]> git.openstreetmap.org Git - rails.git/blob - vendor/assets/iD/iD.js
Update to iD v2.33.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: (a2, b2) => (typeof require !== "undefined" ? require : a2)[b2]
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, options2) {
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     options2 = options2 || {};
255     var body = options2.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 (!options2.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 = options2.credentials || this.credentials || "same-origin";
276     if (options2.headers || !this.headers) {
277       this.headers = new Headers(options2.headers);
278     }
279     this.method = normalizeMethod(options2.method || this.method || "GET");
280     this.mode = options2.mode || this.mode || null;
281     this.signal = options2.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 (options2.cache === "no-store" || options2.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, options2) {
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 (!options2) {
340       options2 = {};
341     }
342     this.type = "default";
343     this.status = options2.status === void 0 ? 200 : options2.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 = options2.statusText === void 0 ? "" : "" + options2.statusText;
349     this.headers = new Headers(options2.headers);
350     this.url = options2.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 options2 = {
365           statusText: xhr.statusText,
366           headers: parseHeaders(xhr.getAllResponseHeaders() || "")
367         };
368         if (request3.url.indexOf("file://") === 0 && (xhr.status < 200 || xhr.status > 599)) {
369           options2.status = 200;
370         } else {
371           options2.status = xhr.status;
372         }
373         options2.url = "responseURL" in xhr ? xhr.responseURL : options2.headers.get("X-Request-URL");
374         var body = "response" in xhr ? xhr.response : xhr.responseText;
375         setTimeout(function() {
376           resolve(new Response(body, options2));
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, a2) {
585           (null == a2 || a2 > r2.length) && (a2 = r2.length);
586           for (var e3 = 0, n3 = Array(a2); e3 < a2; 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(a2, n3) {
597           if (!(a2 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, F2 = function() {
616               };
617               return {
618                 s: F2,
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: F2
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, a2 = true, u2 = false;
636           return {
637             s: function() {
638               t2 = t2.call(r2);
639             },
640             n: function() {
641               var r3 = t2.next();
642               return a2 = r3.done, r3;
643             },
644             e: function(r3) {
645               u2 = true, o2 = r3;
646             },
647             f: function() {
648               try {
649                 a2 || 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, a2) {
727           if (r2) {
728             if ("string" == typeof r2) return _arrayLikeToArray(r2, a2);
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, a2) : 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, options2) {
794               if (!(type2 in this.listeners)) {
795                 this.listeners[type2] = [];
796               }
797               this.listeners[type2].push({
798                 callback,
799                 options: options2
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(_2, 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, options2) {
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(([k2, v2]) => {
1204             return allTags[k2] && (v2 === "*" || allTags[k2] === v2);
1205           })
1206         )) {
1207           return value;
1208         }
1209       }
1210       if (key === "incline" && numeric.test(value)) {
1211         return value.replace(numeric, function(_2, sign2) {
1212           return sign2 === "-" ? "" : "-";
1213         });
1214       } else if (options2 && options2.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(a2, b2) {
1294     return a2 == null || b2 == null ? NaN : a2 < b2 ? -1 : a2 > b2 ? 1 : a2 >= b2 ? 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(a2, b2) {
1303     return a2 == null || b2 == null ? NaN : b2 < a2 ? -1 : b2 > a2 ? 1 : b2 >= a2 ? 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(a2, x2, lo = 0, hi = a2.length) {
1323       if (lo < hi) {
1324         if (compare1(x2, x2) !== 0) return hi;
1325         do {
1326           const mid = lo + hi >>> 1;
1327           if (compare2(a2[mid], x2) < 0) lo = mid + 1;
1328           else hi = mid;
1329         } while (lo < hi);
1330       }
1331       return lo;
1332     }
1333     function right(a2, x2, lo = 0, hi = a2.length) {
1334       if (lo < hi) {
1335         if (compare1(x2, x2) !== 0) return hi;
1336         do {
1337           const mid = lo + hi >>> 1;
1338           if (compare2(a2[mid], x2) <= 0) lo = mid + 1;
1339           else hi = mid;
1340         } while (lo < hi);
1341       }
1342       return lo;
1343     }
1344     function center(a2, x2, lo = 0, hi = a2.length) {
1345       const i3 = left(a2, x2, lo, hi - 1);
1346       return i3 > lo && delta(a2[i3 - 1], x2) > -delta(a2[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 j2 = 0; j2 < this._n && j2 < 32; j2++) {
1413             const y2 = p2[j2], 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 (a2, b2) => {
1450       const x2 = compare2(a2, b2);
1451       if (x2 || x2 === 0) return x2;
1452       return (compare2(b2, b2) === 0) - (compare2(a2, a2) === 0);
1453     };
1454   }
1455   function ascendingDefined(a2, b2) {
1456     return (a2 == null || !(a2 >= a2)) - (b2 == null || !(b2 >= b2)) || (a2 < b2 ? -1 : a2 > b2 ? 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, k2, left = 0, right = Infinity, compare2) {
1569     k2 = Math.floor(k2);
1570     left = Math.floor(Math.max(0, left));
1571     right = Math.floor(Math.min(array2.length - 1, right));
1572     if (!(left <= k2 && k2 <= 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 m2 = k2 - left + 1;
1578         const z2 = Math.log(n3);
1579         const s2 = 0.5 * Math.exp(2 * z2 / 3);
1580         const sd = 0.5 * Math.sqrt(z2 * s2 * (n3 - s2) / n3) * (m2 - n3 / 2 < 0 ? -1 : 1);
1581         const newLeft = Math.max(left, Math.floor(k2 - m2 * s2 / n3 + sd));
1582         const newRight = Math.min(right, Math.floor(k2 + (n3 - m2) * s2 / n3 + sd));
1583         quickselect(array2, k2, newLeft, newRight, compare2);
1584       }
1585       const t2 = array2[k2];
1586       let i3 = left;
1587       let j2 = right;
1588       swap(array2, left, k2);
1589       if (compare2(array2[right], t2) > 0) swap(array2, left, right);
1590       while (i3 < j2) {
1591         swap(array2, i3, j2), ++i3, --j2;
1592         while (compare2(array2[i3], t2) < 0) ++i3;
1593         while (compare2(array2[j2], t2) > 0) --j2;
1594       }
1595       if (compare2(array2[left], t2) === 0) swap(array2, left, j2);
1596       else ++j2, swap(array2, j2, right);
1597       if (j2 <= k2) left = j2 + 1;
1598       if (k2 <= j2) right = j2 - 1;
1599     }
1600     return array2;
1601   }
1602   function swap(array2, i3, j2) {
1603     const t2 = array2[i3];
1604     array2[i3] = array2[j2];
1605     array2[j2] = 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(a2, b2) {
1668     return [a2, b2];
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), k2 = sinPhi0 * sinPhi, u2 = cosPhi0 * cosPhi + k2 * cos(adLambda), v2 = k2 * sdLambda * sin(adLambda);
1834     areaRingSum.add(atan2(v2, 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(a2, b2) {
1881     return a2[0] * b2[0] + a2[1] * b2[1] + a2[2] * b2[2];
1882   }
1883   function cartesianCross(a2, b2) {
1884     return [a2[1] * b2[2] - a2[2] * b2[1], a2[2] * b2[0] - a2[0] * b2[2], a2[0] * b2[1] - a2[1] * b2[0]];
1885   }
1886   function cartesianAddInPlace(a2, b2) {
1887     a2[0] += b2[0], a2[1] += b2[1], a2[2] += b2[2];
1888   }
1889   function cartesianScale(vector, k2) {
1890     return [vector[0] * k2, vector[1] * k2, vector[2] * k2];
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(a2, b2) {
1982     return a2[0] - b2[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, a2, b2, 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, a2 = ranges[0], merged = [a2]; i3 < n3; ++i3) {
1995         b2 = ranges[i3];
1996         if (rangeContains(a2, b2[0]) || rangeContains(a2, b2[1])) {
1997           if (angle(a2[0], b2[1]) > angle(a2[0], a2[1])) a2[1] = b2[1];
1998           if (angle(b2[0], a2[1]) > angle(a2[0], a2[1])) a2[0] = b2[0];
1999         } else {
2000           merged.push(a2 = b2);
2001         }
2002       }
2003       for (deltaMax = -Infinity, n3 = merged.length - 1, i3 = 0, a2 = merged[n3]; i3 <= n3; a2 = b2, ++i3) {
2004         b2 = merged[i3];
2005         if ((delta = angle(a2[1], b2[0])) > deltaMax) deltaMax = delta, lambda02 = b2[0], lambda1 = a2[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(a2, b2) {
2049     function compose(x2, y2) {
2050       return x2 = a2(x2, y2), b2(x2[0], x2[1]);
2051     }
2052     if (a2.invert && b2.invert) compose.invert = function(x2, y2) {
2053       return x2 = b2.invert(x2, y2), x2 && a2.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, z2 = sin(phi), k2 = z2 * cosDeltaPhi + x2 * sinDeltaPhi;
2086       return [
2087         atan2(y2 * cosDeltaGamma - k2 * sinDeltaGamma, x2 * cosDeltaPhi - z2 * sinDeltaPhi),
2088         asin(k2 * cosDeltaGamma + y2 * sinDeltaGamma)
2089       ];
2090     }
2091     rotation.invert = function(lambda, phi) {
2092       var cosPhi = cos(phi), x2 = cos(lambda) * cosPhi, y2 = sin(lambda) * cosPhi, z2 = sin(phi), k2 = z2 * cosDeltaGamma - y2 * sinDeltaGamma;
2093       return [
2094         atan2(y2 * cosDeltaGamma + z2 * sinDeltaGamma, x2 * cosDeltaPhi + k2 * sinDeltaPhi),
2095         asin(k2 * 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, m2) {
2155         line.push([x2, y2, m2]);
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(a2, b2) {
2180     return abs(a2[0] - b2[0]) < epsilon && abs(a2[1] - b2[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, other2, entry) {
2190     this.x = point;
2191     this.z = points;
2192     this.o = other2;
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, a2 = array2[0], b2;
2257     while (++i3 < n3) {
2258       a2.n = b2 = array2[i3];
2259       b2.p = a2;
2260       a2 = b2;
2261     }
2262     a2.n = b2 = array2[0];
2263     b2.p = a2;
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 (!(m2 = (ring = polygon2[i3]).length)) continue;
2283       var ring, m2, point0 = ring[m2 - 1], lambda04 = longitude(point0), phi02 = point0[1] / 2 + quarterPi, sinPhi03 = sin(phi02), cosPhi03 = cos(phi02);
2284       for (var j2 = 0; j2 < m2; ++j2, lambda04 = lambda12, sinPhi03 = sinPhi1, cosPhi03 = cosPhi1, point0 = point1) {
2285         var point1 = ring[j2], lambda12 = longitude(point1), phi12 = point1[1] / 2 + quarterPi, sinPhi1 = sin(phi12), cosPhi1 = cos(phi12), delta = lambda12 - lambda04, sign2 = delta >= 0 ? 1 : -1, absDelta = sign2 * delta, antimeridian = absDelta > pi, k2 = sinPhi03 * sinPhi1;
2286         sum.add(atan2(k2 * sign2 * sin(absDelta), cosPhi03 * cosPhi1 + k2 * 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, m2, 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 ((m2 = segment.length - 1) > 0) {
2384             if (!polygonStarted) sink.polygonStart(), polygonStarted = true;
2385             sink.lineStart();
2386             for (i3 = 0; i3 < m2; ++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(a2, b2) {
2401     return ((a2 = a2.x)[0] < 0 ? a2[1] - halfPi - epsilon : halfPi - a2[1]) - ((b2 = b2.x)[0] < 0 ? b2[1] - halfPi - epsilon : halfPi - b2[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, v2 = visible(lambda, phi), c2 = smallRadius ? v2 ? 0 : code(lambda, phi) : v2 ? code(lambda + (lambda < 0 ? pi : -pi), phi) : 0;
2514           if (!point0 && (v00 = v0 = v2)) stream.lineStart();
2515           if (v2 !== v0) {
2516             point2 = intersect2(point0, point1);
2517             if (!point2 || pointEqual_default(point0, point2) || pointEqual_default(point1, point2))
2518               point1[2] = 1;
2519           }
2520           if (v2 !== v0) {
2521             clean2 = 0;
2522             if (v2) {
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 ^ v2) {
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 (v2 && (!point0 || !pointEqual_default(point0, point1))) {
2550             stream.point(point1[0], point1[1]);
2551           }
2552           point0 = point1, v0 = v2, 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(a2, b2, two) {
2566       var pa = cartesian(a2), pb = cartesian(b2);
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 && a2;
2569       var c1 = cr * n2n2 / determinant, c2 = -cr * n1n2 / determinant, n1xn2 = cartesianCross(n1, n22), A2 = cartesianScale(n1, c1), B2 = cartesianScale(n22, c2);
2570       cartesianAddInPlace(A2, B2);
2571       var u2 = n1xn2, w2 = cartesianDot(A2, u2), uu = cartesianDot(u2, u2), t2 = w2 * w2 - uu * (cartesianDot(A2, A2) - 1);
2572       if (t2 < 0) return;
2573       var t3 = sqrt(t2), q2 = cartesianScale(u2, (-w2 - t3) / uu);
2574       cartesianAddInPlace(q2, A2);
2575       q2 = spherical(q2);
2576       if (!two) return q2;
2577       var lambda04 = a2[0], lambda12 = b2[0], phi02 = a2[1], phi12 = b2[1], z2;
2578       if (lambda12 < lambda04) z2 = lambda04, lambda04 = lambda12, lambda12 = z2;
2579       var delta2 = lambda12 - lambda04, polar = abs(delta2 - pi) < epsilon, meridian = polar || delta2 < epsilon;
2580       if (!polar && phi12 < phi02) z2 = phi02, phi02 = phi12, phi12 = z2;
2581       if (meridian ? polar ? phi02 + phi12 > 0 ^ q2[1] < (abs(q2[0] - lambda04) < epsilon ? phi02 : phi12) : phi02 <= q2[1] && q2[1] <= phi12 : delta2 > pi ^ (lambda04 <= q2[0] && q2[0] <= lambda12)) {
2582         var q1 = cartesianScale(u2, (-w2 + t3) / uu);
2583         cartesianAddInPlace(q1, A2);
2584         return [q2, 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(a2, b2, x05, y05, x12, y12) {
2609     var ax = a2[0], ay = a2[1], bx = b2[0], by = b2[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) a2[0] = ax + t02 * dx, a2[1] = ay + t02 * dy;
2651     if (t12 < 1) b2[0] = ax + t12 * dx, b2[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 a2 = 0, a1 = 0;
2666       if (from == null || (a2 = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoint(from, to) < 0 ^ direction > 0) {
2667         do
2668           stream.point(a2 === 0 || a2 === 3 ? x05 : x12, a2 > 1 ? y12 : y05);
2669         while ((a2 = (a2 + 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(a2, b2) {
2678       return comparePoint(a2.x, b2.x);
2679     }
2680     function comparePoint(a2, b2) {
2681       var ca = corner(a2, 1), cb = corner(b2, 1);
2682       return ca !== cb ? ca - cb : ca === 0 ? b2[1] - a2[1] : ca === 1 ? a2[0] - b2[0] : ca === 2 ? a2[1] - b2[1] : b2[0] - a2[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], j2 = 1, m2 = ring2.length, point2 = ring2[0], a0, a1, b0 = point2[0], b1 = point2[1]; j2 < m2; ++j2) {
2700             a0 = b0, a1 = b1, point2 = ring2[j2], 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 v2 = visible(x2, y2);
2747         if (polygon2) ring.push([x2, y2]);
2748         if (first) {
2749           x__ = x2, y__ = y2, v__ = v2;
2750           first = false;
2751           if (v2) {
2752             activeStream.lineStart();
2753             activeStream.point(x2, y2);
2754           }
2755         } else {
2756           if (v2 && v_) activeStream.point(x2, y2);
2757           else {
2758             var a2 = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))], b2 = [x2 = Math.max(clipMin, Math.min(clipMax, x2)), y2 = Math.max(clipMin, Math.min(clipMax, y2))];
2759             if (line_default(a2, b2, x05, y05, x12, y12)) {
2760               if (!v_) {
2761                 activeStream.lineStart();
2762                 activeStream.point(a2[0], a2[1]);
2763               }
2764               activeStream.point(b2[0], b2[1]);
2765               if (!v2) activeStream.lineEnd();
2766               clean2 = false;
2767             } else if (v2) {
2768               activeStream.lineStart();
2769               activeStream.point(x2, y2);
2770               clean2 = false;
2771             }
2772           }
2773         }
2774         x_ = x2, y_ = y2, v_ = v2;
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, z2 = sinPhi02 * sinPhi + cosPhi02 * cosPhi * cosDelta;
2808     lengthSum.add(atan2(sqrt(x2 * x2 + y2 * y2), z2));
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, z2 = sqrt(dx * dx + dy * dy);
2934     X1 += z2 * (x03 + x2) / 2;
2935     Y1 += z2 * (y03 + y2) / 2;
2936     Z1 += z2;
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, z2 = sqrt(dx * dx + dy * dy);
2954     X1 += z2 * (x03 + x2) / 2;
2955     Y1 += z2 * (y03 + y2) / 2;
2956     Z1 += z2;
2957     z2 = y03 * x2 - x03 * y2;
2958     X2 += z2 * (x03 + x2);
2959     Y2 += z2 * (y03 + y2);
2960     Z2 += z2 * 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(_2) {
3010           return this._radius = _2, 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 j2 = strings.length; i3 < j2; ++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 k2 = 10 ** d2;
3104       cacheDigits = d2;
3105       cacheAppend = function append2(strings) {
3106         let i3 = 1;
3107         this._ += strings[0];
3108         for (const j2 = strings.length; i3 < j2; ++i3) {
3109           this._ += Math.round(arguments[i3] * k2) / k2 + 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(_2) {
3125           this._radius = +_2;
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(_2) {
3205       if (!arguments.length) return projection2;
3206       projectionStream = _2 == null ? (projection2 = null, identity_default) : (projection2 = _2).stream;
3207       return path;
3208     };
3209     path.context = function(_2) {
3210       if (!arguments.length) return context;
3211       contextStream = _2 == null ? (context = null, new PathString(digits)) : new PathContext(context = _2);
3212       if (typeof pointRadius !== "function") contextStream.pointRadius(pointRadius);
3213       return path;
3214     };
3215     path.pointRadius = function(_2) {
3216       if (!arguments.length) return pointRadius;
3217       pointRadius = typeof _2 === "function" ? _2 : (contextStream.pointRadius(+_2), +_2);
3218       return path;
3219     };
3220     path.digits = function(_2) {
3221       if (!arguments.length) return digits;
3222       if (_2 == null) digits = null;
3223       else {
3224         const d2 = Math.floor(_2);
3225         if (!(d2 >= 0)) throw new RangeError(`invalid digits: ${_2}`);
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(b2) {
3300       var w2 = extent[1][0] - extent[0][0], h2 = extent[1][1] - extent[0][1], k2 = Math.min(w2 / (b2[1][0] - b2[0][0]), h2 / (b2[1][1] - b2[0][1])), x2 = +extent[0][0] + (w2 - k2 * (b2[1][0] + b2[0][0])) / 2, y2 = +extent[0][1] + (h2 - k2 * (b2[1][1] + b2[0][1])) / 2;
3301       projection2.scale(150 * k2).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(b2) {
3309       var w2 = +width, k2 = w2 / (b2[1][0] - b2[0][0]), x2 = (w2 - k2 * (b2[1][0] + b2[0][0])) / 2, y2 = -k2 * b2[0][1];
3310       projection2.scale(150 * k2).translate([x2, y2]);
3311     }, object);
3312   }
3313   function fitHeight(projection2, height, object) {
3314     return fit(projection2, function(b2) {
3315       var h2 = +height, k2 = h2 / (b2[1][1] - b2[0][1]), x2 = -k2 * b2[0][0], y2 = (h2 - k2 * (b2[1][1] + b2[0][1])) / 2;
3316       projection2.scale(150 * k2).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 a2 = a0 + a1, b2 = b0 + b1, c2 = c0 + c1, m2 = sqrt(a2 * a2 + b2 * b2 + c2 * c2), phi2 = asin(c2 /= m2), lambda22 = abs(abs(c2) - 1) < epsilon || abs(lambda04 - lambda12) < epsilon ? (lambda04 + lambda12) / 2 : atan2(b2, a2), 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, a2 /= m2, b2 /= m2, c2, depth, stream);
3345           stream.point(x2, y2);
3346           resampleLineTo(x2, y2, lambda22, a2, b2, 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(k2, dx, dy, sx, sy) {
3421     function transform2(x2, y2) {
3422       x2 *= sx;
3423       y2 *= sy;
3424       return [dx + k2 * x2, dy - k2 * y2];
3425     }
3426     transform2.invert = function(x2, y2) {
3427       return [(x2 - dx) / k2 * sx, (dy - y2) / k2 * sy];
3428     };
3429     return transform2;
3430   }
3431   function scaleTranslateRotate(k2, dx, dy, sx, sy, alpha) {
3432     if (!alpha) return scaleTranslate(k2, dx, dy, sx, sy);
3433     var cosAlpha = cos(alpha), sinAlpha = sin(alpha), a2 = cosAlpha * k2, b2 = sinAlpha * k2, ai = cosAlpha / k2, bi = sinAlpha / k2, ci = (sinAlpha * dy - cosAlpha * dx) / k2, fi = (sinAlpha * dx + cosAlpha * dy) / k2;
3434     function transform2(x2, y2) {
3435       x2 *= sx;
3436       y2 *= sy;
3437       return [a2 * x2 - b2 * y2 + dx, dy - b2 * x2 - a2 * 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, k2 = 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(_2) {
3462       return arguments.length ? (preclip = _2, theta = void 0, reset()) : preclip;
3463     };
3464     projection2.postclip = function(_2) {
3465       return arguments.length ? (postclip = _2, x05 = y05 = x12 = y12 = null, reset()) : postclip;
3466     };
3467     projection2.clipAngle = function(_2) {
3468       return arguments.length ? (preclip = +_2 ? circle_default(theta = _2 * radians) : (theta = null, antimeridian_default), reset()) : theta * degrees;
3469     };
3470     projection2.clipExtent = function(_2) {
3471       return arguments.length ? (postclip = _2 == null ? (x05 = y05 = x12 = y12 = null, identity_default) : clipRectangle(x05 = +_2[0][0], y05 = +_2[0][1], x12 = +_2[1][0], y12 = +_2[1][1]), reset()) : x05 == null ? null : [[x05, y05], [x12, y12]];
3472     };
3473     projection2.scale = function(_2) {
3474       return arguments.length ? (k2 = +_2, recenter()) : k2;
3475     };
3476     projection2.translate = function(_2) {
3477       return arguments.length ? (x2 = +_2[0], y2 = +_2[1], recenter()) : [x2, y2];
3478     };
3479     projection2.center = function(_2) {
3480       return arguments.length ? (lambda = _2[0] % 360 * radians, phi = _2[1] % 360 * radians, recenter()) : [lambda * degrees, phi * degrees];
3481     };
3482     projection2.rotate = function(_2) {
3483       return arguments.length ? (deltaLambda = _2[0] % 360 * radians, deltaPhi = _2[1] % 360 * radians, deltaGamma = _2.length > 2 ? _2[2] % 360 * radians : 0, recenter()) : [deltaLambda * degrees, deltaPhi * degrees, deltaGamma * degrees];
3484     };
3485     projection2.angle = function(_2) {
3486       return arguments.length ? (alpha = _2 % 360 * radians, recenter()) : alpha * degrees;
3487     };
3488     projection2.reflectX = function(_2) {
3489       return arguments.length ? (sx = _2 ? -1 : 1, recenter()) : sx < 0;
3490     };
3491     projection2.reflectY = function(_2) {
3492       return arguments.length ? (sy = _2 ? -1 : 1, recenter()) : sy < 0;
3493     };
3494     projection2.precision = function(_2) {
3495       return arguments.length ? (projectResample = resample_default(projectTransform, delta2 = _2 * _2), 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(k2, 0, 0, sx, sy, alpha).apply(null, project(lambda, phi)), transform2 = scaleTranslateRotate(k2, 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 m2 = projection(project), center = m2.center, scale = m2.scale, translate = m2.translate, clipExtent = m2.clipExtent, x05 = null, y05, x12, y12;
3557     m2.scale = function(_2) {
3558       return arguments.length ? (scale(_2), reclip()) : scale();
3559     };
3560     m2.translate = function(_2) {
3561       return arguments.length ? (translate(_2), reclip()) : translate();
3562     };
3563     m2.center = function(_2) {
3564       return arguments.length ? (center(_2), reclip()) : center();
3565     };
3566     m2.clipExtent = function(_2) {
3567       return arguments.length ? (_2 == null ? x05 = y05 = x12 = y12 = null : (x05 = +_2[0][0], y05 = +_2[0][1], x12 = +_2[1][0], y12 = +_2[1][1]), reclip()) : x05 == null ? null : [[x05, y05], [x12, y12]];
3568     };
3569     function reclip() {
3570       var k2 = pi * scale(), t2 = m2(rotation_default(m2.rotate()).invert([0, 0]));
3571       return clipExtent(x05 == null ? [[t2[0] - k2, t2[1] - k2], [t2[0] + k2, t2[1] + k2]] : project === mercatorRaw ? [[Math.max(t2[0] - k2, x05), y05], [Math.min(t2[0] + k2, x12), y12]] : [[x05, Math.max(t2[1] - k2, y05)], [x12, Math.min(t2[1] + k2, 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 k2 = 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 = k2 * sx;
3596       ky = k2 * 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(_2) {
3622       return arguments.length ? (postclip = _2, x05 = y05 = x12 = y12 = null, reset()) : postclip;
3623     };
3624     projection2.clipExtent = function(_2) {
3625       return arguments.length ? (postclip = _2 == null ? (x05 = y05 = x12 = y12 = null, identity_default) : clipRectangle(x05 = +_2[0][0], y05 = +_2[0][1], x12 = +_2[1][0], y12 = +_2[1][1]), reset()) : x05 == null ? null : [[x05, y05], [x12, y12]];
3626     };
3627     projection2.scale = function(_2) {
3628       return arguments.length ? (k2 = +_2, reset()) : k2;
3629     };
3630     projection2.translate = function(_2) {
3631       return arguments.length ? (tx = +_2[0], ty = +_2[1], reset()) : [tx, ty];
3632     };
3633     projection2.angle = function(_2) {
3634       return arguments.length ? (alpha = _2 % 360 * radians, sa = sin(alpha), ca = cos(alpha), reset()) : alpha * degrees;
3635     };
3636     projection2.reflectX = function(_2) {
3637       return arguments.length ? (sx = _2 ? -1 : 1, reset()) : sx < 0;
3638     };
3639     projection2.reflectY = function(_2) {
3640       return arguments.length ? (sy = _2 ? -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(m2) {
3702     return m2 / (TAU * POLAR_RADIUS / 360);
3703   }
3704   function geoMetersToLon(m2, atLat) {
3705     return Math.abs(atLat) >= 90 ? 0 : m2 / (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(a2, b2) {
3722     var x2 = geoLonToMeters(a2[0] - b2[0], (a2[1] + b2[1]) / 2);
3723     var y2 = geoLatToMeters(a2[1] - b2[1]);
3724     return Math.sqrt(x2 * x2 + y2 * y2);
3725   }
3726   function geoScaleToZoom(k2, tileSize) {
3727     tileSize = tileSize || 256;
3728     var log2ts = Math.log(tileSize) * Math.LOG2E;
3729     return Math.log(k2 * TAU) / Math.LN2 - log2ts;
3730   }
3731   function geoZoomToScale(z2, tileSize) {
3732     tileSize = tileSize || 256;
3733     return tileSize * Math.pow(2, z2) / 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 a2 = this.area();
3841           if (a1 === Infinity || a2 === Infinity) {
3842             return 0;
3843           } else if (a1 === 0 || a2 === 0) {
3844             if (obj.contains(this)) {
3845               return 1;
3846             }
3847             return 0;
3848           } else {
3849             return a1 / a2;
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, a2, b2 = polygon2[n3 - 1], area = 0;
3879     while (++i3 < n3) {
3880       a2 = b2;
3881       b2 = polygon2[i3];
3882       area += a2[1] * b2[0] - a2[0] * b2[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, a2, b2 = polygon2[n3 - 1], c2, k2 = 0;
3894     while (++i3 < n3) {
3895       a2 = b2;
3896       b2 = polygon2[i3];
3897       k2 += c2 = a2[0] * b2[1] - b2[0] * a2[1];
3898       x2 += (a2[0] + b2[0]) * c2;
3899       y2 += (a2[1] + b2[1]) * c2;
3900     }
3901     return k2 *= 3, [x2 / k2, y2 / k2];
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(a2, b2, c2) {
3910     return (b2[0] - a2[0]) * (c2[1] - a2[1]) - (b2[1] - a2[1]) * (c2[0] - a2[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(a2, b2) {
3919     return a2[0] - b2[0] || a2[1] - b2[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(a2, b2, epsilon3) {
3976     if (epsilon3) {
3977       return Math.abs(a2[0] - b2[0]) <= epsilon3 && Math.abs(a2[1] - b2[1]) <= epsilon3;
3978     } else {
3979       return a2[0] === b2[0] && a2[1] === b2[1];
3980     }
3981   }
3982   function geoVecAdd(a2, b2) {
3983     return [a2[0] + b2[0], a2[1] + b2[1]];
3984   }
3985   function geoVecSubtract(a2, b2) {
3986     return [a2[0] - b2[0], a2[1] - b2[1]];
3987   }
3988   function geoVecScale(a2, mag) {
3989     return [a2[0] * mag, a2[1] * mag];
3990   }
3991   function geoVecFloor(a2) {
3992     return [Math.floor(a2[0]), Math.floor(a2[1])];
3993   }
3994   function geoVecInterp(a2, b2, t2) {
3995     return [
3996       a2[0] + (b2[0] - a2[0]) * t2,
3997       a2[1] + (b2[1] - a2[1]) * t2
3998     ];
3999   }
4000   function geoVecLength(a2, b2) {
4001     return Math.sqrt(geoVecLengthSquare(a2, b2));
4002   }
4003   function geoVecLengthSquare(a2, b2) {
4004     b2 = b2 || [0, 0];
4005     var x2 = a2[0] - b2[0];
4006     var y2 = a2[1] - b2[1];
4007     return x2 * x2 + y2 * y2;
4008   }
4009   function geoVecNormalize(a2) {
4010     var length2 = Math.sqrt(a2[0] * a2[0] + a2[1] * a2[1]);
4011     if (length2 !== 0) {
4012       return geoVecScale(a2, 1 / length2);
4013     }
4014     return [0, 0];
4015   }
4016   function geoVecAngle(a2, b2) {
4017     return Math.atan2(b2[1] - a2[1], b2[0] - a2[0]);
4018   }
4019   function geoVecDot(a2, b2, origin) {
4020     origin = origin || [0, 0];
4021     var p2 = geoVecSubtract(a2, origin);
4022     var q2 = geoVecSubtract(b2, origin);
4023     return p2[0] * q2[0] + p2[1] * q2[1];
4024   }
4025   function geoVecNormalizedDot(a2, b2, origin) {
4026     origin = origin || [0, 0];
4027     var p2 = geoVecNormalize(geoVecSubtract(a2, origin));
4028     var q2 = geoVecNormalize(geoVecSubtract(b2, origin));
4029     return geoVecDot(p2, q2);
4030   }
4031   function geoVecCross(a2, b2, origin) {
4032     origin = origin || [0, 0];
4033     var p2 = geoVecSubtract(a2, origin);
4034     var q2 = geoVecSubtract(b2, origin);
4035     return p2[0] * q2[1] - p2[1] * q2[0];
4036   }
4037   function geoVecProject(a2, 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 v2 = geoVecSubtract(a2, o2);
4045       var proj = geoVecDot(v2, 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, a2);
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(a2, b2, projection2) {
4093     return geoVecAngle(projection2(a2.loc), projection2(b2.loc));
4094   }
4095   function geoEdgeEqual(a2, b2) {
4096     return a2[0] === b2[0] && a2[1] === b2[1] || a2[0] === b2[1] && a2[1] === b2[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 v2 = geoVecSubtract(point, o2);
4123       var proj = geoVecDot(v2, 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 j2, k2, n1, n22, segment;
4149     for (j2 = 0; j2 < activeNodes.length - 1; j2++) {
4150       n1 = activeNodes[j2];
4151       n22 = activeNodes[j2 + 1];
4152       segment = [n1.loc, n22.loc];
4153       if (n1.id === activeID || n22.id === activeID) {
4154         actives.push(segment);
4155       }
4156     }
4157     for (j2 = 0; j2 < inactiveNodes.length - 1; j2++) {
4158       n1 = inactiveNodes[j2];
4159       n22 = inactiveNodes[j2 + 1];
4160       segment = [n1.loc, n22.loc];
4161       inactives.push(segment);
4162     }
4163     for (j2 = 0; j2 < actives.length; j2++) {
4164       for (k2 = 0; k2 < inactives.length; k2++) {
4165         var p2 = actives[j2];
4166         var q2 = inactives[k2];
4167         var hit = geoLineIntersection(p2, q2);
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 j2, k2;
4179     for (j2 = 0; j2 < nodes.length - 1; j2++) {
4180       var n1 = nodes[j2];
4181       var n22 = nodes[j2 + 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 (j2 = 0; j2 < actives.length; j2++) {
4190       for (k2 = 0; k2 < inactives.length; k2++) {
4191         var p2 = actives[j2];
4192         var q2 = inactives[k2];
4193         if (geoVecEqual(p2[1], q2[0]) || geoVecEqual(p2[0], q2[1]) || geoVecEqual(p2[0], q2[0]) || geoVecEqual(p2[1], q2[1])) {
4194           continue;
4195         }
4196         var hit = geoLineIntersection(p2, q2);
4197         if (hit) {
4198           var epsilon3 = 1e-8;
4199           if (geoVecEqual(p2[1], hit, epsilon3) || geoVecEqual(p2[0], hit, epsilon3) || geoVecEqual(q2[1], hit, epsilon3) || geoVecEqual(q2[0], hit, epsilon3)) {
4200             continue;
4201           } else {
4202             return true;
4203           }
4204         }
4205       }
4206     }
4207     return false;
4208   }
4209   function geoLineIntersection(a2, b2) {
4210     var p2 = [a2[0][0], a2[0][1]];
4211     var p22 = [a2[1][0], a2[1][1]];
4212     var q2 = [b2[0][0], b2[0][1]];
4213     var q22 = [b2[1][0], b2[1][1]];
4214     var r2 = geoVecSubtract(p22, p2);
4215     var s2 = geoVecSubtract(q22, q2);
4216     var uNumerator = geoVecCross(geoVecSubtract(q2, p2), r2);
4217     var denominator = geoVecCross(r2, s2);
4218     if (uNumerator && denominator) {
4219       var u2 = uNumerator / denominator;
4220       var t2 = geoVecCross(geoVecSubtract(q2, 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 j2 = 0; j2 < path2.length - 1; j2++) {
4231         var a2 = [path1[i3], path1[i3 + 1]];
4232         var b2 = [path2[j2], path2[j2 + 1]];
4233         var hit = geoLineIntersection(a2, b2);
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 j2 = 0; j2 < path2.length - 1; j2++) {
4244         var a2 = [path1[i3], path1[i3 + 1]];
4245         var b2 = [path2[j2], path2[j2 + 1]];
4246         var hit = geoLineIntersection(a2, b2);
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, j2 = polygon2.length - 1; i3 < polygon2.length; j2 = i3++) {
4259       var xi = polygon2[i3][0];
4260       var yi = polygon2[i3][1];
4261       var xj = polygon2[j2][0];
4262       var yj = polygon2[j2][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, _2 = {}, t2; i3 < n3; ++i3) {
4349       if (!(t2 = arguments[i3] + "") || t2 in _2 || /[\s.]/.test(t2)) throw new Error("illegal type: " + t2);
4350       _2[t2] = [];
4351     }
4352     return new Dispatch(_2);
4353   }
4354   function Dispatch(_2) {
4355     this._ = _2;
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 _2 = this._, T2 = parseTypenames(typename + "", _2), t2, i3 = -1, n3 = T2.length;
4391           if (arguments.length < 2) {
4392             while (++i3 < n3) if ((t2 = (typename = T2[i3]).type) && (t2 = get(_2[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 = T2[i3]).type) _2[t2] = set(_2[t2], typename.name, callback);
4398             else if (callback == null) for (t2 in _2) _2[t2] = set(_2[t2], typename.name, null);
4399           }
4400           return this;
4401         },
4402         copy: function() {
4403           var copy2 = {}, _2 = this._;
4404           for (var t2 in _2) copy2[t2] = _2[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, m2 = groups.length, subgroups = new Array(m2), j2 = 0; j2 < m2; ++j2) {
4495       for (var group = groups[j2], n3 = group.length, subgroup = subgroups[j2] = 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, m2 = groups.length, subgroups = [], parents = [], j2 = 0; j2 < m2; ++j2) {
4544       for (var group = groups[j2], 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, m2 = groups.length, subgroups = new Array(m2), j2 = 0; j2 < m2; ++j2) {
4621       for (var group = groups[j2], n3 = group.length, subgroup = subgroups[j2] = [], 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(parent, datum2) {
4650     this.ownerDocument = parent.ownerDocument;
4651     this.namespaceURI = parent.namespaceURI;
4652     this._next = null;
4653     this._parent = parent;
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(parent, 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(parent, data[i3]);
4698       }
4699     }
4700     for (; i3 < groupLength; ++i3) {
4701       if (node = group[i3]) {
4702         exit[i3] = node;
4703       }
4704     }
4705   }
4706   function bindKey(parent, 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(parent, 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(parent, 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 m2 = groups.length, update = new Array(m2), enter = new Array(m2), exit = new Array(m2), j2 = 0; j2 < m2; ++j2) {
4742       var parent = parents[j2], group = groups[j2], groupLength = group.length, data = arraylike(value.call(parent, parent && parent.__data__, j2, parents)), dataLength = data.length, enterGroup = enter[j2] = new Array(dataLength), updateGroup = update[j2] = new Array(dataLength), exitGroup = exit[j2] = new Array(groupLength);
4743       bind(parent, 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, m2 = Math.min(m0, m1), merges = new Array(m0), j2 = 0; j2 < m2; ++j2) {
4805       for (var group0 = groups0[j2], group1 = groups1[j2], n3 = group0.length, merge3 = merges[j2] = 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 (; j2 < m0; ++j2) {
4812       merges[j2] = groups0[j2];
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, j2 = -1, m2 = groups.length; ++j2 < m2; ) {
4825       for (var group = groups[j2], 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(a2, b2) {
4843       return a2 && b2 ? compare2(a2.__data__, b2.__data__) : !a2 - !b2;
4844     }
4845     for (var groups = this._groups, m2 = groups.length, sortgroups = new Array(m2), j2 = 0; j2 < m2; ++j2) {
4846       for (var group = groups[j2], n3 = group.length, sortgroup = sortgroups[j2] = 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(a2, b2) {
4856     return a2 < b2 ? -1 : a2 > b2 ? 1 : a2 >= b2 ? 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, j2 = 0, m2 = groups.length; j2 < m2; ++j2) {
4888       for (var group = groups[j2], 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, j2 = 0, m2 = groups.length; j2 < m2; ++j2) {
4923       for (var group = groups[j2], 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 v2 = value.apply(this, arguments);
4958       if (v2 == null) this.removeAttribute(name);
4959       else this.setAttribute(name, v2);
4960     };
4961   }
4962   function attrFunctionNS(fullname, value) {
4963     return function() {
4964       var v2 = value.apply(this, arguments);
4965       if (v2 == null) this.removeAttributeNS(fullname.space, fullname.local);
4966       else this.setAttributeNS(fullname.space, fullname.local, v2);
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 v2 = value.apply(this, arguments);
5006       if (v2 == null) this.style.removeProperty(name);
5007       else this.style.setProperty(name, v2, 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 v2 = value.apply(this, arguments);
5036       if (v2 == null) delete this[name];
5037       else this[name] = v2;
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 list2 = classList(node), i3 = -1, n3 = names.length;
5061     while (++i3 < n3) list2.add(names[i3]);
5062   }
5063   function classedRemove(node, names) {
5064     var list2 = classList(node), i3 = -1, n3 = names.length;
5065     while (++i3 < n3) list2.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 list2 = classList(this.node()), i3 = -1, n3 = names.length;
5086       while (++i3 < n3) if (!list2.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 v2 = value.apply(this, arguments);
5127       this.textContent = v2 == null ? "" : v2;
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 v2 = value.apply(this, arguments);
5150       this.innerHTML = v2 == null ? "" : v2;
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 parent = this.parentNode;
5218     if (parent) parent.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), parent = this.parentNode;
5231     return parent ? parent.insertBefore(clone2, this.nextSibling) : clone2;
5232   }
5233   function selection_cloneDeep() {
5234     var clone2 = this.cloneNode(true), parent = this.parentNode;
5235     return parent ? parent.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 j2 = 0, i3 = -1, m2 = on.length, o2; j2 < m2; ++j2) {
5272         if (o2 = on[j2], (!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, options2) {
5283     return function() {
5284       var on = this.__on, o2, listener = contextListener(value);
5285       if (on) for (var j2 = 0, m2 = on.length; j2 < m2; ++j2) {
5286         if ((o2 = on[j2]).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 = options2);
5289           o2.value = value;
5290           return;
5291         }
5292       }
5293       this.addEventListener(typename.type, listener, options2);
5294       o2 = { type: typename.type, name: typename.name, value, listener, options: options2 };
5295       if (!on) this.__on = [o2];
5296       else on.push(o2);
5297     };
5298   }
5299   function on_default(typename, value, options2) {
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 j2 = 0, m2 = on.length, o2; j2 < m2; ++j2) {
5304         for (i3 = 0, o2 = on[j2]; 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, options2));
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, j2 = 0, m2 = groups.length; j2 < m2; ++j2) {
5355       for (var group = groups[j2], 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(_2) {
5744       return arguments.length ? (filter2 = typeof _2 === "function" ? _2 : constant_default2(!!_2), drag) : filter2;
5745     };
5746     drag.container = function(_2) {
5747       return arguments.length ? (container = typeof _2 === "function" ? _2 : constant_default2(_2), drag) : container;
5748     };
5749     drag.subject = function(_2) {
5750       return arguments.length ? (subject = typeof _2 === "function" ? _2 : constant_default2(_2), drag) : subject;
5751     };
5752     drag.touchable = function(_2) {
5753       return arguments.length ? (touchable = typeof _2 === "function" ? _2 : constant_default2(!!_2), 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(_2) {
5760       return arguments.length ? (clickDistance2 = (_2 = +_2) * _2, 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(parent, definition) {
5789     var prototype4 = Object.create(parent.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 m2, l2;
5815     format2 = (format2 + "").trim().toLowerCase();
5816     return (m2 = reHex.exec(format2)) ? (l2 = m2[1].length, m2 = parseInt(m2[1], 16), l2 === 6 ? rgbn(m2) : l2 === 3 ? new Rgb(m2 >> 8 & 15 | m2 >> 4 & 240, m2 >> 4 & 15 | m2 & 240, (m2 & 15) << 4 | m2 & 15, 1) : l2 === 8 ? rgba(m2 >> 24 & 255, m2 >> 16 & 255, m2 >> 8 & 255, (m2 & 255) / 255) : l2 === 4 ? rgba(m2 >> 12 & 15 | m2 >> 8 & 240, m2 >> 8 & 15 | m2 >> 4 & 240, m2 >> 4 & 15 | m2 & 240, ((m2 & 15) << 4 | m2 & 15) / 255) : null) : (m2 = reRgbInteger.exec(format2)) ? new Rgb(m2[1], m2[2], m2[3], 1) : (m2 = reRgbPercent.exec(format2)) ? new Rgb(m2[1] * 255 / 100, m2[2] * 255 / 100, m2[3] * 255 / 100, 1) : (m2 = reRgbaInteger.exec(format2)) ? rgba(m2[1], m2[2], m2[3], m2[4]) : (m2 = reRgbaPercent.exec(format2)) ? rgba(m2[1] * 255 / 100, m2[2] * 255 / 100, m2[3] * 255 / 100, m2[4]) : (m2 = reHslPercent.exec(format2)) ? hsla(m2[1], m2[2] / 100, m2[3] / 100, 1) : (m2 = reHslaPercent.exec(format2)) ? hsla(m2[1], m2[2] / 100, m2[3] / 100, m2[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, b2, a2) {
5822     if (a2 <= 0) r2 = g3 = b2 = NaN;
5823     return new Rgb(r2, g3, b2, a2);
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, b2, opacity) {
5832     return arguments.length === 1 ? rgbConvert(r2) : new Rgb(r2, g3, b2, opacity == null ? 1 : opacity);
5833   }
5834   function Rgb(r2, g3, b2, opacity) {
5835     this.r = +r2;
5836     this.g = +g3;
5837     this.b = +b2;
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 a2 = clampa(this.opacity);
5848     return `${a2 === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a2 === 1 ? ")" : `, ${a2})`}`;
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(h2, s2, l2, a2) {
5861     if (a2 <= 0) h2 = s2 = l2 = NaN;
5862     else if (l2 <= 0 || l2 >= 1) h2 = s2 = NaN;
5863     else if (s2 <= 0) h2 = NaN;
5864     return new Hsl(h2, s2, l2, a2);
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, b2 = o2.b / 255, min3 = Math.min(r2, g3, b2), max3 = Math.max(r2, g3, b2), h2 = NaN, s2 = max3 - min3, l2 = (max3 + min3) / 2;
5873     if (s2) {
5874       if (r2 === max3) h2 = (g3 - b2) / s2 + (g3 < b2) * 6;
5875       else if (g3 === max3) h2 = (b2 - r2) / s2 + 2;
5876       else h2 = (r2 - g3) / s2 + 4;
5877       s2 /= l2 < 0.5 ? max3 + min3 : 2 - max3 - min3;
5878       h2 *= 60;
5879     } else {
5880       s2 = l2 > 0 && l2 < 1 ? 0 : h2;
5881     }
5882     return new Hsl(h2, s2, l2, o2.opacity);
5883   }
5884   function hsl(h2, s2, l2, opacity) {
5885     return arguments.length === 1 ? hslConvert(h2) : new Hsl(h2, s2, l2, opacity == null ? 1 : opacity);
5886   }
5887   function Hsl(h2, s2, l2, opacity) {
5888     this.h = +h2;
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(h2, m1, m2) {
5901     return (h2 < 60 ? m1 + (m2 - m1) * h2 / 60 : h2 < 180 ? m2 : h2 < 240 ? m1 + (m2 - m1) * (240 - h2) / 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(k2) {
6086           k2 = k2 == null ? brighter : Math.pow(brighter, k2);
6087           return new Rgb(this.r * k2, this.g * k2, this.b * k2, this.opacity);
6088         },
6089         darker(k2) {
6090           k2 = k2 == null ? darker : Math.pow(darker, k2);
6091           return new Rgb(this.r * k2, this.g * k2, this.b * k2, 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(k2) {
6111           k2 = k2 == null ? brighter : Math.pow(brighter, k2);
6112           return new Hsl(this.h, this.s, this.l * k2, this.opacity);
6113         },
6114         darker(k2) {
6115           k2 = k2 == null ? darker : Math.pow(darker, k2);
6116           return new Hsl(this.h, this.s, this.l * k2, this.opacity);
6117         },
6118         rgb() {
6119           var h2 = this.h % 360 + (this.h < 0) * 360, s2 = isNaN(h2) || isNaN(this.s) ? 0 : this.s, l2 = this.l, m2 = l2 + (l2 < 0.5 ? l2 : 1 - l2) * s2, m1 = 2 * l2 - m2;
6120           return new Rgb(
6121             hsl2rgb(h2 >= 240 ? h2 - 240 : h2 + 120, m1, m2),
6122             hsl2rgb(h2, m1, m2),
6123             hsl2rgb(h2 < 120 ? h2 + 240 : h2 - 120, m1, m2),
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 a2 = clampa(this.opacity);
6135           return `${a2 === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a2 === 1 ? ")" : `, ${a2})`}`;
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, v2, 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) * v2 + 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], v2 = values[i3 + 1], v0 = i3 > 0 ? values[i3 - 1] : 2 * v1 - v2, v3 = i3 < n3 - 1 ? values[i3 + 2] : 2 * v2 - v1;
6157       return basis((t2 - i3 / n3) * n3, v0, v1, v2, 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], v2 = values[(i3 + 1) % n3], v3 = values[(i3 + 2) % n3];
6170       return basis((t2 - i3 / n3) * n3, v0, v1, v2, 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(a2, d2) {
6189     return function(t2) {
6190       return a2 + t2 * d2;
6191     };
6192   }
6193   function exponential(a2, b2, y2) {
6194     return a2 = Math.pow(a2, y2), b2 = Math.pow(b2, y2) - a2, y2 = 1 / y2, function(t2) {
6195       return Math.pow(a2 + t2 * b2, y2);
6196     };
6197   }
6198   function gamma(y2) {
6199     return (y2 = +y2) === 1 ? nogamma : function(a2, b2) {
6200       return b2 - a2 ? exponential(a2, b2, y2) : constant_default3(isNaN(a2) ? b2 : a2);
6201     };
6202   }
6203   function nogamma(a2, b2) {
6204     var d2 = b2 - a2;
6205     return d2 ? linear(a2, d2) : constant_default3(isNaN(a2) ? b2 : a2);
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), b2 = 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         b2[i3] = color2.b || 0;
6222       }
6223       r2 = spline(r2);
6224       g3 = spline(g3);
6225       b2 = spline(b2);
6226       color2.opacity = 1;
6227       return function(t2) {
6228         color2.r = r2(t2);
6229         color2.g = g3(t2);
6230         color2.b = b2(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), b2 = 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 = b2(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(a2, b2) {
6264     if (!b2) b2 = [];
6265     var n3 = a2 ? Math.min(b2.length, a2.length) : 0, c2 = b2.slice(), i3;
6266     return function(t2) {
6267       for (i3 = 0; i3 < n3; ++i3) c2[i3] = a2[i3] * (1 - t2) + b2[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(a2, b2) {
6281     var nb = b2 ? b2.length : 0, na = a2 ? Math.min(nb, a2.length) : 0, x2 = new Array(na), c2 = new Array(nb), i3;
6282     for (i3 = 0; i3 < na; ++i3) x2[i3] = value_default(a2[i3], b2[i3]);
6283     for (; i3 < nb; ++i3) c2[i3] = b2[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(a2, b2) {
6297     var d2 = /* @__PURE__ */ new Date();
6298     return a2 = +a2, b2 = +b2, function(t2) {
6299       return d2.setTime(a2 * (1 - t2) + b2 * 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(a2, b2) {
6309     return a2 = +a2, b2 = +b2, function(t2) {
6310       return a2 * (1 - t2) + b2 * 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(a2, b2) {
6320     var i3 = {}, c2 = {}, k2;
6321     if (a2 === null || typeof a2 !== "object") a2 = {};
6322     if (b2 === null || typeof b2 !== "object") b2 = {};
6323     for (k2 in b2) {
6324       if (k2 in a2) {
6325         i3[k2] = value_default(a2[k2], b2[k2]);
6326       } else {
6327         c2[k2] = b2[k2];
6328       }
6329     }
6330     return function(t2) {
6331       for (k2 in i3) c2[k2] = i3[k2](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(b2) {
6343     return function() {
6344       return b2;
6345     };
6346   }
6347   function one(b2) {
6348     return function(t2) {
6349       return b2(t2) + "";
6350     };
6351   }
6352   function string_default(a2, b2) {
6353     var bi = reA.lastIndex = reB.lastIndex = 0, am, bm, bs, i3 = -1, s2 = [], q2 = [];
6354     a2 = a2 + "", b2 = b2 + "";
6355     while ((am = reA.exec(a2)) && (bm = reB.exec(b2))) {
6356       if ((bs = bm.index) > bi) {
6357         bs = b2.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         q2.push({ i: i3, x: number_default(am, bm) });
6367       }
6368       bi = reB.lastIndex;
6369     }
6370     if (bi < b2.length) {
6371       bs = b2.slice(bi);
6372       if (s2[i3]) s2[i3] += bs;
6373       else s2[++i3] = bs;
6374     }
6375     return s2.length < 2 ? q2[0] ? one(q2[0].x) : zero2(b2) : (b2 = q2.length, function(t2) {
6376       for (var i4 = 0, o2; i4 < b2; ++i4) s2[(o2 = q2[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(a2, b2) {
6391     var t2 = typeof b2, c2;
6392     return b2 == null || t2 === "boolean" ? constant_default3(b2) : (t2 === "number" ? number_default : t2 === "string" ? (c2 = color(b2)) ? (b2 = c2, rgb_default) : string_default : b2 instanceof color ? rgb_default : b2 instanceof Date ? date_default : isNumberArray(b2) ? numberArray_default : Array.isArray(b2) ? genericArray : typeof b2.valueOf !== "function" && typeof b2.toString !== "function" || isNaN(b2) ? object_default : number_default)(a2, b2);
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(a2, b2) {
6410     return a2 = +a2, b2 = +b2, function(t2) {
6411       return Math.round(a2 * (1 - t2) + b2 * 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(a2, b2, c2, d2, e3, f2) {
6421     var scaleX, scaleY, skewX;
6422     if (scaleX = Math.sqrt(a2 * a2 + b2 * b2)) a2 /= scaleX, b2 /= scaleX;
6423     if (skewX = a2 * c2 + b2 * d2) c2 -= a2 * skewX, d2 -= b2 * skewX;
6424     if (scaleY = Math.sqrt(c2 * c2 + d2 * d2)) c2 /= scaleY, d2 /= scaleY, skewX /= scaleY;
6425     if (a2 * d2 < b2 * c2) a2 = -a2, b2 = -b2, skewX = -skewX, scaleX = -scaleX;
6426     return {
6427       translateX: e3,
6428       translateY: f2,
6429       rotate: Math.atan2(b2, a2) * 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 m2 = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value + "");
6453     return m2.isIdentity ? identity : decompose_default(m2.a, m2.b, m2.c, m2.d, m2.e, m2.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, q2) {
6476       if (xa !== xb || ya !== yb) {
6477         var i3 = s2.push("translate(", null, pxComma, null, pxParen);
6478         q2.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(a2, b2, s2, q2) {
6484       if (a2 !== b2) {
6485         if (a2 - b2 > 180) b2 += 360;
6486         else if (b2 - a2 > 180) a2 += 360;
6487         q2.push({ i: s2.push(pop(s2) + "rotate(", null, degParen) - 2, x: number_default(a2, b2) });
6488       } else if (b2) {
6489         s2.push(pop(s2) + "rotate(" + b2 + degParen);
6490       }
6491     }
6492     function skewX(a2, b2, s2, q2) {
6493       if (a2 !== b2) {
6494         q2.push({ i: s2.push(pop(s2) + "skewX(", null, degParen) - 2, x: number_default(a2, b2) });
6495       } else if (b2) {
6496         s2.push(pop(s2) + "skewX(" + b2 + degParen);
6497       }
6498     }
6499     function scale(xa, ya, xb, yb, s2, q2) {
6500       if (xa !== xb || ya !== yb) {
6501         var i3 = s2.push(pop(s2) + "scale(", null, ",", null, ")");
6502         q2.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(a2, b2) {
6508       var s2 = [], q2 = [];
6509       a2 = parse(a2), b2 = parse(b2);
6510       translate(a2.translateX, a2.translateY, b2.translateX, b2.translateY, s2, q2);
6511       rotate(a2.rotate, b2.rotate, s2, q2);
6512       skewX(a2.skewX, b2.skewX, s2, q2);
6513       scale(a2.scaleX, a2.scaleY, b2.scaleX, b2.scaleY, s2, q2);
6514       a2 = b2 = null;
6515       return function(t2) {
6516         var i3 = -1, n3 = q2.length, o2;
6517         while (++i3 < n3) s2[(o2 = q2[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, S2;
6549           if (d2 < epsilon22) {
6550             S2 = 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 * S2)
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             S2 = (r1 - r0) / rho;
6561             i3 = function(t2) {
6562               var s2 = t2 * S2, 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 = S2 * 1e3 * rho / Math.SQRT2;
6571           return i3;
6572         }
6573         zoom.rho = function(_2) {
6574           var _1 = Math.max(1e-3, +_2), _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, j2, 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, j2 = -1; i3 < n3; ++i3) {
6813         if (o2 = self2.tween[i3].value.call(node, node.__data__, self2.index, self2.group)) {
6814           tween[++j2] = o2;
6815         }
6816       }
6817       tween.length = j2 + 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(a2, b2) {
6958     var c2;
6959     return (typeof b2 === "number" ? number_default : b2 instanceof color ? rgb_default : (c2 = color(b2)) ? (b2 = c2, rgb_default) : string_default)(a2, b2);
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 v2 = value.apply(this, arguments);
7134       if (typeof v2 !== "function") throw new Error();
7135       set2(this, id2).ease = v2;
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, m2 = groups.length, subgroups = new Array(m2), j2 = 0; j2 < m2; ++j2) {
7152       for (var group = groups[j2], n3 = group.length, subgroup = subgroups[j2] = [], 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, m2 = Math.min(m0, m1), merges = new Array(m0), j2 = 0; j2 < m2; ++j2) {
7171       for (var group0 = groups0[j2], group1 = groups1[j2], n3 = group0.length, merge3 = merges[j2] = 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 (; j2 < m0; ++j2) {
7178       merges[j2] = groups0[j2];
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 parent = this.parentNode;
7218       for (var i3 in this.__transition) if (+i3 !== id2) return;
7219       if (parent) parent.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, m2 = groups.length, subgroups = new Array(m2), j2 = 0; j2 < m2; ++j2) {
7235       for (var group = groups[j2], n3 = group.length, subgroup = subgroups[j2] = 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, m2 = groups.length, subgroups = [], parents = [], j2 = 0; j2 < m2; ++j2) {
7258       for (var group = groups[j2], 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), k2 = 0, l2 = children2.length; k2 < l2; ++k2) {
7261             if (child = children2[k2]) {
7262               schedule_default(child, name, id2, k2, 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, m2 = groups.length, j2 = 0; j2 < m2; ++j2) {
7423       for (var group = groups[j2], 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, m2 = groups.length, j2 = 0; j2 < m2; ++j2) {
7587       for (var group = groups[j2], 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(k2, x2, y2) {
7661     this.k = k2;
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(k2) {
7675           return k2 === 1 ? this : new Transform(this.k * k2, 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, k2, p2, event) {
7775       zoom.scaleTo(selection2, function() {
7776         var k0 = this.__zoom.k, k1 = typeof k2 === "function" ? k2.apply(this, arguments) : k2;
7777         return k0 * k1;
7778       }, p2, event);
7779     };
7780     zoom.scaleTo = function(selection2, k2, 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 k2 === "function" ? k2.apply(this, arguments) : k2;
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, k2) {
7804       k2 = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k2));
7805       return k2 === transform2.k ? transform2 : new Transform(k2, 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, w2 = Math.max(e3[1][0] - e3[0][0], e3[1][1] - e3[0][1]), a2 = that.__zoom, b2 = typeof transform2 === "function" ? transform2.apply(that, args) : transform2, i3 = interpolate(a2.invert(p2).concat(w2 / a2.k), b2.invert(p2).concat(w2 / b2.k));
7821         return function(t2) {
7822           if (t2 === 1) t2 = b2;
7823           else {
7824             var l2 = i3(t2), k2 = w2 / l2[2];
7825             t2 = new Transform(k2, p2[0] - l2[0] * k2, p2[1] - l2[1] * k2);
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, k2 = 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 === k2) 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, k2), 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), v2 = 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         v2.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(_2) {
8002       return arguments.length ? (wheelDelta = typeof _2 === "function" ? _2 : constant_default4(+_2), zoom) : wheelDelta;
8003     };
8004     zoom.filter = function(_2) {
8005       return arguments.length ? (filter2 = typeof _2 === "function" ? _2 : constant_default4(!!_2), zoom) : filter2;
8006     };
8007     zoom.touchable = function(_2) {
8008       return arguments.length ? (touchable = typeof _2 === "function" ? _2 : constant_default4(!!_2), zoom) : touchable;
8009     };
8010     zoom.extent = function(_2) {
8011       return arguments.length ? (extent = typeof _2 === "function" ? _2 : constant_default4([[+_2[0][0], +_2[0][1]], [+_2[1][0], +_2[1][1]]]), zoom) : extent;
8012     };
8013     zoom.scaleExtent = function(_2) {
8014       return arguments.length ? (scaleExtent[0] = +_2[0], scaleExtent[1] = +_2[1], zoom) : [scaleExtent[0], scaleExtent[1]];
8015     };
8016     zoom.translateExtent = function(_2) {
8017       return arguments.length ? (translateExtent[0][0] = +_2[0][0], translateExtent[1][0] = +_2[1][0], translateExtent[0][1] = +_2[0][1], translateExtent[1][1] = +_2[1][1], zoom) : [[translateExtent[0][0], translateExtent[0][1]], [translateExtent[1][0], translateExtent[1][1]]];
8018     };
8019     zoom.constrain = function(_2) {
8020       return arguments.length ? (constrain = _2, zoom) : constrain;
8021     };
8022     zoom.duration = function(_2) {
8023       return arguments.length ? (duration = +_2, zoom) : duration;
8024     };
8025     zoom.interpolate = function(_2) {
8026       return arguments.length ? (interpolate = _2, 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(_2) {
8033       return arguments.length ? (clickDistance2 = (_2 = +_2) * _2, zoom) : Math.sqrt(clickDistance2);
8034     };
8035     zoom.tapDistance = function(_2) {
8036       return arguments.length ? (tapDistance = +_2, 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 k2 = 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] * k2 + x2, y2 - point[1] * k2];
8076     }
8077     projection2.invert = function(point) {
8078       point = project.invert((point[0] - x2) / k2, (y2 - point[1]) / k2);
8079       return point && [point[0] * 180 / Math.PI, point[1] * 180 / Math.PI];
8080     };
8081     projection2.scale = function(_2) {
8082       if (!arguments.length) return k2;
8083       k2 = +_2;
8084       return projection2;
8085     };
8086     projection2.translate = function(_2) {
8087       if (!arguments.length) return [x2, y2];
8088       x2 = +_2[0];
8089       y2 = +_2[1];
8090       return projection2;
8091     };
8092     projection2.clipExtent = function(_2) {
8093       if (!arguments.length) return clipExtent;
8094       clipExtent = _2;
8095       return projection2;
8096     };
8097     projection2.transform = function(obj) {
8098       if (!arguments.length) return identity2.translate(x2, y2).scale(k2);
8099       x2 = +obj.x;
8100       y2 = +obj.y;
8101       k2 = +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(a2, b2, origin) {
8129     if (geoVecEqual(origin, a2) || geoVecEqual(origin, b2)) {
8130       return 1;
8131     }
8132     return geoVecNormalizedDot(a2, b2, 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 last = 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 < last; i3++) {
8156       var a2 = coords[(i3 - 1 + coords.length) % coords.length];
8157       var origin = coords[i3];
8158       var b2 = coords[(i3 + 1) % coords.length];
8159       var dotp = geoOrthoFilterDotProduct(geoOrthoNormalizedDotProduct(a2, b2, 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 last = isClosed ? coords.length : coords.length - 1;
8169     for (var i3 = first; i3 < last; i3++) {
8170       var a2 = coords[(i3 - 1 + coords.length) % coords.length];
8171       var origin = coords[i3];
8172       var b2 = coords[(i3 + 1) % coords.length];
8173       var normalizedDotP = geoOrthoNormalizedDotProduct(a2, b2, 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 last = 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 < last; i3++) {
8189       var a2 = coords[(i3 - 1 + coords.length) % coords.length];
8190       var origin = coords[i3];
8191       var b2 = coords[(i3 + 1) % coords.length];
8192       var dotp = geoOrthoFilterDotProduct(geoOrthoNormalizedDotProduct(a2, b2, 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), tag2 = 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] = tag2;
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 other2 = typeof value.valueOf == "function" ? value.valueOf() : value;
8526       value = isObject_default(other2) ? other2 + "" : other2;
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 tag2 = baseGetTag_default(value);
8567     return tag2 == funcTag || tag2 == genTag || tag2 == asyncTag || tag2 == 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/_isIndex.js
8845   function isIndex(value, length2) {
8846     var type2 = typeof value;
8847     length2 = length2 == null ? MAX_SAFE_INTEGER : length2;
8848     return !!length2 && (type2 == "number" || type2 != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length2);
8849   }
8850   var MAX_SAFE_INTEGER, reIsUint, isIndex_default;
8851   var init_isIndex = __esm({
8852     "node_modules/lodash-es/_isIndex.js"() {
8853       MAX_SAFE_INTEGER = 9007199254740991;
8854       reIsUint = /^(?:0|[1-9]\d*)$/;
8855       isIndex_default = isIndex;
8856     }
8857   });
8858
8859   // node_modules/lodash-es/_baseAssignValue.js
8860   function baseAssignValue(object, key, value) {
8861     if (key == "__proto__" && defineProperty_default) {
8862       defineProperty_default(object, key, {
8863         "configurable": true,
8864         "enumerable": true,
8865         "value": value,
8866         "writable": true
8867       });
8868     } else {
8869       object[key] = value;
8870     }
8871   }
8872   var baseAssignValue_default;
8873   var init_baseAssignValue = __esm({
8874     "node_modules/lodash-es/_baseAssignValue.js"() {
8875       init_defineProperty();
8876       baseAssignValue_default = baseAssignValue;
8877     }
8878   });
8879
8880   // node_modules/lodash-es/eq.js
8881   function eq(value, other2) {
8882     return value === other2 || value !== value && other2 !== other2;
8883   }
8884   var eq_default;
8885   var init_eq = __esm({
8886     "node_modules/lodash-es/eq.js"() {
8887       eq_default = eq;
8888     }
8889   });
8890
8891   // node_modules/lodash-es/_assignValue.js
8892   function assignValue(object, key, value) {
8893     var objValue = object[key];
8894     if (!(hasOwnProperty3.call(object, key) && eq_default(objValue, value)) || value === void 0 && !(key in object)) {
8895       baseAssignValue_default(object, key, value);
8896     }
8897   }
8898   var objectProto4, hasOwnProperty3, assignValue_default;
8899   var init_assignValue = __esm({
8900     "node_modules/lodash-es/_assignValue.js"() {
8901       init_baseAssignValue();
8902       init_eq();
8903       objectProto4 = Object.prototype;
8904       hasOwnProperty3 = objectProto4.hasOwnProperty;
8905       assignValue_default = assignValue;
8906     }
8907   });
8908
8909   // node_modules/lodash-es/_copyObject.js
8910   function copyObject(source, props, object, customizer) {
8911     var isNew = !object;
8912     object || (object = {});
8913     var index = -1, length2 = props.length;
8914     while (++index < length2) {
8915       var key = props[index];
8916       var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0;
8917       if (newValue === void 0) {
8918         newValue = source[key];
8919       }
8920       if (isNew) {
8921         baseAssignValue_default(object, key, newValue);
8922       } else {
8923         assignValue_default(object, key, newValue);
8924       }
8925     }
8926     return object;
8927   }
8928   var copyObject_default;
8929   var init_copyObject = __esm({
8930     "node_modules/lodash-es/_copyObject.js"() {
8931       init_assignValue();
8932       init_baseAssignValue();
8933       copyObject_default = copyObject;
8934     }
8935   });
8936
8937   // node_modules/lodash-es/_overRest.js
8938   function overRest(func, start2, transform2) {
8939     start2 = nativeMax(start2 === void 0 ? func.length - 1 : start2, 0);
8940     return function() {
8941       var args = arguments, index = -1, length2 = nativeMax(args.length - start2, 0), array2 = Array(length2);
8942       while (++index < length2) {
8943         array2[index] = args[start2 + index];
8944       }
8945       index = -1;
8946       var otherArgs = Array(start2 + 1);
8947       while (++index < start2) {
8948         otherArgs[index] = args[index];
8949       }
8950       otherArgs[start2] = transform2(array2);
8951       return apply_default(func, this, otherArgs);
8952     };
8953   }
8954   var nativeMax, overRest_default;
8955   var init_overRest = __esm({
8956     "node_modules/lodash-es/_overRest.js"() {
8957       init_apply();
8958       nativeMax = Math.max;
8959       overRest_default = overRest;
8960     }
8961   });
8962
8963   // node_modules/lodash-es/_baseRest.js
8964   function baseRest(func, start2) {
8965     return setToString_default(overRest_default(func, start2, identity_default3), func + "");
8966   }
8967   var baseRest_default;
8968   var init_baseRest = __esm({
8969     "node_modules/lodash-es/_baseRest.js"() {
8970       init_identity3();
8971       init_overRest();
8972       init_setToString();
8973       baseRest_default = baseRest;
8974     }
8975   });
8976
8977   // node_modules/lodash-es/isLength.js
8978   function isLength(value) {
8979     return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER2;
8980   }
8981   var MAX_SAFE_INTEGER2, isLength_default;
8982   var init_isLength = __esm({
8983     "node_modules/lodash-es/isLength.js"() {
8984       MAX_SAFE_INTEGER2 = 9007199254740991;
8985       isLength_default = isLength;
8986     }
8987   });
8988
8989   // node_modules/lodash-es/isArrayLike.js
8990   function isArrayLike(value) {
8991     return value != null && isLength_default(value.length) && !isFunction_default(value);
8992   }
8993   var isArrayLike_default;
8994   var init_isArrayLike = __esm({
8995     "node_modules/lodash-es/isArrayLike.js"() {
8996       init_isFunction();
8997       init_isLength();
8998       isArrayLike_default = isArrayLike;
8999     }
9000   });
9001
9002   // node_modules/lodash-es/_isIterateeCall.js
9003   function isIterateeCall(value, index, object) {
9004     if (!isObject_default(object)) {
9005       return false;
9006     }
9007     var type2 = typeof index;
9008     if (type2 == "number" ? isArrayLike_default(object) && isIndex_default(index, object.length) : type2 == "string" && index in object) {
9009       return eq_default(object[index], value);
9010     }
9011     return false;
9012   }
9013   var isIterateeCall_default;
9014   var init_isIterateeCall = __esm({
9015     "node_modules/lodash-es/_isIterateeCall.js"() {
9016       init_eq();
9017       init_isArrayLike();
9018       init_isIndex();
9019       init_isObject();
9020       isIterateeCall_default = isIterateeCall;
9021     }
9022   });
9023
9024   // node_modules/lodash-es/_createAssigner.js
9025   function createAssigner(assigner) {
9026     return baseRest_default(function(object, sources) {
9027       var index = -1, length2 = sources.length, customizer = length2 > 1 ? sources[length2 - 1] : void 0, guard = length2 > 2 ? sources[2] : void 0;
9028       customizer = assigner.length > 3 && typeof customizer == "function" ? (length2--, customizer) : void 0;
9029       if (guard && isIterateeCall_default(sources[0], sources[1], guard)) {
9030         customizer = length2 < 3 ? void 0 : customizer;
9031         length2 = 1;
9032       }
9033       object = Object(object);
9034       while (++index < length2) {
9035         var source = sources[index];
9036         if (source) {
9037           assigner(object, source, index, customizer);
9038         }
9039       }
9040       return object;
9041     });
9042   }
9043   var createAssigner_default;
9044   var init_createAssigner = __esm({
9045     "node_modules/lodash-es/_createAssigner.js"() {
9046       init_baseRest();
9047       init_isIterateeCall();
9048       createAssigner_default = createAssigner;
9049     }
9050   });
9051
9052   // node_modules/lodash-es/_isPrototype.js
9053   function isPrototype(value) {
9054     var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto5;
9055     return value === proto;
9056   }
9057   var objectProto5, isPrototype_default;
9058   var init_isPrototype = __esm({
9059     "node_modules/lodash-es/_isPrototype.js"() {
9060       objectProto5 = Object.prototype;
9061       isPrototype_default = isPrototype;
9062     }
9063   });
9064
9065   // node_modules/lodash-es/_baseTimes.js
9066   function baseTimes(n3, iteratee) {
9067     var index = -1, result = Array(n3);
9068     while (++index < n3) {
9069       result[index] = iteratee(index);
9070     }
9071     return result;
9072   }
9073   var baseTimes_default;
9074   var init_baseTimes = __esm({
9075     "node_modules/lodash-es/_baseTimes.js"() {
9076       baseTimes_default = baseTimes;
9077     }
9078   });
9079
9080   // node_modules/lodash-es/_baseIsArguments.js
9081   function baseIsArguments(value) {
9082     return isObjectLike_default(value) && baseGetTag_default(value) == argsTag;
9083   }
9084   var argsTag, baseIsArguments_default;
9085   var init_baseIsArguments = __esm({
9086     "node_modules/lodash-es/_baseIsArguments.js"() {
9087       init_baseGetTag();
9088       init_isObjectLike();
9089       argsTag = "[object Arguments]";
9090       baseIsArguments_default = baseIsArguments;
9091     }
9092   });
9093
9094   // node_modules/lodash-es/isArguments.js
9095   var objectProto6, hasOwnProperty4, propertyIsEnumerable, isArguments, isArguments_default;
9096   var init_isArguments = __esm({
9097     "node_modules/lodash-es/isArguments.js"() {
9098       init_baseIsArguments();
9099       init_isObjectLike();
9100       objectProto6 = Object.prototype;
9101       hasOwnProperty4 = objectProto6.hasOwnProperty;
9102       propertyIsEnumerable = objectProto6.propertyIsEnumerable;
9103       isArguments = baseIsArguments_default(/* @__PURE__ */ function() {
9104         return arguments;
9105       }()) ? baseIsArguments_default : function(value) {
9106         return isObjectLike_default(value) && hasOwnProperty4.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
9107       };
9108       isArguments_default = isArguments;
9109     }
9110   });
9111
9112   // node_modules/lodash-es/stubFalse.js
9113   function stubFalse() {
9114     return false;
9115   }
9116   var stubFalse_default;
9117   var init_stubFalse = __esm({
9118     "node_modules/lodash-es/stubFalse.js"() {
9119       stubFalse_default = stubFalse;
9120     }
9121   });
9122
9123   // node_modules/lodash-es/isBuffer.js
9124   var freeExports, freeModule, moduleExports, Buffer2, nativeIsBuffer, isBuffer, isBuffer_default;
9125   var init_isBuffer = __esm({
9126     "node_modules/lodash-es/isBuffer.js"() {
9127       init_root();
9128       init_stubFalse();
9129       freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
9130       freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
9131       moduleExports = freeModule && freeModule.exports === freeExports;
9132       Buffer2 = moduleExports ? root_default.Buffer : void 0;
9133       nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : void 0;
9134       isBuffer = nativeIsBuffer || stubFalse_default;
9135       isBuffer_default = isBuffer;
9136     }
9137   });
9138
9139   // node_modules/lodash-es/_baseIsTypedArray.js
9140   function baseIsTypedArray(value) {
9141     return isObjectLike_default(value) && isLength_default(value.length) && !!typedArrayTags[baseGetTag_default(value)];
9142   }
9143   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;
9144   var init_baseIsTypedArray = __esm({
9145     "node_modules/lodash-es/_baseIsTypedArray.js"() {
9146       init_baseGetTag();
9147       init_isLength();
9148       init_isObjectLike();
9149       argsTag2 = "[object Arguments]";
9150       arrayTag = "[object Array]";
9151       boolTag = "[object Boolean]";
9152       dateTag = "[object Date]";
9153       errorTag = "[object Error]";
9154       funcTag2 = "[object Function]";
9155       mapTag = "[object Map]";
9156       numberTag = "[object Number]";
9157       objectTag = "[object Object]";
9158       regexpTag = "[object RegExp]";
9159       setTag = "[object Set]";
9160       stringTag = "[object String]";
9161       weakMapTag = "[object WeakMap]";
9162       arrayBufferTag = "[object ArrayBuffer]";
9163       dataViewTag = "[object DataView]";
9164       float32Tag = "[object Float32Array]";
9165       float64Tag = "[object Float64Array]";
9166       int8Tag = "[object Int8Array]";
9167       int16Tag = "[object Int16Array]";
9168       int32Tag = "[object Int32Array]";
9169       uint8Tag = "[object Uint8Array]";
9170       uint8ClampedTag = "[object Uint8ClampedArray]";
9171       uint16Tag = "[object Uint16Array]";
9172       uint32Tag = "[object Uint32Array]";
9173       typedArrayTags = {};
9174       typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
9175       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;
9176       baseIsTypedArray_default = baseIsTypedArray;
9177     }
9178   });
9179
9180   // node_modules/lodash-es/_baseUnary.js
9181   function baseUnary(func) {
9182     return function(value) {
9183       return func(value);
9184     };
9185   }
9186   var baseUnary_default;
9187   var init_baseUnary = __esm({
9188     "node_modules/lodash-es/_baseUnary.js"() {
9189       baseUnary_default = baseUnary;
9190     }
9191   });
9192
9193   // node_modules/lodash-es/_nodeUtil.js
9194   var freeExports2, freeModule2, moduleExports2, freeProcess, nodeUtil, nodeUtil_default;
9195   var init_nodeUtil = __esm({
9196     "node_modules/lodash-es/_nodeUtil.js"() {
9197       init_freeGlobal();
9198       freeExports2 = typeof exports == "object" && exports && !exports.nodeType && exports;
9199       freeModule2 = freeExports2 && typeof module == "object" && module && !module.nodeType && module;
9200       moduleExports2 = freeModule2 && freeModule2.exports === freeExports2;
9201       freeProcess = moduleExports2 && freeGlobal_default.process;
9202       nodeUtil = function() {
9203         try {
9204           var types = freeModule2 && freeModule2.require && freeModule2.require("util").types;
9205           if (types) {
9206             return types;
9207           }
9208           return freeProcess && freeProcess.binding && freeProcess.binding("util");
9209         } catch (e3) {
9210         }
9211       }();
9212       nodeUtil_default = nodeUtil;
9213     }
9214   });
9215
9216   // node_modules/lodash-es/isTypedArray.js
9217   var nodeIsTypedArray, isTypedArray, isTypedArray_default;
9218   var init_isTypedArray = __esm({
9219     "node_modules/lodash-es/isTypedArray.js"() {
9220       init_baseIsTypedArray();
9221       init_baseUnary();
9222       init_nodeUtil();
9223       nodeIsTypedArray = nodeUtil_default && nodeUtil_default.isTypedArray;
9224       isTypedArray = nodeIsTypedArray ? baseUnary_default(nodeIsTypedArray) : baseIsTypedArray_default;
9225       isTypedArray_default = isTypedArray;
9226     }
9227   });
9228
9229   // node_modules/lodash-es/_arrayLikeKeys.js
9230   function arrayLikeKeys(value, inherited) {
9231     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;
9232     for (var key in value) {
9233       if ((inherited || hasOwnProperty5.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
9234       (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
9235       isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
9236       isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
9237       isIndex_default(key, length2)))) {
9238         result.push(key);
9239       }
9240     }
9241     return result;
9242   }
9243   var objectProto7, hasOwnProperty5, arrayLikeKeys_default;
9244   var init_arrayLikeKeys = __esm({
9245     "node_modules/lodash-es/_arrayLikeKeys.js"() {
9246       init_baseTimes();
9247       init_isArguments();
9248       init_isArray();
9249       init_isBuffer();
9250       init_isIndex();
9251       init_isTypedArray();
9252       objectProto7 = Object.prototype;
9253       hasOwnProperty5 = objectProto7.hasOwnProperty;
9254       arrayLikeKeys_default = arrayLikeKeys;
9255     }
9256   });
9257
9258   // node_modules/lodash-es/_overArg.js
9259   function overArg(func, transform2) {
9260     return function(arg) {
9261       return func(transform2(arg));
9262     };
9263   }
9264   var overArg_default;
9265   var init_overArg = __esm({
9266     "node_modules/lodash-es/_overArg.js"() {
9267       overArg_default = overArg;
9268     }
9269   });
9270
9271   // node_modules/lodash-es/_nativeKeys.js
9272   var nativeKeys, nativeKeys_default;
9273   var init_nativeKeys = __esm({
9274     "node_modules/lodash-es/_nativeKeys.js"() {
9275       init_overArg();
9276       nativeKeys = overArg_default(Object.keys, Object);
9277       nativeKeys_default = nativeKeys;
9278     }
9279   });
9280
9281   // node_modules/lodash-es/_baseKeys.js
9282   function baseKeys(object) {
9283     if (!isPrototype_default(object)) {
9284       return nativeKeys_default(object);
9285     }
9286     var result = [];
9287     for (var key in Object(object)) {
9288       if (hasOwnProperty6.call(object, key) && key != "constructor") {
9289         result.push(key);
9290       }
9291     }
9292     return result;
9293   }
9294   var objectProto8, hasOwnProperty6, baseKeys_default;
9295   var init_baseKeys = __esm({
9296     "node_modules/lodash-es/_baseKeys.js"() {
9297       init_isPrototype();
9298       init_nativeKeys();
9299       objectProto8 = Object.prototype;
9300       hasOwnProperty6 = objectProto8.hasOwnProperty;
9301       baseKeys_default = baseKeys;
9302     }
9303   });
9304
9305   // node_modules/lodash-es/keys.js
9306   function keys(object) {
9307     return isArrayLike_default(object) ? arrayLikeKeys_default(object) : baseKeys_default(object);
9308   }
9309   var keys_default;
9310   var init_keys = __esm({
9311     "node_modules/lodash-es/keys.js"() {
9312       init_arrayLikeKeys();
9313       init_baseKeys();
9314       init_isArrayLike();
9315       keys_default = keys;
9316     }
9317   });
9318
9319   // node_modules/lodash-es/_nativeKeysIn.js
9320   function nativeKeysIn(object) {
9321     var result = [];
9322     if (object != null) {
9323       for (var key in Object(object)) {
9324         result.push(key);
9325       }
9326     }
9327     return result;
9328   }
9329   var nativeKeysIn_default;
9330   var init_nativeKeysIn = __esm({
9331     "node_modules/lodash-es/_nativeKeysIn.js"() {
9332       nativeKeysIn_default = nativeKeysIn;
9333     }
9334   });
9335
9336   // node_modules/lodash-es/_baseKeysIn.js
9337   function baseKeysIn(object) {
9338     if (!isObject_default(object)) {
9339       return nativeKeysIn_default(object);
9340     }
9341     var isProto = isPrototype_default(object), result = [];
9342     for (var key in object) {
9343       if (!(key == "constructor" && (isProto || !hasOwnProperty7.call(object, key)))) {
9344         result.push(key);
9345       }
9346     }
9347     return result;
9348   }
9349   var objectProto9, hasOwnProperty7, baseKeysIn_default;
9350   var init_baseKeysIn = __esm({
9351     "node_modules/lodash-es/_baseKeysIn.js"() {
9352       init_isObject();
9353       init_isPrototype();
9354       init_nativeKeysIn();
9355       objectProto9 = Object.prototype;
9356       hasOwnProperty7 = objectProto9.hasOwnProperty;
9357       baseKeysIn_default = baseKeysIn;
9358     }
9359   });
9360
9361   // node_modules/lodash-es/keysIn.js
9362   function keysIn(object) {
9363     return isArrayLike_default(object) ? arrayLikeKeys_default(object, true) : baseKeysIn_default(object);
9364   }
9365   var keysIn_default;
9366   var init_keysIn = __esm({
9367     "node_modules/lodash-es/keysIn.js"() {
9368       init_arrayLikeKeys();
9369       init_baseKeysIn();
9370       init_isArrayLike();
9371       keysIn_default = keysIn;
9372     }
9373   });
9374
9375   // node_modules/lodash-es/_nativeCreate.js
9376   var nativeCreate, nativeCreate_default;
9377   var init_nativeCreate = __esm({
9378     "node_modules/lodash-es/_nativeCreate.js"() {
9379       init_getNative();
9380       nativeCreate = getNative_default(Object, "create");
9381       nativeCreate_default = nativeCreate;
9382     }
9383   });
9384
9385   // node_modules/lodash-es/_hashClear.js
9386   function hashClear() {
9387     this.__data__ = nativeCreate_default ? nativeCreate_default(null) : {};
9388     this.size = 0;
9389   }
9390   var hashClear_default;
9391   var init_hashClear = __esm({
9392     "node_modules/lodash-es/_hashClear.js"() {
9393       init_nativeCreate();
9394       hashClear_default = hashClear;
9395     }
9396   });
9397
9398   // node_modules/lodash-es/_hashDelete.js
9399   function hashDelete(key) {
9400     var result = this.has(key) && delete this.__data__[key];
9401     this.size -= result ? 1 : 0;
9402     return result;
9403   }
9404   var hashDelete_default;
9405   var init_hashDelete = __esm({
9406     "node_modules/lodash-es/_hashDelete.js"() {
9407       hashDelete_default = hashDelete;
9408     }
9409   });
9410
9411   // node_modules/lodash-es/_hashGet.js
9412   function hashGet(key) {
9413     var data = this.__data__;
9414     if (nativeCreate_default) {
9415       var result = data[key];
9416       return result === HASH_UNDEFINED ? void 0 : result;
9417     }
9418     return hasOwnProperty8.call(data, key) ? data[key] : void 0;
9419   }
9420   var HASH_UNDEFINED, objectProto10, hasOwnProperty8, hashGet_default;
9421   var init_hashGet = __esm({
9422     "node_modules/lodash-es/_hashGet.js"() {
9423       init_nativeCreate();
9424       HASH_UNDEFINED = "__lodash_hash_undefined__";
9425       objectProto10 = Object.prototype;
9426       hasOwnProperty8 = objectProto10.hasOwnProperty;
9427       hashGet_default = hashGet;
9428     }
9429   });
9430
9431   // node_modules/lodash-es/_hashHas.js
9432   function hashHas(key) {
9433     var data = this.__data__;
9434     return nativeCreate_default ? data[key] !== void 0 : hasOwnProperty9.call(data, key);
9435   }
9436   var objectProto11, hasOwnProperty9, hashHas_default;
9437   var init_hashHas = __esm({
9438     "node_modules/lodash-es/_hashHas.js"() {
9439       init_nativeCreate();
9440       objectProto11 = Object.prototype;
9441       hasOwnProperty9 = objectProto11.hasOwnProperty;
9442       hashHas_default = hashHas;
9443     }
9444   });
9445
9446   // node_modules/lodash-es/_hashSet.js
9447   function hashSet(key, value) {
9448     var data = this.__data__;
9449     this.size += this.has(key) ? 0 : 1;
9450     data[key] = nativeCreate_default && value === void 0 ? HASH_UNDEFINED2 : value;
9451     return this;
9452   }
9453   var HASH_UNDEFINED2, hashSet_default;
9454   var init_hashSet = __esm({
9455     "node_modules/lodash-es/_hashSet.js"() {
9456       init_nativeCreate();
9457       HASH_UNDEFINED2 = "__lodash_hash_undefined__";
9458       hashSet_default = hashSet;
9459     }
9460   });
9461
9462   // node_modules/lodash-es/_Hash.js
9463   function Hash(entries) {
9464     var index = -1, length2 = entries == null ? 0 : entries.length;
9465     this.clear();
9466     while (++index < length2) {
9467       var entry = entries[index];
9468       this.set(entry[0], entry[1]);
9469     }
9470   }
9471   var Hash_default;
9472   var init_Hash = __esm({
9473     "node_modules/lodash-es/_Hash.js"() {
9474       init_hashClear();
9475       init_hashDelete();
9476       init_hashGet();
9477       init_hashHas();
9478       init_hashSet();
9479       Hash.prototype.clear = hashClear_default;
9480       Hash.prototype["delete"] = hashDelete_default;
9481       Hash.prototype.get = hashGet_default;
9482       Hash.prototype.has = hashHas_default;
9483       Hash.prototype.set = hashSet_default;
9484       Hash_default = Hash;
9485     }
9486   });
9487
9488   // node_modules/lodash-es/_listCacheClear.js
9489   function listCacheClear() {
9490     this.__data__ = [];
9491     this.size = 0;
9492   }
9493   var listCacheClear_default;
9494   var init_listCacheClear = __esm({
9495     "node_modules/lodash-es/_listCacheClear.js"() {
9496       listCacheClear_default = listCacheClear;
9497     }
9498   });
9499
9500   // node_modules/lodash-es/_assocIndexOf.js
9501   function assocIndexOf(array2, key) {
9502     var length2 = array2.length;
9503     while (length2--) {
9504       if (eq_default(array2[length2][0], key)) {
9505         return length2;
9506       }
9507     }
9508     return -1;
9509   }
9510   var assocIndexOf_default;
9511   var init_assocIndexOf = __esm({
9512     "node_modules/lodash-es/_assocIndexOf.js"() {
9513       init_eq();
9514       assocIndexOf_default = assocIndexOf;
9515     }
9516   });
9517
9518   // node_modules/lodash-es/_listCacheDelete.js
9519   function listCacheDelete(key) {
9520     var data = this.__data__, index = assocIndexOf_default(data, key);
9521     if (index < 0) {
9522       return false;
9523     }
9524     var lastIndex = data.length - 1;
9525     if (index == lastIndex) {
9526       data.pop();
9527     } else {
9528       splice.call(data, index, 1);
9529     }
9530     --this.size;
9531     return true;
9532   }
9533   var arrayProto, splice, listCacheDelete_default;
9534   var init_listCacheDelete = __esm({
9535     "node_modules/lodash-es/_listCacheDelete.js"() {
9536       init_assocIndexOf();
9537       arrayProto = Array.prototype;
9538       splice = arrayProto.splice;
9539       listCacheDelete_default = listCacheDelete;
9540     }
9541   });
9542
9543   // node_modules/lodash-es/_listCacheGet.js
9544   function listCacheGet(key) {
9545     var data = this.__data__, index = assocIndexOf_default(data, key);
9546     return index < 0 ? void 0 : data[index][1];
9547   }
9548   var listCacheGet_default;
9549   var init_listCacheGet = __esm({
9550     "node_modules/lodash-es/_listCacheGet.js"() {
9551       init_assocIndexOf();
9552       listCacheGet_default = listCacheGet;
9553     }
9554   });
9555
9556   // node_modules/lodash-es/_listCacheHas.js
9557   function listCacheHas(key) {
9558     return assocIndexOf_default(this.__data__, key) > -1;
9559   }
9560   var listCacheHas_default;
9561   var init_listCacheHas = __esm({
9562     "node_modules/lodash-es/_listCacheHas.js"() {
9563       init_assocIndexOf();
9564       listCacheHas_default = listCacheHas;
9565     }
9566   });
9567
9568   // node_modules/lodash-es/_listCacheSet.js
9569   function listCacheSet(key, value) {
9570     var data = this.__data__, index = assocIndexOf_default(data, key);
9571     if (index < 0) {
9572       ++this.size;
9573       data.push([key, value]);
9574     } else {
9575       data[index][1] = value;
9576     }
9577     return this;
9578   }
9579   var listCacheSet_default;
9580   var init_listCacheSet = __esm({
9581     "node_modules/lodash-es/_listCacheSet.js"() {
9582       init_assocIndexOf();
9583       listCacheSet_default = listCacheSet;
9584     }
9585   });
9586
9587   // node_modules/lodash-es/_ListCache.js
9588   function ListCache(entries) {
9589     var index = -1, length2 = entries == null ? 0 : entries.length;
9590     this.clear();
9591     while (++index < length2) {
9592       var entry = entries[index];
9593       this.set(entry[0], entry[1]);
9594     }
9595   }
9596   var ListCache_default;
9597   var init_ListCache = __esm({
9598     "node_modules/lodash-es/_ListCache.js"() {
9599       init_listCacheClear();
9600       init_listCacheDelete();
9601       init_listCacheGet();
9602       init_listCacheHas();
9603       init_listCacheSet();
9604       ListCache.prototype.clear = listCacheClear_default;
9605       ListCache.prototype["delete"] = listCacheDelete_default;
9606       ListCache.prototype.get = listCacheGet_default;
9607       ListCache.prototype.has = listCacheHas_default;
9608       ListCache.prototype.set = listCacheSet_default;
9609       ListCache_default = ListCache;
9610     }
9611   });
9612
9613   // node_modules/lodash-es/_Map.js
9614   var Map2, Map_default;
9615   var init_Map = __esm({
9616     "node_modules/lodash-es/_Map.js"() {
9617       init_getNative();
9618       init_root();
9619       Map2 = getNative_default(root_default, "Map");
9620       Map_default = Map2;
9621     }
9622   });
9623
9624   // node_modules/lodash-es/_mapCacheClear.js
9625   function mapCacheClear() {
9626     this.size = 0;
9627     this.__data__ = {
9628       "hash": new Hash_default(),
9629       "map": new (Map_default || ListCache_default)(),
9630       "string": new Hash_default()
9631     };
9632   }
9633   var mapCacheClear_default;
9634   var init_mapCacheClear = __esm({
9635     "node_modules/lodash-es/_mapCacheClear.js"() {
9636       init_Hash();
9637       init_ListCache();
9638       init_Map();
9639       mapCacheClear_default = mapCacheClear;
9640     }
9641   });
9642
9643   // node_modules/lodash-es/_isKeyable.js
9644   function isKeyable(value) {
9645     var type2 = typeof value;
9646     return type2 == "string" || type2 == "number" || type2 == "symbol" || type2 == "boolean" ? value !== "__proto__" : value === null;
9647   }
9648   var isKeyable_default;
9649   var init_isKeyable = __esm({
9650     "node_modules/lodash-es/_isKeyable.js"() {
9651       isKeyable_default = isKeyable;
9652     }
9653   });
9654
9655   // node_modules/lodash-es/_getMapData.js
9656   function getMapData(map2, key) {
9657     var data = map2.__data__;
9658     return isKeyable_default(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
9659   }
9660   var getMapData_default;
9661   var init_getMapData = __esm({
9662     "node_modules/lodash-es/_getMapData.js"() {
9663       init_isKeyable();
9664       getMapData_default = getMapData;
9665     }
9666   });
9667
9668   // node_modules/lodash-es/_mapCacheDelete.js
9669   function mapCacheDelete(key) {
9670     var result = getMapData_default(this, key)["delete"](key);
9671     this.size -= result ? 1 : 0;
9672     return result;
9673   }
9674   var mapCacheDelete_default;
9675   var init_mapCacheDelete = __esm({
9676     "node_modules/lodash-es/_mapCacheDelete.js"() {
9677       init_getMapData();
9678       mapCacheDelete_default = mapCacheDelete;
9679     }
9680   });
9681
9682   // node_modules/lodash-es/_mapCacheGet.js
9683   function mapCacheGet(key) {
9684     return getMapData_default(this, key).get(key);
9685   }
9686   var mapCacheGet_default;
9687   var init_mapCacheGet = __esm({
9688     "node_modules/lodash-es/_mapCacheGet.js"() {
9689       init_getMapData();
9690       mapCacheGet_default = mapCacheGet;
9691     }
9692   });
9693
9694   // node_modules/lodash-es/_mapCacheHas.js
9695   function mapCacheHas(key) {
9696     return getMapData_default(this, key).has(key);
9697   }
9698   var mapCacheHas_default;
9699   var init_mapCacheHas = __esm({
9700     "node_modules/lodash-es/_mapCacheHas.js"() {
9701       init_getMapData();
9702       mapCacheHas_default = mapCacheHas;
9703     }
9704   });
9705
9706   // node_modules/lodash-es/_mapCacheSet.js
9707   function mapCacheSet(key, value) {
9708     var data = getMapData_default(this, key), size = data.size;
9709     data.set(key, value);
9710     this.size += data.size == size ? 0 : 1;
9711     return this;
9712   }
9713   var mapCacheSet_default;
9714   var init_mapCacheSet = __esm({
9715     "node_modules/lodash-es/_mapCacheSet.js"() {
9716       init_getMapData();
9717       mapCacheSet_default = mapCacheSet;
9718     }
9719   });
9720
9721   // node_modules/lodash-es/_MapCache.js
9722   function MapCache(entries) {
9723     var index = -1, length2 = entries == null ? 0 : entries.length;
9724     this.clear();
9725     while (++index < length2) {
9726       var entry = entries[index];
9727       this.set(entry[0], entry[1]);
9728     }
9729   }
9730   var MapCache_default;
9731   var init_MapCache = __esm({
9732     "node_modules/lodash-es/_MapCache.js"() {
9733       init_mapCacheClear();
9734       init_mapCacheDelete();
9735       init_mapCacheGet();
9736       init_mapCacheHas();
9737       init_mapCacheSet();
9738       MapCache.prototype.clear = mapCacheClear_default;
9739       MapCache.prototype["delete"] = mapCacheDelete_default;
9740       MapCache.prototype.get = mapCacheGet_default;
9741       MapCache.prototype.has = mapCacheHas_default;
9742       MapCache.prototype.set = mapCacheSet_default;
9743       MapCache_default = MapCache;
9744     }
9745   });
9746
9747   // node_modules/lodash-es/toString.js
9748   function toString(value) {
9749     return value == null ? "" : baseToString_default(value);
9750   }
9751   var toString_default;
9752   var init_toString = __esm({
9753     "node_modules/lodash-es/toString.js"() {
9754       init_baseToString();
9755       toString_default = toString;
9756     }
9757   });
9758
9759   // node_modules/lodash-es/_arrayPush.js
9760   function arrayPush(array2, values) {
9761     var index = -1, length2 = values.length, offset = array2.length;
9762     while (++index < length2) {
9763       array2[offset + index] = values[index];
9764     }
9765     return array2;
9766   }
9767   var arrayPush_default;
9768   var init_arrayPush = __esm({
9769     "node_modules/lodash-es/_arrayPush.js"() {
9770       arrayPush_default = arrayPush;
9771     }
9772   });
9773
9774   // node_modules/lodash-es/_getPrototype.js
9775   var getPrototype, getPrototype_default;
9776   var init_getPrototype = __esm({
9777     "node_modules/lodash-es/_getPrototype.js"() {
9778       init_overArg();
9779       getPrototype = overArg_default(Object.getPrototypeOf, Object);
9780       getPrototype_default = getPrototype;
9781     }
9782   });
9783
9784   // node_modules/lodash-es/isPlainObject.js
9785   function isPlainObject(value) {
9786     if (!isObjectLike_default(value) || baseGetTag_default(value) != objectTag2) {
9787       return false;
9788     }
9789     var proto = getPrototype_default(value);
9790     if (proto === null) {
9791       return true;
9792     }
9793     var Ctor = hasOwnProperty10.call(proto, "constructor") && proto.constructor;
9794     return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString3.call(Ctor) == objectCtorString;
9795   }
9796   var objectTag2, funcProto3, objectProto12, funcToString3, hasOwnProperty10, objectCtorString, isPlainObject_default;
9797   var init_isPlainObject = __esm({
9798     "node_modules/lodash-es/isPlainObject.js"() {
9799       init_baseGetTag();
9800       init_getPrototype();
9801       init_isObjectLike();
9802       objectTag2 = "[object Object]";
9803       funcProto3 = Function.prototype;
9804       objectProto12 = Object.prototype;
9805       funcToString3 = funcProto3.toString;
9806       hasOwnProperty10 = objectProto12.hasOwnProperty;
9807       objectCtorString = funcToString3.call(Object);
9808       isPlainObject_default = isPlainObject;
9809     }
9810   });
9811
9812   // node_modules/lodash-es/_basePropertyOf.js
9813   function basePropertyOf(object) {
9814     return function(key) {
9815       return object == null ? void 0 : object[key];
9816     };
9817   }
9818   var basePropertyOf_default;
9819   var init_basePropertyOf = __esm({
9820     "node_modules/lodash-es/_basePropertyOf.js"() {
9821       basePropertyOf_default = basePropertyOf;
9822     }
9823   });
9824
9825   // node_modules/lodash-es/_stackClear.js
9826   function stackClear() {
9827     this.__data__ = new ListCache_default();
9828     this.size = 0;
9829   }
9830   var stackClear_default;
9831   var init_stackClear = __esm({
9832     "node_modules/lodash-es/_stackClear.js"() {
9833       init_ListCache();
9834       stackClear_default = stackClear;
9835     }
9836   });
9837
9838   // node_modules/lodash-es/_stackDelete.js
9839   function stackDelete(key) {
9840     var data = this.__data__, result = data["delete"](key);
9841     this.size = data.size;
9842     return result;
9843   }
9844   var stackDelete_default;
9845   var init_stackDelete = __esm({
9846     "node_modules/lodash-es/_stackDelete.js"() {
9847       stackDelete_default = stackDelete;
9848     }
9849   });
9850
9851   // node_modules/lodash-es/_stackGet.js
9852   function stackGet(key) {
9853     return this.__data__.get(key);
9854   }
9855   var stackGet_default;
9856   var init_stackGet = __esm({
9857     "node_modules/lodash-es/_stackGet.js"() {
9858       stackGet_default = stackGet;
9859     }
9860   });
9861
9862   // node_modules/lodash-es/_stackHas.js
9863   function stackHas(key) {
9864     return this.__data__.has(key);
9865   }
9866   var stackHas_default;
9867   var init_stackHas = __esm({
9868     "node_modules/lodash-es/_stackHas.js"() {
9869       stackHas_default = stackHas;
9870     }
9871   });
9872
9873   // node_modules/lodash-es/_stackSet.js
9874   function stackSet(key, value) {
9875     var data = this.__data__;
9876     if (data instanceof ListCache_default) {
9877       var pairs2 = data.__data__;
9878       if (!Map_default || pairs2.length < LARGE_ARRAY_SIZE - 1) {
9879         pairs2.push([key, value]);
9880         this.size = ++data.size;
9881         return this;
9882       }
9883       data = this.__data__ = new MapCache_default(pairs2);
9884     }
9885     data.set(key, value);
9886     this.size = data.size;
9887     return this;
9888   }
9889   var LARGE_ARRAY_SIZE, stackSet_default;
9890   var init_stackSet = __esm({
9891     "node_modules/lodash-es/_stackSet.js"() {
9892       init_ListCache();
9893       init_Map();
9894       init_MapCache();
9895       LARGE_ARRAY_SIZE = 200;
9896       stackSet_default = stackSet;
9897     }
9898   });
9899
9900   // node_modules/lodash-es/_Stack.js
9901   function Stack(entries) {
9902     var data = this.__data__ = new ListCache_default(entries);
9903     this.size = data.size;
9904   }
9905   var Stack_default;
9906   var init_Stack = __esm({
9907     "node_modules/lodash-es/_Stack.js"() {
9908       init_ListCache();
9909       init_stackClear();
9910       init_stackDelete();
9911       init_stackGet();
9912       init_stackHas();
9913       init_stackSet();
9914       Stack.prototype.clear = stackClear_default;
9915       Stack.prototype["delete"] = stackDelete_default;
9916       Stack.prototype.get = stackGet_default;
9917       Stack.prototype.has = stackHas_default;
9918       Stack.prototype.set = stackSet_default;
9919       Stack_default = Stack;
9920     }
9921   });
9922
9923   // node_modules/lodash-es/_cloneBuffer.js
9924   function cloneBuffer(buffer, isDeep) {
9925     if (isDeep) {
9926       return buffer.slice();
9927     }
9928     var length2 = buffer.length, result = allocUnsafe ? allocUnsafe(length2) : new buffer.constructor(length2);
9929     buffer.copy(result);
9930     return result;
9931   }
9932   var freeExports3, freeModule3, moduleExports3, Buffer3, allocUnsafe, cloneBuffer_default;
9933   var init_cloneBuffer = __esm({
9934     "node_modules/lodash-es/_cloneBuffer.js"() {
9935       init_root();
9936       freeExports3 = typeof exports == "object" && exports && !exports.nodeType && exports;
9937       freeModule3 = freeExports3 && typeof module == "object" && module && !module.nodeType && module;
9938       moduleExports3 = freeModule3 && freeModule3.exports === freeExports3;
9939       Buffer3 = moduleExports3 ? root_default.Buffer : void 0;
9940       allocUnsafe = Buffer3 ? Buffer3.allocUnsafe : void 0;
9941       cloneBuffer_default = cloneBuffer;
9942     }
9943   });
9944
9945   // node_modules/lodash-es/_arrayFilter.js
9946   function arrayFilter(array2, predicate) {
9947     var index = -1, length2 = array2 == null ? 0 : array2.length, resIndex = 0, result = [];
9948     while (++index < length2) {
9949       var value = array2[index];
9950       if (predicate(value, index, array2)) {
9951         result[resIndex++] = value;
9952       }
9953     }
9954     return result;
9955   }
9956   var arrayFilter_default;
9957   var init_arrayFilter = __esm({
9958     "node_modules/lodash-es/_arrayFilter.js"() {
9959       arrayFilter_default = arrayFilter;
9960     }
9961   });
9962
9963   // node_modules/lodash-es/stubArray.js
9964   function stubArray() {
9965     return [];
9966   }
9967   var stubArray_default;
9968   var init_stubArray = __esm({
9969     "node_modules/lodash-es/stubArray.js"() {
9970       stubArray_default = stubArray;
9971     }
9972   });
9973
9974   // node_modules/lodash-es/_getSymbols.js
9975   var objectProto13, propertyIsEnumerable2, nativeGetSymbols, getSymbols, getSymbols_default;
9976   var init_getSymbols = __esm({
9977     "node_modules/lodash-es/_getSymbols.js"() {
9978       init_arrayFilter();
9979       init_stubArray();
9980       objectProto13 = Object.prototype;
9981       propertyIsEnumerable2 = objectProto13.propertyIsEnumerable;
9982       nativeGetSymbols = Object.getOwnPropertySymbols;
9983       getSymbols = !nativeGetSymbols ? stubArray_default : function(object) {
9984         if (object == null) {
9985           return [];
9986         }
9987         object = Object(object);
9988         return arrayFilter_default(nativeGetSymbols(object), function(symbol) {
9989           return propertyIsEnumerable2.call(object, symbol);
9990         });
9991       };
9992       getSymbols_default = getSymbols;
9993     }
9994   });
9995
9996   // node_modules/lodash-es/_baseGetAllKeys.js
9997   function baseGetAllKeys(object, keysFunc, symbolsFunc) {
9998     var result = keysFunc(object);
9999     return isArray_default(object) ? result : arrayPush_default(result, symbolsFunc(object));
10000   }
10001   var baseGetAllKeys_default;
10002   var init_baseGetAllKeys = __esm({
10003     "node_modules/lodash-es/_baseGetAllKeys.js"() {
10004       init_arrayPush();
10005       init_isArray();
10006       baseGetAllKeys_default = baseGetAllKeys;
10007     }
10008   });
10009
10010   // node_modules/lodash-es/_getAllKeys.js
10011   function getAllKeys(object) {
10012     return baseGetAllKeys_default(object, keys_default, getSymbols_default);
10013   }
10014   var getAllKeys_default;
10015   var init_getAllKeys = __esm({
10016     "node_modules/lodash-es/_getAllKeys.js"() {
10017       init_baseGetAllKeys();
10018       init_getSymbols();
10019       init_keys();
10020       getAllKeys_default = getAllKeys;
10021     }
10022   });
10023
10024   // node_modules/lodash-es/_DataView.js
10025   var DataView2, DataView_default;
10026   var init_DataView = __esm({
10027     "node_modules/lodash-es/_DataView.js"() {
10028       init_getNative();
10029       init_root();
10030       DataView2 = getNative_default(root_default, "DataView");
10031       DataView_default = DataView2;
10032     }
10033   });
10034
10035   // node_modules/lodash-es/_Promise.js
10036   var Promise2, Promise_default;
10037   var init_Promise = __esm({
10038     "node_modules/lodash-es/_Promise.js"() {
10039       init_getNative();
10040       init_root();
10041       Promise2 = getNative_default(root_default, "Promise");
10042       Promise_default = Promise2;
10043     }
10044   });
10045
10046   // node_modules/lodash-es/_Set.js
10047   var Set2, Set_default;
10048   var init_Set = __esm({
10049     "node_modules/lodash-es/_Set.js"() {
10050       init_getNative();
10051       init_root();
10052       Set2 = getNative_default(root_default, "Set");
10053       Set_default = Set2;
10054     }
10055   });
10056
10057   // node_modules/lodash-es/_getTag.js
10058   var mapTag2, objectTag3, promiseTag, setTag2, weakMapTag2, dataViewTag2, dataViewCtorString, mapCtorString, promiseCtorString, setCtorString, weakMapCtorString, getTag, getTag_default;
10059   var init_getTag = __esm({
10060     "node_modules/lodash-es/_getTag.js"() {
10061       init_DataView();
10062       init_Map();
10063       init_Promise();
10064       init_Set();
10065       init_WeakMap();
10066       init_baseGetTag();
10067       init_toSource();
10068       mapTag2 = "[object Map]";
10069       objectTag3 = "[object Object]";
10070       promiseTag = "[object Promise]";
10071       setTag2 = "[object Set]";
10072       weakMapTag2 = "[object WeakMap]";
10073       dataViewTag2 = "[object DataView]";
10074       dataViewCtorString = toSource_default(DataView_default);
10075       mapCtorString = toSource_default(Map_default);
10076       promiseCtorString = toSource_default(Promise_default);
10077       setCtorString = toSource_default(Set_default);
10078       weakMapCtorString = toSource_default(WeakMap_default);
10079       getTag = baseGetTag_default;
10080       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) {
10081         getTag = function(value) {
10082           var result = baseGetTag_default(value), Ctor = result == objectTag3 ? value.constructor : void 0, ctorString = Ctor ? toSource_default(Ctor) : "";
10083           if (ctorString) {
10084             switch (ctorString) {
10085               case dataViewCtorString:
10086                 return dataViewTag2;
10087               case mapCtorString:
10088                 return mapTag2;
10089               case promiseCtorString:
10090                 return promiseTag;
10091               case setCtorString:
10092                 return setTag2;
10093               case weakMapCtorString:
10094                 return weakMapTag2;
10095             }
10096           }
10097           return result;
10098         };
10099       }
10100       getTag_default = getTag;
10101     }
10102   });
10103
10104   // node_modules/lodash-es/_Uint8Array.js
10105   var Uint8Array2, Uint8Array_default;
10106   var init_Uint8Array = __esm({
10107     "node_modules/lodash-es/_Uint8Array.js"() {
10108       init_root();
10109       Uint8Array2 = root_default.Uint8Array;
10110       Uint8Array_default = Uint8Array2;
10111     }
10112   });
10113
10114   // node_modules/lodash-es/_cloneArrayBuffer.js
10115   function cloneArrayBuffer(arrayBuffer) {
10116     var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
10117     new Uint8Array_default(result).set(new Uint8Array_default(arrayBuffer));
10118     return result;
10119   }
10120   var cloneArrayBuffer_default;
10121   var init_cloneArrayBuffer = __esm({
10122     "node_modules/lodash-es/_cloneArrayBuffer.js"() {
10123       init_Uint8Array();
10124       cloneArrayBuffer_default = cloneArrayBuffer;
10125     }
10126   });
10127
10128   // node_modules/lodash-es/_cloneTypedArray.js
10129   function cloneTypedArray(typedArray, isDeep) {
10130     var buffer = isDeep ? cloneArrayBuffer_default(typedArray.buffer) : typedArray.buffer;
10131     return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
10132   }
10133   var cloneTypedArray_default;
10134   var init_cloneTypedArray = __esm({
10135     "node_modules/lodash-es/_cloneTypedArray.js"() {
10136       init_cloneArrayBuffer();
10137       cloneTypedArray_default = cloneTypedArray;
10138     }
10139   });
10140
10141   // node_modules/lodash-es/_initCloneObject.js
10142   function initCloneObject(object) {
10143     return typeof object.constructor == "function" && !isPrototype_default(object) ? baseCreate_default(getPrototype_default(object)) : {};
10144   }
10145   var initCloneObject_default;
10146   var init_initCloneObject = __esm({
10147     "node_modules/lodash-es/_initCloneObject.js"() {
10148       init_baseCreate();
10149       init_getPrototype();
10150       init_isPrototype();
10151       initCloneObject_default = initCloneObject;
10152     }
10153   });
10154
10155   // node_modules/lodash-es/_setCacheAdd.js
10156   function setCacheAdd(value) {
10157     this.__data__.set(value, HASH_UNDEFINED3);
10158     return this;
10159   }
10160   var HASH_UNDEFINED3, setCacheAdd_default;
10161   var init_setCacheAdd = __esm({
10162     "node_modules/lodash-es/_setCacheAdd.js"() {
10163       HASH_UNDEFINED3 = "__lodash_hash_undefined__";
10164       setCacheAdd_default = setCacheAdd;
10165     }
10166   });
10167
10168   // node_modules/lodash-es/_setCacheHas.js
10169   function setCacheHas(value) {
10170     return this.__data__.has(value);
10171   }
10172   var setCacheHas_default;
10173   var init_setCacheHas = __esm({
10174     "node_modules/lodash-es/_setCacheHas.js"() {
10175       setCacheHas_default = setCacheHas;
10176     }
10177   });
10178
10179   // node_modules/lodash-es/_SetCache.js
10180   function SetCache(values) {
10181     var index = -1, length2 = values == null ? 0 : values.length;
10182     this.__data__ = new MapCache_default();
10183     while (++index < length2) {
10184       this.add(values[index]);
10185     }
10186   }
10187   var SetCache_default;
10188   var init_SetCache = __esm({
10189     "node_modules/lodash-es/_SetCache.js"() {
10190       init_MapCache();
10191       init_setCacheAdd();
10192       init_setCacheHas();
10193       SetCache.prototype.add = SetCache.prototype.push = setCacheAdd_default;
10194       SetCache.prototype.has = setCacheHas_default;
10195       SetCache_default = SetCache;
10196     }
10197   });
10198
10199   // node_modules/lodash-es/_arraySome.js
10200   function arraySome(array2, predicate) {
10201     var index = -1, length2 = array2 == null ? 0 : array2.length;
10202     while (++index < length2) {
10203       if (predicate(array2[index], index, array2)) {
10204         return true;
10205       }
10206     }
10207     return false;
10208   }
10209   var arraySome_default;
10210   var init_arraySome = __esm({
10211     "node_modules/lodash-es/_arraySome.js"() {
10212       arraySome_default = arraySome;
10213     }
10214   });
10215
10216   // node_modules/lodash-es/_cacheHas.js
10217   function cacheHas(cache, key) {
10218     return cache.has(key);
10219   }
10220   var cacheHas_default;
10221   var init_cacheHas = __esm({
10222     "node_modules/lodash-es/_cacheHas.js"() {
10223       cacheHas_default = cacheHas;
10224     }
10225   });
10226
10227   // node_modules/lodash-es/_equalArrays.js
10228   function equalArrays(array2, other2, bitmask, customizer, equalFunc, stack) {
10229     var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array2.length, othLength = other2.length;
10230     if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
10231       return false;
10232     }
10233     var arrStacked = stack.get(array2);
10234     var othStacked = stack.get(other2);
10235     if (arrStacked && othStacked) {
10236       return arrStacked == other2 && othStacked == array2;
10237     }
10238     var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache_default() : void 0;
10239     stack.set(array2, other2);
10240     stack.set(other2, array2);
10241     while (++index < arrLength) {
10242       var arrValue = array2[index], othValue = other2[index];
10243       if (customizer) {
10244         var compared = isPartial ? customizer(othValue, arrValue, index, other2, array2, stack) : customizer(arrValue, othValue, index, array2, other2, stack);
10245       }
10246       if (compared !== void 0) {
10247         if (compared) {
10248           continue;
10249         }
10250         result = false;
10251         break;
10252       }
10253       if (seen) {
10254         if (!arraySome_default(other2, function(othValue2, othIndex) {
10255           if (!cacheHas_default(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
10256             return seen.push(othIndex);
10257           }
10258         })) {
10259           result = false;
10260           break;
10261         }
10262       } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
10263         result = false;
10264         break;
10265       }
10266     }
10267     stack["delete"](array2);
10268     stack["delete"](other2);
10269     return result;
10270   }
10271   var COMPARE_PARTIAL_FLAG, COMPARE_UNORDERED_FLAG, equalArrays_default;
10272   var init_equalArrays = __esm({
10273     "node_modules/lodash-es/_equalArrays.js"() {
10274       init_SetCache();
10275       init_arraySome();
10276       init_cacheHas();
10277       COMPARE_PARTIAL_FLAG = 1;
10278       COMPARE_UNORDERED_FLAG = 2;
10279       equalArrays_default = equalArrays;
10280     }
10281   });
10282
10283   // node_modules/lodash-es/_mapToArray.js
10284   function mapToArray(map2) {
10285     var index = -1, result = Array(map2.size);
10286     map2.forEach(function(value, key) {
10287       result[++index] = [key, value];
10288     });
10289     return result;
10290   }
10291   var mapToArray_default;
10292   var init_mapToArray = __esm({
10293     "node_modules/lodash-es/_mapToArray.js"() {
10294       mapToArray_default = mapToArray;
10295     }
10296   });
10297
10298   // node_modules/lodash-es/_setToArray.js
10299   function setToArray(set4) {
10300     var index = -1, result = Array(set4.size);
10301     set4.forEach(function(value) {
10302       result[++index] = value;
10303     });
10304     return result;
10305   }
10306   var setToArray_default;
10307   var init_setToArray = __esm({
10308     "node_modules/lodash-es/_setToArray.js"() {
10309       setToArray_default = setToArray;
10310     }
10311   });
10312
10313   // node_modules/lodash-es/_equalByTag.js
10314   function equalByTag(object, other2, tag2, bitmask, customizer, equalFunc, stack) {
10315     switch (tag2) {
10316       case dataViewTag3:
10317         if (object.byteLength != other2.byteLength || object.byteOffset != other2.byteOffset) {
10318           return false;
10319         }
10320         object = object.buffer;
10321         other2 = other2.buffer;
10322       case arrayBufferTag2:
10323         if (object.byteLength != other2.byteLength || !equalFunc(new Uint8Array_default(object), new Uint8Array_default(other2))) {
10324           return false;
10325         }
10326         return true;
10327       case boolTag2:
10328       case dateTag2:
10329       case numberTag2:
10330         return eq_default(+object, +other2);
10331       case errorTag2:
10332         return object.name == other2.name && object.message == other2.message;
10333       case regexpTag2:
10334       case stringTag2:
10335         return object == other2 + "";
10336       case mapTag3:
10337         var convert = mapToArray_default;
10338       case setTag3:
10339         var isPartial = bitmask & COMPARE_PARTIAL_FLAG2;
10340         convert || (convert = setToArray_default);
10341         if (object.size != other2.size && !isPartial) {
10342           return false;
10343         }
10344         var stacked = stack.get(object);
10345         if (stacked) {
10346           return stacked == other2;
10347         }
10348         bitmask |= COMPARE_UNORDERED_FLAG2;
10349         stack.set(object, other2);
10350         var result = equalArrays_default(convert(object), convert(other2), bitmask, customizer, equalFunc, stack);
10351         stack["delete"](object);
10352         return result;
10353       case symbolTag2:
10354         if (symbolValueOf) {
10355           return symbolValueOf.call(object) == symbolValueOf.call(other2);
10356         }
10357     }
10358     return false;
10359   }
10360   var COMPARE_PARTIAL_FLAG2, COMPARE_UNORDERED_FLAG2, boolTag2, dateTag2, errorTag2, mapTag3, numberTag2, regexpTag2, setTag3, stringTag2, symbolTag2, arrayBufferTag2, dataViewTag3, symbolProto2, symbolValueOf, equalByTag_default;
10361   var init_equalByTag = __esm({
10362     "node_modules/lodash-es/_equalByTag.js"() {
10363       init_Symbol();
10364       init_Uint8Array();
10365       init_eq();
10366       init_equalArrays();
10367       init_mapToArray();
10368       init_setToArray();
10369       COMPARE_PARTIAL_FLAG2 = 1;
10370       COMPARE_UNORDERED_FLAG2 = 2;
10371       boolTag2 = "[object Boolean]";
10372       dateTag2 = "[object Date]";
10373       errorTag2 = "[object Error]";
10374       mapTag3 = "[object Map]";
10375       numberTag2 = "[object Number]";
10376       regexpTag2 = "[object RegExp]";
10377       setTag3 = "[object Set]";
10378       stringTag2 = "[object String]";
10379       symbolTag2 = "[object Symbol]";
10380       arrayBufferTag2 = "[object ArrayBuffer]";
10381       dataViewTag3 = "[object DataView]";
10382       symbolProto2 = Symbol_default ? Symbol_default.prototype : void 0;
10383       symbolValueOf = symbolProto2 ? symbolProto2.valueOf : void 0;
10384       equalByTag_default = equalByTag;
10385     }
10386   });
10387
10388   // node_modules/lodash-es/_equalObjects.js
10389   function equalObjects(object, other2, bitmask, customizer, equalFunc, stack) {
10390     var isPartial = bitmask & COMPARE_PARTIAL_FLAG3, objProps = getAllKeys_default(object), objLength = objProps.length, othProps = getAllKeys_default(other2), othLength = othProps.length;
10391     if (objLength != othLength && !isPartial) {
10392       return false;
10393     }
10394     var index = objLength;
10395     while (index--) {
10396       var key = objProps[index];
10397       if (!(isPartial ? key in other2 : hasOwnProperty11.call(other2, key))) {
10398         return false;
10399       }
10400     }
10401     var objStacked = stack.get(object);
10402     var othStacked = stack.get(other2);
10403     if (objStacked && othStacked) {
10404       return objStacked == other2 && othStacked == object;
10405     }
10406     var result = true;
10407     stack.set(object, other2);
10408     stack.set(other2, object);
10409     var skipCtor = isPartial;
10410     while (++index < objLength) {
10411       key = objProps[index];
10412       var objValue = object[key], othValue = other2[key];
10413       if (customizer) {
10414         var compared = isPartial ? customizer(othValue, objValue, key, other2, object, stack) : customizer(objValue, othValue, key, object, other2, stack);
10415       }
10416       if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
10417         result = false;
10418         break;
10419       }
10420       skipCtor || (skipCtor = key == "constructor");
10421     }
10422     if (result && !skipCtor) {
10423       var objCtor = object.constructor, othCtor = other2.constructor;
10424       if (objCtor != othCtor && ("constructor" in object && "constructor" in other2) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
10425         result = false;
10426       }
10427     }
10428     stack["delete"](object);
10429     stack["delete"](other2);
10430     return result;
10431   }
10432   var COMPARE_PARTIAL_FLAG3, objectProto14, hasOwnProperty11, equalObjects_default;
10433   var init_equalObjects = __esm({
10434     "node_modules/lodash-es/_equalObjects.js"() {
10435       init_getAllKeys();
10436       COMPARE_PARTIAL_FLAG3 = 1;
10437       objectProto14 = Object.prototype;
10438       hasOwnProperty11 = objectProto14.hasOwnProperty;
10439       equalObjects_default = equalObjects;
10440     }
10441   });
10442
10443   // node_modules/lodash-es/_baseIsEqualDeep.js
10444   function baseIsEqualDeep(object, other2, bitmask, customizer, equalFunc, stack) {
10445     var objIsArr = isArray_default(object), othIsArr = isArray_default(other2), objTag = objIsArr ? arrayTag2 : getTag_default(object), othTag = othIsArr ? arrayTag2 : getTag_default(other2);
10446     objTag = objTag == argsTag3 ? objectTag4 : objTag;
10447     othTag = othTag == argsTag3 ? objectTag4 : othTag;
10448     var objIsObj = objTag == objectTag4, othIsObj = othTag == objectTag4, isSameTag = objTag == othTag;
10449     if (isSameTag && isBuffer_default(object)) {
10450       if (!isBuffer_default(other2)) {
10451         return false;
10452       }
10453       objIsArr = true;
10454       objIsObj = false;
10455     }
10456     if (isSameTag && !objIsObj) {
10457       stack || (stack = new Stack_default());
10458       return objIsArr || isTypedArray_default(object) ? equalArrays_default(object, other2, bitmask, customizer, equalFunc, stack) : equalByTag_default(object, other2, objTag, bitmask, customizer, equalFunc, stack);
10459     }
10460     if (!(bitmask & COMPARE_PARTIAL_FLAG4)) {
10461       var objIsWrapped = objIsObj && hasOwnProperty12.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty12.call(other2, "__wrapped__");
10462       if (objIsWrapped || othIsWrapped) {
10463         var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other2.value() : other2;
10464         stack || (stack = new Stack_default());
10465         return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
10466       }
10467     }
10468     if (!isSameTag) {
10469       return false;
10470     }
10471     stack || (stack = new Stack_default());
10472     return equalObjects_default(object, other2, bitmask, customizer, equalFunc, stack);
10473   }
10474   var COMPARE_PARTIAL_FLAG4, argsTag3, arrayTag2, objectTag4, objectProto15, hasOwnProperty12, baseIsEqualDeep_default;
10475   var init_baseIsEqualDeep = __esm({
10476     "node_modules/lodash-es/_baseIsEqualDeep.js"() {
10477       init_Stack();
10478       init_equalArrays();
10479       init_equalByTag();
10480       init_equalObjects();
10481       init_getTag();
10482       init_isArray();
10483       init_isBuffer();
10484       init_isTypedArray();
10485       COMPARE_PARTIAL_FLAG4 = 1;
10486       argsTag3 = "[object Arguments]";
10487       arrayTag2 = "[object Array]";
10488       objectTag4 = "[object Object]";
10489       objectProto15 = Object.prototype;
10490       hasOwnProperty12 = objectProto15.hasOwnProperty;
10491       baseIsEqualDeep_default = baseIsEqualDeep;
10492     }
10493   });
10494
10495   // node_modules/lodash-es/_baseIsEqual.js
10496   function baseIsEqual(value, other2, bitmask, customizer, stack) {
10497     if (value === other2) {
10498       return true;
10499     }
10500     if (value == null || other2 == null || !isObjectLike_default(value) && !isObjectLike_default(other2)) {
10501       return value !== value && other2 !== other2;
10502     }
10503     return baseIsEqualDeep_default(value, other2, bitmask, customizer, baseIsEqual, stack);
10504   }
10505   var baseIsEqual_default;
10506   var init_baseIsEqual = __esm({
10507     "node_modules/lodash-es/_baseIsEqual.js"() {
10508       init_baseIsEqualDeep();
10509       init_isObjectLike();
10510       baseIsEqual_default = baseIsEqual;
10511     }
10512   });
10513
10514   // node_modules/lodash-es/_createBaseFor.js
10515   function createBaseFor(fromRight) {
10516     return function(object, iteratee, keysFunc) {
10517       var index = -1, iterable = Object(object), props = keysFunc(object), length2 = props.length;
10518       while (length2--) {
10519         var key = props[fromRight ? length2 : ++index];
10520         if (iteratee(iterable[key], key, iterable) === false) {
10521           break;
10522         }
10523       }
10524       return object;
10525     };
10526   }
10527   var createBaseFor_default;
10528   var init_createBaseFor = __esm({
10529     "node_modules/lodash-es/_createBaseFor.js"() {
10530       createBaseFor_default = createBaseFor;
10531     }
10532   });
10533
10534   // node_modules/lodash-es/_baseFor.js
10535   var baseFor, baseFor_default;
10536   var init_baseFor = __esm({
10537     "node_modules/lodash-es/_baseFor.js"() {
10538       init_createBaseFor();
10539       baseFor = createBaseFor_default();
10540       baseFor_default = baseFor;
10541     }
10542   });
10543
10544   // node_modules/lodash-es/now.js
10545   var now2, now_default;
10546   var init_now = __esm({
10547     "node_modules/lodash-es/now.js"() {
10548       init_root();
10549       now2 = function() {
10550         return root_default.Date.now();
10551       };
10552       now_default = now2;
10553     }
10554   });
10555
10556   // node_modules/lodash-es/debounce.js
10557   function debounce(func, wait, options2) {
10558     var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
10559     if (typeof func != "function") {
10560       throw new TypeError(FUNC_ERROR_TEXT);
10561     }
10562     wait = toNumber_default(wait) || 0;
10563     if (isObject_default(options2)) {
10564       leading = !!options2.leading;
10565       maxing = "maxWait" in options2;
10566       maxWait = maxing ? nativeMax2(toNumber_default(options2.maxWait) || 0, wait) : maxWait;
10567       trailing = "trailing" in options2 ? !!options2.trailing : trailing;
10568     }
10569     function invokeFunc(time) {
10570       var args = lastArgs, thisArg = lastThis;
10571       lastArgs = lastThis = void 0;
10572       lastInvokeTime = time;
10573       result = func.apply(thisArg, args);
10574       return result;
10575     }
10576     function leadingEdge(time) {
10577       lastInvokeTime = time;
10578       timerId = setTimeout(timerExpired, wait);
10579       return leading ? invokeFunc(time) : result;
10580     }
10581     function remainingWait(time) {
10582       var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
10583       return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
10584     }
10585     function shouldInvoke(time) {
10586       var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
10587       return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
10588     }
10589     function timerExpired() {
10590       var time = now_default();
10591       if (shouldInvoke(time)) {
10592         return trailingEdge(time);
10593       }
10594       timerId = setTimeout(timerExpired, remainingWait(time));
10595     }
10596     function trailingEdge(time) {
10597       timerId = void 0;
10598       if (trailing && lastArgs) {
10599         return invokeFunc(time);
10600       }
10601       lastArgs = lastThis = void 0;
10602       return result;
10603     }
10604     function cancel() {
10605       if (timerId !== void 0) {
10606         clearTimeout(timerId);
10607       }
10608       lastInvokeTime = 0;
10609       lastArgs = lastCallTime = lastThis = timerId = void 0;
10610     }
10611     function flush() {
10612       return timerId === void 0 ? result : trailingEdge(now_default());
10613     }
10614     function debounced() {
10615       var time = now_default(), isInvoking = shouldInvoke(time);
10616       lastArgs = arguments;
10617       lastThis = this;
10618       lastCallTime = time;
10619       if (isInvoking) {
10620         if (timerId === void 0) {
10621           return leadingEdge(lastCallTime);
10622         }
10623         if (maxing) {
10624           clearTimeout(timerId);
10625           timerId = setTimeout(timerExpired, wait);
10626           return invokeFunc(lastCallTime);
10627         }
10628       }
10629       if (timerId === void 0) {
10630         timerId = setTimeout(timerExpired, wait);
10631       }
10632       return result;
10633     }
10634     debounced.cancel = cancel;
10635     debounced.flush = flush;
10636     return debounced;
10637   }
10638   var FUNC_ERROR_TEXT, nativeMax2, nativeMin, debounce_default;
10639   var init_debounce = __esm({
10640     "node_modules/lodash-es/debounce.js"() {
10641       init_isObject();
10642       init_now();
10643       init_toNumber();
10644       FUNC_ERROR_TEXT = "Expected a function";
10645       nativeMax2 = Math.max;
10646       nativeMin = Math.min;
10647       debounce_default = debounce;
10648     }
10649   });
10650
10651   // node_modules/lodash-es/_assignMergeValue.js
10652   function assignMergeValue(object, key, value) {
10653     if (value !== void 0 && !eq_default(object[key], value) || value === void 0 && !(key in object)) {
10654       baseAssignValue_default(object, key, value);
10655     }
10656   }
10657   var assignMergeValue_default;
10658   var init_assignMergeValue = __esm({
10659     "node_modules/lodash-es/_assignMergeValue.js"() {
10660       init_baseAssignValue();
10661       init_eq();
10662       assignMergeValue_default = assignMergeValue;
10663     }
10664   });
10665
10666   // node_modules/lodash-es/isArrayLikeObject.js
10667   function isArrayLikeObject(value) {
10668     return isObjectLike_default(value) && isArrayLike_default(value);
10669   }
10670   var isArrayLikeObject_default;
10671   var init_isArrayLikeObject = __esm({
10672     "node_modules/lodash-es/isArrayLikeObject.js"() {
10673       init_isArrayLike();
10674       init_isObjectLike();
10675       isArrayLikeObject_default = isArrayLikeObject;
10676     }
10677   });
10678
10679   // node_modules/lodash-es/_safeGet.js
10680   function safeGet(object, key) {
10681     if (key === "constructor" && typeof object[key] === "function") {
10682       return;
10683     }
10684     if (key == "__proto__") {
10685       return;
10686     }
10687     return object[key];
10688   }
10689   var safeGet_default;
10690   var init_safeGet = __esm({
10691     "node_modules/lodash-es/_safeGet.js"() {
10692       safeGet_default = safeGet;
10693     }
10694   });
10695
10696   // node_modules/lodash-es/toPlainObject.js
10697   function toPlainObject(value) {
10698     return copyObject_default(value, keysIn_default(value));
10699   }
10700   var toPlainObject_default;
10701   var init_toPlainObject = __esm({
10702     "node_modules/lodash-es/toPlainObject.js"() {
10703       init_copyObject();
10704       init_keysIn();
10705       toPlainObject_default = toPlainObject;
10706     }
10707   });
10708
10709   // node_modules/lodash-es/_baseMergeDeep.js
10710   function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
10711     var objValue = safeGet_default(object, key), srcValue = safeGet_default(source, key), stacked = stack.get(srcValue);
10712     if (stacked) {
10713       assignMergeValue_default(object, key, stacked);
10714       return;
10715     }
10716     var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : void 0;
10717     var isCommon = newValue === void 0;
10718     if (isCommon) {
10719       var isArr = isArray_default(srcValue), isBuff = !isArr && isBuffer_default(srcValue), isTyped = !isArr && !isBuff && isTypedArray_default(srcValue);
10720       newValue = srcValue;
10721       if (isArr || isBuff || isTyped) {
10722         if (isArray_default(objValue)) {
10723           newValue = objValue;
10724         } else if (isArrayLikeObject_default(objValue)) {
10725           newValue = copyArray_default(objValue);
10726         } else if (isBuff) {
10727           isCommon = false;
10728           newValue = cloneBuffer_default(srcValue, true);
10729         } else if (isTyped) {
10730           isCommon = false;
10731           newValue = cloneTypedArray_default(srcValue, true);
10732         } else {
10733           newValue = [];
10734         }
10735       } else if (isPlainObject_default(srcValue) || isArguments_default(srcValue)) {
10736         newValue = objValue;
10737         if (isArguments_default(objValue)) {
10738           newValue = toPlainObject_default(objValue);
10739         } else if (!isObject_default(objValue) || isFunction_default(objValue)) {
10740           newValue = initCloneObject_default(srcValue);
10741         }
10742       } else {
10743         isCommon = false;
10744       }
10745     }
10746     if (isCommon) {
10747       stack.set(srcValue, newValue);
10748       mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
10749       stack["delete"](srcValue);
10750     }
10751     assignMergeValue_default(object, key, newValue);
10752   }
10753   var baseMergeDeep_default;
10754   var init_baseMergeDeep = __esm({
10755     "node_modules/lodash-es/_baseMergeDeep.js"() {
10756       init_assignMergeValue();
10757       init_cloneBuffer();
10758       init_cloneTypedArray();
10759       init_copyArray();
10760       init_initCloneObject();
10761       init_isArguments();
10762       init_isArray();
10763       init_isArrayLikeObject();
10764       init_isBuffer();
10765       init_isFunction();
10766       init_isObject();
10767       init_isPlainObject();
10768       init_isTypedArray();
10769       init_safeGet();
10770       init_toPlainObject();
10771       baseMergeDeep_default = baseMergeDeep;
10772     }
10773   });
10774
10775   // node_modules/lodash-es/_baseMerge.js
10776   function baseMerge(object, source, srcIndex, customizer, stack) {
10777     if (object === source) {
10778       return;
10779     }
10780     baseFor_default(source, function(srcValue, key) {
10781       stack || (stack = new Stack_default());
10782       if (isObject_default(srcValue)) {
10783         baseMergeDeep_default(object, source, key, srcIndex, baseMerge, customizer, stack);
10784       } else {
10785         var newValue = customizer ? customizer(safeGet_default(object, key), srcValue, key + "", object, source, stack) : void 0;
10786         if (newValue === void 0) {
10787           newValue = srcValue;
10788         }
10789         assignMergeValue_default(object, key, newValue);
10790       }
10791     }, keysIn_default);
10792   }
10793   var baseMerge_default;
10794   var init_baseMerge = __esm({
10795     "node_modules/lodash-es/_baseMerge.js"() {
10796       init_Stack();
10797       init_assignMergeValue();
10798       init_baseFor();
10799       init_baseMergeDeep();
10800       init_isObject();
10801       init_keysIn();
10802       init_safeGet();
10803       baseMerge_default = baseMerge;
10804     }
10805   });
10806
10807   // node_modules/lodash-es/_escapeHtmlChar.js
10808   var htmlEscapes, escapeHtmlChar, escapeHtmlChar_default;
10809   var init_escapeHtmlChar = __esm({
10810     "node_modules/lodash-es/_escapeHtmlChar.js"() {
10811       init_basePropertyOf();
10812       htmlEscapes = {
10813         "&": "&amp;",
10814         "<": "&lt;",
10815         ">": "&gt;",
10816         '"': "&quot;",
10817         "'": "&#39;"
10818       };
10819       escapeHtmlChar = basePropertyOf_default(htmlEscapes);
10820       escapeHtmlChar_default = escapeHtmlChar;
10821     }
10822   });
10823
10824   // node_modules/lodash-es/escape.js
10825   function escape2(string) {
10826     string = toString_default(string);
10827     return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, escapeHtmlChar_default) : string;
10828   }
10829   var reUnescapedHtml, reHasUnescapedHtml, escape_default;
10830   var init_escape = __esm({
10831     "node_modules/lodash-es/escape.js"() {
10832       init_escapeHtmlChar();
10833       init_toString();
10834       reUnescapedHtml = /[&<>"']/g;
10835       reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
10836       escape_default = escape2;
10837     }
10838   });
10839
10840   // node_modules/lodash-es/isEqual.js
10841   function isEqual(value, other2) {
10842     return baseIsEqual_default(value, other2);
10843   }
10844   var isEqual_default;
10845   var init_isEqual = __esm({
10846     "node_modules/lodash-es/isEqual.js"() {
10847       init_baseIsEqual();
10848       isEqual_default = isEqual;
10849     }
10850   });
10851
10852   // node_modules/lodash-es/isNumber.js
10853   function isNumber(value) {
10854     return typeof value == "number" || isObjectLike_default(value) && baseGetTag_default(value) == numberTag3;
10855   }
10856   var numberTag3, isNumber_default;
10857   var init_isNumber = __esm({
10858     "node_modules/lodash-es/isNumber.js"() {
10859       init_baseGetTag();
10860       init_isObjectLike();
10861       numberTag3 = "[object Number]";
10862       isNumber_default = isNumber;
10863     }
10864   });
10865
10866   // node_modules/lodash-es/merge.js
10867   var merge2, merge_default3;
10868   var init_merge4 = __esm({
10869     "node_modules/lodash-es/merge.js"() {
10870       init_baseMerge();
10871       init_createAssigner();
10872       merge2 = createAssigner_default(function(object, source, srcIndex) {
10873         baseMerge_default(object, source, srcIndex);
10874       });
10875       merge_default3 = merge2;
10876     }
10877   });
10878
10879   // node_modules/lodash-es/throttle.js
10880   function throttle(func, wait, options2) {
10881     var leading = true, trailing = true;
10882     if (typeof func != "function") {
10883       throw new TypeError(FUNC_ERROR_TEXT2);
10884     }
10885     if (isObject_default(options2)) {
10886       leading = "leading" in options2 ? !!options2.leading : leading;
10887       trailing = "trailing" in options2 ? !!options2.trailing : trailing;
10888     }
10889     return debounce_default(func, wait, {
10890       "leading": leading,
10891       "maxWait": wait,
10892       "trailing": trailing
10893     });
10894   }
10895   var FUNC_ERROR_TEXT2, throttle_default;
10896   var init_throttle = __esm({
10897     "node_modules/lodash-es/throttle.js"() {
10898       init_debounce();
10899       init_isObject();
10900       FUNC_ERROR_TEXT2 = "Expected a function";
10901       throttle_default = throttle;
10902     }
10903   });
10904
10905   // node_modules/lodash-es/_unescapeHtmlChar.js
10906   var htmlUnescapes, unescapeHtmlChar, unescapeHtmlChar_default;
10907   var init_unescapeHtmlChar = __esm({
10908     "node_modules/lodash-es/_unescapeHtmlChar.js"() {
10909       init_basePropertyOf();
10910       htmlUnescapes = {
10911         "&amp;": "&",
10912         "&lt;": "<",
10913         "&gt;": ">",
10914         "&quot;": '"',
10915         "&#39;": "'"
10916       };
10917       unescapeHtmlChar = basePropertyOf_default(htmlUnescapes);
10918       unescapeHtmlChar_default = unescapeHtmlChar;
10919     }
10920   });
10921
10922   // node_modules/lodash-es/unescape.js
10923   function unescape(string) {
10924     string = toString_default(string);
10925     return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, unescapeHtmlChar_default) : string;
10926   }
10927   var reEscapedHtml, reHasEscapedHtml, unescape_default;
10928   var init_unescape = __esm({
10929     "node_modules/lodash-es/unescape.js"() {
10930       init_toString();
10931       init_unescapeHtmlChar();
10932       reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g;
10933       reHasEscapedHtml = RegExp(reEscapedHtml.source);
10934       unescape_default = unescape;
10935     }
10936   });
10937
10938   // node_modules/lodash-es/lodash.js
10939   var init_lodash = __esm({
10940     "node_modules/lodash-es/lodash.js"() {
10941       init_escape();
10942       init_isArray();
10943       init_isEqual();
10944       init_isNumber();
10945       init_merge4();
10946       init_unescape();
10947     }
10948   });
10949
10950   // modules/osm/tags.js
10951   var tags_exports = {};
10952   __export(tags_exports, {
10953     allowUpperCaseTagValues: () => allowUpperCaseTagValues,
10954     isColourValid: () => isColourValid,
10955     osmAreaKeys: () => osmAreaKeys,
10956     osmAreaKeysExceptions: () => osmAreaKeysExceptions,
10957     osmFlowingWaterwayTagValues: () => osmFlowingWaterwayTagValues,
10958     osmIsInterestingTag: () => osmIsInterestingTag,
10959     osmLifecyclePrefixes: () => osmLifecyclePrefixes,
10960     osmLineTags: () => osmLineTags,
10961     osmMutuallyExclusiveTagPairs: () => osmMutuallyExclusiveTagPairs,
10962     osmNodeGeometriesForTags: () => osmNodeGeometriesForTags,
10963     osmOneWayBackwardTags: () => osmOneWayBackwardTags,
10964     osmOneWayBiDirectionalTags: () => osmOneWayBiDirectionalTags,
10965     osmOneWayForwardTags: () => osmOneWayForwardTags,
10966     osmOneWayTags: () => osmOneWayTags,
10967     osmPathHighwayTagValues: () => osmPathHighwayTagValues,
10968     osmPavedTags: () => osmPavedTags,
10969     osmPointTags: () => osmPointTags,
10970     osmRailwayTrackTagValues: () => osmRailwayTrackTagValues,
10971     osmRemoveLifecyclePrefix: () => osmRemoveLifecyclePrefix,
10972     osmRightSideIsInsideTags: () => osmRightSideIsInsideTags,
10973     osmRoutableAerowayTags: () => osmRoutableAerowayTags,
10974     osmRoutableHighwayTagValues: () => osmRoutableHighwayTagValues,
10975     osmSemipavedTags: () => osmSemipavedTags,
10976     osmSetAreaKeys: () => osmSetAreaKeys,
10977     osmSetLineTags: () => osmSetLineTags,
10978     osmSetPointTags: () => osmSetPointTags,
10979     osmSetVertexTags: () => osmSetVertexTags,
10980     osmShouldRenderDirection: () => osmShouldRenderDirection,
10981     osmTagSuggestingArea: () => osmTagSuggestingArea,
10982     osmVertexTags: () => osmVertexTags
10983   });
10984   function osmIsInterestingTag(key) {
10985     return key !== "attribution" && key !== "created_by" && key !== "source" && key !== "odbl" && key.indexOf("source:") !== 0 && key.indexOf("source_ref") !== 0 && // purposely exclude colon
10986     key.indexOf("tiger:") !== 0;
10987   }
10988   function osmRemoveLifecyclePrefix(key) {
10989     const keySegments = key.split(":");
10990     if (keySegments.length === 1) return key;
10991     if (keySegments[0] in osmLifecyclePrefixes) {
10992       return key.slice(keySegments[0].length + 1);
10993     }
10994     return key;
10995   }
10996   function osmSetAreaKeys(value) {
10997     osmAreaKeys = value;
10998   }
10999   function osmTagSuggestingArea(tags) {
11000     if (tags.area === "yes") return { area: "yes" };
11001     if (tags.area === "no") return null;
11002     var returnTags = {};
11003     for (var realKey in tags) {
11004       const key = osmRemoveLifecyclePrefix(realKey);
11005       if (key in osmAreaKeys && !(tags[realKey] in osmAreaKeys[key])) {
11006         returnTags[realKey] = tags[realKey];
11007         return returnTags;
11008       }
11009       if (key in osmAreaKeysExceptions && tags[realKey] in osmAreaKeysExceptions[key]) {
11010         returnTags[realKey] = tags[realKey];
11011         return returnTags;
11012       }
11013     }
11014     return null;
11015   }
11016   function osmSetLineTags(value) {
11017     osmLineTags = value;
11018   }
11019   function osmSetPointTags(value) {
11020     osmPointTags = value;
11021   }
11022   function osmSetVertexTags(value) {
11023     osmVertexTags = value;
11024   }
11025   function osmNodeGeometriesForTags(nodeTags) {
11026     var geometries = {};
11027     for (var key in nodeTags) {
11028       if (osmPointTags[key] && (osmPointTags[key]["*"] || osmPointTags[key][nodeTags[key]])) {
11029         geometries.point = true;
11030       }
11031       if (osmVertexTags[key] && (osmVertexTags[key]["*"] || osmVertexTags[key][nodeTags[key]])) {
11032         geometries.vertex = true;
11033       }
11034       if (geometries.point && geometries.vertex) break;
11035     }
11036     return geometries;
11037   }
11038   function isColourValid(value) {
11039     if (!value.match(/^(#([0-9a-fA-F]{3}){1,2}|\w+)$/)) {
11040       return false;
11041     }
11042     if (!CSS.supports("color", value) || ["unset", "inherit", "initial", "revert"].includes(value)) {
11043       return false;
11044     }
11045     return true;
11046   }
11047   function osmShouldRenderDirection(vertexTags, wayTags) {
11048     if (vertexTags.highway || vertexTags.traffic_sign || vertexTags.traffic_calming || vertexTags.barrier) {
11049       return !!(wayTags.highway || wayTags.railway);
11050     }
11051     if (vertexTags.railway) return !!wayTags.railway;
11052     if (vertexTags.waterway) return !!wayTags.waterway;
11053     if (vertexTags.cycleway === "asl") return !!wayTags.highway;
11054     return true;
11055   }
11056   var osmLifecyclePrefixes, osmAreaKeys, osmAreaKeysExceptions, osmLineTags, osmPointTags, osmVertexTags, osmOneWayForwardTags, osmOneWayBackwardTags, osmOneWayBiDirectionalTags, osmOneWayTags, osmPavedTags, osmSemipavedTags, osmRightSideIsInsideTags, osmRoutableHighwayTagValues, osmRoutableAerowayTags, osmPathHighwayTagValues, osmRailwayTrackTagValues, osmFlowingWaterwayTagValues, allowUpperCaseTagValues, osmMutuallyExclusiveTagPairs;
11057   var init_tags = __esm({
11058     "modules/osm/tags.js"() {
11059       "use strict";
11060       init_lodash();
11061       osmLifecyclePrefixes = {
11062         // nonexistent, might be built
11063         proposed: true,
11064         planned: true,
11065         // under maintenance or between groundbreaking and opening
11066         construction: true,
11067         // existent but not functional
11068         disused: true,
11069         // dilapidated to nonexistent
11070         abandoned: true,
11071         was: true,
11072         // nonexistent, still may appear in imagery
11073         dismantled: true,
11074         razed: true,
11075         demolished: true,
11076         destroyed: true,
11077         removed: true,
11078         obliterated: true,
11079         // existent occasionally, e.g. stormwater drainage basin
11080         intermittent: true
11081       };
11082       osmAreaKeys = {};
11083       osmAreaKeysExceptions = {
11084         highway: {
11085           elevator: true,
11086           rest_area: true,
11087           services: true
11088         },
11089         public_transport: {
11090           platform: true
11091         },
11092         railway: {
11093           platform: true,
11094           roundhouse: true,
11095           station: true,
11096           traverser: true,
11097           turntable: true,
11098           wash: true,
11099           ventilation_shaft: true
11100         },
11101         waterway: {
11102           dam: true
11103         },
11104         amenity: {
11105           bicycle_parking: true
11106         }
11107       };
11108       osmLineTags = {};
11109       osmPointTags = {};
11110       osmVertexTags = {};
11111       osmOneWayForwardTags = {
11112         "aerialway": {
11113           "chair_lift": true,
11114           "drag_lift": true,
11115           "j-bar": true,
11116           "magic_carpet": true,
11117           "mixed_lift": true,
11118           "platter": true,
11119           "rope_tow": true,
11120           "t-bar": true,
11121           "zip_line": true
11122         },
11123         "conveying": {
11124           "forward": true
11125         },
11126         "highway": {
11127           "motorway": true
11128         },
11129         "junction": {
11130           "circular": true,
11131           "roundabout": true
11132         },
11133         "man_made": {
11134           "goods_conveyor": true,
11135           "piste:halfpipe": true
11136         },
11137         "oneway": {
11138           "yes": true
11139         },
11140         "piste:type": {
11141           "downhill": true,
11142           "sled": true,
11143           "yes": true
11144         },
11145         "seamark:type": {
11146           "two-way_route": true,
11147           "recommended_traffic_lane": true,
11148           "separation_lane": true,
11149           "separation_roundabout": true
11150         },
11151         "waterway": {
11152           "canal": true,
11153           "ditch": true,
11154           "drain": true,
11155           "fish_pass": true,
11156           "flowline": true,
11157           "pressurised": true,
11158           "river": true,
11159           "spillway": true,
11160           "stream": true,
11161           "tidal_channel": true
11162         }
11163       };
11164       osmOneWayBackwardTags = {
11165         "conveying": {
11166           "backward": true
11167         },
11168         "oneway": {
11169           "-1": true
11170         }
11171       };
11172       osmOneWayBiDirectionalTags = {
11173         "conveying": {
11174           "reversible": true
11175         },
11176         "oneway": {
11177           "alternating": true,
11178           "reversible": true
11179         }
11180       };
11181       osmOneWayTags = merge_default3(
11182         osmOneWayForwardTags,
11183         osmOneWayBackwardTags,
11184         osmOneWayBiDirectionalTags
11185       );
11186       osmPavedTags = {
11187         "surface": {
11188           "paved": true,
11189           "asphalt": true,
11190           "concrete": true,
11191           "chipseal": true,
11192           "concrete:lanes": true,
11193           "concrete:plates": true
11194         },
11195         "tracktype": {
11196           "grade1": true
11197         }
11198       };
11199       osmSemipavedTags = {
11200         "surface": {
11201           "cobblestone": true,
11202           "cobblestone:flattened": true,
11203           "unhewn_cobblestone": true,
11204           "sett": true,
11205           "paving_stones": true,
11206           "metal": true,
11207           "wood": true
11208         }
11209       };
11210       osmRightSideIsInsideTags = {
11211         "natural": {
11212           "cliff": true,
11213           "coastline": "coastline"
11214         },
11215         "barrier": {
11216           "retaining_wall": true,
11217           "kerb": true,
11218           "guard_rail": true,
11219           "city_wall": true
11220         },
11221         "man_made": {
11222           "embankment": true,
11223           "quay": true
11224         },
11225         "waterway": {
11226           "weir": true
11227         }
11228       };
11229       osmRoutableHighwayTagValues = {
11230         motorway: true,
11231         trunk: true,
11232         primary: true,
11233         secondary: true,
11234         tertiary: true,
11235         residential: true,
11236         motorway_link: true,
11237         trunk_link: true,
11238         primary_link: true,
11239         secondary_link: true,
11240         tertiary_link: true,
11241         unclassified: true,
11242         road: true,
11243         service: true,
11244         track: true,
11245         living_street: true,
11246         bus_guideway: true,
11247         busway: true,
11248         path: true,
11249         footway: true,
11250         cycleway: true,
11251         bridleway: true,
11252         pedestrian: true,
11253         corridor: true,
11254         steps: true,
11255         ladder: true
11256       };
11257       osmRoutableAerowayTags = {
11258         runway: true,
11259         taxiway: true
11260       };
11261       osmPathHighwayTagValues = {
11262         path: true,
11263         footway: true,
11264         cycleway: true,
11265         bridleway: true,
11266         pedestrian: true,
11267         corridor: true,
11268         steps: true,
11269         ladder: true
11270       };
11271       osmRailwayTrackTagValues = {
11272         rail: true,
11273         light_rail: true,
11274         tram: true,
11275         subway: true,
11276         monorail: true,
11277         funicular: true,
11278         miniature: true,
11279         narrow_gauge: true,
11280         disused: true,
11281         preserved: true
11282       };
11283       osmFlowingWaterwayTagValues = {
11284         canal: true,
11285         ditch: true,
11286         drain: true,
11287         fish_pass: true,
11288         flowline: true,
11289         river: true,
11290         stream: true,
11291         tidal_channel: true
11292       };
11293       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/;
11294       osmMutuallyExclusiveTagPairs = [
11295         ["noname", "name"],
11296         ["noref", "ref"],
11297         ["nohousenumber", "addr:housenumber"],
11298         ["noaddress", "addr:housenumber"],
11299         ["noaddress", "addr:housename"],
11300         ["noaddress", "addr:unit"],
11301         ["addr:nostreet", "addr:street"]
11302       ];
11303     }
11304   });
11305
11306   // modules/util/array.js
11307   var array_exports = {};
11308   __export(array_exports, {
11309     utilArrayChunk: () => utilArrayChunk,
11310     utilArrayDifference: () => utilArrayDifference,
11311     utilArrayFlatten: () => utilArrayFlatten,
11312     utilArrayGroupBy: () => utilArrayGroupBy,
11313     utilArrayIdentical: () => utilArrayIdentical,
11314     utilArrayIntersection: () => utilArrayIntersection,
11315     utilArrayUnion: () => utilArrayUnion,
11316     utilArrayUniq: () => utilArrayUniq,
11317     utilArrayUniqBy: () => utilArrayUniqBy
11318   });
11319   function utilArrayIdentical(a2, b2) {
11320     if (a2 === b2) return true;
11321     var i3 = a2.length;
11322     if (i3 !== b2.length) return false;
11323     while (i3--) {
11324       if (a2[i3] !== b2[i3]) return false;
11325     }
11326     return true;
11327   }
11328   function utilArrayDifference(a2, b2) {
11329     var other2 = new Set(b2);
11330     return Array.from(new Set(a2)).filter(function(v2) {
11331       return !other2.has(v2);
11332     });
11333   }
11334   function utilArrayIntersection(a2, b2) {
11335     var other2 = new Set(b2);
11336     return Array.from(new Set(a2)).filter(function(v2) {
11337       return other2.has(v2);
11338     });
11339   }
11340   function utilArrayUnion(a2, b2) {
11341     var result = new Set(a2);
11342     b2.forEach(function(v2) {
11343       result.add(v2);
11344     });
11345     return Array.from(result);
11346   }
11347   function utilArrayUniq(a2) {
11348     return Array.from(new Set(a2));
11349   }
11350   function utilArrayChunk(a2, chunkSize) {
11351     if (!chunkSize || chunkSize < 0) return [a2.slice()];
11352     var result = new Array(Math.ceil(a2.length / chunkSize));
11353     return Array.from(result, function(item, i3) {
11354       return a2.slice(i3 * chunkSize, i3 * chunkSize + chunkSize);
11355     });
11356   }
11357   function utilArrayFlatten(a2) {
11358     return a2.reduce(function(acc, val) {
11359       return acc.concat(val);
11360     }, []);
11361   }
11362   function utilArrayGroupBy(a2, key) {
11363     return a2.reduce(function(acc, item) {
11364       var group = typeof key === "function" ? key(item) : item[key];
11365       (acc[group] = acc[group] || []).push(item);
11366       return acc;
11367     }, {});
11368   }
11369   function utilArrayUniqBy(a2, key) {
11370     var seen = /* @__PURE__ */ new Set();
11371     return a2.reduce(function(acc, item) {
11372       var val = typeof key === "function" ? key(item) : item[key];
11373       if (val && !seen.has(val)) {
11374         seen.add(val);
11375         acc.push(item);
11376       }
11377       return acc;
11378     }, []);
11379   }
11380   var init_array3 = __esm({
11381     "modules/util/array.js"() {
11382       "use strict";
11383     }
11384   });
11385
11386   // node_modules/diacritics/index.js
11387   var require_diacritics = __commonJS({
11388     "node_modules/diacritics/index.js"(exports2) {
11389       exports2.remove = removeDiacritics2;
11390       var replacementList = [
11391         {
11392           base: " ",
11393           chars: "\xA0"
11394         },
11395         {
11396           base: "0",
11397           chars: "\u07C0"
11398         },
11399         {
11400           base: "A",
11401           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"
11402         },
11403         {
11404           base: "AA",
11405           chars: "\uA732"
11406         },
11407         {
11408           base: "AE",
11409           chars: "\xC6\u01FC\u01E2"
11410         },
11411         {
11412           base: "AO",
11413           chars: "\uA734"
11414         },
11415         {
11416           base: "AU",
11417           chars: "\uA736"
11418         },
11419         {
11420           base: "AV",
11421           chars: "\uA738\uA73A"
11422         },
11423         {
11424           base: "AY",
11425           chars: "\uA73C"
11426         },
11427         {
11428           base: "B",
11429           chars: "\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0181"
11430         },
11431         {
11432           base: "C",
11433           chars: "\u24B8\uFF23\uA73E\u1E08\u0106C\u0108\u010A\u010C\xC7\u0187\u023B"
11434         },
11435         {
11436           base: "D",
11437           chars: "\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018A\u0189\u1D05\uA779"
11438         },
11439         {
11440           base: "Dh",
11441           chars: "\xD0"
11442         },
11443         {
11444           base: "DZ",
11445           chars: "\u01F1\u01C4"
11446         },
11447         {
11448           base: "Dz",
11449           chars: "\u01F2\u01C5"
11450         },
11451         {
11452           base: "E",
11453           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"
11454         },
11455         {
11456           base: "F",
11457           chars: "\uA77C\u24BB\uFF26\u1E1E\u0191\uA77B"
11458         },
11459         {
11460           base: "G",
11461           chars: "\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E\u0262"
11462         },
11463         {
11464           base: "H",
11465           chars: "\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D"
11466         },
11467         {
11468           base: "I",
11469           chars: "\u24BE\uFF29\xCC\xCD\xCE\u0128\u012A\u012C\u0130\xCF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197"
11470         },
11471         {
11472           base: "J",
11473           chars: "\u24BF\uFF2A\u0134\u0248\u0237"
11474         },
11475         {
11476           base: "K",
11477           chars: "\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2"
11478         },
11479         {
11480           base: "L",
11481           chars: "\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780"
11482         },
11483         {
11484           base: "LJ",
11485           chars: "\u01C7"
11486         },
11487         {
11488           base: "Lj",
11489           chars: "\u01C8"
11490         },
11491         {
11492           base: "M",
11493           chars: "\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C\u03FB"
11494         },
11495         {
11496           base: "N",
11497           chars: "\uA7A4\u0220\u24C3\uFF2E\u01F8\u0143\xD1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u019D\uA790\u1D0E"
11498         },
11499         {
11500           base: "NJ",
11501           chars: "\u01CA"
11502         },
11503         {
11504           base: "Nj",
11505           chars: "\u01CB"
11506         },
11507         {
11508           base: "O",
11509           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"
11510         },
11511         {
11512           base: "OE",
11513           chars: "\u0152"
11514         },
11515         {
11516           base: "OI",
11517           chars: "\u01A2"
11518         },
11519         {
11520           base: "OO",
11521           chars: "\uA74E"
11522         },
11523         {
11524           base: "OU",
11525           chars: "\u0222"
11526         },
11527         {
11528           base: "P",
11529           chars: "\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754"
11530         },
11531         {
11532           base: "Q",
11533           chars: "\u24C6\uFF31\uA756\uA758\u024A"
11534         },
11535         {
11536           base: "R",
11537           chars: "\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782"
11538         },
11539         {
11540           base: "S",
11541           chars: "\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784"
11542         },
11543         {
11544           base: "T",
11545           chars: "\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786"
11546         },
11547         {
11548           base: "Th",
11549           chars: "\xDE"
11550         },
11551         {
11552           base: "TZ",
11553           chars: "\uA728"
11554         },
11555         {
11556           base: "U",
11557           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"
11558         },
11559         {
11560           base: "V",
11561           chars: "\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245"
11562         },
11563         {
11564           base: "VY",
11565           chars: "\uA760"
11566         },
11567         {
11568           base: "W",
11569           chars: "\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72"
11570         },
11571         {
11572           base: "X",
11573           chars: "\u24CD\uFF38\u1E8A\u1E8C"
11574         },
11575         {
11576           base: "Y",
11577           chars: "\u24CE\uFF39\u1EF2\xDD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE"
11578         },
11579         {
11580           base: "Z",
11581           chars: "\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762"
11582         },
11583         {
11584           base: "a",
11585           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"
11586         },
11587         {
11588           base: "aa",
11589           chars: "\uA733"
11590         },
11591         {
11592           base: "ae",
11593           chars: "\xE6\u01FD\u01E3"
11594         },
11595         {
11596           base: "ao",
11597           chars: "\uA735"
11598         },
11599         {
11600           base: "au",
11601           chars: "\uA737"
11602         },
11603         {
11604           base: "av",
11605           chars: "\uA739\uA73B"
11606         },
11607         {
11608           base: "ay",
11609           chars: "\uA73D"
11610         },
11611         {
11612           base: "b",
11613           chars: "\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253\u0182"
11614         },
11615         {
11616           base: "c",
11617           chars: "\uFF43\u24D2\u0107\u0109\u010B\u010D\xE7\u1E09\u0188\u023C\uA73F\u2184"
11618         },
11619         {
11620           base: "d",
11621           chars: "\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\u018B\u13E7\u0501\uA7AA"
11622         },
11623         {
11624           base: "dh",
11625           chars: "\xF0"
11626         },
11627         {
11628           base: "dz",
11629           chars: "\u01F3\u01C6"
11630         },
11631         {
11632           base: "e",
11633           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"
11634         },
11635         {
11636           base: "f",
11637           chars: "\u24D5\uFF46\u1E1F\u0192"
11638         },
11639         {
11640           base: "ff",
11641           chars: "\uFB00"
11642         },
11643         {
11644           base: "fi",
11645           chars: "\uFB01"
11646         },
11647         {
11648           base: "fl",
11649           chars: "\uFB02"
11650         },
11651         {
11652           base: "ffi",
11653           chars: "\uFB03"
11654         },
11655         {
11656           base: "ffl",
11657           chars: "\uFB04"
11658         },
11659         {
11660           base: "g",
11661           chars: "\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\uA77F\u1D79"
11662         },
11663         {
11664           base: "h",
11665           chars: "\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265"
11666         },
11667         {
11668           base: "hv",
11669           chars: "\u0195"
11670         },
11671         {
11672           base: "i",
11673           chars: "\u24D8\uFF49\xEC\xED\xEE\u0129\u012B\u012D\xEF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131"
11674         },
11675         {
11676           base: "j",
11677           chars: "\u24D9\uFF4A\u0135\u01F0\u0249"
11678         },
11679         {
11680           base: "k",
11681           chars: "\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3"
11682         },
11683         {
11684           base: "l",
11685           chars: "\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747\u026D"
11686         },
11687         {
11688           base: "lj",
11689           chars: "\u01C9"
11690         },
11691         {
11692           base: "m",
11693           chars: "\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F"
11694         },
11695         {
11696           base: "n",
11697           chars: "\u24DD\uFF4E\u01F9\u0144\xF1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5\u043B\u0509"
11698         },
11699         {
11700           base: "nj",
11701           chars: "\u01CC"
11702         },
11703         {
11704           base: "o",
11705           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"
11706         },
11707         {
11708           base: "oe",
11709           chars: "\u0153"
11710         },
11711         {
11712           base: "oi",
11713           chars: "\u01A3"
11714         },
11715         {
11716           base: "oo",
11717           chars: "\uA74F"
11718         },
11719         {
11720           base: "ou",
11721           chars: "\u0223"
11722         },
11723         {
11724           base: "p",
11725           chars: "\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755\u03C1"
11726         },
11727         {
11728           base: "q",
11729           chars: "\u24E0\uFF51\u024B\uA757\uA759"
11730         },
11731         {
11732           base: "r",
11733           chars: "\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783"
11734         },
11735         {
11736           base: "s",
11737           chars: "\u24E2\uFF53\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B\u0282"
11738         },
11739         {
11740           base: "ss",
11741           chars: "\xDF"
11742         },
11743         {
11744           base: "t",
11745           chars: "\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787"
11746         },
11747         {
11748           base: "th",
11749           chars: "\xFE"
11750         },
11751         {
11752           base: "tz",
11753           chars: "\uA729"
11754         },
11755         {
11756           base: "u",
11757           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"
11758         },
11759         {
11760           base: "v",
11761           chars: "\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C"
11762         },
11763         {
11764           base: "vy",
11765           chars: "\uA761"
11766         },
11767         {
11768           base: "w",
11769           chars: "\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73"
11770         },
11771         {
11772           base: "x",
11773           chars: "\u24E7\uFF58\u1E8B\u1E8D"
11774         },
11775         {
11776           base: "y",
11777           chars: "\u24E8\uFF59\u1EF3\xFD\u0177\u1EF9\u0233\u1E8F\xFF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF"
11778         },
11779         {
11780           base: "z",
11781           chars: "\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763"
11782         }
11783       ];
11784       var diacriticsMap = {};
11785       for (i3 = 0; i3 < replacementList.length; i3 += 1) {
11786         chars = replacementList[i3].chars;
11787         for (j2 = 0; j2 < chars.length; j2 += 1) {
11788           diacriticsMap[chars[j2]] = replacementList[i3].base;
11789         }
11790       }
11791       var chars;
11792       var j2;
11793       var i3;
11794       function removeDiacritics2(str) {
11795         return str.replace(/[^\u0000-\u007e]/g, function(c2) {
11796           return diacriticsMap[c2] || c2;
11797         });
11798       }
11799       exports2.replacementList = replacementList;
11800       exports2.diacriticsMap = diacriticsMap;
11801     }
11802   });
11803
11804   // node_modules/alif-toolkit/lib/isArabic.js
11805   var require_isArabic = __commonJS({
11806     "node_modules/alif-toolkit/lib/isArabic.js"(exports2) {
11807       "use strict";
11808       Object.defineProperty(exports2, "__esModule", { value: true });
11809       exports2.isArabic = isArabic;
11810       exports2.isMath = isMath;
11811       var arabicBlocks = [
11812         [1536, 1791],
11813         // Arabic https://www.unicode.org/charts/PDF/U0600.pdf
11814         [1872, 1919],
11815         // supplement https://www.unicode.org/charts/PDF/U0750.pdf
11816         [2208, 2303],
11817         // Extended-A https://www.unicode.org/charts/PDF/U08A0.pdf
11818         [64336, 65023],
11819         // Presentation Forms-A https://www.unicode.org/charts/PDF/UFB50.pdf
11820         [65136, 65279],
11821         // Presentation Forms-B https://www.unicode.org/charts/PDF/UFE70.pdf
11822         [69216, 69247],
11823         // Rumi numerals https://www.unicode.org/charts/PDF/U10E60.pdf
11824         [126064, 126143],
11825         // Indic Siyaq numerals https://www.unicode.org/charts/PDF/U1EC70.pdf
11826         [126464, 126719]
11827         // Mathematical Alphabetic symbols https://www.unicode.org/charts/PDF/U1EE00.pdf
11828       ];
11829       function isArabic(char) {
11830         if (char.length > 1) {
11831           throw new Error("isArabic works on only one-character strings");
11832         }
11833         let code = char.charCodeAt(0);
11834         for (let i3 = 0; i3 < arabicBlocks.length; i3++) {
11835           let block2 = arabicBlocks[i3];
11836           if (code >= block2[0] && code <= block2[1]) {
11837             return true;
11838           }
11839         }
11840         return false;
11841       }
11842       function isMath(char) {
11843         if (char.length > 2) {
11844           throw new Error("isMath works on only one-character strings");
11845         }
11846         let code = char.charCodeAt(0);
11847         return code >= 1632 && code <= 1644 || code >= 1776 && code <= 1785;
11848       }
11849     }
11850   });
11851
11852   // node_modules/alif-toolkit/lib/unicode-arabic.js
11853   var require_unicode_arabic = __commonJS({
11854     "node_modules/alif-toolkit/lib/unicode-arabic.js"(exports2) {
11855       "use strict";
11856       Object.defineProperty(exports2, "__esModule", { value: true });
11857       var arabicReference = {
11858         "alef": {
11859           "normal": [
11860             "\u0627"
11861           ],
11862           "madda_above": {
11863             "normal": [
11864               "\u0627\u0653",
11865               "\u0622"
11866             ],
11867             "isolated": "\uFE81",
11868             "final": "\uFE82"
11869           },
11870           "hamza_above": {
11871             "normal": [
11872               "\u0627\u0654",
11873               "\u0623"
11874             ],
11875             "isolated": "\uFE83",
11876             "final": "\uFE84"
11877           },
11878           "hamza_below": {
11879             "normal": [
11880               "\u0627\u0655",
11881               "\u0625"
11882             ],
11883             "isolated": "\uFE87",
11884             "final": "\uFE88"
11885           },
11886           "wasla": {
11887             "normal": "\u0671",
11888             "isolated": "\uFB50",
11889             "final": "\uFB51"
11890           },
11891           "wavy_hamza_above": [
11892             "\u0672"
11893           ],
11894           "wavy_hamza_below": [
11895             "\u0627\u065F",
11896             "\u0673"
11897           ],
11898           "high_hamza": [
11899             "\u0675",
11900             "\u0627\u0674"
11901           ],
11902           "indic_two_above": [
11903             "\u0773"
11904           ],
11905           "indic_three_above": [
11906             "\u0774"
11907           ],
11908           "fathatan": {
11909             "normal": [
11910               "\u0627\u064B"
11911             ],
11912             "final": "\uFD3C",
11913             "isolated": "\uFD3D"
11914           },
11915           "isolated": "\uFE8D",
11916           "final": "\uFE8E"
11917         },
11918         "beh": {
11919           "normal": [
11920             "\u0628"
11921           ],
11922           "dotless": [
11923             "\u066E"
11924           ],
11925           "three_dots_horizontally_below": [
11926             "\u0750"
11927           ],
11928           "dot_below_three_dots_above": [
11929             "\u0751"
11930           ],
11931           "three_dots_pointing_upwards_below": [
11932             "\u0752"
11933           ],
11934           "three_dots_pointing_upwards_below_two_dots_above": [
11935             "\u0753"
11936           ],
11937           "two_dots_below_dot_above": [
11938             "\u0754"
11939           ],
11940           "inverted_small_v_below": [
11941             "\u0755"
11942           ],
11943           "small_v": [
11944             "\u0756"
11945           ],
11946           "small_v_below": [
11947             "\u08A0"
11948           ],
11949           "hamza_above": [
11950             "\u08A1"
11951           ],
11952           "small_meem_above": [
11953             "\u08B6"
11954           ],
11955           "isolated": "\uFE8F",
11956           "final": "\uFE90",
11957           "initial": "\uFE91",
11958           "medial": "\uFE92"
11959         },
11960         "teh marbuta": {
11961           "normal": [
11962             "\u0629"
11963           ],
11964           "isolated": "\uFE93",
11965           "final": "\uFE94"
11966         },
11967         "teh": {
11968           "normal": [
11969             "\u062A"
11970           ],
11971           "ring": [
11972             "\u067C"
11973           ],
11974           "three_dots_above_downwards": [
11975             "\u067D"
11976           ],
11977           "small_teh_above": [
11978             "\u08B8"
11979           ],
11980           "isolated": "\uFE95",
11981           "final": "\uFE96",
11982           "initial": "\uFE97",
11983           "medial": "\uFE98"
11984         },
11985         "theh": {
11986           "normal": [
11987             "\u062B"
11988           ],
11989           "isolated": "\uFE99",
11990           "final": "\uFE9A",
11991           "initial": "\uFE9B",
11992           "medial": "\uFE9C"
11993         },
11994         "jeem": {
11995           "normal": [
11996             "\u062C"
11997           ],
11998           "two_dots_above": [
11999             "\u08A2"
12000           ],
12001           "isolated": "\uFE9D",
12002           "final": "\uFE9E",
12003           "initial": "\uFE9F",
12004           "medial": "\uFEA0"
12005         },
12006         "hah": {
12007           "normal": [
12008             "\u062D"
12009           ],
12010           "hamza_above": [
12011             "\u0681"
12012           ],
12013           "two_dots_vertical_above": [
12014             "\u0682"
12015           ],
12016           "three_dots_above": [
12017             "\u0685"
12018           ],
12019           "two_dots_above": [
12020             "\u0757"
12021           ],
12022           "three_dots_pointing_upwards_below": [
12023             "\u0758"
12024           ],
12025           "small_tah_below": [
12026             "\u076E"
12027           ],
12028           "small_tah_two_dots": [
12029             "\u076F"
12030           ],
12031           "small_tah_above": [
12032             "\u0772"
12033           ],
12034           "indic_four_below": [
12035             "\u077C"
12036           ],
12037           "isolated": "\uFEA1",
12038           "final": "\uFEA2",
12039           "initial": "\uFEA3",
12040           "medial": "\uFEA4"
12041         },
12042         "khah": {
12043           "normal": [
12044             "\u062E"
12045           ],
12046           "isolated": "\uFEA5",
12047           "final": "\uFEA6",
12048           "initial": "\uFEA7",
12049           "medial": "\uFEA8"
12050         },
12051         "dal": {
12052           "normal": [
12053             "\u062F"
12054           ],
12055           "ring": [
12056             "\u0689"
12057           ],
12058           "dot_below": [
12059             "\u068A"
12060           ],
12061           "dot_below_small_tah": [
12062             "\u068B"
12063           ],
12064           "three_dots_above_downwards": [
12065             "\u068F"
12066           ],
12067           "four_dots_above": [
12068             "\u0690"
12069           ],
12070           "inverted_v": [
12071             "\u06EE"
12072           ],
12073           "two_dots_vertically_below_small_tah": [
12074             "\u0759"
12075           ],
12076           "inverted_small_v_below": [
12077             "\u075A"
12078           ],
12079           "three_dots_below": [
12080             "\u08AE"
12081           ],
12082           "isolated": "\uFEA9",
12083           "final": "\uFEAA"
12084         },
12085         "thal": {
12086           "normal": [
12087             "\u0630"
12088           ],
12089           "isolated": "\uFEAB",
12090           "final": "\uFEAC"
12091         },
12092         "reh": {
12093           "normal": [
12094             "\u0631"
12095           ],
12096           "small_v": [
12097             "\u0692"
12098           ],
12099           "ring": [
12100             "\u0693"
12101           ],
12102           "dot_below": [
12103             "\u0694"
12104           ],
12105           "small_v_below": [
12106             "\u0695"
12107           ],
12108           "dot_below_dot_above": [
12109             "\u0696"
12110           ],
12111           "two_dots_above": [
12112             "\u0697"
12113           ],
12114           "four_dots_above": [
12115             "\u0699"
12116           ],
12117           "inverted_v": [
12118             "\u06EF"
12119           ],
12120           "stroke": [
12121             "\u075B"
12122           ],
12123           "two_dots_vertically_above": [
12124             "\u076B"
12125           ],
12126           "hamza_above": [
12127             "\u076C"
12128           ],
12129           "small_tah_two_dots": [
12130             "\u0771"
12131           ],
12132           "loop": [
12133             "\u08AA"
12134           ],
12135           "small_noon_above": [
12136             "\u08B9"
12137           ],
12138           "isolated": "\uFEAD",
12139           "final": "\uFEAE"
12140         },
12141         "zain": {
12142           "normal": [
12143             "\u0632"
12144           ],
12145           "inverted_v_above": [
12146             "\u08B2"
12147           ],
12148           "isolated": "\uFEAF",
12149           "final": "\uFEB0"
12150         },
12151         "seen": {
12152           "normal": [
12153             "\u0633"
12154           ],
12155           "dot_below_dot_above": [
12156             "\u069A"
12157           ],
12158           "three_dots_below": [
12159             "\u069B"
12160           ],
12161           "three_dots_below_three_dots_above": [
12162             "\u069C"
12163           ],
12164           "four_dots_above": [
12165             "\u075C"
12166           ],
12167           "two_dots_vertically_above": [
12168             "\u076D"
12169           ],
12170           "small_tah_two_dots": [
12171             "\u0770"
12172           ],
12173           "indic_four_above": [
12174             "\u077D"
12175           ],
12176           "inverted_v": [
12177             "\u077E"
12178           ],
12179           "isolated": "\uFEB1",
12180           "final": "\uFEB2",
12181           "initial": "\uFEB3",
12182           "medial": "\uFEB4"
12183         },
12184         "sheen": {
12185           "normal": [
12186             "\u0634"
12187           ],
12188           "dot_below": [
12189             "\u06FA"
12190           ],
12191           "isolated": "\uFEB5",
12192           "final": "\uFEB6",
12193           "initial": "\uFEB7",
12194           "medial": "\uFEB8"
12195         },
12196         "sad": {
12197           "normal": [
12198             "\u0635"
12199           ],
12200           "two_dots_below": [
12201             "\u069D"
12202           ],
12203           "three_dots_above": [
12204             "\u069E"
12205           ],
12206           "three_dots_below": [
12207             "\u08AF"
12208           ],
12209           "isolated": "\uFEB9",
12210           "final": "\uFEBA",
12211           "initial": "\uFEBB",
12212           "medial": "\uFEBC"
12213         },
12214         "dad": {
12215           "normal": [
12216             "\u0636"
12217           ],
12218           "dot_below": [
12219             "\u06FB"
12220           ],
12221           "isolated": "\uFEBD",
12222           "final": "\uFEBE",
12223           "initial": "\uFEBF",
12224           "medial": "\uFEC0"
12225         },
12226         "tah": {
12227           "normal": [
12228             "\u0637"
12229           ],
12230           "three_dots_above": [
12231             "\u069F"
12232           ],
12233           "two_dots_above": [
12234             "\u08A3"
12235           ],
12236           "isolated": "\uFEC1",
12237           "final": "\uFEC2",
12238           "initial": "\uFEC3",
12239           "medial": "\uFEC4"
12240         },
12241         "zah": {
12242           "normal": [
12243             "\u0638"
12244           ],
12245           "isolated": "\uFEC5",
12246           "final": "\uFEC6",
12247           "initial": "\uFEC7",
12248           "medial": "\uFEC8"
12249         },
12250         "ain": {
12251           "normal": [
12252             "\u0639"
12253           ],
12254           "three_dots_above": [
12255             "\u06A0"
12256           ],
12257           "two_dots_above": [
12258             "\u075D"
12259           ],
12260           "three_dots_pointing_downwards_above": [
12261             "\u075E"
12262           ],
12263           "two_dots_vertically_above": [
12264             "\u075F"
12265           ],
12266           "three_dots_below": [
12267             "\u08B3"
12268           ],
12269           "isolated": "\uFEC9",
12270           "final": "\uFECA",
12271           "initial": "\uFECB",
12272           "medial": "\uFECC"
12273         },
12274         "ghain": {
12275           "normal": [
12276             "\u063A"
12277           ],
12278           "dot_below": [
12279             "\u06FC"
12280           ],
12281           "isolated": "\uFECD",
12282           "final": "\uFECE",
12283           "initial": "\uFECF",
12284           "medial": "\uFED0"
12285         },
12286         "feh": {
12287           "normal": [
12288             "\u0641"
12289           ],
12290           "dotless": [
12291             "\u06A1"
12292           ],
12293           "dot_moved_below": [
12294             "\u06A2"
12295           ],
12296           "dot_below": [
12297             "\u06A3"
12298           ],
12299           "three_dots_below": [
12300             "\u06A5"
12301           ],
12302           "two_dots_below": [
12303             "\u0760"
12304           ],
12305           "three_dots_pointing_upwards_below": [
12306             "\u0761"
12307           ],
12308           "dot_below_three_dots_above": [
12309             "\u08A4"
12310           ],
12311           "isolated": "\uFED1",
12312           "final": "\uFED2",
12313           "initial": "\uFED3",
12314           "medial": "\uFED4"
12315         },
12316         "qaf": {
12317           "normal": [
12318             "\u0642"
12319           ],
12320           "dotless": [
12321             "\u066F"
12322           ],
12323           "dot_above": [
12324             "\u06A7"
12325           ],
12326           "three_dots_above": [
12327             "\u06A8"
12328           ],
12329           "dot_below": [
12330             "\u08A5"
12331           ],
12332           "isolated": "\uFED5",
12333           "final": "\uFED6",
12334           "initial": "\uFED7",
12335           "medial": "\uFED8"
12336         },
12337         "kaf": {
12338           "normal": [
12339             "\u0643"
12340           ],
12341           "swash": [
12342             "\u06AA"
12343           ],
12344           "ring": [
12345             "\u06AB"
12346           ],
12347           "dot_above": [
12348             "\u06AC"
12349           ],
12350           "three_dots_below": [
12351             "\u06AE"
12352           ],
12353           "two_dots_above": [
12354             "\u077F"
12355           ],
12356           "dot_below": [
12357             "\u08B4"
12358           ],
12359           "isolated": "\uFED9",
12360           "final": "\uFEDA",
12361           "initial": "\uFEDB",
12362           "medial": "\uFEDC"
12363         },
12364         "lam": {
12365           "normal": [
12366             "\u0644"
12367           ],
12368           "small_v": [
12369             "\u06B5"
12370           ],
12371           "dot_above": [
12372             "\u06B6"
12373           ],
12374           "three_dots_above": [
12375             "\u06B7"
12376           ],
12377           "three_dots_below": [
12378             "\u06B8"
12379           ],
12380           "bar": [
12381             "\u076A"
12382           ],
12383           "double_bar": [
12384             "\u08A6"
12385           ],
12386           "isolated": "\uFEDD",
12387           "final": "\uFEDE",
12388           "initial": "\uFEDF",
12389           "medial": "\uFEE0"
12390         },
12391         "meem": {
12392           "normal": [
12393             "\u0645"
12394           ],
12395           "dot_above": [
12396             "\u0765"
12397           ],
12398           "dot_below": [
12399             "\u0766"
12400           ],
12401           "three_dots_above": [
12402             "\u08A7"
12403           ],
12404           "isolated": "\uFEE1",
12405           "final": "\uFEE2",
12406           "initial": "\uFEE3",
12407           "medial": "\uFEE4"
12408         },
12409         "noon": {
12410           "normal": [
12411             "\u0646"
12412           ],
12413           "dot_below": [
12414             "\u06B9"
12415           ],
12416           "ring": [
12417             "\u06BC"
12418           ],
12419           "three_dots_above": [
12420             "\u06BD"
12421           ],
12422           "two_dots_below": [
12423             "\u0767"
12424           ],
12425           "small_tah": [
12426             "\u0768"
12427           ],
12428           "small_v": [
12429             "\u0769"
12430           ],
12431           "isolated": "\uFEE5",
12432           "final": "\uFEE6",
12433           "initial": "\uFEE7",
12434           "medial": "\uFEE8"
12435         },
12436         "heh": {
12437           "normal": [
12438             "\u0647"
12439           ],
12440           "isolated": "\uFEE9",
12441           "final": "\uFEEA",
12442           "initial": "\uFEEB",
12443           "medial": "\uFEEC"
12444         },
12445         "waw": {
12446           "normal": [
12447             "\u0648"
12448           ],
12449           "hamza_above": {
12450             "normal": [
12451               "\u0624",
12452               "\u0648\u0654"
12453             ],
12454             "isolated": "\uFE85",
12455             "final": "\uFE86"
12456           },
12457           "high_hamza": [
12458             "\u0676",
12459             "\u0648\u0674"
12460           ],
12461           "ring": [
12462             "\u06C4"
12463           ],
12464           "two_dots_above": [
12465             "\u06CA"
12466           ],
12467           "dot_above": [
12468             "\u06CF"
12469           ],
12470           "indic_two_above": [
12471             "\u0778"
12472           ],
12473           "indic_three_above": [
12474             "\u0779"
12475           ],
12476           "dot_within": [
12477             "\u08AB"
12478           ],
12479           "isolated": "\uFEED",
12480           "final": "\uFEEE"
12481         },
12482         "alef_maksura": {
12483           "normal": [
12484             "\u0649"
12485           ],
12486           "hamza_above": [
12487             "\u0626",
12488             "\u064A\u0654"
12489           ],
12490           "initial": "\uFBE8",
12491           "medial": "\uFBE9",
12492           "isolated": "\uFEEF",
12493           "final": "\uFEF0"
12494         },
12495         "yeh": {
12496           "normal": [
12497             "\u064A"
12498           ],
12499           "hamza_above": {
12500             "normal": [
12501               "\u0626",
12502               "\u0649\u0654"
12503             ],
12504             "isolated": "\uFE89",
12505             "final": "\uFE8A",
12506             "initial": "\uFE8B",
12507             "medial": "\uFE8C"
12508           },
12509           "two_dots_below_hamza_above": [
12510             "\u08A8"
12511           ],
12512           "high_hamza": [
12513             "\u0678",
12514             "\u064A\u0674"
12515           ],
12516           "tail": [
12517             "\u06CD"
12518           ],
12519           "small_v": [
12520             "\u06CE"
12521           ],
12522           "three_dots_below": [
12523             "\u06D1"
12524           ],
12525           "two_dots_below_dot_above": [
12526             "\u08A9"
12527           ],
12528           "two_dots_below_small_noon_above": [
12529             "\u08BA"
12530           ],
12531           "isolated": "\uFEF1",
12532           "final": "\uFEF2",
12533           "initial": "\uFEF3",
12534           "medial": "\uFEF4"
12535         },
12536         "tteh": {
12537           "normal": [
12538             "\u0679"
12539           ],
12540           "isolated": "\uFB66",
12541           "final": "\uFB67",
12542           "initial": "\uFB68",
12543           "medial": "\uFB69"
12544         },
12545         "tteheh": {
12546           "normal": [
12547             "\u067A"
12548           ],
12549           "isolated": "\uFB5E",
12550           "final": "\uFB5F",
12551           "initial": "\uFB60",
12552           "medial": "\uFB61"
12553         },
12554         "beeh": {
12555           "normal": [
12556             "\u067B"
12557           ],
12558           "isolated": "\uFB52",
12559           "final": "\uFB53",
12560           "initial": "\uFB54",
12561           "medial": "\uFB55"
12562         },
12563         "peh": {
12564           "normal": [
12565             "\u067E"
12566           ],
12567           "small_meem_above": [
12568             "\u08B7"
12569           ],
12570           "isolated": "\uFB56",
12571           "final": "\uFB57",
12572           "initial": "\uFB58",
12573           "medial": "\uFB59"
12574         },
12575         "teheh": {
12576           "normal": [
12577             "\u067F"
12578           ],
12579           "isolated": "\uFB62",
12580           "final": "\uFB63",
12581           "initial": "\uFB64",
12582           "medial": "\uFB65"
12583         },
12584         "beheh": {
12585           "normal": [
12586             "\u0680"
12587           ],
12588           "isolated": "\uFB5A",
12589           "final": "\uFB5B",
12590           "initial": "\uFB5C",
12591           "medial": "\uFB5D"
12592         },
12593         "nyeh": {
12594           "normal": [
12595             "\u0683"
12596           ],
12597           "isolated": "\uFB76",
12598           "final": "\uFB77",
12599           "initial": "\uFB78",
12600           "medial": "\uFB79"
12601         },
12602         "dyeh": {
12603           "normal": [
12604             "\u0684"
12605           ],
12606           "isolated": "\uFB72",
12607           "final": "\uFB73",
12608           "initial": "\uFB74",
12609           "medial": "\uFB75"
12610         },
12611         "tcheh": {
12612           "normal": [
12613             "\u0686"
12614           ],
12615           "dot_above": [
12616             "\u06BF"
12617           ],
12618           "isolated": "\uFB7A",
12619           "final": "\uFB7B",
12620           "initial": "\uFB7C",
12621           "medial": "\uFB7D"
12622         },
12623         "tcheheh": {
12624           "normal": [
12625             "\u0687"
12626           ],
12627           "isolated": "\uFB7E",
12628           "final": "\uFB7F",
12629           "initial": "\uFB80",
12630           "medial": "\uFB81"
12631         },
12632         "ddal": {
12633           "normal": [
12634             "\u0688"
12635           ],
12636           "isolated": "\uFB88",
12637           "final": "\uFB89"
12638         },
12639         "dahal": {
12640           "normal": [
12641             "\u068C"
12642           ],
12643           "isolated": "\uFB84",
12644           "final": "\uFB85"
12645         },
12646         "ddahal": {
12647           "normal": [
12648             "\u068D"
12649           ],
12650           "isolated": "\uFB82",
12651           "final": "\uFB83"
12652         },
12653         "dul": {
12654           "normal": [
12655             "\u068F",
12656             "\u068E"
12657           ],
12658           "isolated": "\uFB86",
12659           "final": "\uFB87"
12660         },
12661         "rreh": {
12662           "normal": [
12663             "\u0691"
12664           ],
12665           "isolated": "\uFB8C",
12666           "final": "\uFB8D"
12667         },
12668         "jeh": {
12669           "normal": [
12670             "\u0698"
12671           ],
12672           "isolated": "\uFB8A",
12673           "final": "\uFB8B"
12674         },
12675         "veh": {
12676           "normal": [
12677             "\u06A4"
12678           ],
12679           "isolated": "\uFB6A",
12680           "final": "\uFB6B",
12681           "initial": "\uFB6C",
12682           "medial": "\uFB6D"
12683         },
12684         "peheh": {
12685           "normal": [
12686             "\u06A6"
12687           ],
12688           "isolated": "\uFB6E",
12689           "final": "\uFB6F",
12690           "initial": "\uFB70",
12691           "medial": "\uFB71"
12692         },
12693         "keheh": {
12694           "normal": [
12695             "\u06A9"
12696           ],
12697           "dot_above": [
12698             "\u0762"
12699           ],
12700           "three_dots_above": [
12701             "\u0763"
12702           ],
12703           "three_dots_pointing_upwards_below": [
12704             "\u0764"
12705           ],
12706           "isolated": "\uFB8E",
12707           "final": "\uFB8F",
12708           "initial": "\uFB90",
12709           "medial": "\uFB91"
12710         },
12711         "ng": {
12712           "normal": [
12713             "\u06AD"
12714           ],
12715           "isolated": "\uFBD3",
12716           "final": "\uFBD4",
12717           "initial": "\uFBD5",
12718           "medial": "\uFBD6"
12719         },
12720         "gaf": {
12721           "normal": [
12722             "\u06AF"
12723           ],
12724           "ring": [
12725             "\u06B0"
12726           ],
12727           "two_dots_below": [
12728             "\u06B2"
12729           ],
12730           "three_dots_above": [
12731             "\u06B4"
12732           ],
12733           "inverted_stroke": [
12734             "\u08B0"
12735           ],
12736           "isolated": "\uFB92",
12737           "final": "\uFB93",
12738           "initial": "\uFB94",
12739           "medial": "\uFB95"
12740         },
12741         "ngoeh": {
12742           "normal": [
12743             "\u06B1"
12744           ],
12745           "isolated": "\uFB9A",
12746           "final": "\uFB9B",
12747           "initial": "\uFB9C",
12748           "medial": "\uFB9D"
12749         },
12750         "gueh": {
12751           "normal": [
12752             "\u06B3"
12753           ],
12754           "isolated": "\uFB96",
12755           "final": "\uFB97",
12756           "initial": "\uFB98",
12757           "medial": "\uFB99"
12758         },
12759         "noon ghunna": {
12760           "normal": [
12761             "\u06BA"
12762           ],
12763           "isolated": "\uFB9E",
12764           "final": "\uFB9F"
12765         },
12766         "rnoon": {
12767           "normal": [
12768             "\u06BB"
12769           ],
12770           "isolated": "\uFBA0",
12771           "final": "\uFBA1",
12772           "initial": "\uFBA2",
12773           "medial": "\uFBA3"
12774         },
12775         "heh doachashmee": {
12776           "normal": [
12777             "\u06BE"
12778           ],
12779           "isolated": "\uFBAA",
12780           "final": "\uFBAB",
12781           "initial": "\uFBAC",
12782           "medial": "\uFBAD"
12783         },
12784         "heh goal": {
12785           "normal": [
12786             "\u06C1"
12787           ],
12788           "hamza_above": [
12789             "\u06C1\u0654",
12790             "\u06C2"
12791           ],
12792           "isolated": "\uFBA6",
12793           "final": "\uFBA7",
12794           "initial": "\uFBA8",
12795           "medial": "\uFBA9"
12796         },
12797         "teh marbuta goal": {
12798           "normal": [
12799             "\u06C3"
12800           ]
12801         },
12802         "kirghiz oe": {
12803           "normal": [
12804             "\u06C5"
12805           ],
12806           "isolated": "\uFBE0",
12807           "final": "\uFBE1"
12808         },
12809         "oe": {
12810           "normal": [
12811             "\u06C6"
12812           ],
12813           "isolated": "\uFBD9",
12814           "final": "\uFBDA"
12815         },
12816         "u": {
12817           "normal": [
12818             "\u06C7"
12819           ],
12820           "hamza_above": {
12821             "normal": [
12822               "\u0677",
12823               "\u06C7\u0674"
12824             ],
12825             "isolated": "\uFBDD"
12826           },
12827           "isolated": "\uFBD7",
12828           "final": "\uFBD8"
12829         },
12830         "yu": {
12831           "normal": [
12832             "\u06C8"
12833           ],
12834           "isolated": "\uFBDB",
12835           "final": "\uFBDC"
12836         },
12837         "kirghiz yu": {
12838           "normal": [
12839             "\u06C9"
12840           ],
12841           "isolated": "\uFBE2",
12842           "final": "\uFBE3"
12843         },
12844         "ve": {
12845           "normal": [
12846             "\u06CB"
12847           ],
12848           "isolated": "\uFBDE",
12849           "final": "\uFBDF"
12850         },
12851         "farsi yeh": {
12852           "normal": [
12853             "\u06CC"
12854           ],
12855           "indic_two_above": [
12856             "\u0775"
12857           ],
12858           "indic_three_above": [
12859             "\u0776"
12860           ],
12861           "indic_four_above": [
12862             "\u0777"
12863           ],
12864           "isolated": "\uFBFC",
12865           "final": "\uFBFD",
12866           "initial": "\uFBFE",
12867           "medial": "\uFBFF"
12868         },
12869         "e": {
12870           "normal": [
12871             "\u06D0"
12872           ],
12873           "isolated": "\uFBE4",
12874           "final": "\uFBE5",
12875           "initial": "\uFBE6",
12876           "medial": "\uFBE7"
12877         },
12878         "yeh barree": {
12879           "normal": [
12880             "\u06D2"
12881           ],
12882           "hamza_above": {
12883             "normal": [
12884               "\u06D2\u0654",
12885               "\u06D3"
12886             ],
12887             "isolated": "\uFBB0",
12888             "final": "\uFBB1"
12889           },
12890           "indic_two_above": [
12891             "\u077A"
12892           ],
12893           "indic_three_above": [
12894             "\u077B"
12895           ],
12896           "isolated": "\uFBAE",
12897           "final": "\uFBAF"
12898         },
12899         "ae": {
12900           "normal": [
12901             "\u06D5"
12902           ],
12903           "isolated": "\u06D5",
12904           "final": "\uFEEA",
12905           "yeh_above": {
12906             "normal": [
12907               "\u06C0",
12908               "\u06D5\u0654"
12909             ],
12910             "isolated": "\uFBA4",
12911             "final": "\uFBA5"
12912           }
12913         },
12914         "rohingya yeh": {
12915           "normal": [
12916             "\u08AC"
12917           ]
12918         },
12919         "low alef": {
12920           "normal": [
12921             "\u08AD"
12922           ]
12923         },
12924         "straight waw": {
12925           "normal": [
12926             "\u08B1"
12927           ]
12928         },
12929         "african feh": {
12930           "normal": [
12931             "\u08BB"
12932           ]
12933         },
12934         "african qaf": {
12935           "normal": [
12936             "\u08BC"
12937           ]
12938         },
12939         "african noon": {
12940           "normal": [
12941             "\u08BD"
12942           ]
12943         }
12944       };
12945       exports2.default = arabicReference;
12946     }
12947   });
12948
12949   // node_modules/alif-toolkit/lib/unicode-ligatures.js
12950   var require_unicode_ligatures = __commonJS({
12951     "node_modules/alif-toolkit/lib/unicode-ligatures.js"(exports2) {
12952       "use strict";
12953       Object.defineProperty(exports2, "__esModule", { value: true });
12954       var ligatureReference = {
12955         "\u0626\u0627": {
12956           "isolated": "\uFBEA",
12957           "final": "\uFBEB"
12958         },
12959         "\u0626\u06D5": {
12960           "isolated": "\uFBEC",
12961           "final": "\uFBED"
12962         },
12963         "\u0626\u0648": {
12964           "isolated": "\uFBEE",
12965           "final": "\uFBEF"
12966         },
12967         "\u0626\u06C7": {
12968           "isolated": "\uFBF0",
12969           "final": "\uFBF1"
12970         },
12971         "\u0626\u06C6": {
12972           "isolated": "\uFBF2",
12973           "final": "\uFBF3"
12974         },
12975         "\u0626\u06C8": {
12976           "isolated": "\uFBF4",
12977           "final": "\uFBF5"
12978         },
12979         "\u0626\u06D0": {
12980           "isolated": "\uFBF6",
12981           "final": "\uFBF7",
12982           "initial": "\uFBF8"
12983         },
12984         "\u0626\u0649": {
12985           "uighur_kirghiz": {
12986             "isolated": "\uFBF9",
12987             "final": "\uFBFA",
12988             "initial": "\uFBFB"
12989           },
12990           "isolated": "\uFC03",
12991           "final": "\uFC68"
12992         },
12993         "\u0626\u062C": {
12994           "isolated": "\uFC00",
12995           "initial": "\uFC97"
12996         },
12997         "\u0626\u062D": {
12998           "isolated": "\uFC01",
12999           "initial": "\uFC98"
13000         },
13001         "\u0626\u0645": {
13002           "isolated": "\uFC02",
13003           "final": "\uFC66",
13004           "initial": "\uFC9A",
13005           "medial": "\uFCDF"
13006         },
13007         "\u0626\u064A": {
13008           "isolated": "\uFC04",
13009           "final": "\uFC69"
13010         },
13011         "\u0628\u062C": {
13012           "isolated": "\uFC05",
13013           "initial": "\uFC9C"
13014         },
13015         "\u0628\u062D": {
13016           "isolated": "\uFC06",
13017           "initial": "\uFC9D"
13018         },
13019         "\u0628\u062E": {
13020           "isolated": "\uFC07",
13021           "initial": "\uFC9E"
13022         },
13023         "\u0628\u0645": {
13024           "isolated": "\uFC08",
13025           "final": "\uFC6C",
13026           "initial": "\uFC9F",
13027           "medial": "\uFCE1"
13028         },
13029         "\u0628\u0649": {
13030           "isolated": "\uFC09",
13031           "final": "\uFC6E"
13032         },
13033         "\u0628\u064A": {
13034           "isolated": "\uFC0A",
13035           "final": "\uFC6F"
13036         },
13037         "\u062A\u062C": {
13038           "isolated": "\uFC0B",
13039           "initial": "\uFCA1"
13040         },
13041         "\u062A\u062D": {
13042           "isolated": "\uFC0C",
13043           "initial": "\uFCA2"
13044         },
13045         "\u062A\u062E": {
13046           "isolated": "\uFC0D",
13047           "initial": "\uFCA3"
13048         },
13049         "\u062A\u0645": {
13050           "isolated": "\uFC0E",
13051           "final": "\uFC72",
13052           "initial": "\uFCA4",
13053           "medial": "\uFCE3"
13054         },
13055         "\u062A\u0649": {
13056           "isolated": "\uFC0F",
13057           "final": "\uFC74"
13058         },
13059         "\u062A\u064A": {
13060           "isolated": "\uFC10",
13061           "final": "\uFC75"
13062         },
13063         "\u062B\u062C": {
13064           "isolated": "\uFC11"
13065         },
13066         "\u062B\u0645": {
13067           "isolated": "\uFC12",
13068           "final": "\uFC78",
13069           "initial": "\uFCA6",
13070           "medial": "\uFCE5"
13071         },
13072         "\u062B\u0649": {
13073           "isolated": "\uFC13",
13074           "final": "\uFC7A"
13075         },
13076         "\u062B\u0648": {
13077           "isolated": "\uFC14"
13078         },
13079         "\u062C\u062D": {
13080           "isolated": "\uFC15",
13081           "initial": "\uFCA7"
13082         },
13083         "\u062C\u0645": {
13084           "isolated": "\uFC16",
13085           "initial": "\uFCA8"
13086         },
13087         "\u062D\u062C": {
13088           "isolated": "\uFC17",
13089           "initial": "\uFCA9"
13090         },
13091         "\u062D\u0645": {
13092           "isolated": "\uFC18",
13093           "initial": "\uFCAA"
13094         },
13095         "\u062E\u062C": {
13096           "isolated": "\uFC19",
13097           "initial": "\uFCAB"
13098         },
13099         "\u062E\u062D": {
13100           "isolated": "\uFC1A"
13101         },
13102         "\u062E\u0645": {
13103           "isolated": "\uFC1B",
13104           "initial": "\uFCAC"
13105         },
13106         "\u0633\u062C": {
13107           "isolated": "\uFC1C",
13108           "initial": "\uFCAD",
13109           "medial": "\uFD34"
13110         },
13111         "\u0633\u062D": {
13112           "isolated": "\uFC1D",
13113           "initial": "\uFCAE",
13114           "medial": "\uFD35"
13115         },
13116         "\u0633\u062E": {
13117           "isolated": "\uFC1E",
13118           "initial": "\uFCAF",
13119           "medial": "\uFD36"
13120         },
13121         "\u0633\u0645": {
13122           "isolated": "\uFC1F",
13123           "initial": "\uFCB0",
13124           "medial": "\uFCE7"
13125         },
13126         "\u0635\u062D": {
13127           "isolated": "\uFC20",
13128           "initial": "\uFCB1"
13129         },
13130         "\u0635\u0645": {
13131           "isolated": "\uFC21",
13132           "initial": "\uFCB3"
13133         },
13134         "\u0636\u062C": {
13135           "isolated": "\uFC22",
13136           "initial": "\uFCB4"
13137         },
13138         "\u0636\u062D": {
13139           "isolated": "\uFC23",
13140           "initial": "\uFCB5"
13141         },
13142         "\u0636\u062E": {
13143           "isolated": "\uFC24",
13144           "initial": "\uFCB6"
13145         },
13146         "\u0636\u0645": {
13147           "isolated": "\uFC25",
13148           "initial": "\uFCB7"
13149         },
13150         "\u0637\u062D": {
13151           "isolated": "\uFC26",
13152           "initial": "\uFCB8"
13153         },
13154         "\u0637\u0645": {
13155           "isolated": "\uFC27",
13156           "initial": "\uFD33",
13157           "medial": "\uFD3A"
13158         },
13159         "\u0638\u0645": {
13160           "isolated": "\uFC28",
13161           "initial": "\uFCB9",
13162           "medial": "\uFD3B"
13163         },
13164         "\u0639\u062C": {
13165           "isolated": "\uFC29",
13166           "initial": "\uFCBA"
13167         },
13168         "\u0639\u0645": {
13169           "isolated": "\uFC2A",
13170           "initial": "\uFCBB"
13171         },
13172         "\u063A\u062C": {
13173           "isolated": "\uFC2B",
13174           "initial": "\uFCBC"
13175         },
13176         "\u063A\u0645": {
13177           "isolated": "\uFC2C",
13178           "initial": "\uFCBD"
13179         },
13180         "\u0641\u062C": {
13181           "isolated": "\uFC2D",
13182           "initial": "\uFCBE"
13183         },
13184         "\u0641\u062D": {
13185           "isolated": "\uFC2E",
13186           "initial": "\uFCBF"
13187         },
13188         "\u0641\u062E": {
13189           "isolated": "\uFC2F",
13190           "initial": "\uFCC0"
13191         },
13192         "\u0641\u0645": {
13193           "isolated": "\uFC30",
13194           "initial": "\uFCC1"
13195         },
13196         "\u0641\u0649": {
13197           "isolated": "\uFC31",
13198           "final": "\uFC7C"
13199         },
13200         "\u0641\u064A": {
13201           "isolated": "\uFC32",
13202           "final": "\uFC7D"
13203         },
13204         "\u0642\u062D": {
13205           "isolated": "\uFC33",
13206           "initial": "\uFCC2"
13207         },
13208         "\u0642\u0645": {
13209           "isolated": "\uFC34",
13210           "initial": "\uFCC3"
13211         },
13212         "\u0642\u0649": {
13213           "isolated": "\uFC35",
13214           "final": "\uFC7E"
13215         },
13216         "\u0642\u064A": {
13217           "isolated": "\uFC36",
13218           "final": "\uFC7F"
13219         },
13220         "\u0643\u0627": {
13221           "isolated": "\uFC37",
13222           "final": "\uFC80"
13223         },
13224         "\u0643\u062C": {
13225           "isolated": "\uFC38",
13226           "initial": "\uFCC4"
13227         },
13228         "\u0643\u062D": {
13229           "isolated": "\uFC39",
13230           "initial": "\uFCC5"
13231         },
13232         "\u0643\u062E": {
13233           "isolated": "\uFC3A",
13234           "initial": "\uFCC6"
13235         },
13236         "\u0643\u0644": {
13237           "isolated": "\uFC3B",
13238           "final": "\uFC81",
13239           "initial": "\uFCC7",
13240           "medial": "\uFCEB"
13241         },
13242         "\u0643\u0645": {
13243           "isolated": "\uFC3C",
13244           "final": "\uFC82",
13245           "initial": "\uFCC8",
13246           "medial": "\uFCEC"
13247         },
13248         "\u0643\u0649": {
13249           "isolated": "\uFC3D",
13250           "final": "\uFC83"
13251         },
13252         "\u0643\u064A": {
13253           "isolated": "\uFC3E",
13254           "final": "\uFC84"
13255         },
13256         "\u0644\u062C": {
13257           "isolated": "\uFC3F",
13258           "initial": "\uFCC9"
13259         },
13260         "\u0644\u062D": {
13261           "isolated": "\uFC40",
13262           "initial": "\uFCCA"
13263         },
13264         "\u0644\u062E": {
13265           "isolated": "\uFC41",
13266           "initial": "\uFCCB"
13267         },
13268         "\u0644\u0645": {
13269           "isolated": "\uFC42",
13270           "final": "\uFC85",
13271           "initial": "\uFCCC",
13272           "medial": "\uFCED"
13273         },
13274         "\u0644\u0649": {
13275           "isolated": "\uFC43",
13276           "final": "\uFC86"
13277         },
13278         "\u0644\u064A": {
13279           "isolated": "\uFC44",
13280           "final": "\uFC87"
13281         },
13282         "\u0645\u062C": {
13283           "isolated": "\uFC45",
13284           "initial": "\uFCCE"
13285         },
13286         "\u0645\u062D": {
13287           "isolated": "\uFC46",
13288           "initial": "\uFCCF"
13289         },
13290         "\u0645\u062E": {
13291           "isolated": "\uFC47",
13292           "initial": "\uFCD0"
13293         },
13294         "\u0645\u0645": {
13295           "isolated": "\uFC48",
13296           "final": "\uFC89",
13297           "initial": "\uFCD1"
13298         },
13299         "\u0645\u0649": {
13300           "isolated": "\uFC49"
13301         },
13302         "\u0645\u064A": {
13303           "isolated": "\uFC4A"
13304         },
13305         "\u0646\u062C": {
13306           "isolated": "\uFC4B",
13307           "initial": "\uFCD2"
13308         },
13309         "\u0646\u062D": {
13310           "isolated": "\uFC4C",
13311           "initial": "\uFCD3"
13312         },
13313         "\u0646\u062E": {
13314           "isolated": "\uFC4D",
13315           "initial": "\uFCD4"
13316         },
13317         "\u0646\u0645": {
13318           "isolated": "\uFC4E",
13319           "final": "\uFC8C",
13320           "initial": "\uFCD5",
13321           "medial": "\uFCEE"
13322         },
13323         "\u0646\u0649": {
13324           "isolated": "\uFC4F",
13325           "final": "\uFC8E"
13326         },
13327         "\u0646\u064A": {
13328           "isolated": "\uFC50",
13329           "final": "\uFC8F"
13330         },
13331         "\u0647\u062C": {
13332           "isolated": "\uFC51",
13333           "initial": "\uFCD7"
13334         },
13335         "\u0647\u0645": {
13336           "isolated": "\uFC52",
13337           "initial": "\uFCD8"
13338         },
13339         "\u0647\u0649": {
13340           "isolated": "\uFC53"
13341         },
13342         "\u0647\u064A": {
13343           "isolated": "\uFC54"
13344         },
13345         "\u064A\u062C": {
13346           "isolated": "\uFC55",
13347           "initial": "\uFCDA"
13348         },
13349         "\u064A\u062D": {
13350           "isolated": "\uFC56",
13351           "initial": "\uFCDB"
13352         },
13353         "\u064A\u062E": {
13354           "isolated": "\uFC57",
13355           "initial": "\uFCDC"
13356         },
13357         "\u064A\u0645": {
13358           "isolated": "\uFC58",
13359           "final": "\uFC93",
13360           "initial": "\uFCDD",
13361           "medial": "\uFCF0"
13362         },
13363         "\u064A\u0649": {
13364           "isolated": "\uFC59",
13365           "final": "\uFC95"
13366         },
13367         "\u064A\u064A": {
13368           "isolated": "\uFC5A",
13369           "final": "\uFC96"
13370         },
13371         "\u0630\u0670": {
13372           "isolated": "\uFC5B"
13373         },
13374         "\u0631\u0670": {
13375           "isolated": "\uFC5C"
13376         },
13377         "\u0649\u0670": {
13378           "isolated": "\uFC5D",
13379           "final": "\uFC90"
13380         },
13381         "\u064C\u0651": {
13382           "isolated": "\uFC5E"
13383         },
13384         "\u064D\u0651": {
13385           "isolated": "\uFC5F"
13386         },
13387         "\u064E\u0651": {
13388           "isolated": "\uFC60"
13389         },
13390         "\u064F\u0651": {
13391           "isolated": "\uFC61"
13392         },
13393         "\u0650\u0651": {
13394           "isolated": "\uFC62"
13395         },
13396         "\u0651\u0670": {
13397           "isolated": "\uFC63"
13398         },
13399         "\u0626\u0631": {
13400           "final": "\uFC64"
13401         },
13402         "\u0626\u0632": {
13403           "final": "\uFC65"
13404         },
13405         "\u0626\u0646": {
13406           "final": "\uFC67"
13407         },
13408         "\u0628\u0631": {
13409           "final": "\uFC6A"
13410         },
13411         "\u0628\u0632": {
13412           "final": "\uFC6B"
13413         },
13414         "\u0628\u0646": {
13415           "final": "\uFC6D"
13416         },
13417         "\u062A\u0631": {
13418           "final": "\uFC70"
13419         },
13420         "\u062A\u0632": {
13421           "final": "\uFC71"
13422         },
13423         "\u062A\u0646": {
13424           "final": "\uFC73"
13425         },
13426         "\u062B\u0631": {
13427           "final": "\uFC76"
13428         },
13429         "\u062B\u0632": {
13430           "final": "\uFC77"
13431         },
13432         "\u062B\u0646": {
13433           "final": "\uFC79"
13434         },
13435         "\u062B\u064A": {
13436           "final": "\uFC7B"
13437         },
13438         "\u0645\u0627": {
13439           "final": "\uFC88"
13440         },
13441         "\u0646\u0631": {
13442           "final": "\uFC8A"
13443         },
13444         "\u0646\u0632": {
13445           "final": "\uFC8B"
13446         },
13447         "\u0646\u0646": {
13448           "final": "\uFC8D"
13449         },
13450         "\u064A\u0631": {
13451           "final": "\uFC91"
13452         },
13453         "\u064A\u0632": {
13454           "final": "\uFC92"
13455         },
13456         "\u064A\u0646": {
13457           "final": "\uFC94"
13458         },
13459         "\u0626\u062E": {
13460           "initial": "\uFC99"
13461         },
13462         "\u0626\u0647": {
13463           "initial": "\uFC9B",
13464           "medial": "\uFCE0"
13465         },
13466         "\u0628\u0647": {
13467           "initial": "\uFCA0",
13468           "medial": "\uFCE2"
13469         },
13470         "\u062A\u0647": {
13471           "initial": "\uFCA5",
13472           "medial": "\uFCE4"
13473         },
13474         "\u0635\u062E": {
13475           "initial": "\uFCB2"
13476         },
13477         "\u0644\u0647": {
13478           "initial": "\uFCCD"
13479         },
13480         "\u0646\u0647": {
13481           "initial": "\uFCD6",
13482           "medial": "\uFCEF"
13483         },
13484         "\u0647\u0670": {
13485           "initial": "\uFCD9"
13486         },
13487         "\u064A\u0647": {
13488           "initial": "\uFCDE",
13489           "medial": "\uFCF1"
13490         },
13491         "\u062B\u0647": {
13492           "medial": "\uFCE6"
13493         },
13494         "\u0633\u0647": {
13495           "medial": "\uFCE8",
13496           "initial": "\uFD31"
13497         },
13498         "\u0634\u0645": {
13499           "medial": "\uFCE9",
13500           "isolated": "\uFD0C",
13501           "final": "\uFD28",
13502           "initial": "\uFD30"
13503         },
13504         "\u0634\u0647": {
13505           "medial": "\uFCEA",
13506           "initial": "\uFD32"
13507         },
13508         "\u0640\u064E\u0651": {
13509           "medial": "\uFCF2"
13510         },
13511         "\u0640\u064F\u0651": {
13512           "medial": "\uFCF3"
13513         },
13514         "\u0640\u0650\u0651": {
13515           "medial": "\uFCF4"
13516         },
13517         "\u0637\u0649": {
13518           "isolated": "\uFCF5",
13519           "final": "\uFD11"
13520         },
13521         "\u0637\u064A": {
13522           "isolated": "\uFCF6",
13523           "final": "\uFD12"
13524         },
13525         "\u0639\u0649": {
13526           "isolated": "\uFCF7",
13527           "final": "\uFD13"
13528         },
13529         "\u0639\u064A": {
13530           "isolated": "\uFCF8",
13531           "final": "\uFD14"
13532         },
13533         "\u063A\u0649": {
13534           "isolated": "\uFCF9",
13535           "final": "\uFD15"
13536         },
13537         "\u063A\u064A": {
13538           "isolated": "\uFCFA",
13539           "final": "\uFD16"
13540         },
13541         "\u0633\u0649": {
13542           "isolated": "\uFCFB"
13543         },
13544         "\u0633\u064A": {
13545           "isolated": "\uFCFC",
13546           "final": "\uFD18"
13547         },
13548         "\u0634\u0649": {
13549           "isolated": "\uFCFD",
13550           "final": "\uFD19"
13551         },
13552         "\u0634\u064A": {
13553           "isolated": "\uFCFE",
13554           "final": "\uFD1A"
13555         },
13556         "\u062D\u0649": {
13557           "isolated": "\uFCFF",
13558           "final": "\uFD1B"
13559         },
13560         "\u062D\u064A": {
13561           "isolated": "\uFD00",
13562           "final": "\uFD1C"
13563         },
13564         "\u062C\u0649": {
13565           "isolated": "\uFD01",
13566           "final": "\uFD1D"
13567         },
13568         "\u062C\u064A": {
13569           "isolated": "\uFD02",
13570           "final": "\uFD1E"
13571         },
13572         "\u062E\u0649": {
13573           "isolated": "\uFD03",
13574           "final": "\uFD1F"
13575         },
13576         "\u062E\u064A": {
13577           "isolated": "\uFD04",
13578           "final": "\uFD20"
13579         },
13580         "\u0635\u0649": {
13581           "isolated": "\uFD05",
13582           "final": "\uFD21"
13583         },
13584         "\u0635\u064A": {
13585           "isolated": "\uFD06",
13586           "final": "\uFD22"
13587         },
13588         "\u0636\u0649": {
13589           "isolated": "\uFD07",
13590           "final": "\uFD23"
13591         },
13592         "\u0636\u064A": {
13593           "isolated": "\uFD08",
13594           "final": "\uFD24"
13595         },
13596         "\u0634\u062C": {
13597           "isolated": "\uFD09",
13598           "final": "\uFD25",
13599           "initial": "\uFD2D",
13600           "medial": "\uFD37"
13601         },
13602         "\u0634\u062D": {
13603           "isolated": "\uFD0A",
13604           "final": "\uFD26",
13605           "initial": "\uFD2E",
13606           "medial": "\uFD38"
13607         },
13608         "\u0634\u062E": {
13609           "isolated": "\uFD0B",
13610           "final": "\uFD27",
13611           "initial": "\uFD2F",
13612           "medial": "\uFD39"
13613         },
13614         "\u0634\u0631": {
13615           "isolated": "\uFD0D",
13616           "final": "\uFD29"
13617         },
13618         "\u0633\u0631": {
13619           "isolated": "\uFD0E",
13620           "final": "\uFD2A"
13621         },
13622         "\u0635\u0631": {
13623           "isolated": "\uFD0F",
13624           "final": "\uFD2B"
13625         },
13626         "\u0636\u0631": {
13627           "isolated": "\uFD10",
13628           "final": "\uFD2C"
13629         },
13630         "\u0633\u0639": {
13631           "final": "\uFD17"
13632         },
13633         "\u062A\u062C\u0645": {
13634           "initial": "\uFD50"
13635         },
13636         "\u062A\u062D\u062C": {
13637           "final": "\uFD51",
13638           "initial": "\uFD52"
13639         },
13640         "\u062A\u062D\u0645": {
13641           "initial": "\uFD53"
13642         },
13643         "\u062A\u062E\u0645": {
13644           "initial": "\uFD54"
13645         },
13646         "\u062A\u0645\u062C": {
13647           "initial": "\uFD55"
13648         },
13649         "\u062A\u0645\u062D": {
13650           "initial": "\uFD56"
13651         },
13652         "\u062A\u0645\u062E": {
13653           "initial": "\uFD57"
13654         },
13655         "\u062C\u0645\u062D": {
13656           "final": "\uFD58",
13657           "initial": "\uFD59"
13658         },
13659         "\u062D\u0645\u064A": {
13660           "final": "\uFD5A"
13661         },
13662         "\u062D\u0645\u0649": {
13663           "final": "\uFD5B"
13664         },
13665         "\u0633\u062D\u062C": {
13666           "initial": "\uFD5C"
13667         },
13668         "\u0633\u062C\u062D": {
13669           "initial": "\uFD5D"
13670         },
13671         "\u0633\u062C\u0649": {
13672           "final": "\uFD5E"
13673         },
13674         "\u0633\u0645\u062D": {
13675           "final": "\uFD5F",
13676           "initial": "\uFD60"
13677         },
13678         "\u0633\u0645\u062C": {
13679           "initial": "\uFD61"
13680         },
13681         "\u0633\u0645\u0645": {
13682           "final": "\uFD62",
13683           "initial": "\uFD63"
13684         },
13685         "\u0635\u062D\u062D": {
13686           "final": "\uFD64",
13687           "initial": "\uFD65"
13688         },
13689         "\u0635\u0645\u0645": {
13690           "final": "\uFD66",
13691           "initial": "\uFDC5"
13692         },
13693         "\u0634\u062D\u0645": {
13694           "final": "\uFD67",
13695           "initial": "\uFD68"
13696         },
13697         "\u0634\u062C\u064A": {
13698           "final": "\uFD69"
13699         },
13700         "\u0634\u0645\u062E": {
13701           "final": "\uFD6A",
13702           "initial": "\uFD6B"
13703         },
13704         "\u0634\u0645\u0645": {
13705           "final": "\uFD6C",
13706           "initial": "\uFD6D"
13707         },
13708         "\u0636\u062D\u0649": {
13709           "final": "\uFD6E"
13710         },
13711         "\u0636\u062E\u0645": {
13712           "final": "\uFD6F",
13713           "initial": "\uFD70"
13714         },
13715         "\u0636\u0645\u062D": {
13716           "final": "\uFD71"
13717         },
13718         "\u0637\u0645\u062D": {
13719           "initial": "\uFD72"
13720         },
13721         "\u0637\u0645\u0645": {
13722           "initial": "\uFD73"
13723         },
13724         "\u0637\u0645\u064A": {
13725           "final": "\uFD74"
13726         },
13727         "\u0639\u062C\u0645": {
13728           "final": "\uFD75",
13729           "initial": "\uFDC4"
13730         },
13731         "\u0639\u0645\u0645": {
13732           "final": "\uFD76",
13733           "initial": "\uFD77"
13734         },
13735         "\u0639\u0645\u0649": {
13736           "final": "\uFD78"
13737         },
13738         "\u063A\u0645\u0645": {
13739           "final": "\uFD79"
13740         },
13741         "\u063A\u0645\u064A": {
13742           "final": "\uFD7A"
13743         },
13744         "\u063A\u0645\u0649": {
13745           "final": "\uFD7B"
13746         },
13747         "\u0641\u062E\u0645": {
13748           "final": "\uFD7C",
13749           "initial": "\uFD7D"
13750         },
13751         "\u0642\u0645\u062D": {
13752           "final": "\uFD7E",
13753           "initial": "\uFDB4"
13754         },
13755         "\u0642\u0645\u0645": {
13756           "final": "\uFD7F"
13757         },
13758         "\u0644\u062D\u0645": {
13759           "final": "\uFD80",
13760           "initial": "\uFDB5"
13761         },
13762         "\u0644\u062D\u064A": {
13763           "final": "\uFD81"
13764         },
13765         "\u0644\u062D\u0649": {
13766           "final": "\uFD82"
13767         },
13768         "\u0644\u062C\u062C": {
13769           "initial": "\uFD83",
13770           "final": "\uFD84"
13771         },
13772         "\u0644\u062E\u0645": {
13773           "final": "\uFD85",
13774           "initial": "\uFD86"
13775         },
13776         "\u0644\u0645\u062D": {
13777           "final": "\uFD87",
13778           "initial": "\uFD88"
13779         },
13780         "\u0645\u062D\u062C": {
13781           "initial": "\uFD89"
13782         },
13783         "\u0645\u062D\u0645": {
13784           "initial": "\uFD8A"
13785         },
13786         "\u0645\u062D\u064A": {
13787           "final": "\uFD8B"
13788         },
13789         "\u0645\u062C\u062D": {
13790           "initial": "\uFD8C"
13791         },
13792         "\u0645\u062C\u0645": {
13793           "initial": "\uFD8D"
13794         },
13795         "\u0645\u062E\u062C": {
13796           "initial": "\uFD8E"
13797         },
13798         "\u0645\u062E\u0645": {
13799           "initial": "\uFD8F"
13800         },
13801         "\u0645\u062C\u062E": {
13802           "initial": "\uFD92"
13803         },
13804         "\u0647\u0645\u062C": {
13805           "initial": "\uFD93"
13806         },
13807         "\u0647\u0645\u0645": {
13808           "initial": "\uFD94"
13809         },
13810         "\u0646\u062D\u0645": {
13811           "initial": "\uFD95"
13812         },
13813         "\u0646\u062D\u0649": {
13814           "final": "\uFD96"
13815         },
13816         "\u0646\u062C\u0645": {
13817           "final": "\uFD97",
13818           "initial": "\uFD98"
13819         },
13820         "\u0646\u062C\u0649": {
13821           "final": "\uFD99"
13822         },
13823         "\u0646\u0645\u064A": {
13824           "final": "\uFD9A"
13825         },
13826         "\u0646\u0645\u0649": {
13827           "final": "\uFD9B"
13828         },
13829         "\u064A\u0645\u0645": {
13830           "final": "\uFD9C",
13831           "initial": "\uFD9D"
13832         },
13833         "\u0628\u062E\u064A": {
13834           "final": "\uFD9E"
13835         },
13836         "\u062A\u062C\u064A": {
13837           "final": "\uFD9F"
13838         },
13839         "\u062A\u062C\u0649": {
13840           "final": "\uFDA0"
13841         },
13842         "\u062A\u062E\u064A": {
13843           "final": "\uFDA1"
13844         },
13845         "\u062A\u062E\u0649": {
13846           "final": "\uFDA2"
13847         },
13848         "\u062A\u0645\u064A": {
13849           "final": "\uFDA3"
13850         },
13851         "\u062A\u0645\u0649": {
13852           "final": "\uFDA4"
13853         },
13854         "\u062C\u0645\u064A": {
13855           "final": "\uFDA5"
13856         },
13857         "\u062C\u062D\u0649": {
13858           "final": "\uFDA6"
13859         },
13860         "\u062C\u0645\u0649": {
13861           "final": "\uFDA7"
13862         },
13863         "\u0633\u062E\u0649": {
13864           "final": "\uFDA8"
13865         },
13866         "\u0635\u062D\u064A": {
13867           "final": "\uFDA9"
13868         },
13869         "\u0634\u062D\u064A": {
13870           "final": "\uFDAA"
13871         },
13872         "\u0636\u062D\u064A": {
13873           "final": "\uFDAB"
13874         },
13875         "\u0644\u062C\u064A": {
13876           "final": "\uFDAC"
13877         },
13878         "\u0644\u0645\u064A": {
13879           "final": "\uFDAD"
13880         },
13881         "\u064A\u062D\u064A": {
13882           "final": "\uFDAE"
13883         },
13884         "\u064A\u062C\u064A": {
13885           "final": "\uFDAF"
13886         },
13887         "\u064A\u0645\u064A": {
13888           "final": "\uFDB0"
13889         },
13890         "\u0645\u0645\u064A": {
13891           "final": "\uFDB1"
13892         },
13893         "\u0642\u0645\u064A": {
13894           "final": "\uFDB2"
13895         },
13896         "\u0646\u062D\u064A": {
13897           "final": "\uFDB3"
13898         },
13899         "\u0639\u0645\u064A": {
13900           "final": "\uFDB6"
13901         },
13902         "\u0643\u0645\u064A": {
13903           "final": "\uFDB7"
13904         },
13905         "\u0646\u062C\u062D": {
13906           "initial": "\uFDB8",
13907           "final": "\uFDBD"
13908         },
13909         "\u0645\u062E\u064A": {
13910           "final": "\uFDB9"
13911         },
13912         "\u0644\u062C\u0645": {
13913           "initial": "\uFDBA",
13914           "final": "\uFDBC"
13915         },
13916         "\u0643\u0645\u0645": {
13917           "final": "\uFDBB",
13918           "initial": "\uFDC3"
13919         },
13920         "\u062C\u062D\u064A": {
13921           "final": "\uFDBE"
13922         },
13923         "\u062D\u062C\u064A": {
13924           "final": "\uFDBF"
13925         },
13926         "\u0645\u062C\u064A": {
13927           "final": "\uFDC0"
13928         },
13929         "\u0641\u0645\u064A": {
13930           "final": "\uFDC1"
13931         },
13932         "\u0628\u062D\u064A": {
13933           "final": "\uFDC2"
13934         },
13935         "\u0633\u062E\u064A": {
13936           "final": "\uFDC6"
13937         },
13938         "\u0646\u062C\u064A": {
13939           "final": "\uFDC7"
13940         },
13941         "\u0644\u0622": {
13942           "isolated": "\uFEF5",
13943           "final": "\uFEF6"
13944         },
13945         "\u0644\u0623": {
13946           "isolated": "\uFEF7",
13947           "final": "\uFEF8"
13948         },
13949         "\u0644\u0625": {
13950           "isolated": "\uFEF9",
13951           "final": "\uFEFA"
13952         },
13953         "\u0644\u0627": {
13954           "isolated": "\uFEFB",
13955           "final": "\uFEFC"
13956         },
13957         "words": {
13958           "\u0635\u0644\u06D2": "\uFDF0",
13959           "\u0642\u0644\u06D2": "\uFDF1",
13960           "\u0627\u0644\u0644\u0647": "\uFDF2",
13961           "\u0627\u0643\u0628\u0631": "\uFDF3",
13962           "\u0645\u062D\u0645\u062F": "\uFDF4",
13963           "\u0635\u0644\u0639\u0645": "\uFDF5",
13964           "\u0631\u0633\u0648\u0644": "\uFDF6",
13965           "\u0639\u0644\u064A\u0647": "\uFDF7",
13966           "\u0648\u0633\u0644\u0645": "\uFDF8",
13967           "\u0635\u0644\u0649": "\uFDF9",
13968           "\u0635\u0644\u0649\u0627\u0644\u0644\u0647\u0639\u0644\u064A\u0647\u0648\u0633\u0644\u0645": "\uFDFA",
13969           "\u062C\u0644\u062C\u0644\u0627\u0644\u0647": "\uFDFB",
13970           "\u0631\u06CC\u0627\u0644": "\uFDFC"
13971         }
13972       };
13973       exports2.default = ligatureReference;
13974     }
13975   });
13976
13977   // node_modules/alif-toolkit/lib/reference.js
13978   var require_reference = __commonJS({
13979     "node_modules/alif-toolkit/lib/reference.js"(exports2) {
13980       "use strict";
13981       Object.defineProperty(exports2, "__esModule", { value: true });
13982       exports2.ligatureWordList = exports2.ligatureList = exports2.letterList = exports2.alefs = exports2.lams = exports2.lineBreakers = exports2.tashkeel = void 0;
13983       var unicode_arabic_1 = require_unicode_arabic();
13984       var unicode_ligatures_1 = require_unicode_ligatures();
13985       var letterList = Object.keys(unicode_arabic_1.default);
13986       exports2.letterList = letterList;
13987       var ligatureList = Object.keys(unicode_ligatures_1.default);
13988       exports2.ligatureList = ligatureList;
13989       var ligatureWordList = Object.keys(unicode_ligatures_1.default.words);
13990       exports2.ligatureWordList = ligatureWordList;
13991       var lams = "\u0644\u06B5\u06B6\u06B7\u06B8";
13992       exports2.lams = lams;
13993       var alefs = "\u0627\u0622\u0623\u0625\u0671\u0672\u0673\u0675\u0773\u0774";
13994       exports2.alefs = alefs;
13995       var tashkeel = "\u0605\u0640\u0670\u0674\u06DF\u06E7\u06E8";
13996       exports2.tashkeel = tashkeel;
13997       function addToTashkeel(start2, finish) {
13998         for (var i3 = start2; i3 <= finish; i3++) {
13999           exports2.tashkeel = tashkeel += String.fromCharCode(i3);
14000         }
14001       }
14002       addToTashkeel(1552, 1562);
14003       addToTashkeel(1611, 1631);
14004       addToTashkeel(1750, 1756);
14005       addToTashkeel(1760, 1764);
14006       addToTashkeel(1770, 1773);
14007       addToTashkeel(2259, 2273);
14008       addToTashkeel(2275, 2303);
14009       addToTashkeel(65136, 65151);
14010       var lineBreakers = "\u0627\u0629\u0648\u06C0\u06CF\u06FD\u06FE\u076B\u076C\u0771\u0773\u0774\u0778\u0779\u08E2\u08B1\u08B2\u08B9";
14011       exports2.lineBreakers = lineBreakers;
14012       function addToLineBreakers(start2, finish) {
14013         for (var i3 = start2; i3 <= finish; i3++) {
14014           exports2.lineBreakers = lineBreakers += String.fromCharCode(i3);
14015         }
14016       }
14017       addToLineBreakers(1536, 1567);
14018       addToLineBreakers(1569, 1573);
14019       addToLineBreakers(1583, 1586);
14020       addToLineBreakers(1632, 1645);
14021       addToLineBreakers(1649, 1655);
14022       addToLineBreakers(1672, 1689);
14023       addToLineBreakers(1731, 1739);
14024       addToLineBreakers(1746, 1785);
14025       addToLineBreakers(1881, 1883);
14026       addToLineBreakers(2218, 2222);
14027       addToLineBreakers(64336, 65021);
14028       addToLineBreakers(65152, 65276);
14029       addToLineBreakers(69216, 69247);
14030       addToLineBreakers(126064, 126143);
14031       addToLineBreakers(126464, 126719);
14032     }
14033   });
14034
14035   // node_modules/alif-toolkit/lib/GlyphSplitter.js
14036   var require_GlyphSplitter = __commonJS({
14037     "node_modules/alif-toolkit/lib/GlyphSplitter.js"(exports2) {
14038       "use strict";
14039       Object.defineProperty(exports2, "__esModule", { value: true });
14040       exports2.GlyphSplitter = GlyphSplitter;
14041       var isArabic_1 = require_isArabic();
14042       var reference_1 = require_reference();
14043       function GlyphSplitter(word) {
14044         let letters = [];
14045         let lastLetter = "";
14046         word.split("").forEach((letter) => {
14047           if ((0, isArabic_1.isArabic)(letter)) {
14048             if (reference_1.tashkeel.indexOf(letter) > -1) {
14049               letters[letters.length - 1] += letter;
14050             } 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)) {
14051               letters[letters.length - 1] += letter;
14052             } else {
14053               letters.push(letter);
14054             }
14055           } else {
14056             letters.push(letter);
14057           }
14058           if (reference_1.tashkeel.indexOf(letter) === -1) {
14059             lastLetter = letter;
14060           }
14061         });
14062         return letters;
14063       }
14064     }
14065   });
14066
14067   // node_modules/alif-toolkit/lib/BaselineSplitter.js
14068   var require_BaselineSplitter = __commonJS({
14069     "node_modules/alif-toolkit/lib/BaselineSplitter.js"(exports2) {
14070       "use strict";
14071       Object.defineProperty(exports2, "__esModule", { value: true });
14072       exports2.BaselineSplitter = BaselineSplitter;
14073       var isArabic_1 = require_isArabic();
14074       var reference_1 = require_reference();
14075       function BaselineSplitter(word) {
14076         let letters = [];
14077         let lastLetter = "";
14078         word.split("").forEach((letter) => {
14079           if ((0, isArabic_1.isArabic)(letter) && (0, isArabic_1.isArabic)(lastLetter)) {
14080             if (lastLetter.length && reference_1.tashkeel.indexOf(letter) > -1) {
14081               letters[letters.length - 1] += letter;
14082             } else if (reference_1.lineBreakers.indexOf(lastLetter) > -1) {
14083               letters.push(letter);
14084             } else {
14085               letters[letters.length - 1] += letter;
14086             }
14087           } else {
14088             letters.push(letter);
14089           }
14090           if (reference_1.tashkeel.indexOf(letter) === -1) {
14091             lastLetter = letter;
14092           }
14093         });
14094         return letters;
14095       }
14096     }
14097   });
14098
14099   // node_modules/alif-toolkit/lib/Normalization.js
14100   var require_Normalization = __commonJS({
14101     "node_modules/alif-toolkit/lib/Normalization.js"(exports2) {
14102       "use strict";
14103       Object.defineProperty(exports2, "__esModule", { value: true });
14104       exports2.Normal = Normal;
14105       var unicode_arabic_1 = require_unicode_arabic();
14106       var unicode_ligatures_1 = require_unicode_ligatures();
14107       var isArabic_1 = require_isArabic();
14108       var reference_1 = require_reference();
14109       function Normal(word, breakPresentationForm) {
14110         if (typeof breakPresentationForm === "undefined") {
14111           breakPresentationForm = true;
14112         }
14113         let returnable = "";
14114         word.split("").forEach((letter) => {
14115           if (!(0, isArabic_1.isArabic)(letter)) {
14116             returnable += letter;
14117             return;
14118           }
14119           for (let w2 = 0; w2 < reference_1.letterList.length; w2++) {
14120             let letterForms = unicode_arabic_1.default[reference_1.letterList[w2]];
14121             let versions = Object.keys(letterForms);
14122             for (let v2 = 0; v2 < versions.length; v2++) {
14123               let localVersion = letterForms[versions[v2]];
14124               if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
14125                 let embeddedForms = Object.keys(localVersion);
14126                 for (let ef = 0; ef < embeddedForms.length; ef++) {
14127                   let form = localVersion[embeddedForms[ef]];
14128                   if (form === letter || typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
14129                     if (form === letter) {
14130                       if (breakPresentationForm && localVersion["normal"] && ["isolated", "initial", "medial", "final"].indexOf(embeddedForms[ef]) > -1) {
14131                         if (typeof localVersion["normal"] === "object") {
14132                           returnable += localVersion["normal"][0];
14133                         } else {
14134                           returnable += localVersion["normal"];
14135                         }
14136                         return;
14137                       }
14138                       returnable += letter;
14139                       return;
14140                     } else if (typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
14141                       returnable += form[0];
14142                       return;
14143                     }
14144                   }
14145                 }
14146               } else if (localVersion === letter) {
14147                 if (breakPresentationForm && letterForms["normal"] && ["isolated", "initial", "medial", "final"].indexOf(versions[v2]) > -1) {
14148                   if (typeof letterForms["normal"] === "object") {
14149                     returnable += letterForms["normal"][0];
14150                   } else {
14151                     returnable += letterForms["normal"];
14152                   }
14153                   return;
14154                 }
14155                 returnable += letter;
14156                 return;
14157               } else if (typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
14158                 returnable += localVersion[0];
14159                 return;
14160               }
14161             }
14162           }
14163           for (let v2 = 0; v2 < reference_1.ligatureList.length; v2++) {
14164             let normalForm = reference_1.ligatureList[v2];
14165             if (normalForm !== "words") {
14166               let ligForms = Object.keys(unicode_ligatures_1.default[normalForm]);
14167               for (let f2 = 0; f2 < ligForms.length; f2++) {
14168                 if (unicode_ligatures_1.default[normalForm][ligForms[f2]] === letter) {
14169                   returnable += normalForm;
14170                   return;
14171                 }
14172               }
14173             }
14174           }
14175           for (let v3 = 0; v3 < reference_1.ligatureWordList.length; v3++) {
14176             let normalForm = reference_1.ligatureWordList[v3];
14177             if (unicode_ligatures_1.default.words[normalForm] === letter) {
14178               returnable += normalForm;
14179               return;
14180             }
14181           }
14182           returnable += letter;
14183         });
14184         return returnable;
14185       }
14186     }
14187   });
14188
14189   // node_modules/alif-toolkit/lib/CharShaper.js
14190   var require_CharShaper = __commonJS({
14191     "node_modules/alif-toolkit/lib/CharShaper.js"(exports2) {
14192       "use strict";
14193       Object.defineProperty(exports2, "__esModule", { value: true });
14194       exports2.CharShaper = CharShaper;
14195       var unicode_arabic_1 = require_unicode_arabic();
14196       var isArabic_1 = require_isArabic();
14197       var reference_1 = require_reference();
14198       function CharShaper(letter, form) {
14199         if (!(0, isArabic_1.isArabic)(letter)) {
14200           throw new Error("Not Arabic");
14201         }
14202         if (letter === "\u0621") {
14203           return "\u0621";
14204         }
14205         for (let w2 = 0; w2 < reference_1.letterList.length; w2++) {
14206           let letterForms = unicode_arabic_1.default[reference_1.letterList[w2]];
14207           let versions = Object.keys(letterForms);
14208           for (let v2 = 0; v2 < versions.length; v2++) {
14209             let localVersion = letterForms[versions[v2]];
14210             if (localVersion === letter || typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
14211               if (versions.indexOf(form) > -1) {
14212                 return letterForms[form];
14213               }
14214             } else if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
14215               let embeddedVersions = Object.keys(localVersion);
14216               for (let ev = 0; ev < embeddedVersions.length; ev++) {
14217                 if (localVersion[embeddedVersions[ev]] === letter || typeof localVersion[embeddedVersions[ev]] === "object" && localVersion[embeddedVersions[ev]].indexOf && localVersion[embeddedVersions[ev]].indexOf(letter) > -1) {
14218                   if (embeddedVersions.indexOf(form) > -1) {
14219                     return localVersion[form];
14220                   }
14221                 }
14222               }
14223             }
14224           }
14225         }
14226       }
14227     }
14228   });
14229
14230   // node_modules/alif-toolkit/lib/WordShaper.js
14231   var require_WordShaper = __commonJS({
14232     "node_modules/alif-toolkit/lib/WordShaper.js"(exports2) {
14233       "use strict";
14234       Object.defineProperty(exports2, "__esModule", { value: true });
14235       exports2.WordShaper = WordShaper2;
14236       var isArabic_1 = require_isArabic();
14237       var reference_1 = require_reference();
14238       var CharShaper_1 = require_CharShaper();
14239       var unicode_ligatures_1 = require_unicode_ligatures();
14240       function WordShaper2(word) {
14241         let state = "initial";
14242         let output = "";
14243         for (let w2 = 0; w2 < word.length; w2++) {
14244           let nextLetter = " ";
14245           for (let nxw = w2 + 1; nxw < word.length; nxw++) {
14246             if (!(0, isArabic_1.isArabic)(word[nxw])) {
14247               break;
14248             }
14249             if (reference_1.tashkeel.indexOf(word[nxw]) === -1) {
14250               nextLetter = word[nxw];
14251               break;
14252             }
14253           }
14254           if (!(0, isArabic_1.isArabic)(word[w2]) || (0, isArabic_1.isMath)(word[w2])) {
14255             output += word[w2];
14256             state = "initial";
14257           } else if (reference_1.tashkeel.indexOf(word[w2]) > -1) {
14258             output += word[w2];
14259           } else if (nextLetter === " " || reference_1.lineBreakers.indexOf(word[w2]) > -1) {
14260             output += (0, CharShaper_1.CharShaper)(word[w2], state === "initial" ? "isolated" : "final");
14261             state = "initial";
14262           } else if (reference_1.lams.indexOf(word[w2]) > -1 && reference_1.alefs.indexOf(nextLetter) > -1) {
14263             output += unicode_ligatures_1.default[word[w2] + nextLetter][state === "initial" ? "isolated" : "final"];
14264             while (word[w2] !== nextLetter) {
14265               w2++;
14266             }
14267             state = "initial";
14268           } else {
14269             output += (0, CharShaper_1.CharShaper)(word[w2], state);
14270             state = "medial";
14271           }
14272         }
14273         return output;
14274       }
14275     }
14276   });
14277
14278   // node_modules/alif-toolkit/lib/ParentLetter.js
14279   var require_ParentLetter = __commonJS({
14280     "node_modules/alif-toolkit/lib/ParentLetter.js"(exports2) {
14281       "use strict";
14282       Object.defineProperty(exports2, "__esModule", { value: true });
14283       exports2.ParentLetter = ParentLetter;
14284       exports2.GrandparentLetter = GrandparentLetter;
14285       var unicode_arabic_1 = require_unicode_arabic();
14286       var isArabic_1 = require_isArabic();
14287       var reference_1 = require_reference();
14288       function ParentLetter(letter) {
14289         if (!(0, isArabic_1.isArabic)(letter)) {
14290           throw new Error("Not an Arabic letter");
14291         }
14292         for (let w2 = 0; w2 < reference_1.letterList.length; w2++) {
14293           let letterForms = unicode_arabic_1.default[reference_1.letterList[w2]];
14294           let versions = Object.keys(letterForms);
14295           for (let v2 = 0; v2 < versions.length; v2++) {
14296             let localVersion = letterForms[versions[v2]];
14297             if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
14298               let embeddedForms = Object.keys(localVersion);
14299               for (let ef = 0; ef < embeddedForms.length; ef++) {
14300                 let form = localVersion[embeddedForms[ef]];
14301                 if (form === letter || typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
14302                   return localVersion;
14303                 }
14304               }
14305             } else if (localVersion === letter || typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
14306               return letterForms;
14307             }
14308           }
14309           return null;
14310         }
14311       }
14312       function GrandparentLetter(letter) {
14313         if (!(0, isArabic_1.isArabic)(letter)) {
14314           throw new Error("Not an Arabic letter");
14315         }
14316         for (let w2 = 0; w2 < reference_1.letterList.length; w2++) {
14317           let letterForms = unicode_arabic_1.default[reference_1.letterList[w2]];
14318           let versions = Object.keys(letterForms);
14319           for (let v2 = 0; v2 < versions.length; v2++) {
14320             let localVersion = letterForms[versions[v2]];
14321             if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
14322               let embeddedForms = Object.keys(localVersion);
14323               for (let ef = 0; ef < embeddedForms.length; ef++) {
14324                 let form = localVersion[embeddedForms[ef]];
14325                 if (form === letter || typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
14326                   return letterForms;
14327                 }
14328               }
14329             } else if (localVersion === letter || typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
14330               return letterForms;
14331             }
14332           }
14333           return null;
14334         }
14335       }
14336     }
14337   });
14338
14339   // node_modules/alif-toolkit/lib/index.js
14340   var require_lib = __commonJS({
14341     "node_modules/alif-toolkit/lib/index.js"(exports2) {
14342       "use strict";
14343       Object.defineProperty(exports2, "__esModule", { value: true });
14344       exports2.GrandparentLetter = exports2.ParentLetter = exports2.WordShaper = exports2.CharShaper = exports2.Normal = exports2.BaselineSplitter = exports2.GlyphSplitter = exports2.isArabic = void 0;
14345       var isArabic_1 = require_isArabic();
14346       Object.defineProperty(exports2, "isArabic", { enumerable: true, get: function() {
14347         return isArabic_1.isArabic;
14348       } });
14349       var GlyphSplitter_1 = require_GlyphSplitter();
14350       Object.defineProperty(exports2, "GlyphSplitter", { enumerable: true, get: function() {
14351         return GlyphSplitter_1.GlyphSplitter;
14352       } });
14353       var BaselineSplitter_1 = require_BaselineSplitter();
14354       Object.defineProperty(exports2, "BaselineSplitter", { enumerable: true, get: function() {
14355         return BaselineSplitter_1.BaselineSplitter;
14356       } });
14357       var Normalization_1 = require_Normalization();
14358       Object.defineProperty(exports2, "Normal", { enumerable: true, get: function() {
14359         return Normalization_1.Normal;
14360       } });
14361       var CharShaper_1 = require_CharShaper();
14362       Object.defineProperty(exports2, "CharShaper", { enumerable: true, get: function() {
14363         return CharShaper_1.CharShaper;
14364       } });
14365       var WordShaper_1 = require_WordShaper();
14366       Object.defineProperty(exports2, "WordShaper", { enumerable: true, get: function() {
14367         return WordShaper_1.WordShaper;
14368       } });
14369       var ParentLetter_1 = require_ParentLetter();
14370       Object.defineProperty(exports2, "ParentLetter", { enumerable: true, get: function() {
14371         return ParentLetter_1.ParentLetter;
14372       } });
14373       Object.defineProperty(exports2, "GrandparentLetter", { enumerable: true, get: function() {
14374         return ParentLetter_1.GrandparentLetter;
14375       } });
14376     }
14377   });
14378
14379   // modules/util/svg_paths_rtl_fix.js
14380   var svg_paths_rtl_fix_exports = {};
14381   __export(svg_paths_rtl_fix_exports, {
14382     fixRTLTextForSvg: () => fixRTLTextForSvg,
14383     rtlRegex: () => rtlRegex
14384   });
14385   function fixRTLTextForSvg(inputText) {
14386     var ret = "", rtlBuffer = [];
14387     var arabicRegex = /[\u0600-\u06FF]/g;
14388     var arabicDiacritics = /[\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06ED]/g;
14389     var arabicMath = /[\u0660-\u066C\u06F0-\u06F9]+/g;
14390     var thaanaVowel = /[\u07A6-\u07B0]/;
14391     var hebrewSign = /[\u0591-\u05bd\u05bf\u05c1-\u05c5\u05c7]/;
14392     if (arabicRegex.test(inputText)) {
14393       inputText = (0, import_alif_toolkit.WordShaper)(inputText);
14394     }
14395     for (var n3 = 0; n3 < inputText.length; n3++) {
14396       var c2 = inputText[n3];
14397       if (arabicMath.test(c2)) {
14398         ret += rtlBuffer.reverse().join("");
14399         rtlBuffer = [c2];
14400       } else {
14401         if (rtlBuffer.length && arabicMath.test(rtlBuffer[rtlBuffer.length - 1])) {
14402           ret += rtlBuffer.reverse().join("");
14403           rtlBuffer = [];
14404         }
14405         if ((thaanaVowel.test(c2) || hebrewSign.test(c2) || arabicDiacritics.test(c2)) && rtlBuffer.length) {
14406           rtlBuffer[rtlBuffer.length - 1] += c2;
14407         } else if (rtlRegex.test(c2) || c2.charCodeAt(0) >= 64336 && c2.charCodeAt(0) <= 65023 || c2.charCodeAt(0) >= 65136 && c2.charCodeAt(0) <= 65279) {
14408           rtlBuffer.push(c2);
14409         } else if (c2 === " " && rtlBuffer.length) {
14410           rtlBuffer = [rtlBuffer.reverse().join("") + " "];
14411         } else {
14412           ret += rtlBuffer.reverse().join("") + c2;
14413           rtlBuffer = [];
14414         }
14415       }
14416     }
14417     ret += rtlBuffer.reverse().join("");
14418     return ret;
14419   }
14420   var import_alif_toolkit, rtlRegex;
14421   var init_svg_paths_rtl_fix = __esm({
14422     "modules/util/svg_paths_rtl_fix.js"() {
14423       "use strict";
14424       import_alif_toolkit = __toESM(require_lib());
14425       rtlRegex = /[\u0590-\u05FF\u0600-\u06FF\u0750-\u07BF\u08A0–\u08BF]/;
14426     }
14427   });
14428
14429   // node_modules/vparse/index.js
14430   var require_vparse = __commonJS({
14431     "node_modules/vparse/index.js"(exports2, module2) {
14432       (function(window2) {
14433         "use strict";
14434         function parseVersion3(v2) {
14435           var m2 = v2.replace(/[^0-9.]/g, "").match(/[0-9]*\.|[0-9]+/g) || [];
14436           v2 = {
14437             major: +m2[0] || 0,
14438             minor: +m2[1] || 0,
14439             patch: +m2[2] || 0,
14440             build: +m2[3] || 0
14441           };
14442           v2.isEmpty = !v2.major && !v2.minor && !v2.patch && !v2.build;
14443           v2.parsed = [v2.major, v2.minor, v2.patch, v2.build];
14444           v2.text = v2.parsed.join(".");
14445           v2.compare = compare2;
14446           return v2;
14447         }
14448         function compare2(v2) {
14449           if (typeof v2 === "string") {
14450             v2 = parseVersion3(v2);
14451           }
14452           for (var i3 = 0; i3 < 4; i3++) {
14453             if (this.parsed[i3] !== v2.parsed[i3]) {
14454               return this.parsed[i3] > v2.parsed[i3] ? 1 : -1;
14455             }
14456           }
14457           return 0;
14458         }
14459         if (typeof module2 === "object" && module2 && typeof module2.exports === "object") {
14460           module2.exports = parseVersion3;
14461         } else {
14462           window2.parseVersion = parseVersion3;
14463         }
14464       })(exports2);
14465     }
14466   });
14467
14468   // config/id.js
14469   var presetsCdnUrl, ociCdnUrl, wmfSitematrixCdnUrl, nsiCdnUrl, defaultOsmApiConnections, osmApiConnections, taginfoApiUrl, nominatimApiUrl, showDonationMessage;
14470   var init_id = __esm({
14471     "config/id.js"() {
14472       "use strict";
14473       presetsCdnUrl = "https://cdn.jsdelivr.net/npm/@openstreetmap/id-tagging-schema@{presets_version}/";
14474       ociCdnUrl = "https://cdn.jsdelivr.net/npm/osm-community-index@{version}/";
14475       wmfSitematrixCdnUrl = "https://cdn.jsdelivr.net/npm/wmf-sitematrix@{version}/";
14476       nsiCdnUrl = "https://cdn.jsdelivr.net/npm/name-suggestion-index@{version}/";
14477       defaultOsmApiConnections = {
14478         live: {
14479           url: "https://www.openstreetmap.org",
14480           apiUrl: "https://api.openstreetmap.org",
14481           client_id: "0tmNTmd0Jo1dQp4AUmMBLtGiD9YpMuXzHefitcuVStc"
14482         },
14483         dev: {
14484           url: "https://api06.dev.openstreetmap.org",
14485           client_id: "Ee1wWJ6UlpERbF6BfTNOpwn0R8k_06mvMXdDUkeHMgw"
14486         }
14487       };
14488       osmApiConnections = [];
14489       if (false) {
14490         osmApiConnections.push({
14491           url: null,
14492           apiUrl: null,
14493           client_id: null
14494         });
14495       } else if (false) {
14496         osmApiConnections.push(defaultOsmApiConnections[null]);
14497       } else {
14498         osmApiConnections.push(defaultOsmApiConnections.live);
14499         osmApiConnections.push(defaultOsmApiConnections.dev);
14500       }
14501       taginfoApiUrl = "https://taginfo.openstreetmap.org/api/4/";
14502       nominatimApiUrl = "https://nominatim.openstreetmap.org/";
14503       showDonationMessage = true;
14504     }
14505   });
14506
14507   // package.json
14508   var package_default;
14509   var init_package = __esm({
14510     "package.json"() {
14511       package_default = {
14512         name: "iD",
14513         version: "2.33.0",
14514         description: "A friendly editor for OpenStreetMap",
14515         main: "dist/iD.min.js",
14516         repository: "github:openstreetmap/iD",
14517         homepage: "https://github.com/openstreetmap/iD",
14518         bugs: "https://github.com/openstreetmap/iD/issues",
14519         keywords: [
14520           "editor",
14521           "openstreetmap"
14522         ],
14523         license: "ISC",
14524         scripts: {
14525           all: "run-s clean build dist",
14526           build: "run-s build:css build:data build:js",
14527           "build:css": "node scripts/build_css.js",
14528           "build:data": "shx mkdir -p dist/data && node scripts/build_data.js",
14529           "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",
14530           "build:js": "node config/esbuild.config.mjs",
14531           "build:js:watch": "node config/esbuild.config.mjs --watch",
14532           clean: "shx rm -f dist/esbuild.json dist/*.js dist/*.map dist/*.css dist/img/*.svg",
14533           dist: "run-p dist:**",
14534           "dist:mapillary": "shx mkdir -p dist/mapillary-js && shx cp -R node_modules/mapillary-js/dist/* dist/mapillary-js/",
14535           "dist:pannellum": "shx mkdir -p dist/pannellum && shx cp -R node_modules/pannellum/build/* dist/pannellum/",
14536           "dist:min": "node config/esbuild.config.min.mjs",
14537           "dist:svg:iD": 'svg-sprite --symbol --symbol-dest . --shape-id-generator "iD-%s" --symbol-sprite dist/img/iD-sprite.svg "svg/iD-sprite/**/*.svg"',
14538           "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',
14539           "dist:svg:fa": "svg-sprite --symbol --symbol-dest . --symbol-sprite dist/img/fa-sprite.svg svg/fontawesome/*.svg",
14540           "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',
14541           "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",
14542           "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",
14543           "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',
14544           "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',
14545           imagery: "node scripts/update_imagery.js",
14546           lint: "eslint config scripts test/spec modules",
14547           "lint:fix": "eslint scripts test/spec modules --fix",
14548           start: "run-s start:watch",
14549           "start:single-build": "run-p build:js start:server",
14550           "start:watch": "run-p build:js:watch start:server",
14551           "start:server": "node scripts/server.js",
14552           test: "npm-run-all -s lint build test:spec",
14553           "test:spec": "vitest --no-isolate",
14554           translations: "node scripts/update_locales.js"
14555         },
14556         dependencies: {
14557           "@mapbox/geojson-area": "^0.2.2",
14558           "@mapbox/sexagesimal": "1.2.0",
14559           "@mapbox/vector-tile": "^2.0.3",
14560           "@rapideditor/country-coder": "~5.3.1",
14561           "@rapideditor/location-conflation": "~1.4.1",
14562           "@tmcw/togeojson": "^7.0.0",
14563           "@turf/bbox": "^7.2.0",
14564           "@turf/bbox-clip": "^7.2.0",
14565           "abortcontroller-polyfill": "^1.7.8",
14566           "aes-js": "^3.1.2",
14567           "alif-toolkit": "^1.3.0",
14568           "core-js-bundle": "^3.41.0",
14569           diacritics: "1.3.0",
14570           exifr: "^7.1.3",
14571           "fast-deep-equal": "~3.1.1",
14572           "fast-json-stable-stringify": "2.1.0",
14573           "lodash-es": "~4.17.15",
14574           marked: "~15.0.8",
14575           "node-diff3": "~3.1.0",
14576           "osm-auth": "~2.6.0",
14577           pannellum: "2.5.6",
14578           pbf: "^4.0.1",
14579           "polygon-clipping": "~0.15.7",
14580           rbush: "4.0.1",
14581           vitest: "^3.1.1",
14582           "whatwg-fetch": "^3.6.20",
14583           "which-polygon": "2.2.1"
14584         },
14585         devDependencies: {
14586           "@fortawesome/fontawesome-svg-core": "~6.7.2",
14587           "@fortawesome/free-brands-svg-icons": "~6.7.2",
14588           "@fortawesome/free-regular-svg-icons": "~6.7.2",
14589           "@fortawesome/free-solid-svg-icons": "~6.7.2",
14590           "@mapbox/maki": "^8.2.0",
14591           "@openstreetmap/id-tagging-schema": "^6.10.0",
14592           "@rapideditor/mapillary_sprite_source": "^1.8.0",
14593           "@rapideditor/temaki": "^5.9.0",
14594           "@transifex/api": "^7.1.3",
14595           "@types/chai": "^5.2.1",
14596           "@types/d3": "^7.4.3",
14597           "@types/geojson": "^7946.0.16",
14598           "@types/happen": "^0.3.0",
14599           "@types/lodash-es": "^4.17.12",
14600           "@types/node": "^22.14.0",
14601           "@types/sinon": "^17.0.3",
14602           "@types/sinon-chai": "^4.0.0",
14603           autoprefixer: "^10.4.21",
14604           browserslist: "^4.24.4",
14605           "browserslist-to-esbuild": "^2.1.1",
14606           chai: "^5.2.0",
14607           chalk: "^4.1.2",
14608           "cldr-core": "^47.0.0",
14609           "cldr-localenames-full": "^47.0.0",
14610           "concat-files": "^0.1.1",
14611           d3: "~7.9.0",
14612           dotenv: "^16.4.7",
14613           "editor-layer-index": "github:osmlab/editor-layer-index#gh-pages",
14614           esbuild: "^0.25.2",
14615           "esbuild-visualizer": "^0.7.0",
14616           eslint: "^9.24.0",
14617           "fetch-mock": "^11.1.1",
14618           gaze: "^1.1.3",
14619           glob: "^10.4.5",
14620           happen: "^0.3.2",
14621           "js-yaml": "^4.0.0",
14622           jsdom: "^26.0.0",
14623           "json-stringify-pretty-compact": "^3.0.0",
14624           "mapillary-js": "4.1.2",
14625           minimist: "^1.2.8",
14626           "name-suggestion-index": "~6.0",
14627           "netlify-cli": "^19.1.5",
14628           "npm-run-all": "^4.0.0",
14629           "osm-community-index": "~5.9.1",
14630           postcss: "^8.5.3",
14631           "postcss-prefix-selector": "^2.1.1",
14632           "serve-handler": "^6.1.6",
14633           shelljs: "^0.9.2",
14634           shx: "^0.4.0",
14635           sinon: "^11.1.2",
14636           "sinon-chai": "^4.0.0",
14637           smash: "0.0",
14638           "svg-sprite": "2.0.4",
14639           vparse: "~1.1.0"
14640         },
14641         engines: {
14642           node: ">=18"
14643         },
14644         browserslist: [
14645           "> 0.3%, last 6 major versions, not dead, Firefox ESR, maintained node versions"
14646         ]
14647       };
14648     }
14649   });
14650
14651   // node_modules/aes-js/index.js
14652   var require_aes_js = __commonJS({
14653     "node_modules/aes-js/index.js"(exports2, module2) {
14654       (function(root3) {
14655         "use strict";
14656         function checkInt(value) {
14657           return parseInt(value) === value;
14658         }
14659         function checkInts(arrayish) {
14660           if (!checkInt(arrayish.length)) {
14661             return false;
14662           }
14663           for (var i3 = 0; i3 < arrayish.length; i3++) {
14664             if (!checkInt(arrayish[i3]) || arrayish[i3] < 0 || arrayish[i3] > 255) {
14665               return false;
14666             }
14667           }
14668           return true;
14669         }
14670         function coerceArray(arg, copy2) {
14671           if (arg.buffer && arg.name === "Uint8Array") {
14672             if (copy2) {
14673               if (arg.slice) {
14674                 arg = arg.slice();
14675               } else {
14676                 arg = Array.prototype.slice.call(arg);
14677               }
14678             }
14679             return arg;
14680           }
14681           if (Array.isArray(arg)) {
14682             if (!checkInts(arg)) {
14683               throw new Error("Array contains invalid value: " + arg);
14684             }
14685             return new Uint8Array(arg);
14686           }
14687           if (checkInt(arg.length) && checkInts(arg)) {
14688             return new Uint8Array(arg);
14689           }
14690           throw new Error("unsupported array-like object");
14691         }
14692         function createArray(length2) {
14693           return new Uint8Array(length2);
14694         }
14695         function copyArray2(sourceArray, targetArray, targetStart, sourceStart, sourceEnd) {
14696           if (sourceStart != null || sourceEnd != null) {
14697             if (sourceArray.slice) {
14698               sourceArray = sourceArray.slice(sourceStart, sourceEnd);
14699             } else {
14700               sourceArray = Array.prototype.slice.call(sourceArray, sourceStart, sourceEnd);
14701             }
14702           }
14703           targetArray.set(sourceArray, targetStart);
14704         }
14705         var convertUtf8 = /* @__PURE__ */ function() {
14706           function toBytes(text) {
14707             var result = [], i3 = 0;
14708             text = encodeURI(text);
14709             while (i3 < text.length) {
14710               var c2 = text.charCodeAt(i3++);
14711               if (c2 === 37) {
14712                 result.push(parseInt(text.substr(i3, 2), 16));
14713                 i3 += 2;
14714               } else {
14715                 result.push(c2);
14716               }
14717             }
14718             return coerceArray(result);
14719           }
14720           function fromBytes(bytes) {
14721             var result = [], i3 = 0;
14722             while (i3 < bytes.length) {
14723               var c2 = bytes[i3];
14724               if (c2 < 128) {
14725                 result.push(String.fromCharCode(c2));
14726                 i3++;
14727               } else if (c2 > 191 && c2 < 224) {
14728                 result.push(String.fromCharCode((c2 & 31) << 6 | bytes[i3 + 1] & 63));
14729                 i3 += 2;
14730               } else {
14731                 result.push(String.fromCharCode((c2 & 15) << 12 | (bytes[i3 + 1] & 63) << 6 | bytes[i3 + 2] & 63));
14732                 i3 += 3;
14733               }
14734             }
14735             return result.join("");
14736           }
14737           return {
14738             toBytes,
14739             fromBytes
14740           };
14741         }();
14742         var convertHex = /* @__PURE__ */ function() {
14743           function toBytes(text) {
14744             var result = [];
14745             for (var i3 = 0; i3 < text.length; i3 += 2) {
14746               result.push(parseInt(text.substr(i3, 2), 16));
14747             }
14748             return result;
14749           }
14750           var Hex = "0123456789abcdef";
14751           function fromBytes(bytes) {
14752             var result = [];
14753             for (var i3 = 0; i3 < bytes.length; i3++) {
14754               var v2 = bytes[i3];
14755               result.push(Hex[(v2 & 240) >> 4] + Hex[v2 & 15]);
14756             }
14757             return result.join("");
14758           }
14759           return {
14760             toBytes,
14761             fromBytes
14762           };
14763         }();
14764         var numberOfRounds = { 16: 10, 24: 12, 32: 14 };
14765         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];
14766         var S2 = [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];
14767         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];
14768         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];
14769         var T2 = [2781242211, 2230877308, 2582542199, 2381740923, 234877682, 3184946027, 2984144751, 1418839493, 1348481072, 50462977, 2848876391, 2102799147, 434634494, 1656084439, 3863849899, 2599188086, 1167051466, 2636087938, 1082771913, 2281340285, 368048890, 3954334041, 3381544775, 201060592, 3963727277, 1739838676, 4250903202, 3930435503, 3206782108, 4149453988, 2531553906, 1536934080, 3262494647, 484572669, 2923271059, 1783375398, 1517041206, 1098792767, 49674231, 1334037708, 1550332980, 4098991525, 886171109, 150598129, 2481090929, 1940642008, 1398944049, 1059722517, 201851908, 1385547719, 1699095331, 1587397571, 674240536, 2704774806, 252314885, 3039795866, 151914247, 908333586, 2602270848, 1038082786, 651029483, 1766729511, 3447698098, 2682942837, 454166793, 2652734339, 1951935532, 775166490, 758520603, 3000790638, 4004797018, 4217086112, 4137964114, 1299594043, 1639438038, 3464344499, 2068982057, 1054729187, 1901997871, 2534638724, 4121318227, 1757008337, 0, 750906861, 1614815264, 535035132, 3363418545, 3988151131, 3201591914, 1183697867, 3647454910, 1265776953, 3734260298, 3566750796, 3903871064, 1250283471, 1807470800, 717615087, 3847203498, 384695291, 3313910595, 3617213773, 1432761139, 2484176261, 3481945413, 283769337, 100925954, 2180939647, 4037038160, 1148730428, 3123027871, 3813386408, 4087501137, 4267549603, 3229630528, 2315620239, 2906624658, 3156319645, 1215313976, 82966005, 3747855548, 3245848246, 1974459098, 1665278241, 807407632, 451280895, 251524083, 1841287890, 1283575245, 337120268, 891687699, 801369324, 3787349855, 2721421207, 3431482436, 959321879, 1469301956, 4065699751, 2197585534, 1199193405, 2898814052, 3887750493, 724703513, 2514908019, 2696962144, 2551808385, 3516813135, 2141445340, 1715741218, 2119445034, 2872807568, 2198571144, 3398190662, 700968686, 3547052216, 1009259540, 2041044702, 3803995742, 487983883, 1991105499, 1004265696, 1449407026, 1316239930, 504629770, 3683797321, 168560134, 1816667172, 3837287516, 1570751170, 1857934291, 4014189740, 2797888098, 2822345105, 2754712981, 936633572, 2347923833, 852879335, 1133234376, 1500395319, 3084545389, 2348912013, 1689376213, 3533459022, 3762923945, 3034082412, 4205598294, 133428468, 634383082, 2949277029, 2398386810, 3913789102, 403703816, 3580869306, 2297460856, 1867130149, 1918643758, 607656988, 4049053350, 3346248884, 1368901318, 600565992, 2090982877, 2632479860, 557719327, 3717614411, 3697393085, 2249034635, 2232388234, 2430627952, 1115438654, 3295786421, 2865522278, 3633334344, 84280067, 33027830, 303828494, 2747425121, 1600795957, 4188952407, 3496589753, 2434238086, 1486471617, 658119965, 3106381470, 953803233, 334231800, 3005978776, 857870609, 3151128937, 1890179545, 2298973838, 2805175444, 3056442267, 574365214, 2450884487, 550103529, 1233637070, 4289353045, 2018519080, 2057691103, 2399374476, 4166623649, 2148108681, 387583245, 3664101311, 836232934, 3330556482, 3100665960, 3280093505, 2955516313, 2002398509, 287182607, 3413881008, 4238890068, 3597515707, 975967766];
14770         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];
14771         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];
14772         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];
14773         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];
14774         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];
14775         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];
14776         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];
14777         var U2 = [0, 185469197, 370938394, 487725847, 741876788, 657861945, 975451694, 824852259, 1483753576, 1400783205, 1315723890, 1164071807, 1950903388, 2135319889, 1649704518, 1767536459, 2967507152, 3152976349, 2801566410, 2918353863, 2631447780, 2547432937, 2328143614, 2177544179, 3901806776, 3818836405, 4270639778, 4118987695, 3299409036, 3483825537, 3535072918, 3652904859, 2077965243, 1893020342, 1841768865, 1724457132, 1474502543, 1559041666, 1107234197, 1257309336, 598438867, 681933534, 901210569, 1052338372, 261314535, 77422314, 428819965, 310463728, 3409685355, 3224740454, 3710368113, 3593056380, 3875770207, 3960309330, 4045380933, 4195456072, 2471224067, 2554718734, 2237133081, 2388260884, 3212035895, 3028143674, 2842678573, 2724322336, 4138563181, 4255350624, 3769721975, 3955191162, 3667219033, 3516619604, 3431546947, 3347532110, 2933734917, 2782082824, 3099667487, 3016697106, 2196052529, 2313884476, 2499348523, 2683765030, 1179510461, 1296297904, 1347548327, 1533017514, 1786102409, 1635502980, 2087309459, 2003294622, 507358933, 355706840, 136428751, 53458370, 839224033, 957055980, 605657339, 790073846, 2373340630, 2256028891, 2607439820, 2422494913, 2706270690, 2856345839, 3075636216, 3160175349, 3573941694, 3725069491, 3273267108, 3356761769, 4181598602, 4063242375, 4011996048, 3828103837, 1033297158, 915985419, 730517276, 545572369, 296679730, 446754879, 129166120, 213705253, 1709610350, 1860738147, 1945798516, 2029293177, 1239331162, 1120974935, 1606591296, 1422699085, 4148292826, 4233094615, 3781033664, 3931371469, 3682191598, 3497509347, 3446004468, 3328955385, 2939266226, 2755636671, 3106780840, 2988687269, 2198438022, 2282195339, 2501218972, 2652609425, 1201765386, 1286567175, 1371368976, 1521706781, 1805211710, 1620529459, 2105887268, 1988838185, 533804130, 350174575, 164439672, 46346101, 870912086, 954669403, 636813900, 788204353, 2358957921, 2274680428, 2592523643, 2441661558, 2695033685, 2880240216, 3065962831, 3182487618, 3572145929, 3756299780, 3270937875, 3388507166, 4174560061, 4091327024, 4006521127, 3854606378, 1014646705, 930369212, 711349675, 560487590, 272786309, 457992840, 106852767, 223377554, 1678381017, 1862534868, 1914052035, 2031621326, 1211247597, 1128014560, 1580087799, 1428173050, 32283319, 182621114, 401639597, 486441376, 768917123, 651868046, 1003007129, 818324884, 1503449823, 1385356242, 1333838021, 1150208456, 1973745387, 2125135846, 1673061617, 1756818940, 2970356327, 3120694122, 2802849917, 2887651696, 2637442643, 2520393566, 2334669897, 2149987652, 3917234703, 3799141122, 4284502037, 4100872472, 3309594171, 3460984630, 3545789473, 3629546796, 2050466060, 1899603969, 1814803222, 1730525723, 1443857720, 1560382517, 1075025698, 1260232239, 575138148, 692707433, 878443390, 1062597235, 243256656, 91341917, 409198410, 325965383, 3403100636, 3252238545, 3704300486, 3620022987, 3874428392, 3990953189, 4042459122, 4227665663, 2460449204, 2578018489, 2226875310, 2411029155, 3198115200, 3046200461, 2827177882, 2743944855];
14778         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];
14779         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];
14780         function convertToInt32(bytes) {
14781           var result = [];
14782           for (var i3 = 0; i3 < bytes.length; i3 += 4) {
14783             result.push(
14784               bytes[i3] << 24 | bytes[i3 + 1] << 16 | bytes[i3 + 2] << 8 | bytes[i3 + 3]
14785             );
14786           }
14787           return result;
14788         }
14789         var AES = function(key) {
14790           if (!(this instanceof AES)) {
14791             throw Error("AES must be instanitated with `new`");
14792           }
14793           Object.defineProperty(this, "key", {
14794             value: coerceArray(key, true)
14795           });
14796           this._prepare();
14797         };
14798         AES.prototype._prepare = function() {
14799           var rounds = numberOfRounds[this.key.length];
14800           if (rounds == null) {
14801             throw new Error("invalid key size (must be 16, 24 or 32 bytes)");
14802           }
14803           this._Ke = [];
14804           this._Kd = [];
14805           for (var i3 = 0; i3 <= rounds; i3++) {
14806             this._Ke.push([0, 0, 0, 0]);
14807             this._Kd.push([0, 0, 0, 0]);
14808           }
14809           var roundKeyCount = (rounds + 1) * 4;
14810           var KC = this.key.length / 4;
14811           var tk = convertToInt32(this.key);
14812           var index;
14813           for (var i3 = 0; i3 < KC; i3++) {
14814             index = i3 >> 2;
14815             this._Ke[index][i3 % 4] = tk[i3];
14816             this._Kd[rounds - index][i3 % 4] = tk[i3];
14817           }
14818           var rconpointer = 0;
14819           var t2 = KC, tt2;
14820           while (t2 < roundKeyCount) {
14821             tt2 = tk[KC - 1];
14822             tk[0] ^= S2[tt2 >> 16 & 255] << 24 ^ S2[tt2 >> 8 & 255] << 16 ^ S2[tt2 & 255] << 8 ^ S2[tt2 >> 24 & 255] ^ rcon[rconpointer] << 24;
14823             rconpointer += 1;
14824             if (KC != 8) {
14825               for (var i3 = 1; i3 < KC; i3++) {
14826                 tk[i3] ^= tk[i3 - 1];
14827               }
14828             } else {
14829               for (var i3 = 1; i3 < KC / 2; i3++) {
14830                 tk[i3] ^= tk[i3 - 1];
14831               }
14832               tt2 = tk[KC / 2 - 1];
14833               tk[KC / 2] ^= S2[tt2 & 255] ^ S2[tt2 >> 8 & 255] << 8 ^ S2[tt2 >> 16 & 255] << 16 ^ S2[tt2 >> 24 & 255] << 24;
14834               for (var i3 = KC / 2 + 1; i3 < KC; i3++) {
14835                 tk[i3] ^= tk[i3 - 1];
14836               }
14837             }
14838             var i3 = 0, r2, c2;
14839             while (i3 < KC && t2 < roundKeyCount) {
14840               r2 = t2 >> 2;
14841               c2 = t2 % 4;
14842               this._Ke[r2][c2] = tk[i3];
14843               this._Kd[rounds - r2][c2] = tk[i3++];
14844               t2++;
14845             }
14846           }
14847           for (var r2 = 1; r2 < rounds; r2++) {
14848             for (var c2 = 0; c2 < 4; c2++) {
14849               tt2 = this._Kd[r2][c2];
14850               this._Kd[r2][c2] = U1[tt2 >> 24 & 255] ^ U2[tt2 >> 16 & 255] ^ U3[tt2 >> 8 & 255] ^ U4[tt2 & 255];
14851             }
14852           }
14853         };
14854         AES.prototype.encrypt = function(plaintext) {
14855           if (plaintext.length != 16) {
14856             throw new Error("invalid plaintext size (must be 16 bytes)");
14857           }
14858           var rounds = this._Ke.length - 1;
14859           var a2 = [0, 0, 0, 0];
14860           var t2 = convertToInt32(plaintext);
14861           for (var i3 = 0; i3 < 4; i3++) {
14862             t2[i3] ^= this._Ke[0][i3];
14863           }
14864           for (var r2 = 1; r2 < rounds; r2++) {
14865             for (var i3 = 0; i3 < 4; i3++) {
14866               a2[i3] = T1[t2[i3] >> 24 & 255] ^ T2[t2[(i3 + 1) % 4] >> 16 & 255] ^ T3[t2[(i3 + 2) % 4] >> 8 & 255] ^ T4[t2[(i3 + 3) % 4] & 255] ^ this._Ke[r2][i3];
14867             }
14868             t2 = a2.slice();
14869           }
14870           var result = createArray(16), tt2;
14871           for (var i3 = 0; i3 < 4; i3++) {
14872             tt2 = this._Ke[rounds][i3];
14873             result[4 * i3] = (S2[t2[i3] >> 24 & 255] ^ tt2 >> 24) & 255;
14874             result[4 * i3 + 1] = (S2[t2[(i3 + 1) % 4] >> 16 & 255] ^ tt2 >> 16) & 255;
14875             result[4 * i3 + 2] = (S2[t2[(i3 + 2) % 4] >> 8 & 255] ^ tt2 >> 8) & 255;
14876             result[4 * i3 + 3] = (S2[t2[(i3 + 3) % 4] & 255] ^ tt2) & 255;
14877           }
14878           return result;
14879         };
14880         AES.prototype.decrypt = function(ciphertext) {
14881           if (ciphertext.length != 16) {
14882             throw new Error("invalid ciphertext size (must be 16 bytes)");
14883           }
14884           var rounds = this._Kd.length - 1;
14885           var a2 = [0, 0, 0, 0];
14886           var t2 = convertToInt32(ciphertext);
14887           for (var i3 = 0; i3 < 4; i3++) {
14888             t2[i3] ^= this._Kd[0][i3];
14889           }
14890           for (var r2 = 1; r2 < rounds; r2++) {
14891             for (var i3 = 0; i3 < 4; i3++) {
14892               a2[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];
14893             }
14894             t2 = a2.slice();
14895           }
14896           var result = createArray(16), tt2;
14897           for (var i3 = 0; i3 < 4; i3++) {
14898             tt2 = this._Kd[rounds][i3];
14899             result[4 * i3] = (Si[t2[i3] >> 24 & 255] ^ tt2 >> 24) & 255;
14900             result[4 * i3 + 1] = (Si[t2[(i3 + 3) % 4] >> 16 & 255] ^ tt2 >> 16) & 255;
14901             result[4 * i3 + 2] = (Si[t2[(i3 + 2) % 4] >> 8 & 255] ^ tt2 >> 8) & 255;
14902             result[4 * i3 + 3] = (Si[t2[(i3 + 1) % 4] & 255] ^ tt2) & 255;
14903           }
14904           return result;
14905         };
14906         var ModeOfOperationECB = function(key) {
14907           if (!(this instanceof ModeOfOperationECB)) {
14908             throw Error("AES must be instanitated with `new`");
14909           }
14910           this.description = "Electronic Code Block";
14911           this.name = "ecb";
14912           this._aes = new AES(key);
14913         };
14914         ModeOfOperationECB.prototype.encrypt = function(plaintext) {
14915           plaintext = coerceArray(plaintext);
14916           if (plaintext.length % 16 !== 0) {
14917             throw new Error("invalid plaintext size (must be multiple of 16 bytes)");
14918           }
14919           var ciphertext = createArray(plaintext.length);
14920           var block2 = createArray(16);
14921           for (var i3 = 0; i3 < plaintext.length; i3 += 16) {
14922             copyArray2(plaintext, block2, 0, i3, i3 + 16);
14923             block2 = this._aes.encrypt(block2);
14924             copyArray2(block2, ciphertext, i3);
14925           }
14926           return ciphertext;
14927         };
14928         ModeOfOperationECB.prototype.decrypt = function(ciphertext) {
14929           ciphertext = coerceArray(ciphertext);
14930           if (ciphertext.length % 16 !== 0) {
14931             throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");
14932           }
14933           var plaintext = createArray(ciphertext.length);
14934           var block2 = createArray(16);
14935           for (var i3 = 0; i3 < ciphertext.length; i3 += 16) {
14936             copyArray2(ciphertext, block2, 0, i3, i3 + 16);
14937             block2 = this._aes.decrypt(block2);
14938             copyArray2(block2, plaintext, i3);
14939           }
14940           return plaintext;
14941         };
14942         var ModeOfOperationCBC = function(key, iv) {
14943           if (!(this instanceof ModeOfOperationCBC)) {
14944             throw Error("AES must be instanitated with `new`");
14945           }
14946           this.description = "Cipher Block Chaining";
14947           this.name = "cbc";
14948           if (!iv) {
14949             iv = createArray(16);
14950           } else if (iv.length != 16) {
14951             throw new Error("invalid initialation vector size (must be 16 bytes)");
14952           }
14953           this._lastCipherblock = coerceArray(iv, true);
14954           this._aes = new AES(key);
14955         };
14956         ModeOfOperationCBC.prototype.encrypt = function(plaintext) {
14957           plaintext = coerceArray(plaintext);
14958           if (plaintext.length % 16 !== 0) {
14959             throw new Error("invalid plaintext size (must be multiple of 16 bytes)");
14960           }
14961           var ciphertext = createArray(plaintext.length);
14962           var block2 = createArray(16);
14963           for (var i3 = 0; i3 < plaintext.length; i3 += 16) {
14964             copyArray2(plaintext, block2, 0, i3, i3 + 16);
14965             for (var j2 = 0; j2 < 16; j2++) {
14966               block2[j2] ^= this._lastCipherblock[j2];
14967             }
14968             this._lastCipherblock = this._aes.encrypt(block2);
14969             copyArray2(this._lastCipherblock, ciphertext, i3);
14970           }
14971           return ciphertext;
14972         };
14973         ModeOfOperationCBC.prototype.decrypt = function(ciphertext) {
14974           ciphertext = coerceArray(ciphertext);
14975           if (ciphertext.length % 16 !== 0) {
14976             throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");
14977           }
14978           var plaintext = createArray(ciphertext.length);
14979           var block2 = createArray(16);
14980           for (var i3 = 0; i3 < ciphertext.length; i3 += 16) {
14981             copyArray2(ciphertext, block2, 0, i3, i3 + 16);
14982             block2 = this._aes.decrypt(block2);
14983             for (var j2 = 0; j2 < 16; j2++) {
14984               plaintext[i3 + j2] = block2[j2] ^ this._lastCipherblock[j2];
14985             }
14986             copyArray2(ciphertext, this._lastCipherblock, 0, i3, i3 + 16);
14987           }
14988           return plaintext;
14989         };
14990         var ModeOfOperationCFB = function(key, iv, segmentSize) {
14991           if (!(this instanceof ModeOfOperationCFB)) {
14992             throw Error("AES must be instanitated with `new`");
14993           }
14994           this.description = "Cipher Feedback";
14995           this.name = "cfb";
14996           if (!iv) {
14997             iv = createArray(16);
14998           } else if (iv.length != 16) {
14999             throw new Error("invalid initialation vector size (must be 16 size)");
15000           }
15001           if (!segmentSize) {
15002             segmentSize = 1;
15003           }
15004           this.segmentSize = segmentSize;
15005           this._shiftRegister = coerceArray(iv, true);
15006           this._aes = new AES(key);
15007         };
15008         ModeOfOperationCFB.prototype.encrypt = function(plaintext) {
15009           if (plaintext.length % this.segmentSize != 0) {
15010             throw new Error("invalid plaintext size (must be segmentSize bytes)");
15011           }
15012           var encrypted = coerceArray(plaintext, true);
15013           var xorSegment;
15014           for (var i3 = 0; i3 < encrypted.length; i3 += this.segmentSize) {
15015             xorSegment = this._aes.encrypt(this._shiftRegister);
15016             for (var j2 = 0; j2 < this.segmentSize; j2++) {
15017               encrypted[i3 + j2] ^= xorSegment[j2];
15018             }
15019             copyArray2(this._shiftRegister, this._shiftRegister, 0, this.segmentSize);
15020             copyArray2(encrypted, this._shiftRegister, 16 - this.segmentSize, i3, i3 + this.segmentSize);
15021           }
15022           return encrypted;
15023         };
15024         ModeOfOperationCFB.prototype.decrypt = function(ciphertext) {
15025           if (ciphertext.length % this.segmentSize != 0) {
15026             throw new Error("invalid ciphertext size (must be segmentSize bytes)");
15027           }
15028           var plaintext = coerceArray(ciphertext, true);
15029           var xorSegment;
15030           for (var i3 = 0; i3 < plaintext.length; i3 += this.segmentSize) {
15031             xorSegment = this._aes.encrypt(this._shiftRegister);
15032             for (var j2 = 0; j2 < this.segmentSize; j2++) {
15033               plaintext[i3 + j2] ^= xorSegment[j2];
15034             }
15035             copyArray2(this._shiftRegister, this._shiftRegister, 0, this.segmentSize);
15036             copyArray2(ciphertext, this._shiftRegister, 16 - this.segmentSize, i3, i3 + this.segmentSize);
15037           }
15038           return plaintext;
15039         };
15040         var ModeOfOperationOFB = function(key, iv) {
15041           if (!(this instanceof ModeOfOperationOFB)) {
15042             throw Error("AES must be instanitated with `new`");
15043           }
15044           this.description = "Output Feedback";
15045           this.name = "ofb";
15046           if (!iv) {
15047             iv = createArray(16);
15048           } else if (iv.length != 16) {
15049             throw new Error("invalid initialation vector size (must be 16 bytes)");
15050           }
15051           this._lastPrecipher = coerceArray(iv, true);
15052           this._lastPrecipherIndex = 16;
15053           this._aes = new AES(key);
15054         };
15055         ModeOfOperationOFB.prototype.encrypt = function(plaintext) {
15056           var encrypted = coerceArray(plaintext, true);
15057           for (var i3 = 0; i3 < encrypted.length; i3++) {
15058             if (this._lastPrecipherIndex === 16) {
15059               this._lastPrecipher = this._aes.encrypt(this._lastPrecipher);
15060               this._lastPrecipherIndex = 0;
15061             }
15062             encrypted[i3] ^= this._lastPrecipher[this._lastPrecipherIndex++];
15063           }
15064           return encrypted;
15065         };
15066         ModeOfOperationOFB.prototype.decrypt = ModeOfOperationOFB.prototype.encrypt;
15067         var Counter = function(initialValue) {
15068           if (!(this instanceof Counter)) {
15069             throw Error("Counter must be instanitated with `new`");
15070           }
15071           if (initialValue !== 0 && !initialValue) {
15072             initialValue = 1;
15073           }
15074           if (typeof initialValue === "number") {
15075             this._counter = createArray(16);
15076             this.setValue(initialValue);
15077           } else {
15078             this.setBytes(initialValue);
15079           }
15080         };
15081         Counter.prototype.setValue = function(value) {
15082           if (typeof value !== "number" || parseInt(value) != value) {
15083             throw new Error("invalid counter value (must be an integer)");
15084           }
15085           if (value > Number.MAX_SAFE_INTEGER) {
15086             throw new Error("integer value out of safe range");
15087           }
15088           for (var index = 15; index >= 0; --index) {
15089             this._counter[index] = value % 256;
15090             value = parseInt(value / 256);
15091           }
15092         };
15093         Counter.prototype.setBytes = function(bytes) {
15094           bytes = coerceArray(bytes, true);
15095           if (bytes.length != 16) {
15096             throw new Error("invalid counter bytes size (must be 16 bytes)");
15097           }
15098           this._counter = bytes;
15099         };
15100         Counter.prototype.increment = function() {
15101           for (var i3 = 15; i3 >= 0; i3--) {
15102             if (this._counter[i3] === 255) {
15103               this._counter[i3] = 0;
15104             } else {
15105               this._counter[i3]++;
15106               break;
15107             }
15108           }
15109         };
15110         var ModeOfOperationCTR = function(key, counter) {
15111           if (!(this instanceof ModeOfOperationCTR)) {
15112             throw Error("AES must be instanitated with `new`");
15113           }
15114           this.description = "Counter";
15115           this.name = "ctr";
15116           if (!(counter instanceof Counter)) {
15117             counter = new Counter(counter);
15118           }
15119           this._counter = counter;
15120           this._remainingCounter = null;
15121           this._remainingCounterIndex = 16;
15122           this._aes = new AES(key);
15123         };
15124         ModeOfOperationCTR.prototype.encrypt = function(plaintext) {
15125           var encrypted = coerceArray(plaintext, true);
15126           for (var i3 = 0; i3 < encrypted.length; i3++) {
15127             if (this._remainingCounterIndex === 16) {
15128               this._remainingCounter = this._aes.encrypt(this._counter._counter);
15129               this._remainingCounterIndex = 0;
15130               this._counter.increment();
15131             }
15132             encrypted[i3] ^= this._remainingCounter[this._remainingCounterIndex++];
15133           }
15134           return encrypted;
15135         };
15136         ModeOfOperationCTR.prototype.decrypt = ModeOfOperationCTR.prototype.encrypt;
15137         function pkcs7pad(data) {
15138           data = coerceArray(data, true);
15139           var padder = 16 - data.length % 16;
15140           var result = createArray(data.length + padder);
15141           copyArray2(data, result);
15142           for (var i3 = data.length; i3 < result.length; i3++) {
15143             result[i3] = padder;
15144           }
15145           return result;
15146         }
15147         function pkcs7strip(data) {
15148           data = coerceArray(data, true);
15149           if (data.length < 16) {
15150             throw new Error("PKCS#7 invalid length");
15151           }
15152           var padder = data[data.length - 1];
15153           if (padder > 16) {
15154             throw new Error("PKCS#7 padding byte out of range");
15155           }
15156           var length2 = data.length - padder;
15157           for (var i3 = 0; i3 < padder; i3++) {
15158             if (data[length2 + i3] !== padder) {
15159               throw new Error("PKCS#7 invalid padding byte");
15160             }
15161           }
15162           var result = createArray(length2);
15163           copyArray2(data, result, 0, 0, length2);
15164           return result;
15165         }
15166         var aesjs2 = {
15167           AES,
15168           Counter,
15169           ModeOfOperation: {
15170             ecb: ModeOfOperationECB,
15171             cbc: ModeOfOperationCBC,
15172             cfb: ModeOfOperationCFB,
15173             ofb: ModeOfOperationOFB,
15174             ctr: ModeOfOperationCTR
15175           },
15176           utils: {
15177             hex: convertHex,
15178             utf8: convertUtf8
15179           },
15180           padding: {
15181             pkcs7: {
15182               pad: pkcs7pad,
15183               strip: pkcs7strip
15184             }
15185           },
15186           _arrayTest: {
15187             coerceArray,
15188             createArray,
15189             copyArray: copyArray2
15190           }
15191         };
15192         if (typeof exports2 !== "undefined") {
15193           module2.exports = aesjs2;
15194         } else if (typeof define === "function" && define.amd) {
15195           define([], function() {
15196             return aesjs2;
15197           });
15198         } else {
15199           if (root3.aesjs) {
15200             aesjs2._aesjs = root3.aesjs;
15201           }
15202           root3.aesjs = aesjs2;
15203         }
15204       })(exports2);
15205     }
15206   });
15207
15208   // modules/util/aes.js
15209   var aes_exports = {};
15210   __export(aes_exports, {
15211     utilAesDecrypt: () => utilAesDecrypt,
15212     utilAesEncrypt: () => utilAesEncrypt
15213   });
15214   function utilAesEncrypt(text, key) {
15215     key = key || DEFAULT_128;
15216     const textBytes = import_aes_js.default.utils.utf8.toBytes(text);
15217     const aesCtr = new import_aes_js.default.ModeOfOperation.ctr(key);
15218     const encryptedBytes = aesCtr.encrypt(textBytes);
15219     const encryptedHex = import_aes_js.default.utils.hex.fromBytes(encryptedBytes);
15220     return encryptedHex;
15221   }
15222   function utilAesDecrypt(encryptedHex, key) {
15223     key = key || DEFAULT_128;
15224     const encryptedBytes = import_aes_js.default.utils.hex.toBytes(encryptedHex);
15225     const aesCtr = new import_aes_js.default.ModeOfOperation.ctr(key);
15226     const decryptedBytes = aesCtr.decrypt(encryptedBytes);
15227     const text = import_aes_js.default.utils.utf8.fromBytes(decryptedBytes);
15228     return text;
15229   }
15230   var import_aes_js, DEFAULT_128;
15231   var init_aes = __esm({
15232     "modules/util/aes.js"() {
15233       "use strict";
15234       import_aes_js = __toESM(require_aes_js());
15235       DEFAULT_128 = [250, 157, 60, 79, 142, 134, 229, 129, 138, 126, 210, 129, 29, 71, 160, 208];
15236     }
15237   });
15238
15239   // modules/util/clean_tags.js
15240   var clean_tags_exports = {};
15241   __export(clean_tags_exports, {
15242     utilCleanTags: () => utilCleanTags
15243   });
15244   function utilCleanTags(tags) {
15245     var out = {};
15246     for (var k2 in tags) {
15247       if (!k2) continue;
15248       var v2 = tags[k2];
15249       if (v2 !== void 0) {
15250         out[k2] = cleanValue(k2, v2);
15251       }
15252     }
15253     return out;
15254     function cleanValue(k3, v3) {
15255       function keepSpaces(k4) {
15256         return /_hours|_times|:conditional$/.test(k4);
15257       }
15258       function skip(k4) {
15259         return /^(description|note|fixme|inscription)$/.test(k4);
15260       }
15261       if (skip(k3)) return v3;
15262       var cleaned = v3.split(";").map(function(s2) {
15263         return s2.trim();
15264       }).join(keepSpaces(k3) ? "; " : ";");
15265       if (k3.indexOf("website") !== -1 || k3.indexOf("email") !== -1 || cleaned.indexOf("http") === 0) {
15266         cleaned = cleaned.replace(/[\u200B-\u200F\uFEFF]/g, "");
15267       }
15268       return cleaned;
15269     }
15270   }
15271   var init_clean_tags = __esm({
15272     "modules/util/clean_tags.js"() {
15273       "use strict";
15274     }
15275   });
15276
15277   // modules/util/detect.js
15278   var detect_exports = {};
15279   __export(detect_exports, {
15280     utilDetect: () => utilDetect
15281   });
15282   function utilDetect(refresh2) {
15283     if (_detected && !refresh2) return _detected;
15284     _detected = {};
15285     const ua = navigator.userAgent;
15286     let m2 = null;
15287     m2 = ua.match(/(edge)\/?\s*(\.?\d+(\.\d+)*)/i);
15288     if (m2 !== null) {
15289       _detected.browser = m2[1];
15290       _detected.version = m2[2];
15291     }
15292     if (!_detected.browser) {
15293       m2 = ua.match(/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/i);
15294       if (m2 !== null) {
15295         _detected.browser = "msie";
15296         _detected.version = m2[1];
15297       }
15298     }
15299     if (!_detected.browser) {
15300       m2 = ua.match(/(opr)\/?\s*(\.?\d+(\.\d+)*)/i);
15301       if (m2 !== null) {
15302         _detected.browser = "Opera";
15303         _detected.version = m2[2];
15304       }
15305     }
15306     if (!_detected.browser) {
15307       m2 = ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
15308       if (m2 !== null) {
15309         _detected.browser = m2[1];
15310         _detected.version = m2[2];
15311         m2 = ua.match(/version\/([\.\d]+)/i);
15312         if (m2 !== null) _detected.version = m2[1];
15313       }
15314     }
15315     if (!_detected.browser) {
15316       _detected.browser = navigator.appName;
15317       _detected.version = navigator.appVersion;
15318     }
15319     _detected.version = _detected.version.split(/\W/).slice(0, 2).join(".");
15320     _detected.opera = _detected.browser.toLowerCase() === "opera" && Number(_detected.version) < 15;
15321     if (_detected.browser.toLowerCase() === "msie") {
15322       _detected.ie = true;
15323       _detected.browser = "Internet Explorer";
15324       _detected.support = false;
15325     } else {
15326       _detected.ie = false;
15327       _detected.support = true;
15328     }
15329     _detected.filedrop = window.FileReader && "ondrop" in window;
15330     if (/Win/.test(ua)) {
15331       _detected.os = "win";
15332       _detected.platform = "Windows";
15333     } else if (/Mac/.test(ua)) {
15334       _detected.os = "mac";
15335       _detected.platform = "Macintosh";
15336     } else if (/X11/.test(ua) || /Linux/.test(ua)) {
15337       _detected.os = "linux";
15338       _detected.platform = "Linux";
15339     } else {
15340       _detected.os = "win";
15341       _detected.platform = "Unknown";
15342     }
15343     _detected.isMobileWebKit = (/\b(iPad|iPhone|iPod)\b/.test(ua) || // HACK: iPadOS 13+ requests desktop sites by default by using a Mac user agent,
15344     // so assume any "mac" with multitouch is actually iOS
15345     navigator.platform === "MacIntel" && "maxTouchPoints" in navigator && navigator.maxTouchPoints > 1) && /WebKit/.test(ua) && !/Edge/.test(ua) && !window.MSStream;
15346     _detected.browserLocales = Array.from(new Set(
15347       // remove duplicates
15348       [navigator.language].concat(navigator.languages || []).concat([
15349         // old property for backwards compatibility
15350         navigator.userLanguage
15351       ]).filter(Boolean)
15352     ));
15353     const loc = window.top.location;
15354     let origin = loc.origin;
15355     if (!origin) {
15356       origin = loc.protocol + "//" + loc.hostname + (loc.port ? ":" + loc.port : "");
15357     }
15358     _detected.host = origin + loc.pathname;
15359     return _detected;
15360   }
15361   var _detected;
15362   var init_detect = __esm({
15363     "modules/util/detect.js"() {
15364       "use strict";
15365     }
15366   });
15367
15368   // modules/util/get_set_value.js
15369   var get_set_value_exports = {};
15370   __export(get_set_value_exports, {
15371     utilGetSetValue: () => utilGetSetValue
15372   });
15373   function utilGetSetValue(selection2, value, shouldUpdate) {
15374     function setValue(value2, shouldUpdate2) {
15375       function valueNull() {
15376         delete this.value;
15377       }
15378       function valueConstant() {
15379         if (shouldUpdate2(this.value, value2)) {
15380           this.value = value2;
15381         }
15382       }
15383       function valueFunction() {
15384         var x2 = value2.apply(this, arguments);
15385         if (x2 === null || x2 === void 0) {
15386           delete this.value;
15387         } else if (shouldUpdate2(this.value, x2)) {
15388           this.value = x2;
15389         }
15390       }
15391       return value2 === null || value2 === void 0 ? valueNull : typeof value2 === "function" ? valueFunction : valueConstant;
15392     }
15393     if (arguments.length === 1) {
15394       return selection2.property("value");
15395     }
15396     if (shouldUpdate === void 0) {
15397       shouldUpdate = (a2, b2) => a2 !== b2;
15398     }
15399     return selection2.each(setValue(value, shouldUpdate));
15400   }
15401   var init_get_set_value = __esm({
15402     "modules/util/get_set_value.js"() {
15403       "use strict";
15404     }
15405   });
15406
15407   // modules/util/keybinding.js
15408   var keybinding_exports = {};
15409   __export(keybinding_exports, {
15410     utilKeybinding: () => utilKeybinding
15411   });
15412   function utilKeybinding(namespace) {
15413     var _keybindings = {};
15414     function testBindings(d3_event, isCapturing) {
15415       var didMatch = false;
15416       var bindings = Object.keys(_keybindings).map(function(id2) {
15417         return _keybindings[id2];
15418       });
15419       var i3, binding;
15420       for (i3 = 0; i3 < bindings.length; i3++) {
15421         binding = bindings[i3];
15422         if (!binding.event.modifiers.shiftKey) continue;
15423         if (!!binding.capture !== isCapturing) continue;
15424         if (matches(d3_event, binding, true)) {
15425           binding.callback(d3_event);
15426           didMatch = true;
15427           break;
15428         }
15429       }
15430       if (didMatch) return;
15431       for (i3 = 0; i3 < bindings.length; i3++) {
15432         binding = bindings[i3];
15433         if (binding.event.modifiers.shiftKey) continue;
15434         if (!!binding.capture !== isCapturing) continue;
15435         if (matches(d3_event, binding, false)) {
15436           binding.callback(d3_event);
15437           break;
15438         }
15439       }
15440       function matches(d3_event2, binding2, testShift) {
15441         var event = d3_event2;
15442         var isMatch = false;
15443         var tryKeyCode = true;
15444         if (event.key !== void 0) {
15445           tryKeyCode = event.key.charCodeAt(0) > 127;
15446           isMatch = true;
15447           if (binding2.event.key === void 0) {
15448             isMatch = false;
15449           } else if (Array.isArray(binding2.event.key)) {
15450             if (binding2.event.key.map(function(s2) {
15451               return s2.toLowerCase();
15452             }).indexOf(event.key.toLowerCase()) === -1) {
15453               isMatch = false;
15454             }
15455           } else {
15456             if (event.key.toLowerCase() !== binding2.event.key.toLowerCase()) {
15457               isMatch = false;
15458             }
15459           }
15460         }
15461         if (!isMatch && (tryKeyCode || binding2.event.modifiers.altKey)) {
15462           isMatch = event.keyCode === binding2.event.keyCode;
15463         }
15464         if (!isMatch) return false;
15465         if (!(event.ctrlKey && event.altKey)) {
15466           if (event.ctrlKey !== binding2.event.modifiers.ctrlKey) return false;
15467           if (event.altKey !== binding2.event.modifiers.altKey) return false;
15468         }
15469         if (event.metaKey !== binding2.event.modifiers.metaKey) return false;
15470         if (testShift && event.shiftKey !== binding2.event.modifiers.shiftKey) return false;
15471         return true;
15472       }
15473     }
15474     function capture(d3_event) {
15475       testBindings(d3_event, true);
15476     }
15477     function bubble(d3_event) {
15478       var tagName = select_default2(d3_event.target).node().tagName;
15479       if (tagName === "INPUT" || tagName === "SELECT" || tagName === "TEXTAREA") {
15480         return;
15481       }
15482       testBindings(d3_event, false);
15483     }
15484     function keybinding(selection2) {
15485       selection2 = selection2 || select_default2(document);
15486       selection2.on("keydown.capture." + namespace, capture, true);
15487       selection2.on("keydown.bubble." + namespace, bubble, false);
15488       return keybinding;
15489     }
15490     keybinding.unbind = function(selection2) {
15491       _keybindings = [];
15492       selection2 = selection2 || select_default2(document);
15493       selection2.on("keydown.capture." + namespace, null);
15494       selection2.on("keydown.bubble." + namespace, null);
15495       return keybinding;
15496     };
15497     keybinding.clear = function() {
15498       _keybindings = {};
15499       return keybinding;
15500     };
15501     keybinding.off = function(codes, capture2) {
15502       var arr = utilArrayUniq([].concat(codes));
15503       for (var i3 = 0; i3 < arr.length; i3++) {
15504         var id2 = arr[i3] + (capture2 ? "-capture" : "-bubble");
15505         delete _keybindings[id2];
15506       }
15507       return keybinding;
15508     };
15509     keybinding.on = function(codes, callback, capture2) {
15510       if (typeof callback !== "function") {
15511         return keybinding.off(codes, capture2);
15512       }
15513       var arr = utilArrayUniq([].concat(codes));
15514       for (var i3 = 0; i3 < arr.length; i3++) {
15515         var id2 = arr[i3] + (capture2 ? "-capture" : "-bubble");
15516         var binding = {
15517           id: id2,
15518           capture: capture2,
15519           callback,
15520           event: {
15521             key: void 0,
15522             // preferred
15523             keyCode: 0,
15524             // fallback
15525             modifiers: {
15526               shiftKey: false,
15527               ctrlKey: false,
15528               altKey: false,
15529               metaKey: false
15530             }
15531           }
15532         };
15533         if (_keybindings[id2]) {
15534           console.warn('warning: duplicate keybinding for "' + id2 + '"');
15535         }
15536         _keybindings[id2] = binding;
15537         var matches = arr[i3].toLowerCase().match(/(?:(?:[^+⇧⌃⌥⌘])+|[⇧⌃⌥⌘]|\+\+|^\+$)/g);
15538         for (var j2 = 0; j2 < matches.length; j2++) {
15539           if (matches[j2] === "++") matches[j2] = "+";
15540           if (matches[j2] in utilKeybinding.modifierCodes) {
15541             var prop = utilKeybinding.modifierProperties[utilKeybinding.modifierCodes[matches[j2]]];
15542             binding.event.modifiers[prop] = true;
15543           } else {
15544             binding.event.key = utilKeybinding.keys[matches[j2]] || matches[j2];
15545             if (matches[j2] in utilKeybinding.keyCodes) {
15546               binding.event.keyCode = utilKeybinding.keyCodes[matches[j2]];
15547             }
15548           }
15549         }
15550       }
15551       return keybinding;
15552     };
15553     return keybinding;
15554   }
15555   var i, n;
15556   var init_keybinding = __esm({
15557     "modules/util/keybinding.js"() {
15558       "use strict";
15559       init_src5();
15560       init_array3();
15561       utilKeybinding.modifierCodes = {
15562         // Shift key, ⇧
15563         "\u21E7": 16,
15564         shift: 16,
15565         // CTRL key, on Mac: ⌃
15566         "\u2303": 17,
15567         ctrl: 17,
15568         // ALT key, on Mac: ⌥ (Alt)
15569         "\u2325": 18,
15570         alt: 18,
15571         option: 18,
15572         // META, on Mac: ⌘ (CMD), on Windows (Win), on Linux (Super)
15573         "\u2318": 91,
15574         meta: 91,
15575         cmd: 91,
15576         "super": 91,
15577         win: 91
15578       };
15579       utilKeybinding.modifierProperties = {
15580         16: "shiftKey",
15581         17: "ctrlKey",
15582         18: "altKey",
15583         91: "metaKey"
15584       };
15585       utilKeybinding.plusKeys = ["plus", "ffplus", "=", "ffequals", "\u2260", "\xB1"];
15586       utilKeybinding.minusKeys = ["_", "-", "ffminus", "dash", "\u2013", "\u2014"];
15587       utilKeybinding.keys = {
15588         // Backspace key, on Mac: ⌫ (Backspace)
15589         "\u232B": "Backspace",
15590         backspace: "Backspace",
15591         // Tab Key, on Mac: ⇥ (Tab), on Windows ⇥⇥
15592         "\u21E5": "Tab",
15593         "\u21C6": "Tab",
15594         tab: "Tab",
15595         // Return key, ↩
15596         "\u21A9": "Enter",
15597         "\u21B5": "Enter",
15598         "\u23CE": "Enter",
15599         "return": "Enter",
15600         enter: "Enter",
15601         "\u2305": "Enter",
15602         // Pause/Break key
15603         "pause": "Pause",
15604         "pause-break": "Pause",
15605         // Caps Lock key, ⇪
15606         "\u21EA": "CapsLock",
15607         caps: "CapsLock",
15608         "caps-lock": "CapsLock",
15609         // Escape key, on Mac: ⎋, on Windows: Esc
15610         "\u238B": ["Escape", "Esc"],
15611         escape: ["Escape", "Esc"],
15612         esc: ["Escape", "Esc"],
15613         // Space key
15614         space: [" ", "Spacebar"],
15615         // Page-Up key, or pgup, on Mac: ↖
15616         "\u2196": "PageUp",
15617         pgup: "PageUp",
15618         "page-up": "PageUp",
15619         // Page-Down key, or pgdown, on Mac: ↘
15620         "\u2198": "PageDown",
15621         pgdown: "PageDown",
15622         "page-down": "PageDown",
15623         // END key, on Mac: ⇟
15624         "\u21DF": "End",
15625         end: "End",
15626         // HOME key, on Mac: ⇞
15627         "\u21DE": "Home",
15628         home: "Home",
15629         // Insert key, or ins
15630         ins: "Insert",
15631         insert: "Insert",
15632         // Delete key, on Mac: ⌦ (Delete)
15633         "\u2326": ["Delete", "Del"],
15634         del: ["Delete", "Del"],
15635         "delete": ["Delete", "Del"],
15636         // Left Arrow Key, or ←
15637         "\u2190": ["ArrowLeft", "Left"],
15638         left: ["ArrowLeft", "Left"],
15639         "arrow-left": ["ArrowLeft", "Left"],
15640         // Up Arrow Key, or ↑
15641         "\u2191": ["ArrowUp", "Up"],
15642         up: ["ArrowUp", "Up"],
15643         "arrow-up": ["ArrowUp", "Up"],
15644         // Right Arrow Key, or →
15645         "\u2192": ["ArrowRight", "Right"],
15646         right: ["ArrowRight", "Right"],
15647         "arrow-right": ["ArrowRight", "Right"],
15648         // Up Arrow Key, or ↓
15649         "\u2193": ["ArrowDown", "Down"],
15650         down: ["ArrowDown", "Down"],
15651         "arrow-down": ["ArrowDown", "Down"],
15652         // odities, stuff for backward compatibility (browsers and code):
15653         // Num-Multiply, or *
15654         "*": ["*", "Multiply"],
15655         star: ["*", "Multiply"],
15656         asterisk: ["*", "Multiply"],
15657         multiply: ["*", "Multiply"],
15658         // Num-Plus or +
15659         "+": ["+", "Add"],
15660         "plus": ["+", "Add"],
15661         // Num-Subtract, or -
15662         "-": ["-", "Subtract"],
15663         subtract: ["-", "Subtract"],
15664         "dash": ["-", "Subtract"],
15665         // Semicolon
15666         semicolon: ";",
15667         // = or equals
15668         equals: "=",
15669         // Comma, or ,
15670         comma: ",",
15671         // Period, or ., or full-stop
15672         period: ".",
15673         "full-stop": ".",
15674         // Slash, or /, or forward-slash
15675         slash: "/",
15676         "forward-slash": "/",
15677         // Tick, or `, or back-quote
15678         tick: "`",
15679         "back-quote": "`",
15680         // Open bracket, or [
15681         "open-bracket": "[",
15682         // Back slash, or \
15683         "back-slash": "\\",
15684         // Close bracket, or ]
15685         "close-bracket": "]",
15686         // Apostrophe, or Quote, or '
15687         quote: "'",
15688         apostrophe: "'",
15689         // NUMPAD 0-9
15690         "num-0": "0",
15691         "num-1": "1",
15692         "num-2": "2",
15693         "num-3": "3",
15694         "num-4": "4",
15695         "num-5": "5",
15696         "num-6": "6",
15697         "num-7": "7",
15698         "num-8": "8",
15699         "num-9": "9",
15700         // F1-F25
15701         f1: "F1",
15702         f2: "F2",
15703         f3: "F3",
15704         f4: "F4",
15705         f5: "F5",
15706         f6: "F6",
15707         f7: "F7",
15708         f8: "F8",
15709         f9: "F9",
15710         f10: "F10",
15711         f11: "F11",
15712         f12: "F12",
15713         f13: "F13",
15714         f14: "F14",
15715         f15: "F15",
15716         f16: "F16",
15717         f17: "F17",
15718         f18: "F18",
15719         f19: "F19",
15720         f20: "F20",
15721         f21: "F21",
15722         f22: "F22",
15723         f23: "F23",
15724         f24: "F24",
15725         f25: "F25"
15726       };
15727       utilKeybinding.keyCodes = {
15728         // Backspace key, on Mac: ⌫ (Backspace)
15729         "\u232B": 8,
15730         backspace: 8,
15731         // Tab Key, on Mac: ⇥ (Tab), on Windows ⇥⇥
15732         "\u21E5": 9,
15733         "\u21C6": 9,
15734         tab: 9,
15735         // Return key, ↩
15736         "\u21A9": 13,
15737         "\u21B5": 13,
15738         "\u23CE": 13,
15739         "return": 13,
15740         enter: 13,
15741         "\u2305": 13,
15742         // Pause/Break key
15743         "pause": 19,
15744         "pause-break": 19,
15745         // Caps Lock key, ⇪
15746         "\u21EA": 20,
15747         caps: 20,
15748         "caps-lock": 20,
15749         // Escape key, on Mac: ⎋, on Windows: Esc
15750         "\u238B": 27,
15751         escape: 27,
15752         esc: 27,
15753         // Space key
15754         space: 32,
15755         // Page-Up key, or pgup, on Mac: ↖
15756         "\u2196": 33,
15757         pgup: 33,
15758         "page-up": 33,
15759         // Page-Down key, or pgdown, on Mac: ↘
15760         "\u2198": 34,
15761         pgdown: 34,
15762         "page-down": 34,
15763         // END key, on Mac: ⇟
15764         "\u21DF": 35,
15765         end: 35,
15766         // HOME key, on Mac: ⇞
15767         "\u21DE": 36,
15768         home: 36,
15769         // Insert key, or ins
15770         ins: 45,
15771         insert: 45,
15772         // Delete key, on Mac: ⌦ (Delete)
15773         "\u2326": 46,
15774         del: 46,
15775         "delete": 46,
15776         // Left Arrow Key, or ←
15777         "\u2190": 37,
15778         left: 37,
15779         "arrow-left": 37,
15780         // Up Arrow Key, or ↑
15781         "\u2191": 38,
15782         up: 38,
15783         "arrow-up": 38,
15784         // Right Arrow Key, or →
15785         "\u2192": 39,
15786         right: 39,
15787         "arrow-right": 39,
15788         // Up Arrow Key, or ↓
15789         "\u2193": 40,
15790         down: 40,
15791         "arrow-down": 40,
15792         // odities, printing characters that come out wrong:
15793         // Firefox Equals
15794         "ffequals": 61,
15795         // Num-Multiply, or *
15796         "*": 106,
15797         star: 106,
15798         asterisk: 106,
15799         multiply: 106,
15800         // Num-Plus or +
15801         "+": 107,
15802         "plus": 107,
15803         // Num-Subtract, or -
15804         "-": 109,
15805         subtract: 109,
15806         // Vertical Bar / Pipe
15807         "|": 124,
15808         // Firefox Plus
15809         "ffplus": 171,
15810         // Firefox Minus
15811         "ffminus": 173,
15812         // Semicolon
15813         ";": 186,
15814         semicolon: 186,
15815         // = or equals
15816         "=": 187,
15817         "equals": 187,
15818         // Comma, or ,
15819         ",": 188,
15820         comma: 188,
15821         // Dash / Underscore key
15822         "dash": 189,
15823         // Period, or ., or full-stop
15824         ".": 190,
15825         period: 190,
15826         "full-stop": 190,
15827         // Slash, or /, or forward-slash
15828         "/": 191,
15829         slash: 191,
15830         "forward-slash": 191,
15831         // Tick, or `, or back-quote
15832         "`": 192,
15833         tick: 192,
15834         "back-quote": 192,
15835         // Open bracket, or [
15836         "[": 219,
15837         "open-bracket": 219,
15838         // Back slash, or \
15839         "\\": 220,
15840         "back-slash": 220,
15841         // Close bracket, or ]
15842         "]": 221,
15843         "close-bracket": 221,
15844         // Apostrophe, or Quote, or '
15845         "'": 222,
15846         quote: 222,
15847         apostrophe: 222
15848       };
15849       i = 95;
15850       n = 0;
15851       while (++i < 106) {
15852         utilKeybinding.keyCodes["num-" + n] = i;
15853         ++n;
15854       }
15855       i = 47;
15856       n = 0;
15857       while (++i < 58) {
15858         utilKeybinding.keyCodes[n] = i;
15859         ++n;
15860       }
15861       i = 111;
15862       n = 1;
15863       while (++i < 136) {
15864         utilKeybinding.keyCodes["f" + n] = i;
15865         ++n;
15866       }
15867       i = 64;
15868       while (++i < 91) {
15869         utilKeybinding.keyCodes[String.fromCharCode(i).toLowerCase()] = i;
15870       }
15871     }
15872   });
15873
15874   // modules/util/object.js
15875   var object_exports = {};
15876   __export(object_exports, {
15877     utilCheckTagDictionary: () => utilCheckTagDictionary,
15878     utilObjectOmit: () => utilObjectOmit
15879   });
15880   function utilObjectOmit(obj, omitKeys) {
15881     return Object.keys(obj).reduce(function(result, key) {
15882       if (omitKeys.indexOf(key) === -1) {
15883         result[key] = obj[key];
15884       }
15885       return result;
15886     }, {});
15887   }
15888   function utilCheckTagDictionary(tags, tagDictionary) {
15889     for (const key in tags) {
15890       const value = tags[key];
15891       if (tagDictionary[key] && value in tagDictionary[key]) {
15892         return tagDictionary[key][value];
15893       }
15894     }
15895     return void 0;
15896   }
15897   var init_object2 = __esm({
15898     "modules/util/object.js"() {
15899       "use strict";
15900     }
15901   });
15902
15903   // modules/util/rebind.js
15904   var rebind_exports = {};
15905   __export(rebind_exports, {
15906     utilRebind: () => utilRebind
15907   });
15908   function utilRebind(target, source, ...args) {
15909     for (const method of args) {
15910       target[method] = d3_rebind(target, source, source[method]);
15911     }
15912     return target;
15913   }
15914   function d3_rebind(target, source, method) {
15915     return function() {
15916       var value = method.apply(source, arguments);
15917       return value === source ? target : value;
15918     };
15919   }
15920   var init_rebind = __esm({
15921     "modules/util/rebind.js"() {
15922       "use strict";
15923     }
15924   });
15925
15926   // modules/util/session_mutex.js
15927   var session_mutex_exports = {};
15928   __export(session_mutex_exports, {
15929     utilSessionMutex: () => utilSessionMutex
15930   });
15931   function utilSessionMutex(name) {
15932     var mutex = {};
15933     var intervalID;
15934     function renew() {
15935       if (typeof window === "undefined") return;
15936       var expires = /* @__PURE__ */ new Date();
15937       expires.setSeconds(expires.getSeconds() + 5);
15938       document.cookie = name + "=1; expires=" + expires.toUTCString() + "; sameSite=strict";
15939     }
15940     mutex.lock = function() {
15941       if (intervalID) return true;
15942       var cookie = document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + name + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1");
15943       if (cookie) return false;
15944       renew();
15945       intervalID = window.setInterval(renew, 4e3);
15946       return true;
15947     };
15948     mutex.unlock = function() {
15949       if (!intervalID) return;
15950       document.cookie = name + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT; sameSite=strict";
15951       clearInterval(intervalID);
15952       intervalID = null;
15953     };
15954     mutex.locked = function() {
15955       return !!intervalID;
15956     };
15957     return mutex;
15958   }
15959   var init_session_mutex = __esm({
15960     "modules/util/session_mutex.js"() {
15961       "use strict";
15962     }
15963   });
15964
15965   // modules/util/tiler.js
15966   var tiler_exports = {};
15967   __export(tiler_exports, {
15968     utilTiler: () => utilTiler
15969   });
15970   function utilTiler() {
15971     var _size = [256, 256];
15972     var _scale = 256;
15973     var _tileSize = 256;
15974     var _zoomExtent = [0, 20];
15975     var _translate = [_size[0] / 2, _size[1] / 2];
15976     var _margin = 0;
15977     var _skipNullIsland = false;
15978     function clamp3(num, min3, max3) {
15979       return Math.max(min3, Math.min(num, max3));
15980     }
15981     function nearNullIsland(tile) {
15982       var x2 = tile[0];
15983       var y2 = tile[1];
15984       var z2 = tile[2];
15985       if (z2 >= 7) {
15986         var center = Math.pow(2, z2 - 1);
15987         var width = Math.pow(2, z2 - 6);
15988         var min3 = center - width / 2;
15989         var max3 = center + width / 2 - 1;
15990         return x2 >= min3 && x2 <= max3 && y2 >= min3 && y2 <= max3;
15991       }
15992       return false;
15993     }
15994     function tiler8() {
15995       var z2 = geoScaleToZoom(_scale / (2 * Math.PI), _tileSize);
15996       var z0 = clamp3(Math.round(z2), _zoomExtent[0], _zoomExtent[1]);
15997       var tileMin = 0;
15998       var tileMax = Math.pow(2, z0) - 1;
15999       var log2ts = Math.log(_tileSize) * Math.LOG2E;
16000       var k2 = Math.pow(2, z2 - z0 + log2ts);
16001       var origin = [
16002         (_translate[0] - _scale / 2) / k2,
16003         (_translate[1] - _scale / 2) / k2
16004       ];
16005       var cols = range(
16006         clamp3(Math.floor(-origin[0]) - _margin, tileMin, tileMax + 1),
16007         clamp3(Math.ceil(_size[0] / k2 - origin[0]) + _margin, tileMin, tileMax + 1)
16008       );
16009       var rows = range(
16010         clamp3(Math.floor(-origin[1]) - _margin, tileMin, tileMax + 1),
16011         clamp3(Math.ceil(_size[1] / k2 - origin[1]) + _margin, tileMin, tileMax + 1)
16012       );
16013       var tiles = [];
16014       for (var i3 = 0; i3 < rows.length; i3++) {
16015         var y2 = rows[i3];
16016         for (var j2 = 0; j2 < cols.length; j2++) {
16017           var x2 = cols[j2];
16018           if (i3 >= _margin && i3 <= rows.length - _margin && j2 >= _margin && j2 <= cols.length - _margin) {
16019             tiles.unshift([x2, y2, z0]);
16020           } else {
16021             tiles.push([x2, y2, z0]);
16022           }
16023         }
16024       }
16025       tiles.translate = origin;
16026       tiles.scale = k2;
16027       return tiles;
16028     }
16029     tiler8.getTiles = function(projection2) {
16030       var origin = [
16031         projection2.scale() * Math.PI - projection2.translate()[0],
16032         projection2.scale() * Math.PI - projection2.translate()[1]
16033       ];
16034       this.size(projection2.clipExtent()[1]).scale(projection2.scale() * 2 * Math.PI).translate(projection2.translate());
16035       var tiles = tiler8();
16036       var ts = tiles.scale;
16037       return tiles.map(function(tile) {
16038         if (_skipNullIsland && nearNullIsland(tile)) {
16039           return false;
16040         }
16041         var x2 = tile[0] * ts - origin[0];
16042         var y2 = tile[1] * ts - origin[1];
16043         return {
16044           id: tile.toString(),
16045           xyz: tile,
16046           extent: geoExtent(
16047             projection2.invert([x2, y2 + ts]),
16048             projection2.invert([x2 + ts, y2])
16049           )
16050         };
16051       }).filter(Boolean);
16052     };
16053     tiler8.getGeoJSON = function(projection2) {
16054       var features = tiler8.getTiles(projection2).map(function(tile) {
16055         return {
16056           type: "Feature",
16057           properties: {
16058             id: tile.id,
16059             name: tile.id
16060           },
16061           geometry: {
16062             type: "Polygon",
16063             coordinates: [tile.extent.polygon()]
16064           }
16065         };
16066       });
16067       return {
16068         type: "FeatureCollection",
16069         features
16070       };
16071     };
16072     tiler8.tileSize = function(val) {
16073       if (!arguments.length) return _tileSize;
16074       _tileSize = val;
16075       return tiler8;
16076     };
16077     tiler8.zoomExtent = function(val) {
16078       if (!arguments.length) return _zoomExtent;
16079       _zoomExtent = val;
16080       return tiler8;
16081     };
16082     tiler8.size = function(val) {
16083       if (!arguments.length) return _size;
16084       _size = val;
16085       return tiler8;
16086     };
16087     tiler8.scale = function(val) {
16088       if (!arguments.length) return _scale;
16089       _scale = val;
16090       return tiler8;
16091     };
16092     tiler8.translate = function(val) {
16093       if (!arguments.length) return _translate;
16094       _translate = val;
16095       return tiler8;
16096     };
16097     tiler8.margin = function(val) {
16098       if (!arguments.length) return _margin;
16099       _margin = +val;
16100       return tiler8;
16101     };
16102     tiler8.skipNullIsland = function(val) {
16103       if (!arguments.length) return _skipNullIsland;
16104       _skipNullIsland = val;
16105       return tiler8;
16106     };
16107     return tiler8;
16108   }
16109   var init_tiler = __esm({
16110     "modules/util/tiler.js"() {
16111       "use strict";
16112       init_src();
16113       init_geo2();
16114     }
16115   });
16116
16117   // modules/util/trigger_event.js
16118   var trigger_event_exports = {};
16119   __export(trigger_event_exports, {
16120     utilTriggerEvent: () => utilTriggerEvent
16121   });
16122   function utilTriggerEvent(target, type2, eventProperties) {
16123     target.each(function() {
16124       var evt = document.createEvent("HTMLEvents");
16125       evt.initEvent(type2, true, true);
16126       for (var prop in eventProperties) {
16127         evt[prop] = eventProperties[prop];
16128       }
16129       this.dispatchEvent(evt);
16130     });
16131   }
16132   var init_trigger_event = __esm({
16133     "modules/util/trigger_event.js"() {
16134       "use strict";
16135     }
16136   });
16137
16138   // modules/util/units.js
16139   var units_exports = {};
16140   __export(units_exports, {
16141     decimalCoordinatePair: () => decimalCoordinatePair,
16142     displayArea: () => displayArea,
16143     displayLength: () => displayLength,
16144     dmsCoordinatePair: () => dmsCoordinatePair,
16145     dmsMatcher: () => dmsMatcher
16146   });
16147   function displayLength(m2, isImperial) {
16148     var d2 = m2 * (isImperial ? 3.28084 : 1);
16149     var unit2;
16150     if (isImperial) {
16151       if (d2 >= 5280) {
16152         d2 /= 5280;
16153         unit2 = "miles";
16154       } else {
16155         unit2 = "feet";
16156       }
16157     } else {
16158       if (d2 >= 1e3) {
16159         d2 /= 1e3;
16160         unit2 = "kilometers";
16161       } else {
16162         unit2 = "meters";
16163       }
16164     }
16165     return _t("units." + unit2, {
16166       quantity: d2.toLocaleString(_mainLocalizer.localeCode(), {
16167         maximumSignificantDigits: 4
16168       })
16169     });
16170   }
16171   function displayArea(m2, isImperial) {
16172     var locale3 = _mainLocalizer.localeCode();
16173     var d2 = m2 * (isImperial ? 10.7639111056 : 1);
16174     var d1, d22, area;
16175     var unit1 = "";
16176     var unit2 = "";
16177     if (isImperial) {
16178       if (d2 >= 6969600) {
16179         d1 = d2 / 27878400;
16180         unit1 = "square_miles";
16181       } else {
16182         d1 = d2;
16183         unit1 = "square_feet";
16184       }
16185       if (d2 > 4356 && d2 < 4356e4) {
16186         d22 = d2 / 43560;
16187         unit2 = "acres";
16188       }
16189     } else {
16190       if (d2 >= 25e4) {
16191         d1 = d2 / 1e6;
16192         unit1 = "square_kilometers";
16193       } else {
16194         d1 = d2;
16195         unit1 = "square_meters";
16196       }
16197       if (d2 > 1e3 && d2 < 1e7) {
16198         d22 = d2 / 1e4;
16199         unit2 = "hectares";
16200       }
16201     }
16202     area = _t("units." + unit1, {
16203       quantity: d1.toLocaleString(locale3, {
16204         maximumSignificantDigits: 4
16205       })
16206     });
16207     if (d22) {
16208       return _t("units.area_pair", {
16209         area1: area,
16210         area2: _t("units." + unit2, {
16211           quantity: d22.toLocaleString(locale3, {
16212             maximumSignificantDigits: 2
16213           })
16214         })
16215       });
16216     } else {
16217       return area;
16218     }
16219   }
16220   function wrap(x2, min3, max3) {
16221     var d2 = max3 - min3;
16222     return ((x2 - min3) % d2 + d2) % d2 + min3;
16223   }
16224   function clamp(x2, min3, max3) {
16225     return Math.max(min3, Math.min(x2, max3));
16226   }
16227   function roundToDecimal(target, decimalPlace) {
16228     target = Number(target);
16229     decimalPlace = Number(decimalPlace);
16230     const factor = Math.pow(10, decimalPlace);
16231     return Math.round(target * factor) / factor;
16232   }
16233   function displayCoordinate(deg, pos, neg) {
16234     var displayCoordinate2;
16235     var locale3 = _mainLocalizer.localeCode();
16236     var degreesFloor = Math.floor(Math.abs(deg));
16237     var min3 = (Math.abs(deg) - degreesFloor) * 60;
16238     var minFloor = Math.floor(min3);
16239     var sec = (min3 - minFloor) * 60;
16240     var fix = roundToDecimal(sec, 8);
16241     var secRounded = roundToDecimal(fix, 0);
16242     if (secRounded === 60) {
16243       secRounded = 0;
16244       minFloor += 1;
16245       if (minFloor === 60) {
16246         minFloor = 0;
16247         degreesFloor += 1;
16248       }
16249     }
16250     displayCoordinate2 = _t("units.arcdegrees", {
16251       quantity: degreesFloor.toLocaleString(locale3)
16252     }) + (minFloor !== 0 || secRounded !== 0 ? _t("units.arcminutes", {
16253       quantity: minFloor.toLocaleString(locale3)
16254     }) : "") + (secRounded !== 0 ? _t("units.arcseconds", {
16255       quantity: secRounded.toLocaleString(locale3)
16256     }) : "");
16257     if (deg === 0) {
16258       return displayCoordinate2;
16259     } else {
16260       return _t("units.coordinate", {
16261         coordinate: displayCoordinate2,
16262         direction: _t("units." + (deg > 0 ? pos : neg))
16263       });
16264     }
16265   }
16266   function dmsCoordinatePair(coord2) {
16267     return _t("units.coordinate_pair", {
16268       latitude: displayCoordinate(clamp(coord2[1], -90, 90), "north", "south"),
16269       longitude: displayCoordinate(wrap(coord2[0], -180, 180), "east", "west")
16270     });
16271   }
16272   function decimalCoordinatePair(coord2) {
16273     return _t("units.coordinate_pair", {
16274       latitude: clamp(coord2[1], -90, 90).toFixed(OSM_PRECISION),
16275       longitude: wrap(coord2[0], -180, 180).toFixed(OSM_PRECISION)
16276     });
16277   }
16278   function dmsMatcher(q2, _localeCode = void 0) {
16279     const matchers = [
16280       // D M SS , D M SS  ex: 35 11 10.1 , 136 49 53.8
16281       {
16282         condition: /^\s*(-?)\s*(\d+)\s+(\d+)\s+(\d+\.?\d*)\s*\,\s*(-?)\s*(\d+)\s+(\d+)\s+(\d+\.?\d*)\s*$/,
16283         parser: function(q3) {
16284           const match = this.condition.exec(q3);
16285           const lat = +match[2] + +match[3] / 60 + +match[4] / 3600;
16286           const lng = +match[6] + +match[7] / 60 + +match[8] / 3600;
16287           const isNegLat = match[1] === "-" ? -lat : lat;
16288           const isNegLng = match[5] === "-" ? -lng : lng;
16289           return [isNegLat, isNegLng];
16290         }
16291       },
16292       // D MM , D MM ex: 35 11.1683 , 136 49.8966
16293       {
16294         condition: /^\s*(-?)\s*(\d+)\s+(\d+\.?\d*)\s*\,\s*(-?)\s*(\d+)\s+(\d+\.?\d*)\s*$/,
16295         parser: function(q3) {
16296           const match = this.condition.exec(q3);
16297           const lat = +match[2] + +match[3] / 60;
16298           const lng = +match[5] + +match[6] / 60;
16299           const isNegLat = match[1] === "-" ? -lat : lat;
16300           const isNegLng = match[4] === "-" ? -lng : lng;
16301           return [isNegLat, isNegLng];
16302         }
16303       },
16304       // D/D ex: 46.112785/72.921033
16305       {
16306         condition: /^\s*(-?\d+\.?\d*)\s*\/\s*(-?\d+\.?\d*)\s*$/,
16307         parser: function(q3) {
16308           const match = this.condition.exec(q3);
16309           return [+match[1], +match[2]];
16310         }
16311       },
16312       // zoom/x/y ex: 2/1.23/34.44
16313       {
16314         condition: /^\s*(\d+\.?\d*)\s*\/\s*(-?\d+\.?\d*)\s*\/\s*(-?\d+\.?\d*)\s*$/,
16315         parser: function(q3) {
16316           const match = this.condition.exec(q3);
16317           const lat = +match[2];
16318           const lng = +match[3];
16319           const zoom = +match[1];
16320           return [lat, lng, zoom];
16321         }
16322       },
16323       // x/y , x, y , x y  where x and y are localized floats, e.g. in German locale: 49,4109399, 8,7147086
16324       {
16325         condition: { test: (q3) => !!localizedNumberCoordsParser(q3) },
16326         parser: localizedNumberCoordsParser
16327       }
16328     ];
16329     function localizedNumberCoordsParser(q3) {
16330       const parseLocaleFloat = _mainLocalizer.floatParser(_localeCode || _mainLocalizer.localeCode());
16331       let parts = q3.split(/,?\s+|\s*[\/\\]\s*/);
16332       if (parts.length !== 2) return false;
16333       const lat = parseLocaleFloat(parts[0]);
16334       const lng = parseLocaleFloat(parts[1]);
16335       if (isNaN(lat) || isNaN(lng)) return false;
16336       return [lat, lng];
16337     }
16338     for (const matcher of matchers) {
16339       if (matcher.condition.test(q2)) {
16340         return matcher.parser(q2);
16341       }
16342     }
16343     return null;
16344   }
16345   var OSM_PRECISION;
16346   var init_units = __esm({
16347     "modules/util/units.js"() {
16348       "use strict";
16349       init_localizer();
16350       OSM_PRECISION = 7;
16351     }
16352   });
16353
16354   // modules/util/index.js
16355   var util_exports = {};
16356   __export(util_exports, {
16357     dmsCoordinatePair: () => dmsCoordinatePair,
16358     dmsMatcher: () => dmsMatcher,
16359     utilAesDecrypt: () => utilAesDecrypt,
16360     utilAesEncrypt: () => utilAesEncrypt,
16361     utilArrayChunk: () => utilArrayChunk,
16362     utilArrayDifference: () => utilArrayDifference,
16363     utilArrayFlatten: () => utilArrayFlatten,
16364     utilArrayGroupBy: () => utilArrayGroupBy,
16365     utilArrayIdentical: () => utilArrayIdentical,
16366     utilArrayIntersection: () => utilArrayIntersection,
16367     utilArrayUnion: () => utilArrayUnion,
16368     utilArrayUniq: () => utilArrayUniq,
16369     utilArrayUniqBy: () => utilArrayUniqBy,
16370     utilAsyncMap: () => utilAsyncMap,
16371     utilCheckTagDictionary: () => utilCheckTagDictionary,
16372     utilCleanOsmString: () => utilCleanOsmString,
16373     utilCleanTags: () => utilCleanTags,
16374     utilCombinedTags: () => utilCombinedTags,
16375     utilCompareIDs: () => utilCompareIDs,
16376     utilDeepMemberSelector: () => utilDeepMemberSelector,
16377     utilDetect: () => utilDetect,
16378     utilDisplayName: () => utilDisplayName,
16379     utilDisplayNameForPath: () => utilDisplayNameForPath,
16380     utilDisplayType: () => utilDisplayType,
16381     utilEditDistance: () => utilEditDistance,
16382     utilEntityAndDeepMemberIDs: () => utilEntityAndDeepMemberIDs,
16383     utilEntityOrDeepMemberSelector: () => utilEntityOrDeepMemberSelector,
16384     utilEntityOrMemberSelector: () => utilEntityOrMemberSelector,
16385     utilEntityRoot: () => utilEntityRoot,
16386     utilEntitySelector: () => utilEntitySelector,
16387     utilFastMouse: () => utilFastMouse,
16388     utilFunctor: () => utilFunctor,
16389     utilGetAllNodes: () => utilGetAllNodes,
16390     utilGetSetValue: () => utilGetSetValue,
16391     utilHashcode: () => utilHashcode,
16392     utilHighlightEntities: () => utilHighlightEntities,
16393     utilKeybinding: () => utilKeybinding,
16394     utilNoAuto: () => utilNoAuto,
16395     utilObjectOmit: () => utilObjectOmit,
16396     utilOldestID: () => utilOldestID,
16397     utilPrefixCSSProperty: () => utilPrefixCSSProperty,
16398     utilPrefixDOMProperty: () => utilPrefixDOMProperty,
16399     utilQsString: () => utilQsString,
16400     utilRebind: () => utilRebind,
16401     utilSafeClassName: () => utilSafeClassName,
16402     utilSessionMutex: () => utilSessionMutex,
16403     utilSetTransform: () => utilSetTransform,
16404     utilStringQs: () => utilStringQs,
16405     utilTagDiff: () => utilTagDiff,
16406     utilTagText: () => utilTagText,
16407     utilTiler: () => utilTiler,
16408     utilTotalExtent: () => utilTotalExtent,
16409     utilTriggerEvent: () => utilTriggerEvent,
16410     utilUnicodeCharsCount: () => utilUnicodeCharsCount,
16411     utilUnicodeCharsTruncated: () => utilUnicodeCharsTruncated,
16412     utilUniqueDomId: () => utilUniqueDomId,
16413     utilWrap: () => utilWrap
16414   });
16415   var init_util = __esm({
16416     "modules/util/index.js"() {
16417       "use strict";
16418       init_aes();
16419       init_aes();
16420       init_array3();
16421       init_array3();
16422       init_array3();
16423       init_array3();
16424       init_array3();
16425       init_array3();
16426       init_array3();
16427       init_array3();
16428       init_array3();
16429       init_util2();
16430       init_clean_tags();
16431       init_util2();
16432       init_util2();
16433       init_detect();
16434       init_util2();
16435       init_util2();
16436       init_util2();
16437       init_util2();
16438       init_util2();
16439       init_util2();
16440       init_util2();
16441       init_util2();
16442       init_util2();
16443       init_util2();
16444       init_util2();
16445       init_util2();
16446       init_get_set_value();
16447       init_util2();
16448       init_util2();
16449       init_keybinding();
16450       init_util2();
16451       init_object2();
16452       init_util2();
16453       init_util2();
16454       init_util2();
16455       init_util2();
16456       init_util2();
16457       init_rebind();
16458       init_util2();
16459       init_util2();
16460       init_session_mutex();
16461       init_util2();
16462       init_util2();
16463       init_util2();
16464       init_tiler();
16465       init_util2();
16466       init_trigger_event();
16467       init_util2();
16468       init_util2();
16469       init_util2();
16470       init_util2();
16471       init_util2();
16472       init_units();
16473       init_units();
16474     }
16475   });
16476
16477   // modules/actions/add_midpoint.js
16478   var add_midpoint_exports = {};
16479   __export(add_midpoint_exports, {
16480     actionAddMidpoint: () => actionAddMidpoint
16481   });
16482   function actionAddMidpoint(midpoint, node) {
16483     return function(graph) {
16484       graph = graph.replace(node.move(midpoint.loc));
16485       var parents = utilArrayIntersection(
16486         graph.parentWays(graph.entity(midpoint.edge[0])),
16487         graph.parentWays(graph.entity(midpoint.edge[1]))
16488       );
16489       parents.forEach(function(way) {
16490         for (var i3 = 0; i3 < way.nodes.length - 1; i3++) {
16491           if (geoEdgeEqual([way.nodes[i3], way.nodes[i3 + 1]], midpoint.edge)) {
16492             graph = graph.replace(graph.entity(way.id).addNode(node.id, i3 + 1));
16493             return;
16494           }
16495         }
16496       });
16497       return graph;
16498     };
16499   }
16500   var init_add_midpoint = __esm({
16501     "modules/actions/add_midpoint.js"() {
16502       "use strict";
16503       init_geo2();
16504       init_util();
16505     }
16506   });
16507
16508   // modules/actions/add_vertex.js
16509   var add_vertex_exports = {};
16510   __export(add_vertex_exports, {
16511     actionAddVertex: () => actionAddVertex
16512   });
16513   function actionAddVertex(wayId, nodeId, index) {
16514     return function(graph) {
16515       return graph.replace(graph.entity(wayId).addNode(nodeId, index));
16516     };
16517   }
16518   var init_add_vertex = __esm({
16519     "modules/actions/add_vertex.js"() {
16520       "use strict";
16521     }
16522   });
16523
16524   // modules/actions/change_member.js
16525   var change_member_exports = {};
16526   __export(change_member_exports, {
16527     actionChangeMember: () => actionChangeMember
16528   });
16529   function actionChangeMember(relationId, member, memberIndex) {
16530     return function(graph) {
16531       return graph.replace(graph.entity(relationId).updateMember(member, memberIndex));
16532     };
16533   }
16534   var init_change_member = __esm({
16535     "modules/actions/change_member.js"() {
16536       "use strict";
16537     }
16538   });
16539
16540   // modules/actions/change_preset.js
16541   var change_preset_exports = {};
16542   __export(change_preset_exports, {
16543     actionChangePreset: () => actionChangePreset
16544   });
16545   function actionChangePreset(entityID, oldPreset, newPreset, skipFieldDefaults) {
16546     return function action(graph) {
16547       var entity = graph.entity(entityID);
16548       var geometry = entity.geometry(graph);
16549       var tags = entity.tags;
16550       const loc = entity.extent(graph).center();
16551       var preserveKeys;
16552       if (newPreset) {
16553         preserveKeys = [];
16554         if (newPreset.addTags) {
16555           preserveKeys = preserveKeys.concat(Object.keys(newPreset.addTags));
16556         }
16557         if (oldPreset && !oldPreset.id.startsWith(newPreset.id)) {
16558           newPreset.fields(loc).concat(newPreset.moreFields(loc)).filter((f2) => f2.matchGeometry(geometry)).map((f2) => f2.key).filter(Boolean).forEach((key) => preserveKeys.push(key));
16559         }
16560       }
16561       if (oldPreset) tags = oldPreset.unsetTags(tags, geometry, preserveKeys, false, loc);
16562       if (newPreset) tags = newPreset.setTags(tags, geometry, skipFieldDefaults, loc);
16563       return graph.replace(entity.update({ tags }));
16564     };
16565   }
16566   var init_change_preset = __esm({
16567     "modules/actions/change_preset.js"() {
16568       "use strict";
16569     }
16570   });
16571
16572   // modules/actions/change_tags.js
16573   var change_tags_exports = {};
16574   __export(change_tags_exports, {
16575     actionChangeTags: () => actionChangeTags
16576   });
16577   function actionChangeTags(entityId, tags) {
16578     return function(graph) {
16579       var entity = graph.entity(entityId);
16580       return graph.replace(entity.update({ tags }));
16581     };
16582   }
16583   var init_change_tags = __esm({
16584     "modules/actions/change_tags.js"() {
16585       "use strict";
16586     }
16587   });
16588
16589   // modules/osm/node.js
16590   var node_exports = {};
16591   __export(node_exports, {
16592     cardinal: () => cardinal,
16593     osmNode: () => osmNode
16594   });
16595   function osmNode() {
16596     if (!(this instanceof osmNode)) {
16597       return new osmNode().initialize(arguments);
16598     } else if (arguments.length) {
16599       this.initialize(arguments);
16600     }
16601   }
16602   var cardinal, prototype;
16603   var init_node2 = __esm({
16604     "modules/osm/node.js"() {
16605       "use strict";
16606       init_entity();
16607       init_geo2();
16608       init_util();
16609       init_tags();
16610       cardinal = {
16611         north: 0,
16612         n: 0,
16613         northnortheast: 22,
16614         nne: 22,
16615         northeast: 45,
16616         ne: 45,
16617         eastnortheast: 67,
16618         ene: 67,
16619         east: 90,
16620         e: 90,
16621         eastsoutheast: 112,
16622         ese: 112,
16623         southeast: 135,
16624         se: 135,
16625         southsoutheast: 157,
16626         sse: 157,
16627         south: 180,
16628         s: 180,
16629         southsouthwest: 202,
16630         ssw: 202,
16631         southwest: 225,
16632         sw: 225,
16633         westsouthwest: 247,
16634         wsw: 247,
16635         west: 270,
16636         w: 270,
16637         westnorthwest: 292,
16638         wnw: 292,
16639         northwest: 315,
16640         nw: 315,
16641         northnorthwest: 337,
16642         nnw: 337
16643       };
16644       osmEntity.node = osmNode;
16645       osmNode.prototype = Object.create(osmEntity.prototype);
16646       prototype = {
16647         type: "node",
16648         loc: [9999, 9999],
16649         extent: function() {
16650           return new geoExtent(this.loc);
16651         },
16652         geometry: function(graph) {
16653           return graph.transient(this, "geometry", function() {
16654             return graph.isPoi(this) ? "point" : "vertex";
16655           });
16656         },
16657         move: function(loc) {
16658           return this.update({ loc });
16659         },
16660         isDegenerate: function() {
16661           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);
16662         },
16663         // Inspect tags and geometry to determine which direction(s) this node/vertex points
16664         directions: function(resolver, projection2) {
16665           var val;
16666           var i3;
16667           if (this.isHighwayIntersection(resolver) && (this.tags.stop || "").toLowerCase() === "all") {
16668             val = "all";
16669           } else {
16670             val = (this.tags.direction || "").toLowerCase();
16671             var re3 = /:direction$/i;
16672             var keys2 = Object.keys(this.tags);
16673             for (i3 = 0; i3 < keys2.length; i3++) {
16674               if (re3.test(keys2[i3])) {
16675                 val = this.tags[keys2[i3]].toLowerCase();
16676                 break;
16677               }
16678             }
16679           }
16680           if (val === "") return [];
16681           var values = val.split(";");
16682           var results = [];
16683           values.forEach(function(v2) {
16684             if (cardinal[v2] !== void 0) {
16685               v2 = cardinal[v2];
16686             }
16687             if (v2 !== "" && !isNaN(+v2)) {
16688               results.push(+v2);
16689               return;
16690             }
16691             var lookBackward = this.tags["traffic_sign:backward"] || v2 === "backward" || v2 === "both" || v2 === "all";
16692             var lookForward = this.tags["traffic_sign:forward"] || v2 === "forward" || v2 === "both" || v2 === "all";
16693             if (!lookForward && !lookBackward) return;
16694             var nodeIds = {};
16695             resolver.parentWays(this).filter((way) => osmShouldRenderDirection(this.tags, way.tags)).forEach(function(parent) {
16696               var nodes = parent.nodes;
16697               for (i3 = 0; i3 < nodes.length; i3++) {
16698                 if (nodes[i3] === this.id) {
16699                   if (lookForward && i3 > 0) {
16700                     nodeIds[nodes[i3 - 1]] = true;
16701                   }
16702                   if (lookBackward && i3 < nodes.length - 1) {
16703                     nodeIds[nodes[i3 + 1]] = true;
16704                   }
16705                 }
16706               }
16707             }, this);
16708             Object.keys(nodeIds).forEach(function(nodeId) {
16709               results.push(
16710                 geoAngle(this, resolver.entity(nodeId), projection2) * (180 / Math.PI) + 90
16711               );
16712             }, this);
16713           }, this);
16714           return utilArrayUniq(results);
16715         },
16716         isCrossing: function() {
16717           return this.tags.highway === "crossing" || this.tags.railway && this.tags.railway.indexOf("crossing") !== -1;
16718         },
16719         isEndpoint: function(resolver) {
16720           return resolver.transient(this, "isEndpoint", function() {
16721             var id2 = this.id;
16722             return resolver.parentWays(this).filter(function(parent) {
16723               return !parent.isClosed() && !!parent.affix(id2);
16724             }).length > 0;
16725           });
16726         },
16727         isConnected: function(resolver) {
16728           return resolver.transient(this, "isConnected", function() {
16729             var parents = resolver.parentWays(this);
16730             if (parents.length > 1) {
16731               for (var i3 in parents) {
16732                 if (parents[i3].geometry(resolver) === "line" && parents[i3].hasInterestingTags()) return true;
16733               }
16734             } else if (parents.length === 1) {
16735               var way = parents[0];
16736               var nodes = way.nodes.slice();
16737               if (way.isClosed()) {
16738                 nodes.pop();
16739               }
16740               return nodes.indexOf(this.id) !== nodes.lastIndexOf(this.id);
16741             }
16742             return false;
16743           });
16744         },
16745         parentIntersectionWays: function(resolver) {
16746           return resolver.transient(this, "parentIntersectionWays", function() {
16747             return resolver.parentWays(this).filter(function(parent) {
16748               return (parent.tags.highway || parent.tags.waterway || parent.tags.railway || parent.tags.aeroway) && parent.geometry(resolver) === "line";
16749             });
16750           });
16751         },
16752         isIntersection: function(resolver) {
16753           return this.parentIntersectionWays(resolver).length > 1;
16754         },
16755         isHighwayIntersection: function(resolver) {
16756           return resolver.transient(this, "isHighwayIntersection", function() {
16757             return resolver.parentWays(this).filter(function(parent) {
16758               return parent.tags.highway && parent.geometry(resolver) === "line";
16759             }).length > 1;
16760           });
16761         },
16762         isOnAddressLine: function(resolver) {
16763           return resolver.transient(this, "isOnAddressLine", function() {
16764             return resolver.parentWays(this).filter(function(parent) {
16765               return parent.tags.hasOwnProperty("addr:interpolation") && parent.geometry(resolver) === "line";
16766             }).length > 0;
16767           });
16768         },
16769         asJXON: function(changeset_id) {
16770           var r2 = {
16771             node: {
16772               "@id": this.osmId(),
16773               "@lon": this.loc[0],
16774               "@lat": this.loc[1],
16775               "@version": this.version || 0,
16776               tag: Object.keys(this.tags).map(function(k2) {
16777                 return { keyAttributes: { k: k2, v: this.tags[k2] } };
16778               }, this)
16779             }
16780           };
16781           if (changeset_id) r2.node["@changeset"] = changeset_id;
16782           return r2;
16783         },
16784         asGeoJSON: function() {
16785           return {
16786             type: "Point",
16787             coordinates: this.loc
16788           };
16789         }
16790       };
16791       Object.assign(osmNode.prototype, prototype);
16792     }
16793   });
16794
16795   // modules/actions/circularize.js
16796   var circularize_exports = {};
16797   __export(circularize_exports, {
16798     actionCircularize: () => actionCircularize
16799   });
16800   function actionCircularize(wayId, projection2, maxAngle) {
16801     maxAngle = (maxAngle || 20) * Math.PI / 180;
16802     var action = function(graph, t2) {
16803       if (t2 === null || !isFinite(t2)) t2 = 1;
16804       t2 = Math.min(Math.max(+t2, 0), 1);
16805       var way = graph.entity(wayId);
16806       var origNodes = {};
16807       graph.childNodes(way).forEach(function(node2) {
16808         if (!origNodes[node2.id]) origNodes[node2.id] = node2;
16809       });
16810       if (!way.isConvex(graph)) {
16811         graph = action.makeConvex(graph);
16812       }
16813       var nodes = utilArrayUniq(graph.childNodes(way));
16814       var keyNodes = nodes.filter(function(n3) {
16815         return graph.parentWays(n3).length !== 1;
16816       });
16817       var points = nodes.map(function(n3) {
16818         return projection2(n3.loc);
16819       });
16820       var keyPoints = keyNodes.map(function(n3) {
16821         return projection2(n3.loc);
16822       });
16823       var centroid = points.length === 2 ? geoVecInterp(points[0], points[1], 0.5) : centroid_default2(points);
16824       var radius = median(points, function(p2) {
16825         return geoVecLength(centroid, p2);
16826       });
16827       var sign2 = area_default3(points) > 0 ? 1 : -1;
16828       var ids, i3, j2, k2;
16829       if (!keyNodes.length) {
16830         keyNodes = [nodes[0]];
16831         keyPoints = [points[0]];
16832       }
16833       if (keyNodes.length === 1) {
16834         var index = nodes.indexOf(keyNodes[0]);
16835         var oppositeIndex = Math.floor((index + nodes.length / 2) % nodes.length);
16836         keyNodes.push(nodes[oppositeIndex]);
16837         keyPoints.push(points[oppositeIndex]);
16838       }
16839       for (i3 = 0; i3 < keyPoints.length; i3++) {
16840         var nextKeyNodeIndex = (i3 + 1) % keyNodes.length;
16841         var startNode = keyNodes[i3];
16842         var endNode = keyNodes[nextKeyNodeIndex];
16843         var startNodeIndex = nodes.indexOf(startNode);
16844         var endNodeIndex = nodes.indexOf(endNode);
16845         var numberNewPoints = -1;
16846         var indexRange = endNodeIndex - startNodeIndex;
16847         var nearNodes = {};
16848         var inBetweenNodes = [];
16849         var startAngle, endAngle, totalAngle, eachAngle;
16850         var angle2, loc, node, origNode;
16851         if (indexRange < 0) {
16852           indexRange += nodes.length;
16853         }
16854         var distance = geoVecLength(centroid, keyPoints[i3]) || 1e-4;
16855         keyPoints[i3] = [
16856           centroid[0] + (keyPoints[i3][0] - centroid[0]) / distance * radius,
16857           centroid[1] + (keyPoints[i3][1] - centroid[1]) / distance * radius
16858         ];
16859         loc = projection2.invert(keyPoints[i3]);
16860         node = keyNodes[i3];
16861         origNode = origNodes[node.id];
16862         node = node.move(geoVecInterp(origNode.loc, loc, t2));
16863         graph = graph.replace(node);
16864         startAngle = Math.atan2(keyPoints[i3][1] - centroid[1], keyPoints[i3][0] - centroid[0]);
16865         endAngle = Math.atan2(keyPoints[nextKeyNodeIndex][1] - centroid[1], keyPoints[nextKeyNodeIndex][0] - centroid[0]);
16866         totalAngle = endAngle - startAngle;
16867         if (totalAngle * sign2 > 0) {
16868           totalAngle = -sign2 * (2 * Math.PI - Math.abs(totalAngle));
16869         }
16870         do {
16871           numberNewPoints++;
16872           eachAngle = totalAngle / (indexRange + numberNewPoints);
16873         } while (Math.abs(eachAngle) > maxAngle);
16874         for (j2 = 1; j2 < indexRange; j2++) {
16875           angle2 = startAngle + j2 * eachAngle;
16876           loc = projection2.invert([
16877             centroid[0] + Math.cos(angle2) * radius,
16878             centroid[1] + Math.sin(angle2) * radius
16879           ]);
16880           node = nodes[(j2 + startNodeIndex) % nodes.length];
16881           origNode = origNodes[node.id];
16882           nearNodes[node.id] = angle2;
16883           node = node.move(geoVecInterp(origNode.loc, loc, t2));
16884           graph = graph.replace(node);
16885         }
16886         for (j2 = 0; j2 < numberNewPoints; j2++) {
16887           angle2 = startAngle + (indexRange + j2) * eachAngle;
16888           loc = projection2.invert([
16889             centroid[0] + Math.cos(angle2) * radius,
16890             centroid[1] + Math.sin(angle2) * radius
16891           ]);
16892           var min3 = Infinity;
16893           for (var nodeId in nearNodes) {
16894             var nearAngle = nearNodes[nodeId];
16895             var dist = Math.abs(nearAngle - angle2);
16896             if (dist < min3) {
16897               min3 = dist;
16898               origNode = origNodes[nodeId];
16899             }
16900           }
16901           node = osmNode({ loc: geoVecInterp(origNode.loc, loc, t2) });
16902           graph = graph.replace(node);
16903           nodes.splice(endNodeIndex + j2, 0, node);
16904           inBetweenNodes.push(node.id);
16905         }
16906         if (indexRange === 1 && inBetweenNodes.length) {
16907           var startIndex1 = way.nodes.lastIndexOf(startNode.id);
16908           var endIndex1 = way.nodes.lastIndexOf(endNode.id);
16909           var wayDirection1 = endIndex1 - startIndex1;
16910           if (wayDirection1 < -1) {
16911             wayDirection1 = 1;
16912           }
16913           var parentWays = graph.parentWays(keyNodes[i3]);
16914           for (j2 = 0; j2 < parentWays.length; j2++) {
16915             var sharedWay = parentWays[j2];
16916             if (sharedWay === way) continue;
16917             if (sharedWay.areAdjacent(startNode.id, endNode.id)) {
16918               var startIndex2 = sharedWay.nodes.lastIndexOf(startNode.id);
16919               var endIndex2 = sharedWay.nodes.lastIndexOf(endNode.id);
16920               var wayDirection2 = endIndex2 - startIndex2;
16921               var insertAt = endIndex2;
16922               if (wayDirection2 < -1) {
16923                 wayDirection2 = 1;
16924               }
16925               if (wayDirection1 !== wayDirection2) {
16926                 inBetweenNodes.reverse();
16927                 insertAt = startIndex2;
16928               }
16929               for (k2 = 0; k2 < inBetweenNodes.length; k2++) {
16930                 sharedWay = sharedWay.addNode(inBetweenNodes[k2], insertAt + k2);
16931               }
16932               graph = graph.replace(sharedWay);
16933             }
16934           }
16935         }
16936       }
16937       ids = nodes.map(function(n3) {
16938         return n3.id;
16939       });
16940       ids.push(ids[0]);
16941       way = way.update({ nodes: ids });
16942       graph = graph.replace(way);
16943       return graph;
16944     };
16945     action.makeConvex = function(graph) {
16946       var way = graph.entity(wayId);
16947       var nodes = utilArrayUniq(graph.childNodes(way));
16948       var points = nodes.map(function(n3) {
16949         return projection2(n3.loc);
16950       });
16951       var sign2 = area_default3(points) > 0 ? 1 : -1;
16952       var hull = hull_default(points);
16953       var i3, j2;
16954       if (sign2 === -1) {
16955         nodes.reverse();
16956         points.reverse();
16957       }
16958       for (i3 = 0; i3 < hull.length - 1; i3++) {
16959         var startIndex = points.indexOf(hull[i3]);
16960         var endIndex = points.indexOf(hull[i3 + 1]);
16961         var indexRange = endIndex - startIndex;
16962         if (indexRange < 0) {
16963           indexRange += nodes.length;
16964         }
16965         for (j2 = 1; j2 < indexRange; j2++) {
16966           var point = geoVecInterp(hull[i3], hull[i3 + 1], j2 / indexRange);
16967           var node = nodes[(j2 + startIndex) % nodes.length].move(projection2.invert(point));
16968           graph = graph.replace(node);
16969         }
16970       }
16971       return graph;
16972     };
16973     action.disabled = function(graph) {
16974       if (!graph.entity(wayId).isClosed()) {
16975         return "not_closed";
16976       }
16977       var way = graph.entity(wayId);
16978       var nodes = utilArrayUniq(graph.childNodes(way));
16979       var points = nodes.map(function(n3) {
16980         return projection2(n3.loc);
16981       });
16982       var hull = hull_default(points);
16983       var epsilonAngle = Math.PI / 180;
16984       if (hull.length !== points.length || hull.length < 3) {
16985         return false;
16986       }
16987       var centroid = centroid_default2(points);
16988       var radius = geoVecLengthSquare(centroid, points[0]);
16989       var i3, actualPoint;
16990       for (i3 = 0; i3 < hull.length; i3++) {
16991         actualPoint = hull[i3];
16992         var actualDist = geoVecLengthSquare(actualPoint, centroid);
16993         var diff = Math.abs(actualDist - radius);
16994         if (diff > 0.05 * radius) {
16995           return false;
16996         }
16997       }
16998       for (i3 = 0; i3 < hull.length; i3++) {
16999         actualPoint = hull[i3];
17000         var nextPoint = hull[(i3 + 1) % hull.length];
17001         var startAngle = Math.atan2(actualPoint[1] - centroid[1], actualPoint[0] - centroid[0]);
17002         var endAngle = Math.atan2(nextPoint[1] - centroid[1], nextPoint[0] - centroid[0]);
17003         var angle2 = endAngle - startAngle;
17004         if (angle2 < 0) {
17005           angle2 = -angle2;
17006         }
17007         if (angle2 > Math.PI) {
17008           angle2 = 2 * Math.PI - angle2;
17009         }
17010         if (angle2 > maxAngle + epsilonAngle) {
17011           return false;
17012         }
17013       }
17014       return "already_circular";
17015     };
17016     action.transitionable = true;
17017     return action;
17018   }
17019   var init_circularize = __esm({
17020     "modules/actions/circularize.js"() {
17021       "use strict";
17022       init_src();
17023       init_src3();
17024       init_geo2();
17025       init_node2();
17026       init_util();
17027       init_vector();
17028     }
17029   });
17030
17031   // modules/actions/delete_way.js
17032   var delete_way_exports = {};
17033   __export(delete_way_exports, {
17034     actionDeleteWay: () => actionDeleteWay
17035   });
17036   function actionDeleteWay(wayID) {
17037     function canDeleteNode(node, graph) {
17038       if (graph.parentWays(node).length || graph.parentRelations(node).length) return false;
17039       var geometries = osmNodeGeometriesForTags(node.tags);
17040       if (geometries.point) return false;
17041       if (geometries.vertex) return true;
17042       return !node.hasInterestingTags();
17043     }
17044     var action = function(graph) {
17045       var way = graph.entity(wayID);
17046       graph.parentRelations(way).forEach(function(parent) {
17047         parent = parent.removeMembersWithID(wayID);
17048         graph = graph.replace(parent);
17049         if (parent.isDegenerate()) {
17050           graph = actionDeleteRelation(parent.id)(graph);
17051         }
17052       });
17053       new Set(way.nodes).forEach(function(nodeID) {
17054         graph = graph.replace(way.removeNode(nodeID));
17055         var node = graph.entity(nodeID);
17056         if (canDeleteNode(node, graph)) {
17057           graph = graph.remove(node);
17058         }
17059       });
17060       return graph.remove(way);
17061     };
17062     return action;
17063   }
17064   var init_delete_way = __esm({
17065     "modules/actions/delete_way.js"() {
17066       "use strict";
17067       init_tags();
17068       init_delete_relation();
17069     }
17070   });
17071
17072   // modules/actions/delete_multiple.js
17073   var delete_multiple_exports = {};
17074   __export(delete_multiple_exports, {
17075     actionDeleteMultiple: () => actionDeleteMultiple
17076   });
17077   function actionDeleteMultiple(ids) {
17078     var actions = {
17079       way: actionDeleteWay,
17080       node: actionDeleteNode,
17081       relation: actionDeleteRelation
17082     };
17083     var action = function(graph) {
17084       ids.forEach(function(id2) {
17085         if (graph.hasEntity(id2)) {
17086           graph = actions[graph.entity(id2).type](id2)(graph);
17087         }
17088       });
17089       return graph;
17090     };
17091     return action;
17092   }
17093   var init_delete_multiple = __esm({
17094     "modules/actions/delete_multiple.js"() {
17095       "use strict";
17096       init_delete_node();
17097       init_delete_relation();
17098       init_delete_way();
17099     }
17100   });
17101
17102   // modules/actions/delete_relation.js
17103   var delete_relation_exports = {};
17104   __export(delete_relation_exports, {
17105     actionDeleteRelation: () => actionDeleteRelation
17106   });
17107   function actionDeleteRelation(relationID, allowUntaggedMembers) {
17108     function canDeleteEntity(entity, graph) {
17109       return !graph.parentWays(entity).length && !graph.parentRelations(entity).length && (!entity.hasInterestingTags() && !allowUntaggedMembers);
17110     }
17111     var action = function(graph) {
17112       var relation = graph.entity(relationID);
17113       graph.parentRelations(relation).forEach(function(parent) {
17114         parent = parent.removeMembersWithID(relationID);
17115         graph = graph.replace(parent);
17116         if (parent.isDegenerate()) {
17117           graph = actionDeleteRelation(parent.id)(graph);
17118         }
17119       });
17120       var memberIDs = utilArrayUniq(relation.members.map(function(m2) {
17121         return m2.id;
17122       }));
17123       memberIDs.forEach(function(memberID) {
17124         graph = graph.replace(relation.removeMembersWithID(memberID));
17125         var entity = graph.entity(memberID);
17126         if (canDeleteEntity(entity, graph)) {
17127           graph = actionDeleteMultiple([memberID])(graph);
17128         }
17129       });
17130       return graph.remove(relation);
17131     };
17132     return action;
17133   }
17134   var init_delete_relation = __esm({
17135     "modules/actions/delete_relation.js"() {
17136       "use strict";
17137       init_delete_multiple();
17138       init_util();
17139     }
17140   });
17141
17142   // modules/actions/delete_node.js
17143   var delete_node_exports = {};
17144   __export(delete_node_exports, {
17145     actionDeleteNode: () => actionDeleteNode
17146   });
17147   function actionDeleteNode(nodeId) {
17148     var action = function(graph) {
17149       var node = graph.entity(nodeId);
17150       graph.parentWays(node).forEach(function(parent) {
17151         parent = parent.removeNode(nodeId);
17152         graph = graph.replace(parent);
17153         if (parent.isDegenerate()) {
17154           graph = actionDeleteWay(parent.id)(graph);
17155         }
17156       });
17157       graph.parentRelations(node).forEach(function(parent) {
17158         parent = parent.removeMembersWithID(nodeId);
17159         graph = graph.replace(parent);
17160         if (parent.isDegenerate()) {
17161           graph = actionDeleteRelation(parent.id)(graph);
17162         }
17163       });
17164       return graph.remove(node);
17165     };
17166     return action;
17167   }
17168   var init_delete_node = __esm({
17169     "modules/actions/delete_node.js"() {
17170       "use strict";
17171       init_delete_relation();
17172       init_delete_way();
17173     }
17174   });
17175
17176   // modules/actions/connect.js
17177   var connect_exports = {};
17178   __export(connect_exports, {
17179     actionConnect: () => actionConnect
17180   });
17181   function actionConnect(nodeIDs) {
17182     var action = function(graph) {
17183       var survivor;
17184       var node;
17185       var parents;
17186       var i3, j2;
17187       nodeIDs.reverse();
17188       var interestingIDs = [];
17189       for (i3 = 0; i3 < nodeIDs.length; i3++) {
17190         node = graph.entity(nodeIDs[i3]);
17191         if (node.hasInterestingTags()) {
17192           if (!node.isNew()) {
17193             interestingIDs.push(node.id);
17194           }
17195         }
17196       }
17197       survivor = graph.entity(utilOldestID(interestingIDs.length > 0 ? interestingIDs : nodeIDs));
17198       for (i3 = 0; i3 < nodeIDs.length; i3++) {
17199         node = graph.entity(nodeIDs[i3]);
17200         if (node.id === survivor.id) continue;
17201         parents = graph.parentWays(node);
17202         for (j2 = 0; j2 < parents.length; j2++) {
17203           graph = graph.replace(parents[j2].replaceNode(node.id, survivor.id));
17204         }
17205         parents = graph.parentRelations(node);
17206         for (j2 = 0; j2 < parents.length; j2++) {
17207           graph = graph.replace(parents[j2].replaceMember(node, survivor));
17208         }
17209         survivor = survivor.mergeTags(node.tags);
17210         graph = actionDeleteNode(node.id)(graph);
17211       }
17212       graph = graph.replace(survivor);
17213       parents = graph.parentWays(survivor);
17214       for (i3 = 0; i3 < parents.length; i3++) {
17215         if (parents[i3].isDegenerate()) {
17216           graph = actionDeleteWay(parents[i3].id)(graph);
17217         }
17218       }
17219       return graph;
17220     };
17221     action.disabled = function(graph) {
17222       var seen = {};
17223       var restrictionIDs = [];
17224       var survivor;
17225       var node, way;
17226       var relations, relation, role;
17227       var i3, j2, k2;
17228       survivor = graph.entity(utilOldestID(nodeIDs));
17229       for (i3 = 0; i3 < nodeIDs.length; i3++) {
17230         node = graph.entity(nodeIDs[i3]);
17231         relations = graph.parentRelations(node);
17232         for (j2 = 0; j2 < relations.length; j2++) {
17233           relation = relations[j2];
17234           role = relation.memberById(node.id).role || "";
17235           if (relation.hasFromViaTo()) {
17236             restrictionIDs.push(relation.id);
17237           }
17238           if (seen[relation.id] !== void 0 && seen[relation.id] !== role) {
17239             return "relation";
17240           } else {
17241             seen[relation.id] = role;
17242           }
17243         }
17244       }
17245       for (i3 = 0; i3 < nodeIDs.length; i3++) {
17246         node = graph.entity(nodeIDs[i3]);
17247         var parents = graph.parentWays(node);
17248         for (j2 = 0; j2 < parents.length; j2++) {
17249           var parent = parents[j2];
17250           relations = graph.parentRelations(parent);
17251           for (k2 = 0; k2 < relations.length; k2++) {
17252             relation = relations[k2];
17253             if (relation.hasFromViaTo()) {
17254               restrictionIDs.push(relation.id);
17255             }
17256           }
17257         }
17258       }
17259       restrictionIDs = utilArrayUniq(restrictionIDs);
17260       for (i3 = 0; i3 < restrictionIDs.length; i3++) {
17261         relation = graph.entity(restrictionIDs[i3]);
17262         if (!relation.isComplete(graph)) continue;
17263         var memberWays = relation.members.filter(function(m2) {
17264           return m2.type === "way";
17265         }).map(function(m2) {
17266           return graph.entity(m2.id);
17267         });
17268         memberWays = utilArrayUniq(memberWays);
17269         var f2 = relation.memberByRole("from");
17270         var t2 = relation.memberByRole("to");
17271         var isUturn = f2.id === t2.id;
17272         var nodes = { from: [], via: [], to: [], keyfrom: [], keyto: [] };
17273         for (j2 = 0; j2 < relation.members.length; j2++) {
17274           collectNodes(relation.members[j2], nodes);
17275         }
17276         nodes.keyfrom = utilArrayUniq(nodes.keyfrom.filter(hasDuplicates));
17277         nodes.keyto = utilArrayUniq(nodes.keyto.filter(hasDuplicates));
17278         var filter2 = keyNodeFilter(nodes.keyfrom, nodes.keyto);
17279         nodes.from = nodes.from.filter(filter2);
17280         nodes.via = nodes.via.filter(filter2);
17281         nodes.to = nodes.to.filter(filter2);
17282         var connectFrom = false;
17283         var connectVia = false;
17284         var connectTo = false;
17285         var connectKeyFrom = false;
17286         var connectKeyTo = false;
17287         for (j2 = 0; j2 < nodeIDs.length; j2++) {
17288           var n3 = nodeIDs[j2];
17289           if (nodes.from.indexOf(n3) !== -1) {
17290             connectFrom = true;
17291           }
17292           if (nodes.via.indexOf(n3) !== -1) {
17293             connectVia = true;
17294           }
17295           if (nodes.to.indexOf(n3) !== -1) {
17296             connectTo = true;
17297           }
17298           if (nodes.keyfrom.indexOf(n3) !== -1) {
17299             connectKeyFrom = true;
17300           }
17301           if (nodes.keyto.indexOf(n3) !== -1) {
17302             connectKeyTo = true;
17303           }
17304         }
17305         if (connectFrom && connectTo && !isUturn) {
17306           return "restriction";
17307         }
17308         if (connectFrom && connectVia) {
17309           return "restriction";
17310         }
17311         if (connectTo && connectVia) {
17312           return "restriction";
17313         }
17314         if (connectKeyFrom || connectKeyTo) {
17315           if (nodeIDs.length !== 2) {
17316             return "restriction";
17317           }
17318           var n0 = null;
17319           var n1 = null;
17320           for (j2 = 0; j2 < memberWays.length; j2++) {
17321             way = memberWays[j2];
17322             if (way.contains(nodeIDs[0])) {
17323               n0 = nodeIDs[0];
17324             }
17325             if (way.contains(nodeIDs[1])) {
17326               n1 = nodeIDs[1];
17327             }
17328           }
17329           if (n0 && n1) {
17330             var ok = false;
17331             for (j2 = 0; j2 < memberWays.length; j2++) {
17332               way = memberWays[j2];
17333               if (way.areAdjacent(n0, n1)) {
17334                 ok = true;
17335                 break;
17336               }
17337             }
17338             if (!ok) {
17339               return "restriction";
17340             }
17341           }
17342         }
17343         for (j2 = 0; j2 < memberWays.length; j2++) {
17344           way = memberWays[j2].update({});
17345           for (k2 = 0; k2 < nodeIDs.length; k2++) {
17346             if (nodeIDs[k2] === survivor.id) continue;
17347             if (way.areAdjacent(nodeIDs[k2], survivor.id)) {
17348               way = way.removeNode(nodeIDs[k2]);
17349             } else {
17350               way = way.replaceNode(nodeIDs[k2], survivor.id);
17351             }
17352           }
17353           if (way.isDegenerate()) {
17354             return "restriction";
17355           }
17356         }
17357       }
17358       return false;
17359       function hasDuplicates(n4, i4, arr) {
17360         return arr.indexOf(n4) !== arr.lastIndexOf(n4);
17361       }
17362       function keyNodeFilter(froms, tos) {
17363         return function(n4) {
17364           return froms.indexOf(n4) === -1 && tos.indexOf(n4) === -1;
17365         };
17366       }
17367       function collectNodes(member, collection) {
17368         var entity = graph.hasEntity(member.id);
17369         if (!entity) return;
17370         var role2 = member.role || "";
17371         if (!collection[role2]) {
17372           collection[role2] = [];
17373         }
17374         if (member.type === "node") {
17375           collection[role2].push(member.id);
17376           if (role2 === "via") {
17377             collection.keyfrom.push(member.id);
17378             collection.keyto.push(member.id);
17379           }
17380         } else if (member.type === "way") {
17381           collection[role2].push.apply(collection[role2], entity.nodes);
17382           if (role2 === "from" || role2 === "via") {
17383             collection.keyfrom.push(entity.first());
17384             collection.keyfrom.push(entity.last());
17385           }
17386           if (role2 === "to" || role2 === "via") {
17387             collection.keyto.push(entity.first());
17388             collection.keyto.push(entity.last());
17389           }
17390         }
17391       }
17392     };
17393     return action;
17394   }
17395   var init_connect = __esm({
17396     "modules/actions/connect.js"() {
17397       "use strict";
17398       init_delete_node();
17399       init_delete_way();
17400       init_util();
17401     }
17402   });
17403
17404   // modules/actions/copy_entities.js
17405   var copy_entities_exports = {};
17406   __export(copy_entities_exports, {
17407     actionCopyEntities: () => actionCopyEntities
17408   });
17409   function actionCopyEntities(ids, fromGraph) {
17410     var _copies = {};
17411     var action = function(graph) {
17412       ids.forEach(function(id3) {
17413         fromGraph.entity(id3).copy(fromGraph, _copies);
17414       });
17415       for (var id2 in _copies) {
17416         graph = graph.replace(_copies[id2]);
17417       }
17418       return graph;
17419     };
17420     action.copies = function() {
17421       return _copies;
17422     };
17423     return action;
17424   }
17425   var init_copy_entities = __esm({
17426     "modules/actions/copy_entities.js"() {
17427       "use strict";
17428     }
17429   });
17430
17431   // modules/actions/delete_member.js
17432   var delete_member_exports = {};
17433   __export(delete_member_exports, {
17434     actionDeleteMember: () => actionDeleteMember
17435   });
17436   function actionDeleteMember(relationId, memberIndex) {
17437     return function(graph) {
17438       var relation = graph.entity(relationId).removeMember(memberIndex);
17439       graph = graph.replace(relation);
17440       if (relation.isDegenerate()) {
17441         graph = actionDeleteRelation(relation.id)(graph);
17442       }
17443       return graph;
17444     };
17445   }
17446   var init_delete_member = __esm({
17447     "modules/actions/delete_member.js"() {
17448       "use strict";
17449       init_delete_relation();
17450     }
17451   });
17452
17453   // modules/actions/delete_members.js
17454   var delete_members_exports = {};
17455   __export(delete_members_exports, {
17456     actionDeleteMembers: () => actionDeleteMembers
17457   });
17458   function actionDeleteMembers(relationId, memberIndexes) {
17459     return function(graph) {
17460       memberIndexes.sort((a2, b2) => b2 - a2);
17461       for (var i3 in memberIndexes) {
17462         graph = actionDeleteMember(relationId, memberIndexes[i3])(graph);
17463       }
17464       return graph;
17465     };
17466   }
17467   var init_delete_members = __esm({
17468     "modules/actions/delete_members.js"() {
17469       "use strict";
17470       init_delete_member();
17471     }
17472   });
17473
17474   // modules/actions/discard_tags.js
17475   var discard_tags_exports = {};
17476   __export(discard_tags_exports, {
17477     actionDiscardTags: () => actionDiscardTags
17478   });
17479   function actionDiscardTags(difference2, discardTags) {
17480     discardTags = discardTags || {};
17481     return (graph) => {
17482       difference2.modified().forEach(checkTags);
17483       difference2.created().forEach(checkTags);
17484       return graph;
17485       function checkTags(entity) {
17486         const keys2 = Object.keys(entity.tags);
17487         let didDiscard = false;
17488         let tags = {};
17489         for (let i3 = 0; i3 < keys2.length; i3++) {
17490           const k2 = keys2[i3];
17491           if (discardTags[k2] || !entity.tags[k2]) {
17492             didDiscard = true;
17493           } else {
17494             tags[k2] = entity.tags[k2];
17495           }
17496         }
17497         if (didDiscard) {
17498           graph = graph.replace(entity.update({ tags }));
17499         }
17500       }
17501     };
17502   }
17503   var init_discard_tags = __esm({
17504     "modules/actions/discard_tags.js"() {
17505       "use strict";
17506     }
17507   });
17508
17509   // modules/actions/disconnect.js
17510   var disconnect_exports = {};
17511   __export(disconnect_exports, {
17512     actionDisconnect: () => actionDisconnect
17513   });
17514   function actionDisconnect(nodeId, newNodeId) {
17515     var wayIds;
17516     var disconnectableRelationTypes = {
17517       "associatedStreet": true,
17518       "enforcement": true,
17519       "site": true
17520     };
17521     var action = function(graph) {
17522       var node = graph.entity(nodeId);
17523       var connections = action.connections(graph);
17524       connections.forEach(function(connection) {
17525         var way = graph.entity(connection.wayID);
17526         var newNode = osmNode({ id: newNodeId, loc: node.loc, tags: node.tags });
17527         graph = graph.replace(newNode);
17528         if (connection.index === 0 && way.isArea()) {
17529           graph = graph.replace(way.replaceNode(way.nodes[0], newNode.id));
17530         } else if (way.isClosed() && connection.index === way.nodes.length - 1) {
17531           graph = graph.replace(way.unclose().addNode(newNode.id));
17532         } else {
17533           graph = graph.replace(way.updateNode(newNode.id, connection.index));
17534         }
17535       });
17536       return graph;
17537     };
17538     action.connections = function(graph) {
17539       var candidates = [];
17540       var keeping = false;
17541       var parentWays = graph.parentWays(graph.entity(nodeId));
17542       var way, waynode;
17543       for (var i3 = 0; i3 < parentWays.length; i3++) {
17544         way = parentWays[i3];
17545         if (wayIds && wayIds.indexOf(way.id) === -1) {
17546           keeping = true;
17547           continue;
17548         }
17549         if (way.isArea() && way.nodes[0] === nodeId) {
17550           candidates.push({ wayID: way.id, index: 0 });
17551         } else {
17552           for (var j2 = 0; j2 < way.nodes.length; j2++) {
17553             waynode = way.nodes[j2];
17554             if (waynode === nodeId) {
17555               if (way.isClosed() && parentWays.length > 1 && wayIds && wayIds.indexOf(way.id) !== -1 && j2 === way.nodes.length - 1) {
17556                 continue;
17557               }
17558               candidates.push({ wayID: way.id, index: j2 });
17559             }
17560           }
17561         }
17562       }
17563       return keeping ? candidates : candidates.slice(1);
17564     };
17565     action.disabled = function(graph) {
17566       var connections = action.connections(graph);
17567       if (connections.length === 0) return "not_connected";
17568       var parentWays = graph.parentWays(graph.entity(nodeId));
17569       var seenRelationIds = {};
17570       var sharedRelation;
17571       parentWays.forEach(function(way) {
17572         var relations = graph.parentRelations(way);
17573         relations.filter((relation) => !disconnectableRelationTypes[relation.tags.type]).forEach(function(relation) {
17574           if (relation.id in seenRelationIds) {
17575             if (wayIds) {
17576               if (wayIds.indexOf(way.id) !== -1 || wayIds.indexOf(seenRelationIds[relation.id]) !== -1) {
17577                 sharedRelation = relation;
17578               }
17579             } else {
17580               sharedRelation = relation;
17581             }
17582           } else {
17583             seenRelationIds[relation.id] = way.id;
17584           }
17585         });
17586       });
17587       if (sharedRelation) return "relation";
17588     };
17589     action.limitWays = function(val) {
17590       if (!arguments.length) return wayIds;
17591       wayIds = val;
17592       return action;
17593     };
17594     return action;
17595   }
17596   var init_disconnect = __esm({
17597     "modules/actions/disconnect.js"() {
17598       "use strict";
17599       init_node2();
17600     }
17601   });
17602
17603   // modules/actions/extract.js
17604   var extract_exports = {};
17605   __export(extract_exports, {
17606     actionExtract: () => actionExtract
17607   });
17608   function actionExtract(entityID, projection2) {
17609     var extractedNodeID;
17610     var action = function(graph, shiftKeyPressed) {
17611       var entity = graph.entity(entityID);
17612       if (entity.type === "node") {
17613         return extractFromNode(entity, graph, shiftKeyPressed);
17614       }
17615       return extractFromWayOrRelation(entity, graph);
17616     };
17617     function extractFromNode(node, graph, shiftKeyPressed) {
17618       extractedNodeID = node.id;
17619       var replacement = osmNode({ loc: node.loc });
17620       graph = graph.replace(replacement);
17621       graph = graph.parentWays(node).reduce(function(accGraph, parentWay) {
17622         return accGraph.replace(parentWay.replaceNode(entityID, replacement.id));
17623       }, graph);
17624       if (!shiftKeyPressed) return graph;
17625       return graph.parentRelations(node).reduce(function(accGraph, parentRel) {
17626         return accGraph.replace(parentRel.replaceMember(node, replacement));
17627       }, graph);
17628     }
17629     function extractFromWayOrRelation(entity, graph) {
17630       var fromGeometry = entity.geometry(graph);
17631       var keysToCopyAndRetain = ["source", "wheelchair"];
17632       var keysToRetain = ["area"];
17633       var buildingKeysToRetain = ["architect", "building", "height", "layer", "nycdoitt:bin"];
17634       var extractedLoc = path_default(projection2).centroid(entity.asGeoJSON(graph));
17635       extractedLoc = extractedLoc && projection2.invert(extractedLoc);
17636       if (!extractedLoc || !isFinite(extractedLoc[0]) || !isFinite(extractedLoc[1])) {
17637         extractedLoc = entity.extent(graph).center();
17638       }
17639       var indoorAreaValues = {
17640         area: true,
17641         corridor: true,
17642         elevator: true,
17643         level: true,
17644         room: true
17645       };
17646       var isBuilding = entity.tags.building && entity.tags.building !== "no" || entity.tags["building:part"] && entity.tags["building:part"] !== "no";
17647       var isIndoorArea = fromGeometry === "area" && entity.tags.indoor && indoorAreaValues[entity.tags.indoor];
17648       var entityTags = Object.assign({}, entity.tags);
17649       var pointTags = {};
17650       for (var key in entityTags) {
17651         if (entity.type === "relation" && key === "type") {
17652           continue;
17653         }
17654         if (keysToRetain.indexOf(key) !== -1) {
17655           continue;
17656         }
17657         if (isBuilding) {
17658           if (buildingKeysToRetain.indexOf(key) !== -1 || key.match(/^building:.{1,}/) || key.match(/^roof:.{1,}/)) continue;
17659         }
17660         if (isIndoorArea && key === "indoor") {
17661           continue;
17662         }
17663         pointTags[key] = entityTags[key];
17664         if (keysToCopyAndRetain.indexOf(key) !== -1 || key.match(/^addr:.{1,}/)) {
17665           continue;
17666         } else if (isIndoorArea && key === "level") {
17667           continue;
17668         }
17669         delete entityTags[key];
17670       }
17671       if (!isBuilding && !isIndoorArea && fromGeometry === "area") {
17672         entityTags.area = "yes";
17673       }
17674       var replacement = osmNode({ loc: extractedLoc, tags: pointTags });
17675       graph = graph.replace(replacement);
17676       extractedNodeID = replacement.id;
17677       return graph.replace(entity.update({ tags: entityTags }));
17678     }
17679     action.getExtractedNodeID = function() {
17680       return extractedNodeID;
17681     };
17682     return action;
17683   }
17684   var init_extract = __esm({
17685     "modules/actions/extract.js"() {
17686       "use strict";
17687       init_src2();
17688       init_node2();
17689     }
17690   });
17691
17692   // modules/actions/join.js
17693   var join_exports = {};
17694   __export(join_exports, {
17695     actionJoin: () => actionJoin
17696   });
17697   function actionJoin(ids) {
17698     function groupEntitiesByGeometry(graph) {
17699       var entities = ids.map(function(id2) {
17700         return graph.entity(id2);
17701       });
17702       return Object.assign(
17703         { line: [] },
17704         utilArrayGroupBy(entities, function(entity) {
17705           return entity.geometry(graph);
17706         })
17707       );
17708     }
17709     var action = function(graph) {
17710       var ways = ids.map(graph.entity, graph);
17711       var survivorID = utilOldestID(ways.map((way) => way.id));
17712       ways.sort(function(a2, b2) {
17713         var aSided = a2.isSided();
17714         var bSided = b2.isSided();
17715         return aSided && !bSided ? -1 : bSided && !aSided ? 1 : 0;
17716       });
17717       var sequences = osmJoinWays(ways, graph);
17718       var joined = sequences[0];
17719       graph = sequences.actions.reduce(function(g3, action2) {
17720         return action2(g3);
17721       }, graph);
17722       var survivor = graph.entity(survivorID);
17723       survivor = survivor.update({ nodes: joined.nodes.map(function(n3) {
17724         return n3.id;
17725       }) });
17726       graph = graph.replace(survivor);
17727       joined.forEach(function(way) {
17728         if (way.id === survivorID) return;
17729         graph.parentRelations(way).forEach(function(parent) {
17730           graph = graph.replace(parent.replaceMember(way, survivor));
17731         });
17732         survivor = survivor.mergeTags(way.tags);
17733         graph = graph.replace(survivor);
17734         graph = actionDeleteWay(way.id)(graph);
17735       });
17736       function checkForSimpleMultipolygon() {
17737         if (!survivor.isClosed()) return;
17738         var multipolygons = graph.parentMultipolygons(survivor).filter(function(multipolygon2) {
17739           return multipolygon2.members.length === 1;
17740         });
17741         if (multipolygons.length !== 1) return;
17742         var multipolygon = multipolygons[0];
17743         for (var key in survivor.tags) {
17744           if (multipolygon.tags[key] && // don't collapse if tags cannot be cleanly merged
17745           multipolygon.tags[key] !== survivor.tags[key]) return;
17746         }
17747         survivor = survivor.mergeTags(multipolygon.tags);
17748         graph = graph.replace(survivor);
17749         graph = actionDeleteRelation(
17750           multipolygon.id,
17751           true
17752           /* allow untagged members */
17753         )(graph);
17754         var tags = Object.assign({}, survivor.tags);
17755         if (survivor.geometry(graph) !== "area") {
17756           tags.area = "yes";
17757         }
17758         delete tags.type;
17759         survivor = survivor.update({ tags });
17760         graph = graph.replace(survivor);
17761       }
17762       checkForSimpleMultipolygon();
17763       return graph;
17764     };
17765     action.resultingWayNodesLength = function(graph) {
17766       return ids.reduce(function(count, id2) {
17767         return count + graph.entity(id2).nodes.length;
17768       }, 0) - ids.length - 1;
17769     };
17770     action.disabled = function(graph) {
17771       var geometries = groupEntitiesByGeometry(graph);
17772       if (ids.length < 2 || ids.length !== geometries.line.length) {
17773         return "not_eligible";
17774       }
17775       var joined = osmJoinWays(ids.map(graph.entity, graph), graph);
17776       if (joined.length > 1) {
17777         return "not_adjacent";
17778       }
17779       var i3;
17780       var sortedParentRelations = function(id2) {
17781         return graph.parentRelations(graph.entity(id2)).filter((rel) => !rel.isRestriction() && !rel.isConnectivity()).sort((a2, b2) => a2.id.localeCompare(b2.id));
17782       };
17783       var relsA = sortedParentRelations(ids[0]);
17784       for (i3 = 1; i3 < ids.length; i3++) {
17785         var relsB = sortedParentRelations(ids[i3]);
17786         if (!utilArrayIdentical(relsA, relsB)) {
17787           return "conflicting_relations";
17788         }
17789       }
17790       for (i3 = 0; i3 < ids.length - 1; i3++) {
17791         for (var j2 = i3 + 1; j2 < ids.length; j2++) {
17792           var path1 = graph.childNodes(graph.entity(ids[i3])).map(function(e3) {
17793             return e3.loc;
17794           });
17795           var path2 = graph.childNodes(graph.entity(ids[j2])).map(function(e3) {
17796             return e3.loc;
17797           });
17798           var intersections = geoPathIntersections(path1, path2);
17799           var common = utilArrayIntersection(
17800             joined[0].nodes.map(function(n3) {
17801               return n3.loc.toString();
17802             }),
17803             intersections.map(function(n3) {
17804               return n3.toString();
17805             })
17806           );
17807           if (common.length !== intersections.length) {
17808             return "paths_intersect";
17809           }
17810         }
17811       }
17812       var nodeIds = joined[0].nodes.map(function(n3) {
17813         return n3.id;
17814       }).slice(1, -1);
17815       var relation;
17816       var tags = {};
17817       var conflicting = false;
17818       joined[0].forEach(function(way) {
17819         var parents = graph.parentRelations(way);
17820         parents.forEach(function(parent) {
17821           if ((parent.isRestriction() || parent.isConnectivity()) && parent.members.some(function(m2) {
17822             return nodeIds.indexOf(m2.id) >= 0;
17823           })) {
17824             relation = parent;
17825           }
17826         });
17827         for (var k2 in way.tags) {
17828           if (!(k2 in tags)) {
17829             tags[k2] = way.tags[k2];
17830           } else if (tags[k2] && osmIsInterestingTag(k2) && tags[k2] !== way.tags[k2]) {
17831             conflicting = true;
17832           }
17833         }
17834       });
17835       if (relation) {
17836         return relation.isRestriction() ? "restriction" : "connectivity";
17837       }
17838       if (conflicting) {
17839         return "conflicting_tags";
17840       }
17841     };
17842     return action;
17843   }
17844   var init_join2 = __esm({
17845     "modules/actions/join.js"() {
17846       "use strict";
17847       init_delete_relation();
17848       init_delete_way();
17849       init_tags();
17850       init_multipolygon();
17851       init_geo2();
17852       init_util();
17853     }
17854   });
17855
17856   // modules/actions/merge.js
17857   var merge_exports = {};
17858   __export(merge_exports, {
17859     actionMerge: () => actionMerge
17860   });
17861   function actionMerge(ids) {
17862     function groupEntitiesByGeometry(graph) {
17863       var entities = ids.map(function(id2) {
17864         return graph.entity(id2);
17865       });
17866       return Object.assign(
17867         { point: [], area: [], line: [], relation: [] },
17868         utilArrayGroupBy(entities, function(entity) {
17869           return entity.geometry(graph);
17870         })
17871       );
17872     }
17873     var action = function(graph) {
17874       var geometries = groupEntitiesByGeometry(graph);
17875       var target = geometries.area[0] || geometries.line[0];
17876       var points = geometries.point;
17877       points.forEach(function(point) {
17878         target = target.mergeTags(point.tags);
17879         graph = graph.replace(target);
17880         graph.parentRelations(point).forEach(function(parent) {
17881           graph = graph.replace(parent.replaceMember(point, target));
17882         });
17883         var nodes = utilArrayUniq(graph.childNodes(target));
17884         var removeNode = point;
17885         if (!point.isNew()) {
17886           var inserted = false;
17887           var canBeReplaced = function(node2) {
17888             return !(graph.parentWays(node2).length > 1 || graph.parentRelations(node2).length);
17889           };
17890           var replaceNode = function(node2) {
17891             graph = graph.replace(point.update({ tags: node2.tags, loc: node2.loc }));
17892             target = target.replaceNode(node2.id, point.id);
17893             graph = graph.replace(target);
17894             removeNode = node2;
17895             inserted = true;
17896           };
17897           var i3;
17898           var node;
17899           for (i3 = 0; i3 < nodes.length; i3++) {
17900             node = nodes[i3];
17901             if (canBeReplaced(node) && node.isNew()) {
17902               replaceNode(node);
17903               break;
17904             }
17905           }
17906           if (!inserted && point.hasInterestingTags()) {
17907             for (i3 = 0; i3 < nodes.length; i3++) {
17908               node = nodes[i3];
17909               if (canBeReplaced(node) && !node.hasInterestingTags()) {
17910                 replaceNode(node);
17911                 break;
17912               }
17913             }
17914             if (!inserted) {
17915               for (i3 = 0; i3 < nodes.length; i3++) {
17916                 node = nodes[i3];
17917                 if (canBeReplaced(node) && utilCompareIDs(point.id, node.id) < 0) {
17918                   replaceNode(node);
17919                   break;
17920                 }
17921               }
17922             }
17923           }
17924         }
17925         graph = graph.remove(removeNode);
17926       });
17927       if (target.tags.area === "yes") {
17928         var tags = Object.assign({}, target.tags);
17929         delete tags.area;
17930         if (osmTagSuggestingArea(tags)) {
17931           target = target.update({ tags });
17932           graph = graph.replace(target);
17933         }
17934       }
17935       return graph;
17936     };
17937     action.disabled = function(graph) {
17938       var geometries = groupEntitiesByGeometry(graph);
17939       if (geometries.point.length === 0 || geometries.area.length + geometries.line.length !== 1 || geometries.relation.length !== 0) {
17940         return "not_eligible";
17941       }
17942     };
17943     return action;
17944   }
17945   var init_merge5 = __esm({
17946     "modules/actions/merge.js"() {
17947       "use strict";
17948       init_tags();
17949       init_util();
17950     }
17951   });
17952
17953   // modules/actions/merge_nodes.js
17954   var merge_nodes_exports = {};
17955   __export(merge_nodes_exports, {
17956     actionMergeNodes: () => actionMergeNodes
17957   });
17958   function actionMergeNodes(nodeIDs, loc) {
17959     function chooseLoc(graph) {
17960       if (!nodeIDs.length) return null;
17961       var sum = [0, 0];
17962       var interestingCount = 0;
17963       var interestingLoc;
17964       for (var i3 = 0; i3 < nodeIDs.length; i3++) {
17965         var node = graph.entity(nodeIDs[i3]);
17966         if (node.hasInterestingTags()) {
17967           interestingLoc = ++interestingCount === 1 ? node.loc : null;
17968         }
17969         sum = geoVecAdd(sum, node.loc);
17970       }
17971       return interestingLoc || geoVecScale(sum, 1 / nodeIDs.length);
17972     }
17973     var action = function(graph) {
17974       if (nodeIDs.length < 2) return graph;
17975       var toLoc = loc;
17976       if (!toLoc) {
17977         toLoc = chooseLoc(graph);
17978       }
17979       for (var i3 = 0; i3 < nodeIDs.length; i3++) {
17980         var node = graph.entity(nodeIDs[i3]);
17981         if (node.loc !== toLoc) {
17982           graph = graph.replace(node.move(toLoc));
17983         }
17984       }
17985       return actionConnect(nodeIDs)(graph);
17986     };
17987     action.disabled = function(graph) {
17988       if (nodeIDs.length < 2) return "not_eligible";
17989       for (var i3 = 0; i3 < nodeIDs.length; i3++) {
17990         var entity = graph.entity(nodeIDs[i3]);
17991         if (entity.type !== "node") return "not_eligible";
17992       }
17993       return actionConnect(nodeIDs).disabled(graph);
17994     };
17995     return action;
17996   }
17997   var init_merge_nodes = __esm({
17998     "modules/actions/merge_nodes.js"() {
17999       "use strict";
18000       init_connect();
18001       init_geo2();
18002     }
18003   });
18004
18005   // modules/osm/changeset.js
18006   var changeset_exports = {};
18007   __export(changeset_exports, {
18008     osmChangeset: () => osmChangeset
18009   });
18010   function osmChangeset() {
18011     if (!(this instanceof osmChangeset)) {
18012       return new osmChangeset().initialize(arguments);
18013     } else if (arguments.length) {
18014       this.initialize(arguments);
18015     }
18016   }
18017   var init_changeset = __esm({
18018     "modules/osm/changeset.js"() {
18019       "use strict";
18020       init_entity();
18021       init_geo2();
18022       osmEntity.changeset = osmChangeset;
18023       osmChangeset.prototype = Object.create(osmEntity.prototype);
18024       Object.assign(osmChangeset.prototype, {
18025         type: "changeset",
18026         extent: function() {
18027           return new geoExtent();
18028         },
18029         geometry: function() {
18030           return "changeset";
18031         },
18032         asJXON: function() {
18033           return {
18034             osm: {
18035               changeset: {
18036                 tag: Object.keys(this.tags).map(function(k2) {
18037                   return { "@k": k2, "@v": this.tags[k2] };
18038                 }, this),
18039                 "@version": 0.6,
18040                 "@generator": "iD"
18041               }
18042             }
18043           };
18044         },
18045         // Generate [osmChange](http://wiki.openstreetmap.org/wiki/OsmChange)
18046         // XML. Returns a string.
18047         osmChangeJXON: function(changes) {
18048           var changeset_id = this.id;
18049           function nest(x2, order) {
18050             var groups = {};
18051             for (var i3 = 0; i3 < x2.length; i3++) {
18052               var tagName = Object.keys(x2[i3])[0];
18053               if (!groups[tagName]) groups[tagName] = [];
18054               groups[tagName].push(x2[i3][tagName]);
18055             }
18056             var ordered = {};
18057             order.forEach(function(o2) {
18058               if (groups[o2]) ordered[o2] = groups[o2];
18059             });
18060             return ordered;
18061           }
18062           function sort(changes2) {
18063             function resolve(item) {
18064               return relations.find(function(relation2) {
18065                 return item.keyAttributes.type === "relation" && item.keyAttributes.ref === relation2["@id"];
18066               });
18067             }
18068             function isNew(item) {
18069               return !sorted[item["@id"]] && !processing.find(function(proc) {
18070                 return proc["@id"] === item["@id"];
18071               });
18072             }
18073             var processing = [];
18074             var sorted = {};
18075             var relations = changes2.relation;
18076             if (!relations) return changes2;
18077             for (var i3 = 0; i3 < relations.length; i3++) {
18078               var relation = relations[i3];
18079               if (!sorted[relation["@id"]]) {
18080                 processing.push(relation);
18081               }
18082               while (processing.length > 0) {
18083                 var next = processing[0], deps = next.member.map(resolve).filter(Boolean).filter(isNew);
18084                 if (deps.length === 0) {
18085                   sorted[next["@id"]] = next;
18086                   processing.shift();
18087                 } else {
18088                   processing = deps.concat(processing);
18089                 }
18090               }
18091             }
18092             changes2.relation = Object.values(sorted);
18093             return changes2;
18094           }
18095           function rep(entity) {
18096             return entity.asJXON(changeset_id);
18097           }
18098           return {
18099             osmChange: {
18100               "@version": 0.6,
18101               "@generator": "iD",
18102               "create": sort(nest(changes.created.map(rep), ["node", "way", "relation"])),
18103               "modify": nest(changes.modified.map(rep), ["node", "way", "relation"]),
18104               "delete": Object.assign(nest(changes.deleted.map(rep), ["relation", "way", "node"]), { "@if-unused": true })
18105             }
18106           };
18107         },
18108         asGeoJSON: function() {
18109           return {};
18110         }
18111       });
18112     }
18113   });
18114
18115   // modules/osm/note.js
18116   var note_exports = {};
18117   __export(note_exports, {
18118     osmNote: () => osmNote
18119   });
18120   function osmNote() {
18121     if (!(this instanceof osmNote)) {
18122       return new osmNote().initialize(arguments);
18123     } else if (arguments.length) {
18124       this.initialize(arguments);
18125     }
18126   }
18127   var init_note = __esm({
18128     "modules/osm/note.js"() {
18129       "use strict";
18130       init_geo2();
18131       osmNote.id = function() {
18132         return osmNote.id.next--;
18133       };
18134       osmNote.id.next = -1;
18135       Object.assign(osmNote.prototype, {
18136         type: "note",
18137         initialize: function(sources) {
18138           for (var i3 = 0; i3 < sources.length; ++i3) {
18139             var source = sources[i3];
18140             for (var prop in source) {
18141               if (Object.prototype.hasOwnProperty.call(source, prop)) {
18142                 if (source[prop] === void 0) {
18143                   delete this[prop];
18144                 } else {
18145                   this[prop] = source[prop];
18146                 }
18147               }
18148             }
18149           }
18150           if (!this.id) {
18151             this.id = osmNote.id().toString();
18152           }
18153           return this;
18154         },
18155         extent: function() {
18156           return new geoExtent(this.loc);
18157         },
18158         update: function(attrs) {
18159           return osmNote(this, attrs);
18160         },
18161         isNew: function() {
18162           return this.id < 0;
18163         },
18164         move: function(loc) {
18165           return this.update({ loc });
18166         }
18167       });
18168     }
18169   });
18170
18171   // modules/osm/relation.js
18172   var relation_exports = {};
18173   __export(relation_exports, {
18174     osmRelation: () => osmRelation
18175   });
18176   function osmRelation() {
18177     if (!(this instanceof osmRelation)) {
18178       return new osmRelation().initialize(arguments);
18179     } else if (arguments.length) {
18180       this.initialize(arguments);
18181     }
18182   }
18183   var prototype2;
18184   var init_relation = __esm({
18185     "modules/osm/relation.js"() {
18186       "use strict";
18187       init_src2();
18188       init_entity();
18189       init_multipolygon();
18190       init_geo2();
18191       osmEntity.relation = osmRelation;
18192       osmRelation.prototype = Object.create(osmEntity.prototype);
18193       osmRelation.creationOrder = function(a2, b2) {
18194         var aId = parseInt(osmEntity.id.toOSM(a2.id), 10);
18195         var bId = parseInt(osmEntity.id.toOSM(b2.id), 10);
18196         if (aId < 0 || bId < 0) return aId - bId;
18197         return bId - aId;
18198       };
18199       prototype2 = {
18200         type: "relation",
18201         members: [],
18202         copy: function(resolver, copies) {
18203           if (copies[this.id]) return copies[this.id];
18204           var copy2 = osmEntity.prototype.copy.call(this, resolver, copies);
18205           var members = this.members.map(function(member) {
18206             return Object.assign({}, member, { id: resolver.entity(member.id).copy(resolver, copies).id });
18207           });
18208           copy2 = copy2.update({ members });
18209           copies[this.id] = copy2;
18210           return copy2;
18211         },
18212         extent: function(resolver, memo) {
18213           return resolver.transient(this, "extent", function() {
18214             if (memo && memo[this.id]) return geoExtent();
18215             memo = memo || {};
18216             memo[this.id] = true;
18217             var extent = geoExtent();
18218             for (var i3 = 0; i3 < this.members.length; i3++) {
18219               var member = resolver.hasEntity(this.members[i3].id);
18220               if (member) {
18221                 extent._extend(member.extent(resolver, memo));
18222               }
18223             }
18224             return extent;
18225           });
18226         },
18227         geometry: function(graph) {
18228           return graph.transient(this, "geometry", function() {
18229             return this.isMultipolygon() ? "area" : "relation";
18230           });
18231         },
18232         isDegenerate: function() {
18233           return this.members.length === 0;
18234         },
18235         // Return an array of members, each extended with an 'index' property whose value
18236         // is the member index.
18237         indexedMembers: function() {
18238           var result = new Array(this.members.length);
18239           for (var i3 = 0; i3 < this.members.length; i3++) {
18240             result[i3] = Object.assign({}, this.members[i3], { index: i3 });
18241           }
18242           return result;
18243         },
18244         // Return the first member with the given role. A copy of the member object
18245         // is returned, extended with an 'index' property whose value is the member index.
18246         memberByRole: function(role) {
18247           for (var i3 = 0; i3 < this.members.length; i3++) {
18248             if (this.members[i3].role === role) {
18249               return Object.assign({}, this.members[i3], { index: i3 });
18250             }
18251           }
18252         },
18253         // Same as memberByRole, but returns all members with the given role
18254         membersByRole: function(role) {
18255           var result = [];
18256           for (var i3 = 0; i3 < this.members.length; i3++) {
18257             if (this.members[i3].role === role) {
18258               result.push(Object.assign({}, this.members[i3], { index: i3 }));
18259             }
18260           }
18261           return result;
18262         },
18263         // Return the first member with the given id. A copy of the member object
18264         // is returned, extended with an 'index' property whose value is the member index.
18265         memberById: function(id2) {
18266           for (var i3 = 0; i3 < this.members.length; i3++) {
18267             if (this.members[i3].id === id2) {
18268               return Object.assign({}, this.members[i3], { index: i3 });
18269             }
18270           }
18271         },
18272         // Return the first member with the given id and role. A copy of the member object
18273         // is returned, extended with an 'index' property whose value is the member index.
18274         memberByIdAndRole: function(id2, role) {
18275           for (var i3 = 0; i3 < this.members.length; i3++) {
18276             if (this.members[i3].id === id2 && this.members[i3].role === role) {
18277               return Object.assign({}, this.members[i3], { index: i3 });
18278             }
18279           }
18280         },
18281         addMember: function(member, index) {
18282           var members = this.members.slice();
18283           members.splice(index === void 0 ? members.length : index, 0, member);
18284           return this.update({ members });
18285         },
18286         updateMember: function(member, index) {
18287           var members = this.members.slice();
18288           members.splice(index, 1, Object.assign({}, members[index], member));
18289           return this.update({ members });
18290         },
18291         removeMember: function(index) {
18292           var members = this.members.slice();
18293           members.splice(index, 1);
18294           return this.update({ members });
18295         },
18296         removeMembersWithID: function(id2) {
18297           var members = this.members.filter(function(m2) {
18298             return m2.id !== id2;
18299           });
18300           return this.update({ members });
18301         },
18302         moveMember: function(fromIndex, toIndex) {
18303           var members = this.members.slice();
18304           members.splice(toIndex, 0, members.splice(fromIndex, 1)[0]);
18305           return this.update({ members });
18306         },
18307         // Wherever a member appears with id `needle.id`, replace it with a member
18308         // with id `replacement.id`, type `replacement.type`, and the original role,
18309         // By default, adding a duplicate member (by id and role) is prevented.
18310         // Return an updated relation.
18311         replaceMember: function(needle, replacement, keepDuplicates) {
18312           if (!this.memberById(needle.id)) return this;
18313           var members = [];
18314           for (var i3 = 0; i3 < this.members.length; i3++) {
18315             var member = this.members[i3];
18316             if (member.id !== needle.id) {
18317               members.push(member);
18318             } else if (keepDuplicates || !this.memberByIdAndRole(replacement.id, member.role)) {
18319               members.push({ id: replacement.id, type: replacement.type, role: member.role });
18320             }
18321           }
18322           return this.update({ members });
18323         },
18324         asJXON: function(changeset_id) {
18325           var r2 = {
18326             relation: {
18327               "@id": this.osmId(),
18328               "@version": this.version || 0,
18329               member: this.members.map(function(member) {
18330                 return {
18331                   keyAttributes: {
18332                     type: member.type,
18333                     role: member.role,
18334                     ref: osmEntity.id.toOSM(member.id)
18335                   }
18336                 };
18337               }, this),
18338               tag: Object.keys(this.tags).map(function(k2) {
18339                 return { keyAttributes: { k: k2, v: this.tags[k2] } };
18340               }, this)
18341             }
18342           };
18343           if (changeset_id) {
18344             r2.relation["@changeset"] = changeset_id;
18345           }
18346           return r2;
18347         },
18348         asGeoJSON: function(resolver) {
18349           return resolver.transient(this, "GeoJSON", function() {
18350             if (this.isMultipolygon()) {
18351               return {
18352                 type: "MultiPolygon",
18353                 coordinates: this.multipolygon(resolver)
18354               };
18355             } else {
18356               return {
18357                 type: "FeatureCollection",
18358                 properties: this.tags,
18359                 features: this.members.map(function(member) {
18360                   return Object.assign({ role: member.role }, resolver.entity(member.id).asGeoJSON(resolver));
18361                 })
18362               };
18363             }
18364           });
18365         },
18366         area: function(resolver) {
18367           return resolver.transient(this, "area", function() {
18368             return area_default(this.asGeoJSON(resolver));
18369           });
18370         },
18371         isMultipolygon: function() {
18372           return this.tags.type === "multipolygon";
18373         },
18374         isComplete: function(resolver) {
18375           for (var i3 = 0; i3 < this.members.length; i3++) {
18376             if (!resolver.hasEntity(this.members[i3].id)) {
18377               return false;
18378             }
18379           }
18380           return true;
18381         },
18382         hasFromViaTo: function() {
18383           return this.members.some(function(m2) {
18384             return m2.role === "from";
18385           }) && this.members.some(
18386             (m2) => m2.role === "via" || m2.role === "intersection" && this.tags.type === "destination_sign"
18387           ) && this.members.some(function(m2) {
18388             return m2.role === "to";
18389           });
18390         },
18391         isRestriction: function() {
18392           return !!(this.tags.type && this.tags.type.match(/^restriction:?/));
18393         },
18394         isValidRestriction: function() {
18395           if (!this.isRestriction()) return false;
18396           var froms = this.members.filter(function(m2) {
18397             return m2.role === "from";
18398           });
18399           var vias = this.members.filter(function(m2) {
18400             return m2.role === "via";
18401           });
18402           var tos = this.members.filter(function(m2) {
18403             return m2.role === "to";
18404           });
18405           if (froms.length !== 1 && this.tags.restriction !== "no_entry") return false;
18406           if (froms.some(function(m2) {
18407             return m2.type !== "way";
18408           })) return false;
18409           if (tos.length !== 1 && this.tags.restriction !== "no_exit") return false;
18410           if (tos.some(function(m2) {
18411             return m2.type !== "way";
18412           })) return false;
18413           if (vias.length === 0) return false;
18414           if (vias.length > 1 && vias.some(function(m2) {
18415             return m2.type !== "way";
18416           })) return false;
18417           return true;
18418         },
18419         isConnectivity: function() {
18420           return !!(this.tags.type && this.tags.type.match(/^connectivity:?/));
18421         },
18422         // Returns an array [A0, ... An], each Ai being an array of node arrays [Nds0, ... Ndsm],
18423         // where Nds0 is an outer ring and subsequent Ndsi's (if any i > 0) being inner rings.
18424         //
18425         // This corresponds to the structure needed for rendering a multipolygon path using a
18426         // `evenodd` fill rule, as well as the structure of a GeoJSON MultiPolygon geometry.
18427         //
18428         // In the case of invalid geometries, this function will still return a result which
18429         // includes the nodes of all way members, but some Nds may be unclosed and some inner
18430         // rings not matched with the intended outer ring.
18431         //
18432         multipolygon: function(resolver) {
18433           var outers = this.members.filter(function(m2) {
18434             return "outer" === (m2.role || "outer");
18435           });
18436           var inners = this.members.filter(function(m2) {
18437             return "inner" === m2.role;
18438           });
18439           outers = osmJoinWays(outers, resolver);
18440           inners = osmJoinWays(inners, resolver);
18441           var sequenceToLineString = function(sequence) {
18442             if (sequence.nodes.length > 2 && sequence.nodes[0] !== sequence.nodes[sequence.nodes.length - 1]) {
18443               sequence.nodes.push(sequence.nodes[0]);
18444             }
18445             return sequence.nodes.map(function(node) {
18446               return node.loc;
18447             });
18448           };
18449           outers = outers.map(sequenceToLineString);
18450           inners = inners.map(sequenceToLineString);
18451           var result = outers.map(function(o3) {
18452             return [area_default({ type: "Polygon", coordinates: [o3] }) > 2 * Math.PI ? o3.reverse() : o3];
18453           });
18454           function findOuter(inner2) {
18455             var o3, outer;
18456             for (o3 = 0; o3 < outers.length; o3++) {
18457               outer = outers[o3];
18458               if (geoPolygonContainsPolygon(outer, inner2)) {
18459                 return o3;
18460               }
18461             }
18462             for (o3 = 0; o3 < outers.length; o3++) {
18463               outer = outers[o3];
18464               if (geoPolygonIntersectsPolygon(outer, inner2, false)) {
18465                 return o3;
18466               }
18467             }
18468           }
18469           for (var i3 = 0; i3 < inners.length; i3++) {
18470             var inner = inners[i3];
18471             if (area_default({ type: "Polygon", coordinates: [inner] }) < 2 * Math.PI) {
18472               inner = inner.reverse();
18473             }
18474             var o2 = findOuter(inners[i3]);
18475             if (o2 !== void 0) {
18476               result[o2].push(inners[i3]);
18477             } else {
18478               result.push([inners[i3]]);
18479             }
18480           }
18481           return result;
18482         }
18483       };
18484       Object.assign(osmRelation.prototype, prototype2);
18485     }
18486   });
18487
18488   // modules/osm/qa_item.js
18489   var qa_item_exports = {};
18490   __export(qa_item_exports, {
18491     QAItem: () => QAItem
18492   });
18493   var QAItem;
18494   var init_qa_item = __esm({
18495     "modules/osm/qa_item.js"() {
18496       "use strict";
18497       QAItem = class _QAItem {
18498         constructor(loc, service, itemType, id2, props) {
18499           this.loc = loc;
18500           this.service = service.title;
18501           this.itemType = itemType;
18502           this.id = id2 ? id2 : `${_QAItem.id()}`;
18503           this.update(props);
18504           if (service && typeof service.getIcon === "function") {
18505             this.icon = service.getIcon(itemType);
18506           }
18507         }
18508         update(props) {
18509           const { loc, service, itemType, id: id2 } = this;
18510           Object.keys(props).forEach((prop) => this[prop] = props[prop]);
18511           this.loc = loc;
18512           this.service = service;
18513           this.itemType = itemType;
18514           this.id = id2;
18515           return this;
18516         }
18517         // Generic handling for newly created QAItems
18518         static id() {
18519           return this.nextId--;
18520         }
18521       };
18522       QAItem.nextId = -1;
18523     }
18524   });
18525
18526   // modules/actions/split.js
18527   var split_exports = {};
18528   __export(split_exports, {
18529     actionSplit: () => actionSplit
18530   });
18531   function actionSplit(nodeIds, newWayIds) {
18532     if (typeof nodeIds === "string") nodeIds = [nodeIds];
18533     var _wayIDs;
18534     var _keepHistoryOn = "longest";
18535     const circularJunctions = ["roundabout", "circular"];
18536     var _createdWayIDs = [];
18537     function dist(graph, nA, nB) {
18538       var locA = graph.entity(nA).loc;
18539       var locB = graph.entity(nB).loc;
18540       var epsilon3 = 1e-6;
18541       return locA && locB ? geoSphericalDistance(locA, locB) : epsilon3;
18542     }
18543     function splitArea(nodes, idxA, graph) {
18544       var lengths = new Array(nodes.length);
18545       var length2;
18546       var i3;
18547       var best = 0;
18548       var idxB;
18549       function wrap2(index) {
18550         return utilWrap(index, nodes.length);
18551       }
18552       length2 = 0;
18553       for (i3 = wrap2(idxA + 1); i3 !== idxA; i3 = wrap2(i3 + 1)) {
18554         length2 += dist(graph, nodes[i3], nodes[wrap2(i3 - 1)]);
18555         lengths[i3] = length2;
18556       }
18557       length2 = 0;
18558       for (i3 = wrap2(idxA - 1); i3 !== idxA; i3 = wrap2(i3 - 1)) {
18559         length2 += dist(graph, nodes[i3], nodes[wrap2(i3 + 1)]);
18560         if (length2 < lengths[i3]) {
18561           lengths[i3] = length2;
18562         }
18563       }
18564       for (i3 = 0; i3 < nodes.length; i3++) {
18565         var cost = lengths[i3] / dist(graph, nodes[idxA], nodes[i3]);
18566         if (cost > best) {
18567           idxB = i3;
18568           best = cost;
18569         }
18570       }
18571       return idxB;
18572     }
18573     function totalLengthBetweenNodes(graph, nodes) {
18574       var totalLength = 0;
18575       for (var i3 = 0; i3 < nodes.length - 1; i3++) {
18576         totalLength += dist(graph, nodes[i3], nodes[i3 + 1]);
18577       }
18578       return totalLength;
18579     }
18580     function split(graph, nodeId, wayA, newWayId, otherNodeIds) {
18581       var wayB = osmWay({ id: newWayId, tags: wayA.tags });
18582       var nodesA;
18583       var nodesB;
18584       var isArea = wayA.isArea();
18585       if (wayA.isClosed()) {
18586         var nodes = wayA.nodes.slice(0, -1);
18587         var idxA = nodes.indexOf(nodeId);
18588         var idxB = otherNodeIds.length > 0 ? nodes.indexOf(otherNodeIds[0]) : splitArea(nodes, idxA, graph);
18589         if (idxB < idxA) {
18590           nodesA = nodes.slice(idxA).concat(nodes.slice(0, idxB + 1));
18591           nodesB = nodes.slice(idxB, idxA + 1);
18592         } else {
18593           nodesA = nodes.slice(idxA, idxB + 1);
18594           nodesB = nodes.slice(idxB).concat(nodes.slice(0, idxA + 1));
18595         }
18596       } else {
18597         var idx = wayA.nodes.indexOf(nodeId, 1);
18598         nodesA = wayA.nodes.slice(0, idx + 1);
18599         nodesB = wayA.nodes.slice(idx);
18600       }
18601       var lengthA = totalLengthBetweenNodes(graph, nodesA);
18602       var lengthB = totalLengthBetweenNodes(graph, nodesB);
18603       if (_keepHistoryOn === "longest" && lengthB > lengthA) {
18604         wayA = wayA.update({ nodes: nodesB });
18605         wayB = wayB.update({ nodes: nodesA });
18606         var temp = lengthA;
18607         lengthA = lengthB;
18608         lengthB = temp;
18609       } else {
18610         wayA = wayA.update({ nodes: nodesA });
18611         wayB = wayB.update({ nodes: nodesB });
18612       }
18613       if (wayA.tags.step_count) {
18614         var stepCount = Number(wayA.tags.step_count);
18615         if (stepCount && // ensure a number
18616         isFinite(stepCount) && // ensure positive
18617         stepCount > 0 && // ensure integer
18618         Math.round(stepCount) === stepCount) {
18619           var tagsA = Object.assign({}, wayA.tags);
18620           var tagsB = Object.assign({}, wayB.tags);
18621           var ratioA = lengthA / (lengthA + lengthB);
18622           var countA = Math.round(stepCount * ratioA);
18623           tagsA.step_count = countA.toString();
18624           tagsB.step_count = (stepCount - countA).toString();
18625           wayA = wayA.update({ tags: tagsA });
18626           wayB = wayB.update({ tags: tagsB });
18627         }
18628       }
18629       graph = graph.replace(wayA);
18630       graph = graph.replace(wayB);
18631       graph.parentRelations(wayA).forEach(function(relation) {
18632         if (relation.hasFromViaTo()) {
18633           var f2 = relation.memberByRole("from");
18634           var v2 = [
18635             ...relation.membersByRole("via"),
18636             ...relation.membersByRole("intersection")
18637           ];
18638           var t2 = relation.memberByRole("to");
18639           var i3;
18640           if (f2.id === wayA.id || t2.id === wayA.id) {
18641             var keepB = false;
18642             if (v2.length === 1 && v2[0].type === "node") {
18643               keepB = wayB.contains(v2[0].id);
18644             } else {
18645               for (i3 = 0; i3 < v2.length; i3++) {
18646                 if (v2[i3].type === "way") {
18647                   var wayVia = graph.hasEntity(v2[i3].id);
18648                   if (wayVia && utilArrayIntersection(wayB.nodes, wayVia.nodes).length) {
18649                     keepB = true;
18650                     break;
18651                   }
18652                 }
18653               }
18654             }
18655             if (keepB) {
18656               relation = relation.replaceMember(wayA, wayB);
18657               graph = graph.replace(relation);
18658             }
18659           } else {
18660             for (i3 = 0; i3 < v2.length; i3++) {
18661               if (v2[i3].type === "way" && v2[i3].id === wayA.id) {
18662                 graph = splitWayMember(graph, relation.id, wayA, wayB);
18663               }
18664             }
18665           }
18666         } else {
18667           graph = splitWayMember(graph, relation.id, wayA, wayB);
18668         }
18669       });
18670       if (isArea) {
18671         var multipolygon = osmRelation({
18672           tags: Object.assign({}, wayA.tags, { type: "multipolygon" }),
18673           members: [
18674             { id: wayA.id, role: "outer", type: "way" },
18675             { id: wayB.id, role: "outer", type: "way" }
18676           ]
18677         });
18678         graph = graph.replace(multipolygon);
18679         graph = graph.replace(wayA.update({ tags: {} }));
18680         graph = graph.replace(wayB.update({ tags: {} }));
18681       }
18682       _createdWayIDs.push(wayB.id);
18683       return graph;
18684     }
18685     function splitWayMember(graph, relationId, wayA, wayB) {
18686       function connects(way1, way2) {
18687         if (way1.nodes.length < 2 || way2.nodes.length < 2) return false;
18688         if (circularJunctions.includes(way1.tags.junction) && way1.isClosed()) {
18689           return way1.nodes.some((nodeId) => nodeId === way2.nodes[0] || nodeId === way2.nodes[way2.nodes.length - 1]);
18690         } else if (circularJunctions.includes(way2.tags.junction) && way2.isClosed()) {
18691           return way2.nodes.some((nodeId) => nodeId === way1.nodes[0] || nodeId === way1.nodes[way1.nodes.length - 1]);
18692         }
18693         if (way1.nodes[0] === way2.nodes[0]) return true;
18694         if (way1.nodes[0] === way2.nodes[way2.nodes.length - 1]) return true;
18695         if (way1.nodes[way1.nodes.length - 1] === way2.nodes[way2.nodes.length - 1]) return true;
18696         if (way1.nodes[way1.nodes.length - 1] === way2.nodes[0]) return true;
18697         return false;
18698       }
18699       let relation = graph.entity(relationId);
18700       const insertMembers = [];
18701       const members = relation.members;
18702       for (let i3 = 0; i3 < members.length; i3++) {
18703         const member = members[i3];
18704         if (member.id === wayA.id) {
18705           let wayAconnectsPrev = false;
18706           let wayAconnectsNext = false;
18707           let wayBconnectsPrev = false;
18708           let wayBconnectsNext = false;
18709           if (i3 > 0 && graph.hasEntity(members[i3 - 1].id)) {
18710             const prevEntity = graph.entity(members[i3 - 1].id);
18711             if (prevEntity.type === "way") {
18712               wayAconnectsPrev = connects(prevEntity, wayA);
18713               wayBconnectsPrev = connects(prevEntity, wayB);
18714             }
18715           }
18716           if (i3 < members.length - 1 && graph.hasEntity(members[i3 + 1].id)) {
18717             const nextEntity = graph.entity(members[i3 + 1].id);
18718             if (nextEntity.type === "way") {
18719               wayAconnectsNext = connects(nextEntity, wayA);
18720               wayBconnectsNext = connects(nextEntity, wayB);
18721             }
18722           }
18723           if (wayAconnectsPrev && !wayAconnectsNext || !wayBconnectsPrev && wayBconnectsNext && !(!wayAconnectsPrev && wayAconnectsNext)) {
18724             insertMembers.push({ at: i3 + 1, role: member.role });
18725             continue;
18726           }
18727           if (!wayAconnectsPrev && wayAconnectsNext || wayBconnectsPrev && !wayBconnectsNext && !(wayAconnectsPrev && !wayAconnectsNext)) {
18728             insertMembers.push({ at: i3, role: member.role });
18729             continue;
18730           }
18731           if (wayAconnectsPrev && wayBconnectsPrev && wayAconnectsNext && wayBconnectsNext) {
18732             if (i3 > 2 && graph.hasEntity(members[i3 - 2].id)) {
18733               const prev2Entity = graph.entity(members[i3 - 2].id);
18734               if (connects(prev2Entity, wayA) && !connects(prev2Entity, wayB)) {
18735                 insertMembers.push({ at: i3, role: member.role });
18736                 continue;
18737               }
18738               if (connects(prev2Entity, wayB) && !connects(prev2Entity, wayA)) {
18739                 insertMembers.push({ at: i3 + 1, role: member.role });
18740                 continue;
18741               }
18742             }
18743             if (i3 < members.length - 2 && graph.hasEntity(members[i3 + 2].id)) {
18744               const next2Entity = graph.entity(members[i3 + 2].id);
18745               if (connects(next2Entity, wayA) && !connects(next2Entity, wayB)) {
18746                 insertMembers.push({ at: i3 + 1, role: member.role });
18747                 continue;
18748               }
18749               if (connects(next2Entity, wayB) && !connects(next2Entity, wayA)) {
18750                 insertMembers.push({ at: i3, role: member.role });
18751                 continue;
18752               }
18753             }
18754           }
18755           if (wayA.nodes[wayA.nodes.length - 1] === wayB.nodes[0]) {
18756             insertMembers.push({ at: i3 + 1, role: member.role });
18757           } else {
18758             insertMembers.push({ at: i3, role: member.role });
18759           }
18760         }
18761       }
18762       insertMembers.reverse().forEach((item) => {
18763         graph = graph.replace(relation.addMember({
18764           id: wayB.id,
18765           type: "way",
18766           role: item.role
18767         }, item.at));
18768         relation = graph.entity(relation.id);
18769       });
18770       return graph;
18771     }
18772     var action = function(graph) {
18773       _createdWayIDs = [];
18774       var newWayIndex = 0;
18775       for (var i3 = 0; i3 < nodeIds.length; i3++) {
18776         var nodeId = nodeIds[i3];
18777         var candidates = action.waysForNode(nodeId, graph);
18778         for (var j2 = 0; j2 < candidates.length; j2++) {
18779           graph = split(graph, nodeId, candidates[j2], newWayIds && newWayIds[newWayIndex], nodeIds.slice(j2 + 1));
18780           newWayIndex += 1;
18781         }
18782       }
18783       return graph;
18784     };
18785     action.getCreatedWayIDs = function() {
18786       return _createdWayIDs;
18787     };
18788     action.waysForNode = function(nodeId, graph) {
18789       var node = graph.entity(nodeId);
18790       var splittableParents = graph.parentWays(node).filter(isSplittable);
18791       if (!_wayIDs) {
18792         var hasLine = splittableParents.some(function(parent) {
18793           return parent.geometry(graph) === "line";
18794         });
18795         if (hasLine) {
18796           return splittableParents.filter(function(parent) {
18797             return parent.geometry(graph) === "line";
18798           });
18799         }
18800       }
18801       return splittableParents;
18802       function isSplittable(parent) {
18803         if (_wayIDs && _wayIDs.indexOf(parent.id) === -1) return false;
18804         if (parent.isClosed()) return true;
18805         for (var i3 = 1; i3 < parent.nodes.length - 1; i3++) {
18806           if (parent.nodes[i3] === nodeId) return true;
18807         }
18808         return false;
18809       }
18810     };
18811     action.ways = function(graph) {
18812       return utilArrayUniq([].concat.apply([], nodeIds.map(function(nodeId) {
18813         return action.waysForNode(nodeId, graph);
18814       })));
18815     };
18816     action.disabled = function(graph) {
18817       for (const nodeId of nodeIds) {
18818         const candidates = action.waysForNode(nodeId, graph);
18819         if (candidates.length === 0 || _wayIDs && _wayIDs.length !== candidates.length) {
18820           return "not_eligible";
18821         }
18822         for (const way of candidates) {
18823           const parentRelations = graph.parentRelations(way);
18824           for (const parentRelation of parentRelations) {
18825             if (parentRelation.hasFromViaTo()) {
18826               const vias = [
18827                 ...parentRelation.membersByRole("via"),
18828                 ...parentRelation.membersByRole("intersection")
18829               ];
18830               if (!vias.every((via) => graph.hasEntity(via.id))) {
18831                 return "parent_incomplete";
18832               }
18833             } else {
18834               for (let i3 = 0; i3 < parentRelation.members.length; i3++) {
18835                 if (parentRelation.members[i3].id === way.id) {
18836                   const memberBeforePresent = i3 > 0 && graph.hasEntity(parentRelation.members[i3 - 1].id);
18837                   const memberAfterPresent = i3 < parentRelation.members.length - 1 && graph.hasEntity(parentRelation.members[i3 + 1].id);
18838                   if (!memberBeforePresent && !memberAfterPresent && parentRelation.members.length > 1) {
18839                     return "parent_incomplete";
18840                   }
18841                 }
18842               }
18843             }
18844             const relTypesExceptions = ["junction", "enforcement"];
18845             if (circularJunctions.includes(way.tags.junction) && way.isClosed() && !relTypesExceptions.includes(parentRelation.tags.type)) {
18846               return "simple_roundabout";
18847             }
18848           }
18849         }
18850       }
18851     };
18852     action.limitWays = function(val) {
18853       if (!arguments.length) return _wayIDs;
18854       _wayIDs = val;
18855       return action;
18856     };
18857     action.keepHistoryOn = function(val) {
18858       if (!arguments.length) return _keepHistoryOn;
18859       _keepHistoryOn = val;
18860       return action;
18861     };
18862     return action;
18863   }
18864   var init_split = __esm({
18865     "modules/actions/split.js"() {
18866       "use strict";
18867       init_geo();
18868       init_relation();
18869       init_way();
18870       init_util();
18871     }
18872   });
18873
18874   // modules/core/graph.js
18875   var graph_exports = {};
18876   __export(graph_exports, {
18877     coreGraph: () => coreGraph
18878   });
18879   function coreGraph(other2, mutable) {
18880     if (!(this instanceof coreGraph)) return new coreGraph(other2, mutable);
18881     if (other2 instanceof coreGraph) {
18882       var base = other2.base();
18883       this.entities = Object.assign(Object.create(base.entities), other2.entities);
18884       this._parentWays = Object.assign(Object.create(base.parentWays), other2._parentWays);
18885       this._parentRels = Object.assign(Object.create(base.parentRels), other2._parentRels);
18886     } else {
18887       this.entities = /* @__PURE__ */ Object.create({});
18888       this._parentWays = /* @__PURE__ */ Object.create({});
18889       this._parentRels = /* @__PURE__ */ Object.create({});
18890       this.rebase(other2 || [], [this]);
18891     }
18892     this.transients = {};
18893     this._childNodes = {};
18894     this.frozen = !mutable;
18895   }
18896   var init_graph = __esm({
18897     "modules/core/graph.js"() {
18898       "use strict";
18899       init_index();
18900       init_util();
18901       coreGraph.prototype = {
18902         hasEntity: function(id2) {
18903           return this.entities[id2];
18904         },
18905         entity: function(id2) {
18906           var entity = this.entities[id2];
18907           if (!entity) {
18908             entity = this.entities.__proto__[id2];
18909           }
18910           if (!entity) {
18911             throw new Error("entity " + id2 + " not found");
18912           }
18913           return entity;
18914         },
18915         geometry: function(id2) {
18916           return this.entity(id2).geometry(this);
18917         },
18918         transient: function(entity, key, fn) {
18919           var id2 = entity.id;
18920           var transients = this.transients[id2] || (this.transients[id2] = {});
18921           if (transients[key] !== void 0) {
18922             return transients[key];
18923           }
18924           transients[key] = fn.call(entity);
18925           return transients[key];
18926         },
18927         parentWays: function(entity) {
18928           var parents = this._parentWays[entity.id];
18929           var result = [];
18930           if (parents) {
18931             parents.forEach(function(id2) {
18932               result.push(this.entity(id2));
18933             }, this);
18934           }
18935           return result;
18936         },
18937         isPoi: function(entity) {
18938           var parents = this._parentWays[entity.id];
18939           return !parents || parents.size === 0;
18940         },
18941         isShared: function(entity) {
18942           var parents = this._parentWays[entity.id];
18943           return parents && parents.size > 1;
18944         },
18945         parentRelations: function(entity) {
18946           var parents = this._parentRels[entity.id];
18947           var result = [];
18948           if (parents) {
18949             parents.forEach(function(id2) {
18950               result.push(this.entity(id2));
18951             }, this);
18952           }
18953           return result;
18954         },
18955         parentMultipolygons: function(entity) {
18956           return this.parentRelations(entity).filter(function(relation) {
18957             return relation.isMultipolygon();
18958           });
18959         },
18960         childNodes: function(entity) {
18961           if (this._childNodes[entity.id]) return this._childNodes[entity.id];
18962           if (!entity.nodes) return [];
18963           var nodes = [];
18964           for (var i3 = 0; i3 < entity.nodes.length; i3++) {
18965             nodes[i3] = this.entity(entity.nodes[i3]);
18966           }
18967           if (debug) Object.freeze(nodes);
18968           this._childNodes[entity.id] = nodes;
18969           return this._childNodes[entity.id];
18970         },
18971         base: function() {
18972           return {
18973             "entities": Object.getPrototypeOf(this.entities),
18974             "parentWays": Object.getPrototypeOf(this._parentWays),
18975             "parentRels": Object.getPrototypeOf(this._parentRels)
18976           };
18977         },
18978         // Unlike other graph methods, rebase mutates in place. This is because it
18979         // is used only during the history operation that merges newly downloaded
18980         // data into each state. To external consumers, it should appear as if the
18981         // graph always contained the newly downloaded data.
18982         rebase: function(entities, stack, force) {
18983           var base = this.base();
18984           var i3, j2, k2, id2;
18985           for (i3 = 0; i3 < entities.length; i3++) {
18986             var entity = entities[i3];
18987             if (!entity.visible || !force && base.entities[entity.id]) continue;
18988             base.entities[entity.id] = entity;
18989             this._updateCalculated(void 0, entity, base.parentWays, base.parentRels);
18990             if (entity.type === "way") {
18991               for (j2 = 0; j2 < entity.nodes.length; j2++) {
18992                 id2 = entity.nodes[j2];
18993                 for (k2 = 1; k2 < stack.length; k2++) {
18994                   var ents = stack[k2].entities;
18995                   if (ents.hasOwnProperty(id2) && ents[id2] === void 0) {
18996                     delete ents[id2];
18997                   }
18998                 }
18999               }
19000             }
19001           }
19002           for (i3 = 0; i3 < stack.length; i3++) {
19003             stack[i3]._updateRebased();
19004           }
19005         },
19006         _updateRebased: function() {
19007           var base = this.base();
19008           Object.keys(this._parentWays).forEach(function(child) {
19009             if (base.parentWays[child]) {
19010               base.parentWays[child].forEach(function(id2) {
19011                 if (!this.entities.hasOwnProperty(id2)) {
19012                   this._parentWays[child].add(id2);
19013                 }
19014               }, this);
19015             }
19016           }, this);
19017           Object.keys(this._parentRels).forEach(function(child) {
19018             if (base.parentRels[child]) {
19019               base.parentRels[child].forEach(function(id2) {
19020                 if (!this.entities.hasOwnProperty(id2)) {
19021                   this._parentRels[child].add(id2);
19022                 }
19023               }, this);
19024             }
19025           }, this);
19026           this.transients = {};
19027         },
19028         // Updates calculated properties (parentWays, parentRels) for the specified change
19029         _updateCalculated: function(oldentity, entity, parentWays, parentRels) {
19030           parentWays = parentWays || this._parentWays;
19031           parentRels = parentRels || this._parentRels;
19032           var type2 = entity && entity.type || oldentity && oldentity.type;
19033           var removed, added, i3;
19034           if (type2 === "way") {
19035             if (oldentity && entity) {
19036               removed = utilArrayDifference(oldentity.nodes, entity.nodes);
19037               added = utilArrayDifference(entity.nodes, oldentity.nodes);
19038             } else if (oldentity) {
19039               removed = oldentity.nodes;
19040               added = [];
19041             } else if (entity) {
19042               removed = [];
19043               added = entity.nodes;
19044             }
19045             for (i3 = 0; i3 < removed.length; i3++) {
19046               parentWays[removed[i3]] = new Set(parentWays[removed[i3]]);
19047               parentWays[removed[i3]].delete(oldentity.id);
19048             }
19049             for (i3 = 0; i3 < added.length; i3++) {
19050               parentWays[added[i3]] = new Set(parentWays[added[i3]]);
19051               parentWays[added[i3]].add(entity.id);
19052             }
19053           } else if (type2 === "relation") {
19054             var oldentityMemberIDs = oldentity ? oldentity.members.map(function(m2) {
19055               return m2.id;
19056             }) : [];
19057             var entityMemberIDs = entity ? entity.members.map(function(m2) {
19058               return m2.id;
19059             }) : [];
19060             if (oldentity && entity) {
19061               removed = utilArrayDifference(oldentityMemberIDs, entityMemberIDs);
19062               added = utilArrayDifference(entityMemberIDs, oldentityMemberIDs);
19063             } else if (oldentity) {
19064               removed = oldentityMemberIDs;
19065               added = [];
19066             } else if (entity) {
19067               removed = [];
19068               added = entityMemberIDs;
19069             }
19070             for (i3 = 0; i3 < removed.length; i3++) {
19071               parentRels[removed[i3]] = new Set(parentRels[removed[i3]]);
19072               parentRels[removed[i3]].delete(oldentity.id);
19073             }
19074             for (i3 = 0; i3 < added.length; i3++) {
19075               parentRels[added[i3]] = new Set(parentRels[added[i3]]);
19076               parentRels[added[i3]].add(entity.id);
19077             }
19078           }
19079         },
19080         replace: function(entity) {
19081           if (this.entities[entity.id] === entity) return this;
19082           return this.update(function() {
19083             this._updateCalculated(this.entities[entity.id], entity);
19084             this.entities[entity.id] = entity;
19085           });
19086         },
19087         remove: function(entity) {
19088           return this.update(function() {
19089             this._updateCalculated(entity, void 0);
19090             this.entities[entity.id] = void 0;
19091           });
19092         },
19093         revert: function(id2) {
19094           var baseEntity = this.base().entities[id2];
19095           var headEntity = this.entities[id2];
19096           if (headEntity === baseEntity) return this;
19097           return this.update(function() {
19098             this._updateCalculated(headEntity, baseEntity);
19099             delete this.entities[id2];
19100           });
19101         },
19102         update: function() {
19103           var graph = this.frozen ? coreGraph(this, true) : this;
19104           for (var i3 = 0; i3 < arguments.length; i3++) {
19105             arguments[i3].call(graph, graph);
19106           }
19107           if (this.frozen) graph.frozen = true;
19108           return graph;
19109         },
19110         // Obliterates any existing entities
19111         load: function(entities) {
19112           var base = this.base();
19113           this.entities = Object.create(base.entities);
19114           for (var i3 in entities) {
19115             this.entities[i3] = entities[i3];
19116             this._updateCalculated(base.entities[i3], this.entities[i3]);
19117           }
19118           return this;
19119         }
19120       };
19121     }
19122   });
19123
19124   // modules/osm/intersection.js
19125   var intersection_exports = {};
19126   __export(intersection_exports, {
19127     osmInferRestriction: () => osmInferRestriction,
19128     osmIntersection: () => osmIntersection,
19129     osmTurn: () => osmTurn
19130   });
19131   function osmTurn(turn) {
19132     if (!(this instanceof osmTurn)) {
19133       return new osmTurn(turn);
19134     }
19135     Object.assign(this, turn);
19136   }
19137   function osmIntersection(graph, startVertexId, maxDistance) {
19138     maxDistance = maxDistance || 30;
19139     var vgraph = coreGraph();
19140     var i3, j2, k2;
19141     function memberOfRestriction(entity) {
19142       return graph.parentRelations(entity).some(function(r2) {
19143         return r2.isRestriction();
19144       });
19145     }
19146     function isRoad(way2) {
19147       if (way2.isArea() || way2.isDegenerate()) return false;
19148       var roads = {
19149         "motorway": true,
19150         "motorway_link": true,
19151         "trunk": true,
19152         "trunk_link": true,
19153         "primary": true,
19154         "primary_link": true,
19155         "secondary": true,
19156         "secondary_link": true,
19157         "tertiary": true,
19158         "tertiary_link": true,
19159         "residential": true,
19160         "unclassified": true,
19161         "living_street": true,
19162         "service": true,
19163         "busway": true,
19164         "road": true,
19165         "track": true
19166       };
19167       return roads[way2.tags.highway];
19168     }
19169     var startNode = graph.entity(startVertexId);
19170     var checkVertices = [startNode];
19171     var checkWays;
19172     var vertices = [];
19173     var vertexIds = [];
19174     var vertex;
19175     var ways = [];
19176     var wayIds = [];
19177     var way;
19178     var nodes = [];
19179     var node;
19180     var parents = [];
19181     var parent;
19182     var actions = [];
19183     while (checkVertices.length) {
19184       vertex = checkVertices.pop();
19185       checkWays = graph.parentWays(vertex);
19186       var hasWays = false;
19187       for (i3 = 0; i3 < checkWays.length; i3++) {
19188         way = checkWays[i3];
19189         if (!isRoad(way) && !memberOfRestriction(way)) continue;
19190         ways.push(way);
19191         hasWays = true;
19192         nodes = utilArrayUniq(graph.childNodes(way));
19193         for (j2 = 0; j2 < nodes.length; j2++) {
19194           node = nodes[j2];
19195           if (node === vertex) continue;
19196           if (vertices.indexOf(node) !== -1) continue;
19197           if (geoSphericalDistance(node.loc, startNode.loc) > maxDistance) continue;
19198           var hasParents = false;
19199           parents = graph.parentWays(node);
19200           for (k2 = 0; k2 < parents.length; k2++) {
19201             parent = parents[k2];
19202             if (parent === way) continue;
19203             if (ways.indexOf(parent) !== -1) continue;
19204             if (!isRoad(parent)) continue;
19205             hasParents = true;
19206             break;
19207           }
19208           if (hasParents) {
19209             checkVertices.push(node);
19210           }
19211         }
19212       }
19213       if (hasWays) {
19214         vertices.push(vertex);
19215       }
19216     }
19217     vertices = utilArrayUniq(vertices);
19218     ways = utilArrayUniq(ways);
19219     ways.forEach(function(way2) {
19220       graph.childNodes(way2).forEach(function(node2) {
19221         vgraph = vgraph.replace(node2);
19222       });
19223       vgraph = vgraph.replace(way2);
19224       graph.parentRelations(way2).forEach(function(relation) {
19225         if (relation.isRestriction()) {
19226           if (relation.isValidRestriction(graph)) {
19227             vgraph = vgraph.replace(relation);
19228           } else if (relation.isComplete(graph)) {
19229             actions.push(actionDeleteRelation(relation.id));
19230           }
19231         }
19232       });
19233     });
19234     ways.forEach(function(w2) {
19235       var way2 = vgraph.entity(w2.id);
19236       if (way2.tags.oneway === "-1") {
19237         var action = actionReverse(way2.id, { reverseOneway: true });
19238         actions.push(action);
19239         vgraph = action(vgraph);
19240       }
19241     });
19242     var origCount = osmEntity.id.next.way;
19243     vertices.forEach(function(v2) {
19244       var splitAll = actionSplit([v2.id]).keepHistoryOn("first");
19245       if (!splitAll.disabled(vgraph)) {
19246         splitAll.ways(vgraph).forEach(function(way2) {
19247           var splitOne = actionSplit([v2.id]).limitWays([way2.id]).keepHistoryOn("first");
19248           actions.push(splitOne);
19249           vgraph = splitOne(vgraph);
19250         });
19251       }
19252     });
19253     osmEntity.id.next.way = origCount;
19254     vertexIds = vertices.map(function(v2) {
19255       return v2.id;
19256     });
19257     vertices = [];
19258     ways = [];
19259     vertexIds.forEach(function(id2) {
19260       var vertex2 = vgraph.entity(id2);
19261       var parents2 = vgraph.parentWays(vertex2);
19262       vertices.push(vertex2);
19263       ways = ways.concat(parents2);
19264     });
19265     vertices = utilArrayUniq(vertices);
19266     ways = utilArrayUniq(ways);
19267     vertexIds = vertices.map(function(v2) {
19268       return v2.id;
19269     });
19270     wayIds = ways.map(function(w2) {
19271       return w2.id;
19272     });
19273     function withMetadata(way2, vertexIds2) {
19274       var __oneWay = way2.isOneWay() && !way2.isBiDirectional();
19275       var __first = vertexIds2.indexOf(way2.first()) !== -1;
19276       var __last = vertexIds2.indexOf(way2.last()) !== -1;
19277       var __via = __first && __last;
19278       var __from = __first && !__oneWay || __last;
19279       var __to = __first || __last && !__oneWay;
19280       return way2.update({
19281         __first,
19282         __last,
19283         __from,
19284         __via,
19285         __to,
19286         __oneWay
19287       });
19288     }
19289     ways = [];
19290     wayIds.forEach(function(id2) {
19291       var way2 = withMetadata(vgraph.entity(id2), vertexIds);
19292       vgraph = vgraph.replace(way2);
19293       ways.push(way2);
19294     });
19295     var keepGoing;
19296     var removeWayIds = [];
19297     var removeVertexIds = [];
19298     do {
19299       keepGoing = false;
19300       checkVertices = vertexIds.slice();
19301       for (i3 = 0; i3 < checkVertices.length; i3++) {
19302         var vertexId = checkVertices[i3];
19303         vertex = vgraph.hasEntity(vertexId);
19304         if (!vertex) {
19305           if (vertexIds.indexOf(vertexId) !== -1) {
19306             vertexIds.splice(vertexIds.indexOf(vertexId), 1);
19307           }
19308           removeVertexIds.push(vertexId);
19309           continue;
19310         }
19311         parents = vgraph.parentWays(vertex);
19312         if (parents.length < 3) {
19313           if (vertexIds.indexOf(vertexId) !== -1) {
19314             vertexIds.splice(vertexIds.indexOf(vertexId), 1);
19315           }
19316         }
19317         if (parents.length === 2) {
19318           var a2 = parents[0];
19319           var b2 = parents[1];
19320           var aIsLeaf = a2 && !a2.__via;
19321           var bIsLeaf = b2 && !b2.__via;
19322           var leaf, survivor;
19323           if (aIsLeaf && !bIsLeaf) {
19324             leaf = a2;
19325             survivor = b2;
19326           } else if (!aIsLeaf && bIsLeaf) {
19327             leaf = b2;
19328             survivor = a2;
19329           }
19330           if (leaf && survivor) {
19331             survivor = withMetadata(survivor, vertexIds);
19332             vgraph = vgraph.replace(survivor).remove(leaf);
19333             removeWayIds.push(leaf.id);
19334             keepGoing = true;
19335           }
19336         }
19337         parents = vgraph.parentWays(vertex);
19338         if (parents.length < 2) {
19339           if (vertexIds.indexOf(vertexId) !== -1) {
19340             vertexIds.splice(vertexIds.indexOf(vertexId), 1);
19341           }
19342           removeVertexIds.push(vertexId);
19343           keepGoing = true;
19344         }
19345         if (parents.length < 1) {
19346           vgraph = vgraph.remove(vertex);
19347         }
19348       }
19349     } while (keepGoing);
19350     vertices = vertices.filter(function(vertex2) {
19351       return removeVertexIds.indexOf(vertex2.id) === -1;
19352     }).map(function(vertex2) {
19353       return vgraph.entity(vertex2.id);
19354     });
19355     ways = ways.filter(function(way2) {
19356       return removeWayIds.indexOf(way2.id) === -1;
19357     }).map(function(way2) {
19358       return vgraph.entity(way2.id);
19359     });
19360     var intersection2 = {
19361       graph: vgraph,
19362       actions,
19363       vertices,
19364       ways
19365     };
19366     intersection2.turns = function(fromWayId, maxViaWay) {
19367       if (!fromWayId) return [];
19368       if (!maxViaWay) maxViaWay = 0;
19369       var vgraph2 = intersection2.graph;
19370       var keyVertexIds = intersection2.vertices.map(function(v2) {
19371         return v2.id;
19372       });
19373       var start2 = vgraph2.entity(fromWayId);
19374       if (!start2 || !(start2.__from || start2.__via)) return [];
19375       var maxPathLength = maxViaWay * 2 + 3;
19376       var turns = [];
19377       step(start2);
19378       return turns;
19379       function step(entity, currPath, currRestrictions, matchedRestriction) {
19380         currPath = (currPath || []).slice();
19381         if (currPath.length >= maxPathLength) return;
19382         currPath.push(entity.id);
19383         currRestrictions = (currRestrictions || []).slice();
19384         if (entity.type === "node") {
19385           stepNode(entity, currPath, currRestrictions);
19386         } else {
19387           stepWay(entity, currPath, currRestrictions, matchedRestriction);
19388         }
19389       }
19390       function stepNode(entity, currPath, currRestrictions) {
19391         var i4, j3;
19392         var parents2 = vgraph2.parentWays(entity);
19393         var nextWays = [];
19394         for (i4 = 0; i4 < parents2.length; i4++) {
19395           var way2 = parents2[i4];
19396           if (way2.__oneWay && way2.nodes[0] !== entity.id) continue;
19397           if (currPath.indexOf(way2.id) !== -1 && currPath.length >= 3) continue;
19398           var restrict = null;
19399           for (j3 = 0; j3 < currRestrictions.length; j3++) {
19400             var restriction = currRestrictions[j3];
19401             var f2 = restriction.memberByRole("from");
19402             var v2 = restriction.membersByRole("via");
19403             var t2 = restriction.memberByRole("to");
19404             var isNo = /^no_/.test(restriction.tags.restriction);
19405             var isOnly = /^only_/.test(restriction.tags.restriction);
19406             if (!(isNo || isOnly)) {
19407               continue;
19408             }
19409             var matchesFrom = f2.id === fromWayId;
19410             var matchesViaTo = false;
19411             var isAlongOnlyPath = false;
19412             if (t2.id === way2.id) {
19413               if (v2.length === 1 && v2[0].type === "node") {
19414                 matchesViaTo = v2[0].id === entity.id && (matchesFrom && currPath.length === 2 || !matchesFrom && currPath.length > 2);
19415               } else {
19416                 var pathVias = [];
19417                 for (k2 = 2; k2 < currPath.length; k2 += 2) {
19418                   pathVias.push(currPath[k2]);
19419                 }
19420                 var restrictionVias = [];
19421                 for (k2 = 0; k2 < v2.length; k2++) {
19422                   if (v2[k2].type === "way") {
19423                     restrictionVias.push(v2[k2].id);
19424                   }
19425                 }
19426                 var diff = utilArrayDifference(pathVias, restrictionVias);
19427                 matchesViaTo = !diff.length;
19428               }
19429             } else if (isOnly) {
19430               for (k2 = 0; k2 < v2.length; k2++) {
19431                 if (v2[k2].type === "way" && v2[k2].id === way2.id) {
19432                   isAlongOnlyPath = true;
19433                   break;
19434                 }
19435               }
19436             }
19437             if (matchesViaTo) {
19438               if (isOnly) {
19439                 restrict = { id: restriction.id, direct: matchesFrom, from: f2.id, only: true, end: true };
19440               } else {
19441                 restrict = { id: restriction.id, direct: matchesFrom, from: f2.id, no: true, end: true };
19442               }
19443             } else {
19444               if (isAlongOnlyPath) {
19445                 restrict = { id: restriction.id, direct: false, from: f2.id, only: true, end: false };
19446               } else if (isOnly) {
19447                 restrict = { id: restriction.id, direct: false, from: f2.id, no: true, end: true };
19448               }
19449             }
19450             if (restrict && restrict.direct) break;
19451           }
19452           nextWays.push({ way: way2, restrict });
19453         }
19454         nextWays.forEach(function(nextWay) {
19455           step(nextWay.way, currPath, currRestrictions, nextWay.restrict);
19456         });
19457       }
19458       function stepWay(entity, currPath, currRestrictions, matchedRestriction) {
19459         var i4;
19460         if (currPath.length >= 3) {
19461           var turnPath = currPath.slice();
19462           if (matchedRestriction && matchedRestriction.direct === false) {
19463             for (i4 = 0; i4 < turnPath.length; i4++) {
19464               if (turnPath[i4] === matchedRestriction.from) {
19465                 turnPath = turnPath.slice(i4);
19466                 break;
19467               }
19468             }
19469           }
19470           var turn = pathToTurn(turnPath);
19471           if (turn) {
19472             if (matchedRestriction) {
19473               turn.restrictionID = matchedRestriction.id;
19474               turn.no = matchedRestriction.no;
19475               turn.only = matchedRestriction.only;
19476               turn.direct = matchedRestriction.direct;
19477             }
19478             turns.push(osmTurn(turn));
19479           }
19480           if (currPath[0] === currPath[2]) return;
19481         }
19482         if (matchedRestriction && matchedRestriction.end) return;
19483         var n1 = vgraph2.entity(entity.first());
19484         var n22 = vgraph2.entity(entity.last());
19485         var dist = geoSphericalDistance(n1.loc, n22.loc);
19486         var nextNodes = [];
19487         if (currPath.length > 1) {
19488           if (dist > maxDistance) return;
19489           if (!entity.__via) return;
19490         }
19491         if (!entity.__oneWay && // bidirectional..
19492         keyVertexIds.indexOf(n1.id) !== -1 && // key vertex..
19493         currPath.indexOf(n1.id) === -1) {
19494           nextNodes.push(n1);
19495         }
19496         if (keyVertexIds.indexOf(n22.id) !== -1 && // key vertex..
19497         currPath.indexOf(n22.id) === -1) {
19498           nextNodes.push(n22);
19499         }
19500         nextNodes.forEach(function(nextNode) {
19501           var fromRestrictions = vgraph2.parentRelations(entity).filter(function(r2) {
19502             if (!r2.isRestriction()) return false;
19503             var f2 = r2.memberByRole("from");
19504             if (!f2 || f2.id !== entity.id) return false;
19505             var isOnly = /^only_/.test(r2.tags.restriction);
19506             if (!isOnly) return true;
19507             var isOnlyVia = false;
19508             var v2 = r2.membersByRole("via");
19509             if (v2.length === 1 && v2[0].type === "node") {
19510               isOnlyVia = v2[0].id === nextNode.id;
19511             } else {
19512               for (var i5 = 0; i5 < v2.length; i5++) {
19513                 if (v2[i5].type !== "way") continue;
19514                 var viaWay = vgraph2.entity(v2[i5].id);
19515                 if (viaWay.first() === nextNode.id || viaWay.last() === nextNode.id) {
19516                   isOnlyVia = true;
19517                   break;
19518                 }
19519               }
19520             }
19521             return isOnlyVia;
19522           });
19523           step(nextNode, currPath, currRestrictions.concat(fromRestrictions), false);
19524         });
19525       }
19526       function pathToTurn(path) {
19527         if (path.length < 3) return;
19528         var fromWayId2, fromNodeId, fromVertexId;
19529         var toWayId, toNodeId, toVertexId;
19530         var viaWayIds, viaNodeId, isUturn;
19531         fromWayId2 = path[0];
19532         toWayId = path[path.length - 1];
19533         if (path.length === 3 && fromWayId2 === toWayId) {
19534           var way2 = vgraph2.entity(fromWayId2);
19535           if (way2.__oneWay) return null;
19536           isUturn = true;
19537           viaNodeId = fromVertexId = toVertexId = path[1];
19538           fromNodeId = toNodeId = adjacentNode(fromWayId2, viaNodeId);
19539         } else {
19540           isUturn = false;
19541           fromVertexId = path[1];
19542           fromNodeId = adjacentNode(fromWayId2, fromVertexId);
19543           toVertexId = path[path.length - 2];
19544           toNodeId = adjacentNode(toWayId, toVertexId);
19545           if (path.length === 3) {
19546             viaNodeId = path[1];
19547           } else {
19548             viaWayIds = path.filter(function(entityId) {
19549               return entityId[0] === "w";
19550             });
19551             viaWayIds = viaWayIds.slice(1, viaWayIds.length - 1);
19552           }
19553         }
19554         return {
19555           key: path.join("_"),
19556           path,
19557           from: { node: fromNodeId, way: fromWayId2, vertex: fromVertexId },
19558           via: { node: viaNodeId, ways: viaWayIds },
19559           to: { node: toNodeId, way: toWayId, vertex: toVertexId },
19560           u: isUturn
19561         };
19562         function adjacentNode(wayId, affixId) {
19563           var nodes2 = vgraph2.entity(wayId).nodes;
19564           return affixId === nodes2[0] ? nodes2[1] : nodes2[nodes2.length - 2];
19565         }
19566       }
19567     };
19568     return intersection2;
19569   }
19570   function osmInferRestriction(graph, turn, projection2) {
19571     var fromWay = graph.entity(turn.from.way);
19572     var fromNode = graph.entity(turn.from.node);
19573     var fromVertex = graph.entity(turn.from.vertex);
19574     var toWay = graph.entity(turn.to.way);
19575     var toNode = graph.entity(turn.to.node);
19576     var toVertex = graph.entity(turn.to.vertex);
19577     var fromOneWay = fromWay.tags.oneway === "yes";
19578     var toOneWay = toWay.tags.oneway === "yes";
19579     var angle2 = (geoAngle(fromVertex, fromNode, projection2) - geoAngle(toVertex, toNode, projection2)) * 180 / Math.PI;
19580     while (angle2 < 0) {
19581       angle2 += 360;
19582     }
19583     if (fromNode === toNode) {
19584       return "no_u_turn";
19585     }
19586     if ((angle2 < 23 || angle2 > 336) && fromOneWay && toOneWay) {
19587       return "no_u_turn";
19588     }
19589     if ((angle2 < 40 || angle2 > 319) && fromOneWay && toOneWay && turn.from.vertex !== turn.to.vertex) {
19590       return "no_u_turn";
19591     }
19592     if (angle2 < 158) {
19593       return "no_right_turn";
19594     }
19595     if (angle2 > 202) {
19596       return "no_left_turn";
19597     }
19598     return "no_straight_on";
19599   }
19600   var init_intersection = __esm({
19601     "modules/osm/intersection.js"() {
19602       "use strict";
19603       init_delete_relation();
19604       init_reverse();
19605       init_split();
19606       init_graph();
19607       init_geo2();
19608       init_entity();
19609       init_util();
19610     }
19611   });
19612
19613   // modules/osm/lanes.js
19614   var lanes_exports = {};
19615   __export(lanes_exports, {
19616     osmLanes: () => osmLanes
19617   });
19618   function osmLanes(entity) {
19619     if (entity.type !== "way") return null;
19620     if (!entity.tags.highway) return null;
19621     var tags = entity.tags;
19622     var isOneWay = entity.isOneWay();
19623     var laneCount = getLaneCount(tags, isOneWay);
19624     var maxspeed = parseMaxspeed(tags);
19625     var laneDirections = parseLaneDirections(tags, isOneWay, laneCount);
19626     var forward = laneDirections.forward;
19627     var backward = laneDirections.backward;
19628     var bothways = laneDirections.bothways;
19629     var turnLanes = {};
19630     turnLanes.unspecified = parseTurnLanes(tags["turn:lanes"]);
19631     turnLanes.forward = parseTurnLanes(tags["turn:lanes:forward"]);
19632     turnLanes.backward = parseTurnLanes(tags["turn:lanes:backward"]);
19633     var maxspeedLanes = {};
19634     maxspeedLanes.unspecified = parseMaxspeedLanes(tags["maxspeed:lanes"], maxspeed);
19635     maxspeedLanes.forward = parseMaxspeedLanes(tags["maxspeed:lanes:forward"], maxspeed);
19636     maxspeedLanes.backward = parseMaxspeedLanes(tags["maxspeed:lanes:backward"], maxspeed);
19637     var psvLanes = {};
19638     psvLanes.unspecified = parseMiscLanes(tags["psv:lanes"]);
19639     psvLanes.forward = parseMiscLanes(tags["psv:lanes:forward"]);
19640     psvLanes.backward = parseMiscLanes(tags["psv:lanes:backward"]);
19641     var busLanes = {};
19642     busLanes.unspecified = parseMiscLanes(tags["bus:lanes"]);
19643     busLanes.forward = parseMiscLanes(tags["bus:lanes:forward"]);
19644     busLanes.backward = parseMiscLanes(tags["bus:lanes:backward"]);
19645     var taxiLanes = {};
19646     taxiLanes.unspecified = parseMiscLanes(tags["taxi:lanes"]);
19647     taxiLanes.forward = parseMiscLanes(tags["taxi:lanes:forward"]);
19648     taxiLanes.backward = parseMiscLanes(tags["taxi:lanes:backward"]);
19649     var hovLanes = {};
19650     hovLanes.unspecified = parseMiscLanes(tags["hov:lanes"]);
19651     hovLanes.forward = parseMiscLanes(tags["hov:lanes:forward"]);
19652     hovLanes.backward = parseMiscLanes(tags["hov:lanes:backward"]);
19653     var hgvLanes = {};
19654     hgvLanes.unspecified = parseMiscLanes(tags["hgv:lanes"]);
19655     hgvLanes.forward = parseMiscLanes(tags["hgv:lanes:forward"]);
19656     hgvLanes.backward = parseMiscLanes(tags["hgv:lanes:backward"]);
19657     var bicyclewayLanes = {};
19658     bicyclewayLanes.unspecified = parseBicycleWay(tags["bicycleway:lanes"]);
19659     bicyclewayLanes.forward = parseBicycleWay(tags["bicycleway:lanes:forward"]);
19660     bicyclewayLanes.backward = parseBicycleWay(tags["bicycleway:lanes:backward"]);
19661     var lanesObj = {
19662       forward: [],
19663       backward: [],
19664       unspecified: []
19665     };
19666     mapToLanesObj(lanesObj, turnLanes, "turnLane");
19667     mapToLanesObj(lanesObj, maxspeedLanes, "maxspeed");
19668     mapToLanesObj(lanesObj, psvLanes, "psv");
19669     mapToLanesObj(lanesObj, busLanes, "bus");
19670     mapToLanesObj(lanesObj, taxiLanes, "taxi");
19671     mapToLanesObj(lanesObj, hovLanes, "hov");
19672     mapToLanesObj(lanesObj, hgvLanes, "hgv");
19673     mapToLanesObj(lanesObj, bicyclewayLanes, "bicycleway");
19674     return {
19675       metadata: {
19676         count: laneCount,
19677         oneway: isOneWay,
19678         forward,
19679         backward,
19680         bothways,
19681         turnLanes,
19682         maxspeed,
19683         maxspeedLanes,
19684         psvLanes,
19685         busLanes,
19686         taxiLanes,
19687         hovLanes,
19688         hgvLanes,
19689         bicyclewayLanes
19690       },
19691       lanes: lanesObj
19692     };
19693   }
19694   function getLaneCount(tags, isOneWay) {
19695     var count;
19696     if (tags.lanes) {
19697       count = parseInt(tags.lanes, 10);
19698       if (count > 0) {
19699         return count;
19700       }
19701     }
19702     switch (tags.highway) {
19703       case "trunk":
19704       case "motorway":
19705         count = isOneWay ? 2 : 4;
19706         break;
19707       default:
19708         count = isOneWay ? 1 : 2;
19709         break;
19710     }
19711     return count;
19712   }
19713   function parseMaxspeed(tags) {
19714     var maxspeed = tags.maxspeed;
19715     if (!maxspeed) return;
19716     var maxspeedRegex = /^([0-9][\.0-9]+?)(?:[ ]?(?:km\/h|kmh|kph|mph|knots))?$/;
19717     if (!maxspeedRegex.test(maxspeed)) return;
19718     return parseInt(maxspeed, 10);
19719   }
19720   function parseLaneDirections(tags, isOneWay, laneCount) {
19721     var forward = parseInt(tags["lanes:forward"], 10);
19722     var backward = parseInt(tags["lanes:backward"], 10);
19723     var bothways = parseInt(tags["lanes:both_ways"], 10) > 0 ? 1 : 0;
19724     if (parseInt(tags.oneway, 10) === -1) {
19725       forward = 0;
19726       bothways = 0;
19727       backward = laneCount;
19728     } else if (isOneWay) {
19729       forward = laneCount;
19730       bothways = 0;
19731       backward = 0;
19732     } else if (isNaN(forward) && isNaN(backward)) {
19733       backward = Math.floor((laneCount - bothways) / 2);
19734       forward = laneCount - bothways - backward;
19735     } else if (isNaN(forward)) {
19736       if (backward > laneCount - bothways) {
19737         backward = laneCount - bothways;
19738       }
19739       forward = laneCount - bothways - backward;
19740     } else if (isNaN(backward)) {
19741       if (forward > laneCount - bothways) {
19742         forward = laneCount - bothways;
19743       }
19744       backward = laneCount - bothways - forward;
19745     }
19746     return {
19747       forward,
19748       backward,
19749       bothways
19750     };
19751   }
19752   function parseTurnLanes(tag2) {
19753     if (!tag2) return;
19754     var validValues = [
19755       "left",
19756       "slight_left",
19757       "sharp_left",
19758       "through",
19759       "right",
19760       "slight_right",
19761       "sharp_right",
19762       "reverse",
19763       "merge_to_left",
19764       "merge_to_right",
19765       "none"
19766     ];
19767     return tag2.split("|").map(function(s2) {
19768       if (s2 === "") s2 = "none";
19769       return s2.split(";").map(function(d2) {
19770         return validValues.indexOf(d2) === -1 ? "unknown" : d2;
19771       });
19772     });
19773   }
19774   function parseMaxspeedLanes(tag2, maxspeed) {
19775     if (!tag2) return;
19776     return tag2.split("|").map(function(s2) {
19777       if (s2 === "none") return s2;
19778       var m2 = parseInt(s2, 10);
19779       if (s2 === "" || m2 === maxspeed) return null;
19780       return isNaN(m2) ? "unknown" : m2;
19781     });
19782   }
19783   function parseMiscLanes(tag2) {
19784     if (!tag2) return;
19785     var validValues = [
19786       "yes",
19787       "no",
19788       "designated"
19789     ];
19790     return tag2.split("|").map(function(s2) {
19791       if (s2 === "") s2 = "no";
19792       return validValues.indexOf(s2) === -1 ? "unknown" : s2;
19793     });
19794   }
19795   function parseBicycleWay(tag2) {
19796     if (!tag2) return;
19797     var validValues = [
19798       "yes",
19799       "no",
19800       "designated",
19801       "lane"
19802     ];
19803     return tag2.split("|").map(function(s2) {
19804       if (s2 === "") s2 = "no";
19805       return validValues.indexOf(s2) === -1 ? "unknown" : s2;
19806     });
19807   }
19808   function mapToLanesObj(lanesObj, data, key) {
19809     if (data.forward) {
19810       data.forward.forEach(function(l2, i3) {
19811         if (!lanesObj.forward[i3]) lanesObj.forward[i3] = {};
19812         lanesObj.forward[i3][key] = l2;
19813       });
19814     }
19815     if (data.backward) {
19816       data.backward.forEach(function(l2, i3) {
19817         if (!lanesObj.backward[i3]) lanesObj.backward[i3] = {};
19818         lanesObj.backward[i3][key] = l2;
19819       });
19820     }
19821     if (data.unspecified) {
19822       data.unspecified.forEach(function(l2, i3) {
19823         if (!lanesObj.unspecified[i3]) lanesObj.unspecified[i3] = {};
19824         lanesObj.unspecified[i3][key] = l2;
19825       });
19826     }
19827   }
19828   var init_lanes = __esm({
19829     "modules/osm/lanes.js"() {
19830       "use strict";
19831     }
19832   });
19833
19834   // modules/osm/index.js
19835   var osm_exports = {};
19836   __export(osm_exports, {
19837     QAItem: () => QAItem,
19838     osmAreaKeys: () => osmAreaKeys,
19839     osmChangeset: () => osmChangeset,
19840     osmEntity: () => osmEntity,
19841     osmFlowingWaterwayTagValues: () => osmFlowingWaterwayTagValues,
19842     osmInferRestriction: () => osmInferRestriction,
19843     osmIntersection: () => osmIntersection,
19844     osmIsInterestingTag: () => osmIsInterestingTag,
19845     osmJoinWays: () => osmJoinWays,
19846     osmLanes: () => osmLanes,
19847     osmLifecyclePrefixes: () => osmLifecyclePrefixes,
19848     osmNode: () => osmNode,
19849     osmNodeGeometriesForTags: () => osmNodeGeometriesForTags,
19850     osmNote: () => osmNote,
19851     osmPavedTags: () => osmPavedTags,
19852     osmPointTags: () => osmPointTags,
19853     osmRailwayTrackTagValues: () => osmRailwayTrackTagValues,
19854     osmRelation: () => osmRelation,
19855     osmRemoveLifecyclePrefix: () => osmRemoveLifecyclePrefix,
19856     osmRoutableHighwayTagValues: () => osmRoutableHighwayTagValues,
19857     osmSetAreaKeys: () => osmSetAreaKeys,
19858     osmSetPointTags: () => osmSetPointTags,
19859     osmSetVertexTags: () => osmSetVertexTags,
19860     osmTagSuggestingArea: () => osmTagSuggestingArea,
19861     osmTurn: () => osmTurn,
19862     osmVertexTags: () => osmVertexTags,
19863     osmWay: () => osmWay
19864   });
19865   var init_osm = __esm({
19866     "modules/osm/index.js"() {
19867       "use strict";
19868       init_changeset();
19869       init_entity();
19870       init_node2();
19871       init_note();
19872       init_relation();
19873       init_way();
19874       init_qa_item();
19875       init_intersection();
19876       init_lanes();
19877       init_multipolygon();
19878       init_tags();
19879     }
19880   });
19881
19882   // modules/actions/merge_polygon.js
19883   var merge_polygon_exports = {};
19884   __export(merge_polygon_exports, {
19885     actionMergePolygon: () => actionMergePolygon
19886   });
19887   function actionMergePolygon(ids, newRelationId) {
19888     function groupEntities(graph) {
19889       var entities = ids.map(function(id2) {
19890         return graph.entity(id2);
19891       });
19892       var geometryGroups = utilArrayGroupBy(entities, function(entity) {
19893         if (entity.type === "way" && entity.isClosed()) {
19894           return "closedWay";
19895         } else if (entity.type === "relation" && entity.isMultipolygon()) {
19896           return "multipolygon";
19897         } else {
19898           return "other";
19899         }
19900       });
19901       return Object.assign(
19902         { closedWay: [], multipolygon: [], other: [] },
19903         geometryGroups
19904       );
19905     }
19906     var action = function(graph) {
19907       var entities = groupEntities(graph);
19908       var polygons = entities.multipolygon.reduce(function(polygons2, m2) {
19909         return polygons2.concat(osmJoinWays(m2.members, graph));
19910       }, []).concat(entities.closedWay.map(function(d2) {
19911         var member = [{ id: d2.id }];
19912         member.nodes = graph.childNodes(d2);
19913         return member;
19914       }));
19915       var contained = polygons.map(function(w2, i3) {
19916         return polygons.map(function(d2, n3) {
19917           if (i3 === n3) return null;
19918           return geoPolygonContainsPolygon(
19919             d2.nodes.map(function(n4) {
19920               return n4.loc;
19921             }),
19922             w2.nodes.map(function(n4) {
19923               return n4.loc;
19924             })
19925           );
19926         });
19927       });
19928       var members = [];
19929       var outer = true;
19930       while (polygons.length) {
19931         extractUncontained(polygons);
19932         polygons = polygons.filter(isContained);
19933         contained = contained.filter(isContained).map(filterContained);
19934       }
19935       function isContained(d2, i3) {
19936         return contained[i3].some(function(val) {
19937           return val;
19938         });
19939       }
19940       function filterContained(d2) {
19941         return d2.filter(isContained);
19942       }
19943       function extractUncontained(polygons2) {
19944         polygons2.forEach(function(d2, i3) {
19945           if (!isContained(d2, i3)) {
19946             d2.forEach(function(member) {
19947               members.push({
19948                 type: "way",
19949                 id: member.id,
19950                 role: outer ? "outer" : "inner"
19951               });
19952             });
19953           }
19954         });
19955         outer = !outer;
19956       }
19957       var relation;
19958       if (entities.multipolygon.length > 0) {
19959         var oldestID = utilOldestID(entities.multipolygon.map((entity) => entity.id));
19960         relation = entities.multipolygon.find((entity) => entity.id === oldestID);
19961       } else {
19962         relation = osmRelation({ id: newRelationId, tags: { type: "multipolygon" } });
19963       }
19964       entities.multipolygon.forEach(function(m2) {
19965         if (m2.id !== relation.id) {
19966           relation = relation.mergeTags(m2.tags);
19967           graph = graph.remove(m2);
19968         }
19969       });
19970       entities.closedWay.forEach(function(way) {
19971         function isThisOuter(m2) {
19972           return m2.id === way.id && m2.role !== "inner";
19973         }
19974         if (members.some(isThisOuter)) {
19975           relation = relation.mergeTags(way.tags);
19976           graph = graph.replace(way.update({ tags: {} }));
19977         }
19978       });
19979       return graph.replace(relation.update({
19980         members,
19981         tags: utilObjectOmit(relation.tags, ["area"])
19982       }));
19983     };
19984     action.disabled = function(graph) {
19985       var entities = groupEntities(graph);
19986       if (entities.other.length > 0 || entities.closedWay.length + entities.multipolygon.length < 2) {
19987         return "not_eligible";
19988       }
19989       if (!entities.multipolygon.every(function(r2) {
19990         return r2.isComplete(graph);
19991       })) {
19992         return "incomplete_relation";
19993       }
19994       if (!entities.multipolygon.length) {
19995         var sharedMultipolygons = [];
19996         entities.closedWay.forEach(function(way, i3) {
19997           if (i3 === 0) {
19998             sharedMultipolygons = graph.parentMultipolygons(way);
19999           } else {
20000             sharedMultipolygons = utilArrayIntersection(sharedMultipolygons, graph.parentMultipolygons(way));
20001           }
20002         });
20003         sharedMultipolygons = sharedMultipolygons.filter(function(relation) {
20004           return relation.members.length === entities.closedWay.length;
20005         });
20006         if (sharedMultipolygons.length) {
20007           return "not_eligible";
20008         }
20009       } else if (entities.closedWay.some(function(way) {
20010         return utilArrayIntersection(graph.parentMultipolygons(way), entities.multipolygon).length;
20011       })) {
20012         return "not_eligible";
20013       }
20014     };
20015     return action;
20016   }
20017   var init_merge_polygon = __esm({
20018     "modules/actions/merge_polygon.js"() {
20019       "use strict";
20020       init_geo2();
20021       init_osm();
20022       init_util();
20023     }
20024   });
20025
20026   // node_modules/fast-deep-equal/index.js
20027   var require_fast_deep_equal = __commonJS({
20028     "node_modules/fast-deep-equal/index.js"(exports2, module2) {
20029       "use strict";
20030       module2.exports = function equal(a2, b2) {
20031         if (a2 === b2) return true;
20032         if (a2 && b2 && typeof a2 == "object" && typeof b2 == "object") {
20033           if (a2.constructor !== b2.constructor) return false;
20034           var length2, i3, keys2;
20035           if (Array.isArray(a2)) {
20036             length2 = a2.length;
20037             if (length2 != b2.length) return false;
20038             for (i3 = length2; i3-- !== 0; )
20039               if (!equal(a2[i3], b2[i3])) return false;
20040             return true;
20041           }
20042           if (a2.constructor === RegExp) return a2.source === b2.source && a2.flags === b2.flags;
20043           if (a2.valueOf !== Object.prototype.valueOf) return a2.valueOf() === b2.valueOf();
20044           if (a2.toString !== Object.prototype.toString) return a2.toString() === b2.toString();
20045           keys2 = Object.keys(a2);
20046           length2 = keys2.length;
20047           if (length2 !== Object.keys(b2).length) return false;
20048           for (i3 = length2; i3-- !== 0; )
20049             if (!Object.prototype.hasOwnProperty.call(b2, keys2[i3])) return false;
20050           for (i3 = length2; i3-- !== 0; ) {
20051             var key = keys2[i3];
20052             if (!equal(a2[key], b2[key])) return false;
20053           }
20054           return true;
20055         }
20056         return a2 !== a2 && b2 !== b2;
20057       };
20058     }
20059   });
20060
20061   // node_modules/node-diff3/index.mjs
20062   function LCS(buffer1, buffer2) {
20063     let equivalenceClasses = {};
20064     for (let j2 = 0; j2 < buffer2.length; j2++) {
20065       const item = buffer2[j2];
20066       if (equivalenceClasses[item]) {
20067         equivalenceClasses[item].push(j2);
20068       } else {
20069         equivalenceClasses[item] = [j2];
20070       }
20071     }
20072     const NULLRESULT = { buffer1index: -1, buffer2index: -1, chain: null };
20073     let candidates = [NULLRESULT];
20074     for (let i3 = 0; i3 < buffer1.length; i3++) {
20075       const item = buffer1[i3];
20076       const buffer2indices = equivalenceClasses[item] || [];
20077       let r2 = 0;
20078       let c2 = candidates[0];
20079       for (let jx = 0; jx < buffer2indices.length; jx++) {
20080         const j2 = buffer2indices[jx];
20081         let s2;
20082         for (s2 = r2; s2 < candidates.length; s2++) {
20083           if (candidates[s2].buffer2index < j2 && (s2 === candidates.length - 1 || candidates[s2 + 1].buffer2index > j2)) {
20084             break;
20085           }
20086         }
20087         if (s2 < candidates.length) {
20088           const newCandidate = { buffer1index: i3, buffer2index: j2, chain: candidates[s2] };
20089           if (r2 === candidates.length) {
20090             candidates.push(c2);
20091           } else {
20092             candidates[r2] = c2;
20093           }
20094           r2 = s2 + 1;
20095           c2 = newCandidate;
20096           if (r2 === candidates.length) {
20097             break;
20098           }
20099         }
20100       }
20101       candidates[r2] = c2;
20102     }
20103     return candidates[candidates.length - 1];
20104   }
20105   function diffIndices(buffer1, buffer2) {
20106     const lcs = LCS(buffer1, buffer2);
20107     let result = [];
20108     let tail1 = buffer1.length;
20109     let tail2 = buffer2.length;
20110     for (let candidate = lcs; candidate !== null; candidate = candidate.chain) {
20111       const mismatchLength1 = tail1 - candidate.buffer1index - 1;
20112       const mismatchLength2 = tail2 - candidate.buffer2index - 1;
20113       tail1 = candidate.buffer1index;
20114       tail2 = candidate.buffer2index;
20115       if (mismatchLength1 || mismatchLength2) {
20116         result.push({
20117           buffer1: [tail1 + 1, mismatchLength1],
20118           buffer1Content: buffer1.slice(tail1 + 1, tail1 + 1 + mismatchLength1),
20119           buffer2: [tail2 + 1, mismatchLength2],
20120           buffer2Content: buffer2.slice(tail2 + 1, tail2 + 1 + mismatchLength2)
20121         });
20122       }
20123     }
20124     result.reverse();
20125     return result;
20126   }
20127   function diff3MergeRegions(a2, o2, b2) {
20128     let hunks = [];
20129     function addHunk(h2, ab) {
20130       hunks.push({
20131         ab,
20132         oStart: h2.buffer1[0],
20133         oLength: h2.buffer1[1],
20134         // length of o to remove
20135         abStart: h2.buffer2[0],
20136         abLength: h2.buffer2[1]
20137         // length of a/b to insert
20138         // abContent: (ab === 'a' ? a : b).slice(h.buffer2[0], h.buffer2[0] + h.buffer2[1])
20139       });
20140     }
20141     diffIndices(o2, a2).forEach((item) => addHunk(item, "a"));
20142     diffIndices(o2, b2).forEach((item) => addHunk(item, "b"));
20143     hunks.sort((x2, y2) => x2.oStart - y2.oStart);
20144     let results = [];
20145     let currOffset = 0;
20146     function advanceTo(endOffset) {
20147       if (endOffset > currOffset) {
20148         results.push({
20149           stable: true,
20150           buffer: "o",
20151           bufferStart: currOffset,
20152           bufferLength: endOffset - currOffset,
20153           bufferContent: o2.slice(currOffset, endOffset)
20154         });
20155         currOffset = endOffset;
20156       }
20157     }
20158     while (hunks.length) {
20159       let hunk = hunks.shift();
20160       let regionStart = hunk.oStart;
20161       let regionEnd = hunk.oStart + hunk.oLength;
20162       let regionHunks = [hunk];
20163       advanceTo(regionStart);
20164       while (hunks.length) {
20165         const nextHunk = hunks[0];
20166         const nextHunkStart = nextHunk.oStart;
20167         if (nextHunkStart > regionEnd) break;
20168         regionEnd = Math.max(regionEnd, nextHunkStart + nextHunk.oLength);
20169         regionHunks.push(hunks.shift());
20170       }
20171       if (regionHunks.length === 1) {
20172         if (hunk.abLength > 0) {
20173           const buffer = hunk.ab === "a" ? a2 : b2;
20174           results.push({
20175             stable: true,
20176             buffer: hunk.ab,
20177             bufferStart: hunk.abStart,
20178             bufferLength: hunk.abLength,
20179             bufferContent: buffer.slice(hunk.abStart, hunk.abStart + hunk.abLength)
20180           });
20181         }
20182       } else {
20183         let bounds = {
20184           a: [a2.length, -1, o2.length, -1],
20185           b: [b2.length, -1, o2.length, -1]
20186         };
20187         while (regionHunks.length) {
20188           hunk = regionHunks.shift();
20189           const oStart = hunk.oStart;
20190           const oEnd = oStart + hunk.oLength;
20191           const abStart = hunk.abStart;
20192           const abEnd = abStart + hunk.abLength;
20193           let b3 = bounds[hunk.ab];
20194           b3[0] = Math.min(abStart, b3[0]);
20195           b3[1] = Math.max(abEnd, b3[1]);
20196           b3[2] = Math.min(oStart, b3[2]);
20197           b3[3] = Math.max(oEnd, b3[3]);
20198         }
20199         const aStart = bounds.a[0] + (regionStart - bounds.a[2]);
20200         const aEnd = bounds.a[1] + (regionEnd - bounds.a[3]);
20201         const bStart = bounds.b[0] + (regionStart - bounds.b[2]);
20202         const bEnd = bounds.b[1] + (regionEnd - bounds.b[3]);
20203         let result = {
20204           stable: false,
20205           aStart,
20206           aLength: aEnd - aStart,
20207           aContent: a2.slice(aStart, aEnd),
20208           oStart: regionStart,
20209           oLength: regionEnd - regionStart,
20210           oContent: o2.slice(regionStart, regionEnd),
20211           bStart,
20212           bLength: bEnd - bStart,
20213           bContent: b2.slice(bStart, bEnd)
20214         };
20215         results.push(result);
20216       }
20217       currOffset = regionEnd;
20218     }
20219     advanceTo(o2.length);
20220     return results;
20221   }
20222   function diff3Merge(a2, o2, b2, options2) {
20223     let defaults = {
20224       excludeFalseConflicts: true,
20225       stringSeparator: /\s+/
20226     };
20227     options2 = Object.assign(defaults, options2);
20228     if (typeof a2 === "string") a2 = a2.split(options2.stringSeparator);
20229     if (typeof o2 === "string") o2 = o2.split(options2.stringSeparator);
20230     if (typeof b2 === "string") b2 = b2.split(options2.stringSeparator);
20231     let results = [];
20232     const regions = diff3MergeRegions(a2, o2, b2);
20233     let okBuffer = [];
20234     function flushOk() {
20235       if (okBuffer.length) {
20236         results.push({ ok: okBuffer });
20237       }
20238       okBuffer = [];
20239     }
20240     function isFalseConflict(a3, b3) {
20241       if (a3.length !== b3.length) return false;
20242       for (let i3 = 0; i3 < a3.length; i3++) {
20243         if (a3[i3] !== b3[i3]) return false;
20244       }
20245       return true;
20246     }
20247     regions.forEach((region) => {
20248       if (region.stable) {
20249         okBuffer.push(...region.bufferContent);
20250       } else {
20251         if (options2.excludeFalseConflicts && isFalseConflict(region.aContent, region.bContent)) {
20252           okBuffer.push(...region.aContent);
20253         } else {
20254           flushOk();
20255           results.push({
20256             conflict: {
20257               a: region.aContent,
20258               aIndex: region.aStart,
20259               o: region.oContent,
20260               oIndex: region.oStart,
20261               b: region.bContent,
20262               bIndex: region.bStart
20263             }
20264           });
20265         }
20266       }
20267     });
20268     flushOk();
20269     return results;
20270   }
20271   var init_node_diff3 = __esm({
20272     "node_modules/node-diff3/index.mjs"() {
20273     }
20274   });
20275
20276   // node_modules/lodash/lodash.js
20277   var require_lodash = __commonJS({
20278     "node_modules/lodash/lodash.js"(exports2, module2) {
20279       (function() {
20280         var undefined2;
20281         var VERSION = "4.17.21";
20282         var LARGE_ARRAY_SIZE2 = 200;
20283         var CORE_ERROR_TEXT = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", FUNC_ERROR_TEXT3 = "Expected a function", INVALID_TEMPL_VAR_ERROR_TEXT = "Invalid `variable` option passed into `_.template`";
20284         var HASH_UNDEFINED4 = "__lodash_hash_undefined__";
20285         var MAX_MEMOIZE_SIZE = 500;
20286         var PLACEHOLDER = "__lodash_placeholder__";
20287         var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4;
20288         var COMPARE_PARTIAL_FLAG5 = 1, COMPARE_UNORDERED_FLAG3 = 2;
20289         var WRAP_BIND_FLAG = 1, WRAP_BIND_KEY_FLAG = 2, WRAP_CURRY_BOUND_FLAG = 4, WRAP_CURRY_FLAG = 8, WRAP_CURRY_RIGHT_FLAG = 16, WRAP_PARTIAL_FLAG = 32, WRAP_PARTIAL_RIGHT_FLAG = 64, WRAP_ARY_FLAG = 128, WRAP_REARG_FLAG = 256, WRAP_FLIP_FLAG = 512;
20290         var DEFAULT_TRUNC_LENGTH = 30, DEFAULT_TRUNC_OMISSION = "...";
20291         var HOT_COUNT2 = 800, HOT_SPAN2 = 16;
20292         var LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2, LAZY_WHILE_FLAG = 3;
20293         var INFINITY2 = 1 / 0, MAX_SAFE_INTEGER4 = 9007199254740991, MAX_INTEGER = 17976931348623157e292, NAN2 = 0 / 0;
20294         var MAX_ARRAY_LENGTH = 4294967295, MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
20295         var wrapFlags = [
20296           ["ary", WRAP_ARY_FLAG],
20297           ["bind", WRAP_BIND_FLAG],
20298           ["bindKey", WRAP_BIND_KEY_FLAG],
20299           ["curry", WRAP_CURRY_FLAG],
20300           ["curryRight", WRAP_CURRY_RIGHT_FLAG],
20301           ["flip", WRAP_FLIP_FLAG],
20302           ["partial", WRAP_PARTIAL_FLAG],
20303           ["partialRight", WRAP_PARTIAL_RIGHT_FLAG],
20304           ["rearg", WRAP_REARG_FLAG]
20305         ];
20306         var argsTag4 = "[object Arguments]", arrayTag3 = "[object Array]", asyncTag2 = "[object AsyncFunction]", boolTag3 = "[object Boolean]", dateTag3 = "[object Date]", domExcTag = "[object DOMException]", errorTag3 = "[object Error]", funcTag3 = "[object Function]", genTag2 = "[object GeneratorFunction]", mapTag4 = "[object Map]", numberTag4 = "[object Number]", nullTag2 = "[object Null]", objectTag5 = "[object Object]", promiseTag2 = "[object Promise]", proxyTag2 = "[object Proxy]", regexpTag3 = "[object RegExp]", setTag4 = "[object Set]", stringTag3 = "[object String]", symbolTag3 = "[object Symbol]", undefinedTag2 = "[object Undefined]", weakMapTag3 = "[object WeakMap]", weakSetTag = "[object WeakSet]";
20307         var arrayBufferTag3 = "[object ArrayBuffer]", dataViewTag4 = "[object DataView]", float32Tag2 = "[object Float32Array]", float64Tag2 = "[object Float64Array]", int8Tag2 = "[object Int8Array]", int16Tag2 = "[object Int16Array]", int32Tag2 = "[object Int32Array]", uint8Tag2 = "[object Uint8Array]", uint8ClampedTag2 = "[object Uint8ClampedArray]", uint16Tag2 = "[object Uint16Array]", uint32Tag2 = "[object Uint32Array]";
20308         var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
20309         var reEscapedHtml2 = /&(?:amp|lt|gt|quot|#39);/g, reUnescapedHtml2 = /[&<>"']/g, reHasEscapedHtml2 = RegExp(reEscapedHtml2.source), reHasUnescapedHtml2 = RegExp(reUnescapedHtml2.source);
20310         var reEscape = /<%-([\s\S]+?)%>/g, reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g;
20311         var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
20312         var reRegExpChar2 = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar2.source);
20313         var reTrimStart2 = /^\s+/;
20314         var reWhitespace2 = /\s/;
20315         var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, reSplitDetails = /,? & /;
20316         var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
20317         var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
20318         var reEscapeChar = /\\(\\)?/g;
20319         var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
20320         var reFlags = /\w*$/;
20321         var reIsBadHex2 = /^[-+]0x[0-9a-f]+$/i;
20322         var reIsBinary2 = /^0b[01]+$/i;
20323         var reIsHostCtor2 = /^\[object .+?Constructor\]$/;
20324         var reIsOctal2 = /^0o[0-7]+$/i;
20325         var reIsUint2 = /^(?:0|[1-9]\d*)$/;
20326         var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
20327         var reNoMatch = /($^)/;
20328         var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
20329         var rsAstralRange = "\\ud800-\\udfff", rsComboMarksRange = "\\u0300-\\u036f", reComboHalfMarksRange = "\\ufe20-\\ufe2f", rsComboSymbolsRange = "\\u20d0-\\u20ff", rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, rsDingbatRange = "\\u2700-\\u27bf", rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff", rsMathOpRange = "\\xac\\xb1\\xd7\\xf7", rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", rsPunctuationRange = "\\u2000-\\u206f", rsSpaceRange = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde", rsVarRange = "\\ufe0e\\ufe0f", rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
20330         var rsApos = "['\u2019]", rsAstral = "[" + rsAstralRange + "]", rsBreak = "[" + rsBreakRange + "]", rsCombo = "[" + rsComboRange + "]", rsDigits = "\\d+", rsDingbat = "[" + rsDingbatRange + "]", rsLower = "[" + rsLowerRange + "]", rsMisc = "[^" + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]", rsFitz = "\\ud83c[\\udffb-\\udfff]", rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")", rsNonAstral = "[^" + rsAstralRange + "]", rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}", rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]", rsUpper = "[" + rsUpperRange + "]", rsZWJ = "\\u200d";
20331         var rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")", rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")", rsOptContrLower = "(?:" + rsApos + "(?:d|ll|m|re|s|t|ve))?", rsOptContrUpper = "(?:" + rsApos + "(?:D|LL|M|RE|S|T|VE))?", reOptMod = rsModifier + "?", rsOptVar = "[" + rsVarRange + "]?", rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*", rsOrdLower = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", rsOrdUpper = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", rsSeq = rsOptVar + reOptMod + rsOptJoin, rsEmoji = "(?:" + [rsDingbat, rsRegional, rsSurrPair].join("|") + ")" + rsSeq, rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")";
20332         var reApos = RegExp(rsApos, "g");
20333         var reComboMark = RegExp(rsCombo, "g");
20334         var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
20335         var reUnicodeWord = RegExp([
20336           rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
20337           rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")",
20338           rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
20339           rsUpper + "+" + rsOptContrUpper,
20340           rsOrdUpper,
20341           rsOrdLower,
20342           rsDigits,
20343           rsEmoji
20344         ].join("|"), "g");
20345         var reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + "]");
20346         var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
20347         var contextProps = [
20348           "Array",
20349           "Buffer",
20350           "DataView",
20351           "Date",
20352           "Error",
20353           "Float32Array",
20354           "Float64Array",
20355           "Function",
20356           "Int8Array",
20357           "Int16Array",
20358           "Int32Array",
20359           "Map",
20360           "Math",
20361           "Object",
20362           "Promise",
20363           "RegExp",
20364           "Set",
20365           "String",
20366           "Symbol",
20367           "TypeError",
20368           "Uint8Array",
20369           "Uint8ClampedArray",
20370           "Uint16Array",
20371           "Uint32Array",
20372           "WeakMap",
20373           "_",
20374           "clearTimeout",
20375           "isFinite",
20376           "parseInt",
20377           "setTimeout"
20378         ];
20379         var templateCounter = -1;
20380         var typedArrayTags2 = {};
20381         typedArrayTags2[float32Tag2] = typedArrayTags2[float64Tag2] = typedArrayTags2[int8Tag2] = typedArrayTags2[int16Tag2] = typedArrayTags2[int32Tag2] = typedArrayTags2[uint8Tag2] = typedArrayTags2[uint8ClampedTag2] = typedArrayTags2[uint16Tag2] = typedArrayTags2[uint32Tag2] = true;
20382         typedArrayTags2[argsTag4] = typedArrayTags2[arrayTag3] = typedArrayTags2[arrayBufferTag3] = typedArrayTags2[boolTag3] = typedArrayTags2[dataViewTag4] = typedArrayTags2[dateTag3] = typedArrayTags2[errorTag3] = typedArrayTags2[funcTag3] = typedArrayTags2[mapTag4] = typedArrayTags2[numberTag4] = typedArrayTags2[objectTag5] = typedArrayTags2[regexpTag3] = typedArrayTags2[setTag4] = typedArrayTags2[stringTag3] = typedArrayTags2[weakMapTag3] = false;
20383         var cloneableTags = {};
20384         cloneableTags[argsTag4] = cloneableTags[arrayTag3] = cloneableTags[arrayBufferTag3] = cloneableTags[dataViewTag4] = cloneableTags[boolTag3] = cloneableTags[dateTag3] = cloneableTags[float32Tag2] = cloneableTags[float64Tag2] = cloneableTags[int8Tag2] = cloneableTags[int16Tag2] = cloneableTags[int32Tag2] = cloneableTags[mapTag4] = cloneableTags[numberTag4] = cloneableTags[objectTag5] = cloneableTags[regexpTag3] = cloneableTags[setTag4] = cloneableTags[stringTag3] = cloneableTags[symbolTag3] = cloneableTags[uint8Tag2] = cloneableTags[uint8ClampedTag2] = cloneableTags[uint16Tag2] = cloneableTags[uint32Tag2] = true;
20385         cloneableTags[errorTag3] = cloneableTags[funcTag3] = cloneableTags[weakMapTag3] = false;
20386         var deburredLetters = {
20387           // Latin-1 Supplement block.
20388           "\xC0": "A",
20389           "\xC1": "A",
20390           "\xC2": "A",
20391           "\xC3": "A",
20392           "\xC4": "A",
20393           "\xC5": "A",
20394           "\xE0": "a",
20395           "\xE1": "a",
20396           "\xE2": "a",
20397           "\xE3": "a",
20398           "\xE4": "a",
20399           "\xE5": "a",
20400           "\xC7": "C",
20401           "\xE7": "c",
20402           "\xD0": "D",
20403           "\xF0": "d",
20404           "\xC8": "E",
20405           "\xC9": "E",
20406           "\xCA": "E",
20407           "\xCB": "E",
20408           "\xE8": "e",
20409           "\xE9": "e",
20410           "\xEA": "e",
20411           "\xEB": "e",
20412           "\xCC": "I",
20413           "\xCD": "I",
20414           "\xCE": "I",
20415           "\xCF": "I",
20416           "\xEC": "i",
20417           "\xED": "i",
20418           "\xEE": "i",
20419           "\xEF": "i",
20420           "\xD1": "N",
20421           "\xF1": "n",
20422           "\xD2": "O",
20423           "\xD3": "O",
20424           "\xD4": "O",
20425           "\xD5": "O",
20426           "\xD6": "O",
20427           "\xD8": "O",
20428           "\xF2": "o",
20429           "\xF3": "o",
20430           "\xF4": "o",
20431           "\xF5": "o",
20432           "\xF6": "o",
20433           "\xF8": "o",
20434           "\xD9": "U",
20435           "\xDA": "U",
20436           "\xDB": "U",
20437           "\xDC": "U",
20438           "\xF9": "u",
20439           "\xFA": "u",
20440           "\xFB": "u",
20441           "\xFC": "u",
20442           "\xDD": "Y",
20443           "\xFD": "y",
20444           "\xFF": "y",
20445           "\xC6": "Ae",
20446           "\xE6": "ae",
20447           "\xDE": "Th",
20448           "\xFE": "th",
20449           "\xDF": "ss",
20450           // Latin Extended-A block.
20451           "\u0100": "A",
20452           "\u0102": "A",
20453           "\u0104": "A",
20454           "\u0101": "a",
20455           "\u0103": "a",
20456           "\u0105": "a",
20457           "\u0106": "C",
20458           "\u0108": "C",
20459           "\u010A": "C",
20460           "\u010C": "C",
20461           "\u0107": "c",
20462           "\u0109": "c",
20463           "\u010B": "c",
20464           "\u010D": "c",
20465           "\u010E": "D",
20466           "\u0110": "D",
20467           "\u010F": "d",
20468           "\u0111": "d",
20469           "\u0112": "E",
20470           "\u0114": "E",
20471           "\u0116": "E",
20472           "\u0118": "E",
20473           "\u011A": "E",
20474           "\u0113": "e",
20475           "\u0115": "e",
20476           "\u0117": "e",
20477           "\u0119": "e",
20478           "\u011B": "e",
20479           "\u011C": "G",
20480           "\u011E": "G",
20481           "\u0120": "G",
20482           "\u0122": "G",
20483           "\u011D": "g",
20484           "\u011F": "g",
20485           "\u0121": "g",
20486           "\u0123": "g",
20487           "\u0124": "H",
20488           "\u0126": "H",
20489           "\u0125": "h",
20490           "\u0127": "h",
20491           "\u0128": "I",
20492           "\u012A": "I",
20493           "\u012C": "I",
20494           "\u012E": "I",
20495           "\u0130": "I",
20496           "\u0129": "i",
20497           "\u012B": "i",
20498           "\u012D": "i",
20499           "\u012F": "i",
20500           "\u0131": "i",
20501           "\u0134": "J",
20502           "\u0135": "j",
20503           "\u0136": "K",
20504           "\u0137": "k",
20505           "\u0138": "k",
20506           "\u0139": "L",
20507           "\u013B": "L",
20508           "\u013D": "L",
20509           "\u013F": "L",
20510           "\u0141": "L",
20511           "\u013A": "l",
20512           "\u013C": "l",
20513           "\u013E": "l",
20514           "\u0140": "l",
20515           "\u0142": "l",
20516           "\u0143": "N",
20517           "\u0145": "N",
20518           "\u0147": "N",
20519           "\u014A": "N",
20520           "\u0144": "n",
20521           "\u0146": "n",
20522           "\u0148": "n",
20523           "\u014B": "n",
20524           "\u014C": "O",
20525           "\u014E": "O",
20526           "\u0150": "O",
20527           "\u014D": "o",
20528           "\u014F": "o",
20529           "\u0151": "o",
20530           "\u0154": "R",
20531           "\u0156": "R",
20532           "\u0158": "R",
20533           "\u0155": "r",
20534           "\u0157": "r",
20535           "\u0159": "r",
20536           "\u015A": "S",
20537           "\u015C": "S",
20538           "\u015E": "S",
20539           "\u0160": "S",
20540           "\u015B": "s",
20541           "\u015D": "s",
20542           "\u015F": "s",
20543           "\u0161": "s",
20544           "\u0162": "T",
20545           "\u0164": "T",
20546           "\u0166": "T",
20547           "\u0163": "t",
20548           "\u0165": "t",
20549           "\u0167": "t",
20550           "\u0168": "U",
20551           "\u016A": "U",
20552           "\u016C": "U",
20553           "\u016E": "U",
20554           "\u0170": "U",
20555           "\u0172": "U",
20556           "\u0169": "u",
20557           "\u016B": "u",
20558           "\u016D": "u",
20559           "\u016F": "u",
20560           "\u0171": "u",
20561           "\u0173": "u",
20562           "\u0174": "W",
20563           "\u0175": "w",
20564           "\u0176": "Y",
20565           "\u0177": "y",
20566           "\u0178": "Y",
20567           "\u0179": "Z",
20568           "\u017B": "Z",
20569           "\u017D": "Z",
20570           "\u017A": "z",
20571           "\u017C": "z",
20572           "\u017E": "z",
20573           "\u0132": "IJ",
20574           "\u0133": "ij",
20575           "\u0152": "Oe",
20576           "\u0153": "oe",
20577           "\u0149": "'n",
20578           "\u017F": "s"
20579         };
20580         var htmlEscapes2 = {
20581           "&": "&amp;",
20582           "<": "&lt;",
20583           ">": "&gt;",
20584           '"': "&quot;",
20585           "'": "&#39;"
20586         };
20587         var htmlUnescapes2 = {
20588           "&amp;": "&",
20589           "&lt;": "<",
20590           "&gt;": ">",
20591           "&quot;": '"',
20592           "&#39;": "'"
20593         };
20594         var stringEscapes = {
20595           "\\": "\\",
20596           "'": "'",
20597           "\n": "n",
20598           "\r": "r",
20599           "\u2028": "u2028",
20600           "\u2029": "u2029"
20601         };
20602         var freeParseFloat = parseFloat, freeParseInt2 = parseInt;
20603         var freeGlobal2 = typeof global == "object" && global && global.Object === Object && global;
20604         var freeSelf2 = typeof self == "object" && self && self.Object === Object && self;
20605         var root3 = freeGlobal2 || freeSelf2 || Function("return this")();
20606         var freeExports4 = typeof exports2 == "object" && exports2 && !exports2.nodeType && exports2;
20607         var freeModule4 = freeExports4 && typeof module2 == "object" && module2 && !module2.nodeType && module2;
20608         var moduleExports4 = freeModule4 && freeModule4.exports === freeExports4;
20609         var freeProcess2 = moduleExports4 && freeGlobal2.process;
20610         var nodeUtil2 = function() {
20611           try {
20612             var types = freeModule4 && freeModule4.require && freeModule4.require("util").types;
20613             if (types) {
20614               return types;
20615             }
20616             return freeProcess2 && freeProcess2.binding && freeProcess2.binding("util");
20617           } catch (e3) {
20618           }
20619         }();
20620         var nodeIsArrayBuffer = nodeUtil2 && nodeUtil2.isArrayBuffer, nodeIsDate = nodeUtil2 && nodeUtil2.isDate, nodeIsMap = nodeUtil2 && nodeUtil2.isMap, nodeIsRegExp = nodeUtil2 && nodeUtil2.isRegExp, nodeIsSet = nodeUtil2 && nodeUtil2.isSet, nodeIsTypedArray2 = nodeUtil2 && nodeUtil2.isTypedArray;
20621         function apply2(func, thisArg, args) {
20622           switch (args.length) {
20623             case 0:
20624               return func.call(thisArg);
20625             case 1:
20626               return func.call(thisArg, args[0]);
20627             case 2:
20628               return func.call(thisArg, args[0], args[1]);
20629             case 3:
20630               return func.call(thisArg, args[0], args[1], args[2]);
20631           }
20632           return func.apply(thisArg, args);
20633         }
20634         function arrayAggregator(array2, setter, iteratee, accumulator) {
20635           var index = -1, length2 = array2 == null ? 0 : array2.length;
20636           while (++index < length2) {
20637             var value = array2[index];
20638             setter(accumulator, value, iteratee(value), array2);
20639           }
20640           return accumulator;
20641         }
20642         function arrayEach(array2, iteratee) {
20643           var index = -1, length2 = array2 == null ? 0 : array2.length;
20644           while (++index < length2) {
20645             if (iteratee(array2[index], index, array2) === false) {
20646               break;
20647             }
20648           }
20649           return array2;
20650         }
20651         function arrayEachRight(array2, iteratee) {
20652           var length2 = array2 == null ? 0 : array2.length;
20653           while (length2--) {
20654             if (iteratee(array2[length2], length2, array2) === false) {
20655               break;
20656             }
20657           }
20658           return array2;
20659         }
20660         function arrayEvery(array2, predicate) {
20661           var index = -1, length2 = array2 == null ? 0 : array2.length;
20662           while (++index < length2) {
20663             if (!predicate(array2[index], index, array2)) {
20664               return false;
20665             }
20666           }
20667           return true;
20668         }
20669         function arrayFilter2(array2, predicate) {
20670           var index = -1, length2 = array2 == null ? 0 : array2.length, resIndex = 0, result = [];
20671           while (++index < length2) {
20672             var value = array2[index];
20673             if (predicate(value, index, array2)) {
20674               result[resIndex++] = value;
20675             }
20676           }
20677           return result;
20678         }
20679         function arrayIncludes(array2, value) {
20680           var length2 = array2 == null ? 0 : array2.length;
20681           return !!length2 && baseIndexOf(array2, value, 0) > -1;
20682         }
20683         function arrayIncludesWith(array2, value, comparator) {
20684           var index = -1, length2 = array2 == null ? 0 : array2.length;
20685           while (++index < length2) {
20686             if (comparator(value, array2[index])) {
20687               return true;
20688             }
20689           }
20690           return false;
20691         }
20692         function arrayMap2(array2, iteratee) {
20693           var index = -1, length2 = array2 == null ? 0 : array2.length, result = Array(length2);
20694           while (++index < length2) {
20695             result[index] = iteratee(array2[index], index, array2);
20696           }
20697           return result;
20698         }
20699         function arrayPush2(array2, values) {
20700           var index = -1, length2 = values.length, offset = array2.length;
20701           while (++index < length2) {
20702             array2[offset + index] = values[index];
20703           }
20704           return array2;
20705         }
20706         function arrayReduce(array2, iteratee, accumulator, initAccum) {
20707           var index = -1, length2 = array2 == null ? 0 : array2.length;
20708           if (initAccum && length2) {
20709             accumulator = array2[++index];
20710           }
20711           while (++index < length2) {
20712             accumulator = iteratee(accumulator, array2[index], index, array2);
20713           }
20714           return accumulator;
20715         }
20716         function arrayReduceRight(array2, iteratee, accumulator, initAccum) {
20717           var length2 = array2 == null ? 0 : array2.length;
20718           if (initAccum && length2) {
20719             accumulator = array2[--length2];
20720           }
20721           while (length2--) {
20722             accumulator = iteratee(accumulator, array2[length2], length2, array2);
20723           }
20724           return accumulator;
20725         }
20726         function arraySome2(array2, predicate) {
20727           var index = -1, length2 = array2 == null ? 0 : array2.length;
20728           while (++index < length2) {
20729             if (predicate(array2[index], index, array2)) {
20730               return true;
20731             }
20732           }
20733           return false;
20734         }
20735         var asciiSize = baseProperty("length");
20736         function asciiToArray(string) {
20737           return string.split("");
20738         }
20739         function asciiWords(string) {
20740           return string.match(reAsciiWord) || [];
20741         }
20742         function baseFindKey(collection, predicate, eachFunc) {
20743           var result;
20744           eachFunc(collection, function(value, key, collection2) {
20745             if (predicate(value, key, collection2)) {
20746               result = key;
20747               return false;
20748             }
20749           });
20750           return result;
20751         }
20752         function baseFindIndex(array2, predicate, fromIndex, fromRight) {
20753           var length2 = array2.length, index = fromIndex + (fromRight ? 1 : -1);
20754           while (fromRight ? index-- : ++index < length2) {
20755             if (predicate(array2[index], index, array2)) {
20756               return index;
20757             }
20758           }
20759           return -1;
20760         }
20761         function baseIndexOf(array2, value, fromIndex) {
20762           return value === value ? strictIndexOf(array2, value, fromIndex) : baseFindIndex(array2, baseIsNaN, fromIndex);
20763         }
20764         function baseIndexOfWith(array2, value, fromIndex, comparator) {
20765           var index = fromIndex - 1, length2 = array2.length;
20766           while (++index < length2) {
20767             if (comparator(array2[index], value)) {
20768               return index;
20769             }
20770           }
20771           return -1;
20772         }
20773         function baseIsNaN(value) {
20774           return value !== value;
20775         }
20776         function baseMean(array2, iteratee) {
20777           var length2 = array2 == null ? 0 : array2.length;
20778           return length2 ? baseSum(array2, iteratee) / length2 : NAN2;
20779         }
20780         function baseProperty(key) {
20781           return function(object) {
20782             return object == null ? undefined2 : object[key];
20783           };
20784         }
20785         function basePropertyOf2(object) {
20786           return function(key) {
20787             return object == null ? undefined2 : object[key];
20788           };
20789         }
20790         function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
20791           eachFunc(collection, function(value, index, collection2) {
20792             accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection2);
20793           });
20794           return accumulator;
20795         }
20796         function baseSortBy(array2, comparer) {
20797           var length2 = array2.length;
20798           array2.sort(comparer);
20799           while (length2--) {
20800             array2[length2] = array2[length2].value;
20801           }
20802           return array2;
20803         }
20804         function baseSum(array2, iteratee) {
20805           var result, index = -1, length2 = array2.length;
20806           while (++index < length2) {
20807             var current = iteratee(array2[index]);
20808             if (current !== undefined2) {
20809               result = result === undefined2 ? current : result + current;
20810             }
20811           }
20812           return result;
20813         }
20814         function baseTimes2(n3, iteratee) {
20815           var index = -1, result = Array(n3);
20816           while (++index < n3) {
20817             result[index] = iteratee(index);
20818           }
20819           return result;
20820         }
20821         function baseToPairs(object, props) {
20822           return arrayMap2(props, function(key) {
20823             return [key, object[key]];
20824           });
20825         }
20826         function baseTrim2(string) {
20827           return string ? string.slice(0, trimmedEndIndex2(string) + 1).replace(reTrimStart2, "") : string;
20828         }
20829         function baseUnary2(func) {
20830           return function(value) {
20831             return func(value);
20832           };
20833         }
20834         function baseValues(object, props) {
20835           return arrayMap2(props, function(key) {
20836             return object[key];
20837           });
20838         }
20839         function cacheHas2(cache, key) {
20840           return cache.has(key);
20841         }
20842         function charsStartIndex(strSymbols, chrSymbols) {
20843           var index = -1, length2 = strSymbols.length;
20844           while (++index < length2 && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
20845           }
20846           return index;
20847         }
20848         function charsEndIndex(strSymbols, chrSymbols) {
20849           var index = strSymbols.length;
20850           while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
20851           }
20852           return index;
20853         }
20854         function countHolders(array2, placeholder) {
20855           var length2 = array2.length, result = 0;
20856           while (length2--) {
20857             if (array2[length2] === placeholder) {
20858               ++result;
20859             }
20860           }
20861           return result;
20862         }
20863         var deburrLetter = basePropertyOf2(deburredLetters);
20864         var escapeHtmlChar2 = basePropertyOf2(htmlEscapes2);
20865         function escapeStringChar(chr) {
20866           return "\\" + stringEscapes[chr];
20867         }
20868         function getValue2(object, key) {
20869           return object == null ? undefined2 : object[key];
20870         }
20871         function hasUnicode(string) {
20872           return reHasUnicode.test(string);
20873         }
20874         function hasUnicodeWord(string) {
20875           return reHasUnicodeWord.test(string);
20876         }
20877         function iteratorToArray(iterator) {
20878           var data, result = [];
20879           while (!(data = iterator.next()).done) {
20880             result.push(data.value);
20881           }
20882           return result;
20883         }
20884         function mapToArray2(map2) {
20885           var index = -1, result = Array(map2.size);
20886           map2.forEach(function(value, key) {
20887             result[++index] = [key, value];
20888           });
20889           return result;
20890         }
20891         function overArg2(func, transform2) {
20892           return function(arg) {
20893             return func(transform2(arg));
20894           };
20895         }
20896         function replaceHolders(array2, placeholder) {
20897           var index = -1, length2 = array2.length, resIndex = 0, result = [];
20898           while (++index < length2) {
20899             var value = array2[index];
20900             if (value === placeholder || value === PLACEHOLDER) {
20901               array2[index] = PLACEHOLDER;
20902               result[resIndex++] = index;
20903             }
20904           }
20905           return result;
20906         }
20907         function setToArray2(set4) {
20908           var index = -1, result = Array(set4.size);
20909           set4.forEach(function(value) {
20910             result[++index] = value;
20911           });
20912           return result;
20913         }
20914         function setToPairs(set4) {
20915           var index = -1, result = Array(set4.size);
20916           set4.forEach(function(value) {
20917             result[++index] = [value, value];
20918           });
20919           return result;
20920         }
20921         function strictIndexOf(array2, value, fromIndex) {
20922           var index = fromIndex - 1, length2 = array2.length;
20923           while (++index < length2) {
20924             if (array2[index] === value) {
20925               return index;
20926             }
20927           }
20928           return -1;
20929         }
20930         function strictLastIndexOf(array2, value, fromIndex) {
20931           var index = fromIndex + 1;
20932           while (index--) {
20933             if (array2[index] === value) {
20934               return index;
20935             }
20936           }
20937           return index;
20938         }
20939         function stringSize(string) {
20940           return hasUnicode(string) ? unicodeSize(string) : asciiSize(string);
20941         }
20942         function stringToArray(string) {
20943           return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string);
20944         }
20945         function trimmedEndIndex2(string) {
20946           var index = string.length;
20947           while (index-- && reWhitespace2.test(string.charAt(index))) {
20948           }
20949           return index;
20950         }
20951         var unescapeHtmlChar2 = basePropertyOf2(htmlUnescapes2);
20952         function unicodeSize(string) {
20953           var result = reUnicode.lastIndex = 0;
20954           while (reUnicode.test(string)) {
20955             ++result;
20956           }
20957           return result;
20958         }
20959         function unicodeToArray(string) {
20960           return string.match(reUnicode) || [];
20961         }
20962         function unicodeWords(string) {
20963           return string.match(reUnicodeWord) || [];
20964         }
20965         var runInContext = function runInContext2(context) {
20966           context = context == null ? root3 : _2.defaults(root3.Object(), context, _2.pick(root3, contextProps));
20967           var Array2 = context.Array, Date2 = context.Date, Error2 = context.Error, Function2 = context.Function, Math2 = context.Math, Object2 = context.Object, RegExp2 = context.RegExp, String2 = context.String, TypeError2 = context.TypeError;
20968           var arrayProto2 = Array2.prototype, funcProto4 = Function2.prototype, objectProto16 = Object2.prototype;
20969           var coreJsData2 = context["__core-js_shared__"];
20970           var funcToString4 = funcProto4.toString;
20971           var hasOwnProperty13 = objectProto16.hasOwnProperty;
20972           var idCounter = 0;
20973           var maskSrcKey2 = function() {
20974             var uid = /[^.]+$/.exec(coreJsData2 && coreJsData2.keys && coreJsData2.keys.IE_PROTO || "");
20975             return uid ? "Symbol(src)_1." + uid : "";
20976           }();
20977           var nativeObjectToString3 = objectProto16.toString;
20978           var objectCtorString2 = funcToString4.call(Object2);
20979           var oldDash = root3._;
20980           var reIsNative2 = RegExp2(
20981             "^" + funcToString4.call(hasOwnProperty13).replace(reRegExpChar2, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
20982           );
20983           var Buffer4 = moduleExports4 ? context.Buffer : undefined2, Symbol3 = context.Symbol, Uint8Array3 = context.Uint8Array, allocUnsafe2 = Buffer4 ? Buffer4.allocUnsafe : undefined2, getPrototype2 = overArg2(Object2.getPrototypeOf, Object2), objectCreate2 = Object2.create, propertyIsEnumerable3 = objectProto16.propertyIsEnumerable, splice2 = arrayProto2.splice, spreadableSymbol = Symbol3 ? Symbol3.isConcatSpreadable : undefined2, symIterator = Symbol3 ? Symbol3.iterator : undefined2, symToStringTag3 = Symbol3 ? Symbol3.toStringTag : undefined2;
20984           var defineProperty2 = function() {
20985             try {
20986               var func = getNative2(Object2, "defineProperty");
20987               func({}, "", {});
20988               return func;
20989             } catch (e3) {
20990             }
20991           }();
20992           var ctxClearTimeout = context.clearTimeout !== root3.clearTimeout && context.clearTimeout, ctxNow = Date2 && Date2.now !== root3.Date.now && Date2.now, ctxSetTimeout = context.setTimeout !== root3.setTimeout && context.setTimeout;
20993           var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols2 = Object2.getOwnPropertySymbols, nativeIsBuffer2 = Buffer4 ? Buffer4.isBuffer : undefined2, nativeIsFinite = context.isFinite, nativeJoin = arrayProto2.join, nativeKeys2 = overArg2(Object2.keys, Object2), nativeMax3 = Math2.max, nativeMin2 = Math2.min, nativeNow2 = Date2.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto2.reverse;
20994           var DataView3 = getNative2(context, "DataView"), Map3 = getNative2(context, "Map"), Promise3 = getNative2(context, "Promise"), Set3 = getNative2(context, "Set"), WeakMap2 = getNative2(context, "WeakMap"), nativeCreate2 = getNative2(Object2, "create");
20995           var metaMap = WeakMap2 && new WeakMap2();
20996           var realNames = {};
20997           var dataViewCtorString2 = toSource2(DataView3), mapCtorString2 = toSource2(Map3), promiseCtorString2 = toSource2(Promise3), setCtorString2 = toSource2(Set3), weakMapCtorString2 = toSource2(WeakMap2);
20998           var symbolProto3 = Symbol3 ? Symbol3.prototype : undefined2, symbolValueOf2 = symbolProto3 ? symbolProto3.valueOf : undefined2, symbolToString2 = symbolProto3 ? symbolProto3.toString : undefined2;
20999           function lodash(value) {
21000             if (isObjectLike2(value) && !isArray2(value) && !(value instanceof LazyWrapper)) {
21001               if (value instanceof LodashWrapper) {
21002                 return value;
21003               }
21004               if (hasOwnProperty13.call(value, "__wrapped__")) {
21005                 return wrapperClone(value);
21006               }
21007             }
21008             return new LodashWrapper(value);
21009           }
21010           var baseCreate2 = /* @__PURE__ */ function() {
21011             function object() {
21012             }
21013             return function(proto) {
21014               if (!isObject2(proto)) {
21015                 return {};
21016               }
21017               if (objectCreate2) {
21018                 return objectCreate2(proto);
21019               }
21020               object.prototype = proto;
21021               var result2 = new object();
21022               object.prototype = undefined2;
21023               return result2;
21024             };
21025           }();
21026           function baseLodash() {
21027           }
21028           function LodashWrapper(value, chainAll) {
21029             this.__wrapped__ = value;
21030             this.__actions__ = [];
21031             this.__chain__ = !!chainAll;
21032             this.__index__ = 0;
21033             this.__values__ = undefined2;
21034           }
21035           lodash.templateSettings = {
21036             /**
21037              * Used to detect `data` property values to be HTML-escaped.
21038              *
21039              * @memberOf _.templateSettings
21040              * @type {RegExp}
21041              */
21042             "escape": reEscape,
21043             /**
21044              * Used to detect code to be evaluated.
21045              *
21046              * @memberOf _.templateSettings
21047              * @type {RegExp}
21048              */
21049             "evaluate": reEvaluate,
21050             /**
21051              * Used to detect `data` property values to inject.
21052              *
21053              * @memberOf _.templateSettings
21054              * @type {RegExp}
21055              */
21056             "interpolate": reInterpolate,
21057             /**
21058              * Used to reference the data object in the template text.
21059              *
21060              * @memberOf _.templateSettings
21061              * @type {string}
21062              */
21063             "variable": "",
21064             /**
21065              * Used to import variables into the compiled template.
21066              *
21067              * @memberOf _.templateSettings
21068              * @type {Object}
21069              */
21070             "imports": {
21071               /**
21072                * A reference to the `lodash` function.
21073                *
21074                * @memberOf _.templateSettings.imports
21075                * @type {Function}
21076                */
21077               "_": lodash
21078             }
21079           };
21080           lodash.prototype = baseLodash.prototype;
21081           lodash.prototype.constructor = lodash;
21082           LodashWrapper.prototype = baseCreate2(baseLodash.prototype);
21083           LodashWrapper.prototype.constructor = LodashWrapper;
21084           function LazyWrapper(value) {
21085             this.__wrapped__ = value;
21086             this.__actions__ = [];
21087             this.__dir__ = 1;
21088             this.__filtered__ = false;
21089             this.__iteratees__ = [];
21090             this.__takeCount__ = MAX_ARRAY_LENGTH;
21091             this.__views__ = [];
21092           }
21093           function lazyClone() {
21094             var result2 = new LazyWrapper(this.__wrapped__);
21095             result2.__actions__ = copyArray2(this.__actions__);
21096             result2.__dir__ = this.__dir__;
21097             result2.__filtered__ = this.__filtered__;
21098             result2.__iteratees__ = copyArray2(this.__iteratees__);
21099             result2.__takeCount__ = this.__takeCount__;
21100             result2.__views__ = copyArray2(this.__views__);
21101             return result2;
21102           }
21103           function lazyReverse() {
21104             if (this.__filtered__) {
21105               var result2 = new LazyWrapper(this);
21106               result2.__dir__ = -1;
21107               result2.__filtered__ = true;
21108             } else {
21109               result2 = this.clone();
21110               result2.__dir__ *= -1;
21111             }
21112             return result2;
21113           }
21114           function lazyValue() {
21115             var array2 = this.__wrapped__.value(), dir = this.__dir__, isArr = isArray2(array2), isRight = dir < 0, arrLength = isArr ? array2.length : 0, view = getView(0, arrLength, this.__views__), start2 = view.start, end = view.end, length2 = end - start2, index = isRight ? end : start2 - 1, iteratees = this.__iteratees__, iterLength = iteratees.length, resIndex = 0, takeCount = nativeMin2(length2, this.__takeCount__);
21116             if (!isArr || !isRight && arrLength == length2 && takeCount == length2) {
21117               return baseWrapperValue(array2, this.__actions__);
21118             }
21119             var result2 = [];
21120             outer:
21121               while (length2-- && resIndex < takeCount) {
21122                 index += dir;
21123                 var iterIndex = -1, value = array2[index];
21124                 while (++iterIndex < iterLength) {
21125                   var data = iteratees[iterIndex], iteratee2 = data.iteratee, type2 = data.type, computed = iteratee2(value);
21126                   if (type2 == LAZY_MAP_FLAG) {
21127                     value = computed;
21128                   } else if (!computed) {
21129                     if (type2 == LAZY_FILTER_FLAG) {
21130                       continue outer;
21131                     } else {
21132                       break outer;
21133                     }
21134                   }
21135                 }
21136                 result2[resIndex++] = value;
21137               }
21138             return result2;
21139           }
21140           LazyWrapper.prototype = baseCreate2(baseLodash.prototype);
21141           LazyWrapper.prototype.constructor = LazyWrapper;
21142           function Hash2(entries) {
21143             var index = -1, length2 = entries == null ? 0 : entries.length;
21144             this.clear();
21145             while (++index < length2) {
21146               var entry = entries[index];
21147               this.set(entry[0], entry[1]);
21148             }
21149           }
21150           function hashClear2() {
21151             this.__data__ = nativeCreate2 ? nativeCreate2(null) : {};
21152             this.size = 0;
21153           }
21154           function hashDelete2(key) {
21155             var result2 = this.has(key) && delete this.__data__[key];
21156             this.size -= result2 ? 1 : 0;
21157             return result2;
21158           }
21159           function hashGet2(key) {
21160             var data = this.__data__;
21161             if (nativeCreate2) {
21162               var result2 = data[key];
21163               return result2 === HASH_UNDEFINED4 ? undefined2 : result2;
21164             }
21165             return hasOwnProperty13.call(data, key) ? data[key] : undefined2;
21166           }
21167           function hashHas2(key) {
21168             var data = this.__data__;
21169             return nativeCreate2 ? data[key] !== undefined2 : hasOwnProperty13.call(data, key);
21170           }
21171           function hashSet2(key, value) {
21172             var data = this.__data__;
21173             this.size += this.has(key) ? 0 : 1;
21174             data[key] = nativeCreate2 && value === undefined2 ? HASH_UNDEFINED4 : value;
21175             return this;
21176           }
21177           Hash2.prototype.clear = hashClear2;
21178           Hash2.prototype["delete"] = hashDelete2;
21179           Hash2.prototype.get = hashGet2;
21180           Hash2.prototype.has = hashHas2;
21181           Hash2.prototype.set = hashSet2;
21182           function ListCache2(entries) {
21183             var index = -1, length2 = entries == null ? 0 : entries.length;
21184             this.clear();
21185             while (++index < length2) {
21186               var entry = entries[index];
21187               this.set(entry[0], entry[1]);
21188             }
21189           }
21190           function listCacheClear2() {
21191             this.__data__ = [];
21192             this.size = 0;
21193           }
21194           function listCacheDelete2(key) {
21195             var data = this.__data__, index = assocIndexOf2(data, key);
21196             if (index < 0) {
21197               return false;
21198             }
21199             var lastIndex = data.length - 1;
21200             if (index == lastIndex) {
21201               data.pop();
21202             } else {
21203               splice2.call(data, index, 1);
21204             }
21205             --this.size;
21206             return true;
21207           }
21208           function listCacheGet2(key) {
21209             var data = this.__data__, index = assocIndexOf2(data, key);
21210             return index < 0 ? undefined2 : data[index][1];
21211           }
21212           function listCacheHas2(key) {
21213             return assocIndexOf2(this.__data__, key) > -1;
21214           }
21215           function listCacheSet2(key, value) {
21216             var data = this.__data__, index = assocIndexOf2(data, key);
21217             if (index < 0) {
21218               ++this.size;
21219               data.push([key, value]);
21220             } else {
21221               data[index][1] = value;
21222             }
21223             return this;
21224           }
21225           ListCache2.prototype.clear = listCacheClear2;
21226           ListCache2.prototype["delete"] = listCacheDelete2;
21227           ListCache2.prototype.get = listCacheGet2;
21228           ListCache2.prototype.has = listCacheHas2;
21229           ListCache2.prototype.set = listCacheSet2;
21230           function MapCache2(entries) {
21231             var index = -1, length2 = entries == null ? 0 : entries.length;
21232             this.clear();
21233             while (++index < length2) {
21234               var entry = entries[index];
21235               this.set(entry[0], entry[1]);
21236             }
21237           }
21238           function mapCacheClear2() {
21239             this.size = 0;
21240             this.__data__ = {
21241               "hash": new Hash2(),
21242               "map": new (Map3 || ListCache2)(),
21243               "string": new Hash2()
21244             };
21245           }
21246           function mapCacheDelete2(key) {
21247             var result2 = getMapData2(this, key)["delete"](key);
21248             this.size -= result2 ? 1 : 0;
21249             return result2;
21250           }
21251           function mapCacheGet2(key) {
21252             return getMapData2(this, key).get(key);
21253           }
21254           function mapCacheHas2(key) {
21255             return getMapData2(this, key).has(key);
21256           }
21257           function mapCacheSet2(key, value) {
21258             var data = getMapData2(this, key), size2 = data.size;
21259             data.set(key, value);
21260             this.size += data.size == size2 ? 0 : 1;
21261             return this;
21262           }
21263           MapCache2.prototype.clear = mapCacheClear2;
21264           MapCache2.prototype["delete"] = mapCacheDelete2;
21265           MapCache2.prototype.get = mapCacheGet2;
21266           MapCache2.prototype.has = mapCacheHas2;
21267           MapCache2.prototype.set = mapCacheSet2;
21268           function SetCache2(values2) {
21269             var index = -1, length2 = values2 == null ? 0 : values2.length;
21270             this.__data__ = new MapCache2();
21271             while (++index < length2) {
21272               this.add(values2[index]);
21273             }
21274           }
21275           function setCacheAdd2(value) {
21276             this.__data__.set(value, HASH_UNDEFINED4);
21277             return this;
21278           }
21279           function setCacheHas2(value) {
21280             return this.__data__.has(value);
21281           }
21282           SetCache2.prototype.add = SetCache2.prototype.push = setCacheAdd2;
21283           SetCache2.prototype.has = setCacheHas2;
21284           function Stack2(entries) {
21285             var data = this.__data__ = new ListCache2(entries);
21286             this.size = data.size;
21287           }
21288           function stackClear2() {
21289             this.__data__ = new ListCache2();
21290             this.size = 0;
21291           }
21292           function stackDelete2(key) {
21293             var data = this.__data__, result2 = data["delete"](key);
21294             this.size = data.size;
21295             return result2;
21296           }
21297           function stackGet2(key) {
21298             return this.__data__.get(key);
21299           }
21300           function stackHas2(key) {
21301             return this.__data__.has(key);
21302           }
21303           function stackSet2(key, value) {
21304             var data = this.__data__;
21305             if (data instanceof ListCache2) {
21306               var pairs2 = data.__data__;
21307               if (!Map3 || pairs2.length < LARGE_ARRAY_SIZE2 - 1) {
21308                 pairs2.push([key, value]);
21309                 this.size = ++data.size;
21310                 return this;
21311               }
21312               data = this.__data__ = new MapCache2(pairs2);
21313             }
21314             data.set(key, value);
21315             this.size = data.size;
21316             return this;
21317           }
21318           Stack2.prototype.clear = stackClear2;
21319           Stack2.prototype["delete"] = stackDelete2;
21320           Stack2.prototype.get = stackGet2;
21321           Stack2.prototype.has = stackHas2;
21322           Stack2.prototype.set = stackSet2;
21323           function arrayLikeKeys2(value, inherited) {
21324             var isArr = isArray2(value), isArg = !isArr && isArguments2(value), isBuff = !isArr && !isArg && isBuffer2(value), isType = !isArr && !isArg && !isBuff && isTypedArray2(value), skipIndexes = isArr || isArg || isBuff || isType, result2 = skipIndexes ? baseTimes2(value.length, String2) : [], length2 = result2.length;
21325             for (var key in value) {
21326               if ((inherited || hasOwnProperty13.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
21327               (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
21328               isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
21329               isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
21330               isIndex2(key, length2)))) {
21331                 result2.push(key);
21332               }
21333             }
21334             return result2;
21335           }
21336           function arraySample(array2) {
21337             var length2 = array2.length;
21338             return length2 ? array2[baseRandom(0, length2 - 1)] : undefined2;
21339           }
21340           function arraySampleSize(array2, n3) {
21341             return shuffleSelf(copyArray2(array2), baseClamp(n3, 0, array2.length));
21342           }
21343           function arrayShuffle(array2) {
21344             return shuffleSelf(copyArray2(array2));
21345           }
21346           function assignMergeValue2(object, key, value) {
21347             if (value !== undefined2 && !eq2(object[key], value) || value === undefined2 && !(key in object)) {
21348               baseAssignValue2(object, key, value);
21349             }
21350           }
21351           function assignValue2(object, key, value) {
21352             var objValue = object[key];
21353             if (!(hasOwnProperty13.call(object, key) && eq2(objValue, value)) || value === undefined2 && !(key in object)) {
21354               baseAssignValue2(object, key, value);
21355             }
21356           }
21357           function assocIndexOf2(array2, key) {
21358             var length2 = array2.length;
21359             while (length2--) {
21360               if (eq2(array2[length2][0], key)) {
21361                 return length2;
21362               }
21363             }
21364             return -1;
21365           }
21366           function baseAggregator(collection, setter, iteratee2, accumulator) {
21367             baseEach(collection, function(value, key, collection2) {
21368               setter(accumulator, value, iteratee2(value), collection2);
21369             });
21370             return accumulator;
21371           }
21372           function baseAssign(object, source) {
21373             return object && copyObject2(source, keys2(source), object);
21374           }
21375           function baseAssignIn(object, source) {
21376             return object && copyObject2(source, keysIn2(source), object);
21377           }
21378           function baseAssignValue2(object, key, value) {
21379             if (key == "__proto__" && defineProperty2) {
21380               defineProperty2(object, key, {
21381                 "configurable": true,
21382                 "enumerable": true,
21383                 "value": value,
21384                 "writable": true
21385               });
21386             } else {
21387               object[key] = value;
21388             }
21389           }
21390           function baseAt(object, paths) {
21391             var index = -1, length2 = paths.length, result2 = Array2(length2), skip = object == null;
21392             while (++index < length2) {
21393               result2[index] = skip ? undefined2 : get4(object, paths[index]);
21394             }
21395             return result2;
21396           }
21397           function baseClamp(number3, lower2, upper) {
21398             if (number3 === number3) {
21399               if (upper !== undefined2) {
21400                 number3 = number3 <= upper ? number3 : upper;
21401               }
21402               if (lower2 !== undefined2) {
21403                 number3 = number3 >= lower2 ? number3 : lower2;
21404               }
21405             }
21406             return number3;
21407           }
21408           function baseClone(value, bitmask, customizer, key, object, stack) {
21409             var result2, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG;
21410             if (customizer) {
21411               result2 = object ? customizer(value, key, object, stack) : customizer(value);
21412             }
21413             if (result2 !== undefined2) {
21414               return result2;
21415             }
21416             if (!isObject2(value)) {
21417               return value;
21418             }
21419             var isArr = isArray2(value);
21420             if (isArr) {
21421               result2 = initCloneArray(value);
21422               if (!isDeep) {
21423                 return copyArray2(value, result2);
21424               }
21425             } else {
21426               var tag2 = getTag2(value), isFunc = tag2 == funcTag3 || tag2 == genTag2;
21427               if (isBuffer2(value)) {
21428                 return cloneBuffer2(value, isDeep);
21429               }
21430               if (tag2 == objectTag5 || tag2 == argsTag4 || isFunc && !object) {
21431                 result2 = isFlat || isFunc ? {} : initCloneObject2(value);
21432                 if (!isDeep) {
21433                   return isFlat ? copySymbolsIn(value, baseAssignIn(result2, value)) : copySymbols(value, baseAssign(result2, value));
21434                 }
21435               } else {
21436                 if (!cloneableTags[tag2]) {
21437                   return object ? value : {};
21438                 }
21439                 result2 = initCloneByTag(value, tag2, isDeep);
21440               }
21441             }
21442             stack || (stack = new Stack2());
21443             var stacked = stack.get(value);
21444             if (stacked) {
21445               return stacked;
21446             }
21447             stack.set(value, result2);
21448             if (isSet(value)) {
21449               value.forEach(function(subValue) {
21450                 result2.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
21451               });
21452             } else if (isMap(value)) {
21453               value.forEach(function(subValue, key2) {
21454                 result2.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
21455               });
21456             }
21457             var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys2 : isFlat ? keysIn2 : keys2;
21458             var props = isArr ? undefined2 : keysFunc(value);
21459             arrayEach(props || value, function(subValue, key2) {
21460               if (props) {
21461                 key2 = subValue;
21462                 subValue = value[key2];
21463               }
21464               assignValue2(result2, key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
21465             });
21466             return result2;
21467           }
21468           function baseConforms(source) {
21469             var props = keys2(source);
21470             return function(object) {
21471               return baseConformsTo(object, source, props);
21472             };
21473           }
21474           function baseConformsTo(object, source, props) {
21475             var length2 = props.length;
21476             if (object == null) {
21477               return !length2;
21478             }
21479             object = Object2(object);
21480             while (length2--) {
21481               var key = props[length2], predicate = source[key], value = object[key];
21482               if (value === undefined2 && !(key in object) || !predicate(value)) {
21483                 return false;
21484               }
21485             }
21486             return true;
21487           }
21488           function baseDelay(func, wait, args) {
21489             if (typeof func != "function") {
21490               throw new TypeError2(FUNC_ERROR_TEXT3);
21491             }
21492             return setTimeout2(function() {
21493               func.apply(undefined2, args);
21494             }, wait);
21495           }
21496           function baseDifference(array2, values2, iteratee2, comparator) {
21497             var index = -1, includes2 = arrayIncludes, isCommon = true, length2 = array2.length, result2 = [], valuesLength = values2.length;
21498             if (!length2) {
21499               return result2;
21500             }
21501             if (iteratee2) {
21502               values2 = arrayMap2(values2, baseUnary2(iteratee2));
21503             }
21504             if (comparator) {
21505               includes2 = arrayIncludesWith;
21506               isCommon = false;
21507             } else if (values2.length >= LARGE_ARRAY_SIZE2) {
21508               includes2 = cacheHas2;
21509               isCommon = false;
21510               values2 = new SetCache2(values2);
21511             }
21512             outer:
21513               while (++index < length2) {
21514                 var value = array2[index], computed = iteratee2 == null ? value : iteratee2(value);
21515                 value = comparator || value !== 0 ? value : 0;
21516                 if (isCommon && computed === computed) {
21517                   var valuesIndex = valuesLength;
21518                   while (valuesIndex--) {
21519                     if (values2[valuesIndex] === computed) {
21520                       continue outer;
21521                     }
21522                   }
21523                   result2.push(value);
21524                 } else if (!includes2(values2, computed, comparator)) {
21525                   result2.push(value);
21526                 }
21527               }
21528             return result2;
21529           }
21530           var baseEach = createBaseEach(baseForOwn);
21531           var baseEachRight = createBaseEach(baseForOwnRight, true);
21532           function baseEvery(collection, predicate) {
21533             var result2 = true;
21534             baseEach(collection, function(value, index, collection2) {
21535               result2 = !!predicate(value, index, collection2);
21536               return result2;
21537             });
21538             return result2;
21539           }
21540           function baseExtremum(array2, iteratee2, comparator) {
21541             var index = -1, length2 = array2.length;
21542             while (++index < length2) {
21543               var value = array2[index], current = iteratee2(value);
21544               if (current != null && (computed === undefined2 ? current === current && !isSymbol2(current) : comparator(current, computed))) {
21545                 var computed = current, result2 = value;
21546               }
21547             }
21548             return result2;
21549           }
21550           function baseFill(array2, value, start2, end) {
21551             var length2 = array2.length;
21552             start2 = toInteger(start2);
21553             if (start2 < 0) {
21554               start2 = -start2 > length2 ? 0 : length2 + start2;
21555             }
21556             end = end === undefined2 || end > length2 ? length2 : toInteger(end);
21557             if (end < 0) {
21558               end += length2;
21559             }
21560             end = start2 > end ? 0 : toLength(end);
21561             while (start2 < end) {
21562               array2[start2++] = value;
21563             }
21564             return array2;
21565           }
21566           function baseFilter(collection, predicate) {
21567             var result2 = [];
21568             baseEach(collection, function(value, index, collection2) {
21569               if (predicate(value, index, collection2)) {
21570                 result2.push(value);
21571               }
21572             });
21573             return result2;
21574           }
21575           function baseFlatten(array2, depth, predicate, isStrict, result2) {
21576             var index = -1, length2 = array2.length;
21577             predicate || (predicate = isFlattenable);
21578             result2 || (result2 = []);
21579             while (++index < length2) {
21580               var value = array2[index];
21581               if (depth > 0 && predicate(value)) {
21582                 if (depth > 1) {
21583                   baseFlatten(value, depth - 1, predicate, isStrict, result2);
21584                 } else {
21585                   arrayPush2(result2, value);
21586                 }
21587               } else if (!isStrict) {
21588                 result2[result2.length] = value;
21589               }
21590             }
21591             return result2;
21592           }
21593           var baseFor2 = createBaseFor2();
21594           var baseForRight = createBaseFor2(true);
21595           function baseForOwn(object, iteratee2) {
21596             return object && baseFor2(object, iteratee2, keys2);
21597           }
21598           function baseForOwnRight(object, iteratee2) {
21599             return object && baseForRight(object, iteratee2, keys2);
21600           }
21601           function baseFunctions(object, props) {
21602             return arrayFilter2(props, function(key) {
21603               return isFunction2(object[key]);
21604             });
21605           }
21606           function baseGet(object, path) {
21607             path = castPath(path, object);
21608             var index = 0, length2 = path.length;
21609             while (object != null && index < length2) {
21610               object = object[toKey(path[index++])];
21611             }
21612             return index && index == length2 ? object : undefined2;
21613           }
21614           function baseGetAllKeys2(object, keysFunc, symbolsFunc) {
21615             var result2 = keysFunc(object);
21616             return isArray2(object) ? result2 : arrayPush2(result2, symbolsFunc(object));
21617           }
21618           function baseGetTag2(value) {
21619             if (value == null) {
21620               return value === undefined2 ? undefinedTag2 : nullTag2;
21621             }
21622             return symToStringTag3 && symToStringTag3 in Object2(value) ? getRawTag2(value) : objectToString2(value);
21623           }
21624           function baseGt(value, other2) {
21625             return value > other2;
21626           }
21627           function baseHas(object, key) {
21628             return object != null && hasOwnProperty13.call(object, key);
21629           }
21630           function baseHasIn(object, key) {
21631             return object != null && key in Object2(object);
21632           }
21633           function baseInRange(number3, start2, end) {
21634             return number3 >= nativeMin2(start2, end) && number3 < nativeMax3(start2, end);
21635           }
21636           function baseIntersection(arrays, iteratee2, comparator) {
21637             var includes2 = comparator ? arrayIncludesWith : arrayIncludes, length2 = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array2(othLength), maxLength = Infinity, result2 = [];
21638             while (othIndex--) {
21639               var array2 = arrays[othIndex];
21640               if (othIndex && iteratee2) {
21641                 array2 = arrayMap2(array2, baseUnary2(iteratee2));
21642               }
21643               maxLength = nativeMin2(array2.length, maxLength);
21644               caches[othIndex] = !comparator && (iteratee2 || length2 >= 120 && array2.length >= 120) ? new SetCache2(othIndex && array2) : undefined2;
21645             }
21646             array2 = arrays[0];
21647             var index = -1, seen = caches[0];
21648             outer:
21649               while (++index < length2 && result2.length < maxLength) {
21650                 var value = array2[index], computed = iteratee2 ? iteratee2(value) : value;
21651                 value = comparator || value !== 0 ? value : 0;
21652                 if (!(seen ? cacheHas2(seen, computed) : includes2(result2, computed, comparator))) {
21653                   othIndex = othLength;
21654                   while (--othIndex) {
21655                     var cache = caches[othIndex];
21656                     if (!(cache ? cacheHas2(cache, computed) : includes2(arrays[othIndex], computed, comparator))) {
21657                       continue outer;
21658                     }
21659                   }
21660                   if (seen) {
21661                     seen.push(computed);
21662                   }
21663                   result2.push(value);
21664                 }
21665               }
21666             return result2;
21667           }
21668           function baseInverter(object, setter, iteratee2, accumulator) {
21669             baseForOwn(object, function(value, key, object2) {
21670               setter(accumulator, iteratee2(value), key, object2);
21671             });
21672             return accumulator;
21673           }
21674           function baseInvoke(object, path, args) {
21675             path = castPath(path, object);
21676             object = parent(object, path);
21677             var func = object == null ? object : object[toKey(last(path))];
21678             return func == null ? undefined2 : apply2(func, object, args);
21679           }
21680           function baseIsArguments2(value) {
21681             return isObjectLike2(value) && baseGetTag2(value) == argsTag4;
21682           }
21683           function baseIsArrayBuffer(value) {
21684             return isObjectLike2(value) && baseGetTag2(value) == arrayBufferTag3;
21685           }
21686           function baseIsDate(value) {
21687             return isObjectLike2(value) && baseGetTag2(value) == dateTag3;
21688           }
21689           function baseIsEqual2(value, other2, bitmask, customizer, stack) {
21690             if (value === other2) {
21691               return true;
21692             }
21693             if (value == null || other2 == null || !isObjectLike2(value) && !isObjectLike2(other2)) {
21694               return value !== value && other2 !== other2;
21695             }
21696             return baseIsEqualDeep2(value, other2, bitmask, customizer, baseIsEqual2, stack);
21697           }
21698           function baseIsEqualDeep2(object, other2, bitmask, customizer, equalFunc, stack) {
21699             var objIsArr = isArray2(object), othIsArr = isArray2(other2), objTag = objIsArr ? arrayTag3 : getTag2(object), othTag = othIsArr ? arrayTag3 : getTag2(other2);
21700             objTag = objTag == argsTag4 ? objectTag5 : objTag;
21701             othTag = othTag == argsTag4 ? objectTag5 : othTag;
21702             var objIsObj = objTag == objectTag5, othIsObj = othTag == objectTag5, isSameTag = objTag == othTag;
21703             if (isSameTag && isBuffer2(object)) {
21704               if (!isBuffer2(other2)) {
21705                 return false;
21706               }
21707               objIsArr = true;
21708               objIsObj = false;
21709             }
21710             if (isSameTag && !objIsObj) {
21711               stack || (stack = new Stack2());
21712               return objIsArr || isTypedArray2(object) ? equalArrays2(object, other2, bitmask, customizer, equalFunc, stack) : equalByTag2(object, other2, objTag, bitmask, customizer, equalFunc, stack);
21713             }
21714             if (!(bitmask & COMPARE_PARTIAL_FLAG5)) {
21715               var objIsWrapped = objIsObj && hasOwnProperty13.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty13.call(other2, "__wrapped__");
21716               if (objIsWrapped || othIsWrapped) {
21717                 var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other2.value() : other2;
21718                 stack || (stack = new Stack2());
21719                 return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
21720               }
21721             }
21722             if (!isSameTag) {
21723               return false;
21724             }
21725             stack || (stack = new Stack2());
21726             return equalObjects2(object, other2, bitmask, customizer, equalFunc, stack);
21727           }
21728           function baseIsMap(value) {
21729             return isObjectLike2(value) && getTag2(value) == mapTag4;
21730           }
21731           function baseIsMatch(object, source, matchData, customizer) {
21732             var index = matchData.length, length2 = index, noCustomizer = !customizer;
21733             if (object == null) {
21734               return !length2;
21735             }
21736             object = Object2(object);
21737             while (index--) {
21738               var data = matchData[index];
21739               if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
21740                 return false;
21741               }
21742             }
21743             while (++index < length2) {
21744               data = matchData[index];
21745               var key = data[0], objValue = object[key], srcValue = data[1];
21746               if (noCustomizer && data[2]) {
21747                 if (objValue === undefined2 && !(key in object)) {
21748                   return false;
21749                 }
21750               } else {
21751                 var stack = new Stack2();
21752                 if (customizer) {
21753                   var result2 = customizer(objValue, srcValue, key, object, source, stack);
21754                 }
21755                 if (!(result2 === undefined2 ? baseIsEqual2(srcValue, objValue, COMPARE_PARTIAL_FLAG5 | COMPARE_UNORDERED_FLAG3, customizer, stack) : result2)) {
21756                   return false;
21757                 }
21758               }
21759             }
21760             return true;
21761           }
21762           function baseIsNative2(value) {
21763             if (!isObject2(value) || isMasked2(value)) {
21764               return false;
21765             }
21766             var pattern = isFunction2(value) ? reIsNative2 : reIsHostCtor2;
21767             return pattern.test(toSource2(value));
21768           }
21769           function baseIsRegExp(value) {
21770             return isObjectLike2(value) && baseGetTag2(value) == regexpTag3;
21771           }
21772           function baseIsSet(value) {
21773             return isObjectLike2(value) && getTag2(value) == setTag4;
21774           }
21775           function baseIsTypedArray2(value) {
21776             return isObjectLike2(value) && isLength2(value.length) && !!typedArrayTags2[baseGetTag2(value)];
21777           }
21778           function baseIteratee(value) {
21779             if (typeof value == "function") {
21780               return value;
21781             }
21782             if (value == null) {
21783               return identity5;
21784             }
21785             if (typeof value == "object") {
21786               return isArray2(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
21787             }
21788             return property(value);
21789           }
21790           function baseKeys2(object) {
21791             if (!isPrototype2(object)) {
21792               return nativeKeys2(object);
21793             }
21794             var result2 = [];
21795             for (var key in Object2(object)) {
21796               if (hasOwnProperty13.call(object, key) && key != "constructor") {
21797                 result2.push(key);
21798               }
21799             }
21800             return result2;
21801           }
21802           function baseKeysIn2(object) {
21803             if (!isObject2(object)) {
21804               return nativeKeysIn2(object);
21805             }
21806             var isProto = isPrototype2(object), result2 = [];
21807             for (var key in object) {
21808               if (!(key == "constructor" && (isProto || !hasOwnProperty13.call(object, key)))) {
21809                 result2.push(key);
21810               }
21811             }
21812             return result2;
21813           }
21814           function baseLt(value, other2) {
21815             return value < other2;
21816           }
21817           function baseMap(collection, iteratee2) {
21818             var index = -1, result2 = isArrayLike2(collection) ? Array2(collection.length) : [];
21819             baseEach(collection, function(value, key, collection2) {
21820               result2[++index] = iteratee2(value, key, collection2);
21821             });
21822             return result2;
21823           }
21824           function baseMatches(source) {
21825             var matchData = getMatchData(source);
21826             if (matchData.length == 1 && matchData[0][2]) {
21827               return matchesStrictComparable(matchData[0][0], matchData[0][1]);
21828             }
21829             return function(object) {
21830               return object === source || baseIsMatch(object, source, matchData);
21831             };
21832           }
21833           function baseMatchesProperty(path, srcValue) {
21834             if (isKey(path) && isStrictComparable(srcValue)) {
21835               return matchesStrictComparable(toKey(path), srcValue);
21836             }
21837             return function(object) {
21838               var objValue = get4(object, path);
21839               return objValue === undefined2 && objValue === srcValue ? hasIn(object, path) : baseIsEqual2(srcValue, objValue, COMPARE_PARTIAL_FLAG5 | COMPARE_UNORDERED_FLAG3);
21840             };
21841           }
21842           function baseMerge2(object, source, srcIndex, customizer, stack) {
21843             if (object === source) {
21844               return;
21845             }
21846             baseFor2(source, function(srcValue, key) {
21847               stack || (stack = new Stack2());
21848               if (isObject2(srcValue)) {
21849                 baseMergeDeep2(object, source, key, srcIndex, baseMerge2, customizer, stack);
21850               } else {
21851                 var newValue = customizer ? customizer(safeGet2(object, key), srcValue, key + "", object, source, stack) : undefined2;
21852                 if (newValue === undefined2) {
21853                   newValue = srcValue;
21854                 }
21855                 assignMergeValue2(object, key, newValue);
21856               }
21857             }, keysIn2);
21858           }
21859           function baseMergeDeep2(object, source, key, srcIndex, mergeFunc, customizer, stack) {
21860             var objValue = safeGet2(object, key), srcValue = safeGet2(source, key), stacked = stack.get(srcValue);
21861             if (stacked) {
21862               assignMergeValue2(object, key, stacked);
21863               return;
21864             }
21865             var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : undefined2;
21866             var isCommon = newValue === undefined2;
21867             if (isCommon) {
21868               var isArr = isArray2(srcValue), isBuff = !isArr && isBuffer2(srcValue), isTyped = !isArr && !isBuff && isTypedArray2(srcValue);
21869               newValue = srcValue;
21870               if (isArr || isBuff || isTyped) {
21871                 if (isArray2(objValue)) {
21872                   newValue = objValue;
21873                 } else if (isArrayLikeObject2(objValue)) {
21874                   newValue = copyArray2(objValue);
21875                 } else if (isBuff) {
21876                   isCommon = false;
21877                   newValue = cloneBuffer2(srcValue, true);
21878                 } else if (isTyped) {
21879                   isCommon = false;
21880                   newValue = cloneTypedArray2(srcValue, true);
21881                 } else {
21882                   newValue = [];
21883                 }
21884               } else if (isPlainObject2(srcValue) || isArguments2(srcValue)) {
21885                 newValue = objValue;
21886                 if (isArguments2(objValue)) {
21887                   newValue = toPlainObject2(objValue);
21888                 } else if (!isObject2(objValue) || isFunction2(objValue)) {
21889                   newValue = initCloneObject2(srcValue);
21890                 }
21891               } else {
21892                 isCommon = false;
21893               }
21894             }
21895             if (isCommon) {
21896               stack.set(srcValue, newValue);
21897               mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
21898               stack["delete"](srcValue);
21899             }
21900             assignMergeValue2(object, key, newValue);
21901           }
21902           function baseNth(array2, n3) {
21903             var length2 = array2.length;
21904             if (!length2) {
21905               return;
21906             }
21907             n3 += n3 < 0 ? length2 : 0;
21908             return isIndex2(n3, length2) ? array2[n3] : undefined2;
21909           }
21910           function baseOrderBy(collection, iteratees, orders) {
21911             if (iteratees.length) {
21912               iteratees = arrayMap2(iteratees, function(iteratee2) {
21913                 if (isArray2(iteratee2)) {
21914                   return function(value) {
21915                     return baseGet(value, iteratee2.length === 1 ? iteratee2[0] : iteratee2);
21916                   };
21917                 }
21918                 return iteratee2;
21919               });
21920             } else {
21921               iteratees = [identity5];
21922             }
21923             var index = -1;
21924             iteratees = arrayMap2(iteratees, baseUnary2(getIteratee()));
21925             var result2 = baseMap(collection, function(value, key, collection2) {
21926               var criteria = arrayMap2(iteratees, function(iteratee2) {
21927                 return iteratee2(value);
21928               });
21929               return { "criteria": criteria, "index": ++index, "value": value };
21930             });
21931             return baseSortBy(result2, function(object, other2) {
21932               return compareMultiple(object, other2, orders);
21933             });
21934           }
21935           function basePick(object, paths) {
21936             return basePickBy(object, paths, function(value, path) {
21937               return hasIn(object, path);
21938             });
21939           }
21940           function basePickBy(object, paths, predicate) {
21941             var index = -1, length2 = paths.length, result2 = {};
21942             while (++index < length2) {
21943               var path = paths[index], value = baseGet(object, path);
21944               if (predicate(value, path)) {
21945                 baseSet(result2, castPath(path, object), value);
21946               }
21947             }
21948             return result2;
21949           }
21950           function basePropertyDeep(path) {
21951             return function(object) {
21952               return baseGet(object, path);
21953             };
21954           }
21955           function basePullAll(array2, values2, iteratee2, comparator) {
21956             var indexOf2 = comparator ? baseIndexOfWith : baseIndexOf, index = -1, length2 = values2.length, seen = array2;
21957             if (array2 === values2) {
21958               values2 = copyArray2(values2);
21959             }
21960             if (iteratee2) {
21961               seen = arrayMap2(array2, baseUnary2(iteratee2));
21962             }
21963             while (++index < length2) {
21964               var fromIndex = 0, value = values2[index], computed = iteratee2 ? iteratee2(value) : value;
21965               while ((fromIndex = indexOf2(seen, computed, fromIndex, comparator)) > -1) {
21966                 if (seen !== array2) {
21967                   splice2.call(seen, fromIndex, 1);
21968                 }
21969                 splice2.call(array2, fromIndex, 1);
21970               }
21971             }
21972             return array2;
21973           }
21974           function basePullAt(array2, indexes) {
21975             var length2 = array2 ? indexes.length : 0, lastIndex = length2 - 1;
21976             while (length2--) {
21977               var index = indexes[length2];
21978               if (length2 == lastIndex || index !== previous) {
21979                 var previous = index;
21980                 if (isIndex2(index)) {
21981                   splice2.call(array2, index, 1);
21982                 } else {
21983                   baseUnset(array2, index);
21984                 }
21985               }
21986             }
21987             return array2;
21988           }
21989           function baseRandom(lower2, upper) {
21990             return lower2 + nativeFloor(nativeRandom() * (upper - lower2 + 1));
21991           }
21992           function baseRange(start2, end, step, fromRight) {
21993             var index = -1, length2 = nativeMax3(nativeCeil((end - start2) / (step || 1)), 0), result2 = Array2(length2);
21994             while (length2--) {
21995               result2[fromRight ? length2 : ++index] = start2;
21996               start2 += step;
21997             }
21998             return result2;
21999           }
22000           function baseRepeat(string, n3) {
22001             var result2 = "";
22002             if (!string || n3 < 1 || n3 > MAX_SAFE_INTEGER4) {
22003               return result2;
22004             }
22005             do {
22006               if (n3 % 2) {
22007                 result2 += string;
22008               }
22009               n3 = nativeFloor(n3 / 2);
22010               if (n3) {
22011                 string += string;
22012               }
22013             } while (n3);
22014             return result2;
22015           }
22016           function baseRest2(func, start2) {
22017             return setToString2(overRest2(func, start2, identity5), func + "");
22018           }
22019           function baseSample(collection) {
22020             return arraySample(values(collection));
22021           }
22022           function baseSampleSize(collection, n3) {
22023             var array2 = values(collection);
22024             return shuffleSelf(array2, baseClamp(n3, 0, array2.length));
22025           }
22026           function baseSet(object, path, value, customizer) {
22027             if (!isObject2(object)) {
22028               return object;
22029             }
22030             path = castPath(path, object);
22031             var index = -1, length2 = path.length, lastIndex = length2 - 1, nested = object;
22032             while (nested != null && ++index < length2) {
22033               var key = toKey(path[index]), newValue = value;
22034               if (key === "__proto__" || key === "constructor" || key === "prototype") {
22035                 return object;
22036               }
22037               if (index != lastIndex) {
22038                 var objValue = nested[key];
22039                 newValue = customizer ? customizer(objValue, key, nested) : undefined2;
22040                 if (newValue === undefined2) {
22041                   newValue = isObject2(objValue) ? objValue : isIndex2(path[index + 1]) ? [] : {};
22042                 }
22043               }
22044               assignValue2(nested, key, newValue);
22045               nested = nested[key];
22046             }
22047             return object;
22048           }
22049           var baseSetData = !metaMap ? identity5 : function(func, data) {
22050             metaMap.set(func, data);
22051             return func;
22052           };
22053           var baseSetToString2 = !defineProperty2 ? identity5 : function(func, string) {
22054             return defineProperty2(func, "toString", {
22055               "configurable": true,
22056               "enumerable": false,
22057               "value": constant2(string),
22058               "writable": true
22059             });
22060           };
22061           function baseShuffle(collection) {
22062             return shuffleSelf(values(collection));
22063           }
22064           function baseSlice(array2, start2, end) {
22065             var index = -1, length2 = array2.length;
22066             if (start2 < 0) {
22067               start2 = -start2 > length2 ? 0 : length2 + start2;
22068             }
22069             end = end > length2 ? length2 : end;
22070             if (end < 0) {
22071               end += length2;
22072             }
22073             length2 = start2 > end ? 0 : end - start2 >>> 0;
22074             start2 >>>= 0;
22075             var result2 = Array2(length2);
22076             while (++index < length2) {
22077               result2[index] = array2[index + start2];
22078             }
22079             return result2;
22080           }
22081           function baseSome(collection, predicate) {
22082             var result2;
22083             baseEach(collection, function(value, index, collection2) {
22084               result2 = predicate(value, index, collection2);
22085               return !result2;
22086             });
22087             return !!result2;
22088           }
22089           function baseSortedIndex(array2, value, retHighest) {
22090             var low = 0, high = array2 == null ? low : array2.length;
22091             if (typeof value == "number" && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
22092               while (low < high) {
22093                 var mid = low + high >>> 1, computed = array2[mid];
22094                 if (computed !== null && !isSymbol2(computed) && (retHighest ? computed <= value : computed < value)) {
22095                   low = mid + 1;
22096                 } else {
22097                   high = mid;
22098                 }
22099               }
22100               return high;
22101             }
22102             return baseSortedIndexBy(array2, value, identity5, retHighest);
22103           }
22104           function baseSortedIndexBy(array2, value, iteratee2, retHighest) {
22105             var low = 0, high = array2 == null ? 0 : array2.length;
22106             if (high === 0) {
22107               return 0;
22108             }
22109             value = iteratee2(value);
22110             var valIsNaN = value !== value, valIsNull = value === null, valIsSymbol = isSymbol2(value), valIsUndefined = value === undefined2;
22111             while (low < high) {
22112               var mid = nativeFloor((low + high) / 2), computed = iteratee2(array2[mid]), othIsDefined = computed !== undefined2, othIsNull = computed === null, othIsReflexive = computed === computed, othIsSymbol = isSymbol2(computed);
22113               if (valIsNaN) {
22114                 var setLow = retHighest || othIsReflexive;
22115               } else if (valIsUndefined) {
22116                 setLow = othIsReflexive && (retHighest || othIsDefined);
22117               } else if (valIsNull) {
22118                 setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
22119               } else if (valIsSymbol) {
22120                 setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
22121               } else if (othIsNull || othIsSymbol) {
22122                 setLow = false;
22123               } else {
22124                 setLow = retHighest ? computed <= value : computed < value;
22125               }
22126               if (setLow) {
22127                 low = mid + 1;
22128               } else {
22129                 high = mid;
22130               }
22131             }
22132             return nativeMin2(high, MAX_ARRAY_INDEX);
22133           }
22134           function baseSortedUniq(array2, iteratee2) {
22135             var index = -1, length2 = array2.length, resIndex = 0, result2 = [];
22136             while (++index < length2) {
22137               var value = array2[index], computed = iteratee2 ? iteratee2(value) : value;
22138               if (!index || !eq2(computed, seen)) {
22139                 var seen = computed;
22140                 result2[resIndex++] = value === 0 ? 0 : value;
22141               }
22142             }
22143             return result2;
22144           }
22145           function baseToNumber(value) {
22146             if (typeof value == "number") {
22147               return value;
22148             }
22149             if (isSymbol2(value)) {
22150               return NAN2;
22151             }
22152             return +value;
22153           }
22154           function baseToString2(value) {
22155             if (typeof value == "string") {
22156               return value;
22157             }
22158             if (isArray2(value)) {
22159               return arrayMap2(value, baseToString2) + "";
22160             }
22161             if (isSymbol2(value)) {
22162               return symbolToString2 ? symbolToString2.call(value) : "";
22163             }
22164             var result2 = value + "";
22165             return result2 == "0" && 1 / value == -INFINITY2 ? "-0" : result2;
22166           }
22167           function baseUniq(array2, iteratee2, comparator) {
22168             var index = -1, includes2 = arrayIncludes, length2 = array2.length, isCommon = true, result2 = [], seen = result2;
22169             if (comparator) {
22170               isCommon = false;
22171               includes2 = arrayIncludesWith;
22172             } else if (length2 >= LARGE_ARRAY_SIZE2) {
22173               var set5 = iteratee2 ? null : createSet(array2);
22174               if (set5) {
22175                 return setToArray2(set5);
22176               }
22177               isCommon = false;
22178               includes2 = cacheHas2;
22179               seen = new SetCache2();
22180             } else {
22181               seen = iteratee2 ? [] : result2;
22182             }
22183             outer:
22184               while (++index < length2) {
22185                 var value = array2[index], computed = iteratee2 ? iteratee2(value) : value;
22186                 value = comparator || value !== 0 ? value : 0;
22187                 if (isCommon && computed === computed) {
22188                   var seenIndex = seen.length;
22189                   while (seenIndex--) {
22190                     if (seen[seenIndex] === computed) {
22191                       continue outer;
22192                     }
22193                   }
22194                   if (iteratee2) {
22195                     seen.push(computed);
22196                   }
22197                   result2.push(value);
22198                 } else if (!includes2(seen, computed, comparator)) {
22199                   if (seen !== result2) {
22200                     seen.push(computed);
22201                   }
22202                   result2.push(value);
22203                 }
22204               }
22205             return result2;
22206           }
22207           function baseUnset(object, path) {
22208             path = castPath(path, object);
22209             object = parent(object, path);
22210             return object == null || delete object[toKey(last(path))];
22211           }
22212           function baseUpdate(object, path, updater, customizer) {
22213             return baseSet(object, path, updater(baseGet(object, path)), customizer);
22214           }
22215           function baseWhile(array2, predicate, isDrop, fromRight) {
22216             var length2 = array2.length, index = fromRight ? length2 : -1;
22217             while ((fromRight ? index-- : ++index < length2) && predicate(array2[index], index, array2)) {
22218             }
22219             return isDrop ? baseSlice(array2, fromRight ? 0 : index, fromRight ? index + 1 : length2) : baseSlice(array2, fromRight ? index + 1 : 0, fromRight ? length2 : index);
22220           }
22221           function baseWrapperValue(value, actions) {
22222             var result2 = value;
22223             if (result2 instanceof LazyWrapper) {
22224               result2 = result2.value();
22225             }
22226             return arrayReduce(actions, function(result3, action) {
22227               return action.func.apply(action.thisArg, arrayPush2([result3], action.args));
22228             }, result2);
22229           }
22230           function baseXor(arrays, iteratee2, comparator) {
22231             var length2 = arrays.length;
22232             if (length2 < 2) {
22233               return length2 ? baseUniq(arrays[0]) : [];
22234             }
22235             var index = -1, result2 = Array2(length2);
22236             while (++index < length2) {
22237               var array2 = arrays[index], othIndex = -1;
22238               while (++othIndex < length2) {
22239                 if (othIndex != index) {
22240                   result2[index] = baseDifference(result2[index] || array2, arrays[othIndex], iteratee2, comparator);
22241                 }
22242               }
22243             }
22244             return baseUniq(baseFlatten(result2, 1), iteratee2, comparator);
22245           }
22246           function baseZipObject(props, values2, assignFunc) {
22247             var index = -1, length2 = props.length, valsLength = values2.length, result2 = {};
22248             while (++index < length2) {
22249               var value = index < valsLength ? values2[index] : undefined2;
22250               assignFunc(result2, props[index], value);
22251             }
22252             return result2;
22253           }
22254           function castArrayLikeObject(value) {
22255             return isArrayLikeObject2(value) ? value : [];
22256           }
22257           function castFunction(value) {
22258             return typeof value == "function" ? value : identity5;
22259           }
22260           function castPath(value, object) {
22261             if (isArray2(value)) {
22262               return value;
22263             }
22264             return isKey(value, object) ? [value] : stringToPath(toString2(value));
22265           }
22266           var castRest = baseRest2;
22267           function castSlice(array2, start2, end) {
22268             var length2 = array2.length;
22269             end = end === undefined2 ? length2 : end;
22270             return !start2 && end >= length2 ? array2 : baseSlice(array2, start2, end);
22271           }
22272           var clearTimeout2 = ctxClearTimeout || function(id2) {
22273             return root3.clearTimeout(id2);
22274           };
22275           function cloneBuffer2(buffer, isDeep) {
22276             if (isDeep) {
22277               return buffer.slice();
22278             }
22279             var length2 = buffer.length, result2 = allocUnsafe2 ? allocUnsafe2(length2) : new buffer.constructor(length2);
22280             buffer.copy(result2);
22281             return result2;
22282           }
22283           function cloneArrayBuffer2(arrayBuffer) {
22284             var result2 = new arrayBuffer.constructor(arrayBuffer.byteLength);
22285             new Uint8Array3(result2).set(new Uint8Array3(arrayBuffer));
22286             return result2;
22287           }
22288           function cloneDataView(dataView, isDeep) {
22289             var buffer = isDeep ? cloneArrayBuffer2(dataView.buffer) : dataView.buffer;
22290             return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
22291           }
22292           function cloneRegExp(regexp) {
22293             var result2 = new regexp.constructor(regexp.source, reFlags.exec(regexp));
22294             result2.lastIndex = regexp.lastIndex;
22295             return result2;
22296           }
22297           function cloneSymbol(symbol) {
22298             return symbolValueOf2 ? Object2(symbolValueOf2.call(symbol)) : {};
22299           }
22300           function cloneTypedArray2(typedArray, isDeep) {
22301             var buffer = isDeep ? cloneArrayBuffer2(typedArray.buffer) : typedArray.buffer;
22302             return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
22303           }
22304           function compareAscending(value, other2) {
22305             if (value !== other2) {
22306               var valIsDefined = value !== undefined2, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol2(value);
22307               var othIsDefined = other2 !== undefined2, othIsNull = other2 === null, othIsReflexive = other2 === other2, othIsSymbol = isSymbol2(other2);
22308               if (!othIsNull && !othIsSymbol && !valIsSymbol && value > other2 || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) {
22309                 return 1;
22310               }
22311               if (!valIsNull && !valIsSymbol && !othIsSymbol && value < other2 || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) {
22312                 return -1;
22313               }
22314             }
22315             return 0;
22316           }
22317           function compareMultiple(object, other2, orders) {
22318             var index = -1, objCriteria = object.criteria, othCriteria = other2.criteria, length2 = objCriteria.length, ordersLength = orders.length;
22319             while (++index < length2) {
22320               var result2 = compareAscending(objCriteria[index], othCriteria[index]);
22321               if (result2) {
22322                 if (index >= ordersLength) {
22323                   return result2;
22324                 }
22325                 var order = orders[index];
22326                 return result2 * (order == "desc" ? -1 : 1);
22327               }
22328             }
22329             return object.index - other2.index;
22330           }
22331           function composeArgs(args, partials, holders, isCurried) {
22332             var argsIndex = -1, argsLength = args.length, holdersLength = holders.length, leftIndex = -1, leftLength = partials.length, rangeLength = nativeMax3(argsLength - holdersLength, 0), result2 = Array2(leftLength + rangeLength), isUncurried = !isCurried;
22333             while (++leftIndex < leftLength) {
22334               result2[leftIndex] = partials[leftIndex];
22335             }
22336             while (++argsIndex < holdersLength) {
22337               if (isUncurried || argsIndex < argsLength) {
22338                 result2[holders[argsIndex]] = args[argsIndex];
22339               }
22340             }
22341             while (rangeLength--) {
22342               result2[leftIndex++] = args[argsIndex++];
22343             }
22344             return result2;
22345           }
22346           function composeArgsRight(args, partials, holders, isCurried) {
22347             var argsIndex = -1, argsLength = args.length, holdersIndex = -1, holdersLength = holders.length, rightIndex = -1, rightLength = partials.length, rangeLength = nativeMax3(argsLength - holdersLength, 0), result2 = Array2(rangeLength + rightLength), isUncurried = !isCurried;
22348             while (++argsIndex < rangeLength) {
22349               result2[argsIndex] = args[argsIndex];
22350             }
22351             var offset = argsIndex;
22352             while (++rightIndex < rightLength) {
22353               result2[offset + rightIndex] = partials[rightIndex];
22354             }
22355             while (++holdersIndex < holdersLength) {
22356               if (isUncurried || argsIndex < argsLength) {
22357                 result2[offset + holders[holdersIndex]] = args[argsIndex++];
22358               }
22359             }
22360             return result2;
22361           }
22362           function copyArray2(source, array2) {
22363             var index = -1, length2 = source.length;
22364             array2 || (array2 = Array2(length2));
22365             while (++index < length2) {
22366               array2[index] = source[index];
22367             }
22368             return array2;
22369           }
22370           function copyObject2(source, props, object, customizer) {
22371             var isNew = !object;
22372             object || (object = {});
22373             var index = -1, length2 = props.length;
22374             while (++index < length2) {
22375               var key = props[index];
22376               var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined2;
22377               if (newValue === undefined2) {
22378                 newValue = source[key];
22379               }
22380               if (isNew) {
22381                 baseAssignValue2(object, key, newValue);
22382               } else {
22383                 assignValue2(object, key, newValue);
22384               }
22385             }
22386             return object;
22387           }
22388           function copySymbols(source, object) {
22389             return copyObject2(source, getSymbols2(source), object);
22390           }
22391           function copySymbolsIn(source, object) {
22392             return copyObject2(source, getSymbolsIn(source), object);
22393           }
22394           function createAggregator(setter, initializer) {
22395             return function(collection, iteratee2) {
22396               var func = isArray2(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {};
22397               return func(collection, setter, getIteratee(iteratee2, 2), accumulator);
22398             };
22399           }
22400           function createAssigner2(assigner) {
22401             return baseRest2(function(object, sources) {
22402               var index = -1, length2 = sources.length, customizer = length2 > 1 ? sources[length2 - 1] : undefined2, guard = length2 > 2 ? sources[2] : undefined2;
22403               customizer = assigner.length > 3 && typeof customizer == "function" ? (length2--, customizer) : undefined2;
22404               if (guard && isIterateeCall2(sources[0], sources[1], guard)) {
22405                 customizer = length2 < 3 ? undefined2 : customizer;
22406                 length2 = 1;
22407               }
22408               object = Object2(object);
22409               while (++index < length2) {
22410                 var source = sources[index];
22411                 if (source) {
22412                   assigner(object, source, index, customizer);
22413                 }
22414               }
22415               return object;
22416             });
22417           }
22418           function createBaseEach(eachFunc, fromRight) {
22419             return function(collection, iteratee2) {
22420               if (collection == null) {
22421                 return collection;
22422               }
22423               if (!isArrayLike2(collection)) {
22424                 return eachFunc(collection, iteratee2);
22425               }
22426               var length2 = collection.length, index = fromRight ? length2 : -1, iterable = Object2(collection);
22427               while (fromRight ? index-- : ++index < length2) {
22428                 if (iteratee2(iterable[index], index, iterable) === false) {
22429                   break;
22430                 }
22431               }
22432               return collection;
22433             };
22434           }
22435           function createBaseFor2(fromRight) {
22436             return function(object, iteratee2, keysFunc) {
22437               var index = -1, iterable = Object2(object), props = keysFunc(object), length2 = props.length;
22438               while (length2--) {
22439                 var key = props[fromRight ? length2 : ++index];
22440                 if (iteratee2(iterable[key], key, iterable) === false) {
22441                   break;
22442                 }
22443               }
22444               return object;
22445             };
22446           }
22447           function createBind(func, bitmask, thisArg) {
22448             var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
22449             function wrapper() {
22450               var fn = this && this !== root3 && this instanceof wrapper ? Ctor : func;
22451               return fn.apply(isBind ? thisArg : this, arguments);
22452             }
22453             return wrapper;
22454           }
22455           function createCaseFirst(methodName) {
22456             return function(string) {
22457               string = toString2(string);
22458               var strSymbols = hasUnicode(string) ? stringToArray(string) : undefined2;
22459               var chr = strSymbols ? strSymbols[0] : string.charAt(0);
22460               var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string.slice(1);
22461               return chr[methodName]() + trailing;
22462             };
22463           }
22464           function createCompounder(callback) {
22465             return function(string) {
22466               return arrayReduce(words(deburr(string).replace(reApos, "")), callback, "");
22467             };
22468           }
22469           function createCtor(Ctor) {
22470             return function() {
22471               var args = arguments;
22472               switch (args.length) {
22473                 case 0:
22474                   return new Ctor();
22475                 case 1:
22476                   return new Ctor(args[0]);
22477                 case 2:
22478                   return new Ctor(args[0], args[1]);
22479                 case 3:
22480                   return new Ctor(args[0], args[1], args[2]);
22481                 case 4:
22482                   return new Ctor(args[0], args[1], args[2], args[3]);
22483                 case 5:
22484                   return new Ctor(args[0], args[1], args[2], args[3], args[4]);
22485                 case 6:
22486                   return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
22487                 case 7:
22488                   return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
22489               }
22490               var thisBinding = baseCreate2(Ctor.prototype), result2 = Ctor.apply(thisBinding, args);
22491               return isObject2(result2) ? result2 : thisBinding;
22492             };
22493           }
22494           function createCurry(func, bitmask, arity) {
22495             var Ctor = createCtor(func);
22496             function wrapper() {
22497               var length2 = arguments.length, args = Array2(length2), index = length2, placeholder = getHolder(wrapper);
22498               while (index--) {
22499                 args[index] = arguments[index];
22500               }
22501               var holders = length2 < 3 && args[0] !== placeholder && args[length2 - 1] !== placeholder ? [] : replaceHolders(args, placeholder);
22502               length2 -= holders.length;
22503               if (length2 < arity) {
22504                 return createRecurry(
22505                   func,
22506                   bitmask,
22507                   createHybrid,
22508                   wrapper.placeholder,
22509                   undefined2,
22510                   args,
22511                   holders,
22512                   undefined2,
22513                   undefined2,
22514                   arity - length2
22515                 );
22516               }
22517               var fn = this && this !== root3 && this instanceof wrapper ? Ctor : func;
22518               return apply2(fn, this, args);
22519             }
22520             return wrapper;
22521           }
22522           function createFind(findIndexFunc) {
22523             return function(collection, predicate, fromIndex) {
22524               var iterable = Object2(collection);
22525               if (!isArrayLike2(collection)) {
22526                 var iteratee2 = getIteratee(predicate, 3);
22527                 collection = keys2(collection);
22528                 predicate = function(key) {
22529                   return iteratee2(iterable[key], key, iterable);
22530                 };
22531               }
22532               var index = findIndexFunc(collection, predicate, fromIndex);
22533               return index > -1 ? iterable[iteratee2 ? collection[index] : index] : undefined2;
22534             };
22535           }
22536           function createFlow(fromRight) {
22537             return flatRest(function(funcs) {
22538               var length2 = funcs.length, index = length2, prereq = LodashWrapper.prototype.thru;
22539               if (fromRight) {
22540                 funcs.reverse();
22541               }
22542               while (index--) {
22543                 var func = funcs[index];
22544                 if (typeof func != "function") {
22545                   throw new TypeError2(FUNC_ERROR_TEXT3);
22546                 }
22547                 if (prereq && !wrapper && getFuncName(func) == "wrapper") {
22548                   var wrapper = new LodashWrapper([], true);
22549                 }
22550               }
22551               index = wrapper ? index : length2;
22552               while (++index < length2) {
22553                 func = funcs[index];
22554                 var funcName = getFuncName(func), data = funcName == "wrapper" ? getData(func) : undefined2;
22555                 if (data && isLaziable(data[0]) && data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && !data[4].length && data[9] == 1) {
22556                   wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
22557                 } else {
22558                   wrapper = func.length == 1 && isLaziable(func) ? wrapper[funcName]() : wrapper.thru(func);
22559                 }
22560               }
22561               return function() {
22562                 var args = arguments, value = args[0];
22563                 if (wrapper && args.length == 1 && isArray2(value)) {
22564                   return wrapper.plant(value).value();
22565                 }
22566                 var index2 = 0, result2 = length2 ? funcs[index2].apply(this, args) : value;
22567                 while (++index2 < length2) {
22568                   result2 = funcs[index2].call(this, result2);
22569                 }
22570                 return result2;
22571               };
22572             });
22573           }
22574           function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary2, arity) {
22575             var isAry = bitmask & WRAP_ARY_FLAG, isBind = bitmask & WRAP_BIND_FLAG, isBindKey = bitmask & WRAP_BIND_KEY_FLAG, isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), isFlip = bitmask & WRAP_FLIP_FLAG, Ctor = isBindKey ? undefined2 : createCtor(func);
22576             function wrapper() {
22577               var length2 = arguments.length, args = Array2(length2), index = length2;
22578               while (index--) {
22579                 args[index] = arguments[index];
22580               }
22581               if (isCurried) {
22582                 var placeholder = getHolder(wrapper), holdersCount = countHolders(args, placeholder);
22583               }
22584               if (partials) {
22585                 args = composeArgs(args, partials, holders, isCurried);
22586               }
22587               if (partialsRight) {
22588                 args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
22589               }
22590               length2 -= holdersCount;
22591               if (isCurried && length2 < arity) {
22592                 var newHolders = replaceHolders(args, placeholder);
22593                 return createRecurry(
22594                   func,
22595                   bitmask,
22596                   createHybrid,
22597                   wrapper.placeholder,
22598                   thisArg,
22599                   args,
22600                   newHolders,
22601                   argPos,
22602                   ary2,
22603                   arity - length2
22604                 );
22605               }
22606               var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func;
22607               length2 = args.length;
22608               if (argPos) {
22609                 args = reorder(args, argPos);
22610               } else if (isFlip && length2 > 1) {
22611                 args.reverse();
22612               }
22613               if (isAry && ary2 < length2) {
22614                 args.length = ary2;
22615               }
22616               if (this && this !== root3 && this instanceof wrapper) {
22617                 fn = Ctor || createCtor(fn);
22618               }
22619               return fn.apply(thisBinding, args);
22620             }
22621             return wrapper;
22622           }
22623           function createInverter(setter, toIteratee) {
22624             return function(object, iteratee2) {
22625               return baseInverter(object, setter, toIteratee(iteratee2), {});
22626             };
22627           }
22628           function createMathOperation(operator, defaultValue) {
22629             return function(value, other2) {
22630               var result2;
22631               if (value === undefined2 && other2 === undefined2) {
22632                 return defaultValue;
22633               }
22634               if (value !== undefined2) {
22635                 result2 = value;
22636               }
22637               if (other2 !== undefined2) {
22638                 if (result2 === undefined2) {
22639                   return other2;
22640                 }
22641                 if (typeof value == "string" || typeof other2 == "string") {
22642                   value = baseToString2(value);
22643                   other2 = baseToString2(other2);
22644                 } else {
22645                   value = baseToNumber(value);
22646                   other2 = baseToNumber(other2);
22647                 }
22648                 result2 = operator(value, other2);
22649               }
22650               return result2;
22651             };
22652           }
22653           function createOver(arrayFunc) {
22654             return flatRest(function(iteratees) {
22655               iteratees = arrayMap2(iteratees, baseUnary2(getIteratee()));
22656               return baseRest2(function(args) {
22657                 var thisArg = this;
22658                 return arrayFunc(iteratees, function(iteratee2) {
22659                   return apply2(iteratee2, thisArg, args);
22660                 });
22661               });
22662             });
22663           }
22664           function createPadding(length2, chars) {
22665             chars = chars === undefined2 ? " " : baseToString2(chars);
22666             var charsLength = chars.length;
22667             if (charsLength < 2) {
22668               return charsLength ? baseRepeat(chars, length2) : chars;
22669             }
22670             var result2 = baseRepeat(chars, nativeCeil(length2 / stringSize(chars)));
22671             return hasUnicode(chars) ? castSlice(stringToArray(result2), 0, length2).join("") : result2.slice(0, length2);
22672           }
22673           function createPartial(func, bitmask, thisArg, partials) {
22674             var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
22675             function wrapper() {
22676               var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array2(leftLength + argsLength), fn = this && this !== root3 && this instanceof wrapper ? Ctor : func;
22677               while (++leftIndex < leftLength) {
22678                 args[leftIndex] = partials[leftIndex];
22679               }
22680               while (argsLength--) {
22681                 args[leftIndex++] = arguments[++argsIndex];
22682               }
22683               return apply2(fn, isBind ? thisArg : this, args);
22684             }
22685             return wrapper;
22686           }
22687           function createRange(fromRight) {
22688             return function(start2, end, step) {
22689               if (step && typeof step != "number" && isIterateeCall2(start2, end, step)) {
22690                 end = step = undefined2;
22691               }
22692               start2 = toFinite(start2);
22693               if (end === undefined2) {
22694                 end = start2;
22695                 start2 = 0;
22696               } else {
22697                 end = toFinite(end);
22698               }
22699               step = step === undefined2 ? start2 < end ? 1 : -1 : toFinite(step);
22700               return baseRange(start2, end, step, fromRight);
22701             };
22702           }
22703           function createRelationalOperation(operator) {
22704             return function(value, other2) {
22705               if (!(typeof value == "string" && typeof other2 == "string")) {
22706                 value = toNumber3(value);
22707                 other2 = toNumber3(other2);
22708               }
22709               return operator(value, other2);
22710             };
22711           }
22712           function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary2, arity) {
22713             var isCurry = bitmask & WRAP_CURRY_FLAG, newHolders = isCurry ? holders : undefined2, newHoldersRight = isCurry ? undefined2 : holders, newPartials = isCurry ? partials : undefined2, newPartialsRight = isCurry ? undefined2 : partials;
22714             bitmask |= isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG;
22715             bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
22716             if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
22717               bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
22718             }
22719             var newData = [
22720               func,
22721               bitmask,
22722               thisArg,
22723               newPartials,
22724               newHolders,
22725               newPartialsRight,
22726               newHoldersRight,
22727               argPos,
22728               ary2,
22729               arity
22730             ];
22731             var result2 = wrapFunc.apply(undefined2, newData);
22732             if (isLaziable(func)) {
22733               setData(result2, newData);
22734             }
22735             result2.placeholder = placeholder;
22736             return setWrapToString(result2, func, bitmask);
22737           }
22738           function createRound(methodName) {
22739             var func = Math2[methodName];
22740             return function(number3, precision3) {
22741               number3 = toNumber3(number3);
22742               precision3 = precision3 == null ? 0 : nativeMin2(toInteger(precision3), 292);
22743               if (precision3 && nativeIsFinite(number3)) {
22744                 var pair3 = (toString2(number3) + "e").split("e"), value = func(pair3[0] + "e" + (+pair3[1] + precision3));
22745                 pair3 = (toString2(value) + "e").split("e");
22746                 return +(pair3[0] + "e" + (+pair3[1] - precision3));
22747               }
22748               return func(number3);
22749             };
22750           }
22751           var createSet = !(Set3 && 1 / setToArray2(new Set3([, -0]))[1] == INFINITY2) ? noop3 : function(values2) {
22752             return new Set3(values2);
22753           };
22754           function createToPairs(keysFunc) {
22755             return function(object) {
22756               var tag2 = getTag2(object);
22757               if (tag2 == mapTag4) {
22758                 return mapToArray2(object);
22759               }
22760               if (tag2 == setTag4) {
22761                 return setToPairs(object);
22762               }
22763               return baseToPairs(object, keysFunc(object));
22764             };
22765           }
22766           function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary2, arity) {
22767             var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
22768             if (!isBindKey && typeof func != "function") {
22769               throw new TypeError2(FUNC_ERROR_TEXT3);
22770             }
22771             var length2 = partials ? partials.length : 0;
22772             if (!length2) {
22773               bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
22774               partials = holders = undefined2;
22775             }
22776             ary2 = ary2 === undefined2 ? ary2 : nativeMax3(toInteger(ary2), 0);
22777             arity = arity === undefined2 ? arity : toInteger(arity);
22778             length2 -= holders ? holders.length : 0;
22779             if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
22780               var partialsRight = partials, holdersRight = holders;
22781               partials = holders = undefined2;
22782             }
22783             var data = isBindKey ? undefined2 : getData(func);
22784             var newData = [
22785               func,
22786               bitmask,
22787               thisArg,
22788               partials,
22789               holders,
22790               partialsRight,
22791               holdersRight,
22792               argPos,
22793               ary2,
22794               arity
22795             ];
22796             if (data) {
22797               mergeData(newData, data);
22798             }
22799             func = newData[0];
22800             bitmask = newData[1];
22801             thisArg = newData[2];
22802             partials = newData[3];
22803             holders = newData[4];
22804             arity = newData[9] = newData[9] === undefined2 ? isBindKey ? 0 : func.length : nativeMax3(newData[9] - length2, 0);
22805             if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
22806               bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
22807             }
22808             if (!bitmask || bitmask == WRAP_BIND_FLAG) {
22809               var result2 = createBind(func, bitmask, thisArg);
22810             } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
22811               result2 = createCurry(func, bitmask, arity);
22812             } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
22813               result2 = createPartial(func, bitmask, thisArg, partials);
22814             } else {
22815               result2 = createHybrid.apply(undefined2, newData);
22816             }
22817             var setter = data ? baseSetData : setData;
22818             return setWrapToString(setter(result2, newData), func, bitmask);
22819           }
22820           function customDefaultsAssignIn(objValue, srcValue, key, object) {
22821             if (objValue === undefined2 || eq2(objValue, objectProto16[key]) && !hasOwnProperty13.call(object, key)) {
22822               return srcValue;
22823             }
22824             return objValue;
22825           }
22826           function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
22827             if (isObject2(objValue) && isObject2(srcValue)) {
22828               stack.set(srcValue, objValue);
22829               baseMerge2(objValue, srcValue, undefined2, customDefaultsMerge, stack);
22830               stack["delete"](srcValue);
22831             }
22832             return objValue;
22833           }
22834           function customOmitClone(value) {
22835             return isPlainObject2(value) ? undefined2 : value;
22836           }
22837           function equalArrays2(array2, other2, bitmask, customizer, equalFunc, stack) {
22838             var isPartial = bitmask & COMPARE_PARTIAL_FLAG5, arrLength = array2.length, othLength = other2.length;
22839             if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
22840               return false;
22841             }
22842             var arrStacked = stack.get(array2);
22843             var othStacked = stack.get(other2);
22844             if (arrStacked && othStacked) {
22845               return arrStacked == other2 && othStacked == array2;
22846             }
22847             var index = -1, result2 = true, seen = bitmask & COMPARE_UNORDERED_FLAG3 ? new SetCache2() : undefined2;
22848             stack.set(array2, other2);
22849             stack.set(other2, array2);
22850             while (++index < arrLength) {
22851               var arrValue = array2[index], othValue = other2[index];
22852               if (customizer) {
22853                 var compared = isPartial ? customizer(othValue, arrValue, index, other2, array2, stack) : customizer(arrValue, othValue, index, array2, other2, stack);
22854               }
22855               if (compared !== undefined2) {
22856                 if (compared) {
22857                   continue;
22858                 }
22859                 result2 = false;
22860                 break;
22861               }
22862               if (seen) {
22863                 if (!arraySome2(other2, function(othValue2, othIndex) {
22864                   if (!cacheHas2(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
22865                     return seen.push(othIndex);
22866                   }
22867                 })) {
22868                   result2 = false;
22869                   break;
22870                 }
22871               } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
22872                 result2 = false;
22873                 break;
22874               }
22875             }
22876             stack["delete"](array2);
22877             stack["delete"](other2);
22878             return result2;
22879           }
22880           function equalByTag2(object, other2, tag2, bitmask, customizer, equalFunc, stack) {
22881             switch (tag2) {
22882               case dataViewTag4:
22883                 if (object.byteLength != other2.byteLength || object.byteOffset != other2.byteOffset) {
22884                   return false;
22885                 }
22886                 object = object.buffer;
22887                 other2 = other2.buffer;
22888               case arrayBufferTag3:
22889                 if (object.byteLength != other2.byteLength || !equalFunc(new Uint8Array3(object), new Uint8Array3(other2))) {
22890                   return false;
22891                 }
22892                 return true;
22893               case boolTag3:
22894               case dateTag3:
22895               case numberTag4:
22896                 return eq2(+object, +other2);
22897               case errorTag3:
22898                 return object.name == other2.name && object.message == other2.message;
22899               case regexpTag3:
22900               case stringTag3:
22901                 return object == other2 + "";
22902               case mapTag4:
22903                 var convert = mapToArray2;
22904               case setTag4:
22905                 var isPartial = bitmask & COMPARE_PARTIAL_FLAG5;
22906                 convert || (convert = setToArray2);
22907                 if (object.size != other2.size && !isPartial) {
22908                   return false;
22909                 }
22910                 var stacked = stack.get(object);
22911                 if (stacked) {
22912                   return stacked == other2;
22913                 }
22914                 bitmask |= COMPARE_UNORDERED_FLAG3;
22915                 stack.set(object, other2);
22916                 var result2 = equalArrays2(convert(object), convert(other2), bitmask, customizer, equalFunc, stack);
22917                 stack["delete"](object);
22918                 return result2;
22919               case symbolTag3:
22920                 if (symbolValueOf2) {
22921                   return symbolValueOf2.call(object) == symbolValueOf2.call(other2);
22922                 }
22923             }
22924             return false;
22925           }
22926           function equalObjects2(object, other2, bitmask, customizer, equalFunc, stack) {
22927             var isPartial = bitmask & COMPARE_PARTIAL_FLAG5, objProps = getAllKeys2(object), objLength = objProps.length, othProps = getAllKeys2(other2), othLength = othProps.length;
22928             if (objLength != othLength && !isPartial) {
22929               return false;
22930             }
22931             var index = objLength;
22932             while (index--) {
22933               var key = objProps[index];
22934               if (!(isPartial ? key in other2 : hasOwnProperty13.call(other2, key))) {
22935                 return false;
22936               }
22937             }
22938             var objStacked = stack.get(object);
22939             var othStacked = stack.get(other2);
22940             if (objStacked && othStacked) {
22941               return objStacked == other2 && othStacked == object;
22942             }
22943             var result2 = true;
22944             stack.set(object, other2);
22945             stack.set(other2, object);
22946             var skipCtor = isPartial;
22947             while (++index < objLength) {
22948               key = objProps[index];
22949               var objValue = object[key], othValue = other2[key];
22950               if (customizer) {
22951                 var compared = isPartial ? customizer(othValue, objValue, key, other2, object, stack) : customizer(objValue, othValue, key, object, other2, stack);
22952               }
22953               if (!(compared === undefined2 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
22954                 result2 = false;
22955                 break;
22956               }
22957               skipCtor || (skipCtor = key == "constructor");
22958             }
22959             if (result2 && !skipCtor) {
22960               var objCtor = object.constructor, othCtor = other2.constructor;
22961               if (objCtor != othCtor && ("constructor" in object && "constructor" in other2) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
22962                 result2 = false;
22963               }
22964             }
22965             stack["delete"](object);
22966             stack["delete"](other2);
22967             return result2;
22968           }
22969           function flatRest(func) {
22970             return setToString2(overRest2(func, undefined2, flatten2), func + "");
22971           }
22972           function getAllKeys2(object) {
22973             return baseGetAllKeys2(object, keys2, getSymbols2);
22974           }
22975           function getAllKeysIn(object) {
22976             return baseGetAllKeys2(object, keysIn2, getSymbolsIn);
22977           }
22978           var getData = !metaMap ? noop3 : function(func) {
22979             return metaMap.get(func);
22980           };
22981           function getFuncName(func) {
22982             var result2 = func.name + "", array2 = realNames[result2], length2 = hasOwnProperty13.call(realNames, result2) ? array2.length : 0;
22983             while (length2--) {
22984               var data = array2[length2], otherFunc = data.func;
22985               if (otherFunc == null || otherFunc == func) {
22986                 return data.name;
22987               }
22988             }
22989             return result2;
22990           }
22991           function getHolder(func) {
22992             var object = hasOwnProperty13.call(lodash, "placeholder") ? lodash : func;
22993             return object.placeholder;
22994           }
22995           function getIteratee() {
22996             var result2 = lodash.iteratee || iteratee;
22997             result2 = result2 === iteratee ? baseIteratee : result2;
22998             return arguments.length ? result2(arguments[0], arguments[1]) : result2;
22999           }
23000           function getMapData2(map3, key) {
23001             var data = map3.__data__;
23002             return isKeyable2(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
23003           }
23004           function getMatchData(object) {
23005             var result2 = keys2(object), length2 = result2.length;
23006             while (length2--) {
23007               var key = result2[length2], value = object[key];
23008               result2[length2] = [key, value, isStrictComparable(value)];
23009             }
23010             return result2;
23011           }
23012           function getNative2(object, key) {
23013             var value = getValue2(object, key);
23014             return baseIsNative2(value) ? value : undefined2;
23015           }
23016           function getRawTag2(value) {
23017             var isOwn = hasOwnProperty13.call(value, symToStringTag3), tag2 = value[symToStringTag3];
23018             try {
23019               value[symToStringTag3] = undefined2;
23020               var unmasked = true;
23021             } catch (e3) {
23022             }
23023             var result2 = nativeObjectToString3.call(value);
23024             if (unmasked) {
23025               if (isOwn) {
23026                 value[symToStringTag3] = tag2;
23027               } else {
23028                 delete value[symToStringTag3];
23029               }
23030             }
23031             return result2;
23032           }
23033           var getSymbols2 = !nativeGetSymbols2 ? stubArray2 : function(object) {
23034             if (object == null) {
23035               return [];
23036             }
23037             object = Object2(object);
23038             return arrayFilter2(nativeGetSymbols2(object), function(symbol) {
23039               return propertyIsEnumerable3.call(object, symbol);
23040             });
23041           };
23042           var getSymbolsIn = !nativeGetSymbols2 ? stubArray2 : function(object) {
23043             var result2 = [];
23044             while (object) {
23045               arrayPush2(result2, getSymbols2(object));
23046               object = getPrototype2(object);
23047             }
23048             return result2;
23049           };
23050           var getTag2 = baseGetTag2;
23051           if (DataView3 && getTag2(new DataView3(new ArrayBuffer(1))) != dataViewTag4 || Map3 && getTag2(new Map3()) != mapTag4 || Promise3 && getTag2(Promise3.resolve()) != promiseTag2 || Set3 && getTag2(new Set3()) != setTag4 || WeakMap2 && getTag2(new WeakMap2()) != weakMapTag3) {
23052             getTag2 = function(value) {
23053               var result2 = baseGetTag2(value), Ctor = result2 == objectTag5 ? value.constructor : undefined2, ctorString = Ctor ? toSource2(Ctor) : "";
23054               if (ctorString) {
23055                 switch (ctorString) {
23056                   case dataViewCtorString2:
23057                     return dataViewTag4;
23058                   case mapCtorString2:
23059                     return mapTag4;
23060                   case promiseCtorString2:
23061                     return promiseTag2;
23062                   case setCtorString2:
23063                     return setTag4;
23064                   case weakMapCtorString2:
23065                     return weakMapTag3;
23066                 }
23067               }
23068               return result2;
23069             };
23070           }
23071           function getView(start2, end, transforms) {
23072             var index = -1, length2 = transforms.length;
23073             while (++index < length2) {
23074               var data = transforms[index], size2 = data.size;
23075               switch (data.type) {
23076                 case "drop":
23077                   start2 += size2;
23078                   break;
23079                 case "dropRight":
23080                   end -= size2;
23081                   break;
23082                 case "take":
23083                   end = nativeMin2(end, start2 + size2);
23084                   break;
23085                 case "takeRight":
23086                   start2 = nativeMax3(start2, end - size2);
23087                   break;
23088               }
23089             }
23090             return { "start": start2, "end": end };
23091           }
23092           function getWrapDetails(source) {
23093             var match = source.match(reWrapDetails);
23094             return match ? match[1].split(reSplitDetails) : [];
23095           }
23096           function hasPath(object, path, hasFunc) {
23097             path = castPath(path, object);
23098             var index = -1, length2 = path.length, result2 = false;
23099             while (++index < length2) {
23100               var key = toKey(path[index]);
23101               if (!(result2 = object != null && hasFunc(object, key))) {
23102                 break;
23103               }
23104               object = object[key];
23105             }
23106             if (result2 || ++index != length2) {
23107               return result2;
23108             }
23109             length2 = object == null ? 0 : object.length;
23110             return !!length2 && isLength2(length2) && isIndex2(key, length2) && (isArray2(object) || isArguments2(object));
23111           }
23112           function initCloneArray(array2) {
23113             var length2 = array2.length, result2 = new array2.constructor(length2);
23114             if (length2 && typeof array2[0] == "string" && hasOwnProperty13.call(array2, "index")) {
23115               result2.index = array2.index;
23116               result2.input = array2.input;
23117             }
23118             return result2;
23119           }
23120           function initCloneObject2(object) {
23121             return typeof object.constructor == "function" && !isPrototype2(object) ? baseCreate2(getPrototype2(object)) : {};
23122           }
23123           function initCloneByTag(object, tag2, isDeep) {
23124             var Ctor = object.constructor;
23125             switch (tag2) {
23126               case arrayBufferTag3:
23127                 return cloneArrayBuffer2(object);
23128               case boolTag3:
23129               case dateTag3:
23130                 return new Ctor(+object);
23131               case dataViewTag4:
23132                 return cloneDataView(object, isDeep);
23133               case float32Tag2:
23134               case float64Tag2:
23135               case int8Tag2:
23136               case int16Tag2:
23137               case int32Tag2:
23138               case uint8Tag2:
23139               case uint8ClampedTag2:
23140               case uint16Tag2:
23141               case uint32Tag2:
23142                 return cloneTypedArray2(object, isDeep);
23143               case mapTag4:
23144                 return new Ctor();
23145               case numberTag4:
23146               case stringTag3:
23147                 return new Ctor(object);
23148               case regexpTag3:
23149                 return cloneRegExp(object);
23150               case setTag4:
23151                 return new Ctor();
23152               case symbolTag3:
23153                 return cloneSymbol(object);
23154             }
23155           }
23156           function insertWrapDetails(source, details) {
23157             var length2 = details.length;
23158             if (!length2) {
23159               return source;
23160             }
23161             var lastIndex = length2 - 1;
23162             details[lastIndex] = (length2 > 1 ? "& " : "") + details[lastIndex];
23163             details = details.join(length2 > 2 ? ", " : " ");
23164             return source.replace(reWrapComment, "{\n/* [wrapped with " + details + "] */\n");
23165           }
23166           function isFlattenable(value) {
23167             return isArray2(value) || isArguments2(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
23168           }
23169           function isIndex2(value, length2) {
23170             var type2 = typeof value;
23171             length2 = length2 == null ? MAX_SAFE_INTEGER4 : length2;
23172             return !!length2 && (type2 == "number" || type2 != "symbol" && reIsUint2.test(value)) && (value > -1 && value % 1 == 0 && value < length2);
23173           }
23174           function isIterateeCall2(value, index, object) {
23175             if (!isObject2(object)) {
23176               return false;
23177             }
23178             var type2 = typeof index;
23179             if (type2 == "number" ? isArrayLike2(object) && isIndex2(index, object.length) : type2 == "string" && index in object) {
23180               return eq2(object[index], value);
23181             }
23182             return false;
23183           }
23184           function isKey(value, object) {
23185             if (isArray2(value)) {
23186               return false;
23187             }
23188             var type2 = typeof value;
23189             if (type2 == "number" || type2 == "symbol" || type2 == "boolean" || value == null || isSymbol2(value)) {
23190               return true;
23191             }
23192             return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object2(object);
23193           }
23194           function isKeyable2(value) {
23195             var type2 = typeof value;
23196             return type2 == "string" || type2 == "number" || type2 == "symbol" || type2 == "boolean" ? value !== "__proto__" : value === null;
23197           }
23198           function isLaziable(func) {
23199             var funcName = getFuncName(func), other2 = lodash[funcName];
23200             if (typeof other2 != "function" || !(funcName in LazyWrapper.prototype)) {
23201               return false;
23202             }
23203             if (func === other2) {
23204               return true;
23205             }
23206             var data = getData(other2);
23207             return !!data && func === data[0];
23208           }
23209           function isMasked2(func) {
23210             return !!maskSrcKey2 && maskSrcKey2 in func;
23211           }
23212           var isMaskable = coreJsData2 ? isFunction2 : stubFalse2;
23213           function isPrototype2(value) {
23214             var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto16;
23215             return value === proto;
23216           }
23217           function isStrictComparable(value) {
23218             return value === value && !isObject2(value);
23219           }
23220           function matchesStrictComparable(key, srcValue) {
23221             return function(object) {
23222               if (object == null) {
23223                 return false;
23224               }
23225               return object[key] === srcValue && (srcValue !== undefined2 || key in Object2(object));
23226             };
23227           }
23228           function memoizeCapped(func) {
23229             var result2 = memoize(func, function(key) {
23230               if (cache.size === MAX_MEMOIZE_SIZE) {
23231                 cache.clear();
23232               }
23233               return key;
23234             });
23235             var cache = result2.cache;
23236             return result2;
23237           }
23238           function mergeData(data, source) {
23239             var bitmask = data[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
23240             var isCombo = srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_CURRY_FLAG || srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_REARG_FLAG && data[7].length <= source[8] || srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG) && source[7].length <= source[8] && bitmask == WRAP_CURRY_FLAG;
23241             if (!(isCommon || isCombo)) {
23242               return data;
23243             }
23244             if (srcBitmask & WRAP_BIND_FLAG) {
23245               data[2] = source[2];
23246               newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
23247             }
23248             var value = source[3];
23249             if (value) {
23250               var partials = data[3];
23251               data[3] = partials ? composeArgs(partials, value, source[4]) : value;
23252               data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
23253             }
23254             value = source[5];
23255             if (value) {
23256               partials = data[5];
23257               data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
23258               data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
23259             }
23260             value = source[7];
23261             if (value) {
23262               data[7] = value;
23263             }
23264             if (srcBitmask & WRAP_ARY_FLAG) {
23265               data[8] = data[8] == null ? source[8] : nativeMin2(data[8], source[8]);
23266             }
23267             if (data[9] == null) {
23268               data[9] = source[9];
23269             }
23270             data[0] = source[0];
23271             data[1] = newBitmask;
23272             return data;
23273           }
23274           function nativeKeysIn2(object) {
23275             var result2 = [];
23276             if (object != null) {
23277               for (var key in Object2(object)) {
23278                 result2.push(key);
23279               }
23280             }
23281             return result2;
23282           }
23283           function objectToString2(value) {
23284             return nativeObjectToString3.call(value);
23285           }
23286           function overRest2(func, start2, transform3) {
23287             start2 = nativeMax3(start2 === undefined2 ? func.length - 1 : start2, 0);
23288             return function() {
23289               var args = arguments, index = -1, length2 = nativeMax3(args.length - start2, 0), array2 = Array2(length2);
23290               while (++index < length2) {
23291                 array2[index] = args[start2 + index];
23292               }
23293               index = -1;
23294               var otherArgs = Array2(start2 + 1);
23295               while (++index < start2) {
23296                 otherArgs[index] = args[index];
23297               }
23298               otherArgs[start2] = transform3(array2);
23299               return apply2(func, this, otherArgs);
23300             };
23301           }
23302           function parent(object, path) {
23303             return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
23304           }
23305           function reorder(array2, indexes) {
23306             var arrLength = array2.length, length2 = nativeMin2(indexes.length, arrLength), oldArray = copyArray2(array2);
23307             while (length2--) {
23308               var index = indexes[length2];
23309               array2[length2] = isIndex2(index, arrLength) ? oldArray[index] : undefined2;
23310             }
23311             return array2;
23312           }
23313           function safeGet2(object, key) {
23314             if (key === "constructor" && typeof object[key] === "function") {
23315               return;
23316             }
23317             if (key == "__proto__") {
23318               return;
23319             }
23320             return object[key];
23321           }
23322           var setData = shortOut2(baseSetData);
23323           var setTimeout2 = ctxSetTimeout || function(func, wait) {
23324             return root3.setTimeout(func, wait);
23325           };
23326           var setToString2 = shortOut2(baseSetToString2);
23327           function setWrapToString(wrapper, reference, bitmask) {
23328             var source = reference + "";
23329             return setToString2(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
23330           }
23331           function shortOut2(func) {
23332             var count = 0, lastCalled = 0;
23333             return function() {
23334               var stamp = nativeNow2(), remaining = HOT_SPAN2 - (stamp - lastCalled);
23335               lastCalled = stamp;
23336               if (remaining > 0) {
23337                 if (++count >= HOT_COUNT2) {
23338                   return arguments[0];
23339                 }
23340               } else {
23341                 count = 0;
23342               }
23343               return func.apply(undefined2, arguments);
23344             };
23345           }
23346           function shuffleSelf(array2, size2) {
23347             var index = -1, length2 = array2.length, lastIndex = length2 - 1;
23348             size2 = size2 === undefined2 ? length2 : size2;
23349             while (++index < size2) {
23350               var rand = baseRandom(index, lastIndex), value = array2[rand];
23351               array2[rand] = array2[index];
23352               array2[index] = value;
23353             }
23354             array2.length = size2;
23355             return array2;
23356           }
23357           var stringToPath = memoizeCapped(function(string) {
23358             var result2 = [];
23359             if (string.charCodeAt(0) === 46) {
23360               result2.push("");
23361             }
23362             string.replace(rePropName, function(match, number3, quote, subString) {
23363               result2.push(quote ? subString.replace(reEscapeChar, "$1") : number3 || match);
23364             });
23365             return result2;
23366           });
23367           function toKey(value) {
23368             if (typeof value == "string" || isSymbol2(value)) {
23369               return value;
23370             }
23371             var result2 = value + "";
23372             return result2 == "0" && 1 / value == -INFINITY2 ? "-0" : result2;
23373           }
23374           function toSource2(func) {
23375             if (func != null) {
23376               try {
23377                 return funcToString4.call(func);
23378               } catch (e3) {
23379               }
23380               try {
23381                 return func + "";
23382               } catch (e3) {
23383               }
23384             }
23385             return "";
23386           }
23387           function updateWrapDetails(details, bitmask) {
23388             arrayEach(wrapFlags, function(pair3) {
23389               var value = "_." + pair3[0];
23390               if (bitmask & pair3[1] && !arrayIncludes(details, value)) {
23391                 details.push(value);
23392               }
23393             });
23394             return details.sort();
23395           }
23396           function wrapperClone(wrapper) {
23397             if (wrapper instanceof LazyWrapper) {
23398               return wrapper.clone();
23399             }
23400             var result2 = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
23401             result2.__actions__ = copyArray2(wrapper.__actions__);
23402             result2.__index__ = wrapper.__index__;
23403             result2.__values__ = wrapper.__values__;
23404             return result2;
23405           }
23406           function chunk(array2, size2, guard) {
23407             if (guard ? isIterateeCall2(array2, size2, guard) : size2 === undefined2) {
23408               size2 = 1;
23409             } else {
23410               size2 = nativeMax3(toInteger(size2), 0);
23411             }
23412             var length2 = array2 == null ? 0 : array2.length;
23413             if (!length2 || size2 < 1) {
23414               return [];
23415             }
23416             var index = 0, resIndex = 0, result2 = Array2(nativeCeil(length2 / size2));
23417             while (index < length2) {
23418               result2[resIndex++] = baseSlice(array2, index, index += size2);
23419             }
23420             return result2;
23421           }
23422           function compact(array2) {
23423             var index = -1, length2 = array2 == null ? 0 : array2.length, resIndex = 0, result2 = [];
23424             while (++index < length2) {
23425               var value = array2[index];
23426               if (value) {
23427                 result2[resIndex++] = value;
23428               }
23429             }
23430             return result2;
23431           }
23432           function concat() {
23433             var length2 = arguments.length;
23434             if (!length2) {
23435               return [];
23436             }
23437             var args = Array2(length2 - 1), array2 = arguments[0], index = length2;
23438             while (index--) {
23439               args[index - 1] = arguments[index];
23440             }
23441             return arrayPush2(isArray2(array2) ? copyArray2(array2) : [array2], baseFlatten(args, 1));
23442           }
23443           var difference2 = baseRest2(function(array2, values2) {
23444             return isArrayLikeObject2(array2) ? baseDifference(array2, baseFlatten(values2, 1, isArrayLikeObject2, true)) : [];
23445           });
23446           var differenceBy = baseRest2(function(array2, values2) {
23447             var iteratee2 = last(values2);
23448             if (isArrayLikeObject2(iteratee2)) {
23449               iteratee2 = undefined2;
23450             }
23451             return isArrayLikeObject2(array2) ? baseDifference(array2, baseFlatten(values2, 1, isArrayLikeObject2, true), getIteratee(iteratee2, 2)) : [];
23452           });
23453           var differenceWith = baseRest2(function(array2, values2) {
23454             var comparator = last(values2);
23455             if (isArrayLikeObject2(comparator)) {
23456               comparator = undefined2;
23457             }
23458             return isArrayLikeObject2(array2) ? baseDifference(array2, baseFlatten(values2, 1, isArrayLikeObject2, true), undefined2, comparator) : [];
23459           });
23460           function drop(array2, n3, guard) {
23461             var length2 = array2 == null ? 0 : array2.length;
23462             if (!length2) {
23463               return [];
23464             }
23465             n3 = guard || n3 === undefined2 ? 1 : toInteger(n3);
23466             return baseSlice(array2, n3 < 0 ? 0 : n3, length2);
23467           }
23468           function dropRight(array2, n3, guard) {
23469             var length2 = array2 == null ? 0 : array2.length;
23470             if (!length2) {
23471               return [];
23472             }
23473             n3 = guard || n3 === undefined2 ? 1 : toInteger(n3);
23474             n3 = length2 - n3;
23475             return baseSlice(array2, 0, n3 < 0 ? 0 : n3);
23476           }
23477           function dropRightWhile(array2, predicate) {
23478             return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3), true, true) : [];
23479           }
23480           function dropWhile(array2, predicate) {
23481             return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3), true) : [];
23482           }
23483           function fill(array2, value, start2, end) {
23484             var length2 = array2 == null ? 0 : array2.length;
23485             if (!length2) {
23486               return [];
23487             }
23488             if (start2 && typeof start2 != "number" && isIterateeCall2(array2, value, start2)) {
23489               start2 = 0;
23490               end = length2;
23491             }
23492             return baseFill(array2, value, start2, end);
23493           }
23494           function findIndex(array2, predicate, fromIndex) {
23495             var length2 = array2 == null ? 0 : array2.length;
23496             if (!length2) {
23497               return -1;
23498             }
23499             var index = fromIndex == null ? 0 : toInteger(fromIndex);
23500             if (index < 0) {
23501               index = nativeMax3(length2 + index, 0);
23502             }
23503             return baseFindIndex(array2, getIteratee(predicate, 3), index);
23504           }
23505           function findLastIndex(array2, predicate, fromIndex) {
23506             var length2 = array2 == null ? 0 : array2.length;
23507             if (!length2) {
23508               return -1;
23509             }
23510             var index = length2 - 1;
23511             if (fromIndex !== undefined2) {
23512               index = toInteger(fromIndex);
23513               index = fromIndex < 0 ? nativeMax3(length2 + index, 0) : nativeMin2(index, length2 - 1);
23514             }
23515             return baseFindIndex(array2, getIteratee(predicate, 3), index, true);
23516           }
23517           function flatten2(array2) {
23518             var length2 = array2 == null ? 0 : array2.length;
23519             return length2 ? baseFlatten(array2, 1) : [];
23520           }
23521           function flattenDeep(array2) {
23522             var length2 = array2 == null ? 0 : array2.length;
23523             return length2 ? baseFlatten(array2, INFINITY2) : [];
23524           }
23525           function flattenDepth(array2, depth) {
23526             var length2 = array2 == null ? 0 : array2.length;
23527             if (!length2) {
23528               return [];
23529             }
23530             depth = depth === undefined2 ? 1 : toInteger(depth);
23531             return baseFlatten(array2, depth);
23532           }
23533           function fromPairs(pairs2) {
23534             var index = -1, length2 = pairs2 == null ? 0 : pairs2.length, result2 = {};
23535             while (++index < length2) {
23536               var pair3 = pairs2[index];
23537               result2[pair3[0]] = pair3[1];
23538             }
23539             return result2;
23540           }
23541           function head(array2) {
23542             return array2 && array2.length ? array2[0] : undefined2;
23543           }
23544           function indexOf(array2, value, fromIndex) {
23545             var length2 = array2 == null ? 0 : array2.length;
23546             if (!length2) {
23547               return -1;
23548             }
23549             var index = fromIndex == null ? 0 : toInteger(fromIndex);
23550             if (index < 0) {
23551               index = nativeMax3(length2 + index, 0);
23552             }
23553             return baseIndexOf(array2, value, index);
23554           }
23555           function initial(array2) {
23556             var length2 = array2 == null ? 0 : array2.length;
23557             return length2 ? baseSlice(array2, 0, -1) : [];
23558           }
23559           var intersection2 = baseRest2(function(arrays) {
23560             var mapped = arrayMap2(arrays, castArrayLikeObject);
23561             return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : [];
23562           });
23563           var intersectionBy = baseRest2(function(arrays) {
23564             var iteratee2 = last(arrays), mapped = arrayMap2(arrays, castArrayLikeObject);
23565             if (iteratee2 === last(mapped)) {
23566               iteratee2 = undefined2;
23567             } else {
23568               mapped.pop();
23569             }
23570             return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, getIteratee(iteratee2, 2)) : [];
23571           });
23572           var intersectionWith = baseRest2(function(arrays) {
23573             var comparator = last(arrays), mapped = arrayMap2(arrays, castArrayLikeObject);
23574             comparator = typeof comparator == "function" ? comparator : undefined2;
23575             if (comparator) {
23576               mapped.pop();
23577             }
23578             return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
23579           });
23580           function join(array2, separator) {
23581             return array2 == null ? "" : nativeJoin.call(array2, separator);
23582           }
23583           function last(array2) {
23584             var length2 = array2 == null ? 0 : array2.length;
23585             return length2 ? array2[length2 - 1] : undefined2;
23586           }
23587           function lastIndexOf(array2, value, fromIndex) {
23588             var length2 = array2 == null ? 0 : array2.length;
23589             if (!length2) {
23590               return -1;
23591             }
23592             var index = length2;
23593             if (fromIndex !== undefined2) {
23594               index = toInteger(fromIndex);
23595               index = index < 0 ? nativeMax3(length2 + index, 0) : nativeMin2(index, length2 - 1);
23596             }
23597             return value === value ? strictLastIndexOf(array2, value, index) : baseFindIndex(array2, baseIsNaN, index, true);
23598           }
23599           function nth(array2, n3) {
23600             return array2 && array2.length ? baseNth(array2, toInteger(n3)) : undefined2;
23601           }
23602           var pull = baseRest2(pullAll);
23603           function pullAll(array2, values2) {
23604             return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2) : array2;
23605           }
23606           function pullAllBy(array2, values2, iteratee2) {
23607             return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2, getIteratee(iteratee2, 2)) : array2;
23608           }
23609           function pullAllWith(array2, values2, comparator) {
23610             return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2, undefined2, comparator) : array2;
23611           }
23612           var pullAt = flatRest(function(array2, indexes) {
23613             var length2 = array2 == null ? 0 : array2.length, result2 = baseAt(array2, indexes);
23614             basePullAt(array2, arrayMap2(indexes, function(index) {
23615               return isIndex2(index, length2) ? +index : index;
23616             }).sort(compareAscending));
23617             return result2;
23618           });
23619           function remove2(array2, predicate) {
23620             var result2 = [];
23621             if (!(array2 && array2.length)) {
23622               return result2;
23623             }
23624             var index = -1, indexes = [], length2 = array2.length;
23625             predicate = getIteratee(predicate, 3);
23626             while (++index < length2) {
23627               var value = array2[index];
23628               if (predicate(value, index, array2)) {
23629                 result2.push(value);
23630                 indexes.push(index);
23631               }
23632             }
23633             basePullAt(array2, indexes);
23634             return result2;
23635           }
23636           function reverse(array2) {
23637             return array2 == null ? array2 : nativeReverse.call(array2);
23638           }
23639           function slice(array2, start2, end) {
23640             var length2 = array2 == null ? 0 : array2.length;
23641             if (!length2) {
23642               return [];
23643             }
23644             if (end && typeof end != "number" && isIterateeCall2(array2, start2, end)) {
23645               start2 = 0;
23646               end = length2;
23647             } else {
23648               start2 = start2 == null ? 0 : toInteger(start2);
23649               end = end === undefined2 ? length2 : toInteger(end);
23650             }
23651             return baseSlice(array2, start2, end);
23652           }
23653           function sortedIndex(array2, value) {
23654             return baseSortedIndex(array2, value);
23655           }
23656           function sortedIndexBy(array2, value, iteratee2) {
23657             return baseSortedIndexBy(array2, value, getIteratee(iteratee2, 2));
23658           }
23659           function sortedIndexOf(array2, value) {
23660             var length2 = array2 == null ? 0 : array2.length;
23661             if (length2) {
23662               var index = baseSortedIndex(array2, value);
23663               if (index < length2 && eq2(array2[index], value)) {
23664                 return index;
23665               }
23666             }
23667             return -1;
23668           }
23669           function sortedLastIndex(array2, value) {
23670             return baseSortedIndex(array2, value, true);
23671           }
23672           function sortedLastIndexBy(array2, value, iteratee2) {
23673             return baseSortedIndexBy(array2, value, getIteratee(iteratee2, 2), true);
23674           }
23675           function sortedLastIndexOf(array2, value) {
23676             var length2 = array2 == null ? 0 : array2.length;
23677             if (length2) {
23678               var index = baseSortedIndex(array2, value, true) - 1;
23679               if (eq2(array2[index], value)) {
23680                 return index;
23681               }
23682             }
23683             return -1;
23684           }
23685           function sortedUniq(array2) {
23686             return array2 && array2.length ? baseSortedUniq(array2) : [];
23687           }
23688           function sortedUniqBy(array2, iteratee2) {
23689             return array2 && array2.length ? baseSortedUniq(array2, getIteratee(iteratee2, 2)) : [];
23690           }
23691           function tail(array2) {
23692             var length2 = array2 == null ? 0 : array2.length;
23693             return length2 ? baseSlice(array2, 1, length2) : [];
23694           }
23695           function take(array2, n3, guard) {
23696             if (!(array2 && array2.length)) {
23697               return [];
23698             }
23699             n3 = guard || n3 === undefined2 ? 1 : toInteger(n3);
23700             return baseSlice(array2, 0, n3 < 0 ? 0 : n3);
23701           }
23702           function takeRight(array2, n3, guard) {
23703             var length2 = array2 == null ? 0 : array2.length;
23704             if (!length2) {
23705               return [];
23706             }
23707             n3 = guard || n3 === undefined2 ? 1 : toInteger(n3);
23708             n3 = length2 - n3;
23709             return baseSlice(array2, n3 < 0 ? 0 : n3, length2);
23710           }
23711           function takeRightWhile(array2, predicate) {
23712             return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3), false, true) : [];
23713           }
23714           function takeWhile(array2, predicate) {
23715             return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3)) : [];
23716           }
23717           var union2 = baseRest2(function(arrays) {
23718             return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject2, true));
23719           });
23720           var unionBy = baseRest2(function(arrays) {
23721             var iteratee2 = last(arrays);
23722             if (isArrayLikeObject2(iteratee2)) {
23723               iteratee2 = undefined2;
23724             }
23725             return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject2, true), getIteratee(iteratee2, 2));
23726           });
23727           var unionWith = baseRest2(function(arrays) {
23728             var comparator = last(arrays);
23729             comparator = typeof comparator == "function" ? comparator : undefined2;
23730             return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject2, true), undefined2, comparator);
23731           });
23732           function uniq(array2) {
23733             return array2 && array2.length ? baseUniq(array2) : [];
23734           }
23735           function uniqBy(array2, iteratee2) {
23736             return array2 && array2.length ? baseUniq(array2, getIteratee(iteratee2, 2)) : [];
23737           }
23738           function uniqWith(array2, comparator) {
23739             comparator = typeof comparator == "function" ? comparator : undefined2;
23740             return array2 && array2.length ? baseUniq(array2, undefined2, comparator) : [];
23741           }
23742           function unzip(array2) {
23743             if (!(array2 && array2.length)) {
23744               return [];
23745             }
23746             var length2 = 0;
23747             array2 = arrayFilter2(array2, function(group) {
23748               if (isArrayLikeObject2(group)) {
23749                 length2 = nativeMax3(group.length, length2);
23750                 return true;
23751               }
23752             });
23753             return baseTimes2(length2, function(index) {
23754               return arrayMap2(array2, baseProperty(index));
23755             });
23756           }
23757           function unzipWith(array2, iteratee2) {
23758             if (!(array2 && array2.length)) {
23759               return [];
23760             }
23761             var result2 = unzip(array2);
23762             if (iteratee2 == null) {
23763               return result2;
23764             }
23765             return arrayMap2(result2, function(group) {
23766               return apply2(iteratee2, undefined2, group);
23767             });
23768           }
23769           var without = baseRest2(function(array2, values2) {
23770             return isArrayLikeObject2(array2) ? baseDifference(array2, values2) : [];
23771           });
23772           var xor = baseRest2(function(arrays) {
23773             return baseXor(arrayFilter2(arrays, isArrayLikeObject2));
23774           });
23775           var xorBy = baseRest2(function(arrays) {
23776             var iteratee2 = last(arrays);
23777             if (isArrayLikeObject2(iteratee2)) {
23778               iteratee2 = undefined2;
23779             }
23780             return baseXor(arrayFilter2(arrays, isArrayLikeObject2), getIteratee(iteratee2, 2));
23781           });
23782           var xorWith = baseRest2(function(arrays) {
23783             var comparator = last(arrays);
23784             comparator = typeof comparator == "function" ? comparator : undefined2;
23785             return baseXor(arrayFilter2(arrays, isArrayLikeObject2), undefined2, comparator);
23786           });
23787           var zip = baseRest2(unzip);
23788           function zipObject(props, values2) {
23789             return baseZipObject(props || [], values2 || [], assignValue2);
23790           }
23791           function zipObjectDeep(props, values2) {
23792             return baseZipObject(props || [], values2 || [], baseSet);
23793           }
23794           var zipWith = baseRest2(function(arrays) {
23795             var length2 = arrays.length, iteratee2 = length2 > 1 ? arrays[length2 - 1] : undefined2;
23796             iteratee2 = typeof iteratee2 == "function" ? (arrays.pop(), iteratee2) : undefined2;
23797             return unzipWith(arrays, iteratee2);
23798           });
23799           function chain(value) {
23800             var result2 = lodash(value);
23801             result2.__chain__ = true;
23802             return result2;
23803           }
23804           function tap(value, interceptor) {
23805             interceptor(value);
23806             return value;
23807           }
23808           function thru(value, interceptor) {
23809             return interceptor(value);
23810           }
23811           var wrapperAt = flatRest(function(paths) {
23812             var length2 = paths.length, start2 = length2 ? paths[0] : 0, value = this.__wrapped__, interceptor = function(object) {
23813               return baseAt(object, paths);
23814             };
23815             if (length2 > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex2(start2)) {
23816               return this.thru(interceptor);
23817             }
23818             value = value.slice(start2, +start2 + (length2 ? 1 : 0));
23819             value.__actions__.push({
23820               "func": thru,
23821               "args": [interceptor],
23822               "thisArg": undefined2
23823             });
23824             return new LodashWrapper(value, this.__chain__).thru(function(array2) {
23825               if (length2 && !array2.length) {
23826                 array2.push(undefined2);
23827               }
23828               return array2;
23829             });
23830           });
23831           function wrapperChain() {
23832             return chain(this);
23833           }
23834           function wrapperCommit() {
23835             return new LodashWrapper(this.value(), this.__chain__);
23836           }
23837           function wrapperNext() {
23838             if (this.__values__ === undefined2) {
23839               this.__values__ = toArray(this.value());
23840             }
23841             var done = this.__index__ >= this.__values__.length, value = done ? undefined2 : this.__values__[this.__index__++];
23842             return { "done": done, "value": value };
23843           }
23844           function wrapperToIterator() {
23845             return this;
23846           }
23847           function wrapperPlant(value) {
23848             var result2, parent2 = this;
23849             while (parent2 instanceof baseLodash) {
23850               var clone3 = wrapperClone(parent2);
23851               clone3.__index__ = 0;
23852               clone3.__values__ = undefined2;
23853               if (result2) {
23854                 previous.__wrapped__ = clone3;
23855               } else {
23856                 result2 = clone3;
23857               }
23858               var previous = clone3;
23859               parent2 = parent2.__wrapped__;
23860             }
23861             previous.__wrapped__ = value;
23862             return result2;
23863           }
23864           function wrapperReverse() {
23865             var value = this.__wrapped__;
23866             if (value instanceof LazyWrapper) {
23867               var wrapped = value;
23868               if (this.__actions__.length) {
23869                 wrapped = new LazyWrapper(this);
23870               }
23871               wrapped = wrapped.reverse();
23872               wrapped.__actions__.push({
23873                 "func": thru,
23874                 "args": [reverse],
23875                 "thisArg": undefined2
23876               });
23877               return new LodashWrapper(wrapped, this.__chain__);
23878             }
23879             return this.thru(reverse);
23880           }
23881           function wrapperValue() {
23882             return baseWrapperValue(this.__wrapped__, this.__actions__);
23883           }
23884           var countBy = createAggregator(function(result2, value, key) {
23885             if (hasOwnProperty13.call(result2, key)) {
23886               ++result2[key];
23887             } else {
23888               baseAssignValue2(result2, key, 1);
23889             }
23890           });
23891           function every(collection, predicate, guard) {
23892             var func = isArray2(collection) ? arrayEvery : baseEvery;
23893             if (guard && isIterateeCall2(collection, predicate, guard)) {
23894               predicate = undefined2;
23895             }
23896             return func(collection, getIteratee(predicate, 3));
23897           }
23898           function filter2(collection, predicate) {
23899             var func = isArray2(collection) ? arrayFilter2 : baseFilter;
23900             return func(collection, getIteratee(predicate, 3));
23901           }
23902           var find2 = createFind(findIndex);
23903           var findLast = createFind(findLastIndex);
23904           function flatMap(collection, iteratee2) {
23905             return baseFlatten(map2(collection, iteratee2), 1);
23906           }
23907           function flatMapDeep(collection, iteratee2) {
23908             return baseFlatten(map2(collection, iteratee2), INFINITY2);
23909           }
23910           function flatMapDepth(collection, iteratee2, depth) {
23911             depth = depth === undefined2 ? 1 : toInteger(depth);
23912             return baseFlatten(map2(collection, iteratee2), depth);
23913           }
23914           function forEach(collection, iteratee2) {
23915             var func = isArray2(collection) ? arrayEach : baseEach;
23916             return func(collection, getIteratee(iteratee2, 3));
23917           }
23918           function forEachRight(collection, iteratee2) {
23919             var func = isArray2(collection) ? arrayEachRight : baseEachRight;
23920             return func(collection, getIteratee(iteratee2, 3));
23921           }
23922           var groupBy = createAggregator(function(result2, value, key) {
23923             if (hasOwnProperty13.call(result2, key)) {
23924               result2[key].push(value);
23925             } else {
23926               baseAssignValue2(result2, key, [value]);
23927             }
23928           });
23929           function includes(collection, value, fromIndex, guard) {
23930             collection = isArrayLike2(collection) ? collection : values(collection);
23931             fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0;
23932             var length2 = collection.length;
23933             if (fromIndex < 0) {
23934               fromIndex = nativeMax3(length2 + fromIndex, 0);
23935             }
23936             return isString(collection) ? fromIndex <= length2 && collection.indexOf(value, fromIndex) > -1 : !!length2 && baseIndexOf(collection, value, fromIndex) > -1;
23937           }
23938           var invokeMap = baseRest2(function(collection, path, args) {
23939             var index = -1, isFunc = typeof path == "function", result2 = isArrayLike2(collection) ? Array2(collection.length) : [];
23940             baseEach(collection, function(value) {
23941               result2[++index] = isFunc ? apply2(path, value, args) : baseInvoke(value, path, args);
23942             });
23943             return result2;
23944           });
23945           var keyBy = createAggregator(function(result2, value, key) {
23946             baseAssignValue2(result2, key, value);
23947           });
23948           function map2(collection, iteratee2) {
23949             var func = isArray2(collection) ? arrayMap2 : baseMap;
23950             return func(collection, getIteratee(iteratee2, 3));
23951           }
23952           function orderBy(collection, iteratees, orders, guard) {
23953             if (collection == null) {
23954               return [];
23955             }
23956             if (!isArray2(iteratees)) {
23957               iteratees = iteratees == null ? [] : [iteratees];
23958             }
23959             orders = guard ? undefined2 : orders;
23960             if (!isArray2(orders)) {
23961               orders = orders == null ? [] : [orders];
23962             }
23963             return baseOrderBy(collection, iteratees, orders);
23964           }
23965           var partition = createAggregator(function(result2, value, key) {
23966             result2[key ? 0 : 1].push(value);
23967           }, function() {
23968             return [[], []];
23969           });
23970           function reduce(collection, iteratee2, accumulator) {
23971             var func = isArray2(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3;
23972             return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEach);
23973           }
23974           function reduceRight(collection, iteratee2, accumulator) {
23975             var func = isArray2(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3;
23976             return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEachRight);
23977           }
23978           function reject(collection, predicate) {
23979             var func = isArray2(collection) ? arrayFilter2 : baseFilter;
23980             return func(collection, negate(getIteratee(predicate, 3)));
23981           }
23982           function sample(collection) {
23983             var func = isArray2(collection) ? arraySample : baseSample;
23984             return func(collection);
23985           }
23986           function sampleSize(collection, n3, guard) {
23987             if (guard ? isIterateeCall2(collection, n3, guard) : n3 === undefined2) {
23988               n3 = 1;
23989             } else {
23990               n3 = toInteger(n3);
23991             }
23992             var func = isArray2(collection) ? arraySampleSize : baseSampleSize;
23993             return func(collection, n3);
23994           }
23995           function shuffle(collection) {
23996             var func = isArray2(collection) ? arrayShuffle : baseShuffle;
23997             return func(collection);
23998           }
23999           function size(collection) {
24000             if (collection == null) {
24001               return 0;
24002             }
24003             if (isArrayLike2(collection)) {
24004               return isString(collection) ? stringSize(collection) : collection.length;
24005             }
24006             var tag2 = getTag2(collection);
24007             if (tag2 == mapTag4 || tag2 == setTag4) {
24008               return collection.size;
24009             }
24010             return baseKeys2(collection).length;
24011           }
24012           function some(collection, predicate, guard) {
24013             var func = isArray2(collection) ? arraySome2 : baseSome;
24014             if (guard && isIterateeCall2(collection, predicate, guard)) {
24015               predicate = undefined2;
24016             }
24017             return func(collection, getIteratee(predicate, 3));
24018           }
24019           var sortBy = baseRest2(function(collection, iteratees) {
24020             if (collection == null) {
24021               return [];
24022             }
24023             var length2 = iteratees.length;
24024             if (length2 > 1 && isIterateeCall2(collection, iteratees[0], iteratees[1])) {
24025               iteratees = [];
24026             } else if (length2 > 2 && isIterateeCall2(iteratees[0], iteratees[1], iteratees[2])) {
24027               iteratees = [iteratees[0]];
24028             }
24029             return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
24030           });
24031           var now3 = ctxNow || function() {
24032             return root3.Date.now();
24033           };
24034           function after(n3, func) {
24035             if (typeof func != "function") {
24036               throw new TypeError2(FUNC_ERROR_TEXT3);
24037             }
24038             n3 = toInteger(n3);
24039             return function() {
24040               if (--n3 < 1) {
24041                 return func.apply(this, arguments);
24042               }
24043             };
24044           }
24045           function ary(func, n3, guard) {
24046             n3 = guard ? undefined2 : n3;
24047             n3 = func && n3 == null ? func.length : n3;
24048             return createWrap(func, WRAP_ARY_FLAG, undefined2, undefined2, undefined2, undefined2, n3);
24049           }
24050           function before(n3, func) {
24051             var result2;
24052             if (typeof func != "function") {
24053               throw new TypeError2(FUNC_ERROR_TEXT3);
24054             }
24055             n3 = toInteger(n3);
24056             return function() {
24057               if (--n3 > 0) {
24058                 result2 = func.apply(this, arguments);
24059               }
24060               if (n3 <= 1) {
24061                 func = undefined2;
24062               }
24063               return result2;
24064             };
24065           }
24066           var bind = baseRest2(function(func, thisArg, partials) {
24067             var bitmask = WRAP_BIND_FLAG;
24068             if (partials.length) {
24069               var holders = replaceHolders(partials, getHolder(bind));
24070               bitmask |= WRAP_PARTIAL_FLAG;
24071             }
24072             return createWrap(func, bitmask, thisArg, partials, holders);
24073           });
24074           var bindKey2 = baseRest2(function(object, key, partials) {
24075             var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
24076             if (partials.length) {
24077               var holders = replaceHolders(partials, getHolder(bindKey2));
24078               bitmask |= WRAP_PARTIAL_FLAG;
24079             }
24080             return createWrap(key, bitmask, object, partials, holders);
24081           });
24082           function curry(func, arity, guard) {
24083             arity = guard ? undefined2 : arity;
24084             var result2 = createWrap(func, WRAP_CURRY_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity);
24085             result2.placeholder = curry.placeholder;
24086             return result2;
24087           }
24088           function curryRight(func, arity, guard) {
24089             arity = guard ? undefined2 : arity;
24090             var result2 = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity);
24091             result2.placeholder = curryRight.placeholder;
24092             return result2;
24093           }
24094           function debounce2(func, wait, options2) {
24095             var lastArgs, lastThis, maxWait, result2, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
24096             if (typeof func != "function") {
24097               throw new TypeError2(FUNC_ERROR_TEXT3);
24098             }
24099             wait = toNumber3(wait) || 0;
24100             if (isObject2(options2)) {
24101               leading = !!options2.leading;
24102               maxing = "maxWait" in options2;
24103               maxWait = maxing ? nativeMax3(toNumber3(options2.maxWait) || 0, wait) : maxWait;
24104               trailing = "trailing" in options2 ? !!options2.trailing : trailing;
24105             }
24106             function invokeFunc(time) {
24107               var args = lastArgs, thisArg = lastThis;
24108               lastArgs = lastThis = undefined2;
24109               lastInvokeTime = time;
24110               result2 = func.apply(thisArg, args);
24111               return result2;
24112             }
24113             function leadingEdge(time) {
24114               lastInvokeTime = time;
24115               timerId = setTimeout2(timerExpired, wait);
24116               return leading ? invokeFunc(time) : result2;
24117             }
24118             function remainingWait(time) {
24119               var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
24120               return maxing ? nativeMin2(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
24121             }
24122             function shouldInvoke(time) {
24123               var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
24124               return lastCallTime === undefined2 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
24125             }
24126             function timerExpired() {
24127               var time = now3();
24128               if (shouldInvoke(time)) {
24129                 return trailingEdge(time);
24130               }
24131               timerId = setTimeout2(timerExpired, remainingWait(time));
24132             }
24133             function trailingEdge(time) {
24134               timerId = undefined2;
24135               if (trailing && lastArgs) {
24136                 return invokeFunc(time);
24137               }
24138               lastArgs = lastThis = undefined2;
24139               return result2;
24140             }
24141             function cancel() {
24142               if (timerId !== undefined2) {
24143                 clearTimeout2(timerId);
24144               }
24145               lastInvokeTime = 0;
24146               lastArgs = lastCallTime = lastThis = timerId = undefined2;
24147             }
24148             function flush() {
24149               return timerId === undefined2 ? result2 : trailingEdge(now3());
24150             }
24151             function debounced() {
24152               var time = now3(), isInvoking = shouldInvoke(time);
24153               lastArgs = arguments;
24154               lastThis = this;
24155               lastCallTime = time;
24156               if (isInvoking) {
24157                 if (timerId === undefined2) {
24158                   return leadingEdge(lastCallTime);
24159                 }
24160                 if (maxing) {
24161                   clearTimeout2(timerId);
24162                   timerId = setTimeout2(timerExpired, wait);
24163                   return invokeFunc(lastCallTime);
24164                 }
24165               }
24166               if (timerId === undefined2) {
24167                 timerId = setTimeout2(timerExpired, wait);
24168               }
24169               return result2;
24170             }
24171             debounced.cancel = cancel;
24172             debounced.flush = flush;
24173             return debounced;
24174           }
24175           var defer = baseRest2(function(func, args) {
24176             return baseDelay(func, 1, args);
24177           });
24178           var delay = baseRest2(function(func, wait, args) {
24179             return baseDelay(func, toNumber3(wait) || 0, args);
24180           });
24181           function flip(func) {
24182             return createWrap(func, WRAP_FLIP_FLAG);
24183           }
24184           function memoize(func, resolver) {
24185             if (typeof func != "function" || resolver != null && typeof resolver != "function") {
24186               throw new TypeError2(FUNC_ERROR_TEXT3);
24187             }
24188             var memoized = function() {
24189               var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
24190               if (cache.has(key)) {
24191                 return cache.get(key);
24192               }
24193               var result2 = func.apply(this, args);
24194               memoized.cache = cache.set(key, result2) || cache;
24195               return result2;
24196             };
24197             memoized.cache = new (memoize.Cache || MapCache2)();
24198             return memoized;
24199           }
24200           memoize.Cache = MapCache2;
24201           function negate(predicate) {
24202             if (typeof predicate != "function") {
24203               throw new TypeError2(FUNC_ERROR_TEXT3);
24204             }
24205             return function() {
24206               var args = arguments;
24207               switch (args.length) {
24208                 case 0:
24209                   return !predicate.call(this);
24210                 case 1:
24211                   return !predicate.call(this, args[0]);
24212                 case 2:
24213                   return !predicate.call(this, args[0], args[1]);
24214                 case 3:
24215                   return !predicate.call(this, args[0], args[1], args[2]);
24216               }
24217               return !predicate.apply(this, args);
24218             };
24219           }
24220           function once(func) {
24221             return before(2, func);
24222           }
24223           var overArgs = castRest(function(func, transforms) {
24224             transforms = transforms.length == 1 && isArray2(transforms[0]) ? arrayMap2(transforms[0], baseUnary2(getIteratee())) : arrayMap2(baseFlatten(transforms, 1), baseUnary2(getIteratee()));
24225             var funcsLength = transforms.length;
24226             return baseRest2(function(args) {
24227               var index = -1, length2 = nativeMin2(args.length, funcsLength);
24228               while (++index < length2) {
24229                 args[index] = transforms[index].call(this, args[index]);
24230               }
24231               return apply2(func, this, args);
24232             });
24233           });
24234           var partial = baseRest2(function(func, partials) {
24235             var holders = replaceHolders(partials, getHolder(partial));
24236             return createWrap(func, WRAP_PARTIAL_FLAG, undefined2, partials, holders);
24237           });
24238           var partialRight = baseRest2(function(func, partials) {
24239             var holders = replaceHolders(partials, getHolder(partialRight));
24240             return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined2, partials, holders);
24241           });
24242           var rearg = flatRest(function(func, indexes) {
24243             return createWrap(func, WRAP_REARG_FLAG, undefined2, undefined2, undefined2, indexes);
24244           });
24245           function rest(func, start2) {
24246             if (typeof func != "function") {
24247               throw new TypeError2(FUNC_ERROR_TEXT3);
24248             }
24249             start2 = start2 === undefined2 ? start2 : toInteger(start2);
24250             return baseRest2(func, start2);
24251           }
24252           function spread(func, start2) {
24253             if (typeof func != "function") {
24254               throw new TypeError2(FUNC_ERROR_TEXT3);
24255             }
24256             start2 = start2 == null ? 0 : nativeMax3(toInteger(start2), 0);
24257             return baseRest2(function(args) {
24258               var array2 = args[start2], otherArgs = castSlice(args, 0, start2);
24259               if (array2) {
24260                 arrayPush2(otherArgs, array2);
24261               }
24262               return apply2(func, this, otherArgs);
24263             });
24264           }
24265           function throttle2(func, wait, options2) {
24266             var leading = true, trailing = true;
24267             if (typeof func != "function") {
24268               throw new TypeError2(FUNC_ERROR_TEXT3);
24269             }
24270             if (isObject2(options2)) {
24271               leading = "leading" in options2 ? !!options2.leading : leading;
24272               trailing = "trailing" in options2 ? !!options2.trailing : trailing;
24273             }
24274             return debounce2(func, wait, {
24275               "leading": leading,
24276               "maxWait": wait,
24277               "trailing": trailing
24278             });
24279           }
24280           function unary(func) {
24281             return ary(func, 1);
24282           }
24283           function wrap2(value, wrapper) {
24284             return partial(castFunction(wrapper), value);
24285           }
24286           function castArray() {
24287             if (!arguments.length) {
24288               return [];
24289             }
24290             var value = arguments[0];
24291             return isArray2(value) ? value : [value];
24292           }
24293           function clone2(value) {
24294             return baseClone(value, CLONE_SYMBOLS_FLAG);
24295           }
24296           function cloneWith(value, customizer) {
24297             customizer = typeof customizer == "function" ? customizer : undefined2;
24298             return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
24299           }
24300           function cloneDeep(value) {
24301             return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
24302           }
24303           function cloneDeepWith(value, customizer) {
24304             customizer = typeof customizer == "function" ? customizer : undefined2;
24305             return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
24306           }
24307           function conformsTo(object, source) {
24308             return source == null || baseConformsTo(object, source, keys2(source));
24309           }
24310           function eq2(value, other2) {
24311             return value === other2 || value !== value && other2 !== other2;
24312           }
24313           var gt2 = createRelationalOperation(baseGt);
24314           var gte = createRelationalOperation(function(value, other2) {
24315             return value >= other2;
24316           });
24317           var isArguments2 = baseIsArguments2(/* @__PURE__ */ function() {
24318             return arguments;
24319           }()) ? baseIsArguments2 : function(value) {
24320             return isObjectLike2(value) && hasOwnProperty13.call(value, "callee") && !propertyIsEnumerable3.call(value, "callee");
24321           };
24322           var isArray2 = Array2.isArray;
24323           var isArrayBuffer = nodeIsArrayBuffer ? baseUnary2(nodeIsArrayBuffer) : baseIsArrayBuffer;
24324           function isArrayLike2(value) {
24325             return value != null && isLength2(value.length) && !isFunction2(value);
24326           }
24327           function isArrayLikeObject2(value) {
24328             return isObjectLike2(value) && isArrayLike2(value);
24329           }
24330           function isBoolean(value) {
24331             return value === true || value === false || isObjectLike2(value) && baseGetTag2(value) == boolTag3;
24332           }
24333           var isBuffer2 = nativeIsBuffer2 || stubFalse2;
24334           var isDate = nodeIsDate ? baseUnary2(nodeIsDate) : baseIsDate;
24335           function isElement2(value) {
24336             return isObjectLike2(value) && value.nodeType === 1 && !isPlainObject2(value);
24337           }
24338           function isEmpty(value) {
24339             if (value == null) {
24340               return true;
24341             }
24342             if (isArrayLike2(value) && (isArray2(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer2(value) || isTypedArray2(value) || isArguments2(value))) {
24343               return !value.length;
24344             }
24345             var tag2 = getTag2(value);
24346             if (tag2 == mapTag4 || tag2 == setTag4) {
24347               return !value.size;
24348             }
24349             if (isPrototype2(value)) {
24350               return !baseKeys2(value).length;
24351             }
24352             for (var key in value) {
24353               if (hasOwnProperty13.call(value, key)) {
24354                 return false;
24355               }
24356             }
24357             return true;
24358           }
24359           function isEqual5(value, other2) {
24360             return baseIsEqual2(value, other2);
24361           }
24362           function isEqualWith(value, other2, customizer) {
24363             customizer = typeof customizer == "function" ? customizer : undefined2;
24364             var result2 = customizer ? customizer(value, other2) : undefined2;
24365             return result2 === undefined2 ? baseIsEqual2(value, other2, undefined2, customizer) : !!result2;
24366           }
24367           function isError(value) {
24368             if (!isObjectLike2(value)) {
24369               return false;
24370             }
24371             var tag2 = baseGetTag2(value);
24372             return tag2 == errorTag3 || tag2 == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject2(value);
24373           }
24374           function isFinite2(value) {
24375             return typeof value == "number" && nativeIsFinite(value);
24376           }
24377           function isFunction2(value) {
24378             if (!isObject2(value)) {
24379               return false;
24380             }
24381             var tag2 = baseGetTag2(value);
24382             return tag2 == funcTag3 || tag2 == genTag2 || tag2 == asyncTag2 || tag2 == proxyTag2;
24383           }
24384           function isInteger(value) {
24385             return typeof value == "number" && value == toInteger(value);
24386           }
24387           function isLength2(value) {
24388             return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER4;
24389           }
24390           function isObject2(value) {
24391             var type2 = typeof value;
24392             return value != null && (type2 == "object" || type2 == "function");
24393           }
24394           function isObjectLike2(value) {
24395             return value != null && typeof value == "object";
24396           }
24397           var isMap = nodeIsMap ? baseUnary2(nodeIsMap) : baseIsMap;
24398           function isMatch(object, source) {
24399             return object === source || baseIsMatch(object, source, getMatchData(source));
24400           }
24401           function isMatchWith(object, source, customizer) {
24402             customizer = typeof customizer == "function" ? customizer : undefined2;
24403             return baseIsMatch(object, source, getMatchData(source), customizer);
24404           }
24405           function isNaN2(value) {
24406             return isNumber2(value) && value != +value;
24407           }
24408           function isNative(value) {
24409             if (isMaskable(value)) {
24410               throw new Error2(CORE_ERROR_TEXT);
24411             }
24412             return baseIsNative2(value);
24413           }
24414           function isNull(value) {
24415             return value === null;
24416           }
24417           function isNil(value) {
24418             return value == null;
24419           }
24420           function isNumber2(value) {
24421             return typeof value == "number" || isObjectLike2(value) && baseGetTag2(value) == numberTag4;
24422           }
24423           function isPlainObject2(value) {
24424             if (!isObjectLike2(value) || baseGetTag2(value) != objectTag5) {
24425               return false;
24426             }
24427             var proto = getPrototype2(value);
24428             if (proto === null) {
24429               return true;
24430             }
24431             var Ctor = hasOwnProperty13.call(proto, "constructor") && proto.constructor;
24432             return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString4.call(Ctor) == objectCtorString2;
24433           }
24434           var isRegExp = nodeIsRegExp ? baseUnary2(nodeIsRegExp) : baseIsRegExp;
24435           function isSafeInteger(value) {
24436             return isInteger(value) && value >= -MAX_SAFE_INTEGER4 && value <= MAX_SAFE_INTEGER4;
24437           }
24438           var isSet = nodeIsSet ? baseUnary2(nodeIsSet) : baseIsSet;
24439           function isString(value) {
24440             return typeof value == "string" || !isArray2(value) && isObjectLike2(value) && baseGetTag2(value) == stringTag3;
24441           }
24442           function isSymbol2(value) {
24443             return typeof value == "symbol" || isObjectLike2(value) && baseGetTag2(value) == symbolTag3;
24444           }
24445           var isTypedArray2 = nodeIsTypedArray2 ? baseUnary2(nodeIsTypedArray2) : baseIsTypedArray2;
24446           function isUndefined(value) {
24447             return value === undefined2;
24448           }
24449           function isWeakMap(value) {
24450             return isObjectLike2(value) && getTag2(value) == weakMapTag3;
24451           }
24452           function isWeakSet(value) {
24453             return isObjectLike2(value) && baseGetTag2(value) == weakSetTag;
24454           }
24455           var lt2 = createRelationalOperation(baseLt);
24456           var lte = createRelationalOperation(function(value, other2) {
24457             return value <= other2;
24458           });
24459           function toArray(value) {
24460             if (!value) {
24461               return [];
24462             }
24463             if (isArrayLike2(value)) {
24464               return isString(value) ? stringToArray(value) : copyArray2(value);
24465             }
24466             if (symIterator && value[symIterator]) {
24467               return iteratorToArray(value[symIterator]());
24468             }
24469             var tag2 = getTag2(value), func = tag2 == mapTag4 ? mapToArray2 : tag2 == setTag4 ? setToArray2 : values;
24470             return func(value);
24471           }
24472           function toFinite(value) {
24473             if (!value) {
24474               return value === 0 ? value : 0;
24475             }
24476             value = toNumber3(value);
24477             if (value === INFINITY2 || value === -INFINITY2) {
24478               var sign2 = value < 0 ? -1 : 1;
24479               return sign2 * MAX_INTEGER;
24480             }
24481             return value === value ? value : 0;
24482           }
24483           function toInteger(value) {
24484             var result2 = toFinite(value), remainder = result2 % 1;
24485             return result2 === result2 ? remainder ? result2 - remainder : result2 : 0;
24486           }
24487           function toLength(value) {
24488             return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
24489           }
24490           function toNumber3(value) {
24491             if (typeof value == "number") {
24492               return value;
24493             }
24494             if (isSymbol2(value)) {
24495               return NAN2;
24496             }
24497             if (isObject2(value)) {
24498               var other2 = typeof value.valueOf == "function" ? value.valueOf() : value;
24499               value = isObject2(other2) ? other2 + "" : other2;
24500             }
24501             if (typeof value != "string") {
24502               return value === 0 ? value : +value;
24503             }
24504             value = baseTrim2(value);
24505             var isBinary = reIsBinary2.test(value);
24506             return isBinary || reIsOctal2.test(value) ? freeParseInt2(value.slice(2), isBinary ? 2 : 8) : reIsBadHex2.test(value) ? NAN2 : +value;
24507           }
24508           function toPlainObject2(value) {
24509             return copyObject2(value, keysIn2(value));
24510           }
24511           function toSafeInteger(value) {
24512             return value ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER4, MAX_SAFE_INTEGER4) : value === 0 ? value : 0;
24513           }
24514           function toString2(value) {
24515             return value == null ? "" : baseToString2(value);
24516           }
24517           var assign = createAssigner2(function(object, source) {
24518             if (isPrototype2(source) || isArrayLike2(source)) {
24519               copyObject2(source, keys2(source), object);
24520               return;
24521             }
24522             for (var key in source) {
24523               if (hasOwnProperty13.call(source, key)) {
24524                 assignValue2(object, key, source[key]);
24525               }
24526             }
24527           });
24528           var assignIn = createAssigner2(function(object, source) {
24529             copyObject2(source, keysIn2(source), object);
24530           });
24531           var assignInWith = createAssigner2(function(object, source, srcIndex, customizer) {
24532             copyObject2(source, keysIn2(source), object, customizer);
24533           });
24534           var assignWith = createAssigner2(function(object, source, srcIndex, customizer) {
24535             copyObject2(source, keys2(source), object, customizer);
24536           });
24537           var at2 = flatRest(baseAt);
24538           function create2(prototype4, properties) {
24539             var result2 = baseCreate2(prototype4);
24540             return properties == null ? result2 : baseAssign(result2, properties);
24541           }
24542           var defaults = baseRest2(function(object, sources) {
24543             object = Object2(object);
24544             var index = -1;
24545             var length2 = sources.length;
24546             var guard = length2 > 2 ? sources[2] : undefined2;
24547             if (guard && isIterateeCall2(sources[0], sources[1], guard)) {
24548               length2 = 1;
24549             }
24550             while (++index < length2) {
24551               var source = sources[index];
24552               var props = keysIn2(source);
24553               var propsIndex = -1;
24554               var propsLength = props.length;
24555               while (++propsIndex < propsLength) {
24556                 var key = props[propsIndex];
24557                 var value = object[key];
24558                 if (value === undefined2 || eq2(value, objectProto16[key]) && !hasOwnProperty13.call(object, key)) {
24559                   object[key] = source[key];
24560                 }
24561               }
24562             }
24563             return object;
24564           });
24565           var defaultsDeep = baseRest2(function(args) {
24566             args.push(undefined2, customDefaultsMerge);
24567             return apply2(mergeWith, undefined2, args);
24568           });
24569           function findKey(object, predicate) {
24570             return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
24571           }
24572           function findLastKey(object, predicate) {
24573             return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
24574           }
24575           function forIn(object, iteratee2) {
24576             return object == null ? object : baseFor2(object, getIteratee(iteratee2, 3), keysIn2);
24577           }
24578           function forInRight(object, iteratee2) {
24579             return object == null ? object : baseForRight(object, getIteratee(iteratee2, 3), keysIn2);
24580           }
24581           function forOwn(object, iteratee2) {
24582             return object && baseForOwn(object, getIteratee(iteratee2, 3));
24583           }
24584           function forOwnRight(object, iteratee2) {
24585             return object && baseForOwnRight(object, getIteratee(iteratee2, 3));
24586           }
24587           function functions(object) {
24588             return object == null ? [] : baseFunctions(object, keys2(object));
24589           }
24590           function functionsIn(object) {
24591             return object == null ? [] : baseFunctions(object, keysIn2(object));
24592           }
24593           function get4(object, path, defaultValue) {
24594             var result2 = object == null ? undefined2 : baseGet(object, path);
24595             return result2 === undefined2 ? defaultValue : result2;
24596           }
24597           function has(object, path) {
24598             return object != null && hasPath(object, path, baseHas);
24599           }
24600           function hasIn(object, path) {
24601             return object != null && hasPath(object, path, baseHasIn);
24602           }
24603           var invert = createInverter(function(result2, value, key) {
24604             if (value != null && typeof value.toString != "function") {
24605               value = nativeObjectToString3.call(value);
24606             }
24607             result2[value] = key;
24608           }, constant2(identity5));
24609           var invertBy = createInverter(function(result2, value, key) {
24610             if (value != null && typeof value.toString != "function") {
24611               value = nativeObjectToString3.call(value);
24612             }
24613             if (hasOwnProperty13.call(result2, value)) {
24614               result2[value].push(key);
24615             } else {
24616               result2[value] = [key];
24617             }
24618           }, getIteratee);
24619           var invoke = baseRest2(baseInvoke);
24620           function keys2(object) {
24621             return isArrayLike2(object) ? arrayLikeKeys2(object) : baseKeys2(object);
24622           }
24623           function keysIn2(object) {
24624             return isArrayLike2(object) ? arrayLikeKeys2(object, true) : baseKeysIn2(object);
24625           }
24626           function mapKeys(object, iteratee2) {
24627             var result2 = {};
24628             iteratee2 = getIteratee(iteratee2, 3);
24629             baseForOwn(object, function(value, key, object2) {
24630               baseAssignValue2(result2, iteratee2(value, key, object2), value);
24631             });
24632             return result2;
24633           }
24634           function mapValues(object, iteratee2) {
24635             var result2 = {};
24636             iteratee2 = getIteratee(iteratee2, 3);
24637             baseForOwn(object, function(value, key, object2) {
24638               baseAssignValue2(result2, key, iteratee2(value, key, object2));
24639             });
24640             return result2;
24641           }
24642           var merge3 = createAssigner2(function(object, source, srcIndex) {
24643             baseMerge2(object, source, srcIndex);
24644           });
24645           var mergeWith = createAssigner2(function(object, source, srcIndex, customizer) {
24646             baseMerge2(object, source, srcIndex, customizer);
24647           });
24648           var omit = flatRest(function(object, paths) {
24649             var result2 = {};
24650             if (object == null) {
24651               return result2;
24652             }
24653             var isDeep = false;
24654             paths = arrayMap2(paths, function(path) {
24655               path = castPath(path, object);
24656               isDeep || (isDeep = path.length > 1);
24657               return path;
24658             });
24659             copyObject2(object, getAllKeysIn(object), result2);
24660             if (isDeep) {
24661               result2 = baseClone(result2, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
24662             }
24663             var length2 = paths.length;
24664             while (length2--) {
24665               baseUnset(result2, paths[length2]);
24666             }
24667             return result2;
24668           });
24669           function omitBy(object, predicate) {
24670             return pickBy(object, negate(getIteratee(predicate)));
24671           }
24672           var pick = flatRest(function(object, paths) {
24673             return object == null ? {} : basePick(object, paths);
24674           });
24675           function pickBy(object, predicate) {
24676             if (object == null) {
24677               return {};
24678             }
24679             var props = arrayMap2(getAllKeysIn(object), function(prop) {
24680               return [prop];
24681             });
24682             predicate = getIteratee(predicate);
24683             return basePickBy(object, props, function(value, path) {
24684               return predicate(value, path[0]);
24685             });
24686           }
24687           function result(object, path, defaultValue) {
24688             path = castPath(path, object);
24689             var index = -1, length2 = path.length;
24690             if (!length2) {
24691               length2 = 1;
24692               object = undefined2;
24693             }
24694             while (++index < length2) {
24695               var value = object == null ? undefined2 : object[toKey(path[index])];
24696               if (value === undefined2) {
24697                 index = length2;
24698                 value = defaultValue;
24699               }
24700               object = isFunction2(value) ? value.call(object) : value;
24701             }
24702             return object;
24703           }
24704           function set4(object, path, value) {
24705             return object == null ? object : baseSet(object, path, value);
24706           }
24707           function setWith(object, path, value, customizer) {
24708             customizer = typeof customizer == "function" ? customizer : undefined2;
24709             return object == null ? object : baseSet(object, path, value, customizer);
24710           }
24711           var toPairs = createToPairs(keys2);
24712           var toPairsIn = createToPairs(keysIn2);
24713           function transform2(object, iteratee2, accumulator) {
24714             var isArr = isArray2(object), isArrLike = isArr || isBuffer2(object) || isTypedArray2(object);
24715             iteratee2 = getIteratee(iteratee2, 4);
24716             if (accumulator == null) {
24717               var Ctor = object && object.constructor;
24718               if (isArrLike) {
24719                 accumulator = isArr ? new Ctor() : [];
24720               } else if (isObject2(object)) {
24721                 accumulator = isFunction2(Ctor) ? baseCreate2(getPrototype2(object)) : {};
24722               } else {
24723                 accumulator = {};
24724               }
24725             }
24726             (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object2) {
24727               return iteratee2(accumulator, value, index, object2);
24728             });
24729             return accumulator;
24730           }
24731           function unset(object, path) {
24732             return object == null ? true : baseUnset(object, path);
24733           }
24734           function update(object, path, updater) {
24735             return object == null ? object : baseUpdate(object, path, castFunction(updater));
24736           }
24737           function updateWith(object, path, updater, customizer) {
24738             customizer = typeof customizer == "function" ? customizer : undefined2;
24739             return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
24740           }
24741           function values(object) {
24742             return object == null ? [] : baseValues(object, keys2(object));
24743           }
24744           function valuesIn(object) {
24745             return object == null ? [] : baseValues(object, keysIn2(object));
24746           }
24747           function clamp3(number3, lower2, upper) {
24748             if (upper === undefined2) {
24749               upper = lower2;
24750               lower2 = undefined2;
24751             }
24752             if (upper !== undefined2) {
24753               upper = toNumber3(upper);
24754               upper = upper === upper ? upper : 0;
24755             }
24756             if (lower2 !== undefined2) {
24757               lower2 = toNumber3(lower2);
24758               lower2 = lower2 === lower2 ? lower2 : 0;
24759             }
24760             return baseClamp(toNumber3(number3), lower2, upper);
24761           }
24762           function inRange(number3, start2, end) {
24763             start2 = toFinite(start2);
24764             if (end === undefined2) {
24765               end = start2;
24766               start2 = 0;
24767             } else {
24768               end = toFinite(end);
24769             }
24770             number3 = toNumber3(number3);
24771             return baseInRange(number3, start2, end);
24772           }
24773           function random(lower2, upper, floating) {
24774             if (floating && typeof floating != "boolean" && isIterateeCall2(lower2, upper, floating)) {
24775               upper = floating = undefined2;
24776             }
24777             if (floating === undefined2) {
24778               if (typeof upper == "boolean") {
24779                 floating = upper;
24780                 upper = undefined2;
24781               } else if (typeof lower2 == "boolean") {
24782                 floating = lower2;
24783                 lower2 = undefined2;
24784               }
24785             }
24786             if (lower2 === undefined2 && upper === undefined2) {
24787               lower2 = 0;
24788               upper = 1;
24789             } else {
24790               lower2 = toFinite(lower2);
24791               if (upper === undefined2) {
24792                 upper = lower2;
24793                 lower2 = 0;
24794               } else {
24795                 upper = toFinite(upper);
24796               }
24797             }
24798             if (lower2 > upper) {
24799               var temp = lower2;
24800               lower2 = upper;
24801               upper = temp;
24802             }
24803             if (floating || lower2 % 1 || upper % 1) {
24804               var rand = nativeRandom();
24805               return nativeMin2(lower2 + rand * (upper - lower2 + freeParseFloat("1e-" + ((rand + "").length - 1))), upper);
24806             }
24807             return baseRandom(lower2, upper);
24808           }
24809           var camelCase = createCompounder(function(result2, word, index) {
24810             word = word.toLowerCase();
24811             return result2 + (index ? capitalize(word) : word);
24812           });
24813           function capitalize(string) {
24814             return upperFirst(toString2(string).toLowerCase());
24815           }
24816           function deburr(string) {
24817             string = toString2(string);
24818             return string && string.replace(reLatin, deburrLetter).replace(reComboMark, "");
24819           }
24820           function endsWith(string, target, position) {
24821             string = toString2(string);
24822             target = baseToString2(target);
24823             var length2 = string.length;
24824             position = position === undefined2 ? length2 : baseClamp(toInteger(position), 0, length2);
24825             var end = position;
24826             position -= target.length;
24827             return position >= 0 && string.slice(position, end) == target;
24828           }
24829           function escape6(string) {
24830             string = toString2(string);
24831             return string && reHasUnescapedHtml2.test(string) ? string.replace(reUnescapedHtml2, escapeHtmlChar2) : string;
24832           }
24833           function escapeRegExp(string) {
24834             string = toString2(string);
24835             return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar2, "\\$&") : string;
24836           }
24837           var kebabCase = createCompounder(function(result2, word, index) {
24838             return result2 + (index ? "-" : "") + word.toLowerCase();
24839           });
24840           var lowerCase = createCompounder(function(result2, word, index) {
24841             return result2 + (index ? " " : "") + word.toLowerCase();
24842           });
24843           var lowerFirst = createCaseFirst("toLowerCase");
24844           function pad3(string, length2, chars) {
24845             string = toString2(string);
24846             length2 = toInteger(length2);
24847             var strLength = length2 ? stringSize(string) : 0;
24848             if (!length2 || strLength >= length2) {
24849               return string;
24850             }
24851             var mid = (length2 - strLength) / 2;
24852             return createPadding(nativeFloor(mid), chars) + string + createPadding(nativeCeil(mid), chars);
24853           }
24854           function padEnd(string, length2, chars) {
24855             string = toString2(string);
24856             length2 = toInteger(length2);
24857             var strLength = length2 ? stringSize(string) : 0;
24858             return length2 && strLength < length2 ? string + createPadding(length2 - strLength, chars) : string;
24859           }
24860           function padStart(string, length2, chars) {
24861             string = toString2(string);
24862             length2 = toInteger(length2);
24863             var strLength = length2 ? stringSize(string) : 0;
24864             return length2 && strLength < length2 ? createPadding(length2 - strLength, chars) + string : string;
24865           }
24866           function parseInt2(string, radix, guard) {
24867             if (guard || radix == null) {
24868               radix = 0;
24869             } else if (radix) {
24870               radix = +radix;
24871             }
24872             return nativeParseInt(toString2(string).replace(reTrimStart2, ""), radix || 0);
24873           }
24874           function repeat(string, n3, guard) {
24875             if (guard ? isIterateeCall2(string, n3, guard) : n3 === undefined2) {
24876               n3 = 1;
24877             } else {
24878               n3 = toInteger(n3);
24879             }
24880             return baseRepeat(toString2(string), n3);
24881           }
24882           function replace() {
24883             var args = arguments, string = toString2(args[0]);
24884             return args.length < 3 ? string : string.replace(args[1], args[2]);
24885           }
24886           var snakeCase = createCompounder(function(result2, word, index) {
24887             return result2 + (index ? "_" : "") + word.toLowerCase();
24888           });
24889           function split(string, separator, limit) {
24890             if (limit && typeof limit != "number" && isIterateeCall2(string, separator, limit)) {
24891               separator = limit = undefined2;
24892             }
24893             limit = limit === undefined2 ? MAX_ARRAY_LENGTH : limit >>> 0;
24894             if (!limit) {
24895               return [];
24896             }
24897             string = toString2(string);
24898             if (string && (typeof separator == "string" || separator != null && !isRegExp(separator))) {
24899               separator = baseToString2(separator);
24900               if (!separator && hasUnicode(string)) {
24901                 return castSlice(stringToArray(string), 0, limit);
24902               }
24903             }
24904             return string.split(separator, limit);
24905           }
24906           var startCase = createCompounder(function(result2, word, index) {
24907             return result2 + (index ? " " : "") + upperFirst(word);
24908           });
24909           function startsWith(string, target, position) {
24910             string = toString2(string);
24911             position = position == null ? 0 : baseClamp(toInteger(position), 0, string.length);
24912             target = baseToString2(target);
24913             return string.slice(position, position + target.length) == target;
24914           }
24915           function template(string, options2, guard) {
24916             var settings = lodash.templateSettings;
24917             if (guard && isIterateeCall2(string, options2, guard)) {
24918               options2 = undefined2;
24919             }
24920             string = toString2(string);
24921             options2 = assignInWith({}, options2, settings, customDefaultsAssignIn);
24922             var imports = assignInWith({}, options2.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys2(imports), importsValues = baseValues(imports, importsKeys);
24923             var isEscaping, isEvaluating, index = 0, interpolate = options2.interpolate || reNoMatch, source = "__p += '";
24924             var reDelimiters = RegExp2(
24925               (options2.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options2.evaluate || reNoMatch).source + "|$",
24926               "g"
24927             );
24928             var sourceURL = "//# sourceURL=" + (hasOwnProperty13.call(options2, "sourceURL") ? (options2.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n";
24929             string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
24930               interpolateValue || (interpolateValue = esTemplateValue);
24931               source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
24932               if (escapeValue) {
24933                 isEscaping = true;
24934                 source += "' +\n__e(" + escapeValue + ") +\n'";
24935               }
24936               if (evaluateValue) {
24937                 isEvaluating = true;
24938                 source += "';\n" + evaluateValue + ";\n__p += '";
24939               }
24940               if (interpolateValue) {
24941                 source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
24942               }
24943               index = offset + match.length;
24944               return match;
24945             });
24946             source += "';\n";
24947             var variable = hasOwnProperty13.call(options2, "variable") && options2.variable;
24948             if (!variable) {
24949               source = "with (obj) {\n" + source + "\n}\n";
24950             } else if (reForbiddenIdentifierChars.test(variable)) {
24951               throw new Error2(INVALID_TEMPL_VAR_ERROR_TEXT);
24952             }
24953             source = (isEvaluating ? source.replace(reEmptyStringLeading, "") : source).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;");
24954             source = "function(" + (variable || "obj") + ") {\n" + (variable ? "" : "obj || (obj = {});\n") + "var __t, __p = ''" + (isEscaping ? ", __e = _.escape" : "") + (isEvaluating ? ", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n" : ";\n") + source + "return __p\n}";
24955             var result2 = attempt(function() {
24956               return Function2(importsKeys, sourceURL + "return " + source).apply(undefined2, importsValues);
24957             });
24958             result2.source = source;
24959             if (isError(result2)) {
24960               throw result2;
24961             }
24962             return result2;
24963           }
24964           function toLower(value) {
24965             return toString2(value).toLowerCase();
24966           }
24967           function toUpper(value) {
24968             return toString2(value).toUpperCase();
24969           }
24970           function trim(string, chars, guard) {
24971             string = toString2(string);
24972             if (string && (guard || chars === undefined2)) {
24973               return baseTrim2(string);
24974             }
24975             if (!string || !(chars = baseToString2(chars))) {
24976               return string;
24977             }
24978             var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars), start2 = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1;
24979             return castSlice(strSymbols, start2, end).join("");
24980           }
24981           function trimEnd(string, chars, guard) {
24982             string = toString2(string);
24983             if (string && (guard || chars === undefined2)) {
24984               return string.slice(0, trimmedEndIndex2(string) + 1);
24985             }
24986             if (!string || !(chars = baseToString2(chars))) {
24987               return string;
24988             }
24989             var strSymbols = stringToArray(string), end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
24990             return castSlice(strSymbols, 0, end).join("");
24991           }
24992           function trimStart(string, chars, guard) {
24993             string = toString2(string);
24994             if (string && (guard || chars === undefined2)) {
24995               return string.replace(reTrimStart2, "");
24996             }
24997             if (!string || !(chars = baseToString2(chars))) {
24998               return string;
24999             }
25000             var strSymbols = stringToArray(string), start2 = charsStartIndex(strSymbols, stringToArray(chars));
25001             return castSlice(strSymbols, start2).join("");
25002           }
25003           function truncate(string, options2) {
25004             var length2 = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION;
25005             if (isObject2(options2)) {
25006               var separator = "separator" in options2 ? options2.separator : separator;
25007               length2 = "length" in options2 ? toInteger(options2.length) : length2;
25008               omission = "omission" in options2 ? baseToString2(options2.omission) : omission;
25009             }
25010             string = toString2(string);
25011             var strLength = string.length;
25012             if (hasUnicode(string)) {
25013               var strSymbols = stringToArray(string);
25014               strLength = strSymbols.length;
25015             }
25016             if (length2 >= strLength) {
25017               return string;
25018             }
25019             var end = length2 - stringSize(omission);
25020             if (end < 1) {
25021               return omission;
25022             }
25023             var result2 = strSymbols ? castSlice(strSymbols, 0, end).join("") : string.slice(0, end);
25024             if (separator === undefined2) {
25025               return result2 + omission;
25026             }
25027             if (strSymbols) {
25028               end += result2.length - end;
25029             }
25030             if (isRegExp(separator)) {
25031               if (string.slice(end).search(separator)) {
25032                 var match, substring = result2;
25033                 if (!separator.global) {
25034                   separator = RegExp2(separator.source, toString2(reFlags.exec(separator)) + "g");
25035                 }
25036                 separator.lastIndex = 0;
25037                 while (match = separator.exec(substring)) {
25038                   var newEnd = match.index;
25039                 }
25040                 result2 = result2.slice(0, newEnd === undefined2 ? end : newEnd);
25041               }
25042             } else if (string.indexOf(baseToString2(separator), end) != end) {
25043               var index = result2.lastIndexOf(separator);
25044               if (index > -1) {
25045                 result2 = result2.slice(0, index);
25046               }
25047             }
25048             return result2 + omission;
25049           }
25050           function unescape2(string) {
25051             string = toString2(string);
25052             return string && reHasEscapedHtml2.test(string) ? string.replace(reEscapedHtml2, unescapeHtmlChar2) : string;
25053           }
25054           var upperCase = createCompounder(function(result2, word, index) {
25055             return result2 + (index ? " " : "") + word.toUpperCase();
25056           });
25057           var upperFirst = createCaseFirst("toUpperCase");
25058           function words(string, pattern, guard) {
25059             string = toString2(string);
25060             pattern = guard ? undefined2 : pattern;
25061             if (pattern === undefined2) {
25062               return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
25063             }
25064             return string.match(pattern) || [];
25065           }
25066           var attempt = baseRest2(function(func, args) {
25067             try {
25068               return apply2(func, undefined2, args);
25069             } catch (e3) {
25070               return isError(e3) ? e3 : new Error2(e3);
25071             }
25072           });
25073           var bindAll = flatRest(function(object, methodNames) {
25074             arrayEach(methodNames, function(key) {
25075               key = toKey(key);
25076               baseAssignValue2(object, key, bind(object[key], object));
25077             });
25078             return object;
25079           });
25080           function cond(pairs2) {
25081             var length2 = pairs2 == null ? 0 : pairs2.length, toIteratee = getIteratee();
25082             pairs2 = !length2 ? [] : arrayMap2(pairs2, function(pair3) {
25083               if (typeof pair3[1] != "function") {
25084                 throw new TypeError2(FUNC_ERROR_TEXT3);
25085               }
25086               return [toIteratee(pair3[0]), pair3[1]];
25087             });
25088             return baseRest2(function(args) {
25089               var index = -1;
25090               while (++index < length2) {
25091                 var pair3 = pairs2[index];
25092                 if (apply2(pair3[0], this, args)) {
25093                   return apply2(pair3[1], this, args);
25094                 }
25095               }
25096             });
25097           }
25098           function conforms(source) {
25099             return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
25100           }
25101           function constant2(value) {
25102             return function() {
25103               return value;
25104             };
25105           }
25106           function defaultTo(value, defaultValue) {
25107             return value == null || value !== value ? defaultValue : value;
25108           }
25109           var flow = createFlow();
25110           var flowRight = createFlow(true);
25111           function identity5(value) {
25112             return value;
25113           }
25114           function iteratee(func) {
25115             return baseIteratee(typeof func == "function" ? func : baseClone(func, CLONE_DEEP_FLAG));
25116           }
25117           function matches(source) {
25118             return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
25119           }
25120           function matchesProperty(path, srcValue) {
25121             return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
25122           }
25123           var method = baseRest2(function(path, args) {
25124             return function(object) {
25125               return baseInvoke(object, path, args);
25126             };
25127           });
25128           var methodOf = baseRest2(function(object, args) {
25129             return function(path) {
25130               return baseInvoke(object, path, args);
25131             };
25132           });
25133           function mixin(object, source, options2) {
25134             var props = keys2(source), methodNames = baseFunctions(source, props);
25135             if (options2 == null && !(isObject2(source) && (methodNames.length || !props.length))) {
25136               options2 = source;
25137               source = object;
25138               object = this;
25139               methodNames = baseFunctions(source, keys2(source));
25140             }
25141             var chain2 = !(isObject2(options2) && "chain" in options2) || !!options2.chain, isFunc = isFunction2(object);
25142             arrayEach(methodNames, function(methodName) {
25143               var func = source[methodName];
25144               object[methodName] = func;
25145               if (isFunc) {
25146                 object.prototype[methodName] = function() {
25147                   var chainAll = this.__chain__;
25148                   if (chain2 || chainAll) {
25149                     var result2 = object(this.__wrapped__), actions = result2.__actions__ = copyArray2(this.__actions__);
25150                     actions.push({ "func": func, "args": arguments, "thisArg": object });
25151                     result2.__chain__ = chainAll;
25152                     return result2;
25153                   }
25154                   return func.apply(object, arrayPush2([this.value()], arguments));
25155                 };
25156               }
25157             });
25158             return object;
25159           }
25160           function noConflict() {
25161             if (root3._ === this) {
25162               root3._ = oldDash;
25163             }
25164             return this;
25165           }
25166           function noop3() {
25167           }
25168           function nthArg(n3) {
25169             n3 = toInteger(n3);
25170             return baseRest2(function(args) {
25171               return baseNth(args, n3);
25172             });
25173           }
25174           var over = createOver(arrayMap2);
25175           var overEvery = createOver(arrayEvery);
25176           var overSome = createOver(arraySome2);
25177           function property(path) {
25178             return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
25179           }
25180           function propertyOf(object) {
25181             return function(path) {
25182               return object == null ? undefined2 : baseGet(object, path);
25183             };
25184           }
25185           var range3 = createRange();
25186           var rangeRight = createRange(true);
25187           function stubArray2() {
25188             return [];
25189           }
25190           function stubFalse2() {
25191             return false;
25192           }
25193           function stubObject() {
25194             return {};
25195           }
25196           function stubString() {
25197             return "";
25198           }
25199           function stubTrue() {
25200             return true;
25201           }
25202           function times(n3, iteratee2) {
25203             n3 = toInteger(n3);
25204             if (n3 < 1 || n3 > MAX_SAFE_INTEGER4) {
25205               return [];
25206             }
25207             var index = MAX_ARRAY_LENGTH, length2 = nativeMin2(n3, MAX_ARRAY_LENGTH);
25208             iteratee2 = getIteratee(iteratee2);
25209             n3 -= MAX_ARRAY_LENGTH;
25210             var result2 = baseTimes2(length2, iteratee2);
25211             while (++index < n3) {
25212               iteratee2(index);
25213             }
25214             return result2;
25215           }
25216           function toPath(value) {
25217             if (isArray2(value)) {
25218               return arrayMap2(value, toKey);
25219             }
25220             return isSymbol2(value) ? [value] : copyArray2(stringToPath(toString2(value)));
25221           }
25222           function uniqueId(prefix) {
25223             var id2 = ++idCounter;
25224             return toString2(prefix) + id2;
25225           }
25226           var add = createMathOperation(function(augend, addend) {
25227             return augend + addend;
25228           }, 0);
25229           var ceil = createRound("ceil");
25230           var divide = createMathOperation(function(dividend, divisor) {
25231             return dividend / divisor;
25232           }, 1);
25233           var floor = createRound("floor");
25234           function max3(array2) {
25235             return array2 && array2.length ? baseExtremum(array2, identity5, baseGt) : undefined2;
25236           }
25237           function maxBy(array2, iteratee2) {
25238             return array2 && array2.length ? baseExtremum(array2, getIteratee(iteratee2, 2), baseGt) : undefined2;
25239           }
25240           function mean(array2) {
25241             return baseMean(array2, identity5);
25242           }
25243           function meanBy(array2, iteratee2) {
25244             return baseMean(array2, getIteratee(iteratee2, 2));
25245           }
25246           function min3(array2) {
25247             return array2 && array2.length ? baseExtremum(array2, identity5, baseLt) : undefined2;
25248           }
25249           function minBy(array2, iteratee2) {
25250             return array2 && array2.length ? baseExtremum(array2, getIteratee(iteratee2, 2), baseLt) : undefined2;
25251           }
25252           var multiply = createMathOperation(function(multiplier, multiplicand) {
25253             return multiplier * multiplicand;
25254           }, 1);
25255           var round = createRound("round");
25256           var subtract = createMathOperation(function(minuend, subtrahend) {
25257             return minuend - subtrahend;
25258           }, 0);
25259           function sum(array2) {
25260             return array2 && array2.length ? baseSum(array2, identity5) : 0;
25261           }
25262           function sumBy(array2, iteratee2) {
25263             return array2 && array2.length ? baseSum(array2, getIteratee(iteratee2, 2)) : 0;
25264           }
25265           lodash.after = after;
25266           lodash.ary = ary;
25267           lodash.assign = assign;
25268           lodash.assignIn = assignIn;
25269           lodash.assignInWith = assignInWith;
25270           lodash.assignWith = assignWith;
25271           lodash.at = at2;
25272           lodash.before = before;
25273           lodash.bind = bind;
25274           lodash.bindAll = bindAll;
25275           lodash.bindKey = bindKey2;
25276           lodash.castArray = castArray;
25277           lodash.chain = chain;
25278           lodash.chunk = chunk;
25279           lodash.compact = compact;
25280           lodash.concat = concat;
25281           lodash.cond = cond;
25282           lodash.conforms = conforms;
25283           lodash.constant = constant2;
25284           lodash.countBy = countBy;
25285           lodash.create = create2;
25286           lodash.curry = curry;
25287           lodash.curryRight = curryRight;
25288           lodash.debounce = debounce2;
25289           lodash.defaults = defaults;
25290           lodash.defaultsDeep = defaultsDeep;
25291           lodash.defer = defer;
25292           lodash.delay = delay;
25293           lodash.difference = difference2;
25294           lodash.differenceBy = differenceBy;
25295           lodash.differenceWith = differenceWith;
25296           lodash.drop = drop;
25297           lodash.dropRight = dropRight;
25298           lodash.dropRightWhile = dropRightWhile;
25299           lodash.dropWhile = dropWhile;
25300           lodash.fill = fill;
25301           lodash.filter = filter2;
25302           lodash.flatMap = flatMap;
25303           lodash.flatMapDeep = flatMapDeep;
25304           lodash.flatMapDepth = flatMapDepth;
25305           lodash.flatten = flatten2;
25306           lodash.flattenDeep = flattenDeep;
25307           lodash.flattenDepth = flattenDepth;
25308           lodash.flip = flip;
25309           lodash.flow = flow;
25310           lodash.flowRight = flowRight;
25311           lodash.fromPairs = fromPairs;
25312           lodash.functions = functions;
25313           lodash.functionsIn = functionsIn;
25314           lodash.groupBy = groupBy;
25315           lodash.initial = initial;
25316           lodash.intersection = intersection2;
25317           lodash.intersectionBy = intersectionBy;
25318           lodash.intersectionWith = intersectionWith;
25319           lodash.invert = invert;
25320           lodash.invertBy = invertBy;
25321           lodash.invokeMap = invokeMap;
25322           lodash.iteratee = iteratee;
25323           lodash.keyBy = keyBy;
25324           lodash.keys = keys2;
25325           lodash.keysIn = keysIn2;
25326           lodash.map = map2;
25327           lodash.mapKeys = mapKeys;
25328           lodash.mapValues = mapValues;
25329           lodash.matches = matches;
25330           lodash.matchesProperty = matchesProperty;
25331           lodash.memoize = memoize;
25332           lodash.merge = merge3;
25333           lodash.mergeWith = mergeWith;
25334           lodash.method = method;
25335           lodash.methodOf = methodOf;
25336           lodash.mixin = mixin;
25337           lodash.negate = negate;
25338           lodash.nthArg = nthArg;
25339           lodash.omit = omit;
25340           lodash.omitBy = omitBy;
25341           lodash.once = once;
25342           lodash.orderBy = orderBy;
25343           lodash.over = over;
25344           lodash.overArgs = overArgs;
25345           lodash.overEvery = overEvery;
25346           lodash.overSome = overSome;
25347           lodash.partial = partial;
25348           lodash.partialRight = partialRight;
25349           lodash.partition = partition;
25350           lodash.pick = pick;
25351           lodash.pickBy = pickBy;
25352           lodash.property = property;
25353           lodash.propertyOf = propertyOf;
25354           lodash.pull = pull;
25355           lodash.pullAll = pullAll;
25356           lodash.pullAllBy = pullAllBy;
25357           lodash.pullAllWith = pullAllWith;
25358           lodash.pullAt = pullAt;
25359           lodash.range = range3;
25360           lodash.rangeRight = rangeRight;
25361           lodash.rearg = rearg;
25362           lodash.reject = reject;
25363           lodash.remove = remove2;
25364           lodash.rest = rest;
25365           lodash.reverse = reverse;
25366           lodash.sampleSize = sampleSize;
25367           lodash.set = set4;
25368           lodash.setWith = setWith;
25369           lodash.shuffle = shuffle;
25370           lodash.slice = slice;
25371           lodash.sortBy = sortBy;
25372           lodash.sortedUniq = sortedUniq;
25373           lodash.sortedUniqBy = sortedUniqBy;
25374           lodash.split = split;
25375           lodash.spread = spread;
25376           lodash.tail = tail;
25377           lodash.take = take;
25378           lodash.takeRight = takeRight;
25379           lodash.takeRightWhile = takeRightWhile;
25380           lodash.takeWhile = takeWhile;
25381           lodash.tap = tap;
25382           lodash.throttle = throttle2;
25383           lodash.thru = thru;
25384           lodash.toArray = toArray;
25385           lodash.toPairs = toPairs;
25386           lodash.toPairsIn = toPairsIn;
25387           lodash.toPath = toPath;
25388           lodash.toPlainObject = toPlainObject2;
25389           lodash.transform = transform2;
25390           lodash.unary = unary;
25391           lodash.union = union2;
25392           lodash.unionBy = unionBy;
25393           lodash.unionWith = unionWith;
25394           lodash.uniq = uniq;
25395           lodash.uniqBy = uniqBy;
25396           lodash.uniqWith = uniqWith;
25397           lodash.unset = unset;
25398           lodash.unzip = unzip;
25399           lodash.unzipWith = unzipWith;
25400           lodash.update = update;
25401           lodash.updateWith = updateWith;
25402           lodash.values = values;
25403           lodash.valuesIn = valuesIn;
25404           lodash.without = without;
25405           lodash.words = words;
25406           lodash.wrap = wrap2;
25407           lodash.xor = xor;
25408           lodash.xorBy = xorBy;
25409           lodash.xorWith = xorWith;
25410           lodash.zip = zip;
25411           lodash.zipObject = zipObject;
25412           lodash.zipObjectDeep = zipObjectDeep;
25413           lodash.zipWith = zipWith;
25414           lodash.entries = toPairs;
25415           lodash.entriesIn = toPairsIn;
25416           lodash.extend = assignIn;
25417           lodash.extendWith = assignInWith;
25418           mixin(lodash, lodash);
25419           lodash.add = add;
25420           lodash.attempt = attempt;
25421           lodash.camelCase = camelCase;
25422           lodash.capitalize = capitalize;
25423           lodash.ceil = ceil;
25424           lodash.clamp = clamp3;
25425           lodash.clone = clone2;
25426           lodash.cloneDeep = cloneDeep;
25427           lodash.cloneDeepWith = cloneDeepWith;
25428           lodash.cloneWith = cloneWith;
25429           lodash.conformsTo = conformsTo;
25430           lodash.deburr = deburr;
25431           lodash.defaultTo = defaultTo;
25432           lodash.divide = divide;
25433           lodash.endsWith = endsWith;
25434           lodash.eq = eq2;
25435           lodash.escape = escape6;
25436           lodash.escapeRegExp = escapeRegExp;
25437           lodash.every = every;
25438           lodash.find = find2;
25439           lodash.findIndex = findIndex;
25440           lodash.findKey = findKey;
25441           lodash.findLast = findLast;
25442           lodash.findLastIndex = findLastIndex;
25443           lodash.findLastKey = findLastKey;
25444           lodash.floor = floor;
25445           lodash.forEach = forEach;
25446           lodash.forEachRight = forEachRight;
25447           lodash.forIn = forIn;
25448           lodash.forInRight = forInRight;
25449           lodash.forOwn = forOwn;
25450           lodash.forOwnRight = forOwnRight;
25451           lodash.get = get4;
25452           lodash.gt = gt2;
25453           lodash.gte = gte;
25454           lodash.has = has;
25455           lodash.hasIn = hasIn;
25456           lodash.head = head;
25457           lodash.identity = identity5;
25458           lodash.includes = includes;
25459           lodash.indexOf = indexOf;
25460           lodash.inRange = inRange;
25461           lodash.invoke = invoke;
25462           lodash.isArguments = isArguments2;
25463           lodash.isArray = isArray2;
25464           lodash.isArrayBuffer = isArrayBuffer;
25465           lodash.isArrayLike = isArrayLike2;
25466           lodash.isArrayLikeObject = isArrayLikeObject2;
25467           lodash.isBoolean = isBoolean;
25468           lodash.isBuffer = isBuffer2;
25469           lodash.isDate = isDate;
25470           lodash.isElement = isElement2;
25471           lodash.isEmpty = isEmpty;
25472           lodash.isEqual = isEqual5;
25473           lodash.isEqualWith = isEqualWith;
25474           lodash.isError = isError;
25475           lodash.isFinite = isFinite2;
25476           lodash.isFunction = isFunction2;
25477           lodash.isInteger = isInteger;
25478           lodash.isLength = isLength2;
25479           lodash.isMap = isMap;
25480           lodash.isMatch = isMatch;
25481           lodash.isMatchWith = isMatchWith;
25482           lodash.isNaN = isNaN2;
25483           lodash.isNative = isNative;
25484           lodash.isNil = isNil;
25485           lodash.isNull = isNull;
25486           lodash.isNumber = isNumber2;
25487           lodash.isObject = isObject2;
25488           lodash.isObjectLike = isObjectLike2;
25489           lodash.isPlainObject = isPlainObject2;
25490           lodash.isRegExp = isRegExp;
25491           lodash.isSafeInteger = isSafeInteger;
25492           lodash.isSet = isSet;
25493           lodash.isString = isString;
25494           lodash.isSymbol = isSymbol2;
25495           lodash.isTypedArray = isTypedArray2;
25496           lodash.isUndefined = isUndefined;
25497           lodash.isWeakMap = isWeakMap;
25498           lodash.isWeakSet = isWeakSet;
25499           lodash.join = join;
25500           lodash.kebabCase = kebabCase;
25501           lodash.last = last;
25502           lodash.lastIndexOf = lastIndexOf;
25503           lodash.lowerCase = lowerCase;
25504           lodash.lowerFirst = lowerFirst;
25505           lodash.lt = lt2;
25506           lodash.lte = lte;
25507           lodash.max = max3;
25508           lodash.maxBy = maxBy;
25509           lodash.mean = mean;
25510           lodash.meanBy = meanBy;
25511           lodash.min = min3;
25512           lodash.minBy = minBy;
25513           lodash.stubArray = stubArray2;
25514           lodash.stubFalse = stubFalse2;
25515           lodash.stubObject = stubObject;
25516           lodash.stubString = stubString;
25517           lodash.stubTrue = stubTrue;
25518           lodash.multiply = multiply;
25519           lodash.nth = nth;
25520           lodash.noConflict = noConflict;
25521           lodash.noop = noop3;
25522           lodash.now = now3;
25523           lodash.pad = pad3;
25524           lodash.padEnd = padEnd;
25525           lodash.padStart = padStart;
25526           lodash.parseInt = parseInt2;
25527           lodash.random = random;
25528           lodash.reduce = reduce;
25529           lodash.reduceRight = reduceRight;
25530           lodash.repeat = repeat;
25531           lodash.replace = replace;
25532           lodash.result = result;
25533           lodash.round = round;
25534           lodash.runInContext = runInContext2;
25535           lodash.sample = sample;
25536           lodash.size = size;
25537           lodash.snakeCase = snakeCase;
25538           lodash.some = some;
25539           lodash.sortedIndex = sortedIndex;
25540           lodash.sortedIndexBy = sortedIndexBy;
25541           lodash.sortedIndexOf = sortedIndexOf;
25542           lodash.sortedLastIndex = sortedLastIndex;
25543           lodash.sortedLastIndexBy = sortedLastIndexBy;
25544           lodash.sortedLastIndexOf = sortedLastIndexOf;
25545           lodash.startCase = startCase;
25546           lodash.startsWith = startsWith;
25547           lodash.subtract = subtract;
25548           lodash.sum = sum;
25549           lodash.sumBy = sumBy;
25550           lodash.template = template;
25551           lodash.times = times;
25552           lodash.toFinite = toFinite;
25553           lodash.toInteger = toInteger;
25554           lodash.toLength = toLength;
25555           lodash.toLower = toLower;
25556           lodash.toNumber = toNumber3;
25557           lodash.toSafeInteger = toSafeInteger;
25558           lodash.toString = toString2;
25559           lodash.toUpper = toUpper;
25560           lodash.trim = trim;
25561           lodash.trimEnd = trimEnd;
25562           lodash.trimStart = trimStart;
25563           lodash.truncate = truncate;
25564           lodash.unescape = unescape2;
25565           lodash.uniqueId = uniqueId;
25566           lodash.upperCase = upperCase;
25567           lodash.upperFirst = upperFirst;
25568           lodash.each = forEach;
25569           lodash.eachRight = forEachRight;
25570           lodash.first = head;
25571           mixin(lodash, function() {
25572             var source = {};
25573             baseForOwn(lodash, function(func, methodName) {
25574               if (!hasOwnProperty13.call(lodash.prototype, methodName)) {
25575                 source[methodName] = func;
25576               }
25577             });
25578             return source;
25579           }(), { "chain": false });
25580           lodash.VERSION = VERSION;
25581           arrayEach(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) {
25582             lodash[methodName].placeholder = lodash;
25583           });
25584           arrayEach(["drop", "take"], function(methodName, index) {
25585             LazyWrapper.prototype[methodName] = function(n3) {
25586               n3 = n3 === undefined2 ? 1 : nativeMax3(toInteger(n3), 0);
25587               var result2 = this.__filtered__ && !index ? new LazyWrapper(this) : this.clone();
25588               if (result2.__filtered__) {
25589                 result2.__takeCount__ = nativeMin2(n3, result2.__takeCount__);
25590               } else {
25591                 result2.__views__.push({
25592                   "size": nativeMin2(n3, MAX_ARRAY_LENGTH),
25593                   "type": methodName + (result2.__dir__ < 0 ? "Right" : "")
25594                 });
25595               }
25596               return result2;
25597             };
25598             LazyWrapper.prototype[methodName + "Right"] = function(n3) {
25599               return this.reverse()[methodName](n3).reverse();
25600             };
25601           });
25602           arrayEach(["filter", "map", "takeWhile"], function(methodName, index) {
25603             var type2 = index + 1, isFilter = type2 == LAZY_FILTER_FLAG || type2 == LAZY_WHILE_FLAG;
25604             LazyWrapper.prototype[methodName] = function(iteratee2) {
25605               var result2 = this.clone();
25606               result2.__iteratees__.push({
25607                 "iteratee": getIteratee(iteratee2, 3),
25608                 "type": type2
25609               });
25610               result2.__filtered__ = result2.__filtered__ || isFilter;
25611               return result2;
25612             };
25613           });
25614           arrayEach(["head", "last"], function(methodName, index) {
25615             var takeName = "take" + (index ? "Right" : "");
25616             LazyWrapper.prototype[methodName] = function() {
25617               return this[takeName](1).value()[0];
25618             };
25619           });
25620           arrayEach(["initial", "tail"], function(methodName, index) {
25621             var dropName = "drop" + (index ? "" : "Right");
25622             LazyWrapper.prototype[methodName] = function() {
25623               return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
25624             };
25625           });
25626           LazyWrapper.prototype.compact = function() {
25627             return this.filter(identity5);
25628           };
25629           LazyWrapper.prototype.find = function(predicate) {
25630             return this.filter(predicate).head();
25631           };
25632           LazyWrapper.prototype.findLast = function(predicate) {
25633             return this.reverse().find(predicate);
25634           };
25635           LazyWrapper.prototype.invokeMap = baseRest2(function(path, args) {
25636             if (typeof path == "function") {
25637               return new LazyWrapper(this);
25638             }
25639             return this.map(function(value) {
25640               return baseInvoke(value, path, args);
25641             });
25642           });
25643           LazyWrapper.prototype.reject = function(predicate) {
25644             return this.filter(negate(getIteratee(predicate)));
25645           };
25646           LazyWrapper.prototype.slice = function(start2, end) {
25647             start2 = toInteger(start2);
25648             var result2 = this;
25649             if (result2.__filtered__ && (start2 > 0 || end < 0)) {
25650               return new LazyWrapper(result2);
25651             }
25652             if (start2 < 0) {
25653               result2 = result2.takeRight(-start2);
25654             } else if (start2) {
25655               result2 = result2.drop(start2);
25656             }
25657             if (end !== undefined2) {
25658               end = toInteger(end);
25659               result2 = end < 0 ? result2.dropRight(-end) : result2.take(end - start2);
25660             }
25661             return result2;
25662           };
25663           LazyWrapper.prototype.takeRightWhile = function(predicate) {
25664             return this.reverse().takeWhile(predicate).reverse();
25665           };
25666           LazyWrapper.prototype.toArray = function() {
25667             return this.take(MAX_ARRAY_LENGTH);
25668           };
25669           baseForOwn(LazyWrapper.prototype, function(func, methodName) {
25670             var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName), isTaker = /^(?:head|last)$/.test(methodName), lodashFunc = lodash[isTaker ? "take" + (methodName == "last" ? "Right" : "") : methodName], retUnwrapped = isTaker || /^find/.test(methodName);
25671             if (!lodashFunc) {
25672               return;
25673             }
25674             lodash.prototype[methodName] = function() {
25675               var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee2 = args[0], useLazy = isLazy || isArray2(value);
25676               var interceptor = function(value2) {
25677                 var result3 = lodashFunc.apply(lodash, arrayPush2([value2], args));
25678                 return isTaker && chainAll ? result3[0] : result3;
25679               };
25680               if (useLazy && checkIteratee && typeof iteratee2 == "function" && iteratee2.length != 1) {
25681                 isLazy = useLazy = false;
25682               }
25683               var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid;
25684               if (!retUnwrapped && useLazy) {
25685                 value = onlyLazy ? value : new LazyWrapper(this);
25686                 var result2 = func.apply(value, args);
25687                 result2.__actions__.push({ "func": thru, "args": [interceptor], "thisArg": undefined2 });
25688                 return new LodashWrapper(result2, chainAll);
25689               }
25690               if (isUnwrapped && onlyLazy) {
25691                 return func.apply(this, args);
25692               }
25693               result2 = this.thru(interceptor);
25694               return isUnwrapped ? isTaker ? result2.value()[0] : result2.value() : result2;
25695             };
25696           });
25697           arrayEach(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) {
25698             var func = arrayProto2[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName);
25699             lodash.prototype[methodName] = function() {
25700               var args = arguments;
25701               if (retUnwrapped && !this.__chain__) {
25702                 var value = this.value();
25703                 return func.apply(isArray2(value) ? value : [], args);
25704               }
25705               return this[chainName](function(value2) {
25706                 return func.apply(isArray2(value2) ? value2 : [], args);
25707               });
25708             };
25709           });
25710           baseForOwn(LazyWrapper.prototype, function(func, methodName) {
25711             var lodashFunc = lodash[methodName];
25712             if (lodashFunc) {
25713               var key = lodashFunc.name + "";
25714               if (!hasOwnProperty13.call(realNames, key)) {
25715                 realNames[key] = [];
25716               }
25717               realNames[key].push({ "name": methodName, "func": lodashFunc });
25718             }
25719           });
25720           realNames[createHybrid(undefined2, WRAP_BIND_KEY_FLAG).name] = [{
25721             "name": "wrapper",
25722             "func": undefined2
25723           }];
25724           LazyWrapper.prototype.clone = lazyClone;
25725           LazyWrapper.prototype.reverse = lazyReverse;
25726           LazyWrapper.prototype.value = lazyValue;
25727           lodash.prototype.at = wrapperAt;
25728           lodash.prototype.chain = wrapperChain;
25729           lodash.prototype.commit = wrapperCommit;
25730           lodash.prototype.next = wrapperNext;
25731           lodash.prototype.plant = wrapperPlant;
25732           lodash.prototype.reverse = wrapperReverse;
25733           lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
25734           lodash.prototype.first = lodash.prototype.head;
25735           if (symIterator) {
25736             lodash.prototype[symIterator] = wrapperToIterator;
25737           }
25738           return lodash;
25739         };
25740         var _2 = runInContext();
25741         if (typeof define == "function" && typeof define.amd == "object" && define.amd) {
25742           root3._ = _2;
25743           define(function() {
25744             return _2;
25745           });
25746         } else if (freeModule4) {
25747           (freeModule4.exports = _2)._ = _2;
25748           freeExports4._ = _2;
25749         } else {
25750           root3._ = _2;
25751         }
25752       }).call(exports2);
25753     }
25754   });
25755
25756   // modules/actions/merge_remote_changes.js
25757   var merge_remote_changes_exports = {};
25758   __export(merge_remote_changes_exports, {
25759     actionMergeRemoteChanges: () => actionMergeRemoteChanges
25760   });
25761   function actionMergeRemoteChanges(id2, localGraph, remoteGraph, discardTags, formatUser) {
25762     discardTags = discardTags || {};
25763     var _option = "safe";
25764     var _conflicts = [];
25765     function user(d2) {
25766       return typeof formatUser === "function" ? formatUser(d2) : (0, import_lodash.escape)(d2);
25767     }
25768     function mergeLocation(remote, target) {
25769       function pointEqual(a2, b2) {
25770         var epsilon3 = 1e-6;
25771         return Math.abs(a2[0] - b2[0]) < epsilon3 && Math.abs(a2[1] - b2[1]) < epsilon3;
25772       }
25773       if (_option === "force_local" || pointEqual(target.loc, remote.loc)) {
25774         return target;
25775       }
25776       if (_option === "force_remote") {
25777         return target.update({ loc: remote.loc });
25778       }
25779       _conflicts.push(_t.html("merge_remote_changes.conflict.location", { user: { html: user(remote.user) } }));
25780       return target;
25781     }
25782     function mergeNodes(base, remote, target) {
25783       if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.nodes, remote.nodes)) {
25784         return target;
25785       }
25786       if (_option === "force_remote") {
25787         return target.update({ nodes: remote.nodes });
25788       }
25789       var ccount = _conflicts.length;
25790       var o2 = base.nodes || [];
25791       var a2 = target.nodes || [];
25792       var b2 = remote.nodes || [];
25793       var nodes = [];
25794       var hunks = diff3Merge(a2, o2, b2, { excludeFalseConflicts: true });
25795       for (var i3 = 0; i3 < hunks.length; i3++) {
25796         var hunk = hunks[i3];
25797         if (hunk.ok) {
25798           nodes.push.apply(nodes, hunk.ok);
25799         } else {
25800           var c2 = hunk.conflict;
25801           if ((0, import_fast_deep_equal.default)(c2.o, c2.a)) {
25802             nodes.push.apply(nodes, c2.b);
25803           } else if ((0, import_fast_deep_equal.default)(c2.o, c2.b)) {
25804             nodes.push.apply(nodes, c2.a);
25805           } else {
25806             _conflicts.push(_t.html("merge_remote_changes.conflict.nodelist", { user: { html: user(remote.user) } }));
25807             break;
25808           }
25809         }
25810       }
25811       return _conflicts.length === ccount ? target.update({ nodes }) : target;
25812     }
25813     function mergeChildren(targetWay, children2, updates, graph) {
25814       function isUsed(node2, targetWay2) {
25815         var hasInterestingParent = graph.parentWays(node2).some(function(way) {
25816           return way.id !== targetWay2.id;
25817         });
25818         return node2.hasInterestingTags() || hasInterestingParent || graph.parentRelations(node2).length > 0;
25819       }
25820       var ccount = _conflicts.length;
25821       for (var i3 = 0; i3 < children2.length; i3++) {
25822         var id3 = children2[i3];
25823         var node = graph.hasEntity(id3);
25824         if (targetWay.nodes.indexOf(id3) === -1) {
25825           if (node && !isUsed(node, targetWay)) {
25826             updates.removeIds.push(id3);
25827           }
25828           continue;
25829         }
25830         var local = localGraph.hasEntity(id3);
25831         var remote = remoteGraph.hasEntity(id3);
25832         var target;
25833         if (_option === "force_remote" && remote && remote.visible) {
25834           updates.replacements.push(remote);
25835         } else if (_option === "force_local" && local) {
25836           target = osmEntity(local);
25837           if (remote) {
25838             target = target.update({ version: remote.version });
25839           }
25840           updates.replacements.push(target);
25841         } else if (_option === "safe" && local && remote && local.version !== remote.version) {
25842           target = osmEntity(local, { version: remote.version });
25843           if (remote.visible) {
25844             target = mergeLocation(remote, target);
25845           } else {
25846             _conflicts.push(_t.html("merge_remote_changes.conflict.deleted", { user: { html: user(remote.user) } }));
25847           }
25848           if (_conflicts.length !== ccount) break;
25849           updates.replacements.push(target);
25850         }
25851       }
25852       return targetWay;
25853     }
25854     function updateChildren(updates, graph) {
25855       for (var i3 = 0; i3 < updates.replacements.length; i3++) {
25856         graph = graph.replace(updates.replacements[i3]);
25857       }
25858       if (updates.removeIds.length) {
25859         graph = actionDeleteMultiple(updates.removeIds)(graph);
25860       }
25861       return graph;
25862     }
25863     function mergeMembers(remote, target) {
25864       if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.members, remote.members)) {
25865         return target;
25866       }
25867       if (_option === "force_remote") {
25868         return target.update({ members: remote.members });
25869       }
25870       _conflicts.push(_t.html("merge_remote_changes.conflict.memberlist", { user: { html: user(remote.user) } }));
25871       return target;
25872     }
25873     function mergeTags(base, remote, target) {
25874       if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.tags, remote.tags)) {
25875         return target;
25876       }
25877       if (_option === "force_remote") {
25878         return target.update({ tags: remote.tags });
25879       }
25880       var ccount = _conflicts.length;
25881       var o2 = base.tags || {};
25882       var a2 = target.tags || {};
25883       var b2 = remote.tags || {};
25884       var keys2 = utilArrayUnion(utilArrayUnion(Object.keys(o2), Object.keys(a2)), Object.keys(b2)).filter(function(k3) {
25885         return !discardTags[k3];
25886       });
25887       var tags = Object.assign({}, a2);
25888       var changed = false;
25889       for (var i3 = 0; i3 < keys2.length; i3++) {
25890         var k2 = keys2[i3];
25891         if (o2[k2] !== b2[k2] && a2[k2] !== b2[k2]) {
25892           if (o2[k2] !== a2[k2]) {
25893             _conflicts.push(_t.html(
25894               "merge_remote_changes.conflict.tags",
25895               { tag: k2, local: a2[k2], remote: b2[k2], user: { html: user(remote.user) } }
25896             ));
25897           } else {
25898             if (b2.hasOwnProperty(k2)) {
25899               tags[k2] = b2[k2];
25900             } else {
25901               delete tags[k2];
25902             }
25903             changed = true;
25904           }
25905         }
25906       }
25907       return changed && _conflicts.length === ccount ? target.update({ tags }) : target;
25908     }
25909     var action = function(graph) {
25910       var updates = { replacements: [], removeIds: [] };
25911       var base = graph.base().entities[id2];
25912       var local = localGraph.entity(id2);
25913       var remote = remoteGraph.entity(id2);
25914       var target = osmEntity(local, { version: remote.version });
25915       if (!remote.visible) {
25916         if (_option === "force_remote") {
25917           return actionDeleteMultiple([id2])(graph);
25918         } else if (_option === "force_local") {
25919           if (target.type === "way") {
25920             target = mergeChildren(target, utilArrayUniq(local.nodes), updates, graph);
25921             graph = updateChildren(updates, graph);
25922           }
25923           return graph.replace(target);
25924         } else {
25925           _conflicts.push(_t.html("merge_remote_changes.conflict.deleted", { user: { html: user(remote.user) } }));
25926           return graph;
25927         }
25928       }
25929       if (target.type === "node") {
25930         target = mergeLocation(remote, target);
25931       } else if (target.type === "way") {
25932         graph.rebase(remoteGraph.childNodes(remote), [graph], false);
25933         target = mergeNodes(base, remote, target);
25934         target = mergeChildren(target, utilArrayUnion(local.nodes, remote.nodes), updates, graph);
25935       } else if (target.type === "relation") {
25936         target = mergeMembers(remote, target);
25937       }
25938       target = mergeTags(base, remote, target);
25939       if (!_conflicts.length) {
25940         graph = updateChildren(updates, graph).replace(target);
25941       }
25942       return graph;
25943     };
25944     action.withOption = function(opt) {
25945       _option = opt;
25946       return action;
25947     };
25948     action.conflicts = function() {
25949       return _conflicts;
25950     };
25951     return action;
25952   }
25953   var import_fast_deep_equal, import_lodash;
25954   var init_merge_remote_changes = __esm({
25955     "modules/actions/merge_remote_changes.js"() {
25956       "use strict";
25957       import_fast_deep_equal = __toESM(require_fast_deep_equal());
25958       init_node_diff3();
25959       import_lodash = __toESM(require_lodash());
25960       init_localizer();
25961       init_delete_multiple();
25962       init_osm();
25963       init_util();
25964     }
25965   });
25966
25967   // modules/actions/move.js
25968   var move_exports = {};
25969   __export(move_exports, {
25970     actionMove: () => actionMove
25971   });
25972   function actionMove(moveIDs, tryDelta, projection2, cache) {
25973     var _delta = tryDelta;
25974     function setupCache(graph) {
25975       function canMove(nodeID) {
25976         if (moveIDs.indexOf(nodeID) !== -1) return true;
25977         var parents = graph.parentWays(graph.entity(nodeID));
25978         if (parents.length < 3) return true;
25979         var parentsMoving = parents.every(function(way) {
25980           return cache.moving[way.id];
25981         });
25982         if (!parentsMoving) delete cache.moving[nodeID];
25983         return parentsMoving;
25984       }
25985       function cacheEntities(ids) {
25986         for (var i3 = 0; i3 < ids.length; i3++) {
25987           var id2 = ids[i3];
25988           if (cache.moving[id2]) continue;
25989           cache.moving[id2] = true;
25990           var entity = graph.hasEntity(id2);
25991           if (!entity) continue;
25992           if (entity.type === "node") {
25993             cache.nodes.push(id2);
25994             cache.startLoc[id2] = entity.loc;
25995           } else if (entity.type === "way") {
25996             cache.ways.push(id2);
25997             cacheEntities(entity.nodes);
25998           } else {
25999             cacheEntities(entity.members.map(function(member) {
26000               return member.id;
26001             }));
26002           }
26003         }
26004       }
26005       function cacheIntersections(ids) {
26006         function isEndpoint(way2, id3) {
26007           return !way2.isClosed() && !!way2.affix(id3);
26008         }
26009         for (var i3 = 0; i3 < ids.length; i3++) {
26010           var id2 = ids[i3];
26011           var childNodes = graph.childNodes(graph.entity(id2));
26012           for (var j2 = 0; j2 < childNodes.length; j2++) {
26013             var node = childNodes[j2];
26014             var parents = graph.parentWays(node);
26015             if (parents.length !== 2) continue;
26016             var moved = graph.entity(id2);
26017             var unmoved = null;
26018             for (var k2 = 0; k2 < parents.length; k2++) {
26019               var way = parents[k2];
26020               if (!cache.moving[way.id]) {
26021                 unmoved = way;
26022                 break;
26023               }
26024             }
26025             if (!unmoved) continue;
26026             if (utilArrayIntersection(moved.nodes, unmoved.nodes).length > 2) continue;
26027             if (moved.isArea() || unmoved.isArea()) continue;
26028             cache.intersections.push({
26029               nodeId: node.id,
26030               movedId: moved.id,
26031               unmovedId: unmoved.id,
26032               movedIsEP: isEndpoint(moved, node.id),
26033               unmovedIsEP: isEndpoint(unmoved, node.id)
26034             });
26035           }
26036         }
26037       }
26038       if (!cache) {
26039         cache = {};
26040       }
26041       if (!cache.ok) {
26042         cache.moving = {};
26043         cache.intersections = [];
26044         cache.replacedVertex = {};
26045         cache.startLoc = {};
26046         cache.nodes = [];
26047         cache.ways = [];
26048         cacheEntities(moveIDs);
26049         cacheIntersections(cache.ways);
26050         cache.nodes = cache.nodes.filter(canMove);
26051         cache.ok = true;
26052       }
26053     }
26054     function replaceMovedVertex(nodeId, wayId, graph, delta) {
26055       var way = graph.entity(wayId);
26056       var moved = graph.entity(nodeId);
26057       var movedIndex = way.nodes.indexOf(nodeId);
26058       var len, prevIndex, nextIndex;
26059       if (way.isClosed()) {
26060         len = way.nodes.length - 1;
26061         prevIndex = (movedIndex + len - 1) % len;
26062         nextIndex = (movedIndex + len + 1) % len;
26063       } else {
26064         len = way.nodes.length;
26065         prevIndex = movedIndex - 1;
26066         nextIndex = movedIndex + 1;
26067       }
26068       var prev = graph.hasEntity(way.nodes[prevIndex]);
26069       var next = graph.hasEntity(way.nodes[nextIndex]);
26070       if (!prev || !next) return graph;
26071       var key = wayId + "_" + nodeId;
26072       var orig = cache.replacedVertex[key];
26073       if (!orig) {
26074         orig = osmNode();
26075         cache.replacedVertex[key] = orig;
26076         cache.startLoc[orig.id] = cache.startLoc[nodeId];
26077       }
26078       var start2, end;
26079       if (delta) {
26080         start2 = projection2(cache.startLoc[nodeId]);
26081         end = projection2.invert(geoVecAdd(start2, delta));
26082       } else {
26083         end = cache.startLoc[nodeId];
26084       }
26085       orig = orig.move(end);
26086       var angle2 = Math.abs(geoAngle(orig, prev, projection2) - geoAngle(orig, next, projection2)) * 180 / Math.PI;
26087       if (angle2 > 175 && angle2 < 185) return graph;
26088       var p1 = [prev.loc, orig.loc, moved.loc, next.loc].map(projection2);
26089       var p2 = [prev.loc, moved.loc, orig.loc, next.loc].map(projection2);
26090       var d1 = geoPathLength(p1);
26091       var d2 = geoPathLength(p2);
26092       var insertAt = d1 <= d2 ? movedIndex : nextIndex;
26093       if (way.isClosed() && insertAt === 0) insertAt = len;
26094       way = way.addNode(orig.id, insertAt);
26095       return graph.replace(orig).replace(way);
26096     }
26097     function removeDuplicateVertices(wayId, graph) {
26098       var way = graph.entity(wayId);
26099       var epsilon3 = 1e-6;
26100       var prev, curr;
26101       function isInteresting(node, graph2) {
26102         return graph2.parentWays(node).length > 1 || graph2.parentRelations(node).length || node.hasInterestingTags();
26103       }
26104       for (var i3 = 0; i3 < way.nodes.length; i3++) {
26105         curr = graph.entity(way.nodes[i3]);
26106         if (prev && curr && geoVecEqual(prev.loc, curr.loc, epsilon3)) {
26107           if (!isInteresting(prev, graph)) {
26108             way = way.removeNode(prev.id);
26109             graph = graph.replace(way).remove(prev);
26110           } else if (!isInteresting(curr, graph)) {
26111             way = way.removeNode(curr.id);
26112             graph = graph.replace(way).remove(curr);
26113           }
26114         }
26115         prev = curr;
26116       }
26117       return graph;
26118     }
26119     function unZorroIntersection(intersection2, graph) {
26120       var vertex = graph.entity(intersection2.nodeId);
26121       var way1 = graph.entity(intersection2.movedId);
26122       var way2 = graph.entity(intersection2.unmovedId);
26123       var isEP1 = intersection2.movedIsEP;
26124       var isEP2 = intersection2.unmovedIsEP;
26125       if (isEP1 && isEP2) return graph;
26126       var nodes1 = graph.childNodes(way1).filter(function(n3) {
26127         return n3 !== vertex;
26128       });
26129       var nodes2 = graph.childNodes(way2).filter(function(n3) {
26130         return n3 !== vertex;
26131       });
26132       if (way1.isClosed() && way1.first() === vertex.id) nodes1.push(nodes1[0]);
26133       if (way2.isClosed() && way2.first() === vertex.id) nodes2.push(nodes2[0]);
26134       var edge1 = !isEP1 && geoChooseEdge(nodes1, projection2(vertex.loc), projection2);
26135       var edge2 = !isEP2 && geoChooseEdge(nodes2, projection2(vertex.loc), projection2);
26136       var loc;
26137       if (!isEP1 && !isEP2) {
26138         var epsilon3 = 1e-6, maxIter = 10;
26139         for (var i3 = 0; i3 < maxIter; i3++) {
26140           loc = geoVecInterp(edge1.loc, edge2.loc, 0.5);
26141           edge1 = geoChooseEdge(nodes1, projection2(loc), projection2);
26142           edge2 = geoChooseEdge(nodes2, projection2(loc), projection2);
26143           if (Math.abs(edge1.distance - edge2.distance) < epsilon3) break;
26144         }
26145       } else if (!isEP1) {
26146         loc = edge1.loc;
26147       } else {
26148         loc = edge2.loc;
26149       }
26150       graph = graph.replace(vertex.move(loc));
26151       if (!isEP1 && edge1.index !== way1.nodes.indexOf(vertex.id)) {
26152         way1 = way1.removeNode(vertex.id).addNode(vertex.id, edge1.index);
26153         graph = graph.replace(way1);
26154       }
26155       if (!isEP2 && edge2.index !== way2.nodes.indexOf(vertex.id)) {
26156         way2 = way2.removeNode(vertex.id).addNode(vertex.id, edge2.index);
26157         graph = graph.replace(way2);
26158       }
26159       return graph;
26160     }
26161     function cleanupIntersections(graph) {
26162       for (var i3 = 0; i3 < cache.intersections.length; i3++) {
26163         var obj = cache.intersections[i3];
26164         graph = replaceMovedVertex(obj.nodeId, obj.movedId, graph, _delta);
26165         graph = replaceMovedVertex(obj.nodeId, obj.unmovedId, graph, null);
26166         graph = unZorroIntersection(obj, graph);
26167         graph = removeDuplicateVertices(obj.movedId, graph);
26168         graph = removeDuplicateVertices(obj.unmovedId, graph);
26169       }
26170       return graph;
26171     }
26172     function limitDelta(graph) {
26173       function moveNode(loc) {
26174         return geoVecAdd(projection2(loc), _delta);
26175       }
26176       for (var i3 = 0; i3 < cache.intersections.length; i3++) {
26177         var obj = cache.intersections[i3];
26178         if (obj.movedIsEP && obj.unmovedIsEP) continue;
26179         if (!obj.movedIsEP) continue;
26180         var node = graph.entity(obj.nodeId);
26181         var start2 = projection2(node.loc);
26182         var end = geoVecAdd(start2, _delta);
26183         var movedNodes = graph.childNodes(graph.entity(obj.movedId));
26184         var movedPath = movedNodes.map(function(n3) {
26185           return moveNode(n3.loc);
26186         });
26187         var unmovedNodes = graph.childNodes(graph.entity(obj.unmovedId));
26188         var unmovedPath = unmovedNodes.map(function(n3) {
26189           return projection2(n3.loc);
26190         });
26191         var hits = geoPathIntersections(movedPath, unmovedPath);
26192         for (var j2 = 0; i3 < hits.length; i3++) {
26193           if (geoVecEqual(hits[j2], end)) continue;
26194           var edge = geoChooseEdge(unmovedNodes, end, projection2);
26195           _delta = geoVecSubtract(projection2(edge.loc), start2);
26196         }
26197       }
26198     }
26199     var action = function(graph) {
26200       if (_delta[0] === 0 && _delta[1] === 0) return graph;
26201       setupCache(graph);
26202       if (cache.intersections.length) {
26203         limitDelta(graph);
26204       }
26205       for (var i3 = 0; i3 < cache.nodes.length; i3++) {
26206         var node = graph.entity(cache.nodes[i3]);
26207         var start2 = projection2(node.loc);
26208         var end = geoVecAdd(start2, _delta);
26209         graph = graph.replace(node.move(projection2.invert(end)));
26210       }
26211       if (cache.intersections.length) {
26212         graph = cleanupIntersections(graph);
26213       }
26214       return graph;
26215     };
26216     action.delta = function() {
26217       return _delta;
26218     };
26219     return action;
26220   }
26221   var init_move = __esm({
26222     "modules/actions/move.js"() {
26223       "use strict";
26224       init_geo2();
26225       init_node2();
26226       init_util();
26227     }
26228   });
26229
26230   // modules/actions/move_member.js
26231   var move_member_exports = {};
26232   __export(move_member_exports, {
26233     actionMoveMember: () => actionMoveMember
26234   });
26235   function actionMoveMember(relationId, fromIndex, toIndex) {
26236     return function(graph) {
26237       return graph.replace(graph.entity(relationId).moveMember(fromIndex, toIndex));
26238     };
26239   }
26240   var init_move_member = __esm({
26241     "modules/actions/move_member.js"() {
26242       "use strict";
26243     }
26244   });
26245
26246   // modules/actions/move_node.js
26247   var move_node_exports = {};
26248   __export(move_node_exports, {
26249     actionMoveNode: () => actionMoveNode
26250   });
26251   function actionMoveNode(nodeID, toLoc) {
26252     var action = function(graph, t2) {
26253       if (t2 === null || !isFinite(t2)) t2 = 1;
26254       t2 = Math.min(Math.max(+t2, 0), 1);
26255       var node = graph.entity(nodeID);
26256       return graph.replace(
26257         node.move(geoVecInterp(node.loc, toLoc, t2))
26258       );
26259     };
26260     action.transitionable = true;
26261     return action;
26262   }
26263   var init_move_node = __esm({
26264     "modules/actions/move_node.js"() {
26265       "use strict";
26266       init_geo2();
26267     }
26268   });
26269
26270   // modules/actions/noop.js
26271   var noop_exports = {};
26272   __export(noop_exports, {
26273     actionNoop: () => actionNoop
26274   });
26275   function actionNoop() {
26276     return function(graph) {
26277       return graph;
26278     };
26279   }
26280   var init_noop2 = __esm({
26281     "modules/actions/noop.js"() {
26282       "use strict";
26283     }
26284   });
26285
26286   // modules/actions/orthogonalize.js
26287   var orthogonalize_exports = {};
26288   __export(orthogonalize_exports, {
26289     actionOrthogonalize: () => actionOrthogonalize
26290   });
26291   function actionOrthogonalize(wayID, projection2, vertexID, degThresh, ep) {
26292     var epsilon3 = ep || 1e-4;
26293     var threshold = degThresh || 13;
26294     var lowerThreshold = Math.cos((90 - threshold) * Math.PI / 180);
26295     var upperThreshold = Math.cos(threshold * Math.PI / 180);
26296     var action = function(graph, t2) {
26297       if (t2 === null || !isFinite(t2)) t2 = 1;
26298       t2 = Math.min(Math.max(+t2, 0), 1);
26299       var way = graph.entity(wayID);
26300       way = way.removeNode("");
26301       if (way.tags.nonsquare) {
26302         var tags = Object.assign({}, way.tags);
26303         delete tags.nonsquare;
26304         way = way.update({ tags });
26305       }
26306       graph = graph.replace(way);
26307       var isClosed = way.isClosed();
26308       var nodes = graph.childNodes(way).slice();
26309       if (isClosed) nodes.pop();
26310       if (vertexID !== void 0) {
26311         nodes = nodeSubset(nodes, vertexID, isClosed);
26312         if (nodes.length !== 3) return graph;
26313       }
26314       var nodeCount = {};
26315       var points = [];
26316       var corner = { i: 0, dotp: 1 };
26317       var node, point, loc, score, motions, i3, j2;
26318       for (i3 = 0; i3 < nodes.length; i3++) {
26319         node = nodes[i3];
26320         nodeCount[node.id] = (nodeCount[node.id] || 0) + 1;
26321         points.push({ id: node.id, coord: projection2(node.loc) });
26322       }
26323       if (points.length === 3) {
26324         for (i3 = 0; i3 < 1e3; i3++) {
26325           const motion = calcMotion(points[1], 1, points);
26326           points[corner.i].coord = geoVecAdd(points[corner.i].coord, motion);
26327           score = corner.dotp;
26328           if (score < epsilon3) {
26329             break;
26330           }
26331         }
26332         node = graph.entity(nodes[corner.i].id);
26333         loc = projection2.invert(points[corner.i].coord);
26334         graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t2)));
26335       } else {
26336         var straights = [];
26337         var simplified = [];
26338         for (i3 = 0; i3 < points.length; i3++) {
26339           point = points[i3];
26340           var dotp = 0;
26341           if (isClosed || i3 > 0 && i3 < points.length - 1) {
26342             var a2 = points[(i3 - 1 + points.length) % points.length];
26343             var b2 = points[(i3 + 1) % points.length];
26344             dotp = Math.abs(geoOrthoNormalizedDotProduct(a2.coord, b2.coord, point.coord));
26345           }
26346           if (dotp > upperThreshold) {
26347             straights.push(point);
26348           } else {
26349             simplified.push(point);
26350           }
26351         }
26352         var bestPoints = clonePoints(simplified);
26353         var originalPoints = clonePoints(simplified);
26354         score = Infinity;
26355         for (i3 = 0; i3 < 1e3; i3++) {
26356           motions = simplified.map(calcMotion);
26357           for (j2 = 0; j2 < motions.length; j2++) {
26358             simplified[j2].coord = geoVecAdd(simplified[j2].coord, motions[j2]);
26359           }
26360           var newScore = geoOrthoCalcScore(simplified, isClosed, epsilon3, threshold);
26361           if (newScore < score) {
26362             bestPoints = clonePoints(simplified);
26363             score = newScore;
26364           }
26365           if (score < epsilon3) {
26366             break;
26367           }
26368         }
26369         var bestCoords = bestPoints.map(function(p2) {
26370           return p2.coord;
26371         });
26372         if (isClosed) bestCoords.push(bestCoords[0]);
26373         for (i3 = 0; i3 < bestPoints.length; i3++) {
26374           point = bestPoints[i3];
26375           if (!geoVecEqual(originalPoints[i3].coord, point.coord)) {
26376             node = graph.entity(point.id);
26377             loc = projection2.invert(point.coord);
26378             graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t2)));
26379           }
26380         }
26381         for (i3 = 0; i3 < straights.length; i3++) {
26382           point = straights[i3];
26383           if (nodeCount[point.id] > 1) continue;
26384           node = graph.entity(point.id);
26385           if (t2 === 1 && graph.parentWays(node).length === 1 && graph.parentRelations(node).length === 0 && !node.hasInterestingTags()) {
26386             graph = actionDeleteNode(node.id)(graph);
26387           } else {
26388             var choice = geoVecProject(point.coord, bestCoords);
26389             if (choice) {
26390               loc = projection2.invert(choice.target);
26391               graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t2)));
26392             }
26393           }
26394         }
26395       }
26396       return graph;
26397       function clonePoints(array2) {
26398         return array2.map(function(p2) {
26399           return { id: p2.id, coord: [p2.coord[0], p2.coord[1]] };
26400         });
26401       }
26402       function calcMotion(point2, i4, array2) {
26403         if (!isClosed && (i4 === 0 || i4 === array2.length - 1)) return [0, 0];
26404         if (nodeCount[array2[i4].id] > 1) return [0, 0];
26405         var a3 = array2[(i4 - 1 + array2.length) % array2.length].coord;
26406         var origin = point2.coord;
26407         var b3 = array2[(i4 + 1) % array2.length].coord;
26408         var p2 = geoVecSubtract(a3, origin);
26409         var q2 = geoVecSubtract(b3, origin);
26410         var scale = 2 * Math.min(geoVecLength(p2), geoVecLength(q2));
26411         p2 = geoVecNormalize(p2);
26412         q2 = geoVecNormalize(q2);
26413         var dotp2 = p2[0] * q2[0] + p2[1] * q2[1];
26414         var val = Math.abs(dotp2);
26415         if (val < lowerThreshold) {
26416           corner.i = i4;
26417           corner.dotp = val;
26418           var vec = geoVecNormalize(geoVecAdd(p2, q2));
26419           return geoVecScale(vec, 0.1 * dotp2 * scale);
26420         }
26421         return [0, 0];
26422       }
26423     };
26424     function nodeSubset(nodes, vertexID2, isClosed) {
26425       var first = isClosed ? 0 : 1;
26426       var last = isClosed ? nodes.length : nodes.length - 1;
26427       for (var i3 = first; i3 < last; i3++) {
26428         if (nodes[i3].id === vertexID2) {
26429           return [
26430             nodes[(i3 - 1 + nodes.length) % nodes.length],
26431             nodes[i3],
26432             nodes[(i3 + 1) % nodes.length]
26433           ];
26434         }
26435       }
26436       return [];
26437     }
26438     action.disabled = function(graph) {
26439       var way = graph.entity(wayID);
26440       way = way.removeNode("");
26441       graph = graph.replace(way);
26442       const isClosed = way.isClosed() && vertexID === void 0;
26443       var nodes = graph.childNodes(way).slice();
26444       if (isClosed) nodes.pop();
26445       var allowStraightAngles = false;
26446       if (vertexID !== void 0) {
26447         allowStraightAngles = true;
26448         nodes = nodeSubset(nodes, vertexID, isClosed);
26449         if (nodes.length !== 3) return "end_vertex";
26450       }
26451       var coords = nodes.map(function(n3) {
26452         return projection2(n3.loc);
26453       });
26454       var score = geoOrthoCanOrthogonalize(coords, isClosed, epsilon3, threshold, allowStraightAngles);
26455       if (score === null) {
26456         return "not_squarish";
26457       } else if (score === 0) {
26458         return "square_enough";
26459       } else {
26460         return false;
26461       }
26462     };
26463     action.transitionable = true;
26464     return action;
26465   }
26466   var init_orthogonalize = __esm({
26467     "modules/actions/orthogonalize.js"() {
26468       "use strict";
26469       init_delete_node();
26470       init_geo2();
26471     }
26472   });
26473
26474   // modules/actions/reflect.js
26475   var reflect_exports = {};
26476   __export(reflect_exports, {
26477     actionReflect: () => actionReflect
26478   });
26479   function actionReflect(reflectIds, projection2) {
26480     var _useLongAxis = true;
26481     var action = function(graph, t2) {
26482       if (t2 === null || !isFinite(t2)) t2 = 1;
26483       t2 = Math.min(Math.max(+t2, 0), 1);
26484       var nodes = utilGetAllNodes(reflectIds, graph);
26485       var points = nodes.map(function(n3) {
26486         return projection2(n3.loc);
26487       });
26488       var ssr = geoGetSmallestSurroundingRectangle(points);
26489       var p1 = [(ssr.poly[0][0] + ssr.poly[1][0]) / 2, (ssr.poly[0][1] + ssr.poly[1][1]) / 2];
26490       var q1 = [(ssr.poly[2][0] + ssr.poly[3][0]) / 2, (ssr.poly[2][1] + ssr.poly[3][1]) / 2];
26491       var p2 = [(ssr.poly[3][0] + ssr.poly[4][0]) / 2, (ssr.poly[3][1] + ssr.poly[4][1]) / 2];
26492       var q2 = [(ssr.poly[1][0] + ssr.poly[2][0]) / 2, (ssr.poly[1][1] + ssr.poly[2][1]) / 2];
26493       var p3, q3;
26494       var isLong = geoVecLength(p1, q1) > geoVecLength(p2, q2);
26495       if (_useLongAxis && isLong || !_useLongAxis && !isLong) {
26496         p3 = p1;
26497         q3 = q1;
26498       } else {
26499         p3 = p2;
26500         q3 = q2;
26501       }
26502       var dx = q3[0] - p3[0];
26503       var dy = q3[1] - p3[1];
26504       var a2 = (dx * dx - dy * dy) / (dx * dx + dy * dy);
26505       var b2 = 2 * dx * dy / (dx * dx + dy * dy);
26506       for (var i3 = 0; i3 < nodes.length; i3++) {
26507         var node = nodes[i3];
26508         var c2 = projection2(node.loc);
26509         var c22 = [
26510           a2 * (c2[0] - p3[0]) + b2 * (c2[1] - p3[1]) + p3[0],
26511           b2 * (c2[0] - p3[0]) - a2 * (c2[1] - p3[1]) + p3[1]
26512         ];
26513         var loc2 = projection2.invert(c22);
26514         node = node.move(geoVecInterp(node.loc, loc2, t2));
26515         graph = graph.replace(node);
26516       }
26517       return graph;
26518     };
26519     action.useLongAxis = function(val) {
26520       if (!arguments.length) return _useLongAxis;
26521       _useLongAxis = val;
26522       return action;
26523     };
26524     action.transitionable = true;
26525     return action;
26526   }
26527   var init_reflect = __esm({
26528     "modules/actions/reflect.js"() {
26529       "use strict";
26530       init_geo2();
26531       init_util();
26532     }
26533   });
26534
26535   // modules/actions/restrict_turn.js
26536   var restrict_turn_exports = {};
26537   __export(restrict_turn_exports, {
26538     actionRestrictTurn: () => actionRestrictTurn
26539   });
26540   function actionRestrictTurn(turn, restrictionType, restrictionID) {
26541     return function(graph) {
26542       var fromWay = graph.entity(turn.from.way);
26543       var toWay = graph.entity(turn.to.way);
26544       var viaNode = turn.via.node && graph.entity(turn.via.node);
26545       var viaWays = turn.via.ways && turn.via.ways.map(function(id2) {
26546         return graph.entity(id2);
26547       });
26548       var members = [];
26549       members.push({ id: fromWay.id, type: "way", role: "from" });
26550       if (viaNode) {
26551         members.push({ id: viaNode.id, type: "node", role: "via" });
26552       } else if (viaWays) {
26553         viaWays.forEach(function(viaWay) {
26554           members.push({ id: viaWay.id, type: "way", role: "via" });
26555         });
26556       }
26557       members.push({ id: toWay.id, type: "way", role: "to" });
26558       return graph.replace(osmRelation({
26559         id: restrictionID,
26560         tags: {
26561           type: "restriction",
26562           restriction: restrictionType
26563         },
26564         members
26565       }));
26566     };
26567   }
26568   var init_restrict_turn = __esm({
26569     "modules/actions/restrict_turn.js"() {
26570       "use strict";
26571       init_relation();
26572     }
26573   });
26574
26575   // modules/actions/revert.js
26576   var revert_exports = {};
26577   __export(revert_exports, {
26578     actionRevert: () => actionRevert
26579   });
26580   function actionRevert(id2) {
26581     var action = function(graph) {
26582       var entity = graph.hasEntity(id2), base = graph.base().entities[id2];
26583       if (entity && !base) {
26584         if (entity.type === "node") {
26585           graph.parentWays(entity).forEach(function(parent) {
26586             parent = parent.removeNode(id2);
26587             graph = graph.replace(parent);
26588             if (parent.isDegenerate()) {
26589               graph = actionDeleteWay(parent.id)(graph);
26590             }
26591           });
26592         }
26593         graph.parentRelations(entity).forEach(function(parent) {
26594           parent = parent.removeMembersWithID(id2);
26595           graph = graph.replace(parent);
26596           if (parent.isDegenerate()) {
26597             graph = actionDeleteRelation(parent.id)(graph);
26598           }
26599         });
26600       }
26601       return graph.revert(id2);
26602     };
26603     return action;
26604   }
26605   var init_revert = __esm({
26606     "modules/actions/revert.js"() {
26607       "use strict";
26608       init_delete_relation();
26609       init_delete_way();
26610     }
26611   });
26612
26613   // modules/actions/rotate.js
26614   var rotate_exports = {};
26615   __export(rotate_exports, {
26616     actionRotate: () => actionRotate
26617   });
26618   function actionRotate(rotateIds, pivot, angle2, projection2) {
26619     var action = function(graph) {
26620       return graph.update(function(graph2) {
26621         utilGetAllNodes(rotateIds, graph2).forEach(function(node) {
26622           var point = geoRotate([projection2(node.loc)], angle2, pivot)[0];
26623           graph2 = graph2.replace(node.move(projection2.invert(point)));
26624         });
26625       });
26626     };
26627     return action;
26628   }
26629   var init_rotate = __esm({
26630     "modules/actions/rotate.js"() {
26631       "use strict";
26632       init_geo2();
26633       init_util();
26634     }
26635   });
26636
26637   // modules/actions/scale.js
26638   var scale_exports = {};
26639   __export(scale_exports, {
26640     actionScale: () => actionScale
26641   });
26642   function actionScale(ids, pivotLoc, scaleFactor, projection2) {
26643     return function(graph) {
26644       return graph.update(function(graph2) {
26645         let point, radial;
26646         utilGetAllNodes(ids, graph2).forEach(function(node) {
26647           point = projection2(node.loc);
26648           radial = [
26649             point[0] - pivotLoc[0],
26650             point[1] - pivotLoc[1]
26651           ];
26652           point = [
26653             pivotLoc[0] + scaleFactor * radial[0],
26654             pivotLoc[1] + scaleFactor * radial[1]
26655           ];
26656           graph2 = graph2.replace(node.move(projection2.invert(point)));
26657         });
26658       });
26659     };
26660   }
26661   var init_scale = __esm({
26662     "modules/actions/scale.js"() {
26663       "use strict";
26664       init_util();
26665     }
26666   });
26667
26668   // modules/actions/straighten_nodes.js
26669   var straighten_nodes_exports = {};
26670   __export(straighten_nodes_exports, {
26671     actionStraightenNodes: () => actionStraightenNodes
26672   });
26673   function actionStraightenNodes(nodeIDs, projection2) {
26674     function positionAlongWay(a2, o2, b2) {
26675       return geoVecDot(a2, b2, o2) / geoVecDot(b2, b2, o2);
26676     }
26677     function getEndpoints(points) {
26678       var ssr = geoGetSmallestSurroundingRectangle(points);
26679       var p1 = [(ssr.poly[0][0] + ssr.poly[1][0]) / 2, (ssr.poly[0][1] + ssr.poly[1][1]) / 2];
26680       var q1 = [(ssr.poly[2][0] + ssr.poly[3][0]) / 2, (ssr.poly[2][1] + ssr.poly[3][1]) / 2];
26681       var p2 = [(ssr.poly[3][0] + ssr.poly[4][0]) / 2, (ssr.poly[3][1] + ssr.poly[4][1]) / 2];
26682       var q2 = [(ssr.poly[1][0] + ssr.poly[2][0]) / 2, (ssr.poly[1][1] + ssr.poly[2][1]) / 2];
26683       var isLong = geoVecLength(p1, q1) > geoVecLength(p2, q2);
26684       if (isLong) {
26685         return [p1, q1];
26686       }
26687       return [p2, q2];
26688     }
26689     var action = function(graph, t2) {
26690       if (t2 === null || !isFinite(t2)) t2 = 1;
26691       t2 = Math.min(Math.max(+t2, 0), 1);
26692       var nodes = nodeIDs.map(function(id2) {
26693         return graph.entity(id2);
26694       });
26695       var points = nodes.map(function(n3) {
26696         return projection2(n3.loc);
26697       });
26698       var endpoints = getEndpoints(points);
26699       var startPoint = endpoints[0];
26700       var endPoint = endpoints[1];
26701       for (var i3 = 0; i3 < points.length; i3++) {
26702         var node = nodes[i3];
26703         var point = points[i3];
26704         var u2 = positionAlongWay(point, startPoint, endPoint);
26705         var point2 = geoVecInterp(startPoint, endPoint, u2);
26706         var loc2 = projection2.invert(point2);
26707         graph = graph.replace(node.move(geoVecInterp(node.loc, loc2, t2)));
26708       }
26709       return graph;
26710     };
26711     action.disabled = function(graph) {
26712       var nodes = nodeIDs.map(function(id2) {
26713         return graph.entity(id2);
26714       });
26715       var points = nodes.map(function(n3) {
26716         return projection2(n3.loc);
26717       });
26718       var endpoints = getEndpoints(points);
26719       var startPoint = endpoints[0];
26720       var endPoint = endpoints[1];
26721       var maxDistance = 0;
26722       for (var i3 = 0; i3 < points.length; i3++) {
26723         var point = points[i3];
26724         var u2 = positionAlongWay(point, startPoint, endPoint);
26725         var p2 = geoVecInterp(startPoint, endPoint, u2);
26726         var dist = geoVecLength(p2, point);
26727         if (!isNaN(dist) && dist > maxDistance) {
26728           maxDistance = dist;
26729         }
26730       }
26731       if (maxDistance < 1e-4) {
26732         return "straight_enough";
26733       }
26734     };
26735     action.transitionable = true;
26736     return action;
26737   }
26738   var init_straighten_nodes = __esm({
26739     "modules/actions/straighten_nodes.js"() {
26740       "use strict";
26741       init_geo2();
26742     }
26743   });
26744
26745   // modules/actions/straighten_way.js
26746   var straighten_way_exports = {};
26747   __export(straighten_way_exports, {
26748     actionStraightenWay: () => actionStraightenWay
26749   });
26750   function actionStraightenWay(selectedIDs, projection2) {
26751     function positionAlongWay(a2, o2, b2) {
26752       return geoVecDot(a2, b2, o2) / geoVecDot(b2, b2, o2);
26753     }
26754     function allNodes(graph) {
26755       var nodes = [];
26756       var startNodes = [];
26757       var endNodes = [];
26758       var remainingWays = [];
26759       var selectedWays = selectedIDs.filter(function(w2) {
26760         return graph.entity(w2).type === "way";
26761       });
26762       var selectedNodes = selectedIDs.filter(function(n3) {
26763         return graph.entity(n3).type === "node";
26764       });
26765       for (var i3 = 0; i3 < selectedWays.length; i3++) {
26766         var way = graph.entity(selectedWays[i3]);
26767         nodes = way.nodes.slice(0);
26768         remainingWays.push(nodes);
26769         startNodes.push(nodes[0]);
26770         endNodes.push(nodes[nodes.length - 1]);
26771       }
26772       startNodes = startNodes.filter(function(n3) {
26773         return startNodes.indexOf(n3) === startNodes.lastIndexOf(n3);
26774       });
26775       endNodes = endNodes.filter(function(n3) {
26776         return endNodes.indexOf(n3) === endNodes.lastIndexOf(n3);
26777       });
26778       var currNode = utilArrayDifference(startNodes, endNodes).concat(utilArrayDifference(endNodes, startNodes))[0];
26779       var nextWay = [];
26780       nodes = [];
26781       var getNextWay = function(currNode2, remainingWays2) {
26782         return remainingWays2.filter(function(way2) {
26783           return way2[0] === currNode2 || way2[way2.length - 1] === currNode2;
26784         })[0];
26785       };
26786       while (remainingWays.length) {
26787         nextWay = getNextWay(currNode, remainingWays);
26788         remainingWays = utilArrayDifference(remainingWays, [nextWay]);
26789         if (nextWay[0] !== currNode) {
26790           nextWay.reverse();
26791         }
26792         nodes = nodes.concat(nextWay);
26793         currNode = nodes[nodes.length - 1];
26794       }
26795       if (selectedNodes.length === 2) {
26796         var startNodeIdx = nodes.indexOf(selectedNodes[0]);
26797         var endNodeIdx = nodes.indexOf(selectedNodes[1]);
26798         var sortedStartEnd = [startNodeIdx, endNodeIdx];
26799         sortedStartEnd.sort(function(a2, b2) {
26800           return a2 - b2;
26801         });
26802         nodes = nodes.slice(sortedStartEnd[0], sortedStartEnd[1] + 1);
26803       }
26804       return nodes.map(function(n3) {
26805         return graph.entity(n3);
26806       });
26807     }
26808     function shouldKeepNode(node, graph) {
26809       return graph.parentWays(node).length > 1 || graph.parentRelations(node).length || node.hasInterestingTags();
26810     }
26811     var action = function(graph, t2) {
26812       if (t2 === null || !isFinite(t2)) t2 = 1;
26813       t2 = Math.min(Math.max(+t2, 0), 1);
26814       var nodes = allNodes(graph);
26815       var points = nodes.map(function(n3) {
26816         return projection2(n3.loc);
26817       });
26818       var startPoint = points[0];
26819       var endPoint = points[points.length - 1];
26820       var toDelete = [];
26821       var i3;
26822       for (i3 = 1; i3 < points.length - 1; i3++) {
26823         var node = nodes[i3];
26824         var point = points[i3];
26825         if (t2 < 1 || shouldKeepNode(node, graph)) {
26826           var u2 = positionAlongWay(point, startPoint, endPoint);
26827           var p2 = geoVecInterp(startPoint, endPoint, u2);
26828           var loc2 = projection2.invert(p2);
26829           graph = graph.replace(node.move(geoVecInterp(node.loc, loc2, t2)));
26830         } else {
26831           if (toDelete.indexOf(node) === -1) {
26832             toDelete.push(node);
26833           }
26834         }
26835       }
26836       for (i3 = 0; i3 < toDelete.length; i3++) {
26837         graph = actionDeleteNode(toDelete[i3].id)(graph);
26838       }
26839       return graph;
26840     };
26841     action.disabled = function(graph) {
26842       var nodes = allNodes(graph);
26843       var points = nodes.map(function(n3) {
26844         return projection2(n3.loc);
26845       });
26846       var startPoint = points[0];
26847       var endPoint = points[points.length - 1];
26848       var threshold = 0.2 * geoVecLength(startPoint, endPoint);
26849       var i3;
26850       if (threshold === 0) {
26851         return "too_bendy";
26852       }
26853       var maxDistance = 0;
26854       for (i3 = 1; i3 < points.length - 1; i3++) {
26855         var point = points[i3];
26856         var u2 = positionAlongWay(point, startPoint, endPoint);
26857         var p2 = geoVecInterp(startPoint, endPoint, u2);
26858         var dist = geoVecLength(p2, point);
26859         if (isNaN(dist) || dist > threshold) {
26860           return "too_bendy";
26861         } else if (dist > maxDistance) {
26862           maxDistance = dist;
26863         }
26864       }
26865       var keepingAllNodes = nodes.every(function(node, i4) {
26866         return i4 === 0 || i4 === nodes.length - 1 || shouldKeepNode(node, graph);
26867       });
26868       if (maxDistance < 1e-4 && // Allow straightening even if already straight in order to remove extraneous nodes
26869       keepingAllNodes) {
26870         return "straight_enough";
26871       }
26872     };
26873     action.transitionable = true;
26874     return action;
26875   }
26876   var init_straighten_way = __esm({
26877     "modules/actions/straighten_way.js"() {
26878       "use strict";
26879       init_delete_node();
26880       init_geo2();
26881       init_util();
26882     }
26883   });
26884
26885   // modules/actions/unrestrict_turn.js
26886   var unrestrict_turn_exports = {};
26887   __export(unrestrict_turn_exports, {
26888     actionUnrestrictTurn: () => actionUnrestrictTurn
26889   });
26890   function actionUnrestrictTurn(turn) {
26891     return function(graph) {
26892       return actionDeleteRelation(turn.restrictionID)(graph);
26893     };
26894   }
26895   var init_unrestrict_turn = __esm({
26896     "modules/actions/unrestrict_turn.js"() {
26897       "use strict";
26898       init_delete_relation();
26899     }
26900   });
26901
26902   // modules/actions/upgrade_tags.js
26903   var upgrade_tags_exports = {};
26904   __export(upgrade_tags_exports, {
26905     actionUpgradeTags: () => actionUpgradeTags
26906   });
26907   function actionUpgradeTags(entityId, oldTags, replaceTags) {
26908     return function(graph) {
26909       var entity = graph.entity(entityId);
26910       var tags = Object.assign({}, entity.tags);
26911       var transferValue;
26912       var semiIndex;
26913       for (var oldTagKey in oldTags) {
26914         if (!(oldTagKey in tags)) continue;
26915         if (oldTags[oldTagKey] === "*") {
26916           transferValue = tags[oldTagKey];
26917           delete tags[oldTagKey];
26918         } else if (oldTags[oldTagKey] === tags[oldTagKey]) {
26919           delete tags[oldTagKey];
26920         } else {
26921           var vals = tags[oldTagKey].split(";").filter(Boolean);
26922           var oldIndex = vals.indexOf(oldTags[oldTagKey]);
26923           if (vals.length === 1 || oldIndex === -1) {
26924             delete tags[oldTagKey];
26925           } else {
26926             if (replaceTags && replaceTags[oldTagKey]) {
26927               semiIndex = oldIndex;
26928             }
26929             vals.splice(oldIndex, 1);
26930             tags[oldTagKey] = vals.join(";");
26931           }
26932         }
26933       }
26934       if (replaceTags) {
26935         for (var replaceKey in replaceTags) {
26936           var replaceValue = replaceTags[replaceKey];
26937           if (replaceValue === "*") {
26938             if (tags[replaceKey] && tags[replaceKey] !== "no") {
26939               continue;
26940             } else {
26941               tags[replaceKey] = "yes";
26942             }
26943           } else if (replaceValue === "$1") {
26944             tags[replaceKey] = transferValue;
26945           } else {
26946             if (tags[replaceKey] && oldTags[replaceKey] && semiIndex !== void 0) {
26947               var existingVals = tags[replaceKey].split(";").filter(Boolean);
26948               if (existingVals.indexOf(replaceValue) === -1) {
26949                 existingVals.splice(semiIndex, 0, replaceValue);
26950                 tags[replaceKey] = existingVals.join(";");
26951               }
26952             } else {
26953               tags[replaceKey] = replaceValue;
26954             }
26955           }
26956         }
26957       }
26958       return graph.replace(entity.update({ tags }));
26959     };
26960   }
26961   var init_upgrade_tags = __esm({
26962     "modules/actions/upgrade_tags.js"() {
26963       "use strict";
26964     }
26965   });
26966
26967   // modules/core/preferences.js
26968   var preferences_exports = {};
26969   __export(preferences_exports, {
26970     prefs: () => corePreferences
26971   });
26972   function corePreferences(k2, v2) {
26973     try {
26974       if (v2 === void 0) return _storage.getItem(k2);
26975       else if (v2 === null) _storage.removeItem(k2);
26976       else _storage.setItem(k2, v2);
26977       if (_listeners[k2]) {
26978         _listeners[k2].forEach((handler) => handler(v2));
26979       }
26980       return true;
26981     } catch {
26982       if (typeof console !== "undefined") {
26983         console.error("localStorage quota exceeded");
26984       }
26985       return false;
26986     }
26987   }
26988   var _storage, _listeners;
26989   var init_preferences = __esm({
26990     "modules/core/preferences.js"() {
26991       "use strict";
26992       try {
26993         _storage = localStorage;
26994       } catch {
26995       }
26996       _storage = _storage || /* @__PURE__ */ (() => {
26997         let s2 = {};
26998         return {
26999           getItem: (k2) => s2[k2],
27000           setItem: (k2, v2) => s2[k2] = v2,
27001           removeItem: (k2) => delete s2[k2]
27002         };
27003       })();
27004       _listeners = {};
27005       corePreferences.onChange = function(k2, handler) {
27006         _listeners[k2] = _listeners[k2] || [];
27007         _listeners[k2].push(handler);
27008       };
27009     }
27010   });
27011
27012   // node_modules/which-polygon/node_modules/quickselect/quickselect.js
27013   var require_quickselect = __commonJS({
27014     "node_modules/which-polygon/node_modules/quickselect/quickselect.js"(exports2, module2) {
27015       (function(global2, factory) {
27016         typeof exports2 === "object" && typeof module2 !== "undefined" ? module2.exports = factory() : typeof define === "function" && define.amd ? define(factory) : global2.quickselect = factory();
27017       })(exports2, function() {
27018         "use strict";
27019         function quickselect3(arr, k2, left, right, compare2) {
27020           quickselectStep(arr, k2, left || 0, right || arr.length - 1, compare2 || defaultCompare2);
27021         }
27022         function quickselectStep(arr, k2, left, right, compare2) {
27023           while (right > left) {
27024             if (right - left > 600) {
27025               var n3 = right - left + 1;
27026               var m2 = k2 - left + 1;
27027               var z2 = Math.log(n3);
27028               var s2 = 0.5 * Math.exp(2 * z2 / 3);
27029               var sd = 0.5 * Math.sqrt(z2 * s2 * (n3 - s2) / n3) * (m2 - n3 / 2 < 0 ? -1 : 1);
27030               var newLeft = Math.max(left, Math.floor(k2 - m2 * s2 / n3 + sd));
27031               var newRight = Math.min(right, Math.floor(k2 + (n3 - m2) * s2 / n3 + sd));
27032               quickselectStep(arr, k2, newLeft, newRight, compare2);
27033             }
27034             var t2 = arr[k2];
27035             var i3 = left;
27036             var j2 = right;
27037             swap3(arr, left, k2);
27038             if (compare2(arr[right], t2) > 0) swap3(arr, left, right);
27039             while (i3 < j2) {
27040               swap3(arr, i3, j2);
27041               i3++;
27042               j2--;
27043               while (compare2(arr[i3], t2) < 0) i3++;
27044               while (compare2(arr[j2], t2) > 0) j2--;
27045             }
27046             if (compare2(arr[left], t2) === 0) swap3(arr, left, j2);
27047             else {
27048               j2++;
27049               swap3(arr, j2, right);
27050             }
27051             if (j2 <= k2) left = j2 + 1;
27052             if (k2 <= j2) right = j2 - 1;
27053           }
27054         }
27055         function swap3(arr, i3, j2) {
27056           var tmp = arr[i3];
27057           arr[i3] = arr[j2];
27058           arr[j2] = tmp;
27059         }
27060         function defaultCompare2(a2, b2) {
27061           return a2 < b2 ? -1 : a2 > b2 ? 1 : 0;
27062         }
27063         return quickselect3;
27064       });
27065     }
27066   });
27067
27068   // node_modules/which-polygon/node_modules/rbush/index.js
27069   var require_rbush = __commonJS({
27070     "node_modules/which-polygon/node_modules/rbush/index.js"(exports2, module2) {
27071       "use strict";
27072       module2.exports = rbush;
27073       module2.exports.default = rbush;
27074       var quickselect3 = require_quickselect();
27075       function rbush(maxEntries, format2) {
27076         if (!(this instanceof rbush)) return new rbush(maxEntries, format2);
27077         this._maxEntries = Math.max(4, maxEntries || 9);
27078         this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4));
27079         if (format2) {
27080           this._initFormat(format2);
27081         }
27082         this.clear();
27083       }
27084       rbush.prototype = {
27085         all: function() {
27086           return this._all(this.data, []);
27087         },
27088         search: function(bbox2) {
27089           var node = this.data, result = [], toBBox = this.toBBox;
27090           if (!intersects2(bbox2, node)) return result;
27091           var nodesToSearch = [], i3, len, child, childBBox;
27092           while (node) {
27093             for (i3 = 0, len = node.children.length; i3 < len; i3++) {
27094               child = node.children[i3];
27095               childBBox = node.leaf ? toBBox(child) : child;
27096               if (intersects2(bbox2, childBBox)) {
27097                 if (node.leaf) result.push(child);
27098                 else if (contains2(bbox2, childBBox)) this._all(child, result);
27099                 else nodesToSearch.push(child);
27100               }
27101             }
27102             node = nodesToSearch.pop();
27103           }
27104           return result;
27105         },
27106         collides: function(bbox2) {
27107           var node = this.data, toBBox = this.toBBox;
27108           if (!intersects2(bbox2, node)) return false;
27109           var nodesToSearch = [], i3, len, child, childBBox;
27110           while (node) {
27111             for (i3 = 0, len = node.children.length; i3 < len; i3++) {
27112               child = node.children[i3];
27113               childBBox = node.leaf ? toBBox(child) : child;
27114               if (intersects2(bbox2, childBBox)) {
27115                 if (node.leaf || contains2(bbox2, childBBox)) return true;
27116                 nodesToSearch.push(child);
27117               }
27118             }
27119             node = nodesToSearch.pop();
27120           }
27121           return false;
27122         },
27123         load: function(data) {
27124           if (!(data && data.length)) return this;
27125           if (data.length < this._minEntries) {
27126             for (var i3 = 0, len = data.length; i3 < len; i3++) {
27127               this.insert(data[i3]);
27128             }
27129             return this;
27130           }
27131           var node = this._build(data.slice(), 0, data.length - 1, 0);
27132           if (!this.data.children.length) {
27133             this.data = node;
27134           } else if (this.data.height === node.height) {
27135             this._splitRoot(this.data, node);
27136           } else {
27137             if (this.data.height < node.height) {
27138               var tmpNode = this.data;
27139               this.data = node;
27140               node = tmpNode;
27141             }
27142             this._insert(node, this.data.height - node.height - 1, true);
27143           }
27144           return this;
27145         },
27146         insert: function(item) {
27147           if (item) this._insert(item, this.data.height - 1);
27148           return this;
27149         },
27150         clear: function() {
27151           this.data = createNode2([]);
27152           return this;
27153         },
27154         remove: function(item, equalsFn) {
27155           if (!item) return this;
27156           var node = this.data, bbox2 = this.toBBox(item), path = [], indexes = [], i3, parent, index, goingUp;
27157           while (node || path.length) {
27158             if (!node) {
27159               node = path.pop();
27160               parent = path[path.length - 1];
27161               i3 = indexes.pop();
27162               goingUp = true;
27163             }
27164             if (node.leaf) {
27165               index = findItem2(item, node.children, equalsFn);
27166               if (index !== -1) {
27167                 node.children.splice(index, 1);
27168                 path.push(node);
27169                 this._condense(path);
27170                 return this;
27171               }
27172             }
27173             if (!goingUp && !node.leaf && contains2(node, bbox2)) {
27174               path.push(node);
27175               indexes.push(i3);
27176               i3 = 0;
27177               parent = node;
27178               node = node.children[0];
27179             } else if (parent) {
27180               i3++;
27181               node = parent.children[i3];
27182               goingUp = false;
27183             } else node = null;
27184           }
27185           return this;
27186         },
27187         toBBox: function(item) {
27188           return item;
27189         },
27190         compareMinX: compareNodeMinX2,
27191         compareMinY: compareNodeMinY2,
27192         toJSON: function() {
27193           return this.data;
27194         },
27195         fromJSON: function(data) {
27196           this.data = data;
27197           return this;
27198         },
27199         _all: function(node, result) {
27200           var nodesToSearch = [];
27201           while (node) {
27202             if (node.leaf) result.push.apply(result, node.children);
27203             else nodesToSearch.push.apply(nodesToSearch, node.children);
27204             node = nodesToSearch.pop();
27205           }
27206           return result;
27207         },
27208         _build: function(items, left, right, height) {
27209           var N2 = right - left + 1, M2 = this._maxEntries, node;
27210           if (N2 <= M2) {
27211             node = createNode2(items.slice(left, right + 1));
27212             calcBBox2(node, this.toBBox);
27213             return node;
27214           }
27215           if (!height) {
27216             height = Math.ceil(Math.log(N2) / Math.log(M2));
27217             M2 = Math.ceil(N2 / Math.pow(M2, height - 1));
27218           }
27219           node = createNode2([]);
27220           node.leaf = false;
27221           node.height = height;
27222           var N22 = Math.ceil(N2 / M2), N1 = N22 * Math.ceil(Math.sqrt(M2)), i3, j2, right2, right3;
27223           multiSelect2(items, left, right, N1, this.compareMinX);
27224           for (i3 = left; i3 <= right; i3 += N1) {
27225             right2 = Math.min(i3 + N1 - 1, right);
27226             multiSelect2(items, i3, right2, N22, this.compareMinY);
27227             for (j2 = i3; j2 <= right2; j2 += N22) {
27228               right3 = Math.min(j2 + N22 - 1, right2);
27229               node.children.push(this._build(items, j2, right3, height - 1));
27230             }
27231           }
27232           calcBBox2(node, this.toBBox);
27233           return node;
27234         },
27235         _chooseSubtree: function(bbox2, node, level, path) {
27236           var i3, len, child, targetNode, area, enlargement, minArea, minEnlargement;
27237           while (true) {
27238             path.push(node);
27239             if (node.leaf || path.length - 1 === level) break;
27240             minArea = minEnlargement = Infinity;
27241             for (i3 = 0, len = node.children.length; i3 < len; i3++) {
27242               child = node.children[i3];
27243               area = bboxArea2(child);
27244               enlargement = enlargedArea2(bbox2, child) - area;
27245               if (enlargement < minEnlargement) {
27246                 minEnlargement = enlargement;
27247                 minArea = area < minArea ? area : minArea;
27248                 targetNode = child;
27249               } else if (enlargement === minEnlargement) {
27250                 if (area < minArea) {
27251                   minArea = area;
27252                   targetNode = child;
27253                 }
27254               }
27255             }
27256             node = targetNode || node.children[0];
27257           }
27258           return node;
27259         },
27260         _insert: function(item, level, isNode) {
27261           var toBBox = this.toBBox, bbox2 = isNode ? item : toBBox(item), insertPath = [];
27262           var node = this._chooseSubtree(bbox2, this.data, level, insertPath);
27263           node.children.push(item);
27264           extend3(node, bbox2);
27265           while (level >= 0) {
27266             if (insertPath[level].children.length > this._maxEntries) {
27267               this._split(insertPath, level);
27268               level--;
27269             } else break;
27270           }
27271           this._adjustParentBBoxes(bbox2, insertPath, level);
27272         },
27273         // split overflowed node into two
27274         _split: function(insertPath, level) {
27275           var node = insertPath[level], M2 = node.children.length, m2 = this._minEntries;
27276           this._chooseSplitAxis(node, m2, M2);
27277           var splitIndex = this._chooseSplitIndex(node, m2, M2);
27278           var newNode = createNode2(node.children.splice(splitIndex, node.children.length - splitIndex));
27279           newNode.height = node.height;
27280           newNode.leaf = node.leaf;
27281           calcBBox2(node, this.toBBox);
27282           calcBBox2(newNode, this.toBBox);
27283           if (level) insertPath[level - 1].children.push(newNode);
27284           else this._splitRoot(node, newNode);
27285         },
27286         _splitRoot: function(node, newNode) {
27287           this.data = createNode2([node, newNode]);
27288           this.data.height = node.height + 1;
27289           this.data.leaf = false;
27290           calcBBox2(this.data, this.toBBox);
27291         },
27292         _chooseSplitIndex: function(node, m2, M2) {
27293           var i3, bbox1, bbox2, overlap, area, minOverlap, minArea, index;
27294           minOverlap = minArea = Infinity;
27295           for (i3 = m2; i3 <= M2 - m2; i3++) {
27296             bbox1 = distBBox2(node, 0, i3, this.toBBox);
27297             bbox2 = distBBox2(node, i3, M2, this.toBBox);
27298             overlap = intersectionArea2(bbox1, bbox2);
27299             area = bboxArea2(bbox1) + bboxArea2(bbox2);
27300             if (overlap < minOverlap) {
27301               minOverlap = overlap;
27302               index = i3;
27303               minArea = area < minArea ? area : minArea;
27304             } else if (overlap === minOverlap) {
27305               if (area < minArea) {
27306                 minArea = area;
27307                 index = i3;
27308               }
27309             }
27310           }
27311           return index;
27312         },
27313         // sorts node children by the best axis for split
27314         _chooseSplitAxis: function(node, m2, M2) {
27315           var compareMinX = node.leaf ? this.compareMinX : compareNodeMinX2, compareMinY = node.leaf ? this.compareMinY : compareNodeMinY2, xMargin = this._allDistMargin(node, m2, M2, compareMinX), yMargin = this._allDistMargin(node, m2, M2, compareMinY);
27316           if (xMargin < yMargin) node.children.sort(compareMinX);
27317         },
27318         // total margin of all possible split distributions where each node is at least m full
27319         _allDistMargin: function(node, m2, M2, compare2) {
27320           node.children.sort(compare2);
27321           var toBBox = this.toBBox, leftBBox = distBBox2(node, 0, m2, toBBox), rightBBox = distBBox2(node, M2 - m2, M2, toBBox), margin = bboxMargin2(leftBBox) + bboxMargin2(rightBBox), i3, child;
27322           for (i3 = m2; i3 < M2 - m2; i3++) {
27323             child = node.children[i3];
27324             extend3(leftBBox, node.leaf ? toBBox(child) : child);
27325             margin += bboxMargin2(leftBBox);
27326           }
27327           for (i3 = M2 - m2 - 1; i3 >= m2; i3--) {
27328             child = node.children[i3];
27329             extend3(rightBBox, node.leaf ? toBBox(child) : child);
27330             margin += bboxMargin2(rightBBox);
27331           }
27332           return margin;
27333         },
27334         _adjustParentBBoxes: function(bbox2, path, level) {
27335           for (var i3 = level; i3 >= 0; i3--) {
27336             extend3(path[i3], bbox2);
27337           }
27338         },
27339         _condense: function(path) {
27340           for (var i3 = path.length - 1, siblings; i3 >= 0; i3--) {
27341             if (path[i3].children.length === 0) {
27342               if (i3 > 0) {
27343                 siblings = path[i3 - 1].children;
27344                 siblings.splice(siblings.indexOf(path[i3]), 1);
27345               } else this.clear();
27346             } else calcBBox2(path[i3], this.toBBox);
27347           }
27348         },
27349         _initFormat: function(format2) {
27350           var compareArr = ["return a", " - b", ";"];
27351           this.compareMinX = new Function("a", "b", compareArr.join(format2[0]));
27352           this.compareMinY = new Function("a", "b", compareArr.join(format2[1]));
27353           this.toBBox = new Function(
27354             "a",
27355             "return {minX: a" + format2[0] + ", minY: a" + format2[1] + ", maxX: a" + format2[2] + ", maxY: a" + format2[3] + "};"
27356           );
27357         }
27358       };
27359       function findItem2(item, items, equalsFn) {
27360         if (!equalsFn) return items.indexOf(item);
27361         for (var i3 = 0; i3 < items.length; i3++) {
27362           if (equalsFn(item, items[i3])) return i3;
27363         }
27364         return -1;
27365       }
27366       function calcBBox2(node, toBBox) {
27367         distBBox2(node, 0, node.children.length, toBBox, node);
27368       }
27369       function distBBox2(node, k2, p2, toBBox, destNode) {
27370         if (!destNode) destNode = createNode2(null);
27371         destNode.minX = Infinity;
27372         destNode.minY = Infinity;
27373         destNode.maxX = -Infinity;
27374         destNode.maxY = -Infinity;
27375         for (var i3 = k2, child; i3 < p2; i3++) {
27376           child = node.children[i3];
27377           extend3(destNode, node.leaf ? toBBox(child) : child);
27378         }
27379         return destNode;
27380       }
27381       function extend3(a2, b2) {
27382         a2.minX = Math.min(a2.minX, b2.minX);
27383         a2.minY = Math.min(a2.minY, b2.minY);
27384         a2.maxX = Math.max(a2.maxX, b2.maxX);
27385         a2.maxY = Math.max(a2.maxY, b2.maxY);
27386         return a2;
27387       }
27388       function compareNodeMinX2(a2, b2) {
27389         return a2.minX - b2.minX;
27390       }
27391       function compareNodeMinY2(a2, b2) {
27392         return a2.minY - b2.minY;
27393       }
27394       function bboxArea2(a2) {
27395         return (a2.maxX - a2.minX) * (a2.maxY - a2.minY);
27396       }
27397       function bboxMargin2(a2) {
27398         return a2.maxX - a2.minX + (a2.maxY - a2.minY);
27399       }
27400       function enlargedArea2(a2, b2) {
27401         return (Math.max(b2.maxX, a2.maxX) - Math.min(b2.minX, a2.minX)) * (Math.max(b2.maxY, a2.maxY) - Math.min(b2.minY, a2.minY));
27402       }
27403       function intersectionArea2(a2, b2) {
27404         var minX = Math.max(a2.minX, b2.minX), minY = Math.max(a2.minY, b2.minY), maxX = Math.min(a2.maxX, b2.maxX), maxY = Math.min(a2.maxY, b2.maxY);
27405         return Math.max(0, maxX - minX) * Math.max(0, maxY - minY);
27406       }
27407       function contains2(a2, b2) {
27408         return a2.minX <= b2.minX && a2.minY <= b2.minY && b2.maxX <= a2.maxX && b2.maxY <= a2.maxY;
27409       }
27410       function intersects2(a2, b2) {
27411         return b2.minX <= a2.maxX && b2.minY <= a2.maxY && b2.maxX >= a2.minX && b2.maxY >= a2.minY;
27412       }
27413       function createNode2(children2) {
27414         return {
27415           children: children2,
27416           height: 1,
27417           leaf: true,
27418           minX: Infinity,
27419           minY: Infinity,
27420           maxX: -Infinity,
27421           maxY: -Infinity
27422         };
27423       }
27424       function multiSelect2(arr, left, right, n3, compare2) {
27425         var stack = [left, right], mid;
27426         while (stack.length) {
27427           right = stack.pop();
27428           left = stack.pop();
27429           if (right - left <= n3) continue;
27430           mid = left + Math.ceil((right - left) / n3 / 2) * n3;
27431           quickselect3(arr, mid, left, right, compare2);
27432           stack.push(left, mid, mid, right);
27433         }
27434       }
27435     }
27436   });
27437
27438   // node_modules/lineclip/index.js
27439   var require_lineclip = __commonJS({
27440     "node_modules/lineclip/index.js"(exports2, module2) {
27441       "use strict";
27442       module2.exports = lineclip2;
27443       lineclip2.polyline = lineclip2;
27444       lineclip2.polygon = polygonclip2;
27445       function lineclip2(points, bbox2, result) {
27446         var len = points.length, codeA = bitCode2(points[0], bbox2), part = [], i3, a2, b2, codeB, lastCode;
27447         if (!result) result = [];
27448         for (i3 = 1; i3 < len; i3++) {
27449           a2 = points[i3 - 1];
27450           b2 = points[i3];
27451           codeB = lastCode = bitCode2(b2, bbox2);
27452           while (true) {
27453             if (!(codeA | codeB)) {
27454               part.push(a2);
27455               if (codeB !== lastCode) {
27456                 part.push(b2);
27457                 if (i3 < len - 1) {
27458                   result.push(part);
27459                   part = [];
27460                 }
27461               } else if (i3 === len - 1) {
27462                 part.push(b2);
27463               }
27464               break;
27465             } else if (codeA & codeB) {
27466               break;
27467             } else if (codeA) {
27468               a2 = intersect2(a2, b2, codeA, bbox2);
27469               codeA = bitCode2(a2, bbox2);
27470             } else {
27471               b2 = intersect2(a2, b2, codeB, bbox2);
27472               codeB = bitCode2(b2, bbox2);
27473             }
27474           }
27475           codeA = lastCode;
27476         }
27477         if (part.length) result.push(part);
27478         return result;
27479       }
27480       function polygonclip2(points, bbox2) {
27481         var result, edge, prev, prevInside, i3, p2, inside;
27482         for (edge = 1; edge <= 8; edge *= 2) {
27483           result = [];
27484           prev = points[points.length - 1];
27485           prevInside = !(bitCode2(prev, bbox2) & edge);
27486           for (i3 = 0; i3 < points.length; i3++) {
27487             p2 = points[i3];
27488             inside = !(bitCode2(p2, bbox2) & edge);
27489             if (inside !== prevInside) result.push(intersect2(prev, p2, edge, bbox2));
27490             if (inside) result.push(p2);
27491             prev = p2;
27492             prevInside = inside;
27493           }
27494           points = result;
27495           if (!points.length) break;
27496         }
27497         return result;
27498       }
27499       function intersect2(a2, b2, edge, bbox2) {
27500         return edge & 8 ? [a2[0] + (b2[0] - a2[0]) * (bbox2[3] - a2[1]) / (b2[1] - a2[1]), bbox2[3]] : (
27501           // top
27502           edge & 4 ? [a2[0] + (b2[0] - a2[0]) * (bbox2[1] - a2[1]) / (b2[1] - a2[1]), bbox2[1]] : (
27503             // bottom
27504             edge & 2 ? [bbox2[2], a2[1] + (b2[1] - a2[1]) * (bbox2[2] - a2[0]) / (b2[0] - a2[0])] : (
27505               // right
27506               edge & 1 ? [bbox2[0], a2[1] + (b2[1] - a2[1]) * (bbox2[0] - a2[0]) / (b2[0] - a2[0])] : (
27507                 // left
27508                 null
27509               )
27510             )
27511           )
27512         );
27513       }
27514       function bitCode2(p2, bbox2) {
27515         var code = 0;
27516         if (p2[0] < bbox2[0]) code |= 1;
27517         else if (p2[0] > bbox2[2]) code |= 2;
27518         if (p2[1] < bbox2[1]) code |= 4;
27519         else if (p2[1] > bbox2[3]) code |= 8;
27520         return code;
27521       }
27522     }
27523   });
27524
27525   // node_modules/which-polygon/index.js
27526   var require_which_polygon = __commonJS({
27527     "node_modules/which-polygon/index.js"(exports2, module2) {
27528       "use strict";
27529       var rbush = require_rbush();
27530       var lineclip2 = require_lineclip();
27531       module2.exports = whichPolygon5;
27532       function whichPolygon5(data) {
27533         var bboxes = [];
27534         for (var i3 = 0; i3 < data.features.length; i3++) {
27535           var feature3 = data.features[i3];
27536           if (!feature3.geometry) continue;
27537           var coords = feature3.geometry.coordinates;
27538           if (feature3.geometry.type === "Polygon") {
27539             bboxes.push(treeItem(coords, feature3.properties));
27540           } else if (feature3.geometry.type === "MultiPolygon") {
27541             for (var j2 = 0; j2 < coords.length; j2++) {
27542               bboxes.push(treeItem(coords[j2], feature3.properties));
27543             }
27544           }
27545         }
27546         var tree = rbush().load(bboxes);
27547         function query(p2, multi) {
27548           var output = [], result = tree.search({
27549             minX: p2[0],
27550             minY: p2[1],
27551             maxX: p2[0],
27552             maxY: p2[1]
27553           });
27554           for (var i4 = 0; i4 < result.length; i4++) {
27555             if (insidePolygon(result[i4].coords, p2)) {
27556               if (multi)
27557                 output.push(result[i4].props);
27558               else
27559                 return result[i4].props;
27560             }
27561           }
27562           return multi && output.length ? output : null;
27563         }
27564         query.tree = tree;
27565         query.bbox = function queryBBox(bbox2) {
27566           var output = [];
27567           var result = tree.search({
27568             minX: bbox2[0],
27569             minY: bbox2[1],
27570             maxX: bbox2[2],
27571             maxY: bbox2[3]
27572           });
27573           for (var i4 = 0; i4 < result.length; i4++) {
27574             if (polygonIntersectsBBox(result[i4].coords, bbox2)) {
27575               output.push(result[i4].props);
27576             }
27577           }
27578           return output;
27579         };
27580         return query;
27581       }
27582       function polygonIntersectsBBox(polygon2, bbox2) {
27583         var bboxCenter = [
27584           (bbox2[0] + bbox2[2]) / 2,
27585           (bbox2[1] + bbox2[3]) / 2
27586         ];
27587         if (insidePolygon(polygon2, bboxCenter)) return true;
27588         for (var i3 = 0; i3 < polygon2.length; i3++) {
27589           if (lineclip2(polygon2[i3], bbox2).length > 0) return true;
27590         }
27591         return false;
27592       }
27593       function insidePolygon(rings, p2) {
27594         var inside = false;
27595         for (var i3 = 0, len = rings.length; i3 < len; i3++) {
27596           var ring = rings[i3];
27597           for (var j2 = 0, len2 = ring.length, k2 = len2 - 1; j2 < len2; k2 = j2++) {
27598             if (rayIntersect(p2, ring[j2], ring[k2])) inside = !inside;
27599           }
27600         }
27601         return inside;
27602       }
27603       function rayIntersect(p2, p1, p22) {
27604         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];
27605       }
27606       function treeItem(coords, props) {
27607         var item = {
27608           minX: Infinity,
27609           minY: Infinity,
27610           maxX: -Infinity,
27611           maxY: -Infinity,
27612           coords,
27613           props
27614         };
27615         for (var i3 = 0; i3 < coords[0].length; i3++) {
27616           var p2 = coords[0][i3];
27617           item.minX = Math.min(item.minX, p2[0]);
27618           item.minY = Math.min(item.minY, p2[1]);
27619           item.maxX = Math.max(item.maxX, p2[0]);
27620           item.maxY = Math.max(item.maxY, p2[1]);
27621         }
27622         return item;
27623       }
27624     }
27625   });
27626
27627   // node_modules/@rapideditor/country-coder/dist/country-coder.mjs
27628   function canonicalID(id2) {
27629     const s2 = id2 || "";
27630     if (s2.charAt(0) === ".") {
27631       return s2.toUpperCase();
27632     } else {
27633       return s2.replace(idFilterRegex, "").toUpperCase();
27634     }
27635   }
27636   function loadDerivedDataAndCaches(borders2) {
27637     const identifierProps = ["iso1A2", "iso1A3", "m49", "wikidata", "emojiFlag", "ccTLD", "nameEn"];
27638     let geometryFeatures = [];
27639     for (const feature22 of borders2.features) {
27640       const props = feature22.properties;
27641       props.id = props.iso1A2 || props.m49 || props.wikidata;
27642       loadM49(feature22);
27643       loadTLD(feature22);
27644       loadIsoStatus(feature22);
27645       loadLevel(feature22);
27646       loadGroups(feature22);
27647       loadFlag(feature22);
27648       cacheFeatureByIDs(feature22);
27649       if (feature22.geometry) {
27650         geometryFeatures.push(feature22);
27651       }
27652     }
27653     for (const feature22 of borders2.features) {
27654       feature22.properties.groups = feature22.properties.groups.map((groupID) => {
27655         return _featuresByCode[groupID].properties.id;
27656       });
27657       loadMembersForGroupsOf(feature22);
27658     }
27659     for (const feature22 of borders2.features) {
27660       loadRoadSpeedUnit(feature22);
27661       loadRoadHeightUnit(feature22);
27662       loadDriveSide(feature22);
27663       loadCallingCodes(feature22);
27664       loadGroupGroups(feature22);
27665     }
27666     for (const feature22 of borders2.features) {
27667       feature22.properties.groups.sort((groupID1, groupID2) => {
27668         return levels.indexOf(_featuresByCode[groupID1].properties.level) - levels.indexOf(_featuresByCode[groupID2].properties.level);
27669       });
27670       if (feature22.properties.members) {
27671         feature22.properties.members.sort((id1, id2) => {
27672           const diff = levels.indexOf(_featuresByCode[id1].properties.level) - levels.indexOf(_featuresByCode[id2].properties.level);
27673           if (diff === 0) {
27674             return borders2.features.indexOf(_featuresByCode[id1]) - borders2.features.indexOf(_featuresByCode[id2]);
27675           }
27676           return diff;
27677         });
27678       }
27679     }
27680     const geometryOnlyCollection = {
27681       type: "FeatureCollection",
27682       features: geometryFeatures
27683     };
27684     _whichPolygon = (0, import_which_polygon.default)(geometryOnlyCollection);
27685     function loadGroups(feature22) {
27686       const props = feature22.properties;
27687       if (!props.groups) {
27688         props.groups = [];
27689       }
27690       if (feature22.geometry && props.country) {
27691         props.groups.push(props.country);
27692       }
27693       if (props.m49 !== "001") {
27694         props.groups.push("001");
27695       }
27696     }
27697     function loadM49(feature22) {
27698       const props = feature22.properties;
27699       if (!props.m49 && props.iso1N3) {
27700         props.m49 = props.iso1N3;
27701       }
27702     }
27703     function loadTLD(feature22) {
27704       const props = feature22.properties;
27705       if (props.level === "unitedNations") return;
27706       if (props.ccTLD === null) return;
27707       if (!props.ccTLD && props.iso1A2) {
27708         props.ccTLD = "." + props.iso1A2.toLowerCase();
27709       }
27710     }
27711     function loadIsoStatus(feature22) {
27712       const props = feature22.properties;
27713       if (!props.isoStatus && props.iso1A2) {
27714         props.isoStatus = "official";
27715       }
27716     }
27717     function loadLevel(feature22) {
27718       const props = feature22.properties;
27719       if (props.level) return;
27720       if (!props.country) {
27721         props.level = "country";
27722       } else if (!props.iso1A2 || props.isoStatus === "official") {
27723         props.level = "territory";
27724       } else {
27725         props.level = "subterritory";
27726       }
27727     }
27728     function loadGroupGroups(feature22) {
27729       const props = feature22.properties;
27730       if (feature22.geometry || !props.members) return;
27731       const featureLevelIndex = levels.indexOf(props.level);
27732       let sharedGroups = [];
27733       props.members.forEach((memberID, index) => {
27734         const member = _featuresByCode[memberID];
27735         const memberGroups = member.properties.groups.filter((groupID) => {
27736           return groupID !== feature22.properties.id && featureLevelIndex < levels.indexOf(_featuresByCode[groupID].properties.level);
27737         });
27738         if (index === 0) {
27739           sharedGroups = memberGroups;
27740         } else {
27741           sharedGroups = sharedGroups.filter((groupID) => memberGroups.indexOf(groupID) !== -1);
27742         }
27743       });
27744       props.groups = props.groups.concat(
27745         sharedGroups.filter((groupID) => props.groups.indexOf(groupID) === -1)
27746       );
27747       for (const groupID of sharedGroups) {
27748         const groupFeature = _featuresByCode[groupID];
27749         if (groupFeature.properties.members.indexOf(props.id) === -1) {
27750           groupFeature.properties.members.push(props.id);
27751         }
27752       }
27753     }
27754     function loadRoadSpeedUnit(feature22) {
27755       const props = feature22.properties;
27756       if (feature22.geometry) {
27757         if (!props.roadSpeedUnit) props.roadSpeedUnit = "km/h";
27758       } else if (props.members) {
27759         const vals = Array.from(
27760           new Set(
27761             props.members.map((id2) => {
27762               const member = _featuresByCode[id2];
27763               if (member.geometry) return member.properties.roadSpeedUnit || "km/h";
27764             }).filter(Boolean)
27765           )
27766         );
27767         if (vals.length === 1) props.roadSpeedUnit = vals[0];
27768       }
27769     }
27770     function loadRoadHeightUnit(feature22) {
27771       const props = feature22.properties;
27772       if (feature22.geometry) {
27773         if (!props.roadHeightUnit) props.roadHeightUnit = "m";
27774       } else if (props.members) {
27775         const vals = Array.from(
27776           new Set(
27777             props.members.map((id2) => {
27778               const member = _featuresByCode[id2];
27779               if (member.geometry) return member.properties.roadHeightUnit || "m";
27780             }).filter(Boolean)
27781           )
27782         );
27783         if (vals.length === 1) props.roadHeightUnit = vals[0];
27784       }
27785     }
27786     function loadDriveSide(feature22) {
27787       const props = feature22.properties;
27788       if (feature22.geometry) {
27789         if (!props.driveSide) props.driveSide = "right";
27790       } else if (props.members) {
27791         const vals = Array.from(
27792           new Set(
27793             props.members.map((id2) => {
27794               const member = _featuresByCode[id2];
27795               if (member.geometry) return member.properties.driveSide || "right";
27796             }).filter(Boolean)
27797           )
27798         );
27799         if (vals.length === 1) props.driveSide = vals[0];
27800       }
27801     }
27802     function loadCallingCodes(feature22) {
27803       const props = feature22.properties;
27804       if (!feature22.geometry && props.members) {
27805         props.callingCodes = Array.from(
27806           new Set(
27807             props.members.reduce((array2, id2) => {
27808               const member = _featuresByCode[id2];
27809               if (member.geometry && member.properties.callingCodes) {
27810                 return array2.concat(member.properties.callingCodes);
27811               }
27812               return array2;
27813             }, [])
27814           )
27815         );
27816       }
27817     }
27818     function loadFlag(feature22) {
27819       if (!feature22.properties.iso1A2) return;
27820       const flag = feature22.properties.iso1A2.replace(/./g, function(char) {
27821         return String.fromCodePoint(char.charCodeAt(0) + 127397);
27822       });
27823       feature22.properties.emojiFlag = flag;
27824     }
27825     function loadMembersForGroupsOf(feature22) {
27826       for (const groupID of feature22.properties.groups) {
27827         const groupFeature = _featuresByCode[groupID];
27828         if (!groupFeature.properties.members) {
27829           groupFeature.properties.members = [];
27830         }
27831         groupFeature.properties.members.push(feature22.properties.id);
27832       }
27833     }
27834     function cacheFeatureByIDs(feature22) {
27835       let ids = [];
27836       for (const prop of identifierProps) {
27837         const id2 = feature22.properties[prop];
27838         if (id2) {
27839           ids.push(id2);
27840         }
27841       }
27842       for (const alias of feature22.properties.aliases || []) {
27843         ids.push(alias);
27844       }
27845       for (const id2 of ids) {
27846         const cid = canonicalID(id2);
27847         _featuresByCode[cid] = feature22;
27848       }
27849     }
27850   }
27851   function locArray(loc) {
27852     if (Array.isArray(loc)) {
27853       return loc;
27854     } else if (loc.coordinates) {
27855       return loc.coordinates;
27856     }
27857     return loc.geometry.coordinates;
27858   }
27859   function smallestFeature(loc) {
27860     const query = locArray(loc);
27861     const featureProperties = _whichPolygon(query);
27862     if (!featureProperties) return null;
27863     return _featuresByCode[featureProperties.id];
27864   }
27865   function countryFeature(loc) {
27866     const feature22 = smallestFeature(loc);
27867     if (!feature22) return null;
27868     const countryCode = feature22.properties.country || feature22.properties.iso1A2;
27869     return _featuresByCode[countryCode] || null;
27870   }
27871   function featureForLoc(loc, opts) {
27872     const targetLevel = opts.level || "country";
27873     const maxLevel = opts.maxLevel || "world";
27874     const withProp = opts.withProp;
27875     const targetLevelIndex = levels.indexOf(targetLevel);
27876     if (targetLevelIndex === -1) return null;
27877     const maxLevelIndex = levels.indexOf(maxLevel);
27878     if (maxLevelIndex === -1) return null;
27879     if (maxLevelIndex < targetLevelIndex) return null;
27880     if (targetLevel === "country") {
27881       const fastFeature = countryFeature(loc);
27882       if (fastFeature) {
27883         if (!withProp || fastFeature.properties[withProp]) {
27884           return fastFeature;
27885         }
27886       }
27887     }
27888     const features = featuresContaining(loc);
27889     const match = features.find((feature22) => {
27890       let levelIndex = levels.indexOf(feature22.properties.level);
27891       if (feature22.properties.level === targetLevel || // if no feature exists at the target level, return the first feature at the next level up
27892       levelIndex > targetLevelIndex && levelIndex <= maxLevelIndex) {
27893         if (!withProp || feature22.properties[withProp]) {
27894           return feature22;
27895         }
27896       }
27897       return false;
27898     });
27899     return match || null;
27900   }
27901   function featureForID(id2) {
27902     let stringID;
27903     if (typeof id2 === "number") {
27904       stringID = id2.toString();
27905       if (stringID.length === 1) {
27906         stringID = "00" + stringID;
27907       } else if (stringID.length === 2) {
27908         stringID = "0" + stringID;
27909       }
27910     } else {
27911       stringID = canonicalID(id2);
27912     }
27913     return _featuresByCode[stringID] || null;
27914   }
27915   function smallestFeaturesForBbox(bbox2) {
27916     return _whichPolygon.bbox(bbox2).map((props) => _featuresByCode[props.id]);
27917   }
27918   function smallestOrMatchingFeature(query) {
27919     if (typeof query === "object") {
27920       return smallestFeature(query);
27921     }
27922     return featureForID(query);
27923   }
27924   function feature(query, opts = defaultOpts) {
27925     if (typeof query === "object") {
27926       return featureForLoc(query, opts);
27927     }
27928     return featureForID(query);
27929   }
27930   function iso1A2Code(query, opts = defaultOpts) {
27931     opts.withProp = "iso1A2";
27932     const match = feature(query, opts);
27933     if (!match) return null;
27934     return match.properties.iso1A2 || null;
27935   }
27936   function propertiesForQuery(query, property) {
27937     const features = featuresContaining(query, false);
27938     return features.map((feature22) => feature22.properties[property]).filter(Boolean);
27939   }
27940   function iso1A2Codes(query) {
27941     return propertiesForQuery(query, "iso1A2");
27942   }
27943   function featuresContaining(query, strict) {
27944     let matchingFeatures;
27945     if (Array.isArray(query) && query.length === 4) {
27946       matchingFeatures = smallestFeaturesForBbox(query);
27947     } else {
27948       const smallestOrMatching = smallestOrMatchingFeature(query);
27949       matchingFeatures = smallestOrMatching ? [smallestOrMatching] : [];
27950     }
27951     if (!matchingFeatures.length) return [];
27952     let returnFeatures;
27953     if (!strict || typeof query === "object") {
27954       returnFeatures = matchingFeatures.slice();
27955     } else {
27956       returnFeatures = [];
27957     }
27958     for (const feature22 of matchingFeatures) {
27959       const properties = feature22.properties;
27960       for (const groupID of properties.groups) {
27961         const groupFeature = _featuresByCode[groupID];
27962         if (returnFeatures.indexOf(groupFeature) === -1) {
27963           returnFeatures.push(groupFeature);
27964         }
27965       }
27966     }
27967     return returnFeatures;
27968   }
27969   function featuresIn(id2, strict) {
27970     const feature22 = featureForID(id2);
27971     if (!feature22) return [];
27972     let features = [];
27973     if (!strict) {
27974       features.push(feature22);
27975     }
27976     const properties = feature22.properties;
27977     for (const memberID of properties.members || []) {
27978       features.push(_featuresByCode[memberID]);
27979     }
27980     return features;
27981   }
27982   function aggregateFeature(id2) {
27983     var _a3;
27984     const features = featuresIn(id2, false);
27985     if (features.length === 0) return null;
27986     let aggregateCoordinates = [];
27987     for (const feature22 of features) {
27988       if (((_a3 = feature22.geometry) == null ? void 0 : _a3.type) === "MultiPolygon" && feature22.geometry.coordinates) {
27989         aggregateCoordinates = aggregateCoordinates.concat(feature22.geometry.coordinates);
27990       }
27991     }
27992     return {
27993       type: "Feature",
27994       properties: features[0].properties,
27995       geometry: {
27996         type: "MultiPolygon",
27997         coordinates: aggregateCoordinates
27998       }
27999     };
28000   }
28001   function roadSpeedUnit(query) {
28002     const feature22 = smallestOrMatchingFeature(query);
28003     return feature22 && feature22.properties.roadSpeedUnit || null;
28004   }
28005   function roadHeightUnit(query) {
28006     const feature22 = smallestOrMatchingFeature(query);
28007     return feature22 && feature22.properties.roadHeightUnit || null;
28008   }
28009   var import_which_polygon, borders_default, borders, _whichPolygon, _featuresByCode, idFilterRegex, levels, defaultOpts;
28010   var init_country_coder = __esm({
28011     "node_modules/@rapideditor/country-coder/dist/country-coder.mjs"() {
28012       import_which_polygon = __toESM(require_which_polygon(), 1);
28013       borders_default = { type: "FeatureCollection", features: [
28014         { 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]]]] } },
28015         { 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]]]] } },
28016         { 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]]]] } },
28017         { 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]]]] } },
28018         { 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]]]] } },
28019         { 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]]]] } },
28020         { 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]]]] } },
28021         { 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]]]] } },
28022         { 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]]]] } },
28023         { 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]]]] } },
28024         { 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]]]] } },
28025         { 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]]]] } },
28026         { 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]]]] } },
28027         { 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]]]] } },
28028         { 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]]]] } },
28029         { 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]]]] } },
28030         { 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]]]] } },
28031         { 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]]]] } },
28032         { 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]]]] } },
28033         { type: "Feature", properties: { wikidata: "Q12837", nameEn: "Iberia", level: "sharedLandform" }, geometry: null },
28034         { 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]]]] } },
28035         { 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]]]] } },
28036         { type: "Feature", properties: { wikidata: "Q22890", nameEn: "Ireland", level: "sharedLandform" }, geometry: null },
28037         { type: "Feature", properties: { wikidata: "Q23666", nameEn: "Great Britain", country: "GB", level: "sharedLandform" }, geometry: null },
28038         { 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]]]] } },
28039         { 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]]]] } },
28040         { 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]]]] } },
28041         { 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]]]] } },
28042         { 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]]]] } },
28043         { 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]]]] } },
28044         { 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]]]] } },
28045         { 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]]]] } },
28046         { 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]]]] } },
28047         { 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]]]] } },
28048         { 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]]]] } },
28049         { 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]]]] } },
28050         { type: "Feature", properties: { wikidata: "Q35657", nameEn: "US States", country: "US", level: "subcountryGroup" }, geometry: null },
28051         { type: "Feature", properties: { wikidata: "Q36117", nameEn: "Borneo", level: "sharedLandform" }, geometry: null },
28052         { 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]]]] } },
28053         { type: "Feature", properties: { wikidata: "Q37362", nameEn: "Akrotiri and Dhekelia", aliases: ["SBA"], country: "GB" }, geometry: null },
28054         { 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]]]] } },
28055         { 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]]]] } },
28056         { 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]]]] } },
28057         { 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]]]] } },
28058         { 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]]]] } },
28059         { 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]]]] } },
28060         { type: "Feature", properties: { wikidata: "Q46395", nameEn: "British Overseas Territories", aliases: ["BOTS", "UKOTS"], country: "GB", level: "subcountryGroup" }, geometry: null },
28061         { 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]]]] } },
28062         { 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]]]] } },
28063         { 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]]]] } },
28064         { 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]]]] } },
28065         { type: "Feature", properties: { wikidata: "Q105472", nameEn: "Macaronesia", level: "sharedLandform" }, geometry: null },
28066         { 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]]]] } },
28067         { 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]]]] } },
28068         { 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]]]] } },
28069         { 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]]]] } },
28070         { 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]]]] } },
28071         { 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]]]] } },
28072         { 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]]]] } },
28073         { 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]]]] } },
28074         { 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]]]] } },
28075         { 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]]]] } },
28076         { type: "Feature", properties: { wikidata: "Q153732", nameEn: "Mariana Islands", level: "sharedLandform" }, geometry: null },
28077         { 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]]]] } },
28078         { 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]]]] } },
28079         { type: "Feature", properties: { wikidata: "Q185086", nameEn: "Crown Dependencies", country: "GB", level: "subcountryGroup" }, geometry: null },
28080         { 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]]]] } },
28081         { type: "Feature", properties: { wikidata: "Q191011", nameEn: "Plazas de soberan\xEDa", country: "ES" }, geometry: null },
28082         { 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]]]] } },
28083         { 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]]]] } },
28084         { type: "Feature", properties: { wikidata: "Q578170", nameEn: "Contiguous United States", aliases: ["CONUS"], country: "US", groups: ["Q35657", "021", "003", "019", "UN"], roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-97.13927, 25.96583], [-96.92418, 25.97377], [-80.57035, 24.0565], [-78.91214, 27.76553], [-61.98255, 37.34815], [-67.16117, 44.20069], [-66.93432, 44.82597], [-66.96824, 44.83078], [-66.98249, 44.87071], [-66.96824, 44.90965], [-67.0216, 44.95333], [-67.11316, 45.11176], [-67.15965, 45.16179], [-67.19603, 45.16771], [-67.20349, 45.1722], [-67.22751, 45.16344], [-67.27039, 45.1934], [-67.29748, 45.18173], [-67.29754, 45.14865], [-67.34927, 45.122], [-67.48201, 45.27351], [-67.42394, 45.37969], [-67.50578, 45.48971], [-67.42144, 45.50584], [-67.43815, 45.59162], [-67.6049, 45.60725], [-67.80705, 45.69528], [-67.80653, 45.80022], [-67.75654, 45.82324], [-67.80961, 45.87531], [-67.75196, 45.91814], [-67.78111, 45.9392], [-67.78578, 47.06473], [-67.87993, 47.10377], [-67.94843, 47.1925], [-68.23244, 47.35712], [-68.37458, 47.35851], [-68.38332, 47.28723], [-68.57914, 47.28431], [-68.60575, 47.24659], [-68.70125, 47.24399], [-68.89222, 47.1807], [-69.05039, 47.2456], [-69.05073, 47.30076], [-69.05148, 47.42012], [-69.22119, 47.46461], [-69.99966, 46.69543], [-70.05812, 46.41768], [-70.18547, 46.35357], [-70.29078, 46.18832], [-70.23855, 46.1453], [-70.31025, 45.96424], [-70.24694, 45.95138], [-70.25976, 45.89675], [-70.41523, 45.79497], [-70.38934, 45.73215], [-70.54019, 45.67291], [-70.68516, 45.56964], [-70.72651, 45.49771], [-70.62518, 45.42286], [-70.65383, 45.37592], [-70.78372, 45.43269], [-70.82638, 45.39828], [-70.80236, 45.37444], [-70.84816, 45.22698], [-70.89864, 45.2398], [-70.91169, 45.29849], [-70.95193, 45.33895], [-71.0107, 45.34819], [-71.01866, 45.31573], [-71.08364, 45.30623], [-71.14568, 45.24128], [-71.19723, 45.25438], [-71.22338, 45.25184], [-71.29371, 45.29996], [-71.37133, 45.24624], [-71.44252, 45.2361], [-71.40364, 45.21382], [-71.42778, 45.12624], [-71.48735, 45.07784], [-71.50067, 45.01357], [-73.35025, 45.00942], [-74.32699, 44.99029], [-74.66689, 45.00646], [-74.8447, 45.00606], [-74.99101, 44.98051], [-75.01363, 44.95608], [-75.2193, 44.87821], [-75.41441, 44.76614], [-75.76813, 44.51537], [-75.8217, 44.43176], [-75.95947, 44.34463], [-76.00018, 44.34896], [-76.16285, 44.28262], [-76.1664, 44.23051], [-76.244, 44.19643], [-76.31222, 44.19894], [-76.35324, 44.13493], [-76.43859, 44.09393], [-76.79706, 43.63099], [-79.25796, 43.54052], [-79.06921, 43.26183], [-79.05512, 43.25375], [-79.05544, 43.21224], [-79.05002, 43.20133], [-79.05384, 43.17418], [-79.04652, 43.16396], [-79.0427, 43.13934], [-79.06881, 43.12029], [-79.05671, 43.10937], [-79.07486, 43.07845], [-79.01055, 43.06659], [-78.99941, 43.05612], [-79.02424, 43.01983], [-79.02074, 42.98444], [-78.98126, 42.97], [-78.96312, 42.95509], [-78.93224, 42.95229], [-78.90905, 42.93022], [-78.90712, 42.89733], [-78.93684, 42.82887], [-82.67862, 41.67615], [-83.11184, 41.95671], [-83.14962, 42.04089], [-83.12724, 42.2376], [-83.09837, 42.28877], [-83.07837, 42.30978], [-83.02253, 42.33045], [-82.82964, 42.37355], [-82.64242, 42.55594], [-82.58873, 42.54984], [-82.57583, 42.5718], [-82.51858, 42.611], [-82.51063, 42.66025], [-82.46613, 42.76615], [-82.4826, 42.8068], [-82.45331, 42.93139], [-82.4253, 42.95423], [-82.4146, 42.97626], [-82.42469, 42.992], [-82.48419, 45.30225], [-83.59589, 45.82131], [-83.43746, 45.99749], [-83.57017, 46.105], [-83.83329, 46.12169], [-83.90453, 46.05922], [-83.95399, 46.05634], [-84.1096, 46.23987], [-84.09756, 46.25512], [-84.11615, 46.2681], [-84.11254, 46.32329], [-84.13451, 46.39218], [-84.11196, 46.50248], [-84.12885, 46.53068], [-84.17723, 46.52753], [-84.1945, 46.54061], [-84.2264, 46.53337], [-84.26351, 46.49508], [-84.29893, 46.49127], [-84.34174, 46.50683], [-84.42101, 46.49853], [-84.4481, 46.48972], [-84.47607, 46.45225], [-84.55635, 46.45974], [-84.85871, 46.88881], [-88.37033, 48.30586], [-89.48837, 48.01412], [-89.57972, 48.00023], [-89.77248, 48.02607], [-89.89974, 47.98109], [-90.07418, 48.11043], [-90.56312, 48.09488], [-90.56444, 48.12184], [-90.75045, 48.09143], [-90.87588, 48.2484], [-91.08016, 48.18096], [-91.25025, 48.08522], [-91.43248, 48.04912], [-91.45829, 48.07454], [-91.58025, 48.04339], [-91.55649, 48.10611], [-91.70451, 48.11805], [-91.71231, 48.19875], [-91.86125, 48.21278], [-91.98929, 48.25409], [-92.05339, 48.35958], [-92.14732, 48.36578], [-92.202, 48.35252], [-92.26662, 48.35651], [-92.30939, 48.31251], [-92.27167, 48.25046], [-92.37185, 48.22259], [-92.48147, 48.36609], [-92.45588, 48.40624], [-92.50712, 48.44921], [-92.65606, 48.43471], [-92.71323, 48.46081], [-92.69927, 48.49573], [-92.62747, 48.50278], [-92.6342, 48.54133], [-92.7287, 48.54005], [-92.94973, 48.60866], [-93.25391, 48.64266], [-93.33946, 48.62787], [-93.3712, 48.60599], [-93.39758, 48.60364], [-93.40693, 48.60948], [-93.44472, 48.59147], [-93.47022, 48.54357], [-93.66382, 48.51845], [-93.79267, 48.51631], [-93.80939, 48.52439], [-93.80676, 48.58232], [-93.83288, 48.62745], [-93.85769, 48.63284], [-94.23215, 48.65202], [-94.25104, 48.65729], [-94.25172, 48.68404], [-94.27153, 48.70232], [-94.4174, 48.71049], [-94.44258, 48.69223], [-94.53826, 48.70216], [-94.54885, 48.71543], [-94.58903, 48.71803], [-94.69335, 48.77883], [-94.69669, 48.80918], [-94.70486, 48.82365], [-94.70087, 48.8339], [-94.687, 48.84077], [-94.75017, 49.09931], [-94.77355, 49.11998], [-94.82487, 49.29483], [-94.8159, 49.32299], [-94.85381, 49.32492], [-94.95681, 49.37035], [-94.99532, 49.36579], [-95.01419, 49.35647], [-95.05825, 49.35311], [-95.12903, 49.37056], [-95.15357, 49.384], [-95.15355, 48.9996], [-123.32163, 49.00419], [-123.0093, 48.83186], [-123.0093, 48.76586], [-123.26565, 48.6959], [-123.15614, 48.35395], [-123.50039, 48.21223], [-125.03842, 48.53282], [-133.98258, 38.06389], [-118.48109, 32.5991], [-117.1243, 32.53427], [-115.88053, 32.63624], [-114.71871, 32.71894], [-114.76736, 32.64094], [-114.80584, 32.62028], [-114.81141, 32.55543], [-114.79524, 32.55731], [-114.82011, 32.49609], [-111.07523, 31.33232], [-108.20979, 31.33316], [-108.20899, 31.78534], [-106.529, 31.784], [-106.52266, 31.77509], [-106.51251, 31.76922], [-106.50962, 31.76155], [-106.50111, 31.75714], [-106.48815, 31.74769], [-106.47298, 31.75054], [-106.46726, 31.75998], [-106.45244, 31.76523], [-106.43419, 31.75478], [-106.41773, 31.75196], [-106.38003, 31.73151], [-106.3718, 31.71165], [-106.34864, 31.69663], [-106.33419, 31.66303], [-106.30305, 31.62154], [-106.28084, 31.56173], [-106.24612, 31.54193], [-106.23711, 31.51262], [-106.20346, 31.46305], [-106.09025, 31.40569], [-106.00363, 31.39181], [-104.77674, 30.4236], [-104.5171, 29.64671], [-104.3969, 29.57105], [-104.39363, 29.55396], [-104.37752, 29.54255], [-103.15787, 28.93865], [-102.60596, 29.8192], [-101.47277, 29.7744], [-101.05686, 29.44738], [-101.01128, 29.36947], [-100.96725, 29.3477], [-100.94579, 29.34523], [-100.94056, 29.33371], [-100.87982, 29.296], [-100.79696, 29.24688], [-100.67294, 29.09744], [-100.63689, 28.90812], [-100.59809, 28.88197], [-100.52313, 28.75598], [-100.5075, 28.74066], [-100.51222, 28.70679], [-100.50029, 28.66117], [-99.55409, 27.61314], [-99.51478, 27.55836], [-99.52955, 27.49747], [-99.50208, 27.50021], [-99.48045, 27.49016], [-99.482, 27.47128], [-99.49744, 27.43746], [-99.53573, 27.30926], [-99.08477, 26.39849], [-99.03053, 26.41249], [-99.00546, 26.3925], [-98.35126, 26.15129], [-98.30491, 26.10475], [-98.27075, 26.09457], [-98.24603, 26.07191], [-97.97017, 26.05232], [-97.95155, 26.0625], [-97.66511, 26.01708], [-97.52025, 25.88518], [-97.49828, 25.89877], [-97.45669, 25.86874], [-97.42511, 25.83969], [-97.37332, 25.83854], [-97.35946, 25.92189], [-97.13927, 25.96583]]]] } },
28085         { 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]]]] } },
28086         { 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]]]] } },
28087         { type: "Feature", properties: { wikidata: "Q644636", nameEn: "Cyprus", level: "sharedLandform" }, geometry: null },
28088         { type: "Feature", properties: { wikidata: "Q851132", nameEn: "New Zealand Outlying Islands", country: "NZ", level: "subcountryGroup" }, geometry: null },
28089         { 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]]]] } },
28090         { 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]]]] } },
28091         { 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]]]] } },
28092         { 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]]]] } },
28093         { type: "Feature", properties: { wikidata: "Q1352230", nameEn: "US Territories", country: "US", level: "subcountryGroup" }, geometry: null },
28094         { type: "Feature", properties: { wikidata: "Q1451600", nameEn: "Overseas Countries and Territories of the EU", aliases: ["OCT"], level: "subunion" }, geometry: null },
28095         { 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]]]] } },
28096         { 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]]]] } },
28097         { 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]]]] } },
28098         { type: "Feature", properties: { wikidata: "Q1901211", nameEn: "East Malaysia", country: "MY", groups: ["Q36117", "035", "142", "UN"], driveSide: "left", callingCodes: ["60"] }, geometry: { type: "MultiPolygon", coordinates: [[[[110.90339, 7.52694], [109.82788, 2.86812], [109.62558, 1.99182], [109.53794, 1.91771], [109.57923, 1.80624], [109.66397, 1.79972], [109.66397, 1.60425], [110.35354, 0.98869], [110.49182, 0.88088], [110.62374, 0.873], [111.22979, 1.08326], [111.55434, 0.97864], [111.82846, 0.99349], [111.94553, 1.12016], [112.15679, 1.17004], [112.2127, 1.44135], [112.48648, 1.56516], [113.021, 1.57819], [113.01448, 1.42832], [113.64677, 1.23933], [114.03788, 1.44787], [114.57892, 1.5], [114.80706, 1.92351], [114.80706, 2.21665], [115.1721, 2.49671], [115.11343, 2.82879], [115.53713, 3.14776], [115.58276, 3.93499], [115.90217, 4.37708], [117.25801, 4.35108], [117.47313, 4.18857], [117.67641, 4.16535], [118.06469, 4.16638], [118.93936, 4.09009], [119.52945, 5.35672], [117.98544, 6.27477], [117.93857, 6.89845], [117.17735, 7.52841], [116.79524, 7.43869], [115.02521, 5.35005], [115.16236, 5.01011], [115.15092, 4.87604], [115.20737, 4.8256], [115.27819, 4.63661], [115.2851, 4.42295], [115.36346, 4.33563], [115.31275, 4.30806], [115.09978, 4.39123], [115.07737, 4.53418], [115.04064, 4.63706], [115.02278, 4.74137], [115.02955, 4.82087], [115.05038, 4.90275], [114.99417, 4.88201], [114.96982, 4.81146], [114.88841, 4.81905], [114.8266, 4.75062], [114.77303, 4.72871], [114.83189, 4.42387], [114.88039, 4.4257], [114.78539, 4.12205], [114.64211, 4.00694], [114.49922, 4.13108], [114.4416, 4.27588], [114.32176, 4.2552], [114.32176, 4.34942], [114.26876, 4.49878], [114.15813, 4.57], [114.07448, 4.58441], [114.10166, 4.76112], [110.90339, 7.52694]]]] } },
28099         { 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]]]] } },
28100         { 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]]]] } },
28101         { 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]]]] } },
28102         { 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]]]] } },
28103         { type: "Feature", properties: { wikidata: "Q2914565", nameEn: "Autonomous Regions of Portugal", country: "PT", level: "subcountryGroup" }, geometry: null },
28104         { 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]]]] } },
28105         { 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]]]] } },
28106         { type: "Feature", properties: { wikidata: "Q3320166", nameEn: "Outermost Regions of the EU", aliases: ["OMR"], level: "subunion" }, geometry: null },
28107         { type: "Feature", properties: { wikidata: "Q3336843", nameEn: "Countries of the United Kingdom", aliases: ["GB-UKM"], country: "GB", level: "subcountryGroup" }, geometry: null },
28108         { 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]]]] } },
28109         { 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]]]] } },
28110         { 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]]]] } },
28111         { 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]]]] } },
28112         { 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]]]] } },
28113         { 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]]]] } },
28114         { type: "Feature", properties: { m49: "001", wikidata: "Q2", nameEn: "World", aliases: ["Earth", "Planet"], level: "world" }, geometry: null },
28115         { type: "Feature", properties: { m49: "002", wikidata: "Q15", nameEn: "Africa", level: "region" }, geometry: null },
28116         { type: "Feature", properties: { m49: "003", wikidata: "Q49", nameEn: "North America", level: "subregion" }, geometry: null },
28117         { type: "Feature", properties: { m49: "005", wikidata: "Q18", nameEn: "South America", level: "intermediateRegion" }, geometry: null },
28118         { type: "Feature", properties: { m49: "009", wikidata: "Q538", nameEn: "Oceania", level: "region" }, geometry: null },
28119         { type: "Feature", properties: { m49: "011", wikidata: "Q4412", nameEn: "Western Africa", level: "intermediateRegion" }, geometry: null },
28120         { type: "Feature", properties: { m49: "013", wikidata: "Q27611", nameEn: "Central America", level: "intermediateRegion" }, geometry: null },
28121         { type: "Feature", properties: { m49: "014", wikidata: "Q27407", nameEn: "Eastern Africa", level: "intermediateRegion" }, geometry: null },
28122         { type: "Feature", properties: { m49: "015", wikidata: "Q27381", nameEn: "Northern Africa", level: "subregion" }, geometry: null },
28123         { type: "Feature", properties: { m49: "017", wikidata: "Q27433", nameEn: "Middle Africa", level: "intermediateRegion" }, geometry: null },
28124         { type: "Feature", properties: { m49: "018", wikidata: "Q27394", nameEn: "Southern Africa", level: "intermediateRegion" }, geometry: null },
28125         { type: "Feature", properties: { m49: "019", wikidata: "Q828", nameEn: "Americas", level: "region" }, geometry: null },
28126         { type: "Feature", properties: { m49: "021", wikidata: "Q2017699", nameEn: "Northern America", level: "subregion" }, geometry: null },
28127         { type: "Feature", properties: { m49: "029", wikidata: "Q664609", nameEn: "Caribbean", level: "intermediateRegion" }, geometry: null },
28128         { type: "Feature", properties: { m49: "030", wikidata: "Q27231", nameEn: "Eastern Asia", level: "subregion" }, geometry: null },
28129         { type: "Feature", properties: { m49: "034", wikidata: "Q771405", nameEn: "Southern Asia", level: "subregion" }, geometry: null },
28130         { type: "Feature", properties: { m49: "035", wikidata: "Q11708", nameEn: "South-eastern Asia", level: "subregion" }, geometry: null },
28131         { type: "Feature", properties: { m49: "039", wikidata: "Q27449", nameEn: "Southern Europe", level: "subregion" }, geometry: null },
28132         { type: "Feature", properties: { m49: "053", wikidata: "Q45256", nameEn: "Australia and New Zealand", aliases: ["Australasia"], level: "subregion" }, geometry: null },
28133         { type: "Feature", properties: { m49: "054", wikidata: "Q37394", nameEn: "Melanesia", level: "subregion" }, geometry: null },
28134         { type: "Feature", properties: { m49: "057", wikidata: "Q3359409", nameEn: "Micronesia", level: "subregion" }, geometry: null },
28135         { type: "Feature", properties: { m49: "061", wikidata: "Q35942", nameEn: "Polynesia", level: "subregion" }, geometry: null },
28136         { type: "Feature", properties: { m49: "142", wikidata: "Q48", nameEn: "Asia", level: "region" }, geometry: null },
28137         { type: "Feature", properties: { m49: "143", wikidata: "Q27275", nameEn: "Central Asia", level: "subregion" }, geometry: null },
28138         { type: "Feature", properties: { m49: "145", wikidata: "Q27293", nameEn: "Western Asia", level: "subregion" }, geometry: null },
28139         { type: "Feature", properties: { m49: "150", wikidata: "Q46", nameEn: "Europe", level: "region" }, geometry: null },
28140         { type: "Feature", properties: { m49: "151", wikidata: "Q27468", nameEn: "Eastern Europe", level: "subregion" }, geometry: null },
28141         { type: "Feature", properties: { m49: "154", wikidata: "Q27479", nameEn: "Northern Europe", level: "subregion" }, geometry: null },
28142         { type: "Feature", properties: { m49: "155", wikidata: "Q27496", nameEn: "Western Europe", level: "subregion" }, geometry: null },
28143         { type: "Feature", properties: { m49: "202", wikidata: "Q132959", nameEn: "Sub-Saharan Africa", level: "subregion" }, geometry: null },
28144         { type: "Feature", properties: { m49: "419", wikidata: "Q72829598", nameEn: "Latin America and the Caribbean", level: "subregion" }, geometry: null },
28145         { type: "Feature", properties: { m49: "830", wikidata: "Q42314", nameEn: "Channel Islands", level: "intermediateRegion" }, geometry: null },
28146         { 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]]]] } },
28147         { 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]]]] } },
28148         { 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]]]] } },
28149         { 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]]]] } },
28150         { 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]]]] } },
28151         { 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]]]] } },
28152         { 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]]]] } },
28153         { 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]]]] } },
28154         { 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]]]] } },
28155         { 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]]]] } },
28156         { 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]]]] } },
28157         { 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]]]] } },
28158         { type: "Feature", properties: { iso1A2: "AT", iso1A3: "AUT", iso1N3: "040", wikidata: "Q40", nameEn: "Austria", groups: ["EU", "155", "150", "UN"], callingCodes: ["43"] }, geometry: { type: "MultiPolygon", coordinates: [[[[15.34823, 48.98444], [15.28305, 48.98831], [15.26177, 48.95766], [15.16358, 48.94278], [15.15534, 48.99056], [14.99878, 49.01444], [14.97612, 48.96983], [14.98917, 48.90082], [14.95072, 48.79101], [14.98032, 48.77959], [14.9782, 48.7766], [14.98112, 48.77524], [14.9758, 48.76857], [14.95641, 48.75915], [14.94773, 48.76268], [14.81545, 48.7874], [14.80821, 48.77711], [14.80584, 48.73489], [14.72756, 48.69502], [14.71794, 48.59794], [14.66762, 48.58215], [14.60808, 48.62881], [14.56139, 48.60429], [14.4587, 48.64695], [14.43076, 48.58855], [14.33909, 48.55852], [14.20691, 48.5898], [14.09104, 48.5943], [14.01482, 48.63788], [14.06151, 48.66873], [13.84023, 48.76988], [13.82266, 48.75544], [13.81863, 48.73257], [13.79337, 48.71375], [13.81791, 48.69832], [13.81283, 48.68426], [13.81901, 48.6761], [13.82609, 48.62345], [13.80038, 48.59487], [13.80519, 48.58026], [13.76921, 48.55324], [13.7513, 48.5624], [13.74816, 48.53058], [13.72802, 48.51208], [13.66113, 48.53558], [13.65186, 48.55092], [13.62508, 48.55501], [13.59705, 48.57013], [13.57535, 48.55912], [13.51291, 48.59023], [13.50131, 48.58091], [13.50663, 48.57506], [13.46967, 48.55157], [13.45214, 48.56472], [13.43695, 48.55776], [13.45727, 48.51092], [13.42527, 48.45711], [13.43929, 48.43386], [13.40709, 48.37292], [13.30897, 48.31575], [13.26039, 48.29422], [13.18093, 48.29577], [13.126, 48.27867], [13.0851, 48.27711], [13.02083, 48.25689], [12.95306, 48.20629], [12.87126, 48.20318], [12.84475, 48.16556], [12.836, 48.1647], [12.8362, 48.15876], [12.82673, 48.15245], [12.80676, 48.14979], [12.78595, 48.12445], [12.7617, 48.12796], [12.74973, 48.10885], [12.76141, 48.07373], [12.8549, 48.01122], [12.87476, 47.96195], [12.91683, 47.95647], [12.9211, 47.95135], [12.91985, 47.94069], [12.92668, 47.93879], [12.93419, 47.94063], [12.93642, 47.94436], [12.93886, 47.94046], [12.94163, 47.92927], [13.00588, 47.84374], [12.98543, 47.82896], [12.96311, 47.79957], [12.93202, 47.77302], [12.94371, 47.76281], [12.9353, 47.74788], [12.91711, 47.74026], [12.90274, 47.72513], [12.91333, 47.7178], [12.92969, 47.71094], [12.98578, 47.7078], [13.01382, 47.72116], [13.07692, 47.68814], [13.09562, 47.63304], [13.06407, 47.60075], [13.06641, 47.58577], [13.04537, 47.58183], [13.05355, 47.56291], [13.03252, 47.53373], [13.04537, 47.49426], [12.9998, 47.46267], [12.98344, 47.48716], [12.9624, 47.47452], [12.85256, 47.52741], [12.84672, 47.54556], [12.80699, 47.54477], [12.77427, 47.58025], [12.82101, 47.61493], [12.76492, 47.64485], [12.77777, 47.66689], [12.7357, 47.6787], [12.6071, 47.6741], [12.57438, 47.63238], [12.53816, 47.63553], [12.50076, 47.62293], [12.44117, 47.6741], [12.43883, 47.6977], [12.37222, 47.68433], [12.336, 47.69534], [12.27991, 47.68827], [12.26004, 47.67725], [12.24017, 47.69534], [12.26238, 47.73544], [12.2542, 47.7433], [12.22571, 47.71776], [12.18303, 47.70065], [12.16217, 47.70105], [12.16769, 47.68167], [12.18347, 47.66663], [12.18507, 47.65984], [12.19895, 47.64085], [12.20801, 47.61082], [12.20398, 47.60667], [12.18568, 47.6049], [12.17737, 47.60121], [12.18145, 47.61019], [12.17824, 47.61506], [12.13734, 47.60639], [12.05788, 47.61742], [12.02282, 47.61033], [12.0088, 47.62451], [11.85572, 47.60166], [11.84052, 47.58354], [11.63934, 47.59202], [11.60681, 47.57881], [11.58811, 47.55515], [11.58578, 47.52281], [11.52618, 47.50939], [11.4362, 47.51413], [11.38128, 47.47465], [11.4175, 47.44621], [11.33804, 47.44937], [11.29597, 47.42566], [11.27844, 47.39956], [11.22002, 47.3964], [11.25157, 47.43277], [11.20482, 47.43198], [11.12536, 47.41222], [11.11835, 47.39719], [10.97111, 47.39561], [10.97111, 47.41617], [10.98513, 47.42882], [10.92437, 47.46991], [10.93839, 47.48018], [10.90918, 47.48571], [10.87061, 47.4786], [10.86945, 47.5015], [10.91268, 47.51334], [10.88814, 47.53701], [10.77596, 47.51729], [10.7596, 47.53228], [10.6965, 47.54253], [10.68832, 47.55752], [10.63456, 47.5591], [10.60337, 47.56755], [10.56912, 47.53584], [10.48849, 47.54057], [10.47329, 47.58552], [10.43473, 47.58394], [10.44992, 47.5524], [10.4324, 47.50111], [10.44291, 47.48453], [10.46278, 47.47901], [10.47446, 47.43318], [10.4359, 47.41183], [10.4324, 47.38494], [10.39851, 47.37623], [10.33424, 47.30813], [10.23257, 47.27088], [10.17531, 47.27167], [10.17648, 47.29149], [10.2147, 47.31014], [10.19998, 47.32832], [10.23757, 47.37609], [10.22774, 47.38904], [10.2127, 47.38019], [10.17648, 47.38889], [10.16362, 47.36674], [10.11805, 47.37228], [10.09819, 47.35724], [10.06897, 47.40709], [10.1052, 47.4316], [10.09001, 47.46005], [10.07131, 47.45531], [10.03859, 47.48927], [10.00003, 47.48216], [9.96029, 47.53899], [9.92407, 47.53111], [9.87733, 47.54688], [9.87499, 47.52953], [9.8189, 47.54688], [9.82591, 47.58158], [9.80254, 47.59419], [9.76748, 47.5934], [9.72736, 47.53457], [9.55125, 47.53629], [9.56312, 47.49495], [9.58208, 47.48344], [9.59482, 47.46305], [9.60205, 47.46165], [9.60484, 47.46358], [9.60841, 47.47178], [9.62158, 47.45858], [9.62475, 47.45685], [9.6423, 47.45599], [9.65728, 47.45383], [9.65863, 47.44847], [9.64483, 47.43842], [9.6446, 47.43233], [9.65043, 47.41937], [9.65136, 47.40504], [9.6629, 47.39591], [9.67334, 47.39191], [9.67445, 47.38429], [9.6711, 47.37824], [9.66243, 47.37136], [9.65427, 47.36824], [9.62476, 47.36639], [9.59978, 47.34671], [9.58513, 47.31334], [9.55857, 47.29919], [9.54773, 47.2809], [9.53116, 47.27029], [9.56766, 47.24281], [9.55176, 47.22585], [9.56981, 47.21926], [9.58264, 47.20673], [9.56539, 47.17124], [9.62623, 47.14685], [9.63395, 47.08443], [9.61216, 47.07732], [9.60717, 47.06091], [9.87935, 47.01337], [9.88266, 46.93343], [9.98058, 46.91434], [10.10715, 46.84296], [10.22675, 46.86942], [10.24128, 46.93147], [10.30031, 46.92093], [10.36933, 47.00212], [10.48376, 46.93891], [10.47197, 46.85698], [10.54783, 46.84505], [10.66405, 46.87614], [10.75753, 46.82258], [10.72974, 46.78972], [11.00764, 46.76896], [11.10618, 46.92966], [11.33355, 46.99862], [11.50739, 47.00644], [11.74789, 46.98484], [12.19254, 47.09331], [12.21781, 47.03996], [12.11675, 47.01241], [12.2006, 46.88854], [12.27591, 46.88651], [12.38708, 46.71529], [12.59992, 46.6595], [12.94445, 46.60401], [13.27627, 46.56059], [13.64088, 46.53438], [13.7148, 46.5222], [13.89837, 46.52331], [14.00422, 46.48474], [14.04002, 46.49117], [14.12097, 46.47724], [14.15989, 46.43327], [14.28326, 46.44315], [14.314, 46.43327], [14.42608, 46.44614], [14.45877, 46.41717], [14.52176, 46.42617], [14.56463, 46.37208], [14.5942, 46.43434], [14.66892, 46.44936], [14.72185, 46.49974], [14.81836, 46.51046], [14.83549, 46.56614], [14.86419, 46.59411], [14.87129, 46.61], [14.92283, 46.60848], [14.96002, 46.63459], [14.98024, 46.6009], [15.01451, 46.641], [15.14215, 46.66131], [15.23711, 46.63994], [15.41235, 46.65556], [15.45514, 46.63697], [15.46906, 46.61321], [15.54431, 46.6312], [15.55333, 46.64988], [15.54533, 46.66985], [15.59826, 46.68908], [15.62317, 46.67947], [15.63255, 46.68069], [15.6365, 46.6894], [15.6543, 46.69228], [15.6543, 46.70616], [15.67411, 46.70735], [15.69523, 46.69823], [15.72279, 46.69548], [15.73823, 46.70011], [15.76771, 46.69863], [15.78518, 46.70712], [15.8162, 46.71897], [15.87691, 46.7211], [15.94864, 46.68769], [15.98512, 46.68463], [15.99988, 46.67947], [16.04036, 46.6549], [16.04347, 46.68694], [16.02808, 46.71094], [15.99769, 46.7266], [15.98432, 46.74991], [15.99126, 46.78199], [15.99054, 46.82772], [16.05786, 46.83927], [16.10983, 46.867], [16.19904, 46.94134], [16.22403, 46.939], [16.27594, 46.9643], [16.28202, 47.00159], [16.51369, 47.00084], [16.43936, 47.03548], [16.52176, 47.05747], [16.46134, 47.09395], [16.52863, 47.13974], [16.44932, 47.14418], [16.46442, 47.16845], [16.4523, 47.18812], [16.42801, 47.18422], [16.41739, 47.20649], [16.43663, 47.21127], [16.44142, 47.25079], [16.47782, 47.25918], [16.45104, 47.41181], [16.49908, 47.39416], [16.52414, 47.41007], [16.57152, 47.40868], [16.6718, 47.46139], [16.64821, 47.50155], [16.71059, 47.52692], [16.64193, 47.63114], [16.58699, 47.61772], [16.4222, 47.66537], [16.55129, 47.72268], [16.53514, 47.73837], [16.54779, 47.75074], [16.61183, 47.76171], [16.65679, 47.74197], [16.72089, 47.73469], [16.7511, 47.67878], [16.82938, 47.68432], [16.86509, 47.72268], [16.87538, 47.68895], [17.08893, 47.70928], [17.05048, 47.79377], [17.07039, 47.81129], [17.00997, 47.86245], [17.08275, 47.87719], [17.11022, 47.92461], [17.09786, 47.97336], [17.16001, 48.00636], [17.07039, 48.0317], [17.09168, 48.09366], [17.05735, 48.14179], [17.02919, 48.13996], [16.97701, 48.17385], [16.89461, 48.31332], [16.90903, 48.32519], [16.84243, 48.35258], [16.83317, 48.38138], [16.83588, 48.3844], [16.8497, 48.38321], [16.85204, 48.44968], [16.94611, 48.53614], [16.93955, 48.60371], [16.90354, 48.71541], [16.79779, 48.70998], [16.71883, 48.73806], [16.68518, 48.7281], [16.67008, 48.77699], [16.46134, 48.80865], [16.40915, 48.74576], [16.37345, 48.729], [16.06034, 48.75436], [15.84404, 48.86921], [15.78087, 48.87644], [15.75341, 48.8516], [15.6921, 48.85973], [15.61622, 48.89541], [15.51357, 48.91549], [15.48027, 48.94481], [15.34823, 48.98444]]]] } },
28159         { type: "Feature", properties: { iso1A2: "AU", iso1A3: "AUS", iso1N3: "036", wikidata: "Q408", nameEn: "Australia" }, geometry: null },
28160         { 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]]]] } },
28161         { 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]]]] } },
28162         { 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]]]] } },
28163         { 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]]]] } },
28164         { 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]]]] } },
28165         { 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]]]] } },
28166         { 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]]]] } },
28167         { 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]]]] } },
28168         { 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]]]] } },
28169         { 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]]]] } },
28170         { 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]]]] } },
28171         { 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]]]] } },
28172         { 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]]]] } },
28173         { 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]]]] } },
28174         { 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]]]] } },
28175         { type: "Feature", properties: { iso1A2: "BO", iso1A3: "BOL", iso1N3: "068", wikidata: "Q750", nameEn: "Bolivia", groups: ["005", "419", "019", "UN"], callingCodes: ["591"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-63.90248, -12.52544], [-64.22539, -12.45267], [-64.30708, -12.46398], [-64.99778, -11.98604], [-65.30027, -11.48749], [-65.28141, -10.86289], [-65.35402, -10.78685], [-65.37923, -10.35141], [-65.29019, -9.86253], [-65.40615, -9.63894], [-65.56244, -9.84266], [-65.68343, -9.75323], [-67.17784, -10.34016], [-68.71533, -11.14749], [-68.7651, -11.0496], [-68.75179, -11.03688], [-68.75265, -11.02383], [-68.74802, -11.00891], [-69.42792, -10.93451], [-69.47839, -10.95254], [-69.57156, -10.94555], [-68.98115, -11.8979], [-68.65044, -12.50689], [-68.85615, -12.87769], [-68.8864, -13.40792], [-69.05265, -13.68546], [-68.88135, -14.18639], [-69.36254, -14.94634], [-69.14856, -15.23478], [-69.40336, -15.61358], [-69.20291, -16.16668], [-69.09986, -16.22693], [-68.96238, -16.194], [-68.79464, -16.33272], [-68.98358, -16.42165], [-69.04027, -16.57214], [-69.00853, -16.66769], [-69.16896, -16.72233], [-69.62883, -17.28142], [-69.46863, -17.37466], [-69.46897, -17.4988], [-69.46623, -17.60518], [-69.34126, -17.72753], [-69.28671, -17.94844], [-69.07496, -18.03715], [-69.14807, -18.16893], [-69.07432, -18.28259], [-68.94987, -18.93302], [-68.87082, -19.06003], [-68.80602, -19.08355], [-68.61989, -19.27584], [-68.41218, -19.40499], [-68.66761, -19.72118], [-68.54611, -19.84651], [-68.57132, -20.03134], [-68.74273, -20.08817], [-68.7276, -20.46178], [-68.44023, -20.62701], [-68.55383, -20.7355], [-68.53957, -20.91542], [-68.40403, -20.94562], [-68.18816, -21.28614], [-67.85114, -22.87076], [-67.54284, -22.89771], [-67.18382, -22.81525], [-66.7298, -22.23644], [-66.29714, -22.08741], [-66.24077, -21.77837], [-66.03836, -21.84829], [-66.04832, -21.9187], [-65.9261, -21.93335], [-65.7467, -22.10105], [-65.61166, -22.09504], [-65.58694, -22.09794], [-65.57743, -22.07675], [-65.47435, -22.08908], [-64.99524, -22.08255], [-64.90014, -22.12136], [-64.67174, -22.18957], [-64.58888, -22.25035], [-64.4176, -22.67692], [-64.35108, -22.73282], [-64.31489, -22.88824], [-64.22918, -22.55807], [-63.93287, -21.99934], [-63.70963, -21.99934], [-63.68113, -22.0544], [-63.66482, -21.99918], [-62.81124, -21.9987], [-62.8078, -22.12534], [-62.64455, -22.25091], [-62.2757, -21.06657], [-62.26883, -20.55311], [-61.93912, -20.10053], [-61.73723, -19.63958], [-60.00638, -19.2981], [-59.06965, -19.29148], [-58.23216, -19.80058], [-58.16225, -20.16193], [-57.8496, -19.98346], [-58.14215, -19.76276], [-57.78463, -19.03259], [-57.71113, -19.03161], [-57.69134, -19.00544], [-57.71995, -18.97546], [-57.71995, -18.89573], [-57.76764, -18.90087], [-57.56807, -18.25655], [-57.48237, -18.24219], [-57.69877, -17.8431], [-57.73949, -17.56095], [-57.90082, -17.44555], [-57.99661, -17.5273], [-58.32935, -17.28195], [-58.5058, -16.80958], [-58.30918, -16.3699], [-58.32431, -16.25861], [-58.41506, -16.32636], [-60.16069, -16.26479], [-60.23797, -15.50267], [-60.58224, -15.09887], [-60.23968, -15.09515], [-60.27887, -14.63021], [-60.46037, -14.22496], [-60.48053, -13.77981], [-61.05527, -13.50054], [-61.81151, -13.49564], [-63.76259, -12.42952], [-63.90248, -12.52544]]]] } },
28176         { type: "Feature", properties: { iso1A2: "BQ", iso1A3: "BES", iso1N3: "535", wikidata: "Q27561", nameEn: "Caribbean Netherlands", country: "NL" }, geometry: null },
28177         { type: "Feature", properties: { iso1A2: "BR", iso1A3: "BRA", iso1N3: "076", wikidata: "Q155", nameEn: "Brazil", groups: ["005", "419", "019", "UN"], callingCodes: ["55"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-59.69361, 4.34069], [-59.78878, 4.45637], [-60.15953, 4.53456], [-60.04189, 4.69801], [-59.98129, 5.07097], [-60.20944, 5.28754], [-60.32352, 5.21299], [-60.73204, 5.20931], [-60.5802, 4.94312], [-60.86539, 4.70512], [-60.98303, 4.54167], [-61.15703, 4.49839], [-61.31457, 4.54167], [-61.29675, 4.44216], [-61.48569, 4.43149], [-61.54629, 4.2822], [-62.13094, 4.08309], [-62.44822, 4.18621], [-62.57656, 4.04754], [-62.74411, 4.03331], [-62.7655, 3.73099], [-62.98296, 3.59935], [-63.21111, 3.96219], [-63.4464, 3.9693], [-63.42233, 3.89995], [-63.50611, 3.83592], [-63.67099, 4.01731], [-63.70218, 3.91417], [-63.86082, 3.94796], [-63.99183, 3.90172], [-64.14512, 4.12932], [-64.57648, 4.12576], [-64.72977, 4.28931], [-64.84028, 4.24665], [-64.48379, 3.7879], [-64.02908, 2.79797], [-64.0257, 2.48156], [-63.39114, 2.4317], [-63.39827, 2.16098], [-64.06135, 1.94722], [-64.08274, 1.64792], [-64.34654, 1.35569], [-64.38932, 1.5125], [-65.11657, 1.12046], [-65.57288, 0.62856], [-65.50158, 0.92086], [-65.6727, 1.01353], [-66.28507, 0.74585], [-66.85795, 1.22998], [-67.08222, 1.17441], [-67.15784, 1.80439], [-67.299, 1.87494], [-67.40488, 2.22258], [-67.9292, 1.82455], [-68.18632, 2.00091], [-68.26699, 1.83463], [-68.18128, 1.72881], [-69.38621, 1.70865], [-69.53746, 1.76408], [-69.83491, 1.69353], [-69.82987, 1.07864], [-69.26017, 1.06856], [-69.14422, 0.84172], [-69.20976, 0.57958], [-69.47696, 0.71065], [-70.04162, 0.55437], [-70.03658, -0.19681], [-69.603, -0.51947], [-69.59796, -0.75136], [-69.4215, -1.01853], [-69.43395, -1.42219], [-69.94708, -4.2431], [-70.00888, -4.37833], [-70.11305, -4.27281], [-70.19582, -4.3607], [-70.33236, -4.15214], [-70.77601, -4.15717], [-70.96814, -4.36915], [-71.87003, -4.51661], [-72.64391, -5.0391], [-72.83973, -5.14765], [-73.24579, -6.05764], [-73.12983, -6.43852], [-73.73986, -6.87919], [-73.77011, -7.28944], [-73.96938, -7.58465], [-73.65485, -7.77897], [-73.76576, -7.89884], [-72.92886, -9.04074], [-73.21498, -9.40904], [-72.72216, -9.41397], [-72.31883, -9.5184], [-72.14742, -9.98049], [-71.23394, -9.9668], [-70.53373, -9.42628], [-70.58453, -9.58303], [-70.55429, -9.76692], [-70.62487, -9.80666], [-70.64134, -11.0108], [-70.51395, -10.92249], [-70.38791, -11.07096], [-69.90896, -10.92744], [-69.57835, -10.94051], [-69.57156, -10.94555], [-69.47839, -10.95254], [-69.42792, -10.93451], [-68.74802, -11.00891], [-68.75265, -11.02383], [-68.75179, -11.03688], [-68.7651, -11.0496], [-68.71533, -11.14749], [-67.17784, -10.34016], [-65.68343, -9.75323], [-65.56244, -9.84266], [-65.40615, -9.63894], [-65.29019, -9.86253], [-65.37923, -10.35141], [-65.35402, -10.78685], [-65.28141, -10.86289], [-65.30027, -11.48749], [-64.99778, -11.98604], [-64.30708, -12.46398], [-64.22539, -12.45267], [-63.90248, -12.52544], [-63.76259, -12.42952], [-61.81151, -13.49564], [-61.05527, -13.50054], [-60.48053, -13.77981], [-60.46037, -14.22496], [-60.27887, -14.63021], [-60.23968, -15.09515], [-60.58224, -15.09887], [-60.23797, -15.50267], [-60.16069, -16.26479], [-58.41506, -16.32636], [-58.32431, -16.25861], [-58.30918, -16.3699], [-58.5058, -16.80958], [-58.32935, -17.28195], [-57.99661, -17.5273], [-57.90082, -17.44555], [-57.73949, -17.56095], [-57.69877, -17.8431], [-57.48237, -18.24219], [-57.56807, -18.25655], [-57.76764, -18.90087], [-57.71995, -18.89573], [-57.71995, -18.97546], [-57.69134, -19.00544], [-57.71113, -19.03161], [-57.78463, -19.03259], [-58.14215, -19.76276], [-57.8496, -19.98346], [-58.16225, -20.16193], [-57.84536, -20.93155], [-57.93492, -21.65505], [-57.88239, -21.6868], [-57.94642, -21.73799], [-57.98625, -22.09157], [-56.6508, -22.28387], [-56.5212, -22.11556], [-56.45893, -22.08072], [-56.23206, -22.25347], [-55.8331, -22.29008], [-55.74941, -22.46436], [-55.741, -22.52018], [-55.72366, -22.5519], [-55.6986, -22.56268], [-55.68742, -22.58407], [-55.62493, -22.62765], [-55.63849, -22.95122], [-55.5446, -23.22811], [-55.52288, -23.2595], [-55.5555, -23.28237], [-55.43585, -23.87157], [-55.44117, -23.9185], [-55.41784, -23.9657], [-55.12292, -23.99669], [-55.0518, -23.98666], [-55.02691, -23.97317], [-54.6238, -23.83078], [-54.32807, -24.01865], [-54.28207, -24.07305], [-54.4423, -25.13381], [-54.62033, -25.46026], [-54.60196, -25.48397], [-54.59509, -25.53696], [-54.59398, -25.59224], [-54.5502, -25.58915], [-54.52926, -25.62846], [-53.90831, -25.55513], [-53.83691, -25.94849], [-53.73511, -26.04211], [-53.73086, -26.05842], [-53.7264, -26.0664], [-53.73391, -26.07006], [-53.73968, -26.10012], [-53.65018, -26.19501], [-53.65237, -26.23289], [-53.63739, -26.2496], [-53.63881, -26.25075], [-53.64632, -26.24798], [-53.64186, -26.25976], [-53.64505, -26.28089], [-53.68269, -26.33359], [-53.73372, -26.6131], [-53.80144, -27.09844], [-54.15978, -27.2889], [-54.19062, -27.27639], [-54.19268, -27.30751], [-54.41888, -27.40882], [-54.50416, -27.48232], [-54.67657, -27.57214], [-54.90159, -27.63132], [-54.90805, -27.73149], [-55.1349, -27.89759], [-55.16872, -27.86224], [-55.33303, -27.94661], [-55.6262, -28.17124], [-55.65418, -28.18304], [-56.01729, -28.51223], [-56.00458, -28.60421], [-56.05265, -28.62651], [-56.54171, -29.11447], [-56.57295, -29.11357], [-56.62789, -29.18073], [-56.81251, -29.48154], [-57.09386, -29.74211], [-57.65132, -30.19229], [-57.22502, -30.26121], [-56.90236, -30.02578], [-56.49267, -30.39471], [-56.4795, -30.3899], [-56.4619, -30.38457], [-55.87388, -31.05053], [-55.58866, -30.84117], [-55.5634, -30.8686], [-55.55373, -30.8732], [-55.55218, -30.88193], [-55.54572, -30.89051], [-55.53431, -30.89714], [-55.53276, -30.90218], [-55.52712, -30.89997], [-55.51862, -30.89828], [-55.50841, -30.9027], [-55.50821, -30.91349], [-54.17384, -31.86168], [-53.76024, -32.0751], [-53.39572, -32.58596], [-53.37671, -32.57005], [-53.1111, -32.71147], [-53.53459, -33.16843], [-53.52794, -33.68908], [-53.44031, -33.69344], [-53.39593, -33.75169], [-53.37138, -33.74313], [-52.83257, -34.01481], [-28.34015, -20.99094], [-28.99601, 1.86593], [-51.35485, 4.8383], [-51.63798, 4.51394], [-51.61983, 4.14596], [-51.79599, 3.89336], [-51.82312, 3.85825], [-51.85573, 3.83427], [-52.31787, 3.17896], [-52.6906, 2.37298], [-52.96539, 2.1881], [-53.78743, 2.34412], [-54.16286, 2.10779], [-54.6084, 2.32856], [-55.01919, 2.564], [-55.71493, 2.40342], [-55.96292, 2.53188], [-56.13054, 2.27723], [-55.92159, 2.05236], [-55.89863, 1.89861], [-55.99278, 1.83137], [-56.47045, 1.95135], [-56.7659, 1.89509], [-57.07092, 1.95304], [-57.09109, 2.01854], [-57.23981, 1.95808], [-57.35073, 1.98327], [-57.55743, 1.69605], [-57.77281, 1.73344], [-57.97336, 1.64566], [-58.01873, 1.51966], [-58.33887, 1.58014], [-58.4858, 1.48399], [-58.53571, 1.29154], [-58.84229, 1.17749], [-58.92072, 1.31293], [-59.25583, 1.40559], [-59.74066, 1.87596], [-59.7264, 2.27497], [-59.91177, 2.36759], [-59.99733, 2.92312], [-59.79769, 3.37162], [-59.86899, 3.57089], [-59.51963, 3.91951], [-59.73353, 4.20399], [-59.69361, 4.34069]]]] } },
28178         { 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]]]] } },
28179         { 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]]]] } },
28180         { 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]]]] } },
28181         { 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]]]] } },
28182         { 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]]]] } },
28183         { 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]]]] } },
28184         { type: "Feature", properties: { iso1A2: "CA", iso1A3: "CAN", iso1N3: "124", wikidata: "Q16", nameEn: "Canada", groups: ["021", "003", "019", "UN"], callingCodes: ["1"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-67.20349, 45.1722], [-67.19603, 45.16771], [-67.15965, 45.16179], [-67.11316, 45.11176], [-67.0216, 44.95333], [-66.96824, 44.90965], [-66.98249, 44.87071], [-66.96824, 44.83078], [-66.93432, 44.82597], [-67.16117, 44.20069], [-61.98255, 37.34815], [-56.27503, 47.39728], [-53.12387, 41.40385], [-46.37635, 57.3249], [-77.52957, 77.23408], [-68.21821, 80.48551], [-49.33696, 84.57952], [-140.97446, 84.39275], [-141.00116, 60.30648], [-140.5227, 60.22077], [-140.45648, 60.30919], [-139.98024, 60.18027], [-139.68991, 60.33693], [-139.05831, 60.35205], [-139.20603, 60.08896], [-139.05365, 59.99655], [-138.71149, 59.90728], [-138.62145, 59.76431], [-137.60623, 59.24465], [-137.4925, 58.89415], [-136.82619, 59.16198], [-136.52365, 59.16752], [-136.47323, 59.46617], [-136.33727, 59.44466], [-136.22381, 59.55526], [-136.31566, 59.59083], [-135.48007, 59.79937], [-135.03069, 59.56208], [-135.00267, 59.28745], [-134.7047, 59.2458], [-134.55699, 59.1297], [-134.48059, 59.13231], [-134.27175, 58.8634], [-133.84645, 58.73543], [-133.38523, 58.42773], [-131.8271, 56.62247], [-130.77769, 56.36185], [-130.33965, 56.10849], [-130.10173, 56.12178], [-130.00093, 56.00325], [-130.00857, 55.91344], [-130.15373, 55.74895], [-129.97513, 55.28029], [-130.08035, 55.21556], [-130.18765, 55.07744], [-130.27203, 54.97174], [-130.44184, 54.85377], [-130.64499, 54.76912], [-130.61931, 54.70835], [-133.92876, 54.62289], [-133.36909, 48.51151], [-125.03842, 48.53282], [-123.50039, 48.21223], [-123.15614, 48.35395], [-123.26565, 48.6959], [-123.0093, 48.76586], [-123.0093, 48.83186], [-123.32163, 49.00419], [-95.15355, 48.9996], [-95.15357, 49.384], [-95.12903, 49.37056], [-95.05825, 49.35311], [-95.01419, 49.35647], [-94.99532, 49.36579], [-94.95681, 49.37035], [-94.85381, 49.32492], [-94.8159, 49.32299], [-94.82487, 49.29483], [-94.77355, 49.11998], [-94.75017, 49.09931], [-94.687, 48.84077], [-94.70087, 48.8339], [-94.70486, 48.82365], [-94.69669, 48.80918], [-94.69335, 48.77883], [-94.58903, 48.71803], [-94.54885, 48.71543], [-94.53826, 48.70216], [-94.44258, 48.69223], [-94.4174, 48.71049], [-94.27153, 48.70232], [-94.25172, 48.68404], [-94.25104, 48.65729], [-94.23215, 48.65202], [-93.85769, 48.63284], [-93.83288, 48.62745], [-93.80676, 48.58232], [-93.80939, 48.52439], [-93.79267, 48.51631], [-93.66382, 48.51845], [-93.47022, 48.54357], [-93.44472, 48.59147], [-93.40693, 48.60948], [-93.39758, 48.60364], [-93.3712, 48.60599], [-93.33946, 48.62787], [-93.25391, 48.64266], [-92.94973, 48.60866], [-92.7287, 48.54005], [-92.6342, 48.54133], [-92.62747, 48.50278], [-92.69927, 48.49573], [-92.71323, 48.46081], [-92.65606, 48.43471], [-92.50712, 48.44921], [-92.45588, 48.40624], [-92.48147, 48.36609], [-92.37185, 48.22259], [-92.27167, 48.25046], [-92.30939, 48.31251], [-92.26662, 48.35651], [-92.202, 48.35252], [-92.14732, 48.36578], [-92.05339, 48.35958], [-91.98929, 48.25409], [-91.86125, 48.21278], [-91.71231, 48.19875], [-91.70451, 48.11805], [-91.55649, 48.10611], [-91.58025, 48.04339], [-91.45829, 48.07454], [-91.43248, 48.04912], [-91.25025, 48.08522], [-91.08016, 48.18096], [-90.87588, 48.2484], [-90.75045, 48.09143], [-90.56444, 48.12184], [-90.56312, 48.09488], [-90.07418, 48.11043], [-89.89974, 47.98109], [-89.77248, 48.02607], [-89.57972, 48.00023], [-89.48837, 48.01412], [-88.37033, 48.30586], [-84.85871, 46.88881], [-84.55635, 46.45974], [-84.47607, 46.45225], [-84.4481, 46.48972], [-84.42101, 46.49853], [-84.34174, 46.50683], [-84.29893, 46.49127], [-84.26351, 46.49508], [-84.2264, 46.53337], [-84.1945, 46.54061], [-84.17723, 46.52753], [-84.12885, 46.53068], [-84.11196, 46.50248], [-84.13451, 46.39218], [-84.11254, 46.32329], [-84.11615, 46.2681], [-84.09756, 46.25512], [-84.1096, 46.23987], [-83.95399, 46.05634], [-83.90453, 46.05922], [-83.83329, 46.12169], [-83.57017, 46.105], [-83.43746, 45.99749], [-83.59589, 45.82131], [-82.48419, 45.30225], [-82.42469, 42.992], [-82.4146, 42.97626], [-82.4253, 42.95423], [-82.45331, 42.93139], [-82.4826, 42.8068], [-82.46613, 42.76615], [-82.51063, 42.66025], [-82.51858, 42.611], [-82.57583, 42.5718], [-82.58873, 42.54984], [-82.64242, 42.55594], [-82.82964, 42.37355], [-83.02253, 42.33045], [-83.07837, 42.30978], [-83.09837, 42.28877], [-83.12724, 42.2376], [-83.14962, 42.04089], [-83.11184, 41.95671], [-82.67862, 41.67615], [-78.93684, 42.82887], [-78.90712, 42.89733], [-78.90905, 42.93022], [-78.93224, 42.95229], [-78.96312, 42.95509], [-78.98126, 42.97], [-79.02074, 42.98444], [-79.02424, 43.01983], [-78.99941, 43.05612], [-79.01055, 43.06659], [-79.07486, 43.07845], [-79.05671, 43.10937], [-79.06881, 43.12029], [-79.0427, 43.13934], [-79.04652, 43.16396], [-79.05384, 43.17418], [-79.05002, 43.20133], [-79.05544, 43.21224], [-79.05512, 43.25375], [-79.06921, 43.26183], [-79.25796, 43.54052], [-76.79706, 43.63099], [-76.43859, 44.09393], [-76.35324, 44.13493], [-76.31222, 44.19894], [-76.244, 44.19643], [-76.1664, 44.23051], [-76.16285, 44.28262], [-76.00018, 44.34896], [-75.95947, 44.34463], [-75.8217, 44.43176], [-75.76813, 44.51537], [-75.41441, 44.76614], [-75.2193, 44.87821], [-75.01363, 44.95608], [-74.99101, 44.98051], [-74.8447, 45.00606], [-74.66689, 45.00646], [-74.32699, 44.99029], [-73.35025, 45.00942], [-71.50067, 45.01357], [-71.48735, 45.07784], [-71.42778, 45.12624], [-71.40364, 45.21382], [-71.44252, 45.2361], [-71.37133, 45.24624], [-71.29371, 45.29996], [-71.22338, 45.25184], [-71.19723, 45.25438], [-71.14568, 45.24128], [-71.08364, 45.30623], [-71.01866, 45.31573], [-71.0107, 45.34819], [-70.95193, 45.33895], [-70.91169, 45.29849], [-70.89864, 45.2398], [-70.84816, 45.22698], [-70.80236, 45.37444], [-70.82638, 45.39828], [-70.78372, 45.43269], [-70.65383, 45.37592], [-70.62518, 45.42286], [-70.72651, 45.49771], [-70.68516, 45.56964], [-70.54019, 45.67291], [-70.38934, 45.73215], [-70.41523, 45.79497], [-70.25976, 45.89675], [-70.24694, 45.95138], [-70.31025, 45.96424], [-70.23855, 46.1453], [-70.29078, 46.18832], [-70.18547, 46.35357], [-70.05812, 46.41768], [-69.99966, 46.69543], [-69.22119, 47.46461], [-69.05148, 47.42012], [-69.05073, 47.30076], [-69.05039, 47.2456], [-68.89222, 47.1807], [-68.70125, 47.24399], [-68.60575, 47.24659], [-68.57914, 47.28431], [-68.38332, 47.28723], [-68.37458, 47.35851], [-68.23244, 47.35712], [-67.94843, 47.1925], [-67.87993, 47.10377], [-67.78578, 47.06473], [-67.78111, 45.9392], [-67.75196, 45.91814], [-67.80961, 45.87531], [-67.75654, 45.82324], [-67.80653, 45.80022], [-67.80705, 45.69528], [-67.6049, 45.60725], [-67.43815, 45.59162], [-67.42144, 45.50584], [-67.50578, 45.48971], [-67.42394, 45.37969], [-67.48201, 45.27351], [-67.34927, 45.122], [-67.29754, 45.14865], [-67.29748, 45.18173], [-67.27039, 45.1934], [-67.22751, 45.16344], [-67.20349, 45.1722]]]] } },
28185         { 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]]]] } },
28186         { 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]]]] } },
28187         { 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]]]] } },
28188         { 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]]]] } },
28189         { type: "Feature", properties: { iso1A2: "CH", iso1A3: "CHE", iso1N3: "756", wikidata: "Q39", nameEn: "Switzerland", groups: ["155", "150", "UN"], callingCodes: ["41"] }, geometry: { type: "MultiPolygon", coordinates: [[[[8.72809, 47.69282], [8.72617, 47.69651], [8.73671, 47.7169], [8.70543, 47.73121], [8.74251, 47.75168], [8.71778, 47.76571], [8.68985, 47.75686], [8.68022, 47.78599], [8.65292, 47.80066], [8.64425, 47.76398], [8.62408, 47.7626], [8.61657, 47.79998], [8.56415, 47.80633], [8.56814, 47.78001], [8.48868, 47.77215], [8.45771, 47.7493], [8.44807, 47.72426], [8.40569, 47.69855], [8.4211, 47.68407], [8.40473, 47.67499], [8.41346, 47.66676], [8.42264, 47.66667], [8.44711, 47.65379], [8.4667, 47.65747], [8.46605, 47.64103], [8.49656, 47.64709], [8.5322, 47.64687], [8.52801, 47.66059], [8.56141, 47.67088], [8.57683, 47.66158], [8.6052, 47.67258], [8.61113, 47.66332], [8.62884, 47.65098], [8.62049, 47.63757], [8.60412, 47.63735], [8.61471, 47.64514], [8.60701, 47.65271], [8.59545, 47.64298], [8.60348, 47.61204], [8.57586, 47.59537], [8.55756, 47.62394], [8.51686, 47.63476], [8.50747, 47.61897], [8.45578, 47.60121], [8.46637, 47.58389], [8.48949, 47.588], [8.49431, 47.58107], [8.43235, 47.56617], [8.39477, 47.57826], [8.38273, 47.56608], [8.35512, 47.57014], [8.32735, 47.57133], [8.30277, 47.58607], [8.29524, 47.5919], [8.29722, 47.60603], [8.2824, 47.61225], [8.26313, 47.6103], [8.25863, 47.61571], [8.23809, 47.61204], [8.22577, 47.60385], [8.22011, 47.6181], [8.20617, 47.62141], [8.19378, 47.61636], [8.1652, 47.5945], [8.14947, 47.59558], [8.13823, 47.59147], [8.13662, 47.58432], [8.11543, 47.5841], [8.10395, 47.57918], [8.10002, 47.56504], [8.08557, 47.55768], [8.06663, 47.56374], [8.04383, 47.55443], [8.02136, 47.55096], [8.00113, 47.55616], [7.97581, 47.55493], [7.95682, 47.55789], [7.94494, 47.54511], [7.91251, 47.55031], [7.90673, 47.57674], [7.88664, 47.58854], [7.84412, 47.5841], [7.81901, 47.58798], [7.79486, 47.55691], [7.75261, 47.54599], [7.71961, 47.54219], [7.69642, 47.53297], [7.68101, 47.53232], [7.6656, 47.53752], [7.66174, 47.54554], [7.65083, 47.54662], [7.63338, 47.56256], [7.67655, 47.56435], [7.68904, 47.57133], [7.67115, 47.5871], [7.68486, 47.59601], [7.69385, 47.60099], [7.68229, 47.59905], [7.67395, 47.59212], [7.64599, 47.59695], [7.64213, 47.5944], [7.64309, 47.59151], [7.61929, 47.57683], [7.60459, 47.57869], [7.60523, 47.58519], [7.58945, 47.59017], [7.58386, 47.57536], [7.56684, 47.57785], [7.56548, 47.57617], [7.55689, 47.57232], [7.55652, 47.56779], [7.53634, 47.55553], [7.52831, 47.55347], [7.51723, 47.54578], [7.50873, 47.54546], [7.49691, 47.53821], [7.50588, 47.52856], [7.51904, 47.53515], [7.53199, 47.5284], [7.5229, 47.51644], [7.49804, 47.51798], [7.51076, 47.49651], [7.47534, 47.47932], [7.43356, 47.49712], [7.42923, 47.48628], [7.4583, 47.47216], [7.4462, 47.46264], [7.43088, 47.45846], [7.40308, 47.43638], [7.35603, 47.43432], [7.33526, 47.44186], [7.24669, 47.4205], [7.17026, 47.44312], [7.19583, 47.49455], [7.16249, 47.49025], [7.12781, 47.50371], [7.07425, 47.48863], [7.0231, 47.50522], [6.98425, 47.49432], [7.0024, 47.45264], [6.93953, 47.43388], [6.93744, 47.40714], [6.88542, 47.37262], [6.87959, 47.35335], [7.03125, 47.36996], [7.0564, 47.35134], [7.05305, 47.33304], [6.94316, 47.28747], [6.95108, 47.26428], [6.9508, 47.24338], [6.8489, 47.15933], [6.76788, 47.1208], [6.68823, 47.06616], [6.71531, 47.0494], [6.43341, 46.92703], [6.46456, 46.88865], [6.43216, 46.80336], [6.45209, 46.77502], [6.38351, 46.73171], [6.27135, 46.68251], [6.11084, 46.57649], [6.1567, 46.54402], [6.07269, 46.46244], [6.08427, 46.44305], [6.06407, 46.41676], [6.09926, 46.40768], [6.15016, 46.3778], [6.15985, 46.37721], [6.16987, 46.36759], [6.15738, 46.3491], [6.13876, 46.33844], [6.1198, 46.31157], [6.11697, 46.29547], [6.1013, 46.28512], [6.11926, 46.2634], [6.12446, 46.25059], [6.10071, 46.23772], [6.08563, 46.24651], [6.07072, 46.24085], [6.0633, 46.24583], [6.05029, 46.23518], [6.04602, 46.23127], [6.03342, 46.2383], [6.02461, 46.23313], [5.97542, 46.21525], [5.96515, 46.19638], [5.99573, 46.18587], [5.98846, 46.17046], [5.98188, 46.17392], [5.97508, 46.15863], [5.9641, 46.14412], [5.95781, 46.12925], [5.97893, 46.13303], [5.9871, 46.14499], [6.01791, 46.14228], [6.03614, 46.13712], [6.04564, 46.14031], [6.05203, 46.15191], [6.07491, 46.14879], [6.09199, 46.15191], [6.09926, 46.14373], [6.13397, 46.1406], [6.15305, 46.15194], [6.18116, 46.16187], [6.18871, 46.16644], [6.18707, 46.17999], [6.19552, 46.18401], [6.19807, 46.18369], [6.20539, 46.19163], [6.21114, 46.1927], [6.21273, 46.19409], [6.21603, 46.19507], [6.21844, 46.19837], [6.22222, 46.19888], [6.22175, 46.20045], [6.23544, 46.20714], [6.23913, 46.20511], [6.24821, 46.20531], [6.26007, 46.21165], [6.27694, 46.21566], [6.29663, 46.22688], [6.31041, 46.24417], [6.29474, 46.26221], [6.26749, 46.24745], [6.24952, 46.26255], [6.23775, 46.27822], [6.25137, 46.29014], [6.24826, 46.30175], [6.21981, 46.31304], [6.25432, 46.3632], [6.53358, 46.45431], [6.82312, 46.42661], [6.8024, 46.39171], [6.77152, 46.34784], [6.86052, 46.28512], [6.78968, 46.14058], [6.89321, 46.12548], [6.87868, 46.03855], [6.93862, 46.06502], [7.00946, 45.9944], [7.04151, 45.92435], [7.10685, 45.85653], [7.56343, 45.97421], [7.85949, 45.91485], [7.9049, 45.99945], [7.98881, 45.99867], [8.02906, 46.10331], [8.11383, 46.11577], [8.16866, 46.17817], [8.08814, 46.26692], [8.31162, 46.38044], [8.30648, 46.41587], [8.42464, 46.46367], [8.46317, 46.43712], [8.45032, 46.26869], [8.62242, 46.12112], [8.75697, 46.10395], [8.80778, 46.10085], [8.85617, 46.0748], [8.79414, 46.00913], [8.78585, 45.98973], [8.79362, 45.99207], [8.8319, 45.9879], [8.85121, 45.97239], [8.86688, 45.96135], [8.88904, 45.95465], [8.93649, 45.86775], [8.94372, 45.86587], [8.93504, 45.86245], [8.91129, 45.8388], [8.94737, 45.84285], [8.9621, 45.83707], [8.99663, 45.83466], [9.00324, 45.82055], [9.0298, 45.82127], [9.03279, 45.82865], [9.03793, 45.83548], [9.03505, 45.83976], [9.04059, 45.8464], [9.04546, 45.84968], [9.06642, 45.8761], [9.09065, 45.89906], [8.99257, 45.9698], [9.01618, 46.04928], [9.24503, 46.23616], [9.29226, 46.32717], [9.25502, 46.43743], [9.28136, 46.49685], [9.36128, 46.5081], [9.40487, 46.46621], [9.45936, 46.50873], [9.46117, 46.37481], [9.57015, 46.2958], [9.71273, 46.29266], [9.73086, 46.35071], [9.95249, 46.38045], [10.07055, 46.21668], [10.14439, 46.22992], [10.17862, 46.25626], [10.10506, 46.3372], [10.165, 46.41051], [10.03715, 46.44479], [10.10307, 46.61003], [10.23674, 46.63484], [10.25309, 46.57432], [10.46136, 46.53164], [10.49375, 46.62049], [10.44686, 46.64162], [10.40475, 46.63671], [10.38659, 46.67847], [10.47197, 46.85698], [10.48376, 46.93891], [10.36933, 47.00212], [10.30031, 46.92093], [10.24128, 46.93147], [10.22675, 46.86942], [10.10715, 46.84296], [9.98058, 46.91434], [9.88266, 46.93343], [9.87935, 47.01337], [9.60717, 47.06091], [9.55721, 47.04762], [9.54041, 47.06495], [9.47548, 47.05257], [9.47139, 47.06402], [9.51362, 47.08505], [9.52089, 47.10019], [9.51044, 47.13727], [9.48774, 47.17402], [9.4891, 47.19346], [9.50318, 47.22153], [9.52406, 47.24959], [9.53116, 47.27029], [9.54773, 47.2809], [9.55857, 47.29919], [9.58513, 47.31334], [9.59978, 47.34671], [9.62476, 47.36639], [9.65427, 47.36824], [9.66243, 47.37136], [9.6711, 47.37824], [9.67445, 47.38429], [9.67334, 47.39191], [9.6629, 47.39591], [9.65136, 47.40504], [9.65043, 47.41937], [9.6446, 47.43233], [9.64483, 47.43842], [9.65863, 47.44847], [9.65728, 47.45383], [9.6423, 47.45599], [9.62475, 47.45685], [9.62158, 47.45858], [9.60841, 47.47178], [9.60484, 47.46358], [9.60205, 47.46165], [9.59482, 47.46305], [9.58208, 47.48344], [9.56312, 47.49495], [9.55125, 47.53629], [9.25619, 47.65939], [9.18203, 47.65598], [9.17593, 47.65399], [9.1755, 47.65584], [9.1705, 47.65513], [9.15181, 47.66904], [9.13845, 47.66389], [9.09891, 47.67801], [9.02093, 47.6868], [8.94093, 47.65596], [8.89946, 47.64769], [8.87625, 47.65441], [8.87383, 47.67045], [8.85065, 47.68209], [8.86989, 47.70504], [8.82002, 47.71458], [8.80663, 47.73821], [8.77309, 47.72059], [8.76965, 47.7075], [8.79966, 47.70222], [8.79511, 47.67462], [8.75856, 47.68969], [8.72809, 47.69282]], [[8.95861, 45.96485], [8.96668, 45.98436], [8.97741, 45.98317], [8.97604, 45.96151], [8.95861, 45.96485]], [[8.70847, 47.68904], [8.68985, 47.69552], [8.66837, 47.68437], [8.65769, 47.68928], [8.67508, 47.6979], [8.66416, 47.71367], [8.70237, 47.71453], [8.71773, 47.69088], [8.70847, 47.68904]]]] } },
28190         { 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]]]] } },
28191         { 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]]]] } },
28192         { 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]]]] } },
28193         { 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]]]] } },
28194         { type: "Feature", properties: { iso1A2: "CN", iso1A3: "CHN", iso1N3: "156", wikidata: "Q148", nameEn: "People's Republic of China" }, geometry: null },
28195         { type: "Feature", properties: { iso1A2: "CO", iso1A3: "COL", iso1N3: "170", wikidata: "Q739", nameEn: "Colombia", groups: ["005", "419", "019", "UN"], callingCodes: ["57"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-71.19849, 12.65801], [-81.58685, 18.0025], [-82.06974, 14.49418], [-82.56142, 11.91792], [-78.79327, 9.93766], [-77.58292, 9.22278], [-77.32389, 8.81247], [-77.45064, 8.49991], [-77.17257, 7.97422], [-77.57185, 7.51147], [-77.72514, 7.72348], [-77.72157, 7.47612], [-77.81426, 7.48319], [-77.89178, 7.22681], [-78.06168, 7.07793], [-82.12561, 4.00341], [-78.87137, 1.47457], [-78.42749, 1.15389], [-77.85677, 0.80197], [-77.7148, 0.85003], [-77.68613, 0.83029], [-77.66416, 0.81604], [-77.67815, 0.73863], [-77.49984, 0.64476], [-77.52001, 0.40782], [-76.89177, 0.24736], [-76.4094, 0.24015], [-76.41215, 0.38228], [-76.23441, 0.42294], [-75.82927, 0.09578], [-75.25764, -0.11943], [-75.18513, -0.0308], [-74.42701, -0.50218], [-74.26675, -0.97229], [-73.65312, -1.26222], [-72.92587, -2.44514], [-71.75223, -2.15058], [-70.94377, -2.23142], [-70.04609, -2.73906], [-70.71396, -3.7921], [-70.52393, -3.87553], [-70.3374, -3.79505], [-69.94708, -4.2431], [-69.43395, -1.42219], [-69.4215, -1.01853], [-69.59796, -0.75136], [-69.603, -0.51947], [-70.03658, -0.19681], [-70.04162, 0.55437], [-69.47696, 0.71065], [-69.20976, 0.57958], [-69.14422, 0.84172], [-69.26017, 1.06856], [-69.82987, 1.07864], [-69.83491, 1.69353], [-69.53746, 1.76408], [-69.38621, 1.70865], [-68.18128, 1.72881], [-68.26699, 1.83463], [-68.18632, 2.00091], [-67.9292, 1.82455], [-67.40488, 2.22258], [-67.299, 1.87494], [-67.15784, 1.80439], [-67.08222, 1.17441], [-66.85795, 1.22998], [-67.21967, 2.35778], [-67.65696, 2.81691], [-67.85862, 2.79173], [-67.85862, 2.86727], [-67.30945, 3.38393], [-67.50067, 3.75812], [-67.62671, 3.74303], [-67.85358, 4.53249], [-67.83341, 5.31104], [-67.59141, 5.5369], [-67.63914, 5.64963], [-67.58558, 5.84537], [-67.43513, 5.98835], [-67.4625, 6.20625], [-67.60654, 6.2891], [-69.41843, 6.1072], [-70.10716, 6.96516], [-70.7596, 7.09799], [-71.03941, 6.98163], [-71.37234, 7.01588], [-71.42212, 7.03854], [-71.44118, 7.02116], [-71.82441, 7.04314], [-72.04895, 7.03837], [-72.19437, 7.37034], [-72.43132, 7.40034], [-72.47415, 7.48928], [-72.45321, 7.57232], [-72.47827, 7.65604], [-72.46763, 7.79518], [-72.44454, 7.86031], [-72.46183, 7.90682], [-72.45806, 7.91141], [-72.47042, 7.92306], [-72.48183, 7.92909], [-72.48801, 7.94329], [-72.47213, 7.96106], [-72.39137, 8.03534], [-72.35163, 8.01163], [-72.36987, 8.19976], [-72.4042, 8.36513], [-72.65474, 8.61428], [-72.77415, 9.10165], [-72.94052, 9.10663], [-73.02119, 9.27584], [-73.36905, 9.16636], [-72.98085, 9.85253], [-72.88002, 10.44309], [-72.4767, 11.1117], [-72.24983, 11.14138], [-71.9675, 11.65536], [-71.3275, 11.85], [-70.92579, 11.96275], [-71.19849, 12.65801]]]] } },
28196         { 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]]]] } },
28197         { 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]]]] } },
28198         { 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]]]] } },
28199         { 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]]]] } },
28200         { 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]]]] } },
28201         { 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]]]] } },
28202         { 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]]]] } },
28203         { 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]]]] } },
28204         { 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]]]] } },
28205         { type: "Feature", properties: { iso1A2: "DE", iso1A3: "DEU", iso1N3: "276", wikidata: "Q183", nameEn: "Germany", groups: ["EU", "155", "150", "UN"], callingCodes: ["49"] }, geometry: { type: "MultiPolygon", coordinates: [[[[8.70847, 47.68904], [8.71773, 47.69088], [8.70237, 47.71453], [8.66416, 47.71367], [8.67508, 47.6979], [8.65769, 47.68928], [8.66837, 47.68437], [8.68985, 47.69552], [8.70847, 47.68904]]], [[[8.72617, 47.69651], [8.72809, 47.69282], [8.75856, 47.68969], [8.79511, 47.67462], [8.79966, 47.70222], [8.76965, 47.7075], [8.77309, 47.72059], [8.80663, 47.73821], [8.82002, 47.71458], [8.86989, 47.70504], [8.85065, 47.68209], [8.87383, 47.67045], [8.87625, 47.65441], [8.89946, 47.64769], [8.94093, 47.65596], [9.02093, 47.6868], [9.09891, 47.67801], [9.13845, 47.66389], [9.15181, 47.66904], [9.1705, 47.65513], [9.1755, 47.65584], [9.17593, 47.65399], [9.18203, 47.65598], [9.25619, 47.65939], [9.55125, 47.53629], [9.72736, 47.53457], [9.76748, 47.5934], [9.80254, 47.59419], [9.82591, 47.58158], [9.8189, 47.54688], [9.87499, 47.52953], [9.87733, 47.54688], [9.92407, 47.53111], [9.96029, 47.53899], [10.00003, 47.48216], [10.03859, 47.48927], [10.07131, 47.45531], [10.09001, 47.46005], [10.1052, 47.4316], [10.06897, 47.40709], [10.09819, 47.35724], [10.11805, 47.37228], [10.16362, 47.36674], [10.17648, 47.38889], [10.2127, 47.38019], [10.22774, 47.38904], [10.23757, 47.37609], [10.19998, 47.32832], [10.2147, 47.31014], [10.17648, 47.29149], [10.17531, 47.27167], [10.23257, 47.27088], [10.33424, 47.30813], [10.39851, 47.37623], [10.4324, 47.38494], [10.4359, 47.41183], [10.47446, 47.43318], [10.46278, 47.47901], [10.44291, 47.48453], [10.4324, 47.50111], [10.44992, 47.5524], [10.43473, 47.58394], [10.47329, 47.58552], [10.48849, 47.54057], [10.56912, 47.53584], [10.60337, 47.56755], [10.63456, 47.5591], [10.68832, 47.55752], [10.6965, 47.54253], [10.7596, 47.53228], [10.77596, 47.51729], [10.88814, 47.53701], [10.91268, 47.51334], [10.86945, 47.5015], [10.87061, 47.4786], [10.90918, 47.48571], [10.93839, 47.48018], [10.92437, 47.46991], [10.98513, 47.42882], [10.97111, 47.41617], [10.97111, 47.39561], [11.11835, 47.39719], [11.12536, 47.41222], [11.20482, 47.43198], [11.25157, 47.43277], [11.22002, 47.3964], [11.27844, 47.39956], [11.29597, 47.42566], [11.33804, 47.44937], [11.4175, 47.44621], [11.38128, 47.47465], [11.4362, 47.51413], [11.52618, 47.50939], [11.58578, 47.52281], [11.58811, 47.55515], [11.60681, 47.57881], [11.63934, 47.59202], [11.84052, 47.58354], [11.85572, 47.60166], [12.0088, 47.62451], [12.02282, 47.61033], [12.05788, 47.61742], [12.13734, 47.60639], [12.17824, 47.61506], [12.18145, 47.61019], [12.17737, 47.60121], [12.18568, 47.6049], [12.20398, 47.60667], [12.20801, 47.61082], [12.19895, 47.64085], [12.18507, 47.65984], [12.18347, 47.66663], [12.16769, 47.68167], [12.16217, 47.70105], [12.18303, 47.70065], [12.22571, 47.71776], [12.2542, 47.7433], [12.26238, 47.73544], [12.24017, 47.69534], [12.26004, 47.67725], [12.27991, 47.68827], [12.336, 47.69534], [12.37222, 47.68433], [12.43883, 47.6977], [12.44117, 47.6741], [12.50076, 47.62293], [12.53816, 47.63553], [12.57438, 47.63238], [12.6071, 47.6741], [12.7357, 47.6787], [12.77777, 47.66689], [12.76492, 47.64485], [12.82101, 47.61493], [12.77427, 47.58025], [12.80699, 47.54477], [12.84672, 47.54556], [12.85256, 47.52741], [12.9624, 47.47452], [12.98344, 47.48716], [12.9998, 47.46267], [13.04537, 47.49426], [13.03252, 47.53373], [13.05355, 47.56291], [13.04537, 47.58183], [13.06641, 47.58577], [13.06407, 47.60075], [13.09562, 47.63304], [13.07692, 47.68814], [13.01382, 47.72116], [12.98578, 47.7078], [12.92969, 47.71094], [12.91333, 47.7178], [12.90274, 47.72513], [12.91711, 47.74026], [12.9353, 47.74788], [12.94371, 47.76281], [12.93202, 47.77302], [12.96311, 47.79957], [12.98543, 47.82896], [13.00588, 47.84374], [12.94163, 47.92927], [12.93886, 47.94046], [12.93642, 47.94436], [12.93419, 47.94063], [12.92668, 47.93879], [12.91985, 47.94069], [12.9211, 47.95135], [12.91683, 47.95647], [12.87476, 47.96195], [12.8549, 48.01122], [12.76141, 48.07373], [12.74973, 48.10885], [12.7617, 48.12796], [12.78595, 48.12445], [12.80676, 48.14979], [12.82673, 48.15245], [12.8362, 48.15876], [12.836, 48.1647], [12.84475, 48.16556], [12.87126, 48.20318], [12.95306, 48.20629], [13.02083, 48.25689], [13.0851, 48.27711], [13.126, 48.27867], [13.18093, 48.29577], [13.26039, 48.29422], [13.30897, 48.31575], [13.40709, 48.37292], [13.43929, 48.43386], [13.42527, 48.45711], [13.45727, 48.51092], [13.43695, 48.55776], [13.45214, 48.56472], [13.46967, 48.55157], [13.50663, 48.57506], [13.50131, 48.58091], [13.51291, 48.59023], [13.57535, 48.55912], [13.59705, 48.57013], [13.62508, 48.55501], [13.65186, 48.55092], [13.66113, 48.53558], [13.72802, 48.51208], [13.74816, 48.53058], [13.7513, 48.5624], [13.76921, 48.55324], [13.80519, 48.58026], [13.80038, 48.59487], [13.82609, 48.62345], [13.81901, 48.6761], [13.81283, 48.68426], [13.81791, 48.69832], [13.79337, 48.71375], [13.81863, 48.73257], [13.82266, 48.75544], [13.84023, 48.76988], [13.8096, 48.77877], [13.78977, 48.83319], [13.76994, 48.83537], [13.73854, 48.88538], [13.67739, 48.87886], [13.61624, 48.9462], [13.58319, 48.96899], [13.50552, 48.97441], [13.50221, 48.93752], [13.40802, 48.98851], [13.39479, 49.04812], [13.28242, 49.1228], [13.23689, 49.11412], [13.20405, 49.12303], [13.17019, 49.14339], [13.17665, 49.16713], [13.05883, 49.26259], [13.02957, 49.27399], [13.03618, 49.30417], [12.94859, 49.34079], [12.88249, 49.35479], [12.88414, 49.33541], [12.78168, 49.34618], [12.75854, 49.3989], [12.71227, 49.42363], [12.669, 49.42935], [12.64121, 49.47628], [12.64782, 49.52565], [12.60155, 49.52887], [12.56188, 49.6146], [12.53544, 49.61888], [12.52553, 49.68415], [12.4462, 49.70233], [12.40489, 49.76321], [12.46603, 49.78882], [12.48256, 49.83575], [12.55197, 49.92094], [12.47264, 49.94222], [12.49908, 49.97305], [12.30798, 50.05719], [12.26111, 50.06331], [12.27433, 50.0771], [12.23709, 50.10213], [12.2073, 50.10315], [12.1917, 50.13434], [12.21484, 50.16399], [12.19335, 50.19997], [12.09287, 50.25032], [12.13716, 50.27396], [12.10907, 50.32041], [12.18013, 50.32146], [12.20823, 50.2729], [12.25119, 50.27079], [12.26953, 50.25189], [12.24791, 50.25525], [12.23943, 50.24594], [12.28755, 50.22429], [12.28063, 50.19544], [12.29232, 50.17524], [12.32596, 50.17146], [12.33847, 50.19432], [12.32445, 50.20442], [12.33263, 50.24367], [12.35425, 50.23993], [12.36594, 50.28289], [12.40158, 50.29521], [12.39924, 50.32302], [12.43371, 50.32506], [12.43722, 50.33774], [12.46643, 50.35527], [12.48256, 50.34784], [12.49214, 50.35228], [12.48747, 50.37278], [12.51356, 50.39694], [12.67261, 50.41949], [12.70731, 50.39948], [12.73044, 50.42268], [12.73476, 50.43237], [12.82465, 50.45738], [12.94058, 50.40944], [12.98433, 50.42016], [13.02147, 50.44763], [13.02038, 50.4734], [13.0312, 50.50944], [13.08301, 50.50132], [13.13424, 50.51709], [13.19043, 50.50237], [13.25158, 50.59268], [13.29454, 50.57904], [13.32594, 50.58009], [13.32264, 50.60317], [13.37805, 50.627], [13.37485, 50.64931], [13.42189, 50.61243], [13.46413, 50.60102], [13.49742, 50.63133], [13.5226, 50.64721], [13.53748, 50.67654], [13.52474, 50.70394], [13.65977, 50.73096], [13.70204, 50.71771], [13.76316, 50.73487], [13.82942, 50.7251], [13.89444, 50.74142], [13.89113, 50.78533], [13.98864, 50.8177], [14.02982, 50.80662], [14.22331, 50.86049], [14.24314, 50.88761], [14.27123, 50.89386], [14.30098, 50.88448], [14.38691, 50.89907], [14.39848, 50.93866], [14.31422, 50.95243], [14.30251, 50.96606], [14.32793, 50.97379], [14.32353, 50.98556], [14.28776, 50.97718], [14.25665, 50.98935], [14.30098, 51.05515], [14.41335, 51.02086], [14.45827, 51.03712], [14.49202, 51.02286], [14.49154, 51.04382], [14.49991, 51.04692], [14.50809, 51.0427], [14.49873, 51.02242], [14.53321, 51.01679], [14.53438, 51.00374], [14.56432, 51.01008], [14.58215, 50.99306], [14.59908, 50.98685], [14.59702, 50.96148], [14.56374, 50.922], [14.58024, 50.91443], [14.64802, 50.93241], [14.65259, 50.90513], [14.63434, 50.8883], [14.61993, 50.86049], [14.70661, 50.84096], [14.79139, 50.81438], [14.82803, 50.86966], [14.81664, 50.88148], [14.89681, 50.9422], [14.89252, 50.94999], [14.92942, 50.99744], [14.95529, 51.04552], [14.97938, 51.07742], [14.98229, 51.11354], [14.99689, 51.12205], [14.99079, 51.14284], [14.99646, 51.14365], [15.00083, 51.14974], [14.99414, 51.15813], [14.99311, 51.16249], [15.0047, 51.16874], [15.01242, 51.21285], [15.04288, 51.28387], [14.98008, 51.33449], [14.96899, 51.38367], [14.9652, 51.44793], [14.94749, 51.47155], [14.73219, 51.52922], [14.72652, 51.53902], [14.73047, 51.54606], [14.71125, 51.56209], [14.7727, 51.61263], [14.75759, 51.62318], [14.75392, 51.67445], [14.69065, 51.70842], [14.66386, 51.73282], [14.64625, 51.79472], [14.60493, 51.80473], [14.59089, 51.83302], [14.6588, 51.88359], [14.6933, 51.9044], [14.70601, 51.92944], [14.7177, 51.94048], [14.72163, 51.95188], [14.71836, 51.95606], [14.7139, 51.95643], [14.70488, 51.97679], [14.71339, 52.00337], [14.76026, 52.06624], [14.72971, 52.09167], [14.6917, 52.10283], [14.67683, 52.13936], [14.70616, 52.16927], [14.68344, 52.19612], [14.71319, 52.22144], [14.70139, 52.25038], [14.58149, 52.28007], [14.56378, 52.33838], [14.55228, 52.35264], [14.54423, 52.42568], [14.63056, 52.48993], [14.60081, 52.53116], [14.6289, 52.57136], [14.61073, 52.59847], [14.22071, 52.81175], [14.13806, 52.82392], [14.12256, 52.84311], [14.15873, 52.87715], [14.14056, 52.95786], [14.25954, 53.00264], [14.35044, 53.05829], [14.38679, 53.13669], [14.36696, 53.16444], [14.37853, 53.20405], [14.40662, 53.21098], [14.45125, 53.26241], [14.44133, 53.27427], [14.4215, 53.27724], [14.35209, 53.49506], [14.3273, 53.50587], [14.30416, 53.55499], [14.31904, 53.61581], [14.2853, 53.63392], [14.28477, 53.65955], [14.27133, 53.66613], [14.2836, 53.67721], [14.26782, 53.69866], [14.27249, 53.74464], [14.21323, 53.8664], [14.20823, 53.90776], [14.18544, 53.91258], [14.20647, 53.91671], [14.22634, 53.9291], [14.20811, 54.12784], [13.93395, 54.84044], [12.85844, 54.82438], [11.90309, 54.38543], [11.00303, 54.63689], [10.31111, 54.65968], [10.16755, 54.73883], [9.89314, 54.84171], [9.73563, 54.8247], [9.61187, 54.85548], [9.62734, 54.88057], [9.58937, 54.88785], [9.4659, 54.83131], [9.43155, 54.82586], [9.41213, 54.84254], [9.38532, 54.83968], [9.36496, 54.81749], [9.33849, 54.80233], [9.32771, 54.80602], [9.2474, 54.8112], [9.23445, 54.83432], [9.24631, 54.84726], [9.20571, 54.85841], [9.14275, 54.87421], [9.04629, 54.87249], [8.92795, 54.90452], [8.81178, 54.90518], [8.76387, 54.8948], [8.63979, 54.91069], [8.55769, 54.91837], [8.45719, 55.06747], [8.02459, 55.09613], [5.45168, 54.20039], [6.91025, 53.44221], [7.00198, 53.32672], [7.19052, 53.31866], [7.21679, 53.20058], [7.22681, 53.18165], [7.17898, 53.13817], [7.21694, 53.00742], [7.07253, 52.81083], [7.04557, 52.63318], [6.77307, 52.65375], [6.71641, 52.62905], [6.69507, 52.488], [6.94293, 52.43597], [6.99041, 52.47235], [7.03417, 52.40237], [7.07044, 52.37805], [7.02703, 52.27941], [7.06365, 52.23789], [7.03729, 52.22695], [6.9897, 52.2271], [6.97189, 52.20329], [6.83984, 52.11728], [6.76117, 52.11895], [6.68128, 52.05052], [6.83035, 51.9905], [6.82357, 51.96711], [6.72319, 51.89518], [6.68386, 51.91861], [6.58556, 51.89386], [6.50231, 51.86313], [6.47179, 51.85395], [6.38815, 51.87257], [6.40704, 51.82771], [6.30593, 51.84998], [6.29872, 51.86801], [6.21443, 51.86801], [6.15349, 51.90439], [6.11551, 51.89769], [6.16902, 51.84094], [6.10337, 51.84829], [6.06705, 51.86136], [5.99848, 51.83195], [5.94568, 51.82786], [5.98665, 51.76944], [5.95003, 51.7493], [6.04091, 51.71821], [6.02767, 51.6742], [6.11759, 51.65609], [6.09055, 51.60564], [6.18017, 51.54096], [6.21724, 51.48568], [6.20654, 51.40049], [6.22641, 51.39948], [6.22674, 51.36135], [6.16977, 51.33169], [6.07889, 51.24432], [6.07889, 51.17038], [6.17384, 51.19589], [6.16706, 51.15677], [5.98292, 51.07469], [5.9541, 51.03496], [5.9134, 51.06736], [5.86735, 51.05182], [5.87849, 51.01969], [5.90493, 51.00198], [5.90296, 50.97356], [5.95282, 50.98728], [6.02697, 50.98303], [6.01615, 50.93367], [6.09297, 50.92066], [6.07486, 50.89307], [6.08805, 50.87223], [6.07693, 50.86025], [6.07431, 50.84674], [6.05702, 50.85179], [6.05623, 50.8572], [6.01921, 50.84435], [6.02328, 50.81694], [6.00462, 50.80065], [5.98404, 50.80988], [5.97497, 50.79992], [6.02624, 50.77453], [6.01976, 50.75398], [6.03889, 50.74618], [6.0326, 50.72647], [6.0406, 50.71848], [6.04428, 50.72861], [6.11707, 50.72231], [6.17852, 50.6245], [6.26957, 50.62444], [6.2476, 50.60392], [6.24888, 50.59869], [6.24005, 50.58732], [6.22581, 50.5907], [6.20281, 50.56952], [6.17739, 50.55875], [6.17802, 50.54179], [6.19735, 50.53576], [6.19579, 50.5313], [6.18716, 50.52653], [6.19193, 50.5212], [6.20599, 50.52089], [6.22335, 50.49578], [6.26637, 50.50272], [6.30809, 50.50058], [6.3465, 50.48833], [6.34005, 50.46083], [6.37219, 50.45397], [6.36852, 50.40776], [6.34406, 50.37994], [6.3688, 50.35898], [6.40785, 50.33557], [6.40641, 50.32425], [6.35701, 50.31139], [6.32488, 50.32333], [6.29949, 50.30887], [6.28797, 50.27458], [6.208, 50.25179], [6.16853, 50.2234], [6.18364, 50.20815], [6.18739, 50.1822], [6.14588, 50.17106], [6.14132, 50.14971], [6.15298, 50.14126], [6.1379, 50.12964], [6.12055, 50.09171], [6.11274, 50.05916], [6.13458, 50.04141], [6.13044, 50.02929], [6.14666, 50.02207], [6.13794, 50.01466], [6.13273, 50.02019], [6.1295, 50.01849], [6.13806, 50.01056], [6.14948, 50.00908], [6.14147, 49.99563], [6.1701, 49.98518], [6.16466, 49.97086], [6.17872, 49.9537], [6.18554, 49.95622], [6.18045, 49.96611], [6.19089, 49.96991], [6.19856, 49.95053], [6.22094, 49.94955], [6.22608, 49.929], [6.21882, 49.92403], [6.22926, 49.92096], [6.23496, 49.89972], [6.26146, 49.88203], [6.28874, 49.87592], [6.29692, 49.86685], [6.30963, 49.87021], [6.32303, 49.85133], [6.32098, 49.83728], [6.33585, 49.83785], [6.34267, 49.84974], [6.36576, 49.85032], [6.40022, 49.82029], [6.42521, 49.81591], [6.42905, 49.81091], [6.44131, 49.81443], [6.45425, 49.81164], [6.47111, 49.82263], [6.48718, 49.81267], [6.50647, 49.80916], [6.51215, 49.80124], [6.52121, 49.81338], [6.53122, 49.80666], [6.52169, 49.79787], [6.50534, 49.78952], [6.51669, 49.78336], [6.51056, 49.77515], [6.51828, 49.76855], [6.51646, 49.75961], [6.50174, 49.75292], [6.50193, 49.73291], [6.51805, 49.72425], [6.51397, 49.72058], [6.50261, 49.72718], [6.49535, 49.72645], [6.49694, 49.72205], [6.5042, 49.71808], [6.50647, 49.71353], [6.49785, 49.71118], [6.48014, 49.69767], [6.46048, 49.69092], [6.44654, 49.67799], [6.42937, 49.66857], [6.42726, 49.66078], [6.43768, 49.66021], [6.4413, 49.65722], [6.41861, 49.61723], [6.39822, 49.60081], [6.385, 49.59946], [6.37464, 49.58886], [6.38342, 49.5799], [6.38024, 49.57593], [6.36676, 49.57813], [6.35825, 49.57053], [6.38228, 49.55855], [6.38072, 49.55171], [6.35666, 49.52931], [6.36788, 49.50377], [6.36907, 49.48931], [6.36778, 49.46937], [6.38352, 49.46463], [6.39168, 49.4667], [6.40274, 49.46546], [6.42432, 49.47683], [6.55404, 49.42464], [6.533, 49.40748], [6.60091, 49.36864], [6.58807, 49.35358], [6.572, 49.35027], [6.60186, 49.31055], [6.66583, 49.28065], [6.69274, 49.21661], [6.71843, 49.2208], [6.73256, 49.20486], [6.71137, 49.18808], [6.73765, 49.16375], [6.78265, 49.16793], [6.83385, 49.15162], [6.84703, 49.15734], [6.86225, 49.18185], [6.85016, 49.19354], [6.85119, 49.20038], [6.83555, 49.21249], [6.85939, 49.22376], [6.89298, 49.20863], [6.91875, 49.22261], [6.93831, 49.2223], [6.94028, 49.21641], [6.95963, 49.203], [6.97273, 49.2099], [7.01318, 49.19018], [7.03459, 49.19096], [7.0274, 49.17042], [7.03178, 49.15734], [7.04662, 49.13724], [7.04409, 49.12123], [7.04843, 49.11422], [7.05548, 49.11185], [7.06642, 49.11415], [7.07162, 49.1255], [7.09007, 49.13094], [7.07859, 49.15031], [7.10715, 49.15631], [7.10384, 49.13787], [7.12504, 49.14253], [7.1358, 49.1282], [7.1593, 49.1204], [7.23473, 49.12971], [7.29514, 49.11426], [7.3195, 49.14231], [7.35995, 49.14399], [7.3662, 49.17308], [7.44052, 49.18354], [7.44455, 49.16765], [7.49473, 49.17], [7.49172, 49.13915], [7.53012, 49.09818], [7.56416, 49.08136], [7.62575, 49.07654], [7.63618, 49.05428], [7.75948, 49.04562], [7.79557, 49.06583], [7.86386, 49.03499], [7.93641, 49.05544], [7.97783, 49.03161], [8.14189, 48.97833], [8.22604, 48.97352], [8.20031, 48.95856], [8.19989, 48.95825], [8.12813, 48.87985], [8.10253, 48.81829], [8.06802, 48.78957], [8.0326, 48.79017], [8.01534, 48.76085], [7.96994, 48.75606], [7.96812, 48.72491], [7.89002, 48.66317], [7.84098, 48.64217], [7.80057, 48.5857], [7.80167, 48.54758], [7.80647, 48.51239], [7.76833, 48.48945], [7.73109, 48.39192], [7.74562, 48.32736], [7.69022, 48.30018], [7.6648, 48.22219], [7.57137, 48.12292], [7.56966, 48.03265], [7.62302, 47.97898], [7.55673, 47.87371], [7.52921, 47.77747], [7.54761, 47.72912], [7.53722, 47.71635], [7.51266, 47.70197], [7.51915, 47.68335], [7.52067, 47.66437], [7.53384, 47.65115], [7.5591, 47.63849], [7.57423, 47.61628], [7.58851, 47.60794], [7.59301, 47.60058], [7.58945, 47.59017], [7.60523, 47.58519], [7.60459, 47.57869], [7.61929, 47.57683], [7.64309, 47.59151], [7.64213, 47.5944], [7.64599, 47.59695], [7.67395, 47.59212], [7.68229, 47.59905], [7.69385, 47.60099], [7.68486, 47.59601], [7.67115, 47.5871], [7.68904, 47.57133], [7.67655, 47.56435], [7.63338, 47.56256], [7.65083, 47.54662], [7.66174, 47.54554], [7.6656, 47.53752], [7.68101, 47.53232], [7.69642, 47.53297], [7.71961, 47.54219], [7.75261, 47.54599], [7.79486, 47.55691], [7.81901, 47.58798], [7.84412, 47.5841], [7.88664, 47.58854], [7.90673, 47.57674], [7.91251, 47.55031], [7.94494, 47.54511], [7.95682, 47.55789], [7.97581, 47.55493], [8.00113, 47.55616], [8.02136, 47.55096], [8.04383, 47.55443], [8.06663, 47.56374], [8.08557, 47.55768], [8.10002, 47.56504], [8.10395, 47.57918], [8.11543, 47.5841], [8.13662, 47.58432], [8.13823, 47.59147], [8.14947, 47.59558], [8.1652, 47.5945], [8.19378, 47.61636], [8.20617, 47.62141], [8.22011, 47.6181], [8.22577, 47.60385], [8.23809, 47.61204], [8.25863, 47.61571], [8.26313, 47.6103], [8.2824, 47.61225], [8.29722, 47.60603], [8.29524, 47.5919], [8.30277, 47.58607], [8.32735, 47.57133], [8.35512, 47.57014], [8.38273, 47.56608], [8.39477, 47.57826], [8.43235, 47.56617], [8.49431, 47.58107], [8.48949, 47.588], [8.46637, 47.58389], [8.45578, 47.60121], [8.50747, 47.61897], [8.51686, 47.63476], [8.55756, 47.62394], [8.57586, 47.59537], [8.60348, 47.61204], [8.59545, 47.64298], [8.60701, 47.65271], [8.61471, 47.64514], [8.60412, 47.63735], [8.62049, 47.63757], [8.62884, 47.65098], [8.61113, 47.66332], [8.6052, 47.67258], [8.57683, 47.66158], [8.56141, 47.67088], [8.52801, 47.66059], [8.5322, 47.64687], [8.49656, 47.64709], [8.46605, 47.64103], [8.4667, 47.65747], [8.44711, 47.65379], [8.42264, 47.66667], [8.41346, 47.66676], [8.40473, 47.67499], [8.4211, 47.68407], [8.40569, 47.69855], [8.44807, 47.72426], [8.45771, 47.7493], [8.48868, 47.77215], [8.56814, 47.78001], [8.56415, 47.80633], [8.61657, 47.79998], [8.62408, 47.7626], [8.64425, 47.76398], [8.65292, 47.80066], [8.68022, 47.78599], [8.68985, 47.75686], [8.71778, 47.76571], [8.74251, 47.75168], [8.70543, 47.73121], [8.73671, 47.7169], [8.72617, 47.69651]]]] } },
28206         { 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]]]] } },
28207         { 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]]]] } },
28208         { type: "Feature", properties: { iso1A2: "DK", iso1A3: "DNK", iso1N3: "208", wikidata: "Q756617", nameEn: "Kingdom of Denmark" }, geometry: null },
28209         { 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]]]] } },
28210         { 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]]]] } },
28211         { 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]]]] } },
28212         { type: "Feature", properties: { iso1A2: "EA", wikidata: "Q28868874", nameEn: "Ceuta, Melilla", country: "ES", level: "territory", isoStatus: "excRes" }, geometry: null },
28213         { type: "Feature", properties: { iso1A2: "EC", iso1A3: "ECU", iso1N3: "218", wikidata: "Q736", nameEn: "Ecuador" }, geometry: null },
28214         { 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]]]] } },
28215         { 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]]]] } },
28216         { 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]]]] } },
28217         { 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]]]] } },
28218         { type: "Feature", properties: { iso1A2: "ES", iso1A3: "ESP", iso1N3: "724", wikidata: "Q29", nameEn: "Spain" }, geometry: null },
28219         { 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]]]] } },
28220         { type: "Feature", properties: { iso1A2: "EU", iso1A3: "EUE", wikidata: "Q458", nameEn: "European Union", level: "union", isoStatus: "excRes" }, geometry: null },
28221         { type: "Feature", properties: { iso1A2: "FI", iso1A3: "FIN", iso1N3: "246", wikidata: "Q33", nameEn: "Finland", aliases: ["SF"] }, geometry: null },
28222         { 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]]]] } },
28223         { 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]]]] } },
28224         { 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]]]] } },
28225         { 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]]]] } },
28226         { type: "Feature", properties: { iso1A2: "FR", iso1A3: "FRA", iso1N3: "250", wikidata: "Q142", nameEn: "France" }, geometry: null },
28227         { type: "Feature", properties: { iso1A2: "FX", iso1A3: "FXX", iso1N3: "249", wikidata: "Q212429", nameEn: "Metropolitan France", country: "FR", groups: ["EU", "155", "150", "UN"], isoStatus: "excRes", callingCodes: ["33"] }, geometry: { type: "MultiPolygon", coordinates: [[[[2.55904, 51.07014], [2.18458, 51.52087], [1.17405, 50.74239], [-2.02963, 49.91866], [-2.09454, 49.46288], [-1.83944, 49.23037], [-2.00491, 48.86706], [-2.65349, 49.15373], [-6.28985, 48.93406], [-1.81005, 43.59738], [-1.77289, 43.38957], [-1.79319, 43.37497], [-1.78332, 43.36399], [-1.78714, 43.35476], [-1.77068, 43.34396], [-1.75334, 43.34107], [-1.75079, 43.3317], [-1.7397, 43.32979], [-1.73074, 43.29481], [-1.69407, 43.31378], [-1.62481, 43.30726], [-1.63052, 43.28591], [-1.61341, 43.25269], [-1.57674, 43.25269], [-1.55963, 43.28828], [-1.50992, 43.29481], [-1.45289, 43.27049], [-1.40942, 43.27272], [-1.3758, 43.24511], [-1.41562, 43.12815], [-1.47555, 43.08372], [-1.44067, 43.047], [-1.35272, 43.02658], [-1.34419, 43.09665], [-1.32209, 43.1127], [-1.27118, 43.11961], [-1.30052, 43.09581], [-1.30531, 43.06859], [-1.25244, 43.04164], [-1.22881, 43.05534], [-1.10333, 43.0059], [-1.00963, 42.99279], [-0.97133, 42.96239], [-0.81652, 42.95166], [-0.75478, 42.96916], [-0.72037, 42.92541], [-0.73422, 42.91228], [-0.72608, 42.89318], [-0.69837, 42.87945], [-0.67637, 42.88303], [-0.55497, 42.77846], [-0.50863, 42.82713], [-0.44334, 42.79939], [-0.41319, 42.80776], [-0.38833, 42.80132], [-0.3122, 42.84788], [-0.17939, 42.78974], [-0.16141, 42.79535], [-0.10519, 42.72761], [-0.02468, 42.68513], [0.17569, 42.73424], [0.25336, 42.7174], [0.29407, 42.67431], [0.36251, 42.72282], [0.40214, 42.69779], [0.67873, 42.69458], [0.65421, 42.75872], [0.66121, 42.84021], [0.711, 42.86372], [0.93089, 42.79154], [0.96166, 42.80629], [0.98292, 42.78754], [1.0804, 42.78569], [1.15928, 42.71407], [1.35562, 42.71944], [1.44197, 42.60217], [1.47986, 42.61346], [1.46718, 42.63296], [1.48043, 42.65203], [1.50867, 42.64483], [1.55418, 42.65669], [1.60085, 42.62703], [1.63485, 42.62957], [1.6625, 42.61982], [1.68267, 42.62533], [1.73452, 42.61515], [1.72588, 42.59098], [1.7858, 42.57698], [1.73683, 42.55492], [1.72515, 42.50338], [1.76335, 42.48863], [1.83037, 42.48395], [1.88853, 42.4501], [1.93663, 42.45439], [1.94292, 42.44316], [1.94061, 42.43333], [1.94084, 42.43039], [1.9574, 42.42401], [1.96482, 42.37787], [2.00488, 42.35399], [2.06241, 42.35906], [2.11621, 42.38393], [2.12789, 42.41291], [2.16599, 42.42314], [2.20578, 42.41633], [2.25551, 42.43757], [2.38504, 42.39977], [2.43299, 42.39423], [2.43508, 42.37568], [2.48457, 42.33933], [2.54382, 42.33406], [2.55516, 42.35351], [2.57934, 42.35808], [2.6747, 42.33974], [2.65311, 42.38771], [2.72056, 42.42298], [2.75497, 42.42578], [2.77464, 42.41046], [2.84335, 42.45724], [2.85675, 42.45444], [2.86983, 42.46843], [2.88413, 42.45938], [2.92107, 42.4573], [2.94283, 42.48174], [2.96518, 42.46692], [3.03734, 42.47363], [3.08167, 42.42748], [3.10027, 42.42621], [3.11379, 42.43646], [3.17156, 42.43545], [3.75438, 42.33445], [7.60802, 41.05927], [10.09675, 41.44089], [9.56115, 43.20816], [7.50102, 43.51859], [7.42422, 43.72209], [7.40903, 43.7296], [7.41113, 43.73156], [7.41291, 43.73168], [7.41298, 43.73311], [7.41233, 43.73439], [7.42062, 43.73977], [7.42299, 43.74176], [7.42443, 43.74087], [7.42809, 43.74396], [7.43013, 43.74895], [7.43624, 43.75014], [7.43708, 43.75197], [7.4389, 43.75151], [7.4379, 43.74963], [7.47823, 43.73341], [7.53006, 43.78405], [7.50423, 43.84345], [7.49355, 43.86551], [7.51162, 43.88301], [7.56075, 43.89932], [7.56858, 43.94506], [7.60771, 43.95772], [7.65266, 43.9763], [7.66848, 43.99943], [7.6597, 44.03009], [7.72508, 44.07578], [7.66878, 44.12795], [7.68694, 44.17487], [7.63245, 44.17877], [7.62155, 44.14881], [7.36364, 44.11882], [7.34547, 44.14359], [7.27827, 44.1462], [7.16929, 44.20352], [7.00764, 44.23736], [6.98221, 44.28289], [6.89171, 44.36637], [6.88784, 44.42043], [6.94504, 44.43112], [6.86233, 44.49834], [6.85507, 44.53072], [6.96042, 44.62129], [6.95133, 44.66264], [7.00582, 44.69364], [7.07484, 44.68073], [7.00401, 44.78782], [7.02217, 44.82519], [6.93499, 44.8664], [6.90774, 44.84322], [6.75518, 44.89915], [6.74519, 44.93661], [6.74791, 45.01939], [6.66981, 45.02324], [6.62803, 45.11175], [6.7697, 45.16044], [6.85144, 45.13226], [6.96706, 45.20841], [7.07074, 45.21228], [7.13115, 45.25386], [7.10572, 45.32924], [7.18019, 45.40071], [7.00037, 45.509], [6.98948, 45.63869], [6.80785, 45.71864], [6.80785, 45.83265], [6.95315, 45.85163], [7.04151, 45.92435], [7.00946, 45.9944], [6.93862, 46.06502], [6.87868, 46.03855], [6.89321, 46.12548], [6.78968, 46.14058], [6.86052, 46.28512], [6.77152, 46.34784], [6.8024, 46.39171], [6.82312, 46.42661], [6.53358, 46.45431], [6.25432, 46.3632], [6.21981, 46.31304], [6.24826, 46.30175], [6.25137, 46.29014], [6.23775, 46.27822], [6.24952, 46.26255], [6.26749, 46.24745], [6.29474, 46.26221], [6.31041, 46.24417], [6.29663, 46.22688], [6.27694, 46.21566], [6.26007, 46.21165], [6.24821, 46.20531], [6.23913, 46.20511], [6.23544, 46.20714], [6.22175, 46.20045], [6.22222, 46.19888], [6.21844, 46.19837], [6.21603, 46.19507], [6.21273, 46.19409], [6.21114, 46.1927], [6.20539, 46.19163], [6.19807, 46.18369], [6.19552, 46.18401], [6.18707, 46.17999], [6.18871, 46.16644], [6.18116, 46.16187], [6.15305, 46.15194], [6.13397, 46.1406], [6.09926, 46.14373], [6.09199, 46.15191], [6.07491, 46.14879], [6.05203, 46.15191], [6.04564, 46.14031], [6.03614, 46.13712], [6.01791, 46.14228], [5.9871, 46.14499], [5.97893, 46.13303], [5.95781, 46.12925], [5.9641, 46.14412], [5.97508, 46.15863], [5.98188, 46.17392], [5.98846, 46.17046], [5.99573, 46.18587], [5.96515, 46.19638], [5.97542, 46.21525], [6.02461, 46.23313], [6.03342, 46.2383], [6.04602, 46.23127], [6.05029, 46.23518], [6.0633, 46.24583], [6.07072, 46.24085], [6.08563, 46.24651], [6.10071, 46.23772], [6.12446, 46.25059], [6.11926, 46.2634], [6.1013, 46.28512], [6.11697, 46.29547], [6.1198, 46.31157], [6.13876, 46.33844], [6.15738, 46.3491], [6.16987, 46.36759], [6.15985, 46.37721], [6.15016, 46.3778], [6.09926, 46.40768], [6.06407, 46.41676], [6.08427, 46.44305], [6.07269, 46.46244], [6.1567, 46.54402], [6.11084, 46.57649], [6.27135, 46.68251], [6.38351, 46.73171], [6.45209, 46.77502], [6.43216, 46.80336], [6.46456, 46.88865], [6.43341, 46.92703], [6.71531, 47.0494], [6.68823, 47.06616], [6.76788, 47.1208], [6.8489, 47.15933], [6.9508, 47.24338], [6.95108, 47.26428], [6.94316, 47.28747], [7.05305, 47.33304], [7.0564, 47.35134], [7.03125, 47.36996], [6.87959, 47.35335], [6.88542, 47.37262], [6.93744, 47.40714], [6.93953, 47.43388], [7.0024, 47.45264], [6.98425, 47.49432], [7.0231, 47.50522], [7.07425, 47.48863], [7.12781, 47.50371], [7.16249, 47.49025], [7.19583, 47.49455], [7.17026, 47.44312], [7.24669, 47.4205], [7.33526, 47.44186], [7.35603, 47.43432], [7.40308, 47.43638], [7.43088, 47.45846], [7.4462, 47.46264], [7.4583, 47.47216], [7.42923, 47.48628], [7.43356, 47.49712], [7.47534, 47.47932], [7.51076, 47.49651], [7.49804, 47.51798], [7.5229, 47.51644], [7.53199, 47.5284], [7.51904, 47.53515], [7.50588, 47.52856], [7.49691, 47.53821], [7.50873, 47.54546], [7.51723, 47.54578], [7.52831, 47.55347], [7.53634, 47.55553], [7.55652, 47.56779], [7.55689, 47.57232], [7.56548, 47.57617], [7.56684, 47.57785], [7.58386, 47.57536], [7.58945, 47.59017], [7.59301, 47.60058], [7.58851, 47.60794], [7.57423, 47.61628], [7.5591, 47.63849], [7.53384, 47.65115], [7.52067, 47.66437], [7.51915, 47.68335], [7.51266, 47.70197], [7.53722, 47.71635], [7.54761, 47.72912], [7.52921, 47.77747], [7.55673, 47.87371], [7.62302, 47.97898], [7.56966, 48.03265], [7.57137, 48.12292], [7.6648, 48.22219], [7.69022, 48.30018], [7.74562, 48.32736], [7.73109, 48.39192], [7.76833, 48.48945], [7.80647, 48.51239], [7.80167, 48.54758], [7.80057, 48.5857], [7.84098, 48.64217], [7.89002, 48.66317], [7.96812, 48.72491], [7.96994, 48.75606], [8.01534, 48.76085], [8.0326, 48.79017], [8.06802, 48.78957], [8.10253, 48.81829], [8.12813, 48.87985], [8.19989, 48.95825], [8.20031, 48.95856], [8.22604, 48.97352], [8.14189, 48.97833], [7.97783, 49.03161], [7.93641, 49.05544], [7.86386, 49.03499], [7.79557, 49.06583], [7.75948, 49.04562], [7.63618, 49.05428], [7.62575, 49.07654], [7.56416, 49.08136], [7.53012, 49.09818], [7.49172, 49.13915], [7.49473, 49.17], [7.44455, 49.16765], [7.44052, 49.18354], [7.3662, 49.17308], [7.35995, 49.14399], [7.3195, 49.14231], [7.29514, 49.11426], [7.23473, 49.12971], [7.1593, 49.1204], [7.1358, 49.1282], [7.12504, 49.14253], [7.10384, 49.13787], [7.10715, 49.15631], [7.07859, 49.15031], [7.09007, 49.13094], [7.07162, 49.1255], [7.06642, 49.11415], [7.05548, 49.11185], [7.04843, 49.11422], [7.04409, 49.12123], [7.04662, 49.13724], [7.03178, 49.15734], [7.0274, 49.17042], [7.03459, 49.19096], [7.01318, 49.19018], [6.97273, 49.2099], [6.95963, 49.203], [6.94028, 49.21641], [6.93831, 49.2223], [6.91875, 49.22261], [6.89298, 49.20863], [6.85939, 49.22376], [6.83555, 49.21249], [6.85119, 49.20038], [6.85016, 49.19354], [6.86225, 49.18185], [6.84703, 49.15734], [6.83385, 49.15162], [6.78265, 49.16793], [6.73765, 49.16375], [6.71137, 49.18808], [6.73256, 49.20486], [6.71843, 49.2208], [6.69274, 49.21661], [6.66583, 49.28065], [6.60186, 49.31055], [6.572, 49.35027], [6.58807, 49.35358], [6.60091, 49.36864], [6.533, 49.40748], [6.55404, 49.42464], [6.42432, 49.47683], [6.40274, 49.46546], [6.39168, 49.4667], [6.38352, 49.46463], [6.36778, 49.46937], [6.3687, 49.4593], [6.28818, 49.48465], [6.27875, 49.503], [6.25029, 49.50609], [6.2409, 49.51408], [6.19543, 49.50536], [6.17386, 49.50934], [6.15366, 49.50226], [6.16115, 49.49297], [6.14321, 49.48796], [6.12814, 49.49365], [6.12346, 49.4735], [6.10325, 49.4707], [6.09845, 49.46351], [6.10072, 49.45268], [6.08373, 49.45594], [6.07887, 49.46399], [6.05553, 49.46663], [6.04176, 49.44801], [6.02743, 49.44845], [6.02648, 49.45451], [5.97693, 49.45513], [5.96876, 49.49053], [5.94224, 49.49608], [5.94128, 49.50034], [5.86571, 49.50015], [5.83389, 49.52152], [5.83467, 49.52717], [5.84466, 49.53027], [5.83648, 49.5425], [5.81664, 49.53775], [5.80871, 49.5425], [5.81838, 49.54777], [5.79195, 49.55228], [5.77435, 49.56298], [5.7577, 49.55915], [5.75649, 49.54321], [5.64505, 49.55146], [5.60909, 49.51228], [5.55001, 49.52729], [5.46541, 49.49825], [5.46734, 49.52648], [5.43713, 49.5707], [5.3974, 49.61596], [5.34837, 49.62889], [5.33851, 49.61599], [5.3137, 49.61225], [5.30214, 49.63055], [5.33039, 49.6555], [5.31465, 49.66846], [5.26232, 49.69456], [5.14545, 49.70287], [5.09249, 49.76193], [4.96714, 49.79872], [4.85464, 49.78995], [4.86965, 49.82271], [4.85134, 49.86457], [4.88529, 49.9236], [4.78827, 49.95609], [4.8382, 50.06738], [4.88602, 50.15182], [4.83279, 50.15331], [4.82438, 50.16878], [4.75237, 50.11314], [4.70064, 50.09384], [4.68695, 49.99685], [4.5414, 49.96911], [4.51098, 49.94659], [4.43488, 49.94122], [4.35051, 49.95315], [4.31963, 49.97043], [4.20532, 49.95803], [4.14239, 49.98034], [4.13508, 50.01976], [4.16294, 50.04719], [4.23101, 50.06945], [4.20147, 50.13535], [4.13561, 50.13078], [4.16014, 50.19239], [4.15524, 50.21103], [4.21945, 50.25539], [4.20651, 50.27333], [4.17861, 50.27443], [4.17347, 50.28838], [4.15524, 50.2833], [4.16808, 50.25786], [4.13665, 50.25609], [4.11954, 50.30425], [4.10957, 50.30234], [4.10237, 50.31247], [4.0689, 50.3254], [4.0268, 50.35793], [3.96771, 50.34989], [3.90781, 50.32814], [3.84314, 50.35219], [3.73911, 50.34809], [3.70987, 50.3191], [3.71009, 50.30305], [3.66976, 50.34563], [3.65709, 50.36873], [3.67262, 50.38663], [3.67494, 50.40239], [3.66153, 50.45165], [3.64426, 50.46275], [3.61014, 50.49568], [3.58361, 50.49049], [3.5683, 50.50192], [3.49509, 50.48885], [3.51564, 50.5256], [3.47385, 50.53397], [3.44629, 50.51009], [3.37693, 50.49538], [3.28575, 50.52724], [3.2729, 50.60718], [3.23951, 50.6585], [3.264, 50.67668], [3.2536, 50.68977], [3.26141, 50.69151], [3.26063, 50.70086], [3.24593, 50.71389], [3.22042, 50.71019], [3.20845, 50.71662], [3.19017, 50.72569], [3.20064, 50.73547], [3.18811, 50.74025], [3.18339, 50.74981], [3.16476, 50.76843], [3.15017, 50.79031], [3.1257, 50.78603], [3.11987, 50.79188], [3.11206, 50.79416], [3.10614, 50.78303], [3.09163, 50.77717], [3.04314, 50.77674], [3.00537, 50.76588], [2.96778, 50.75242], [2.95019, 50.75138], [2.90873, 50.702], [2.91036, 50.6939], [2.90069, 50.69263], [2.88504, 50.70656], [2.87937, 50.70298], [2.86985, 50.7033], [2.8483, 50.72276], [2.81056, 50.71773], [2.71165, 50.81295], [2.63331, 50.81457], [2.59093, 50.91751], [2.63074, 50.94746], [2.57551, 51.00326], [2.55904, 51.07014]], [[1.99838, 42.44682], [1.98378, 42.44697], [1.96125, 42.45364], [1.95606, 42.45785], [1.96215, 42.47854], [1.97003, 42.48081], [1.97227, 42.48487], [1.97697, 42.48568], [1.98022, 42.49569], [1.98916, 42.49351], [1.99766, 42.4858], [1.98579, 42.47486], [1.99216, 42.46208], [2.01564, 42.45171], [1.99838, 42.44682]]]] } },
28228         { 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]]]] } },
28229         { type: "Feature", properties: { iso1A2: "GB", iso1A3: "GBR", iso1N3: "826", wikidata: "Q145", ccTLD: ".uk", nameEn: "United Kingdom", aliases: ["UK"] }, geometry: null },
28230         { 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]]]] } },
28231         { 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]]]] } },
28232         { 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]]]] } },
28233         { type: "Feature", properties: { iso1A2: "GG", iso1A3: "GGY", iso1N3: "831", wikidata: "Q25230", nameEn: "Bailiwick of Guernsey", country: "GB" }, geometry: null },
28234         { 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]]]] } },
28235         { 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]]]] } },
28236         { 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]]]] } },
28237         { 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]]]] } },
28238         { 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]]]] } },
28239         { 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]]]] } },
28240         { 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]]]] } },
28241         { 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]]]] } },
28242         { 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]]]] } },
28243         { 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]]]] } },
28244         { 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]]]] } },
28245         { 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]]]] } },
28246         { type: "Feature", properties: { iso1A2: "GY", iso1A3: "GUY", iso1N3: "328", wikidata: "Q734", nameEn: "Guyana", groups: ["005", "419", "019", "UN"], driveSide: "left", callingCodes: ["592"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-56.84822, 6.73257], [-59.54058, 8.6862], [-59.98508, 8.53046], [-59.85562, 8.35213], [-59.80661, 8.28906], [-59.83156, 8.23261], [-59.97059, 8.20791], [-60.02407, 8.04557], [-60.38056, 7.8302], [-60.51959, 7.83373], [-60.64793, 7.56877], [-60.71923, 7.55817], [-60.59802, 7.33194], [-60.63367, 7.25061], [-60.54098, 7.14804], [-60.44116, 7.20817], [-60.28074, 7.1162], [-60.39419, 6.94847], [-60.54873, 6.8631], [-61.13632, 6.70922], [-61.20762, 6.58174], [-61.15058, 6.19558], [-61.4041, 5.95304], [-60.73204, 5.20931], [-60.32352, 5.21299], [-60.20944, 5.28754], [-59.98129, 5.07097], [-60.04189, 4.69801], [-60.15953, 4.53456], [-59.78878, 4.45637], [-59.69361, 4.34069], [-59.73353, 4.20399], [-59.51963, 3.91951], [-59.86899, 3.57089], [-59.79769, 3.37162], [-59.99733, 2.92312], [-59.91177, 2.36759], [-59.7264, 2.27497], [-59.74066, 1.87596], [-59.25583, 1.40559], [-58.92072, 1.31293], [-58.84229, 1.17749], [-58.53571, 1.29154], [-58.4858, 1.48399], [-58.33887, 1.58014], [-58.01873, 1.51966], [-57.97336, 1.64566], [-57.77281, 1.73344], [-57.55743, 1.69605], [-57.35073, 1.98327], [-57.23981, 1.95808], [-57.09109, 2.01854], [-57.07092, 1.95304], [-56.7659, 1.89509], [-56.47045, 1.95135], [-56.55439, 2.02003], [-56.70519, 2.02964], [-57.35891, 3.32121], [-58.0307, 3.95513], [-57.8699, 4.89394], [-57.37442, 5.0208], [-57.22536, 5.15605], [-57.31629, 5.33714], [-56.84822, 6.73257]]]] } },
28247         { 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]]]] } },
28248         { 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]]]] } },
28249         { 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]]]] } },
28250         { 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]]]] } },
28251         { 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]]]] } },
28252         { type: "Feature", properties: { iso1A2: "HU", iso1A3: "HUN", iso1N3: "348", wikidata: "Q28", nameEn: "Hungary", groups: ["EU", "151", "150", "UN"], callingCodes: ["36"] }, geometry: { type: "MultiPolygon", coordinates: [[[[21.72525, 48.34628], [21.67134, 48.3989], [21.6068, 48.50365], [21.44063, 48.58456], [21.11516, 48.49546], [20.83248, 48.5824], [20.5215, 48.53336], [20.29943, 48.26104], [20.24312, 48.2784], [19.92452, 48.1283], [19.63338, 48.25006], [19.52489, 48.19791], [19.47957, 48.09437], [19.28182, 48.08336], [19.23924, 48.0595], [19.01952, 48.07052], [18.82176, 48.04206], [18.76134, 47.97499], [18.76821, 47.87469], [18.8506, 47.82308], [18.74074, 47.8157], [18.66521, 47.76772], [18.56496, 47.76588], [18.29305, 47.73541], [18.02938, 47.75665], [17.71215, 47.7548], [17.23699, 48.02094], [17.16001, 48.00636], [17.09786, 47.97336], [17.11022, 47.92461], [17.08275, 47.87719], [17.00997, 47.86245], [17.07039, 47.81129], [17.05048, 47.79377], [17.08893, 47.70928], [16.87538, 47.68895], [16.86509, 47.72268], [16.82938, 47.68432], [16.7511, 47.67878], [16.72089, 47.73469], [16.65679, 47.74197], [16.61183, 47.76171], [16.54779, 47.75074], [16.53514, 47.73837], [16.55129, 47.72268], [16.4222, 47.66537], [16.58699, 47.61772], [16.64193, 47.63114], [16.71059, 47.52692], [16.64821, 47.50155], [16.6718, 47.46139], [16.57152, 47.40868], [16.52414, 47.41007], [16.49908, 47.39416], [16.45104, 47.41181], [16.47782, 47.25918], [16.44142, 47.25079], [16.43663, 47.21127], [16.41739, 47.20649], [16.42801, 47.18422], [16.4523, 47.18812], [16.46442, 47.16845], [16.44932, 47.14418], [16.52863, 47.13974], [16.46134, 47.09395], [16.52176, 47.05747], [16.43936, 47.03548], [16.51369, 47.00084], [16.28202, 47.00159], [16.27594, 46.9643], [16.22403, 46.939], [16.19904, 46.94134], [16.10983, 46.867], [16.14365, 46.8547], [16.15711, 46.85434], [16.21892, 46.86961], [16.2365, 46.87775], [16.2941, 46.87137], [16.34547, 46.83836], [16.3408, 46.80641], [16.31303, 46.79838], [16.30966, 46.7787], [16.37816, 46.69975], [16.42641, 46.69228], [16.41863, 46.66238], [16.38594, 46.6549], [16.39217, 46.63673], [16.50139, 46.56684], [16.52885, 46.53303], [16.52604, 46.5051], [16.59527, 46.47524], [16.6639, 46.45203], [16.7154, 46.39523], [16.8541, 46.36255], [16.8903, 46.28122], [17.14592, 46.16697], [17.35672, 45.95209], [17.56821, 45.93728], [17.66545, 45.84207], [17.87377, 45.78522], [17.99805, 45.79671], [18.08869, 45.76511], [18.12439, 45.78905], [18.44368, 45.73972], [18.57483, 45.80772], [18.6792, 45.92057], [18.80211, 45.87995], [18.81394, 45.91329], [18.99712, 45.93537], [19.01284, 45.96529], [19.0791, 45.96458], [19.10388, 46.04015], [19.14543, 45.9998], [19.28826, 45.99694], [19.52473, 46.1171], [19.56113, 46.16824], [19.66007, 46.19005], [19.81491, 46.1313], [19.93508, 46.17553], [20.01816, 46.17696], [20.03533, 46.14509], [20.09713, 46.17315], [20.26068, 46.12332], [20.28324, 46.1438], [20.35573, 46.16629], [20.45377, 46.14405], [20.49718, 46.18721], [20.63863, 46.12728], [20.76085, 46.21002], [20.74574, 46.25467], [20.86797, 46.28884], [21.06572, 46.24897], [21.16872, 46.30118], [21.28061, 46.44941], [21.26929, 46.4993], [21.33214, 46.63035], [21.43926, 46.65109], [21.5151, 46.72147], [21.48935, 46.7577], [21.52028, 46.84118], [21.59307, 46.86935], [21.59581, 46.91628], [21.68645, 46.99595], [21.648, 47.03902], [21.78395, 47.11104], [21.94463, 47.38046], [22.01055, 47.37767], [22.03389, 47.42508], [22.00917, 47.50492], [22.31816, 47.76126], [22.41979, 47.7391], [22.46559, 47.76583], [22.67247, 47.7871], [22.76617, 47.8417], [22.77991, 47.87211], [22.89849, 47.95851], [22.84276, 47.98602], [22.87847, 48.04665], [22.81804, 48.11363], [22.73427, 48.12005], [22.66835, 48.09162], [22.58733, 48.10813], [22.59007, 48.15121], [22.49806, 48.25189], [22.38133, 48.23726], [22.2083, 48.42534], [22.14689, 48.4005], [21.83339, 48.36242], [21.8279, 48.33321], [21.72525, 48.34628]]]] } },
28253         { 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]]]] } },
28254         { type: "Feature", properties: { iso1A2: "ID", iso1A3: "IDN", iso1N3: "360", wikidata: "Q252", nameEn: "Indonesia", aliases: ["RI"] }, geometry: null },
28255         { 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]]]] } },
28256         { 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]]]] } },
28257         { 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]]]] } },
28258         { type: "Feature", properties: { iso1A2: "IN", iso1A3: "IND", iso1N3: "356", wikidata: "Q668", nameEn: "India" }, geometry: null },
28259         { type: "Feature", properties: { iso1A2: "IO", iso1A3: "IOT", iso1N3: "086", wikidata: "Q43448", nameEn: "British Indian Ocean Territory", country: "GB" }, geometry: null },
28260         { 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]]]] } },
28261         { 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]]]] } },
28262         { 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]]]] } },
28263         { type: "Feature", properties: { iso1A2: "IT", iso1A3: "ITA", iso1N3: "380", wikidata: "Q38", nameEn: "Italy", groups: ["EU", "039", "150", "UN"], callingCodes: ["39"] }, geometry: { type: "MultiPolygon", coordinates: [[[[8.95861, 45.96485], [8.97604, 45.96151], [8.97741, 45.98317], [8.96668, 45.98436], [8.95861, 45.96485]]], [[[7.63035, 43.57419], [9.56115, 43.20816], [10.09675, 41.44089], [7.60802, 41.05927], [7.89009, 38.19924], [11.2718, 37.6713], [12.13667, 34.20326], [14.02721, 36.53141], [17.67657, 35.68918], [18.83516, 40.36999], [16.15283, 42.18525], [13.12821, 44.48877], [13.05142, 45.33128], [13.45644, 45.59464], [13.6076, 45.64761], [13.7198, 45.59352], [13.74587, 45.59811], [13.78445, 45.5825], [13.84106, 45.58185], [13.86771, 45.59898], [13.8695, 45.60835], [13.9191, 45.6322], [13.87933, 45.65207], [13.83422, 45.68703], [13.83332, 45.70855], [13.8235, 45.7176], [13.66986, 45.79955], [13.59784, 45.8072], [13.58858, 45.83503], [13.57563, 45.8425], [13.58644, 45.88173], [13.59565, 45.89446], [13.60857, 45.89907], [13.61931, 45.91782], [13.63815, 45.93607], [13.6329, 45.94894], [13.64307, 45.98326], [13.63458, 45.98947], [13.62074, 45.98388], [13.58903, 45.99009], [13.56759, 45.96991], [13.52963, 45.96588], [13.50104, 45.98078], [13.47474, 46.00546], [13.49702, 46.01832], [13.50998, 46.04498], [13.49568, 46.04839], [13.50104, 46.05986], [13.57072, 46.09022], [13.64053, 46.13587], [13.66472, 46.17392], [13.64451, 46.18966], [13.56682, 46.18703], [13.56114, 46.2054], [13.47587, 46.22725], [13.42218, 46.20758], [13.37671, 46.29668], [13.44808, 46.33507], [13.43418, 46.35992], [13.47019, 46.3621], [13.5763, 46.40915], [13.5763, 46.42613], [13.59777, 46.44137], [13.68684, 46.43881], [13.7148, 46.5222], [13.64088, 46.53438], [13.27627, 46.56059], [12.94445, 46.60401], [12.59992, 46.6595], [12.38708, 46.71529], [12.27591, 46.88651], [12.2006, 46.88854], [12.11675, 47.01241], [12.21781, 47.03996], [12.19254, 47.09331], [11.74789, 46.98484], [11.50739, 47.00644], [11.33355, 46.99862], [11.10618, 46.92966], [11.00764, 46.76896], [10.72974, 46.78972], [10.75753, 46.82258], [10.66405, 46.87614], [10.54783, 46.84505], [10.47197, 46.85698], [10.38659, 46.67847], [10.40475, 46.63671], [10.44686, 46.64162], [10.49375, 46.62049], [10.46136, 46.53164], [10.25309, 46.57432], [10.23674, 46.63484], [10.10307, 46.61003], [10.03715, 46.44479], [10.165, 46.41051], [10.10506, 46.3372], [10.17862, 46.25626], [10.14439, 46.22992], [10.07055, 46.21668], [9.95249, 46.38045], [9.73086, 46.35071], [9.71273, 46.29266], [9.57015, 46.2958], [9.46117, 46.37481], [9.45936, 46.50873], [9.40487, 46.46621], [9.36128, 46.5081], [9.28136, 46.49685], [9.25502, 46.43743], [9.29226, 46.32717], [9.24503, 46.23616], [9.01618, 46.04928], [8.99257, 45.9698], [9.09065, 45.89906], [9.06642, 45.8761], [9.04546, 45.84968], [9.04059, 45.8464], [9.03505, 45.83976], [9.03793, 45.83548], [9.03279, 45.82865], [9.0298, 45.82127], [9.00324, 45.82055], [8.99663, 45.83466], [8.9621, 45.83707], [8.94737, 45.84285], [8.91129, 45.8388], [8.93504, 45.86245], [8.94372, 45.86587], [8.93649, 45.86775], [8.88904, 45.95465], [8.86688, 45.96135], [8.85121, 45.97239], [8.8319, 45.9879], [8.79362, 45.99207], [8.78585, 45.98973], [8.79414, 46.00913], [8.85617, 46.0748], [8.80778, 46.10085], [8.75697, 46.10395], [8.62242, 46.12112], [8.45032, 46.26869], [8.46317, 46.43712], [8.42464, 46.46367], [8.30648, 46.41587], [8.31162, 46.38044], [8.08814, 46.26692], [8.16866, 46.17817], [8.11383, 46.11577], [8.02906, 46.10331], [7.98881, 45.99867], [7.9049, 45.99945], [7.85949, 45.91485], [7.56343, 45.97421], [7.10685, 45.85653], [7.04151, 45.92435], [6.95315, 45.85163], [6.80785, 45.83265], [6.80785, 45.71864], [6.98948, 45.63869], [7.00037, 45.509], [7.18019, 45.40071], [7.10572, 45.32924], [7.13115, 45.25386], [7.07074, 45.21228], [6.96706, 45.20841], [6.85144, 45.13226], [6.7697, 45.16044], [6.62803, 45.11175], [6.66981, 45.02324], [6.74791, 45.01939], [6.74519, 44.93661], [6.75518, 44.89915], [6.90774, 44.84322], [6.93499, 44.8664], [7.02217, 44.82519], [7.00401, 44.78782], [7.07484, 44.68073], [7.00582, 44.69364], [6.95133, 44.66264], [6.96042, 44.62129], [6.85507, 44.53072], [6.86233, 44.49834], [6.94504, 44.43112], [6.88784, 44.42043], [6.89171, 44.36637], [6.98221, 44.28289], [7.00764, 44.23736], [7.16929, 44.20352], [7.27827, 44.1462], [7.34547, 44.14359], [7.36364, 44.11882], [7.62155, 44.14881], [7.63245, 44.17877], [7.68694, 44.17487], [7.66878, 44.12795], [7.72508, 44.07578], [7.6597, 44.03009], [7.66848, 43.99943], [7.65266, 43.9763], [7.60771, 43.95772], [7.56858, 43.94506], [7.56075, 43.89932], [7.51162, 43.88301], [7.49355, 43.86551], [7.50423, 43.84345], [7.53006, 43.78405], [7.63035, 43.57419]], [[12.45181, 41.90056], [12.44834, 41.90095], [12.44582, 41.90194], [12.44815, 41.90326], [12.44984, 41.90545], [12.45091, 41.90625], [12.45543, 41.90738], [12.45561, 41.90629], [12.45762, 41.9058], [12.45755, 41.9033], [12.45826, 41.90281], [12.45834, 41.90174], [12.4577, 41.90115], [12.45691, 41.90125], [12.45626, 41.90172], [12.45435, 41.90143], [12.45446, 41.90028], [12.45181, 41.90056]], [[12.45648, 43.89369], [12.44184, 43.90498], [12.41641, 43.89991], [12.40935, 43.9024], [12.41233, 43.90956], [12.40733, 43.92379], [12.41551, 43.92984], [12.41165, 43.93769], [12.40506, 43.94325], [12.40415, 43.95485], [12.41414, 43.95273], [12.42005, 43.9578], [12.43662, 43.95698], [12.44684, 43.96597], [12.46205, 43.97463], [12.47853, 43.98052], [12.49406, 43.98492], [12.50678, 43.99113], [12.51463, 43.99122], [12.5154, 43.98508], [12.51064, 43.98165], [12.51109, 43.97201], [12.50622, 43.97131], [12.50875, 43.96198], [12.50655, 43.95796], [12.51427, 43.94897], [12.51553, 43.94096], [12.50496, 43.93017], [12.50269, 43.92363], [12.49724, 43.92248], [12.49247, 43.91774], [12.49429, 43.90973], [12.48771, 43.89706], [12.45648, 43.89369]]]] } },
28264         { 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]]]] } },
28265         { 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]]]] } },
28266         { 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]]]] } },
28267         { 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]]]] } },
28268         { 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]]]] } },
28269         { 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]]]] } },
28270         { 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]]]] } },
28271         { 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]]]] } },
28272         { 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]]]] } },
28273         { 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]]]] } },
28274         { 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]]]] } },
28275         { 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]]]] } },
28276         { 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]]]] } },
28277         { 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]]]] } },
28278         { 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]]]] } },
28279         { 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]]]] } },
28280         { 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]]]] } },
28281         { 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]]]] } },
28282         { 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]]]] } },
28283         { 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]]]] } },
28284         { 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]]]] } },
28285         { 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]]]] } },
28286         { 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]]]] } },
28287         { 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]]]] } },
28288         { 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]]]] } },
28289         { 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]]]] } },
28290         { 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]]]] } },
28291         { 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]]]] } },
28292         { 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]]]] } },
28293         { 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]]]] } },
28294         { 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]]]] } },
28295         { 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]]]] } },
28296         { 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]]]] } },
28297         { 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]]]] } },
28298         { 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]]]] } },
28299         { 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]]]] } },
28300         { 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]]]] } },
28301         { 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]]]] } },
28302         { 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]]]] } },
28303         { 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]]]] } },
28304         { 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]]]] } },
28305         { 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]]]] } },
28306         { 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]]]] } },
28307         { 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]]]] } },
28308         { 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]]]] } },
28309         { 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]]]] } },
28310         { 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]]]] } },
28311         { type: "Feature", properties: { iso1A2: "MY", iso1A3: "MYS", iso1N3: "458", wikidata: "Q833", nameEn: "Malaysia" }, geometry: null },
28312         { 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]]]] } },
28313         { 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]]]] } },
28314         { 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]]]] } },
28315         { 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]]]] } },
28316         { 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]]]] } },
28317         { 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]]]] } },
28318         { 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]]]] } },
28319         { type: "Feature", properties: { iso1A2: "NL", iso1A3: "NLD", iso1N3: "528", wikidata: "Q29999", nameEn: "Kingdom of the Netherlands" }, geometry: null },
28320         { type: "Feature", properties: { iso1A2: "NO", iso1A3: "NOR", iso1N3: "578", wikidata: "Q20", nameEn: "Norway" }, geometry: null },
28321         { 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]]]] } },
28322         { 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]]]] } },
28323         { 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]]]] } },
28324         { type: "Feature", properties: { iso1A2: "NZ", iso1A3: "NZL", iso1N3: "554", wikidata: "Q664", nameEn: "New Zealand" }, geometry: null },
28325         { 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]]]] } },
28326         { 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]]]] } },
28327         { type: "Feature", properties: { iso1A2: "PE", iso1A3: "PER", iso1N3: "604", wikidata: "Q419", nameEn: "Peru", groups: ["005", "419", "019", "UN"], callingCodes: ["51"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-74.26675, -0.97229], [-74.42701, -0.50218], [-75.18513, -0.0308], [-75.25764, -0.11943], [-75.40192, -0.17196], [-75.61997, -0.10012], [-75.60169, -0.18708], [-75.53615, -0.19213], [-75.22862, -0.60048], [-75.22862, -0.95588], [-75.3872, -0.9374], [-75.57429, -1.55961], [-76.05203, -2.12179], [-76.6324, -2.58397], [-77.94147, -3.05454], [-78.19369, -3.36431], [-78.14324, -3.47653], [-78.22642, -3.51113], [-78.24589, -3.39907], [-78.34362, -3.38633], [-78.68394, -4.60754], [-78.85149, -4.66795], [-79.01659, -5.01481], [-79.1162, -4.97774], [-79.26248, -4.95167], [-79.59402, -4.46848], [-79.79722, -4.47558], [-80.13945, -4.29786], [-80.39256, -4.48269], [-80.46386, -4.41516], [-80.32114, -4.21323], [-80.45023, -4.20938], [-80.4822, -4.05477], [-80.46386, -4.01342], [-80.13232, -3.90317], [-80.19926, -3.68894], [-80.18741, -3.63994], [-80.19848, -3.59249], [-80.21642, -3.5888], [-80.20535, -3.51667], [-80.22629, -3.501], [-80.23651, -3.48652], [-80.24586, -3.48677], [-80.24123, -3.46124], [-80.20647, -3.431], [-80.30602, -3.39149], [-84.52388, -3.36941], [-85.71054, -21.15413], [-70.59118, -18.35072], [-70.378, -18.3495], [-70.31267, -18.31258], [-70.16394, -18.31737], [-69.96732, -18.25992], [-69.81607, -18.12582], [-69.75305, -17.94605], [-69.82868, -17.72048], [-69.79087, -17.65563], [-69.66483, -17.65083], [-69.46897, -17.4988], [-69.46863, -17.37466], [-69.62883, -17.28142], [-69.16896, -16.72233], [-69.00853, -16.66769], [-69.04027, -16.57214], [-68.98358, -16.42165], [-68.79464, -16.33272], [-68.96238, -16.194], [-69.09986, -16.22693], [-69.20291, -16.16668], [-69.40336, -15.61358], [-69.14856, -15.23478], [-69.36254, -14.94634], [-68.88135, -14.18639], [-69.05265, -13.68546], [-68.8864, -13.40792], [-68.85615, -12.87769], [-68.65044, -12.50689], [-68.98115, -11.8979], [-69.57156, -10.94555], [-69.57835, -10.94051], [-69.90896, -10.92744], [-70.38791, -11.07096], [-70.51395, -10.92249], [-70.64134, -11.0108], [-70.62487, -9.80666], [-70.55429, -9.76692], [-70.58453, -9.58303], [-70.53373, -9.42628], [-71.23394, -9.9668], [-72.14742, -9.98049], [-72.31883, -9.5184], [-72.72216, -9.41397], [-73.21498, -9.40904], [-72.92886, -9.04074], [-73.76576, -7.89884], [-73.65485, -7.77897], [-73.96938, -7.58465], [-73.77011, -7.28944], [-73.73986, -6.87919], [-73.12983, -6.43852], [-73.24579, -6.05764], [-72.83973, -5.14765], [-72.64391, -5.0391], [-71.87003, -4.51661], [-70.96814, -4.36915], [-70.77601, -4.15717], [-70.33236, -4.15214], [-70.19582, -4.3607], [-70.11305, -4.27281], [-70.00888, -4.37833], [-69.94708, -4.2431], [-70.3374, -3.79505], [-70.52393, -3.87553], [-70.71396, -3.7921], [-70.04609, -2.73906], [-70.94377, -2.23142], [-71.75223, -2.15058], [-72.92587, -2.44514], [-73.65312, -1.26222], [-74.26675, -0.97229]]]] } },
28328         { 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]]]] } },
28329         { 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]]]] } },
28330         { type: "Feature", properties: { iso1A2: "PH", iso1A3: "PHL", iso1N3: "608", wikidata: "Q928", nameEn: "Philippines", aliases: ["PI", "RP"], groups: ["035", "142", "UN"], callingCodes: ["63"] }, geometry: { type: "MultiPolygon", coordinates: [[[[129.19694, 7.84182], [121.8109, 21.77688], [120.69238, 21.52331], [118.82252, 14.67191], [115.39742, 10.92666], [116.79524, 7.43869], [117.17735, 7.52841], [117.93857, 6.89845], [117.98544, 6.27477], [119.52945, 5.35672], [118.93936, 4.09009], [118.06469, 4.16638], [121.14448, 2.12444], [129.19694, 7.84182]]]] } },
28331         { 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]]]] } },
28332         { 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]]]] } },
28333         { 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]]]] } },
28334         { 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]]]] } },
28335         { 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]]]] } },
28336         { type: "Feature", properties: { iso1A2: "PS", iso1A3: "PSE", iso1N3: "275", wikidata: "Q219060", nameEn: "Palestine" }, geometry: null },
28337         { type: "Feature", properties: { iso1A2: "PT", iso1A3: "PRT", iso1N3: "620", wikidata: "Q45", nameEn: "Portugal" }, geometry: null },
28338         { 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]]]] } },
28339         { type: "Feature", properties: { iso1A2: "PY", iso1A3: "PRY", iso1N3: "600", wikidata: "Q733", nameEn: "Paraguay", groups: ["005", "419", "019", "UN"], callingCodes: ["595"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-58.16225, -20.16193], [-58.23216, -19.80058], [-59.06965, -19.29148], [-60.00638, -19.2981], [-61.73723, -19.63958], [-61.93912, -20.10053], [-62.26883, -20.55311], [-62.2757, -21.06657], [-62.64455, -22.25091], [-62.51761, -22.37684], [-62.22768, -22.55807], [-61.9756, -23.0507], [-61.0782, -23.62932], [-60.99754, -23.80934], [-60.28163, -24.04436], [-60.03367, -24.00701], [-59.45482, -24.34787], [-59.33886, -24.49935], [-58.33055, -24.97099], [-58.25492, -24.92528], [-57.80821, -25.13863], [-57.57431, -25.47269], [-57.87176, -25.93604], [-58.1188, -26.16704], [-58.3198, -26.83443], [-58.65321, -27.14028], [-58.59549, -27.29973], [-58.04205, -27.2387], [-56.85337, -27.5165], [-56.18313, -27.29851], [-55.89195, -27.3467], [-55.74475, -27.44485], [-55.59094, -27.32444], [-55.62322, -27.1941], [-55.39611, -26.97679], [-55.25243, -26.93808], [-55.16948, -26.96068], [-55.06351, -26.80195], [-55.00584, -26.78754], [-54.80868, -26.55669], [-54.70732, -26.45099], [-54.69333, -26.37705], [-54.67359, -25.98607], [-54.60664, -25.9691], [-54.62063, -25.91213], [-54.59398, -25.59224], [-54.59509, -25.53696], [-54.60196, -25.48397], [-54.62033, -25.46026], [-54.4423, -25.13381], [-54.28207, -24.07305], [-54.32807, -24.01865], [-54.6238, -23.83078], [-55.02691, -23.97317], [-55.0518, -23.98666], [-55.12292, -23.99669], [-55.41784, -23.9657], [-55.44117, -23.9185], [-55.43585, -23.87157], [-55.5555, -23.28237], [-55.52288, -23.2595], [-55.5446, -23.22811], [-55.63849, -22.95122], [-55.62493, -22.62765], [-55.68742, -22.58407], [-55.6986, -22.56268], [-55.72366, -22.5519], [-55.741, -22.52018], [-55.74941, -22.46436], [-55.8331, -22.29008], [-56.23206, -22.25347], [-56.45893, -22.08072], [-56.5212, -22.11556], [-56.6508, -22.28387], [-57.98625, -22.09157], [-57.94642, -21.73799], [-57.88239, -21.6868], [-57.93492, -21.65505], [-57.84536, -20.93155], [-58.16225, -20.16193]]]] } },
28340         { 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]]]] } },
28341         { 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]]]] } },
28342         { 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]]]] } },
28343         { 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]]]] } },
28344         { type: "Feature", properties: { iso1A2: "RU", iso1A3: "RUS", iso1N3: "643", wikidata: "Q159", nameEn: "Russia" }, geometry: null },
28345         { 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]]]] } },
28346         { 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]]]] } },
28347         { 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]]]] } },
28348         { 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]]]] } },
28349         { 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]]]] } },
28350         { 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]]]] } },
28351         { 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]]]] } },
28352         { type: "Feature", properties: { iso1A2: "SH", iso1A3: "SHN", iso1N3: "654", wikidata: "Q192184", nameEn: "Saint Helena, Ascension and Tristan da Cunha", country: "GB" }, geometry: null },
28353         { type: "Feature", properties: { iso1A2: "SI", iso1A3: "SVN", iso1N3: "705", wikidata: "Q215", nameEn: "Slovenia", groups: ["EU", "039", "150", "UN"], callingCodes: ["386"] }, geometry: { type: "MultiPolygon", coordinates: [[[[16.50139, 46.56684], [16.39217, 46.63673], [16.38594, 46.6549], [16.41863, 46.66238], [16.42641, 46.69228], [16.37816, 46.69975], [16.30966, 46.7787], [16.31303, 46.79838], [16.3408, 46.80641], [16.34547, 46.83836], [16.2941, 46.87137], [16.2365, 46.87775], [16.21892, 46.86961], [16.15711, 46.85434], [16.14365, 46.8547], [16.10983, 46.867], [16.05786, 46.83927], [15.99054, 46.82772], [15.99126, 46.78199], [15.98432, 46.74991], [15.99769, 46.7266], [16.02808, 46.71094], [16.04347, 46.68694], [16.04036, 46.6549], [15.99988, 46.67947], [15.98512, 46.68463], [15.94864, 46.68769], [15.87691, 46.7211], [15.8162, 46.71897], [15.78518, 46.70712], [15.76771, 46.69863], [15.73823, 46.70011], [15.72279, 46.69548], [15.69523, 46.69823], [15.67411, 46.70735], [15.6543, 46.70616], [15.6543, 46.69228], [15.6365, 46.6894], [15.63255, 46.68069], [15.62317, 46.67947], [15.59826, 46.68908], [15.54533, 46.66985], [15.55333, 46.64988], [15.54431, 46.6312], [15.46906, 46.61321], [15.45514, 46.63697], [15.41235, 46.65556], [15.23711, 46.63994], [15.14215, 46.66131], [15.01451, 46.641], [14.98024, 46.6009], [14.96002, 46.63459], [14.92283, 46.60848], [14.87129, 46.61], [14.86419, 46.59411], [14.83549, 46.56614], [14.81836, 46.51046], [14.72185, 46.49974], [14.66892, 46.44936], [14.5942, 46.43434], [14.56463, 46.37208], [14.52176, 46.42617], [14.45877, 46.41717], [14.42608, 46.44614], [14.314, 46.43327], [14.28326, 46.44315], [14.15989, 46.43327], [14.12097, 46.47724], [14.04002, 46.49117], [14.00422, 46.48474], [13.89837, 46.52331], [13.7148, 46.5222], [13.68684, 46.43881], [13.59777, 46.44137], [13.5763, 46.42613], [13.5763, 46.40915], [13.47019, 46.3621], [13.43418, 46.35992], [13.44808, 46.33507], [13.37671, 46.29668], [13.42218, 46.20758], [13.47587, 46.22725], [13.56114, 46.2054], [13.56682, 46.18703], [13.64451, 46.18966], [13.66472, 46.17392], [13.64053, 46.13587], [13.57072, 46.09022], [13.50104, 46.05986], [13.49568, 46.04839], [13.50998, 46.04498], [13.49702, 46.01832], [13.47474, 46.00546], [13.50104, 45.98078], [13.52963, 45.96588], [13.56759, 45.96991], [13.58903, 45.99009], [13.62074, 45.98388], [13.63458, 45.98947], [13.64307, 45.98326], [13.6329, 45.94894], [13.63815, 45.93607], [13.61931, 45.91782], [13.60857, 45.89907], [13.59565, 45.89446], [13.58644, 45.88173], [13.57563, 45.8425], [13.58858, 45.83503], [13.59784, 45.8072], [13.66986, 45.79955], [13.8235, 45.7176], [13.83332, 45.70855], [13.83422, 45.68703], [13.87933, 45.65207], [13.9191, 45.6322], [13.8695, 45.60835], [13.86771, 45.59898], [13.84106, 45.58185], [13.78445, 45.5825], [13.74587, 45.59811], [13.7198, 45.59352], [13.6076, 45.64761], [13.45644, 45.59464], [13.56979, 45.4895], [13.62902, 45.45898], [13.67398, 45.4436], [13.7785, 45.46787], [13.81742, 45.43729], [13.88124, 45.42637], [13.90771, 45.45149], [13.97309, 45.45258], [13.99488, 45.47551], [13.96063, 45.50825], [14.00578, 45.52352], [14.07116, 45.48752], [14.20348, 45.46896], [14.22371, 45.50388], [14.24239, 45.50607], [14.26611, 45.48239], [14.27681, 45.4902], [14.32487, 45.47142], [14.36693, 45.48642], [14.49769, 45.54424], [14.5008, 45.60852], [14.53816, 45.6205], [14.57397, 45.67165], [14.60977, 45.66403], [14.59576, 45.62812], [14.69694, 45.57366], [14.68605, 45.53006], [14.71718, 45.53442], [14.80124, 45.49515], [14.81992, 45.45913], [14.90554, 45.47769], [14.92266, 45.52788], [15.02385, 45.48533], [15.05187, 45.49079], [15.16862, 45.42309], [15.27758, 45.46678], [15.33051, 45.45258], [15.38188, 45.48752], [15.30249, 45.53224], [15.29837, 45.5841], [15.27747, 45.60504], [15.31027, 45.6303], [15.34695, 45.63382], [15.34214, 45.64702], [15.38952, 45.63682], [15.4057, 45.64727], [15.34919, 45.71623], [15.30872, 45.69014], [15.25423, 45.72275], [15.40836, 45.79491], [15.47531, 45.79802], [15.47325, 45.8253], [15.52234, 45.82195], [15.57952, 45.84953], [15.64185, 45.82915], [15.66662, 45.84085], [15.70411, 45.8465], [15.68232, 45.86819], [15.68383, 45.88867], [15.67967, 45.90455], [15.70636, 45.92116], [15.70327, 46.00015], [15.71246, 46.01196], [15.72977, 46.04682], [15.62317, 46.09103], [15.6083, 46.11992], [15.59909, 46.14761], [15.64904, 46.19229], [15.6434, 46.21396], [15.67395, 46.22478], [15.75436, 46.21969], [15.75479, 46.20336], [15.78817, 46.21719], [15.79284, 46.25811], [15.97965, 46.30652], [16.07616, 46.3463], [16.07314, 46.36458], [16.05065, 46.3833], [16.05281, 46.39141], [16.14859, 46.40547], [16.18824, 46.38282], [16.30233, 46.37837], [16.30162, 46.40437], [16.27329, 46.41467], [16.27398, 46.42875], [16.25124, 46.48067], [16.23961, 46.49653], [16.26759, 46.50566], [16.26733, 46.51505], [16.29793, 46.5121], [16.37193, 46.55008], [16.38771, 46.53608], [16.44036, 46.5171], [16.5007, 46.49644], [16.52604, 46.47831], [16.59527, 46.47524], [16.52604, 46.5051], [16.52885, 46.53303], [16.50139, 46.56684]]]] } },
28354         { type: "Feature", properties: { iso1A2: "SJ", iso1A3: "SJM", iso1N3: "744", wikidata: "Q842829", nameEn: "Svalbard and Jan Mayen", country: "NO" }, geometry: null },
28355         { type: "Feature", properties: { iso1A2: "SK", iso1A3: "SVK", iso1N3: "703", wikidata: "Q214", nameEn: "Slovakia", groups: ["EU", "151", "150", "UN"], callingCodes: ["421"] }, geometry: { type: "MultiPolygon", coordinates: [[[[19.82237, 49.27806], [19.78581, 49.41701], [19.72127, 49.39288], [19.6375, 49.40897], [19.64162, 49.45184], [19.57845, 49.46077], [19.53313, 49.52856], [19.52626, 49.57311], [19.45348, 49.61583], [19.37795, 49.574], [19.36009, 49.53747], [19.25435, 49.53391], [19.18019, 49.41165], [18.9742, 49.39557], [18.97283, 49.49914], [18.94536, 49.52143], [18.84521, 49.51672], [18.74761, 49.492], [18.67757, 49.50895], [18.6144, 49.49824], [18.57183, 49.51162], [18.53063, 49.49022], [18.54848, 49.47059], [18.44686, 49.39467], [18.4084, 49.40003], [18.4139, 49.36517], [18.36446, 49.3267], [18.18456, 49.28909], [18.15022, 49.24518], [18.1104, 49.08624], [18.06885, 49.03157], [17.91814, 49.01784], [17.87831, 48.92679], [17.77944, 48.92318], [17.73126, 48.87885], [17.7094, 48.86721], [17.5295, 48.81117], [17.45671, 48.85004], [17.3853, 48.80936], [17.29054, 48.85546], [17.19355, 48.87602], [17.11202, 48.82925], [17.00215, 48.70887], [16.93955, 48.60371], [16.94611, 48.53614], [16.85204, 48.44968], [16.8497, 48.38321], [16.83588, 48.3844], [16.83317, 48.38138], [16.84243, 48.35258], [16.90903, 48.32519], [16.89461, 48.31332], [16.97701, 48.17385], [17.02919, 48.13996], [17.05735, 48.14179], [17.09168, 48.09366], [17.07039, 48.0317], [17.16001, 48.00636], [17.23699, 48.02094], [17.71215, 47.7548], [18.02938, 47.75665], [18.29305, 47.73541], [18.56496, 47.76588], [18.66521, 47.76772], [18.74074, 47.8157], [18.8506, 47.82308], [18.76821, 47.87469], [18.76134, 47.97499], [18.82176, 48.04206], [19.01952, 48.07052], [19.23924, 48.0595], [19.28182, 48.08336], [19.47957, 48.09437], [19.52489, 48.19791], [19.63338, 48.25006], [19.92452, 48.1283], [20.24312, 48.2784], [20.29943, 48.26104], [20.5215, 48.53336], [20.83248, 48.5824], [21.11516, 48.49546], [21.44063, 48.58456], [21.6068, 48.50365], [21.67134, 48.3989], [21.72525, 48.34628], [21.8279, 48.33321], [21.83339, 48.36242], [22.14689, 48.4005], [22.16023, 48.56548], [22.21379, 48.6218], [22.34151, 48.68893], [22.42934, 48.92857], [22.48296, 48.99172], [22.54338, 49.01424], [22.56155, 49.08865], [22.04427, 49.22136], [21.96385, 49.3437], [21.82927, 49.39467], [21.77983, 49.35443], [21.62328, 49.4447], [21.43376, 49.41433], [21.27858, 49.45988], [21.19756, 49.4054], [21.12477, 49.43666], [21.041, 49.41791], [21.09799, 49.37176], [20.98733, 49.30774], [20.9229, 49.29626], [20.77971, 49.35383], [20.72274, 49.41813], [20.61666, 49.41791], [20.5631, 49.375], [20.46422, 49.41612], [20.39939, 49.3896], [20.31728, 49.39914], [20.31453, 49.34817], [20.21977, 49.35265], [20.13738, 49.31685], [20.08238, 49.1813], [19.98494, 49.22904], [19.90529, 49.23532], [19.86409, 49.19316], [19.75286, 49.20751], [19.82237, 49.27806]]]] } },
28356         { 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]]]] } },
28357         { 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]]]] } },
28358         { 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]]]] } },
28359         { 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]]]] } },
28360         { 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]]]] } },
28361         { 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]]]] } },
28362         { 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]]]] } },
28363         { 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]]]] } },
28364         { 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]]]] } },
28365         { 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]]]] } },
28366         { 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]]]] } },
28367         { 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]]]] } },
28368         { 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]]]] } },
28369         { 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]]]] } },
28370         { type: "Feature", properties: { iso1A2: "TF", iso1A3: "ATF", iso1N3: "260", wikidata: "Q129003", nameEn: "French Southern Territories", country: "FR", groups: ["EU", "UN"] }, geometry: null },
28371         { 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]]]] } },
28372         { 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]]]] } },
28373         { 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]]]] } },
28374         { 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]]]] } },
28375         { 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]]]] } },
28376         { 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]]]] } },
28377         { 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]]]] } },
28378         { 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]]]] } },
28379         { 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]]]] } },
28380         { 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]]]] } },
28381         { 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]]]] } },
28382         { 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]]]] } },
28383         { 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]]]] } },
28384         { 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]]]] } },
28385         { 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]]]] } },
28386         { type: "Feature", properties: { iso1A2: "UM", iso1A3: "UMI", iso1N3: "581", wikidata: "Q16645", nameEn: "United States Minor Outlying Islands", country: "US" }, geometry: null },
28387         { type: "Feature", properties: { iso1A2: "UN", wikidata: "Q1065", nameEn: "United Nations", level: "unitedNations", isoStatus: "excRes" }, geometry: null },
28388         { type: "Feature", properties: { iso1A2: "US", iso1A3: "USA", iso1N3: "840", wikidata: "Q30", nameEn: "United States of America" }, geometry: null },
28389         { type: "Feature", properties: { iso1A2: "UY", iso1A3: "URY", iso1N3: "858", wikidata: "Q77", nameEn: "Uruguay", groups: ["005", "419", "019", "UN"], callingCodes: ["598"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-57.65132, -30.19229], [-57.61478, -30.25165], [-57.64859, -30.35095], [-57.89115, -30.49572], [-57.8024, -30.77193], [-57.89476, -30.95994], [-57.86729, -31.06352], [-57.9908, -31.34924], [-57.98127, -31.3872], [-58.07569, -31.44916], [-58.0023, -31.53084], [-58.00076, -31.65016], [-58.20252, -31.86966], [-58.10036, -32.25338], [-58.22362, -32.52416], [-58.1224, -32.98842], [-58.40475, -33.11777], [-58.44442, -33.84033], [-58.34425, -34.15035], [-57.83001, -34.69099], [-54.78916, -36.21945], [-52.83257, -34.01481], [-53.37138, -33.74313], [-53.39593, -33.75169], [-53.44031, -33.69344], [-53.52794, -33.68908], [-53.53459, -33.16843], [-53.1111, -32.71147], [-53.37671, -32.57005], [-53.39572, -32.58596], [-53.76024, -32.0751], [-54.17384, -31.86168], [-55.50821, -30.91349], [-55.50841, -30.9027], [-55.51862, -30.89828], [-55.52712, -30.89997], [-55.53276, -30.90218], [-55.53431, -30.89714], [-55.54572, -30.89051], [-55.55218, -30.88193], [-55.55373, -30.8732], [-55.5634, -30.8686], [-55.58866, -30.84117], [-55.87388, -31.05053], [-56.4619, -30.38457], [-56.4795, -30.3899], [-56.49267, -30.39471], [-56.90236, -30.02578], [-57.22502, -30.26121], [-57.65132, -30.19229]]]] } },
28390         { 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]]]] } },
28391         { 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]]]] } },
28392         { 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]]]] } },
28393         { 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]]]] } },
28394         { 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]]]] } },
28395         { 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]]]] } },
28396         { 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]]]] } },
28397         { 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]]]] } },
28398         { 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]]]] } },
28399         { 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]]]] } },
28400         { 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]]]] } },
28401         { 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]]]] } },
28402         { 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]]]] } },
28403         { 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]]]] } },
28404         { 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]]]] } },
28405         { 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]]]] } }
28406       ] };
28407       borders = borders_default;
28408       _whichPolygon = {};
28409       _featuresByCode = {};
28410       idFilterRegex = /(?=(?!^(and|the|of|el|la|de)$))(\b(and|the|of|el|la|de)\b)|[-_ .,'()&[\]/]/gi;
28411       levels = [
28412         "subterritory",
28413         "territory",
28414         "subcountryGroup",
28415         "country",
28416         "sharedLandform",
28417         "intermediateRegion",
28418         "subregion",
28419         "region",
28420         "subunion",
28421         "union",
28422         "unitedNations",
28423         "world"
28424       ];
28425       loadDerivedDataAndCaches(borders);
28426       defaultOpts = {
28427         level: void 0,
28428         maxLevel: void 0,
28429         withProp: void 0
28430       };
28431     }
28432   });
28433
28434   // node_modules/bignumber.js/bignumber.mjs
28435   function clone(configObject) {
28436     var div, convertBase, parseNumeric2, P2 = 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 = {
28437       prefix: "",
28438       groupSize: 3,
28439       secondaryGroupSize: 0,
28440       groupSeparator: ",",
28441       decimalSeparator: ".",
28442       fractionGroupSize: 0,
28443       fractionGroupSeparator: "\xA0",
28444       // non-breaking space
28445       suffix: ""
28446     }, ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz", alphabetHasNormalDecimalDigits = true;
28447     function BigNumber2(v2, b2) {
28448       var alphabet, c2, caseChanged, e3, i3, isNum, len, str, x2 = this;
28449       if (!(x2 instanceof BigNumber2)) return new BigNumber2(v2, b2);
28450       if (b2 == null) {
28451         if (v2 && v2._isBigNumber === true) {
28452           x2.s = v2.s;
28453           if (!v2.c || v2.e > MAX_EXP) {
28454             x2.c = x2.e = null;
28455           } else if (v2.e < MIN_EXP) {
28456             x2.c = [x2.e = 0];
28457           } else {
28458             x2.e = v2.e;
28459             x2.c = v2.c.slice();
28460           }
28461           return;
28462         }
28463         if ((isNum = typeof v2 == "number") && v2 * 0 == 0) {
28464           x2.s = 1 / v2 < 0 ? (v2 = -v2, -1) : 1;
28465           if (v2 === ~~v2) {
28466             for (e3 = 0, i3 = v2; i3 >= 10; i3 /= 10, e3++) ;
28467             if (e3 > MAX_EXP) {
28468               x2.c = x2.e = null;
28469             } else {
28470               x2.e = e3;
28471               x2.c = [v2];
28472             }
28473             return;
28474           }
28475           str = String(v2);
28476         } else {
28477           if (!isNumeric.test(str = String(v2))) return parseNumeric2(x2, str, isNum);
28478           x2.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1;
28479         }
28480         if ((e3 = str.indexOf(".")) > -1) str = str.replace(".", "");
28481         if ((i3 = str.search(/e/i)) > 0) {
28482           if (e3 < 0) e3 = i3;
28483           e3 += +str.slice(i3 + 1);
28484           str = str.substring(0, i3);
28485         } else if (e3 < 0) {
28486           e3 = str.length;
28487         }
28488       } else {
28489         intCheck(b2, 2, ALPHABET.length, "Base");
28490         if (b2 == 10 && alphabetHasNormalDecimalDigits) {
28491           x2 = new BigNumber2(v2);
28492           return round(x2, DECIMAL_PLACES + x2.e + 1, ROUNDING_MODE);
28493         }
28494         str = String(v2);
28495         if (isNum = typeof v2 == "number") {
28496           if (v2 * 0 != 0) return parseNumeric2(x2, str, isNum, b2);
28497           x2.s = 1 / v2 < 0 ? (str = str.slice(1), -1) : 1;
28498           if (BigNumber2.DEBUG && str.replace(/^0\.0*|\./, "").length > 15) {
28499             throw Error(tooManyDigits + v2);
28500           }
28501         } else {
28502           x2.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;
28503         }
28504         alphabet = ALPHABET.slice(0, b2);
28505         e3 = i3 = 0;
28506         for (len = str.length; i3 < len; i3++) {
28507           if (alphabet.indexOf(c2 = str.charAt(i3)) < 0) {
28508             if (c2 == ".") {
28509               if (i3 > e3) {
28510                 e3 = len;
28511                 continue;
28512               }
28513             } else if (!caseChanged) {
28514               if (str == str.toUpperCase() && (str = str.toLowerCase()) || str == str.toLowerCase() && (str = str.toUpperCase())) {
28515                 caseChanged = true;
28516                 i3 = -1;
28517                 e3 = 0;
28518                 continue;
28519               }
28520             }
28521             return parseNumeric2(x2, String(v2), isNum, b2);
28522           }
28523         }
28524         isNum = false;
28525         str = convertBase(str, b2, 10, x2.s);
28526         if ((e3 = str.indexOf(".")) > -1) str = str.replace(".", "");
28527         else e3 = str.length;
28528       }
28529       for (i3 = 0; str.charCodeAt(i3) === 48; i3++) ;
28530       for (len = str.length; str.charCodeAt(--len) === 48; ) ;
28531       if (str = str.slice(i3, ++len)) {
28532         len -= i3;
28533         if (isNum && BigNumber2.DEBUG && len > 15 && (v2 > MAX_SAFE_INTEGER3 || v2 !== mathfloor(v2))) {
28534           throw Error(tooManyDigits + x2.s * v2);
28535         }
28536         if ((e3 = e3 - i3 - 1) > MAX_EXP) {
28537           x2.c = x2.e = null;
28538         } else if (e3 < MIN_EXP) {
28539           x2.c = [x2.e = 0];
28540         } else {
28541           x2.e = e3;
28542           x2.c = [];
28543           i3 = (e3 + 1) % LOG_BASE;
28544           if (e3 < 0) i3 += LOG_BASE;
28545           if (i3 < len) {
28546             if (i3) x2.c.push(+str.slice(0, i3));
28547             for (len -= LOG_BASE; i3 < len; ) {
28548               x2.c.push(+str.slice(i3, i3 += LOG_BASE));
28549             }
28550             i3 = LOG_BASE - (str = str.slice(i3)).length;
28551           } else {
28552             i3 -= len;
28553           }
28554           for (; i3--; str += "0") ;
28555           x2.c.push(+str);
28556         }
28557       } else {
28558         x2.c = [x2.e = 0];
28559       }
28560     }
28561     BigNumber2.clone = clone;
28562     BigNumber2.ROUND_UP = 0;
28563     BigNumber2.ROUND_DOWN = 1;
28564     BigNumber2.ROUND_CEIL = 2;
28565     BigNumber2.ROUND_FLOOR = 3;
28566     BigNumber2.ROUND_HALF_UP = 4;
28567     BigNumber2.ROUND_HALF_DOWN = 5;
28568     BigNumber2.ROUND_HALF_EVEN = 6;
28569     BigNumber2.ROUND_HALF_CEIL = 7;
28570     BigNumber2.ROUND_HALF_FLOOR = 8;
28571     BigNumber2.EUCLID = 9;
28572     BigNumber2.config = BigNumber2.set = function(obj) {
28573       var p2, v2;
28574       if (obj != null) {
28575         if (typeof obj == "object") {
28576           if (obj.hasOwnProperty(p2 = "DECIMAL_PLACES")) {
28577             v2 = obj[p2];
28578             intCheck(v2, 0, MAX, p2);
28579             DECIMAL_PLACES = v2;
28580           }
28581           if (obj.hasOwnProperty(p2 = "ROUNDING_MODE")) {
28582             v2 = obj[p2];
28583             intCheck(v2, 0, 8, p2);
28584             ROUNDING_MODE = v2;
28585           }
28586           if (obj.hasOwnProperty(p2 = "EXPONENTIAL_AT")) {
28587             v2 = obj[p2];
28588             if (v2 && v2.pop) {
28589               intCheck(v2[0], -MAX, 0, p2);
28590               intCheck(v2[1], 0, MAX, p2);
28591               TO_EXP_NEG = v2[0];
28592               TO_EXP_POS = v2[1];
28593             } else {
28594               intCheck(v2, -MAX, MAX, p2);
28595               TO_EXP_NEG = -(TO_EXP_POS = v2 < 0 ? -v2 : v2);
28596             }
28597           }
28598           if (obj.hasOwnProperty(p2 = "RANGE")) {
28599             v2 = obj[p2];
28600             if (v2 && v2.pop) {
28601               intCheck(v2[0], -MAX, -1, p2);
28602               intCheck(v2[1], 1, MAX, p2);
28603               MIN_EXP = v2[0];
28604               MAX_EXP = v2[1];
28605             } else {
28606               intCheck(v2, -MAX, MAX, p2);
28607               if (v2) {
28608                 MIN_EXP = -(MAX_EXP = v2 < 0 ? -v2 : v2);
28609               } else {
28610                 throw Error(bignumberError + p2 + " cannot be zero: " + v2);
28611               }
28612             }
28613           }
28614           if (obj.hasOwnProperty(p2 = "CRYPTO")) {
28615             v2 = obj[p2];
28616             if (v2 === !!v2) {
28617               if (v2) {
28618                 if (typeof crypto != "undefined" && crypto && (crypto.getRandomValues || crypto.randomBytes)) {
28619                   CRYPTO = v2;
28620                 } else {
28621                   CRYPTO = !v2;
28622                   throw Error(bignumberError + "crypto unavailable");
28623                 }
28624               } else {
28625                 CRYPTO = v2;
28626               }
28627             } else {
28628               throw Error(bignumberError + p2 + " not true or false: " + v2);
28629             }
28630           }
28631           if (obj.hasOwnProperty(p2 = "MODULO_MODE")) {
28632             v2 = obj[p2];
28633             intCheck(v2, 0, 9, p2);
28634             MODULO_MODE = v2;
28635           }
28636           if (obj.hasOwnProperty(p2 = "POW_PRECISION")) {
28637             v2 = obj[p2];
28638             intCheck(v2, 0, MAX, p2);
28639             POW_PRECISION = v2;
28640           }
28641           if (obj.hasOwnProperty(p2 = "FORMAT")) {
28642             v2 = obj[p2];
28643             if (typeof v2 == "object") FORMAT = v2;
28644             else throw Error(bignumberError + p2 + " not an object: " + v2);
28645           }
28646           if (obj.hasOwnProperty(p2 = "ALPHABET")) {
28647             v2 = obj[p2];
28648             if (typeof v2 == "string" && !/^.?$|[+\-.\s]|(.).*\1/.test(v2)) {
28649               alphabetHasNormalDecimalDigits = v2.slice(0, 10) == "0123456789";
28650               ALPHABET = v2;
28651             } else {
28652               throw Error(bignumberError + p2 + " invalid: " + v2);
28653             }
28654           }
28655         } else {
28656           throw Error(bignumberError + "Object expected: " + obj);
28657         }
28658       }
28659       return {
28660         DECIMAL_PLACES,
28661         ROUNDING_MODE,
28662         EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS],
28663         RANGE: [MIN_EXP, MAX_EXP],
28664         CRYPTO,
28665         MODULO_MODE,
28666         POW_PRECISION,
28667         FORMAT,
28668         ALPHABET
28669       };
28670     };
28671     BigNumber2.isBigNumber = function(v2) {
28672       if (!v2 || v2._isBigNumber !== true) return false;
28673       if (!BigNumber2.DEBUG) return true;
28674       var i3, n3, c2 = v2.c, e3 = v2.e, s2 = v2.s;
28675       out: if ({}.toString.call(c2) == "[object Array]") {
28676         if ((s2 === 1 || s2 === -1) && e3 >= -MAX && e3 <= MAX && e3 === mathfloor(e3)) {
28677           if (c2[0] === 0) {
28678             if (e3 === 0 && c2.length === 1) return true;
28679             break out;
28680           }
28681           i3 = (e3 + 1) % LOG_BASE;
28682           if (i3 < 1) i3 += LOG_BASE;
28683           if (String(c2[0]).length == i3) {
28684             for (i3 = 0; i3 < c2.length; i3++) {
28685               n3 = c2[i3];
28686               if (n3 < 0 || n3 >= BASE || n3 !== mathfloor(n3)) break out;
28687             }
28688             if (n3 !== 0) return true;
28689           }
28690         }
28691       } else if (c2 === null && e3 === null && (s2 === null || s2 === 1 || s2 === -1)) {
28692         return true;
28693       }
28694       throw Error(bignumberError + "Invalid BigNumber: " + v2);
28695     };
28696     BigNumber2.maximum = BigNumber2.max = function() {
28697       return maxOrMin(arguments, -1);
28698     };
28699     BigNumber2.minimum = BigNumber2.min = function() {
28700       return maxOrMin(arguments, 1);
28701     };
28702     BigNumber2.random = function() {
28703       var pow2_53 = 9007199254740992;
28704       var random53bitInt = Math.random() * pow2_53 & 2097151 ? function() {
28705         return mathfloor(Math.random() * pow2_53);
28706       } : function() {
28707         return (Math.random() * 1073741824 | 0) * 8388608 + (Math.random() * 8388608 | 0);
28708       };
28709       return function(dp) {
28710         var a2, b2, e3, k2, v2, i3 = 0, c2 = [], rand = new BigNumber2(ONE);
28711         if (dp == null) dp = DECIMAL_PLACES;
28712         else intCheck(dp, 0, MAX);
28713         k2 = mathceil(dp / LOG_BASE);
28714         if (CRYPTO) {
28715           if (crypto.getRandomValues) {
28716             a2 = crypto.getRandomValues(new Uint32Array(k2 *= 2));
28717             for (; i3 < k2; ) {
28718               v2 = a2[i3] * 131072 + (a2[i3 + 1] >>> 11);
28719               if (v2 >= 9e15) {
28720                 b2 = crypto.getRandomValues(new Uint32Array(2));
28721                 a2[i3] = b2[0];
28722                 a2[i3 + 1] = b2[1];
28723               } else {
28724                 c2.push(v2 % 1e14);
28725                 i3 += 2;
28726               }
28727             }
28728             i3 = k2 / 2;
28729           } else if (crypto.randomBytes) {
28730             a2 = crypto.randomBytes(k2 *= 7);
28731             for (; i3 < k2; ) {
28732               v2 = (a2[i3] & 31) * 281474976710656 + a2[i3 + 1] * 1099511627776 + a2[i3 + 2] * 4294967296 + a2[i3 + 3] * 16777216 + (a2[i3 + 4] << 16) + (a2[i3 + 5] << 8) + a2[i3 + 6];
28733               if (v2 >= 9e15) {
28734                 crypto.randomBytes(7).copy(a2, i3);
28735               } else {
28736                 c2.push(v2 % 1e14);
28737                 i3 += 7;
28738               }
28739             }
28740             i3 = k2 / 7;
28741           } else {
28742             CRYPTO = false;
28743             throw Error(bignumberError + "crypto unavailable");
28744           }
28745         }
28746         if (!CRYPTO) {
28747           for (; i3 < k2; ) {
28748             v2 = random53bitInt();
28749             if (v2 < 9e15) c2[i3++] = v2 % 1e14;
28750           }
28751         }
28752         k2 = c2[--i3];
28753         dp %= LOG_BASE;
28754         if (k2 && dp) {
28755           v2 = POWS_TEN[LOG_BASE - dp];
28756           c2[i3] = mathfloor(k2 / v2) * v2;
28757         }
28758         for (; c2[i3] === 0; c2.pop(), i3--) ;
28759         if (i3 < 0) {
28760           c2 = [e3 = 0];
28761         } else {
28762           for (e3 = -1; c2[0] === 0; c2.splice(0, 1), e3 -= LOG_BASE) ;
28763           for (i3 = 1, v2 = c2[0]; v2 >= 10; v2 /= 10, i3++) ;
28764           if (i3 < LOG_BASE) e3 -= LOG_BASE - i3;
28765         }
28766         rand.e = e3;
28767         rand.c = c2;
28768         return rand;
28769       };
28770     }();
28771     BigNumber2.sum = function() {
28772       var i3 = 1, args = arguments, sum = new BigNumber2(args[0]);
28773       for (; i3 < args.length; ) sum = sum.plus(args[i3++]);
28774       return sum;
28775     };
28776     convertBase = /* @__PURE__ */ function() {
28777       var decimal = "0123456789";
28778       function toBaseOut(str, baseIn, baseOut, alphabet) {
28779         var j2, arr = [0], arrL, i3 = 0, len = str.length;
28780         for (; i3 < len; ) {
28781           for (arrL = arr.length; arrL--; arr[arrL] *= baseIn) ;
28782           arr[0] += alphabet.indexOf(str.charAt(i3++));
28783           for (j2 = 0; j2 < arr.length; j2++) {
28784             if (arr[j2] > baseOut - 1) {
28785               if (arr[j2 + 1] == null) arr[j2 + 1] = 0;
28786               arr[j2 + 1] += arr[j2] / baseOut | 0;
28787               arr[j2] %= baseOut;
28788             }
28789           }
28790         }
28791         return arr.reverse();
28792       }
28793       return function(str, baseIn, baseOut, sign2, callerIsToString) {
28794         var alphabet, d2, e3, k2, r2, x2, xc, y2, i3 = str.indexOf("."), dp = DECIMAL_PLACES, rm = ROUNDING_MODE;
28795         if (i3 >= 0) {
28796           k2 = POW_PRECISION;
28797           POW_PRECISION = 0;
28798           str = str.replace(".", "");
28799           y2 = new BigNumber2(baseIn);
28800           x2 = y2.pow(str.length - i3);
28801           POW_PRECISION = k2;
28802           y2.c = toBaseOut(
28803             toFixedPoint(coeffToString(x2.c), x2.e, "0"),
28804             10,
28805             baseOut,
28806             decimal
28807           );
28808           y2.e = y2.c.length;
28809         }
28810         xc = toBaseOut(str, baseIn, baseOut, callerIsToString ? (alphabet = ALPHABET, decimal) : (alphabet = decimal, ALPHABET));
28811         e3 = k2 = xc.length;
28812         for (; xc[--k2] == 0; xc.pop()) ;
28813         if (!xc[0]) return alphabet.charAt(0);
28814         if (i3 < 0) {
28815           --e3;
28816         } else {
28817           x2.c = xc;
28818           x2.e = e3;
28819           x2.s = sign2;
28820           x2 = div(x2, y2, dp, rm, baseOut);
28821           xc = x2.c;
28822           r2 = x2.r;
28823           e3 = x2.e;
28824         }
28825         d2 = e3 + dp + 1;
28826         i3 = xc[d2];
28827         k2 = baseOut / 2;
28828         r2 = r2 || d2 < 0 || xc[d2 + 1] != null;
28829         r2 = rm < 4 ? (i3 != null || r2) && (rm == 0 || rm == (x2.s < 0 ? 3 : 2)) : i3 > k2 || i3 == k2 && (rm == 4 || r2 || rm == 6 && xc[d2 - 1] & 1 || rm == (x2.s < 0 ? 8 : 7));
28830         if (d2 < 1 || !xc[0]) {
28831           str = r2 ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0);
28832         } else {
28833           xc.length = d2;
28834           if (r2) {
28835             for (--baseOut; ++xc[--d2] > baseOut; ) {
28836               xc[d2] = 0;
28837               if (!d2) {
28838                 ++e3;
28839                 xc = [1].concat(xc);
28840               }
28841             }
28842           }
28843           for (k2 = xc.length; !xc[--k2]; ) ;
28844           for (i3 = 0, str = ""; i3 <= k2; str += alphabet.charAt(xc[i3++])) ;
28845           str = toFixedPoint(str, e3, alphabet.charAt(0));
28846         }
28847         return str;
28848       };
28849     }();
28850     div = /* @__PURE__ */ function() {
28851       function multiply(x2, k2, base) {
28852         var m2, temp, xlo, xhi, carry = 0, i3 = x2.length, klo = k2 % SQRT_BASE, khi = k2 / SQRT_BASE | 0;
28853         for (x2 = x2.slice(); i3--; ) {
28854           xlo = x2[i3] % SQRT_BASE;
28855           xhi = x2[i3] / SQRT_BASE | 0;
28856           m2 = khi * xlo + xhi * klo;
28857           temp = klo * xlo + m2 % SQRT_BASE * SQRT_BASE + carry;
28858           carry = (temp / base | 0) + (m2 / SQRT_BASE | 0) + khi * xhi;
28859           x2[i3] = temp % base;
28860         }
28861         if (carry) x2 = [carry].concat(x2);
28862         return x2;
28863       }
28864       function compare2(a2, b2, aL, bL) {
28865         var i3, cmp;
28866         if (aL != bL) {
28867           cmp = aL > bL ? 1 : -1;
28868         } else {
28869           for (i3 = cmp = 0; i3 < aL; i3++) {
28870             if (a2[i3] != b2[i3]) {
28871               cmp = a2[i3] > b2[i3] ? 1 : -1;
28872               break;
28873             }
28874           }
28875         }
28876         return cmp;
28877       }
28878       function subtract(a2, b2, aL, base) {
28879         var i3 = 0;
28880         for (; aL--; ) {
28881           a2[aL] -= i3;
28882           i3 = a2[aL] < b2[aL] ? 1 : 0;
28883           a2[aL] = i3 * base + a2[aL] - b2[aL];
28884         }
28885         for (; !a2[0] && a2.length > 1; a2.splice(0, 1)) ;
28886       }
28887       return function(x2, y2, dp, rm, base) {
28888         var cmp, e3, i3, more, n3, prod, prodL, q2, qc, rem, remL, rem0, xi, xL, yc0, yL, yz, s2 = x2.s == y2.s ? 1 : -1, xc = x2.c, yc = y2.c;
28889         if (!xc || !xc[0] || !yc || !yc[0]) {
28890           return new BigNumber2(
28891             // Return NaN if either NaN, or both Infinity or 0.
28892             !x2.s || !y2.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN : (
28893               // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.
28894               xc && xc[0] == 0 || !yc ? s2 * 0 : s2 / 0
28895             )
28896           );
28897         }
28898         q2 = new BigNumber2(s2);
28899         qc = q2.c = [];
28900         e3 = x2.e - y2.e;
28901         s2 = dp + e3 + 1;
28902         if (!base) {
28903           base = BASE;
28904           e3 = bitFloor(x2.e / LOG_BASE) - bitFloor(y2.e / LOG_BASE);
28905           s2 = s2 / LOG_BASE | 0;
28906         }
28907         for (i3 = 0; yc[i3] == (xc[i3] || 0); i3++) ;
28908         if (yc[i3] > (xc[i3] || 0)) e3--;
28909         if (s2 < 0) {
28910           qc.push(1);
28911           more = true;
28912         } else {
28913           xL = xc.length;
28914           yL = yc.length;
28915           i3 = 0;
28916           s2 += 2;
28917           n3 = mathfloor(base / (yc[0] + 1));
28918           if (n3 > 1) {
28919             yc = multiply(yc, n3, base);
28920             xc = multiply(xc, n3, base);
28921             yL = yc.length;
28922             xL = xc.length;
28923           }
28924           xi = yL;
28925           rem = xc.slice(0, yL);
28926           remL = rem.length;
28927           for (; remL < yL; rem[remL++] = 0) ;
28928           yz = yc.slice();
28929           yz = [0].concat(yz);
28930           yc0 = yc[0];
28931           if (yc[1] >= base / 2) yc0++;
28932           do {
28933             n3 = 0;
28934             cmp = compare2(yc, rem, yL, remL);
28935             if (cmp < 0) {
28936               rem0 = rem[0];
28937               if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);
28938               n3 = mathfloor(rem0 / yc0);
28939               if (n3 > 1) {
28940                 if (n3 >= base) n3 = base - 1;
28941                 prod = multiply(yc, n3, base);
28942                 prodL = prod.length;
28943                 remL = rem.length;
28944                 while (compare2(prod, rem, prodL, remL) == 1) {
28945                   n3--;
28946                   subtract(prod, yL < prodL ? yz : yc, prodL, base);
28947                   prodL = prod.length;
28948                   cmp = 1;
28949                 }
28950               } else {
28951                 if (n3 == 0) {
28952                   cmp = n3 = 1;
28953                 }
28954                 prod = yc.slice();
28955                 prodL = prod.length;
28956               }
28957               if (prodL < remL) prod = [0].concat(prod);
28958               subtract(rem, prod, remL, base);
28959               remL = rem.length;
28960               if (cmp == -1) {
28961                 while (compare2(yc, rem, yL, remL) < 1) {
28962                   n3++;
28963                   subtract(rem, yL < remL ? yz : yc, remL, base);
28964                   remL = rem.length;
28965                 }
28966               }
28967             } else if (cmp === 0) {
28968               n3++;
28969               rem = [0];
28970             }
28971             qc[i3++] = n3;
28972             if (rem[0]) {
28973               rem[remL++] = xc[xi] || 0;
28974             } else {
28975               rem = [xc[xi]];
28976               remL = 1;
28977             }
28978           } while ((xi++ < xL || rem[0] != null) && s2--);
28979           more = rem[0] != null;
28980           if (!qc[0]) qc.splice(0, 1);
28981         }
28982         if (base == BASE) {
28983           for (i3 = 1, s2 = qc[0]; s2 >= 10; s2 /= 10, i3++) ;
28984           round(q2, dp + (q2.e = i3 + e3 * LOG_BASE - 1) + 1, rm, more);
28985         } else {
28986           q2.e = e3;
28987           q2.r = +more;
28988         }
28989         return q2;
28990       };
28991     }();
28992     function format2(n3, i3, rm, id2) {
28993       var c0, e3, ne2, len, str;
28994       if (rm == null) rm = ROUNDING_MODE;
28995       else intCheck(rm, 0, 8);
28996       if (!n3.c) return n3.toString();
28997       c0 = n3.c[0];
28998       ne2 = n3.e;
28999       if (i3 == null) {
29000         str = coeffToString(n3.c);
29001         str = id2 == 1 || id2 == 2 && (ne2 <= TO_EXP_NEG || ne2 >= TO_EXP_POS) ? toExponential(str, ne2) : toFixedPoint(str, ne2, "0");
29002       } else {
29003         n3 = round(new BigNumber2(n3), i3, rm);
29004         e3 = n3.e;
29005         str = coeffToString(n3.c);
29006         len = str.length;
29007         if (id2 == 1 || id2 == 2 && (i3 <= e3 || e3 <= TO_EXP_NEG)) {
29008           for (; len < i3; str += "0", len++) ;
29009           str = toExponential(str, e3);
29010         } else {
29011           i3 -= ne2;
29012           str = toFixedPoint(str, e3, "0");
29013           if (e3 + 1 > len) {
29014             if (--i3 > 0) for (str += "."; i3--; str += "0") ;
29015           } else {
29016             i3 += e3 - len;
29017             if (i3 > 0) {
29018               if (e3 + 1 == len) str += ".";
29019               for (; i3--; str += "0") ;
29020             }
29021           }
29022         }
29023       }
29024       return n3.s < 0 && c0 ? "-" + str : str;
29025     }
29026     function maxOrMin(args, n3) {
29027       var k2, y2, i3 = 1, x2 = new BigNumber2(args[0]);
29028       for (; i3 < args.length; i3++) {
29029         y2 = new BigNumber2(args[i3]);
29030         if (!y2.s || (k2 = compare(x2, y2)) === n3 || k2 === 0 && x2.s === n3) {
29031           x2 = y2;
29032         }
29033       }
29034       return x2;
29035     }
29036     function normalise(n3, c2, e3) {
29037       var i3 = 1, j2 = c2.length;
29038       for (; !c2[--j2]; c2.pop()) ;
29039       for (j2 = c2[0]; j2 >= 10; j2 /= 10, i3++) ;
29040       if ((e3 = i3 + e3 * LOG_BASE - 1) > MAX_EXP) {
29041         n3.c = n3.e = null;
29042       } else if (e3 < MIN_EXP) {
29043         n3.c = [n3.e = 0];
29044       } else {
29045         n3.e = e3;
29046         n3.c = c2;
29047       }
29048       return n3;
29049     }
29050     parseNumeric2 = /* @__PURE__ */ function() {
29051       var basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i, dotAfter = /^([^.]+)\.$/, dotBefore = /^\.([^.]+)$/, isInfinityOrNaN = /^-?(Infinity|NaN)$/, whitespaceOrPlus = /^\s*\+(?=[\w.])|^\s+|\s+$/g;
29052       return function(x2, str, isNum, b2) {
29053         var base, s2 = isNum ? str : str.replace(whitespaceOrPlus, "");
29054         if (isInfinityOrNaN.test(s2)) {
29055           x2.s = isNaN(s2) ? null : s2 < 0 ? -1 : 1;
29056         } else {
29057           if (!isNum) {
29058             s2 = s2.replace(basePrefix, function(m2, p1, p2) {
29059               base = (p2 = p2.toLowerCase()) == "x" ? 16 : p2 == "b" ? 2 : 8;
29060               return !b2 || b2 == base ? p1 : m2;
29061             });
29062             if (b2) {
29063               base = b2;
29064               s2 = s2.replace(dotAfter, "$1").replace(dotBefore, "0.$1");
29065             }
29066             if (str != s2) return new BigNumber2(s2, base);
29067           }
29068           if (BigNumber2.DEBUG) {
29069             throw Error(bignumberError + "Not a" + (b2 ? " base " + b2 : "") + " number: " + str);
29070           }
29071           x2.s = null;
29072         }
29073         x2.c = x2.e = null;
29074       };
29075     }();
29076     function round(x2, sd, rm, r2) {
29077       var d2, i3, j2, k2, n3, ni, rd, xc = x2.c, pows10 = POWS_TEN;
29078       if (xc) {
29079         out: {
29080           for (d2 = 1, k2 = xc[0]; k2 >= 10; k2 /= 10, d2++) ;
29081           i3 = sd - d2;
29082           if (i3 < 0) {
29083             i3 += LOG_BASE;
29084             j2 = sd;
29085             n3 = xc[ni = 0];
29086             rd = mathfloor(n3 / pows10[d2 - j2 - 1] % 10);
29087           } else {
29088             ni = mathceil((i3 + 1) / LOG_BASE);
29089             if (ni >= xc.length) {
29090               if (r2) {
29091                 for (; xc.length <= ni; xc.push(0)) ;
29092                 n3 = rd = 0;
29093                 d2 = 1;
29094                 i3 %= LOG_BASE;
29095                 j2 = i3 - LOG_BASE + 1;
29096               } else {
29097                 break out;
29098               }
29099             } else {
29100               n3 = k2 = xc[ni];
29101               for (d2 = 1; k2 >= 10; k2 /= 10, d2++) ;
29102               i3 %= LOG_BASE;
29103               j2 = i3 - LOG_BASE + d2;
29104               rd = j2 < 0 ? 0 : mathfloor(n3 / pows10[d2 - j2 - 1] % 10);
29105             }
29106           }
29107           r2 = r2 || sd < 0 || // Are there any non-zero digits after the rounding digit?
29108           // The expression  n % pows10[d - j - 1]  returns all digits of n to the right
29109           // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.
29110           xc[ni + 1] != null || (j2 < 0 ? n3 : n3 % pows10[d2 - j2 - 1]);
29111           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.
29112           (i3 > 0 ? j2 > 0 ? n3 / pows10[d2 - j2] : 0 : xc[ni - 1]) % 10 & 1 || rm == (x2.s < 0 ? 8 : 7));
29113           if (sd < 1 || !xc[0]) {
29114             xc.length = 0;
29115             if (r2) {
29116               sd -= x2.e + 1;
29117               xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE];
29118               x2.e = -sd || 0;
29119             } else {
29120               xc[0] = x2.e = 0;
29121             }
29122             return x2;
29123           }
29124           if (i3 == 0) {
29125             xc.length = ni;
29126             k2 = 1;
29127             ni--;
29128           } else {
29129             xc.length = ni + 1;
29130             k2 = pows10[LOG_BASE - i3];
29131             xc[ni] = j2 > 0 ? mathfloor(n3 / pows10[d2 - j2] % pows10[j2]) * k2 : 0;
29132           }
29133           if (r2) {
29134             for (; ; ) {
29135               if (ni == 0) {
29136                 for (i3 = 1, j2 = xc[0]; j2 >= 10; j2 /= 10, i3++) ;
29137                 j2 = xc[0] += k2;
29138                 for (k2 = 1; j2 >= 10; j2 /= 10, k2++) ;
29139                 if (i3 != k2) {
29140                   x2.e++;
29141                   if (xc[0] == BASE) xc[0] = 1;
29142                 }
29143                 break;
29144               } else {
29145                 xc[ni] += k2;
29146                 if (xc[ni] != BASE) break;
29147                 xc[ni--] = 0;
29148                 k2 = 1;
29149               }
29150             }
29151           }
29152           for (i3 = xc.length; xc[--i3] === 0; xc.pop()) ;
29153         }
29154         if (x2.e > MAX_EXP) {
29155           x2.c = x2.e = null;
29156         } else if (x2.e < MIN_EXP) {
29157           x2.c = [x2.e = 0];
29158         }
29159       }
29160       return x2;
29161     }
29162     function valueOf(n3) {
29163       var str, e3 = n3.e;
29164       if (e3 === null) return n3.toString();
29165       str = coeffToString(n3.c);
29166       str = e3 <= TO_EXP_NEG || e3 >= TO_EXP_POS ? toExponential(str, e3) : toFixedPoint(str, e3, "0");
29167       return n3.s < 0 ? "-" + str : str;
29168     }
29169     P2.absoluteValue = P2.abs = function() {
29170       var x2 = new BigNumber2(this);
29171       if (x2.s < 0) x2.s = 1;
29172       return x2;
29173     };
29174     P2.comparedTo = function(y2, b2) {
29175       return compare(this, new BigNumber2(y2, b2));
29176     };
29177     P2.decimalPlaces = P2.dp = function(dp, rm) {
29178       var c2, n3, v2, x2 = this;
29179       if (dp != null) {
29180         intCheck(dp, 0, MAX);
29181         if (rm == null) rm = ROUNDING_MODE;
29182         else intCheck(rm, 0, 8);
29183         return round(new BigNumber2(x2), dp + x2.e + 1, rm);
29184       }
29185       if (!(c2 = x2.c)) return null;
29186       n3 = ((v2 = c2.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE;
29187       if (v2 = c2[v2]) for (; v2 % 10 == 0; v2 /= 10, n3--) ;
29188       if (n3 < 0) n3 = 0;
29189       return n3;
29190     };
29191     P2.dividedBy = P2.div = function(y2, b2) {
29192       return div(this, new BigNumber2(y2, b2), DECIMAL_PLACES, ROUNDING_MODE);
29193     };
29194     P2.dividedToIntegerBy = P2.idiv = function(y2, b2) {
29195       return div(this, new BigNumber2(y2, b2), 0, 1);
29196     };
29197     P2.exponentiatedBy = P2.pow = function(n3, m2) {
29198       var half, isModExp, i3, k2, more, nIsBig, nIsNeg, nIsOdd, y2, x2 = this;
29199       n3 = new BigNumber2(n3);
29200       if (n3.c && !n3.isInteger()) {
29201         throw Error(bignumberError + "Exponent not an integer: " + valueOf(n3));
29202       }
29203       if (m2 != null) m2 = new BigNumber2(m2);
29204       nIsBig = n3.e > 14;
29205       if (!x2.c || !x2.c[0] || x2.c[0] == 1 && !x2.e && x2.c.length == 1 || !n3.c || !n3.c[0]) {
29206         y2 = new BigNumber2(Math.pow(+valueOf(x2), nIsBig ? n3.s * (2 - isOdd(n3)) : +valueOf(n3)));
29207         return m2 ? y2.mod(m2) : y2;
29208       }
29209       nIsNeg = n3.s < 0;
29210       if (m2) {
29211         if (m2.c ? !m2.c[0] : !m2.s) return new BigNumber2(NaN);
29212         isModExp = !nIsNeg && x2.isInteger() && m2.isInteger();
29213         if (isModExp) x2 = x2.mod(m2);
29214       } 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))) {
29215         k2 = x2.s < 0 && isOdd(n3) ? -0 : 0;
29216         if (x2.e > -1) k2 = 1 / k2;
29217         return new BigNumber2(nIsNeg ? 1 / k2 : k2);
29218       } else if (POW_PRECISION) {
29219         k2 = mathceil(POW_PRECISION / LOG_BASE + 2);
29220       }
29221       if (nIsBig) {
29222         half = new BigNumber2(0.5);
29223         if (nIsNeg) n3.s = 1;
29224         nIsOdd = isOdd(n3);
29225       } else {
29226         i3 = Math.abs(+valueOf(n3));
29227         nIsOdd = i3 % 2;
29228       }
29229       y2 = new BigNumber2(ONE);
29230       for (; ; ) {
29231         if (nIsOdd) {
29232           y2 = y2.times(x2);
29233           if (!y2.c) break;
29234           if (k2) {
29235             if (y2.c.length > k2) y2.c.length = k2;
29236           } else if (isModExp) {
29237             y2 = y2.mod(m2);
29238           }
29239         }
29240         if (i3) {
29241           i3 = mathfloor(i3 / 2);
29242           if (i3 === 0) break;
29243           nIsOdd = i3 % 2;
29244         } else {
29245           n3 = n3.times(half);
29246           round(n3, n3.e + 1, 1);
29247           if (n3.e > 14) {
29248             nIsOdd = isOdd(n3);
29249           } else {
29250             i3 = +valueOf(n3);
29251             if (i3 === 0) break;
29252             nIsOdd = i3 % 2;
29253           }
29254         }
29255         x2 = x2.times(x2);
29256         if (k2) {
29257           if (x2.c && x2.c.length > k2) x2.c.length = k2;
29258         } else if (isModExp) {
29259           x2 = x2.mod(m2);
29260         }
29261       }
29262       if (isModExp) return y2;
29263       if (nIsNeg) y2 = ONE.div(y2);
29264       return m2 ? y2.mod(m2) : k2 ? round(y2, POW_PRECISION, ROUNDING_MODE, more) : y2;
29265     };
29266     P2.integerValue = function(rm) {
29267       var n3 = new BigNumber2(this);
29268       if (rm == null) rm = ROUNDING_MODE;
29269       else intCheck(rm, 0, 8);
29270       return round(n3, n3.e + 1, rm);
29271     };
29272     P2.isEqualTo = P2.eq = function(y2, b2) {
29273       return compare(this, new BigNumber2(y2, b2)) === 0;
29274     };
29275     P2.isFinite = function() {
29276       return !!this.c;
29277     };
29278     P2.isGreaterThan = P2.gt = function(y2, b2) {
29279       return compare(this, new BigNumber2(y2, b2)) > 0;
29280     };
29281     P2.isGreaterThanOrEqualTo = P2.gte = function(y2, b2) {
29282       return (b2 = compare(this, new BigNumber2(y2, b2))) === 1 || b2 === 0;
29283     };
29284     P2.isInteger = function() {
29285       return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;
29286     };
29287     P2.isLessThan = P2.lt = function(y2, b2) {
29288       return compare(this, new BigNumber2(y2, b2)) < 0;
29289     };
29290     P2.isLessThanOrEqualTo = P2.lte = function(y2, b2) {
29291       return (b2 = compare(this, new BigNumber2(y2, b2))) === -1 || b2 === 0;
29292     };
29293     P2.isNaN = function() {
29294       return !this.s;
29295     };
29296     P2.isNegative = function() {
29297       return this.s < 0;
29298     };
29299     P2.isPositive = function() {
29300       return this.s > 0;
29301     };
29302     P2.isZero = function() {
29303       return !!this.c && this.c[0] == 0;
29304     };
29305     P2.minus = function(y2, b2) {
29306       var i3, j2, t2, xLTy, x2 = this, a2 = x2.s;
29307       y2 = new BigNumber2(y2, b2);
29308       b2 = y2.s;
29309       if (!a2 || !b2) return new BigNumber2(NaN);
29310       if (a2 != b2) {
29311         y2.s = -b2;
29312         return x2.plus(y2);
29313       }
29314       var xe2 = x2.e / LOG_BASE, ye2 = y2.e / LOG_BASE, xc = x2.c, yc = y2.c;
29315       if (!xe2 || !ye2) {
29316         if (!xc || !yc) return xc ? (y2.s = -b2, y2) : new BigNumber2(yc ? x2 : NaN);
29317         if (!xc[0] || !yc[0]) {
29318           return yc[0] ? (y2.s = -b2, y2) : new BigNumber2(xc[0] ? x2 : (
29319             // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity
29320             ROUNDING_MODE == 3 ? -0 : 0
29321           ));
29322         }
29323       }
29324       xe2 = bitFloor(xe2);
29325       ye2 = bitFloor(ye2);
29326       xc = xc.slice();
29327       if (a2 = xe2 - ye2) {
29328         if (xLTy = a2 < 0) {
29329           a2 = -a2;
29330           t2 = xc;
29331         } else {
29332           ye2 = xe2;
29333           t2 = yc;
29334         }
29335         t2.reverse();
29336         for (b2 = a2; b2--; t2.push(0)) ;
29337         t2.reverse();
29338       } else {
29339         j2 = (xLTy = (a2 = xc.length) < (b2 = yc.length)) ? a2 : b2;
29340         for (a2 = b2 = 0; b2 < j2; b2++) {
29341           if (xc[b2] != yc[b2]) {
29342             xLTy = xc[b2] < yc[b2];
29343             break;
29344           }
29345         }
29346       }
29347       if (xLTy) {
29348         t2 = xc;
29349         xc = yc;
29350         yc = t2;
29351         y2.s = -y2.s;
29352       }
29353       b2 = (j2 = yc.length) - (i3 = xc.length);
29354       if (b2 > 0) for (; b2--; xc[i3++] = 0) ;
29355       b2 = BASE - 1;
29356       for (; j2 > a2; ) {
29357         if (xc[--j2] < yc[j2]) {
29358           for (i3 = j2; i3 && !xc[--i3]; xc[i3] = b2) ;
29359           --xc[i3];
29360           xc[j2] += BASE;
29361         }
29362         xc[j2] -= yc[j2];
29363       }
29364       for (; xc[0] == 0; xc.splice(0, 1), --ye2) ;
29365       if (!xc[0]) {
29366         y2.s = ROUNDING_MODE == 3 ? -1 : 1;
29367         y2.c = [y2.e = 0];
29368         return y2;
29369       }
29370       return normalise(y2, xc, ye2);
29371     };
29372     P2.modulo = P2.mod = function(y2, b2) {
29373       var q2, s2, x2 = this;
29374       y2 = new BigNumber2(y2, b2);
29375       if (!x2.c || !y2.s || y2.c && !y2.c[0]) {
29376         return new BigNumber2(NaN);
29377       } else if (!y2.c || x2.c && !x2.c[0]) {
29378         return new BigNumber2(x2);
29379       }
29380       if (MODULO_MODE == 9) {
29381         s2 = y2.s;
29382         y2.s = 1;
29383         q2 = div(x2, y2, 0, 3);
29384         y2.s = s2;
29385         q2.s *= s2;
29386       } else {
29387         q2 = div(x2, y2, 0, MODULO_MODE);
29388       }
29389       y2 = x2.minus(q2.times(y2));
29390       if (!y2.c[0] && MODULO_MODE == 1) y2.s = x2.s;
29391       return y2;
29392     };
29393     P2.multipliedBy = P2.times = function(y2, b2) {
29394       var c2, e3, i3, j2, k2, m2, xcL, xlo, xhi, ycL, ylo, yhi, zc, base, sqrtBase, x2 = this, xc = x2.c, yc = (y2 = new BigNumber2(y2, b2)).c;
29395       if (!xc || !yc || !xc[0] || !yc[0]) {
29396         if (!x2.s || !y2.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {
29397           y2.c = y2.e = y2.s = null;
29398         } else {
29399           y2.s *= x2.s;
29400           if (!xc || !yc) {
29401             y2.c = y2.e = null;
29402           } else {
29403             y2.c = [0];
29404             y2.e = 0;
29405           }
29406         }
29407         return y2;
29408       }
29409       e3 = bitFloor(x2.e / LOG_BASE) + bitFloor(y2.e / LOG_BASE);
29410       y2.s *= x2.s;
29411       xcL = xc.length;
29412       ycL = yc.length;
29413       if (xcL < ycL) {
29414         zc = xc;
29415         xc = yc;
29416         yc = zc;
29417         i3 = xcL;
29418         xcL = ycL;
29419         ycL = i3;
29420       }
29421       for (i3 = xcL + ycL, zc = []; i3--; zc.push(0)) ;
29422       base = BASE;
29423       sqrtBase = SQRT_BASE;
29424       for (i3 = ycL; --i3 >= 0; ) {
29425         c2 = 0;
29426         ylo = yc[i3] % sqrtBase;
29427         yhi = yc[i3] / sqrtBase | 0;
29428         for (k2 = xcL, j2 = i3 + k2; j2 > i3; ) {
29429           xlo = xc[--k2] % sqrtBase;
29430           xhi = xc[k2] / sqrtBase | 0;
29431           m2 = yhi * xlo + xhi * ylo;
29432           xlo = ylo * xlo + m2 % sqrtBase * sqrtBase + zc[j2] + c2;
29433           c2 = (xlo / base | 0) + (m2 / sqrtBase | 0) + yhi * xhi;
29434           zc[j2--] = xlo % base;
29435         }
29436         zc[j2] = c2;
29437       }
29438       if (c2) {
29439         ++e3;
29440       } else {
29441         zc.splice(0, 1);
29442       }
29443       return normalise(y2, zc, e3);
29444     };
29445     P2.negated = function() {
29446       var x2 = new BigNumber2(this);
29447       x2.s = -x2.s || null;
29448       return x2;
29449     };
29450     P2.plus = function(y2, b2) {
29451       var t2, x2 = this, a2 = x2.s;
29452       y2 = new BigNumber2(y2, b2);
29453       b2 = y2.s;
29454       if (!a2 || !b2) return new BigNumber2(NaN);
29455       if (a2 != b2) {
29456         y2.s = -b2;
29457         return x2.minus(y2);
29458       }
29459       var xe2 = x2.e / LOG_BASE, ye2 = y2.e / LOG_BASE, xc = x2.c, yc = y2.c;
29460       if (!xe2 || !ye2) {
29461         if (!xc || !yc) return new BigNumber2(a2 / 0);
29462         if (!xc[0] || !yc[0]) return yc[0] ? y2 : new BigNumber2(xc[0] ? x2 : a2 * 0);
29463       }
29464       xe2 = bitFloor(xe2);
29465       ye2 = bitFloor(ye2);
29466       xc = xc.slice();
29467       if (a2 = xe2 - ye2) {
29468         if (a2 > 0) {
29469           ye2 = xe2;
29470           t2 = yc;
29471         } else {
29472           a2 = -a2;
29473           t2 = xc;
29474         }
29475         t2.reverse();
29476         for (; a2--; t2.push(0)) ;
29477         t2.reverse();
29478       }
29479       a2 = xc.length;
29480       b2 = yc.length;
29481       if (a2 - b2 < 0) {
29482         t2 = yc;
29483         yc = xc;
29484         xc = t2;
29485         b2 = a2;
29486       }
29487       for (a2 = 0; b2; ) {
29488         a2 = (xc[--b2] = xc[b2] + yc[b2] + a2) / BASE | 0;
29489         xc[b2] = BASE === xc[b2] ? 0 : xc[b2] % BASE;
29490       }
29491       if (a2) {
29492         xc = [a2].concat(xc);
29493         ++ye2;
29494       }
29495       return normalise(y2, xc, ye2);
29496     };
29497     P2.precision = P2.sd = function(sd, rm) {
29498       var c2, n3, v2, x2 = this;
29499       if (sd != null && sd !== !!sd) {
29500         intCheck(sd, 1, MAX);
29501         if (rm == null) rm = ROUNDING_MODE;
29502         else intCheck(rm, 0, 8);
29503         return round(new BigNumber2(x2), sd, rm);
29504       }
29505       if (!(c2 = x2.c)) return null;
29506       v2 = c2.length - 1;
29507       n3 = v2 * LOG_BASE + 1;
29508       if (v2 = c2[v2]) {
29509         for (; v2 % 10 == 0; v2 /= 10, n3--) ;
29510         for (v2 = c2[0]; v2 >= 10; v2 /= 10, n3++) ;
29511       }
29512       if (sd && x2.e + 1 > n3) n3 = x2.e + 1;
29513       return n3;
29514     };
29515     P2.shiftedBy = function(k2) {
29516       intCheck(k2, -MAX_SAFE_INTEGER3, MAX_SAFE_INTEGER3);
29517       return this.times("1e" + k2);
29518     };
29519     P2.squareRoot = P2.sqrt = function() {
29520       var m2, n3, r2, rep, t2, x2 = this, c2 = x2.c, s2 = x2.s, e3 = x2.e, dp = DECIMAL_PLACES + 4, half = new BigNumber2("0.5");
29521       if (s2 !== 1 || !c2 || !c2[0]) {
29522         return new BigNumber2(!s2 || s2 < 0 && (!c2 || c2[0]) ? NaN : c2 ? x2 : 1 / 0);
29523       }
29524       s2 = Math.sqrt(+valueOf(x2));
29525       if (s2 == 0 || s2 == 1 / 0) {
29526         n3 = coeffToString(c2);
29527         if ((n3.length + e3) % 2 == 0) n3 += "0";
29528         s2 = Math.sqrt(+n3);
29529         e3 = bitFloor((e3 + 1) / 2) - (e3 < 0 || e3 % 2);
29530         if (s2 == 1 / 0) {
29531           n3 = "5e" + e3;
29532         } else {
29533           n3 = s2.toExponential();
29534           n3 = n3.slice(0, n3.indexOf("e") + 1) + e3;
29535         }
29536         r2 = new BigNumber2(n3);
29537       } else {
29538         r2 = new BigNumber2(s2 + "");
29539       }
29540       if (r2.c[0]) {
29541         e3 = r2.e;
29542         s2 = e3 + dp;
29543         if (s2 < 3) s2 = 0;
29544         for (; ; ) {
29545           t2 = r2;
29546           r2 = half.times(t2.plus(div(x2, t2, dp, 1)));
29547           if (coeffToString(t2.c).slice(0, s2) === (n3 = coeffToString(r2.c)).slice(0, s2)) {
29548             if (r2.e < e3) --s2;
29549             n3 = n3.slice(s2 - 3, s2 + 1);
29550             if (n3 == "9999" || !rep && n3 == "4999") {
29551               if (!rep) {
29552                 round(t2, t2.e + DECIMAL_PLACES + 2, 0);
29553                 if (t2.times(t2).eq(x2)) {
29554                   r2 = t2;
29555                   break;
29556                 }
29557               }
29558               dp += 4;
29559               s2 += 4;
29560               rep = 1;
29561             } else {
29562               if (!+n3 || !+n3.slice(1) && n3.charAt(0) == "5") {
29563                 round(r2, r2.e + DECIMAL_PLACES + 2, 1);
29564                 m2 = !r2.times(r2).eq(x2);
29565               }
29566               break;
29567             }
29568           }
29569         }
29570       }
29571       return round(r2, r2.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m2);
29572     };
29573     P2.toExponential = function(dp, rm) {
29574       if (dp != null) {
29575         intCheck(dp, 0, MAX);
29576         dp++;
29577       }
29578       return format2(this, dp, rm, 1);
29579     };
29580     P2.toFixed = function(dp, rm) {
29581       if (dp != null) {
29582         intCheck(dp, 0, MAX);
29583         dp = dp + this.e + 1;
29584       }
29585       return format2(this, dp, rm);
29586     };
29587     P2.toFormat = function(dp, rm, format3) {
29588       var str, x2 = this;
29589       if (format3 == null) {
29590         if (dp != null && rm && typeof rm == "object") {
29591           format3 = rm;
29592           rm = null;
29593         } else if (dp && typeof dp == "object") {
29594           format3 = dp;
29595           dp = rm = null;
29596         } else {
29597           format3 = FORMAT;
29598         }
29599       } else if (typeof format3 != "object") {
29600         throw Error(bignumberError + "Argument not an object: " + format3);
29601       }
29602       str = x2.toFixed(dp, rm);
29603       if (x2.c) {
29604         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;
29605         if (g22) {
29606           i3 = g1;
29607           g1 = g22;
29608           g22 = i3;
29609           len -= i3;
29610         }
29611         if (g1 > 0 && len > 0) {
29612           i3 = len % g1 || g1;
29613           intPart = intDigits.substr(0, i3);
29614           for (; i3 < len; i3 += g1) intPart += groupSeparator + intDigits.substr(i3, g1);
29615           if (g22 > 0) intPart += groupSeparator + intDigits.slice(i3);
29616           if (isNeg) intPart = "-" + intPart;
29617         }
29618         str = fractionPart ? intPart + (format3.decimalSeparator || "") + ((g22 = +format3.fractionGroupSize) ? fractionPart.replace(
29619           new RegExp("\\d{" + g22 + "}\\B", "g"),
29620           "$&" + (format3.fractionGroupSeparator || "")
29621         ) : fractionPart) : intPart;
29622       }
29623       return (format3.prefix || "") + str + (format3.suffix || "");
29624     };
29625     P2.toFraction = function(md) {
29626       var d2, d0, d1, d22, e3, exp2, n3, n0, n1, q2, r2, s2, x2 = this, xc = x2.c;
29627       if (md != null) {
29628         n3 = new BigNumber2(md);
29629         if (!n3.isInteger() && (n3.c || n3.s !== 1) || n3.lt(ONE)) {
29630           throw Error(bignumberError + "Argument " + (n3.isInteger() ? "out of range: " : "not an integer: ") + valueOf(n3));
29631         }
29632       }
29633       if (!xc) return new BigNumber2(x2);
29634       d2 = new BigNumber2(ONE);
29635       n1 = d0 = new BigNumber2(ONE);
29636       d1 = n0 = new BigNumber2(ONE);
29637       s2 = coeffToString(xc);
29638       e3 = d2.e = s2.length - x2.e - 1;
29639       d2.c[0] = POWS_TEN[(exp2 = e3 % LOG_BASE) < 0 ? LOG_BASE + exp2 : exp2];
29640       md = !md || n3.comparedTo(d2) > 0 ? e3 > 0 ? d2 : n1 : n3;
29641       exp2 = MAX_EXP;
29642       MAX_EXP = 1 / 0;
29643       n3 = new BigNumber2(s2);
29644       n0.c[0] = 0;
29645       for (; ; ) {
29646         q2 = div(n3, d2, 0, 1);
29647         d22 = d0.plus(q2.times(d1));
29648         if (d22.comparedTo(md) == 1) break;
29649         d0 = d1;
29650         d1 = d22;
29651         n1 = n0.plus(q2.times(d22 = n1));
29652         n0 = d22;
29653         d2 = n3.minus(q2.times(d22 = d2));
29654         n3 = d22;
29655       }
29656       d22 = div(md.minus(d0), d1, 0, 1);
29657       n0 = n0.plus(d22.times(n1));
29658       d0 = d0.plus(d22.times(d1));
29659       n0.s = n1.s = x2.s;
29660       e3 = e3 * 2;
29661       r2 = div(n1, d1, e3, ROUNDING_MODE).minus(x2).abs().comparedTo(
29662         div(n0, d0, e3, ROUNDING_MODE).minus(x2).abs()
29663       ) < 1 ? [n1, d1] : [n0, d0];
29664       MAX_EXP = exp2;
29665       return r2;
29666     };
29667     P2.toNumber = function() {
29668       return +valueOf(this);
29669     };
29670     P2.toPrecision = function(sd, rm) {
29671       if (sd != null) intCheck(sd, 1, MAX);
29672       return format2(this, sd, rm, 2);
29673     };
29674     P2.toString = function(b2) {
29675       var str, n3 = this, s2 = n3.s, e3 = n3.e;
29676       if (e3 === null) {
29677         if (s2) {
29678           str = "Infinity";
29679           if (s2 < 0) str = "-" + str;
29680         } else {
29681           str = "NaN";
29682         }
29683       } else {
29684         if (b2 == null) {
29685           str = e3 <= TO_EXP_NEG || e3 >= TO_EXP_POS ? toExponential(coeffToString(n3.c), e3) : toFixedPoint(coeffToString(n3.c), e3, "0");
29686         } else if (b2 === 10 && alphabetHasNormalDecimalDigits) {
29687           n3 = round(new BigNumber2(n3), DECIMAL_PLACES + e3 + 1, ROUNDING_MODE);
29688           str = toFixedPoint(coeffToString(n3.c), n3.e, "0");
29689         } else {
29690           intCheck(b2, 2, ALPHABET.length, "Base");
29691           str = convertBase(toFixedPoint(coeffToString(n3.c), e3, "0"), 10, b2, s2, true);
29692         }
29693         if (s2 < 0 && n3.c[0]) str = "-" + str;
29694       }
29695       return str;
29696     };
29697     P2.valueOf = P2.toJSON = function() {
29698       return valueOf(this);
29699     };
29700     P2._isBigNumber = true;
29701     P2[Symbol.toStringTag] = "BigNumber";
29702     P2[Symbol.for("nodejs.util.inspect.custom")] = P2.valueOf;
29703     if (configObject != null) BigNumber2.set(configObject);
29704     return BigNumber2;
29705   }
29706   function bitFloor(n3) {
29707     var i3 = n3 | 0;
29708     return n3 > 0 || n3 === i3 ? i3 : i3 - 1;
29709   }
29710   function coeffToString(a2) {
29711     var s2, z2, i3 = 1, j2 = a2.length, r2 = a2[0] + "";
29712     for (; i3 < j2; ) {
29713       s2 = a2[i3++] + "";
29714       z2 = LOG_BASE - s2.length;
29715       for (; z2--; s2 = "0" + s2) ;
29716       r2 += s2;
29717     }
29718     for (j2 = r2.length; r2.charCodeAt(--j2) === 48; ) ;
29719     return r2.slice(0, j2 + 1 || 1);
29720   }
29721   function compare(x2, y2) {
29722     var a2, b2, xc = x2.c, yc = y2.c, i3 = x2.s, j2 = y2.s, k2 = x2.e, l2 = y2.e;
29723     if (!i3 || !j2) return null;
29724     a2 = xc && !xc[0];
29725     b2 = yc && !yc[0];
29726     if (a2 || b2) return a2 ? b2 ? 0 : -j2 : i3;
29727     if (i3 != j2) return i3;
29728     a2 = i3 < 0;
29729     b2 = k2 == l2;
29730     if (!xc || !yc) return b2 ? 0 : !xc ^ a2 ? 1 : -1;
29731     if (!b2) return k2 > l2 ^ a2 ? 1 : -1;
29732     j2 = (k2 = xc.length) < (l2 = yc.length) ? k2 : l2;
29733     for (i3 = 0; i3 < j2; i3++) if (xc[i3] != yc[i3]) return xc[i3] > yc[i3] ^ a2 ? 1 : -1;
29734     return k2 == l2 ? 0 : k2 > l2 ^ a2 ? 1 : -1;
29735   }
29736   function intCheck(n3, min3, max3, name) {
29737     if (n3 < min3 || n3 > max3 || n3 !== mathfloor(n3)) {
29738       throw Error(bignumberError + (name || "Argument") + (typeof n3 == "number" ? n3 < min3 || n3 > max3 ? " out of range: " : " not an integer: " : " not a primitive number: ") + String(n3));
29739     }
29740   }
29741   function isOdd(n3) {
29742     var k2 = n3.c.length - 1;
29743     return bitFloor(n3.e / LOG_BASE) == k2 && n3.c[k2] % 2 != 0;
29744   }
29745   function toExponential(str, e3) {
29746     return (str.length > 1 ? str.charAt(0) + "." + str.slice(1) : str) + (e3 < 0 ? "e" : "e+") + e3;
29747   }
29748   function toFixedPoint(str, e3, z2) {
29749     var len, zs;
29750     if (e3 < 0) {
29751       for (zs = z2 + "."; ++e3; zs += z2) ;
29752       str = zs + str;
29753     } else {
29754       len = str.length;
29755       if (++e3 > len) {
29756         for (zs = z2, e3 -= len; --e3; zs += z2) ;
29757         str += zs;
29758       } else if (e3 < len) {
29759         str = str.slice(0, e3) + "." + str.slice(e3);
29760       }
29761     }
29762     return str;
29763   }
29764   var isNumeric, mathceil, mathfloor, bignumberError, tooManyDigits, BASE, LOG_BASE, MAX_SAFE_INTEGER3, POWS_TEN, SQRT_BASE, MAX, BigNumber, bignumber_default;
29765   var init_bignumber = __esm({
29766     "node_modules/bignumber.js/bignumber.mjs"() {
29767       isNumeric = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i;
29768       mathceil = Math.ceil;
29769       mathfloor = Math.floor;
29770       bignumberError = "[BigNumber Error] ";
29771       tooManyDigits = bignumberError + "Number primitive has more than 15 significant digits: ";
29772       BASE = 1e14;
29773       LOG_BASE = 14;
29774       MAX_SAFE_INTEGER3 = 9007199254740991;
29775       POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13];
29776       SQRT_BASE = 1e7;
29777       MAX = 1e9;
29778       BigNumber = clone();
29779       bignumber_default = BigNumber;
29780     }
29781   });
29782
29783   // node_modules/splaytree-ts/dist/esm/index.js
29784   var SplayTreeNode, SplayTreeSetNode, SplayTree, _a, _b, SplayTreeSet, SplayTreeIterableIterator, SplayTreeKeyIterableIterator, SplayTreeSetEntryIterableIterator;
29785   var init_esm = __esm({
29786     "node_modules/splaytree-ts/dist/esm/index.js"() {
29787       SplayTreeNode = class {
29788         constructor(key) {
29789           __publicField(this, "key");
29790           __publicField(this, "left", null);
29791           __publicField(this, "right", null);
29792           this.key = key;
29793         }
29794       };
29795       SplayTreeSetNode = class extends SplayTreeNode {
29796         constructor(key) {
29797           super(key);
29798         }
29799       };
29800       SplayTree = class {
29801         constructor() {
29802           __publicField(this, "size", 0);
29803           __publicField(this, "modificationCount", 0);
29804           __publicField(this, "splayCount", 0);
29805         }
29806         splay(key) {
29807           const root3 = this.root;
29808           if (root3 == null) {
29809             this.compare(key, key);
29810             return -1;
29811           }
29812           let right = null;
29813           let newTreeRight = null;
29814           let left = null;
29815           let newTreeLeft = null;
29816           let current = root3;
29817           const compare2 = this.compare;
29818           let comp;
29819           while (true) {
29820             comp = compare2(current.key, key);
29821             if (comp > 0) {
29822               let currentLeft = current.left;
29823               if (currentLeft == null) break;
29824               comp = compare2(currentLeft.key, key);
29825               if (comp > 0) {
29826                 current.left = currentLeft.right;
29827                 currentLeft.right = current;
29828                 current = currentLeft;
29829                 currentLeft = current.left;
29830                 if (currentLeft == null) break;
29831               }
29832               if (right == null) {
29833                 newTreeRight = current;
29834               } else {
29835                 right.left = current;
29836               }
29837               right = current;
29838               current = currentLeft;
29839             } else if (comp < 0) {
29840               let currentRight = current.right;
29841               if (currentRight == null) break;
29842               comp = compare2(currentRight.key, key);
29843               if (comp < 0) {
29844                 current.right = currentRight.left;
29845                 currentRight.left = current;
29846                 current = currentRight;
29847                 currentRight = current.right;
29848                 if (currentRight == null) break;
29849               }
29850               if (left == null) {
29851                 newTreeLeft = current;
29852               } else {
29853                 left.right = current;
29854               }
29855               left = current;
29856               current = currentRight;
29857             } else {
29858               break;
29859             }
29860           }
29861           if (left != null) {
29862             left.right = current.left;
29863             current.left = newTreeLeft;
29864           }
29865           if (right != null) {
29866             right.left = current.right;
29867             current.right = newTreeRight;
29868           }
29869           if (this.root !== current) {
29870             this.root = current;
29871             this.splayCount++;
29872           }
29873           return comp;
29874         }
29875         splayMin(node) {
29876           let current = node;
29877           let nextLeft = current.left;
29878           while (nextLeft != null) {
29879             const left = nextLeft;
29880             current.left = left.right;
29881             left.right = current;
29882             current = left;
29883             nextLeft = current.left;
29884           }
29885           return current;
29886         }
29887         splayMax(node) {
29888           let current = node;
29889           let nextRight = current.right;
29890           while (nextRight != null) {
29891             const right = nextRight;
29892             current.right = right.left;
29893             right.left = current;
29894             current = right;
29895             nextRight = current.right;
29896           }
29897           return current;
29898         }
29899         _delete(key) {
29900           if (this.root == null) return null;
29901           const comp = this.splay(key);
29902           if (comp != 0) return null;
29903           let root3 = this.root;
29904           const result = root3;
29905           const left = root3.left;
29906           this.size--;
29907           if (left == null) {
29908             this.root = root3.right;
29909           } else {
29910             const right = root3.right;
29911             root3 = this.splayMax(left);
29912             root3.right = right;
29913             this.root = root3;
29914           }
29915           this.modificationCount++;
29916           return result;
29917         }
29918         addNewRoot(node, comp) {
29919           this.size++;
29920           this.modificationCount++;
29921           const root3 = this.root;
29922           if (root3 == null) {
29923             this.root = node;
29924             return;
29925           }
29926           if (comp < 0) {
29927             node.left = root3;
29928             node.right = root3.right;
29929             root3.right = null;
29930           } else {
29931             node.right = root3;
29932             node.left = root3.left;
29933             root3.left = null;
29934           }
29935           this.root = node;
29936         }
29937         _first() {
29938           const root3 = this.root;
29939           if (root3 == null) return null;
29940           this.root = this.splayMin(root3);
29941           return this.root;
29942         }
29943         _last() {
29944           const root3 = this.root;
29945           if (root3 == null) return null;
29946           this.root = this.splayMax(root3);
29947           return this.root;
29948         }
29949         clear() {
29950           this.root = null;
29951           this.size = 0;
29952           this.modificationCount++;
29953         }
29954         has(key) {
29955           return this.validKey(key) && this.splay(key) == 0;
29956         }
29957         defaultCompare() {
29958           return (a2, b2) => a2 < b2 ? -1 : a2 > b2 ? 1 : 0;
29959         }
29960         wrap() {
29961           return {
29962             getRoot: () => {
29963               return this.root;
29964             },
29965             setRoot: (root3) => {
29966               this.root = root3;
29967             },
29968             getSize: () => {
29969               return this.size;
29970             },
29971             getModificationCount: () => {
29972               return this.modificationCount;
29973             },
29974             getSplayCount: () => {
29975               return this.splayCount;
29976             },
29977             setSplayCount: (count) => {
29978               this.splayCount = count;
29979             },
29980             splay: (key) => {
29981               return this.splay(key);
29982             },
29983             has: (key) => {
29984               return this.has(key);
29985             }
29986           };
29987         }
29988       };
29989       SplayTreeSet = class _SplayTreeSet extends SplayTree {
29990         constructor(compare2, isValidKey) {
29991           super();
29992           __publicField(this, "root", null);
29993           __publicField(this, "compare");
29994           __publicField(this, "validKey");
29995           __publicField(this, _a, "[object Set]");
29996           this.compare = compare2 != null ? compare2 : this.defaultCompare();
29997           this.validKey = isValidKey != null ? isValidKey : (v2) => v2 != null && v2 != void 0;
29998         }
29999         delete(element) {
30000           if (!this.validKey(element)) return false;
30001           return this._delete(element) != null;
30002         }
30003         deleteAll(elements) {
30004           for (const element of elements) {
30005             this.delete(element);
30006           }
30007         }
30008         forEach(f2) {
30009           const nodes = this[Symbol.iterator]();
30010           let result;
30011           while (result = nodes.next(), !result.done) {
30012             f2(result.value, result.value, this);
30013           }
30014         }
30015         add(element) {
30016           const compare2 = this.splay(element);
30017           if (compare2 != 0) this.addNewRoot(new SplayTreeSetNode(element), compare2);
30018           return this;
30019         }
30020         addAndReturn(element) {
30021           const compare2 = this.splay(element);
30022           if (compare2 != 0) this.addNewRoot(new SplayTreeSetNode(element), compare2);
30023           return this.root.key;
30024         }
30025         addAll(elements) {
30026           for (const element of elements) {
30027             this.add(element);
30028           }
30029         }
30030         isEmpty() {
30031           return this.root == null;
30032         }
30033         isNotEmpty() {
30034           return this.root != null;
30035         }
30036         single() {
30037           if (this.size == 0) throw "Bad state: No element";
30038           if (this.size > 1) throw "Bad state: Too many element";
30039           return this.root.key;
30040         }
30041         first() {
30042           if (this.size == 0) throw "Bad state: No element";
30043           return this._first().key;
30044         }
30045         last() {
30046           if (this.size == 0) throw "Bad state: No element";
30047           return this._last().key;
30048         }
30049         lastBefore(element) {
30050           if (element == null) throw "Invalid arguments(s)";
30051           if (this.root == null) return null;
30052           const comp = this.splay(element);
30053           if (comp < 0) return this.root.key;
30054           let node = this.root.left;
30055           if (node == null) return null;
30056           let nodeRight = node.right;
30057           while (nodeRight != null) {
30058             node = nodeRight;
30059             nodeRight = node.right;
30060           }
30061           return node.key;
30062         }
30063         firstAfter(element) {
30064           if (element == null) throw "Invalid arguments(s)";
30065           if (this.root == null) return null;
30066           const comp = this.splay(element);
30067           if (comp > 0) return this.root.key;
30068           let node = this.root.right;
30069           if (node == null) return null;
30070           let nodeLeft = node.left;
30071           while (nodeLeft != null) {
30072             node = nodeLeft;
30073             nodeLeft = node.left;
30074           }
30075           return node.key;
30076         }
30077         retainAll(elements) {
30078           const retainSet = new _SplayTreeSet(this.compare, this.validKey);
30079           const modificationCount = this.modificationCount;
30080           for (const object of elements) {
30081             if (modificationCount != this.modificationCount) {
30082               throw "Concurrent modification during iteration.";
30083             }
30084             if (this.validKey(object) && this.splay(object) == 0) {
30085               retainSet.add(this.root.key);
30086             }
30087           }
30088           if (retainSet.size != this.size) {
30089             this.root = retainSet.root;
30090             this.size = retainSet.size;
30091             this.modificationCount++;
30092           }
30093         }
30094         lookup(object) {
30095           if (!this.validKey(object)) return null;
30096           const comp = this.splay(object);
30097           if (comp != 0) return null;
30098           return this.root.key;
30099         }
30100         intersection(other2) {
30101           const result = new _SplayTreeSet(this.compare, this.validKey);
30102           for (const element of this) {
30103             if (other2.has(element)) result.add(element);
30104           }
30105           return result;
30106         }
30107         difference(other2) {
30108           const result = new _SplayTreeSet(this.compare, this.validKey);
30109           for (const element of this) {
30110             if (!other2.has(element)) result.add(element);
30111           }
30112           return result;
30113         }
30114         union(other2) {
30115           const u2 = this.clone();
30116           u2.addAll(other2);
30117           return u2;
30118         }
30119         clone() {
30120           const set4 = new _SplayTreeSet(this.compare, this.validKey);
30121           set4.size = this.size;
30122           set4.root = this.copyNode(this.root);
30123           return set4;
30124         }
30125         copyNode(node) {
30126           if (node == null) return null;
30127           function copyChildren(node2, dest) {
30128             let left;
30129             let right;
30130             do {
30131               left = node2.left;
30132               right = node2.right;
30133               if (left != null) {
30134                 const newLeft = new SplayTreeSetNode(left.key);
30135                 dest.left = newLeft;
30136                 copyChildren(left, newLeft);
30137               }
30138               if (right != null) {
30139                 const newRight = new SplayTreeSetNode(right.key);
30140                 dest.right = newRight;
30141                 node2 = right;
30142                 dest = newRight;
30143               }
30144             } while (right != null);
30145           }
30146           const result = new SplayTreeSetNode(node.key);
30147           copyChildren(node, result);
30148           return result;
30149         }
30150         toSet() {
30151           return this.clone();
30152         }
30153         entries() {
30154           return new SplayTreeSetEntryIterableIterator(this.wrap());
30155         }
30156         keys() {
30157           return this[Symbol.iterator]();
30158         }
30159         values() {
30160           return this[Symbol.iterator]();
30161         }
30162         [(_b = Symbol.iterator, _a = Symbol.toStringTag, _b)]() {
30163           return new SplayTreeKeyIterableIterator(this.wrap());
30164         }
30165       };
30166       SplayTreeIterableIterator = class {
30167         constructor(tree) {
30168           __publicField(this, "tree");
30169           __publicField(this, "path", new Array());
30170           __publicField(this, "modificationCount", null);
30171           __publicField(this, "splayCount");
30172           this.tree = tree;
30173           this.splayCount = tree.getSplayCount();
30174         }
30175         [Symbol.iterator]() {
30176           return this;
30177         }
30178         next() {
30179           if (this.moveNext()) return { done: false, value: this.current() };
30180           return { done: true, value: null };
30181         }
30182         current() {
30183           if (!this.path.length) return null;
30184           const node = this.path[this.path.length - 1];
30185           return this.getValue(node);
30186         }
30187         rebuildPath(key) {
30188           this.path.splice(0, this.path.length);
30189           this.tree.splay(key);
30190           this.path.push(this.tree.getRoot());
30191           this.splayCount = this.tree.getSplayCount();
30192         }
30193         findLeftMostDescendent(node) {
30194           while (node != null) {
30195             this.path.push(node);
30196             node = node.left;
30197           }
30198         }
30199         moveNext() {
30200           if (this.modificationCount != this.tree.getModificationCount()) {
30201             if (this.modificationCount == null) {
30202               this.modificationCount = this.tree.getModificationCount();
30203               let node2 = this.tree.getRoot();
30204               while (node2 != null) {
30205                 this.path.push(node2);
30206                 node2 = node2.left;
30207               }
30208               return this.path.length > 0;
30209             }
30210             throw "Concurrent modification during iteration.";
30211           }
30212           if (!this.path.length) return false;
30213           if (this.splayCount != this.tree.getSplayCount()) {
30214             this.rebuildPath(this.path[this.path.length - 1].key);
30215           }
30216           let node = this.path[this.path.length - 1];
30217           let next = node.right;
30218           if (next != null) {
30219             while (next != null) {
30220               this.path.push(next);
30221               next = next.left;
30222             }
30223             return true;
30224           }
30225           this.path.pop();
30226           while (this.path.length && this.path[this.path.length - 1].right === node) {
30227             node = this.path.pop();
30228           }
30229           return this.path.length > 0;
30230         }
30231       };
30232       SplayTreeKeyIterableIterator = class extends SplayTreeIterableIterator {
30233         getValue(node) {
30234           return node.key;
30235         }
30236       };
30237       SplayTreeSetEntryIterableIterator = class extends SplayTreeIterableIterator {
30238         getValue(node) {
30239           return [node.key, node.key];
30240         }
30241       };
30242     }
30243   });
30244
30245   // node_modules/polyclip-ts/dist/esm/index.js
30246   function orient_default(eps) {
30247     const almostCollinear = eps ? (area2, ax, ay, cx, cy) => area2.exponentiatedBy(2).isLessThanOrEqualTo(
30248       cx.minus(ax).exponentiatedBy(2).plus(cy.minus(ay).exponentiatedBy(2)).times(eps)
30249     ) : constant_default6(false);
30250     return (a2, b2, c2) => {
30251       const ax = a2.x, ay = a2.y, cx = c2.x, cy = c2.y;
30252       const area2 = ay.minus(cy).times(b2.x.minus(cx)).minus(ax.minus(cx).times(b2.y.minus(cy)));
30253       if (almostCollinear(area2, ax, ay, cx, cy)) return 0;
30254       return area2.comparedTo(0);
30255     };
30256   }
30257   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;
30258   var init_esm2 = __esm({
30259     "node_modules/polyclip-ts/dist/esm/index.js"() {
30260       init_bignumber();
30261       init_bignumber();
30262       init_esm();
30263       init_esm();
30264       init_esm();
30265       constant_default6 = (x2) => {
30266         return () => {
30267           return x2;
30268         };
30269       };
30270       compare_default = (eps) => {
30271         const almostEqual = eps ? (a2, b2) => b2.minus(a2).abs().isLessThanOrEqualTo(eps) : constant_default6(false);
30272         return (a2, b2) => {
30273           if (almostEqual(a2, b2)) return 0;
30274           return a2.comparedTo(b2);
30275         };
30276       };
30277       identity_default4 = (x2) => {
30278         return x2;
30279       };
30280       snap_default = (eps) => {
30281         if (eps) {
30282           const xTree = new SplayTreeSet(compare_default(eps));
30283           const yTree = new SplayTreeSet(compare_default(eps));
30284           const snapCoord = (coord2, tree) => {
30285             return tree.addAndReturn(coord2);
30286           };
30287           const snap = (v2) => {
30288             return {
30289               x: snapCoord(v2.x, xTree),
30290               y: snapCoord(v2.y, yTree)
30291             };
30292           };
30293           snap({ x: new bignumber_default(0), y: new bignumber_default(0) });
30294           return snap;
30295         }
30296         return identity_default4;
30297       };
30298       set3 = (eps) => {
30299         return {
30300           set: (eps2) => {
30301             precision = set3(eps2);
30302           },
30303           reset: () => set3(eps),
30304           compare: compare_default(eps),
30305           snap: snap_default(eps),
30306           orient: orient_default(eps)
30307         };
30308       };
30309       precision = set3();
30310       isInBbox = (bbox2, point) => {
30311         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);
30312       };
30313       getBboxOverlap = (b1, b2) => {
30314         if (b2.ur.x.isLessThan(b1.ll.x) || b1.ur.x.isLessThan(b2.ll.x) || b2.ur.y.isLessThan(b1.ll.y) || b1.ur.y.isLessThan(b2.ll.y))
30315           return null;
30316         const lowerX = b1.ll.x.isLessThan(b2.ll.x) ? b2.ll.x : b1.ll.x;
30317         const upperX = b1.ur.x.isLessThan(b2.ur.x) ? b1.ur.x : b2.ur.x;
30318         const lowerY = b1.ll.y.isLessThan(b2.ll.y) ? b2.ll.y : b1.ll.y;
30319         const upperY = b1.ur.y.isLessThan(b2.ur.y) ? b1.ur.y : b2.ur.y;
30320         return { ll: { x: lowerX, y: lowerY }, ur: { x: upperX, y: upperY } };
30321       };
30322       crossProduct = (a2, b2) => a2.x.times(b2.y).minus(a2.y.times(b2.x));
30323       dotProduct = (a2, b2) => a2.x.times(b2.x).plus(a2.y.times(b2.y));
30324       length = (v2) => dotProduct(v2, v2).sqrt();
30325       sineOfAngle = (pShared, pBase, pAngle) => {
30326         const vBase = { x: pBase.x.minus(pShared.x), y: pBase.y.minus(pShared.y) };
30327         const vAngle = { x: pAngle.x.minus(pShared.x), y: pAngle.y.minus(pShared.y) };
30328         return crossProduct(vAngle, vBase).div(length(vAngle)).div(length(vBase));
30329       };
30330       cosineOfAngle = (pShared, pBase, pAngle) => {
30331         const vBase = { x: pBase.x.minus(pShared.x), y: pBase.y.minus(pShared.y) };
30332         const vAngle = { x: pAngle.x.minus(pShared.x), y: pAngle.y.minus(pShared.y) };
30333         return dotProduct(vAngle, vBase).div(length(vAngle)).div(length(vBase));
30334       };
30335       horizontalIntersection = (pt2, v2, y2) => {
30336         if (v2.y.isZero()) return null;
30337         return { x: pt2.x.plus(v2.x.div(v2.y).times(y2.minus(pt2.y))), y: y2 };
30338       };
30339       verticalIntersection = (pt2, v2, x2) => {
30340         if (v2.x.isZero()) return null;
30341         return { x: x2, y: pt2.y.plus(v2.y.div(v2.x).times(x2.minus(pt2.x))) };
30342       };
30343       intersection = (pt1, v1, pt2, v2) => {
30344         if (v1.x.isZero()) return verticalIntersection(pt2, v2, pt1.x);
30345         if (v2.x.isZero()) return verticalIntersection(pt1, v1, pt2.x);
30346         if (v1.y.isZero()) return horizontalIntersection(pt2, v2, pt1.y);
30347         if (v2.y.isZero()) return horizontalIntersection(pt1, v1, pt2.y);
30348         const kross = crossProduct(v1, v2);
30349         if (kross.isZero()) return null;
30350         const ve2 = { x: pt2.x.minus(pt1.x), y: pt2.y.minus(pt1.y) };
30351         const d1 = crossProduct(ve2, v1).div(kross);
30352         const d2 = crossProduct(ve2, v2).div(kross);
30353         const x12 = pt1.x.plus(d2.times(v1.x)), x2 = pt2.x.plus(d1.times(v2.x));
30354         const y12 = pt1.y.plus(d2.times(v1.y)), y2 = pt2.y.plus(d1.times(v2.y));
30355         const x3 = x12.plus(x2).div(2);
30356         const y3 = y12.plus(y2).div(2);
30357         return { x: x3, y: y3 };
30358       };
30359       SweepEvent = class _SweepEvent {
30360         // Warning: 'point' input will be modified and re-used (for performance)
30361         constructor(point, isLeft) {
30362           __publicField(this, "point");
30363           __publicField(this, "isLeft");
30364           __publicField(this, "segment");
30365           __publicField(this, "otherSE");
30366           __publicField(this, "consumedBy");
30367           if (point.events === void 0) point.events = [this];
30368           else point.events.push(this);
30369           this.point = point;
30370           this.isLeft = isLeft;
30371         }
30372         // for ordering sweep events in the sweep event queue
30373         static compare(a2, b2) {
30374           const ptCmp = _SweepEvent.comparePoints(a2.point, b2.point);
30375           if (ptCmp !== 0) return ptCmp;
30376           if (a2.point !== b2.point) a2.link(b2);
30377           if (a2.isLeft !== b2.isLeft) return a2.isLeft ? 1 : -1;
30378           return Segment.compare(a2.segment, b2.segment);
30379         }
30380         // for ordering points in sweep line order
30381         static comparePoints(aPt, bPt) {
30382           if (aPt.x.isLessThan(bPt.x)) return -1;
30383           if (aPt.x.isGreaterThan(bPt.x)) return 1;
30384           if (aPt.y.isLessThan(bPt.y)) return -1;
30385           if (aPt.y.isGreaterThan(bPt.y)) return 1;
30386           return 0;
30387         }
30388         link(other2) {
30389           if (other2.point === this.point) {
30390             throw new Error("Tried to link already linked events");
30391           }
30392           const otherEvents = other2.point.events;
30393           for (let i3 = 0, iMax = otherEvents.length; i3 < iMax; i3++) {
30394             const evt = otherEvents[i3];
30395             this.point.events.push(evt);
30396             evt.point = this.point;
30397           }
30398           this.checkForConsuming();
30399         }
30400         /* Do a pass over our linked events and check to see if any pair
30401          * of segments match, and should be consumed. */
30402         checkForConsuming() {
30403           const numEvents = this.point.events.length;
30404           for (let i3 = 0; i3 < numEvents; i3++) {
30405             const evt1 = this.point.events[i3];
30406             if (evt1.segment.consumedBy !== void 0) continue;
30407             for (let j2 = i3 + 1; j2 < numEvents; j2++) {
30408               const evt2 = this.point.events[j2];
30409               if (evt2.consumedBy !== void 0) continue;
30410               if (evt1.otherSE.point.events !== evt2.otherSE.point.events) continue;
30411               evt1.segment.consume(evt2.segment);
30412             }
30413           }
30414         }
30415         getAvailableLinkedEvents() {
30416           const events = [];
30417           for (let i3 = 0, iMax = this.point.events.length; i3 < iMax; i3++) {
30418             const evt = this.point.events[i3];
30419             if (evt !== this && !evt.segment.ringOut && evt.segment.isInResult()) {
30420               events.push(evt);
30421             }
30422           }
30423           return events;
30424         }
30425         /**
30426          * Returns a comparator function for sorting linked events that will
30427          * favor the event that will give us the smallest left-side angle.
30428          * All ring construction starts as low as possible heading to the right,
30429          * so by always turning left as sharp as possible we'll get polygons
30430          * without uncessary loops & holes.
30431          *
30432          * The comparator function has a compute cache such that it avoids
30433          * re-computing already-computed values.
30434          */
30435         getLeftmostComparator(baseEvent) {
30436           const cache = /* @__PURE__ */ new Map();
30437           const fillCache = (linkedEvent) => {
30438             const nextEvent = linkedEvent.otherSE;
30439             cache.set(linkedEvent, {
30440               sine: sineOfAngle(this.point, baseEvent.point, nextEvent.point),
30441               cosine: cosineOfAngle(this.point, baseEvent.point, nextEvent.point)
30442             });
30443           };
30444           return (a2, b2) => {
30445             if (!cache.has(a2)) fillCache(a2);
30446             if (!cache.has(b2)) fillCache(b2);
30447             const { sine: asine, cosine: acosine } = cache.get(a2);
30448             const { sine: bsine, cosine: bcosine } = cache.get(b2);
30449             if (asine.isGreaterThanOrEqualTo(0) && bsine.isGreaterThanOrEqualTo(0)) {
30450               if (acosine.isLessThan(bcosine)) return 1;
30451               if (acosine.isGreaterThan(bcosine)) return -1;
30452               return 0;
30453             }
30454             if (asine.isLessThan(0) && bsine.isLessThan(0)) {
30455               if (acosine.isLessThan(bcosine)) return -1;
30456               if (acosine.isGreaterThan(bcosine)) return 1;
30457               return 0;
30458             }
30459             if (bsine.isLessThan(asine)) return -1;
30460             if (bsine.isGreaterThan(asine)) return 1;
30461             return 0;
30462           };
30463         }
30464       };
30465       RingOut = class _RingOut {
30466         constructor(events) {
30467           __publicField(this, "events");
30468           __publicField(this, "poly");
30469           __publicField(this, "_isExteriorRing");
30470           __publicField(this, "_enclosingRing");
30471           this.events = events;
30472           for (let i3 = 0, iMax = events.length; i3 < iMax; i3++) {
30473             events[i3].segment.ringOut = this;
30474           }
30475           this.poly = null;
30476         }
30477         /* Given the segments from the sweep line pass, compute & return a series
30478          * of closed rings from all the segments marked to be part of the result */
30479         static factory(allSegments) {
30480           const ringsOut = [];
30481           for (let i3 = 0, iMax = allSegments.length; i3 < iMax; i3++) {
30482             const segment = allSegments[i3];
30483             if (!segment.isInResult() || segment.ringOut) continue;
30484             let prevEvent = null;
30485             let event = segment.leftSE;
30486             let nextEvent = segment.rightSE;
30487             const events = [event];
30488             const startingPoint = event.point;
30489             const intersectionLEs = [];
30490             while (true) {
30491               prevEvent = event;
30492               event = nextEvent;
30493               events.push(event);
30494               if (event.point === startingPoint) break;
30495               while (true) {
30496                 const availableLEs = event.getAvailableLinkedEvents();
30497                 if (availableLEs.length === 0) {
30498                   const firstPt = events[0].point;
30499                   const lastPt = events[events.length - 1].point;
30500                   throw new Error(
30501                     `Unable to complete output ring starting at [${firstPt.x}, ${firstPt.y}]. Last matching segment found ends at [${lastPt.x}, ${lastPt.y}].`
30502                   );
30503                 }
30504                 if (availableLEs.length === 1) {
30505                   nextEvent = availableLEs[0].otherSE;
30506                   break;
30507                 }
30508                 let indexLE = null;
30509                 for (let j2 = 0, jMax = intersectionLEs.length; j2 < jMax; j2++) {
30510                   if (intersectionLEs[j2].point === event.point) {
30511                     indexLE = j2;
30512                     break;
30513                   }
30514                 }
30515                 if (indexLE !== null) {
30516                   const intersectionLE = intersectionLEs.splice(indexLE)[0];
30517                   const ringEvents = events.splice(intersectionLE.index);
30518                   ringEvents.unshift(ringEvents[0].otherSE);
30519                   ringsOut.push(new _RingOut(ringEvents.reverse()));
30520                   continue;
30521                 }
30522                 intersectionLEs.push({
30523                   index: events.length,
30524                   point: event.point
30525                 });
30526                 const comparator = event.getLeftmostComparator(prevEvent);
30527                 nextEvent = availableLEs.sort(comparator)[0].otherSE;
30528                 break;
30529               }
30530             }
30531             ringsOut.push(new _RingOut(events));
30532           }
30533           return ringsOut;
30534         }
30535         getGeom() {
30536           let prevPt = this.events[0].point;
30537           const points = [prevPt];
30538           for (let i3 = 1, iMax = this.events.length - 1; i3 < iMax; i3++) {
30539             const pt22 = this.events[i3].point;
30540             const nextPt2 = this.events[i3 + 1].point;
30541             if (precision.orient(pt22, prevPt, nextPt2) === 0) continue;
30542             points.push(pt22);
30543             prevPt = pt22;
30544           }
30545           if (points.length === 1) return null;
30546           const pt2 = points[0];
30547           const nextPt = points[1];
30548           if (precision.orient(pt2, prevPt, nextPt) === 0) points.shift();
30549           points.push(points[0]);
30550           const step = this.isExteriorRing() ? 1 : -1;
30551           const iStart = this.isExteriorRing() ? 0 : points.length - 1;
30552           const iEnd = this.isExteriorRing() ? points.length : -1;
30553           const orderedPoints = [];
30554           for (let i3 = iStart; i3 != iEnd; i3 += step)
30555             orderedPoints.push([points[i3].x.toNumber(), points[i3].y.toNumber()]);
30556           return orderedPoints;
30557         }
30558         isExteriorRing() {
30559           if (this._isExteriorRing === void 0) {
30560             const enclosing = this.enclosingRing();
30561             this._isExteriorRing = enclosing ? !enclosing.isExteriorRing() : true;
30562           }
30563           return this._isExteriorRing;
30564         }
30565         enclosingRing() {
30566           if (this._enclosingRing === void 0) {
30567             this._enclosingRing = this._calcEnclosingRing();
30568           }
30569           return this._enclosingRing;
30570         }
30571         /* Returns the ring that encloses this one, if any */
30572         _calcEnclosingRing() {
30573           var _a3, _b2;
30574           let leftMostEvt = this.events[0];
30575           for (let i3 = 1, iMax = this.events.length; i3 < iMax; i3++) {
30576             const evt = this.events[i3];
30577             if (SweepEvent.compare(leftMostEvt, evt) > 0) leftMostEvt = evt;
30578           }
30579           let prevSeg = leftMostEvt.segment.prevInResult();
30580           let prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
30581           while (true) {
30582             if (!prevSeg) return null;
30583             if (!prevPrevSeg) return prevSeg.ringOut;
30584             if (prevPrevSeg.ringOut !== prevSeg.ringOut) {
30585               if (((_a3 = prevPrevSeg.ringOut) == null ? void 0 : _a3.enclosingRing()) !== prevSeg.ringOut) {
30586                 return prevSeg.ringOut;
30587               } else return (_b2 = prevSeg.ringOut) == null ? void 0 : _b2.enclosingRing();
30588             }
30589             prevSeg = prevPrevSeg.prevInResult();
30590             prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
30591           }
30592         }
30593       };
30594       PolyOut = class {
30595         constructor(exteriorRing) {
30596           __publicField(this, "exteriorRing");
30597           __publicField(this, "interiorRings");
30598           this.exteriorRing = exteriorRing;
30599           exteriorRing.poly = this;
30600           this.interiorRings = [];
30601         }
30602         addInterior(ring) {
30603           this.interiorRings.push(ring);
30604           ring.poly = this;
30605         }
30606         getGeom() {
30607           const geom0 = this.exteriorRing.getGeom();
30608           if (geom0 === null) return null;
30609           const geom = [geom0];
30610           for (let i3 = 0, iMax = this.interiorRings.length; i3 < iMax; i3++) {
30611             const ringGeom = this.interiorRings[i3].getGeom();
30612             if (ringGeom === null) continue;
30613             geom.push(ringGeom);
30614           }
30615           return geom;
30616         }
30617       };
30618       MultiPolyOut = class {
30619         constructor(rings) {
30620           __publicField(this, "rings");
30621           __publicField(this, "polys");
30622           this.rings = rings;
30623           this.polys = this._composePolys(rings);
30624         }
30625         getGeom() {
30626           const geom = [];
30627           for (let i3 = 0, iMax = this.polys.length; i3 < iMax; i3++) {
30628             const polyGeom = this.polys[i3].getGeom();
30629             if (polyGeom === null) continue;
30630             geom.push(polyGeom);
30631           }
30632           return geom;
30633         }
30634         _composePolys(rings) {
30635           var _a3;
30636           const polys = [];
30637           for (let i3 = 0, iMax = rings.length; i3 < iMax; i3++) {
30638             const ring = rings[i3];
30639             if (ring.poly) continue;
30640             if (ring.isExteriorRing()) polys.push(new PolyOut(ring));
30641             else {
30642               const enclosingRing = ring.enclosingRing();
30643               if (!(enclosingRing == null ? void 0 : enclosingRing.poly)) polys.push(new PolyOut(enclosingRing));
30644               (_a3 = enclosingRing == null ? void 0 : enclosingRing.poly) == null ? void 0 : _a3.addInterior(ring);
30645             }
30646           }
30647           return polys;
30648         }
30649       };
30650       SweepLine = class {
30651         constructor(queue, comparator = Segment.compare) {
30652           __publicField(this, "queue");
30653           __publicField(this, "tree");
30654           __publicField(this, "segments");
30655           this.queue = queue;
30656           this.tree = new SplayTreeSet(comparator);
30657           this.segments = [];
30658         }
30659         process(event) {
30660           const segment = event.segment;
30661           const newEvents = [];
30662           if (event.consumedBy) {
30663             if (event.isLeft) this.queue.delete(event.otherSE);
30664             else this.tree.delete(segment);
30665             return newEvents;
30666           }
30667           if (event.isLeft) this.tree.add(segment);
30668           let prevSeg = segment;
30669           let nextSeg = segment;
30670           do {
30671             prevSeg = this.tree.lastBefore(prevSeg);
30672           } while (prevSeg != null && prevSeg.consumedBy != void 0);
30673           do {
30674             nextSeg = this.tree.firstAfter(nextSeg);
30675           } while (nextSeg != null && nextSeg.consumedBy != void 0);
30676           if (event.isLeft) {
30677             let prevMySplitter = null;
30678             if (prevSeg) {
30679               const prevInter = prevSeg.getIntersection(segment);
30680               if (prevInter !== null) {
30681                 if (!segment.isAnEndpoint(prevInter)) prevMySplitter = prevInter;
30682                 if (!prevSeg.isAnEndpoint(prevInter)) {
30683                   const newEventsFromSplit = this._splitSafely(prevSeg, prevInter);
30684                   for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
30685                     newEvents.push(newEventsFromSplit[i3]);
30686                   }
30687                 }
30688               }
30689             }
30690             let nextMySplitter = null;
30691             if (nextSeg) {
30692               const nextInter = nextSeg.getIntersection(segment);
30693               if (nextInter !== null) {
30694                 if (!segment.isAnEndpoint(nextInter)) nextMySplitter = nextInter;
30695                 if (!nextSeg.isAnEndpoint(nextInter)) {
30696                   const newEventsFromSplit = this._splitSafely(nextSeg, nextInter);
30697                   for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
30698                     newEvents.push(newEventsFromSplit[i3]);
30699                   }
30700                 }
30701               }
30702             }
30703             if (prevMySplitter !== null || nextMySplitter !== null) {
30704               let mySplitter = null;
30705               if (prevMySplitter === null) mySplitter = nextMySplitter;
30706               else if (nextMySplitter === null) mySplitter = prevMySplitter;
30707               else {
30708                 const cmpSplitters = SweepEvent.comparePoints(
30709                   prevMySplitter,
30710                   nextMySplitter
30711                 );
30712                 mySplitter = cmpSplitters <= 0 ? prevMySplitter : nextMySplitter;
30713               }
30714               this.queue.delete(segment.rightSE);
30715               newEvents.push(segment.rightSE);
30716               const newEventsFromSplit = segment.split(mySplitter);
30717               for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
30718                 newEvents.push(newEventsFromSplit[i3]);
30719               }
30720             }
30721             if (newEvents.length > 0) {
30722               this.tree.delete(segment);
30723               newEvents.push(event);
30724             } else {
30725               this.segments.push(segment);
30726               segment.prev = prevSeg;
30727             }
30728           } else {
30729             if (prevSeg && nextSeg) {
30730               const inter = prevSeg.getIntersection(nextSeg);
30731               if (inter !== null) {
30732                 if (!prevSeg.isAnEndpoint(inter)) {
30733                   const newEventsFromSplit = this._splitSafely(prevSeg, inter);
30734                   for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
30735                     newEvents.push(newEventsFromSplit[i3]);
30736                   }
30737                 }
30738                 if (!nextSeg.isAnEndpoint(inter)) {
30739                   const newEventsFromSplit = this._splitSafely(nextSeg, inter);
30740                   for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
30741                     newEvents.push(newEventsFromSplit[i3]);
30742                   }
30743                 }
30744               }
30745             }
30746             this.tree.delete(segment);
30747           }
30748           return newEvents;
30749         }
30750         /* Safely split a segment that is currently in the datastructures
30751          * IE - a segment other than the one that is currently being processed. */
30752         _splitSafely(seg, pt2) {
30753           this.tree.delete(seg);
30754           const rightSE = seg.rightSE;
30755           this.queue.delete(rightSE);
30756           const newEvents = seg.split(pt2);
30757           newEvents.push(rightSE);
30758           if (seg.consumedBy === void 0) this.tree.add(seg);
30759           return newEvents;
30760         }
30761       };
30762       Operation = class {
30763         constructor() {
30764           __publicField(this, "type");
30765           __publicField(this, "numMultiPolys");
30766         }
30767         run(type2, geom, moreGeoms) {
30768           operation.type = type2;
30769           const multipolys = [new MultiPolyIn(geom, true)];
30770           for (let i3 = 0, iMax = moreGeoms.length; i3 < iMax; i3++) {
30771             multipolys.push(new MultiPolyIn(moreGeoms[i3], false));
30772           }
30773           operation.numMultiPolys = multipolys.length;
30774           if (operation.type === "difference") {
30775             const subject = multipolys[0];
30776             let i3 = 1;
30777             while (i3 < multipolys.length) {
30778               if (getBboxOverlap(multipolys[i3].bbox, subject.bbox) !== null) i3++;
30779               else multipolys.splice(i3, 1);
30780             }
30781           }
30782           if (operation.type === "intersection") {
30783             for (let i3 = 0, iMax = multipolys.length; i3 < iMax; i3++) {
30784               const mpA = multipolys[i3];
30785               for (let j2 = i3 + 1, jMax = multipolys.length; j2 < jMax; j2++) {
30786                 if (getBboxOverlap(mpA.bbox, multipolys[j2].bbox) === null) return [];
30787               }
30788             }
30789           }
30790           const queue = new SplayTreeSet(SweepEvent.compare);
30791           for (let i3 = 0, iMax = multipolys.length; i3 < iMax; i3++) {
30792             const sweepEvents = multipolys[i3].getSweepEvents();
30793             for (let j2 = 0, jMax = sweepEvents.length; j2 < jMax; j2++) {
30794               queue.add(sweepEvents[j2]);
30795             }
30796           }
30797           const sweepLine = new SweepLine(queue);
30798           let evt = null;
30799           if (queue.size != 0) {
30800             evt = queue.first();
30801             queue.delete(evt);
30802           }
30803           while (evt) {
30804             const newEvents = sweepLine.process(evt);
30805             for (let i3 = 0, iMax = newEvents.length; i3 < iMax; i3++) {
30806               const evt2 = newEvents[i3];
30807               if (evt2.consumedBy === void 0) queue.add(evt2);
30808             }
30809             if (queue.size != 0) {
30810               evt = queue.first();
30811               queue.delete(evt);
30812             } else {
30813               evt = null;
30814             }
30815           }
30816           precision.reset();
30817           const ringsOut = RingOut.factory(sweepLine.segments);
30818           const result = new MultiPolyOut(ringsOut);
30819           return result.getGeom();
30820         }
30821       };
30822       operation = new Operation();
30823       operation_default = operation;
30824       segmentId = 0;
30825       Segment = class _Segment {
30826         /* Warning: a reference to ringWindings input will be stored,
30827          *  and possibly will be later modified */
30828         constructor(leftSE, rightSE, rings, windings) {
30829           __publicField(this, "id");
30830           __publicField(this, "leftSE");
30831           __publicField(this, "rightSE");
30832           __publicField(this, "rings");
30833           __publicField(this, "windings");
30834           __publicField(this, "ringOut");
30835           __publicField(this, "consumedBy");
30836           __publicField(this, "prev");
30837           __publicField(this, "_prevInResult");
30838           __publicField(this, "_beforeState");
30839           __publicField(this, "_afterState");
30840           __publicField(this, "_isInResult");
30841           this.id = ++segmentId;
30842           this.leftSE = leftSE;
30843           leftSE.segment = this;
30844           leftSE.otherSE = rightSE;
30845           this.rightSE = rightSE;
30846           rightSE.segment = this;
30847           rightSE.otherSE = leftSE;
30848           this.rings = rings;
30849           this.windings = windings;
30850         }
30851         /* This compare() function is for ordering segments in the sweep
30852          * line tree, and does so according to the following criteria:
30853          *
30854          * Consider the vertical line that lies an infinestimal step to the
30855          * right of the right-more of the two left endpoints of the input
30856          * segments. Imagine slowly moving a point up from negative infinity
30857          * in the increasing y direction. Which of the two segments will that
30858          * point intersect first? That segment comes 'before' the other one.
30859          *
30860          * If neither segment would be intersected by such a line, (if one
30861          * or more of the segments are vertical) then the line to be considered
30862          * is directly on the right-more of the two left inputs.
30863          */
30864         static compare(a2, b2) {
30865           const alx = a2.leftSE.point.x;
30866           const blx = b2.leftSE.point.x;
30867           const arx = a2.rightSE.point.x;
30868           const brx = b2.rightSE.point.x;
30869           if (brx.isLessThan(alx)) return 1;
30870           if (arx.isLessThan(blx)) return -1;
30871           const aly = a2.leftSE.point.y;
30872           const bly = b2.leftSE.point.y;
30873           const ary = a2.rightSE.point.y;
30874           const bry = b2.rightSE.point.y;
30875           if (alx.isLessThan(blx)) {
30876             if (bly.isLessThan(aly) && bly.isLessThan(ary)) return 1;
30877             if (bly.isGreaterThan(aly) && bly.isGreaterThan(ary)) return -1;
30878             const aCmpBLeft = a2.comparePoint(b2.leftSE.point);
30879             if (aCmpBLeft < 0) return 1;
30880             if (aCmpBLeft > 0) return -1;
30881             const bCmpARight = b2.comparePoint(a2.rightSE.point);
30882             if (bCmpARight !== 0) return bCmpARight;
30883             return -1;
30884           }
30885           if (alx.isGreaterThan(blx)) {
30886             if (aly.isLessThan(bly) && aly.isLessThan(bry)) return -1;
30887             if (aly.isGreaterThan(bly) && aly.isGreaterThan(bry)) return 1;
30888             const bCmpALeft = b2.comparePoint(a2.leftSE.point);
30889             if (bCmpALeft !== 0) return bCmpALeft;
30890             const aCmpBRight = a2.comparePoint(b2.rightSE.point);
30891             if (aCmpBRight < 0) return 1;
30892             if (aCmpBRight > 0) return -1;
30893             return 1;
30894           }
30895           if (aly.isLessThan(bly)) return -1;
30896           if (aly.isGreaterThan(bly)) return 1;
30897           if (arx.isLessThan(brx)) {
30898             const bCmpARight = b2.comparePoint(a2.rightSE.point);
30899             if (bCmpARight !== 0) return bCmpARight;
30900           }
30901           if (arx.isGreaterThan(brx)) {
30902             const aCmpBRight = a2.comparePoint(b2.rightSE.point);
30903             if (aCmpBRight < 0) return 1;
30904             if (aCmpBRight > 0) return -1;
30905           }
30906           if (!arx.eq(brx)) {
30907             const ay = ary.minus(aly);
30908             const ax = arx.minus(alx);
30909             const by = bry.minus(bly);
30910             const bx = brx.minus(blx);
30911             if (ay.isGreaterThan(ax) && by.isLessThan(bx)) return 1;
30912             if (ay.isLessThan(ax) && by.isGreaterThan(bx)) return -1;
30913           }
30914           if (arx.isGreaterThan(brx)) return 1;
30915           if (arx.isLessThan(brx)) return -1;
30916           if (ary.isLessThan(bry)) return -1;
30917           if (ary.isGreaterThan(bry)) return 1;
30918           if (a2.id < b2.id) return -1;
30919           if (a2.id > b2.id) return 1;
30920           return 0;
30921         }
30922         static fromRing(pt1, pt2, ring) {
30923           let leftPt, rightPt, winding;
30924           const cmpPts = SweepEvent.comparePoints(pt1, pt2);
30925           if (cmpPts < 0) {
30926             leftPt = pt1;
30927             rightPt = pt2;
30928             winding = 1;
30929           } else if (cmpPts > 0) {
30930             leftPt = pt2;
30931             rightPt = pt1;
30932             winding = -1;
30933           } else
30934             throw new Error(
30935               `Tried to create degenerate segment at [${pt1.x}, ${pt1.y}]`
30936             );
30937           const leftSE = new SweepEvent(leftPt, true);
30938           const rightSE = new SweepEvent(rightPt, false);
30939           return new _Segment(leftSE, rightSE, [ring], [winding]);
30940         }
30941         /* When a segment is split, the rightSE is replaced with a new sweep event */
30942         replaceRightSE(newRightSE) {
30943           this.rightSE = newRightSE;
30944           this.rightSE.segment = this;
30945           this.rightSE.otherSE = this.leftSE;
30946           this.leftSE.otherSE = this.rightSE;
30947         }
30948         bbox() {
30949           const y12 = this.leftSE.point.y;
30950           const y2 = this.rightSE.point.y;
30951           return {
30952             ll: { x: this.leftSE.point.x, y: y12.isLessThan(y2) ? y12 : y2 },
30953             ur: { x: this.rightSE.point.x, y: y12.isGreaterThan(y2) ? y12 : y2 }
30954           };
30955         }
30956         /* A vector from the left point to the right */
30957         vector() {
30958           return {
30959             x: this.rightSE.point.x.minus(this.leftSE.point.x),
30960             y: this.rightSE.point.y.minus(this.leftSE.point.y)
30961           };
30962         }
30963         isAnEndpoint(pt2) {
30964           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);
30965         }
30966         /* Compare this segment with a point.
30967          *
30968          * A point P is considered to be colinear to a segment if there
30969          * exists a distance D such that if we travel along the segment
30970          * from one * endpoint towards the other a distance D, we find
30971          * ourselves at point P.
30972          *
30973          * Return value indicates:
30974          *
30975          *   1: point lies above the segment (to the left of vertical)
30976          *   0: point is colinear to segment
30977          *  -1: point lies below the segment (to the right of vertical)
30978          */
30979         comparePoint(point) {
30980           return precision.orient(this.leftSE.point, point, this.rightSE.point);
30981         }
30982         /**
30983          * Given another segment, returns the first non-trivial intersection
30984          * between the two segments (in terms of sweep line ordering), if it exists.
30985          *
30986          * A 'non-trivial' intersection is one that will cause one or both of the
30987          * segments to be split(). As such, 'trivial' vs. 'non-trivial' intersection:
30988          *
30989          *   * endpoint of segA with endpoint of segB --> trivial
30990          *   * endpoint of segA with point along segB --> non-trivial
30991          *   * endpoint of segB with point along segA --> non-trivial
30992          *   * point along segA with point along segB --> non-trivial
30993          *
30994          * If no non-trivial intersection exists, return null
30995          * Else, return null.
30996          */
30997         getIntersection(other2) {
30998           const tBbox = this.bbox();
30999           const oBbox = other2.bbox();
31000           const bboxOverlap = getBboxOverlap(tBbox, oBbox);
31001           if (bboxOverlap === null) return null;
31002           const tlp = this.leftSE.point;
31003           const trp = this.rightSE.point;
31004           const olp = other2.leftSE.point;
31005           const orp = other2.rightSE.point;
31006           const touchesOtherLSE = isInBbox(tBbox, olp) && this.comparePoint(olp) === 0;
31007           const touchesThisLSE = isInBbox(oBbox, tlp) && other2.comparePoint(tlp) === 0;
31008           const touchesOtherRSE = isInBbox(tBbox, orp) && this.comparePoint(orp) === 0;
31009           const touchesThisRSE = isInBbox(oBbox, trp) && other2.comparePoint(trp) === 0;
31010           if (touchesThisLSE && touchesOtherLSE) {
31011             if (touchesThisRSE && !touchesOtherRSE) return trp;
31012             if (!touchesThisRSE && touchesOtherRSE) return orp;
31013             return null;
31014           }
31015           if (touchesThisLSE) {
31016             if (touchesOtherRSE) {
31017               if (tlp.x.eq(orp.x) && tlp.y.eq(orp.y)) return null;
31018             }
31019             return tlp;
31020           }
31021           if (touchesOtherLSE) {
31022             if (touchesThisRSE) {
31023               if (trp.x.eq(olp.x) && trp.y.eq(olp.y)) return null;
31024             }
31025             return olp;
31026           }
31027           if (touchesThisRSE && touchesOtherRSE) return null;
31028           if (touchesThisRSE) return trp;
31029           if (touchesOtherRSE) return orp;
31030           const pt2 = intersection(tlp, this.vector(), olp, other2.vector());
31031           if (pt2 === null) return null;
31032           if (!isInBbox(bboxOverlap, pt2)) return null;
31033           return precision.snap(pt2);
31034         }
31035         /**
31036          * Split the given segment into multiple segments on the given points.
31037          *  * Each existing segment will retain its leftSE and a new rightSE will be
31038          *    generated for it.
31039          *  * A new segment will be generated which will adopt the original segment's
31040          *    rightSE, and a new leftSE will be generated for it.
31041          *  * If there are more than two points given to split on, new segments
31042          *    in the middle will be generated with new leftSE and rightSE's.
31043          *  * An array of the newly generated SweepEvents will be returned.
31044          *
31045          * Warning: input array of points is modified
31046          */
31047         split(point) {
31048           const newEvents = [];
31049           const alreadyLinked = point.events !== void 0;
31050           const newLeftSE = new SweepEvent(point, true);
31051           const newRightSE = new SweepEvent(point, false);
31052           const oldRightSE = this.rightSE;
31053           this.replaceRightSE(newRightSE);
31054           newEvents.push(newRightSE);
31055           newEvents.push(newLeftSE);
31056           const newSeg = new _Segment(
31057             newLeftSE,
31058             oldRightSE,
31059             this.rings.slice(),
31060             this.windings.slice()
31061           );
31062           if (SweepEvent.comparePoints(newSeg.leftSE.point, newSeg.rightSE.point) > 0) {
31063             newSeg.swapEvents();
31064           }
31065           if (SweepEvent.comparePoints(this.leftSE.point, this.rightSE.point) > 0) {
31066             this.swapEvents();
31067           }
31068           if (alreadyLinked) {
31069             newLeftSE.checkForConsuming();
31070             newRightSE.checkForConsuming();
31071           }
31072           return newEvents;
31073         }
31074         /* Swap which event is left and right */
31075         swapEvents() {
31076           const tmpEvt = this.rightSE;
31077           this.rightSE = this.leftSE;
31078           this.leftSE = tmpEvt;
31079           this.leftSE.isLeft = true;
31080           this.rightSE.isLeft = false;
31081           for (let i3 = 0, iMax = this.windings.length; i3 < iMax; i3++) {
31082             this.windings[i3] *= -1;
31083           }
31084         }
31085         /* Consume another segment. We take their rings under our wing
31086          * and mark them as consumed. Use for perfectly overlapping segments */
31087         consume(other2) {
31088           let consumer = this;
31089           let consumee = other2;
31090           while (consumer.consumedBy) consumer = consumer.consumedBy;
31091           while (consumee.consumedBy) consumee = consumee.consumedBy;
31092           const cmp = _Segment.compare(consumer, consumee);
31093           if (cmp === 0) return;
31094           if (cmp > 0) {
31095             const tmp = consumer;
31096             consumer = consumee;
31097             consumee = tmp;
31098           }
31099           if (consumer.prev === consumee) {
31100             const tmp = consumer;
31101             consumer = consumee;
31102             consumee = tmp;
31103           }
31104           for (let i3 = 0, iMax = consumee.rings.length; i3 < iMax; i3++) {
31105             const ring = consumee.rings[i3];
31106             const winding = consumee.windings[i3];
31107             const index = consumer.rings.indexOf(ring);
31108             if (index === -1) {
31109               consumer.rings.push(ring);
31110               consumer.windings.push(winding);
31111             } else consumer.windings[index] += winding;
31112           }
31113           consumee.rings = null;
31114           consumee.windings = null;
31115           consumee.consumedBy = consumer;
31116           consumee.leftSE.consumedBy = consumer.leftSE;
31117           consumee.rightSE.consumedBy = consumer.rightSE;
31118         }
31119         /* The first segment previous segment chain that is in the result */
31120         prevInResult() {
31121           if (this._prevInResult !== void 0) return this._prevInResult;
31122           if (!this.prev) this._prevInResult = null;
31123           else if (this.prev.isInResult()) this._prevInResult = this.prev;
31124           else this._prevInResult = this.prev.prevInResult();
31125           return this._prevInResult;
31126         }
31127         beforeState() {
31128           if (this._beforeState !== void 0) return this._beforeState;
31129           if (!this.prev)
31130             this._beforeState = {
31131               rings: [],
31132               windings: [],
31133               multiPolys: []
31134             };
31135           else {
31136             const seg = this.prev.consumedBy || this.prev;
31137             this._beforeState = seg.afterState();
31138           }
31139           return this._beforeState;
31140         }
31141         afterState() {
31142           if (this._afterState !== void 0) return this._afterState;
31143           const beforeState = this.beforeState();
31144           this._afterState = {
31145             rings: beforeState.rings.slice(0),
31146             windings: beforeState.windings.slice(0),
31147             multiPolys: []
31148           };
31149           const ringsAfter = this._afterState.rings;
31150           const windingsAfter = this._afterState.windings;
31151           const mpsAfter = this._afterState.multiPolys;
31152           for (let i3 = 0, iMax = this.rings.length; i3 < iMax; i3++) {
31153             const ring = this.rings[i3];
31154             const winding = this.windings[i3];
31155             const index = ringsAfter.indexOf(ring);
31156             if (index === -1) {
31157               ringsAfter.push(ring);
31158               windingsAfter.push(winding);
31159             } else windingsAfter[index] += winding;
31160           }
31161           const polysAfter = [];
31162           const polysExclude = [];
31163           for (let i3 = 0, iMax = ringsAfter.length; i3 < iMax; i3++) {
31164             if (windingsAfter[i3] === 0) continue;
31165             const ring = ringsAfter[i3];
31166             const poly = ring.poly;
31167             if (polysExclude.indexOf(poly) !== -1) continue;
31168             if (ring.isExterior) polysAfter.push(poly);
31169             else {
31170               if (polysExclude.indexOf(poly) === -1) polysExclude.push(poly);
31171               const index = polysAfter.indexOf(ring.poly);
31172               if (index !== -1) polysAfter.splice(index, 1);
31173             }
31174           }
31175           for (let i3 = 0, iMax = polysAfter.length; i3 < iMax; i3++) {
31176             const mp = polysAfter[i3].multiPoly;
31177             if (mpsAfter.indexOf(mp) === -1) mpsAfter.push(mp);
31178           }
31179           return this._afterState;
31180         }
31181         /* Is this segment part of the final result? */
31182         isInResult() {
31183           if (this.consumedBy) return false;
31184           if (this._isInResult !== void 0) return this._isInResult;
31185           const mpsBefore = this.beforeState().multiPolys;
31186           const mpsAfter = this.afterState().multiPolys;
31187           switch (operation_default.type) {
31188             case "union": {
31189               const noBefores = mpsBefore.length === 0;
31190               const noAfters = mpsAfter.length === 0;
31191               this._isInResult = noBefores !== noAfters;
31192               break;
31193             }
31194             case "intersection": {
31195               let least;
31196               let most;
31197               if (mpsBefore.length < mpsAfter.length) {
31198                 least = mpsBefore.length;
31199                 most = mpsAfter.length;
31200               } else {
31201                 least = mpsAfter.length;
31202                 most = mpsBefore.length;
31203               }
31204               this._isInResult = most === operation_default.numMultiPolys && least < most;
31205               break;
31206             }
31207             case "xor": {
31208               const diff = Math.abs(mpsBefore.length - mpsAfter.length);
31209               this._isInResult = diff % 2 === 1;
31210               break;
31211             }
31212             case "difference": {
31213               const isJustSubject = (mps) => mps.length === 1 && mps[0].isSubject;
31214               this._isInResult = isJustSubject(mpsBefore) !== isJustSubject(mpsAfter);
31215               break;
31216             }
31217           }
31218           return this._isInResult;
31219         }
31220       };
31221       RingIn = class {
31222         constructor(geomRing, poly, isExterior) {
31223           __publicField(this, "poly");
31224           __publicField(this, "isExterior");
31225           __publicField(this, "segments");
31226           __publicField(this, "bbox");
31227           if (!Array.isArray(geomRing) || geomRing.length === 0) {
31228             throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
31229           }
31230           this.poly = poly;
31231           this.isExterior = isExterior;
31232           this.segments = [];
31233           if (typeof geomRing[0][0] !== "number" || typeof geomRing[0][1] !== "number") {
31234             throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
31235           }
31236           const firstPoint = precision.snap({ x: new bignumber_default(geomRing[0][0]), y: new bignumber_default(geomRing[0][1]) });
31237           this.bbox = {
31238             ll: { x: firstPoint.x, y: firstPoint.y },
31239             ur: { x: firstPoint.x, y: firstPoint.y }
31240           };
31241           let prevPoint = firstPoint;
31242           for (let i3 = 1, iMax = geomRing.length; i3 < iMax; i3++) {
31243             if (typeof geomRing[i3][0] !== "number" || typeof geomRing[i3][1] !== "number") {
31244               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
31245             }
31246             const point = precision.snap({ x: new bignumber_default(geomRing[i3][0]), y: new bignumber_default(geomRing[i3][1]) });
31247             if (point.x.eq(prevPoint.x) && point.y.eq(prevPoint.y)) continue;
31248             this.segments.push(Segment.fromRing(prevPoint, point, this));
31249             if (point.x.isLessThan(this.bbox.ll.x)) this.bbox.ll.x = point.x;
31250             if (point.y.isLessThan(this.bbox.ll.y)) this.bbox.ll.y = point.y;
31251             if (point.x.isGreaterThan(this.bbox.ur.x)) this.bbox.ur.x = point.x;
31252             if (point.y.isGreaterThan(this.bbox.ur.y)) this.bbox.ur.y = point.y;
31253             prevPoint = point;
31254           }
31255           if (!firstPoint.x.eq(prevPoint.x) || !firstPoint.y.eq(prevPoint.y)) {
31256             this.segments.push(Segment.fromRing(prevPoint, firstPoint, this));
31257           }
31258         }
31259         getSweepEvents() {
31260           const sweepEvents = [];
31261           for (let i3 = 0, iMax = this.segments.length; i3 < iMax; i3++) {
31262             const segment = this.segments[i3];
31263             sweepEvents.push(segment.leftSE);
31264             sweepEvents.push(segment.rightSE);
31265           }
31266           return sweepEvents;
31267         }
31268       };
31269       PolyIn = class {
31270         constructor(geomPoly, multiPoly) {
31271           __publicField(this, "multiPoly");
31272           __publicField(this, "exteriorRing");
31273           __publicField(this, "interiorRings");
31274           __publicField(this, "bbox");
31275           if (!Array.isArray(geomPoly)) {
31276             throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
31277           }
31278           this.exteriorRing = new RingIn(geomPoly[0], this, true);
31279           this.bbox = {
31280             ll: { x: this.exteriorRing.bbox.ll.x, y: this.exteriorRing.bbox.ll.y },
31281             ur: { x: this.exteriorRing.bbox.ur.x, y: this.exteriorRing.bbox.ur.y }
31282           };
31283           this.interiorRings = [];
31284           for (let i3 = 1, iMax = geomPoly.length; i3 < iMax; i3++) {
31285             const ring = new RingIn(geomPoly[i3], this, false);
31286             if (ring.bbox.ll.x.isLessThan(this.bbox.ll.x)) this.bbox.ll.x = ring.bbox.ll.x;
31287             if (ring.bbox.ll.y.isLessThan(this.bbox.ll.y)) this.bbox.ll.y = ring.bbox.ll.y;
31288             if (ring.bbox.ur.x.isGreaterThan(this.bbox.ur.x)) this.bbox.ur.x = ring.bbox.ur.x;
31289             if (ring.bbox.ur.y.isGreaterThan(this.bbox.ur.y)) this.bbox.ur.y = ring.bbox.ur.y;
31290             this.interiorRings.push(ring);
31291           }
31292           this.multiPoly = multiPoly;
31293         }
31294         getSweepEvents() {
31295           const sweepEvents = this.exteriorRing.getSweepEvents();
31296           for (let i3 = 0, iMax = this.interiorRings.length; i3 < iMax; i3++) {
31297             const ringSweepEvents = this.interiorRings[i3].getSweepEvents();
31298             for (let j2 = 0, jMax = ringSweepEvents.length; j2 < jMax; j2++) {
31299               sweepEvents.push(ringSweepEvents[j2]);
31300             }
31301           }
31302           return sweepEvents;
31303         }
31304       };
31305       MultiPolyIn = class {
31306         constructor(geom, isSubject) {
31307           __publicField(this, "isSubject");
31308           __publicField(this, "polys");
31309           __publicField(this, "bbox");
31310           if (!Array.isArray(geom)) {
31311             throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
31312           }
31313           try {
31314             if (typeof geom[0][0][0] === "number") geom = [geom];
31315           } catch (ex) {
31316           }
31317           this.polys = [];
31318           this.bbox = {
31319             ll: { x: new bignumber_default(Number.POSITIVE_INFINITY), y: new bignumber_default(Number.POSITIVE_INFINITY) },
31320             ur: { x: new bignumber_default(Number.NEGATIVE_INFINITY), y: new bignumber_default(Number.NEGATIVE_INFINITY) }
31321           };
31322           for (let i3 = 0, iMax = geom.length; i3 < iMax; i3++) {
31323             const poly = new PolyIn(geom[i3], this);
31324             if (poly.bbox.ll.x.isLessThan(this.bbox.ll.x)) this.bbox.ll.x = poly.bbox.ll.x;
31325             if (poly.bbox.ll.y.isLessThan(this.bbox.ll.y)) this.bbox.ll.y = poly.bbox.ll.y;
31326             if (poly.bbox.ur.x.isGreaterThan(this.bbox.ur.x)) this.bbox.ur.x = poly.bbox.ur.x;
31327             if (poly.bbox.ur.y.isGreaterThan(this.bbox.ur.y)) this.bbox.ur.y = poly.bbox.ur.y;
31328             this.polys.push(poly);
31329           }
31330           this.isSubject = isSubject;
31331         }
31332         getSweepEvents() {
31333           const sweepEvents = [];
31334           for (let i3 = 0, iMax = this.polys.length; i3 < iMax; i3++) {
31335             const polySweepEvents = this.polys[i3].getSweepEvents();
31336             for (let j2 = 0, jMax = polySweepEvents.length; j2 < jMax; j2++) {
31337               sweepEvents.push(polySweepEvents[j2]);
31338             }
31339           }
31340           return sweepEvents;
31341         }
31342       };
31343       union = (geom, ...moreGeoms) => operation_default.run("union", geom, moreGeoms);
31344       difference = (geom, ...moreGeoms) => operation_default.run("difference", geom, moreGeoms);
31345       setPrecision = precision.set;
31346     }
31347   });
31348
31349   // node_modules/wgs84/index.js
31350   var require_wgs84 = __commonJS({
31351     "node_modules/wgs84/index.js"(exports2, module2) {
31352       module2.exports.RADIUS = 6378137;
31353       module2.exports.FLATTENING = 1 / 298.257223563;
31354       module2.exports.POLAR_RADIUS = 63567523142e-4;
31355     }
31356   });
31357
31358   // node_modules/@mapbox/geojson-area/index.js
31359   var require_geojson_area = __commonJS({
31360     "node_modules/@mapbox/geojson-area/index.js"(exports2, module2) {
31361       var wgs84 = require_wgs84();
31362       module2.exports.geometry = geometry;
31363       module2.exports.ring = ringArea;
31364       function geometry(_2) {
31365         var area = 0, i3;
31366         switch (_2.type) {
31367           case "Polygon":
31368             return polygonArea(_2.coordinates);
31369           case "MultiPolygon":
31370             for (i3 = 0; i3 < _2.coordinates.length; i3++) {
31371               area += polygonArea(_2.coordinates[i3]);
31372             }
31373             return area;
31374           case "Point":
31375           case "MultiPoint":
31376           case "LineString":
31377           case "MultiLineString":
31378             return 0;
31379           case "GeometryCollection":
31380             for (i3 = 0; i3 < _2.geometries.length; i3++) {
31381               area += geometry(_2.geometries[i3]);
31382             }
31383             return area;
31384         }
31385       }
31386       function polygonArea(coords) {
31387         var area = 0;
31388         if (coords && coords.length > 0) {
31389           area += Math.abs(ringArea(coords[0]));
31390           for (var i3 = 1; i3 < coords.length; i3++) {
31391             area -= Math.abs(ringArea(coords[i3]));
31392           }
31393         }
31394         return area;
31395       }
31396       function ringArea(coords) {
31397         var p1, p2, p3, lowerIndex, middleIndex, upperIndex, i3, area = 0, coordsLength = coords.length;
31398         if (coordsLength > 2) {
31399           for (i3 = 0; i3 < coordsLength; i3++) {
31400             if (i3 === coordsLength - 2) {
31401               lowerIndex = coordsLength - 2;
31402               middleIndex = coordsLength - 1;
31403               upperIndex = 0;
31404             } else if (i3 === coordsLength - 1) {
31405               lowerIndex = coordsLength - 1;
31406               middleIndex = 0;
31407               upperIndex = 1;
31408             } else {
31409               lowerIndex = i3;
31410               middleIndex = i3 + 1;
31411               upperIndex = i3 + 2;
31412             }
31413             p1 = coords[lowerIndex];
31414             p2 = coords[middleIndex];
31415             p3 = coords[upperIndex];
31416             area += (rad(p3[0]) - rad(p1[0])) * Math.sin(rad(p2[1]));
31417           }
31418           area = area * wgs84.RADIUS * wgs84.RADIUS / 2;
31419         }
31420         return area;
31421       }
31422       function rad(_2) {
31423         return _2 * Math.PI / 180;
31424       }
31425     }
31426   });
31427
31428   // node_modules/circle-to-polygon/input-validation/validateCenter.js
31429   var require_validateCenter = __commonJS({
31430     "node_modules/circle-to-polygon/input-validation/validateCenter.js"(exports2) {
31431       exports2.validateCenter = function validateCenter(center) {
31432         var validCenterLengths = [2, 3];
31433         if (!Array.isArray(center) || !validCenterLengths.includes(center.length)) {
31434           throw new Error("ERROR! Center has to be an array of length two or three");
31435         }
31436         var [lng, lat] = center;
31437         if (typeof lng !== "number" || typeof lat !== "number") {
31438           throw new Error(
31439             `ERROR! Longitude and Latitude has to be numbers but where ${typeof lng} and ${typeof lat}`
31440           );
31441         }
31442         if (lng > 180 || lng < -180) {
31443           throw new Error(`ERROR! Longitude has to be between -180 and 180 but was ${lng}`);
31444         }
31445         if (lat > 90 || lat < -90) {
31446           throw new Error(`ERROR! Latitude has to be between -90 and 90 but was ${lat}`);
31447         }
31448       };
31449     }
31450   });
31451
31452   // node_modules/circle-to-polygon/input-validation/validateRadius.js
31453   var require_validateRadius = __commonJS({
31454     "node_modules/circle-to-polygon/input-validation/validateRadius.js"(exports2) {
31455       exports2.validateRadius = function validateRadius(radius) {
31456         if (typeof radius !== "number") {
31457           throw new Error(`ERROR! Radius has to be a positive number but was: ${typeof radius}`);
31458         }
31459         if (radius <= 0) {
31460           throw new Error(`ERROR! Radius has to be a positive number but was: ${radius}`);
31461         }
31462       };
31463     }
31464   });
31465
31466   // node_modules/circle-to-polygon/input-validation/validateNumberOfEdges.js
31467   var require_validateNumberOfEdges = __commonJS({
31468     "node_modules/circle-to-polygon/input-validation/validateNumberOfEdges.js"(exports2) {
31469       exports2.validateNumberOfEdges = function validateNumberOfEdges(numberOfEdges) {
31470         if (typeof numberOfEdges !== "number") {
31471           const ARGUMENT_TYPE = Array.isArray(numberOfEdges) ? "array" : typeof numberOfEdges;
31472           throw new Error(`ERROR! Number of edges has to be a number but was: ${ARGUMENT_TYPE}`);
31473         }
31474         if (numberOfEdges < 3) {
31475           throw new Error(`ERROR! Number of edges has to be at least 3 but was: ${numberOfEdges}`);
31476         }
31477       };
31478     }
31479   });
31480
31481   // node_modules/circle-to-polygon/input-validation/validateEarthRadius.js
31482   var require_validateEarthRadius = __commonJS({
31483     "node_modules/circle-to-polygon/input-validation/validateEarthRadius.js"(exports2) {
31484       exports2.validateEarthRadius = function validateEarthRadius(earthRadius2) {
31485         if (typeof earthRadius2 !== "number") {
31486           const ARGUMENT_TYPE = Array.isArray(earthRadius2) ? "array" : typeof earthRadius2;
31487           throw new Error(`ERROR! Earth radius has to be a number but was: ${ARGUMENT_TYPE}`);
31488         }
31489         if (earthRadius2 <= 0) {
31490           throw new Error(`ERROR! Earth radius has to be a positive number but was: ${earthRadius2}`);
31491         }
31492       };
31493     }
31494   });
31495
31496   // node_modules/circle-to-polygon/input-validation/validateBearing.js
31497   var require_validateBearing = __commonJS({
31498     "node_modules/circle-to-polygon/input-validation/validateBearing.js"(exports2) {
31499       exports2.validateBearing = function validateBearing(bearing) {
31500         if (typeof bearing !== "number") {
31501           const ARGUMENT_TYPE = Array.isArray(bearing) ? "array" : typeof bearing;
31502           throw new Error(`ERROR! Bearing has to be a number but was: ${ARGUMENT_TYPE}`);
31503         }
31504       };
31505     }
31506   });
31507
31508   // node_modules/circle-to-polygon/input-validation/index.js
31509   var require_input_validation = __commonJS({
31510     "node_modules/circle-to-polygon/input-validation/index.js"(exports2) {
31511       var validateCenter = require_validateCenter().validateCenter;
31512       var validateRadius = require_validateRadius().validateRadius;
31513       var validateNumberOfEdges = require_validateNumberOfEdges().validateNumberOfEdges;
31514       var validateEarthRadius = require_validateEarthRadius().validateEarthRadius;
31515       var validateBearing = require_validateBearing().validateBearing;
31516       function validateInput({ center, radius, numberOfEdges, earthRadius: earthRadius2, bearing }) {
31517         validateCenter(center);
31518         validateRadius(radius);
31519         validateNumberOfEdges(numberOfEdges);
31520         validateEarthRadius(earthRadius2);
31521         validateBearing(bearing);
31522       }
31523       exports2.validateCenter = validateCenter;
31524       exports2.validateRadius = validateRadius;
31525       exports2.validateNumberOfEdges = validateNumberOfEdges;
31526       exports2.validateEarthRadius = validateEarthRadius;
31527       exports2.validateBearing = validateBearing;
31528       exports2.validateInput = validateInput;
31529     }
31530   });
31531
31532   // node_modules/circle-to-polygon/index.js
31533   var require_circle_to_polygon = __commonJS({
31534     "node_modules/circle-to-polygon/index.js"(exports2, module2) {
31535       "use strict";
31536       var { validateInput } = require_input_validation();
31537       var defaultEarthRadius = 6378137;
31538       function toRadians(angleInDegrees) {
31539         return angleInDegrees * Math.PI / 180;
31540       }
31541       function toDegrees(angleInRadians) {
31542         return angleInRadians * 180 / Math.PI;
31543       }
31544       function offset(c1, distance, earthRadius2, bearing) {
31545         var lat1 = toRadians(c1[1]);
31546         var lon1 = toRadians(c1[0]);
31547         var dByR = distance / earthRadius2;
31548         var lat = Math.asin(
31549           Math.sin(lat1) * Math.cos(dByR) + Math.cos(lat1) * Math.sin(dByR) * Math.cos(bearing)
31550         );
31551         var lon = lon1 + Math.atan2(
31552           Math.sin(bearing) * Math.sin(dByR) * Math.cos(lat1),
31553           Math.cos(dByR) - Math.sin(lat1) * Math.sin(lat)
31554         );
31555         return [toDegrees(lon), toDegrees(lat)];
31556       }
31557       module2.exports = function circleToPolygon2(center, radius, options2) {
31558         var n3 = getNumberOfEdges(options2);
31559         var earthRadius2 = getEarthRadius(options2);
31560         var bearing = getBearing(options2);
31561         var direction = getDirection(options2);
31562         validateInput({ center, radius, numberOfEdges: n3, earthRadius: earthRadius2, bearing });
31563         var start2 = toRadians(bearing);
31564         var coordinates = [];
31565         for (var i3 = 0; i3 < n3; ++i3) {
31566           coordinates.push(
31567             offset(
31568               center,
31569               radius,
31570               earthRadius2,
31571               start2 + direction * 2 * Math.PI * -i3 / n3
31572             )
31573           );
31574         }
31575         coordinates.push(coordinates[0]);
31576         return {
31577           type: "Polygon",
31578           coordinates: [coordinates]
31579         };
31580       };
31581       function getNumberOfEdges(options2) {
31582         if (isUndefinedOrNull(options2)) {
31583           return 32;
31584         } else if (isObjectNotArray(options2)) {
31585           var numberOfEdges = options2.numberOfEdges;
31586           return numberOfEdges === void 0 ? 32 : numberOfEdges;
31587         }
31588         return options2;
31589       }
31590       function getEarthRadius(options2) {
31591         if (isUndefinedOrNull(options2)) {
31592           return defaultEarthRadius;
31593         } else if (isObjectNotArray(options2)) {
31594           var earthRadius2 = options2.earthRadius;
31595           return earthRadius2 === void 0 ? defaultEarthRadius : earthRadius2;
31596         }
31597         return defaultEarthRadius;
31598       }
31599       function getDirection(options2) {
31600         if (isObjectNotArray(options2) && options2.rightHandRule) {
31601           return -1;
31602         }
31603         return 1;
31604       }
31605       function getBearing(options2) {
31606         if (isUndefinedOrNull(options2)) {
31607           return 0;
31608         } else if (isObjectNotArray(options2)) {
31609           var bearing = options2.bearing;
31610           return bearing === void 0 ? 0 : bearing;
31611         }
31612         return 0;
31613       }
31614       function isObjectNotArray(argument) {
31615         return argument !== null && typeof argument === "object" && !Array.isArray(argument);
31616       }
31617       function isUndefinedOrNull(argument) {
31618         return argument === null || argument === void 0;
31619       }
31620     }
31621   });
31622
31623   // node_modules/geojson-precision/index.js
31624   var require_geojson_precision = __commonJS({
31625     "node_modules/geojson-precision/index.js"(exports2, module2) {
31626       (function() {
31627         function parse(t2, coordinatePrecision, extrasPrecision) {
31628           function point(p2) {
31629             return p2.map(function(e3, index) {
31630               if (index < 2) {
31631                 return 1 * e3.toFixed(coordinatePrecision);
31632               } else {
31633                 return 1 * e3.toFixed(extrasPrecision);
31634               }
31635             });
31636           }
31637           function multi(l2) {
31638             return l2.map(point);
31639           }
31640           function poly(p2) {
31641             return p2.map(multi);
31642           }
31643           function multiPoly(m2) {
31644             return m2.map(poly);
31645           }
31646           function geometry(obj) {
31647             if (!obj) {
31648               return {};
31649             }
31650             switch (obj.type) {
31651               case "Point":
31652                 obj.coordinates = point(obj.coordinates);
31653                 return obj;
31654               case "LineString":
31655               case "MultiPoint":
31656                 obj.coordinates = multi(obj.coordinates);
31657                 return obj;
31658               case "Polygon":
31659               case "MultiLineString":
31660                 obj.coordinates = poly(obj.coordinates);
31661                 return obj;
31662               case "MultiPolygon":
31663                 obj.coordinates = multiPoly(obj.coordinates);
31664                 return obj;
31665               case "GeometryCollection":
31666                 obj.geometries = obj.geometries.map(geometry);
31667                 return obj;
31668               default:
31669                 return {};
31670             }
31671           }
31672           function feature3(obj) {
31673             obj.geometry = geometry(obj.geometry);
31674             return obj;
31675           }
31676           function featureCollection(f2) {
31677             f2.features = f2.features.map(feature3);
31678             return f2;
31679           }
31680           function geometryCollection(g3) {
31681             g3.geometries = g3.geometries.map(geometry);
31682             return g3;
31683           }
31684           if (!t2) {
31685             return t2;
31686           }
31687           switch (t2.type) {
31688             case "Feature":
31689               return feature3(t2);
31690             case "GeometryCollection":
31691               return geometryCollection(t2);
31692             case "FeatureCollection":
31693               return featureCollection(t2);
31694             case "Point":
31695             case "LineString":
31696             case "Polygon":
31697             case "MultiPoint":
31698             case "MultiPolygon":
31699             case "MultiLineString":
31700               return geometry(t2);
31701             default:
31702               return t2;
31703           }
31704         }
31705         module2.exports = parse;
31706         module2.exports.parse = parse;
31707       })();
31708     }
31709   });
31710
31711   // node_modules/@aitodotai/json-stringify-pretty-compact/index.js
31712   var require_json_stringify_pretty_compact = __commonJS({
31713     "node_modules/@aitodotai/json-stringify-pretty-compact/index.js"(exports2, module2) {
31714       function isObject2(obj) {
31715         return typeof obj === "object" && obj !== null;
31716       }
31717       function forEach(obj, cb) {
31718         if (Array.isArray(obj)) {
31719           obj.forEach(cb);
31720         } else if (isObject2(obj)) {
31721           Object.keys(obj).forEach(function(key) {
31722             var val = obj[key];
31723             cb(val, key);
31724           });
31725         }
31726       }
31727       function getTreeDepth(obj) {
31728         var depth = 0;
31729         if (Array.isArray(obj) || isObject2(obj)) {
31730           forEach(obj, function(val) {
31731             if (Array.isArray(val) || isObject2(val)) {
31732               var tmpDepth = getTreeDepth(val);
31733               if (tmpDepth > depth) {
31734                 depth = tmpDepth;
31735               }
31736             }
31737           });
31738           return depth + 1;
31739         }
31740         return depth;
31741       }
31742       function stringify3(obj, options2) {
31743         options2 = options2 || {};
31744         var indent = JSON.stringify([1], null, get4(options2, "indent", 2)).slice(2, -3);
31745         var addMargin = get4(options2, "margins", false);
31746         var addArrayMargin = get4(options2, "arrayMargins", false);
31747         var addObjectMargin = get4(options2, "objectMargins", false);
31748         var maxLength = indent === "" ? Infinity : get4(options2, "maxLength", 80);
31749         var maxNesting = get4(options2, "maxNesting", Infinity);
31750         return function _stringify(obj2, currentIndent, reserved) {
31751           if (obj2 && typeof obj2.toJSON === "function") {
31752             obj2 = obj2.toJSON();
31753           }
31754           var string = JSON.stringify(obj2);
31755           if (string === void 0) {
31756             return string;
31757           }
31758           var length2 = maxLength - currentIndent.length - reserved;
31759           var treeDepth = getTreeDepth(obj2);
31760           if (treeDepth <= maxNesting && string.length <= length2) {
31761             var prettified = prettify(string, {
31762               addMargin,
31763               addArrayMargin,
31764               addObjectMargin
31765             });
31766             if (prettified.length <= length2) {
31767               return prettified;
31768             }
31769           }
31770           if (isObject2(obj2)) {
31771             var nextIndent = currentIndent + indent;
31772             var items = [];
31773             var delimiters;
31774             var comma = function(array2, index2) {
31775               return index2 === array2.length - 1 ? 0 : 1;
31776             };
31777             if (Array.isArray(obj2)) {
31778               for (var index = 0; index < obj2.length; index++) {
31779                 items.push(
31780                   _stringify(obj2[index], nextIndent, comma(obj2, index)) || "null"
31781                 );
31782               }
31783               delimiters = "[]";
31784             } else {
31785               Object.keys(obj2).forEach(function(key, index2, array2) {
31786                 var keyPart = JSON.stringify(key) + ": ";
31787                 var value = _stringify(
31788                   obj2[key],
31789                   nextIndent,
31790                   keyPart.length + comma(array2, index2)
31791                 );
31792                 if (value !== void 0) {
31793                   items.push(keyPart + value);
31794                 }
31795               });
31796               delimiters = "{}";
31797             }
31798             if (items.length > 0) {
31799               return [
31800                 delimiters[0],
31801                 indent + items.join(",\n" + nextIndent),
31802                 delimiters[1]
31803               ].join("\n" + currentIndent);
31804             }
31805           }
31806           return string;
31807         }(obj, "", 0);
31808       }
31809       var stringOrChar = /("(?:[^\\"]|\\.)*")|[:,\][}{]/g;
31810       function prettify(string, options2) {
31811         options2 = options2 || {};
31812         var tokens = {
31813           "{": "{",
31814           "}": "}",
31815           "[": "[",
31816           "]": "]",
31817           ",": ", ",
31818           ":": ": "
31819         };
31820         if (options2.addMargin || options2.addObjectMargin) {
31821           tokens["{"] = "{ ";
31822           tokens["}"] = " }";
31823         }
31824         if (options2.addMargin || options2.addArrayMargin) {
31825           tokens["["] = "[ ";
31826           tokens["]"] = " ]";
31827         }
31828         return string.replace(stringOrChar, function(match, string2) {
31829           return string2 ? match : tokens[match];
31830         });
31831       }
31832       function get4(options2, name, defaultValue) {
31833         return name in options2 ? options2[name] : defaultValue;
31834       }
31835       module2.exports = stringify3;
31836     }
31837   });
31838
31839   // node_modules/@rapideditor/location-conflation/index.mjs
31840   function _clip(features, which) {
31841     if (!Array.isArray(features) || !features.length) return null;
31842     const fn = { UNION: union, DIFFERENCE: difference }[which];
31843     const args = features.map((feature3) => feature3.geometry.coordinates);
31844     const coords = fn.apply(null, args);
31845     return {
31846       type: "Feature",
31847       properties: {},
31848       geometry: {
31849         type: whichType(coords),
31850         coordinates: coords
31851       }
31852     };
31853     function whichType(coords2) {
31854       const a2 = Array.isArray(coords2);
31855       const b2 = a2 && Array.isArray(coords2[0]);
31856       const c2 = b2 && Array.isArray(coords2[0][0]);
31857       const d2 = c2 && Array.isArray(coords2[0][0][0]);
31858       return d2 ? "MultiPolygon" : "Polygon";
31859     }
31860   }
31861   function _cloneDeep(obj) {
31862     return JSON.parse(JSON.stringify(obj));
31863   }
31864   function _sortLocations(a2, b2) {
31865     const rank = { countrycoder: 1, geojson: 2, point: 3 };
31866     const aRank = rank[a2.type];
31867     const bRank = rank[b2.type];
31868     return aRank > bRank ? 1 : aRank < bRank ? -1 : a2.id.localeCompare(b2.id);
31869   }
31870   var import_geojson_area, import_circle_to_polygon, import_geojson_precision, import_json_stringify_pretty_compact, LocationConflation;
31871   var init_location_conflation = __esm({
31872     "node_modules/@rapideditor/location-conflation/index.mjs"() {
31873       init_country_coder();
31874       init_esm2();
31875       import_geojson_area = __toESM(require_geojson_area(), 1);
31876       import_circle_to_polygon = __toESM(require_circle_to_polygon(), 1);
31877       import_geojson_precision = __toESM(require_geojson_precision(), 1);
31878       import_json_stringify_pretty_compact = __toESM(require_json_stringify_pretty_compact(), 1);
31879       LocationConflation = class {
31880         // constructor
31881         //
31882         // `fc`  Optional FeatureCollection of known features
31883         //
31884         // Optionally pass a GeoJSON FeatureCollection of known features which we can refer to later.
31885         // Each feature must have a filename-like `id`, for example: `something.geojson`
31886         //
31887         // {
31888         //   "type": "FeatureCollection"
31889         //   "features": [
31890         //     {
31891         //       "type": "Feature",
31892         //       "id": "philly_metro.geojson",
31893         //       "properties": { … },
31894         //       "geometry": { … }
31895         //     }
31896         //   ]
31897         // }
31898         constructor(fc) {
31899           this._cache = {};
31900           this.strict = true;
31901           if (fc && fc.type === "FeatureCollection" && Array.isArray(fc.features)) {
31902             fc.features.forEach((feature3) => {
31903               feature3.properties = feature3.properties || {};
31904               let props = feature3.properties;
31905               let id2 = feature3.id || props.id;
31906               if (!id2 || !/^\S+\.geojson$/i.test(id2)) return;
31907               id2 = id2.toLowerCase();
31908               feature3.id = id2;
31909               props.id = id2;
31910               if (!props.area) {
31911                 const area = import_geojson_area.default.geometry(feature3.geometry) / 1e6;
31912                 props.area = Number(area.toFixed(2));
31913               }
31914               this._cache[id2] = feature3;
31915             });
31916           }
31917           let world = _cloneDeep(feature("Q2"));
31918           world.geometry = {
31919             type: "Polygon",
31920             coordinates: [[[-180, -90], [180, -90], [180, 90], [-180, 90], [-180, -90]]]
31921           };
31922           world.id = "Q2";
31923           world.properties.id = "Q2";
31924           world.properties.area = import_geojson_area.default.geometry(world.geometry) / 1e6;
31925           this._cache.Q2 = world;
31926         }
31927         // validateLocation
31928         // `location`  The location to validate
31929         //
31930         // Pass a `location` value to validate
31931         //
31932         // Returns a result like:
31933         //   {
31934         //     type:     'point', 'geojson', or 'countrycoder'
31935         //     location:  the queried location
31936         //     id:        the stable identifier for the feature
31937         //   }
31938         // or `null` if the location is invalid
31939         //
31940         validateLocation(location) {
31941           if (Array.isArray(location) && (location.length === 2 || location.length === 3)) {
31942             const lon = location[0];
31943             const lat = location[1];
31944             const radius = location[2];
31945             if (Number.isFinite(lon) && lon >= -180 && lon <= 180 && Number.isFinite(lat) && lat >= -90 && lat <= 90 && (location.length === 2 || Number.isFinite(radius) && radius > 0)) {
31946               const id2 = "[" + location.toString() + "]";
31947               return { type: "point", location, id: id2 };
31948             }
31949           } else if (typeof location === "string" && /^\S+\.geojson$/i.test(location)) {
31950             const id2 = location.toLowerCase();
31951             if (this._cache[id2]) {
31952               return { type: "geojson", location, id: id2 };
31953             }
31954           } else if (typeof location === "string" || typeof location === "number") {
31955             const feature3 = feature(location);
31956             if (feature3) {
31957               const id2 = feature3.properties.wikidata;
31958               return { type: "countrycoder", location, id: id2 };
31959             }
31960           }
31961           if (this.strict) {
31962             throw new Error(`validateLocation:  Invalid location: "${location}".`);
31963           } else {
31964             return null;
31965           }
31966         }
31967         // resolveLocation
31968         // `location`  The location to resolve
31969         //
31970         // Pass a `location` value to resolve
31971         //
31972         // Returns a result like:
31973         //   {
31974         //     type:      'point', 'geojson', or 'countrycoder'
31975         //     location:  the queried location
31976         //     id:        a stable identifier for the feature
31977         //     feature:   the resolved GeoJSON feature
31978         //   }
31979         //  or `null` if the location is invalid
31980         //
31981         resolveLocation(location) {
31982           const valid = this.validateLocation(location);
31983           if (!valid) return null;
31984           const id2 = valid.id;
31985           if (this._cache[id2]) {
31986             return Object.assign(valid, { feature: this._cache[id2] });
31987           }
31988           if (valid.type === "point") {
31989             const lon = location[0];
31990             const lat = location[1];
31991             const radius = location[2] || 25;
31992             const EDGES = 10;
31993             const PRECISION = 3;
31994             const area = Math.PI * radius * radius;
31995             const feature3 = this._cache[id2] = (0, import_geojson_precision.default)({
31996               type: "Feature",
31997               id: id2,
31998               properties: { id: id2, area: Number(area.toFixed(2)) },
31999               geometry: (0, import_circle_to_polygon.default)([lon, lat], radius * 1e3, EDGES)
32000               // km to m
32001             }, PRECISION);
32002             return Object.assign(valid, { feature: feature3 });
32003           } else if (valid.type === "geojson") {
32004           } else if (valid.type === "countrycoder") {
32005             let feature3 = _cloneDeep(feature(id2));
32006             let props = feature3.properties;
32007             if (Array.isArray(props.members)) {
32008               let aggregate = aggregateFeature(id2);
32009               aggregate.geometry.coordinates = _clip([aggregate], "UNION").geometry.coordinates;
32010               feature3.geometry = aggregate.geometry;
32011             }
32012             if (!props.area) {
32013               const area = import_geojson_area.default.geometry(feature3.geometry) / 1e6;
32014               props.area = Number(area.toFixed(2));
32015             }
32016             feature3.id = id2;
32017             props.id = id2;
32018             this._cache[id2] = feature3;
32019             return Object.assign(valid, { feature: feature3 });
32020           }
32021           if (this.strict) {
32022             throw new Error(`resolveLocation:  Couldn't resolve location "${location}".`);
32023           } else {
32024             return null;
32025           }
32026         }
32027         // validateLocationSet
32028         // `locationSet`  the locationSet to validate
32029         //
32030         // Pass a locationSet Object to validate like:
32031         //   {
32032         //     include: [ Array of locations ],
32033         //     exclude: [ Array of locations ]
32034         //   }
32035         //
32036         // Returns a result like:
32037         //   {
32038         //     type:         'locationset'
32039         //     locationSet:  the queried locationSet
32040         //     id:           the stable identifier for the feature
32041         //   }
32042         // or `null` if the locationSet is invalid
32043         //
32044         validateLocationSet(locationSet) {
32045           locationSet = locationSet || {};
32046           const validator = this.validateLocation.bind(this);
32047           let include = (locationSet.include || []).map(validator).filter(Boolean);
32048           let exclude = (locationSet.exclude || []).map(validator).filter(Boolean);
32049           if (!include.length) {
32050             if (this.strict) {
32051               throw new Error(`validateLocationSet:  LocationSet includes nothing.`);
32052             } else {
32053               locationSet.include = ["Q2"];
32054               include = [{ type: "countrycoder", location: "Q2", id: "Q2" }];
32055             }
32056           }
32057           include.sort(_sortLocations);
32058           let id2 = "+[" + include.map((d2) => d2.id).join(",") + "]";
32059           if (exclude.length) {
32060             exclude.sort(_sortLocations);
32061             id2 += "-[" + exclude.map((d2) => d2.id).join(",") + "]";
32062           }
32063           return { type: "locationset", locationSet, id: id2 };
32064         }
32065         // resolveLocationSet
32066         // `locationSet`  the locationSet to resolve
32067         //
32068         // Pass a locationSet Object to validate like:
32069         //   {
32070         //     include: [ Array of locations ],
32071         //     exclude: [ Array of locations ]
32072         //   }
32073         //
32074         // Returns a result like:
32075         //   {
32076         //     type:         'locationset'
32077         //     locationSet:  the queried locationSet
32078         //     id:           the stable identifier for the feature
32079         //     feature:      the resolved GeoJSON feature
32080         //   }
32081         // or `null` if the locationSet is invalid
32082         //
32083         resolveLocationSet(locationSet) {
32084           locationSet = locationSet || {};
32085           const valid = this.validateLocationSet(locationSet);
32086           if (!valid) return null;
32087           const id2 = valid.id;
32088           if (this._cache[id2]) {
32089             return Object.assign(valid, { feature: this._cache[id2] });
32090           }
32091           const resolver = this.resolveLocation.bind(this);
32092           const includes = (locationSet.include || []).map(resolver).filter(Boolean);
32093           const excludes = (locationSet.exclude || []).map(resolver).filter(Boolean);
32094           if (includes.length === 1 && excludes.length === 0) {
32095             return Object.assign(valid, { feature: includes[0].feature });
32096           }
32097           const includeGeoJSON = _clip(includes.map((d2) => d2.feature), "UNION");
32098           const excludeGeoJSON = _clip(excludes.map((d2) => d2.feature), "UNION");
32099           let resultGeoJSON = excludeGeoJSON ? _clip([includeGeoJSON, excludeGeoJSON], "DIFFERENCE") : includeGeoJSON;
32100           const area = import_geojson_area.default.geometry(resultGeoJSON.geometry) / 1e6;
32101           resultGeoJSON.id = id2;
32102           resultGeoJSON.properties = { id: id2, area: Number(area.toFixed(2)) };
32103           this._cache[id2] = resultGeoJSON;
32104           return Object.assign(valid, { feature: resultGeoJSON });
32105         }
32106         // stringify
32107         // convenience method to prettyStringify the given object
32108         stringify(obj, options2) {
32109           return (0, import_json_stringify_pretty_compact.default)(obj, options2);
32110         }
32111       };
32112     }
32113   });
32114
32115   // modules/core/LocationManager.js
32116   var LocationManager_exports = {};
32117   __export(LocationManager_exports, {
32118     LocationManager: () => LocationManager,
32119     locationManager: () => _sharedLocationManager
32120   });
32121   var import_which_polygon2, import_geojson_area2, _loco, LocationManager, _sharedLocationManager;
32122   var init_LocationManager = __esm({
32123     "modules/core/LocationManager.js"() {
32124       "use strict";
32125       init_location_conflation();
32126       import_which_polygon2 = __toESM(require_which_polygon());
32127       import_geojson_area2 = __toESM(require_geojson_area());
32128       _loco = new LocationConflation();
32129       LocationManager = class {
32130         /**
32131          * @constructor
32132          */
32133         constructor() {
32134           this._wp = null;
32135           this._resolved = /* @__PURE__ */ new Map();
32136           this._knownLocationSets = /* @__PURE__ */ new Map();
32137           this._locationIncludedIn = /* @__PURE__ */ new Map();
32138           this._locationExcludedIn = /* @__PURE__ */ new Map();
32139           const world = { locationSet: { include: ["Q2"] } };
32140           this._resolveLocationSet(world);
32141           this._rebuildIndex();
32142         }
32143         /**
32144          * _validateLocationSet
32145          * Pass an Object with a `locationSet` property.
32146          * Validates the `locationSet` and sets a `locationSetID` property on the object.
32147          * To avoid so much computation we only resolve the include and exclude regions, but not the locationSet itself.
32148          *
32149          * Use `_resolveLocationSet()` instead if you need to resolve geojson of locationSet, for example to render it.
32150          * Note: You need to call `_rebuildIndex()` after you're all finished validating the locationSets.
32151          *
32152          * @param  `obj`  Object to check, it should have `locationSet` property
32153          */
32154         _validateLocationSet(obj) {
32155           if (obj.locationSetID) return;
32156           try {
32157             let locationSet = obj.locationSet;
32158             if (!locationSet) {
32159               throw new Error("object missing locationSet property");
32160             }
32161             if (!locationSet.include) {
32162               locationSet.include = ["Q2"];
32163             }
32164             const locationSetID = _loco.validateLocationSet(locationSet).id;
32165             obj.locationSetID = locationSetID;
32166             if (this._knownLocationSets.has(locationSetID)) return;
32167             let area = 0;
32168             (locationSet.include || []).forEach((location) => {
32169               const locationID = _loco.validateLocation(location).id;
32170               let geojson = this._resolved.get(locationID);
32171               if (!geojson) {
32172                 geojson = _loco.resolveLocation(location).feature;
32173                 this._resolved.set(locationID, geojson);
32174               }
32175               area += geojson.properties.area;
32176               let s2 = this._locationIncludedIn.get(locationID);
32177               if (!s2) {
32178                 s2 = /* @__PURE__ */ new Set();
32179                 this._locationIncludedIn.set(locationID, s2);
32180               }
32181               s2.add(locationSetID);
32182             });
32183             (locationSet.exclude || []).forEach((location) => {
32184               const locationID = _loco.validateLocation(location).id;
32185               let geojson = this._resolved.get(locationID);
32186               if (!geojson) {
32187                 geojson = _loco.resolveLocation(location).feature;
32188                 this._resolved.set(locationID, geojson);
32189               }
32190               area -= geojson.properties.area;
32191               let s2 = this._locationExcludedIn.get(locationID);
32192               if (!s2) {
32193                 s2 = /* @__PURE__ */ new Set();
32194                 this._locationExcludedIn.set(locationID, s2);
32195               }
32196               s2.add(locationSetID);
32197             });
32198             this._knownLocationSets.set(locationSetID, area);
32199           } catch {
32200             obj.locationSet = { include: ["Q2"] };
32201             obj.locationSetID = "+[Q2]";
32202           }
32203         }
32204         /**
32205          * _resolveLocationSet
32206          * Does everything that `_validateLocationSet()` does, but then "resolves" the locationSet into GeoJSON.
32207          * This step is a bit more computationally expensive, so really only needed if you intend to render the shape.
32208          *
32209          * Note: You need to call `_rebuildIndex()` after you're all finished validating the locationSets.
32210          *
32211          * @param  `obj`  Object to check, it should have `locationSet` property
32212          */
32213         _resolveLocationSet(obj) {
32214           this._validateLocationSet(obj);
32215           if (this._resolved.has(obj.locationSetID)) return;
32216           try {
32217             const result = _loco.resolveLocationSet(obj.locationSet);
32218             const locationSetID = result.id;
32219             obj.locationSetID = locationSetID;
32220             if (!result.feature.geometry.coordinates.length || !result.feature.properties.area) {
32221               throw new Error(`locationSet ${locationSetID} resolves to an empty feature.`);
32222             }
32223             let geojson = JSON.parse(JSON.stringify(result.feature));
32224             geojson.id = locationSetID;
32225             geojson.properties.id = locationSetID;
32226             this._resolved.set(locationSetID, geojson);
32227           } catch {
32228             obj.locationSet = { include: ["Q2"] };
32229             obj.locationSetID = "+[Q2]";
32230           }
32231         }
32232         /**
32233          * _rebuildIndex
32234          * Rebuilds the whichPolygon index with whatever features have been resolved into GeoJSON.
32235          */
32236         _rebuildIndex() {
32237           this._wp = (0, import_which_polygon2.default)({ features: [...this._resolved.values()] });
32238         }
32239         /**
32240          * mergeCustomGeoJSON
32241          * Accepts a FeatureCollection-like object containing custom locations
32242          * Each feature must have a filename-like `id`, for example: `something.geojson`
32243          * {
32244          *   "type": "FeatureCollection"
32245          *   "features": [
32246          *     {
32247          *       "type": "Feature",
32248          *       "id": "philly_metro.geojson",
32249          *       "properties": { … },
32250          *       "geometry": { … }
32251          *     }
32252          *   ]
32253          * }
32254          *
32255          * @param  `fc`  FeatureCollection-like Object containing custom locations
32256          */
32257         mergeCustomGeoJSON(fc) {
32258           if (!fc || fc.type !== "FeatureCollection" || !Array.isArray(fc.features)) return;
32259           fc.features.forEach((feature3) => {
32260             feature3.properties = feature3.properties || {};
32261             let props = feature3.properties;
32262             let id2 = feature3.id || props.id;
32263             if (!id2 || !/^\S+\.geojson$/i.test(id2)) return;
32264             id2 = id2.toLowerCase();
32265             feature3.id = id2;
32266             props.id = id2;
32267             if (!props.area) {
32268               const area = import_geojson_area2.default.geometry(feature3.geometry) / 1e6;
32269               props.area = Number(area.toFixed(2));
32270             }
32271             _loco._cache[id2] = feature3;
32272           });
32273         }
32274         /**
32275          * mergeLocationSets
32276          * Accepts an Array of Objects containing `locationSet` properties:
32277          * [
32278          *  { id: 'preset1', locationSet: {…} },
32279          *  { id: 'preset2', locationSet: {…} },
32280          *  …
32281          * ]
32282          * After validating, the Objects will be decorated with a `locationSetID` property:
32283          * [
32284          *  { id: 'preset1', locationSet: {…}, locationSetID: '+[Q2]' },
32285          *  { id: 'preset2', locationSet: {…}, locationSetID: '+[Q30]' },
32286          *  …
32287          * ]
32288          *
32289          * @param  `objects`  Objects to check - they should have `locationSet` property
32290          * @return  Promise resolved true (this function used to be slow/async, now it's faster and sync)
32291          */
32292         mergeLocationSets(objects) {
32293           if (!Array.isArray(objects)) return Promise.reject("nothing to do");
32294           objects.forEach((obj) => this._validateLocationSet(obj));
32295           this._rebuildIndex();
32296           return Promise.resolve(objects);
32297         }
32298         /**
32299          * locationSetID
32300          * Returns a locationSetID for a given locationSet (fallback to `+[Q2]`, world)
32301          * (The locationSet doesn't necessarily need to be resolved to compute its `id`)
32302          *
32303          * @param  `locationSet`  A locationSet Object, e.g. `{ include: ['us'] }`
32304          * @return  String locationSetID, e.g. `+[Q30]`
32305          */
32306         locationSetID(locationSet) {
32307           let locationSetID;
32308           try {
32309             locationSetID = _loco.validateLocationSet(locationSet).id;
32310           } catch {
32311             locationSetID = "+[Q2]";
32312           }
32313           return locationSetID;
32314         }
32315         /**
32316          * feature
32317          * Returns the resolved GeoJSON feature for a given locationSetID (fallback to 'world')
32318          * A GeoJSON feature:
32319          * {
32320          *   type: 'Feature',
32321          *   id: '+[Q30]',
32322          *   properties: { id: '+[Q30]', area: 21817019.17, … },
32323          *   geometry: { … }
32324          * }
32325          *
32326          * @param  `locationSetID`  String identifier, e.g. `+[Q30]`
32327          * @return  GeoJSON object (fallback to world)
32328          */
32329         feature(locationSetID = "+[Q2]") {
32330           const feature3 = this._resolved.get(locationSetID);
32331           return feature3 || this._resolved.get("+[Q2]");
32332         }
32333         /**
32334          * locationSetsAt
32335          * Find all the locationSets valid at the given location.
32336          * Results include the area (in km²) to facilitate sorting.
32337          *
32338          * Object of locationSetIDs to areas (in km²)
32339          * {
32340          *   "+[Q2]": 511207893.3958111,
32341          *   "+[Q30]": 21817019.17,
32342          *   "+[new_jersey.geojson]": 22390.77,
32343          *   …
32344          * }
32345          *
32346          * @param  `loc`  `[lon,lat]` location to query, e.g. `[-74.4813, 40.7967]`
32347          * @return  Object of locationSetIDs valid at given location
32348          */
32349         locationSetsAt(loc) {
32350           let result = {};
32351           const hits = this._wp(loc, true) || [];
32352           const thiz = this;
32353           hits.forEach((prop) => {
32354             if (prop.id[0] !== "+") return;
32355             const locationSetID = prop.id;
32356             const area = thiz._knownLocationSets.get(locationSetID);
32357             if (area) {
32358               result[locationSetID] = area;
32359             }
32360           });
32361           hits.forEach((prop) => {
32362             if (prop.id[0] === "+") return;
32363             const locationID = prop.id;
32364             const included = thiz._locationIncludedIn.get(locationID);
32365             (included || []).forEach((locationSetID) => {
32366               const area = thiz._knownLocationSets.get(locationSetID);
32367               if (area) {
32368                 result[locationSetID] = area;
32369               }
32370             });
32371           });
32372           hits.forEach((prop) => {
32373             if (prop.id[0] === "+") return;
32374             const locationID = prop.id;
32375             const excluded = thiz._locationExcludedIn.get(locationID);
32376             (excluded || []).forEach((locationSetID) => {
32377               delete result[locationSetID];
32378             });
32379           });
32380           return result;
32381         }
32382         // Direct access to the location-conflation resolver
32383         loco() {
32384           return _loco;
32385         }
32386       };
32387       _sharedLocationManager = new LocationManager();
32388     }
32389   });
32390
32391   // modules/presets/collection.js
32392   var collection_exports = {};
32393   __export(collection_exports, {
32394     presetCollection: () => presetCollection
32395   });
32396   function presetCollection(collection) {
32397     const MAXRESULTS = 50;
32398     let _this = {};
32399     let _memo = {};
32400     _this.collection = collection;
32401     _this.item = (id2) => {
32402       if (_memo[id2]) return _memo[id2];
32403       const found = _this.collection.find((d2) => d2.id === id2);
32404       if (found) _memo[id2] = found;
32405       return found;
32406     };
32407     _this.index = (id2) => _this.collection.findIndex((d2) => d2.id === id2);
32408     _this.matchGeometry = (geometry) => {
32409       return presetCollection(
32410         _this.collection.filter((d2) => d2.matchGeometry(geometry))
32411       );
32412     };
32413     _this.matchAllGeometry = (geometries) => {
32414       return presetCollection(
32415         _this.collection.filter((d2) => d2 && d2.matchAllGeometry(geometries))
32416       );
32417     };
32418     _this.matchAnyGeometry = (geometries) => {
32419       return presetCollection(
32420         _this.collection.filter((d2) => geometries.some((geom) => d2.matchGeometry(geom)))
32421       );
32422     };
32423     _this.fallback = (geometry) => {
32424       let id2 = geometry;
32425       if (id2 === "vertex") id2 = "point";
32426       return _this.item(id2);
32427     };
32428     _this.search = (value, geometry, loc) => {
32429       if (!value) return _this;
32430       value = value.toLowerCase().trim();
32431       function leading(a2) {
32432         const index = a2.indexOf(value);
32433         return index === 0 || a2[index - 1] === " ";
32434       }
32435       function leadingStrict(a2) {
32436         const index = a2.indexOf(value);
32437         return index === 0;
32438       }
32439       function sortPresets(nameProp, aliasesProp) {
32440         return function sortNames(a2, b2) {
32441           let aCompare = a2[nameProp]();
32442           let bCompare = b2[nameProp]();
32443           if (aliasesProp) {
32444             const findMatchingAlias = (strings) => {
32445               if (strings.some((s2) => s2 === value)) {
32446                 return strings.find((s2) => s2 === value);
32447               } else {
32448                 return strings.filter((s2) => s2.includes(value)).sort((a3, b3) => a3.length - b3.length)[0];
32449               }
32450             };
32451             aCompare = findMatchingAlias([aCompare].concat(a2[aliasesProp]()));
32452             bCompare = findMatchingAlias([bCompare].concat(b2[aliasesProp]()));
32453           }
32454           if (value === aCompare) return -1;
32455           if (value === bCompare) return 1;
32456           let i3 = b2.originalScore - a2.originalScore;
32457           if (i3 !== 0) return i3;
32458           i3 = aCompare.indexOf(value) - bCompare.indexOf(value);
32459           if (i3 !== 0) return i3;
32460           return aCompare.length - bCompare.length;
32461         };
32462       }
32463       let pool = _this.collection;
32464       if (Array.isArray(loc)) {
32465         const validHere = _sharedLocationManager.locationSetsAt(loc);
32466         pool = pool.filter((a2) => !a2.locationSetID || validHere[a2.locationSetID]);
32467       }
32468       const searchable = pool.filter((a2) => a2.searchable !== false && a2.suggestion !== true);
32469       const suggestions = pool.filter((a2) => a2.suggestion === true);
32470       const leadingNames = searchable.filter((a2) => leading(a2.searchName()) || a2.searchAliases().some(leading)).sort(sortPresets("searchName", "searchAliases"));
32471       const leadingSuggestions = suggestions.filter((a2) => leadingStrict(a2.searchName())).sort(sortPresets("searchName"));
32472       const leadingNamesStripped = searchable.filter((a2) => leading(a2.searchNameStripped()) || a2.searchAliasesStripped().some(leading)).sort(sortPresets("searchNameStripped", "searchAliasesStripped"));
32473       const leadingSuggestionsStripped = suggestions.filter((a2) => leadingStrict(a2.searchNameStripped())).sort(sortPresets("searchNameStripped"));
32474       const leadingTerms = searchable.filter((a2) => (a2.terms() || []).some(leading));
32475       const leadingSuggestionTerms = suggestions.filter((a2) => (a2.terms() || []).some(leading));
32476       const leadingTagValues = searchable.filter((a2) => Object.values(a2.tags || {}).filter((val) => val !== "*").some(leading));
32477       const similarName = searchable.map((a2) => ({ preset: a2, dist: utilEditDistance(value, a2.searchName()) })).filter((a2) => a2.dist + Math.min(value.length - a2.preset.searchName().length, 0) < 3).sort((a2, b2) => a2.dist - b2.dist).map((a2) => a2.preset);
32478       const similarSuggestions = suggestions.map((a2) => ({ preset: a2, dist: utilEditDistance(value, a2.searchName()) })).filter((a2) => a2.dist + Math.min(value.length - a2.preset.searchName().length, 0) < 1).sort((a2, b2) => a2.dist - b2.dist).map((a2) => a2.preset);
32479       const similarTerms = searchable.filter((a2) => {
32480         return (a2.terms() || []).some((b2) => {
32481           return utilEditDistance(value, b2) + Math.min(value.length - b2.length, 0) < 3;
32482         });
32483       });
32484       let leadingTagKeyValues = [];
32485       if (value.includes("=")) {
32486         leadingTagKeyValues = searchable.filter((a2) => a2.tags && Object.keys(a2.tags).some((key) => key + "=" + a2.tags[key] === value)).concat(searchable.filter((a2) => a2.tags && Object.keys(a2.tags).some((key) => leading(key + "=" + a2.tags[key]))));
32487       }
32488       let results = leadingNames.concat(
32489         leadingSuggestions,
32490         leadingNamesStripped,
32491         leadingSuggestionsStripped,
32492         leadingTerms,
32493         leadingSuggestionTerms,
32494         leadingTagValues,
32495         similarName,
32496         similarSuggestions,
32497         similarTerms,
32498         leadingTagKeyValues
32499       ).slice(0, MAXRESULTS - 1);
32500       if (geometry) {
32501         if (typeof geometry === "string") {
32502           results.push(_this.fallback(geometry));
32503         } else {
32504           geometry.forEach((geom) => results.push(_this.fallback(geom)));
32505         }
32506       }
32507       return presetCollection(utilArrayUniq(results));
32508     };
32509     return _this;
32510   }
32511   var init_collection = __esm({
32512     "modules/presets/collection.js"() {
32513       "use strict";
32514       init_LocationManager();
32515       init_array3();
32516       init_util();
32517     }
32518   });
32519
32520   // modules/presets/category.js
32521   var category_exports = {};
32522   __export(category_exports, {
32523     presetCategory: () => presetCategory
32524   });
32525   function presetCategory(categoryID, category, allPresets) {
32526     let _this = Object.assign({}, category);
32527     let _searchName;
32528     let _searchNameStripped;
32529     _this.id = categoryID;
32530     _this.members = presetCollection(
32531       (category.members || []).map((presetID) => allPresets[presetID]).filter(Boolean)
32532     );
32533     _this.geometry = _this.members.collection.reduce((acc, preset) => {
32534       for (let i3 in preset.geometry) {
32535         const geometry = preset.geometry[i3];
32536         if (acc.indexOf(geometry) === -1) {
32537           acc.push(geometry);
32538         }
32539       }
32540       return acc;
32541     }, []);
32542     _this.matchGeometry = (geom) => _this.geometry.indexOf(geom) >= 0;
32543     _this.matchAllGeometry = (geometries) => _this.members.collection.some((preset) => preset.matchAllGeometry(geometries));
32544     _this.matchScore = () => -1;
32545     _this.name = () => _t(`_tagging.presets.categories.${categoryID}.name`, { "default": categoryID });
32546     _this.nameLabel = () => _t.append(`_tagging.presets.categories.${categoryID}.name`, { "default": categoryID });
32547     _this.terms = () => [];
32548     _this.searchName = () => {
32549       if (!_searchName) {
32550         _searchName = (_this.suggestion ? _this.originalName : _this.name()).toLowerCase();
32551       }
32552       return _searchName;
32553     };
32554     _this.searchNameStripped = () => {
32555       if (!_searchNameStripped) {
32556         _searchNameStripped = _this.searchName();
32557         if (_searchNameStripped.normalize) _searchNameStripped = _searchNameStripped.normalize("NFD");
32558         _searchNameStripped = _searchNameStripped.replace(/[\u0300-\u036f]/g, "");
32559       }
32560       return _searchNameStripped;
32561     };
32562     _this.searchAliases = () => [];
32563     _this.searchAliasesStripped = () => [];
32564     return _this;
32565   }
32566   var init_category = __esm({
32567     "modules/presets/category.js"() {
32568       "use strict";
32569       init_localizer();
32570       init_collection();
32571     }
32572   });
32573
32574   // modules/presets/field.js
32575   var field_exports = {};
32576   __export(field_exports, {
32577     presetField: () => presetField
32578   });
32579   function presetField(fieldID, field, allFields) {
32580     allFields = allFields || {};
32581     let _this = Object.assign({}, field);
32582     _this.id = fieldID;
32583     _this.safeid = utilSafeClassName(fieldID);
32584     _this.matchGeometry = (geom) => !_this.geometry || _this.geometry.indexOf(geom) !== -1;
32585     _this.matchAllGeometry = (geometries) => {
32586       return !_this.geometry || geometries.every((geom) => _this.geometry.indexOf(geom) !== -1);
32587     };
32588     _this.t = (scope, options2) => _t(`_tagging.presets.fields.${fieldID}.${scope}`, options2);
32589     _this.t.html = (scope, options2) => _t.html(`_tagging.presets.fields.${fieldID}.${scope}`, options2);
32590     _this.t.append = (scope, options2) => _t.append(`_tagging.presets.fields.${fieldID}.${scope}`, options2);
32591     _this.hasTextForStringId = (scope) => _mainLocalizer.hasTextForStringId(`_tagging.presets.fields.${fieldID}.${scope}`);
32592     _this.resolveReference = (which) => {
32593       const referenceRegex = /^\{(.*)\}$/;
32594       const match = (field[which] || "").match(referenceRegex);
32595       if (match) {
32596         const field2 = allFields[match[1]];
32597         if (field2) {
32598           return field2;
32599         }
32600         console.error(`Unable to resolve referenced field: ${match[1]}`);
32601       }
32602       return _this;
32603     };
32604     _this.title = () => _this.overrideLabel || _this.resolveReference("label").t("label", { "default": fieldID });
32605     _this.label = () => _this.overrideLabel ? (selection2) => selection2.text(_this.overrideLabel) : _this.resolveReference("label").t.append("label", { "default": fieldID });
32606     _this.placeholder = () => _this.resolveReference("placeholder").t("placeholder", { "default": "" });
32607     _this.originalTerms = (_this.terms || []).join();
32608     _this.terms = () => _this.resolveReference("label").t("terms", { "default": _this.originalTerms }).toLowerCase().trim().split(/\s*,+\s*/);
32609     _this.increment = _this.type === "number" ? _this.increment || 1 : void 0;
32610     return _this;
32611   }
32612   var init_field = __esm({
32613     "modules/presets/field.js"() {
32614       "use strict";
32615       init_localizer();
32616       init_util2();
32617     }
32618   });
32619
32620   // modules/presets/preset.js
32621   var preset_exports = {};
32622   __export(preset_exports, {
32623     presetPreset: () => presetPreset
32624   });
32625   function presetPreset(presetID, preset, addable, allFields, allPresets) {
32626     allFields = allFields || {};
32627     allPresets = allPresets || {};
32628     let _this = Object.assign({}, preset);
32629     let _addable = addable || false;
32630     let _searchName;
32631     let _searchNameStripped;
32632     let _searchAliases;
32633     let _searchAliasesStripped;
32634     const referenceRegex = /^\{(.*)\}$/;
32635     _this.id = presetID;
32636     _this.safeid = utilSafeClassName(presetID);
32637     _this.originalTerms = (_this.terms || []).join();
32638     _this.originalName = _this.name || "";
32639     _this.originalAliases = (_this.aliases || []).join("\n");
32640     _this.originalScore = _this.matchScore || 1;
32641     _this.originalReference = _this.reference || {};
32642     _this.originalFields = _this.fields || [];
32643     _this.originalMoreFields = _this.moreFields || [];
32644     _this.fields = (loc) => resolveFields("fields", loc);
32645     _this.moreFields = (loc) => resolveFields("moreFields", loc);
32646     _this.tags = _this.tags || {};
32647     _this.addTags = _this.addTags || _this.tags;
32648     _this.removeTags = _this.removeTags || _this.addTags;
32649     _this.geometry = _this.geometry || [];
32650     _this.matchGeometry = (geom) => _this.geometry.indexOf(geom) >= 0;
32651     _this.matchAllGeometry = (geoms) => geoms.every(_this.matchGeometry);
32652     _this.matchScore = (entityTags) => {
32653       const tags = _this.tags;
32654       let seen = {};
32655       let score = 0;
32656       for (let k2 in tags) {
32657         seen[k2] = true;
32658         if (entityTags[k2] === tags[k2]) {
32659           score += _this.originalScore;
32660         } else if (tags[k2] === "*" && k2 in entityTags) {
32661           score += _this.originalScore / 2;
32662         } else {
32663           return -1;
32664         }
32665       }
32666       const addTags = _this.addTags;
32667       for (let k2 in addTags) {
32668         if (!seen[k2] && entityTags[k2] === addTags[k2]) {
32669           score += _this.originalScore;
32670         }
32671       }
32672       if (_this.searchable === false) {
32673         score *= 0.999;
32674       }
32675       return score;
32676     };
32677     _this.t = (scope, options2) => {
32678       const textID = `_tagging.presets.presets.${presetID}.${scope}`;
32679       return _t(textID, options2);
32680     };
32681     _this.t.append = (scope, options2) => {
32682       const textID = `_tagging.presets.presets.${presetID}.${scope}`;
32683       return _t.append(textID, options2);
32684     };
32685     function resolveReference(which) {
32686       const match = (_this[which] || "").match(referenceRegex);
32687       if (match) {
32688         const preset2 = allPresets[match[1]];
32689         if (preset2) {
32690           return preset2;
32691         }
32692         console.error(`Unable to resolve referenced preset: ${match[1]}`);
32693       }
32694       return _this;
32695     }
32696     _this.name = () => {
32697       return resolveReference("originalName").t("name", { "default": _this.originalName || presetID });
32698     };
32699     _this.nameLabel = () => {
32700       return resolveReference("originalName").t.append("name", { "default": _this.originalName || presetID });
32701     };
32702     _this.subtitle = () => {
32703       if (_this.suggestion) {
32704         let path = presetID.split("/");
32705         path.pop();
32706         return _t("_tagging.presets.presets." + path.join("/") + ".name");
32707       }
32708       return null;
32709     };
32710     _this.subtitleLabel = () => {
32711       if (_this.suggestion) {
32712         let path = presetID.split("/");
32713         path.pop();
32714         return _t.append("_tagging.presets.presets." + path.join("/") + ".name");
32715       }
32716       return null;
32717     };
32718     _this.aliases = () => {
32719       return resolveReference("originalName").t("aliases", { "default": _this.originalAliases }).trim().split(/\s*[\r\n]+\s*/).filter(Boolean);
32720     };
32721     _this.terms = () => {
32722       return resolveReference("originalName").t("terms", { "default": _this.originalTerms }).toLowerCase().trim().split(/\s*,+\s*/);
32723     };
32724     _this.searchName = () => {
32725       if (!_searchName) {
32726         _searchName = (_this.suggestion ? _this.originalName : _this.name()).toLowerCase();
32727       }
32728       return _searchName;
32729     };
32730     _this.searchNameStripped = () => {
32731       if (!_searchNameStripped) {
32732         _searchNameStripped = stripDiacritics(_this.searchName());
32733       }
32734       return _searchNameStripped;
32735     };
32736     _this.searchAliases = () => {
32737       if (!_searchAliases) {
32738         _searchAliases = _this.aliases().map((alias) => alias.toLowerCase());
32739       }
32740       return _searchAliases;
32741     };
32742     _this.searchAliasesStripped = () => {
32743       if (!_searchAliasesStripped) {
32744         _searchAliasesStripped = _this.searchAliases();
32745         _searchAliasesStripped = _searchAliasesStripped.map(stripDiacritics);
32746       }
32747       return _searchAliasesStripped;
32748     };
32749     _this.isFallback = () => {
32750       const tagCount = Object.keys(_this.tags).length;
32751       return tagCount === 0 || tagCount === 1 && _this.tags.hasOwnProperty("area");
32752     };
32753     _this.addable = function(val) {
32754       if (!arguments.length) return _addable;
32755       _addable = val;
32756       return _this;
32757     };
32758     _this.reference = () => {
32759       const qid = _this.tags.wikidata || _this.tags["flag:wikidata"] || _this.tags["brand:wikidata"] || _this.tags["network:wikidata"] || _this.tags["operator:wikidata"];
32760       if (qid) {
32761         return { qid };
32762       }
32763       let key = _this.originalReference.key || Object.keys(utilObjectOmit(_this.tags, "name"))[0];
32764       let value = _this.originalReference.value || _this.tags[key];
32765       if (value === "*") {
32766         return { key };
32767       } else {
32768         return { key, value };
32769       }
32770     };
32771     _this.unsetTags = (tags, geometry, ignoringKeys, skipFieldDefaults, loc) => {
32772       let removeTags = ignoringKeys ? utilObjectOmit(_this.removeTags, ignoringKeys) : _this.removeTags;
32773       tags = utilObjectOmit(tags, Object.keys(removeTags));
32774       if (geometry && !skipFieldDefaults) {
32775         _this.fields(loc).forEach((field) => {
32776           if (field.matchGeometry(geometry) && field.key && field.default === tags[field.key] && (!ignoringKeys || ignoringKeys.indexOf(field.key) === -1)) {
32777             delete tags[field.key];
32778           }
32779         });
32780       }
32781       delete tags.area;
32782       return tags;
32783     };
32784     _this.setTags = (tags, geometry, skipFieldDefaults, loc) => {
32785       const addTags = _this.addTags;
32786       tags = Object.assign({}, tags);
32787       for (let k2 in addTags) {
32788         if (addTags[k2] === "*") {
32789           if (_this.tags[k2] || !tags[k2]) {
32790             tags[k2] = "yes";
32791           }
32792         } else {
32793           tags[k2] = addTags[k2];
32794         }
32795       }
32796       if (!addTags.hasOwnProperty("area")) {
32797         delete tags.area;
32798         if (geometry === "area") {
32799           let needsAreaTag = true;
32800           for (let k2 in addTags) {
32801             if (_this.geometry.indexOf("line") === -1 && k2 in osmAreaKeys || k2 in osmAreaKeysExceptions && addTags[k2] in osmAreaKeysExceptions[k2]) {
32802               needsAreaTag = false;
32803               break;
32804             }
32805           }
32806           if (needsAreaTag) {
32807             tags.area = "yes";
32808           }
32809         }
32810       }
32811       if (geometry && !skipFieldDefaults) {
32812         _this.fields(loc).forEach((field) => {
32813           if (field.matchGeometry(geometry) && field.key && !tags[field.key] && field.default) {
32814             tags[field.key] = field.default;
32815           }
32816         });
32817       }
32818       return tags;
32819     };
32820     function resolveFields(which, loc) {
32821       const fieldIDs = which === "fields" ? _this.originalFields : _this.originalMoreFields;
32822       let resolved = [];
32823       fieldIDs.forEach((fieldID) => {
32824         const match = fieldID.match(referenceRegex);
32825         if (match !== null) {
32826           resolved = resolved.concat(inheritFields(allPresets[match[1]], which, loc));
32827         } else if (allFields[fieldID]) {
32828           resolved.push(allFields[fieldID]);
32829         } else {
32830           console.log(`Cannot resolve "${fieldID}" found in ${_this.id}.${which}`);
32831         }
32832       });
32833       if (!resolved.length) {
32834         const endIndex = _this.id.lastIndexOf("/");
32835         const parentID = endIndex && _this.id.substring(0, endIndex);
32836         if (parentID) {
32837           let parent = allPresets[parentID];
32838           if (loc) {
32839             const validHere = _sharedLocationManager.locationSetsAt(loc);
32840             if ((parent == null ? void 0 : parent.locationSetID) && !validHere[parent.locationSetID]) {
32841               const candidateIDs = Object.keys(allPresets).filter((k2) => k2.startsWith(parentID));
32842               parent = allPresets[candidateIDs.find((candidateID) => {
32843                 const candidate = allPresets[candidateID];
32844                 return validHere[candidate.locationSetID] && (0, import_lodash2.isEqual)(candidate.tags, parent.tags);
32845               })];
32846             }
32847           }
32848           resolved = inheritFields(parent, which, loc);
32849         }
32850       }
32851       if (loc) {
32852         const validHere = _sharedLocationManager.locationSetsAt(loc);
32853         resolved = resolved.filter((field) => !field.locationSetID || validHere[field.locationSetID]);
32854       }
32855       return resolved;
32856       function inheritFields(parent, which2, loc2) {
32857         if (!parent) return [];
32858         if (which2 === "fields") {
32859           return parent.fields(loc2).filter(shouldInherit);
32860         } else if (which2 === "moreFields") {
32861           return parent.moreFields(loc2).filter(shouldInherit);
32862         } else {
32863           return [];
32864         }
32865       }
32866       function shouldInherit(f2) {
32867         if (f2.key && _this.tags[f2.key] !== void 0 && // inherit anyway if multiple values are allowed or just a checkbox
32868         f2.type !== "multiCombo" && f2.type !== "semiCombo" && f2.type !== "manyCombo" && f2.type !== "check") return false;
32869         if (f2.key && (_this.originalFields.some((originalField) => {
32870           var _a3;
32871           return f2.key === ((_a3 = allFields[originalField]) == null ? void 0 : _a3.key);
32872         }) || _this.originalMoreFields.some((originalField) => {
32873           var _a3;
32874           return f2.key === ((_a3 = allFields[originalField]) == null ? void 0 : _a3.key);
32875         }))) {
32876           return false;
32877         }
32878         return true;
32879       }
32880     }
32881     function stripDiacritics(s2) {
32882       if (s2.normalize) s2 = s2.normalize("NFD");
32883       s2 = s2.replace(/[\u0300-\u036f]/g, "");
32884       return s2;
32885     }
32886     return _this;
32887   }
32888   var import_lodash2;
32889   var init_preset = __esm({
32890     "modules/presets/preset.js"() {
32891       "use strict";
32892       import_lodash2 = __toESM(require_lodash());
32893       init_localizer();
32894       init_tags();
32895       init_util();
32896       init_util2();
32897       init_LocationManager();
32898     }
32899   });
32900
32901   // modules/presets/index.js
32902   var presets_exports = {};
32903   __export(presets_exports, {
32904     presetCategory: () => presetCategory,
32905     presetCollection: () => presetCollection,
32906     presetField: () => presetField,
32907     presetIndex: () => presetIndex,
32908     presetManager: () => _mainPresetIndex,
32909     presetPreset: () => presetPreset
32910   });
32911   function presetIndex() {
32912     const dispatch14 = dispatch_default("favoritePreset", "recentsChange");
32913     const MAXRECENTS = 30;
32914     const POINT = presetPreset("point", { name: "Point", tags: {}, geometry: ["point", "vertex"], matchScore: 0.1 });
32915     const LINE = presetPreset("line", { name: "Line", tags: {}, geometry: ["line"], matchScore: 0.1 });
32916     const AREA = presetPreset("area", { name: "Area", tags: { area: "yes" }, geometry: ["area"], matchScore: 0.1 });
32917     const RELATION = presetPreset("relation", { name: "Relation", tags: {}, geometry: ["relation"], matchScore: 0.1 });
32918     let _this = presetCollection([POINT, LINE, AREA, RELATION]);
32919     let _presets = { point: POINT, line: LINE, area: AREA, relation: RELATION };
32920     let _defaults2 = {
32921       point: presetCollection([POINT]),
32922       vertex: presetCollection([POINT]),
32923       line: presetCollection([LINE]),
32924       area: presetCollection([AREA]),
32925       relation: presetCollection([RELATION])
32926     };
32927     let _fields = {};
32928     let _categories = {};
32929     let _universal = [];
32930     let _addablePresetIDs = null;
32931     let _recents;
32932     let _favorites;
32933     let _geometryIndex = { point: {}, vertex: {}, line: {}, area: {}, relation: {} };
32934     let _loadPromise;
32935     _this.ensureLoaded = (bypassCache) => {
32936       if (_loadPromise && !bypassCache) return _loadPromise;
32937       return _loadPromise = Promise.all([
32938         _mainFileFetcher.get("preset_categories"),
32939         _mainFileFetcher.get("preset_defaults"),
32940         _mainFileFetcher.get("preset_presets"),
32941         _mainFileFetcher.get("preset_fields")
32942       ]).then((vals) => {
32943         _this.merge({
32944           categories: vals[0],
32945           defaults: vals[1],
32946           presets: vals[2],
32947           fields: vals[3]
32948         });
32949         osmSetAreaKeys(_this.areaKeys());
32950         osmSetLineTags(_this.lineTags());
32951         osmSetPointTags(_this.pointTags());
32952         osmSetVertexTags(_this.vertexTags());
32953       });
32954     };
32955     _this.merge = (d2) => {
32956       let newLocationSets = [];
32957       if (d2.fields) {
32958         Object.keys(d2.fields).forEach((fieldID) => {
32959           let f2 = d2.fields[fieldID];
32960           if (f2) {
32961             f2 = presetField(fieldID, f2, _fields);
32962             if (f2.locationSet) newLocationSets.push(f2);
32963             _fields[fieldID] = f2;
32964           } else {
32965             delete _fields[fieldID];
32966           }
32967         });
32968       }
32969       if (d2.presets) {
32970         Object.keys(d2.presets).forEach((presetID) => {
32971           let p2 = d2.presets[presetID];
32972           if (p2) {
32973             const isAddable = !_addablePresetIDs || _addablePresetIDs.has(presetID);
32974             p2 = presetPreset(presetID, p2, isAddable, _fields, _presets);
32975             if (p2.locationSet) newLocationSets.push(p2);
32976             _presets[presetID] = p2;
32977           } else {
32978             const existing = _presets[presetID];
32979             if (existing && !existing.isFallback()) {
32980               delete _presets[presetID];
32981             }
32982           }
32983         });
32984       }
32985       if (d2.categories) {
32986         Object.keys(d2.categories).forEach((categoryID) => {
32987           let c2 = d2.categories[categoryID];
32988           if (c2) {
32989             c2 = presetCategory(categoryID, c2, _presets);
32990             if (c2.locationSet) newLocationSets.push(c2);
32991             _categories[categoryID] = c2;
32992           } else {
32993             delete _categories[categoryID];
32994           }
32995         });
32996       }
32997       _this.collection = Object.values(_presets).concat(Object.values(_categories));
32998       if (d2.defaults) {
32999         Object.keys(d2.defaults).forEach((geometry) => {
33000           const def2 = d2.defaults[geometry];
33001           if (Array.isArray(def2)) {
33002             _defaults2[geometry] = presetCollection(
33003               def2.map((id2) => _presets[id2] || _categories[id2]).filter(Boolean)
33004             );
33005           } else {
33006             delete _defaults2[geometry];
33007           }
33008         });
33009       }
33010       _universal = Object.values(_fields).filter((field) => field.universal);
33011       _geometryIndex = { point: {}, vertex: {}, line: {}, area: {}, relation: {} };
33012       _this.collection.forEach((preset) => {
33013         (preset.geometry || []).forEach((geometry) => {
33014           let g3 = _geometryIndex[geometry];
33015           for (let key in preset.tags) {
33016             g3[key] = g3[key] || {};
33017             let value = preset.tags[key];
33018             (g3[key][value] = g3[key][value] || []).push(preset);
33019           }
33020         });
33021       });
33022       if (d2.featureCollection && Array.isArray(d2.featureCollection.features)) {
33023         _sharedLocationManager.mergeCustomGeoJSON(d2.featureCollection);
33024       }
33025       if (newLocationSets.length) {
33026         _sharedLocationManager.mergeLocationSets(newLocationSets);
33027       }
33028       return _this;
33029     };
33030     _this.match = (entity, resolver) => {
33031       return resolver.transient(entity, "presetMatch", () => {
33032         let geometry = entity.geometry(resolver);
33033         if (geometry === "vertex" && entity.isOnAddressLine(resolver)) {
33034           geometry = "point";
33035         }
33036         const entityExtent = entity.extent(resolver);
33037         return _this.matchTags(entity.tags, geometry, entityExtent.center());
33038       });
33039     };
33040     _this.matchTags = (tags, geometry, loc) => {
33041       const keyIndex = _geometryIndex[geometry];
33042       let bestScore = -1;
33043       let bestMatch;
33044       let matchCandidates = [];
33045       for (let k2 in tags) {
33046         let indexMatches = [];
33047         let valueIndex = keyIndex[k2];
33048         if (!valueIndex) continue;
33049         let keyValueMatches = valueIndex[tags[k2]];
33050         if (keyValueMatches) indexMatches.push(...keyValueMatches);
33051         let keyStarMatches = valueIndex["*"];
33052         if (keyStarMatches) indexMatches.push(...keyStarMatches);
33053         if (indexMatches.length === 0) continue;
33054         for (let i3 = 0; i3 < indexMatches.length; i3++) {
33055           const candidate = indexMatches[i3];
33056           const score = candidate.matchScore(tags);
33057           if (score === -1) {
33058             continue;
33059           }
33060           matchCandidates.push({ score, candidate });
33061           if (score > bestScore) {
33062             bestScore = score;
33063             bestMatch = candidate;
33064           }
33065         }
33066       }
33067       if (bestMatch && bestMatch.locationSetID && bestMatch.locationSetID !== "+[Q2]" && Array.isArray(loc)) {
33068         const validHere = _sharedLocationManager.locationSetsAt(loc);
33069         if (!validHere[bestMatch.locationSetID]) {
33070           matchCandidates.sort((a2, b2) => a2.score < b2.score ? 1 : -1);
33071           for (let i3 = 0; i3 < matchCandidates.length; i3++) {
33072             const candidateScore = matchCandidates[i3];
33073             if (!candidateScore.candidate.locationSetID || validHere[candidateScore.candidate.locationSetID]) {
33074               bestMatch = candidateScore.candidate;
33075               bestScore = candidateScore.score;
33076               break;
33077             }
33078           }
33079         }
33080       }
33081       if (!bestMatch || bestMatch.isFallback()) {
33082         for (let k2 in tags) {
33083           if (/^addr:/.test(k2) && keyIndex["addr:*"] && keyIndex["addr:*"]["*"]) {
33084             bestMatch = keyIndex["addr:*"]["*"][0];
33085             break;
33086           }
33087         }
33088       }
33089       return bestMatch || _this.fallback(geometry);
33090     };
33091     _this.allowsVertex = (entity, resolver) => {
33092       if (entity.type !== "node") return false;
33093       if (Object.keys(entity.tags).length === 0) return true;
33094       return resolver.transient(entity, "vertexMatch", () => {
33095         if (entity.isOnAddressLine(resolver)) return true;
33096         const geometries = osmNodeGeometriesForTags(entity.tags);
33097         if (geometries.vertex) return true;
33098         if (geometries.point) return false;
33099         return true;
33100       });
33101     };
33102     _this.areaKeys = () => {
33103       const ignore = {
33104         barrier: true,
33105         highway: true,
33106         footway: true,
33107         railway: true,
33108         junction: true,
33109         type: true
33110       };
33111       let areaKeys = {};
33112       const presets = _this.collection.filter((p2) => !p2.suggestion && !p2.replacement);
33113       presets.forEach((p2) => {
33114         const keys2 = p2.tags && Object.keys(p2.tags);
33115         const key = keys2 && keys2.length && keys2[0];
33116         if (!key) return;
33117         if (ignore[key]) return;
33118         if (p2.geometry.indexOf("area") !== -1) {
33119           areaKeys[key] = areaKeys[key] || {};
33120         }
33121       });
33122       presets.forEach((p2) => {
33123         let key;
33124         for (key in p2.addTags) {
33125           const value = p2.addTags[key];
33126           if (key in areaKeys && // probably an area...
33127           p2.geometry.indexOf("line") !== -1 && // but sometimes a line
33128           value !== "*") {
33129             areaKeys[key][value] = true;
33130           }
33131         }
33132       });
33133       return areaKeys;
33134     };
33135     _this.lineTags = () => {
33136       return _this.collection.filter((lineTags, d2) => {
33137         if (d2.suggestion || d2.replacement || d2.searchable === false) return lineTags;
33138         const keys2 = d2.tags && Object.keys(d2.tags);
33139         const key = keys2 && keys2.length && keys2[0];
33140         if (!key) return lineTags;
33141         if (d2.geometry.indexOf("line") !== -1) {
33142           lineTags[key] = lineTags[key] || [];
33143           lineTags[key].push(d2.tags);
33144         }
33145         return lineTags;
33146       }, {});
33147     };
33148     _this.pointTags = () => {
33149       return _this.collection.reduce((pointTags, d2) => {
33150         if (d2.suggestion || d2.replacement || d2.searchable === false) return pointTags;
33151         const keys2 = d2.tags && Object.keys(d2.tags);
33152         const key = keys2 && keys2.length && keys2[0];
33153         if (!key) return pointTags;
33154         if (d2.geometry.indexOf("point") !== -1) {
33155           pointTags[key] = pointTags[key] || {};
33156           pointTags[key][d2.tags[key]] = true;
33157         }
33158         return pointTags;
33159       }, {});
33160     };
33161     _this.vertexTags = () => {
33162       return _this.collection.reduce((vertexTags, d2) => {
33163         if (d2.suggestion || d2.replacement || d2.searchable === false) return vertexTags;
33164         const keys2 = d2.tags && Object.keys(d2.tags);
33165         const key = keys2 && keys2.length && keys2[0];
33166         if (!key) return vertexTags;
33167         if (d2.geometry.indexOf("vertex") !== -1) {
33168           vertexTags[key] = vertexTags[key] || {};
33169           vertexTags[key][d2.tags[key]] = true;
33170         }
33171         return vertexTags;
33172       }, {});
33173     };
33174     _this.field = (id2) => _fields[id2];
33175     _this.universal = () => _universal;
33176     _this.defaults = (geometry, n3, startWithRecents, loc, extraPresets) => {
33177       let recents = [];
33178       if (startWithRecents) {
33179         recents = _this.recent().matchGeometry(geometry).collection.slice(0, 4);
33180       }
33181       let defaults;
33182       if (_addablePresetIDs) {
33183         defaults = Array.from(_addablePresetIDs).map(function(id2) {
33184           var preset = _this.item(id2);
33185           if (preset && preset.matchGeometry(geometry)) return preset;
33186           return null;
33187         }).filter(Boolean);
33188       } else {
33189         defaults = _defaults2[geometry].collection.concat(_this.fallback(geometry));
33190       }
33191       let result = presetCollection(
33192         utilArrayUniq(recents.concat(defaults).concat(extraPresets || [])).slice(0, n3 - 1)
33193       );
33194       if (Array.isArray(loc)) {
33195         const validHere = _sharedLocationManager.locationSetsAt(loc);
33196         result.collection = result.collection.filter((a2) => !a2.locationSetID || validHere[a2.locationSetID]);
33197       }
33198       return result;
33199     };
33200     _this.addablePresetIDs = function(val) {
33201       if (!arguments.length) return _addablePresetIDs;
33202       if (Array.isArray(val)) val = new Set(val);
33203       _addablePresetIDs = val;
33204       if (_addablePresetIDs) {
33205         _this.collection.forEach((p2) => {
33206           if (p2.addable) p2.addable(_addablePresetIDs.has(p2.id));
33207         });
33208       } else {
33209         _this.collection.forEach((p2) => {
33210           if (p2.addable) p2.addable(true);
33211         });
33212       }
33213       return _this;
33214     };
33215     _this.recent = () => {
33216       return presetCollection(
33217         utilArrayUniq(_this.getRecents().map((d2) => d2.preset).filter((d2) => d2.searchable !== false))
33218       );
33219     };
33220     function RibbonItem(preset, source) {
33221       let item = {};
33222       item.preset = preset;
33223       item.source = source;
33224       item.isFavorite = () => item.source === "favorite";
33225       item.isRecent = () => item.source === "recent";
33226       item.matches = (preset2) => item.preset.id === preset2.id;
33227       item.minified = () => ({ pID: item.preset.id });
33228       return item;
33229     }
33230     function ribbonItemForMinified(d2, source) {
33231       if (d2 && d2.pID) {
33232         const preset = _this.item(d2.pID);
33233         if (!preset) return null;
33234         return RibbonItem(preset, source);
33235       }
33236       return null;
33237     }
33238     _this.getGenericRibbonItems = () => {
33239       return ["point", "line", "area"].map((id2) => RibbonItem(_this.item(id2), "generic"));
33240     };
33241     _this.getAddable = () => {
33242       if (!_addablePresetIDs) return [];
33243       return _addablePresetIDs.map((id2) => {
33244         const preset = _this.item(id2);
33245         if (preset) return RibbonItem(preset, "addable");
33246         return null;
33247       }).filter(Boolean);
33248     };
33249     function setRecents(items) {
33250       _recents = items;
33251       const minifiedItems = items.map((d2) => d2.minified());
33252       corePreferences("preset_recents", JSON.stringify(minifiedItems));
33253       dispatch14.call("recentsChange");
33254     }
33255     _this.getRecents = () => {
33256       if (!_recents) {
33257         _recents = (JSON.parse(corePreferences("preset_recents")) || []).reduce((acc, d2) => {
33258           let item = ribbonItemForMinified(d2, "recent");
33259           if (item && item.preset.addable()) acc.push(item);
33260           return acc;
33261         }, []);
33262       }
33263       return _recents;
33264     };
33265     _this.addRecent = (preset, besidePreset, after) => {
33266       const recents = _this.getRecents();
33267       const beforeItem = _this.recentMatching(besidePreset);
33268       let toIndex = recents.indexOf(beforeItem);
33269       if (after) toIndex += 1;
33270       const newItem = RibbonItem(preset, "recent");
33271       recents.splice(toIndex, 0, newItem);
33272       setRecents(recents);
33273     };
33274     _this.removeRecent = (preset) => {
33275       const item = _this.recentMatching(preset);
33276       if (item) {
33277         let items = _this.getRecents();
33278         items.splice(items.indexOf(item), 1);
33279         setRecents(items);
33280       }
33281     };
33282     _this.recentMatching = (preset) => {
33283       const items = _this.getRecents();
33284       for (let i3 in items) {
33285         if (items[i3].matches(preset)) {
33286           return items[i3];
33287         }
33288       }
33289       return null;
33290     };
33291     _this.moveItem = (items, fromIndex, toIndex) => {
33292       if (fromIndex === toIndex || fromIndex < 0 || toIndex < 0 || fromIndex >= items.length || toIndex >= items.length) return null;
33293       items.splice(toIndex, 0, items.splice(fromIndex, 1)[0]);
33294       return items;
33295     };
33296     _this.moveRecent = (item, beforeItem) => {
33297       const recents = _this.getRecents();
33298       const fromIndex = recents.indexOf(item);
33299       const toIndex = recents.indexOf(beforeItem);
33300       const items = _this.moveItem(recents, fromIndex, toIndex);
33301       if (items) setRecents(items);
33302     };
33303     _this.setMostRecent = (preset) => {
33304       if (preset.searchable === false) return;
33305       let items = _this.getRecents();
33306       let item = _this.recentMatching(preset);
33307       if (item) {
33308         items.splice(items.indexOf(item), 1);
33309       } else {
33310         item = RibbonItem(preset, "recent");
33311       }
33312       while (items.length >= MAXRECENTS) {
33313         items.pop();
33314       }
33315       items.unshift(item);
33316       setRecents(items);
33317     };
33318     function setFavorites(items) {
33319       _favorites = items;
33320       const minifiedItems = items.map((d2) => d2.minified());
33321       corePreferences("preset_favorites", JSON.stringify(minifiedItems));
33322       dispatch14.call("favoritePreset");
33323     }
33324     _this.addFavorite = (preset, besidePreset, after) => {
33325       const favorites = _this.getFavorites();
33326       const beforeItem = _this.favoriteMatching(besidePreset);
33327       let toIndex = favorites.indexOf(beforeItem);
33328       if (after) toIndex += 1;
33329       const newItem = RibbonItem(preset, "favorite");
33330       favorites.splice(toIndex, 0, newItem);
33331       setFavorites(favorites);
33332     };
33333     _this.toggleFavorite = (preset) => {
33334       const favs = _this.getFavorites();
33335       const favorite = _this.favoriteMatching(preset);
33336       if (favorite) {
33337         favs.splice(favs.indexOf(favorite), 1);
33338       } else {
33339         if (favs.length === 10) {
33340           favs.pop();
33341         }
33342         favs.push(RibbonItem(preset, "favorite"));
33343       }
33344       setFavorites(favs);
33345     };
33346     _this.removeFavorite = (preset) => {
33347       const item = _this.favoriteMatching(preset);
33348       if (item) {
33349         const items = _this.getFavorites();
33350         items.splice(items.indexOf(item), 1);
33351         setFavorites(items);
33352       }
33353     };
33354     _this.getFavorites = () => {
33355       if (!_favorites) {
33356         let rawFavorites = JSON.parse(corePreferences("preset_favorites"));
33357         if (!rawFavorites) {
33358           rawFavorites = [];
33359           corePreferences("preset_favorites", JSON.stringify(rawFavorites));
33360         }
33361         _favorites = rawFavorites.reduce((output, d2) => {
33362           const item = ribbonItemForMinified(d2, "favorite");
33363           if (item && item.preset.addable()) output.push(item);
33364           return output;
33365         }, []);
33366       }
33367       return _favorites;
33368     };
33369     _this.favoriteMatching = (preset) => {
33370       const favs = _this.getFavorites();
33371       for (let index in favs) {
33372         if (favs[index].matches(preset)) {
33373           return favs[index];
33374         }
33375       }
33376       return null;
33377     };
33378     return utilRebind(_this, dispatch14, "on");
33379   }
33380   var _mainPresetIndex;
33381   var init_presets = __esm({
33382     "modules/presets/index.js"() {
33383       "use strict";
33384       init_src4();
33385       init_preferences();
33386       init_file_fetcher();
33387       init_LocationManager();
33388       init_tags();
33389       init_category();
33390       init_collection();
33391       init_field();
33392       init_preset();
33393       init_util();
33394       _mainPresetIndex = presetIndex();
33395     }
33396   });
33397
33398   // modules/behavior/edit.js
33399   var edit_exports = {};
33400   __export(edit_exports, {
33401     behaviorEdit: () => behaviorEdit
33402   });
33403   function behaviorEdit(context) {
33404     function behavior() {
33405       context.map().minzoom(context.minEditableZoom());
33406     }
33407     behavior.off = function() {
33408       context.map().minzoom(0);
33409     };
33410     return behavior;
33411   }
33412   var init_edit = __esm({
33413     "modules/behavior/edit.js"() {
33414       "use strict";
33415     }
33416   });
33417
33418   // modules/behavior/hover.js
33419   var hover_exports = {};
33420   __export(hover_exports, {
33421     behaviorHover: () => behaviorHover
33422   });
33423   function behaviorHover(context) {
33424     var dispatch14 = dispatch_default("hover");
33425     var _selection = select_default2(null);
33426     var _newNodeId = null;
33427     var _initialNodeID = null;
33428     var _altDisables;
33429     var _ignoreVertex;
33430     var _targets = [];
33431     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
33432     function keydown(d3_event) {
33433       if (_altDisables && d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
33434         _selection.selectAll(".hover").classed("hover-suppressed", true).classed("hover", false);
33435         _selection.classed("hover-disabled", true);
33436         dispatch14.call("hover", this, null);
33437       }
33438     }
33439     function keyup(d3_event) {
33440       if (_altDisables && d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
33441         _selection.selectAll(".hover-suppressed").classed("hover-suppressed", false).classed("hover", true);
33442         _selection.classed("hover-disabled", false);
33443         dispatch14.call("hover", this, _targets);
33444       }
33445     }
33446     function behavior(selection2) {
33447       _selection = selection2;
33448       _targets = [];
33449       if (_initialNodeID) {
33450         _newNodeId = _initialNodeID;
33451         _initialNodeID = null;
33452       } else {
33453         _newNodeId = null;
33454       }
33455       _selection.on(_pointerPrefix + "over.hover", pointerover).on(_pointerPrefix + "out.hover", pointerout).on(_pointerPrefix + "down.hover", pointerover);
33456       select_default2(window).on(_pointerPrefix + "up.hover pointercancel.hover", pointerout, true).on("keydown.hover", keydown).on("keyup.hover", keyup);
33457       function eventTarget(d3_event) {
33458         var datum2 = d3_event.target && d3_event.target.__data__;
33459         if (typeof datum2 !== "object") return null;
33460         if (!(datum2 instanceof osmEntity) && datum2.properties && datum2.properties.entity instanceof osmEntity) {
33461           return datum2.properties.entity;
33462         }
33463         return datum2;
33464       }
33465       function pointerover(d3_event) {
33466         if (context.mode().id.indexOf("drag") === -1 && (!d3_event.pointerType || d3_event.pointerType === "mouse") && d3_event.buttons) return;
33467         var target = eventTarget(d3_event);
33468         if (target && _targets.indexOf(target) === -1) {
33469           _targets.push(target);
33470           updateHover(d3_event, _targets);
33471         }
33472       }
33473       function pointerout(d3_event) {
33474         var target = eventTarget(d3_event);
33475         var index = _targets.indexOf(target);
33476         if (index !== -1) {
33477           _targets.splice(index);
33478           updateHover(d3_event, _targets);
33479         }
33480       }
33481       function allowsVertex(d2) {
33482         return d2.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d2, context.graph());
33483       }
33484       function modeAllowsHover(target) {
33485         var mode = context.mode();
33486         if (mode.id === "add-point") {
33487           return mode.preset.matchGeometry("vertex") || target.type !== "way" && target.geometry(context.graph()) !== "vertex";
33488         }
33489         return true;
33490       }
33491       function updateHover(d3_event, targets) {
33492         _selection.selectAll(".hover").classed("hover", false);
33493         _selection.selectAll(".hover-suppressed").classed("hover-suppressed", false);
33494         var mode = context.mode();
33495         if (!_newNodeId && (mode.id === "draw-line" || mode.id === "draw-area")) {
33496           var node = targets.find(function(target) {
33497             return target instanceof osmEntity && target.type === "node";
33498           });
33499           _newNodeId = node && node.id;
33500         }
33501         targets = targets.filter(function(datum3) {
33502           if (datum3 instanceof osmEntity) {
33503             return datum3.id !== _newNodeId && (datum3.type !== "node" || !_ignoreVertex || allowsVertex(datum3)) && modeAllowsHover(datum3);
33504           }
33505           return true;
33506         });
33507         var selector = "";
33508         for (var i3 in targets) {
33509           var datum2 = targets[i3];
33510           if (datum2.__featurehash__) {
33511             selector += ", .data" + datum2.__featurehash__;
33512           } else if (datum2 instanceof QAItem) {
33513             selector += ", ." + datum2.service + ".itemId-" + datum2.id;
33514           } else if (datum2 instanceof osmNote) {
33515             selector += ", .note-" + datum2.id;
33516           } else if (datum2 instanceof osmEntity) {
33517             selector += ", ." + datum2.id;
33518             if (datum2.type === "relation") {
33519               for (var j2 in datum2.members) {
33520                 selector += ", ." + datum2.members[j2].id;
33521               }
33522             }
33523           }
33524         }
33525         var suppressed = _altDisables && d3_event && d3_event.altKey;
33526         if (selector.trim().length) {
33527           selector = selector.slice(1);
33528           _selection.selectAll(selector).classed(suppressed ? "hover-suppressed" : "hover", true);
33529         }
33530         dispatch14.call("hover", this, !suppressed && targets);
33531       }
33532     }
33533     behavior.off = function(selection2) {
33534       selection2.selectAll(".hover").classed("hover", false);
33535       selection2.selectAll(".hover-suppressed").classed("hover-suppressed", false);
33536       selection2.classed("hover-disabled", false);
33537       selection2.on(_pointerPrefix + "over.hover", null).on(_pointerPrefix + "out.hover", null).on(_pointerPrefix + "down.hover", null);
33538       select_default2(window).on(_pointerPrefix + "up.hover pointercancel.hover", null, true).on("keydown.hover", null).on("keyup.hover", null);
33539     };
33540     behavior.altDisables = function(val) {
33541       if (!arguments.length) return _altDisables;
33542       _altDisables = val;
33543       return behavior;
33544     };
33545     behavior.ignoreVertex = function(val) {
33546       if (!arguments.length) return _ignoreVertex;
33547       _ignoreVertex = val;
33548       return behavior;
33549     };
33550     behavior.initialNodeID = function(nodeId) {
33551       _initialNodeID = nodeId;
33552       return behavior;
33553     };
33554     return utilRebind(behavior, dispatch14, "on");
33555   }
33556   var init_hover = __esm({
33557     "modules/behavior/hover.js"() {
33558       "use strict";
33559       init_src4();
33560       init_src5();
33561       init_presets();
33562       init_osm();
33563       init_util();
33564     }
33565   });
33566
33567   // modules/behavior/draw.js
33568   var draw_exports = {};
33569   __export(draw_exports, {
33570     behaviorDraw: () => behaviorDraw
33571   });
33572   function behaviorDraw(context) {
33573     var dispatch14 = dispatch_default(
33574       "move",
33575       "down",
33576       "downcancel",
33577       "click",
33578       "clickWay",
33579       "clickNode",
33580       "undo",
33581       "cancel",
33582       "finish"
33583     );
33584     var keybinding = utilKeybinding("draw");
33585     var _hover = behaviorHover(context).altDisables(true).ignoreVertex(true).on("hover", context.ui().sidebar.hover);
33586     var _edit = behaviorEdit(context);
33587     var _closeTolerance = 4;
33588     var _tolerance = 12;
33589     var _mouseLeave = false;
33590     var _lastMouse = null;
33591     var _lastPointerUpEvent;
33592     var _downPointer;
33593     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
33594     function datum2(d3_event) {
33595       var mode = context.mode();
33596       var isNote = mode && mode.id.indexOf("note") !== -1;
33597       if (d3_event.altKey || isNote) return {};
33598       var element;
33599       if (d3_event.type === "keydown") {
33600         element = _lastMouse && _lastMouse.target;
33601       } else {
33602         element = d3_event.target;
33603       }
33604       var d2 = element.__data__;
33605       return d2 && d2.properties && d2.properties.target ? d2 : {};
33606     }
33607     function pointerdown(d3_event) {
33608       if (_downPointer) return;
33609       var pointerLocGetter = utilFastMouse(this);
33610       _downPointer = {
33611         id: d3_event.pointerId || "mouse",
33612         pointerLocGetter,
33613         downTime: +/* @__PURE__ */ new Date(),
33614         downLoc: pointerLocGetter(d3_event)
33615       };
33616       dispatch14.call("down", this, d3_event, datum2(d3_event));
33617     }
33618     function pointerup(d3_event) {
33619       if (!_downPointer || _downPointer.id !== (d3_event.pointerId || "mouse")) return;
33620       var downPointer = _downPointer;
33621       _downPointer = null;
33622       _lastPointerUpEvent = d3_event;
33623       if (downPointer.isCancelled) return;
33624       var t2 = +/* @__PURE__ */ new Date();
33625       var p2 = downPointer.pointerLocGetter(d3_event);
33626       var dist = geoVecLength(downPointer.downLoc, p2);
33627       if (dist < _closeTolerance || dist < _tolerance && t2 - downPointer.downTime < 500) {
33628         select_default2(window).on("click.draw-block", function() {
33629           d3_event.stopPropagation();
33630         }, true);
33631         context.map().dblclickZoomEnable(false);
33632         window.setTimeout(function() {
33633           context.map().dblclickZoomEnable(true);
33634           select_default2(window).on("click.draw-block", null);
33635         }, 500);
33636         click(d3_event, p2);
33637       }
33638     }
33639     function pointermove(d3_event) {
33640       if (_downPointer && _downPointer.id === (d3_event.pointerId || "mouse") && !_downPointer.isCancelled) {
33641         var p2 = _downPointer.pointerLocGetter(d3_event);
33642         var dist = geoVecLength(_downPointer.downLoc, p2);
33643         if (dist >= _closeTolerance) {
33644           _downPointer.isCancelled = true;
33645           dispatch14.call("downcancel", this);
33646         }
33647       }
33648       if (d3_event.pointerType && d3_event.pointerType !== "mouse" || d3_event.buttons || _downPointer) return;
33649       if (_lastPointerUpEvent && _lastPointerUpEvent.pointerType !== "mouse" && d3_event.timeStamp - _lastPointerUpEvent.timeStamp < 100) return;
33650       _lastMouse = d3_event;
33651       dispatch14.call("move", this, d3_event, datum2(d3_event));
33652     }
33653     function pointercancel(d3_event) {
33654       if (_downPointer && _downPointer.id === (d3_event.pointerId || "mouse")) {
33655         if (!_downPointer.isCancelled) {
33656           dispatch14.call("downcancel", this);
33657         }
33658         _downPointer = null;
33659       }
33660     }
33661     function mouseenter() {
33662       _mouseLeave = false;
33663     }
33664     function mouseleave() {
33665       _mouseLeave = true;
33666     }
33667     function allowsVertex(d2) {
33668       return d2.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d2, context.graph());
33669     }
33670     function click(d3_event, loc) {
33671       var d2 = datum2(d3_event);
33672       var target = d2 && d2.properties && d2.properties.entity;
33673       var mode = context.mode();
33674       if (target && target.type === "node" && allowsVertex(target)) {
33675         dispatch14.call("clickNode", this, target, d2);
33676         return;
33677       } else if (target && target.type === "way" && (mode.id !== "add-point" || mode.preset.matchGeometry("vertex"))) {
33678         var choice = geoChooseEdge(
33679           context.graph().childNodes(target),
33680           loc,
33681           context.projection,
33682           context.activeID()
33683         );
33684         if (choice) {
33685           var edge = [target.nodes[choice.index - 1], target.nodes[choice.index]];
33686           dispatch14.call("clickWay", this, choice.loc, edge, d2);
33687           return;
33688         }
33689       } else if (mode.id !== "add-point" || mode.preset.matchGeometry("point")) {
33690         var locLatLng = context.projection.invert(loc);
33691         dispatch14.call("click", this, locLatLng, d2);
33692       }
33693     }
33694     function space(d3_event) {
33695       d3_event.preventDefault();
33696       d3_event.stopPropagation();
33697       var currSpace = context.map().mouse();
33698       if (_disableSpace && _lastSpace) {
33699         var dist = geoVecLength(_lastSpace, currSpace);
33700         if (dist > _tolerance) {
33701           _disableSpace = false;
33702         }
33703       }
33704       if (_disableSpace || _mouseLeave || !_lastMouse) return;
33705       _lastSpace = currSpace;
33706       _disableSpace = true;
33707       select_default2(window).on("keyup.space-block", function() {
33708         d3_event.preventDefault();
33709         d3_event.stopPropagation();
33710         _disableSpace = false;
33711         select_default2(window).on("keyup.space-block", null);
33712       });
33713       var loc = context.map().mouse() || // or the map center if the mouse has never entered the map
33714       context.projection(context.map().center());
33715       click(d3_event, loc);
33716     }
33717     function backspace(d3_event) {
33718       d3_event.preventDefault();
33719       dispatch14.call("undo");
33720     }
33721     function del(d3_event) {
33722       d3_event.preventDefault();
33723       dispatch14.call("cancel");
33724     }
33725     function ret(d3_event) {
33726       d3_event.preventDefault();
33727       dispatch14.call("finish");
33728     }
33729     function behavior(selection2) {
33730       context.install(_hover);
33731       context.install(_edit);
33732       _downPointer = null;
33733       keybinding.on("\u232B", backspace).on("\u2326", del).on("\u238B", ret).on("\u21A9", ret).on("space", space).on("\u2325space", space);
33734       selection2.on("mouseenter.draw", mouseenter).on("mouseleave.draw", mouseleave).on(_pointerPrefix + "down.draw", pointerdown).on(_pointerPrefix + "move.draw", pointermove);
33735       select_default2(window).on(_pointerPrefix + "up.draw", pointerup, true).on("pointercancel.draw", pointercancel, true);
33736       select_default2(document).call(keybinding);
33737       return behavior;
33738     }
33739     behavior.off = function(selection2) {
33740       context.ui().sidebar.hover.cancel();
33741       context.uninstall(_hover);
33742       context.uninstall(_edit);
33743       selection2.on("mouseenter.draw", null).on("mouseleave.draw", null).on(_pointerPrefix + "down.draw", null).on(_pointerPrefix + "move.draw", null);
33744       select_default2(window).on(_pointerPrefix + "up.draw", null).on("pointercancel.draw", null);
33745       select_default2(document).call(keybinding.unbind);
33746     };
33747     behavior.hover = function() {
33748       return _hover;
33749     };
33750     return utilRebind(behavior, dispatch14, "on");
33751   }
33752   var _disableSpace, _lastSpace;
33753   var init_draw = __esm({
33754     "modules/behavior/draw.js"() {
33755       "use strict";
33756       init_src4();
33757       init_src5();
33758       init_presets();
33759       init_edit();
33760       init_hover();
33761       init_geo2();
33762       init_util();
33763       _disableSpace = false;
33764       _lastSpace = null;
33765     }
33766   });
33767
33768   // node_modules/d3-scale/src/init.js
33769   function initRange(domain, range3) {
33770     switch (arguments.length) {
33771       case 0:
33772         break;
33773       case 1:
33774         this.range(domain);
33775         break;
33776       default:
33777         this.range(range3).domain(domain);
33778         break;
33779     }
33780     return this;
33781   }
33782   var init_init = __esm({
33783     "node_modules/d3-scale/src/init.js"() {
33784     }
33785   });
33786
33787   // node_modules/d3-scale/src/constant.js
33788   function constants(x2) {
33789     return function() {
33790       return x2;
33791     };
33792   }
33793   var init_constant6 = __esm({
33794     "node_modules/d3-scale/src/constant.js"() {
33795     }
33796   });
33797
33798   // node_modules/d3-scale/src/number.js
33799   function number2(x2) {
33800     return +x2;
33801   }
33802   var init_number3 = __esm({
33803     "node_modules/d3-scale/src/number.js"() {
33804     }
33805   });
33806
33807   // node_modules/d3-scale/src/continuous.js
33808   function identity4(x2) {
33809     return x2;
33810   }
33811   function normalize(a2, b2) {
33812     return (b2 -= a2 = +a2) ? function(x2) {
33813       return (x2 - a2) / b2;
33814     } : constants(isNaN(b2) ? NaN : 0.5);
33815   }
33816   function clamper(a2, b2) {
33817     var t2;
33818     if (a2 > b2) t2 = a2, a2 = b2, b2 = t2;
33819     return function(x2) {
33820       return Math.max(a2, Math.min(b2, x2));
33821     };
33822   }
33823   function bimap(domain, range3, interpolate) {
33824     var d0 = domain[0], d1 = domain[1], r0 = range3[0], r1 = range3[1];
33825     if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0);
33826     else d0 = normalize(d0, d1), r0 = interpolate(r0, r1);
33827     return function(x2) {
33828       return r0(d0(x2));
33829     };
33830   }
33831   function polymap(domain, range3, interpolate) {
33832     var j2 = Math.min(domain.length, range3.length) - 1, d2 = new Array(j2), r2 = new Array(j2), i3 = -1;
33833     if (domain[j2] < domain[0]) {
33834       domain = domain.slice().reverse();
33835       range3 = range3.slice().reverse();
33836     }
33837     while (++i3 < j2) {
33838       d2[i3] = normalize(domain[i3], domain[i3 + 1]);
33839       r2[i3] = interpolate(range3[i3], range3[i3 + 1]);
33840     }
33841     return function(x2) {
33842       var i4 = bisect_default(domain, x2, 1, j2) - 1;
33843       return r2[i4](d2[i4](x2));
33844     };
33845   }
33846   function copy(source, target) {
33847     return target.domain(source.domain()).range(source.range()).interpolate(source.interpolate()).clamp(source.clamp()).unknown(source.unknown());
33848   }
33849   function transformer2() {
33850     var domain = unit, range3 = unit, interpolate = value_default, transform2, untransform, unknown, clamp3 = identity4, piecewise, output, input;
33851     function rescale() {
33852       var n3 = Math.min(domain.length, range3.length);
33853       if (clamp3 !== identity4) clamp3 = clamper(domain[0], domain[n3 - 1]);
33854       piecewise = n3 > 2 ? polymap : bimap;
33855       output = input = null;
33856       return scale;
33857     }
33858     function scale(x2) {
33859       return x2 == null || isNaN(x2 = +x2) ? unknown : (output || (output = piecewise(domain.map(transform2), range3, interpolate)))(transform2(clamp3(x2)));
33860     }
33861     scale.invert = function(y2) {
33862       return clamp3(untransform((input || (input = piecewise(range3, domain.map(transform2), number_default)))(y2)));
33863     };
33864     scale.domain = function(_2) {
33865       return arguments.length ? (domain = Array.from(_2, number2), rescale()) : domain.slice();
33866     };
33867     scale.range = function(_2) {
33868       return arguments.length ? (range3 = Array.from(_2), rescale()) : range3.slice();
33869     };
33870     scale.rangeRound = function(_2) {
33871       return range3 = Array.from(_2), interpolate = round_default, rescale();
33872     };
33873     scale.clamp = function(_2) {
33874       return arguments.length ? (clamp3 = _2 ? true : identity4, rescale()) : clamp3 !== identity4;
33875     };
33876     scale.interpolate = function(_2) {
33877       return arguments.length ? (interpolate = _2, rescale()) : interpolate;
33878     };
33879     scale.unknown = function(_2) {
33880       return arguments.length ? (unknown = _2, scale) : unknown;
33881     };
33882     return function(t2, u2) {
33883       transform2 = t2, untransform = u2;
33884       return rescale();
33885     };
33886   }
33887   function continuous() {
33888     return transformer2()(identity4, identity4);
33889   }
33890   var unit;
33891   var init_continuous = __esm({
33892     "node_modules/d3-scale/src/continuous.js"() {
33893       init_src();
33894       init_src8();
33895       init_constant6();
33896       init_number3();
33897       unit = [0, 1];
33898     }
33899   });
33900
33901   // node_modules/d3-format/src/formatDecimal.js
33902   function formatDecimal_default(x2) {
33903     return Math.abs(x2 = Math.round(x2)) >= 1e21 ? x2.toLocaleString("en").replace(/,/g, "") : x2.toString(10);
33904   }
33905   function formatDecimalParts(x2, p2) {
33906     if ((i3 = (x2 = p2 ? x2.toExponential(p2 - 1) : x2.toExponential()).indexOf("e")) < 0) return null;
33907     var i3, coefficient = x2.slice(0, i3);
33908     return [
33909       coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
33910       +x2.slice(i3 + 1)
33911     ];
33912   }
33913   var init_formatDecimal = __esm({
33914     "node_modules/d3-format/src/formatDecimal.js"() {
33915     }
33916   });
33917
33918   // node_modules/d3-format/src/exponent.js
33919   function exponent_default(x2) {
33920     return x2 = formatDecimalParts(Math.abs(x2)), x2 ? x2[1] : NaN;
33921   }
33922   var init_exponent = __esm({
33923     "node_modules/d3-format/src/exponent.js"() {
33924       init_formatDecimal();
33925     }
33926   });
33927
33928   // node_modules/d3-format/src/formatGroup.js
33929   function formatGroup_default(grouping, thousands) {
33930     return function(value, width) {
33931       var i3 = value.length, t2 = [], j2 = 0, g3 = grouping[0], length2 = 0;
33932       while (i3 > 0 && g3 > 0) {
33933         if (length2 + g3 + 1 > width) g3 = Math.max(1, width - length2);
33934         t2.push(value.substring(i3 -= g3, i3 + g3));
33935         if ((length2 += g3 + 1) > width) break;
33936         g3 = grouping[j2 = (j2 + 1) % grouping.length];
33937       }
33938       return t2.reverse().join(thousands);
33939     };
33940   }
33941   var init_formatGroup = __esm({
33942     "node_modules/d3-format/src/formatGroup.js"() {
33943     }
33944   });
33945
33946   // node_modules/d3-format/src/formatNumerals.js
33947   function formatNumerals_default(numerals) {
33948     return function(value) {
33949       return value.replace(/[0-9]/g, function(i3) {
33950         return numerals[+i3];
33951       });
33952     };
33953   }
33954   var init_formatNumerals = __esm({
33955     "node_modules/d3-format/src/formatNumerals.js"() {
33956     }
33957   });
33958
33959   // node_modules/d3-format/src/formatSpecifier.js
33960   function formatSpecifier(specifier) {
33961     if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier);
33962     var match;
33963     return new FormatSpecifier({
33964       fill: match[1],
33965       align: match[2],
33966       sign: match[3],
33967       symbol: match[4],
33968       zero: match[5],
33969       width: match[6],
33970       comma: match[7],
33971       precision: match[8] && match[8].slice(1),
33972       trim: match[9],
33973       type: match[10]
33974     });
33975   }
33976   function FormatSpecifier(specifier) {
33977     this.fill = specifier.fill === void 0 ? " " : specifier.fill + "";
33978     this.align = specifier.align === void 0 ? ">" : specifier.align + "";
33979     this.sign = specifier.sign === void 0 ? "-" : specifier.sign + "";
33980     this.symbol = specifier.symbol === void 0 ? "" : specifier.symbol + "";
33981     this.zero = !!specifier.zero;
33982     this.width = specifier.width === void 0 ? void 0 : +specifier.width;
33983     this.comma = !!specifier.comma;
33984     this.precision = specifier.precision === void 0 ? void 0 : +specifier.precision;
33985     this.trim = !!specifier.trim;
33986     this.type = specifier.type === void 0 ? "" : specifier.type + "";
33987   }
33988   var re;
33989   var init_formatSpecifier = __esm({
33990     "node_modules/d3-format/src/formatSpecifier.js"() {
33991       re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
33992       formatSpecifier.prototype = FormatSpecifier.prototype;
33993       FormatSpecifier.prototype.toString = function() {
33994         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;
33995       };
33996     }
33997   });
33998
33999   // node_modules/d3-format/src/formatTrim.js
34000   function formatTrim_default(s2) {
34001     out: for (var n3 = s2.length, i3 = 1, i0 = -1, i1; i3 < n3; ++i3) {
34002       switch (s2[i3]) {
34003         case ".":
34004           i0 = i1 = i3;
34005           break;
34006         case "0":
34007           if (i0 === 0) i0 = i3;
34008           i1 = i3;
34009           break;
34010         default:
34011           if (!+s2[i3]) break out;
34012           if (i0 > 0) i0 = 0;
34013           break;
34014       }
34015     }
34016     return i0 > 0 ? s2.slice(0, i0) + s2.slice(i1 + 1) : s2;
34017   }
34018   var init_formatTrim = __esm({
34019     "node_modules/d3-format/src/formatTrim.js"() {
34020     }
34021   });
34022
34023   // node_modules/d3-format/src/formatPrefixAuto.js
34024   function formatPrefixAuto_default(x2, p2) {
34025     var d2 = formatDecimalParts(x2, p2);
34026     if (!d2) return x2 + "";
34027     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;
34028     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];
34029   }
34030   var prefixExponent;
34031   var init_formatPrefixAuto = __esm({
34032     "node_modules/d3-format/src/formatPrefixAuto.js"() {
34033       init_formatDecimal();
34034     }
34035   });
34036
34037   // node_modules/d3-format/src/formatRounded.js
34038   function formatRounded_default(x2, p2) {
34039     var d2 = formatDecimalParts(x2, p2);
34040     if (!d2) return x2 + "";
34041     var coefficient = d2[0], exponent = d2[1];
34042     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");
34043   }
34044   var init_formatRounded = __esm({
34045     "node_modules/d3-format/src/formatRounded.js"() {
34046       init_formatDecimal();
34047     }
34048   });
34049
34050   // node_modules/d3-format/src/formatTypes.js
34051   var formatTypes_default;
34052   var init_formatTypes = __esm({
34053     "node_modules/d3-format/src/formatTypes.js"() {
34054       init_formatDecimal();
34055       init_formatPrefixAuto();
34056       init_formatRounded();
34057       formatTypes_default = {
34058         "%": (x2, p2) => (x2 * 100).toFixed(p2),
34059         "b": (x2) => Math.round(x2).toString(2),
34060         "c": (x2) => x2 + "",
34061         "d": formatDecimal_default,
34062         "e": (x2, p2) => x2.toExponential(p2),
34063         "f": (x2, p2) => x2.toFixed(p2),
34064         "g": (x2, p2) => x2.toPrecision(p2),
34065         "o": (x2) => Math.round(x2).toString(8),
34066         "p": (x2, p2) => formatRounded_default(x2 * 100, p2),
34067         "r": formatRounded_default,
34068         "s": formatPrefixAuto_default,
34069         "X": (x2) => Math.round(x2).toString(16).toUpperCase(),
34070         "x": (x2) => Math.round(x2).toString(16)
34071       };
34072     }
34073   });
34074
34075   // node_modules/d3-format/src/identity.js
34076   function identity_default5(x2) {
34077     return x2;
34078   }
34079   var init_identity4 = __esm({
34080     "node_modules/d3-format/src/identity.js"() {
34081     }
34082   });
34083
34084   // node_modules/d3-format/src/locale.js
34085   function locale_default(locale3) {
34086     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 + "";
34087     function newFormat(specifier) {
34088       specifier = formatSpecifier(specifier);
34089       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;
34090       if (type2 === "n") comma = true, type2 = "g";
34091       else if (!formatTypes_default[type2]) precision3 === void 0 && (precision3 = 12), trim = true, type2 = "g";
34092       if (zero3 || fill === "0" && align === "=") zero3 = true, fill = "0", align = "=";
34093       var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type2) ? "0" + type2.toLowerCase() : "", suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type2) ? percent : "";
34094       var formatType = formatTypes_default[type2], maybeSuffix = /[defgprs%]/.test(type2);
34095       precision3 = precision3 === void 0 ? 6 : /[gprs]/.test(type2) ? Math.max(1, Math.min(21, precision3)) : Math.max(0, Math.min(20, precision3));
34096       function format2(value) {
34097         var valuePrefix = prefix, valueSuffix = suffix, i3, n3, c2;
34098         if (type2 === "c") {
34099           valueSuffix = formatType(value) + valueSuffix;
34100           value = "";
34101         } else {
34102           value = +value;
34103           var valueNegative = value < 0 || 1 / value < 0;
34104           value = isNaN(value) ? nan : formatType(Math.abs(value), precision3);
34105           if (trim) value = formatTrim_default(value);
34106           if (valueNegative && +value === 0 && sign2 !== "+") valueNegative = false;
34107           valuePrefix = (valueNegative ? sign2 === "(" ? sign2 : minus : sign2 === "-" || sign2 === "(" ? "" : sign2) + valuePrefix;
34108           valueSuffix = (type2 === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign2 === "(" ? ")" : "");
34109           if (maybeSuffix) {
34110             i3 = -1, n3 = value.length;
34111             while (++i3 < n3) {
34112               if (c2 = value.charCodeAt(i3), 48 > c2 || c2 > 57) {
34113                 valueSuffix = (c2 === 46 ? decimal + value.slice(i3 + 1) : value.slice(i3)) + valueSuffix;
34114                 value = value.slice(0, i3);
34115                 break;
34116               }
34117             }
34118           }
34119         }
34120         if (comma && !zero3) value = group(value, Infinity);
34121         var length2 = valuePrefix.length + value.length + valueSuffix.length, padding = length2 < width ? new Array(width - length2 + 1).join(fill) : "";
34122         if (comma && zero3) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";
34123         switch (align) {
34124           case "<":
34125             value = valuePrefix + value + valueSuffix + padding;
34126             break;
34127           case "=":
34128             value = valuePrefix + padding + value + valueSuffix;
34129             break;
34130           case "^":
34131             value = padding.slice(0, length2 = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length2);
34132             break;
34133           default:
34134             value = padding + valuePrefix + value + valueSuffix;
34135             break;
34136         }
34137         return numerals(value);
34138       }
34139       format2.toString = function() {
34140         return specifier + "";
34141       };
34142       return format2;
34143     }
34144     function formatPrefix2(specifier, value) {
34145       var f2 = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)), e3 = Math.max(-8, Math.min(8, Math.floor(exponent_default(value) / 3))) * 3, k2 = Math.pow(10, -e3), prefix = prefixes[8 + e3 / 3];
34146       return function(value2) {
34147         return f2(k2 * value2) + prefix;
34148       };
34149     }
34150     return {
34151       format: newFormat,
34152       formatPrefix: formatPrefix2
34153     };
34154   }
34155   var map, prefixes;
34156   var init_locale = __esm({
34157     "node_modules/d3-format/src/locale.js"() {
34158       init_exponent();
34159       init_formatGroup();
34160       init_formatNumerals();
34161       init_formatSpecifier();
34162       init_formatTrim();
34163       init_formatTypes();
34164       init_formatPrefixAuto();
34165       init_identity4();
34166       map = Array.prototype.map;
34167       prefixes = ["y", "z", "a", "f", "p", "n", "\xB5", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
34168     }
34169   });
34170
34171   // node_modules/d3-format/src/defaultLocale.js
34172   function defaultLocale(definition) {
34173     locale = locale_default(definition);
34174     format = locale.format;
34175     formatPrefix = locale.formatPrefix;
34176     return locale;
34177   }
34178   var locale, format, formatPrefix;
34179   var init_defaultLocale = __esm({
34180     "node_modules/d3-format/src/defaultLocale.js"() {
34181       init_locale();
34182       defaultLocale({
34183         thousands: ",",
34184         grouping: [3],
34185         currency: ["$", ""]
34186       });
34187     }
34188   });
34189
34190   // node_modules/d3-format/src/precisionFixed.js
34191   function precisionFixed_default(step) {
34192     return Math.max(0, -exponent_default(Math.abs(step)));
34193   }
34194   var init_precisionFixed = __esm({
34195     "node_modules/d3-format/src/precisionFixed.js"() {
34196       init_exponent();
34197     }
34198   });
34199
34200   // node_modules/d3-format/src/precisionPrefix.js
34201   function precisionPrefix_default(step, value) {
34202     return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent_default(value) / 3))) * 3 - exponent_default(Math.abs(step)));
34203   }
34204   var init_precisionPrefix = __esm({
34205     "node_modules/d3-format/src/precisionPrefix.js"() {
34206       init_exponent();
34207     }
34208   });
34209
34210   // node_modules/d3-format/src/precisionRound.js
34211   function precisionRound_default(step, max3) {
34212     step = Math.abs(step), max3 = Math.abs(max3) - step;
34213     return Math.max(0, exponent_default(max3) - exponent_default(step)) + 1;
34214   }
34215   var init_precisionRound = __esm({
34216     "node_modules/d3-format/src/precisionRound.js"() {
34217       init_exponent();
34218     }
34219   });
34220
34221   // node_modules/d3-format/src/index.js
34222   var init_src13 = __esm({
34223     "node_modules/d3-format/src/index.js"() {
34224       init_defaultLocale();
34225       init_formatSpecifier();
34226       init_precisionFixed();
34227       init_precisionPrefix();
34228       init_precisionRound();
34229     }
34230   });
34231
34232   // node_modules/d3-scale/src/tickFormat.js
34233   function tickFormat(start2, stop, count, specifier) {
34234     var step = tickStep(start2, stop, count), precision3;
34235     specifier = formatSpecifier(specifier == null ? ",f" : specifier);
34236     switch (specifier.type) {
34237       case "s": {
34238         var value = Math.max(Math.abs(start2), Math.abs(stop));
34239         if (specifier.precision == null && !isNaN(precision3 = precisionPrefix_default(step, value))) specifier.precision = precision3;
34240         return formatPrefix(specifier, value);
34241       }
34242       case "":
34243       case "e":
34244       case "g":
34245       case "p":
34246       case "r": {
34247         if (specifier.precision == null && !isNaN(precision3 = precisionRound_default(step, Math.max(Math.abs(start2), Math.abs(stop))))) specifier.precision = precision3 - (specifier.type === "e");
34248         break;
34249       }
34250       case "f":
34251       case "%": {
34252         if (specifier.precision == null && !isNaN(precision3 = precisionFixed_default(step))) specifier.precision = precision3 - (specifier.type === "%") * 2;
34253         break;
34254       }
34255     }
34256     return format(specifier);
34257   }
34258   var init_tickFormat = __esm({
34259     "node_modules/d3-scale/src/tickFormat.js"() {
34260       init_src();
34261       init_src13();
34262     }
34263   });
34264
34265   // node_modules/d3-scale/src/linear.js
34266   function linearish(scale) {
34267     var domain = scale.domain;
34268     scale.ticks = function(count) {
34269       var d2 = domain();
34270       return ticks(d2[0], d2[d2.length - 1], count == null ? 10 : count);
34271     };
34272     scale.tickFormat = function(count, specifier) {
34273       var d2 = domain();
34274       return tickFormat(d2[0], d2[d2.length - 1], count == null ? 10 : count, specifier);
34275     };
34276     scale.nice = function(count) {
34277       if (count == null) count = 10;
34278       var d2 = domain();
34279       var i0 = 0;
34280       var i1 = d2.length - 1;
34281       var start2 = d2[i0];
34282       var stop = d2[i1];
34283       var prestep;
34284       var step;
34285       var maxIter = 10;
34286       if (stop < start2) {
34287         step = start2, start2 = stop, stop = step;
34288         step = i0, i0 = i1, i1 = step;
34289       }
34290       while (maxIter-- > 0) {
34291         step = tickIncrement(start2, stop, count);
34292         if (step === prestep) {
34293           d2[i0] = start2;
34294           d2[i1] = stop;
34295           return domain(d2);
34296         } else if (step > 0) {
34297           start2 = Math.floor(start2 / step) * step;
34298           stop = Math.ceil(stop / step) * step;
34299         } else if (step < 0) {
34300           start2 = Math.ceil(start2 * step) / step;
34301           stop = Math.floor(stop * step) / step;
34302         } else {
34303           break;
34304         }
34305         prestep = step;
34306       }
34307       return scale;
34308     };
34309     return scale;
34310   }
34311   function linear3() {
34312     var scale = continuous();
34313     scale.copy = function() {
34314       return copy(scale, linear3());
34315     };
34316     initRange.apply(scale, arguments);
34317     return linearish(scale);
34318   }
34319   var init_linear2 = __esm({
34320     "node_modules/d3-scale/src/linear.js"() {
34321       init_src();
34322       init_continuous();
34323       init_init();
34324       init_tickFormat();
34325     }
34326   });
34327
34328   // node_modules/d3-scale/src/quantize.js
34329   function quantize() {
34330     var x05 = 0, x12 = 1, n3 = 1, domain = [0.5], range3 = [0, 1], unknown;
34331     function scale(x2) {
34332       return x2 != null && x2 <= x2 ? range3[bisect_default(domain, x2, 0, n3)] : unknown;
34333     }
34334     function rescale() {
34335       var i3 = -1;
34336       domain = new Array(n3);
34337       while (++i3 < n3) domain[i3] = ((i3 + 1) * x12 - (i3 - n3) * x05) / (n3 + 1);
34338       return scale;
34339     }
34340     scale.domain = function(_2) {
34341       return arguments.length ? ([x05, x12] = _2, x05 = +x05, x12 = +x12, rescale()) : [x05, x12];
34342     };
34343     scale.range = function(_2) {
34344       return arguments.length ? (n3 = (range3 = Array.from(_2)).length - 1, rescale()) : range3.slice();
34345     };
34346     scale.invertExtent = function(y2) {
34347       var i3 = range3.indexOf(y2);
34348       return i3 < 0 ? [NaN, NaN] : i3 < 1 ? [x05, domain[0]] : i3 >= n3 ? [domain[n3 - 1], x12] : [domain[i3 - 1], domain[i3]];
34349     };
34350     scale.unknown = function(_2) {
34351       return arguments.length ? (unknown = _2, scale) : scale;
34352     };
34353     scale.thresholds = function() {
34354       return domain.slice();
34355     };
34356     scale.copy = function() {
34357       return quantize().domain([x05, x12]).range(range3).unknown(unknown);
34358     };
34359     return initRange.apply(linearish(scale), arguments);
34360   }
34361   var init_quantize2 = __esm({
34362     "node_modules/d3-scale/src/quantize.js"() {
34363       init_src();
34364       init_linear2();
34365       init_init();
34366     }
34367   });
34368
34369   // node_modules/d3-time/src/interval.js
34370   function timeInterval(floori, offseti, count, field) {
34371     function interval2(date) {
34372       return floori(date = arguments.length === 0 ? /* @__PURE__ */ new Date() : /* @__PURE__ */ new Date(+date)), date;
34373     }
34374     interval2.floor = (date) => {
34375       return floori(date = /* @__PURE__ */ new Date(+date)), date;
34376     };
34377     interval2.ceil = (date) => {
34378       return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date;
34379     };
34380     interval2.round = (date) => {
34381       const d0 = interval2(date), d1 = interval2.ceil(date);
34382       return date - d0 < d1 - date ? d0 : d1;
34383     };
34384     interval2.offset = (date, step) => {
34385       return offseti(date = /* @__PURE__ */ new Date(+date), step == null ? 1 : Math.floor(step)), date;
34386     };
34387     interval2.range = (start2, stop, step) => {
34388       const range3 = [];
34389       start2 = interval2.ceil(start2);
34390       step = step == null ? 1 : Math.floor(step);
34391       if (!(start2 < stop) || !(step > 0)) return range3;
34392       let previous;
34393       do
34394         range3.push(previous = /* @__PURE__ */ new Date(+start2)), offseti(start2, step), floori(start2);
34395       while (previous < start2 && start2 < stop);
34396       return range3;
34397     };
34398     interval2.filter = (test) => {
34399       return timeInterval((date) => {
34400         if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1);
34401       }, (date, step) => {
34402         if (date >= date) {
34403           if (step < 0) while (++step <= 0) {
34404             while (offseti(date, -1), !test(date)) {
34405             }
34406           }
34407           else while (--step >= 0) {
34408             while (offseti(date, 1), !test(date)) {
34409             }
34410           }
34411         }
34412       });
34413     };
34414     if (count) {
34415       interval2.count = (start2, end) => {
34416         t0.setTime(+start2), t1.setTime(+end);
34417         floori(t0), floori(t1);
34418         return Math.floor(count(t0, t1));
34419       };
34420       interval2.every = (step) => {
34421         step = Math.floor(step);
34422         return !isFinite(step) || !(step > 0) ? null : !(step > 1) ? interval2 : interval2.filter(field ? (d2) => field(d2) % step === 0 : (d2) => interval2.count(0, d2) % step === 0);
34423       };
34424     }
34425     return interval2;
34426   }
34427   var t0, t1;
34428   var init_interval = __esm({
34429     "node_modules/d3-time/src/interval.js"() {
34430       t0 = /* @__PURE__ */ new Date();
34431       t1 = /* @__PURE__ */ new Date();
34432     }
34433   });
34434
34435   // node_modules/d3-time/src/duration.js
34436   var durationSecond, durationMinute, durationHour, durationDay, durationWeek, durationMonth, durationYear;
34437   var init_duration2 = __esm({
34438     "node_modules/d3-time/src/duration.js"() {
34439       durationSecond = 1e3;
34440       durationMinute = durationSecond * 60;
34441       durationHour = durationMinute * 60;
34442       durationDay = durationHour * 24;
34443       durationWeek = durationDay * 7;
34444       durationMonth = durationDay * 30;
34445       durationYear = durationDay * 365;
34446     }
34447   });
34448
34449   // node_modules/d3-time/src/day.js
34450   var timeDay, timeDays, utcDay, utcDays, unixDay, unixDays;
34451   var init_day = __esm({
34452     "node_modules/d3-time/src/day.js"() {
34453       init_interval();
34454       init_duration2();
34455       timeDay = timeInterval(
34456         (date) => date.setHours(0, 0, 0, 0),
34457         (date, step) => date.setDate(date.getDate() + step),
34458         (start2, end) => (end - start2 - (end.getTimezoneOffset() - start2.getTimezoneOffset()) * durationMinute) / durationDay,
34459         (date) => date.getDate() - 1
34460       );
34461       timeDays = timeDay.range;
34462       utcDay = timeInterval((date) => {
34463         date.setUTCHours(0, 0, 0, 0);
34464       }, (date, step) => {
34465         date.setUTCDate(date.getUTCDate() + step);
34466       }, (start2, end) => {
34467         return (end - start2) / durationDay;
34468       }, (date) => {
34469         return date.getUTCDate() - 1;
34470       });
34471       utcDays = utcDay.range;
34472       unixDay = timeInterval((date) => {
34473         date.setUTCHours(0, 0, 0, 0);
34474       }, (date, step) => {
34475         date.setUTCDate(date.getUTCDate() + step);
34476       }, (start2, end) => {
34477         return (end - start2) / durationDay;
34478       }, (date) => {
34479         return Math.floor(date / durationDay);
34480       });
34481       unixDays = unixDay.range;
34482     }
34483   });
34484
34485   // node_modules/d3-time/src/week.js
34486   function timeWeekday(i3) {
34487     return timeInterval((date) => {
34488       date.setDate(date.getDate() - (date.getDay() + 7 - i3) % 7);
34489       date.setHours(0, 0, 0, 0);
34490     }, (date, step) => {
34491       date.setDate(date.getDate() + step * 7);
34492     }, (start2, end) => {
34493       return (end - start2 - (end.getTimezoneOffset() - start2.getTimezoneOffset()) * durationMinute) / durationWeek;
34494     });
34495   }
34496   function utcWeekday(i3) {
34497     return timeInterval((date) => {
34498       date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i3) % 7);
34499       date.setUTCHours(0, 0, 0, 0);
34500     }, (date, step) => {
34501       date.setUTCDate(date.getUTCDate() + step * 7);
34502     }, (start2, end) => {
34503       return (end - start2) / durationWeek;
34504     });
34505   }
34506   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;
34507   var init_week = __esm({
34508     "node_modules/d3-time/src/week.js"() {
34509       init_interval();
34510       init_duration2();
34511       timeSunday = timeWeekday(0);
34512       timeMonday = timeWeekday(1);
34513       timeTuesday = timeWeekday(2);
34514       timeWednesday = timeWeekday(3);
34515       timeThursday = timeWeekday(4);
34516       timeFriday = timeWeekday(5);
34517       timeSaturday = timeWeekday(6);
34518       timeSundays = timeSunday.range;
34519       timeMondays = timeMonday.range;
34520       timeTuesdays = timeTuesday.range;
34521       timeWednesdays = timeWednesday.range;
34522       timeThursdays = timeThursday.range;
34523       timeFridays = timeFriday.range;
34524       timeSaturdays = timeSaturday.range;
34525       utcSunday = utcWeekday(0);
34526       utcMonday = utcWeekday(1);
34527       utcTuesday = utcWeekday(2);
34528       utcWednesday = utcWeekday(3);
34529       utcThursday = utcWeekday(4);
34530       utcFriday = utcWeekday(5);
34531       utcSaturday = utcWeekday(6);
34532       utcSundays = utcSunday.range;
34533       utcMondays = utcMonday.range;
34534       utcTuesdays = utcTuesday.range;
34535       utcWednesdays = utcWednesday.range;
34536       utcThursdays = utcThursday.range;
34537       utcFridays = utcFriday.range;
34538       utcSaturdays = utcSaturday.range;
34539     }
34540   });
34541
34542   // node_modules/d3-time/src/year.js
34543   var timeYear, timeYears, utcYear, utcYears;
34544   var init_year = __esm({
34545     "node_modules/d3-time/src/year.js"() {
34546       init_interval();
34547       timeYear = timeInterval((date) => {
34548         date.setMonth(0, 1);
34549         date.setHours(0, 0, 0, 0);
34550       }, (date, step) => {
34551         date.setFullYear(date.getFullYear() + step);
34552       }, (start2, end) => {
34553         return end.getFullYear() - start2.getFullYear();
34554       }, (date) => {
34555         return date.getFullYear();
34556       });
34557       timeYear.every = (k2) => {
34558         return !isFinite(k2 = Math.floor(k2)) || !(k2 > 0) ? null : timeInterval((date) => {
34559           date.setFullYear(Math.floor(date.getFullYear() / k2) * k2);
34560           date.setMonth(0, 1);
34561           date.setHours(0, 0, 0, 0);
34562         }, (date, step) => {
34563           date.setFullYear(date.getFullYear() + step * k2);
34564         });
34565       };
34566       timeYears = timeYear.range;
34567       utcYear = timeInterval((date) => {
34568         date.setUTCMonth(0, 1);
34569         date.setUTCHours(0, 0, 0, 0);
34570       }, (date, step) => {
34571         date.setUTCFullYear(date.getUTCFullYear() + step);
34572       }, (start2, end) => {
34573         return end.getUTCFullYear() - start2.getUTCFullYear();
34574       }, (date) => {
34575         return date.getUTCFullYear();
34576       });
34577       utcYear.every = (k2) => {
34578         return !isFinite(k2 = Math.floor(k2)) || !(k2 > 0) ? null : timeInterval((date) => {
34579           date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k2) * k2);
34580           date.setUTCMonth(0, 1);
34581           date.setUTCHours(0, 0, 0, 0);
34582         }, (date, step) => {
34583           date.setUTCFullYear(date.getUTCFullYear() + step * k2);
34584         });
34585       };
34586       utcYears = utcYear.range;
34587     }
34588   });
34589
34590   // node_modules/d3-time/src/index.js
34591   var init_src14 = __esm({
34592     "node_modules/d3-time/src/index.js"() {
34593       init_day();
34594       init_week();
34595       init_year();
34596     }
34597   });
34598
34599   // node_modules/d3-time-format/src/locale.js
34600   function localDate(d2) {
34601     if (0 <= d2.y && d2.y < 100) {
34602       var date = new Date(-1, d2.m, d2.d, d2.H, d2.M, d2.S, d2.L);
34603       date.setFullYear(d2.y);
34604       return date;
34605     }
34606     return new Date(d2.y, d2.m, d2.d, d2.H, d2.M, d2.S, d2.L);
34607   }
34608   function utcDate(d2) {
34609     if (0 <= d2.y && d2.y < 100) {
34610       var date = new Date(Date.UTC(-1, d2.m, d2.d, d2.H, d2.M, d2.S, d2.L));
34611       date.setUTCFullYear(d2.y);
34612       return date;
34613     }
34614     return new Date(Date.UTC(d2.y, d2.m, d2.d, d2.H, d2.M, d2.S, d2.L));
34615   }
34616   function newDate(y2, m2, d2) {
34617     return { y: y2, m: m2, d: d2, H: 0, M: 0, S: 0, L: 0 };
34618   }
34619   function formatLocale(locale3) {
34620     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;
34621     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);
34622     var formats = {
34623       "a": formatShortWeekday,
34624       "A": formatWeekday,
34625       "b": formatShortMonth,
34626       "B": formatMonth,
34627       "c": null,
34628       "d": formatDayOfMonth,
34629       "e": formatDayOfMonth,
34630       "f": formatMicroseconds,
34631       "g": formatYearISO,
34632       "G": formatFullYearISO,
34633       "H": formatHour24,
34634       "I": formatHour12,
34635       "j": formatDayOfYear,
34636       "L": formatMilliseconds,
34637       "m": formatMonthNumber,
34638       "M": formatMinutes,
34639       "p": formatPeriod,
34640       "q": formatQuarter,
34641       "Q": formatUnixTimestamp,
34642       "s": formatUnixTimestampSeconds,
34643       "S": formatSeconds,
34644       "u": formatWeekdayNumberMonday,
34645       "U": formatWeekNumberSunday,
34646       "V": formatWeekNumberISO,
34647       "w": formatWeekdayNumberSunday,
34648       "W": formatWeekNumberMonday,
34649       "x": null,
34650       "X": null,
34651       "y": formatYear,
34652       "Y": formatFullYear,
34653       "Z": formatZone,
34654       "%": formatLiteralPercent
34655     };
34656     var utcFormats = {
34657       "a": formatUTCShortWeekday,
34658       "A": formatUTCWeekday,
34659       "b": formatUTCShortMonth,
34660       "B": formatUTCMonth,
34661       "c": null,
34662       "d": formatUTCDayOfMonth,
34663       "e": formatUTCDayOfMonth,
34664       "f": formatUTCMicroseconds,
34665       "g": formatUTCYearISO,
34666       "G": formatUTCFullYearISO,
34667       "H": formatUTCHour24,
34668       "I": formatUTCHour12,
34669       "j": formatUTCDayOfYear,
34670       "L": formatUTCMilliseconds,
34671       "m": formatUTCMonthNumber,
34672       "M": formatUTCMinutes,
34673       "p": formatUTCPeriod,
34674       "q": formatUTCQuarter,
34675       "Q": formatUnixTimestamp,
34676       "s": formatUnixTimestampSeconds,
34677       "S": formatUTCSeconds,
34678       "u": formatUTCWeekdayNumberMonday,
34679       "U": formatUTCWeekNumberSunday,
34680       "V": formatUTCWeekNumberISO,
34681       "w": formatUTCWeekdayNumberSunday,
34682       "W": formatUTCWeekNumberMonday,
34683       "x": null,
34684       "X": null,
34685       "y": formatUTCYear,
34686       "Y": formatUTCFullYear,
34687       "Z": formatUTCZone,
34688       "%": formatLiteralPercent
34689     };
34690     var parses = {
34691       "a": parseShortWeekday,
34692       "A": parseWeekday,
34693       "b": parseShortMonth,
34694       "B": parseMonth,
34695       "c": parseLocaleDateTime,
34696       "d": parseDayOfMonth,
34697       "e": parseDayOfMonth,
34698       "f": parseMicroseconds,
34699       "g": parseYear,
34700       "G": parseFullYear,
34701       "H": parseHour24,
34702       "I": parseHour24,
34703       "j": parseDayOfYear,
34704       "L": parseMilliseconds,
34705       "m": parseMonthNumber,
34706       "M": parseMinutes,
34707       "p": parsePeriod,
34708       "q": parseQuarter,
34709       "Q": parseUnixTimestamp,
34710       "s": parseUnixTimestampSeconds,
34711       "S": parseSeconds,
34712       "u": parseWeekdayNumberMonday,
34713       "U": parseWeekNumberSunday,
34714       "V": parseWeekNumberISO,
34715       "w": parseWeekdayNumberSunday,
34716       "W": parseWeekNumberMonday,
34717       "x": parseLocaleDate,
34718       "X": parseLocaleTime,
34719       "y": parseYear,
34720       "Y": parseFullYear,
34721       "Z": parseZone,
34722       "%": parseLiteralPercent
34723     };
34724     formats.x = newFormat(locale_date, formats);
34725     formats.X = newFormat(locale_time, formats);
34726     formats.c = newFormat(locale_dateTime, formats);
34727     utcFormats.x = newFormat(locale_date, utcFormats);
34728     utcFormats.X = newFormat(locale_time, utcFormats);
34729     utcFormats.c = newFormat(locale_dateTime, utcFormats);
34730     function newFormat(specifier, formats2) {
34731       return function(date) {
34732         var string = [], i3 = -1, j2 = 0, n3 = specifier.length, c2, pad3, format2;
34733         if (!(date instanceof Date)) date = /* @__PURE__ */ new Date(+date);
34734         while (++i3 < n3) {
34735           if (specifier.charCodeAt(i3) === 37) {
34736             string.push(specifier.slice(j2, i3));
34737             if ((pad3 = pads[c2 = specifier.charAt(++i3)]) != null) c2 = specifier.charAt(++i3);
34738             else pad3 = c2 === "e" ? " " : "0";
34739             if (format2 = formats2[c2]) c2 = format2(date, pad3);
34740             string.push(c2);
34741             j2 = i3 + 1;
34742           }
34743         }
34744         string.push(specifier.slice(j2, i3));
34745         return string.join("");
34746       };
34747     }
34748     function newParse(specifier, Z3) {
34749       return function(string) {
34750         var d2 = newDate(1900, void 0, 1), i3 = parseSpecifier(d2, specifier, string += "", 0), week, day;
34751         if (i3 != string.length) return null;
34752         if ("Q" in d2) return new Date(d2.Q);
34753         if ("s" in d2) return new Date(d2.s * 1e3 + ("L" in d2 ? d2.L : 0));
34754         if (Z3 && !("Z" in d2)) d2.Z = 0;
34755         if ("p" in d2) d2.H = d2.H % 12 + d2.p * 12;
34756         if (d2.m === void 0) d2.m = "q" in d2 ? d2.q : 0;
34757         if ("V" in d2) {
34758           if (d2.V < 1 || d2.V > 53) return null;
34759           if (!("w" in d2)) d2.w = 1;
34760           if ("Z" in d2) {
34761             week = utcDate(newDate(d2.y, 0, 1)), day = week.getUTCDay();
34762             week = day > 4 || day === 0 ? utcMonday.ceil(week) : utcMonday(week);
34763             week = utcDay.offset(week, (d2.V - 1) * 7);
34764             d2.y = week.getUTCFullYear();
34765             d2.m = week.getUTCMonth();
34766             d2.d = week.getUTCDate() + (d2.w + 6) % 7;
34767           } else {
34768             week = localDate(newDate(d2.y, 0, 1)), day = week.getDay();
34769             week = day > 4 || day === 0 ? timeMonday.ceil(week) : timeMonday(week);
34770             week = timeDay.offset(week, (d2.V - 1) * 7);
34771             d2.y = week.getFullYear();
34772             d2.m = week.getMonth();
34773             d2.d = week.getDate() + (d2.w + 6) % 7;
34774           }
34775         } else if ("W" in d2 || "U" in d2) {
34776           if (!("w" in d2)) d2.w = "u" in d2 ? d2.u % 7 : "W" in d2 ? 1 : 0;
34777           day = "Z" in d2 ? utcDate(newDate(d2.y, 0, 1)).getUTCDay() : localDate(newDate(d2.y, 0, 1)).getDay();
34778           d2.m = 0;
34779           d2.d = "W" in d2 ? (d2.w + 6) % 7 + d2.W * 7 - (day + 5) % 7 : d2.w + d2.U * 7 - (day + 6) % 7;
34780         }
34781         if ("Z" in d2) {
34782           d2.H += d2.Z / 100 | 0;
34783           d2.M += d2.Z % 100;
34784           return utcDate(d2);
34785         }
34786         return localDate(d2);
34787       };
34788     }
34789     function parseSpecifier(d2, specifier, string, j2) {
34790       var i3 = 0, n3 = specifier.length, m2 = string.length, c2, parse;
34791       while (i3 < n3) {
34792         if (j2 >= m2) return -1;
34793         c2 = specifier.charCodeAt(i3++);
34794         if (c2 === 37) {
34795           c2 = specifier.charAt(i3++);
34796           parse = parses[c2 in pads ? specifier.charAt(i3++) : c2];
34797           if (!parse || (j2 = parse(d2, string, j2)) < 0) return -1;
34798         } else if (c2 != string.charCodeAt(j2++)) {
34799           return -1;
34800         }
34801       }
34802       return j2;
34803     }
34804     function parsePeriod(d2, string, i3) {
34805       var n3 = periodRe.exec(string.slice(i3));
34806       return n3 ? (d2.p = periodLookup.get(n3[0].toLowerCase()), i3 + n3[0].length) : -1;
34807     }
34808     function parseShortWeekday(d2, string, i3) {
34809       var n3 = shortWeekdayRe.exec(string.slice(i3));
34810       return n3 ? (d2.w = shortWeekdayLookup.get(n3[0].toLowerCase()), i3 + n3[0].length) : -1;
34811     }
34812     function parseWeekday(d2, string, i3) {
34813       var n3 = weekdayRe.exec(string.slice(i3));
34814       return n3 ? (d2.w = weekdayLookup.get(n3[0].toLowerCase()), i3 + n3[0].length) : -1;
34815     }
34816     function parseShortMonth(d2, string, i3) {
34817       var n3 = shortMonthRe.exec(string.slice(i3));
34818       return n3 ? (d2.m = shortMonthLookup.get(n3[0].toLowerCase()), i3 + n3[0].length) : -1;
34819     }
34820     function parseMonth(d2, string, i3) {
34821       var n3 = monthRe.exec(string.slice(i3));
34822       return n3 ? (d2.m = monthLookup.get(n3[0].toLowerCase()), i3 + n3[0].length) : -1;
34823     }
34824     function parseLocaleDateTime(d2, string, i3) {
34825       return parseSpecifier(d2, locale_dateTime, string, i3);
34826     }
34827     function parseLocaleDate(d2, string, i3) {
34828       return parseSpecifier(d2, locale_date, string, i3);
34829     }
34830     function parseLocaleTime(d2, string, i3) {
34831       return parseSpecifier(d2, locale_time, string, i3);
34832     }
34833     function formatShortWeekday(d2) {
34834       return locale_shortWeekdays[d2.getDay()];
34835     }
34836     function formatWeekday(d2) {
34837       return locale_weekdays[d2.getDay()];
34838     }
34839     function formatShortMonth(d2) {
34840       return locale_shortMonths[d2.getMonth()];
34841     }
34842     function formatMonth(d2) {
34843       return locale_months[d2.getMonth()];
34844     }
34845     function formatPeriod(d2) {
34846       return locale_periods[+(d2.getHours() >= 12)];
34847     }
34848     function formatQuarter(d2) {
34849       return 1 + ~~(d2.getMonth() / 3);
34850     }
34851     function formatUTCShortWeekday(d2) {
34852       return locale_shortWeekdays[d2.getUTCDay()];
34853     }
34854     function formatUTCWeekday(d2) {
34855       return locale_weekdays[d2.getUTCDay()];
34856     }
34857     function formatUTCShortMonth(d2) {
34858       return locale_shortMonths[d2.getUTCMonth()];
34859     }
34860     function formatUTCMonth(d2) {
34861       return locale_months[d2.getUTCMonth()];
34862     }
34863     function formatUTCPeriod(d2) {
34864       return locale_periods[+(d2.getUTCHours() >= 12)];
34865     }
34866     function formatUTCQuarter(d2) {
34867       return 1 + ~~(d2.getUTCMonth() / 3);
34868     }
34869     return {
34870       format: function(specifier) {
34871         var f2 = newFormat(specifier += "", formats);
34872         f2.toString = function() {
34873           return specifier;
34874         };
34875         return f2;
34876       },
34877       parse: function(specifier) {
34878         var p2 = newParse(specifier += "", false);
34879         p2.toString = function() {
34880           return specifier;
34881         };
34882         return p2;
34883       },
34884       utcFormat: function(specifier) {
34885         var f2 = newFormat(specifier += "", utcFormats);
34886         f2.toString = function() {
34887           return specifier;
34888         };
34889         return f2;
34890       },
34891       utcParse: function(specifier) {
34892         var p2 = newParse(specifier += "", true);
34893         p2.toString = function() {
34894           return specifier;
34895         };
34896         return p2;
34897       }
34898     };
34899   }
34900   function pad(value, fill, width) {
34901     var sign2 = value < 0 ? "-" : "", string = (sign2 ? -value : value) + "", length2 = string.length;
34902     return sign2 + (length2 < width ? new Array(width - length2 + 1).join(fill) + string : string);
34903   }
34904   function requote(s2) {
34905     return s2.replace(requoteRe, "\\$&");
34906   }
34907   function formatRe(names) {
34908     return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i");
34909   }
34910   function formatLookup(names) {
34911     return new Map(names.map((name, i3) => [name.toLowerCase(), i3]));
34912   }
34913   function parseWeekdayNumberSunday(d2, string, i3) {
34914     var n3 = numberRe.exec(string.slice(i3, i3 + 1));
34915     return n3 ? (d2.w = +n3[0], i3 + n3[0].length) : -1;
34916   }
34917   function parseWeekdayNumberMonday(d2, string, i3) {
34918     var n3 = numberRe.exec(string.slice(i3, i3 + 1));
34919     return n3 ? (d2.u = +n3[0], i3 + n3[0].length) : -1;
34920   }
34921   function parseWeekNumberSunday(d2, string, i3) {
34922     var n3 = numberRe.exec(string.slice(i3, i3 + 2));
34923     return n3 ? (d2.U = +n3[0], i3 + n3[0].length) : -1;
34924   }
34925   function parseWeekNumberISO(d2, string, i3) {
34926     var n3 = numberRe.exec(string.slice(i3, i3 + 2));
34927     return n3 ? (d2.V = +n3[0], i3 + n3[0].length) : -1;
34928   }
34929   function parseWeekNumberMonday(d2, string, i3) {
34930     var n3 = numberRe.exec(string.slice(i3, i3 + 2));
34931     return n3 ? (d2.W = +n3[0], i3 + n3[0].length) : -1;
34932   }
34933   function parseFullYear(d2, string, i3) {
34934     var n3 = numberRe.exec(string.slice(i3, i3 + 4));
34935     return n3 ? (d2.y = +n3[0], i3 + n3[0].length) : -1;
34936   }
34937   function parseYear(d2, string, i3) {
34938     var n3 = numberRe.exec(string.slice(i3, i3 + 2));
34939     return n3 ? (d2.y = +n3[0] + (+n3[0] > 68 ? 1900 : 2e3), i3 + n3[0].length) : -1;
34940   }
34941   function parseZone(d2, string, i3) {
34942     var n3 = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string.slice(i3, i3 + 6));
34943     return n3 ? (d2.Z = n3[1] ? 0 : -(n3[2] + (n3[3] || "00")), i3 + n3[0].length) : -1;
34944   }
34945   function parseQuarter(d2, string, i3) {
34946     var n3 = numberRe.exec(string.slice(i3, i3 + 1));
34947     return n3 ? (d2.q = n3[0] * 3 - 3, i3 + n3[0].length) : -1;
34948   }
34949   function parseMonthNumber(d2, string, i3) {
34950     var n3 = numberRe.exec(string.slice(i3, i3 + 2));
34951     return n3 ? (d2.m = n3[0] - 1, i3 + n3[0].length) : -1;
34952   }
34953   function parseDayOfMonth(d2, string, i3) {
34954     var n3 = numberRe.exec(string.slice(i3, i3 + 2));
34955     return n3 ? (d2.d = +n3[0], i3 + n3[0].length) : -1;
34956   }
34957   function parseDayOfYear(d2, string, i3) {
34958     var n3 = numberRe.exec(string.slice(i3, i3 + 3));
34959     return n3 ? (d2.m = 0, d2.d = +n3[0], i3 + n3[0].length) : -1;
34960   }
34961   function parseHour24(d2, string, i3) {
34962     var n3 = numberRe.exec(string.slice(i3, i3 + 2));
34963     return n3 ? (d2.H = +n3[0], i3 + n3[0].length) : -1;
34964   }
34965   function parseMinutes(d2, string, i3) {
34966     var n3 = numberRe.exec(string.slice(i3, i3 + 2));
34967     return n3 ? (d2.M = +n3[0], i3 + n3[0].length) : -1;
34968   }
34969   function parseSeconds(d2, string, i3) {
34970     var n3 = numberRe.exec(string.slice(i3, i3 + 2));
34971     return n3 ? (d2.S = +n3[0], i3 + n3[0].length) : -1;
34972   }
34973   function parseMilliseconds(d2, string, i3) {
34974     var n3 = numberRe.exec(string.slice(i3, i3 + 3));
34975     return n3 ? (d2.L = +n3[0], i3 + n3[0].length) : -1;
34976   }
34977   function parseMicroseconds(d2, string, i3) {
34978     var n3 = numberRe.exec(string.slice(i3, i3 + 6));
34979     return n3 ? (d2.L = Math.floor(n3[0] / 1e3), i3 + n3[0].length) : -1;
34980   }
34981   function parseLiteralPercent(d2, string, i3) {
34982     var n3 = percentRe.exec(string.slice(i3, i3 + 1));
34983     return n3 ? i3 + n3[0].length : -1;
34984   }
34985   function parseUnixTimestamp(d2, string, i3) {
34986     var n3 = numberRe.exec(string.slice(i3));
34987     return n3 ? (d2.Q = +n3[0], i3 + n3[0].length) : -1;
34988   }
34989   function parseUnixTimestampSeconds(d2, string, i3) {
34990     var n3 = numberRe.exec(string.slice(i3));
34991     return n3 ? (d2.s = +n3[0], i3 + n3[0].length) : -1;
34992   }
34993   function formatDayOfMonth(d2, p2) {
34994     return pad(d2.getDate(), p2, 2);
34995   }
34996   function formatHour24(d2, p2) {
34997     return pad(d2.getHours(), p2, 2);
34998   }
34999   function formatHour12(d2, p2) {
35000     return pad(d2.getHours() % 12 || 12, p2, 2);
35001   }
35002   function formatDayOfYear(d2, p2) {
35003     return pad(1 + timeDay.count(timeYear(d2), d2), p2, 3);
35004   }
35005   function formatMilliseconds(d2, p2) {
35006     return pad(d2.getMilliseconds(), p2, 3);
35007   }
35008   function formatMicroseconds(d2, p2) {
35009     return formatMilliseconds(d2, p2) + "000";
35010   }
35011   function formatMonthNumber(d2, p2) {
35012     return pad(d2.getMonth() + 1, p2, 2);
35013   }
35014   function formatMinutes(d2, p2) {
35015     return pad(d2.getMinutes(), p2, 2);
35016   }
35017   function formatSeconds(d2, p2) {
35018     return pad(d2.getSeconds(), p2, 2);
35019   }
35020   function formatWeekdayNumberMonday(d2) {
35021     var day = d2.getDay();
35022     return day === 0 ? 7 : day;
35023   }
35024   function formatWeekNumberSunday(d2, p2) {
35025     return pad(timeSunday.count(timeYear(d2) - 1, d2), p2, 2);
35026   }
35027   function dISO(d2) {
35028     var day = d2.getDay();
35029     return day >= 4 || day === 0 ? timeThursday(d2) : timeThursday.ceil(d2);
35030   }
35031   function formatWeekNumberISO(d2, p2) {
35032     d2 = dISO(d2);
35033     return pad(timeThursday.count(timeYear(d2), d2) + (timeYear(d2).getDay() === 4), p2, 2);
35034   }
35035   function formatWeekdayNumberSunday(d2) {
35036     return d2.getDay();
35037   }
35038   function formatWeekNumberMonday(d2, p2) {
35039     return pad(timeMonday.count(timeYear(d2) - 1, d2), p2, 2);
35040   }
35041   function formatYear(d2, p2) {
35042     return pad(d2.getFullYear() % 100, p2, 2);
35043   }
35044   function formatYearISO(d2, p2) {
35045     d2 = dISO(d2);
35046     return pad(d2.getFullYear() % 100, p2, 2);
35047   }
35048   function formatFullYear(d2, p2) {
35049     return pad(d2.getFullYear() % 1e4, p2, 4);
35050   }
35051   function formatFullYearISO(d2, p2) {
35052     var day = d2.getDay();
35053     d2 = day >= 4 || day === 0 ? timeThursday(d2) : timeThursday.ceil(d2);
35054     return pad(d2.getFullYear() % 1e4, p2, 4);
35055   }
35056   function formatZone(d2) {
35057     var z2 = d2.getTimezoneOffset();
35058     return (z2 > 0 ? "-" : (z2 *= -1, "+")) + pad(z2 / 60 | 0, "0", 2) + pad(z2 % 60, "0", 2);
35059   }
35060   function formatUTCDayOfMonth(d2, p2) {
35061     return pad(d2.getUTCDate(), p2, 2);
35062   }
35063   function formatUTCHour24(d2, p2) {
35064     return pad(d2.getUTCHours(), p2, 2);
35065   }
35066   function formatUTCHour12(d2, p2) {
35067     return pad(d2.getUTCHours() % 12 || 12, p2, 2);
35068   }
35069   function formatUTCDayOfYear(d2, p2) {
35070     return pad(1 + utcDay.count(utcYear(d2), d2), p2, 3);
35071   }
35072   function formatUTCMilliseconds(d2, p2) {
35073     return pad(d2.getUTCMilliseconds(), p2, 3);
35074   }
35075   function formatUTCMicroseconds(d2, p2) {
35076     return formatUTCMilliseconds(d2, p2) + "000";
35077   }
35078   function formatUTCMonthNumber(d2, p2) {
35079     return pad(d2.getUTCMonth() + 1, p2, 2);
35080   }
35081   function formatUTCMinutes(d2, p2) {
35082     return pad(d2.getUTCMinutes(), p2, 2);
35083   }
35084   function formatUTCSeconds(d2, p2) {
35085     return pad(d2.getUTCSeconds(), p2, 2);
35086   }
35087   function formatUTCWeekdayNumberMonday(d2) {
35088     var dow = d2.getUTCDay();
35089     return dow === 0 ? 7 : dow;
35090   }
35091   function formatUTCWeekNumberSunday(d2, p2) {
35092     return pad(utcSunday.count(utcYear(d2) - 1, d2), p2, 2);
35093   }
35094   function UTCdISO(d2) {
35095     var day = d2.getUTCDay();
35096     return day >= 4 || day === 0 ? utcThursday(d2) : utcThursday.ceil(d2);
35097   }
35098   function formatUTCWeekNumberISO(d2, p2) {
35099     d2 = UTCdISO(d2);
35100     return pad(utcThursday.count(utcYear(d2), d2) + (utcYear(d2).getUTCDay() === 4), p2, 2);
35101   }
35102   function formatUTCWeekdayNumberSunday(d2) {
35103     return d2.getUTCDay();
35104   }
35105   function formatUTCWeekNumberMonday(d2, p2) {
35106     return pad(utcMonday.count(utcYear(d2) - 1, d2), p2, 2);
35107   }
35108   function formatUTCYear(d2, p2) {
35109     return pad(d2.getUTCFullYear() % 100, p2, 2);
35110   }
35111   function formatUTCYearISO(d2, p2) {
35112     d2 = UTCdISO(d2);
35113     return pad(d2.getUTCFullYear() % 100, p2, 2);
35114   }
35115   function formatUTCFullYear(d2, p2) {
35116     return pad(d2.getUTCFullYear() % 1e4, p2, 4);
35117   }
35118   function formatUTCFullYearISO(d2, p2) {
35119     var day = d2.getUTCDay();
35120     d2 = day >= 4 || day === 0 ? utcThursday(d2) : utcThursday.ceil(d2);
35121     return pad(d2.getUTCFullYear() % 1e4, p2, 4);
35122   }
35123   function formatUTCZone() {
35124     return "+0000";
35125   }
35126   function formatLiteralPercent() {
35127     return "%";
35128   }
35129   function formatUnixTimestamp(d2) {
35130     return +d2;
35131   }
35132   function formatUnixTimestampSeconds(d2) {
35133     return Math.floor(+d2 / 1e3);
35134   }
35135   var pads, numberRe, percentRe, requoteRe;
35136   var init_locale2 = __esm({
35137     "node_modules/d3-time-format/src/locale.js"() {
35138       init_src14();
35139       pads = { "-": "", "_": " ", "0": "0" };
35140       numberRe = /^\s*\d+/;
35141       percentRe = /^%/;
35142       requoteRe = /[\\^$*+?|[\]().{}]/g;
35143     }
35144   });
35145
35146   // node_modules/d3-time-format/src/defaultLocale.js
35147   function defaultLocale2(definition) {
35148     locale2 = formatLocale(definition);
35149     timeFormat = locale2.format;
35150     timeParse = locale2.parse;
35151     utcFormat = locale2.utcFormat;
35152     utcParse = locale2.utcParse;
35153     return locale2;
35154   }
35155   var locale2, timeFormat, timeParse, utcFormat, utcParse;
35156   var init_defaultLocale2 = __esm({
35157     "node_modules/d3-time-format/src/defaultLocale.js"() {
35158       init_locale2();
35159       defaultLocale2({
35160         dateTime: "%x, %X",
35161         date: "%-m/%-d/%Y",
35162         time: "%-I:%M:%S %p",
35163         periods: ["AM", "PM"],
35164         days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
35165         shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
35166         months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
35167         shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
35168       });
35169     }
35170   });
35171
35172   // node_modules/d3-time-format/src/index.js
35173   var init_src15 = __esm({
35174     "node_modules/d3-time-format/src/index.js"() {
35175       init_defaultLocale2();
35176     }
35177   });
35178
35179   // node_modules/d3-scale/src/index.js
35180   var init_src16 = __esm({
35181     "node_modules/d3-scale/src/index.js"() {
35182       init_linear2();
35183       init_quantize2();
35184     }
35185   });
35186
35187   // modules/behavior/breathe.js
35188   var breathe_exports = {};
35189   __export(breathe_exports, {
35190     behaviorBreathe: () => behaviorBreathe
35191   });
35192   function behaviorBreathe() {
35193     var duration = 800;
35194     var steps = 4;
35195     var selector = ".selected.shadow, .selected .shadow";
35196     var _selected = select_default2(null);
35197     var _classed = "";
35198     var _params = {};
35199     var _done = false;
35200     var _timer;
35201     function ratchetyInterpolator(a2, b2, steps2, units) {
35202       a2 = Number(a2);
35203       b2 = Number(b2);
35204       var sample = quantize().domain([0, 1]).range(quantize_default(number_default(a2, b2), steps2));
35205       return function(t2) {
35206         return String(sample(t2)) + (units || "");
35207       };
35208     }
35209     function reset(selection2) {
35210       selection2.style("stroke-opacity", null).style("stroke-width", null).style("fill-opacity", null).style("r", null);
35211     }
35212     function setAnimationParams(transition2, fromTo) {
35213       var toFrom = fromTo === "from" ? "to" : "from";
35214       transition2.styleTween("stroke-opacity", function(d2) {
35215         return ratchetyInterpolator(
35216           _params[d2.id][toFrom].opacity,
35217           _params[d2.id][fromTo].opacity,
35218           steps
35219         );
35220       }).styleTween("stroke-width", function(d2) {
35221         return ratchetyInterpolator(
35222           _params[d2.id][toFrom].width,
35223           _params[d2.id][fromTo].width,
35224           steps,
35225           "px"
35226         );
35227       }).styleTween("fill-opacity", function(d2) {
35228         return ratchetyInterpolator(
35229           _params[d2.id][toFrom].opacity,
35230           _params[d2.id][fromTo].opacity,
35231           steps
35232         );
35233       }).styleTween("r", function(d2) {
35234         return ratchetyInterpolator(
35235           _params[d2.id][toFrom].width,
35236           _params[d2.id][fromTo].width,
35237           steps,
35238           "px"
35239         );
35240       });
35241     }
35242     function calcAnimationParams(selection2) {
35243       selection2.call(reset).each(function(d2) {
35244         var s2 = select_default2(this);
35245         var tag2 = s2.node().tagName;
35246         var p2 = { "from": {}, "to": {} };
35247         var opacity;
35248         var width;
35249         if (tag2 === "circle") {
35250           opacity = Number(s2.style("fill-opacity") || 0.5);
35251           width = Number(s2.style("r") || 15.5);
35252         } else {
35253           opacity = Number(s2.style("stroke-opacity") || 0.7);
35254           width = Number(s2.style("stroke-width") || 10);
35255         }
35256         p2.tag = tag2;
35257         p2.from.opacity = opacity * 0.6;
35258         p2.to.opacity = opacity * 1.25;
35259         p2.from.width = width * 0.7;
35260         p2.to.width = width * (tag2 === "circle" ? 1.5 : 1);
35261         _params[d2.id] = p2;
35262       });
35263     }
35264     function run(surface, fromTo) {
35265       var toFrom = fromTo === "from" ? "to" : "from";
35266       var currSelected = surface.selectAll(selector);
35267       var currClassed = surface.attr("class");
35268       if (_done || currSelected.empty()) {
35269         _selected.call(reset);
35270         _selected = select_default2(null);
35271         return;
35272       }
35273       if (!(0, import_fast_deep_equal2.default)(currSelected.data(), _selected.data()) || currClassed !== _classed) {
35274         _selected.call(reset);
35275         _classed = currClassed;
35276         _selected = currSelected.call(calcAnimationParams);
35277       }
35278       var didCallNextRun = false;
35279       _selected.transition().duration(duration).call(setAnimationParams, fromTo).on("end", function() {
35280         if (!didCallNextRun) {
35281           surface.call(run, toFrom);
35282           didCallNextRun = true;
35283         }
35284         if (!select_default2(this).classed("selected")) {
35285           reset(select_default2(this));
35286         }
35287       });
35288     }
35289     function behavior(surface) {
35290       _done = false;
35291       _timer = timer(function() {
35292         if (surface.selectAll(selector).empty()) {
35293           return false;
35294         }
35295         surface.call(run, "from");
35296         _timer.stop();
35297         return true;
35298       }, 20);
35299     }
35300     behavior.restartIfNeeded = function(surface) {
35301       if (_selected.empty()) {
35302         surface.call(run, "from");
35303         if (_timer) {
35304           _timer.stop();
35305         }
35306       }
35307     };
35308     behavior.off = function() {
35309       _done = true;
35310       if (_timer) {
35311         _timer.stop();
35312       }
35313       _selected.interrupt().call(reset);
35314     };
35315     return behavior;
35316   }
35317   var import_fast_deep_equal2;
35318   var init_breathe = __esm({
35319     "modules/behavior/breathe.js"() {
35320       "use strict";
35321       import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
35322       init_src8();
35323       init_src5();
35324       init_src16();
35325       init_src9();
35326     }
35327   });
35328
35329   // modules/behavior/operation.js
35330   var operation_exports = {};
35331   __export(operation_exports, {
35332     behaviorOperation: () => behaviorOperation
35333   });
35334   function behaviorOperation(context) {
35335     var _operation;
35336     function keypress(d3_event) {
35337       if (!context.map().withinEditableZoom()) return;
35338       if (_operation.availableForKeypress && !_operation.availableForKeypress()) return;
35339       d3_event.preventDefault();
35340       var disabled = _operation.disabled();
35341       if (disabled) {
35342         context.ui().flash.duration(4e3).iconName("#iD-operation-" + _operation.id).iconClass("operation disabled").label(_operation.tooltip())();
35343       } else {
35344         context.ui().flash.duration(2e3).iconName("#iD-operation-" + _operation.id).iconClass("operation").label(_operation.annotation() || _operation.title)();
35345         if (_operation.point) _operation.point(null);
35346         _operation(d3_event);
35347       }
35348     }
35349     function behavior() {
35350       if (_operation && _operation.available()) {
35351         context.keybinding().on(_operation.keys, keypress);
35352       }
35353       return behavior;
35354     }
35355     behavior.off = function() {
35356       context.keybinding().off(_operation.keys);
35357     };
35358     behavior.which = function(_2) {
35359       if (!arguments.length) return _operation;
35360       _operation = _2;
35361       return behavior;
35362     };
35363     return behavior;
35364   }
35365   var init_operation = __esm({
35366     "modules/behavior/operation.js"() {
35367       "use strict";
35368     }
35369   });
35370
35371   // modules/operations/circularize.js
35372   var circularize_exports2 = {};
35373   __export(circularize_exports2, {
35374     operationCircularize: () => operationCircularize
35375   });
35376   function operationCircularize(context, selectedIDs) {
35377     var _extent;
35378     var _actions = selectedIDs.map(getAction).filter(Boolean);
35379     var _amount = _actions.length === 1 ? "single" : "multiple";
35380     var _coords = utilGetAllNodes(selectedIDs, context.graph()).map(function(n3) {
35381       return n3.loc;
35382     });
35383     function getAction(entityID) {
35384       var entity = context.entity(entityID);
35385       if (entity.type !== "way" || new Set(entity.nodes).size <= 1) return null;
35386       if (!_extent) {
35387         _extent = entity.extent(context.graph());
35388       } else {
35389         _extent = _extent.extend(entity.extent(context.graph()));
35390       }
35391       return actionCircularize(entityID, context.projection);
35392     }
35393     var operation2 = function() {
35394       if (!_actions.length) return;
35395       var combinedAction = function(graph, t2) {
35396         _actions.forEach(function(action) {
35397           if (!action.disabled(graph)) {
35398             graph = action(graph, t2);
35399           }
35400         });
35401         return graph;
35402       };
35403       combinedAction.transitionable = true;
35404       context.perform(combinedAction, operation2.annotation());
35405       window.setTimeout(function() {
35406         context.validator().validate();
35407       }, 300);
35408     };
35409     operation2.available = function() {
35410       return _actions.length && selectedIDs.length === _actions.length;
35411     };
35412     operation2.disabled = function() {
35413       if (!_actions.length) return "";
35414       var actionDisableds = _actions.map(function(action) {
35415         return action.disabled(context.graph());
35416       }).filter(Boolean);
35417       if (actionDisableds.length === _actions.length) {
35418         if (new Set(actionDisableds).size > 1) {
35419           return "multiple_blockers";
35420         }
35421         return actionDisableds[0];
35422       } else if (_extent.percentContainedIn(context.map().extent()) < 0.8) {
35423         return "too_large";
35424       } else if (someMissing()) {
35425         return "not_downloaded";
35426       } else if (selectedIDs.some(context.hasHiddenConnections)) {
35427         return "connected_to_hidden";
35428       }
35429       return false;
35430       function someMissing() {
35431         if (context.inIntro()) return false;
35432         var osm = context.connection();
35433         if (osm) {
35434           var missing = _coords.filter(function(loc) {
35435             return !osm.isDataLoaded(loc);
35436           });
35437           if (missing.length) {
35438             missing.forEach(function(loc) {
35439               context.loadTileAtLoc(loc);
35440             });
35441             return true;
35442           }
35443         }
35444         return false;
35445       }
35446     };
35447     operation2.tooltip = function() {
35448       var disable = operation2.disabled();
35449       return disable ? _t.append("operations.circularize." + disable + "." + _amount) : _t.append("operations.circularize.description." + _amount);
35450     };
35451     operation2.annotation = function() {
35452       return _t("operations.circularize.annotation.feature", { n: _actions.length });
35453     };
35454     operation2.id = "circularize";
35455     operation2.keys = [_t("operations.circularize.key")];
35456     operation2.title = _t.append("operations.circularize.title");
35457     operation2.behavior = behaviorOperation(context).which(operation2);
35458     return operation2;
35459   }
35460   var init_circularize2 = __esm({
35461     "modules/operations/circularize.js"() {
35462       "use strict";
35463       init_localizer();
35464       init_circularize();
35465       init_operation();
35466       init_util();
35467     }
35468   });
35469
35470   // modules/ui/cmd.js
35471   var cmd_exports = {};
35472   __export(cmd_exports, {
35473     uiCmd: () => uiCmd
35474   });
35475   var uiCmd;
35476   var init_cmd = __esm({
35477     "modules/ui/cmd.js"() {
35478       "use strict";
35479       init_localizer();
35480       init_detect();
35481       uiCmd = function(code) {
35482         var detected = utilDetect();
35483         if (detected.os === "mac") {
35484           return code;
35485         }
35486         if (detected.os === "win") {
35487           if (code === "\u2318\u21E7Z") return "Ctrl+Y";
35488         }
35489         var result = "", replacements = {
35490           "\u2318": "Ctrl",
35491           "\u21E7": "Shift",
35492           "\u2325": "Alt",
35493           "\u232B": "Backspace",
35494           "\u2326": "Delete"
35495         };
35496         for (var i3 = 0; i3 < code.length; i3++) {
35497           if (code[i3] in replacements) {
35498             result += replacements[code[i3]] + (i3 < code.length - 1 ? "+" : "");
35499           } else {
35500             result += code[i3];
35501           }
35502         }
35503         return result;
35504       };
35505       uiCmd.display = function(code) {
35506         if (code.length !== 1) return code;
35507         var detected = utilDetect();
35508         var mac = detected.os === "mac";
35509         var replacements = {
35510           "\u2318": mac ? "\u2318 " + _t("shortcuts.key.cmd") : _t("shortcuts.key.ctrl"),
35511           "\u21E7": mac ? "\u21E7 " + _t("shortcuts.key.shift") : _t("shortcuts.key.shift"),
35512           "\u2325": mac ? "\u2325 " + _t("shortcuts.key.option") : _t("shortcuts.key.alt"),
35513           "\u2303": mac ? "\u2303 " + _t("shortcuts.key.ctrl") : _t("shortcuts.key.ctrl"),
35514           "\u232B": mac ? "\u232B " + _t("shortcuts.key.delete") : _t("shortcuts.key.backspace"),
35515           "\u2326": mac ? "\u2326 " + _t("shortcuts.key.del") : _t("shortcuts.key.del"),
35516           "\u2196": mac ? "\u2196 " + _t("shortcuts.key.pgup") : _t("shortcuts.key.pgup"),
35517           "\u2198": mac ? "\u2198 " + _t("shortcuts.key.pgdn") : _t("shortcuts.key.pgdn"),
35518           "\u21DE": mac ? "\u21DE " + _t("shortcuts.key.home") : _t("shortcuts.key.home"),
35519           "\u21DF": mac ? "\u21DF " + _t("shortcuts.key.end") : _t("shortcuts.key.end"),
35520           "\u21B5": mac ? "\u23CE " + _t("shortcuts.key.return") : _t("shortcuts.key.enter"),
35521           "\u238B": mac ? "\u238B " + _t("shortcuts.key.esc") : _t("shortcuts.key.esc"),
35522           "\u2630": mac ? "\u2630 " + _t("shortcuts.key.menu") : _t("shortcuts.key.menu")
35523         };
35524         return replacements[code] || code;
35525       };
35526     }
35527   });
35528
35529   // modules/operations/delete.js
35530   var delete_exports = {};
35531   __export(delete_exports, {
35532     operationDelete: () => operationDelete
35533   });
35534   function operationDelete(context, selectedIDs) {
35535     var multi = selectedIDs.length === 1 ? "single" : "multiple";
35536     var action = actionDeleteMultiple(selectedIDs);
35537     var nodes = utilGetAllNodes(selectedIDs, context.graph());
35538     var coords = nodes.map(function(n3) {
35539       return n3.loc;
35540     });
35541     var extent = utilTotalExtent(selectedIDs, context.graph());
35542     var operation2 = function() {
35543       var nextSelectedID;
35544       var nextSelectedLoc;
35545       if (selectedIDs.length === 1) {
35546         var id2 = selectedIDs[0];
35547         var entity = context.entity(id2);
35548         var geometry = entity.geometry(context.graph());
35549         var parents = context.graph().parentWays(entity);
35550         var parent = parents[0];
35551         if (geometry === "vertex") {
35552           var nodes2 = parent.nodes;
35553           var i3 = nodes2.indexOf(id2);
35554           if (i3 === 0) {
35555             i3++;
35556           } else if (i3 === nodes2.length - 1) {
35557             i3--;
35558           } else {
35559             var a2 = geoSphericalDistance(entity.loc, context.entity(nodes2[i3 - 1]).loc);
35560             var b2 = geoSphericalDistance(entity.loc, context.entity(nodes2[i3 + 1]).loc);
35561             i3 = a2 < b2 ? i3 - 1 : i3 + 1;
35562           }
35563           nextSelectedID = nodes2[i3];
35564           nextSelectedLoc = context.entity(nextSelectedID).loc;
35565         }
35566       }
35567       context.perform(action, operation2.annotation());
35568       context.validator().validate();
35569       if (nextSelectedID && nextSelectedLoc) {
35570         if (context.hasEntity(nextSelectedID)) {
35571           context.enter(modeSelect(context, [nextSelectedID]).follow(true));
35572         } else {
35573           context.map().centerEase(nextSelectedLoc);
35574           context.enter(modeBrowse(context));
35575         }
35576       } else {
35577         context.enter(modeBrowse(context));
35578       }
35579     };
35580     operation2.available = function() {
35581       return true;
35582     };
35583     operation2.disabled = function() {
35584       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
35585         return "too_large";
35586       } else if (someMissing()) {
35587         return "not_downloaded";
35588       } else if (selectedIDs.some(context.hasHiddenConnections)) {
35589         return "connected_to_hidden";
35590       } else if (selectedIDs.some(protectedMember)) {
35591         return "part_of_relation";
35592       } else if (selectedIDs.some(incompleteRelation)) {
35593         return "incomplete_relation";
35594       } else if (selectedIDs.some(hasWikidataTag)) {
35595         return "has_wikidata_tag";
35596       }
35597       return false;
35598       function someMissing() {
35599         if (context.inIntro()) return false;
35600         var osm = context.connection();
35601         if (osm) {
35602           var missing = coords.filter(function(loc) {
35603             return !osm.isDataLoaded(loc);
35604           });
35605           if (missing.length) {
35606             missing.forEach(function(loc) {
35607               context.loadTileAtLoc(loc);
35608             });
35609             return true;
35610           }
35611         }
35612         return false;
35613       }
35614       function hasWikidataTag(id2) {
35615         var entity = context.entity(id2);
35616         return entity.tags.wikidata && entity.tags.wikidata.trim().length > 0;
35617       }
35618       function incompleteRelation(id2) {
35619         var entity = context.entity(id2);
35620         return entity.type === "relation" && !entity.isComplete(context.graph());
35621       }
35622       function protectedMember(id2) {
35623         var entity = context.entity(id2);
35624         if (entity.type !== "way") return false;
35625         var parents = context.graph().parentRelations(entity);
35626         for (var i3 = 0; i3 < parents.length; i3++) {
35627           var parent = parents[i3];
35628           var type2 = parent.tags.type;
35629           var role = parent.memberById(id2).role || "outer";
35630           if (type2 === "route" || type2 === "boundary" || type2 === "multipolygon" && role === "outer") {
35631             return true;
35632           }
35633         }
35634         return false;
35635       }
35636     };
35637     operation2.tooltip = function() {
35638       var disable = operation2.disabled();
35639       return disable ? _t.append("operations.delete." + disable + "." + multi) : _t.append("operations.delete.description." + multi);
35640     };
35641     operation2.annotation = function() {
35642       return selectedIDs.length === 1 ? _t("operations.delete.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.delete.annotation.feature", { n: selectedIDs.length });
35643     };
35644     operation2.id = "delete";
35645     operation2.keys = [uiCmd("\u2318\u232B"), uiCmd("\u2318\u2326"), uiCmd("\u2326")];
35646     operation2.title = _t.append("operations.delete.title");
35647     operation2.behavior = behaviorOperation(context).which(operation2);
35648     return operation2;
35649   }
35650   var init_delete = __esm({
35651     "modules/operations/delete.js"() {
35652       "use strict";
35653       init_localizer();
35654       init_delete_multiple();
35655       init_operation();
35656       init_geo2();
35657       init_browse();
35658       init_select5();
35659       init_cmd();
35660       init_util();
35661     }
35662   });
35663
35664   // modules/operations/orthogonalize.js
35665   var orthogonalize_exports2 = {};
35666   __export(orthogonalize_exports2, {
35667     operationOrthogonalize: () => operationOrthogonalize
35668   });
35669   function operationOrthogonalize(context, selectedIDs) {
35670     var _extent;
35671     var _type;
35672     var _actions = selectedIDs.map(chooseAction).filter(Boolean);
35673     var _amount = _actions.length === 1 ? "single" : "multiple";
35674     var _coords = utilGetAllNodes(selectedIDs, context.graph()).map(function(n3) {
35675       return n3.loc;
35676     });
35677     function chooseAction(entityID) {
35678       var entity = context.entity(entityID);
35679       var geometry = entity.geometry(context.graph());
35680       if (!_extent) {
35681         _extent = entity.extent(context.graph());
35682       } else {
35683         _extent = _extent.extend(entity.extent(context.graph()));
35684       }
35685       if (entity.type === "way" && new Set(entity.nodes).size > 2) {
35686         if (_type && _type !== "feature") return null;
35687         _type = "feature";
35688         return actionOrthogonalize(entityID, context.projection);
35689       } else if (geometry === "vertex") {
35690         if (_type && _type !== "corner") return null;
35691         _type = "corner";
35692         var graph = context.graph();
35693         var parents = graph.parentWays(entity);
35694         if (parents.length === 1) {
35695           var way = parents[0];
35696           if (way.nodes.indexOf(entityID) !== -1) {
35697             return actionOrthogonalize(way.id, context.projection, entityID);
35698           }
35699         }
35700       }
35701       return null;
35702     }
35703     var operation2 = function() {
35704       if (!_actions.length) return;
35705       var combinedAction = function(graph, t2) {
35706         _actions.forEach(function(action) {
35707           if (!action.disabled(graph)) {
35708             graph = action(graph, t2);
35709           }
35710         });
35711         return graph;
35712       };
35713       combinedAction.transitionable = true;
35714       context.perform(combinedAction, operation2.annotation());
35715       window.setTimeout(function() {
35716         context.validator().validate();
35717       }, 300);
35718     };
35719     operation2.available = function() {
35720       return _actions.length && selectedIDs.length === _actions.length;
35721     };
35722     operation2.disabled = function() {
35723       if (!_actions.length) return "";
35724       var actionDisableds = _actions.map(function(action) {
35725         return action.disabled(context.graph());
35726       }).filter(Boolean);
35727       if (actionDisableds.length === _actions.length) {
35728         if (new Set(actionDisableds).size > 1) {
35729           return "multiple_blockers";
35730         }
35731         return actionDisableds[0];
35732       } else if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
35733         return "too_large";
35734       } else if (someMissing()) {
35735         return "not_downloaded";
35736       } else if (selectedIDs.some(context.hasHiddenConnections)) {
35737         return "connected_to_hidden";
35738       }
35739       return false;
35740       function someMissing() {
35741         if (context.inIntro()) return false;
35742         var osm = context.connection();
35743         if (osm) {
35744           var missing = _coords.filter(function(loc) {
35745             return !osm.isDataLoaded(loc);
35746           });
35747           if (missing.length) {
35748             missing.forEach(function(loc) {
35749               context.loadTileAtLoc(loc);
35750             });
35751             return true;
35752           }
35753         }
35754         return false;
35755       }
35756     };
35757     operation2.tooltip = function() {
35758       var disable = operation2.disabled();
35759       return disable ? _t.append("operations.orthogonalize." + disable + "." + _amount) : _t.append("operations.orthogonalize.description." + _type + "." + _amount);
35760     };
35761     operation2.annotation = function() {
35762       return _t("operations.orthogonalize.annotation." + _type, { n: _actions.length });
35763     };
35764     operation2.id = "orthogonalize";
35765     operation2.keys = [_t("operations.orthogonalize.key")];
35766     operation2.title = _t.append("operations.orthogonalize.title");
35767     operation2.behavior = behaviorOperation(context).which(operation2);
35768     return operation2;
35769   }
35770   var init_orthogonalize2 = __esm({
35771     "modules/operations/orthogonalize.js"() {
35772       "use strict";
35773       init_localizer();
35774       init_orthogonalize();
35775       init_operation();
35776       init_util();
35777     }
35778   });
35779
35780   // modules/operations/reflect.js
35781   var reflect_exports2 = {};
35782   __export(reflect_exports2, {
35783     operationReflect: () => operationReflect,
35784     operationReflectLong: () => operationReflectLong,
35785     operationReflectShort: () => operationReflectShort
35786   });
35787   function operationReflectShort(context, selectedIDs) {
35788     return operationReflect(context, selectedIDs, "short");
35789   }
35790   function operationReflectLong(context, selectedIDs) {
35791     return operationReflect(context, selectedIDs, "long");
35792   }
35793   function operationReflect(context, selectedIDs, axis) {
35794     axis = axis || "long";
35795     var multi = selectedIDs.length === 1 ? "single" : "multiple";
35796     var nodes = utilGetAllNodes(selectedIDs, context.graph());
35797     var coords = nodes.map(function(n3) {
35798       return n3.loc;
35799     });
35800     var extent = utilTotalExtent(selectedIDs, context.graph());
35801     var operation2 = function() {
35802       var action = actionReflect(selectedIDs, context.projection).useLongAxis(Boolean(axis === "long"));
35803       context.perform(action, operation2.annotation());
35804       window.setTimeout(function() {
35805         context.validator().validate();
35806       }, 300);
35807     };
35808     operation2.available = function() {
35809       return nodes.length >= 3;
35810     };
35811     operation2.disabled = function() {
35812       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
35813         return "too_large";
35814       } else if (someMissing()) {
35815         return "not_downloaded";
35816       } else if (selectedIDs.some(context.hasHiddenConnections)) {
35817         return "connected_to_hidden";
35818       } else if (selectedIDs.some(incompleteRelation)) {
35819         return "incomplete_relation";
35820       }
35821       return false;
35822       function someMissing() {
35823         if (context.inIntro()) return false;
35824         var osm = context.connection();
35825         if (osm) {
35826           var missing = coords.filter(function(loc) {
35827             return !osm.isDataLoaded(loc);
35828           });
35829           if (missing.length) {
35830             missing.forEach(function(loc) {
35831               context.loadTileAtLoc(loc);
35832             });
35833             return true;
35834           }
35835         }
35836         return false;
35837       }
35838       function incompleteRelation(id2) {
35839         var entity = context.entity(id2);
35840         return entity.type === "relation" && !entity.isComplete(context.graph());
35841       }
35842     };
35843     operation2.tooltip = function() {
35844       var disable = operation2.disabled();
35845       return disable ? _t.append("operations.reflect." + disable + "." + multi) : _t.append("operations.reflect.description." + axis + "." + multi);
35846     };
35847     operation2.annotation = function() {
35848       return _t("operations.reflect.annotation." + axis + ".feature", { n: selectedIDs.length });
35849     };
35850     operation2.id = "reflect-" + axis;
35851     operation2.keys = [_t("operations.reflect.key." + axis)];
35852     operation2.title = _t.append("operations.reflect.title." + axis);
35853     operation2.behavior = behaviorOperation(context).which(operation2);
35854     return operation2;
35855   }
35856   var init_reflect2 = __esm({
35857     "modules/operations/reflect.js"() {
35858       "use strict";
35859       init_localizer();
35860       init_reflect();
35861       init_operation();
35862       init_util2();
35863     }
35864   });
35865
35866   // modules/operations/move.js
35867   var move_exports2 = {};
35868   __export(move_exports2, {
35869     operationMove: () => operationMove
35870   });
35871   function operationMove(context, selectedIDs) {
35872     var multi = selectedIDs.length === 1 ? "single" : "multiple";
35873     var nodes = utilGetAllNodes(selectedIDs, context.graph());
35874     var coords = nodes.map(function(n3) {
35875       return n3.loc;
35876     });
35877     var extent = utilTotalExtent(selectedIDs, context.graph());
35878     var operation2 = function() {
35879       context.enter(modeMove(context, selectedIDs));
35880     };
35881     operation2.available = function() {
35882       return selectedIDs.length > 0;
35883     };
35884     operation2.disabled = function() {
35885       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
35886         return "too_large";
35887       } else if (someMissing()) {
35888         return "not_downloaded";
35889       } else if (selectedIDs.some(context.hasHiddenConnections)) {
35890         return "connected_to_hidden";
35891       } else if (selectedIDs.some(incompleteRelation)) {
35892         return "incomplete_relation";
35893       }
35894       return false;
35895       function someMissing() {
35896         if (context.inIntro()) return false;
35897         var osm = context.connection();
35898         if (osm) {
35899           var missing = coords.filter(function(loc) {
35900             return !osm.isDataLoaded(loc);
35901           });
35902           if (missing.length) {
35903             missing.forEach(function(loc) {
35904               context.loadTileAtLoc(loc);
35905             });
35906             return true;
35907           }
35908         }
35909         return false;
35910       }
35911       function incompleteRelation(id2) {
35912         var entity = context.entity(id2);
35913         return entity.type === "relation" && !entity.isComplete(context.graph());
35914       }
35915     };
35916     operation2.tooltip = function() {
35917       var disable = operation2.disabled();
35918       return disable ? _t.append("operations.move." + disable + "." + multi) : _t.append("operations.move.description." + multi);
35919     };
35920     operation2.annotation = function() {
35921       return selectedIDs.length === 1 ? _t("operations.move.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.move.annotation.feature", { n: selectedIDs.length });
35922     };
35923     operation2.id = "move";
35924     operation2.keys = [_t("operations.move.key")];
35925     operation2.title = _t.append("operations.move.title");
35926     operation2.behavior = behaviorOperation(context).which(operation2);
35927     operation2.mouseOnly = true;
35928     return operation2;
35929   }
35930   var init_move2 = __esm({
35931     "modules/operations/move.js"() {
35932       "use strict";
35933       init_localizer();
35934       init_operation();
35935       init_move3();
35936       init_util2();
35937     }
35938   });
35939
35940   // modules/modes/rotate.js
35941   var rotate_exports2 = {};
35942   __export(rotate_exports2, {
35943     modeRotate: () => modeRotate
35944   });
35945   function modeRotate(context, entityIDs) {
35946     var _tolerancePx = 4;
35947     var mode = {
35948       id: "rotate",
35949       button: "browse"
35950     };
35951     var keybinding = utilKeybinding("rotate");
35952     var behaviors = [
35953       behaviorEdit(context),
35954       operationCircularize(context, entityIDs).behavior,
35955       operationDelete(context, entityIDs).behavior,
35956       operationMove(context, entityIDs).behavior,
35957       operationOrthogonalize(context, entityIDs).behavior,
35958       operationReflectLong(context, entityIDs).behavior,
35959       operationReflectShort(context, entityIDs).behavior
35960     ];
35961     var annotation = entityIDs.length === 1 ? _t("operations.rotate.annotation." + context.graph().geometry(entityIDs[0])) : _t("operations.rotate.annotation.feature", { n: entityIDs.length });
35962     var _prevGraph;
35963     var _prevAngle;
35964     var _prevTransform;
35965     var _pivot;
35966     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
35967     function doRotate(d3_event) {
35968       var fn;
35969       if (context.graph() !== _prevGraph) {
35970         fn = context.perform;
35971       } else {
35972         fn = context.replace;
35973       }
35974       var projection2 = context.projection;
35975       var currTransform = projection2.transform();
35976       if (!_prevTransform || currTransform.k !== _prevTransform.k || currTransform.x !== _prevTransform.x || currTransform.y !== _prevTransform.y) {
35977         var nodes = utilGetAllNodes(entityIDs, context.graph());
35978         var points = nodes.map(function(n3) {
35979           return projection2(n3.loc);
35980         });
35981         _pivot = getPivot(points);
35982         _prevAngle = void 0;
35983       }
35984       var currMouse = context.map().mouse(d3_event);
35985       var currAngle = Math.atan2(currMouse[1] - _pivot[1], currMouse[0] - _pivot[0]);
35986       if (typeof _prevAngle === "undefined") _prevAngle = currAngle;
35987       var delta = currAngle - _prevAngle;
35988       fn(actionRotate(entityIDs, _pivot, delta, projection2));
35989       _prevTransform = currTransform;
35990       _prevAngle = currAngle;
35991       _prevGraph = context.graph();
35992     }
35993     function getPivot(points) {
35994       var _pivot2;
35995       if (points.length === 1) {
35996         _pivot2 = points[0];
35997       } else if (points.length === 2) {
35998         _pivot2 = geoVecInterp(points[0], points[1], 0.5);
35999       } else {
36000         var polygonHull = hull_default(points);
36001         if (polygonHull.length === 2) {
36002           _pivot2 = geoVecInterp(points[0], points[1], 0.5);
36003         } else {
36004           _pivot2 = centroid_default2(hull_default(points));
36005         }
36006       }
36007       return _pivot2;
36008     }
36009     function finish(d3_event) {
36010       d3_event.stopPropagation();
36011       context.replace(actionNoop(), annotation);
36012       context.enter(modeSelect(context, entityIDs));
36013     }
36014     function cancel() {
36015       if (_prevGraph) context.pop();
36016       context.enter(modeSelect(context, entityIDs));
36017     }
36018     function undone() {
36019       context.enter(modeBrowse(context));
36020     }
36021     mode.enter = function() {
36022       _prevGraph = null;
36023       context.features().forceVisible(entityIDs);
36024       behaviors.forEach(context.install);
36025       var downEvent;
36026       context.surface().on(_pointerPrefix + "down.modeRotate", function(d3_event) {
36027         downEvent = d3_event;
36028       });
36029       select_default2(window).on(_pointerPrefix + "move.modeRotate", doRotate, true).on(_pointerPrefix + "up.modeRotate", function(d3_event) {
36030         if (!downEvent) return;
36031         var mapNode = context.container().select(".main-map").node();
36032         var pointGetter = utilFastMouse(mapNode);
36033         var p1 = pointGetter(downEvent);
36034         var p2 = pointGetter(d3_event);
36035         var dist = geoVecLength(p1, p2);
36036         if (dist <= _tolerancePx) finish(d3_event);
36037         downEvent = null;
36038       }, true);
36039       context.history().on("undone.modeRotate", undone);
36040       keybinding.on("\u238B", cancel).on("\u21A9", finish);
36041       select_default2(document).call(keybinding);
36042     };
36043     mode.exit = function() {
36044       behaviors.forEach(context.uninstall);
36045       context.surface().on(_pointerPrefix + "down.modeRotate", null);
36046       select_default2(window).on(_pointerPrefix + "move.modeRotate", null, true).on(_pointerPrefix + "up.modeRotate", null, true);
36047       context.history().on("undone.modeRotate", null);
36048       select_default2(document).call(keybinding.unbind);
36049       context.features().forceVisible([]);
36050     };
36051     mode.selectedIDs = function() {
36052       if (!arguments.length) return entityIDs;
36053       return mode;
36054     };
36055     return mode;
36056   }
36057   var init_rotate2 = __esm({
36058     "modules/modes/rotate.js"() {
36059       "use strict";
36060       init_src5();
36061       init_src3();
36062       init_localizer();
36063       init_rotate();
36064       init_noop2();
36065       init_edit();
36066       init_vector();
36067       init_browse();
36068       init_select5();
36069       init_circularize2();
36070       init_delete();
36071       init_move2();
36072       init_orthogonalize2();
36073       init_reflect2();
36074       init_keybinding();
36075       init_util2();
36076     }
36077   });
36078
36079   // modules/operations/rotate.js
36080   var rotate_exports3 = {};
36081   __export(rotate_exports3, {
36082     operationRotate: () => operationRotate
36083   });
36084   function operationRotate(context, selectedIDs) {
36085     var multi = selectedIDs.length === 1 ? "single" : "multiple";
36086     var nodes = utilGetAllNodes(selectedIDs, context.graph());
36087     var coords = nodes.map(function(n3) {
36088       return n3.loc;
36089     });
36090     var extent = utilTotalExtent(selectedIDs, context.graph());
36091     var operation2 = function() {
36092       context.enter(modeRotate(context, selectedIDs));
36093     };
36094     operation2.available = function() {
36095       return nodes.length >= 2;
36096     };
36097     operation2.disabled = function() {
36098       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
36099         return "too_large";
36100       } else if (someMissing()) {
36101         return "not_downloaded";
36102       } else if (selectedIDs.some(context.hasHiddenConnections)) {
36103         return "connected_to_hidden";
36104       } else if (selectedIDs.some(incompleteRelation)) {
36105         return "incomplete_relation";
36106       }
36107       return false;
36108       function someMissing() {
36109         if (context.inIntro()) return false;
36110         var osm = context.connection();
36111         if (osm) {
36112           var missing = coords.filter(function(loc) {
36113             return !osm.isDataLoaded(loc);
36114           });
36115           if (missing.length) {
36116             missing.forEach(function(loc) {
36117               context.loadTileAtLoc(loc);
36118             });
36119             return true;
36120           }
36121         }
36122         return false;
36123       }
36124       function incompleteRelation(id2) {
36125         var entity = context.entity(id2);
36126         return entity.type === "relation" && !entity.isComplete(context.graph());
36127       }
36128     };
36129     operation2.tooltip = function() {
36130       var disable = operation2.disabled();
36131       return disable ? _t.append("operations.rotate." + disable + "." + multi) : _t.append("operations.rotate.description." + multi);
36132     };
36133     operation2.annotation = function() {
36134       return selectedIDs.length === 1 ? _t("operations.rotate.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.rotate.annotation.feature", { n: selectedIDs.length });
36135     };
36136     operation2.id = "rotate";
36137     operation2.keys = [_t("operations.rotate.key")];
36138     operation2.title = _t.append("operations.rotate.title");
36139     operation2.behavior = behaviorOperation(context).which(operation2);
36140     operation2.mouseOnly = true;
36141     return operation2;
36142   }
36143   var init_rotate3 = __esm({
36144     "modules/operations/rotate.js"() {
36145       "use strict";
36146       init_localizer();
36147       init_operation();
36148       init_rotate2();
36149       init_util2();
36150     }
36151   });
36152
36153   // modules/modes/move.js
36154   var move_exports3 = {};
36155   __export(move_exports3, {
36156     modeMove: () => modeMove
36157   });
36158   function modeMove(context, entityIDs, baseGraph) {
36159     var _tolerancePx = 4;
36160     var mode = {
36161       id: "move",
36162       button: "browse"
36163     };
36164     var keybinding = utilKeybinding("move");
36165     var behaviors = [
36166       behaviorEdit(context),
36167       operationCircularize(context, entityIDs).behavior,
36168       operationDelete(context, entityIDs).behavior,
36169       operationOrthogonalize(context, entityIDs).behavior,
36170       operationReflectLong(context, entityIDs).behavior,
36171       operationReflectShort(context, entityIDs).behavior,
36172       operationRotate(context, entityIDs).behavior
36173     ];
36174     var annotation = entityIDs.length === 1 ? _t("operations.move.annotation." + context.graph().geometry(entityIDs[0])) : _t("operations.move.annotation.feature", { n: entityIDs.length });
36175     var _prevGraph;
36176     var _cache5;
36177     var _origin;
36178     var _nudgeInterval;
36179     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
36180     function doMove(nudge) {
36181       nudge = nudge || [0, 0];
36182       var fn;
36183       if (_prevGraph !== context.graph()) {
36184         _cache5 = {};
36185         _origin = context.map().mouseCoordinates();
36186         fn = context.perform;
36187       } else {
36188         fn = context.overwrite;
36189       }
36190       var currMouse = context.map().mouse();
36191       var origMouse = context.projection(_origin);
36192       var delta = geoVecSubtract(geoVecSubtract(currMouse, origMouse), nudge);
36193       fn(actionMove(entityIDs, delta, context.projection, _cache5));
36194       _prevGraph = context.graph();
36195     }
36196     function startNudge(nudge) {
36197       if (_nudgeInterval) window.clearInterval(_nudgeInterval);
36198       _nudgeInterval = window.setInterval(function() {
36199         context.map().pan(nudge);
36200         doMove(nudge);
36201       }, 50);
36202     }
36203     function stopNudge() {
36204       if (_nudgeInterval) {
36205         window.clearInterval(_nudgeInterval);
36206         _nudgeInterval = null;
36207       }
36208     }
36209     function move() {
36210       doMove();
36211       var nudge = geoViewportEdge(context.map().mouse(), context.map().dimensions());
36212       if (nudge) {
36213         startNudge(nudge);
36214       } else {
36215         stopNudge();
36216       }
36217     }
36218     function finish(d3_event) {
36219       d3_event.stopPropagation();
36220       context.replace(actionNoop(), annotation);
36221       context.enter(modeSelect(context, entityIDs));
36222       stopNudge();
36223     }
36224     function cancel() {
36225       if (baseGraph) {
36226         while (context.graph() !== baseGraph) context.pop();
36227         context.enter(modeBrowse(context));
36228       } else {
36229         if (_prevGraph) context.pop();
36230         context.enter(modeSelect(context, entityIDs));
36231       }
36232       stopNudge();
36233     }
36234     function undone() {
36235       context.enter(modeBrowse(context));
36236     }
36237     mode.enter = function() {
36238       _origin = context.map().mouseCoordinates();
36239       _prevGraph = null;
36240       _cache5 = {};
36241       context.features().forceVisible(entityIDs);
36242       behaviors.forEach(context.install);
36243       var downEvent;
36244       context.surface().on(_pointerPrefix + "down.modeMove", function(d3_event) {
36245         downEvent = d3_event;
36246       });
36247       select_default2(window).on(_pointerPrefix + "move.modeMove", move, true).on(_pointerPrefix + "up.modeMove", function(d3_event) {
36248         if (!downEvent) return;
36249         var mapNode = context.container().select(".main-map").node();
36250         var pointGetter = utilFastMouse(mapNode);
36251         var p1 = pointGetter(downEvent);
36252         var p2 = pointGetter(d3_event);
36253         var dist = geoVecLength(p1, p2);
36254         if (dist <= _tolerancePx) finish(d3_event);
36255         downEvent = null;
36256       }, true);
36257       context.history().on("undone.modeMove", undone);
36258       keybinding.on("\u238B", cancel).on("\u21A9", finish);
36259       select_default2(document).call(keybinding);
36260     };
36261     mode.exit = function() {
36262       stopNudge();
36263       behaviors.forEach(function(behavior) {
36264         context.uninstall(behavior);
36265       });
36266       context.surface().on(_pointerPrefix + "down.modeMove", null);
36267       select_default2(window).on(_pointerPrefix + "move.modeMove", null, true).on(_pointerPrefix + "up.modeMove", null, true);
36268       context.history().on("undone.modeMove", null);
36269       select_default2(document).call(keybinding.unbind);
36270       context.features().forceVisible([]);
36271     };
36272     mode.selectedIDs = function() {
36273       if (!arguments.length) return entityIDs;
36274       return mode;
36275     };
36276     return mode;
36277   }
36278   var init_move3 = __esm({
36279     "modules/modes/move.js"() {
36280       "use strict";
36281       init_src5();
36282       init_localizer();
36283       init_move();
36284       init_noop2();
36285       init_edit();
36286       init_vector();
36287       init_geom();
36288       init_browse();
36289       init_select5();
36290       init_util();
36291       init_util2();
36292       init_circularize2();
36293       init_delete();
36294       init_orthogonalize2();
36295       init_reflect2();
36296       init_rotate3();
36297     }
36298   });
36299
36300   // modules/behavior/paste.js
36301   var paste_exports = {};
36302   __export(paste_exports, {
36303     behaviorPaste: () => behaviorPaste
36304   });
36305   function behaviorPaste(context) {
36306     function doPaste(d3_event) {
36307       if (!context.map().withinEditableZoom()) return;
36308       const isOsmLayerEnabled = context.layers().layer("osm").enabled();
36309       if (!isOsmLayerEnabled) return;
36310       d3_event.preventDefault();
36311       var baseGraph = context.graph();
36312       var mouse = context.map().mouse();
36313       var projection2 = context.projection;
36314       var viewport = geoExtent(projection2.clipExtent()).polygon();
36315       if (!geoPointInPolygon(mouse, viewport)) return;
36316       var oldIDs = context.copyIDs();
36317       if (!oldIDs.length) return;
36318       var extent = geoExtent();
36319       var oldGraph = context.copyGraph();
36320       var newIDs = [];
36321       var action = actionCopyEntities(oldIDs, oldGraph);
36322       context.perform(action);
36323       var copies = action.copies();
36324       var originals = /* @__PURE__ */ new Set();
36325       Object.values(copies).forEach(function(entity) {
36326         originals.add(entity.id);
36327       });
36328       for (var id2 in copies) {
36329         var oldEntity = oldGraph.entity(id2);
36330         var newEntity = copies[id2];
36331         extent._extend(oldEntity.extent(oldGraph));
36332         var parents = context.graph().parentWays(newEntity);
36333         var parentCopied = parents.some(function(parent) {
36334           return originals.has(parent.id);
36335         });
36336         if (!parentCopied) {
36337           newIDs.push(newEntity.id);
36338         }
36339       }
36340       var copyPoint = context.copyLonLat() && projection2(context.copyLonLat()) || projection2(extent.center());
36341       var delta = geoVecSubtract(mouse, copyPoint);
36342       context.perform(actionMove(newIDs, delta, projection2));
36343       context.enter(modeMove(context, newIDs, baseGraph));
36344     }
36345     function behavior() {
36346       context.keybinding().on(uiCmd("\u2318V"), doPaste);
36347       return behavior;
36348     }
36349     behavior.off = function() {
36350       context.keybinding().off(uiCmd("\u2318V"));
36351     };
36352     return behavior;
36353   }
36354   var init_paste = __esm({
36355     "modules/behavior/paste.js"() {
36356       "use strict";
36357       init_copy_entities();
36358       init_move();
36359       init_geo2();
36360       init_move3();
36361       init_cmd();
36362     }
36363   });
36364
36365   // modules/behavior/drag.js
36366   var drag_exports = {};
36367   __export(drag_exports, {
36368     behaviorDrag: () => behaviorDrag
36369   });
36370   function behaviorDrag() {
36371     var dispatch14 = dispatch_default("start", "move", "end");
36372     var _tolerancePx = 1;
36373     var _penTolerancePx = 4;
36374     var _origin = null;
36375     var _selector = "";
36376     var _targetNode;
36377     var _targetEntity;
36378     var _surface;
36379     var _pointerId;
36380     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
36381     var d3_event_userSelectProperty = utilPrefixCSSProperty("UserSelect");
36382     var d3_event_userSelectSuppress = function() {
36383       var selection2 = selection_default();
36384       var select = selection2.style(d3_event_userSelectProperty);
36385       selection2.style(d3_event_userSelectProperty, "none");
36386       return function() {
36387         selection2.style(d3_event_userSelectProperty, select);
36388       };
36389     };
36390     function pointerdown(d3_event) {
36391       if (_pointerId) return;
36392       _pointerId = d3_event.pointerId || "mouse";
36393       _targetNode = this;
36394       var pointerLocGetter = utilFastMouse(_surface || _targetNode.parentNode);
36395       var offset;
36396       var startOrigin = pointerLocGetter(d3_event);
36397       var started = false;
36398       var selectEnable = d3_event_userSelectSuppress();
36399       select_default2(window).on(_pointerPrefix + "move.drag", pointermove).on(_pointerPrefix + "up.drag pointercancel.drag", pointerup, true);
36400       if (_origin) {
36401         offset = _origin.call(_targetNode, _targetEntity);
36402         offset = [offset[0] - startOrigin[0], offset[1] - startOrigin[1]];
36403       } else {
36404         offset = [0, 0];
36405       }
36406       d3_event.stopPropagation();
36407       function pointermove(d3_event2) {
36408         if (_pointerId !== (d3_event2.pointerId || "mouse")) return;
36409         var p2 = pointerLocGetter(d3_event2);
36410         if (!started) {
36411           var dist = geoVecLength(startOrigin, p2);
36412           var tolerance = d3_event2.pointerType === "pen" ? _penTolerancePx : _tolerancePx;
36413           if (dist < tolerance) return;
36414           started = true;
36415           dispatch14.call("start", this, d3_event2, _targetEntity);
36416         } else {
36417           startOrigin = p2;
36418           d3_event2.stopPropagation();
36419           d3_event2.preventDefault();
36420           var dx = p2[0] - startOrigin[0];
36421           var dy = p2[1] - startOrigin[1];
36422           dispatch14.call("move", this, d3_event2, _targetEntity, [p2[0] + offset[0], p2[1] + offset[1]], [dx, dy]);
36423         }
36424       }
36425       function pointerup(d3_event2) {
36426         if (_pointerId !== (d3_event2.pointerId || "mouse")) return;
36427         _pointerId = null;
36428         if (started) {
36429           dispatch14.call("end", this, d3_event2, _targetEntity);
36430           d3_event2.preventDefault();
36431         }
36432         select_default2(window).on(_pointerPrefix + "move.drag", null).on(_pointerPrefix + "up.drag pointercancel.drag", null);
36433         selectEnable();
36434       }
36435     }
36436     function behavior(selection2) {
36437       var matchesSelector = utilPrefixDOMProperty("matchesSelector");
36438       var delegate = pointerdown;
36439       if (_selector) {
36440         delegate = function(d3_event) {
36441           var root3 = this;
36442           var target = d3_event.target;
36443           for (; target && target !== root3; target = target.parentNode) {
36444             var datum2 = target.__data__;
36445             _targetEntity = datum2 instanceof osmNote ? datum2 : datum2 && datum2.properties && datum2.properties.entity;
36446             if (_targetEntity && target[matchesSelector](_selector)) {
36447               return pointerdown.call(target, d3_event);
36448             }
36449           }
36450         };
36451       }
36452       selection2.on(_pointerPrefix + "down.drag" + _selector, delegate);
36453     }
36454     behavior.off = function(selection2) {
36455       selection2.on(_pointerPrefix + "down.drag" + _selector, null);
36456     };
36457     behavior.selector = function(_2) {
36458       if (!arguments.length) return _selector;
36459       _selector = _2;
36460       return behavior;
36461     };
36462     behavior.origin = function(_2) {
36463       if (!arguments.length) return _origin;
36464       _origin = _2;
36465       return behavior;
36466     };
36467     behavior.cancel = function() {
36468       select_default2(window).on(_pointerPrefix + "move.drag", null).on(_pointerPrefix + "up.drag pointercancel.drag", null);
36469       return behavior;
36470     };
36471     behavior.targetNode = function(_2) {
36472       if (!arguments.length) return _targetNode;
36473       _targetNode = _2;
36474       return behavior;
36475     };
36476     behavior.targetEntity = function(_2) {
36477       if (!arguments.length) return _targetEntity;
36478       _targetEntity = _2;
36479       return behavior;
36480     };
36481     behavior.surface = function(_2) {
36482       if (!arguments.length) return _surface;
36483       _surface = _2;
36484       return behavior;
36485     };
36486     return utilRebind(behavior, dispatch14, "on");
36487   }
36488   var init_drag2 = __esm({
36489     "modules/behavior/drag.js"() {
36490       "use strict";
36491       init_src4();
36492       init_src5();
36493       init_geo2();
36494       init_osm();
36495       init_rebind();
36496       init_util();
36497     }
36498   });
36499
36500   // modules/modes/drag_node.js
36501   var drag_node_exports = {};
36502   __export(drag_node_exports, {
36503     modeDragNode: () => modeDragNode
36504   });
36505   function modeDragNode(context) {
36506     var mode = {
36507       id: "drag-node",
36508       button: "browse"
36509     };
36510     var hover = behaviorHover(context).altDisables(true).on("hover", context.ui().sidebar.hover);
36511     var edit2 = behaviorEdit(context);
36512     var _nudgeInterval;
36513     var _restoreSelectedIDs = [];
36514     var _wasMidpoint = false;
36515     var _isCancelled = false;
36516     var _activeEntity;
36517     var _startLoc;
36518     var _lastLoc;
36519     function startNudge(d3_event, entity, nudge) {
36520       if (_nudgeInterval) window.clearInterval(_nudgeInterval);
36521       _nudgeInterval = window.setInterval(function() {
36522         context.map().pan(nudge);
36523         doMove(d3_event, entity, nudge);
36524       }, 50);
36525     }
36526     function stopNudge() {
36527       if (_nudgeInterval) {
36528         window.clearInterval(_nudgeInterval);
36529         _nudgeInterval = null;
36530       }
36531     }
36532     function moveAnnotation(entity) {
36533       return _t("operations.move.annotation." + entity.geometry(context.graph()));
36534     }
36535     function connectAnnotation(nodeEntity, targetEntity) {
36536       var nodeGeometry = nodeEntity.geometry(context.graph());
36537       var targetGeometry = targetEntity.geometry(context.graph());
36538       if (nodeGeometry === "vertex" && targetGeometry === "vertex") {
36539         var nodeParentWayIDs = context.graph().parentWays(nodeEntity);
36540         var targetParentWayIDs = context.graph().parentWays(targetEntity);
36541         var sharedParentWays = utilArrayIntersection(nodeParentWayIDs, targetParentWayIDs);
36542         if (sharedParentWays.length !== 0) {
36543           if (sharedParentWays[0].areAdjacent(nodeEntity.id, targetEntity.id)) {
36544             return _t("operations.connect.annotation.from_vertex.to_adjacent_vertex");
36545           }
36546           return _t("operations.connect.annotation.from_vertex.to_sibling_vertex");
36547         }
36548       }
36549       return _t("operations.connect.annotation.from_" + nodeGeometry + ".to_" + targetGeometry);
36550     }
36551     function shouldSnapToNode(target) {
36552       if (!_activeEntity) return false;
36553       return _activeEntity.geometry(context.graph()) !== "vertex" || (target.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(target, context.graph()));
36554     }
36555     function origin(entity) {
36556       return context.projection(entity.loc);
36557     }
36558     function keydown(d3_event) {
36559       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
36560         if (context.surface().classed("nope")) {
36561           context.surface().classed("nope-suppressed", true);
36562         }
36563         context.surface().classed("nope", false).classed("nope-disabled", true);
36564       }
36565     }
36566     function keyup(d3_event) {
36567       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
36568         if (context.surface().classed("nope-suppressed")) {
36569           context.surface().classed("nope", true);
36570         }
36571         context.surface().classed("nope-suppressed", false).classed("nope-disabled", false);
36572       }
36573     }
36574     function start2(d3_event, entity) {
36575       _wasMidpoint = entity.type === "midpoint";
36576       var hasHidden = context.features().hasHiddenConnections(entity, context.graph());
36577       _isCancelled = !context.editable() || d3_event.shiftKey || hasHidden;
36578       if (_isCancelled) {
36579         if (hasHidden) {
36580           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("modes.drag_node.connected_to_hidden"))();
36581         }
36582         return drag.cancel();
36583       }
36584       if (_wasMidpoint) {
36585         var midpoint = entity;
36586         entity = osmNode();
36587         context.perform(actionAddMidpoint(midpoint, entity));
36588         entity = context.entity(entity.id);
36589         var vertex = context.surface().selectAll("." + entity.id);
36590         drag.targetNode(vertex.node()).targetEntity(entity);
36591       } else {
36592         context.perform(actionNoop());
36593       }
36594       _activeEntity = entity;
36595       _startLoc = entity.loc;
36596       hover.ignoreVertex(entity.geometry(context.graph()) === "vertex");
36597       context.surface().selectAll("." + _activeEntity.id).classed("active", true);
36598       context.enter(mode);
36599     }
36600     function datum2(d3_event) {
36601       if (!d3_event || d3_event.altKey) {
36602         return {};
36603       } else {
36604         var d2 = d3_event.target.__data__;
36605         return d2 && d2.properties && d2.properties.target ? d2 : {};
36606       }
36607     }
36608     function doMove(d3_event, entity, nudge) {
36609       nudge = nudge || [0, 0];
36610       var currPoint = d3_event && d3_event.point || context.projection(_lastLoc);
36611       var currMouse = geoVecSubtract(currPoint, nudge);
36612       var loc = context.projection.invert(currMouse);
36613       var target, edge;
36614       if (!_nudgeInterval) {
36615         var d2 = datum2(d3_event);
36616         target = d2 && d2.properties && d2.properties.entity;
36617         var targetLoc = target && target.loc;
36618         var targetNodes = d2 && d2.properties && d2.properties.nodes;
36619         if (targetLoc) {
36620           if (shouldSnapToNode(target)) {
36621             loc = targetLoc;
36622           }
36623         } else if (targetNodes) {
36624           edge = geoChooseEdge(targetNodes, context.map().mouse(), context.projection, end.id);
36625           if (edge) {
36626             loc = edge.loc;
36627           }
36628         }
36629       }
36630       context.replace(
36631         actionMoveNode(entity.id, loc)
36632       );
36633       var isInvalid = false;
36634       if (target) {
36635         isInvalid = hasRelationConflict(entity, target, edge, context.graph());
36636       }
36637       if (!isInvalid) {
36638         isInvalid = hasInvalidGeometry(entity, context.graph());
36639       }
36640       var nope = context.surface().classed("nope");
36641       if (isInvalid === "relation" || isInvalid === "restriction") {
36642         if (!nope) {
36643           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append(
36644             "operations.connect." + isInvalid,
36645             { relation: _mainPresetIndex.item("type/restriction").name() }
36646           ))();
36647         }
36648       } else if (isInvalid) {
36649         var errorID = isInvalid === "line" ? "lines" : "areas";
36650         context.ui().flash.duration(3e3).iconName("#iD-icon-no").label(_t.append("self_intersection.error." + errorID))();
36651       } else {
36652         if (nope) {
36653           context.ui().flash.duration(1).label("")();
36654         }
36655       }
36656       var nopeDisabled = context.surface().classed("nope-disabled");
36657       if (nopeDisabled) {
36658         context.surface().classed("nope", false).classed("nope-suppressed", isInvalid);
36659       } else {
36660         context.surface().classed("nope", isInvalid).classed("nope-suppressed", false);
36661       }
36662       _lastLoc = loc;
36663     }
36664     function hasRelationConflict(entity, target, edge, graph) {
36665       var testGraph = graph.update();
36666       if (edge) {
36667         var midpoint = osmNode();
36668         var action = actionAddMidpoint({
36669           loc: edge.loc,
36670           edge: [target.nodes[edge.index - 1], target.nodes[edge.index]]
36671         }, midpoint);
36672         testGraph = action(testGraph);
36673         target = midpoint;
36674       }
36675       var ids = [entity.id, target.id];
36676       return actionConnect(ids).disabled(testGraph);
36677     }
36678     function hasInvalidGeometry(entity, graph) {
36679       var parents = graph.parentWays(entity);
36680       var i3, j2, k2;
36681       for (i3 = 0; i3 < parents.length; i3++) {
36682         var parent = parents[i3];
36683         var nodes = [];
36684         var activeIndex = null;
36685         var relations = graph.parentRelations(parent);
36686         for (j2 = 0; j2 < relations.length; j2++) {
36687           if (!relations[j2].isMultipolygon()) continue;
36688           var rings = osmJoinWays(relations[j2].members, graph);
36689           for (k2 = 0; k2 < rings.length; k2++) {
36690             nodes = rings[k2].nodes;
36691             if (nodes.find(function(n3) {
36692               return n3.id === entity.id;
36693             })) {
36694               activeIndex = k2;
36695               if (geoHasSelfIntersections(nodes, entity.id)) {
36696                 return "multipolygonMember";
36697               }
36698             }
36699             rings[k2].coords = nodes.map(function(n3) {
36700               return n3.loc;
36701             });
36702           }
36703           for (k2 = 0; k2 < rings.length; k2++) {
36704             if (k2 === activeIndex) continue;
36705             if (geoHasLineIntersections(rings[activeIndex].nodes, rings[k2].nodes, entity.id)) {
36706               return "multipolygonRing";
36707             }
36708           }
36709         }
36710         if (activeIndex === null) {
36711           nodes = parent.nodes.map(function(nodeID) {
36712             return graph.entity(nodeID);
36713           });
36714           if (nodes.length && geoHasSelfIntersections(nodes, entity.id)) {
36715             return parent.geometry(graph);
36716           }
36717         }
36718       }
36719       return false;
36720     }
36721     function move(d3_event, entity, point) {
36722       if (_isCancelled) return;
36723       d3_event.stopPropagation();
36724       context.surface().classed("nope-disabled", d3_event.altKey);
36725       _lastLoc = context.projection.invert(point);
36726       doMove(d3_event, entity);
36727       var nudge = geoViewportEdge(point, context.map().dimensions());
36728       if (nudge) {
36729         startNudge(d3_event, entity, nudge);
36730       } else {
36731         stopNudge();
36732       }
36733     }
36734     function end(d3_event, entity) {
36735       if (_isCancelled) return;
36736       var wasPoint = entity.geometry(context.graph()) === "point";
36737       var d2 = datum2(d3_event);
36738       var nope = d2 && d2.properties && d2.properties.nope || context.surface().classed("nope");
36739       var target = d2 && d2.properties && d2.properties.entity;
36740       if (nope) {
36741         context.perform(
36742           _actionBounceBack(entity.id, _startLoc)
36743         );
36744       } else if (target && target.type === "way") {
36745         var choice = geoChooseEdge(context.graph().childNodes(target), context.map().mouse(), context.projection, entity.id);
36746         context.replace(
36747           actionAddMidpoint({
36748             loc: choice.loc,
36749             edge: [target.nodes[choice.index - 1], target.nodes[choice.index]]
36750           }, entity),
36751           connectAnnotation(entity, target)
36752         );
36753       } else if (target && target.type === "node" && shouldSnapToNode(target)) {
36754         context.replace(
36755           actionConnect([target.id, entity.id]),
36756           connectAnnotation(entity, target)
36757         );
36758       } else if (_wasMidpoint) {
36759         context.replace(
36760           actionNoop(),
36761           _t("operations.add.annotation.vertex")
36762         );
36763       } else {
36764         context.replace(
36765           actionNoop(),
36766           moveAnnotation(entity)
36767         );
36768       }
36769       if (wasPoint) {
36770         context.enter(modeSelect(context, [entity.id]));
36771       } else {
36772         var reselection = _restoreSelectedIDs.filter(function(id2) {
36773           return context.graph().hasEntity(id2);
36774         });
36775         if (reselection.length) {
36776           context.enter(modeSelect(context, reselection));
36777         } else {
36778           context.enter(modeBrowse(context));
36779         }
36780       }
36781     }
36782     function _actionBounceBack(nodeID, toLoc) {
36783       var moveNode = actionMoveNode(nodeID, toLoc);
36784       var action = function(graph, t2) {
36785         if (t2 === 1) context.pop();
36786         return moveNode(graph, t2);
36787       };
36788       action.transitionable = true;
36789       return action;
36790     }
36791     function cancel() {
36792       drag.cancel();
36793       context.enter(modeBrowse(context));
36794     }
36795     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);
36796     mode.enter = function() {
36797       context.install(hover);
36798       context.install(edit2);
36799       select_default2(window).on("keydown.dragNode", keydown).on("keyup.dragNode", keyup);
36800       context.history().on("undone.drag-node", cancel);
36801     };
36802     mode.exit = function() {
36803       context.ui().sidebar.hover.cancel();
36804       context.uninstall(hover);
36805       context.uninstall(edit2);
36806       select_default2(window).on("keydown.dragNode", null).on("keyup.dragNode", null);
36807       context.history().on("undone.drag-node", null);
36808       _activeEntity = null;
36809       context.surface().classed("nope", false).classed("nope-suppressed", false).classed("nope-disabled", false).selectAll(".active").classed("active", false);
36810       stopNudge();
36811     };
36812     mode.selectedIDs = function() {
36813       if (!arguments.length) return _activeEntity ? [_activeEntity.id] : [];
36814       return mode;
36815     };
36816     mode.activeID = function() {
36817       if (!arguments.length) return _activeEntity && _activeEntity.id;
36818       return mode;
36819     };
36820     mode.restoreSelectedIDs = function(_2) {
36821       if (!arguments.length) return _restoreSelectedIDs;
36822       _restoreSelectedIDs = _2;
36823       return mode;
36824     };
36825     mode.behavior = drag;
36826     return mode;
36827   }
36828   var init_drag_node = __esm({
36829     "modules/modes/drag_node.js"() {
36830       "use strict";
36831       init_src5();
36832       init_presets();
36833       init_localizer();
36834       init_add_midpoint();
36835       init_connect();
36836       init_move_node();
36837       init_noop2();
36838       init_drag2();
36839       init_edit();
36840       init_hover();
36841       init_geo2();
36842       init_browse();
36843       init_select5();
36844       init_osm();
36845       init_util();
36846     }
36847   });
36848
36849   // node_modules/quickselect/index.js
36850   function quickselect2(arr, k2, left = 0, right = arr.length - 1, compare2 = defaultCompare) {
36851     while (right > left) {
36852       if (right - left > 600) {
36853         const n3 = right - left + 1;
36854         const m2 = k2 - left + 1;
36855         const z2 = Math.log(n3);
36856         const s2 = 0.5 * Math.exp(2 * z2 / 3);
36857         const sd = 0.5 * Math.sqrt(z2 * s2 * (n3 - s2) / n3) * (m2 - n3 / 2 < 0 ? -1 : 1);
36858         const newLeft = Math.max(left, Math.floor(k2 - m2 * s2 / n3 + sd));
36859         const newRight = Math.min(right, Math.floor(k2 + (n3 - m2) * s2 / n3 + sd));
36860         quickselect2(arr, k2, newLeft, newRight, compare2);
36861       }
36862       const t2 = arr[k2];
36863       let i3 = left;
36864       let j2 = right;
36865       swap2(arr, left, k2);
36866       if (compare2(arr[right], t2) > 0) swap2(arr, left, right);
36867       while (i3 < j2) {
36868         swap2(arr, i3, j2);
36869         i3++;
36870         j2--;
36871         while (compare2(arr[i3], t2) < 0) i3++;
36872         while (compare2(arr[j2], t2) > 0) j2--;
36873       }
36874       if (compare2(arr[left], t2) === 0) swap2(arr, left, j2);
36875       else {
36876         j2++;
36877         swap2(arr, j2, right);
36878       }
36879       if (j2 <= k2) left = j2 + 1;
36880       if (k2 <= j2) right = j2 - 1;
36881     }
36882   }
36883   function swap2(arr, i3, j2) {
36884     const tmp = arr[i3];
36885     arr[i3] = arr[j2];
36886     arr[j2] = tmp;
36887   }
36888   function defaultCompare(a2, b2) {
36889     return a2 < b2 ? -1 : a2 > b2 ? 1 : 0;
36890   }
36891   var init_quickselect2 = __esm({
36892     "node_modules/quickselect/index.js"() {
36893     }
36894   });
36895
36896   // node_modules/rbush/index.js
36897   function findItem(item, items, equalsFn) {
36898     if (!equalsFn) return items.indexOf(item);
36899     for (let i3 = 0; i3 < items.length; i3++) {
36900       if (equalsFn(item, items[i3])) return i3;
36901     }
36902     return -1;
36903   }
36904   function calcBBox(node, toBBox) {
36905     distBBox(node, 0, node.children.length, toBBox, node);
36906   }
36907   function distBBox(node, k2, p2, toBBox, destNode) {
36908     if (!destNode) destNode = createNode(null);
36909     destNode.minX = Infinity;
36910     destNode.minY = Infinity;
36911     destNode.maxX = -Infinity;
36912     destNode.maxY = -Infinity;
36913     for (let i3 = k2; i3 < p2; i3++) {
36914       const child = node.children[i3];
36915       extend2(destNode, node.leaf ? toBBox(child) : child);
36916     }
36917     return destNode;
36918   }
36919   function extend2(a2, b2) {
36920     a2.minX = Math.min(a2.minX, b2.minX);
36921     a2.minY = Math.min(a2.minY, b2.minY);
36922     a2.maxX = Math.max(a2.maxX, b2.maxX);
36923     a2.maxY = Math.max(a2.maxY, b2.maxY);
36924     return a2;
36925   }
36926   function compareNodeMinX(a2, b2) {
36927     return a2.minX - b2.minX;
36928   }
36929   function compareNodeMinY(a2, b2) {
36930     return a2.minY - b2.minY;
36931   }
36932   function bboxArea(a2) {
36933     return (a2.maxX - a2.minX) * (a2.maxY - a2.minY);
36934   }
36935   function bboxMargin(a2) {
36936     return a2.maxX - a2.minX + (a2.maxY - a2.minY);
36937   }
36938   function enlargedArea(a2, b2) {
36939     return (Math.max(b2.maxX, a2.maxX) - Math.min(b2.minX, a2.minX)) * (Math.max(b2.maxY, a2.maxY) - Math.min(b2.minY, a2.minY));
36940   }
36941   function intersectionArea(a2, b2) {
36942     const minX = Math.max(a2.minX, b2.minX);
36943     const minY = Math.max(a2.minY, b2.minY);
36944     const maxX = Math.min(a2.maxX, b2.maxX);
36945     const maxY = Math.min(a2.maxY, b2.maxY);
36946     return Math.max(0, maxX - minX) * Math.max(0, maxY - minY);
36947   }
36948   function contains(a2, b2) {
36949     return a2.minX <= b2.minX && a2.minY <= b2.minY && b2.maxX <= a2.maxX && b2.maxY <= a2.maxY;
36950   }
36951   function intersects(a2, b2) {
36952     return b2.minX <= a2.maxX && b2.minY <= a2.maxY && b2.maxX >= a2.minX && b2.maxY >= a2.minY;
36953   }
36954   function createNode(children2) {
36955     return {
36956       children: children2,
36957       height: 1,
36958       leaf: true,
36959       minX: Infinity,
36960       minY: Infinity,
36961       maxX: -Infinity,
36962       maxY: -Infinity
36963     };
36964   }
36965   function multiSelect(arr, left, right, n3, compare2) {
36966     const stack = [left, right];
36967     while (stack.length) {
36968       right = stack.pop();
36969       left = stack.pop();
36970       if (right - left <= n3) continue;
36971       const mid = left + Math.ceil((right - left) / n3 / 2) * n3;
36972       quickselect2(arr, mid, left, right, compare2);
36973       stack.push(left, mid, mid, right);
36974     }
36975   }
36976   var RBush;
36977   var init_rbush = __esm({
36978     "node_modules/rbush/index.js"() {
36979       init_quickselect2();
36980       RBush = class {
36981         constructor(maxEntries = 9) {
36982           this._maxEntries = Math.max(4, maxEntries);
36983           this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4));
36984           this.clear();
36985         }
36986         all() {
36987           return this._all(this.data, []);
36988         }
36989         search(bbox2) {
36990           let node = this.data;
36991           const result = [];
36992           if (!intersects(bbox2, node)) return result;
36993           const toBBox = this.toBBox;
36994           const nodesToSearch = [];
36995           while (node) {
36996             for (let i3 = 0; i3 < node.children.length; i3++) {
36997               const child = node.children[i3];
36998               const childBBox = node.leaf ? toBBox(child) : child;
36999               if (intersects(bbox2, childBBox)) {
37000                 if (node.leaf) result.push(child);
37001                 else if (contains(bbox2, childBBox)) this._all(child, result);
37002                 else nodesToSearch.push(child);
37003               }
37004             }
37005             node = nodesToSearch.pop();
37006           }
37007           return result;
37008         }
37009         collides(bbox2) {
37010           let node = this.data;
37011           if (!intersects(bbox2, node)) return false;
37012           const nodesToSearch = [];
37013           while (node) {
37014             for (let i3 = 0; i3 < node.children.length; i3++) {
37015               const child = node.children[i3];
37016               const childBBox = node.leaf ? this.toBBox(child) : child;
37017               if (intersects(bbox2, childBBox)) {
37018                 if (node.leaf || contains(bbox2, childBBox)) return true;
37019                 nodesToSearch.push(child);
37020               }
37021             }
37022             node = nodesToSearch.pop();
37023           }
37024           return false;
37025         }
37026         load(data) {
37027           if (!(data && data.length)) return this;
37028           if (data.length < this._minEntries) {
37029             for (let i3 = 0; i3 < data.length; i3++) {
37030               this.insert(data[i3]);
37031             }
37032             return this;
37033           }
37034           let node = this._build(data.slice(), 0, data.length - 1, 0);
37035           if (!this.data.children.length) {
37036             this.data = node;
37037           } else if (this.data.height === node.height) {
37038             this._splitRoot(this.data, node);
37039           } else {
37040             if (this.data.height < node.height) {
37041               const tmpNode = this.data;
37042               this.data = node;
37043               node = tmpNode;
37044             }
37045             this._insert(node, this.data.height - node.height - 1, true);
37046           }
37047           return this;
37048         }
37049         insert(item) {
37050           if (item) this._insert(item, this.data.height - 1);
37051           return this;
37052         }
37053         clear() {
37054           this.data = createNode([]);
37055           return this;
37056         }
37057         remove(item, equalsFn) {
37058           if (!item) return this;
37059           let node = this.data;
37060           const bbox2 = this.toBBox(item);
37061           const path = [];
37062           const indexes = [];
37063           let i3, parent, goingUp;
37064           while (node || path.length) {
37065             if (!node) {
37066               node = path.pop();
37067               parent = path[path.length - 1];
37068               i3 = indexes.pop();
37069               goingUp = true;
37070             }
37071             if (node.leaf) {
37072               const index = findItem(item, node.children, equalsFn);
37073               if (index !== -1) {
37074                 node.children.splice(index, 1);
37075                 path.push(node);
37076                 this._condense(path);
37077                 return this;
37078               }
37079             }
37080             if (!goingUp && !node.leaf && contains(node, bbox2)) {
37081               path.push(node);
37082               indexes.push(i3);
37083               i3 = 0;
37084               parent = node;
37085               node = node.children[0];
37086             } else if (parent) {
37087               i3++;
37088               node = parent.children[i3];
37089               goingUp = false;
37090             } else node = null;
37091           }
37092           return this;
37093         }
37094         toBBox(item) {
37095           return item;
37096         }
37097         compareMinX(a2, b2) {
37098           return a2.minX - b2.minX;
37099         }
37100         compareMinY(a2, b2) {
37101           return a2.minY - b2.minY;
37102         }
37103         toJSON() {
37104           return this.data;
37105         }
37106         fromJSON(data) {
37107           this.data = data;
37108           return this;
37109         }
37110         _all(node, result) {
37111           const nodesToSearch = [];
37112           while (node) {
37113             if (node.leaf) result.push(...node.children);
37114             else nodesToSearch.push(...node.children);
37115             node = nodesToSearch.pop();
37116           }
37117           return result;
37118         }
37119         _build(items, left, right, height) {
37120           const N2 = right - left + 1;
37121           let M2 = this._maxEntries;
37122           let node;
37123           if (N2 <= M2) {
37124             node = createNode(items.slice(left, right + 1));
37125             calcBBox(node, this.toBBox);
37126             return node;
37127           }
37128           if (!height) {
37129             height = Math.ceil(Math.log(N2) / Math.log(M2));
37130             M2 = Math.ceil(N2 / Math.pow(M2, height - 1));
37131           }
37132           node = createNode([]);
37133           node.leaf = false;
37134           node.height = height;
37135           const N22 = Math.ceil(N2 / M2);
37136           const N1 = N22 * Math.ceil(Math.sqrt(M2));
37137           multiSelect(items, left, right, N1, this.compareMinX);
37138           for (let i3 = left; i3 <= right; i3 += N1) {
37139             const right2 = Math.min(i3 + N1 - 1, right);
37140             multiSelect(items, i3, right2, N22, this.compareMinY);
37141             for (let j2 = i3; j2 <= right2; j2 += N22) {
37142               const right3 = Math.min(j2 + N22 - 1, right2);
37143               node.children.push(this._build(items, j2, right3, height - 1));
37144             }
37145           }
37146           calcBBox(node, this.toBBox);
37147           return node;
37148         }
37149         _chooseSubtree(bbox2, node, level, path) {
37150           while (true) {
37151             path.push(node);
37152             if (node.leaf || path.length - 1 === level) break;
37153             let minArea = Infinity;
37154             let minEnlargement = Infinity;
37155             let targetNode;
37156             for (let i3 = 0; i3 < node.children.length; i3++) {
37157               const child = node.children[i3];
37158               const area = bboxArea(child);
37159               const enlargement = enlargedArea(bbox2, child) - area;
37160               if (enlargement < minEnlargement) {
37161                 minEnlargement = enlargement;
37162                 minArea = area < minArea ? area : minArea;
37163                 targetNode = child;
37164               } else if (enlargement === minEnlargement) {
37165                 if (area < minArea) {
37166                   minArea = area;
37167                   targetNode = child;
37168                 }
37169               }
37170             }
37171             node = targetNode || node.children[0];
37172           }
37173           return node;
37174         }
37175         _insert(item, level, isNode) {
37176           const bbox2 = isNode ? item : this.toBBox(item);
37177           const insertPath = [];
37178           const node = this._chooseSubtree(bbox2, this.data, level, insertPath);
37179           node.children.push(item);
37180           extend2(node, bbox2);
37181           while (level >= 0) {
37182             if (insertPath[level].children.length > this._maxEntries) {
37183               this._split(insertPath, level);
37184               level--;
37185             } else break;
37186           }
37187           this._adjustParentBBoxes(bbox2, insertPath, level);
37188         }
37189         // split overflowed node into two
37190         _split(insertPath, level) {
37191           const node = insertPath[level];
37192           const M2 = node.children.length;
37193           const m2 = this._minEntries;
37194           this._chooseSplitAxis(node, m2, M2);
37195           const splitIndex = this._chooseSplitIndex(node, m2, M2);
37196           const newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex));
37197           newNode.height = node.height;
37198           newNode.leaf = node.leaf;
37199           calcBBox(node, this.toBBox);
37200           calcBBox(newNode, this.toBBox);
37201           if (level) insertPath[level - 1].children.push(newNode);
37202           else this._splitRoot(node, newNode);
37203         }
37204         _splitRoot(node, newNode) {
37205           this.data = createNode([node, newNode]);
37206           this.data.height = node.height + 1;
37207           this.data.leaf = false;
37208           calcBBox(this.data, this.toBBox);
37209         }
37210         _chooseSplitIndex(node, m2, M2) {
37211           let index;
37212           let minOverlap = Infinity;
37213           let minArea = Infinity;
37214           for (let i3 = m2; i3 <= M2 - m2; i3++) {
37215             const bbox1 = distBBox(node, 0, i3, this.toBBox);
37216             const bbox2 = distBBox(node, i3, M2, this.toBBox);
37217             const overlap = intersectionArea(bbox1, bbox2);
37218             const area = bboxArea(bbox1) + bboxArea(bbox2);
37219             if (overlap < minOverlap) {
37220               minOverlap = overlap;
37221               index = i3;
37222               minArea = area < minArea ? area : minArea;
37223             } else if (overlap === minOverlap) {
37224               if (area < minArea) {
37225                 minArea = area;
37226                 index = i3;
37227               }
37228             }
37229           }
37230           return index || M2 - m2;
37231         }
37232         // sorts node children by the best axis for split
37233         _chooseSplitAxis(node, m2, M2) {
37234           const compareMinX = node.leaf ? this.compareMinX : compareNodeMinX;
37235           const compareMinY = node.leaf ? this.compareMinY : compareNodeMinY;
37236           const xMargin = this._allDistMargin(node, m2, M2, compareMinX);
37237           const yMargin = this._allDistMargin(node, m2, M2, compareMinY);
37238           if (xMargin < yMargin) node.children.sort(compareMinX);
37239         }
37240         // total margin of all possible split distributions where each node is at least m full
37241         _allDistMargin(node, m2, M2, compare2) {
37242           node.children.sort(compare2);
37243           const toBBox = this.toBBox;
37244           const leftBBox = distBBox(node, 0, m2, toBBox);
37245           const rightBBox = distBBox(node, M2 - m2, M2, toBBox);
37246           let margin = bboxMargin(leftBBox) + bboxMargin(rightBBox);
37247           for (let i3 = m2; i3 < M2 - m2; i3++) {
37248             const child = node.children[i3];
37249             extend2(leftBBox, node.leaf ? toBBox(child) : child);
37250             margin += bboxMargin(leftBBox);
37251           }
37252           for (let i3 = M2 - m2 - 1; i3 >= m2; i3--) {
37253             const child = node.children[i3];
37254             extend2(rightBBox, node.leaf ? toBBox(child) : child);
37255             margin += bboxMargin(rightBBox);
37256           }
37257           return margin;
37258         }
37259         _adjustParentBBoxes(bbox2, path, level) {
37260           for (let i3 = level; i3 >= 0; i3--) {
37261             extend2(path[i3], bbox2);
37262           }
37263         }
37264         _condense(path) {
37265           for (let i3 = path.length - 1, siblings; i3 >= 0; i3--) {
37266             if (path[i3].children.length === 0) {
37267               if (i3 > 0) {
37268                 siblings = path[i3 - 1].children;
37269                 siblings.splice(siblings.indexOf(path[i3]), 1);
37270               } else this.clear();
37271             } else calcBBox(path[i3], this.toBBox);
37272           }
37273         }
37274       };
37275     }
37276   });
37277
37278   // node_modules/d3-dsv/src/index.js
37279   var init_src17 = __esm({
37280     "node_modules/d3-dsv/src/index.js"() {
37281     }
37282   });
37283
37284   // node_modules/d3-fetch/src/text.js
37285   function responseText(response) {
37286     if (!response.ok) throw new Error(response.status + " " + response.statusText);
37287     return response.text();
37288   }
37289   function text_default3(input, init2) {
37290     return fetch(input, init2).then(responseText);
37291   }
37292   var init_text3 = __esm({
37293     "node_modules/d3-fetch/src/text.js"() {
37294     }
37295   });
37296
37297   // node_modules/d3-fetch/src/json.js
37298   function responseJson(response) {
37299     if (!response.ok) throw new Error(response.status + " " + response.statusText);
37300     if (response.status === 204 || response.status === 205) return;
37301     return response.json();
37302   }
37303   function json_default(input, init2) {
37304     return fetch(input, init2).then(responseJson);
37305   }
37306   var init_json = __esm({
37307     "node_modules/d3-fetch/src/json.js"() {
37308     }
37309   });
37310
37311   // node_modules/d3-fetch/src/xml.js
37312   function parser(type2) {
37313     return (input, init2) => text_default3(input, init2).then((text) => new DOMParser().parseFromString(text, type2));
37314   }
37315   var xml_default, html, svg;
37316   var init_xml = __esm({
37317     "node_modules/d3-fetch/src/xml.js"() {
37318       init_text3();
37319       xml_default = parser("application/xml");
37320       html = parser("text/html");
37321       svg = parser("image/svg+xml");
37322     }
37323   });
37324
37325   // node_modules/d3-fetch/src/index.js
37326   var init_src18 = __esm({
37327     "node_modules/d3-fetch/src/index.js"() {
37328       init_json();
37329       init_text3();
37330       init_xml();
37331     }
37332   });
37333
37334   // modules/services/keepRight.js
37335   var keepRight_exports = {};
37336   __export(keepRight_exports, {
37337     default: () => keepRight_default
37338   });
37339   function abortRequest(controller) {
37340     if (controller) {
37341       controller.abort();
37342     }
37343   }
37344   function abortUnwantedRequests(cache, tiles) {
37345     Object.keys(cache.inflightTile).forEach((k2) => {
37346       const wanted = tiles.find((tile) => k2 === tile.id);
37347       if (!wanted) {
37348         abortRequest(cache.inflightTile[k2]);
37349         delete cache.inflightTile[k2];
37350       }
37351     });
37352   }
37353   function encodeIssueRtree(d2) {
37354     return { minX: d2.loc[0], minY: d2.loc[1], maxX: d2.loc[0], maxY: d2.loc[1], data: d2 };
37355   }
37356   function updateRtree(item, replace) {
37357     _cache.rtree.remove(item, (a2, b2) => a2.data.id === b2.data.id);
37358     if (replace) {
37359       _cache.rtree.insert(item);
37360     }
37361   }
37362   function tokenReplacements(d2) {
37363     if (!(d2 instanceof QAItem)) return;
37364     const replacements = {};
37365     const issueTemplate = _krData.errorTypes[d2.whichType];
37366     if (!issueTemplate) {
37367       console.log("No Template: ", d2.whichType);
37368       console.log("  ", d2.description);
37369       return;
37370     }
37371     if (!issueTemplate.regex) return;
37372     const errorRegex = new RegExp(issueTemplate.regex, "i");
37373     const errorMatch = errorRegex.exec(d2.description);
37374     if (!errorMatch) {
37375       console.log("Unmatched: ", d2.whichType);
37376       console.log("  ", d2.description);
37377       console.log("  ", errorRegex);
37378       return;
37379     }
37380     for (let i3 = 1; i3 < errorMatch.length; i3++) {
37381       let capture = errorMatch[i3];
37382       let idType;
37383       idType = "IDs" in issueTemplate ? issueTemplate.IDs[i3 - 1] : "";
37384       if (idType && capture) {
37385         capture = parseError(capture, idType);
37386       } else {
37387         const compare2 = capture.toLowerCase();
37388         if (_krData.localizeStrings[compare2]) {
37389           capture = _t("QA.keepRight.error_parts." + _krData.localizeStrings[compare2]);
37390         } else {
37391           capture = unescape_default(capture);
37392         }
37393       }
37394       replacements["var" + i3] = capture;
37395     }
37396     return replacements;
37397   }
37398   function parseError(capture, idType) {
37399     const compare2 = capture.toLowerCase();
37400     if (_krData.localizeStrings[compare2]) {
37401       capture = _t("QA.keepRight.error_parts." + _krData.localizeStrings[compare2]);
37402     }
37403     switch (idType) {
37404       // link a string like "this node"
37405       case "this":
37406         capture = linkErrorObject(capture);
37407         break;
37408       case "url":
37409         capture = linkURL(capture);
37410         break;
37411       // link an entity ID
37412       case "n":
37413       case "w":
37414       case "r":
37415         capture = linkEntity(idType + capture);
37416         break;
37417       // some errors have more complex ID lists/variance
37418       case "20":
37419         capture = parse20(capture);
37420         break;
37421       case "211":
37422         capture = parse211(capture);
37423         break;
37424       case "231":
37425         capture = parse231(capture);
37426         break;
37427       case "294":
37428         capture = parse294(capture);
37429         break;
37430       case "370":
37431         capture = parse370(capture);
37432         break;
37433     }
37434     return capture;
37435     function linkErrorObject(d2) {
37436       return { html: `<a class="error_object_link">${d2}</a>` };
37437     }
37438     function linkEntity(d2) {
37439       return { html: `<a class="error_entity_link">${d2}</a>` };
37440     }
37441     function linkURL(d2) {
37442       return { html: `<a class="kr_external_link" target="_blank" href="${d2}">${d2}</a>` };
37443     }
37444     function parse211(capture2) {
37445       let newList = [];
37446       const items = capture2.split(", ");
37447       items.forEach((item) => {
37448         let id2 = linkEntity("n" + item.slice(1));
37449         newList.push(id2);
37450       });
37451       return newList.join(", ");
37452     }
37453     function parse231(capture2) {
37454       let newList = [];
37455       const items = capture2.split("),");
37456       items.forEach((item) => {
37457         const match = item.match(/\#(\d+)\((.+)\)?/);
37458         if (match !== null && match.length > 2) {
37459           newList.push(
37460             linkEntity("w" + match[1]) + " " + _t("QA.keepRight.errorTypes.231.layer", { layer: match[2] })
37461           );
37462         }
37463       });
37464       return newList.join(", ");
37465     }
37466     function parse294(capture2) {
37467       let newList = [];
37468       const items = capture2.split(",");
37469       items.forEach((item) => {
37470         item = item.split(" ");
37471         const role = `"${item[0]}"`;
37472         const idType2 = item[1].slice(0, 1);
37473         let id2 = item[2].slice(1);
37474         id2 = linkEntity(idType2 + id2);
37475         newList.push(`${role} ${item[1]} ${id2}`);
37476       });
37477       return newList.join(", ");
37478     }
37479     function parse370(capture2) {
37480       if (!capture2) return "";
37481       const match = capture2.match(/\(including the name (\'.+\')\)/);
37482       if (match && match.length) {
37483         return _t("QA.keepRight.errorTypes.370.including_the_name", { name: match[1] });
37484       }
37485       return "";
37486     }
37487     function parse20(capture2) {
37488       let newList = [];
37489       const items = capture2.split(",");
37490       items.forEach((item) => {
37491         const id2 = linkEntity("n" + item.slice(1));
37492         newList.push(id2);
37493       });
37494       return newList.join(", ");
37495     }
37496   }
37497   var tiler, dispatch2, _tileZoom, _krUrlRoot, _krData, _cache, _krRuleset, keepRight_default;
37498   var init_keepRight = __esm({
37499     "modules/services/keepRight.js"() {
37500       "use strict";
37501       init_rbush();
37502       init_src4();
37503       init_src18();
37504       init_lodash();
37505       init_file_fetcher();
37506       init_geo2();
37507       init_osm();
37508       init_localizer();
37509       init_util();
37510       tiler = utilTiler();
37511       dispatch2 = dispatch_default("loaded");
37512       _tileZoom = 14;
37513       _krUrlRoot = "https://www.keepright.at";
37514       _krData = { errorTypes: {}, localizeStrings: {} };
37515       _krRuleset = [
37516         // no 20 - multiple node on same spot - these are mostly boundaries overlapping roads
37517         30,
37518         40,
37519         50,
37520         60,
37521         70,
37522         90,
37523         100,
37524         110,
37525         120,
37526         130,
37527         150,
37528         160,
37529         170,
37530         180,
37531         190,
37532         191,
37533         192,
37534         193,
37535         194,
37536         195,
37537         196,
37538         197,
37539         198,
37540         200,
37541         201,
37542         202,
37543         203,
37544         204,
37545         205,
37546         206,
37547         207,
37548         208,
37549         210,
37550         220,
37551         230,
37552         231,
37553         232,
37554         270,
37555         280,
37556         281,
37557         282,
37558         283,
37559         284,
37560         285,
37561         290,
37562         291,
37563         292,
37564         293,
37565         294,
37566         295,
37567         296,
37568         297,
37569         298,
37570         300,
37571         310,
37572         311,
37573         312,
37574         313,
37575         320,
37576         350,
37577         360,
37578         370,
37579         380,
37580         390,
37581         400,
37582         401,
37583         402,
37584         410,
37585         411,
37586         412,
37587         413
37588       ];
37589       keepRight_default = {
37590         title: "keepRight",
37591         init() {
37592           _mainFileFetcher.get("keepRight").then((d2) => _krData = d2);
37593           if (!_cache) {
37594             this.reset();
37595           }
37596           this.event = utilRebind(this, dispatch2, "on");
37597         },
37598         reset() {
37599           if (_cache) {
37600             Object.values(_cache.inflightTile).forEach(abortRequest);
37601           }
37602           _cache = {
37603             data: {},
37604             loadedTile: {},
37605             inflightTile: {},
37606             inflightPost: {},
37607             closed: {},
37608             rtree: new RBush()
37609           };
37610         },
37611         // KeepRight API:  http://osm.mueschelsoft.de/keepright/interfacing.php
37612         loadIssues(projection2) {
37613           const options2 = {
37614             format: "geojson",
37615             ch: _krRuleset
37616           };
37617           const tiles = tiler.zoomExtent([_tileZoom, _tileZoom]).getTiles(projection2);
37618           abortUnwantedRequests(_cache, tiles);
37619           tiles.forEach((tile) => {
37620             if (_cache.loadedTile[tile.id] || _cache.inflightTile[tile.id]) return;
37621             const [left, top, right, bottom] = tile.extent.rectangle();
37622             const params = Object.assign({}, options2, { left, bottom, right, top });
37623             const url = `${_krUrlRoot}/export.php?` + utilQsString(params);
37624             const controller = new AbortController();
37625             _cache.inflightTile[tile.id] = controller;
37626             json_default(url, { signal: controller.signal }).then((data) => {
37627               delete _cache.inflightTile[tile.id];
37628               _cache.loadedTile[tile.id] = true;
37629               if (!data || !data.features || !data.features.length) {
37630                 throw new Error("No Data");
37631               }
37632               data.features.forEach((feature3) => {
37633                 const {
37634                   properties: {
37635                     error_type: itemType,
37636                     error_id: id2,
37637                     comment = null,
37638                     object_id: objectId,
37639                     object_type: objectType,
37640                     schema,
37641                     title
37642                   }
37643                 } = feature3;
37644                 let {
37645                   geometry: { coordinates: loc },
37646                   properties: { description = "" }
37647                 } = feature3;
37648                 const issueTemplate = _krData.errorTypes[itemType];
37649                 const parentIssueType = (Math.floor(itemType / 10) * 10).toString();
37650                 const whichType = issueTemplate ? itemType : parentIssueType;
37651                 const whichTemplate = _krData.errorTypes[whichType];
37652                 switch (whichType) {
37653                   case "170":
37654                     description = `This feature has a FIXME tag: ${description}`;
37655                     break;
37656                   case "292":
37657                   case "293":
37658                     description = description.replace("A turn-", "This turn-");
37659                     break;
37660                   case "294":
37661                   case "295":
37662                   case "296":
37663                   case "297":
37664                   case "298":
37665                     description = `This turn-restriction~${description}`;
37666                     break;
37667                   case "300":
37668                     description = "This highway is missing a maxspeed tag";
37669                     break;
37670                   case "411":
37671                   case "412":
37672                   case "413":
37673                     description = `This feature~${description}`;
37674                     break;
37675                 }
37676                 let coincident = false;
37677                 do {
37678                   let delta = coincident ? [1e-5, 0] : [0, 1e-5];
37679                   loc = geoVecAdd(loc, delta);
37680                   let bbox2 = geoExtent(loc).bbox();
37681                   coincident = _cache.rtree.search(bbox2).length;
37682                 } while (coincident);
37683                 let d2 = new QAItem(loc, this, itemType, id2, {
37684                   comment,
37685                   description,
37686                   whichType,
37687                   parentIssueType,
37688                   severity: whichTemplate.severity || "error",
37689                   objectId,
37690                   objectType,
37691                   schema,
37692                   title
37693                 });
37694                 d2.replacements = tokenReplacements(d2);
37695                 _cache.data[id2] = d2;
37696                 _cache.rtree.insert(encodeIssueRtree(d2));
37697               });
37698               dispatch2.call("loaded");
37699             }).catch(() => {
37700               delete _cache.inflightTile[tile.id];
37701               _cache.loadedTile[tile.id] = true;
37702             });
37703           });
37704         },
37705         postUpdate(d2, callback) {
37706           if (_cache.inflightPost[d2.id]) {
37707             return callback({ message: "Error update already inflight", status: -2 }, d2);
37708           }
37709           const params = { schema: d2.schema, id: d2.id };
37710           if (d2.newStatus) {
37711             params.st = d2.newStatus;
37712           }
37713           if (d2.newComment !== void 0) {
37714             params.co = d2.newComment;
37715           }
37716           const url = `${_krUrlRoot}/comment.php?` + utilQsString(params);
37717           const controller = new AbortController();
37718           _cache.inflightPost[d2.id] = controller;
37719           json_default(url, { signal: controller.signal }).finally(() => {
37720             delete _cache.inflightPost[d2.id];
37721             if (d2.newStatus === "ignore") {
37722               this.removeItem(d2);
37723             } else if (d2.newStatus === "ignore_t") {
37724               this.removeItem(d2);
37725               _cache.closed[`${d2.schema}:${d2.id}`] = true;
37726             } else {
37727               d2 = this.replaceItem(d2.update({
37728                 comment: d2.newComment,
37729                 newComment: void 0,
37730                 newState: void 0
37731               }));
37732             }
37733             if (callback) callback(null, d2);
37734           });
37735         },
37736         // Get all cached QAItems covering the viewport
37737         getItems(projection2) {
37738           const viewport = projection2.clipExtent();
37739           const min3 = [viewport[0][0], viewport[1][1]];
37740           const max3 = [viewport[1][0], viewport[0][1]];
37741           const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
37742           return _cache.rtree.search(bbox2).map((d2) => d2.data);
37743         },
37744         // Get a QAItem from cache
37745         // NOTE: Don't change method name until UI v3 is merged
37746         getError(id2) {
37747           return _cache.data[id2];
37748         },
37749         // Replace a single QAItem in the cache
37750         replaceItem(item) {
37751           if (!(item instanceof QAItem) || !item.id) return;
37752           _cache.data[item.id] = item;
37753           updateRtree(encodeIssueRtree(item), true);
37754           return item;
37755         },
37756         // Remove a single QAItem from the cache
37757         removeItem(item) {
37758           if (!(item instanceof QAItem) || !item.id) return;
37759           delete _cache.data[item.id];
37760           updateRtree(encodeIssueRtree(item), false);
37761         },
37762         issueURL(item) {
37763           return `${_krUrlRoot}/report_map.php?schema=${item.schema}&error=${item.id}`;
37764         },
37765         // Get an array of issues closed during this session.
37766         // Used to populate `closed:keepright` changeset tag
37767         getClosedIDs() {
37768           return Object.keys(_cache.closed).sort();
37769         }
37770       };
37771     }
37772   });
37773
37774   // node_modules/marked/lib/marked.esm.js
37775   function _getDefaults() {
37776     return {
37777       async: false,
37778       breaks: false,
37779       extensions: null,
37780       gfm: true,
37781       hooks: null,
37782       pedantic: false,
37783       renderer: null,
37784       silent: false,
37785       tokenizer: null,
37786       walkTokens: null
37787     };
37788   }
37789   function changeDefaults(newDefaults) {
37790     _defaults = newDefaults;
37791   }
37792   function edit(regex, opt = "") {
37793     let source = typeof regex === "string" ? regex : regex.source;
37794     const obj = {
37795       replace: (name, val) => {
37796         let valSource = typeof val === "string" ? val : val.source;
37797         valSource = valSource.replace(other.caret, "$1");
37798         source = source.replace(name, valSource);
37799         return obj;
37800       },
37801       getRegex: () => {
37802         return new RegExp(source, opt);
37803       }
37804     };
37805     return obj;
37806   }
37807   function escape4(html3, encode) {
37808     if (encode) {
37809       if (other.escapeTest.test(html3)) {
37810         return html3.replace(other.escapeReplace, getEscapeReplacement);
37811       }
37812     } else {
37813       if (other.escapeTestNoEncode.test(html3)) {
37814         return html3.replace(other.escapeReplaceNoEncode, getEscapeReplacement);
37815       }
37816     }
37817     return html3;
37818   }
37819   function cleanUrl(href) {
37820     try {
37821       href = encodeURI(href).replace(other.percentDecode, "%");
37822     } catch {
37823       return null;
37824     }
37825     return href;
37826   }
37827   function splitCells(tableRow, count) {
37828     var _a3;
37829     const row = tableRow.replace(other.findPipe, (match, offset, str) => {
37830       let escaped = false;
37831       let curr = offset;
37832       while (--curr >= 0 && str[curr] === "\\")
37833         escaped = !escaped;
37834       if (escaped) {
37835         return "|";
37836       } else {
37837         return " |";
37838       }
37839     }), cells = row.split(other.splitPipe);
37840     let i3 = 0;
37841     if (!cells[0].trim()) {
37842       cells.shift();
37843     }
37844     if (cells.length > 0 && !((_a3 = cells.at(-1)) == null ? void 0 : _a3.trim())) {
37845       cells.pop();
37846     }
37847     if (count) {
37848       if (cells.length > count) {
37849         cells.splice(count);
37850       } else {
37851         while (cells.length < count)
37852           cells.push("");
37853       }
37854     }
37855     for (; i3 < cells.length; i3++) {
37856       cells[i3] = cells[i3].trim().replace(other.slashPipe, "|");
37857     }
37858     return cells;
37859   }
37860   function rtrim(str, c2, invert) {
37861     const l2 = str.length;
37862     if (l2 === 0) {
37863       return "";
37864     }
37865     let suffLen = 0;
37866     while (suffLen < l2) {
37867       const currChar = str.charAt(l2 - suffLen - 1);
37868       if (currChar === c2 && true) {
37869         suffLen++;
37870       } else {
37871         break;
37872       }
37873     }
37874     return str.slice(0, l2 - suffLen);
37875   }
37876   function findClosingBracket(str, b2) {
37877     if (str.indexOf(b2[1]) === -1) {
37878       return -1;
37879     }
37880     let level = 0;
37881     for (let i3 = 0; i3 < str.length; i3++) {
37882       if (str[i3] === "\\") {
37883         i3++;
37884       } else if (str[i3] === b2[0]) {
37885         level++;
37886       } else if (str[i3] === b2[1]) {
37887         level--;
37888         if (level < 0) {
37889           return i3;
37890         }
37891       }
37892     }
37893     return -1;
37894   }
37895   function outputLink(cap, link3, raw, lexer2, rules) {
37896     const href = link3.href;
37897     const title = link3.title || null;
37898     const text = cap[1].replace(rules.other.outputLinkReplace, "$1");
37899     if (cap[0].charAt(0) !== "!") {
37900       lexer2.state.inLink = true;
37901       const token = {
37902         type: "link",
37903         raw,
37904         href,
37905         title,
37906         text,
37907         tokens: lexer2.inlineTokens(text)
37908       };
37909       lexer2.state.inLink = false;
37910       return token;
37911     }
37912     return {
37913       type: "image",
37914       raw,
37915       href,
37916       title,
37917       text
37918     };
37919   }
37920   function indentCodeCompensation(raw, text, rules) {
37921     const matchIndentToCode = raw.match(rules.other.indentCodeCompensation);
37922     if (matchIndentToCode === null) {
37923       return text;
37924     }
37925     const indentToCode = matchIndentToCode[1];
37926     return text.split("\n").map((node) => {
37927       const matchIndentInNode = node.match(rules.other.beginningSpace);
37928       if (matchIndentInNode === null) {
37929         return node;
37930       }
37931       const [indentInNode] = matchIndentInNode;
37932       if (indentInNode.length >= indentToCode.length) {
37933         return node.slice(indentToCode.length);
37934       }
37935       return node;
37936     }).join("\n");
37937   }
37938   function marked(src, opt) {
37939     return markedInstance.parse(src, opt);
37940   }
37941   var _defaults, noopTest, other, newline, blockCode, fences, hr, heading, bullet, lheadingCore, lheading, lheadingGfm, _paragraph, blockText, _blockLabel, def, list, _tag, _comment, html2, paragraph, blockquote, blockNormal, gfmTable, blockGfm, blockPedantic, escape$1, inlineCode, br, inlineText, _punctuation, _punctuationOrSpace, _notPunctuationOrSpace, punctuation, _punctuationGfmStrongEm, _punctuationOrSpaceGfmStrongEm, _notPunctuationOrSpaceGfmStrongEm, blockSkip, emStrongLDelimCore, emStrongLDelim, emStrongLDelimGfm, emStrongRDelimAstCore, emStrongRDelimAst, emStrongRDelimAstGfm, emStrongRDelimUnd, anyPunctuation, autolink, _inlineComment, tag, _inlineLabel, link2, reflink, nolink, reflinkSearch, inlineNormal, inlinePedantic, inlineGfm, inlineBreaks, block, inline, escapeReplacements, getEscapeReplacement, _Tokenizer, _Lexer, _Renderer, _TextRenderer, _Parser, _Hooks, Marked, markedInstance, options, setOptions, use, walkTokens, parseInline, parser2, lexer;
37942   var init_marked_esm = __esm({
37943     "node_modules/marked/lib/marked.esm.js"() {
37944       _defaults = _getDefaults();
37945       noopTest = { exec: () => null };
37946       other = {
37947         codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm,
37948         outputLinkReplace: /\\([\[\]])/g,
37949         indentCodeCompensation: /^(\s+)(?:```)/,
37950         beginningSpace: /^\s+/,
37951         endingHash: /#$/,
37952         startingSpaceChar: /^ /,
37953         endingSpaceChar: / $/,
37954         nonSpaceChar: /[^ ]/,
37955         newLineCharGlobal: /\n/g,
37956         tabCharGlobal: /\t/g,
37957         multipleSpaceGlobal: /\s+/g,
37958         blankLine: /^[ \t]*$/,
37959         doubleBlankLine: /\n[ \t]*\n[ \t]*$/,
37960         blockquoteStart: /^ {0,3}>/,
37961         blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g,
37962         blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm,
37963         listReplaceTabs: /^\t+/,
37964         listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g,
37965         listIsTask: /^\[[ xX]\] /,
37966         listReplaceTask: /^\[[ xX]\] +/,
37967         anyLine: /\n.*\n/,
37968         hrefBrackets: /^<(.*)>$/,
37969         tableDelimiter: /[:|]/,
37970         tableAlignChars: /^\||\| *$/g,
37971         tableRowBlankLine: /\n[ \t]*$/,
37972         tableAlignRight: /^ *-+: *$/,
37973         tableAlignCenter: /^ *:-+: *$/,
37974         tableAlignLeft: /^ *:-+ *$/,
37975         startATag: /^<a /i,
37976         endATag: /^<\/a>/i,
37977         startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i,
37978         endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i,
37979         startAngleBracket: /^</,
37980         endAngleBracket: />$/,
37981         pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/,
37982         unicodeAlphaNumeric: /[\p{L}\p{N}]/u,
37983         escapeTest: /[&<>"']/,
37984         escapeReplace: /[&<>"']/g,
37985         escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,
37986         escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,
37987         unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,
37988         caret: /(^|[^\[])\^/g,
37989         percentDecode: /%25/g,
37990         findPipe: /\|/g,
37991         splitPipe: / \|/,
37992         slashPipe: /\\\|/g,
37993         carriageReturn: /\r\n|\r/g,
37994         spaceLine: /^ +$/gm,
37995         notSpaceStart: /^\S*/,
37996         endingNewline: /\n$/,
37997         listItemRegex: (bull) => new RegExp(`^( {0,3}${bull})((?:[       ][^\\n]*)?(?:\\n|$))`),
37998         nextBulletRegex: (indent) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[    ][^\\n]*)?(?:\\n|$))`),
37999         hrRegex: (indent) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),
38000         fencesBeginRegex: (indent) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:\`\`\`|~~~)`),
38001         headingBeginRegex: (indent) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}#`),
38002         htmlBeginRegex: (indent) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}<(?:[a-z].*>|!--)`, "i")
38003       };
38004       newline = /^(?:[ \t]*(?:\n|$))+/;
38005       blockCode = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/;
38006       fences = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;
38007       hr = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
38008       heading = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
38009       bullet = /(?:[*+-]|\d{1,9}[.)])/;
38010       lheadingCore = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/;
38011       lheading = edit(lheadingCore).replace(/bull/g, bullet).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();
38012       lheadingGfm = edit(lheadingCore).replace(/bull/g, bullet).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();
38013       _paragraph = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/;
38014       blockText = /^[^\n]+/;
38015       _blockLabel = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
38016       def = edit(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", _blockLabel).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();
38017       list = edit(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, bullet).getRegex();
38018       _tag = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
38019       _comment = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
38020       html2 = edit("^ {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", _comment).replace("tag", _tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
38021       paragraph = edit(_paragraph).replace("hr", hr).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", _tag).getRegex();
38022       blockquote = edit(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", paragraph).getRegex();
38023       blockNormal = {
38024         blockquote,
38025         code: blockCode,
38026         def,
38027         fences,
38028         heading,
38029         hr,
38030         html: html2,
38031         lheading,
38032         list,
38033         newline,
38034         paragraph,
38035         table: noopTest,
38036         text: blockText
38037       };
38038       gfmTable = edit("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", hr).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", _tag).getRegex();
38039       blockGfm = {
38040         ...blockNormal,
38041         lheading: lheadingGfm,
38042         table: gfmTable,
38043         paragraph: edit(_paragraph).replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", gfmTable).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", _tag).getRegex()
38044       };
38045       blockPedantic = {
38046         ...blockNormal,
38047         html: edit(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", _comment).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
38048         def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
38049         heading: /^(#{1,6})(.*)(?:\n+|$)/,
38050         fences: noopTest,
38051         // fences not supported
38052         lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
38053         paragraph: edit(_paragraph).replace("hr", hr).replace("heading", " *#{1,6} *[^\n]").replace("lheading", lheading).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
38054       };
38055       escape$1 = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;
38056       inlineCode = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
38057       br = /^( {2,}|\\)\n(?!\s*$)/;
38058       inlineText = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
38059       _punctuation = /[\p{P}\p{S}]/u;
38060       _punctuationOrSpace = /[\s\p{P}\p{S}]/u;
38061       _notPunctuationOrSpace = /[^\s\p{P}\p{S}]/u;
38062       punctuation = edit(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, _punctuationOrSpace).getRegex();
38063       _punctuationGfmStrongEm = /(?!~)[\p{P}\p{S}]/u;
38064       _punctuationOrSpaceGfmStrongEm = /(?!~)[\s\p{P}\p{S}]/u;
38065       _notPunctuationOrSpaceGfmStrongEm = /(?:[^\s\p{P}\p{S}]|~)/u;
38066       blockSkip = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g;
38067       emStrongLDelimCore = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/;
38068       emStrongLDelim = edit(emStrongLDelimCore, "u").replace(/punct/g, _punctuation).getRegex();
38069       emStrongLDelimGfm = edit(emStrongLDelimCore, "u").replace(/punct/g, _punctuationGfmStrongEm).getRegex();
38070       emStrongRDelimAstCore = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)";
38071       emStrongRDelimAst = edit(emStrongRDelimAstCore, "gu").replace(/notPunctSpace/g, _notPunctuationOrSpace).replace(/punctSpace/g, _punctuationOrSpace).replace(/punct/g, _punctuation).getRegex();
38072       emStrongRDelimAstGfm = edit(emStrongRDelimAstCore, "gu").replace(/notPunctSpace/g, _notPunctuationOrSpaceGfmStrongEm).replace(/punctSpace/g, _punctuationOrSpaceGfmStrongEm).replace(/punct/g, _punctuationGfmStrongEm).getRegex();
38073       emStrongRDelimUnd = edit("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, _notPunctuationOrSpace).replace(/punctSpace/g, _punctuationOrSpace).replace(/punct/g, _punctuation).getRegex();
38074       anyPunctuation = edit(/\\(punct)/, "gu").replace(/punct/g, _punctuation).getRegex();
38075       autolink = edit(/^<(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();
38076       _inlineComment = edit(_comment).replace("(?:-->|$)", "-->").getRegex();
38077       tag = edit("^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", _inlineComment).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();
38078       _inlineLabel = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
38079       link2 = edit(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label", _inlineLabel).replace("href", /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex();
38080       reflink = edit(/^!?\[(label)\]\[(ref)\]/).replace("label", _inlineLabel).replace("ref", _blockLabel).getRegex();
38081       nolink = edit(/^!?\[(ref)\](?:\[\])?/).replace("ref", _blockLabel).getRegex();
38082       reflinkSearch = edit("reflink|nolink(?!\\()", "g").replace("reflink", reflink).replace("nolink", nolink).getRegex();
38083       inlineNormal = {
38084         _backpedal: noopTest,
38085         // only used for GFM url
38086         anyPunctuation,
38087         autolink,
38088         blockSkip,
38089         br,
38090         code: inlineCode,
38091         del: noopTest,
38092         emStrongLDelim,
38093         emStrongRDelimAst,
38094         emStrongRDelimUnd,
38095         escape: escape$1,
38096         link: link2,
38097         nolink,
38098         punctuation,
38099         reflink,
38100         reflinkSearch,
38101         tag,
38102         text: inlineText,
38103         url: noopTest
38104       };
38105       inlinePedantic = {
38106         ...inlineNormal,
38107         link: edit(/^!?\[(label)\]\((.*?)\)/).replace("label", _inlineLabel).getRegex(),
38108         reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", _inlineLabel).getRegex()
38109       };
38110       inlineGfm = {
38111         ...inlineNormal,
38112         emStrongRDelimAst: emStrongRDelimAstGfm,
38113         emStrongLDelim: emStrongLDelimGfm,
38114         url: edit(/^((?: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(),
38115         _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
38116         del: /^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,
38117         text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
38118       };
38119       inlineBreaks = {
38120         ...inlineGfm,
38121         br: edit(br).replace("{2,}", "*").getRegex(),
38122         text: edit(inlineGfm.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
38123       };
38124       block = {
38125         normal: blockNormal,
38126         gfm: blockGfm,
38127         pedantic: blockPedantic
38128       };
38129       inline = {
38130         normal: inlineNormal,
38131         gfm: inlineGfm,
38132         breaks: inlineBreaks,
38133         pedantic: inlinePedantic
38134       };
38135       escapeReplacements = {
38136         "&": "&amp;",
38137         "<": "&lt;",
38138         ">": "&gt;",
38139         '"': "&quot;",
38140         "'": "&#39;"
38141       };
38142       getEscapeReplacement = (ch) => escapeReplacements[ch];
38143       _Tokenizer = class {
38144         // set by the lexer
38145         constructor(options2) {
38146           __publicField(this, "options");
38147           __publicField(this, "rules");
38148           // set by the lexer
38149           __publicField(this, "lexer");
38150           this.options = options2 || _defaults;
38151         }
38152         space(src) {
38153           const cap = this.rules.block.newline.exec(src);
38154           if (cap && cap[0].length > 0) {
38155             return {
38156               type: "space",
38157               raw: cap[0]
38158             };
38159           }
38160         }
38161         code(src) {
38162           const cap = this.rules.block.code.exec(src);
38163           if (cap) {
38164             const text = cap[0].replace(this.rules.other.codeRemoveIndent, "");
38165             return {
38166               type: "code",
38167               raw: cap[0],
38168               codeBlockStyle: "indented",
38169               text: !this.options.pedantic ? rtrim(text, "\n") : text
38170             };
38171           }
38172         }
38173         fences(src) {
38174           const cap = this.rules.block.fences.exec(src);
38175           if (cap) {
38176             const raw = cap[0];
38177             const text = indentCodeCompensation(raw, cap[3] || "", this.rules);
38178             return {
38179               type: "code",
38180               raw,
38181               lang: cap[2] ? cap[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : cap[2],
38182               text
38183             };
38184           }
38185         }
38186         heading(src) {
38187           const cap = this.rules.block.heading.exec(src);
38188           if (cap) {
38189             let text = cap[2].trim();
38190             if (this.rules.other.endingHash.test(text)) {
38191               const trimmed = rtrim(text, "#");
38192               if (this.options.pedantic) {
38193                 text = trimmed.trim();
38194               } else if (!trimmed || this.rules.other.endingSpaceChar.test(trimmed)) {
38195                 text = trimmed.trim();
38196               }
38197             }
38198             return {
38199               type: "heading",
38200               raw: cap[0],
38201               depth: cap[1].length,
38202               text,
38203               tokens: this.lexer.inline(text)
38204             };
38205           }
38206         }
38207         hr(src) {
38208           const cap = this.rules.block.hr.exec(src);
38209           if (cap) {
38210             return {
38211               type: "hr",
38212               raw: rtrim(cap[0], "\n")
38213             };
38214           }
38215         }
38216         blockquote(src) {
38217           const cap = this.rules.block.blockquote.exec(src);
38218           if (cap) {
38219             let lines = rtrim(cap[0], "\n").split("\n");
38220             let raw = "";
38221             let text = "";
38222             const tokens = [];
38223             while (lines.length > 0) {
38224               let inBlockquote = false;
38225               const currentLines = [];
38226               let i3;
38227               for (i3 = 0; i3 < lines.length; i3++) {
38228                 if (this.rules.other.blockquoteStart.test(lines[i3])) {
38229                   currentLines.push(lines[i3]);
38230                   inBlockquote = true;
38231                 } else if (!inBlockquote) {
38232                   currentLines.push(lines[i3]);
38233                 } else {
38234                   break;
38235                 }
38236               }
38237               lines = lines.slice(i3);
38238               const currentRaw = currentLines.join("\n");
38239               const currentText = currentRaw.replace(this.rules.other.blockquoteSetextReplace, "\n    $1").replace(this.rules.other.blockquoteSetextReplace2, "");
38240               raw = raw ? `${raw}
38241 ${currentRaw}` : currentRaw;
38242               text = text ? `${text}
38243 ${currentText}` : currentText;
38244               const top = this.lexer.state.top;
38245               this.lexer.state.top = true;
38246               this.lexer.blockTokens(currentText, tokens, true);
38247               this.lexer.state.top = top;
38248               if (lines.length === 0) {
38249                 break;
38250               }
38251               const lastToken = tokens.at(-1);
38252               if ((lastToken == null ? void 0 : lastToken.type) === "code") {
38253                 break;
38254               } else if ((lastToken == null ? void 0 : lastToken.type) === "blockquote") {
38255                 const oldToken = lastToken;
38256                 const newText = oldToken.raw + "\n" + lines.join("\n");
38257                 const newToken = this.blockquote(newText);
38258                 tokens[tokens.length - 1] = newToken;
38259                 raw = raw.substring(0, raw.length - oldToken.raw.length) + newToken.raw;
38260                 text = text.substring(0, text.length - oldToken.text.length) + newToken.text;
38261                 break;
38262               } else if ((lastToken == null ? void 0 : lastToken.type) === "list") {
38263                 const oldToken = lastToken;
38264                 const newText = oldToken.raw + "\n" + lines.join("\n");
38265                 const newToken = this.list(newText);
38266                 tokens[tokens.length - 1] = newToken;
38267                 raw = raw.substring(0, raw.length - lastToken.raw.length) + newToken.raw;
38268                 text = text.substring(0, text.length - oldToken.raw.length) + newToken.raw;
38269                 lines = newText.substring(tokens.at(-1).raw.length).split("\n");
38270                 continue;
38271               }
38272             }
38273             return {
38274               type: "blockquote",
38275               raw,
38276               tokens,
38277               text
38278             };
38279           }
38280         }
38281         list(src) {
38282           let cap = this.rules.block.list.exec(src);
38283           if (cap) {
38284             let bull = cap[1].trim();
38285             const isordered = bull.length > 1;
38286             const list2 = {
38287               type: "list",
38288               raw: "",
38289               ordered: isordered,
38290               start: isordered ? +bull.slice(0, -1) : "",
38291               loose: false,
38292               items: []
38293             };
38294             bull = isordered ? `\\d{1,9}\\${bull.slice(-1)}` : `\\${bull}`;
38295             if (this.options.pedantic) {
38296               bull = isordered ? bull : "[*+-]";
38297             }
38298             const itemRegex = this.rules.other.listItemRegex(bull);
38299             let endsWithBlankLine = false;
38300             while (src) {
38301               let endEarly = false;
38302               let raw = "";
38303               let itemContents = "";
38304               if (!(cap = itemRegex.exec(src))) {
38305                 break;
38306               }
38307               if (this.rules.block.hr.test(src)) {
38308                 break;
38309               }
38310               raw = cap[0];
38311               src = src.substring(raw.length);
38312               let line = cap[2].split("\n", 1)[0].replace(this.rules.other.listReplaceTabs, (t2) => " ".repeat(3 * t2.length));
38313               let nextLine = src.split("\n", 1)[0];
38314               let blankLine = !line.trim();
38315               let indent = 0;
38316               if (this.options.pedantic) {
38317                 indent = 2;
38318                 itemContents = line.trimStart();
38319               } else if (blankLine) {
38320                 indent = cap[1].length + 1;
38321               } else {
38322                 indent = cap[2].search(this.rules.other.nonSpaceChar);
38323                 indent = indent > 4 ? 1 : indent;
38324                 itemContents = line.slice(indent);
38325                 indent += cap[1].length;
38326               }
38327               if (blankLine && this.rules.other.blankLine.test(nextLine)) {
38328                 raw += nextLine + "\n";
38329                 src = src.substring(nextLine.length + 1);
38330                 endEarly = true;
38331               }
38332               if (!endEarly) {
38333                 const nextBulletRegex = this.rules.other.nextBulletRegex(indent);
38334                 const hrRegex = this.rules.other.hrRegex(indent);
38335                 const fencesBeginRegex = this.rules.other.fencesBeginRegex(indent);
38336                 const headingBeginRegex = this.rules.other.headingBeginRegex(indent);
38337                 const htmlBeginRegex = this.rules.other.htmlBeginRegex(indent);
38338                 while (src) {
38339                   const rawLine = src.split("\n", 1)[0];
38340                   let nextLineWithoutTabs;
38341                   nextLine = rawLine;
38342                   if (this.options.pedantic) {
38343                     nextLine = nextLine.replace(this.rules.other.listReplaceNesting, "  ");
38344                     nextLineWithoutTabs = nextLine;
38345                   } else {
38346                     nextLineWithoutTabs = nextLine.replace(this.rules.other.tabCharGlobal, "    ");
38347                   }
38348                   if (fencesBeginRegex.test(nextLine)) {
38349                     break;
38350                   }
38351                   if (headingBeginRegex.test(nextLine)) {
38352                     break;
38353                   }
38354                   if (htmlBeginRegex.test(nextLine)) {
38355                     break;
38356                   }
38357                   if (nextBulletRegex.test(nextLine)) {
38358                     break;
38359                   }
38360                   if (hrRegex.test(nextLine)) {
38361                     break;
38362                   }
38363                   if (nextLineWithoutTabs.search(this.rules.other.nonSpaceChar) >= indent || !nextLine.trim()) {
38364                     itemContents += "\n" + nextLineWithoutTabs.slice(indent);
38365                   } else {
38366                     if (blankLine) {
38367                       break;
38368                     }
38369                     if (line.replace(this.rules.other.tabCharGlobal, "    ").search(this.rules.other.nonSpaceChar) >= 4) {
38370                       break;
38371                     }
38372                     if (fencesBeginRegex.test(line)) {
38373                       break;
38374                     }
38375                     if (headingBeginRegex.test(line)) {
38376                       break;
38377                     }
38378                     if (hrRegex.test(line)) {
38379                       break;
38380                     }
38381                     itemContents += "\n" + nextLine;
38382                   }
38383                   if (!blankLine && !nextLine.trim()) {
38384                     blankLine = true;
38385                   }
38386                   raw += rawLine + "\n";
38387                   src = src.substring(rawLine.length + 1);
38388                   line = nextLineWithoutTabs.slice(indent);
38389                 }
38390               }
38391               if (!list2.loose) {
38392                 if (endsWithBlankLine) {
38393                   list2.loose = true;
38394                 } else if (this.rules.other.doubleBlankLine.test(raw)) {
38395                   endsWithBlankLine = true;
38396                 }
38397               }
38398               let istask = null;
38399               let ischecked;
38400               if (this.options.gfm) {
38401                 istask = this.rules.other.listIsTask.exec(itemContents);
38402                 if (istask) {
38403                   ischecked = istask[0] !== "[ ] ";
38404                   itemContents = itemContents.replace(this.rules.other.listReplaceTask, "");
38405                 }
38406               }
38407               list2.items.push({
38408                 type: "list_item",
38409                 raw,
38410                 task: !!istask,
38411                 checked: ischecked,
38412                 loose: false,
38413                 text: itemContents,
38414                 tokens: []
38415               });
38416               list2.raw += raw;
38417             }
38418             const lastItem = list2.items.at(-1);
38419             if (lastItem) {
38420               lastItem.raw = lastItem.raw.trimEnd();
38421               lastItem.text = lastItem.text.trimEnd();
38422             } else {
38423               return;
38424             }
38425             list2.raw = list2.raw.trimEnd();
38426             for (let i3 = 0; i3 < list2.items.length; i3++) {
38427               this.lexer.state.top = false;
38428               list2.items[i3].tokens = this.lexer.blockTokens(list2.items[i3].text, []);
38429               if (!list2.loose) {
38430                 const spacers = list2.items[i3].tokens.filter((t2) => t2.type === "space");
38431                 const hasMultipleLineBreaks = spacers.length > 0 && spacers.some((t2) => this.rules.other.anyLine.test(t2.raw));
38432                 list2.loose = hasMultipleLineBreaks;
38433               }
38434             }
38435             if (list2.loose) {
38436               for (let i3 = 0; i3 < list2.items.length; i3++) {
38437                 list2.items[i3].loose = true;
38438               }
38439             }
38440             return list2;
38441           }
38442         }
38443         html(src) {
38444           const cap = this.rules.block.html.exec(src);
38445           if (cap) {
38446             const token = {
38447               type: "html",
38448               block: true,
38449               raw: cap[0],
38450               pre: cap[1] === "pre" || cap[1] === "script" || cap[1] === "style",
38451               text: cap[0]
38452             };
38453             return token;
38454           }
38455         }
38456         def(src) {
38457           const cap = this.rules.block.def.exec(src);
38458           if (cap) {
38459             const tag2 = cap[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " ");
38460             const href = cap[2] ? cap[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "";
38461             const title = cap[3] ? cap[3].substring(1, cap[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : cap[3];
38462             return {
38463               type: "def",
38464               tag: tag2,
38465               raw: cap[0],
38466               href,
38467               title
38468             };
38469           }
38470         }
38471         table(src) {
38472           var _a3;
38473           const cap = this.rules.block.table.exec(src);
38474           if (!cap) {
38475             return;
38476           }
38477           if (!this.rules.other.tableDelimiter.test(cap[2])) {
38478             return;
38479           }
38480           const headers = splitCells(cap[1]);
38481           const aligns = cap[2].replace(this.rules.other.tableAlignChars, "").split("|");
38482           const rows = ((_a3 = cap[3]) == null ? void 0 : _a3.trim()) ? cap[3].replace(this.rules.other.tableRowBlankLine, "").split("\n") : [];
38483           const item = {
38484             type: "table",
38485             raw: cap[0],
38486             header: [],
38487             align: [],
38488             rows: []
38489           };
38490           if (headers.length !== aligns.length) {
38491             return;
38492           }
38493           for (const align of aligns) {
38494             if (this.rules.other.tableAlignRight.test(align)) {
38495               item.align.push("right");
38496             } else if (this.rules.other.tableAlignCenter.test(align)) {
38497               item.align.push("center");
38498             } else if (this.rules.other.tableAlignLeft.test(align)) {
38499               item.align.push("left");
38500             } else {
38501               item.align.push(null);
38502             }
38503           }
38504           for (let i3 = 0; i3 < headers.length; i3++) {
38505             item.header.push({
38506               text: headers[i3],
38507               tokens: this.lexer.inline(headers[i3]),
38508               header: true,
38509               align: item.align[i3]
38510             });
38511           }
38512           for (const row of rows) {
38513             item.rows.push(splitCells(row, item.header.length).map((cell, i3) => {
38514               return {
38515                 text: cell,
38516                 tokens: this.lexer.inline(cell),
38517                 header: false,
38518                 align: item.align[i3]
38519               };
38520             }));
38521           }
38522           return item;
38523         }
38524         lheading(src) {
38525           const cap = this.rules.block.lheading.exec(src);
38526           if (cap) {
38527             return {
38528               type: "heading",
38529               raw: cap[0],
38530               depth: cap[2].charAt(0) === "=" ? 1 : 2,
38531               text: cap[1],
38532               tokens: this.lexer.inline(cap[1])
38533             };
38534           }
38535         }
38536         paragraph(src) {
38537           const cap = this.rules.block.paragraph.exec(src);
38538           if (cap) {
38539             const text = cap[1].charAt(cap[1].length - 1) === "\n" ? cap[1].slice(0, -1) : cap[1];
38540             return {
38541               type: "paragraph",
38542               raw: cap[0],
38543               text,
38544               tokens: this.lexer.inline(text)
38545             };
38546           }
38547         }
38548         text(src) {
38549           const cap = this.rules.block.text.exec(src);
38550           if (cap) {
38551             return {
38552               type: "text",
38553               raw: cap[0],
38554               text: cap[0],
38555               tokens: this.lexer.inline(cap[0])
38556             };
38557           }
38558         }
38559         escape(src) {
38560           const cap = this.rules.inline.escape.exec(src);
38561           if (cap) {
38562             return {
38563               type: "escape",
38564               raw: cap[0],
38565               text: cap[1]
38566             };
38567           }
38568         }
38569         tag(src) {
38570           const cap = this.rules.inline.tag.exec(src);
38571           if (cap) {
38572             if (!this.lexer.state.inLink && this.rules.other.startATag.test(cap[0])) {
38573               this.lexer.state.inLink = true;
38574             } else if (this.lexer.state.inLink && this.rules.other.endATag.test(cap[0])) {
38575               this.lexer.state.inLink = false;
38576             }
38577             if (!this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(cap[0])) {
38578               this.lexer.state.inRawBlock = true;
38579             } else if (this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(cap[0])) {
38580               this.lexer.state.inRawBlock = false;
38581             }
38582             return {
38583               type: "html",
38584               raw: cap[0],
38585               inLink: this.lexer.state.inLink,
38586               inRawBlock: this.lexer.state.inRawBlock,
38587               block: false,
38588               text: cap[0]
38589             };
38590           }
38591         }
38592         link(src) {
38593           const cap = this.rules.inline.link.exec(src);
38594           if (cap) {
38595             const trimmedUrl = cap[2].trim();
38596             if (!this.options.pedantic && this.rules.other.startAngleBracket.test(trimmedUrl)) {
38597               if (!this.rules.other.endAngleBracket.test(trimmedUrl)) {
38598                 return;
38599               }
38600               const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), "\\");
38601               if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
38602                 return;
38603               }
38604             } else {
38605               const lastParenIndex = findClosingBracket(cap[2], "()");
38606               if (lastParenIndex > -1) {
38607                 const start2 = cap[0].indexOf("!") === 0 ? 5 : 4;
38608                 const linkLen = start2 + cap[1].length + lastParenIndex;
38609                 cap[2] = cap[2].substring(0, lastParenIndex);
38610                 cap[0] = cap[0].substring(0, linkLen).trim();
38611                 cap[3] = "";
38612               }
38613             }
38614             let href = cap[2];
38615             let title = "";
38616             if (this.options.pedantic) {
38617               const link3 = this.rules.other.pedanticHrefTitle.exec(href);
38618               if (link3) {
38619                 href = link3[1];
38620                 title = link3[3];
38621               }
38622             } else {
38623               title = cap[3] ? cap[3].slice(1, -1) : "";
38624             }
38625             href = href.trim();
38626             if (this.rules.other.startAngleBracket.test(href)) {
38627               if (this.options.pedantic && !this.rules.other.endAngleBracket.test(trimmedUrl)) {
38628                 href = href.slice(1);
38629               } else {
38630                 href = href.slice(1, -1);
38631               }
38632             }
38633             return outputLink(cap, {
38634               href: href ? href.replace(this.rules.inline.anyPunctuation, "$1") : href,
38635               title: title ? title.replace(this.rules.inline.anyPunctuation, "$1") : title
38636             }, cap[0], this.lexer, this.rules);
38637           }
38638         }
38639         reflink(src, links) {
38640           let cap;
38641           if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) {
38642             const linkString = (cap[2] || cap[1]).replace(this.rules.other.multipleSpaceGlobal, " ");
38643             const link3 = links[linkString.toLowerCase()];
38644             if (!link3) {
38645               const text = cap[0].charAt(0);
38646               return {
38647                 type: "text",
38648                 raw: text,
38649                 text
38650               };
38651             }
38652             return outputLink(cap, link3, cap[0], this.lexer, this.rules);
38653           }
38654         }
38655         emStrong(src, maskedSrc, prevChar = "") {
38656           let match = this.rules.inline.emStrongLDelim.exec(src);
38657           if (!match)
38658             return;
38659           if (match[3] && prevChar.match(this.rules.other.unicodeAlphaNumeric))
38660             return;
38661           const nextChar = match[1] || match[2] || "";
38662           if (!nextChar || !prevChar || this.rules.inline.punctuation.exec(prevChar)) {
38663             const lLength = [...match[0]].length - 1;
38664             let rDelim, rLength, delimTotal = lLength, midDelimTotal = 0;
38665             const endReg = match[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
38666             endReg.lastIndex = 0;
38667             maskedSrc = maskedSrc.slice(-1 * src.length + lLength);
38668             while ((match = endReg.exec(maskedSrc)) != null) {
38669               rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
38670               if (!rDelim)
38671                 continue;
38672               rLength = [...rDelim].length;
38673               if (match[3] || match[4]) {
38674                 delimTotal += rLength;
38675                 continue;
38676               } else if (match[5] || match[6]) {
38677                 if (lLength % 3 && !((lLength + rLength) % 3)) {
38678                   midDelimTotal += rLength;
38679                   continue;
38680                 }
38681               }
38682               delimTotal -= rLength;
38683               if (delimTotal > 0)
38684                 continue;
38685               rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
38686               const lastCharLength = [...match[0]][0].length;
38687               const raw = src.slice(0, lLength + match.index + lastCharLength + rLength);
38688               if (Math.min(lLength, rLength) % 2) {
38689                 const text2 = raw.slice(1, -1);
38690                 return {
38691                   type: "em",
38692                   raw,
38693                   text: text2,
38694                   tokens: this.lexer.inlineTokens(text2)
38695                 };
38696               }
38697               const text = raw.slice(2, -2);
38698               return {
38699                 type: "strong",
38700                 raw,
38701                 text,
38702                 tokens: this.lexer.inlineTokens(text)
38703               };
38704             }
38705           }
38706         }
38707         codespan(src) {
38708           const cap = this.rules.inline.code.exec(src);
38709           if (cap) {
38710             let text = cap[2].replace(this.rules.other.newLineCharGlobal, " ");
38711             const hasNonSpaceChars = this.rules.other.nonSpaceChar.test(text);
38712             const hasSpaceCharsOnBothEnds = this.rules.other.startingSpaceChar.test(text) && this.rules.other.endingSpaceChar.test(text);
38713             if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
38714               text = text.substring(1, text.length - 1);
38715             }
38716             return {
38717               type: "codespan",
38718               raw: cap[0],
38719               text
38720             };
38721           }
38722         }
38723         br(src) {
38724           const cap = this.rules.inline.br.exec(src);
38725           if (cap) {
38726             return {
38727               type: "br",
38728               raw: cap[0]
38729             };
38730           }
38731         }
38732         del(src) {
38733           const cap = this.rules.inline.del.exec(src);
38734           if (cap) {
38735             return {
38736               type: "del",
38737               raw: cap[0],
38738               text: cap[2],
38739               tokens: this.lexer.inlineTokens(cap[2])
38740             };
38741           }
38742         }
38743         autolink(src) {
38744           const cap = this.rules.inline.autolink.exec(src);
38745           if (cap) {
38746             let text, href;
38747             if (cap[2] === "@") {
38748               text = cap[1];
38749               href = "mailto:" + text;
38750             } else {
38751               text = cap[1];
38752               href = text;
38753             }
38754             return {
38755               type: "link",
38756               raw: cap[0],
38757               text,
38758               href,
38759               tokens: [
38760                 {
38761                   type: "text",
38762                   raw: text,
38763                   text
38764                 }
38765               ]
38766             };
38767           }
38768         }
38769         url(src) {
38770           var _a3, _b2;
38771           let cap;
38772           if (cap = this.rules.inline.url.exec(src)) {
38773             let text, href;
38774             if (cap[2] === "@") {
38775               text = cap[0];
38776               href = "mailto:" + text;
38777             } else {
38778               let prevCapZero;
38779               do {
38780                 prevCapZero = cap[0];
38781                 cap[0] = (_b2 = (_a3 = this.rules.inline._backpedal.exec(cap[0])) == null ? void 0 : _a3[0]) != null ? _b2 : "";
38782               } while (prevCapZero !== cap[0]);
38783               text = cap[0];
38784               if (cap[1] === "www.") {
38785                 href = "http://" + cap[0];
38786               } else {
38787                 href = cap[0];
38788               }
38789             }
38790             return {
38791               type: "link",
38792               raw: cap[0],
38793               text,
38794               href,
38795               tokens: [
38796                 {
38797                   type: "text",
38798                   raw: text,
38799                   text
38800                 }
38801               ]
38802             };
38803           }
38804         }
38805         inlineText(src) {
38806           const cap = this.rules.inline.text.exec(src);
38807           if (cap) {
38808             const escaped = this.lexer.state.inRawBlock;
38809             return {
38810               type: "text",
38811               raw: cap[0],
38812               text: cap[0],
38813               escaped
38814             };
38815           }
38816         }
38817       };
38818       _Lexer = class __Lexer {
38819         constructor(options2) {
38820           __publicField(this, "tokens");
38821           __publicField(this, "options");
38822           __publicField(this, "state");
38823           __publicField(this, "tokenizer");
38824           __publicField(this, "inlineQueue");
38825           this.tokens = [];
38826           this.tokens.links = /* @__PURE__ */ Object.create(null);
38827           this.options = options2 || _defaults;
38828           this.options.tokenizer = this.options.tokenizer || new _Tokenizer();
38829           this.tokenizer = this.options.tokenizer;
38830           this.tokenizer.options = this.options;
38831           this.tokenizer.lexer = this;
38832           this.inlineQueue = [];
38833           this.state = {
38834             inLink: false,
38835             inRawBlock: false,
38836             top: true
38837           };
38838           const rules = {
38839             other,
38840             block: block.normal,
38841             inline: inline.normal
38842           };
38843           if (this.options.pedantic) {
38844             rules.block = block.pedantic;
38845             rules.inline = inline.pedantic;
38846           } else if (this.options.gfm) {
38847             rules.block = block.gfm;
38848             if (this.options.breaks) {
38849               rules.inline = inline.breaks;
38850             } else {
38851               rules.inline = inline.gfm;
38852             }
38853           }
38854           this.tokenizer.rules = rules;
38855         }
38856         /**
38857          * Expose Rules
38858          */
38859         static get rules() {
38860           return {
38861             block,
38862             inline
38863           };
38864         }
38865         /**
38866          * Static Lex Method
38867          */
38868         static lex(src, options2) {
38869           const lexer2 = new __Lexer(options2);
38870           return lexer2.lex(src);
38871         }
38872         /**
38873          * Static Lex Inline Method
38874          */
38875         static lexInline(src, options2) {
38876           const lexer2 = new __Lexer(options2);
38877           return lexer2.inlineTokens(src);
38878         }
38879         /**
38880          * Preprocessing
38881          */
38882         lex(src) {
38883           src = src.replace(other.carriageReturn, "\n");
38884           this.blockTokens(src, this.tokens);
38885           for (let i3 = 0; i3 < this.inlineQueue.length; i3++) {
38886             const next = this.inlineQueue[i3];
38887             this.inlineTokens(next.src, next.tokens);
38888           }
38889           this.inlineQueue = [];
38890           return this.tokens;
38891         }
38892         blockTokens(src, tokens = [], lastParagraphClipped = false) {
38893           var _a3, _b2, _c;
38894           if (this.options.pedantic) {
38895             src = src.replace(other.tabCharGlobal, "    ").replace(other.spaceLine, "");
38896           }
38897           while (src) {
38898             let token;
38899             if ((_b2 = (_a3 = this.options.extensions) == null ? void 0 : _a3.block) == null ? void 0 : _b2.some((extTokenizer) => {
38900               if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
38901                 src = src.substring(token.raw.length);
38902                 tokens.push(token);
38903                 return true;
38904               }
38905               return false;
38906             })) {
38907               continue;
38908             }
38909             if (token = this.tokenizer.space(src)) {
38910               src = src.substring(token.raw.length);
38911               const lastToken = tokens.at(-1);
38912               if (token.raw.length === 1 && lastToken !== void 0) {
38913                 lastToken.raw += "\n";
38914               } else {
38915                 tokens.push(token);
38916               }
38917               continue;
38918             }
38919             if (token = this.tokenizer.code(src)) {
38920               src = src.substring(token.raw.length);
38921               const lastToken = tokens.at(-1);
38922               if ((lastToken == null ? void 0 : lastToken.type) === "paragraph" || (lastToken == null ? void 0 : lastToken.type) === "text") {
38923                 lastToken.raw += "\n" + token.raw;
38924                 lastToken.text += "\n" + token.text;
38925                 this.inlineQueue.at(-1).src = lastToken.text;
38926               } else {
38927                 tokens.push(token);
38928               }
38929               continue;
38930             }
38931             if (token = this.tokenizer.fences(src)) {
38932               src = src.substring(token.raw.length);
38933               tokens.push(token);
38934               continue;
38935             }
38936             if (token = this.tokenizer.heading(src)) {
38937               src = src.substring(token.raw.length);
38938               tokens.push(token);
38939               continue;
38940             }
38941             if (token = this.tokenizer.hr(src)) {
38942               src = src.substring(token.raw.length);
38943               tokens.push(token);
38944               continue;
38945             }
38946             if (token = this.tokenizer.blockquote(src)) {
38947               src = src.substring(token.raw.length);
38948               tokens.push(token);
38949               continue;
38950             }
38951             if (token = this.tokenizer.list(src)) {
38952               src = src.substring(token.raw.length);
38953               tokens.push(token);
38954               continue;
38955             }
38956             if (token = this.tokenizer.html(src)) {
38957               src = src.substring(token.raw.length);
38958               tokens.push(token);
38959               continue;
38960             }
38961             if (token = this.tokenizer.def(src)) {
38962               src = src.substring(token.raw.length);
38963               const lastToken = tokens.at(-1);
38964               if ((lastToken == null ? void 0 : lastToken.type) === "paragraph" || (lastToken == null ? void 0 : lastToken.type) === "text") {
38965                 lastToken.raw += "\n" + token.raw;
38966                 lastToken.text += "\n" + token.raw;
38967                 this.inlineQueue.at(-1).src = lastToken.text;
38968               } else if (!this.tokens.links[token.tag]) {
38969                 this.tokens.links[token.tag] = {
38970                   href: token.href,
38971                   title: token.title
38972                 };
38973               }
38974               continue;
38975             }
38976             if (token = this.tokenizer.table(src)) {
38977               src = src.substring(token.raw.length);
38978               tokens.push(token);
38979               continue;
38980             }
38981             if (token = this.tokenizer.lheading(src)) {
38982               src = src.substring(token.raw.length);
38983               tokens.push(token);
38984               continue;
38985             }
38986             let cutSrc = src;
38987             if ((_c = this.options.extensions) == null ? void 0 : _c.startBlock) {
38988               let startIndex = Infinity;
38989               const tempSrc = src.slice(1);
38990               let tempStart;
38991               this.options.extensions.startBlock.forEach((getStartIndex) => {
38992                 tempStart = getStartIndex.call({ lexer: this }, tempSrc);
38993                 if (typeof tempStart === "number" && tempStart >= 0) {
38994                   startIndex = Math.min(startIndex, tempStart);
38995                 }
38996               });
38997               if (startIndex < Infinity && startIndex >= 0) {
38998                 cutSrc = src.substring(0, startIndex + 1);
38999               }
39000             }
39001             if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {
39002               const lastToken = tokens.at(-1);
39003               if (lastParagraphClipped && (lastToken == null ? void 0 : lastToken.type) === "paragraph") {
39004                 lastToken.raw += "\n" + token.raw;
39005                 lastToken.text += "\n" + token.text;
39006                 this.inlineQueue.pop();
39007                 this.inlineQueue.at(-1).src = lastToken.text;
39008               } else {
39009                 tokens.push(token);
39010               }
39011               lastParagraphClipped = cutSrc.length !== src.length;
39012               src = src.substring(token.raw.length);
39013               continue;
39014             }
39015             if (token = this.tokenizer.text(src)) {
39016               src = src.substring(token.raw.length);
39017               const lastToken = tokens.at(-1);
39018               if ((lastToken == null ? void 0 : lastToken.type) === "text") {
39019                 lastToken.raw += "\n" + token.raw;
39020                 lastToken.text += "\n" + token.text;
39021                 this.inlineQueue.pop();
39022                 this.inlineQueue.at(-1).src = lastToken.text;
39023               } else {
39024                 tokens.push(token);
39025               }
39026               continue;
39027             }
39028             if (src) {
39029               const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
39030               if (this.options.silent) {
39031                 console.error(errMsg);
39032                 break;
39033               } else {
39034                 throw new Error(errMsg);
39035               }
39036             }
39037           }
39038           this.state.top = true;
39039           return tokens;
39040         }
39041         inline(src, tokens = []) {
39042           this.inlineQueue.push({ src, tokens });
39043           return tokens;
39044         }
39045         /**
39046          * Lexing/Compiling
39047          */
39048         inlineTokens(src, tokens = []) {
39049           var _a3, _b2, _c;
39050           let maskedSrc = src;
39051           let match = null;
39052           if (this.tokens.links) {
39053             const links = Object.keys(this.tokens.links);
39054             if (links.length > 0) {
39055               while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
39056                 if (links.includes(match[0].slice(match[0].lastIndexOf("[") + 1, -1))) {
39057                   maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
39058                 }
39059               }
39060             }
39061           }
39062           while ((match = this.tokenizer.rules.inline.anyPunctuation.exec(maskedSrc)) != null) {
39063             maskedSrc = maskedSrc.slice(0, match.index) + "++" + maskedSrc.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
39064           }
39065           while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
39066             maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
39067           }
39068           let keepPrevChar = false;
39069           let prevChar = "";
39070           while (src) {
39071             if (!keepPrevChar) {
39072               prevChar = "";
39073             }
39074             keepPrevChar = false;
39075             let token;
39076             if ((_b2 = (_a3 = this.options.extensions) == null ? void 0 : _a3.inline) == null ? void 0 : _b2.some((extTokenizer) => {
39077               if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
39078                 src = src.substring(token.raw.length);
39079                 tokens.push(token);
39080                 return true;
39081               }
39082               return false;
39083             })) {
39084               continue;
39085             }
39086             if (token = this.tokenizer.escape(src)) {
39087               src = src.substring(token.raw.length);
39088               tokens.push(token);
39089               continue;
39090             }
39091             if (token = this.tokenizer.tag(src)) {
39092               src = src.substring(token.raw.length);
39093               tokens.push(token);
39094               continue;
39095             }
39096             if (token = this.tokenizer.link(src)) {
39097               src = src.substring(token.raw.length);
39098               tokens.push(token);
39099               continue;
39100             }
39101             if (token = this.tokenizer.reflink(src, this.tokens.links)) {
39102               src = src.substring(token.raw.length);
39103               const lastToken = tokens.at(-1);
39104               if (token.type === "text" && (lastToken == null ? void 0 : lastToken.type) === "text") {
39105                 lastToken.raw += token.raw;
39106                 lastToken.text += token.text;
39107               } else {
39108                 tokens.push(token);
39109               }
39110               continue;
39111             }
39112             if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {
39113               src = src.substring(token.raw.length);
39114               tokens.push(token);
39115               continue;
39116             }
39117             if (token = this.tokenizer.codespan(src)) {
39118               src = src.substring(token.raw.length);
39119               tokens.push(token);
39120               continue;
39121             }
39122             if (token = this.tokenizer.br(src)) {
39123               src = src.substring(token.raw.length);
39124               tokens.push(token);
39125               continue;
39126             }
39127             if (token = this.tokenizer.del(src)) {
39128               src = src.substring(token.raw.length);
39129               tokens.push(token);
39130               continue;
39131             }
39132             if (token = this.tokenizer.autolink(src)) {
39133               src = src.substring(token.raw.length);
39134               tokens.push(token);
39135               continue;
39136             }
39137             if (!this.state.inLink && (token = this.tokenizer.url(src))) {
39138               src = src.substring(token.raw.length);
39139               tokens.push(token);
39140               continue;
39141             }
39142             let cutSrc = src;
39143             if ((_c = this.options.extensions) == null ? void 0 : _c.startInline) {
39144               let startIndex = Infinity;
39145               const tempSrc = src.slice(1);
39146               let tempStart;
39147               this.options.extensions.startInline.forEach((getStartIndex) => {
39148                 tempStart = getStartIndex.call({ lexer: this }, tempSrc);
39149                 if (typeof tempStart === "number" && tempStart >= 0) {
39150                   startIndex = Math.min(startIndex, tempStart);
39151                 }
39152               });
39153               if (startIndex < Infinity && startIndex >= 0) {
39154                 cutSrc = src.substring(0, startIndex + 1);
39155               }
39156             }
39157             if (token = this.tokenizer.inlineText(cutSrc)) {
39158               src = src.substring(token.raw.length);
39159               if (token.raw.slice(-1) !== "_") {
39160                 prevChar = token.raw.slice(-1);
39161               }
39162               keepPrevChar = true;
39163               const lastToken = tokens.at(-1);
39164               if ((lastToken == null ? void 0 : lastToken.type) === "text") {
39165                 lastToken.raw += token.raw;
39166                 lastToken.text += token.text;
39167               } else {
39168                 tokens.push(token);
39169               }
39170               continue;
39171             }
39172             if (src) {
39173               const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
39174               if (this.options.silent) {
39175                 console.error(errMsg);
39176                 break;
39177               } else {
39178                 throw new Error(errMsg);
39179               }
39180             }
39181           }
39182           return tokens;
39183         }
39184       };
39185       _Renderer = class {
39186         // set by the parser
39187         constructor(options2) {
39188           __publicField(this, "options");
39189           __publicField(this, "parser");
39190           this.options = options2 || _defaults;
39191         }
39192         space(token) {
39193           return "";
39194         }
39195         code({ text, lang, escaped }) {
39196           var _a3;
39197           const langString = (_a3 = (lang || "").match(other.notSpaceStart)) == null ? void 0 : _a3[0];
39198           const code = text.replace(other.endingNewline, "") + "\n";
39199           if (!langString) {
39200             return "<pre><code>" + (escaped ? code : escape4(code, true)) + "</code></pre>\n";
39201           }
39202           return '<pre><code class="language-' + escape4(langString) + '">' + (escaped ? code : escape4(code, true)) + "</code></pre>\n";
39203         }
39204         blockquote({ tokens }) {
39205           const body = this.parser.parse(tokens);
39206           return `<blockquote>
39207 ${body}</blockquote>
39208 `;
39209         }
39210         html({ text }) {
39211           return text;
39212         }
39213         heading({ tokens, depth }) {
39214           return `<h${depth}>${this.parser.parseInline(tokens)}</h${depth}>
39215 `;
39216         }
39217         hr(token) {
39218           return "<hr>\n";
39219         }
39220         list(token) {
39221           const ordered = token.ordered;
39222           const start2 = token.start;
39223           let body = "";
39224           for (let j2 = 0; j2 < token.items.length; j2++) {
39225             const item = token.items[j2];
39226             body += this.listitem(item);
39227           }
39228           const type2 = ordered ? "ol" : "ul";
39229           const startAttr = ordered && start2 !== 1 ? ' start="' + start2 + '"' : "";
39230           return "<" + type2 + startAttr + ">\n" + body + "</" + type2 + ">\n";
39231         }
39232         listitem(item) {
39233           var _a3;
39234           let itemBody = "";
39235           if (item.task) {
39236             const checkbox = this.checkbox({ checked: !!item.checked });
39237             if (item.loose) {
39238               if (((_a3 = item.tokens[0]) == null ? void 0 : _a3.type) === "paragraph") {
39239                 item.tokens[0].text = checkbox + " " + item.tokens[0].text;
39240                 if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === "text") {
39241                   item.tokens[0].tokens[0].text = checkbox + " " + escape4(item.tokens[0].tokens[0].text);
39242                   item.tokens[0].tokens[0].escaped = true;
39243                 }
39244               } else {
39245                 item.tokens.unshift({
39246                   type: "text",
39247                   raw: checkbox + " ",
39248                   text: checkbox + " ",
39249                   escaped: true
39250                 });
39251               }
39252             } else {
39253               itemBody += checkbox + " ";
39254             }
39255           }
39256           itemBody += this.parser.parse(item.tokens, !!item.loose);
39257           return `<li>${itemBody}</li>
39258 `;
39259         }
39260         checkbox({ checked }) {
39261           return "<input " + (checked ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
39262         }
39263         paragraph({ tokens }) {
39264           return `<p>${this.parser.parseInline(tokens)}</p>
39265 `;
39266         }
39267         table(token) {
39268           let header = "";
39269           let cell = "";
39270           for (let j2 = 0; j2 < token.header.length; j2++) {
39271             cell += this.tablecell(token.header[j2]);
39272           }
39273           header += this.tablerow({ text: cell });
39274           let body = "";
39275           for (let j2 = 0; j2 < token.rows.length; j2++) {
39276             const row = token.rows[j2];
39277             cell = "";
39278             for (let k2 = 0; k2 < row.length; k2++) {
39279               cell += this.tablecell(row[k2]);
39280             }
39281             body += this.tablerow({ text: cell });
39282           }
39283           if (body)
39284             body = `<tbody>${body}</tbody>`;
39285           return "<table>\n<thead>\n" + header + "</thead>\n" + body + "</table>\n";
39286         }
39287         tablerow({ text }) {
39288           return `<tr>
39289 ${text}</tr>
39290 `;
39291         }
39292         tablecell(token) {
39293           const content = this.parser.parseInline(token.tokens);
39294           const type2 = token.header ? "th" : "td";
39295           const tag2 = token.align ? `<${type2} align="${token.align}">` : `<${type2}>`;
39296           return tag2 + content + `</${type2}>
39297 `;
39298         }
39299         /**
39300          * span level renderer
39301          */
39302         strong({ tokens }) {
39303           return `<strong>${this.parser.parseInline(tokens)}</strong>`;
39304         }
39305         em({ tokens }) {
39306           return `<em>${this.parser.parseInline(tokens)}</em>`;
39307         }
39308         codespan({ text }) {
39309           return `<code>${escape4(text, true)}</code>`;
39310         }
39311         br(token) {
39312           return "<br>";
39313         }
39314         del({ tokens }) {
39315           return `<del>${this.parser.parseInline(tokens)}</del>`;
39316         }
39317         link({ href, title, tokens }) {
39318           const text = this.parser.parseInline(tokens);
39319           const cleanHref = cleanUrl(href);
39320           if (cleanHref === null) {
39321             return text;
39322           }
39323           href = cleanHref;
39324           let out = '<a href="' + href + '"';
39325           if (title) {
39326             out += ' title="' + escape4(title) + '"';
39327           }
39328           out += ">" + text + "</a>";
39329           return out;
39330         }
39331         image({ href, title, text }) {
39332           const cleanHref = cleanUrl(href);
39333           if (cleanHref === null) {
39334             return escape4(text);
39335           }
39336           href = cleanHref;
39337           let out = `<img src="${href}" alt="${text}"`;
39338           if (title) {
39339             out += ` title="${escape4(title)}"`;
39340           }
39341           out += ">";
39342           return out;
39343         }
39344         text(token) {
39345           return "tokens" in token && token.tokens ? this.parser.parseInline(token.tokens) : "escaped" in token && token.escaped ? token.text : escape4(token.text);
39346         }
39347       };
39348       _TextRenderer = class {
39349         // no need for block level renderers
39350         strong({ text }) {
39351           return text;
39352         }
39353         em({ text }) {
39354           return text;
39355         }
39356         codespan({ text }) {
39357           return text;
39358         }
39359         del({ text }) {
39360           return text;
39361         }
39362         html({ text }) {
39363           return text;
39364         }
39365         text({ text }) {
39366           return text;
39367         }
39368         link({ text }) {
39369           return "" + text;
39370         }
39371         image({ text }) {
39372           return "" + text;
39373         }
39374         br() {
39375           return "";
39376         }
39377       };
39378       _Parser = class __Parser {
39379         constructor(options2) {
39380           __publicField(this, "options");
39381           __publicField(this, "renderer");
39382           __publicField(this, "textRenderer");
39383           this.options = options2 || _defaults;
39384           this.options.renderer = this.options.renderer || new _Renderer();
39385           this.renderer = this.options.renderer;
39386           this.renderer.options = this.options;
39387           this.renderer.parser = this;
39388           this.textRenderer = new _TextRenderer();
39389         }
39390         /**
39391          * Static Parse Method
39392          */
39393         static parse(tokens, options2) {
39394           const parser3 = new __Parser(options2);
39395           return parser3.parse(tokens);
39396         }
39397         /**
39398          * Static Parse Inline Method
39399          */
39400         static parseInline(tokens, options2) {
39401           const parser3 = new __Parser(options2);
39402           return parser3.parseInline(tokens);
39403         }
39404         /**
39405          * Parse Loop
39406          */
39407         parse(tokens, top = true) {
39408           var _a3, _b2;
39409           let out = "";
39410           for (let i3 = 0; i3 < tokens.length; i3++) {
39411             const anyToken = tokens[i3];
39412             if ((_b2 = (_a3 = this.options.extensions) == null ? void 0 : _a3.renderers) == null ? void 0 : _b2[anyToken.type]) {
39413               const genericToken = anyToken;
39414               const ret = this.options.extensions.renderers[genericToken.type].call({ parser: this }, genericToken);
39415               if (ret !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(genericToken.type)) {
39416                 out += ret || "";
39417                 continue;
39418               }
39419             }
39420             const token = anyToken;
39421             switch (token.type) {
39422               case "space": {
39423                 out += this.renderer.space(token);
39424                 continue;
39425               }
39426               case "hr": {
39427                 out += this.renderer.hr(token);
39428                 continue;
39429               }
39430               case "heading": {
39431                 out += this.renderer.heading(token);
39432                 continue;
39433               }
39434               case "code": {
39435                 out += this.renderer.code(token);
39436                 continue;
39437               }
39438               case "table": {
39439                 out += this.renderer.table(token);
39440                 continue;
39441               }
39442               case "blockquote": {
39443                 out += this.renderer.blockquote(token);
39444                 continue;
39445               }
39446               case "list": {
39447                 out += this.renderer.list(token);
39448                 continue;
39449               }
39450               case "html": {
39451                 out += this.renderer.html(token);
39452                 continue;
39453               }
39454               case "paragraph": {
39455                 out += this.renderer.paragraph(token);
39456                 continue;
39457               }
39458               case "text": {
39459                 let textToken = token;
39460                 let body = this.renderer.text(textToken);
39461                 while (i3 + 1 < tokens.length && tokens[i3 + 1].type === "text") {
39462                   textToken = tokens[++i3];
39463                   body += "\n" + this.renderer.text(textToken);
39464                 }
39465                 if (top) {
39466                   out += this.renderer.paragraph({
39467                     type: "paragraph",
39468                     raw: body,
39469                     text: body,
39470                     tokens: [{ type: "text", raw: body, text: body, escaped: true }]
39471                   });
39472                 } else {
39473                   out += body;
39474                 }
39475                 continue;
39476               }
39477               default: {
39478                 const errMsg = 'Token with "' + token.type + '" type was not found.';
39479                 if (this.options.silent) {
39480                   console.error(errMsg);
39481                   return "";
39482                 } else {
39483                   throw new Error(errMsg);
39484                 }
39485               }
39486             }
39487           }
39488           return out;
39489         }
39490         /**
39491          * Parse Inline Tokens
39492          */
39493         parseInline(tokens, renderer = this.renderer) {
39494           var _a3, _b2;
39495           let out = "";
39496           for (let i3 = 0; i3 < tokens.length; i3++) {
39497             const anyToken = tokens[i3];
39498             if ((_b2 = (_a3 = this.options.extensions) == null ? void 0 : _a3.renderers) == null ? void 0 : _b2[anyToken.type]) {
39499               const ret = this.options.extensions.renderers[anyToken.type].call({ parser: this }, anyToken);
39500               if (ret !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(anyToken.type)) {
39501                 out += ret || "";
39502                 continue;
39503               }
39504             }
39505             const token = anyToken;
39506             switch (token.type) {
39507               case "escape": {
39508                 out += renderer.text(token);
39509                 break;
39510               }
39511               case "html": {
39512                 out += renderer.html(token);
39513                 break;
39514               }
39515               case "link": {
39516                 out += renderer.link(token);
39517                 break;
39518               }
39519               case "image": {
39520                 out += renderer.image(token);
39521                 break;
39522               }
39523               case "strong": {
39524                 out += renderer.strong(token);
39525                 break;
39526               }
39527               case "em": {
39528                 out += renderer.em(token);
39529                 break;
39530               }
39531               case "codespan": {
39532                 out += renderer.codespan(token);
39533                 break;
39534               }
39535               case "br": {
39536                 out += renderer.br(token);
39537                 break;
39538               }
39539               case "del": {
39540                 out += renderer.del(token);
39541                 break;
39542               }
39543               case "text": {
39544                 out += renderer.text(token);
39545                 break;
39546               }
39547               default: {
39548                 const errMsg = 'Token with "' + token.type + '" type was not found.';
39549                 if (this.options.silent) {
39550                   console.error(errMsg);
39551                   return "";
39552                 } else {
39553                   throw new Error(errMsg);
39554                 }
39555               }
39556             }
39557           }
39558           return out;
39559         }
39560       };
39561       _Hooks = class {
39562         constructor(options2) {
39563           __publicField(this, "options");
39564           __publicField(this, "block");
39565           this.options = options2 || _defaults;
39566         }
39567         /**
39568          * Process markdown before marked
39569          */
39570         preprocess(markdown) {
39571           return markdown;
39572         }
39573         /**
39574          * Process HTML after marked is finished
39575          */
39576         postprocess(html3) {
39577           return html3;
39578         }
39579         /**
39580          * Process all tokens before walk tokens
39581          */
39582         processAllTokens(tokens) {
39583           return tokens;
39584         }
39585         /**
39586          * Provide function to tokenize markdown
39587          */
39588         provideLexer() {
39589           return this.block ? _Lexer.lex : _Lexer.lexInline;
39590         }
39591         /**
39592          * Provide function to parse tokens
39593          */
39594         provideParser() {
39595           return this.block ? _Parser.parse : _Parser.parseInline;
39596         }
39597       };
39598       __publicField(_Hooks, "passThroughHooks", /* @__PURE__ */ new Set([
39599         "preprocess",
39600         "postprocess",
39601         "processAllTokens"
39602       ]));
39603       Marked = class {
39604         constructor(...args) {
39605           __publicField(this, "defaults", _getDefaults());
39606           __publicField(this, "options", this.setOptions);
39607           __publicField(this, "parse", this.parseMarkdown(true));
39608           __publicField(this, "parseInline", this.parseMarkdown(false));
39609           __publicField(this, "Parser", _Parser);
39610           __publicField(this, "Renderer", _Renderer);
39611           __publicField(this, "TextRenderer", _TextRenderer);
39612           __publicField(this, "Lexer", _Lexer);
39613           __publicField(this, "Tokenizer", _Tokenizer);
39614           __publicField(this, "Hooks", _Hooks);
39615           this.use(...args);
39616         }
39617         /**
39618          * Run callback for every token
39619          */
39620         walkTokens(tokens, callback) {
39621           var _a3, _b2;
39622           let values = [];
39623           for (const token of tokens) {
39624             values = values.concat(callback.call(this, token));
39625             switch (token.type) {
39626               case "table": {
39627                 const tableToken = token;
39628                 for (const cell of tableToken.header) {
39629                   values = values.concat(this.walkTokens(cell.tokens, callback));
39630                 }
39631                 for (const row of tableToken.rows) {
39632                   for (const cell of row) {
39633                     values = values.concat(this.walkTokens(cell.tokens, callback));
39634                   }
39635                 }
39636                 break;
39637               }
39638               case "list": {
39639                 const listToken = token;
39640                 values = values.concat(this.walkTokens(listToken.items, callback));
39641                 break;
39642               }
39643               default: {
39644                 const genericToken = token;
39645                 if ((_b2 = (_a3 = this.defaults.extensions) == null ? void 0 : _a3.childTokens) == null ? void 0 : _b2[genericToken.type]) {
39646                   this.defaults.extensions.childTokens[genericToken.type].forEach((childTokens) => {
39647                     const tokens2 = genericToken[childTokens].flat(Infinity);
39648                     values = values.concat(this.walkTokens(tokens2, callback));
39649                   });
39650                 } else if (genericToken.tokens) {
39651                   values = values.concat(this.walkTokens(genericToken.tokens, callback));
39652                 }
39653               }
39654             }
39655           }
39656           return values;
39657         }
39658         use(...args) {
39659           const extensions = this.defaults.extensions || { renderers: {}, childTokens: {} };
39660           args.forEach((pack) => {
39661             const opts = { ...pack };
39662             opts.async = this.defaults.async || opts.async || false;
39663             if (pack.extensions) {
39664               pack.extensions.forEach((ext) => {
39665                 if (!ext.name) {
39666                   throw new Error("extension name required");
39667                 }
39668                 if ("renderer" in ext) {
39669                   const prevRenderer = extensions.renderers[ext.name];
39670                   if (prevRenderer) {
39671                     extensions.renderers[ext.name] = function(...args2) {
39672                       let ret = ext.renderer.apply(this, args2);
39673                       if (ret === false) {
39674                         ret = prevRenderer.apply(this, args2);
39675                       }
39676                       return ret;
39677                     };
39678                   } else {
39679                     extensions.renderers[ext.name] = ext.renderer;
39680                   }
39681                 }
39682                 if ("tokenizer" in ext) {
39683                   if (!ext.level || ext.level !== "block" && ext.level !== "inline") {
39684                     throw new Error("extension level must be 'block' or 'inline'");
39685                   }
39686                   const extLevel = extensions[ext.level];
39687                   if (extLevel) {
39688                     extLevel.unshift(ext.tokenizer);
39689                   } else {
39690                     extensions[ext.level] = [ext.tokenizer];
39691                   }
39692                   if (ext.start) {
39693                     if (ext.level === "block") {
39694                       if (extensions.startBlock) {
39695                         extensions.startBlock.push(ext.start);
39696                       } else {
39697                         extensions.startBlock = [ext.start];
39698                       }
39699                     } else if (ext.level === "inline") {
39700                       if (extensions.startInline) {
39701                         extensions.startInline.push(ext.start);
39702                       } else {
39703                         extensions.startInline = [ext.start];
39704                       }
39705                     }
39706                   }
39707                 }
39708                 if ("childTokens" in ext && ext.childTokens) {
39709                   extensions.childTokens[ext.name] = ext.childTokens;
39710                 }
39711               });
39712               opts.extensions = extensions;
39713             }
39714             if (pack.renderer) {
39715               const renderer = this.defaults.renderer || new _Renderer(this.defaults);
39716               for (const prop in pack.renderer) {
39717                 if (!(prop in renderer)) {
39718                   throw new Error(`renderer '${prop}' does not exist`);
39719                 }
39720                 if (["options", "parser"].includes(prop)) {
39721                   continue;
39722                 }
39723                 const rendererProp = prop;
39724                 const rendererFunc = pack.renderer[rendererProp];
39725                 const prevRenderer = renderer[rendererProp];
39726                 renderer[rendererProp] = (...args2) => {
39727                   let ret = rendererFunc.apply(renderer, args2);
39728                   if (ret === false) {
39729                     ret = prevRenderer.apply(renderer, args2);
39730                   }
39731                   return ret || "";
39732                 };
39733               }
39734               opts.renderer = renderer;
39735             }
39736             if (pack.tokenizer) {
39737               const tokenizer = this.defaults.tokenizer || new _Tokenizer(this.defaults);
39738               for (const prop in pack.tokenizer) {
39739                 if (!(prop in tokenizer)) {
39740                   throw new Error(`tokenizer '${prop}' does not exist`);
39741                 }
39742                 if (["options", "rules", "lexer"].includes(prop)) {
39743                   continue;
39744                 }
39745                 const tokenizerProp = prop;
39746                 const tokenizerFunc = pack.tokenizer[tokenizerProp];
39747                 const prevTokenizer = tokenizer[tokenizerProp];
39748                 tokenizer[tokenizerProp] = (...args2) => {
39749                   let ret = tokenizerFunc.apply(tokenizer, args2);
39750                   if (ret === false) {
39751                     ret = prevTokenizer.apply(tokenizer, args2);
39752                   }
39753                   return ret;
39754                 };
39755               }
39756               opts.tokenizer = tokenizer;
39757             }
39758             if (pack.hooks) {
39759               const hooks = this.defaults.hooks || new _Hooks();
39760               for (const prop in pack.hooks) {
39761                 if (!(prop in hooks)) {
39762                   throw new Error(`hook '${prop}' does not exist`);
39763                 }
39764                 if (["options", "block"].includes(prop)) {
39765                   continue;
39766                 }
39767                 const hooksProp = prop;
39768                 const hooksFunc = pack.hooks[hooksProp];
39769                 const prevHook = hooks[hooksProp];
39770                 if (_Hooks.passThroughHooks.has(prop)) {
39771                   hooks[hooksProp] = (arg) => {
39772                     if (this.defaults.async) {
39773                       return Promise.resolve(hooksFunc.call(hooks, arg)).then((ret2) => {
39774                         return prevHook.call(hooks, ret2);
39775                       });
39776                     }
39777                     const ret = hooksFunc.call(hooks, arg);
39778                     return prevHook.call(hooks, ret);
39779                   };
39780                 } else {
39781                   hooks[hooksProp] = (...args2) => {
39782                     let ret = hooksFunc.apply(hooks, args2);
39783                     if (ret === false) {
39784                       ret = prevHook.apply(hooks, args2);
39785                     }
39786                     return ret;
39787                   };
39788                 }
39789               }
39790               opts.hooks = hooks;
39791             }
39792             if (pack.walkTokens) {
39793               const walkTokens2 = this.defaults.walkTokens;
39794               const packWalktokens = pack.walkTokens;
39795               opts.walkTokens = function(token) {
39796                 let values = [];
39797                 values.push(packWalktokens.call(this, token));
39798                 if (walkTokens2) {
39799                   values = values.concat(walkTokens2.call(this, token));
39800                 }
39801                 return values;
39802               };
39803             }
39804             this.defaults = { ...this.defaults, ...opts };
39805           });
39806           return this;
39807         }
39808         setOptions(opt) {
39809           this.defaults = { ...this.defaults, ...opt };
39810           return this;
39811         }
39812         lexer(src, options2) {
39813           return _Lexer.lex(src, options2 != null ? options2 : this.defaults);
39814         }
39815         parser(tokens, options2) {
39816           return _Parser.parse(tokens, options2 != null ? options2 : this.defaults);
39817         }
39818         parseMarkdown(blockType) {
39819           const parse = (src, options2) => {
39820             const origOpt = { ...options2 };
39821             const opt = { ...this.defaults, ...origOpt };
39822             const throwError = this.onError(!!opt.silent, !!opt.async);
39823             if (this.defaults.async === true && origOpt.async === false) {
39824               return throwError(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."));
39825             }
39826             if (typeof src === "undefined" || src === null) {
39827               return throwError(new Error("marked(): input parameter is undefined or null"));
39828             }
39829             if (typeof src !== "string") {
39830               return throwError(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected"));
39831             }
39832             if (opt.hooks) {
39833               opt.hooks.options = opt;
39834               opt.hooks.block = blockType;
39835             }
39836             const lexer2 = opt.hooks ? opt.hooks.provideLexer() : blockType ? _Lexer.lex : _Lexer.lexInline;
39837             const parser3 = opt.hooks ? opt.hooks.provideParser() : blockType ? _Parser.parse : _Parser.parseInline;
39838             if (opt.async) {
39839               return Promise.resolve(opt.hooks ? opt.hooks.preprocess(src) : src).then((src2) => lexer2(src2, opt)).then((tokens) => opt.hooks ? opt.hooks.processAllTokens(tokens) : tokens).then((tokens) => opt.walkTokens ? Promise.all(this.walkTokens(tokens, opt.walkTokens)).then(() => tokens) : tokens).then((tokens) => parser3(tokens, opt)).then((html3) => opt.hooks ? opt.hooks.postprocess(html3) : html3).catch(throwError);
39840             }
39841             try {
39842               if (opt.hooks) {
39843                 src = opt.hooks.preprocess(src);
39844               }
39845               let tokens = lexer2(src, opt);
39846               if (opt.hooks) {
39847                 tokens = opt.hooks.processAllTokens(tokens);
39848               }
39849               if (opt.walkTokens) {
39850                 this.walkTokens(tokens, opt.walkTokens);
39851               }
39852               let html3 = parser3(tokens, opt);
39853               if (opt.hooks) {
39854                 html3 = opt.hooks.postprocess(html3);
39855               }
39856               return html3;
39857             } catch (e3) {
39858               return throwError(e3);
39859             }
39860           };
39861           return parse;
39862         }
39863         onError(silent, async) {
39864           return (e3) => {
39865             e3.message += "\nPlease report this to https://github.com/markedjs/marked.";
39866             if (silent) {
39867               const msg = "<p>An error occurred:</p><pre>" + escape4(e3.message + "", true) + "</pre>";
39868               if (async) {
39869                 return Promise.resolve(msg);
39870               }
39871               return msg;
39872             }
39873             if (async) {
39874               return Promise.reject(e3);
39875             }
39876             throw e3;
39877           };
39878         }
39879       };
39880       markedInstance = new Marked();
39881       marked.options = marked.setOptions = function(options2) {
39882         markedInstance.setOptions(options2);
39883         marked.defaults = markedInstance.defaults;
39884         changeDefaults(marked.defaults);
39885         return marked;
39886       };
39887       marked.getDefaults = _getDefaults;
39888       marked.defaults = _defaults;
39889       marked.use = function(...args) {
39890         markedInstance.use(...args);
39891         marked.defaults = markedInstance.defaults;
39892         changeDefaults(marked.defaults);
39893         return marked;
39894       };
39895       marked.walkTokens = function(tokens, callback) {
39896         return markedInstance.walkTokens(tokens, callback);
39897       };
39898       marked.parseInline = markedInstance.parseInline;
39899       marked.Parser = _Parser;
39900       marked.parser = _Parser.parse;
39901       marked.Renderer = _Renderer;
39902       marked.TextRenderer = _TextRenderer;
39903       marked.Lexer = _Lexer;
39904       marked.lexer = _Lexer.lex;
39905       marked.Tokenizer = _Tokenizer;
39906       marked.Hooks = _Hooks;
39907       marked.parse = marked;
39908       options = marked.options;
39909       setOptions = marked.setOptions;
39910       use = marked.use;
39911       walkTokens = marked.walkTokens;
39912       parseInline = marked.parseInline;
39913       parser2 = _Parser.parse;
39914       lexer = _Lexer.lex;
39915     }
39916   });
39917
39918   // modules/services/osmose.js
39919   var osmose_exports = {};
39920   __export(osmose_exports, {
39921     default: () => osmose_default
39922   });
39923   function abortRequest2(controller) {
39924     if (controller) {
39925       controller.abort();
39926     }
39927   }
39928   function abortUnwantedRequests2(cache, tiles) {
39929     Object.keys(cache.inflightTile).forEach((k2) => {
39930       let wanted = tiles.find((tile) => k2 === tile.id);
39931       if (!wanted) {
39932         abortRequest2(cache.inflightTile[k2]);
39933         delete cache.inflightTile[k2];
39934       }
39935     });
39936   }
39937   function encodeIssueRtree2(d2) {
39938     return { minX: d2.loc[0], minY: d2.loc[1], maxX: d2.loc[0], maxY: d2.loc[1], data: d2 };
39939   }
39940   function updateRtree2(item, replace) {
39941     _cache2.rtree.remove(item, (a2, b2) => a2.data.id === b2.data.id);
39942     if (replace) {
39943       _cache2.rtree.insert(item);
39944     }
39945   }
39946   function preventCoincident(loc) {
39947     let coincident = false;
39948     do {
39949       let delta = coincident ? [1e-5, 0] : [0, 1e-5];
39950       loc = geoVecAdd(loc, delta);
39951       let bbox2 = geoExtent(loc).bbox();
39952       coincident = _cache2.rtree.search(bbox2).length;
39953     } while (coincident);
39954     return loc;
39955   }
39956   var tiler2, dispatch3, _tileZoom2, _osmoseUrlRoot, _osmoseData, _cache2, osmose_default;
39957   var init_osmose = __esm({
39958     "modules/services/osmose.js"() {
39959       "use strict";
39960       init_rbush();
39961       init_src4();
39962       init_src18();
39963       init_marked_esm();
39964       init_file_fetcher();
39965       init_localizer();
39966       init_geo2();
39967       init_osm();
39968       init_util();
39969       tiler2 = utilTiler();
39970       dispatch3 = dispatch_default("loaded");
39971       _tileZoom2 = 14;
39972       _osmoseUrlRoot = "https://osmose.openstreetmap.fr/api/0.3";
39973       _osmoseData = { icons: {}, items: [] };
39974       osmose_default = {
39975         title: "osmose",
39976         init() {
39977           _mainFileFetcher.get("qa_data").then((d2) => {
39978             _osmoseData = d2.osmose;
39979             _osmoseData.items = Object.keys(d2.osmose.icons).map((s2) => s2.split("-")[0]).reduce((unique, item) => unique.indexOf(item) !== -1 ? unique : [...unique, item], []);
39980           });
39981           if (!_cache2) {
39982             this.reset();
39983           }
39984           this.event = utilRebind(this, dispatch3, "on");
39985         },
39986         reset() {
39987           let _strings = {};
39988           let _colors = {};
39989           if (_cache2) {
39990             Object.values(_cache2.inflightTile).forEach(abortRequest2);
39991             _strings = _cache2.strings;
39992             _colors = _cache2.colors;
39993           }
39994           _cache2 = {
39995             data: {},
39996             loadedTile: {},
39997             inflightTile: {},
39998             inflightPost: {},
39999             closed: {},
40000             rtree: new RBush(),
40001             strings: _strings,
40002             colors: _colors
40003           };
40004         },
40005         loadIssues(projection2) {
40006           let params = {
40007             // Tiles return a maximum # of issues
40008             // So we want to filter our request for only types iD supports
40009             item: _osmoseData.items
40010           };
40011           let tiles = tiler2.zoomExtent([_tileZoom2, _tileZoom2]).getTiles(projection2);
40012           abortUnwantedRequests2(_cache2, tiles);
40013           tiles.forEach((tile) => {
40014             if (_cache2.loadedTile[tile.id] || _cache2.inflightTile[tile.id]) return;
40015             let [x2, y2, z2] = tile.xyz;
40016             let url = `${_osmoseUrlRoot}/issues/${z2}/${x2}/${y2}.geojson?` + utilQsString(params);
40017             let controller = new AbortController();
40018             _cache2.inflightTile[tile.id] = controller;
40019             json_default(url, { signal: controller.signal }).then((data) => {
40020               delete _cache2.inflightTile[tile.id];
40021               _cache2.loadedTile[tile.id] = true;
40022               if (data.features) {
40023                 data.features.forEach((issue) => {
40024                   const { item, class: cl, uuid: id2 } = issue.properties;
40025                   const itemType = `${item}-${cl}`;
40026                   if (itemType in _osmoseData.icons) {
40027                     let loc = issue.geometry.coordinates;
40028                     loc = preventCoincident(loc);
40029                     let d2 = new QAItem(loc, this, itemType, id2, { item });
40030                     if (item === 8300 || item === 8360) {
40031                       d2.elems = [];
40032                     }
40033                     _cache2.data[d2.id] = d2;
40034                     _cache2.rtree.insert(encodeIssueRtree2(d2));
40035                   }
40036                 });
40037               }
40038               dispatch3.call("loaded");
40039             }).catch(() => {
40040               delete _cache2.inflightTile[tile.id];
40041               _cache2.loadedTile[tile.id] = true;
40042             });
40043           });
40044         },
40045         loadIssueDetail(issue) {
40046           if (issue.elems !== void 0) {
40047             return Promise.resolve(issue);
40048           }
40049           const url = `${_osmoseUrlRoot}/issue/${issue.id}?langs=${_mainLocalizer.localeCode()}`;
40050           const cacheDetails = (data) => {
40051             issue.elems = data.elems.map((e3) => e3.type.substring(0, 1) + e3.id);
40052             issue.detail = data.subtitle ? marked(data.subtitle.auto) : "";
40053             this.replaceItem(issue);
40054           };
40055           return json_default(url).then(cacheDetails).then(() => issue);
40056         },
40057         loadStrings(locale3 = _mainLocalizer.localeCode()) {
40058           const items = Object.keys(_osmoseData.icons);
40059           if (locale3 in _cache2.strings && Object.keys(_cache2.strings[locale3]).length === items.length) {
40060             return Promise.resolve(_cache2.strings[locale3]);
40061           }
40062           if (!(locale3 in _cache2.strings)) {
40063             _cache2.strings[locale3] = {};
40064           }
40065           const allRequests = items.map((itemType) => {
40066             if (itemType in _cache2.strings[locale3]) return null;
40067             const cacheData = (data) => {
40068               const [cat = { items: [] }] = data.categories;
40069               const [item2 = { class: [] }] = cat.items;
40070               const [cl2 = null] = item2.class;
40071               if (!cl2) {
40072                 console.log(`Osmose strings request (${itemType}) had unexpected data`);
40073                 return;
40074               }
40075               const { item: itemInt, color: color2 } = item2;
40076               if (/^#[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}/.test(color2)) {
40077                 _cache2.colors[itemInt] = color2;
40078               }
40079               const { title, detail, fix, trap } = cl2;
40080               let issueStrings = {};
40081               if (title) issueStrings.title = title.auto;
40082               if (detail) issueStrings.detail = marked(detail.auto);
40083               if (trap) issueStrings.trap = marked(trap.auto);
40084               if (fix) issueStrings.fix = marked(fix.auto);
40085               _cache2.strings[locale3][itemType] = issueStrings;
40086             };
40087             const [item, cl] = itemType.split("-");
40088             const url = `${_osmoseUrlRoot}/items/${item}/class/${cl}?langs=${locale3}`;
40089             return json_default(url).then(cacheData);
40090           }).filter(Boolean);
40091           return Promise.all(allRequests).then(() => _cache2.strings[locale3]);
40092         },
40093         getStrings(itemType, locale3 = _mainLocalizer.localeCode()) {
40094           return locale3 in _cache2.strings ? _cache2.strings[locale3][itemType] : {};
40095         },
40096         getColor(itemType) {
40097           return itemType in _cache2.colors ? _cache2.colors[itemType] : "#FFFFFF";
40098         },
40099         postUpdate(issue, callback) {
40100           if (_cache2.inflightPost[issue.id]) {
40101             return callback({ message: "Issue update already inflight", status: -2 }, issue);
40102           }
40103           const url = `${_osmoseUrlRoot}/issue/${issue.id}/${issue.newStatus}`;
40104           const controller = new AbortController();
40105           const after = () => {
40106             delete _cache2.inflightPost[issue.id];
40107             this.removeItem(issue);
40108             if (issue.newStatus === "done") {
40109               if (!(issue.item in _cache2.closed)) {
40110                 _cache2.closed[issue.item] = 0;
40111               }
40112               _cache2.closed[issue.item] += 1;
40113             }
40114             if (callback) callback(null, issue);
40115           };
40116           _cache2.inflightPost[issue.id] = controller;
40117           fetch(url, { signal: controller.signal }).then(after).catch((err) => {
40118             delete _cache2.inflightPost[issue.id];
40119             if (callback) callback(err.message);
40120           });
40121         },
40122         // Get all cached QAItems covering the viewport
40123         getItems(projection2) {
40124           const viewport = projection2.clipExtent();
40125           const min3 = [viewport[0][0], viewport[1][1]];
40126           const max3 = [viewport[1][0], viewport[0][1]];
40127           const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
40128           return _cache2.rtree.search(bbox2).map((d2) => d2.data);
40129         },
40130         // Get a QAItem from cache
40131         // NOTE: Don't change method name until UI v3 is merged
40132         getError(id2) {
40133           return _cache2.data[id2];
40134         },
40135         // get the name of the icon to display for this item
40136         getIcon(itemType) {
40137           return _osmoseData.icons[itemType];
40138         },
40139         // Replace a single QAItem in the cache
40140         replaceItem(item) {
40141           if (!(item instanceof QAItem) || !item.id) return;
40142           _cache2.data[item.id] = item;
40143           updateRtree2(encodeIssueRtree2(item), true);
40144           return item;
40145         },
40146         // Remove a single QAItem from the cache
40147         removeItem(item) {
40148           if (!(item instanceof QAItem) || !item.id) return;
40149           delete _cache2.data[item.id];
40150           updateRtree2(encodeIssueRtree2(item), false);
40151         },
40152         // Used to populate `closed:osmose:*` changeset tags
40153         getClosedCounts() {
40154           return _cache2.closed;
40155         },
40156         itemURL(item) {
40157           return `https://osmose.openstreetmap.fr/en/error/${item.id}`;
40158         }
40159       };
40160     }
40161   });
40162
40163   // node_modules/pbf/index.js
40164   function readVarintRemainder(l2, s2, p2) {
40165     const buf = p2.buf;
40166     let h2, b2;
40167     b2 = buf[p2.pos++];
40168     h2 = (b2 & 112) >> 4;
40169     if (b2 < 128) return toNum(l2, h2, s2);
40170     b2 = buf[p2.pos++];
40171     h2 |= (b2 & 127) << 3;
40172     if (b2 < 128) return toNum(l2, h2, s2);
40173     b2 = buf[p2.pos++];
40174     h2 |= (b2 & 127) << 10;
40175     if (b2 < 128) return toNum(l2, h2, s2);
40176     b2 = buf[p2.pos++];
40177     h2 |= (b2 & 127) << 17;
40178     if (b2 < 128) return toNum(l2, h2, s2);
40179     b2 = buf[p2.pos++];
40180     h2 |= (b2 & 127) << 24;
40181     if (b2 < 128) return toNum(l2, h2, s2);
40182     b2 = buf[p2.pos++];
40183     h2 |= (b2 & 1) << 31;
40184     if (b2 < 128) return toNum(l2, h2, s2);
40185     throw new Error("Expected varint not more than 10 bytes");
40186   }
40187   function toNum(low, high, isSigned) {
40188     return isSigned ? high * 4294967296 + (low >>> 0) : (high >>> 0) * 4294967296 + (low >>> 0);
40189   }
40190   function writeBigVarint(val, pbf) {
40191     let low, high;
40192     if (val >= 0) {
40193       low = val % 4294967296 | 0;
40194       high = val / 4294967296 | 0;
40195     } else {
40196       low = ~(-val % 4294967296);
40197       high = ~(-val / 4294967296);
40198       if (low ^ 4294967295) {
40199         low = low + 1 | 0;
40200       } else {
40201         low = 0;
40202         high = high + 1 | 0;
40203       }
40204     }
40205     if (val >= 18446744073709552e3 || val < -18446744073709552e3) {
40206       throw new Error("Given varint doesn't fit into 10 bytes");
40207     }
40208     pbf.realloc(10);
40209     writeBigVarintLow(low, high, pbf);
40210     writeBigVarintHigh(high, pbf);
40211   }
40212   function writeBigVarintLow(low, high, pbf) {
40213     pbf.buf[pbf.pos++] = low & 127 | 128;
40214     low >>>= 7;
40215     pbf.buf[pbf.pos++] = low & 127 | 128;
40216     low >>>= 7;
40217     pbf.buf[pbf.pos++] = low & 127 | 128;
40218     low >>>= 7;
40219     pbf.buf[pbf.pos++] = low & 127 | 128;
40220     low >>>= 7;
40221     pbf.buf[pbf.pos] = low & 127;
40222   }
40223   function writeBigVarintHigh(high, pbf) {
40224     const lsb = (high & 7) << 4;
40225     pbf.buf[pbf.pos++] |= lsb | ((high >>>= 3) ? 128 : 0);
40226     if (!high) return;
40227     pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
40228     if (!high) return;
40229     pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
40230     if (!high) return;
40231     pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
40232     if (!high) return;
40233     pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
40234     if (!high) return;
40235     pbf.buf[pbf.pos++] = high & 127;
40236   }
40237   function makeRoomForExtraLength(startPos, len, pbf) {
40238     const extraLen = len <= 16383 ? 1 : len <= 2097151 ? 2 : len <= 268435455 ? 3 : Math.floor(Math.log(len) / (Math.LN2 * 7));
40239     pbf.realloc(extraLen);
40240     for (let i3 = pbf.pos - 1; i3 >= startPos; i3--) pbf.buf[i3 + extraLen] = pbf.buf[i3];
40241   }
40242   function writePackedVarint(arr, pbf) {
40243     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeVarint(arr[i3]);
40244   }
40245   function writePackedSVarint(arr, pbf) {
40246     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeSVarint(arr[i3]);
40247   }
40248   function writePackedFloat(arr, pbf) {
40249     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeFloat(arr[i3]);
40250   }
40251   function writePackedDouble(arr, pbf) {
40252     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeDouble(arr[i3]);
40253   }
40254   function writePackedBoolean(arr, pbf) {
40255     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeBoolean(arr[i3]);
40256   }
40257   function writePackedFixed32(arr, pbf) {
40258     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeFixed32(arr[i3]);
40259   }
40260   function writePackedSFixed32(arr, pbf) {
40261     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeSFixed32(arr[i3]);
40262   }
40263   function writePackedFixed64(arr, pbf) {
40264     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeFixed64(arr[i3]);
40265   }
40266   function writePackedSFixed64(arr, pbf) {
40267     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeSFixed64(arr[i3]);
40268   }
40269   function readUtf8(buf, pos, end) {
40270     let str = "";
40271     let i3 = pos;
40272     while (i3 < end) {
40273       const b0 = buf[i3];
40274       let c2 = null;
40275       let bytesPerSequence = b0 > 239 ? 4 : b0 > 223 ? 3 : b0 > 191 ? 2 : 1;
40276       if (i3 + bytesPerSequence > end) break;
40277       let b1, b2, b3;
40278       if (bytesPerSequence === 1) {
40279         if (b0 < 128) {
40280           c2 = b0;
40281         }
40282       } else if (bytesPerSequence === 2) {
40283         b1 = buf[i3 + 1];
40284         if ((b1 & 192) === 128) {
40285           c2 = (b0 & 31) << 6 | b1 & 63;
40286           if (c2 <= 127) {
40287             c2 = null;
40288           }
40289         }
40290       } else if (bytesPerSequence === 3) {
40291         b1 = buf[i3 + 1];
40292         b2 = buf[i3 + 2];
40293         if ((b1 & 192) === 128 && (b2 & 192) === 128) {
40294           c2 = (b0 & 15) << 12 | (b1 & 63) << 6 | b2 & 63;
40295           if (c2 <= 2047 || c2 >= 55296 && c2 <= 57343) {
40296             c2 = null;
40297           }
40298         }
40299       } else if (bytesPerSequence === 4) {
40300         b1 = buf[i3 + 1];
40301         b2 = buf[i3 + 2];
40302         b3 = buf[i3 + 3];
40303         if ((b1 & 192) === 128 && (b2 & 192) === 128 && (b3 & 192) === 128) {
40304           c2 = (b0 & 15) << 18 | (b1 & 63) << 12 | (b2 & 63) << 6 | b3 & 63;
40305           if (c2 <= 65535 || c2 >= 1114112) {
40306             c2 = null;
40307           }
40308         }
40309       }
40310       if (c2 === null) {
40311         c2 = 65533;
40312         bytesPerSequence = 1;
40313       } else if (c2 > 65535) {
40314         c2 -= 65536;
40315         str += String.fromCharCode(c2 >>> 10 & 1023 | 55296);
40316         c2 = 56320 | c2 & 1023;
40317       }
40318       str += String.fromCharCode(c2);
40319       i3 += bytesPerSequence;
40320     }
40321     return str;
40322   }
40323   function writeUtf8(buf, str, pos) {
40324     for (let i3 = 0, c2, lead; i3 < str.length; i3++) {
40325       c2 = str.charCodeAt(i3);
40326       if (c2 > 55295 && c2 < 57344) {
40327         if (lead) {
40328           if (c2 < 56320) {
40329             buf[pos++] = 239;
40330             buf[pos++] = 191;
40331             buf[pos++] = 189;
40332             lead = c2;
40333             continue;
40334           } else {
40335             c2 = lead - 55296 << 10 | c2 - 56320 | 65536;
40336             lead = null;
40337           }
40338         } else {
40339           if (c2 > 56319 || i3 + 1 === str.length) {
40340             buf[pos++] = 239;
40341             buf[pos++] = 191;
40342             buf[pos++] = 189;
40343           } else {
40344             lead = c2;
40345           }
40346           continue;
40347         }
40348       } else if (lead) {
40349         buf[pos++] = 239;
40350         buf[pos++] = 191;
40351         buf[pos++] = 189;
40352         lead = null;
40353       }
40354       if (c2 < 128) {
40355         buf[pos++] = c2;
40356       } else {
40357         if (c2 < 2048) {
40358           buf[pos++] = c2 >> 6 | 192;
40359         } else {
40360           if (c2 < 65536) {
40361             buf[pos++] = c2 >> 12 | 224;
40362           } else {
40363             buf[pos++] = c2 >> 18 | 240;
40364             buf[pos++] = c2 >> 12 & 63 | 128;
40365           }
40366           buf[pos++] = c2 >> 6 & 63 | 128;
40367         }
40368         buf[pos++] = c2 & 63 | 128;
40369       }
40370     }
40371     return pos;
40372   }
40373   var SHIFT_LEFT_32, SHIFT_RIGHT_32, TEXT_DECODER_MIN_LENGTH, utf8TextDecoder, PBF_VARINT, PBF_FIXED64, PBF_BYTES, PBF_FIXED32, Pbf;
40374   var init_pbf = __esm({
40375     "node_modules/pbf/index.js"() {
40376       SHIFT_LEFT_32 = (1 << 16) * (1 << 16);
40377       SHIFT_RIGHT_32 = 1 / SHIFT_LEFT_32;
40378       TEXT_DECODER_MIN_LENGTH = 12;
40379       utf8TextDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder("utf-8");
40380       PBF_VARINT = 0;
40381       PBF_FIXED64 = 1;
40382       PBF_BYTES = 2;
40383       PBF_FIXED32 = 5;
40384       Pbf = class {
40385         /**
40386          * @param {Uint8Array | ArrayBuffer} [buf]
40387          */
40388         constructor(buf = new Uint8Array(16)) {
40389           this.buf = ArrayBuffer.isView(buf) ? buf : new Uint8Array(buf);
40390           this.dataView = new DataView(this.buf.buffer);
40391           this.pos = 0;
40392           this.type = 0;
40393           this.length = this.buf.length;
40394         }
40395         // === READING =================================================================
40396         /**
40397          * @template T
40398          * @param {(tag: number, result: T, pbf: Pbf) => void} readField
40399          * @param {T} result
40400          * @param {number} [end]
40401          */
40402         readFields(readField, result, end = this.length) {
40403           while (this.pos < end) {
40404             const val = this.readVarint(), tag2 = val >> 3, startPos = this.pos;
40405             this.type = val & 7;
40406             readField(tag2, result, this);
40407             if (this.pos === startPos) this.skip(val);
40408           }
40409           return result;
40410         }
40411         /**
40412          * @template T
40413          * @param {(tag: number, result: T, pbf: Pbf) => void} readField
40414          * @param {T} result
40415          */
40416         readMessage(readField, result) {
40417           return this.readFields(readField, result, this.readVarint() + this.pos);
40418         }
40419         readFixed32() {
40420           const val = this.dataView.getUint32(this.pos, true);
40421           this.pos += 4;
40422           return val;
40423         }
40424         readSFixed32() {
40425           const val = this.dataView.getInt32(this.pos, true);
40426           this.pos += 4;
40427           return val;
40428         }
40429         // 64-bit int handling is based on github.com/dpw/node-buffer-more-ints (MIT-licensed)
40430         readFixed64() {
40431           const val = this.dataView.getUint32(this.pos, true) + this.dataView.getUint32(this.pos + 4, true) * SHIFT_LEFT_32;
40432           this.pos += 8;
40433           return val;
40434         }
40435         readSFixed64() {
40436           const val = this.dataView.getUint32(this.pos, true) + this.dataView.getInt32(this.pos + 4, true) * SHIFT_LEFT_32;
40437           this.pos += 8;
40438           return val;
40439         }
40440         readFloat() {
40441           const val = this.dataView.getFloat32(this.pos, true);
40442           this.pos += 4;
40443           return val;
40444         }
40445         readDouble() {
40446           const val = this.dataView.getFloat64(this.pos, true);
40447           this.pos += 8;
40448           return val;
40449         }
40450         /**
40451          * @param {boolean} [isSigned]
40452          */
40453         readVarint(isSigned) {
40454           const buf = this.buf;
40455           let val, b2;
40456           b2 = buf[this.pos++];
40457           val = b2 & 127;
40458           if (b2 < 128) return val;
40459           b2 = buf[this.pos++];
40460           val |= (b2 & 127) << 7;
40461           if (b2 < 128) return val;
40462           b2 = buf[this.pos++];
40463           val |= (b2 & 127) << 14;
40464           if (b2 < 128) return val;
40465           b2 = buf[this.pos++];
40466           val |= (b2 & 127) << 21;
40467           if (b2 < 128) return val;
40468           b2 = buf[this.pos];
40469           val |= (b2 & 15) << 28;
40470           return readVarintRemainder(val, isSigned, this);
40471         }
40472         readVarint64() {
40473           return this.readVarint(true);
40474         }
40475         readSVarint() {
40476           const num = this.readVarint();
40477           return num % 2 === 1 ? (num + 1) / -2 : num / 2;
40478         }
40479         readBoolean() {
40480           return Boolean(this.readVarint());
40481         }
40482         readString() {
40483           const end = this.readVarint() + this.pos;
40484           const pos = this.pos;
40485           this.pos = end;
40486           if (end - pos >= TEXT_DECODER_MIN_LENGTH && utf8TextDecoder) {
40487             return utf8TextDecoder.decode(this.buf.subarray(pos, end));
40488           }
40489           return readUtf8(this.buf, pos, end);
40490         }
40491         readBytes() {
40492           const end = this.readVarint() + this.pos, buffer = this.buf.subarray(this.pos, end);
40493           this.pos = end;
40494           return buffer;
40495         }
40496         // verbose for performance reasons; doesn't affect gzipped size
40497         /**
40498          * @param {number[]} [arr]
40499          * @param {boolean} [isSigned]
40500          */
40501         readPackedVarint(arr = [], isSigned) {
40502           const end = this.readPackedEnd();
40503           while (this.pos < end) arr.push(this.readVarint(isSigned));
40504           return arr;
40505         }
40506         /** @param {number[]} [arr] */
40507         readPackedSVarint(arr = []) {
40508           const end = this.readPackedEnd();
40509           while (this.pos < end) arr.push(this.readSVarint());
40510           return arr;
40511         }
40512         /** @param {boolean[]} [arr] */
40513         readPackedBoolean(arr = []) {
40514           const end = this.readPackedEnd();
40515           while (this.pos < end) arr.push(this.readBoolean());
40516           return arr;
40517         }
40518         /** @param {number[]} [arr] */
40519         readPackedFloat(arr = []) {
40520           const end = this.readPackedEnd();
40521           while (this.pos < end) arr.push(this.readFloat());
40522           return arr;
40523         }
40524         /** @param {number[]} [arr] */
40525         readPackedDouble(arr = []) {
40526           const end = this.readPackedEnd();
40527           while (this.pos < end) arr.push(this.readDouble());
40528           return arr;
40529         }
40530         /** @param {number[]} [arr] */
40531         readPackedFixed32(arr = []) {
40532           const end = this.readPackedEnd();
40533           while (this.pos < end) arr.push(this.readFixed32());
40534           return arr;
40535         }
40536         /** @param {number[]} [arr] */
40537         readPackedSFixed32(arr = []) {
40538           const end = this.readPackedEnd();
40539           while (this.pos < end) arr.push(this.readSFixed32());
40540           return arr;
40541         }
40542         /** @param {number[]} [arr] */
40543         readPackedFixed64(arr = []) {
40544           const end = this.readPackedEnd();
40545           while (this.pos < end) arr.push(this.readFixed64());
40546           return arr;
40547         }
40548         /** @param {number[]} [arr] */
40549         readPackedSFixed64(arr = []) {
40550           const end = this.readPackedEnd();
40551           while (this.pos < end) arr.push(this.readSFixed64());
40552           return arr;
40553         }
40554         readPackedEnd() {
40555           return this.type === PBF_BYTES ? this.readVarint() + this.pos : this.pos + 1;
40556         }
40557         /** @param {number} val */
40558         skip(val) {
40559           const type2 = val & 7;
40560           if (type2 === PBF_VARINT) while (this.buf[this.pos++] > 127) {
40561           }
40562           else if (type2 === PBF_BYTES) this.pos = this.readVarint() + this.pos;
40563           else if (type2 === PBF_FIXED32) this.pos += 4;
40564           else if (type2 === PBF_FIXED64) this.pos += 8;
40565           else throw new Error(`Unimplemented type: ${type2}`);
40566         }
40567         // === WRITING =================================================================
40568         /**
40569          * @param {number} tag
40570          * @param {number} type
40571          */
40572         writeTag(tag2, type2) {
40573           this.writeVarint(tag2 << 3 | type2);
40574         }
40575         /** @param {number} min */
40576         realloc(min3) {
40577           let length2 = this.length || 16;
40578           while (length2 < this.pos + min3) length2 *= 2;
40579           if (length2 !== this.length) {
40580             const buf = new Uint8Array(length2);
40581             buf.set(this.buf);
40582             this.buf = buf;
40583             this.dataView = new DataView(buf.buffer);
40584             this.length = length2;
40585           }
40586         }
40587         finish() {
40588           this.length = this.pos;
40589           this.pos = 0;
40590           return this.buf.subarray(0, this.length);
40591         }
40592         /** @param {number} val */
40593         writeFixed32(val) {
40594           this.realloc(4);
40595           this.dataView.setInt32(this.pos, val, true);
40596           this.pos += 4;
40597         }
40598         /** @param {number} val */
40599         writeSFixed32(val) {
40600           this.realloc(4);
40601           this.dataView.setInt32(this.pos, val, true);
40602           this.pos += 4;
40603         }
40604         /** @param {number} val */
40605         writeFixed64(val) {
40606           this.realloc(8);
40607           this.dataView.setInt32(this.pos, val & -1, true);
40608           this.dataView.setInt32(this.pos + 4, Math.floor(val * SHIFT_RIGHT_32), true);
40609           this.pos += 8;
40610         }
40611         /** @param {number} val */
40612         writeSFixed64(val) {
40613           this.realloc(8);
40614           this.dataView.setInt32(this.pos, val & -1, true);
40615           this.dataView.setInt32(this.pos + 4, Math.floor(val * SHIFT_RIGHT_32), true);
40616           this.pos += 8;
40617         }
40618         /** @param {number} val */
40619         writeVarint(val) {
40620           val = +val || 0;
40621           if (val > 268435455 || val < 0) {
40622             writeBigVarint(val, this);
40623             return;
40624           }
40625           this.realloc(4);
40626           this.buf[this.pos++] = val & 127 | (val > 127 ? 128 : 0);
40627           if (val <= 127) return;
40628           this.buf[this.pos++] = (val >>>= 7) & 127 | (val > 127 ? 128 : 0);
40629           if (val <= 127) return;
40630           this.buf[this.pos++] = (val >>>= 7) & 127 | (val > 127 ? 128 : 0);
40631           if (val <= 127) return;
40632           this.buf[this.pos++] = val >>> 7 & 127;
40633         }
40634         /** @param {number} val */
40635         writeSVarint(val) {
40636           this.writeVarint(val < 0 ? -val * 2 - 1 : val * 2);
40637         }
40638         /** @param {boolean} val */
40639         writeBoolean(val) {
40640           this.writeVarint(+val);
40641         }
40642         /** @param {string} str */
40643         writeString(str) {
40644           str = String(str);
40645           this.realloc(str.length * 4);
40646           this.pos++;
40647           const startPos = this.pos;
40648           this.pos = writeUtf8(this.buf, str, this.pos);
40649           const len = this.pos - startPos;
40650           if (len >= 128) makeRoomForExtraLength(startPos, len, this);
40651           this.pos = startPos - 1;
40652           this.writeVarint(len);
40653           this.pos += len;
40654         }
40655         /** @param {number} val */
40656         writeFloat(val) {
40657           this.realloc(4);
40658           this.dataView.setFloat32(this.pos, val, true);
40659           this.pos += 4;
40660         }
40661         /** @param {number} val */
40662         writeDouble(val) {
40663           this.realloc(8);
40664           this.dataView.setFloat64(this.pos, val, true);
40665           this.pos += 8;
40666         }
40667         /** @param {Uint8Array} buffer */
40668         writeBytes(buffer) {
40669           const len = buffer.length;
40670           this.writeVarint(len);
40671           this.realloc(len);
40672           for (let i3 = 0; i3 < len; i3++) this.buf[this.pos++] = buffer[i3];
40673         }
40674         /**
40675          * @template T
40676          * @param {(obj: T, pbf: Pbf) => void} fn
40677          * @param {T} obj
40678          */
40679         writeRawMessage(fn, obj) {
40680           this.pos++;
40681           const startPos = this.pos;
40682           fn(obj, this);
40683           const len = this.pos - startPos;
40684           if (len >= 128) makeRoomForExtraLength(startPos, len, this);
40685           this.pos = startPos - 1;
40686           this.writeVarint(len);
40687           this.pos += len;
40688         }
40689         /**
40690          * @template T
40691          * @param {number} tag
40692          * @param {(obj: T, pbf: Pbf) => void} fn
40693          * @param {T} obj
40694          */
40695         writeMessage(tag2, fn, obj) {
40696           this.writeTag(tag2, PBF_BYTES);
40697           this.writeRawMessage(fn, obj);
40698         }
40699         /**
40700          * @param {number} tag
40701          * @param {number[]} arr
40702          */
40703         writePackedVarint(tag2, arr) {
40704           if (arr.length) this.writeMessage(tag2, writePackedVarint, arr);
40705         }
40706         /**
40707          * @param {number} tag
40708          * @param {number[]} arr
40709          */
40710         writePackedSVarint(tag2, arr) {
40711           if (arr.length) this.writeMessage(tag2, writePackedSVarint, arr);
40712         }
40713         /**
40714          * @param {number} tag
40715          * @param {boolean[]} arr
40716          */
40717         writePackedBoolean(tag2, arr) {
40718           if (arr.length) this.writeMessage(tag2, writePackedBoolean, arr);
40719         }
40720         /**
40721          * @param {number} tag
40722          * @param {number[]} arr
40723          */
40724         writePackedFloat(tag2, arr) {
40725           if (arr.length) this.writeMessage(tag2, writePackedFloat, arr);
40726         }
40727         /**
40728          * @param {number} tag
40729          * @param {number[]} arr
40730          */
40731         writePackedDouble(tag2, arr) {
40732           if (arr.length) this.writeMessage(tag2, writePackedDouble, arr);
40733         }
40734         /**
40735          * @param {number} tag
40736          * @param {number[]} arr
40737          */
40738         writePackedFixed32(tag2, arr) {
40739           if (arr.length) this.writeMessage(tag2, writePackedFixed32, arr);
40740         }
40741         /**
40742          * @param {number} tag
40743          * @param {number[]} arr
40744          */
40745         writePackedSFixed32(tag2, arr) {
40746           if (arr.length) this.writeMessage(tag2, writePackedSFixed32, arr);
40747         }
40748         /**
40749          * @param {number} tag
40750          * @param {number[]} arr
40751          */
40752         writePackedFixed64(tag2, arr) {
40753           if (arr.length) this.writeMessage(tag2, writePackedFixed64, arr);
40754         }
40755         /**
40756          * @param {number} tag
40757          * @param {number[]} arr
40758          */
40759         writePackedSFixed64(tag2, arr) {
40760           if (arr.length) this.writeMessage(tag2, writePackedSFixed64, arr);
40761         }
40762         /**
40763          * @param {number} tag
40764          * @param {Uint8Array} buffer
40765          */
40766         writeBytesField(tag2, buffer) {
40767           this.writeTag(tag2, PBF_BYTES);
40768           this.writeBytes(buffer);
40769         }
40770         /**
40771          * @param {number} tag
40772          * @param {number} val
40773          */
40774         writeFixed32Field(tag2, val) {
40775           this.writeTag(tag2, PBF_FIXED32);
40776           this.writeFixed32(val);
40777         }
40778         /**
40779          * @param {number} tag
40780          * @param {number} val
40781          */
40782         writeSFixed32Field(tag2, val) {
40783           this.writeTag(tag2, PBF_FIXED32);
40784           this.writeSFixed32(val);
40785         }
40786         /**
40787          * @param {number} tag
40788          * @param {number} val
40789          */
40790         writeFixed64Field(tag2, val) {
40791           this.writeTag(tag2, PBF_FIXED64);
40792           this.writeFixed64(val);
40793         }
40794         /**
40795          * @param {number} tag
40796          * @param {number} val
40797          */
40798         writeSFixed64Field(tag2, val) {
40799           this.writeTag(tag2, PBF_FIXED64);
40800           this.writeSFixed64(val);
40801         }
40802         /**
40803          * @param {number} tag
40804          * @param {number} val
40805          */
40806         writeVarintField(tag2, val) {
40807           this.writeTag(tag2, PBF_VARINT);
40808           this.writeVarint(val);
40809         }
40810         /**
40811          * @param {number} tag
40812          * @param {number} val
40813          */
40814         writeSVarintField(tag2, val) {
40815           this.writeTag(tag2, PBF_VARINT);
40816           this.writeSVarint(val);
40817         }
40818         /**
40819          * @param {number} tag
40820          * @param {string} str
40821          */
40822         writeStringField(tag2, str) {
40823           this.writeTag(tag2, PBF_BYTES);
40824           this.writeString(str);
40825         }
40826         /**
40827          * @param {number} tag
40828          * @param {number} val
40829          */
40830         writeFloatField(tag2, val) {
40831           this.writeTag(tag2, PBF_FIXED32);
40832           this.writeFloat(val);
40833         }
40834         /**
40835          * @param {number} tag
40836          * @param {number} val
40837          */
40838         writeDoubleField(tag2, val) {
40839           this.writeTag(tag2, PBF_FIXED64);
40840           this.writeDouble(val);
40841         }
40842         /**
40843          * @param {number} tag
40844          * @param {boolean} val
40845          */
40846         writeBooleanField(tag2, val) {
40847           this.writeVarintField(tag2, +val);
40848         }
40849       };
40850     }
40851   });
40852
40853   // node_modules/@mapbox/point-geometry/index.js
40854   function Point(x2, y2) {
40855     this.x = x2;
40856     this.y = y2;
40857   }
40858   var init_point_geometry = __esm({
40859     "node_modules/@mapbox/point-geometry/index.js"() {
40860       Point.prototype = {
40861         /**
40862          * Clone this point, returning a new point that can be modified
40863          * without affecting the old one.
40864          * @return {Point} the clone
40865          */
40866         clone() {
40867           return new Point(this.x, this.y);
40868         },
40869         /**
40870          * Add this point's x & y coordinates to another point,
40871          * yielding a new point.
40872          * @param {Point} p the other point
40873          * @return {Point} output point
40874          */
40875         add(p2) {
40876           return this.clone()._add(p2);
40877         },
40878         /**
40879          * Subtract this point's x & y coordinates to from point,
40880          * yielding a new point.
40881          * @param {Point} p the other point
40882          * @return {Point} output point
40883          */
40884         sub(p2) {
40885           return this.clone()._sub(p2);
40886         },
40887         /**
40888          * Multiply this point's x & y coordinates by point,
40889          * yielding a new point.
40890          * @param {Point} p the other point
40891          * @return {Point} output point
40892          */
40893         multByPoint(p2) {
40894           return this.clone()._multByPoint(p2);
40895         },
40896         /**
40897          * Divide this point's x & y coordinates by point,
40898          * yielding a new point.
40899          * @param {Point} p the other point
40900          * @return {Point} output point
40901          */
40902         divByPoint(p2) {
40903           return this.clone()._divByPoint(p2);
40904         },
40905         /**
40906          * Multiply this point's x & y coordinates by a factor,
40907          * yielding a new point.
40908          * @param {number} k factor
40909          * @return {Point} output point
40910          */
40911         mult(k2) {
40912           return this.clone()._mult(k2);
40913         },
40914         /**
40915          * Divide this point's x & y coordinates by a factor,
40916          * yielding a new point.
40917          * @param {number} k factor
40918          * @return {Point} output point
40919          */
40920         div(k2) {
40921           return this.clone()._div(k2);
40922         },
40923         /**
40924          * Rotate this point around the 0, 0 origin by an angle a,
40925          * given in radians
40926          * @param {number} a angle to rotate around, in radians
40927          * @return {Point} output point
40928          */
40929         rotate(a2) {
40930           return this.clone()._rotate(a2);
40931         },
40932         /**
40933          * Rotate this point around p point by an angle a,
40934          * given in radians
40935          * @param {number} a angle to rotate around, in radians
40936          * @param {Point} p Point to rotate around
40937          * @return {Point} output point
40938          */
40939         rotateAround(a2, p2) {
40940           return this.clone()._rotateAround(a2, p2);
40941         },
40942         /**
40943          * Multiply this point by a 4x1 transformation matrix
40944          * @param {[number, number, number, number]} m transformation matrix
40945          * @return {Point} output point
40946          */
40947         matMult(m2) {
40948           return this.clone()._matMult(m2);
40949         },
40950         /**
40951          * Calculate this point but as a unit vector from 0, 0, meaning
40952          * that the distance from the resulting point to the 0, 0
40953          * coordinate will be equal to 1 and the angle from the resulting
40954          * point to the 0, 0 coordinate will be the same as before.
40955          * @return {Point} unit vector point
40956          */
40957         unit() {
40958           return this.clone()._unit();
40959         },
40960         /**
40961          * Compute a perpendicular point, where the new y coordinate
40962          * is the old x coordinate and the new x coordinate is the old y
40963          * coordinate multiplied by -1
40964          * @return {Point} perpendicular point
40965          */
40966         perp() {
40967           return this.clone()._perp();
40968         },
40969         /**
40970          * Return a version of this point with the x & y coordinates
40971          * rounded to integers.
40972          * @return {Point} rounded point
40973          */
40974         round() {
40975           return this.clone()._round();
40976         },
40977         /**
40978          * Return the magnitude of this point: this is the Euclidean
40979          * distance from the 0, 0 coordinate to this point's x and y
40980          * coordinates.
40981          * @return {number} magnitude
40982          */
40983         mag() {
40984           return Math.sqrt(this.x * this.x + this.y * this.y);
40985         },
40986         /**
40987          * Judge whether this point is equal to another point, returning
40988          * true or false.
40989          * @param {Point} other the other point
40990          * @return {boolean} whether the points are equal
40991          */
40992         equals(other2) {
40993           return this.x === other2.x && this.y === other2.y;
40994         },
40995         /**
40996          * Calculate the distance from this point to another point
40997          * @param {Point} p the other point
40998          * @return {number} distance
40999          */
41000         dist(p2) {
41001           return Math.sqrt(this.distSqr(p2));
41002         },
41003         /**
41004          * Calculate the distance from this point to another point,
41005          * without the square root step. Useful if you're comparing
41006          * relative distances.
41007          * @param {Point} p the other point
41008          * @return {number} distance
41009          */
41010         distSqr(p2) {
41011           const dx = p2.x - this.x, dy = p2.y - this.y;
41012           return dx * dx + dy * dy;
41013         },
41014         /**
41015          * Get the angle from the 0, 0 coordinate to this point, in radians
41016          * coordinates.
41017          * @return {number} angle
41018          */
41019         angle() {
41020           return Math.atan2(this.y, this.x);
41021         },
41022         /**
41023          * Get the angle from this point to another point, in radians
41024          * @param {Point} b the other point
41025          * @return {number} angle
41026          */
41027         angleTo(b2) {
41028           return Math.atan2(this.y - b2.y, this.x - b2.x);
41029         },
41030         /**
41031          * Get the angle between this point and another point, in radians
41032          * @param {Point} b the other point
41033          * @return {number} angle
41034          */
41035         angleWith(b2) {
41036           return this.angleWithSep(b2.x, b2.y);
41037         },
41038         /**
41039          * Find the angle of the two vectors, solving the formula for
41040          * the cross product a x b = |a||b|sin(θ) for θ.
41041          * @param {number} x the x-coordinate
41042          * @param {number} y the y-coordinate
41043          * @return {number} the angle in radians
41044          */
41045         angleWithSep(x2, y2) {
41046           return Math.atan2(
41047             this.x * y2 - this.y * x2,
41048             this.x * x2 + this.y * y2
41049           );
41050         },
41051         /** @param {[number, number, number, number]} m */
41052         _matMult(m2) {
41053           const x2 = m2[0] * this.x + m2[1] * this.y, y2 = m2[2] * this.x + m2[3] * this.y;
41054           this.x = x2;
41055           this.y = y2;
41056           return this;
41057         },
41058         /** @param {Point} p */
41059         _add(p2) {
41060           this.x += p2.x;
41061           this.y += p2.y;
41062           return this;
41063         },
41064         /** @param {Point} p */
41065         _sub(p2) {
41066           this.x -= p2.x;
41067           this.y -= p2.y;
41068           return this;
41069         },
41070         /** @param {number} k */
41071         _mult(k2) {
41072           this.x *= k2;
41073           this.y *= k2;
41074           return this;
41075         },
41076         /** @param {number} k */
41077         _div(k2) {
41078           this.x /= k2;
41079           this.y /= k2;
41080           return this;
41081         },
41082         /** @param {Point} p */
41083         _multByPoint(p2) {
41084           this.x *= p2.x;
41085           this.y *= p2.y;
41086           return this;
41087         },
41088         /** @param {Point} p */
41089         _divByPoint(p2) {
41090           this.x /= p2.x;
41091           this.y /= p2.y;
41092           return this;
41093         },
41094         _unit() {
41095           this._div(this.mag());
41096           return this;
41097         },
41098         _perp() {
41099           const y2 = this.y;
41100           this.y = this.x;
41101           this.x = -y2;
41102           return this;
41103         },
41104         /** @param {number} angle */
41105         _rotate(angle2) {
41106           const cos2 = Math.cos(angle2), sin2 = Math.sin(angle2), x2 = cos2 * this.x - sin2 * this.y, y2 = sin2 * this.x + cos2 * this.y;
41107           this.x = x2;
41108           this.y = y2;
41109           return this;
41110         },
41111         /**
41112          * @param {number} angle
41113          * @param {Point} p
41114          */
41115         _rotateAround(angle2, p2) {
41116           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);
41117           this.x = x2;
41118           this.y = y2;
41119           return this;
41120         },
41121         _round() {
41122           this.x = Math.round(this.x);
41123           this.y = Math.round(this.y);
41124           return this;
41125         },
41126         constructor: Point
41127       };
41128       Point.convert = function(p2) {
41129         if (p2 instanceof Point) {
41130           return (
41131             /** @type {Point} */
41132             p2
41133           );
41134         }
41135         if (Array.isArray(p2)) {
41136           return new Point(+p2[0], +p2[1]);
41137         }
41138         if (p2.x !== void 0 && p2.y !== void 0) {
41139           return new Point(+p2.x, +p2.y);
41140         }
41141         throw new Error("Expected [x, y] or {x, y} point format");
41142       };
41143     }
41144   });
41145
41146   // node_modules/@mapbox/vector-tile/index.js
41147   function readFeature(tag2, feature3, pbf) {
41148     if (tag2 === 1) feature3.id = pbf.readVarint();
41149     else if (tag2 === 2) readTag(pbf, feature3);
41150     else if (tag2 === 3) feature3.type = /** @type {0 | 1 | 2 | 3} */
41151     pbf.readVarint();
41152     else if (tag2 === 4) feature3._geometry = pbf.pos;
41153   }
41154   function readTag(pbf, feature3) {
41155     const end = pbf.readVarint() + pbf.pos;
41156     while (pbf.pos < end) {
41157       const key = feature3._keys[pbf.readVarint()], value = feature3._values[pbf.readVarint()];
41158       feature3.properties[key] = value;
41159     }
41160   }
41161   function classifyRings(rings) {
41162     const len = rings.length;
41163     if (len <= 1) return [rings];
41164     const polygons = [];
41165     let polygon2, ccw;
41166     for (let i3 = 0; i3 < len; i3++) {
41167       const area = signedArea(rings[i3]);
41168       if (area === 0) continue;
41169       if (ccw === void 0) ccw = area < 0;
41170       if (ccw === area < 0) {
41171         if (polygon2) polygons.push(polygon2);
41172         polygon2 = [rings[i3]];
41173       } else if (polygon2) {
41174         polygon2.push(rings[i3]);
41175       }
41176     }
41177     if (polygon2) polygons.push(polygon2);
41178     return polygons;
41179   }
41180   function signedArea(ring) {
41181     let sum = 0;
41182     for (let i3 = 0, len = ring.length, j2 = len - 1, p1, p2; i3 < len; j2 = i3++) {
41183       p1 = ring[i3];
41184       p2 = ring[j2];
41185       sum += (p2.x - p1.x) * (p1.y + p2.y);
41186     }
41187     return sum;
41188   }
41189   function readLayer(tag2, layer, pbf) {
41190     if (tag2 === 15) layer.version = pbf.readVarint();
41191     else if (tag2 === 1) layer.name = pbf.readString();
41192     else if (tag2 === 5) layer.extent = pbf.readVarint();
41193     else if (tag2 === 2) layer._features.push(pbf.pos);
41194     else if (tag2 === 3) layer._keys.push(pbf.readString());
41195     else if (tag2 === 4) layer._values.push(readValueMessage(pbf));
41196   }
41197   function readValueMessage(pbf) {
41198     let value = null;
41199     const end = pbf.readVarint() + pbf.pos;
41200     while (pbf.pos < end) {
41201       const tag2 = pbf.readVarint() >> 3;
41202       value = tag2 === 1 ? pbf.readString() : tag2 === 2 ? pbf.readFloat() : tag2 === 3 ? pbf.readDouble() : tag2 === 4 ? pbf.readVarint64() : tag2 === 5 ? pbf.readVarint() : tag2 === 6 ? pbf.readSVarint() : tag2 === 7 ? pbf.readBoolean() : null;
41203     }
41204     return value;
41205   }
41206   function readTile(tag2, layers, pbf) {
41207     if (tag2 === 3) {
41208       const layer = new VectorTileLayer(pbf, pbf.readVarint() + pbf.pos);
41209       if (layer.length) layers[layer.name] = layer;
41210     }
41211   }
41212   var VectorTileFeature, VectorTileLayer, VectorTile;
41213   var init_vector_tile = __esm({
41214     "node_modules/@mapbox/vector-tile/index.js"() {
41215       init_point_geometry();
41216       VectorTileFeature = class {
41217         /**
41218          * @param {Pbf} pbf
41219          * @param {number} end
41220          * @param {number} extent
41221          * @param {string[]} keys
41222          * @param {unknown[]} values
41223          */
41224         constructor(pbf, end, extent, keys2, values) {
41225           this.properties = {};
41226           this.extent = extent;
41227           this.type = 0;
41228           this.id = void 0;
41229           this._pbf = pbf;
41230           this._geometry = -1;
41231           this._keys = keys2;
41232           this._values = values;
41233           pbf.readFields(readFeature, this, end);
41234         }
41235         loadGeometry() {
41236           const pbf = this._pbf;
41237           pbf.pos = this._geometry;
41238           const end = pbf.readVarint() + pbf.pos;
41239           const lines = [];
41240           let line;
41241           let cmd = 1;
41242           let length2 = 0;
41243           let x2 = 0;
41244           let y2 = 0;
41245           while (pbf.pos < end) {
41246             if (length2 <= 0) {
41247               const cmdLen = pbf.readVarint();
41248               cmd = cmdLen & 7;
41249               length2 = cmdLen >> 3;
41250             }
41251             length2--;
41252             if (cmd === 1 || cmd === 2) {
41253               x2 += pbf.readSVarint();
41254               y2 += pbf.readSVarint();
41255               if (cmd === 1) {
41256                 if (line) lines.push(line);
41257                 line = [];
41258               }
41259               if (line) line.push(new Point(x2, y2));
41260             } else if (cmd === 7) {
41261               if (line) {
41262                 line.push(line[0].clone());
41263               }
41264             } else {
41265               throw new Error(`unknown command ${cmd}`);
41266             }
41267           }
41268           if (line) lines.push(line);
41269           return lines;
41270         }
41271         bbox() {
41272           const pbf = this._pbf;
41273           pbf.pos = this._geometry;
41274           const end = pbf.readVarint() + pbf.pos;
41275           let cmd = 1, length2 = 0, x2 = 0, y2 = 0, x12 = Infinity, x22 = -Infinity, y12 = Infinity, y22 = -Infinity;
41276           while (pbf.pos < end) {
41277             if (length2 <= 0) {
41278               const cmdLen = pbf.readVarint();
41279               cmd = cmdLen & 7;
41280               length2 = cmdLen >> 3;
41281             }
41282             length2--;
41283             if (cmd === 1 || cmd === 2) {
41284               x2 += pbf.readSVarint();
41285               y2 += pbf.readSVarint();
41286               if (x2 < x12) x12 = x2;
41287               if (x2 > x22) x22 = x2;
41288               if (y2 < y12) y12 = y2;
41289               if (y2 > y22) y22 = y2;
41290             } else if (cmd !== 7) {
41291               throw new Error(`unknown command ${cmd}`);
41292             }
41293           }
41294           return [x12, y12, x22, y22];
41295         }
41296         /**
41297          * @param {number} x
41298          * @param {number} y
41299          * @param {number} z
41300          * @return {Feature}
41301          */
41302         toGeoJSON(x2, y2, z2) {
41303           const size = this.extent * Math.pow(2, z2), x05 = this.extent * x2, y05 = this.extent * y2, vtCoords = this.loadGeometry();
41304           function projectPoint(p2) {
41305             return [
41306               (p2.x + x05) * 360 / size - 180,
41307               360 / Math.PI * Math.atan(Math.exp((1 - (p2.y + y05) * 2 / size) * Math.PI)) - 90
41308             ];
41309           }
41310           function projectLine(line) {
41311             return line.map(projectPoint);
41312           }
41313           let geometry;
41314           if (this.type === 1) {
41315             const points = [];
41316             for (const line of vtCoords) {
41317               points.push(line[0]);
41318             }
41319             const coordinates = projectLine(points);
41320             geometry = points.length === 1 ? { type: "Point", coordinates: coordinates[0] } : { type: "MultiPoint", coordinates };
41321           } else if (this.type === 2) {
41322             const coordinates = vtCoords.map(projectLine);
41323             geometry = coordinates.length === 1 ? { type: "LineString", coordinates: coordinates[0] } : { type: "MultiLineString", coordinates };
41324           } else if (this.type === 3) {
41325             const polygons = classifyRings(vtCoords);
41326             const coordinates = [];
41327             for (const polygon2 of polygons) {
41328               coordinates.push(polygon2.map(projectLine));
41329             }
41330             geometry = coordinates.length === 1 ? { type: "Polygon", coordinates: coordinates[0] } : { type: "MultiPolygon", coordinates };
41331           } else {
41332             throw new Error("unknown feature type");
41333           }
41334           const result = {
41335             type: "Feature",
41336             geometry,
41337             properties: this.properties
41338           };
41339           if (this.id != null) {
41340             result.id = this.id;
41341           }
41342           return result;
41343         }
41344       };
41345       VectorTileFeature.types = ["Unknown", "Point", "LineString", "Polygon"];
41346       VectorTileLayer = class {
41347         /**
41348          * @param {Pbf} pbf
41349          * @param {number} [end]
41350          */
41351         constructor(pbf, end) {
41352           this.version = 1;
41353           this.name = "";
41354           this.extent = 4096;
41355           this.length = 0;
41356           this._pbf = pbf;
41357           this._keys = [];
41358           this._values = [];
41359           this._features = [];
41360           pbf.readFields(readLayer, this, end);
41361           this.length = this._features.length;
41362         }
41363         /** return feature `i` from this layer as a `VectorTileFeature`
41364          * @param {number} i
41365          */
41366         feature(i3) {
41367           if (i3 < 0 || i3 >= this._features.length) throw new Error("feature index out of bounds");
41368           this._pbf.pos = this._features[i3];
41369           const end = this._pbf.readVarint() + this._pbf.pos;
41370           return new VectorTileFeature(this._pbf, end, this.extent, this._keys, this._values);
41371         }
41372       };
41373       VectorTile = class {
41374         /**
41375          * @param {Pbf} pbf
41376          * @param {number} [end]
41377          */
41378         constructor(pbf, end) {
41379           this.layers = pbf.readFields(readTile, {}, end);
41380         }
41381       };
41382     }
41383   });
41384
41385   // modules/services/mapillary.js
41386   var mapillary_exports = {};
41387   __export(mapillary_exports, {
41388     default: () => mapillary_default
41389   });
41390   function loadTiles(which, url, maxZoom2, projection2) {
41391     const tiler8 = utilTiler().zoomExtent([minZoom, maxZoom2]).skipNullIsland(true);
41392     const tiles = tiler8.getTiles(projection2);
41393     tiles.forEach(function(tile) {
41394       loadTile(which, url, tile);
41395     });
41396   }
41397   function loadTile(which, url, tile) {
41398     const cache = _mlyCache.requests;
41399     const tileId = `${tile.id}-${which}`;
41400     if (cache.loaded[tileId] || cache.inflight[tileId]) return;
41401     const controller = new AbortController();
41402     cache.inflight[tileId] = controller;
41403     const requestUrl = url.replace("{x}", tile.xyz[0]).replace("{y}", tile.xyz[1]).replace("{z}", tile.xyz[2]);
41404     fetch(requestUrl, { signal: controller.signal }).then(function(response) {
41405       if (!response.ok) {
41406         throw new Error(response.status + " " + response.statusText);
41407       }
41408       cache.loaded[tileId] = true;
41409       delete cache.inflight[tileId];
41410       return response.arrayBuffer();
41411     }).then(function(data) {
41412       if (!data) {
41413         throw new Error("No Data");
41414       }
41415       loadTileDataToCache(data, tile, which);
41416       if (which === "images") {
41417         dispatch4.call("loadedImages");
41418       } else if (which === "signs") {
41419         dispatch4.call("loadedSigns");
41420       } else if (which === "points") {
41421         dispatch4.call("loadedMapFeatures");
41422       }
41423     }).catch(function() {
41424       cache.loaded[tileId] = true;
41425       delete cache.inflight[tileId];
41426     });
41427   }
41428   function loadTileDataToCache(data, tile, which) {
41429     const vectorTile = new VectorTile(new Pbf(data));
41430     let features, cache, layer, i3, feature3, loc, d2;
41431     if (vectorTile.layers.hasOwnProperty("image")) {
41432       features = [];
41433       cache = _mlyCache.images;
41434       layer = vectorTile.layers.image;
41435       for (i3 = 0; i3 < layer.length; i3++) {
41436         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
41437         loc = feature3.geometry.coordinates;
41438         d2 = {
41439           loc,
41440           captured_at: feature3.properties.captured_at,
41441           ca: feature3.properties.compass_angle,
41442           id: feature3.properties.id,
41443           is_pano: feature3.properties.is_pano,
41444           sequence_id: feature3.properties.sequence_id
41445         };
41446         cache.forImageId[d2.id] = d2;
41447         features.push({
41448           minX: loc[0],
41449           minY: loc[1],
41450           maxX: loc[0],
41451           maxY: loc[1],
41452           data: d2
41453         });
41454       }
41455       if (cache.rtree) {
41456         cache.rtree.load(features);
41457       }
41458     }
41459     if (vectorTile.layers.hasOwnProperty("sequence")) {
41460       features = [];
41461       cache = _mlyCache.sequences;
41462       layer = vectorTile.layers.sequence;
41463       for (i3 = 0; i3 < layer.length; i3++) {
41464         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
41465         if (cache.lineString[feature3.properties.id]) {
41466           cache.lineString[feature3.properties.id].push(feature3);
41467         } else {
41468           cache.lineString[feature3.properties.id] = [feature3];
41469         }
41470       }
41471     }
41472     if (vectorTile.layers.hasOwnProperty("point")) {
41473       features = [];
41474       cache = _mlyCache[which];
41475       layer = vectorTile.layers.point;
41476       for (i3 = 0; i3 < layer.length; i3++) {
41477         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
41478         loc = feature3.geometry.coordinates;
41479         d2 = {
41480           loc,
41481           id: feature3.properties.id,
41482           first_seen_at: feature3.properties.first_seen_at,
41483           last_seen_at: feature3.properties.last_seen_at,
41484           value: feature3.properties.value
41485         };
41486         features.push({
41487           minX: loc[0],
41488           minY: loc[1],
41489           maxX: loc[0],
41490           maxY: loc[1],
41491           data: d2
41492         });
41493       }
41494       if (cache.rtree) {
41495         cache.rtree.load(features);
41496       }
41497     }
41498     if (vectorTile.layers.hasOwnProperty("traffic_sign")) {
41499       features = [];
41500       cache = _mlyCache[which];
41501       layer = vectorTile.layers.traffic_sign;
41502       for (i3 = 0; i3 < layer.length; i3++) {
41503         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
41504         loc = feature3.geometry.coordinates;
41505         d2 = {
41506           loc,
41507           id: feature3.properties.id,
41508           first_seen_at: feature3.properties.first_seen_at,
41509           last_seen_at: feature3.properties.last_seen_at,
41510           value: feature3.properties.value
41511         };
41512         features.push({
41513           minX: loc[0],
41514           minY: loc[1],
41515           maxX: loc[0],
41516           maxY: loc[1],
41517           data: d2
41518         });
41519       }
41520       if (cache.rtree) {
41521         cache.rtree.load(features);
41522       }
41523     }
41524   }
41525   function loadData(url) {
41526     return fetch(url).then(function(response) {
41527       if (!response.ok) {
41528         throw new Error(response.status + " " + response.statusText);
41529       }
41530       return response.json();
41531     }).then(function(result) {
41532       if (!result) {
41533         return [];
41534       }
41535       return result.data || [];
41536     });
41537   }
41538   function partitionViewport(projection2) {
41539     const z2 = geoScaleToZoom(projection2.scale());
41540     const z22 = Math.ceil(z2 * 2) / 2 + 2.5;
41541     const tiler8 = utilTiler().zoomExtent([z22, z22]);
41542     return tiler8.getTiles(projection2).map(function(tile) {
41543       return tile.extent;
41544     });
41545   }
41546   function searchLimited(limit, projection2, rtree) {
41547     limit = limit || 5;
41548     return partitionViewport(projection2).reduce(function(result, extent) {
41549       const found = rtree.search(extent.bbox()).slice(0, limit).map(function(d2) {
41550         return d2.data;
41551       });
41552       return found.length ? result.concat(found) : result;
41553     }, []);
41554   }
41555   var accessToken, apiUrl, baseTileUrl, mapFeatureTileUrl, tileUrl, trafficSignTileUrl, viewercss, viewerjs, minZoom, dispatch4, _loadViewerPromise, _mlyActiveImage, _mlyCache, _mlyFallback, _mlyHighlightedDetection, _mlyShowFeatureDetections, _mlyShowSignDetections, _mlyViewer, _mlyViewerFilter, _isViewerOpen, mapillary_default;
41556   var init_mapillary = __esm({
41557     "modules/services/mapillary.js"() {
41558       "use strict";
41559       init_src4();
41560       init_src5();
41561       init_pbf();
41562       init_rbush();
41563       init_vector_tile();
41564       init_geo2();
41565       init_util();
41566       accessToken = "MLY|4100327730013843|5bb78b81720791946a9a7b956c57b7cf";
41567       apiUrl = "https://graph.mapillary.com/";
41568       baseTileUrl = "https://tiles.mapillary.com/maps/vtp";
41569       mapFeatureTileUrl = `${baseTileUrl}/mly_map_feature_point/2/{z}/{x}/{y}?access_token=${accessToken}`;
41570       tileUrl = `${baseTileUrl}/mly1_public/2/{z}/{x}/{y}?access_token=${accessToken}`;
41571       trafficSignTileUrl = `${baseTileUrl}/mly_map_feature_traffic_sign/2/{z}/{x}/{y}?access_token=${accessToken}`;
41572       viewercss = "mapillary-js/mapillary.css";
41573       viewerjs = "mapillary-js/mapillary.js";
41574       minZoom = 14;
41575       dispatch4 = dispatch_default("change", "loadedImages", "loadedSigns", "loadedMapFeatures", "bearingChanged", "imageChanged");
41576       _mlyFallback = false;
41577       _mlyShowFeatureDetections = false;
41578       _mlyShowSignDetections = false;
41579       _mlyViewerFilter = ["all"];
41580       _isViewerOpen = false;
41581       mapillary_default = {
41582         // Initialize Mapillary
41583         init: function() {
41584           if (!_mlyCache) {
41585             this.reset();
41586           }
41587           this.event = utilRebind(this, dispatch4, "on");
41588         },
41589         // Reset cache and state
41590         reset: function() {
41591           if (_mlyCache) {
41592             Object.values(_mlyCache.requests.inflight).forEach(function(request3) {
41593               request3.abort();
41594             });
41595           }
41596           _mlyCache = {
41597             images: { rtree: new RBush(), forImageId: {} },
41598             image_detections: { forImageId: {} },
41599             signs: { rtree: new RBush() },
41600             points: { rtree: new RBush() },
41601             sequences: { rtree: new RBush(), lineString: {} },
41602             requests: { loaded: {}, inflight: {} }
41603           };
41604           _mlyActiveImage = null;
41605         },
41606         // Get visible images
41607         images: function(projection2) {
41608           const limit = 5;
41609           return searchLimited(limit, projection2, _mlyCache.images.rtree);
41610         },
41611         // Get visible traffic signs
41612         signs: function(projection2) {
41613           const limit = 5;
41614           return searchLimited(limit, projection2, _mlyCache.signs.rtree);
41615         },
41616         // Get visible map (point) features
41617         mapFeatures: function(projection2) {
41618           const limit = 5;
41619           return searchLimited(limit, projection2, _mlyCache.points.rtree);
41620         },
41621         // Get cached image by id
41622         cachedImage: function(imageId) {
41623           return _mlyCache.images.forImageId[imageId];
41624         },
41625         // Get visible sequences
41626         sequences: function(projection2) {
41627           const viewport = projection2.clipExtent();
41628           const min3 = [viewport[0][0], viewport[1][1]];
41629           const max3 = [viewport[1][0], viewport[0][1]];
41630           const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
41631           const sequenceIds = {};
41632           let lineStrings = [];
41633           _mlyCache.images.rtree.search(bbox2).forEach(function(d2) {
41634             if (d2.data.sequence_id) {
41635               sequenceIds[d2.data.sequence_id] = true;
41636             }
41637           });
41638           Object.keys(sequenceIds).forEach(function(sequenceId) {
41639             if (_mlyCache.sequences.lineString[sequenceId]) {
41640               lineStrings = lineStrings.concat(_mlyCache.sequences.lineString[sequenceId]);
41641             }
41642           });
41643           return lineStrings;
41644         },
41645         // Load images in the visible area
41646         loadImages: function(projection2) {
41647           loadTiles("images", tileUrl, 14, projection2);
41648         },
41649         // Load traffic signs in the visible area
41650         loadSigns: function(projection2) {
41651           loadTiles("signs", trafficSignTileUrl, 14, projection2);
41652         },
41653         // Load map (point) features in the visible area
41654         loadMapFeatures: function(projection2) {
41655           loadTiles("points", mapFeatureTileUrl, 14, projection2);
41656         },
41657         // Return a promise that resolves when the image viewer (Mapillary JS) library has finished loading
41658         ensureViewerLoaded: function(context) {
41659           if (_loadViewerPromise) return _loadViewerPromise;
41660           const wrap2 = context.container().select(".photoviewer").selectAll(".mly-wrapper").data([0]);
41661           wrap2.enter().append("div").attr("id", "ideditor-mly").attr("class", "photo-wrapper mly-wrapper").classed("hide", true);
41662           const that = this;
41663           _loadViewerPromise = new Promise((resolve, reject) => {
41664             let loadedCount = 0;
41665             function loaded() {
41666               loadedCount += 1;
41667               if (loadedCount === 2) resolve();
41668             }
41669             const head = select_default2("head");
41670             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() {
41671               reject();
41672             });
41673             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() {
41674               reject();
41675             });
41676           }).catch(function() {
41677             _loadViewerPromise = null;
41678           }).then(function() {
41679             that.initViewer(context);
41680           });
41681           return _loadViewerPromise;
41682         },
41683         // Load traffic sign image sprites
41684         loadSignResources: function(context) {
41685           context.ui().svgDefs.addSprites(
41686             ["mapillary-sprite"],
41687             false
41688             /* don't override colors */
41689           );
41690           return this;
41691         },
41692         // Load map (point) feature image sprites
41693         loadObjectResources: function(context) {
41694           context.ui().svgDefs.addSprites(
41695             ["mapillary-object-sprite"],
41696             false
41697             /* don't override colors */
41698           );
41699           return this;
41700         },
41701         // Remove previous detections in image viewer
41702         resetTags: function() {
41703           if (_mlyViewer && !_mlyFallback) {
41704             _mlyViewer.getComponent("tag").removeAll();
41705           }
41706         },
41707         // Show map feature detections in image viewer
41708         showFeatureDetections: function(value) {
41709           _mlyShowFeatureDetections = value;
41710           if (!_mlyShowFeatureDetections && !_mlyShowSignDetections) {
41711             this.resetTags();
41712           }
41713         },
41714         // Show traffic sign detections in image viewer
41715         showSignDetections: function(value) {
41716           _mlyShowSignDetections = value;
41717           if (!_mlyShowFeatureDetections && !_mlyShowSignDetections) {
41718             this.resetTags();
41719           }
41720         },
41721         // Apply filter to image viewer
41722         filterViewer: function(context) {
41723           const showsPano = context.photos().showsPanoramic();
41724           const showsFlat = context.photos().showsFlat();
41725           const fromDate = context.photos().fromDate();
41726           const toDate = context.photos().toDate();
41727           const filter2 = ["all"];
41728           if (!showsPano) filter2.push(["!=", "cameraType", "spherical"]);
41729           if (!showsFlat && showsPano) filter2.push(["==", "pano", true]);
41730           if (fromDate) {
41731             filter2.push([">=", "capturedAt", new Date(fromDate).getTime()]);
41732           }
41733           if (toDate) {
41734             filter2.push([">=", "capturedAt", new Date(toDate).getTime()]);
41735           }
41736           if (_mlyViewer) {
41737             _mlyViewer.setFilter(filter2);
41738           }
41739           _mlyViewerFilter = filter2;
41740           return filter2;
41741         },
41742         // Make the image viewer visible
41743         showViewer: function(context) {
41744           const wrap2 = context.container().select(".photoviewer").classed("hide", false);
41745           const isHidden = wrap2.selectAll(".photo-wrapper.mly-wrapper.hide").size();
41746           if (isHidden && _mlyViewer) {
41747             wrap2.selectAll(".photo-wrapper:not(.mly-wrapper)").classed("hide", true);
41748             wrap2.selectAll(".photo-wrapper.mly-wrapper").classed("hide", false);
41749             _mlyViewer.resize();
41750           }
41751           _isViewerOpen = true;
41752           return this;
41753         },
41754         // Hide the image viewer and resets map markers
41755         hideViewer: function(context) {
41756           _mlyActiveImage = null;
41757           if (!_mlyFallback && _mlyViewer) {
41758             _mlyViewer.getComponent("sequence").stop();
41759           }
41760           const viewer = context.container().select(".photoviewer");
41761           if (!viewer.empty()) viewer.datum(null);
41762           viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
41763           this.updateUrlImage(null);
41764           dispatch4.call("imageChanged");
41765           dispatch4.call("loadedMapFeatures");
41766           dispatch4.call("loadedSigns");
41767           _isViewerOpen = false;
41768           return this.setStyles(context, null);
41769         },
41770         // Get viewer status
41771         isViewerOpen: function() {
41772           return _isViewerOpen;
41773         },
41774         // Update the URL with current image id
41775         updateUrlImage: function(imageId) {
41776           if (!window.mocha) {
41777             const hash2 = utilStringQs(window.location.hash);
41778             if (imageId) {
41779               hash2.photo = "mapillary/" + imageId;
41780             } else {
41781               delete hash2.photo;
41782             }
41783             window.location.replace("#" + utilQsString(hash2, true));
41784           }
41785         },
41786         // Highlight the detection in the viewer that is related to the clicked map feature
41787         highlightDetection: function(detection) {
41788           if (detection) {
41789             _mlyHighlightedDetection = detection.id;
41790           }
41791           return this;
41792         },
41793         // Initialize image viewer (Mapillar JS)
41794         initViewer: function(context) {
41795           const that = this;
41796           if (!window.mapillary) return;
41797           const opts = {
41798             accessToken,
41799             component: {
41800               cover: false,
41801               keyboard: false,
41802               tag: true
41803             },
41804             container: "ideditor-mly"
41805           };
41806           if (!mapillary.isSupported() && mapillary.isFallbackSupported()) {
41807             _mlyFallback = true;
41808             opts.component = {
41809               cover: false,
41810               direction: false,
41811               imagePlane: false,
41812               keyboard: false,
41813               mouse: false,
41814               sequence: false,
41815               tag: false,
41816               image: true,
41817               // fallback
41818               navigation: true
41819               // fallback
41820             };
41821           }
41822           _mlyViewer = new mapillary.Viewer(opts);
41823           _mlyViewer.on("image", imageChanged);
41824           _mlyViewer.on("bearing", bearingChanged);
41825           if (_mlyViewerFilter) {
41826             _mlyViewer.setFilter(_mlyViewerFilter);
41827           }
41828           context.ui().photoviewer.on("resize.mapillary", function() {
41829             if (_mlyViewer) _mlyViewer.resize();
41830           });
41831           function imageChanged(node) {
41832             that.resetTags();
41833             const image = node.image;
41834             that.setActiveImage(image);
41835             that.setStyles(context, null);
41836             const loc = [image.originalLngLat.lng, image.originalLngLat.lat];
41837             context.map().centerEase(loc);
41838             that.updateUrlImage(image.id);
41839             if (_mlyShowFeatureDetections || _mlyShowSignDetections) {
41840               that.updateDetections(image.id, `${apiUrl}/${image.id}/detections?access_token=${accessToken}&fields=id,image,geometry,value`);
41841             }
41842             dispatch4.call("imageChanged");
41843           }
41844           function bearingChanged(e3) {
41845             dispatch4.call("bearingChanged", void 0, e3);
41846           }
41847         },
41848         // Move to an image
41849         selectImage: function(context, imageId) {
41850           if (_mlyViewer && imageId) {
41851             _mlyViewer.moveTo(imageId).catch(function(e3) {
41852               console.error("mly3", e3);
41853             });
41854           }
41855           return this;
41856         },
41857         // Return the currently displayed image
41858         getActiveImage: function() {
41859           return _mlyActiveImage;
41860         },
41861         // Return a list of detection objects for the given id
41862         getDetections: function(id2) {
41863           return loadData(`${apiUrl}/${id2}/detections?access_token=${accessToken}&fields=id,value,image`);
41864         },
41865         // Set the currently visible image
41866         setActiveImage: function(image) {
41867           if (image) {
41868             _mlyActiveImage = {
41869               ca: image.originalCompassAngle,
41870               id: image.id,
41871               loc: [image.originalLngLat.lng, image.originalLngLat.lat],
41872               is_pano: image.cameraType === "spherical",
41873               sequence_id: image.sequenceId
41874             };
41875           } else {
41876             _mlyActiveImage = null;
41877           }
41878         },
41879         // Update the currently highlighted sequence and selected bubble.
41880         setStyles: function(context, hovered) {
41881           const hoveredImageId = hovered && hovered.id;
41882           const hoveredSequenceId = hovered && hovered.sequence_id;
41883           const selectedSequenceId = _mlyActiveImage && _mlyActiveImage.sequence_id;
41884           context.container().selectAll(".layer-mapillary .viewfield-group").classed("highlighted", function(d2) {
41885             return d2.sequence_id === selectedSequenceId || d2.id === hoveredImageId;
41886           }).classed("hovered", function(d2) {
41887             return d2.id === hoveredImageId;
41888           });
41889           context.container().selectAll(".layer-mapillary .sequence").classed("highlighted", function(d2) {
41890             return d2.properties.id === hoveredSequenceId;
41891           }).classed("currentView", function(d2) {
41892             return d2.properties.id === selectedSequenceId;
41893           });
41894           return this;
41895         },
41896         // Get detections for the current image and shows them in the image viewer
41897         updateDetections: function(imageId, url) {
41898           if (!_mlyViewer || _mlyFallback) return;
41899           if (!imageId) return;
41900           const cache = _mlyCache.image_detections;
41901           if (cache.forImageId[imageId]) {
41902             showDetections(_mlyCache.image_detections.forImageId[imageId]);
41903           } else {
41904             loadData(url).then((detections) => {
41905               detections.forEach(function(detection) {
41906                 if (!cache.forImageId[imageId]) {
41907                   cache.forImageId[imageId] = [];
41908                 }
41909                 cache.forImageId[imageId].push({
41910                   geometry: detection.geometry,
41911                   id: detection.id,
41912                   image_id: imageId,
41913                   value: detection.value
41914                 });
41915               });
41916               showDetections(_mlyCache.image_detections.forImageId[imageId] || []);
41917             });
41918           }
41919           function showDetections(detections) {
41920             const tagComponent = _mlyViewer.getComponent("tag");
41921             detections.forEach(function(data) {
41922               const tag2 = makeTag(data);
41923               if (tag2) {
41924                 tagComponent.add([tag2]);
41925               }
41926             });
41927           }
41928           function makeTag(data) {
41929             const valueParts = data.value.split("--");
41930             if (!valueParts.length) return;
41931             let tag2;
41932             let text;
41933             let color2 = 16777215;
41934             if (_mlyHighlightedDetection === data.id) {
41935               color2 = 16776960;
41936               text = valueParts[1];
41937               if (text === "flat" || text === "discrete" || text === "sign") {
41938                 text = valueParts[2];
41939               }
41940               text = text.replace(/-/g, " ");
41941               text = text.charAt(0).toUpperCase() + text.slice(1);
41942               _mlyHighlightedDetection = null;
41943             }
41944             var decodedGeometry = window.atob(data.geometry);
41945             var uintArray = new Uint8Array(decodedGeometry.length);
41946             for (var i3 = 0; i3 < decodedGeometry.length; i3++) {
41947               uintArray[i3] = decodedGeometry.charCodeAt(i3);
41948             }
41949             const tile = new VectorTile(new Pbf(uintArray.buffer));
41950             const layer = tile.layers["mpy-or"];
41951             const geometries = layer.feature(0).loadGeometry();
41952             const polygon2 = geometries.map((ring) => ring.map((point) => [point.x / layer.extent, point.y / layer.extent]));
41953             tag2 = new mapillary.OutlineTag(
41954               data.id,
41955               new mapillary.PolygonGeometry(polygon2[0]),
41956               {
41957                 text,
41958                 textColor: color2,
41959                 lineColor: color2,
41960                 lineWidth: 2,
41961                 fillColor: color2,
41962                 fillOpacity: 0.3
41963               }
41964             );
41965             return tag2;
41966           }
41967         },
41968         // Return the current cache
41969         cache: function() {
41970           return _mlyCache;
41971         }
41972       };
41973     }
41974   });
41975
41976   // modules/core/validation/models.js
41977   var models_exports = {};
41978   __export(models_exports, {
41979     validationIssue: () => validationIssue,
41980     validationIssueFix: () => validationIssueFix
41981   });
41982   function validationIssue(attrs) {
41983     this.type = attrs.type;
41984     this.subtype = attrs.subtype;
41985     this.severity = attrs.severity;
41986     this.message = attrs.message;
41987     this.reference = attrs.reference;
41988     this.entityIds = attrs.entityIds;
41989     this.loc = attrs.loc;
41990     this.data = attrs.data;
41991     this.dynamicFixes = attrs.dynamicFixes;
41992     this.hash = attrs.hash;
41993     this.id = generateID.apply(this);
41994     this.key = generateKey.apply(this);
41995     this.autoFix = null;
41996     function generateID() {
41997       var parts = [this.type];
41998       if (this.hash) {
41999         parts.push(this.hash);
42000       }
42001       if (this.subtype) {
42002         parts.push(this.subtype);
42003       }
42004       if (this.entityIds) {
42005         var entityKeys = this.entityIds.slice().sort();
42006         parts.push.apply(parts, entityKeys);
42007       }
42008       return parts.join(":");
42009     }
42010     function generateKey() {
42011       return this.id + ":" + Date.now().toString();
42012     }
42013     this.extent = function(resolver) {
42014       if (this.loc) {
42015         return geoExtent(this.loc);
42016       }
42017       if (this.entityIds && this.entityIds.length) {
42018         return this.entityIds.reduce(function(extent, entityId) {
42019           return extent.extend(resolver.entity(entityId).extent(resolver));
42020         }, geoExtent());
42021       }
42022       return null;
42023     };
42024     this.fixes = function(context) {
42025       var fixes = this.dynamicFixes ? this.dynamicFixes(context) : [];
42026       var issue = this;
42027       if (issue.severity === "warning") {
42028         fixes.push(new validationIssueFix({
42029           title: _t.append("issues.fix.ignore_issue.title"),
42030           icon: "iD-icon-close",
42031           onClick: function() {
42032             context.validator().ignoreIssue(this.issue.id);
42033           }
42034         }));
42035       }
42036       fixes.forEach(function(fix) {
42037         fix.id = fix.title.stringId;
42038         fix.issue = issue;
42039         if (fix.autoArgs) {
42040           issue.autoFix = fix;
42041         }
42042       });
42043       return fixes;
42044     };
42045   }
42046   function validationIssueFix(attrs) {
42047     this.title = attrs.title;
42048     this.onClick = attrs.onClick;
42049     this.disabledReason = attrs.disabledReason;
42050     this.icon = attrs.icon;
42051     this.entityIds = attrs.entityIds || [];
42052     this.autoArgs = attrs.autoArgs;
42053     this.issue = null;
42054   }
42055   var init_models = __esm({
42056     "modules/core/validation/models.js"() {
42057       "use strict";
42058       init_geo2();
42059       init_localizer();
42060     }
42061   });
42062
42063   // modules/core/validation/index.js
42064   var validation_exports = {};
42065   __export(validation_exports, {
42066     validationIssue: () => validationIssue,
42067     validationIssueFix: () => validationIssueFix
42068   });
42069   var init_validation = __esm({
42070     "modules/core/validation/index.js"() {
42071       "use strict";
42072       init_models();
42073     }
42074   });
42075
42076   // modules/services/maprules.js
42077   var maprules_exports = {};
42078   __export(maprules_exports, {
42079     default: () => maprules_default
42080   });
42081   var buildRuleChecks, buildLineKeys, maprules_default;
42082   var init_maprules = __esm({
42083     "modules/services/maprules.js"() {
42084       "use strict";
42085       init_tags();
42086       init_util();
42087       init_validation();
42088       buildRuleChecks = function() {
42089         return {
42090           equals: function(equals) {
42091             return function(tags) {
42092               return Object.keys(equals).every(function(k2) {
42093                 return equals[k2] === tags[k2];
42094               });
42095             };
42096           },
42097           notEquals: function(notEquals) {
42098             return function(tags) {
42099               return Object.keys(notEquals).some(function(k2) {
42100                 return notEquals[k2] !== tags[k2];
42101               });
42102             };
42103           },
42104           absence: function(absence) {
42105             return function(tags) {
42106               return Object.keys(tags).indexOf(absence) === -1;
42107             };
42108           },
42109           presence: function(presence) {
42110             return function(tags) {
42111               return Object.keys(tags).indexOf(presence) > -1;
42112             };
42113           },
42114           greaterThan: function(greaterThan) {
42115             var key = Object.keys(greaterThan)[0];
42116             var value = greaterThan[key];
42117             return function(tags) {
42118               return tags[key] > value;
42119             };
42120           },
42121           greaterThanEqual: function(greaterThanEqual) {
42122             var key = Object.keys(greaterThanEqual)[0];
42123             var value = greaterThanEqual[key];
42124             return function(tags) {
42125               return tags[key] >= value;
42126             };
42127           },
42128           lessThan: function(lessThan) {
42129             var key = Object.keys(lessThan)[0];
42130             var value = lessThan[key];
42131             return function(tags) {
42132               return tags[key] < value;
42133             };
42134           },
42135           lessThanEqual: function(lessThanEqual) {
42136             var key = Object.keys(lessThanEqual)[0];
42137             var value = lessThanEqual[key];
42138             return function(tags) {
42139               return tags[key] <= value;
42140             };
42141           },
42142           positiveRegex: function(positiveRegex) {
42143             var tagKey = Object.keys(positiveRegex)[0];
42144             var expression = positiveRegex[tagKey].join("|");
42145             var regex = new RegExp(expression);
42146             return function(tags) {
42147               return regex.test(tags[tagKey]);
42148             };
42149           },
42150           negativeRegex: function(negativeRegex) {
42151             var tagKey = Object.keys(negativeRegex)[0];
42152             var expression = negativeRegex[tagKey].join("|");
42153             var regex = new RegExp(expression);
42154             return function(tags) {
42155               return !regex.test(tags[tagKey]);
42156             };
42157           }
42158         };
42159       };
42160       buildLineKeys = function() {
42161         return {
42162           highway: {
42163             rest_area: true,
42164             services: true
42165           },
42166           railway: {
42167             roundhouse: true,
42168             station: true,
42169             traverser: true,
42170             turntable: true,
42171             wash: true
42172           }
42173         };
42174       };
42175       maprules_default = {
42176         init: function() {
42177           this._ruleChecks = buildRuleChecks();
42178           this._validationRules = [];
42179           this._areaKeys = osmAreaKeys;
42180           this._lineKeys = buildLineKeys();
42181         },
42182         // list of rules only relevant to tag checks...
42183         filterRuleChecks: function(selector) {
42184           var _ruleChecks = this._ruleChecks;
42185           return Object.keys(selector).reduce(function(rules, key) {
42186             if (["geometry", "error", "warning"].indexOf(key) === -1) {
42187               rules.push(_ruleChecks[key](selector[key]));
42188             }
42189             return rules;
42190           }, []);
42191         },
42192         // builds tagMap from mapcss-parse selector object...
42193         buildTagMap: function(selector) {
42194           var getRegexValues = function(regexes) {
42195             return regexes.map(function(regex) {
42196               return regex.replace(/\$|\^/g, "");
42197             });
42198           };
42199           var tagMap = Object.keys(selector).reduce(function(expectedTags, key) {
42200             var values;
42201             var isRegex = /regex/gi.test(key);
42202             var isEqual5 = /equals/gi.test(key);
42203             if (isRegex || isEqual5) {
42204               Object.keys(selector[key]).forEach(function(selectorKey) {
42205                 values = isEqual5 ? [selector[key][selectorKey]] : getRegexValues(selector[key][selectorKey]);
42206                 if (expectedTags.hasOwnProperty(selectorKey)) {
42207                   values = values.concat(expectedTags[selectorKey]);
42208                 }
42209                 expectedTags[selectorKey] = values;
42210               });
42211             } else if (/(greater|less)Than(Equal)?|presence/g.test(key)) {
42212               var tagKey = /presence/.test(key) ? selector[key] : Object.keys(selector[key])[0];
42213               values = [selector[key][tagKey]];
42214               if (expectedTags.hasOwnProperty(tagKey)) {
42215                 values = values.concat(expectedTags[tagKey]);
42216               }
42217               expectedTags[tagKey] = values;
42218             }
42219             return expectedTags;
42220           }, {});
42221           return tagMap;
42222         },
42223         // inspired by osmWay#isArea()
42224         inferGeometry: function(tagMap) {
42225           var _lineKeys = this._lineKeys;
42226           var _areaKeys = this._areaKeys;
42227           var keyValueDoesNotImplyArea = function(key2) {
42228             return utilArrayIntersection(tagMap[key2], Object.keys(_areaKeys[key2])).length > 0;
42229           };
42230           var keyValueImpliesLine = function(key2) {
42231             return utilArrayIntersection(tagMap[key2], Object.keys(_lineKeys[key2])).length > 0;
42232           };
42233           if (tagMap.hasOwnProperty("area")) {
42234             if (tagMap.area.indexOf("yes") > -1) {
42235               return "area";
42236             }
42237             if (tagMap.area.indexOf("no") > -1) {
42238               return "line";
42239             }
42240           }
42241           for (var key in tagMap) {
42242             if (key in _areaKeys && !keyValueDoesNotImplyArea(key)) {
42243               return "area";
42244             }
42245             if (key in _lineKeys && keyValueImpliesLine(key)) {
42246               return "area";
42247             }
42248           }
42249           return "line";
42250         },
42251         // adds from mapcss-parse selector check...
42252         addRule: function(selector) {
42253           var rule = {
42254             // checks relevant to mapcss-selector
42255             checks: this.filterRuleChecks(selector),
42256             // true if all conditions for a tag error are true..
42257             matches: function(entity) {
42258               return this.checks.every(function(check) {
42259                 return check(entity.tags);
42260               });
42261             },
42262             // borrowed from Way#isArea()
42263             inferredGeometry: this.inferGeometry(this.buildTagMap(selector), this._areaKeys),
42264             geometryMatches: function(entity, graph) {
42265               if (entity.type === "node" || entity.type === "relation") {
42266                 return selector.geometry === entity.type;
42267               } else if (entity.type === "way") {
42268                 return this.inferredGeometry === entity.geometry(graph);
42269               }
42270             },
42271             // when geometries match and tag matches are present, return a warning...
42272             findIssues: function(entity, graph, issues) {
42273               if (this.geometryMatches(entity, graph) && this.matches(entity)) {
42274                 var severity = Object.keys(selector).indexOf("error") > -1 ? "error" : "warning";
42275                 var message = selector[severity];
42276                 issues.push(new validationIssue({
42277                   type: "maprules",
42278                   severity,
42279                   message: function() {
42280                     return message;
42281                   },
42282                   entityIds: [entity.id]
42283                 }));
42284               }
42285             }
42286           };
42287           this._validationRules.push(rule);
42288         },
42289         clearRules: function() {
42290           this._validationRules = [];
42291         },
42292         // returns validationRules...
42293         validationRules: function() {
42294           return this._validationRules;
42295         },
42296         // returns ruleChecks
42297         ruleChecks: function() {
42298           return this._ruleChecks;
42299         }
42300       };
42301     }
42302   });
42303
42304   // modules/core/difference.js
42305   var difference_exports = {};
42306   __export(difference_exports, {
42307     coreDifference: () => coreDifference
42308   });
42309   function coreDifference(base, head) {
42310     var _changes = {};
42311     var _didChange = {};
42312     var _diff = {};
42313     function checkEntityID(id2) {
42314       var h2 = head.entities[id2];
42315       var b2 = base.entities[id2];
42316       if (h2 === b2) return;
42317       if (_changes[id2]) return;
42318       if (!h2 && b2) {
42319         _changes[id2] = { base: b2, head: h2 };
42320         _didChange.deletion = true;
42321         return;
42322       }
42323       if (h2 && !b2) {
42324         _changes[id2] = { base: b2, head: h2 };
42325         _didChange.addition = true;
42326         return;
42327       }
42328       if (h2 && b2) {
42329         if (h2.members && b2.members && !(0, import_fast_deep_equal3.default)(h2.members, b2.members)) {
42330           _changes[id2] = { base: b2, head: h2 };
42331           _didChange.geometry = true;
42332           _didChange.properties = true;
42333           return;
42334         }
42335         if (h2.loc && b2.loc && !geoVecEqual(h2.loc, b2.loc)) {
42336           _changes[id2] = { base: b2, head: h2 };
42337           _didChange.geometry = true;
42338         }
42339         if (h2.nodes && b2.nodes && !(0, import_fast_deep_equal3.default)(h2.nodes, b2.nodes)) {
42340           _changes[id2] = { base: b2, head: h2 };
42341           _didChange.geometry = true;
42342         }
42343         if (h2.tags && b2.tags && !(0, import_fast_deep_equal3.default)(h2.tags, b2.tags)) {
42344           _changes[id2] = { base: b2, head: h2 };
42345           _didChange.properties = true;
42346         }
42347       }
42348     }
42349     function load() {
42350       var ids = utilArrayUniq(Object.keys(head.entities).concat(Object.keys(base.entities)));
42351       for (var i3 = 0; i3 < ids.length; i3++) {
42352         checkEntityID(ids[i3]);
42353       }
42354     }
42355     load();
42356     _diff.length = function length2() {
42357       return Object.keys(_changes).length;
42358     };
42359     _diff.changes = function changes() {
42360       return _changes;
42361     };
42362     _diff.didChange = _didChange;
42363     _diff.extantIDs = function extantIDs(includeRelMembers) {
42364       var result = /* @__PURE__ */ new Set();
42365       Object.keys(_changes).forEach(function(id2) {
42366         if (_changes[id2].head) {
42367           result.add(id2);
42368         }
42369         var h2 = _changes[id2].head;
42370         var b2 = _changes[id2].base;
42371         var entity = h2 || b2;
42372         if (includeRelMembers && entity.type === "relation") {
42373           var mh = h2 ? h2.members.map(function(m2) {
42374             return m2.id;
42375           }) : [];
42376           var mb = b2 ? b2.members.map(function(m2) {
42377             return m2.id;
42378           }) : [];
42379           utilArrayUnion(mh, mb).forEach(function(memberID) {
42380             if (head.hasEntity(memberID)) {
42381               result.add(memberID);
42382             }
42383           });
42384         }
42385       });
42386       return Array.from(result);
42387     };
42388     _diff.modified = function modified() {
42389       var result = [];
42390       Object.values(_changes).forEach(function(change) {
42391         if (change.base && change.head) {
42392           result.push(change.head);
42393         }
42394       });
42395       return result;
42396     };
42397     _diff.created = function created() {
42398       var result = [];
42399       Object.values(_changes).forEach(function(change) {
42400         if (!change.base && change.head) {
42401           result.push(change.head);
42402         }
42403       });
42404       return result;
42405     };
42406     _diff.deleted = function deleted() {
42407       var result = [];
42408       Object.values(_changes).forEach(function(change) {
42409         if (change.base && !change.head) {
42410           result.push(change.base);
42411         }
42412       });
42413       return result;
42414     };
42415     _diff.summary = function summary() {
42416       var relevant = {};
42417       var keys2 = Object.keys(_changes);
42418       for (var i3 = 0; i3 < keys2.length; i3++) {
42419         var change = _changes[keys2[i3]];
42420         if (change.head && change.head.geometry(head) !== "vertex") {
42421           addEntity(change.head, head, change.base ? "modified" : "created");
42422         } else if (change.base && change.base.geometry(base) !== "vertex") {
42423           addEntity(change.base, base, "deleted");
42424         } else if (change.base && change.head) {
42425           var moved = !(0, import_fast_deep_equal3.default)(change.base.loc, change.head.loc);
42426           var retagged = !(0, import_fast_deep_equal3.default)(change.base.tags, change.head.tags);
42427           if (moved) {
42428             addParents(change.head);
42429           }
42430           if (retagged || moved && change.head.hasInterestingTags()) {
42431             addEntity(change.head, head, "modified");
42432           }
42433         } else if (change.head && change.head.hasInterestingTags()) {
42434           addEntity(change.head, head, "created");
42435         } else if (change.base && change.base.hasInterestingTags()) {
42436           addEntity(change.base, base, "deleted");
42437         }
42438       }
42439       return Object.values(relevant);
42440       function addEntity(entity, graph, changeType) {
42441         relevant[entity.id] = {
42442           entity,
42443           graph,
42444           changeType
42445         };
42446       }
42447       function addParents(entity) {
42448         var parents = head.parentWays(entity);
42449         for (var j2 = parents.length - 1; j2 >= 0; j2--) {
42450           var parent = parents[j2];
42451           if (!(parent.id in relevant)) {
42452             addEntity(parent, head, "modified");
42453           }
42454         }
42455       }
42456     };
42457     _diff.complete = function complete(extent) {
42458       var result = {};
42459       var id2, change;
42460       for (id2 in _changes) {
42461         change = _changes[id2];
42462         var h2 = change.head;
42463         var b2 = change.base;
42464         var entity = h2 || b2;
42465         var i3;
42466         if (extent && (!h2 || !h2.intersects(extent, head)) && (!b2 || !b2.intersects(extent, base))) {
42467           continue;
42468         }
42469         result[id2] = h2;
42470         if (entity.type === "way") {
42471           var nh = h2 ? h2.nodes : [];
42472           var nb = b2 ? b2.nodes : [];
42473           var diff;
42474           diff = utilArrayDifference(nh, nb);
42475           for (i3 = 0; i3 < diff.length; i3++) {
42476             result[diff[i3]] = head.hasEntity(diff[i3]);
42477           }
42478           diff = utilArrayDifference(nb, nh);
42479           for (i3 = 0; i3 < diff.length; i3++) {
42480             result[diff[i3]] = head.hasEntity(diff[i3]);
42481           }
42482         }
42483         if (entity.type === "relation" && entity.isMultipolygon()) {
42484           var mh = h2 ? h2.members.map(function(m2) {
42485             return m2.id;
42486           }) : [];
42487           var mb = b2 ? b2.members.map(function(m2) {
42488             return m2.id;
42489           }) : [];
42490           var ids = utilArrayUnion(mh, mb);
42491           for (i3 = 0; i3 < ids.length; i3++) {
42492             var member = head.hasEntity(ids[i3]);
42493             if (!member) continue;
42494             if (extent && !member.intersects(extent, head)) continue;
42495             result[ids[i3]] = member;
42496           }
42497         }
42498         addParents(head.parentWays(entity), result);
42499         addParents(head.parentRelations(entity), result);
42500       }
42501       return result;
42502       function addParents(parents, result2) {
42503         for (var i4 = 0; i4 < parents.length; i4++) {
42504           var parent = parents[i4];
42505           if (parent.id in result2) continue;
42506           result2[parent.id] = parent;
42507           addParents(head.parentRelations(parent), result2);
42508         }
42509       }
42510     };
42511     return _diff;
42512   }
42513   var import_fast_deep_equal3;
42514   var init_difference = __esm({
42515     "modules/core/difference.js"() {
42516       "use strict";
42517       import_fast_deep_equal3 = __toESM(require_fast_deep_equal());
42518       init_geo2();
42519       init_array3();
42520     }
42521   });
42522
42523   // modules/core/tree.js
42524   var tree_exports = {};
42525   __export(tree_exports, {
42526     coreTree: () => coreTree
42527   });
42528   function coreTree(head) {
42529     var _rtree = new RBush();
42530     var _bboxes = {};
42531     var _segmentsRTree = new RBush();
42532     var _segmentsBBoxes = {};
42533     var _segmentsByWayId = {};
42534     var tree = {};
42535     function entityBBox(entity) {
42536       var bbox2 = entity.extent(head).bbox();
42537       bbox2.id = entity.id;
42538       _bboxes[entity.id] = bbox2;
42539       return bbox2;
42540     }
42541     function segmentBBox(segment) {
42542       var extent = segment.extent(head);
42543       if (!extent) return null;
42544       var bbox2 = extent.bbox();
42545       bbox2.segment = segment;
42546       _segmentsBBoxes[segment.id] = bbox2;
42547       return bbox2;
42548     }
42549     function removeEntity(entity) {
42550       _rtree.remove(_bboxes[entity.id]);
42551       delete _bboxes[entity.id];
42552       if (_segmentsByWayId[entity.id]) {
42553         _segmentsByWayId[entity.id].forEach(function(segment) {
42554           _segmentsRTree.remove(_segmentsBBoxes[segment.id]);
42555           delete _segmentsBBoxes[segment.id];
42556         });
42557         delete _segmentsByWayId[entity.id];
42558       }
42559     }
42560     function loadEntities(entities) {
42561       _rtree.load(entities.map(entityBBox));
42562       var segments = [];
42563       entities.forEach(function(entity) {
42564         if (entity.segments) {
42565           var entitySegments = entity.segments(head);
42566           _segmentsByWayId[entity.id] = entitySegments;
42567           segments = segments.concat(entitySegments);
42568         }
42569       });
42570       if (segments.length) _segmentsRTree.load(segments.map(segmentBBox).filter(Boolean));
42571     }
42572     function updateParents(entity, insertions, memo) {
42573       head.parentWays(entity).forEach(function(way) {
42574         if (_bboxes[way.id]) {
42575           removeEntity(way);
42576           insertions[way.id] = way;
42577         }
42578         updateParents(way, insertions, memo);
42579       });
42580       head.parentRelations(entity).forEach(function(relation) {
42581         if (memo[relation.id]) return;
42582         memo[relation.id] = true;
42583         if (_bboxes[relation.id]) {
42584           removeEntity(relation);
42585           insertions[relation.id] = relation;
42586         }
42587         updateParents(relation, insertions, memo);
42588       });
42589     }
42590     tree.rebase = function(entities, force) {
42591       var insertions = {};
42592       for (var i3 = 0; i3 < entities.length; i3++) {
42593         var entity = entities[i3];
42594         if (!entity.visible) continue;
42595         if (head.entities.hasOwnProperty(entity.id) || _bboxes[entity.id]) {
42596           if (!force) {
42597             continue;
42598           } else if (_bboxes[entity.id]) {
42599             removeEntity(entity);
42600           }
42601         }
42602         insertions[entity.id] = entity;
42603         updateParents(entity, insertions, {});
42604       }
42605       loadEntities(Object.values(insertions));
42606       return tree;
42607     };
42608     function updateToGraph(graph) {
42609       if (graph === head) return;
42610       var diff = coreDifference(head, graph);
42611       head = graph;
42612       var changed = diff.didChange;
42613       if (!changed.addition && !changed.deletion && !changed.geometry) return;
42614       var insertions = {};
42615       if (changed.deletion) {
42616         diff.deleted().forEach(function(entity) {
42617           removeEntity(entity);
42618         });
42619       }
42620       if (changed.geometry) {
42621         diff.modified().forEach(function(entity) {
42622           removeEntity(entity);
42623           insertions[entity.id] = entity;
42624           updateParents(entity, insertions, {});
42625         });
42626       }
42627       if (changed.addition) {
42628         diff.created().forEach(function(entity) {
42629           insertions[entity.id] = entity;
42630         });
42631       }
42632       loadEntities(Object.values(insertions));
42633     }
42634     tree.intersects = function(extent, graph) {
42635       updateToGraph(graph);
42636       return _rtree.search(extent.bbox()).map(function(bbox2) {
42637         return graph.entity(bbox2.id);
42638       });
42639     };
42640     tree.waySegments = function(extent, graph) {
42641       updateToGraph(graph);
42642       return _segmentsRTree.search(extent.bbox()).map(function(bbox2) {
42643         return bbox2.segment;
42644       });
42645     };
42646     return tree;
42647   }
42648   var init_tree = __esm({
42649     "modules/core/tree.js"() {
42650       "use strict";
42651       init_rbush();
42652       init_difference();
42653     }
42654   });
42655
42656   // modules/svg/icon.js
42657   var icon_exports = {};
42658   __export(icon_exports, {
42659     svgIcon: () => svgIcon
42660   });
42661   function svgIcon(name, svgklass, useklass) {
42662     return function drawIcon(selection2) {
42663       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);
42664     };
42665   }
42666   var init_icon = __esm({
42667     "modules/svg/icon.js"() {
42668       "use strict";
42669     }
42670   });
42671
42672   // modules/ui/modal.js
42673   var modal_exports = {};
42674   __export(modal_exports, {
42675     uiModal: () => uiModal
42676   });
42677   function uiModal(selection2, blocking) {
42678     let keybinding = utilKeybinding("modal");
42679     let previous = selection2.select("div.modal");
42680     let animate = previous.empty();
42681     previous.transition().duration(200).style("opacity", 0).remove();
42682     let shaded = selection2.append("div").attr("class", "shaded").style("opacity", 0);
42683     shaded.close = () => {
42684       shaded.transition().duration(200).style("opacity", 0).remove();
42685       modal.transition().duration(200).style("top", "0px");
42686       select_default2(document).call(keybinding.unbind);
42687     };
42688     let modal = shaded.append("div").attr("class", "modal fillL");
42689     modal.append("input").attr("class", "keytrap keytrap-first").on("focus.keytrap", moveFocusToLast);
42690     if (!blocking) {
42691       shaded.on("click.remove-modal", (d3_event) => {
42692         if (d3_event.target === this) {
42693           shaded.close();
42694         }
42695       });
42696       modal.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", shaded.close).call(svgIcon("#iD-icon-close"));
42697       keybinding.on("\u232B", shaded.close).on("\u238B", shaded.close);
42698       select_default2(document).call(keybinding);
42699     }
42700     modal.append("div").attr("class", "content");
42701     modal.append("input").attr("class", "keytrap keytrap-last").on("focus.keytrap", moveFocusToFirst);
42702     if (animate) {
42703       shaded.transition().style("opacity", 1);
42704     } else {
42705       shaded.style("opacity", 1);
42706     }
42707     return shaded;
42708     function moveFocusToFirst() {
42709       let node = modal.select("a, button, input:not(.keytrap), select, textarea").node();
42710       if (node) {
42711         node.focus();
42712       } else {
42713         select_default2(this).node().blur();
42714       }
42715     }
42716     function moveFocusToLast() {
42717       let nodes = modal.selectAll("a, button, input:not(.keytrap), select, textarea").nodes();
42718       if (nodes.length) {
42719         nodes[nodes.length - 1].focus();
42720       } else {
42721         select_default2(this).node().blur();
42722       }
42723     }
42724   }
42725   var init_modal = __esm({
42726     "modules/ui/modal.js"() {
42727       "use strict";
42728       init_src5();
42729       init_localizer();
42730       init_icon();
42731       init_util();
42732     }
42733   });
42734
42735   // modules/ui/loading.js
42736   var loading_exports = {};
42737   __export(loading_exports, {
42738     uiLoading: () => uiLoading
42739   });
42740   function uiLoading(context) {
42741     let _modalSelection = select_default2(null);
42742     let _message = "";
42743     let _blocking = false;
42744     let loading = (selection2) => {
42745       _modalSelection = uiModal(selection2, _blocking);
42746       let loadertext = _modalSelection.select(".content").classed("loading-modal", true).append("div").attr("class", "modal-section fillL");
42747       loadertext.append("img").attr("class", "loader").attr("src", context.imagePath("loader-white.gif"));
42748       loadertext.append("h3").html(_message);
42749       _modalSelection.select("button.close").attr("class", "hide");
42750       return loading;
42751     };
42752     loading.message = function(val) {
42753       if (!arguments.length) return _message;
42754       _message = val;
42755       return loading;
42756     };
42757     loading.blocking = function(val) {
42758       if (!arguments.length) return _blocking;
42759       _blocking = val;
42760       return loading;
42761     };
42762     loading.close = () => {
42763       _modalSelection.remove();
42764     };
42765     loading.isShown = () => {
42766       return _modalSelection && !_modalSelection.empty() && _modalSelection.node().parentNode;
42767     };
42768     return loading;
42769   }
42770   var init_loading = __esm({
42771     "modules/ui/loading.js"() {
42772       "use strict";
42773       init_src5();
42774       init_modal();
42775     }
42776   });
42777
42778   // modules/core/history.js
42779   var history_exports = {};
42780   __export(history_exports, {
42781     coreHistory: () => coreHistory
42782   });
42783   function coreHistory(context) {
42784     var dispatch14 = dispatch_default("reset", "change", "merge", "restore", "undone", "redone", "storage_error");
42785     var lock = utilSessionMutex("lock");
42786     var _hasUnresolvedRestorableChanges = lock.lock() && !!corePreferences(getKey("saved_history"));
42787     var duration = 150;
42788     var _imageryUsed = [];
42789     var _photoOverlaysUsed = [];
42790     var _checkpoints = {};
42791     var _pausedGraph;
42792     var _stack;
42793     var _index;
42794     var _tree;
42795     function _act(actions, t2) {
42796       actions = Array.prototype.slice.call(actions);
42797       var annotation;
42798       if (typeof actions[actions.length - 1] !== "function") {
42799         annotation = actions.pop();
42800       }
42801       var graph = _stack[_index].graph;
42802       for (var i3 = 0; i3 < actions.length; i3++) {
42803         graph = actions[i3](graph, t2);
42804       }
42805       return {
42806         graph,
42807         annotation,
42808         imageryUsed: _imageryUsed,
42809         photoOverlaysUsed: _photoOverlaysUsed,
42810         transform: context.projection.transform(),
42811         selectedIDs: context.selectedIDs()
42812       };
42813     }
42814     function _perform(args, t2) {
42815       var previous = _stack[_index].graph;
42816       _stack = _stack.slice(0, _index + 1);
42817       var actionResult = _act(args, t2);
42818       _stack.push(actionResult);
42819       _index++;
42820       return change(previous);
42821     }
42822     function _replace(args, t2) {
42823       var previous = _stack[_index].graph;
42824       var actionResult = _act(args, t2);
42825       _stack[_index] = actionResult;
42826       return change(previous);
42827     }
42828     function _overwrite(args, t2) {
42829       var previous = _stack[_index].graph;
42830       if (_index > 0) {
42831         _index--;
42832         _stack.pop();
42833       }
42834       _stack = _stack.slice(0, _index + 1);
42835       var actionResult = _act(args, t2);
42836       _stack.push(actionResult);
42837       _index++;
42838       return change(previous);
42839     }
42840     function change(previous) {
42841       var difference2 = coreDifference(previous, history.graph());
42842       if (!_pausedGraph) {
42843         dispatch14.call("change", this, difference2);
42844       }
42845       return difference2;
42846     }
42847     function getKey(n3) {
42848       return "iD_" + window.location.origin + "_" + n3;
42849     }
42850     var history = {
42851       graph: function() {
42852         return _stack[_index].graph;
42853       },
42854       tree: function() {
42855         return _tree;
42856       },
42857       base: function() {
42858         return _stack[0].graph;
42859       },
42860       merge: function(entities) {
42861         var stack = _stack.map(function(state) {
42862           return state.graph;
42863         });
42864         _stack[0].graph.rebase(entities, stack, false);
42865         _tree.rebase(entities, false);
42866         dispatch14.call("merge", this, entities);
42867       },
42868       perform: function() {
42869         select_default2(document).interrupt("history.perform");
42870         var transitionable = false;
42871         var action0 = arguments[0];
42872         if (arguments.length === 1 || arguments.length === 2 && typeof arguments[1] !== "function") {
42873           transitionable = !!action0.transitionable;
42874         }
42875         if (transitionable) {
42876           var origArguments = arguments;
42877           select_default2(document).transition("history.perform").duration(duration).ease(linear2).tween("history.tween", function() {
42878             return function(t2) {
42879               if (t2 < 1) _overwrite([action0], t2);
42880             };
42881           }).on("start", function() {
42882             _perform([action0], 0);
42883           }).on("end interrupt", function() {
42884             _overwrite(origArguments, 1);
42885           });
42886         } else {
42887           return _perform(arguments);
42888         }
42889       },
42890       replace: function() {
42891         select_default2(document).interrupt("history.perform");
42892         return _replace(arguments, 1);
42893       },
42894       // Same as calling pop and then perform
42895       overwrite: function() {
42896         select_default2(document).interrupt("history.perform");
42897         return _overwrite(arguments, 1);
42898       },
42899       pop: function(n3) {
42900         select_default2(document).interrupt("history.perform");
42901         var previous = _stack[_index].graph;
42902         if (isNaN(+n3) || +n3 < 0) {
42903           n3 = 1;
42904         }
42905         while (n3-- > 0 && _index > 0) {
42906           _index--;
42907           _stack.pop();
42908         }
42909         return change(previous);
42910       },
42911       // Back to the previous annotated state or _index = 0.
42912       undo: function() {
42913         select_default2(document).interrupt("history.perform");
42914         var previousStack = _stack[_index];
42915         var previous = previousStack.graph;
42916         while (_index > 0) {
42917           _index--;
42918           if (_stack[_index].annotation) break;
42919         }
42920         dispatch14.call("undone", this, _stack[_index], previousStack);
42921         return change(previous);
42922       },
42923       // Forward to the next annotated state.
42924       redo: function() {
42925         select_default2(document).interrupt("history.perform");
42926         var previousStack = _stack[_index];
42927         var previous = previousStack.graph;
42928         var tryIndex = _index;
42929         while (tryIndex < _stack.length - 1) {
42930           tryIndex++;
42931           if (_stack[tryIndex].annotation) {
42932             _index = tryIndex;
42933             dispatch14.call("redone", this, _stack[_index], previousStack);
42934             break;
42935           }
42936         }
42937         return change(previous);
42938       },
42939       pauseChangeDispatch: function() {
42940         if (!_pausedGraph) {
42941           _pausedGraph = _stack[_index].graph;
42942         }
42943       },
42944       resumeChangeDispatch: function() {
42945         if (_pausedGraph) {
42946           var previous = _pausedGraph;
42947           _pausedGraph = null;
42948           return change(previous);
42949         }
42950       },
42951       undoAnnotation: function() {
42952         var i3 = _index;
42953         while (i3 >= 0) {
42954           if (_stack[i3].annotation) return _stack[i3].annotation;
42955           i3--;
42956         }
42957       },
42958       redoAnnotation: function() {
42959         var i3 = _index + 1;
42960         while (i3 <= _stack.length - 1) {
42961           if (_stack[i3].annotation) return _stack[i3].annotation;
42962           i3++;
42963         }
42964       },
42965       // Returns the entities from the active graph with bounding boxes
42966       // overlapping the given `extent`.
42967       intersects: function(extent) {
42968         return _tree.intersects(extent, _stack[_index].graph);
42969       },
42970       difference: function() {
42971         var base = _stack[0].graph;
42972         var head = _stack[_index].graph;
42973         return coreDifference(base, head);
42974       },
42975       changes: function(action) {
42976         var base = _stack[0].graph;
42977         var head = _stack[_index].graph;
42978         if (action) {
42979           head = action(head);
42980         }
42981         var difference2 = coreDifference(base, head);
42982         return {
42983           modified: difference2.modified(),
42984           created: difference2.created(),
42985           deleted: difference2.deleted()
42986         };
42987       },
42988       hasChanges: function() {
42989         return this.difference().length() > 0;
42990       },
42991       imageryUsed: function(sources) {
42992         if (sources) {
42993           _imageryUsed = sources;
42994           return history;
42995         } else {
42996           var s2 = /* @__PURE__ */ new Set();
42997           _stack.slice(1, _index + 1).forEach(function(state) {
42998             state.imageryUsed.forEach(function(source) {
42999               if (source !== "Custom") {
43000                 s2.add(source);
43001               }
43002             });
43003           });
43004           return Array.from(s2);
43005         }
43006       },
43007       photoOverlaysUsed: function(sources) {
43008         if (sources) {
43009           _photoOverlaysUsed = sources;
43010           return history;
43011         } else {
43012           var s2 = /* @__PURE__ */ new Set();
43013           _stack.slice(1, _index + 1).forEach(function(state) {
43014             if (state.photoOverlaysUsed && Array.isArray(state.photoOverlaysUsed)) {
43015               state.photoOverlaysUsed.forEach(function(photoOverlay) {
43016                 s2.add(photoOverlay);
43017               });
43018             }
43019           });
43020           return Array.from(s2);
43021         }
43022       },
43023       // save the current history state
43024       checkpoint: function(key) {
43025         _checkpoints[key] = {
43026           stack: _stack,
43027           index: _index
43028         };
43029         return history;
43030       },
43031       // restore history state to a given checkpoint or reset completely
43032       reset: function(key) {
43033         if (key !== void 0 && _checkpoints.hasOwnProperty(key)) {
43034           _stack = _checkpoints[key].stack;
43035           _index = _checkpoints[key].index;
43036         } else {
43037           _stack = [{ graph: coreGraph() }];
43038           _index = 0;
43039           _tree = coreTree(_stack[0].graph);
43040           _checkpoints = {};
43041         }
43042         dispatch14.call("reset");
43043         dispatch14.call("change");
43044         return history;
43045       },
43046       // `toIntroGraph()` is used to export the intro graph used by the walkthrough.
43047       //
43048       // To use it:
43049       //  1. Start the walkthrough.
43050       //  2. Get to a "free editing" tutorial step
43051       //  3. Make your edits to the walkthrough map
43052       //  4. In your browser dev console run:
43053       //        `id.history().toIntroGraph()`
43054       //  5. This outputs stringified JSON to the browser console
43055       //  6. Copy it to `data/intro_graph.json` and prettify it in your code editor
43056       toIntroGraph: function() {
43057         var nextID = { n: 0, r: 0, w: 0 };
43058         var permIDs = {};
43059         var graph = this.graph();
43060         var baseEntities = {};
43061         Object.values(graph.base().entities).forEach(function(entity) {
43062           var copy2 = copyIntroEntity(entity);
43063           baseEntities[copy2.id] = copy2;
43064         });
43065         Object.keys(graph.entities).forEach(function(id2) {
43066           var entity = graph.entities[id2];
43067           if (entity) {
43068             var copy2 = copyIntroEntity(entity);
43069             baseEntities[copy2.id] = copy2;
43070           } else {
43071             delete baseEntities[id2];
43072           }
43073         });
43074         Object.values(baseEntities).forEach(function(entity) {
43075           if (Array.isArray(entity.nodes)) {
43076             entity.nodes = entity.nodes.map(function(node) {
43077               return permIDs[node] || node;
43078             });
43079           }
43080           if (Array.isArray(entity.members)) {
43081             entity.members = entity.members.map(function(member) {
43082               member.id = permIDs[member.id] || member.id;
43083               return member;
43084             });
43085           }
43086         });
43087         return JSON.stringify({ dataIntroGraph: baseEntities });
43088         function copyIntroEntity(source) {
43089           var copy2 = utilObjectOmit(source, ["type", "user", "v", "version", "visible"]);
43090           if (copy2.tags && !Object.keys(copy2.tags)) {
43091             delete copy2.tags;
43092           }
43093           if (Array.isArray(copy2.loc)) {
43094             copy2.loc[0] = +copy2.loc[0].toFixed(6);
43095             copy2.loc[1] = +copy2.loc[1].toFixed(6);
43096           }
43097           var match = source.id.match(/([nrw])-\d*/);
43098           if (match !== null) {
43099             var nrw = match[1];
43100             var permID;
43101             do {
43102               permID = nrw + ++nextID[nrw];
43103             } while (baseEntities.hasOwnProperty(permID));
43104             copy2.id = permIDs[source.id] = permID;
43105           }
43106           return copy2;
43107         }
43108       },
43109       toJSON: function() {
43110         if (!this.hasChanges()) return;
43111         var allEntities = {};
43112         var baseEntities = {};
43113         var base = _stack[0];
43114         var s2 = _stack.map(function(i3) {
43115           var modified = [];
43116           var deleted = [];
43117           Object.keys(i3.graph.entities).forEach(function(id2) {
43118             var entity = i3.graph.entities[id2];
43119             if (entity) {
43120               var key = osmEntity.key(entity);
43121               allEntities[key] = entity;
43122               modified.push(key);
43123             } else {
43124               deleted.push(id2);
43125             }
43126             if (id2 in base.graph.entities) {
43127               baseEntities[id2] = base.graph.entities[id2];
43128             }
43129             if (entity && entity.nodes) {
43130               entity.nodes.forEach(function(nodeID) {
43131                 if (nodeID in base.graph.entities) {
43132                   baseEntities[nodeID] = base.graph.entities[nodeID];
43133                 }
43134               });
43135             }
43136             var baseParents = base.graph._parentWays[id2];
43137             if (baseParents) {
43138               baseParents.forEach(function(parentID) {
43139                 if (parentID in base.graph.entities) {
43140                   baseEntities[parentID] = base.graph.entities[parentID];
43141                 }
43142               });
43143             }
43144           });
43145           var x2 = {};
43146           if (modified.length) x2.modified = modified;
43147           if (deleted.length) x2.deleted = deleted;
43148           if (i3.imageryUsed) x2.imageryUsed = i3.imageryUsed;
43149           if (i3.photoOverlaysUsed) x2.photoOverlaysUsed = i3.photoOverlaysUsed;
43150           if (i3.annotation) x2.annotation = i3.annotation;
43151           if (i3.transform) x2.transform = i3.transform;
43152           if (i3.selectedIDs) x2.selectedIDs = i3.selectedIDs;
43153           return x2;
43154         });
43155         return JSON.stringify({
43156           version: 3,
43157           entities: Object.values(allEntities),
43158           baseEntities: Object.values(baseEntities),
43159           stack: s2,
43160           nextIDs: osmEntity.id.next,
43161           index: _index,
43162           // note the time the changes were saved
43163           timestamp: (/* @__PURE__ */ new Date()).getTime()
43164         });
43165       },
43166       fromJSON: function(json, loadChildNodes) {
43167         var h2 = JSON.parse(json);
43168         var loadComplete = true;
43169         osmEntity.id.next = h2.nextIDs;
43170         _index = h2.index;
43171         if (h2.version === 2 || h2.version === 3) {
43172           var allEntities = {};
43173           h2.entities.forEach(function(entity) {
43174             allEntities[osmEntity.key(entity)] = osmEntity(entity);
43175           });
43176           if (h2.version === 3) {
43177             var baseEntities = h2.baseEntities.map(function(d2) {
43178               return osmEntity(d2);
43179             });
43180             var stack = _stack.map(function(state) {
43181               return state.graph;
43182             });
43183             _stack[0].graph.rebase(baseEntities, stack, true);
43184             _tree.rebase(baseEntities, true);
43185             if (loadChildNodes) {
43186               var osm = context.connection();
43187               var baseWays = baseEntities.filter(function(e3) {
43188                 return e3.type === "way";
43189               });
43190               var nodeIDs = baseWays.reduce(function(acc, way) {
43191                 return utilArrayUnion(acc, way.nodes);
43192               }, []);
43193               var missing = nodeIDs.filter(function(n3) {
43194                 return !_stack[0].graph.hasEntity(n3);
43195               });
43196               if (missing.length && osm) {
43197                 loadComplete = false;
43198                 context.map().redrawEnable(false);
43199                 var loading = uiLoading(context).blocking(true);
43200                 context.container().call(loading);
43201                 var childNodesLoaded = function(err, result) {
43202                   if (!err) {
43203                     var visibleGroups = utilArrayGroupBy(result.data, "visible");
43204                     var visibles = visibleGroups.true || [];
43205                     var invisibles = visibleGroups.false || [];
43206                     if (visibles.length) {
43207                       var visibleIDs = visibles.map(function(entity) {
43208                         return entity.id;
43209                       });
43210                       var stack2 = _stack.map(function(state) {
43211                         return state.graph;
43212                       });
43213                       missing = utilArrayDifference(missing, visibleIDs);
43214                       _stack[0].graph.rebase(visibles, stack2, true);
43215                       _tree.rebase(visibles, true);
43216                     }
43217                     invisibles.forEach(function(entity) {
43218                       osm.loadEntityVersion(entity.id, +entity.version - 1, childNodesLoaded);
43219                     });
43220                   }
43221                   if (err || !missing.length) {
43222                     loading.close();
43223                     context.map().redrawEnable(true);
43224                     dispatch14.call("change");
43225                     dispatch14.call("restore", this);
43226                   }
43227                 };
43228                 osm.loadMultiple(missing, childNodesLoaded);
43229               }
43230             }
43231           }
43232           _stack = h2.stack.map(function(d2) {
43233             var entities = {}, entity;
43234             if (d2.modified) {
43235               d2.modified.forEach(function(key) {
43236                 entity = allEntities[key];
43237                 entities[entity.id] = entity;
43238               });
43239             }
43240             if (d2.deleted) {
43241               d2.deleted.forEach(function(id2) {
43242                 entities[id2] = void 0;
43243               });
43244             }
43245             return {
43246               graph: coreGraph(_stack[0].graph).load(entities),
43247               annotation: d2.annotation,
43248               imageryUsed: d2.imageryUsed,
43249               photoOverlaysUsed: d2.photoOverlaysUsed,
43250               transform: d2.transform,
43251               selectedIDs: d2.selectedIDs
43252             };
43253           });
43254         } else {
43255           _stack = h2.stack.map(function(d2) {
43256             var entities = {};
43257             for (var i3 in d2.entities) {
43258               var entity = d2.entities[i3];
43259               entities[i3] = entity === "undefined" ? void 0 : osmEntity(entity);
43260             }
43261             d2.graph = coreGraph(_stack[0].graph).load(entities);
43262             return d2;
43263           });
43264         }
43265         var transform2 = _stack[_index].transform;
43266         if (transform2) {
43267           context.map().transformEase(transform2, 0);
43268         }
43269         if (loadComplete) {
43270           dispatch14.call("change");
43271           dispatch14.call("restore", this);
43272         }
43273         return history;
43274       },
43275       lock: function() {
43276         return lock.lock();
43277       },
43278       unlock: function() {
43279         lock.unlock();
43280       },
43281       save: function() {
43282         if (lock.locked() && // don't overwrite existing, unresolved changes
43283         !_hasUnresolvedRestorableChanges) {
43284           const success = corePreferences(getKey("saved_history"), history.toJSON() || null);
43285           if (!success) dispatch14.call("storage_error");
43286         }
43287         return history;
43288       },
43289       // delete the history version saved in localStorage
43290       clearSaved: function() {
43291         context.debouncedSave.cancel();
43292         if (lock.locked()) {
43293           _hasUnresolvedRestorableChanges = false;
43294           corePreferences(getKey("saved_history"), null);
43295           corePreferences("comment", null);
43296           corePreferences("hashtags", null);
43297           corePreferences("source", null);
43298         }
43299         return history;
43300       },
43301       savedHistoryJSON: function() {
43302         return corePreferences(getKey("saved_history"));
43303       },
43304       hasRestorableChanges: function() {
43305         return _hasUnresolvedRestorableChanges;
43306       },
43307       // load history from a version stored in localStorage
43308       restore: function() {
43309         if (lock.locked()) {
43310           _hasUnresolvedRestorableChanges = false;
43311           var json = this.savedHistoryJSON();
43312           if (json) history.fromJSON(json, true);
43313         }
43314       },
43315       _getKey: getKey
43316     };
43317     history.reset();
43318     return utilRebind(history, dispatch14, "on");
43319   }
43320   var init_history = __esm({
43321     "modules/core/history.js"() {
43322       "use strict";
43323       init_src4();
43324       init_src10();
43325       init_src5();
43326       init_preferences();
43327       init_difference();
43328       init_graph();
43329       init_tree();
43330       init_entity();
43331       init_loading();
43332       init_util();
43333     }
43334   });
43335
43336   // modules/util/utilDisplayLabel.js
43337   var utilDisplayLabel_exports = {};
43338   __export(utilDisplayLabel_exports, {
43339     utilDisplayLabel: () => utilDisplayLabel
43340   });
43341   function utilDisplayLabel(entity, graphOrGeometry, verbose) {
43342     var result;
43343     var displayName = utilDisplayName(entity);
43344     var preset = typeof graphOrGeometry === "string" ? _mainPresetIndex.matchTags(entity.tags, graphOrGeometry) : _mainPresetIndex.match(entity, graphOrGeometry);
43345     var presetName = preset && (preset.suggestion ? preset.subtitle() : preset.name());
43346     if (verbose) {
43347       result = [presetName, displayName].filter(Boolean).join(" ");
43348     } else {
43349       result = displayName || presetName;
43350     }
43351     return result || utilDisplayType(entity.id);
43352   }
43353   var init_utilDisplayLabel = __esm({
43354     "modules/util/utilDisplayLabel.js"() {
43355       "use strict";
43356       init_presets();
43357       init_util2();
43358     }
43359   });
43360
43361   // modules/validations/almost_junction.js
43362   var almost_junction_exports = {};
43363   __export(almost_junction_exports, {
43364     validationAlmostJunction: () => validationAlmostJunction
43365   });
43366   function validationAlmostJunction(context) {
43367     const type2 = "almost_junction";
43368     const EXTEND_TH_METERS = 5;
43369     const WELD_TH_METERS = 0.75;
43370     const CLOSE_NODE_TH = EXTEND_TH_METERS - WELD_TH_METERS;
43371     const SIG_ANGLE_TH = Math.atan(WELD_TH_METERS / EXTEND_TH_METERS);
43372     function isHighway(entity) {
43373       return entity.type === "way" && osmRoutableHighwayTagValues[entity.tags.highway];
43374     }
43375     function isTaggedAsNotContinuing(node) {
43376       return node.tags.noexit === "yes" || node.tags.amenity === "parking_entrance" || node.tags.entrance && node.tags.entrance !== "no";
43377     }
43378     const validation = function checkAlmostJunction(entity, graph) {
43379       if (!isHighway(entity)) return [];
43380       if (entity.isDegenerate()) return [];
43381       const tree = context.history().tree();
43382       const extendableNodeInfos = findConnectableEndNodesByExtension(entity);
43383       let issues = [];
43384       extendableNodeInfos.forEach((extendableNodeInfo) => {
43385         issues.push(new validationIssue({
43386           type: type2,
43387           subtype: "highway-highway",
43388           severity: "warning",
43389           message: function(context2) {
43390             const entity1 = context2.hasEntity(this.entityIds[0]);
43391             if (this.entityIds[0] === this.entityIds[2]) {
43392               return entity1 ? _t.append("issues.almost_junction.self.message", {
43393                 feature: utilDisplayLabel(entity1, context2.graph())
43394               }) : "";
43395             } else {
43396               const entity2 = context2.hasEntity(this.entityIds[2]);
43397               return entity1 && entity2 ? _t.append("issues.almost_junction.message", {
43398                 feature: utilDisplayLabel(entity1, context2.graph()),
43399                 feature2: utilDisplayLabel(entity2, context2.graph())
43400               }) : "";
43401             }
43402           },
43403           reference: showReference,
43404           entityIds: [
43405             entity.id,
43406             extendableNodeInfo.node.id,
43407             extendableNodeInfo.wid
43408           ],
43409           loc: extendableNodeInfo.node.loc,
43410           hash: JSON.stringify(extendableNodeInfo.node.loc),
43411           data: {
43412             midId: extendableNodeInfo.mid.id,
43413             edge: extendableNodeInfo.edge,
43414             cross_loc: extendableNodeInfo.cross_loc
43415           },
43416           dynamicFixes: makeFixes
43417         }));
43418       });
43419       return issues;
43420       function makeFixes(context2) {
43421         let fixes = [new validationIssueFix({
43422           icon: "iD-icon-abutment",
43423           title: _t.append("issues.fix.connect_features.title"),
43424           onClick: function(context3) {
43425             const annotation = _t("issues.fix.connect_almost_junction.annotation");
43426             const [, endNodeId, crossWayId] = this.issue.entityIds;
43427             const midNode = context3.entity(this.issue.data.midId);
43428             const endNode = context3.entity(endNodeId);
43429             const crossWay = context3.entity(crossWayId);
43430             const nearEndNodes = findNearbyEndNodes(endNode, crossWay);
43431             if (nearEndNodes.length > 0) {
43432               const collinear = findSmallJoinAngle(midNode, endNode, nearEndNodes);
43433               if (collinear) {
43434                 context3.perform(
43435                   actionMergeNodes([collinear.id, endNode.id], collinear.loc),
43436                   annotation
43437                 );
43438                 return;
43439               }
43440             }
43441             const targetEdge = this.issue.data.edge;
43442             const crossLoc = this.issue.data.cross_loc;
43443             const edgeNodes = [context3.entity(targetEdge[0]), context3.entity(targetEdge[1])];
43444             const closestNodeInfo = geoSphericalClosestNode(edgeNodes, crossLoc);
43445             if (closestNodeInfo.distance < WELD_TH_METERS) {
43446               context3.perform(
43447                 actionMergeNodes([closestNodeInfo.node.id, endNode.id], closestNodeInfo.node.loc),
43448                 annotation
43449               );
43450             } else {
43451               context3.perform(
43452                 actionAddMidpoint({ loc: crossLoc, edge: targetEdge }, endNode),
43453                 annotation
43454               );
43455             }
43456           }
43457         })];
43458         const node = context2.hasEntity(this.entityIds[1]);
43459         if (node && !node.hasInterestingTags()) {
43460           fixes.push(new validationIssueFix({
43461             icon: "maki-barrier",
43462             title: _t.append("issues.fix.tag_as_disconnected.title"),
43463             onClick: function(context3) {
43464               const nodeID = this.issue.entityIds[1];
43465               const tags = Object.assign({}, context3.entity(nodeID).tags);
43466               tags.noexit = "yes";
43467               context3.perform(
43468                 actionChangeTags(nodeID, tags),
43469                 _t("issues.fix.tag_as_disconnected.annotation")
43470               );
43471             }
43472           }));
43473         }
43474         return fixes;
43475       }
43476       function showReference(selection2) {
43477         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.almost_junction.highway-highway.reference"));
43478       }
43479       function isExtendableCandidate(node, way) {
43480         const osm = services.osm;
43481         if (osm && !osm.isDataLoaded(node.loc)) {
43482           return false;
43483         }
43484         if (isTaggedAsNotContinuing(node) || graph.parentWays(node).length !== 1) {
43485           return false;
43486         }
43487         let occurrences = 0;
43488         for (const index in way.nodes) {
43489           if (way.nodes[index] === node.id) {
43490             occurrences += 1;
43491             if (occurrences > 1) {
43492               return false;
43493             }
43494           }
43495         }
43496         return true;
43497       }
43498       function findConnectableEndNodesByExtension(way) {
43499         let results = [];
43500         if (way.isClosed()) return results;
43501         let testNodes;
43502         const indices = [0, way.nodes.length - 1];
43503         indices.forEach((nodeIndex) => {
43504           const nodeID = way.nodes[nodeIndex];
43505           const node = graph.entity(nodeID);
43506           if (!isExtendableCandidate(node, way)) return;
43507           const connectionInfo = canConnectByExtend(way, nodeIndex);
43508           if (!connectionInfo) return;
43509           testNodes = graph.childNodes(way).slice();
43510           testNodes[nodeIndex] = testNodes[nodeIndex].move(connectionInfo.cross_loc);
43511           if (geoHasSelfIntersections(testNodes, nodeID)) return;
43512           results.push(connectionInfo);
43513         });
43514         return results;
43515       }
43516       function findNearbyEndNodes(node, way) {
43517         return [
43518           way.nodes[0],
43519           way.nodes[way.nodes.length - 1]
43520         ].map((d2) => graph.entity(d2)).filter((d2) => {
43521           return d2.id !== node.id && geoSphericalDistance(node.loc, d2.loc) <= CLOSE_NODE_TH;
43522         });
43523       }
43524       function findSmallJoinAngle(midNode, tipNode, endNodes) {
43525         let joinTo;
43526         let minAngle = Infinity;
43527         endNodes.forEach((endNode) => {
43528           const a1 = geoAngle(midNode, tipNode, context.projection) + Math.PI;
43529           const a2 = geoAngle(midNode, endNode, context.projection) + Math.PI;
43530           const diff = Math.max(a1, a2) - Math.min(a1, a2);
43531           if (diff < minAngle) {
43532             joinTo = endNode;
43533             minAngle = diff;
43534           }
43535         });
43536         if (minAngle <= SIG_ANGLE_TH) return joinTo;
43537         return null;
43538       }
43539       function hasTag(tags, key) {
43540         return tags[key] !== void 0 && tags[key] !== "no";
43541       }
43542       function canConnectWays(way, way2) {
43543         if (way.id === way2.id) return true;
43544         if ((hasTag(way.tags, "bridge") || hasTag(way2.tags, "bridge")) && !(hasTag(way.tags, "bridge") && hasTag(way2.tags, "bridge"))) return false;
43545         if ((hasTag(way.tags, "tunnel") || hasTag(way2.tags, "tunnel")) && !(hasTag(way.tags, "tunnel") && hasTag(way2.tags, "tunnel"))) return false;
43546         const layer1 = way.tags.layer || "0", layer2 = way2.tags.layer || "0";
43547         if (layer1 !== layer2) return false;
43548         const level1 = way.tags.level || "0", level2 = way2.tags.level || "0";
43549         if (level1 !== level2) return false;
43550         return true;
43551       }
43552       function canConnectByExtend(way, endNodeIdx) {
43553         const tipNid = way.nodes[endNodeIdx];
43554         const midNid = endNodeIdx === 0 ? way.nodes[1] : way.nodes[way.nodes.length - 2];
43555         const tipNode = graph.entity(tipNid);
43556         const midNode = graph.entity(midNid);
43557         const lon = tipNode.loc[0];
43558         const lat = tipNode.loc[1];
43559         const lon_range = geoMetersToLon(EXTEND_TH_METERS, lat) / 2;
43560         const lat_range = geoMetersToLat(EXTEND_TH_METERS) / 2;
43561         const queryExtent = geoExtent([
43562           [lon - lon_range, lat - lat_range],
43563           [lon + lon_range, lat + lat_range]
43564         ]);
43565         const edgeLen = geoSphericalDistance(midNode.loc, tipNode.loc);
43566         const t2 = EXTEND_TH_METERS / edgeLen + 1;
43567         const extTipLoc = geoVecInterp(midNode.loc, tipNode.loc, t2);
43568         const segmentInfos = tree.waySegments(queryExtent, graph);
43569         for (let i3 = 0; i3 < segmentInfos.length; i3++) {
43570           let segmentInfo = segmentInfos[i3];
43571           let way2 = graph.entity(segmentInfo.wayId);
43572           if (!isHighway(way2)) continue;
43573           if (!canConnectWays(way, way2)) continue;
43574           let nAid = segmentInfo.nodes[0], nBid = segmentInfo.nodes[1];
43575           if (nAid === tipNid || nBid === tipNid) continue;
43576           let nA = graph.entity(nAid), nB = graph.entity(nBid);
43577           let crossLoc = geoLineIntersection([tipNode.loc, extTipLoc], [nA.loc, nB.loc]);
43578           if (crossLoc) {
43579             return {
43580               mid: midNode,
43581               node: tipNode,
43582               wid: way2.id,
43583               edge: [nA.id, nB.id],
43584               cross_loc: crossLoc
43585             };
43586           }
43587         }
43588         return null;
43589       }
43590     };
43591     validation.type = type2;
43592     return validation;
43593   }
43594   var init_almost_junction = __esm({
43595     "modules/validations/almost_junction.js"() {
43596       "use strict";
43597       init_geo2();
43598       init_add_midpoint();
43599       init_change_tags();
43600       init_merge_nodes();
43601       init_localizer();
43602       init_utilDisplayLabel();
43603       init_tags();
43604       init_validation();
43605       init_services();
43606     }
43607   });
43608
43609   // modules/validations/close_nodes.js
43610   var close_nodes_exports = {};
43611   __export(close_nodes_exports, {
43612     validationCloseNodes: () => validationCloseNodes
43613   });
43614   function validationCloseNodes(context) {
43615     var type2 = "close_nodes";
43616     var pointThresholdMeters = 0.2;
43617     var validation = function(entity, graph) {
43618       if (entity.type === "node") {
43619         return getIssuesForNode(entity);
43620       } else if (entity.type === "way") {
43621         return getIssuesForWay(entity);
43622       }
43623       return [];
43624       function getIssuesForNode(node) {
43625         var parentWays = graph.parentWays(node);
43626         if (parentWays.length) {
43627           return getIssuesForVertex(node, parentWays);
43628         } else {
43629           return getIssuesForDetachedPoint(node);
43630         }
43631       }
43632       function wayTypeFor(way) {
43633         if (way.tags.boundary && way.tags.boundary !== "no") return "boundary";
43634         if (way.tags.indoor && way.tags.indoor !== "no") return "indoor";
43635         if (way.tags.building && way.tags.building !== "no" || way.tags["building:part"] && way.tags["building:part"] !== "no") return "building";
43636         if (osmPathHighwayTagValues[way.tags.highway]) return "path";
43637         var parentRelations = graph.parentRelations(way);
43638         for (var i3 in parentRelations) {
43639           var relation = parentRelations[i3];
43640           if (relation.tags.type === "boundary") return "boundary";
43641           if (relation.isMultipolygon()) {
43642             if (relation.tags.indoor && relation.tags.indoor !== "no") return "indoor";
43643             if (relation.tags.building && relation.tags.building !== "no" || relation.tags["building:part"] && relation.tags["building:part"] !== "no") return "building";
43644           }
43645         }
43646         return "other";
43647       }
43648       function shouldCheckWay(way) {
43649         if (way.nodes.length <= 2 || way.isClosed() && way.nodes.length <= 4) return false;
43650         var bbox2 = way.extent(graph).bbox();
43651         var hypotenuseMeters = geoSphericalDistance([bbox2.minX, bbox2.minY], [bbox2.maxX, bbox2.maxY]);
43652         if (hypotenuseMeters < 1.5) return false;
43653         return true;
43654       }
43655       function getIssuesForWay(way) {
43656         if (!shouldCheckWay(way)) return [];
43657         var issues = [], nodes = graph.childNodes(way);
43658         for (var i3 = 0; i3 < nodes.length - 1; i3++) {
43659           var node1 = nodes[i3];
43660           var node2 = nodes[i3 + 1];
43661           var issue = getWayIssueIfAny(node1, node2, way);
43662           if (issue) issues.push(issue);
43663         }
43664         return issues;
43665       }
43666       function getIssuesForVertex(node, parentWays) {
43667         var issues = [];
43668         function checkForCloseness(node1, node2, way) {
43669           var issue = getWayIssueIfAny(node1, node2, way);
43670           if (issue) issues.push(issue);
43671         }
43672         for (var i3 = 0; i3 < parentWays.length; i3++) {
43673           var parentWay = parentWays[i3];
43674           if (!shouldCheckWay(parentWay)) continue;
43675           var lastIndex = parentWay.nodes.length - 1;
43676           for (var j2 = 0; j2 < parentWay.nodes.length; j2++) {
43677             if (j2 !== 0) {
43678               if (parentWay.nodes[j2 - 1] === node.id) {
43679                 checkForCloseness(node, graph.entity(parentWay.nodes[j2]), parentWay);
43680               }
43681             }
43682             if (j2 !== lastIndex) {
43683               if (parentWay.nodes[j2 + 1] === node.id) {
43684                 checkForCloseness(graph.entity(parentWay.nodes[j2]), node, parentWay);
43685               }
43686             }
43687           }
43688         }
43689         return issues;
43690       }
43691       function thresholdMetersForWay(way) {
43692         if (!shouldCheckWay(way)) return 0;
43693         var wayType = wayTypeFor(way);
43694         if (wayType === "boundary") return 0;
43695         if (wayType === "indoor") return 0.01;
43696         if (wayType === "building") return 0.05;
43697         if (wayType === "path") return 0.1;
43698         return 0.2;
43699       }
43700       function getIssuesForDetachedPoint(node) {
43701         var issues = [];
43702         var lon = node.loc[0];
43703         var lat = node.loc[1];
43704         var lon_range = geoMetersToLon(pointThresholdMeters, lat) / 2;
43705         var lat_range = geoMetersToLat(pointThresholdMeters) / 2;
43706         var queryExtent = geoExtent([
43707           [lon - lon_range, lat - lat_range],
43708           [lon + lon_range, lat + lat_range]
43709         ]);
43710         var intersected = context.history().tree().intersects(queryExtent, graph);
43711         for (var j2 = 0; j2 < intersected.length; j2++) {
43712           var nearby = intersected[j2];
43713           if (nearby.id === node.id) continue;
43714           if (nearby.type !== "node" || nearby.geometry(graph) !== "point") continue;
43715           if (nearby.loc === node.loc || geoSphericalDistance(node.loc, nearby.loc) < pointThresholdMeters) {
43716             if ("memorial:type" in node.tags && "memorial:type" in nearby.tags && node.tags["memorial:type"] === "stolperstein" && nearby.tags["memorial:type"] === "stolperstein") continue;
43717             if ("memorial" in node.tags && "memorial" in nearby.tags && node.tags.memorial === "stolperstein" && nearby.tags.memorial === "stolperstein") continue;
43718             var zAxisKeys = { layer: true, level: true, "addr:housenumber": true, "addr:unit": true };
43719             var zAxisDifferentiates = false;
43720             for (var key in zAxisKeys) {
43721               var nodeValue = node.tags[key] || "0";
43722               var nearbyValue = nearby.tags[key] || "0";
43723               if (nodeValue !== nearbyValue) {
43724                 zAxisDifferentiates = true;
43725                 break;
43726               }
43727             }
43728             if (zAxisDifferentiates) continue;
43729             issues.push(new validationIssue({
43730               type: type2,
43731               subtype: "detached",
43732               severity: "warning",
43733               message: function(context2) {
43734                 var entity2 = context2.hasEntity(this.entityIds[0]), entity22 = context2.hasEntity(this.entityIds[1]);
43735                 return entity2 && entity22 ? _t.append("issues.close_nodes.detached.message", {
43736                   feature: utilDisplayLabel(entity2, context2.graph()),
43737                   feature2: utilDisplayLabel(entity22, context2.graph())
43738                 }) : "";
43739               },
43740               reference: showReference,
43741               entityIds: [node.id, nearby.id],
43742               dynamicFixes: function() {
43743                 return [
43744                   new validationIssueFix({
43745                     icon: "iD-operation-disconnect",
43746                     title: _t.append("issues.fix.move_points_apart.title")
43747                   }),
43748                   new validationIssueFix({
43749                     icon: "iD-icon-layers",
43750                     title: _t.append("issues.fix.use_different_layers_or_levels.title")
43751                   })
43752                 ];
43753               }
43754             }));
43755           }
43756         }
43757         return issues;
43758         function showReference(selection2) {
43759           var referenceText = _t("issues.close_nodes.detached.reference");
43760           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").html(referenceText);
43761         }
43762       }
43763       function getWayIssueIfAny(node1, node2, way) {
43764         if (node1.id === node2.id || node1.hasInterestingTags() && node2.hasInterestingTags()) {
43765           return null;
43766         }
43767         if (node1.loc !== node2.loc) {
43768           var parentWays1 = graph.parentWays(node1);
43769           var parentWays2 = new Set(graph.parentWays(node2));
43770           var sharedWays = parentWays1.filter(function(parentWay) {
43771             return parentWays2.has(parentWay);
43772           });
43773           var thresholds = sharedWays.map(function(parentWay) {
43774             return thresholdMetersForWay(parentWay);
43775           });
43776           var threshold = Math.min(...thresholds);
43777           var distance = geoSphericalDistance(node1.loc, node2.loc);
43778           if (distance > threshold) return null;
43779         }
43780         return new validationIssue({
43781           type: type2,
43782           subtype: "vertices",
43783           severity: "warning",
43784           message: function(context2) {
43785             var entity2 = context2.hasEntity(this.entityIds[0]);
43786             return entity2 ? _t.append("issues.close_nodes.message", { way: utilDisplayLabel(entity2, context2.graph()) }) : "";
43787           },
43788           reference: showReference,
43789           entityIds: [way.id, node1.id, node2.id],
43790           loc: node1.loc,
43791           dynamicFixes: function() {
43792             return [
43793               new validationIssueFix({
43794                 icon: "iD-icon-plus",
43795                 title: _t.append("issues.fix.merge_points.title"),
43796                 onClick: function(context2) {
43797                   var entityIds = this.issue.entityIds;
43798                   var action = actionMergeNodes([entityIds[1], entityIds[2]]);
43799                   context2.perform(action, _t("issues.fix.merge_close_vertices.annotation"));
43800                 }
43801               }),
43802               new validationIssueFix({
43803                 icon: "iD-operation-disconnect",
43804                 title: _t.append("issues.fix.move_points_apart.title")
43805               })
43806             ];
43807           }
43808         });
43809         function showReference(selection2) {
43810           var referenceText = _t("issues.close_nodes.reference");
43811           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").html(referenceText);
43812         }
43813       }
43814     };
43815     validation.type = type2;
43816     return validation;
43817   }
43818   var init_close_nodes = __esm({
43819     "modules/validations/close_nodes.js"() {
43820       "use strict";
43821       init_merge_nodes();
43822       init_utilDisplayLabel();
43823       init_localizer();
43824       init_validation();
43825       init_tags();
43826       init_geo();
43827       init_extent();
43828     }
43829   });
43830
43831   // modules/validations/crossing_ways.js
43832   var crossing_ways_exports = {};
43833   __export(crossing_ways_exports, {
43834     validationCrossingWays: () => validationCrossingWays
43835   });
43836   function validationCrossingWays(context) {
43837     var type2 = "crossing_ways";
43838     function getFeatureWithFeatureTypeTagsForWay(way, graph) {
43839       if (getFeatureType(way, graph) === null) {
43840         var parentRels = graph.parentRelations(way);
43841         for (var i3 = 0; i3 < parentRels.length; i3++) {
43842           var rel = parentRels[i3];
43843           if (getFeatureType(rel, graph) !== null) {
43844             return rel;
43845           }
43846         }
43847       }
43848       return way;
43849     }
43850     function hasTag(tags, key) {
43851       return tags[key] !== void 0 && tags[key] !== "no";
43852     }
43853     function taggedAsIndoor(tags) {
43854       return hasTag(tags, "indoor") || hasTag(tags, "level") || tags.highway === "corridor";
43855     }
43856     function allowsBridge(featureType) {
43857       return featureType === "highway" || featureType === "railway" || featureType === "waterway" || featureType === "aeroway";
43858     }
43859     function allowsTunnel(featureType) {
43860       return featureType === "highway" || featureType === "railway" || featureType === "waterway";
43861     }
43862     var ignoredBuildings = {
43863       demolished: true,
43864       dismantled: true,
43865       proposed: true,
43866       razed: true
43867     };
43868     function getFeatureType(entity, graph) {
43869       var geometry = entity.geometry(graph);
43870       if (geometry !== "line" && geometry !== "area") return null;
43871       var tags = entity.tags;
43872       if (tags.aeroway in osmRoutableAerowayTags) return "aeroway";
43873       if (hasTag(tags, "building") && !ignoredBuildings[tags.building]) return "building";
43874       if (hasTag(tags, "highway") && osmRoutableHighwayTagValues[tags.highway]) return "highway";
43875       if (geometry !== "line") return null;
43876       if (hasTag(tags, "railway") && osmRailwayTrackTagValues[tags.railway]) return "railway";
43877       if (hasTag(tags, "waterway") && osmFlowingWaterwayTagValues[tags.waterway]) return "waterway";
43878       return null;
43879     }
43880     function isLegitCrossing(tags1, featureType1, tags2, featureType2) {
43881       var level1 = tags1.level || "0";
43882       var level2 = tags2.level || "0";
43883       if (taggedAsIndoor(tags1) && taggedAsIndoor(tags2) && level1 !== level2) {
43884         return true;
43885       }
43886       var layer1 = tags1.layer || "0";
43887       var layer2 = tags2.layer || "0";
43888       if (allowsBridge(featureType1) && allowsBridge(featureType2)) {
43889         if (hasTag(tags1, "bridge") && !hasTag(tags2, "bridge")) return true;
43890         if (!hasTag(tags1, "bridge") && hasTag(tags2, "bridge")) return true;
43891         if (hasTag(tags1, "bridge") && hasTag(tags2, "bridge") && layer1 !== layer2) return true;
43892       } else if (allowsBridge(featureType1) && hasTag(tags1, "bridge")) return true;
43893       else if (allowsBridge(featureType2) && hasTag(tags2, "bridge")) return true;
43894       if (allowsTunnel(featureType1) && allowsTunnel(featureType2)) {
43895         if (hasTag(tags1, "tunnel") && !hasTag(tags2, "tunnel")) return true;
43896         if (!hasTag(tags1, "tunnel") && hasTag(tags2, "tunnel")) return true;
43897         if (hasTag(tags1, "tunnel") && hasTag(tags2, "tunnel") && layer1 !== layer2) return true;
43898       } else if (allowsTunnel(featureType1) && hasTag(tags1, "tunnel")) return true;
43899       else if (allowsTunnel(featureType2) && hasTag(tags2, "tunnel")) return true;
43900       if (featureType1 === "waterway" && featureType2 === "highway" && tags2.man_made === "pier") return true;
43901       if (featureType2 === "waterway" && featureType1 === "highway" && tags1.man_made === "pier") return true;
43902       if (featureType1 === "building" || featureType2 === "building" || taggedAsIndoor(tags1) || taggedAsIndoor(tags2)) {
43903         if (layer1 !== layer2) return true;
43904       }
43905       return false;
43906     }
43907     var highwaysDisallowingFords = {
43908       motorway: true,
43909       motorway_link: true,
43910       trunk: true,
43911       trunk_link: true,
43912       primary: true,
43913       primary_link: true,
43914       secondary: true,
43915       secondary_link: true
43916     };
43917     function tagsForConnectionNodeIfAllowed(entity1, entity2, graph, lessLikelyTags) {
43918       var featureType1 = getFeatureType(entity1, graph);
43919       var featureType2 = getFeatureType(entity2, graph);
43920       var geometry1 = entity1.geometry(graph);
43921       var geometry2 = entity2.geometry(graph);
43922       var bothLines = geometry1 === "line" && geometry2 === "line";
43923       const featureTypes = [featureType1, featureType2].sort().join("-");
43924       if (featureTypes === "aeroway-aeroway") return {};
43925       if (featureTypes === "aeroway-highway") {
43926         const isServiceRoad = entity1.tags.highway === "service" || entity2.tags.highway === "service";
43927         const isPath = entity1.tags.highway in osmPathHighwayTagValues || entity2.tags.highway in osmPathHighwayTagValues;
43928         return isServiceRoad || isPath ? {} : { aeroway: "aircraft_crossing" };
43929       }
43930       if (featureTypes === "aeroway-railway") {
43931         return { aeroway: "aircraft_crossing", railway: "level_crossing" };
43932       }
43933       if (featureTypes === "aeroway-waterway") return null;
43934       if (featureType1 === featureType2) {
43935         if (featureType1 === "highway") {
43936           var entity1IsPath = osmPathHighwayTagValues[entity1.tags.highway];
43937           var entity2IsPath = osmPathHighwayTagValues[entity2.tags.highway];
43938           if ((entity1IsPath || entity2IsPath) && entity1IsPath !== entity2IsPath) {
43939             if (!bothLines) return {};
43940             var roadFeature = entity1IsPath ? entity2 : entity1;
43941             var pathFeature = entity1IsPath ? entity1 : entity2;
43942             if (roadFeature.tags.highway === "track") {
43943               return {};
43944             }
43945             if (!lessLikelyTags && roadFeature.tags.highway === "service" && pathFeature.tags.highway === "footway" && pathFeature.tags.footway === "sidewalk") {
43946               return {};
43947             }
43948             if (["marked", "unmarked", "traffic_signals", "uncontrolled"].indexOf(pathFeature.tags.crossing) !== -1) {
43949               var tags = { highway: "crossing", crossing: pathFeature.tags.crossing };
43950               if ("crossing:markings" in pathFeature.tags) {
43951                 tags["crossing:markings"] = pathFeature.tags["crossing:markings"];
43952               }
43953               return tags;
43954             }
43955             return { highway: "crossing" };
43956           }
43957           return {};
43958         }
43959         if (featureType1 === "waterway") return {};
43960         if (featureType1 === "railway") return {};
43961       } else {
43962         if (featureTypes.indexOf("highway") !== -1) {
43963           if (featureTypes.indexOf("railway") !== -1) {
43964             if (!bothLines) return {};
43965             var isTram = entity1.tags.railway === "tram" || entity2.tags.railway === "tram";
43966             if (osmPathHighwayTagValues[entity1.tags.highway] || osmPathHighwayTagValues[entity2.tags.highway]) {
43967               if (isTram) return { railway: "tram_crossing" };
43968               return { railway: "crossing" };
43969             } else {
43970               if (isTram) return { railway: "tram_level_crossing" };
43971               return { railway: "level_crossing" };
43972             }
43973           }
43974           if (featureTypes.indexOf("waterway") !== -1) {
43975             if (hasTag(entity1.tags, "tunnel") && hasTag(entity2.tags, "tunnel")) return null;
43976             if (hasTag(entity1.tags, "bridge") && hasTag(entity2.tags, "bridge")) return null;
43977             if (highwaysDisallowingFords[entity1.tags.highway] || highwaysDisallowingFords[entity2.tags.highway]) {
43978               return null;
43979             }
43980             return bothLines ? { ford: "yes" } : {};
43981           }
43982         }
43983       }
43984       return null;
43985     }
43986     function findCrossingsByWay(way1, graph, tree) {
43987       var edgeCrossInfos = [];
43988       if (way1.type !== "way") return edgeCrossInfos;
43989       var taggedFeature1 = getFeatureWithFeatureTypeTagsForWay(way1, graph);
43990       var way1FeatureType = getFeatureType(taggedFeature1, graph);
43991       if (way1FeatureType === null) return edgeCrossInfos;
43992       var checkedSingleCrossingWays = {};
43993       var i3, j2;
43994       var extent;
43995       var n1, n22, nA, nB, nAId, nBId;
43996       var segment1, segment2;
43997       var oneOnly;
43998       var segmentInfos, segment2Info, way2, taggedFeature2, way2FeatureType;
43999       var way1Nodes = graph.childNodes(way1);
44000       var comparedWays = {};
44001       for (i3 = 0; i3 < way1Nodes.length - 1; i3++) {
44002         n1 = way1Nodes[i3];
44003         n22 = way1Nodes[i3 + 1];
44004         extent = geoExtent([
44005           [
44006             Math.min(n1.loc[0], n22.loc[0]),
44007             Math.min(n1.loc[1], n22.loc[1])
44008           ],
44009           [
44010             Math.max(n1.loc[0], n22.loc[0]),
44011             Math.max(n1.loc[1], n22.loc[1])
44012           ]
44013         ]);
44014         segmentInfos = tree.waySegments(extent, graph);
44015         for (j2 = 0; j2 < segmentInfos.length; j2++) {
44016           segment2Info = segmentInfos[j2];
44017           if (segment2Info.wayId === way1.id) continue;
44018           if (checkedSingleCrossingWays[segment2Info.wayId]) continue;
44019           comparedWays[segment2Info.wayId] = true;
44020           way2 = graph.hasEntity(segment2Info.wayId);
44021           if (!way2) continue;
44022           taggedFeature2 = getFeatureWithFeatureTypeTagsForWay(way2, graph);
44023           way2FeatureType = getFeatureType(taggedFeature2, graph);
44024           if (way2FeatureType === null || isLegitCrossing(taggedFeature1.tags, way1FeatureType, taggedFeature2.tags, way2FeatureType)) {
44025             continue;
44026           }
44027           oneOnly = way1FeatureType === "building" || way2FeatureType === "building";
44028           nAId = segment2Info.nodes[0];
44029           nBId = segment2Info.nodes[1];
44030           if (nAId === n1.id || nAId === n22.id || nBId === n1.id || nBId === n22.id) {
44031             continue;
44032           }
44033           nA = graph.hasEntity(nAId);
44034           if (!nA) continue;
44035           nB = graph.hasEntity(nBId);
44036           if (!nB) continue;
44037           segment1 = [n1.loc, n22.loc];
44038           segment2 = [nA.loc, nB.loc];
44039           var point = geoLineIntersection(segment1, segment2);
44040           if (point) {
44041             edgeCrossInfos.push({
44042               wayInfos: [
44043                 {
44044                   way: way1,
44045                   featureType: way1FeatureType,
44046                   edge: [n1.id, n22.id]
44047                 },
44048                 {
44049                   way: way2,
44050                   featureType: way2FeatureType,
44051                   edge: [nA.id, nB.id]
44052                 }
44053               ],
44054               crossPoint: point
44055             });
44056             if (oneOnly) {
44057               checkedSingleCrossingWays[way2.id] = true;
44058               break;
44059             }
44060           }
44061         }
44062       }
44063       return edgeCrossInfos;
44064     }
44065     function waysToCheck(entity, graph) {
44066       var featureType = getFeatureType(entity, graph);
44067       if (!featureType) return [];
44068       if (entity.type === "way") {
44069         return [entity];
44070       } else if (entity.type === "relation") {
44071         return entity.members.reduce(function(array2, member) {
44072           if (member.type === "way" && // only look at geometry ways
44073           (!member.role || member.role === "outer" || member.role === "inner")) {
44074             var entity2 = graph.hasEntity(member.id);
44075             if (entity2 && array2.indexOf(entity2) === -1) {
44076               array2.push(entity2);
44077             }
44078           }
44079           return array2;
44080         }, []);
44081       }
44082       return [];
44083     }
44084     var validation = function checkCrossingWays(entity, graph) {
44085       var tree = context.history().tree();
44086       var ways = waysToCheck(entity, graph);
44087       var issues = [];
44088       var wayIndex, crossingIndex, crossings;
44089       for (wayIndex in ways) {
44090         crossings = findCrossingsByWay(ways[wayIndex], graph, tree);
44091         for (crossingIndex in crossings) {
44092           issues.push(createIssue(crossings[crossingIndex], graph));
44093         }
44094       }
44095       return issues;
44096     };
44097     function createIssue(crossing, graph) {
44098       crossing.wayInfos.sort(function(way1Info, way2Info) {
44099         var type1 = way1Info.featureType;
44100         var type22 = way2Info.featureType;
44101         if (type1 === type22) {
44102           return utilDisplayLabel(way1Info.way, graph) > utilDisplayLabel(way2Info.way, graph);
44103         } else if (type1 === "waterway") {
44104           return true;
44105         } else if (type22 === "waterway") {
44106           return false;
44107         }
44108         return type1 < type22;
44109       });
44110       var entities = crossing.wayInfos.map(function(wayInfo) {
44111         return getFeatureWithFeatureTypeTagsForWay(wayInfo.way, graph);
44112       });
44113       var edges = [crossing.wayInfos[0].edge, crossing.wayInfos[1].edge];
44114       var featureTypes = [crossing.wayInfos[0].featureType, crossing.wayInfos[1].featureType];
44115       var connectionTags = tagsForConnectionNodeIfAllowed(entities[0], entities[1], graph);
44116       var featureType1 = crossing.wayInfos[0].featureType;
44117       var featureType2 = crossing.wayInfos[1].featureType;
44118       var isCrossingIndoors = taggedAsIndoor(entities[0].tags) && taggedAsIndoor(entities[1].tags);
44119       var isCrossingTunnels = allowsTunnel(featureType1) && hasTag(entities[0].tags, "tunnel") && allowsTunnel(featureType2) && hasTag(entities[1].tags, "tunnel");
44120       var isCrossingBridges = allowsBridge(featureType1) && hasTag(entities[0].tags, "bridge") && allowsBridge(featureType2) && hasTag(entities[1].tags, "bridge");
44121       var subtype = [featureType1, featureType2].sort().join("-");
44122       var crossingTypeID = subtype;
44123       if (isCrossingIndoors) {
44124         crossingTypeID = "indoor-indoor";
44125       } else if (isCrossingTunnels) {
44126         crossingTypeID = "tunnel-tunnel";
44127       } else if (isCrossingBridges) {
44128         crossingTypeID = "bridge-bridge";
44129       }
44130       if (connectionTags && (isCrossingIndoors || isCrossingTunnels || isCrossingBridges)) {
44131         crossingTypeID += "_connectable";
44132       }
44133       var uniqueID = crossing.crossPoint[0].toFixed(4) + "," + crossing.crossPoint[1].toFixed(4);
44134       return new validationIssue({
44135         type: type2,
44136         subtype,
44137         severity: "warning",
44138         message: function(context2) {
44139           var graph2 = context2.graph();
44140           var entity1 = graph2.hasEntity(this.entityIds[0]), entity2 = graph2.hasEntity(this.entityIds[1]);
44141           return entity1 && entity2 ? _t.append("issues.crossing_ways.message", {
44142             feature: utilDisplayLabel(entity1, graph2),
44143             feature2: utilDisplayLabel(entity2, graph2)
44144           }) : "";
44145         },
44146         reference: showReference,
44147         entityIds: entities.map(function(entity) {
44148           return entity.id;
44149         }),
44150         data: {
44151           edges,
44152           featureTypes,
44153           connectionTags
44154         },
44155         hash: uniqueID,
44156         loc: crossing.crossPoint,
44157         dynamicFixes: function(context2) {
44158           var mode = context2.mode();
44159           if (!mode || mode.id !== "select" || mode.selectedIDs().length !== 1) return [];
44160           var selectedIndex = this.entityIds[0] === mode.selectedIDs()[0] ? 0 : 1;
44161           var selectedFeatureType = this.data.featureTypes[selectedIndex];
44162           var otherFeatureType = this.data.featureTypes[selectedIndex === 0 ? 1 : 0];
44163           var fixes = [];
44164           if (connectionTags) {
44165             fixes.push(makeConnectWaysFix(this.data.connectionTags));
44166             let lessLikelyConnectionTags = tagsForConnectionNodeIfAllowed(entities[0], entities[1], graph, true);
44167             if (lessLikelyConnectionTags && !(0, import_lodash3.isEqual)(connectionTags, lessLikelyConnectionTags)) {
44168               fixes.push(makeConnectWaysFix(lessLikelyConnectionTags));
44169             }
44170           }
44171           if (isCrossingIndoors) {
44172             fixes.push(new validationIssueFix({
44173               icon: "iD-icon-layers",
44174               title: _t.append("issues.fix.use_different_levels.title")
44175             }));
44176           } else if (isCrossingTunnels || isCrossingBridges || featureType1 === "building" || featureType2 === "building") {
44177             fixes.push(makeChangeLayerFix("higher"));
44178             fixes.push(makeChangeLayerFix("lower"));
44179           } else if (context2.graph().geometry(this.entityIds[0]) === "line" && context2.graph().geometry(this.entityIds[1]) === "line") {
44180             if (allowsBridge(selectedFeatureType) && selectedFeatureType !== "waterway") {
44181               fixes.push(makeAddBridgeOrTunnelFix("add_a_bridge", "temaki-bridge", "bridge"));
44182             }
44183             var skipTunnelFix = otherFeatureType === "waterway" && selectedFeatureType !== "waterway";
44184             if (allowsTunnel(selectedFeatureType) && !skipTunnelFix) {
44185               if (selectedFeatureType === "waterway") {
44186                 fixes.push(makeAddBridgeOrTunnelFix("add_a_culvert", "temaki-waste", "tunnel"));
44187               } else {
44188                 fixes.push(makeAddBridgeOrTunnelFix("add_a_tunnel", "temaki-tunnel", "tunnel"));
44189               }
44190             }
44191           }
44192           fixes.push(new validationIssueFix({
44193             icon: "iD-operation-move",
44194             title: _t.append("issues.fix.reposition_features.title")
44195           }));
44196           return fixes;
44197         }
44198       });
44199       function showReference(selection2) {
44200         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.crossing_ways." + crossingTypeID + ".reference"));
44201       }
44202     }
44203     function makeAddBridgeOrTunnelFix(fixTitleID, iconName, bridgeOrTunnel) {
44204       return new validationIssueFix({
44205         icon: iconName,
44206         title: _t.append("issues.fix." + fixTitleID + ".title"),
44207         onClick: function(context2) {
44208           var mode = context2.mode();
44209           if (!mode || mode.id !== "select") return;
44210           var selectedIDs = mode.selectedIDs();
44211           if (selectedIDs.length !== 1) return;
44212           var selectedWayID = selectedIDs[0];
44213           if (!context2.hasEntity(selectedWayID)) return;
44214           var resultWayIDs = [selectedWayID];
44215           var edge, crossedEdge, crossedWayID;
44216           if (this.issue.entityIds[0] === selectedWayID) {
44217             edge = this.issue.data.edges[0];
44218             crossedEdge = this.issue.data.edges[1];
44219             crossedWayID = this.issue.entityIds[1];
44220           } else {
44221             edge = this.issue.data.edges[1];
44222             crossedEdge = this.issue.data.edges[0];
44223             crossedWayID = this.issue.entityIds[0];
44224           }
44225           var crossingLoc = this.issue.loc;
44226           var projection2 = context2.projection;
44227           var action = function actionAddStructure(graph) {
44228             var edgeNodes = [graph.entity(edge[0]), graph.entity(edge[1])];
44229             var crossedWay = graph.hasEntity(crossedWayID);
44230             var structLengthMeters = crossedWay && isFinite(crossedWay.tags.width) && Number(crossedWay.tags.width);
44231             if (!structLengthMeters) {
44232               structLengthMeters = crossedWay && crossedWay.impliedLineWidthMeters();
44233             }
44234             if (structLengthMeters) {
44235               if (getFeatureType(crossedWay, graph) === "railway") {
44236                 structLengthMeters *= 2;
44237               }
44238             } else {
44239               structLengthMeters = 8;
44240             }
44241             var a1 = geoAngle(edgeNodes[0], edgeNodes[1], projection2) + Math.PI;
44242             var a2 = geoAngle(graph.entity(crossedEdge[0]), graph.entity(crossedEdge[1]), projection2) + Math.PI;
44243             var crossingAngle = Math.max(a1, a2) - Math.min(a1, a2);
44244             if (crossingAngle > Math.PI) crossingAngle -= Math.PI;
44245             structLengthMeters = structLengthMeters / 2 / Math.sin(crossingAngle) * 2;
44246             structLengthMeters += 4;
44247             structLengthMeters = Math.min(Math.max(structLengthMeters, 4), 50);
44248             function geomToProj(geoPoint) {
44249               return [
44250                 geoLonToMeters(geoPoint[0], geoPoint[1]),
44251                 geoLatToMeters(geoPoint[1])
44252               ];
44253             }
44254             function projToGeom(projPoint) {
44255               var lat = geoMetersToLat(projPoint[1]);
44256               return [
44257                 geoMetersToLon(projPoint[0], lat),
44258                 lat
44259               ];
44260             }
44261             var projEdgeNode1 = geomToProj(edgeNodes[0].loc);
44262             var projEdgeNode2 = geomToProj(edgeNodes[1].loc);
44263             var projectedAngle = geoVecAngle(projEdgeNode1, projEdgeNode2);
44264             var projectedCrossingLoc = geomToProj(crossingLoc);
44265             var linearToSphericalMetersRatio = geoVecLength(projEdgeNode1, projEdgeNode2) / geoSphericalDistance(edgeNodes[0].loc, edgeNodes[1].loc);
44266             function locSphericalDistanceFromCrossingLoc(angle2, distanceMeters) {
44267               var lengthSphericalMeters = distanceMeters * linearToSphericalMetersRatio;
44268               return projToGeom([
44269                 projectedCrossingLoc[0] + Math.cos(angle2) * lengthSphericalMeters,
44270                 projectedCrossingLoc[1] + Math.sin(angle2) * lengthSphericalMeters
44271               ]);
44272             }
44273             var endpointLocGetter1 = function(lengthMeters) {
44274               return locSphericalDistanceFromCrossingLoc(projectedAngle, lengthMeters);
44275             };
44276             var endpointLocGetter2 = function(lengthMeters) {
44277               return locSphericalDistanceFromCrossingLoc(projectedAngle + Math.PI, lengthMeters);
44278             };
44279             var minEdgeLengthMeters = 0.55;
44280             function determineEndpoint(edge2, endNode, locGetter) {
44281               var newNode;
44282               var idealLengthMeters = structLengthMeters / 2;
44283               var crossingToEdgeEndDistance = geoSphericalDistance(crossingLoc, endNode.loc);
44284               if (crossingToEdgeEndDistance - idealLengthMeters > minEdgeLengthMeters) {
44285                 var idealNodeLoc = locGetter(idealLengthMeters);
44286                 newNode = osmNode();
44287                 graph = actionAddMidpoint({ loc: idealNodeLoc, edge: edge2 }, newNode)(graph);
44288               } else {
44289                 var edgeCount = 0;
44290                 endNode.parentIntersectionWays(graph).forEach(function(way) {
44291                   way.nodes.forEach(function(nodeID) {
44292                     if (nodeID === endNode.id) {
44293                       if (endNode.id === way.first() && endNode.id !== way.last() || endNode.id === way.last() && endNode.id !== way.first()) {
44294                         edgeCount += 1;
44295                       } else {
44296                         edgeCount += 2;
44297                       }
44298                     }
44299                   });
44300                 });
44301                 if (edgeCount >= 3) {
44302                   var insetLength = crossingToEdgeEndDistance - minEdgeLengthMeters;
44303                   if (insetLength > minEdgeLengthMeters) {
44304                     var insetNodeLoc = locGetter(insetLength);
44305                     newNode = osmNode();
44306                     graph = actionAddMidpoint({ loc: insetNodeLoc, edge: edge2 }, newNode)(graph);
44307                   }
44308                 }
44309               }
44310               if (!newNode) newNode = endNode;
44311               var splitAction = actionSplit([newNode.id]).limitWays(resultWayIDs);
44312               graph = splitAction(graph);
44313               if (splitAction.getCreatedWayIDs().length) {
44314                 resultWayIDs.push(splitAction.getCreatedWayIDs()[0]);
44315               }
44316               return newNode;
44317             }
44318             var structEndNode1 = determineEndpoint(edge, edgeNodes[1], endpointLocGetter1);
44319             var structEndNode2 = determineEndpoint([edgeNodes[0].id, structEndNode1.id], edgeNodes[0], endpointLocGetter2);
44320             var structureWay = resultWayIDs.map(function(id2) {
44321               return graph.entity(id2);
44322             }).find(function(way) {
44323               return way.nodes.indexOf(structEndNode1.id) !== -1 && way.nodes.indexOf(structEndNode2.id) !== -1;
44324             });
44325             var tags = Object.assign({}, structureWay.tags);
44326             if (bridgeOrTunnel === "bridge") {
44327               tags.bridge = "yes";
44328               tags.layer = "1";
44329             } else {
44330               var tunnelValue = "yes";
44331               if (getFeatureType(structureWay, graph) === "waterway") {
44332                 tunnelValue = "culvert";
44333               }
44334               tags.tunnel = tunnelValue;
44335               tags.layer = "-1";
44336             }
44337             graph = actionChangeTags(structureWay.id, tags)(graph);
44338             return graph;
44339           };
44340           context2.perform(action, _t("issues.fix." + fixTitleID + ".annotation"));
44341           context2.enter(modeSelect(context2, resultWayIDs));
44342         }
44343       });
44344     }
44345     function makeConnectWaysFix(connectionTags) {
44346       var fixTitleID = "connect_features";
44347       var fixIcon = "iD-icon-crossing";
44348       if (connectionTags.highway === "crossing") {
44349         fixTitleID = "connect_using_crossing";
44350         fixIcon = "temaki-pedestrian";
44351       }
44352       if (connectionTags.ford) {
44353         fixTitleID = "connect_using_ford";
44354         fixIcon = "roentgen-ford";
44355       }
44356       const fix = new validationIssueFix({
44357         icon: fixIcon,
44358         title: _t.append("issues.fix." + fixTitleID + ".title"),
44359         onClick: function(context2) {
44360           var loc = this.issue.loc;
44361           var edges = this.issue.data.edges;
44362           context2.perform(
44363             function actionConnectCrossingWays(graph) {
44364               var node = osmNode({ loc, tags: connectionTags });
44365               graph = graph.replace(node);
44366               var nodesToMerge = [node.id];
44367               var mergeThresholdInMeters = 0.75;
44368               edges.forEach(function(edge) {
44369                 var edgeNodes = [graph.entity(edge[0]), graph.entity(edge[1])];
44370                 var nearby = geoSphericalClosestNode(edgeNodes, loc);
44371                 if ((!nearby.node.hasInterestingTags() || nearby.node.isCrossing()) && nearby.distance < mergeThresholdInMeters) {
44372                   nodesToMerge.push(nearby.node.id);
44373                 } else {
44374                   graph = actionAddMidpoint({ loc, edge }, node)(graph);
44375                 }
44376               });
44377               if (nodesToMerge.length > 1) {
44378                 graph = actionMergeNodes(nodesToMerge, loc)(graph);
44379               }
44380               return graph;
44381             },
44382             _t("issues.fix.connect_crossing_features.annotation")
44383           );
44384         }
44385       });
44386       fix._connectionTags = connectionTags;
44387       return fix;
44388     }
44389     function makeChangeLayerFix(higherOrLower) {
44390       return new validationIssueFix({
44391         icon: "iD-icon-" + (higherOrLower === "higher" ? "up" : "down"),
44392         title: _t.append("issues.fix.tag_this_as_" + higherOrLower + ".title"),
44393         onClick: function(context2) {
44394           var mode = context2.mode();
44395           if (!mode || mode.id !== "select") return;
44396           var selectedIDs = mode.selectedIDs();
44397           if (selectedIDs.length !== 1) return;
44398           var selectedID = selectedIDs[0];
44399           if (!this.issue.entityIds.some(function(entityId) {
44400             return entityId === selectedID;
44401           })) return;
44402           var entity = context2.hasEntity(selectedID);
44403           if (!entity) return;
44404           var tags = Object.assign({}, entity.tags);
44405           var layer = tags.layer && Number(tags.layer);
44406           if (layer && !isNaN(layer)) {
44407             if (higherOrLower === "higher") {
44408               layer += 1;
44409             } else {
44410               layer -= 1;
44411             }
44412           } else {
44413             if (higherOrLower === "higher") {
44414               layer = 1;
44415             } else {
44416               layer = -1;
44417             }
44418           }
44419           tags.layer = layer.toString();
44420           context2.perform(
44421             actionChangeTags(entity.id, tags),
44422             _t("operations.change_tags.annotation")
44423           );
44424         }
44425       });
44426     }
44427     validation.type = type2;
44428     return validation;
44429   }
44430   var import_lodash3;
44431   var init_crossing_ways = __esm({
44432     "modules/validations/crossing_ways.js"() {
44433       "use strict";
44434       import_lodash3 = __toESM(require_lodash());
44435       init_add_midpoint();
44436       init_change_tags();
44437       init_merge_nodes();
44438       init_split();
44439       init_select5();
44440       init_geo2();
44441       init_node2();
44442       init_tags();
44443       init_localizer();
44444       init_utilDisplayLabel();
44445       init_validation();
44446     }
44447   });
44448
44449   // modules/behavior/draw_way.js
44450   var draw_way_exports = {};
44451   __export(draw_way_exports, {
44452     behaviorDrawWay: () => behaviorDrawWay
44453   });
44454   function behaviorDrawWay(context, wayID, mode, startGraph) {
44455     const keybinding = utilKeybinding("drawWay");
44456     var dispatch14 = dispatch_default("rejectedSelfIntersection");
44457     var behavior = behaviorDraw(context);
44458     var _nodeIndex;
44459     var _origWay;
44460     var _wayGeometry;
44461     var _headNodeID;
44462     var _annotation;
44463     var _pointerHasMoved = false;
44464     var _drawNode;
44465     var _didResolveTempEdit = false;
44466     function createDrawNode(loc) {
44467       _drawNode = osmNode({ loc });
44468       context.pauseChangeDispatch();
44469       context.replace(function actionAddDrawNode(graph) {
44470         var way = graph.entity(wayID);
44471         return graph.replace(_drawNode).replace(way.addNode(_drawNode.id, _nodeIndex));
44472       }, _annotation);
44473       context.resumeChangeDispatch();
44474       setActiveElements();
44475     }
44476     function removeDrawNode() {
44477       context.pauseChangeDispatch();
44478       context.replace(
44479         function actionDeleteDrawNode(graph) {
44480           var way = graph.entity(wayID);
44481           return graph.replace(way.removeNode(_drawNode.id)).remove(_drawNode);
44482         },
44483         _annotation
44484       );
44485       _drawNode = void 0;
44486       context.resumeChangeDispatch();
44487     }
44488     function keydown(d3_event) {
44489       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
44490         if (context.surface().classed("nope")) {
44491           context.surface().classed("nope-suppressed", true);
44492         }
44493         context.surface().classed("nope", false).classed("nope-disabled", true);
44494       }
44495     }
44496     function keyup(d3_event) {
44497       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
44498         if (context.surface().classed("nope-suppressed")) {
44499           context.surface().classed("nope", true);
44500         }
44501         context.surface().classed("nope-suppressed", false).classed("nope-disabled", false);
44502       }
44503     }
44504     function allowsVertex(d2) {
44505       return d2.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d2, context.graph());
44506     }
44507     function move(d3_event, datum2) {
44508       var loc = context.map().mouseCoordinates();
44509       if (!_drawNode) createDrawNode(loc);
44510       context.surface().classed("nope-disabled", d3_event.altKey);
44511       var targetLoc = datum2 && datum2.properties && datum2.properties.entity && allowsVertex(datum2.properties.entity) && datum2.properties.entity.loc;
44512       var targetNodes = datum2 && datum2.properties && datum2.properties.nodes;
44513       if (targetLoc) {
44514         loc = targetLoc;
44515       } else if (targetNodes) {
44516         var choice = geoChooseEdge(targetNodes, context.map().mouse(), context.projection, _drawNode.id);
44517         if (choice) {
44518           loc = choice.loc;
44519         }
44520       }
44521       context.replace(actionMoveNode(_drawNode.id, loc), _annotation);
44522       _drawNode = context.entity(_drawNode.id);
44523       checkGeometry(
44524         true
44525         /* includeDrawNode */
44526       );
44527     }
44528     function checkGeometry(includeDrawNode) {
44529       var nopeDisabled = context.surface().classed("nope-disabled");
44530       var isInvalid = isInvalidGeometry(includeDrawNode);
44531       if (nopeDisabled) {
44532         context.surface().classed("nope", false).classed("nope-suppressed", isInvalid);
44533       } else {
44534         context.surface().classed("nope", isInvalid).classed("nope-suppressed", false);
44535       }
44536     }
44537     function isInvalidGeometry(includeDrawNode) {
44538       var testNode = _drawNode;
44539       var parentWay = context.graph().entity(wayID);
44540       var nodes = context.graph().childNodes(parentWay).slice();
44541       if (includeDrawNode) {
44542         if (parentWay.isClosed()) {
44543           nodes.pop();
44544         }
44545       } else {
44546         if (parentWay.isClosed()) {
44547           if (nodes.length < 3) return false;
44548           if (_drawNode) nodes.splice(-2, 1);
44549           testNode = nodes[nodes.length - 2];
44550         } else {
44551           return false;
44552         }
44553       }
44554       return testNode && geoHasSelfIntersections(nodes, testNode.id);
44555     }
44556     function undone() {
44557       _didResolveTempEdit = true;
44558       context.pauseChangeDispatch();
44559       var nextMode;
44560       if (context.graph() === startGraph) {
44561         nextMode = modeSelect(context, [wayID]);
44562       } else {
44563         context.pop(1);
44564         nextMode = mode;
44565       }
44566       context.perform(actionNoop());
44567       context.pop(1);
44568       context.resumeChangeDispatch();
44569       context.enter(nextMode);
44570     }
44571     function setActiveElements() {
44572       if (!_drawNode) return;
44573       context.surface().selectAll("." + _drawNode.id).classed("active", true);
44574     }
44575     function resetToStartGraph() {
44576       while (context.graph() !== startGraph) {
44577         context.pop();
44578       }
44579     }
44580     var drawWay = function(surface) {
44581       _drawNode = void 0;
44582       _didResolveTempEdit = false;
44583       _origWay = context.entity(wayID);
44584       if (typeof _nodeIndex === "number") {
44585         _headNodeID = _origWay.nodes[_nodeIndex];
44586       } else if (_origWay.isClosed()) {
44587         _headNodeID = _origWay.nodes[_origWay.nodes.length - 2];
44588       } else {
44589         _headNodeID = _origWay.nodes[_origWay.nodes.length - 1];
44590       }
44591       _wayGeometry = _origWay.geometry(context.graph());
44592       _annotation = _t(
44593         (_origWay.nodes.length === (_origWay.isClosed() ? 2 : 1) ? "operations.start.annotation." : "operations.continue.annotation.") + _wayGeometry
44594       );
44595       _pointerHasMoved = false;
44596       context.pauseChangeDispatch();
44597       context.perform(actionNoop(), _annotation);
44598       context.resumeChangeDispatch();
44599       behavior.hover().initialNodeID(_headNodeID);
44600       behavior.on("move", function() {
44601         _pointerHasMoved = true;
44602         move.apply(this, arguments);
44603       }).on("down", function() {
44604         move.apply(this, arguments);
44605       }).on("downcancel", function() {
44606         if (_drawNode) removeDrawNode();
44607       }).on("click", drawWay.add).on("clickWay", drawWay.addWay).on("clickNode", drawWay.addNode).on("undo", context.undo).on("cancel", drawWay.cancel).on("finish", drawWay.finish);
44608       select_default2(window).on("keydown.drawWay", keydown).on("keyup.drawWay", keyup);
44609       context.map().dblclickZoomEnable(false).on("drawn.draw", setActiveElements);
44610       setActiveElements();
44611       surface.call(behavior);
44612       context.history().on("undone.draw", undone);
44613     };
44614     drawWay.off = function(surface) {
44615       if (!_didResolveTempEdit) {
44616         context.pauseChangeDispatch();
44617         resetToStartGraph();
44618         context.resumeChangeDispatch();
44619       }
44620       _drawNode = void 0;
44621       _nodeIndex = void 0;
44622       context.map().on("drawn.draw", null);
44623       surface.call(behavior.off).selectAll(".active").classed("active", false);
44624       surface.classed("nope", false).classed("nope-suppressed", false).classed("nope-disabled", false);
44625       select_default2(window).on("keydown.drawWay", null).on("keyup.drawWay", null);
44626       context.history().on("undone.draw", null);
44627     };
44628     function attemptAdd(d2, loc, doAdd) {
44629       if (_drawNode) {
44630         context.replace(actionMoveNode(_drawNode.id, loc), _annotation);
44631         _drawNode = context.entity(_drawNode.id);
44632       } else {
44633         createDrawNode(loc);
44634       }
44635       checkGeometry(
44636         true
44637         /* includeDrawNode */
44638       );
44639       if (d2 && d2.properties && d2.properties.nope || context.surface().classed("nope")) {
44640         if (!_pointerHasMoved) {
44641           removeDrawNode();
44642         }
44643         dispatch14.call("rejectedSelfIntersection", this);
44644         return;
44645       }
44646       context.pauseChangeDispatch();
44647       doAdd();
44648       _didResolveTempEdit = true;
44649       context.resumeChangeDispatch();
44650       context.enter(mode);
44651     }
44652     drawWay.add = function(loc, d2) {
44653       attemptAdd(d2, loc, function() {
44654       });
44655     };
44656     drawWay.addWay = function(loc, edge, d2) {
44657       attemptAdd(d2, loc, function() {
44658         context.replace(
44659           actionAddMidpoint({ loc, edge }, _drawNode),
44660           _annotation
44661         );
44662       });
44663     };
44664     drawWay.addNode = function(node, d2) {
44665       if (node.id === _headNodeID || // or the first node when drawing an area
44666       _origWay.isClosed() && node.id === _origWay.first()) {
44667         drawWay.finish();
44668         return;
44669       }
44670       attemptAdd(d2, node.loc, function() {
44671         context.replace(
44672           function actionReplaceDrawNode(graph) {
44673             graph = graph.replace(graph.entity(wayID).removeNode(_drawNode.id)).remove(_drawNode);
44674             return graph.replace(graph.entity(wayID).addNode(node.id, _nodeIndex));
44675           },
44676           _annotation
44677         );
44678       });
44679     };
44680     function getFeatureType(ways) {
44681       if (ways.every((way) => way.isClosed())) return "area";
44682       if (ways.every((way) => !way.isClosed())) return "line";
44683       return "generic";
44684     }
44685     function followMode() {
44686       if (_didResolveTempEdit) return;
44687       try {
44688         const isDrawingArea = _origWay.nodes[0] === _origWay.nodes.slice(-1)[0];
44689         const [secondLastNodeId, lastNodeId] = _origWay.nodes.slice(isDrawingArea ? -3 : -2);
44690         const historyGraph = context.history().graph();
44691         if (!lastNodeId || !secondLastNodeId || !historyGraph.hasEntity(lastNodeId) || !historyGraph.hasEntity(secondLastNodeId)) {
44692           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("operations.follow.error.needs_more_initial_nodes"))();
44693           return;
44694         }
44695         const lastNodesParents = historyGraph.parentWays(historyGraph.entity(lastNodeId)).filter((w2) => w2.id !== wayID);
44696         const secondLastNodesParents = historyGraph.parentWays(historyGraph.entity(secondLastNodeId)).filter((w2) => w2.id !== wayID);
44697         const featureType = getFeatureType(lastNodesParents);
44698         if (lastNodesParents.length !== 1 || secondLastNodesParents.length === 0) {
44699           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append(`operations.follow.error.intersection_of_multiple_ways.${featureType}`))();
44700           return;
44701         }
44702         if (!secondLastNodesParents.some((n3) => n3.id === lastNodesParents[0].id)) {
44703           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append(`operations.follow.error.intersection_of_different_ways.${featureType}`))();
44704           return;
44705         }
44706         const way = lastNodesParents[0];
44707         const indexOfLast = way.nodes.indexOf(lastNodeId);
44708         const indexOfSecondLast = way.nodes.indexOf(secondLastNodeId);
44709         const isDescendingPastZero = indexOfLast === way.nodes.length - 2 && indexOfSecondLast === 0;
44710         let nextNodeIndex = indexOfLast + (indexOfLast > indexOfSecondLast && !isDescendingPastZero ? 1 : -1);
44711         if (nextNodeIndex === -1) nextNodeIndex = indexOfSecondLast === 1 ? way.nodes.length - 2 : 1;
44712         const nextNode = historyGraph.entity(way.nodes[nextNodeIndex]);
44713         drawWay.addNode(nextNode, {
44714           geometry: { type: "Point", coordinates: nextNode.loc },
44715           id: nextNode.id,
44716           properties: { target: true, entity: nextNode }
44717         });
44718       } catch {
44719         context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("operations.follow.error.unknown"))();
44720       }
44721     }
44722     keybinding.on(_t("operations.follow.key"), followMode);
44723     select_default2(document).call(keybinding);
44724     drawWay.finish = function() {
44725       checkGeometry(
44726         false
44727         /* includeDrawNode */
44728       );
44729       if (context.surface().classed("nope")) {
44730         dispatch14.call("rejectedSelfIntersection", this);
44731         return;
44732       }
44733       context.pauseChangeDispatch();
44734       context.pop(1);
44735       _didResolveTempEdit = true;
44736       context.resumeChangeDispatch();
44737       var way = context.hasEntity(wayID);
44738       if (!way || way.isDegenerate()) {
44739         drawWay.cancel();
44740         return;
44741       }
44742       window.setTimeout(function() {
44743         context.map().dblclickZoomEnable(true);
44744       }, 1e3);
44745       var isNewFeature = !mode.isContinuing;
44746       context.enter(modeSelect(context, [wayID]).newFeature(isNewFeature));
44747     };
44748     drawWay.cancel = function() {
44749       context.pauseChangeDispatch();
44750       resetToStartGraph();
44751       context.resumeChangeDispatch();
44752       window.setTimeout(function() {
44753         context.map().dblclickZoomEnable(true);
44754       }, 1e3);
44755       context.surface().classed("nope", false).classed("nope-disabled", false).classed("nope-suppressed", false);
44756       context.enter(modeBrowse(context));
44757     };
44758     drawWay.nodeIndex = function(val) {
44759       if (!arguments.length) return _nodeIndex;
44760       _nodeIndex = val;
44761       return drawWay;
44762     };
44763     drawWay.activeID = function() {
44764       if (!arguments.length) return _drawNode && _drawNode.id;
44765       return drawWay;
44766     };
44767     return utilRebind(drawWay, dispatch14, "on");
44768   }
44769   var init_draw_way = __esm({
44770     "modules/behavior/draw_way.js"() {
44771       "use strict";
44772       init_src4();
44773       init_src5();
44774       init_presets();
44775       init_localizer();
44776       init_add_midpoint();
44777       init_move_node();
44778       init_noop2();
44779       init_draw();
44780       init_geo2();
44781       init_browse();
44782       init_select5();
44783       init_node2();
44784       init_rebind();
44785       init_util();
44786     }
44787   });
44788
44789   // modules/modes/draw_line.js
44790   var draw_line_exports = {};
44791   __export(draw_line_exports, {
44792     modeDrawLine: () => modeDrawLine
44793   });
44794   function modeDrawLine(context, wayID, startGraph, button, affix, continuing) {
44795     var mode = {
44796       button,
44797       id: "draw-line"
44798     };
44799     var behavior = behaviorDrawWay(context, wayID, mode, startGraph).on("rejectedSelfIntersection.modeDrawLine", function() {
44800       context.ui().flash.iconName("#iD-icon-no").label(_t.append("self_intersection.error.lines"))();
44801     });
44802     mode.wayID = wayID;
44803     mode.isContinuing = continuing;
44804     mode.enter = function() {
44805       behavior.nodeIndex(affix === "prefix" ? 0 : void 0);
44806       context.install(behavior);
44807     };
44808     mode.exit = function() {
44809       context.uninstall(behavior);
44810     };
44811     mode.selectedIDs = function() {
44812       return [wayID];
44813     };
44814     mode.activeID = function() {
44815       return behavior && behavior.activeID() || [];
44816     };
44817     return mode;
44818   }
44819   var init_draw_line = __esm({
44820     "modules/modes/draw_line.js"() {
44821       "use strict";
44822       init_localizer();
44823       init_draw_way();
44824     }
44825   });
44826
44827   // modules/validations/disconnected_way.js
44828   var disconnected_way_exports = {};
44829   __export(disconnected_way_exports, {
44830     validationDisconnectedWay: () => validationDisconnectedWay
44831   });
44832   function validationDisconnectedWay() {
44833     var type2 = "disconnected_way";
44834     function isTaggedAsHighway(entity) {
44835       return osmRoutableHighwayTagValues[entity.tags.highway];
44836     }
44837     var validation = function checkDisconnectedWay(entity, graph) {
44838       var routingIslandWays = routingIslandForEntity(entity);
44839       if (!routingIslandWays) return [];
44840       return [new validationIssue({
44841         type: type2,
44842         subtype: "highway",
44843         severity: "warning",
44844         message: function(context) {
44845           var entity2 = this.entityIds.length && context.hasEntity(this.entityIds[0]);
44846           var label = entity2 && utilDisplayLabel(entity2, context.graph());
44847           return _t.append("issues.disconnected_way.routable.message", { count: this.entityIds.length, highway: label });
44848         },
44849         reference: showReference,
44850         entityIds: Array.from(routingIslandWays).map(function(way) {
44851           return way.id;
44852         }),
44853         dynamicFixes: makeFixes
44854       })];
44855       function makeFixes(context) {
44856         var fixes = [];
44857         var singleEntity = this.entityIds.length === 1 && context.hasEntity(this.entityIds[0]);
44858         if (singleEntity) {
44859           if (singleEntity.type === "way" && !singleEntity.isClosed()) {
44860             var textDirection = _mainLocalizer.textDirection();
44861             var startFix = makeContinueDrawingFixIfAllowed(textDirection, singleEntity.first(), "start");
44862             if (startFix) fixes.push(startFix);
44863             var endFix = makeContinueDrawingFixIfAllowed(textDirection, singleEntity.last(), "end");
44864             if (endFix) fixes.push(endFix);
44865           }
44866           if (!fixes.length) {
44867             fixes.push(new validationIssueFix({
44868               title: _t.append("issues.fix.connect_feature.title")
44869             }));
44870           }
44871           fixes.push(new validationIssueFix({
44872             icon: "iD-operation-delete",
44873             title: _t.append("issues.fix.delete_feature.title"),
44874             entityIds: [singleEntity.id],
44875             onClick: function(context2) {
44876               var id2 = this.issue.entityIds[0];
44877               var operation2 = operationDelete(context2, [id2]);
44878               if (!operation2.disabled()) {
44879                 operation2();
44880               }
44881             }
44882           }));
44883         } else {
44884           fixes.push(new validationIssueFix({
44885             title: _t.append("issues.fix.connect_features.title")
44886           }));
44887         }
44888         return fixes;
44889       }
44890       function showReference(selection2) {
44891         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.disconnected_way.routable.reference"));
44892       }
44893       function routingIslandForEntity(entity2) {
44894         var routingIsland = /* @__PURE__ */ new Set();
44895         var waysToCheck = [];
44896         function queueParentWays(node) {
44897           graph.parentWays(node).forEach(function(parentWay) {
44898             if (!routingIsland.has(parentWay) && // only check each feature once
44899             isRoutableWay(parentWay, false)) {
44900               routingIsland.add(parentWay);
44901               waysToCheck.push(parentWay);
44902             }
44903           });
44904         }
44905         if (entity2.type === "way" && isRoutableWay(entity2, true)) {
44906           routingIsland.add(entity2);
44907           waysToCheck.push(entity2);
44908         } else if (entity2.type === "node" && isRoutableNode(entity2)) {
44909           routingIsland.add(entity2);
44910           queueParentWays(entity2);
44911         } else {
44912           return null;
44913         }
44914         while (waysToCheck.length) {
44915           var wayToCheck = waysToCheck.pop();
44916           var childNodes = graph.childNodes(wayToCheck);
44917           for (var i3 in childNodes) {
44918             var vertex = childNodes[i3];
44919             if (isConnectedVertex(vertex)) {
44920               return null;
44921             }
44922             if (isRoutableNode(vertex)) {
44923               routingIsland.add(vertex);
44924             }
44925             queueParentWays(vertex);
44926           }
44927         }
44928         return routingIsland;
44929       }
44930       function isConnectedVertex(vertex) {
44931         var osm = services.osm;
44932         if (osm && !osm.isDataLoaded(vertex.loc)) return true;
44933         if (vertex.tags.entrance && vertex.tags.entrance !== "no") return true;
44934         if (vertex.tags.amenity === "parking_entrance") return true;
44935         return false;
44936       }
44937       function isRoutableNode(node) {
44938         if (node.tags.highway === "elevator") return true;
44939         return false;
44940       }
44941       function isRoutableWay(way, ignoreInnerWays) {
44942         if (isTaggedAsHighway(way) || way.tags.route === "ferry") return true;
44943         return graph.parentRelations(way).some(function(parentRelation) {
44944           if (parentRelation.tags.type === "route" && parentRelation.tags.route === "ferry") return true;
44945           if (parentRelation.isMultipolygon() && isTaggedAsHighway(parentRelation) && (!ignoreInnerWays || parentRelation.memberById(way.id).role !== "inner")) return true;
44946           return false;
44947         });
44948       }
44949       function makeContinueDrawingFixIfAllowed(textDirection, vertexID, whichEnd) {
44950         var vertex = graph.hasEntity(vertexID);
44951         if (!vertex || vertex.tags.noexit === "yes") return null;
44952         var useLeftContinue = whichEnd === "start" && textDirection === "ltr" || whichEnd === "end" && textDirection === "rtl";
44953         return new validationIssueFix({
44954           icon: "iD-operation-continue" + (useLeftContinue ? "-left" : ""),
44955           title: _t.append("issues.fix.continue_from_" + whichEnd + ".title"),
44956           entityIds: [vertexID],
44957           onClick: function(context) {
44958             var wayId = this.issue.entityIds[0];
44959             var way = context.hasEntity(wayId);
44960             var vertexId = this.entityIds[0];
44961             var vertex2 = context.hasEntity(vertexId);
44962             if (!way || !vertex2) return;
44963             var map2 = context.map();
44964             if (!context.editable() || !map2.trimmedExtent().contains(vertex2.loc)) {
44965               map2.zoomToEase(vertex2);
44966             }
44967             context.enter(
44968               modeDrawLine(context, wayId, context.graph(), "line", way.affix(vertexId), true)
44969             );
44970           }
44971         });
44972       }
44973     };
44974     validation.type = type2;
44975     return validation;
44976   }
44977   var init_disconnected_way = __esm({
44978     "modules/validations/disconnected_way.js"() {
44979       "use strict";
44980       init_localizer();
44981       init_draw_line();
44982       init_delete();
44983       init_utilDisplayLabel();
44984       init_tags();
44985       init_validation();
44986       init_services();
44987     }
44988   });
44989
44990   // modules/validations/invalid_format.js
44991   var invalid_format_exports = {};
44992   __export(invalid_format_exports, {
44993     validationFormatting: () => validationFormatting
44994   });
44995   function validationFormatting() {
44996     var type2 = "invalid_format";
44997     var validation = function(entity) {
44998       var issues = [];
44999       function isValidEmail(email) {
45000         var valid_email = /^[^\(\)\\,":;<>@\[\]]+@[^\(\)\\,":;<>@\[\]\.]+(?:\.[a-z0-9-]+)*$/i;
45001         return !email || valid_email.test(email);
45002       }
45003       function showReferenceEmail(selection2) {
45004         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.invalid_format.email.reference"));
45005       }
45006       if (entity.tags.email) {
45007         var emails = entity.tags.email.split(";").map(function(s2) {
45008           return s2.trim();
45009         }).filter(function(x2) {
45010           return !isValidEmail(x2);
45011         });
45012         if (emails.length) {
45013           issues.push(new validationIssue({
45014             type: type2,
45015             subtype: "email",
45016             severity: "warning",
45017             message: function(context) {
45018               var entity2 = context.hasEntity(this.entityIds[0]);
45019               return entity2 ? _t.append(
45020                 "issues.invalid_format.email.message" + this.data,
45021                 { feature: utilDisplayLabel(entity2, context.graph()), email: emails.join(", ") }
45022               ) : "";
45023             },
45024             reference: showReferenceEmail,
45025             entityIds: [entity.id],
45026             hash: emails.join(),
45027             data: emails.length > 1 ? "_multi" : ""
45028           }));
45029         }
45030       }
45031       return issues;
45032     };
45033     validation.type = type2;
45034     return validation;
45035   }
45036   var init_invalid_format = __esm({
45037     "modules/validations/invalid_format.js"() {
45038       "use strict";
45039       init_localizer();
45040       init_utilDisplayLabel();
45041       init_validation();
45042     }
45043   });
45044
45045   // modules/validations/help_request.js
45046   var help_request_exports = {};
45047   __export(help_request_exports, {
45048     validationHelpRequest: () => validationHelpRequest
45049   });
45050   function validationHelpRequest(context) {
45051     var type2 = "help_request";
45052     var validation = function checkFixmeTag(entity) {
45053       if (!entity.tags.fixme) return [];
45054       if (entity.version === void 0) return [];
45055       if (entity.v !== void 0) {
45056         var baseEntity = context.history().base().hasEntity(entity.id);
45057         if (!baseEntity || !baseEntity.tags.fixme) return [];
45058       }
45059       return [new validationIssue({
45060         type: type2,
45061         subtype: "fixme_tag",
45062         severity: "warning",
45063         message: function(context2) {
45064           var entity2 = context2.hasEntity(this.entityIds[0]);
45065           return entity2 ? _t.append("issues.fixme_tag.message", {
45066             feature: utilDisplayLabel(
45067               entity2,
45068               context2.graph(),
45069               true
45070               /* verbose */
45071             )
45072           }) : "";
45073         },
45074         dynamicFixes: function() {
45075           return [
45076             new validationIssueFix({
45077               title: _t.append("issues.fix.address_the_concern.title")
45078             })
45079           ];
45080         },
45081         reference: showReference,
45082         entityIds: [entity.id]
45083       })];
45084       function showReference(selection2) {
45085         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.fixme_tag.reference"));
45086       }
45087     };
45088     validation.type = type2;
45089     return validation;
45090   }
45091   var init_help_request = __esm({
45092     "modules/validations/help_request.js"() {
45093       "use strict";
45094       init_localizer();
45095       init_utilDisplayLabel();
45096       init_validation();
45097     }
45098   });
45099
45100   // modules/validations/impossible_oneway.js
45101   var impossible_oneway_exports = {};
45102   __export(impossible_oneway_exports, {
45103     validationImpossibleOneway: () => validationImpossibleOneway
45104   });
45105   function validationImpossibleOneway() {
45106     var type2 = "impossible_oneway";
45107     var validation = function checkImpossibleOneway(entity, graph) {
45108       if (entity.type !== "way" || entity.geometry(graph) !== "line") return [];
45109       if (entity.isClosed()) return [];
45110       if (!typeForWay(entity)) return [];
45111       if (!entity.isOneWay()) return [];
45112       var firstIssues = issuesForNode(entity, entity.first());
45113       var lastIssues = issuesForNode(entity, entity.last());
45114       return firstIssues.concat(lastIssues);
45115       function typeForWay(way) {
45116         if (way.geometry(graph) !== "line") return null;
45117         if (osmRoutableHighwayTagValues[way.tags.highway]) return "highway";
45118         if (osmFlowingWaterwayTagValues[way.tags.waterway]) return "waterway";
45119         return null;
45120       }
45121       function nodeOccursMoreThanOnce(way, nodeID) {
45122         var occurrences = 0;
45123         for (var index in way.nodes) {
45124           if (way.nodes[index] === nodeID) {
45125             occurrences += 1;
45126             if (occurrences > 1) return true;
45127           }
45128         }
45129         return false;
45130       }
45131       function isConnectedViaOtherTypes(way, node) {
45132         var wayType = typeForWay(way);
45133         if (wayType === "highway") {
45134           if (node.tags.entrance && node.tags.entrance !== "no") return true;
45135           if (node.tags.amenity === "parking_entrance") return true;
45136         } else if (wayType === "waterway") {
45137           if (node.id === way.first()) {
45138             if (node.tags.natural === "spring") return true;
45139           } else {
45140             if (node.tags.manhole === "drain") return true;
45141           }
45142         }
45143         return graph.parentWays(node).some(function(parentWay) {
45144           if (parentWay.id === way.id) return false;
45145           if (wayType === "highway") {
45146             if (parentWay.geometry(graph) === "area" && osmRoutableHighwayTagValues[parentWay.tags.highway]) return true;
45147             if (parentWay.tags.route === "ferry") return true;
45148             return graph.parentRelations(parentWay).some(function(parentRelation) {
45149               if (parentRelation.tags.type === "route" && parentRelation.tags.route === "ferry") return true;
45150               return parentRelation.isMultipolygon() && osmRoutableHighwayTagValues[parentRelation.tags.highway];
45151             });
45152           } else if (wayType === "waterway") {
45153             if (parentWay.tags.natural === "water" || parentWay.tags.natural === "coastline") return true;
45154           }
45155           return false;
45156         });
45157       }
45158       function issuesForNode(way, nodeID) {
45159         var isFirst = nodeID === way.first();
45160         var wayType = typeForWay(way);
45161         if (nodeOccursMoreThanOnce(way, nodeID)) return [];
45162         var osm = services.osm;
45163         if (!osm) return [];
45164         var node = graph.hasEntity(nodeID);
45165         if (!node || !osm.isDataLoaded(node.loc)) return [];
45166         if (isConnectedViaOtherTypes(way, node)) return [];
45167         var attachedWaysOfSameType = graph.parentWays(node).filter(function(parentWay) {
45168           if (parentWay.id === way.id) return false;
45169           return typeForWay(parentWay) === wayType;
45170         });
45171         if (wayType === "waterway" && attachedWaysOfSameType.length === 0) return [];
45172         var attachedOneways = attachedWaysOfSameType.filter(function(attachedWay) {
45173           return attachedWay.isOneWay();
45174         });
45175         if (attachedOneways.length < attachedWaysOfSameType.length) return [];
45176         if (attachedOneways.length) {
45177           var connectedEndpointsOkay = attachedOneways.some(function(attachedOneway) {
45178             if ((isFirst ? attachedOneway.first() : attachedOneway.last()) !== nodeID) return true;
45179             if (nodeOccursMoreThanOnce(attachedOneway, nodeID)) return true;
45180             return false;
45181           });
45182           if (connectedEndpointsOkay) return [];
45183         }
45184         var placement = isFirst ? "start" : "end", messageID = wayType + ".", referenceID = wayType + ".";
45185         if (wayType === "waterway") {
45186           messageID += "connected." + placement;
45187           referenceID += "connected";
45188         } else {
45189           messageID += placement;
45190           referenceID += placement;
45191         }
45192         return [new validationIssue({
45193           type: type2,
45194           subtype: wayType,
45195           severity: "warning",
45196           message: function(context) {
45197             var entity2 = context.hasEntity(this.entityIds[0]);
45198             return entity2 ? _t.append("issues.impossible_oneway." + messageID + ".message", {
45199               feature: utilDisplayLabel(entity2, context.graph())
45200             }) : "";
45201           },
45202           reference: getReference(referenceID),
45203           entityIds: [way.id, node.id],
45204           dynamicFixes: function() {
45205             var fixes = [];
45206             if (attachedOneways.length) {
45207               fixes.push(new validationIssueFix({
45208                 icon: "iD-operation-reverse",
45209                 title: _t.append("issues.fix.reverse_feature.title"),
45210                 entityIds: [way.id],
45211                 onClick: function(context) {
45212                   var id2 = this.issue.entityIds[0];
45213                   context.perform(actionReverse(id2), _t("operations.reverse.annotation.line", { n: 1 }));
45214                 }
45215               }));
45216             }
45217             if (node.tags.noexit !== "yes") {
45218               var textDirection = _mainLocalizer.textDirection();
45219               var useLeftContinue = isFirst && textDirection === "ltr" || !isFirst && textDirection === "rtl";
45220               fixes.push(new validationIssueFix({
45221                 icon: "iD-operation-continue" + (useLeftContinue ? "-left" : ""),
45222                 title: _t.append("issues.fix.continue_from_" + (isFirst ? "start" : "end") + ".title"),
45223                 onClick: function(context) {
45224                   var entityID = this.issue.entityIds[0];
45225                   var vertexID = this.issue.entityIds[1];
45226                   var way2 = context.entity(entityID);
45227                   var vertex = context.entity(vertexID);
45228                   continueDrawing(way2, vertex, context);
45229                 }
45230               }));
45231             }
45232             return fixes;
45233           },
45234           loc: node.loc
45235         })];
45236         function getReference(referenceID2) {
45237           return function showReference(selection2) {
45238             selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.impossible_oneway." + referenceID2 + ".reference"));
45239           };
45240         }
45241       }
45242     };
45243     function continueDrawing(way, vertex, context) {
45244       var map2 = context.map();
45245       if (!context.editable() || !map2.trimmedExtent().contains(vertex.loc)) {
45246         map2.zoomToEase(vertex);
45247       }
45248       context.enter(
45249         modeDrawLine(context, way.id, context.graph(), "line", way.affix(vertex.id), true)
45250       );
45251     }
45252     validation.type = type2;
45253     return validation;
45254   }
45255   var init_impossible_oneway = __esm({
45256     "modules/validations/impossible_oneway.js"() {
45257       "use strict";
45258       init_localizer();
45259       init_draw_line();
45260       init_reverse();
45261       init_utilDisplayLabel();
45262       init_tags();
45263       init_validation();
45264       init_services();
45265     }
45266   });
45267
45268   // modules/validations/incompatible_source.js
45269   var incompatible_source_exports = {};
45270   __export(incompatible_source_exports, {
45271     validationIncompatibleSource: () => validationIncompatibleSource
45272   });
45273   function validationIncompatibleSource() {
45274     const type2 = "incompatible_source";
45275     const incompatibleRules = [
45276       {
45277         id: "amap",
45278         regex: /(^amap$|^amap\.com|autonavi|mapabc|高德)/i
45279       },
45280       {
45281         id: "baidu",
45282         regex: /(baidu|mapbar|百度)/i
45283       },
45284       {
45285         id: "google",
45286         regex: /google/i,
45287         exceptRegex: /((books|drive)\.google|google\s?(books|drive|plus))|(esri\/Google_Africa_Buildings)/i
45288       }
45289     ];
45290     const validation = function checkIncompatibleSource(entity) {
45291       const entitySources = entity.tags && entity.tags.source && entity.tags.source.split(";");
45292       if (!entitySources) return [];
45293       const entityID = entity.id;
45294       return entitySources.map((source) => {
45295         const matchRule = incompatibleRules.find((rule) => {
45296           if (!rule.regex.test(source)) return false;
45297           if (rule.exceptRegex && rule.exceptRegex.test(source)) return false;
45298           return true;
45299         });
45300         if (!matchRule) return null;
45301         return new validationIssue({
45302           type: type2,
45303           severity: "warning",
45304           message: (context) => {
45305             const entity2 = context.hasEntity(entityID);
45306             return entity2 ? _t.append("issues.incompatible_source.feature.message", {
45307               feature: utilDisplayLabel(
45308                 entity2,
45309                 context.graph(),
45310                 true
45311                 /* verbose */
45312               ),
45313               value: source
45314             }) : "";
45315           },
45316           reference: getReference(matchRule.id),
45317           entityIds: [entityID],
45318           hash: source,
45319           dynamicFixes: () => {
45320             return [
45321               new validationIssueFix({ title: _t.append("issues.fix.remove_proprietary_data.title") })
45322             ];
45323           }
45324         });
45325       }).filter(Boolean);
45326       function getReference(id2) {
45327         return function showReference(selection2) {
45328           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append(`issues.incompatible_source.reference.${id2}`));
45329         };
45330       }
45331     };
45332     validation.type = type2;
45333     return validation;
45334   }
45335   var init_incompatible_source = __esm({
45336     "modules/validations/incompatible_source.js"() {
45337       "use strict";
45338       init_localizer();
45339       init_utilDisplayLabel();
45340       init_validation();
45341     }
45342   });
45343
45344   // modules/validations/maprules.js
45345   var maprules_exports2 = {};
45346   __export(maprules_exports2, {
45347     validationMaprules: () => validationMaprules
45348   });
45349   function validationMaprules() {
45350     var type2 = "maprules";
45351     var validation = function checkMaprules(entity, graph) {
45352       if (!services.maprules) return [];
45353       var rules = services.maprules.validationRules();
45354       var issues = [];
45355       for (var i3 = 0; i3 < rules.length; i3++) {
45356         var rule = rules[i3];
45357         rule.findIssues(entity, graph, issues);
45358       }
45359       return issues;
45360     };
45361     validation.type = type2;
45362     return validation;
45363   }
45364   var init_maprules2 = __esm({
45365     "modules/validations/maprules.js"() {
45366       "use strict";
45367       init_services();
45368     }
45369   });
45370
45371   // modules/validations/mismatched_geometry.js
45372   var mismatched_geometry_exports = {};
45373   __export(mismatched_geometry_exports, {
45374     validationMismatchedGeometry: () => validationMismatchedGeometry
45375   });
45376   function validationMismatchedGeometry() {
45377     var type2 = "mismatched_geometry";
45378     function tagSuggestingLineIsArea(entity) {
45379       if (entity.type !== "way" || entity.isClosed()) return null;
45380       var tagSuggestingArea = entity.tagSuggestingArea();
45381       if (!tagSuggestingArea) {
45382         return null;
45383       }
45384       var asLine = _mainPresetIndex.matchTags(tagSuggestingArea, "line");
45385       var asArea = _mainPresetIndex.matchTags(tagSuggestingArea, "area");
45386       if (asLine && asArea && (0, import_fast_deep_equal4.default)(asLine.tags, asArea.tags)) {
45387         return null;
45388       }
45389       if (asLine.isFallback() && asArea.isFallback() && !(0, import_fast_deep_equal4.default)(tagSuggestingArea, { area: "yes" })) {
45390         return null;
45391       }
45392       return tagSuggestingArea;
45393     }
45394     function makeConnectEndpointsFixOnClick(way, graph) {
45395       if (way.nodes.length < 3) return null;
45396       var nodes = graph.childNodes(way), testNodes;
45397       var firstToLastDistanceMeters = geoSphericalDistance(nodes[0].loc, nodes[nodes.length - 1].loc);
45398       if (firstToLastDistanceMeters < 0.75) {
45399         testNodes = nodes.slice();
45400         testNodes.pop();
45401         testNodes.push(testNodes[0]);
45402         if (!geoHasSelfIntersections(testNodes, testNodes[0].id)) {
45403           return function(context) {
45404             var way2 = context.entity(this.issue.entityIds[0]);
45405             context.perform(
45406               actionMergeNodes([way2.nodes[0], way2.nodes[way2.nodes.length - 1]], nodes[0].loc),
45407               _t("issues.fix.connect_endpoints.annotation")
45408             );
45409           };
45410         }
45411       }
45412       testNodes = nodes.slice();
45413       testNodes.push(testNodes[0]);
45414       if (!geoHasSelfIntersections(testNodes, testNodes[0].id)) {
45415         return function(context) {
45416           var wayId = this.issue.entityIds[0];
45417           var way2 = context.entity(wayId);
45418           var nodeId = way2.nodes[0];
45419           var index = way2.nodes.length;
45420           context.perform(
45421             actionAddVertex(wayId, nodeId, index),
45422             _t("issues.fix.connect_endpoints.annotation")
45423           );
45424         };
45425       }
45426     }
45427     function lineTaggedAsAreaIssue(entity) {
45428       var tagSuggestingArea = tagSuggestingLineIsArea(entity);
45429       if (!tagSuggestingArea) return null;
45430       var validAsLine = false;
45431       var presetAsLine = _mainPresetIndex.matchTags(entity.tags, "line");
45432       if (presetAsLine) {
45433         validAsLine = true;
45434         var key = Object.keys(tagSuggestingArea)[0];
45435         if (presetAsLine.tags[key] && presetAsLine.tags[key] === "*") {
45436           validAsLine = false;
45437         }
45438         if (Object.keys(presetAsLine.tags).length === 0) {
45439           validAsLine = false;
45440         }
45441       }
45442       return new validationIssue({
45443         type: type2,
45444         subtype: "area_as_line",
45445         severity: "warning",
45446         message: function(context) {
45447           var entity2 = context.hasEntity(this.entityIds[0]);
45448           return entity2 ? _t.append("issues.tag_suggests_area.message", {
45449             feature: utilDisplayLabel(
45450               entity2,
45451               "area",
45452               true
45453               /* verbose */
45454             ),
45455             tag: utilTagText({ tags: tagSuggestingArea })
45456           }) : "";
45457         },
45458         reference: showReference,
45459         entityIds: [entity.id],
45460         hash: JSON.stringify(tagSuggestingArea),
45461         dynamicFixes: function(context) {
45462           var fixes = [];
45463           var entity2 = context.entity(this.entityIds[0]);
45464           var connectEndsOnClick = makeConnectEndpointsFixOnClick(entity2, context.graph());
45465           if (!validAsLine) {
45466             fixes.push(new validationIssueFix({
45467               title: _t.append("issues.fix.connect_endpoints.title"),
45468               onClick: connectEndsOnClick
45469             }));
45470           }
45471           fixes.push(new validationIssueFix({
45472             icon: "iD-operation-delete",
45473             title: _t.append("issues.fix.remove_tag.title"),
45474             onClick: function(context2) {
45475               var entityId = this.issue.entityIds[0];
45476               var entity3 = context2.entity(entityId);
45477               var tags = Object.assign({}, entity3.tags);
45478               for (var key2 in tagSuggestingArea) {
45479                 delete tags[key2];
45480               }
45481               context2.perform(
45482                 actionChangeTags(entityId, tags),
45483                 _t("issues.fix.remove_tag.annotation")
45484               );
45485             }
45486           }));
45487           return fixes;
45488         }
45489       });
45490       function showReference(selection2) {
45491         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.tag_suggests_area.reference"));
45492       }
45493     }
45494     function vertexPointIssue(entity, graph) {
45495       if (entity.type !== "node") return null;
45496       if (Object.keys(entity.tags).length === 0) return null;
45497       if (entity.isOnAddressLine(graph)) return null;
45498       var geometry = entity.geometry(graph);
45499       var allowedGeometries = osmNodeGeometriesForTags(entity.tags);
45500       if (geometry === "point" && !allowedGeometries.point && allowedGeometries.vertex) {
45501         return new validationIssue({
45502           type: type2,
45503           subtype: "vertex_as_point",
45504           severity: "warning",
45505           message: function(context) {
45506             var entity2 = context.hasEntity(this.entityIds[0]);
45507             return entity2 ? _t.append("issues.vertex_as_point.message", {
45508               feature: utilDisplayLabel(
45509                 entity2,
45510                 "vertex",
45511                 true
45512                 /* verbose */
45513               )
45514             }) : "";
45515           },
45516           reference: function showReference(selection2) {
45517             selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.vertex_as_point.reference"));
45518           },
45519           entityIds: [entity.id]
45520         });
45521       } else if (geometry === "vertex" && !allowedGeometries.vertex && allowedGeometries.point) {
45522         return new validationIssue({
45523           type: type2,
45524           subtype: "point_as_vertex",
45525           severity: "warning",
45526           message: function(context) {
45527             var entity2 = context.hasEntity(this.entityIds[0]);
45528             return entity2 ? _t.append("issues.point_as_vertex.message", {
45529               feature: utilDisplayLabel(
45530                 entity2,
45531                 "point",
45532                 true
45533                 /* verbose */
45534               )
45535             }) : "";
45536           },
45537           reference: function showReference(selection2) {
45538             selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.point_as_vertex.reference"));
45539           },
45540           entityIds: [entity.id],
45541           dynamicFixes: extractPointDynamicFixes
45542         });
45543       }
45544       return null;
45545     }
45546     function otherMismatchIssue(entity, graph) {
45547       if (!entity.hasInterestingTags()) return null;
45548       if (entity.type !== "node" && entity.type !== "way") return null;
45549       if (entity.type === "node" && entity.isOnAddressLine(graph)) return null;
45550       var sourceGeom = entity.geometry(graph);
45551       var targetGeoms = entity.type === "way" ? ["point", "vertex"] : ["line", "area"];
45552       if (sourceGeom === "area") targetGeoms.unshift("line");
45553       var asSource = _mainPresetIndex.match(entity, graph);
45554       var targetGeom = targetGeoms.find((nodeGeom) => {
45555         const asTarget = _mainPresetIndex.matchTags(
45556           entity.tags,
45557           nodeGeom,
45558           entity.extent(graph).center()
45559         );
45560         if (!asSource || !asTarget || asSource === asTarget || // sometimes there are two presets with the same tags for different geometries
45561         (0, import_fast_deep_equal4.default)(asSource.tags, asTarget.tags)) return false;
45562         if (asTarget.isFallback()) return false;
45563         var primaryKey = Object.keys(asTarget.tags)[0];
45564         if (primaryKey === "building") return false;
45565         if (asTarget.tags[primaryKey] === "*") return false;
45566         return asSource.isFallback() || asSource.tags[primaryKey] === "*";
45567       });
45568       if (!targetGeom) return null;
45569       var subtype = targetGeom + "_as_" + sourceGeom;
45570       if (targetGeom === "vertex") targetGeom = "point";
45571       if (sourceGeom === "vertex") sourceGeom = "point";
45572       var referenceId = targetGeom + "_as_" + sourceGeom;
45573       var dynamicFixes;
45574       if (targetGeom === "point") {
45575         dynamicFixes = extractPointDynamicFixes;
45576       } else if (sourceGeom === "area" && targetGeom === "line") {
45577         dynamicFixes = lineToAreaDynamicFixes;
45578       }
45579       return new validationIssue({
45580         type: type2,
45581         subtype,
45582         severity: "warning",
45583         message: function(context) {
45584           var entity2 = context.hasEntity(this.entityIds[0]);
45585           return entity2 ? _t.append("issues." + referenceId + ".message", {
45586             feature: utilDisplayLabel(
45587               entity2,
45588               targetGeom,
45589               true
45590               /* verbose */
45591             )
45592           }) : "";
45593         },
45594         reference: function showReference(selection2) {
45595           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.mismatched_geometry.reference"));
45596         },
45597         entityIds: [entity.id],
45598         dynamicFixes
45599       });
45600     }
45601     function lineToAreaDynamicFixes(context) {
45602       var convertOnClick;
45603       var entityId = this.entityIds[0];
45604       var entity = context.entity(entityId);
45605       var tags = Object.assign({}, entity.tags);
45606       delete tags.area;
45607       if (!osmTagSuggestingArea(tags)) {
45608         convertOnClick = function(context2) {
45609           var entityId2 = this.issue.entityIds[0];
45610           var entity2 = context2.entity(entityId2);
45611           var tags2 = Object.assign({}, entity2.tags);
45612           if (tags2.area) {
45613             delete tags2.area;
45614           }
45615           context2.perform(
45616             actionChangeTags(entityId2, tags2),
45617             _t("issues.fix.convert_to_line.annotation")
45618           );
45619         };
45620       }
45621       return [
45622         new validationIssueFix({
45623           icon: "iD-icon-line",
45624           title: _t.append("issues.fix.convert_to_line.title"),
45625           onClick: convertOnClick
45626         })
45627       ];
45628     }
45629     function extractPointDynamicFixes(context) {
45630       var entityId = this.entityIds[0];
45631       var extractOnClick = null;
45632       if (!context.hasHiddenConnections(entityId)) {
45633         extractOnClick = function(context2) {
45634           var entityId2 = this.issue.entityIds[0];
45635           var action = actionExtract(entityId2, context2.projection);
45636           context2.perform(
45637             action,
45638             _t("operations.extract.annotation", { n: 1 })
45639           );
45640           context2.enter(modeSelect(context2, [action.getExtractedNodeID()]));
45641         };
45642       }
45643       return [
45644         new validationIssueFix({
45645           icon: "iD-operation-extract",
45646           title: _t.append("issues.fix.extract_point.title"),
45647           onClick: extractOnClick
45648         })
45649       ];
45650     }
45651     function unclosedMultipolygonPartIssues(entity, graph) {
45652       if (entity.type !== "relation" || !entity.isMultipolygon() || entity.isDegenerate() || // cannot determine issues for incompletely-downloaded relations
45653       !entity.isComplete(graph)) return [];
45654       var sequences = osmJoinWays(entity.members, graph);
45655       var issues = [];
45656       for (var i3 in sequences) {
45657         var sequence = sequences[i3];
45658         if (!sequence.nodes) continue;
45659         var firstNode = sequence.nodes[0];
45660         var lastNode = sequence.nodes[sequence.nodes.length - 1];
45661         if (firstNode === lastNode) continue;
45662         var issue = new validationIssue({
45663           type: type2,
45664           subtype: "unclosed_multipolygon_part",
45665           severity: "warning",
45666           message: function(context) {
45667             var entity2 = context.hasEntity(this.entityIds[0]);
45668             return entity2 ? _t.append("issues.unclosed_multipolygon_part.message", {
45669               feature: utilDisplayLabel(
45670                 entity2,
45671                 context.graph(),
45672                 true
45673                 /* verbose */
45674               )
45675             }) : "";
45676           },
45677           reference: showReference,
45678           loc: sequence.nodes[0].loc,
45679           entityIds: [entity.id],
45680           hash: sequence.map(function(way) {
45681             return way.id;
45682           }).join()
45683         });
45684         issues.push(issue);
45685       }
45686       return issues;
45687       function showReference(selection2) {
45688         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.unclosed_multipolygon_part.reference"));
45689       }
45690     }
45691     var validation = function checkMismatchedGeometry(entity, graph) {
45692       var vertexPoint = vertexPointIssue(entity, graph);
45693       if (vertexPoint) return [vertexPoint];
45694       var lineAsArea = lineTaggedAsAreaIssue(entity);
45695       if (lineAsArea) return [lineAsArea];
45696       var mismatch = otherMismatchIssue(entity, graph);
45697       if (mismatch) return [mismatch];
45698       return unclosedMultipolygonPartIssues(entity, graph);
45699     };
45700     validation.type = type2;
45701     return validation;
45702   }
45703   var import_fast_deep_equal4;
45704   var init_mismatched_geometry = __esm({
45705     "modules/validations/mismatched_geometry.js"() {
45706       "use strict";
45707       import_fast_deep_equal4 = __toESM(require_fast_deep_equal());
45708       init_add_vertex();
45709       init_change_tags();
45710       init_merge_nodes();
45711       init_extract();
45712       init_select5();
45713       init_multipolygon();
45714       init_tags();
45715       init_presets();
45716       init_geo2();
45717       init_localizer();
45718       init_util();
45719       init_utilDisplayLabel();
45720       init_validation();
45721     }
45722   });
45723
45724   // modules/validations/missing_role.js
45725   var missing_role_exports = {};
45726   __export(missing_role_exports, {
45727     validationMissingRole: () => validationMissingRole
45728   });
45729   function validationMissingRole() {
45730     var type2 = "missing_role";
45731     var validation = function checkMissingRole(entity, graph) {
45732       var issues = [];
45733       if (entity.type === "way") {
45734         graph.parentRelations(entity).forEach(function(relation) {
45735           if (!relation.isMultipolygon()) return;
45736           var member = relation.memberById(entity.id);
45737           if (member && isMissingRole(member)) {
45738             issues.push(makeIssue(entity, relation, member));
45739           }
45740         });
45741       } else if (entity.type === "relation" && entity.isMultipolygon()) {
45742         entity.indexedMembers().forEach(function(member) {
45743           var way = graph.hasEntity(member.id);
45744           if (way && isMissingRole(member)) {
45745             issues.push(makeIssue(way, entity, member));
45746           }
45747         });
45748       }
45749       return issues;
45750     };
45751     function isMissingRole(member) {
45752       return !member.role || !member.role.trim().length;
45753     }
45754     function makeIssue(way, relation, member) {
45755       return new validationIssue({
45756         type: type2,
45757         severity: "warning",
45758         message: function(context) {
45759           var member2 = context.hasEntity(this.entityIds[1]), relation2 = context.hasEntity(this.entityIds[0]);
45760           return member2 && relation2 ? _t.append("issues.missing_role.message", {
45761             member: utilDisplayLabel(member2, context.graph()),
45762             relation: utilDisplayLabel(relation2, context.graph())
45763           }) : "";
45764         },
45765         reference: showReference,
45766         entityIds: [relation.id, way.id],
45767         data: {
45768           member
45769         },
45770         hash: member.index.toString(),
45771         dynamicFixes: function() {
45772           return [
45773             makeAddRoleFix("inner"),
45774             makeAddRoleFix("outer"),
45775             new validationIssueFix({
45776               icon: "iD-operation-delete",
45777               title: _t.append("issues.fix.remove_from_relation.title"),
45778               onClick: function(context) {
45779                 context.perform(
45780                   actionDeleteMember(this.issue.entityIds[0], this.issue.data.member.index),
45781                   _t("operations.delete_member.annotation", {
45782                     n: 1
45783                   })
45784                 );
45785               }
45786             })
45787           ];
45788         }
45789       });
45790       function showReference(selection2) {
45791         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.missing_role.multipolygon.reference"));
45792       }
45793     }
45794     function makeAddRoleFix(role) {
45795       return new validationIssueFix({
45796         title: _t.append("issues.fix.set_as_" + role + ".title"),
45797         onClick: function(context) {
45798           var oldMember = this.issue.data.member;
45799           var member = { id: this.issue.entityIds[1], type: oldMember.type, role };
45800           context.perform(
45801             actionChangeMember(this.issue.entityIds[0], member, oldMember.index),
45802             _t("operations.change_role.annotation", {
45803               n: 1
45804             })
45805           );
45806         }
45807       });
45808     }
45809     validation.type = type2;
45810     return validation;
45811   }
45812   var init_missing_role = __esm({
45813     "modules/validations/missing_role.js"() {
45814       "use strict";
45815       init_change_member();
45816       init_delete_member();
45817       init_localizer();
45818       init_utilDisplayLabel();
45819       init_validation();
45820     }
45821   });
45822
45823   // modules/validations/missing_tag.js
45824   var missing_tag_exports = {};
45825   __export(missing_tag_exports, {
45826     validationMissingTag: () => validationMissingTag
45827   });
45828   function validationMissingTag(context) {
45829     var type2 = "missing_tag";
45830     function hasDescriptiveTags(entity) {
45831       var onlyAttributeKeys = ["description", "name", "note", "start_date", "oneway"];
45832       var entityDescriptiveKeys = Object.keys(entity.tags).filter(function(k2) {
45833         if (k2 === "area" || !osmIsInterestingTag(k2)) return false;
45834         return !onlyAttributeKeys.some(function(attributeKey) {
45835           return k2 === attributeKey || k2.indexOf(attributeKey + ":") === 0;
45836         });
45837       });
45838       if (entity.type === "relation" && entityDescriptiveKeys.length === 1 && entity.tags.type === "multipolygon") {
45839         return false;
45840       }
45841       return entityDescriptiveKeys.length > 0;
45842     }
45843     function isUnknownRoad(entity) {
45844       return entity.type === "way" && entity.tags.highway === "road";
45845     }
45846     function isUntypedRelation(entity) {
45847       return entity.type === "relation" && !entity.tags.type;
45848     }
45849     var validation = function checkMissingTag(entity, graph) {
45850       var subtype;
45851       var osm = context.connection();
45852       var isUnloadedNode = entity.type === "node" && osm && !osm.isDataLoaded(entity.loc);
45853       if (!isUnloadedNode && // allow untagged nodes that are part of ways
45854       entity.geometry(graph) !== "vertex" && // allow untagged entities that are part of relations
45855       !entity.hasParentRelations(graph)) {
45856         if (Object.keys(entity.tags).length === 0) {
45857           subtype = "any";
45858         } else if (!hasDescriptiveTags(entity)) {
45859           subtype = "descriptive";
45860         } else if (isUntypedRelation(entity)) {
45861           subtype = "relation_type";
45862         }
45863       }
45864       if (!subtype && isUnknownRoad(entity)) {
45865         subtype = "highway_classification";
45866       }
45867       if (!subtype) return [];
45868       var messageID = subtype === "highway_classification" ? "unknown_road" : "missing_tag." + subtype;
45869       var referenceID = subtype === "highway_classification" ? "unknown_road" : "missing_tag";
45870       var canDelete = entity.version === void 0 || entity.v !== void 0;
45871       var severity = canDelete && subtype !== "highway_classification" ? "error" : "warning";
45872       return [new validationIssue({
45873         type: type2,
45874         subtype,
45875         severity,
45876         message: function(context2) {
45877           var entity2 = context2.hasEntity(this.entityIds[0]);
45878           return entity2 ? _t.append("issues." + messageID + ".message", {
45879             feature: utilDisplayLabel(entity2, context2.graph())
45880           }) : "";
45881         },
45882         reference: showReference,
45883         entityIds: [entity.id],
45884         dynamicFixes: function(context2) {
45885           var fixes = [];
45886           var selectFixType = subtype === "highway_classification" ? "select_road_type" : "select_preset";
45887           fixes.push(new validationIssueFix({
45888             icon: "iD-icon-search",
45889             title: _t.append("issues.fix." + selectFixType + ".title"),
45890             onClick: function(context3) {
45891               context3.ui().sidebar.showPresetList();
45892             }
45893           }));
45894           var deleteOnClick;
45895           var id2 = this.entityIds[0];
45896           var operation2 = operationDelete(context2, [id2]);
45897           var disabledReasonID = operation2.disabled();
45898           if (!disabledReasonID) {
45899             deleteOnClick = function(context3) {
45900               var id3 = this.issue.entityIds[0];
45901               var operation3 = operationDelete(context3, [id3]);
45902               if (!operation3.disabled()) {
45903                 operation3();
45904               }
45905             };
45906           }
45907           fixes.push(
45908             new validationIssueFix({
45909               icon: "iD-operation-delete",
45910               title: _t.append("issues.fix.delete_feature.title"),
45911               disabledReason: disabledReasonID ? _t("operations.delete." + disabledReasonID + ".single") : void 0,
45912               onClick: deleteOnClick
45913             })
45914           );
45915           return fixes;
45916         }
45917       })];
45918       function showReference(selection2) {
45919         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues." + referenceID + ".reference"));
45920       }
45921     };
45922     validation.type = type2;
45923     return validation;
45924   }
45925   var init_missing_tag = __esm({
45926     "modules/validations/missing_tag.js"() {
45927       "use strict";
45928       init_delete();
45929       init_tags();
45930       init_localizer();
45931       init_utilDisplayLabel();
45932       init_validation();
45933     }
45934   });
45935
45936   // modules/validations/mutually_exclusive_tags.js
45937   var mutually_exclusive_tags_exports = {};
45938   __export(mutually_exclusive_tags_exports, {
45939     validationMutuallyExclusiveTags: () => validationMutuallyExclusiveTags
45940   });
45941   function validationMutuallyExclusiveTags() {
45942     const type2 = "mutually_exclusive_tags";
45943     const tagKeyPairs = osmMutuallyExclusiveTagPairs;
45944     const validation = function checkMutuallyExclusiveTags(entity) {
45945       let pairsFounds = tagKeyPairs.filter((pair3) => {
45946         return pair3[0] in entity.tags && pair3[1] in entity.tags;
45947       }).filter((pair3) => {
45948         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");
45949       });
45950       Object.keys(entity.tags).forEach((key) => {
45951         let negative_key = "not:" + key;
45952         if (negative_key in entity.tags && entity.tags[negative_key].split(";").includes(entity.tags[key])) {
45953           pairsFounds.push([negative_key, key, "same_value"]);
45954         }
45955         if (key.match(/^name:[a-z]+/)) {
45956           negative_key = "not:name";
45957           if (negative_key in entity.tags && entity.tags[negative_key].split(";").includes(entity.tags[key])) {
45958             pairsFounds.push([negative_key, key, "same_value"]);
45959           }
45960         }
45961       });
45962       let issues = pairsFounds.map((pair3) => {
45963         const subtype = pair3[2] || "default";
45964         return new validationIssue({
45965           type: type2,
45966           subtype,
45967           severity: "warning",
45968           message: function(context) {
45969             let entity2 = context.hasEntity(this.entityIds[0]);
45970             return entity2 ? _t.append(`issues.${type2}.${subtype}.message`, {
45971               feature: utilDisplayLabel(entity2, context.graph()),
45972               tag1: pair3[0],
45973               tag2: pair3[1]
45974             }) : "";
45975           },
45976           reference: (selection2) => showReference(selection2, pair3, subtype),
45977           entityIds: [entity.id],
45978           dynamicFixes: () => pair3.slice(0, 2).map((tagToRemove) => createIssueFix(tagToRemove))
45979         });
45980       });
45981       function createIssueFix(tagToRemove) {
45982         return new validationIssueFix({
45983           icon: "iD-operation-delete",
45984           title: _t.append("issues.fix.remove_named_tag.title", { tag: tagToRemove }),
45985           onClick: function(context) {
45986             const entityId = this.issue.entityIds[0];
45987             const entity2 = context.entity(entityId);
45988             let tags = Object.assign({}, entity2.tags);
45989             delete tags[tagToRemove];
45990             context.perform(
45991               actionChangeTags(entityId, tags),
45992               _t("issues.fix.remove_named_tag.annotation", { tag: tagToRemove })
45993             );
45994           }
45995         });
45996       }
45997       function showReference(selection2, pair3, subtype) {
45998         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] }));
45999       }
46000       return issues;
46001     };
46002     validation.type = type2;
46003     return validation;
46004   }
46005   var init_mutually_exclusive_tags = __esm({
46006     "modules/validations/mutually_exclusive_tags.js"() {
46007       "use strict";
46008       init_change_tags();
46009       init_localizer();
46010       init_utilDisplayLabel();
46011       init_validation();
46012       init_tags();
46013     }
46014   });
46015
46016   // modules/operations/split.js
46017   var split_exports2 = {};
46018   __export(split_exports2, {
46019     operationSplit: () => operationSplit
46020   });
46021   function operationSplit(context, selectedIDs) {
46022     var _vertexIds = selectedIDs.filter(function(id2) {
46023       return context.graph().geometry(id2) === "vertex";
46024     });
46025     var _selectedWayIds = selectedIDs.filter(function(id2) {
46026       var entity = context.graph().hasEntity(id2);
46027       return entity && entity.type === "way";
46028     });
46029     var _isAvailable = _vertexIds.length > 0 && _vertexIds.length + _selectedWayIds.length === selectedIDs.length;
46030     var _action = actionSplit(_vertexIds);
46031     var _ways = [];
46032     var _geometry = "feature";
46033     var _waysAmount = "single";
46034     var _nodesAmount = _vertexIds.length === 1 ? "single" : "multiple";
46035     if (_isAvailable) {
46036       if (_selectedWayIds.length) _action.limitWays(_selectedWayIds);
46037       _ways = _action.ways(context.graph());
46038       var geometries = {};
46039       _ways.forEach(function(way) {
46040         geometries[way.geometry(context.graph())] = true;
46041       });
46042       if (Object.keys(geometries).length === 1) {
46043         _geometry = Object.keys(geometries)[0];
46044       }
46045       _waysAmount = _ways.length === 1 ? "single" : "multiple";
46046     }
46047     var operation2 = function() {
46048       var difference2 = context.perform(_action, operation2.annotation());
46049       var idsToSelect = _vertexIds.concat(difference2.extantIDs().filter(function(id2) {
46050         return context.entity(id2).type === "way";
46051       }));
46052       context.enter(modeSelect(context, idsToSelect));
46053     };
46054     operation2.relatedEntityIds = function() {
46055       return _selectedWayIds.length ? [] : _ways.map((way) => way.id);
46056     };
46057     operation2.available = function() {
46058       return _isAvailable;
46059     };
46060     operation2.disabled = function() {
46061       var reason = _action.disabled(context.graph());
46062       if (reason) {
46063         return reason;
46064       } else if (selectedIDs.some(context.hasHiddenConnections)) {
46065         return "connected_to_hidden";
46066       }
46067       return false;
46068     };
46069     operation2.tooltip = function() {
46070       var disable = operation2.disabled();
46071       return disable ? _t.append("operations.split." + disable) : _t.append("operations.split.description." + _geometry + "." + _waysAmount + "." + _nodesAmount + "_node");
46072     };
46073     operation2.annotation = function() {
46074       return _t("operations.split.annotation." + _geometry, { n: _ways.length });
46075     };
46076     operation2.icon = function() {
46077       if (_waysAmount === "multiple") {
46078         return "#iD-operation-split-multiple";
46079       } else {
46080         return "#iD-operation-split";
46081       }
46082     };
46083     operation2.id = "split";
46084     operation2.keys = [_t("operations.split.key")];
46085     operation2.title = _t.append("operations.split.title");
46086     operation2.behavior = behaviorOperation(context).which(operation2);
46087     return operation2;
46088   }
46089   var init_split2 = __esm({
46090     "modules/operations/split.js"() {
46091       "use strict";
46092       init_localizer();
46093       init_split();
46094       init_operation();
46095       init_select5();
46096     }
46097   });
46098
46099   // modules/validations/osm_api_limits.js
46100   var osm_api_limits_exports = {};
46101   __export(osm_api_limits_exports, {
46102     validationOsmApiLimits: () => validationOsmApiLimits
46103   });
46104   function validationOsmApiLimits(context) {
46105     const type2 = "osm_api_limits";
46106     const validation = function checkOsmApiLimits(entity) {
46107       const issues = [];
46108       const osm = context.connection();
46109       if (!osm) return issues;
46110       const maxWayNodes = osm.maxWayNodes();
46111       if (entity.type === "way") {
46112         if (entity.nodes.length > maxWayNodes) {
46113           issues.push(new validationIssue({
46114             type: type2,
46115             subtype: "exceededMaxWayNodes",
46116             severity: "error",
46117             message: function() {
46118               return _t.html("issues.osm_api_limits.max_way_nodes.message");
46119             },
46120             reference: function(selection2) {
46121               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 }));
46122             },
46123             entityIds: [entity.id],
46124             dynamicFixes: splitWayIntoSmallChunks
46125           }));
46126         }
46127       }
46128       return issues;
46129     };
46130     function splitWayIntoSmallChunks() {
46131       const fix = new validationIssueFix({
46132         icon: "iD-operation-split",
46133         title: _t.html("issues.fix.split_way.title"),
46134         entityIds: this.entityIds,
46135         onClick: function(context2) {
46136           const maxWayNodes = context2.connection().maxWayNodes();
46137           const g3 = context2.graph();
46138           const entityId = this.entityIds[0];
46139           const entity = context2.graph().entities[entityId];
46140           const numberOfParts = Math.ceil(entity.nodes.length / maxWayNodes);
46141           let splitVertices;
46142           if (numberOfParts === 2) {
46143             const splitIntersections = entity.nodes.map((nid) => g3.entity(nid)).filter((n3) => g3.parentWays(n3).length > 1).map((n3) => n3.id).filter((nid) => {
46144               const splitIndex = entity.nodes.indexOf(nid);
46145               return splitIndex < maxWayNodes && entity.nodes.length - splitIndex < maxWayNodes;
46146             });
46147             if (splitIntersections.length > 0) {
46148               splitVertices = [
46149                 splitIntersections[Math.floor(splitIntersections.length / 2)]
46150               ];
46151             }
46152           }
46153           if (splitVertices === void 0) {
46154             splitVertices = [...Array(numberOfParts - 1)].map((_2, i3) => entity.nodes[Math.floor(entity.nodes.length * (i3 + 1) / numberOfParts)]);
46155           }
46156           if (entity.isClosed()) {
46157             splitVertices.push(entity.nodes[0]);
46158           }
46159           const operation2 = operationSplit(context2, splitVertices.concat(entityId));
46160           if (!operation2.disabled()) {
46161             operation2();
46162           }
46163         }
46164       });
46165       return [fix];
46166     }
46167     validation.type = type2;
46168     return validation;
46169   }
46170   var init_osm_api_limits = __esm({
46171     "modules/validations/osm_api_limits.js"() {
46172       "use strict";
46173       init_localizer();
46174       init_validation();
46175       init_split2();
46176     }
46177   });
46178
46179   // modules/osm/deprecated.js
46180   var deprecated_exports = {};
46181   __export(deprecated_exports, {
46182     deprecatedTagValuesByKey: () => deprecatedTagValuesByKey,
46183     getDeprecatedTags: () => getDeprecatedTags
46184   });
46185   function getDeprecatedTags(tags, dataDeprecated) {
46186     if (Object.keys(tags).length === 0) return [];
46187     var deprecated = [];
46188     dataDeprecated.forEach((d2) => {
46189       var oldKeys = Object.keys(d2.old);
46190       if (d2.replace) {
46191         var hasExistingValues = Object.keys(d2.replace).some((replaceKey) => {
46192           if (!tags[replaceKey] || d2.old[replaceKey]) return false;
46193           var replaceValue = d2.replace[replaceKey];
46194           if (replaceValue === "*") return false;
46195           if (replaceValue === tags[replaceKey]) return false;
46196           return true;
46197         });
46198         if (hasExistingValues) return;
46199       }
46200       var matchesDeprecatedTags = oldKeys.every((oldKey) => {
46201         if (!tags[oldKey]) return false;
46202         if (d2.old[oldKey] === "*") return true;
46203         if (d2.old[oldKey] === tags[oldKey]) return true;
46204         var vals = tags[oldKey].split(";").filter(Boolean);
46205         if (vals.length === 0) {
46206           return false;
46207         } else if (vals.length > 1) {
46208           return vals.indexOf(d2.old[oldKey]) !== -1;
46209         } else {
46210           if (tags[oldKey] === d2.old[oldKey]) {
46211             if (d2.replace && d2.old[oldKey] === d2.replace[oldKey]) {
46212               var replaceKeys = Object.keys(d2.replace);
46213               return !replaceKeys.every((replaceKey) => {
46214                 return tags[replaceKey] === d2.replace[replaceKey];
46215               });
46216             } else {
46217               return true;
46218             }
46219           }
46220         }
46221         return false;
46222       });
46223       if (matchesDeprecatedTags) {
46224         deprecated.push(d2);
46225       }
46226     });
46227     return deprecated;
46228   }
46229   function deprecatedTagValuesByKey(dataDeprecated) {
46230     if (!_deprecatedTagValuesByKey) {
46231       _deprecatedTagValuesByKey = {};
46232       dataDeprecated.forEach((d2) => {
46233         var oldKeys = Object.keys(d2.old);
46234         if (oldKeys.length === 1) {
46235           var oldKey = oldKeys[0];
46236           var oldValue = d2.old[oldKey];
46237           if (oldValue !== "*") {
46238             if (!_deprecatedTagValuesByKey[oldKey]) {
46239               _deprecatedTagValuesByKey[oldKey] = [oldValue];
46240             } else {
46241               _deprecatedTagValuesByKey[oldKey].push(oldValue);
46242             }
46243           }
46244         }
46245       });
46246     }
46247     return _deprecatedTagValuesByKey;
46248   }
46249   var _deprecatedTagValuesByKey;
46250   var init_deprecated = __esm({
46251     "modules/osm/deprecated.js"() {
46252       "use strict";
46253     }
46254   });
46255
46256   // modules/validations/outdated_tags.js
46257   var outdated_tags_exports = {};
46258   __export(outdated_tags_exports, {
46259     validationOutdatedTags: () => validationOutdatedTags
46260   });
46261   function validationOutdatedTags() {
46262     const type2 = "outdated_tags";
46263     let _waitingForDeprecated = true;
46264     let _dataDeprecated;
46265     _mainFileFetcher.get("deprecated").then((d2) => _dataDeprecated = d2).catch(() => {
46266     }).finally(() => _waitingForDeprecated = false);
46267     function oldTagIssues(entity, graph) {
46268       if (!entity.hasInterestingTags()) return [];
46269       let preset = _mainPresetIndex.match(entity, graph);
46270       if (!preset) return [];
46271       const oldTags = Object.assign({}, entity.tags);
46272       if (preset.replacement) {
46273         const newPreset = _mainPresetIndex.item(preset.replacement);
46274         graph = actionChangePreset(
46275           entity.id,
46276           preset,
46277           newPreset,
46278           true
46279           /* skip field defaults */
46280         )(graph);
46281         entity = graph.entity(entity.id);
46282         preset = newPreset;
46283       }
46284       const nsi = services.nsi;
46285       let waitingForNsi = false;
46286       let nsiResult;
46287       if (nsi) {
46288         waitingForNsi = nsi.status() === "loading";
46289         if (!waitingForNsi) {
46290           const loc = entity.extent(graph).center();
46291           nsiResult = nsi.upgradeTags(oldTags, loc);
46292         }
46293       }
46294       const nsiDiff = nsiResult ? utilTagDiff(oldTags, nsiResult.newTags) : [];
46295       if (_dataDeprecated) {
46296         const deprecatedTags = getDeprecatedTags(entity.tags, _dataDeprecated);
46297         if (entity.type === "way" && entity.isClosed() && entity.tags.traffic_calming === "island" && !entity.tags.highway) {
46298           deprecatedTags.push({
46299             old: { traffic_calming: "island" },
46300             replace: { "area:highway": "traffic_island" }
46301           });
46302         }
46303         if (deprecatedTags.length) {
46304           deprecatedTags.forEach((tag2) => {
46305             graph = actionUpgradeTags(entity.id, tag2.old, tag2.replace)(graph);
46306           });
46307           entity = graph.entity(entity.id);
46308         }
46309       }
46310       let newTags = Object.assign({}, entity.tags);
46311       if (preset.tags !== preset.addTags) {
46312         Object.keys(preset.addTags).filter((k2) => {
46313           return !(nsiResult == null ? void 0 : nsiResult.newTags[k2]);
46314         }).forEach((k2) => {
46315           if (!newTags[k2]) {
46316             if (preset.addTags[k2] === "*") {
46317               newTags[k2] = "yes";
46318             } else if (preset.addTags[k2]) {
46319               newTags[k2] = preset.addTags[k2];
46320             }
46321           }
46322         });
46323       }
46324       const deprecationDiff = utilTagDiff(oldTags, newTags);
46325       let issues = [];
46326       issues.provisional = _waitingForDeprecated || waitingForNsi;
46327       if (deprecationDiff.length) {
46328         const isOnlyAddingTags = deprecationDiff.every((d2) => d2.type === "+");
46329         const prefix = isOnlyAddingTags ? "incomplete." : "";
46330         issues.push(new validationIssue({
46331           type: type2,
46332           subtype: isOnlyAddingTags ? "incomplete_tags" : "deprecated_tags",
46333           severity: "warning",
46334           message: (context) => {
46335             const currEntity = context.hasEntity(entity.id);
46336             if (!currEntity) return "";
46337             const feature3 = utilDisplayLabel(
46338               currEntity,
46339               context.graph(),
46340               /* verbose */
46341               true
46342             );
46343             return _t.append(`issues.outdated_tags.${prefix}message`, { feature: feature3 });
46344           },
46345           reference: (selection2) => showReference(
46346             selection2,
46347             _t.append(`issues.outdated_tags.${prefix}reference`),
46348             deprecationDiff
46349           ),
46350           entityIds: [entity.id],
46351           hash: utilHashcode(JSON.stringify(deprecationDiff)),
46352           dynamicFixes: () => {
46353             let fixes = [
46354               new validationIssueFix({
46355                 title: _t.append("issues.fix.upgrade_tags.title"),
46356                 onClick: (context) => {
46357                   context.perform((graph2) => doUpgrade(graph2, deprecationDiff), _t("issues.fix.upgrade_tags.annotation"));
46358                 }
46359               })
46360             ];
46361             return fixes;
46362           }
46363         }));
46364       }
46365       if (nsiDiff.length) {
46366         const isOnlyAddingTags = nsiDiff.every((d2) => d2.type === "+");
46367         issues.push(new validationIssue({
46368           type: type2,
46369           subtype: "noncanonical_brand",
46370           severity: "warning",
46371           message: (context) => {
46372             const currEntity = context.hasEntity(entity.id);
46373             if (!currEntity) return "";
46374             const feature3 = utilDisplayLabel(
46375               currEntity,
46376               context.graph(),
46377               /* verbose */
46378               true
46379             );
46380             return isOnlyAddingTags ? _t.append("issues.outdated_tags.noncanonical_brand.message_incomplete", { feature: feature3 }) : _t.append("issues.outdated_tags.noncanonical_brand.message", { feature: feature3 });
46381           },
46382           reference: (selection2) => showReference(
46383             selection2,
46384             _t.append("issues.outdated_tags.noncanonical_brand.reference"),
46385             nsiDiff
46386           ),
46387           entityIds: [entity.id],
46388           hash: utilHashcode(JSON.stringify(nsiDiff)),
46389           dynamicFixes: () => {
46390             let fixes = [
46391               new validationIssueFix({
46392                 title: _t.append("issues.fix.upgrade_tags.title"),
46393                 onClick: (context) => {
46394                   context.perform((graph2) => doUpgrade(graph2, nsiDiff), _t("issues.fix.upgrade_tags.annotation"));
46395                 }
46396               }),
46397               new validationIssueFix({
46398                 title: _t.append("issues.fix.tag_as_not.title", { name: nsiResult.matched.displayName }),
46399                 onClick: (context) => {
46400                   context.perform(addNotTag, _t("issues.fix.tag_as_not.annotation"));
46401                 }
46402               })
46403             ];
46404             return fixes;
46405           }
46406         }));
46407       }
46408       return issues;
46409       function doUpgrade(graph2, diff) {
46410         const currEntity = graph2.hasEntity(entity.id);
46411         if (!currEntity) return graph2;
46412         let newTags2 = Object.assign({}, currEntity.tags);
46413         diff.forEach((diff2) => {
46414           if (diff2.type === "-") {
46415             delete newTags2[diff2.key];
46416           } else if (diff2.type === "+") {
46417             newTags2[diff2.key] = diff2.newVal;
46418           }
46419         });
46420         return actionChangeTags(currEntity.id, newTags2)(graph2);
46421       }
46422       function addNotTag(graph2) {
46423         const currEntity = graph2.hasEntity(entity.id);
46424         if (!currEntity) return graph2;
46425         const item = nsiResult && nsiResult.matched;
46426         if (!item) return graph2;
46427         let newTags2 = Object.assign({}, currEntity.tags);
46428         const wd = item.mainTag;
46429         const notwd = `not:${wd}`;
46430         const qid = item.tags[wd];
46431         newTags2[notwd] = qid;
46432         if (newTags2[wd] === qid) {
46433           const wp = item.mainTag.replace("wikidata", "wikipedia");
46434           delete newTags2[wd];
46435           delete newTags2[wp];
46436         }
46437         return actionChangeTags(currEntity.id, newTags2)(graph2);
46438       }
46439       function showReference(selection2, reference, tagDiff) {
46440         let enter = selection2.selectAll(".issue-reference").data([0]).enter();
46441         enter.append("div").attr("class", "issue-reference").call(reference);
46442         enter.append("strong").call(_t.append("issues.suggested"));
46443         enter.append("table").attr("class", "tagDiff-table").selectAll(".tagDiff-row").data(tagDiff).enter().append("tr").attr("class", "tagDiff-row").append("td").attr("class", (d2) => {
46444           let klass = d2.type === "+" ? "add" : "remove";
46445           return `tagDiff-cell tagDiff-cell-${klass}`;
46446         }).html((d2) => d2.display);
46447       }
46448     }
46449     let validation = oldTagIssues;
46450     validation.type = type2;
46451     return validation;
46452   }
46453   var init_outdated_tags = __esm({
46454     "modules/validations/outdated_tags.js"() {
46455       "use strict";
46456       init_localizer();
46457       init_change_preset();
46458       init_change_tags();
46459       init_upgrade_tags();
46460       init_core();
46461       init_presets();
46462       init_services();
46463       init_util();
46464       init_utilDisplayLabel();
46465       init_validation();
46466       init_deprecated();
46467     }
46468   });
46469
46470   // modules/validations/private_data.js
46471   var private_data_exports = {};
46472   __export(private_data_exports, {
46473     validationPrivateData: () => validationPrivateData
46474   });
46475   function validationPrivateData() {
46476     var type2 = "private_data";
46477     var privateBuildingValues = {
46478       detached: true,
46479       farm: true,
46480       house: true,
46481       houseboat: true,
46482       residential: true,
46483       semidetached_house: true,
46484       static_caravan: true
46485     };
46486     var publicKeys = {
46487       amenity: true,
46488       craft: true,
46489       historic: true,
46490       leisure: true,
46491       office: true,
46492       shop: true,
46493       tourism: true
46494     };
46495     var personalTags = {
46496       "contact:email": true,
46497       "contact:fax": true,
46498       "contact:phone": true,
46499       email: true,
46500       fax: true,
46501       phone: true
46502     };
46503     var validation = function checkPrivateData(entity) {
46504       var tags = entity.tags;
46505       if (!tags.building || !privateBuildingValues[tags.building]) return [];
46506       var keepTags = {};
46507       for (var k2 in tags) {
46508         if (publicKeys[k2]) return [];
46509         if (!personalTags[k2]) {
46510           keepTags[k2] = tags[k2];
46511         }
46512       }
46513       var tagDiff = utilTagDiff(tags, keepTags);
46514       if (!tagDiff.length) return [];
46515       var fixID = tagDiff.length === 1 ? "remove_tag" : "remove_tags";
46516       return [new validationIssue({
46517         type: type2,
46518         severity: "warning",
46519         message: showMessage,
46520         reference: showReference,
46521         entityIds: [entity.id],
46522         dynamicFixes: function() {
46523           return [
46524             new validationIssueFix({
46525               icon: "iD-operation-delete",
46526               title: _t.append("issues.fix." + fixID + ".title"),
46527               onClick: function(context) {
46528                 context.perform(doUpgrade, _t("issues.fix.remove_tag.annotation"));
46529               }
46530             })
46531           ];
46532         }
46533       })];
46534       function doUpgrade(graph) {
46535         var currEntity = graph.hasEntity(entity.id);
46536         if (!currEntity) return graph;
46537         var newTags = Object.assign({}, currEntity.tags);
46538         tagDiff.forEach(function(diff) {
46539           if (diff.type === "-") {
46540             delete newTags[diff.key];
46541           } else if (diff.type === "+") {
46542             newTags[diff.key] = diff.newVal;
46543           }
46544         });
46545         return actionChangeTags(currEntity.id, newTags)(graph);
46546       }
46547       function showMessage(context) {
46548         var currEntity = context.hasEntity(this.entityIds[0]);
46549         if (!currEntity) return "";
46550         return _t.append(
46551           "issues.private_data.contact.message",
46552           { feature: utilDisplayLabel(currEntity, context.graph()) }
46553         );
46554       }
46555       function showReference(selection2) {
46556         var enter = selection2.selectAll(".issue-reference").data([0]).enter();
46557         enter.append("div").attr("class", "issue-reference").call(_t.append("issues.private_data.reference"));
46558         enter.append("strong").call(_t.append("issues.suggested"));
46559         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) {
46560           var klass = d2.type === "+" ? "add" : "remove";
46561           return "tagDiff-cell tagDiff-cell-" + klass;
46562         }).html(function(d2) {
46563           return d2.display;
46564         });
46565       }
46566     };
46567     validation.type = type2;
46568     return validation;
46569   }
46570   var init_private_data = __esm({
46571     "modules/validations/private_data.js"() {
46572       "use strict";
46573       init_change_tags();
46574       init_localizer();
46575       init_util();
46576       init_utilDisplayLabel();
46577       init_validation();
46578     }
46579   });
46580
46581   // modules/validations/suspicious_name.js
46582   var suspicious_name_exports = {};
46583   __export(suspicious_name_exports, {
46584     validationSuspiciousName: () => validationSuspiciousName
46585   });
46586   function validationSuspiciousName(context) {
46587     const type2 = "suspicious_name";
46588     const keysToTestForGenericValues = [
46589       "aerialway",
46590       "aeroway",
46591       "amenity",
46592       "building",
46593       "craft",
46594       "highway",
46595       "leisure",
46596       "railway",
46597       "man_made",
46598       "office",
46599       "shop",
46600       "tourism",
46601       "waterway"
46602     ];
46603     const ignoredPresets = /* @__PURE__ */ new Set([
46604       "amenity/place_of_worship/christian/jehovahs_witness",
46605       "__test__ignored_preset"
46606       // for unit tests
46607     ]);
46608     let _waitingForNsi = false;
46609     function isGenericMatchInNsi(tags) {
46610       const nsi = services.nsi;
46611       if (nsi) {
46612         _waitingForNsi = nsi.status() === "loading";
46613         if (!_waitingForNsi) {
46614           return nsi.isGenericName(tags);
46615         }
46616       }
46617       return false;
46618     }
46619     function nameMatchesRawTag(lowercaseName, tags) {
46620       for (let i3 = 0; i3 < keysToTestForGenericValues.length; i3++) {
46621         let key = keysToTestForGenericValues[i3];
46622         let val = tags[key];
46623         if (val) {
46624           val = val.toLowerCase();
46625           if (key === lowercaseName || val === lowercaseName || key.replace(/\_/g, " ") === lowercaseName || val.replace(/\_/g, " ") === lowercaseName) {
46626             return true;
46627           }
46628         }
46629       }
46630       return false;
46631     }
46632     function nameMatchesPresetName(name, preset) {
46633       if (!preset) return false;
46634       if (ignoredPresets.has(preset.id)) return false;
46635       name = name.toLowerCase();
46636       return name === preset.name().toLowerCase() || preset.aliases().some((alias) => name === alias.toLowerCase());
46637     }
46638     function isGenericName(name, tags, preset) {
46639       name = name.toLowerCase();
46640       return nameMatchesRawTag(name, tags) || nameMatchesPresetName(name, preset) || isGenericMatchInNsi(tags);
46641     }
46642     function makeGenericNameIssue(entityId, nameKey, genericName, langCode) {
46643       return new validationIssue({
46644         type: type2,
46645         subtype: "generic_name",
46646         severity: "warning",
46647         message: function(context2) {
46648           let entity = context2.hasEntity(this.entityIds[0]);
46649           if (!entity) return "";
46650           let preset = _mainPresetIndex.match(entity, context2.graph());
46651           let langName = langCode && _mainLocalizer.languageName(langCode);
46652           return _t.append(
46653             "issues.generic_name.message" + (langName ? "_language" : ""),
46654             { feature: preset.name(), name: genericName, language: langName }
46655           );
46656         },
46657         reference: showReference,
46658         entityIds: [entityId],
46659         hash: `${nameKey}=${genericName}`,
46660         dynamicFixes: function() {
46661           return [
46662             new validationIssueFix({
46663               icon: "iD-operation-delete",
46664               title: _t.append("issues.fix.remove_the_name.title"),
46665               onClick: function(context2) {
46666                 let entityId2 = this.issue.entityIds[0];
46667                 let entity = context2.entity(entityId2);
46668                 let tags = Object.assign({}, entity.tags);
46669                 delete tags[nameKey];
46670                 context2.perform(
46671                   actionChangeTags(entityId2, tags),
46672                   _t("issues.fix.remove_generic_name.annotation")
46673                 );
46674               }
46675             })
46676           ];
46677         }
46678       });
46679       function showReference(selection2) {
46680         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.generic_name.reference"));
46681       }
46682     }
46683     let validation = function checkGenericName(entity) {
46684       const tags = entity.tags;
46685       const hasWikidata = !!tags.wikidata || !!tags["brand:wikidata"] || !!tags["operator:wikidata"];
46686       if (hasWikidata) return [];
46687       let issues = [];
46688       const preset = _mainPresetIndex.match(entity, context.graph());
46689       for (let key in tags) {
46690         const m2 = key.match(/^name(?:(?::)([a-zA-Z_-]+))?$/);
46691         if (!m2) continue;
46692         const langCode = m2.length >= 2 ? m2[1] : null;
46693         const value = tags[key];
46694         if (isGenericName(value, tags, preset)) {
46695           issues.provisional = _waitingForNsi;
46696           issues.push(makeGenericNameIssue(entity.id, key, value, langCode));
46697         }
46698       }
46699       return issues;
46700     };
46701     validation.type = type2;
46702     return validation;
46703   }
46704   var init_suspicious_name = __esm({
46705     "modules/validations/suspicious_name.js"() {
46706       "use strict";
46707       init_change_tags();
46708       init_presets();
46709       init_services();
46710       init_localizer();
46711       init_validation();
46712     }
46713   });
46714
46715   // modules/validations/unsquare_way.js
46716   var unsquare_way_exports = {};
46717   __export(unsquare_way_exports, {
46718     validationUnsquareWay: () => validationUnsquareWay
46719   });
46720   function validationUnsquareWay(context) {
46721     var type2 = "unsquare_way";
46722     var DEFAULT_DEG_THRESHOLD = 5;
46723     var epsilon3 = 0.05;
46724     var nodeThreshold = 10;
46725     function isBuilding(entity, graph) {
46726       if (entity.type !== "way" || entity.geometry(graph) !== "area") return false;
46727       return entity.tags.building && entity.tags.building !== "no";
46728     }
46729     var validation = function checkUnsquareWay(entity, graph) {
46730       if (!isBuilding(entity, graph)) return [];
46731       if (entity.tags.nonsquare === "yes") return [];
46732       var isClosed = entity.isClosed();
46733       if (!isClosed) return [];
46734       var nodes = graph.childNodes(entity).slice();
46735       if (nodes.length > nodeThreshold + 1) return [];
46736       var osm = services.osm;
46737       if (!osm || nodes.some(function(node) {
46738         return !osm.isDataLoaded(node.loc);
46739       })) return [];
46740       var hasConnectedSquarableWays = nodes.some(function(node) {
46741         return graph.parentWays(node).some(function(way) {
46742           if (way.id === entity.id) return false;
46743           if (isBuilding(way, graph)) return true;
46744           return graph.parentRelations(way).some(function(parentRelation) {
46745             return parentRelation.isMultipolygon() && parentRelation.tags.building && parentRelation.tags.building !== "no";
46746           });
46747         });
46748       });
46749       if (hasConnectedSquarableWays) return [];
46750       var storedDegreeThreshold = corePreferences("validate-square-degrees");
46751       var degreeThreshold = isFinite(storedDegreeThreshold) ? Number(storedDegreeThreshold) : DEFAULT_DEG_THRESHOLD;
46752       var points = nodes.map(function(node) {
46753         return context.projection(node.loc);
46754       });
46755       if (!geoOrthoCanOrthogonalize(points, isClosed, epsilon3, degreeThreshold, true)) return [];
46756       var autoArgs;
46757       if (!entity.tags.wikidata) {
46758         var autoAction = actionOrthogonalize(entity.id, context.projection, void 0, degreeThreshold);
46759         autoAction.transitionable = false;
46760         autoArgs = [autoAction, _t("operations.orthogonalize.annotation.feature", { n: 1 })];
46761       }
46762       return [new validationIssue({
46763         type: type2,
46764         subtype: "building",
46765         severity: "warning",
46766         message: function(context2) {
46767           var entity2 = context2.hasEntity(this.entityIds[0]);
46768           return entity2 ? _t.append("issues.unsquare_way.message", {
46769             feature: utilDisplayLabel(entity2, context2.graph())
46770           }) : "";
46771         },
46772         reference: showReference,
46773         entityIds: [entity.id],
46774         hash: degreeThreshold,
46775         dynamicFixes: function() {
46776           return [
46777             new validationIssueFix({
46778               icon: "iD-operation-orthogonalize",
46779               title: _t.append("issues.fix.square_feature.title"),
46780               autoArgs,
46781               onClick: function(context2, completionHandler) {
46782                 var entityId = this.issue.entityIds[0];
46783                 context2.perform(
46784                   actionOrthogonalize(entityId, context2.projection, void 0, degreeThreshold),
46785                   _t("operations.orthogonalize.annotation.feature", { n: 1 })
46786                 );
46787                 window.setTimeout(function() {
46788                   completionHandler();
46789                 }, 175);
46790               }
46791             })
46792             /*
46793             new validationIssueFix({
46794                 title: t.append('issues.fix.tag_as_unsquare.title'),
46795                 onClick: function(context) {
46796                     var entityId = this.issue.entityIds[0];
46797                     var entity = context.entity(entityId);
46798                     var tags = Object.assign({}, entity.tags);  // shallow copy
46799                     tags.nonsquare = 'yes';
46800                     context.perform(
46801                         actionChangeTags(entityId, tags),
46802                         t('issues.fix.tag_as_unsquare.annotation')
46803                     );
46804                 }
46805             })
46806             */
46807           ];
46808         }
46809       })];
46810       function showReference(selection2) {
46811         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.unsquare_way.buildings.reference"));
46812       }
46813     };
46814     validation.type = type2;
46815     return validation;
46816   }
46817   var init_unsquare_way = __esm({
46818     "modules/validations/unsquare_way.js"() {
46819       "use strict";
46820       init_preferences();
46821       init_localizer();
46822       init_orthogonalize();
46823       init_ortho();
46824       init_utilDisplayLabel();
46825       init_validation();
46826       init_services();
46827     }
46828   });
46829
46830   // modules/validations/index.js
46831   var validations_exports = {};
46832   __export(validations_exports, {
46833     validationAlmostJunction: () => validationAlmostJunction,
46834     validationCloseNodes: () => validationCloseNodes,
46835     validationCrossingWays: () => validationCrossingWays,
46836     validationDisconnectedWay: () => validationDisconnectedWay,
46837     validationFormatting: () => validationFormatting,
46838     validationHelpRequest: () => validationHelpRequest,
46839     validationImpossibleOneway: () => validationImpossibleOneway,
46840     validationIncompatibleSource: () => validationIncompatibleSource,
46841     validationMaprules: () => validationMaprules,
46842     validationMismatchedGeometry: () => validationMismatchedGeometry,
46843     validationMissingRole: () => validationMissingRole,
46844     validationMissingTag: () => validationMissingTag,
46845     validationMutuallyExclusiveTags: () => validationMutuallyExclusiveTags,
46846     validationOsmApiLimits: () => validationOsmApiLimits,
46847     validationOutdatedTags: () => validationOutdatedTags,
46848     validationPrivateData: () => validationPrivateData,
46849     validationSuspiciousName: () => validationSuspiciousName,
46850     validationUnsquareWay: () => validationUnsquareWay
46851   });
46852   var init_validations = __esm({
46853     "modules/validations/index.js"() {
46854       "use strict";
46855       init_almost_junction();
46856       init_close_nodes();
46857       init_crossing_ways();
46858       init_disconnected_way();
46859       init_invalid_format();
46860       init_help_request();
46861       init_impossible_oneway();
46862       init_incompatible_source();
46863       init_maprules2();
46864       init_mismatched_geometry();
46865       init_missing_role();
46866       init_missing_tag();
46867       init_mutually_exclusive_tags();
46868       init_osm_api_limits();
46869       init_outdated_tags();
46870       init_private_data();
46871       init_suspicious_name();
46872       init_unsquare_way();
46873     }
46874   });
46875
46876   // modules/core/validator.js
46877   var validator_exports = {};
46878   __export(validator_exports, {
46879     coreValidator: () => coreValidator
46880   });
46881   function coreValidator(context) {
46882     let dispatch14 = dispatch_default("validated", "focusedIssue");
46883     const validator = {};
46884     let _rules = {};
46885     let _disabledRules = {};
46886     let _ignoredIssueIDs = /* @__PURE__ */ new Set();
46887     let _resolvedIssueIDs = /* @__PURE__ */ new Set();
46888     let _baseCache = validationCache("base");
46889     let _headCache = validationCache("head");
46890     let _completeDiff = {};
46891     let _headIsCurrent = false;
46892     let _deferredRIC = {};
46893     let _deferredST = /* @__PURE__ */ new Set();
46894     let _headPromise;
46895     const RETRY = 5e3;
46896     const _errorOverrides = parseHashParam(context.initialHashParams.validationError);
46897     const _warningOverrides = parseHashParam(context.initialHashParams.validationWarning);
46898     const _disableOverrides = parseHashParam(context.initialHashParams.validationDisable);
46899     function parseHashParam(param) {
46900       let result = [];
46901       let rules = (param || "").split(",");
46902       rules.forEach((rule) => {
46903         rule = rule.trim();
46904         const parts = rule.split("/", 2);
46905         const type2 = parts[0];
46906         const subtype = parts[1] || "*";
46907         if (!type2 || !subtype) return;
46908         result.push({ type: makeRegExp(type2), subtype: makeRegExp(subtype) });
46909       });
46910       return result;
46911       function makeRegExp(str) {
46912         const escaped = str.replace(/[-\/\\^$+?.()|[\]{}]/g, "\\$&").replace(/\*/g, ".*");
46913         return new RegExp("^" + escaped + "$");
46914       }
46915     }
46916     validator.init = () => {
46917       Object.values(validations_exports).forEach((validation) => {
46918         if (typeof validation !== "function") return;
46919         const fn = validation(context);
46920         const key = fn.type;
46921         _rules[key] = fn;
46922       });
46923       let disabledRules = corePreferences("validate-disabledRules");
46924       if (disabledRules) {
46925         disabledRules.split(",").forEach((k2) => _disabledRules[k2] = true);
46926       }
46927     };
46928     function reset(resetIgnored) {
46929       _baseCache.queue = [];
46930       _headCache.queue = [];
46931       Object.keys(_deferredRIC).forEach((key) => {
46932         window.cancelIdleCallback(key);
46933         _deferredRIC[key]();
46934       });
46935       _deferredRIC = {};
46936       _deferredST.forEach(window.clearTimeout);
46937       _deferredST.clear();
46938       if (resetIgnored) _ignoredIssueIDs.clear();
46939       _resolvedIssueIDs.clear();
46940       _baseCache = validationCache("base");
46941       _headCache = validationCache("head");
46942       _completeDiff = {};
46943       _headIsCurrent = false;
46944     }
46945     validator.reset = () => {
46946       reset(true);
46947     };
46948     validator.resetIgnoredIssues = () => {
46949       _ignoredIssueIDs.clear();
46950       dispatch14.call("validated");
46951     };
46952     validator.revalidateUnsquare = () => {
46953       revalidateUnsquare(_headCache);
46954       revalidateUnsquare(_baseCache);
46955       dispatch14.call("validated");
46956     };
46957     function revalidateUnsquare(cache) {
46958       const checkUnsquareWay = _rules.unsquare_way;
46959       if (!cache.graph || typeof checkUnsquareWay !== "function") return;
46960       cache.uncacheIssuesOfType("unsquare_way");
46961       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");
46962       buildings.forEach((entity) => {
46963         const detected = checkUnsquareWay(entity, cache.graph);
46964         if (!detected.length) return;
46965         cache.cacheIssues(detected);
46966       });
46967     }
46968     validator.getIssues = (options2) => {
46969       const opts = Object.assign({ what: "all", where: "all", includeIgnored: false, includeDisabledRules: false }, options2);
46970       const view = context.map().extent();
46971       let seen = /* @__PURE__ */ new Set();
46972       let results = [];
46973       if (_headCache.graph && _headCache.graph !== _baseCache.graph) {
46974         Object.values(_headCache.issuesByIssueID).forEach((issue) => {
46975           const userModified = (issue.entityIds || []).some((id2) => _completeDiff.hasOwnProperty(id2));
46976           if (opts.what === "edited" && !userModified) return;
46977           if (!filter2(issue)) return;
46978           seen.add(issue.id);
46979           results.push(issue);
46980         });
46981       }
46982       if (opts.what === "all") {
46983         Object.values(_baseCache.issuesByIssueID).forEach((issue) => {
46984           if (!filter2(issue)) return;
46985           seen.add(issue.id);
46986           results.push(issue);
46987         });
46988       }
46989       return results;
46990       function filter2(issue) {
46991         if (!issue) return false;
46992         if (seen.has(issue.id)) return false;
46993         if (_resolvedIssueIDs.has(issue.id)) return false;
46994         if (opts.includeDisabledRules === "only" && !_disabledRules[issue.type]) return false;
46995         if (!opts.includeDisabledRules && _disabledRules[issue.type]) return false;
46996         if (opts.includeIgnored === "only" && !_ignoredIssueIDs.has(issue.id)) return false;
46997         if (!opts.includeIgnored && _ignoredIssueIDs.has(issue.id)) return false;
46998         if ((issue.entityIds || []).some((id2) => !context.hasEntity(id2))) return false;
46999         if (opts.where === "visible") {
47000           const extent = issue.extent(context.graph());
47001           if (!view.intersects(extent)) return false;
47002         }
47003         return true;
47004       }
47005     };
47006     validator.getResolvedIssues = () => {
47007       return Array.from(_resolvedIssueIDs).map((issueID) => _baseCache.issuesByIssueID[issueID]).filter(Boolean);
47008     };
47009     validator.focusIssue = (issue) => {
47010       const graph = context.graph();
47011       let selectID;
47012       let focusCenter;
47013       const issueExtent = issue.extent(graph);
47014       if (issueExtent) {
47015         focusCenter = issueExtent.center();
47016       }
47017       if (issue.entityIds && issue.entityIds.length) {
47018         selectID = issue.entityIds[0];
47019         if (selectID && selectID.charAt(0) === "r") {
47020           const ids = utilEntityAndDeepMemberIDs([selectID], graph);
47021           let nodeID = ids.find((id2) => id2.charAt(0) === "n" && graph.hasEntity(id2));
47022           if (!nodeID) {
47023             const wayID = ids.find((id2) => id2.charAt(0) === "w" && graph.hasEntity(id2));
47024             if (wayID) {
47025               nodeID = graph.entity(wayID).first();
47026             }
47027           }
47028           if (nodeID) {
47029             focusCenter = graph.entity(nodeID).loc;
47030           }
47031         }
47032       }
47033       if (focusCenter) {
47034         const setZoom = Math.max(context.map().zoom(), 19);
47035         context.map().unobscuredCenterZoomEase(focusCenter, setZoom);
47036       }
47037       if (selectID) {
47038         window.setTimeout(() => {
47039           context.enter(modeSelect(context, [selectID]));
47040           dispatch14.call("focusedIssue", this, issue);
47041         }, 250);
47042       }
47043     };
47044     validator.getIssuesBySeverity = (options2) => {
47045       let groups = utilArrayGroupBy(validator.getIssues(options2), "severity");
47046       groups.error = groups.error || [];
47047       groups.warning = groups.warning || [];
47048       return groups;
47049     };
47050     validator.getSharedEntityIssues = (entityIDs, options2) => {
47051       const orderedIssueTypes = [
47052         // Show some issue types in a particular order:
47053         "missing_tag",
47054         "missing_role",
47055         // - missing data first
47056         "outdated_tags",
47057         "mismatched_geometry",
47058         // - identity issues
47059         "crossing_ways",
47060         "almost_junction",
47061         // - geometry issues where fixing them might solve connectivity issues
47062         "disconnected_way",
47063         "impossible_oneway"
47064         // - finally connectivity issues
47065       ];
47066       const allIssues = validator.getIssues(options2);
47067       const forEntityIDs = new Set(entityIDs);
47068       return allIssues.filter((issue) => (issue.entityIds || []).some((entityID) => forEntityIDs.has(entityID))).sort((issue1, issue2) => {
47069         if (issue1.type === issue2.type) {
47070           return issue1.id < issue2.id ? -1 : 1;
47071         }
47072         const index1 = orderedIssueTypes.indexOf(issue1.type);
47073         const index2 = orderedIssueTypes.indexOf(issue2.type);
47074         if (index1 !== -1 && index2 !== -1) {
47075           return index1 - index2;
47076         } else if (index1 === -1 && index2 === -1) {
47077           return issue1.type < issue2.type ? -1 : 1;
47078         } else {
47079           return index1 !== -1 ? -1 : 1;
47080         }
47081       });
47082     };
47083     validator.getEntityIssues = (entityID, options2) => {
47084       return validator.getSharedEntityIssues([entityID], options2);
47085     };
47086     validator.getRuleKeys = () => {
47087       return Object.keys(_rules);
47088     };
47089     validator.isRuleEnabled = (key) => {
47090       return !_disabledRules[key];
47091     };
47092     validator.toggleRule = (key) => {
47093       if (_disabledRules[key]) {
47094         delete _disabledRules[key];
47095       } else {
47096         _disabledRules[key] = true;
47097       }
47098       corePreferences("validate-disabledRules", Object.keys(_disabledRules).join(","));
47099       validator.validate();
47100     };
47101     validator.disableRules = (keys2) => {
47102       _disabledRules = {};
47103       keys2.forEach((k2) => _disabledRules[k2] = true);
47104       corePreferences("validate-disabledRules", Object.keys(_disabledRules).join(","));
47105       validator.validate();
47106     };
47107     validator.ignoreIssue = (issueID) => {
47108       _ignoredIssueIDs.add(issueID);
47109     };
47110     validator.validate = () => {
47111       const baseGraph = context.history().base();
47112       if (!_headCache.graph) _headCache.graph = baseGraph;
47113       if (!_baseCache.graph) _baseCache.graph = baseGraph;
47114       const prevGraph = _headCache.graph;
47115       const currGraph = context.graph();
47116       if (currGraph === prevGraph) {
47117         _headIsCurrent = true;
47118         dispatch14.call("validated");
47119         return Promise.resolve();
47120       }
47121       if (_headPromise) {
47122         _headIsCurrent = false;
47123         return _headPromise;
47124       }
47125       _headCache.graph = currGraph;
47126       _completeDiff = context.history().difference().complete();
47127       const incrementalDiff = coreDifference(prevGraph, currGraph);
47128       const diff = Object.keys(incrementalDiff.complete());
47129       const entityIDs = _headCache.withAllRelatedEntities(diff);
47130       if (!entityIDs.size) {
47131         dispatch14.call("validated");
47132         return Promise.resolve();
47133       }
47134       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));
47135       addConnectedWays(currGraph);
47136       addConnectedWays(prevGraph);
47137       Object.values({ ...incrementalDiff.created(), ...incrementalDiff.deleted() }).filter((e3) => e3.type === "relation").flatMap((r2) => r2.members).forEach((m2) => entityIDs.add(m2.id));
47138       Object.values(incrementalDiff.modified()).filter((e3) => e3.type === "relation").map((r2) => ({ baseEntity: prevGraph.entity(r2.id), headEntity: r2 })).forEach(({ baseEntity, headEntity }) => {
47139         const bm = baseEntity.members.map((m2) => m2.id);
47140         const hm = headEntity.members.map((m2) => m2.id);
47141         const symDiff = utilArrayDifference(utilArrayUnion(bm, hm), utilArrayIntersection(bm, hm));
47142         symDiff.forEach((id2) => entityIDs.add(id2));
47143       });
47144       _headPromise = validateEntitiesAsync(entityIDs, _headCache).then(() => updateResolvedIssues(entityIDs)).then(() => dispatch14.call("validated")).catch(() => {
47145       }).then(() => {
47146         _headPromise = null;
47147         if (!_headIsCurrent) {
47148           validator.validate();
47149         }
47150       });
47151       return _headPromise;
47152     };
47153     context.history().on("restore.validator", validator.validate).on("undone.validator", validator.validate).on("redone.validator", validator.validate).on("reset.validator", () => {
47154       reset(false);
47155       validator.validate();
47156     });
47157     context.on("exit.validator", validator.validate);
47158     context.history().on("merge.validator", (entities) => {
47159       if (!entities) return;
47160       const baseGraph = context.history().base();
47161       if (!_headCache.graph) _headCache.graph = baseGraph;
47162       if (!_baseCache.graph) _baseCache.graph = baseGraph;
47163       let entityIDs = entities.map((entity) => entity.id);
47164       entityIDs = _baseCache.withAllRelatedEntities(entityIDs);
47165       validateEntitiesAsync(entityIDs, _baseCache);
47166     });
47167     function validateEntity(entity, graph) {
47168       let result = { issues: [], provisional: false };
47169       Object.keys(_rules).forEach(runValidation);
47170       return result;
47171       function runValidation(key) {
47172         const fn = _rules[key];
47173         if (typeof fn !== "function") {
47174           console.error("no such validation rule = " + key);
47175           return;
47176         }
47177         let detected = fn(entity, graph);
47178         if (detected.provisional) {
47179           result.provisional = true;
47180         }
47181         detected = detected.filter(applySeverityOverrides);
47182         result.issues = result.issues.concat(detected);
47183         function applySeverityOverrides(issue) {
47184           const type2 = issue.type;
47185           const subtype = issue.subtype || "";
47186           let i3;
47187           for (i3 = 0; i3 < _errorOverrides.length; i3++) {
47188             if (_errorOverrides[i3].type.test(type2) && _errorOverrides[i3].subtype.test(subtype)) {
47189               issue.severity = "error";
47190               return true;
47191             }
47192           }
47193           for (i3 = 0; i3 < _warningOverrides.length; i3++) {
47194             if (_warningOverrides[i3].type.test(type2) && _warningOverrides[i3].subtype.test(subtype)) {
47195               issue.severity = "warning";
47196               return true;
47197             }
47198           }
47199           for (i3 = 0; i3 < _disableOverrides.length; i3++) {
47200             if (_disableOverrides[i3].type.test(type2) && _disableOverrides[i3].subtype.test(subtype)) {
47201               return false;
47202             }
47203           }
47204           return true;
47205         }
47206       }
47207     }
47208     function updateResolvedIssues(entityIDs) {
47209       entityIDs.forEach((entityID) => {
47210         const baseIssues = _baseCache.issuesByEntityID[entityID];
47211         if (!baseIssues) return;
47212         baseIssues.forEach((issueID) => {
47213           const issue = _baseCache.issuesByIssueID[issueID];
47214           const userModified = (issue.entityIds || []).some((id2) => _completeDiff.hasOwnProperty(id2));
47215           if (userModified && !_headCache.issuesByIssueID[issueID]) {
47216             _resolvedIssueIDs.add(issueID);
47217           } else {
47218             _resolvedIssueIDs.delete(issueID);
47219           }
47220         });
47221       });
47222     }
47223     function validateEntitiesAsync(entityIDs, cache) {
47224       const jobs = Array.from(entityIDs).map((entityID) => {
47225         if (cache.queuedEntityIDs.has(entityID)) return null;
47226         cache.queuedEntityIDs.add(entityID);
47227         cache.uncacheEntityID(entityID);
47228         return () => {
47229           cache.queuedEntityIDs.delete(entityID);
47230           const graph = cache.graph;
47231           if (!graph) return;
47232           const entity = graph.hasEntity(entityID);
47233           if (!entity) return;
47234           const result = validateEntity(entity, graph);
47235           if (result.provisional) {
47236             cache.provisionalEntityIDs.add(entityID);
47237           }
47238           cache.cacheIssues(result.issues);
47239         };
47240       }).filter(Boolean);
47241       cache.queue = cache.queue.concat(utilArrayChunk(jobs, 100));
47242       if (cache.queuePromise) return cache.queuePromise;
47243       cache.queuePromise = processQueue(cache).then(() => revalidateProvisionalEntities(cache)).catch(() => {
47244       }).finally(() => cache.queuePromise = null);
47245       return cache.queuePromise;
47246     }
47247     function revalidateProvisionalEntities(cache) {
47248       if (!cache.provisionalEntityIDs.size) return;
47249       const handle = window.setTimeout(() => {
47250         _deferredST.delete(handle);
47251         if (!cache.provisionalEntityIDs.size) return;
47252         validateEntitiesAsync(Array.from(cache.provisionalEntityIDs), cache);
47253       }, RETRY);
47254       _deferredST.add(handle);
47255     }
47256     function processQueue(cache) {
47257       if (!cache.queue.length) return Promise.resolve();
47258       const chunk = cache.queue.pop();
47259       return new Promise((resolvePromise, rejectPromise) => {
47260         const handle = window.requestIdleCallback(() => {
47261           delete _deferredRIC[handle];
47262           chunk.forEach((job) => job());
47263           resolvePromise();
47264         });
47265         _deferredRIC[handle] = rejectPromise;
47266       }).then(() => {
47267         if (cache.queue.length % 25 === 0) dispatch14.call("validated");
47268       }).then(() => processQueue(cache));
47269     }
47270     return utilRebind(validator, dispatch14, "on");
47271   }
47272   function validationCache(which) {
47273     let cache = {
47274       which,
47275       graph: null,
47276       queue: [],
47277       queuePromise: null,
47278       queuedEntityIDs: /* @__PURE__ */ new Set(),
47279       provisionalEntityIDs: /* @__PURE__ */ new Set(),
47280       issuesByIssueID: {},
47281       // issue.id -> issue
47282       issuesByEntityID: {}
47283       // entity.id -> Set(issue.id)
47284     };
47285     cache.cacheIssue = (issue) => {
47286       (issue.entityIds || []).forEach((entityID) => {
47287         if (!cache.issuesByEntityID[entityID]) {
47288           cache.issuesByEntityID[entityID] = /* @__PURE__ */ new Set();
47289         }
47290         cache.issuesByEntityID[entityID].add(issue.id);
47291       });
47292       cache.issuesByIssueID[issue.id] = issue;
47293     };
47294     cache.uncacheIssue = (issue) => {
47295       (issue.entityIds || []).forEach((entityID) => {
47296         if (cache.issuesByEntityID[entityID]) {
47297           cache.issuesByEntityID[entityID].delete(issue.id);
47298         }
47299       });
47300       delete cache.issuesByIssueID[issue.id];
47301     };
47302     cache.cacheIssues = (issues) => {
47303       issues.forEach(cache.cacheIssue);
47304     };
47305     cache.uncacheIssues = (issues) => {
47306       issues.forEach(cache.uncacheIssue);
47307     };
47308     cache.uncacheIssuesOfType = (type2) => {
47309       const issuesOfType = Object.values(cache.issuesByIssueID).filter((issue) => issue.type === type2);
47310       cache.uncacheIssues(issuesOfType);
47311     };
47312     cache.uncacheEntityID = (entityID) => {
47313       const entityIssueIDs = cache.issuesByEntityID[entityID];
47314       if (entityIssueIDs) {
47315         entityIssueIDs.forEach((issueID) => {
47316           const issue = cache.issuesByIssueID[issueID];
47317           if (issue) {
47318             cache.uncacheIssue(issue);
47319           } else {
47320             delete cache.issuesByIssueID[issueID];
47321           }
47322         });
47323       }
47324       delete cache.issuesByEntityID[entityID];
47325       cache.provisionalEntityIDs.delete(entityID);
47326     };
47327     cache.withAllRelatedEntities = (entityIDs) => {
47328       let result = /* @__PURE__ */ new Set();
47329       (entityIDs || []).forEach((entityID) => {
47330         result.add(entityID);
47331         const entityIssueIDs = cache.issuesByEntityID[entityID];
47332         if (entityIssueIDs) {
47333           entityIssueIDs.forEach((issueID) => {
47334             const issue = cache.issuesByIssueID[issueID];
47335             if (issue) {
47336               (issue.entityIds || []).forEach((relatedID) => result.add(relatedID));
47337             } else {
47338               delete cache.issuesByIssueID[issueID];
47339             }
47340           });
47341         }
47342       });
47343       return result;
47344     };
47345     return cache;
47346   }
47347   var init_validator = __esm({
47348     "modules/core/validator.js"() {
47349       "use strict";
47350       init_src4();
47351       init_preferences();
47352       init_difference();
47353       init_extent();
47354       init_select5();
47355       init_util();
47356       init_validations();
47357     }
47358   });
47359
47360   // modules/core/uploader.js
47361   var uploader_exports = {};
47362   __export(uploader_exports, {
47363     coreUploader: () => coreUploader
47364   });
47365   function coreUploader(context) {
47366     var dispatch14 = dispatch_default(
47367       // Start and end events are dispatched exactly once each per legitimate outside call to `save`
47368       "saveStarted",
47369       // dispatched as soon as a call to `save` has been deemed legitimate
47370       "saveEnded",
47371       // dispatched after the result event has been dispatched
47372       "willAttemptUpload",
47373       // dispatched before the actual upload call occurs, if it will
47374       "progressChanged",
47375       // Each save results in one of these outcomes:
47376       "resultNoChanges",
47377       // upload wasn't attempted since there were no edits
47378       "resultErrors",
47379       // upload failed due to errors
47380       "resultConflicts",
47381       // upload failed due to data conflicts
47382       "resultSuccess"
47383       // upload completed without errors
47384     );
47385     var _isSaving = false;
47386     let _anyConflictsAutomaticallyResolved = false;
47387     var _conflicts = [];
47388     var _errors = [];
47389     var _origChanges;
47390     var _discardTags = {};
47391     _mainFileFetcher.get("discarded").then(function(d2) {
47392       _discardTags = d2;
47393     }).catch(function() {
47394     });
47395     const uploader = {};
47396     uploader.isSaving = function() {
47397       return _isSaving;
47398     };
47399     uploader.save = function(changeset, tryAgain, checkConflicts) {
47400       if (_isSaving && !tryAgain) {
47401         return;
47402       }
47403       var osm = context.connection();
47404       if (!osm) return;
47405       if (!osm.authenticated()) {
47406         osm.authenticate(function(err) {
47407           if (!err) {
47408             uploader.save(changeset, tryAgain, checkConflicts);
47409           }
47410         });
47411         return;
47412       }
47413       if (!_isSaving) {
47414         _isSaving = true;
47415         dispatch14.call("saveStarted", this);
47416       }
47417       var history = context.history();
47418       _anyConflictsAutomaticallyResolved = false;
47419       _conflicts = [];
47420       _errors = [];
47421       _origChanges = history.changes(actionDiscardTags(history.difference(), _discardTags));
47422       if (!tryAgain) {
47423         history.perform(actionNoop());
47424       }
47425       if (!checkConflicts) {
47426         upload(changeset);
47427       } else {
47428         performFullConflictCheck(changeset);
47429       }
47430     };
47431     function performFullConflictCheck(changeset) {
47432       var osm = context.connection();
47433       if (!osm) return;
47434       var history = context.history();
47435       var localGraph = context.graph();
47436       var remoteGraph = coreGraph(history.base(), true);
47437       var summary = history.difference().summary();
47438       var _toCheck = [];
47439       for (var i3 = 0; i3 < summary.length; i3++) {
47440         var item = summary[i3];
47441         if (item.changeType === "modified") {
47442           _toCheck.push(item.entity.id);
47443         }
47444       }
47445       var _toLoad = withChildNodes(_toCheck, localGraph);
47446       var _loaded = {};
47447       var _toLoadCount = 0;
47448       var _toLoadTotal = _toLoad.length;
47449       if (_toCheck.length) {
47450         dispatch14.call("progressChanged", this, _toLoadCount, _toLoadTotal);
47451         _toLoad.forEach(function(id2) {
47452           _loaded[id2] = false;
47453         });
47454         osm.loadMultiple(_toLoad, loaded);
47455       } else {
47456         upload(changeset);
47457       }
47458       return;
47459       function withChildNodes(ids, graph) {
47460         var s2 = new Set(ids);
47461         ids.forEach(function(id2) {
47462           var entity = graph.entity(id2);
47463           if (entity.type !== "way") return;
47464           graph.childNodes(entity).forEach(function(child) {
47465             if (child.version !== void 0) {
47466               s2.add(child.id);
47467             }
47468           });
47469         });
47470         return Array.from(s2);
47471       }
47472       function loaded(err, result) {
47473         if (_errors.length) return;
47474         if (err) {
47475           _errors.push({
47476             msg: err.message || err.responseText,
47477             details: [_t("save.status_code", { code: err.status })]
47478           });
47479           didResultInErrors();
47480         } else {
47481           var loadMore = [];
47482           result.data.forEach(function(entity) {
47483             remoteGraph.replace(entity);
47484             _loaded[entity.id] = true;
47485             _toLoad = _toLoad.filter(function(val) {
47486               return val !== entity.id;
47487             });
47488             if (!entity.visible) return;
47489             var i4, id2;
47490             if (entity.type === "way") {
47491               for (i4 = 0; i4 < entity.nodes.length; i4++) {
47492                 id2 = entity.nodes[i4];
47493                 if (_loaded[id2] === void 0) {
47494                   _loaded[id2] = false;
47495                   loadMore.push(id2);
47496                 }
47497               }
47498             } else if (entity.type === "relation" && entity.isMultipolygon()) {
47499               for (i4 = 0; i4 < entity.members.length; i4++) {
47500                 id2 = entity.members[i4].id;
47501                 if (_loaded[id2] === void 0) {
47502                   _loaded[id2] = false;
47503                   loadMore.push(id2);
47504                 }
47505               }
47506             }
47507           });
47508           _toLoadCount += result.data.length;
47509           _toLoadTotal += loadMore.length;
47510           dispatch14.call("progressChanged", this, _toLoadCount, _toLoadTotal);
47511           if (loadMore.length) {
47512             _toLoad.push.apply(_toLoad, loadMore);
47513             osm.loadMultiple(loadMore, loaded);
47514           }
47515           if (!_toLoad.length) {
47516             detectConflicts();
47517             upload(changeset);
47518           }
47519         }
47520       }
47521       function detectConflicts() {
47522         function choice(id2, text, action) {
47523           return {
47524             id: id2,
47525             text,
47526             action: function() {
47527               history.replace(action);
47528             }
47529           };
47530         }
47531         function formatUser(d2) {
47532           return '<a href="' + osm.userURL(d2) + '" target="_blank">' + escape_default(d2) + "</a>";
47533         }
47534         function entityName(entity) {
47535           return utilDisplayName(entity) || utilDisplayType(entity.id) + " " + entity.id;
47536         }
47537         function sameVersions(local, remote) {
47538           if (local.version !== remote.version) return false;
47539           if (local.type === "way") {
47540             var children2 = utilArrayUnion(local.nodes, remote.nodes);
47541             for (var i4 = 0; i4 < children2.length; i4++) {
47542               var a2 = localGraph.hasEntity(children2[i4]);
47543               var b2 = remoteGraph.hasEntity(children2[i4]);
47544               if (a2 && b2 && a2.version !== b2.version) return false;
47545             }
47546           }
47547           return true;
47548         }
47549         _toCheck.forEach(function(id2) {
47550           var local = localGraph.entity(id2);
47551           var remote = remoteGraph.entity(id2);
47552           if (sameVersions(local, remote)) return;
47553           var merge3 = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags, formatUser);
47554           history.replace(merge3);
47555           var mergeConflicts = merge3.conflicts();
47556           if (!mergeConflicts.length) {
47557             _anyConflictsAutomaticallyResolved = true;
47558             return;
47559           }
47560           var forceLocal = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags).withOption("force_local");
47561           var forceRemote = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags).withOption("force_remote");
47562           var keepMine = _t("save.conflict." + (remote.visible ? "keep_local" : "restore"));
47563           var keepTheirs = _t("save.conflict." + (remote.visible ? "keep_remote" : "delete"));
47564           _conflicts.push({
47565             id: id2,
47566             name: entityName(local),
47567             details: mergeConflicts,
47568             chosen: 1,
47569             choices: [
47570               choice(id2, keepMine, forceLocal),
47571               choice(id2, keepTheirs, forceRemote)
47572             ]
47573           });
47574         });
47575       }
47576     }
47577     async function upload(changeset) {
47578       var osm = context.connection();
47579       if (!osm) {
47580         _errors.push({ msg: "No OSM Service" });
47581       }
47582       if (_conflicts.length) {
47583         didResultInConflicts(changeset);
47584       } else if (_errors.length) {
47585         didResultInErrors();
47586       } else {
47587         if (_anyConflictsAutomaticallyResolved) {
47588           changeset.tags.merge_conflict_resolved = "automatically";
47589           await osm.updateChangesetTags(changeset);
47590         }
47591         var history = context.history();
47592         var changes = history.changes(actionDiscardTags(history.difference(), _discardTags));
47593         if (changes.modified.length || changes.created.length || changes.deleted.length) {
47594           dispatch14.call("willAttemptUpload", this);
47595           osm.putChangeset(changeset, changes, uploadCallback);
47596         } else {
47597           didResultInNoChanges();
47598         }
47599       }
47600     }
47601     function uploadCallback(err, changeset) {
47602       if (err) {
47603         if (err.status === 409) {
47604           uploader.save(changeset, true, true);
47605         } else {
47606           _errors.push({
47607             msg: err.message || err.responseText,
47608             details: [_t("save.status_code", { code: err.status })]
47609           });
47610           didResultInErrors();
47611         }
47612       } else {
47613         didResultInSuccess(changeset);
47614       }
47615     }
47616     function didResultInNoChanges() {
47617       dispatch14.call("resultNoChanges", this);
47618       endSave();
47619       context.flush();
47620     }
47621     function didResultInErrors() {
47622       context.history().pop();
47623       dispatch14.call("resultErrors", this, _errors);
47624       endSave();
47625     }
47626     function didResultInConflicts(changeset) {
47627       changeset.tags.merge_conflict_resolved = "manually";
47628       context.connection().updateChangesetTags(changeset);
47629       _conflicts.sort(function(a2, b2) {
47630         return b2.id.localeCompare(a2.id);
47631       });
47632       dispatch14.call("resultConflicts", this, changeset, _conflicts, _origChanges);
47633       endSave();
47634     }
47635     function didResultInSuccess(changeset) {
47636       context.history().clearSaved();
47637       dispatch14.call("resultSuccess", this, changeset);
47638       window.setTimeout(function() {
47639         endSave();
47640         context.flush();
47641       }, 2500);
47642     }
47643     function endSave() {
47644       _isSaving = false;
47645       dispatch14.call("saveEnded", this);
47646     }
47647     uploader.cancelConflictResolution = function() {
47648       context.history().pop();
47649     };
47650     uploader.processResolvedConflicts = function(changeset) {
47651       var history = context.history();
47652       for (var i3 = 0; i3 < _conflicts.length; i3++) {
47653         if (_conflicts[i3].chosen === 1) {
47654           var entity = context.hasEntity(_conflicts[i3].id);
47655           if (entity && entity.type === "way") {
47656             var children2 = utilArrayUniq(entity.nodes);
47657             for (var j2 = 0; j2 < children2.length; j2++) {
47658               history.replace(actionRevert(children2[j2]));
47659             }
47660           }
47661           history.replace(actionRevert(_conflicts[i3].id));
47662         }
47663       }
47664       uploader.save(changeset, true, false);
47665     };
47666     uploader.reset = function() {
47667     };
47668     return utilRebind(uploader, dispatch14, "on");
47669   }
47670   var init_uploader = __esm({
47671     "modules/core/uploader.js"() {
47672       "use strict";
47673       init_src4();
47674       init_lodash();
47675       init_file_fetcher();
47676       init_discard_tags();
47677       init_merge_remote_changes();
47678       init_noop2();
47679       init_revert();
47680       init_graph();
47681       init_localizer();
47682       init_util();
47683     }
47684   });
47685
47686   // modules/modes/draw_area.js
47687   var draw_area_exports = {};
47688   __export(draw_area_exports, {
47689     modeDrawArea: () => modeDrawArea
47690   });
47691   function modeDrawArea(context, wayID, startGraph, button) {
47692     var mode = {
47693       button,
47694       id: "draw-area"
47695     };
47696     var behavior = behaviorDrawWay(context, wayID, mode, startGraph).on("rejectedSelfIntersection.modeDrawArea", function() {
47697       context.ui().flash.iconName("#iD-icon-no").label(_t.append("self_intersection.error.areas"))();
47698     });
47699     mode.wayID = wayID;
47700     mode.enter = function() {
47701       context.install(behavior);
47702     };
47703     mode.exit = function() {
47704       context.uninstall(behavior);
47705     };
47706     mode.selectedIDs = function() {
47707       return [wayID];
47708     };
47709     mode.activeID = function() {
47710       return behavior && behavior.activeID() || [];
47711     };
47712     return mode;
47713   }
47714   var init_draw_area = __esm({
47715     "modules/modes/draw_area.js"() {
47716       "use strict";
47717       init_localizer();
47718       init_draw_way();
47719     }
47720   });
47721
47722   // modules/modes/add_area.js
47723   var add_area_exports = {};
47724   __export(add_area_exports, {
47725     modeAddArea: () => modeAddArea
47726   });
47727   function modeAddArea(context, mode) {
47728     mode.id = "add-area";
47729     var behavior = behaviorAddWay(context).on("start", start2).on("startFromWay", startFromWay).on("startFromNode", startFromNode);
47730     function defaultTags(loc) {
47731       var defaultTags2 = { area: "yes" };
47732       if (mode.preset) defaultTags2 = mode.preset.setTags(defaultTags2, "area", false, loc);
47733       return defaultTags2;
47734     }
47735     function actionClose(wayId) {
47736       return function(graph) {
47737         return graph.replace(graph.entity(wayId).close());
47738       };
47739     }
47740     function start2(loc) {
47741       var startGraph = context.graph();
47742       var node = osmNode({ loc });
47743       var way = osmWay({ tags: defaultTags(loc) });
47744       context.perform(
47745         actionAddEntity(node),
47746         actionAddEntity(way),
47747         actionAddVertex(way.id, node.id),
47748         actionClose(way.id)
47749       );
47750       context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
47751     }
47752     function startFromWay(loc, edge) {
47753       var startGraph = context.graph();
47754       var node = osmNode({ loc });
47755       var way = osmWay({ tags: defaultTags(loc) });
47756       context.perform(
47757         actionAddEntity(node),
47758         actionAddEntity(way),
47759         actionAddVertex(way.id, node.id),
47760         actionClose(way.id),
47761         actionAddMidpoint({ loc, edge }, node)
47762       );
47763       context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
47764     }
47765     function startFromNode(node) {
47766       var startGraph = context.graph();
47767       var way = osmWay({ tags: defaultTags(node.loc) });
47768       context.perform(
47769         actionAddEntity(way),
47770         actionAddVertex(way.id, node.id),
47771         actionClose(way.id)
47772       );
47773       context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
47774     }
47775     mode.enter = function() {
47776       context.install(behavior);
47777     };
47778     mode.exit = function() {
47779       context.uninstall(behavior);
47780     };
47781     return mode;
47782   }
47783   var init_add_area = __esm({
47784     "modules/modes/add_area.js"() {
47785       "use strict";
47786       init_add_entity();
47787       init_add_midpoint();
47788       init_add_vertex();
47789       init_add_way();
47790       init_draw_area();
47791       init_osm();
47792     }
47793   });
47794
47795   // modules/modes/add_line.js
47796   var add_line_exports = {};
47797   __export(add_line_exports, {
47798     modeAddLine: () => modeAddLine
47799   });
47800   function modeAddLine(context, mode) {
47801     mode.id = "add-line";
47802     var behavior = behaviorAddWay(context).on("start", start2).on("startFromWay", startFromWay).on("startFromNode", startFromNode);
47803     function defaultTags(loc) {
47804       var defaultTags2 = {};
47805       if (mode.preset) defaultTags2 = mode.preset.setTags(defaultTags2, "line", false, loc);
47806       return defaultTags2;
47807     }
47808     function start2(loc) {
47809       var startGraph = context.graph();
47810       var node = osmNode({ loc });
47811       var way = osmWay({ tags: defaultTags(loc) });
47812       context.perform(
47813         actionAddEntity(node),
47814         actionAddEntity(way),
47815         actionAddVertex(way.id, node.id)
47816       );
47817       context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
47818     }
47819     function startFromWay(loc, edge) {
47820       var startGraph = context.graph();
47821       var node = osmNode({ loc });
47822       var way = osmWay({ tags: defaultTags(loc) });
47823       context.perform(
47824         actionAddEntity(node),
47825         actionAddEntity(way),
47826         actionAddVertex(way.id, node.id),
47827         actionAddMidpoint({ loc, edge }, node)
47828       );
47829       context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
47830     }
47831     function startFromNode(node) {
47832       var startGraph = context.graph();
47833       var way = osmWay({ tags: defaultTags(node.loc) });
47834       context.perform(
47835         actionAddEntity(way),
47836         actionAddVertex(way.id, node.id)
47837       );
47838       context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
47839     }
47840     mode.enter = function() {
47841       context.install(behavior);
47842     };
47843     mode.exit = function() {
47844       context.uninstall(behavior);
47845     };
47846     return mode;
47847   }
47848   var init_add_line = __esm({
47849     "modules/modes/add_line.js"() {
47850       "use strict";
47851       init_add_entity();
47852       init_add_midpoint();
47853       init_add_vertex();
47854       init_add_way();
47855       init_draw_line();
47856       init_osm();
47857     }
47858   });
47859
47860   // modules/modes/add_point.js
47861   var add_point_exports = {};
47862   __export(add_point_exports, {
47863     modeAddPoint: () => modeAddPoint
47864   });
47865   function modeAddPoint(context, mode) {
47866     mode.id = "add-point";
47867     var behavior = behaviorDraw(context).on("click", add).on("clickWay", addWay).on("clickNode", addNode).on("cancel", cancel).on("finish", cancel);
47868     function defaultTags(loc) {
47869       var defaultTags2 = {};
47870       if (mode.preset) defaultTags2 = mode.preset.setTags(defaultTags2, "point", false, loc);
47871       return defaultTags2;
47872     }
47873     function add(loc) {
47874       var node = osmNode({ loc, tags: defaultTags(loc) });
47875       context.perform(
47876         actionAddEntity(node),
47877         _t("operations.add.annotation.point")
47878       );
47879       enterSelectMode(node);
47880     }
47881     function addWay(loc, edge) {
47882       var node = osmNode({ tags: defaultTags(loc) });
47883       context.perform(
47884         actionAddMidpoint({ loc, edge }, node),
47885         _t("operations.add.annotation.vertex")
47886       );
47887       enterSelectMode(node);
47888     }
47889     function enterSelectMode(node) {
47890       context.enter(
47891         modeSelect(context, [node.id]).newFeature(true)
47892       );
47893     }
47894     function addNode(node) {
47895       const _defaultTags = defaultTags(node.loc);
47896       if (Object.keys(_defaultTags).length === 0) {
47897         enterSelectMode(node);
47898         return;
47899       }
47900       var tags = Object.assign({}, node.tags);
47901       for (var key in _defaultTags) {
47902         tags[key] = _defaultTags[key];
47903       }
47904       context.perform(
47905         actionChangeTags(node.id, tags),
47906         _t("operations.add.annotation.point")
47907       );
47908       enterSelectMode(node);
47909     }
47910     function cancel() {
47911       context.enter(modeBrowse(context));
47912     }
47913     mode.enter = function() {
47914       context.install(behavior);
47915     };
47916     mode.exit = function() {
47917       context.uninstall(behavior);
47918     };
47919     return mode;
47920   }
47921   var init_add_point = __esm({
47922     "modules/modes/add_point.js"() {
47923       "use strict";
47924       init_localizer();
47925       init_draw();
47926       init_browse();
47927       init_select5();
47928       init_node2();
47929       init_add_entity();
47930       init_change_tags();
47931       init_add_midpoint();
47932     }
47933   });
47934
47935   // modules/ui/note_comments.js
47936   var note_comments_exports = {};
47937   __export(note_comments_exports, {
47938     uiNoteComments: () => uiNoteComments
47939   });
47940   function uiNoteComments() {
47941     var _note;
47942     function noteComments(selection2) {
47943       if (_note.isNew()) return;
47944       var comments = selection2.selectAll(".comments-container").data([0]);
47945       comments = comments.enter().append("div").attr("class", "comments-container").merge(comments);
47946       var commentEnter = comments.selectAll(".comment").data(_note.comments).enter().append("div").attr("class", "comment");
47947       commentEnter.append("div").attr("class", function(d2) {
47948         return "comment-avatar user-" + d2.uid;
47949       }).call(svgIcon("#iD-icon-avatar", "comment-avatar-icon"));
47950       var mainEnter = commentEnter.append("div").attr("class", "comment-main");
47951       var metadataEnter = mainEnter.append("div").attr("class", "comment-metadata");
47952       metadataEnter.append("div").attr("class", "comment-author").each(function(d2) {
47953         var selection3 = select_default2(this);
47954         var osm = services.osm;
47955         if (osm && d2.user) {
47956           selection3 = selection3.append("a").attr("class", "comment-author-link").attr("href", osm.userURL(d2.user)).attr("target", "_blank");
47957         }
47958         if (d2.user) {
47959           selection3.text(d2.user);
47960         } else {
47961           selection3.call(_t.append("note.anonymous"));
47962         }
47963       });
47964       metadataEnter.append("div").attr("class", "comment-date").html(function(d2) {
47965         return _t.html("note.status." + d2.action, { when: localeDateString2(d2.date) });
47966       });
47967       mainEnter.append("div").attr("class", "comment-text").html(function(d2) {
47968         return d2.html;
47969       }).selectAll("a").attr("rel", "noopener nofollow").attr("target", "_blank");
47970       comments.call(replaceAvatars);
47971     }
47972     function replaceAvatars(selection2) {
47973       var showThirdPartyIcons = corePreferences("preferences.privacy.thirdpartyicons") || "true";
47974       var osm = services.osm;
47975       if (showThirdPartyIcons !== "true" || !osm) return;
47976       var uids = {};
47977       _note.comments.forEach(function(d2) {
47978         if (d2.uid) uids[d2.uid] = true;
47979       });
47980       Object.keys(uids).forEach(function(uid) {
47981         osm.loadUser(uid, function(err, user) {
47982           if (!user || !user.image_url) return;
47983           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);
47984         });
47985       });
47986     }
47987     function localeDateString2(s2) {
47988       if (!s2) return null;
47989       var options2 = { day: "numeric", month: "short", year: "numeric" };
47990       s2 = s2.replace(/-/g, "/");
47991       var d2 = new Date(s2);
47992       if (isNaN(d2.getTime())) return null;
47993       return d2.toLocaleDateString(_mainLocalizer.localeCode(), options2);
47994     }
47995     noteComments.note = function(val) {
47996       if (!arguments.length) return _note;
47997       _note = val;
47998       return noteComments;
47999     };
48000     return noteComments;
48001   }
48002   var init_note_comments = __esm({
48003     "modules/ui/note_comments.js"() {
48004       "use strict";
48005       init_src5();
48006       init_preferences();
48007       init_localizer();
48008       init_icon();
48009       init_services();
48010     }
48011   });
48012
48013   // modules/ui/note_header.js
48014   var note_header_exports = {};
48015   __export(note_header_exports, {
48016     uiNoteHeader: () => uiNoteHeader
48017   });
48018   function uiNoteHeader() {
48019     var _note;
48020     function noteHeader(selection2) {
48021       var header = selection2.selectAll(".note-header").data(
48022         _note ? [_note] : [],
48023         function(d2) {
48024           return d2.status + d2.id;
48025         }
48026       );
48027       header.exit().remove();
48028       var headerEnter = header.enter().append("div").attr("class", "note-header");
48029       var iconEnter = headerEnter.append("div").attr("class", function(d2) {
48030         return "note-header-icon " + d2.status;
48031       }).classed("new", function(d2) {
48032         return d2.id < 0;
48033       });
48034       iconEnter.append("div").attr("class", "preset-icon-28").call(svgIcon("#iD-icon-note", "note-fill"));
48035       iconEnter.each(function(d2) {
48036         var statusIcon;
48037         if (d2.id < 0) {
48038           statusIcon = "#iD-icon-plus";
48039         } else if (d2.status === "open") {
48040           statusIcon = "#iD-icon-close";
48041         } else {
48042           statusIcon = "#iD-icon-apply";
48043         }
48044         iconEnter.append("div").attr("class", "note-icon-annotation").attr("title", _t("icons.close")).call(svgIcon(statusIcon, "icon-annotation"));
48045       });
48046       headerEnter.append("div").attr("class", "note-header-label").html(function(d2) {
48047         if (_note.isNew()) {
48048           return _t.html("note.new");
48049         }
48050         return _t.html("note.note") + " " + d2.id + " " + (d2.status === "closed" ? _t.html("note.closed") : "");
48051       });
48052     }
48053     noteHeader.note = function(val) {
48054       if (!arguments.length) return _note;
48055       _note = val;
48056       return noteHeader;
48057     };
48058     return noteHeader;
48059   }
48060   var init_note_header = __esm({
48061     "modules/ui/note_header.js"() {
48062       "use strict";
48063       init_localizer();
48064       init_icon();
48065     }
48066   });
48067
48068   // modules/ui/note_report.js
48069   var note_report_exports = {};
48070   __export(note_report_exports, {
48071     uiNoteReport: () => uiNoteReport
48072   });
48073   function uiNoteReport() {
48074     var _note;
48075     function noteReport(selection2) {
48076       var url;
48077       if (services.osm && _note instanceof osmNote && !_note.isNew()) {
48078         url = services.osm.noteReportURL(_note);
48079       }
48080       var link3 = selection2.selectAll(".note-report").data(url ? [url] : []);
48081       link3.exit().remove();
48082       var linkEnter = link3.enter().append("a").attr("class", "note-report").attr("target", "_blank").attr("href", function(d2) {
48083         return d2;
48084       }).call(svgIcon("#iD-icon-out-link", "inline"));
48085       linkEnter.append("span").call(_t.append("note.report"));
48086     }
48087     noteReport.note = function(val) {
48088       if (!arguments.length) return _note;
48089       _note = val;
48090       return noteReport;
48091     };
48092     return noteReport;
48093   }
48094   var init_note_report = __esm({
48095     "modules/ui/note_report.js"() {
48096       "use strict";
48097       init_localizer();
48098       init_osm();
48099       init_services();
48100       init_icon();
48101     }
48102   });
48103
48104   // modules/ui/view_on_osm.js
48105   var view_on_osm_exports = {};
48106   __export(view_on_osm_exports, {
48107     uiViewOnOSM: () => uiViewOnOSM
48108   });
48109   function uiViewOnOSM(context) {
48110     var _what;
48111     function viewOnOSM(selection2) {
48112       var url;
48113       if (_what instanceof osmEntity) {
48114         url = context.connection().entityURL(_what);
48115       } else if (_what instanceof osmNote) {
48116         url = context.connection().noteURL(_what);
48117       }
48118       var data = !_what || _what.isNew() ? [] : [_what];
48119       var link3 = selection2.selectAll(".view-on-osm").data(data, function(d2) {
48120         return d2.id;
48121       });
48122       link3.exit().remove();
48123       var linkEnter = link3.enter().append("a").attr("class", "view-on-osm").attr("target", "_blank").attr("href", url).call(svgIcon("#iD-icon-out-link", "inline"));
48124       linkEnter.append("span").call(_t.append("inspector.view_on_osm"));
48125     }
48126     viewOnOSM.what = function(_2) {
48127       if (!arguments.length) return _what;
48128       _what = _2;
48129       return viewOnOSM;
48130     };
48131     return viewOnOSM;
48132   }
48133   var init_view_on_osm = __esm({
48134     "modules/ui/view_on_osm.js"() {
48135       "use strict";
48136       init_localizer();
48137       init_osm();
48138       init_icon();
48139     }
48140   });
48141
48142   // modules/ui/note_editor.js
48143   var note_editor_exports = {};
48144   __export(note_editor_exports, {
48145     uiNoteEditor: () => uiNoteEditor
48146   });
48147   function uiNoteEditor(context) {
48148     var dispatch14 = dispatch_default("change");
48149     var noteComments = uiNoteComments(context);
48150     var noteHeader = uiNoteHeader();
48151     var _note;
48152     var _newNote;
48153     function noteEditor(selection2) {
48154       var header = selection2.selectAll(".header").data([0]);
48155       var headerEnter = header.enter().append("div").attr("class", "header fillL");
48156       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
48157         context.enter(modeBrowse(context));
48158       }).call(svgIcon("#iD-icon-close"));
48159       headerEnter.append("h2").call(_t.append("note.title"));
48160       var body = selection2.selectAll(".body").data([0]);
48161       body = body.enter().append("div").attr("class", "body").merge(body);
48162       var editor = body.selectAll(".note-editor").data([0]);
48163       editor.enter().append("div").attr("class", "modal-section note-editor").merge(editor).call(noteHeader.note(_note)).call(noteComments.note(_note)).call(noteSaveSection);
48164       var footer = selection2.selectAll(".footer").data([0]);
48165       footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnOSM(context).what(_note)).call(uiNoteReport(context).note(_note));
48166       var osm = services.osm;
48167       if (osm) {
48168         osm.on("change.note-save", function() {
48169           selection2.call(noteEditor);
48170         });
48171       }
48172     }
48173     function noteSaveSection(selection2) {
48174       var isSelected = _note && _note.id === context.selectedNoteID();
48175       var noteSave = selection2.selectAll(".note-save").data(isSelected ? [_note] : [], function(d2) {
48176         return d2.status + d2.id;
48177       });
48178       noteSave.exit().remove();
48179       var noteSaveEnter = noteSave.enter().append("div").attr("class", "note-save save-section cf");
48180       noteSaveEnter.append("h4").attr("class", ".note-save-header").text("").each(function() {
48181         if (_note.isNew()) {
48182           _t.append("note.newDescription")(select_default2(this));
48183         } else {
48184           _t.append("note.newComment")(select_default2(this));
48185         }
48186       });
48187       var commentTextarea = noteSaveEnter.append("textarea").attr("class", "new-comment-input").attr("placeholder", _t("note.inputPlaceholder")).attr("maxlength", 1e3).property("value", function(d2) {
48188         return d2.newComment;
48189       }).call(utilNoAuto).on("keydown.note-input", keydown).on("input.note-input", changeInput).on("blur.note-input", changeInput);
48190       if (!commentTextarea.empty() && _newNote) {
48191         commentTextarea.node().focus();
48192       }
48193       noteSave = noteSaveEnter.merge(noteSave).call(userDetails).call(noteSaveButtons);
48194       function keydown(d3_event) {
48195         if (!(d3_event.keyCode === 13 && // ↩ Return
48196         d3_event.metaKey)) return;
48197         var osm = services.osm;
48198         if (!osm) return;
48199         var hasAuth = osm.authenticated();
48200         if (!hasAuth) return;
48201         if (!_note.newComment) return;
48202         d3_event.preventDefault();
48203         select_default2(this).on("keydown.note-input", null);
48204         window.setTimeout(function() {
48205           if (_note.isNew()) {
48206             noteSave.selectAll(".save-button").node().focus();
48207             clickSave(_note);
48208           } else {
48209             noteSave.selectAll(".comment-button").node().focus();
48210             clickComment(_note);
48211           }
48212         }, 10);
48213       }
48214       function changeInput() {
48215         var input = select_default2(this);
48216         var val = input.property("value").trim() || void 0;
48217         _note = _note.update({ newComment: val });
48218         var osm = services.osm;
48219         if (osm) {
48220           osm.replaceNote(_note);
48221         }
48222         noteSave.call(noteSaveButtons);
48223       }
48224     }
48225     function userDetails(selection2) {
48226       var detailSection = selection2.selectAll(".detail-section").data([0]);
48227       detailSection = detailSection.enter().append("div").attr("class", "detail-section").merge(detailSection);
48228       var osm = services.osm;
48229       if (!osm) return;
48230       var hasAuth = osm.authenticated();
48231       var authWarning = detailSection.selectAll(".auth-warning").data(hasAuth ? [] : [0]);
48232       authWarning.exit().transition().duration(200).style("opacity", 0).remove();
48233       var authEnter = authWarning.enter().insert("div", ".tag-reference-body").attr("class", "field-warning auth-warning").style("opacity", 0);
48234       authEnter.call(svgIcon("#iD-icon-alert", "inline"));
48235       authEnter.append("span").call(_t.append("note.login"));
48236       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) {
48237         d3_event.preventDefault();
48238         osm.authenticate();
48239       });
48240       authEnter.transition().duration(200).style("opacity", 1);
48241       var prose = detailSection.selectAll(".note-save-prose").data(hasAuth ? [0] : []);
48242       prose.exit().remove();
48243       prose = prose.enter().append("p").attr("class", "note-save-prose").call(_t.append("note.upload_explanation")).merge(prose);
48244       osm.userDetails(function(err, user) {
48245         if (err) return;
48246         var userLink = select_default2(document.createElement("div"));
48247         if (user.image_url) {
48248           userLink.append("img").attr("src", user.image_url).attr("class", "icon pre-text user-icon");
48249         }
48250         userLink.append("a").attr("class", "user-info").text(user.display_name).attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
48251         prose.html(_t.html("note.upload_explanation_with_user", { user: { html: userLink.html() } }));
48252       });
48253     }
48254     function noteSaveButtons(selection2) {
48255       var osm = services.osm;
48256       var hasAuth = osm && osm.authenticated();
48257       var isSelected = _note && _note.id === context.selectedNoteID();
48258       var buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_note] : [], function(d2) {
48259         return d2.status + d2.id;
48260       });
48261       buttonSection.exit().remove();
48262       var buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
48263       if (_note.isNew()) {
48264         buttonEnter.append("button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
48265         buttonEnter.append("button").attr("class", "button save-button action").call(_t.append("note.save"));
48266       } else {
48267         buttonEnter.append("button").attr("class", "button status-button action");
48268         buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("note.comment"));
48269       }
48270       buttonSection = buttonSection.merge(buttonEnter);
48271       buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
48272       buttonSection.select(".save-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
48273       buttonSection.select(".status-button").attr("disabled", hasAuth ? null : true).each(function(d2) {
48274         var action = d2.status === "open" ? "close" : "open";
48275         var andComment = d2.newComment ? "_comment" : "";
48276         _t.addOrUpdate("note." + action + andComment)(select_default2(this));
48277       }).on("click.status", clickStatus);
48278       buttonSection.select(".comment-button").attr("disabled", isSaveDisabled).on("click.comment", clickComment);
48279       function isSaveDisabled(d2) {
48280         return hasAuth && d2.status === "open" && d2.newComment ? null : true;
48281       }
48282     }
48283     function clickCancel(d3_event, d2) {
48284       this.blur();
48285       var osm = services.osm;
48286       if (osm) {
48287         osm.removeNote(d2);
48288       }
48289       context.enter(modeBrowse(context));
48290       dispatch14.call("change");
48291     }
48292     function clickSave(d3_event, d2) {
48293       this.blur();
48294       var osm = services.osm;
48295       if (osm) {
48296         osm.postNoteCreate(d2, function(err, note) {
48297           dispatch14.call("change", note);
48298         });
48299       }
48300     }
48301     function clickStatus(d3_event, d2) {
48302       this.blur();
48303       var osm = services.osm;
48304       if (osm) {
48305         var setStatus = d2.status === "open" ? "closed" : "open";
48306         osm.postNoteUpdate(d2, setStatus, function(err, note) {
48307           dispatch14.call("change", note);
48308         });
48309       }
48310     }
48311     function clickComment(d3_event, d2) {
48312       this.blur();
48313       var osm = services.osm;
48314       if (osm) {
48315         osm.postNoteUpdate(d2, d2.status, function(err, note) {
48316           dispatch14.call("change", note);
48317         });
48318       }
48319     }
48320     noteEditor.note = function(val) {
48321       if (!arguments.length) return _note;
48322       _note = val;
48323       return noteEditor;
48324     };
48325     noteEditor.newNote = function(val) {
48326       if (!arguments.length) return _newNote;
48327       _newNote = val;
48328       return noteEditor;
48329     };
48330     return utilRebind(noteEditor, dispatch14, "on");
48331   }
48332   var init_note_editor = __esm({
48333     "modules/ui/note_editor.js"() {
48334       "use strict";
48335       init_src4();
48336       init_src5();
48337       init_localizer();
48338       init_services();
48339       init_browse();
48340       init_icon();
48341       init_note_comments();
48342       init_note_header();
48343       init_note_report();
48344       init_view_on_osm();
48345       init_util();
48346     }
48347   });
48348
48349   // modules/modes/select_note.js
48350   var select_note_exports = {};
48351   __export(select_note_exports, {
48352     modeSelectNote: () => modeSelectNote
48353   });
48354   function modeSelectNote(context, selectedNoteID) {
48355     var mode = {
48356       id: "select-note",
48357       button: "browse"
48358     };
48359     var _keybinding = utilKeybinding("select-note");
48360     var _noteEditor = uiNoteEditor(context).on("change", function() {
48361       context.map().pan([0, 0]);
48362       var note = checkSelectedID();
48363       if (!note) return;
48364       context.ui().sidebar.show(_noteEditor.note(note));
48365     });
48366     var _behaviors = [
48367       behaviorBreathe(context),
48368       behaviorHover(context),
48369       behaviorSelect(context),
48370       behaviorLasso(context),
48371       modeDragNode(context).behavior,
48372       modeDragNote(context).behavior
48373     ];
48374     var _newFeature = false;
48375     function checkSelectedID() {
48376       if (!services.osm) return;
48377       var note = services.osm.getNote(selectedNoteID);
48378       if (!note) {
48379         context.enter(modeBrowse(context));
48380       }
48381       return note;
48382     }
48383     function selectNote(d3_event, drawn) {
48384       if (!checkSelectedID()) return;
48385       var selection2 = context.surface().selectAll(".layer-notes .note-" + selectedNoteID);
48386       if (selection2.empty()) {
48387         var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
48388         if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
48389           context.enter(modeBrowse(context));
48390         }
48391       } else {
48392         selection2.classed("selected", true);
48393         context.selectedNoteID(selectedNoteID);
48394       }
48395     }
48396     function esc() {
48397       if (context.container().select(".combobox").size()) return;
48398       context.enter(modeBrowse(context));
48399     }
48400     mode.zoomToSelected = function() {
48401       if (!services.osm) return;
48402       var note = services.osm.getNote(selectedNoteID);
48403       if (note) {
48404         context.map().centerZoomEase(note.loc, 20);
48405       }
48406     };
48407     mode.newFeature = function(val) {
48408       if (!arguments.length) return _newFeature;
48409       _newFeature = val;
48410       return mode;
48411     };
48412     mode.enter = function() {
48413       var note = checkSelectedID();
48414       if (!note) return;
48415       _behaviors.forEach(context.install);
48416       _keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
48417       select_default2(document).call(_keybinding);
48418       selectNote();
48419       var sidebar = context.ui().sidebar;
48420       sidebar.show(_noteEditor.note(note).newNote(_newFeature));
48421       sidebar.expand(sidebar.intersects(note.extent()));
48422       context.map().on("drawn.select", selectNote);
48423     };
48424     mode.exit = function() {
48425       _behaviors.forEach(context.uninstall);
48426       select_default2(document).call(_keybinding.unbind);
48427       context.surface().selectAll(".layer-notes .selected").classed("selected hover", false);
48428       context.map().on("drawn.select", null);
48429       context.ui().sidebar.hide();
48430       context.selectedNoteID(null);
48431     };
48432     return mode;
48433   }
48434   var init_select_note = __esm({
48435     "modules/modes/select_note.js"() {
48436       "use strict";
48437       init_src5();
48438       init_breathe();
48439       init_hover();
48440       init_lasso2();
48441       init_select4();
48442       init_localizer();
48443       init_browse();
48444       init_drag_node();
48445       init_drag_note();
48446       init_services();
48447       init_note_editor();
48448       init_util();
48449     }
48450   });
48451
48452   // modules/modes/add_note.js
48453   var add_note_exports = {};
48454   __export(add_note_exports, {
48455     modeAddNote: () => modeAddNote
48456   });
48457   function modeAddNote(context) {
48458     var mode = {
48459       id: "add-note",
48460       button: "note",
48461       description: _t.append("modes.add_note.description"),
48462       key: _t("modes.add_note.key")
48463     };
48464     var behavior = behaviorDraw(context).on("click", add).on("cancel", cancel).on("finish", cancel);
48465     function add(loc) {
48466       var osm = services.osm;
48467       if (!osm) return;
48468       var note = osmNote({ loc, status: "open", comments: [] });
48469       osm.replaceNote(note);
48470       context.map().pan([0, 0]);
48471       context.selectedNoteID(note.id).enter(modeSelectNote(context, note.id).newFeature(true));
48472     }
48473     function cancel() {
48474       context.enter(modeBrowse(context));
48475     }
48476     mode.enter = function() {
48477       context.install(behavior);
48478     };
48479     mode.exit = function() {
48480       context.uninstall(behavior);
48481     };
48482     return mode;
48483   }
48484   var init_add_note = __esm({
48485     "modules/modes/add_note.js"() {
48486       "use strict";
48487       init_localizer();
48488       init_draw();
48489       init_browse();
48490       init_select_note();
48491       init_osm();
48492       init_services();
48493     }
48494   });
48495
48496   // modules/util/jxon.js
48497   var jxon_exports = {};
48498   __export(jxon_exports, {
48499     JXON: () => JXON
48500   });
48501   var JXON;
48502   var init_jxon = __esm({
48503     "modules/util/jxon.js"() {
48504       "use strict";
48505       JXON = new function() {
48506         var sValueProp = "keyValue", sAttributesProp = "keyAttributes", sAttrPref = "@", aCache = [], rIsNull = /^\s*$/, rIsBool = /^(?:true|false)$/i;
48507         function parseText(sValue) {
48508           if (rIsNull.test(sValue)) {
48509             return null;
48510           }
48511           if (rIsBool.test(sValue)) {
48512             return sValue.toLowerCase() === "true";
48513           }
48514           if (isFinite(sValue)) {
48515             return parseFloat(sValue);
48516           }
48517           if (isFinite(Date.parse(sValue))) {
48518             return new Date(sValue);
48519           }
48520           return sValue;
48521         }
48522         function EmptyTree() {
48523         }
48524         EmptyTree.prototype.toString = function() {
48525           return "null";
48526         };
48527         EmptyTree.prototype.valueOf = function() {
48528           return null;
48529         };
48530         function objectify(vValue) {
48531           return vValue === null ? new EmptyTree() : vValue instanceof Object ? vValue : new vValue.constructor(vValue);
48532         }
48533         function createObjTree(oParentNode, nVerb, bFreeze, bNesteAttr) {
48534           var nLevelStart = aCache.length, bChildren = oParentNode.hasChildNodes(), bAttributes = oParentNode.hasAttributes(), bHighVerb = Boolean(nVerb & 2);
48535           var sProp, vContent, nLength = 0, sCollectedTxt = "", vResult = bHighVerb ? {} : (
48536             /* put here the default value for empty nodes: */
48537             true
48538           );
48539           if (bChildren) {
48540             for (var oNode, nItem = 0; nItem < oParentNode.childNodes.length; nItem++) {
48541               oNode = oParentNode.childNodes.item(nItem);
48542               if (oNode.nodeType === 4) {
48543                 sCollectedTxt += oNode.nodeValue;
48544               } else if (oNode.nodeType === 3) {
48545                 sCollectedTxt += oNode.nodeValue.trim();
48546               } else if (oNode.nodeType === 1 && !oNode.prefix) {
48547                 aCache.push(oNode);
48548               }
48549             }
48550           }
48551           var nLevelEnd = aCache.length, vBuiltVal = parseText(sCollectedTxt);
48552           if (!bHighVerb && (bChildren || bAttributes)) {
48553             vResult = nVerb === 0 ? objectify(vBuiltVal) : {};
48554           }
48555           for (var nElId = nLevelStart; nElId < nLevelEnd; nElId++) {
48556             sProp = aCache[nElId].nodeName.toLowerCase();
48557             vContent = createObjTree(aCache[nElId], nVerb, bFreeze, bNesteAttr);
48558             if (vResult.hasOwnProperty(sProp)) {
48559               if (vResult[sProp].constructor !== Array) {
48560                 vResult[sProp] = [vResult[sProp]];
48561               }
48562               vResult[sProp].push(vContent);
48563             } else {
48564               vResult[sProp] = vContent;
48565               nLength++;
48566             }
48567           }
48568           if (bAttributes) {
48569             var nAttrLen = oParentNode.attributes.length, sAPrefix = bNesteAttr ? "" : sAttrPref, oAttrParent = bNesteAttr ? {} : vResult;
48570             for (var oAttrib, nAttrib = 0; nAttrib < nAttrLen; nLength++, nAttrib++) {
48571               oAttrib = oParentNode.attributes.item(nAttrib);
48572               oAttrParent[sAPrefix + oAttrib.name.toLowerCase()] = parseText(oAttrib.value.trim());
48573             }
48574             if (bNesteAttr) {
48575               if (bFreeze) {
48576                 Object.freeze(oAttrParent);
48577               }
48578               vResult[sAttributesProp] = oAttrParent;
48579               nLength -= nAttrLen - 1;
48580             }
48581           }
48582           if (nVerb === 3 || (nVerb === 2 || nVerb === 1 && nLength > 0) && sCollectedTxt) {
48583             vResult[sValueProp] = vBuiltVal;
48584           } else if (!bHighVerb && nLength === 0 && sCollectedTxt) {
48585             vResult = vBuiltVal;
48586           }
48587           if (bFreeze && (bHighVerb || nLength > 0)) {
48588             Object.freeze(vResult);
48589           }
48590           aCache.length = nLevelStart;
48591           return vResult;
48592         }
48593         function loadObjTree(oXMLDoc, oParentEl, oParentObj) {
48594           var vValue, oChild;
48595           if (oParentObj instanceof String || oParentObj instanceof Number || oParentObj instanceof Boolean) {
48596             oParentEl.appendChild(oXMLDoc.createTextNode(oParentObj.toString()));
48597           } else if (oParentObj.constructor === Date) {
48598             oParentEl.appendChild(oXMLDoc.createTextNode(oParentObj.toGMTString()));
48599           }
48600           for (var sName in oParentObj) {
48601             vValue = oParentObj[sName];
48602             if (isFinite(sName) || vValue instanceof Function) {
48603               continue;
48604             }
48605             if (sName === sValueProp) {
48606               if (vValue !== null && vValue !== true) {
48607                 oParentEl.appendChild(oXMLDoc.createTextNode(vValue.constructor === Date ? vValue.toGMTString() : String(vValue)));
48608               }
48609             } else if (sName === sAttributesProp) {
48610               for (var sAttrib in vValue) {
48611                 oParentEl.setAttribute(sAttrib, vValue[sAttrib]);
48612               }
48613             } else if (sName.charAt(0) === sAttrPref) {
48614               oParentEl.setAttribute(sName.slice(1), vValue);
48615             } else if (vValue.constructor === Array) {
48616               for (var nItem = 0; nItem < vValue.length; nItem++) {
48617                 oChild = oXMLDoc.createElement(sName);
48618                 loadObjTree(oXMLDoc, oChild, vValue[nItem]);
48619                 oParentEl.appendChild(oChild);
48620               }
48621             } else {
48622               oChild = oXMLDoc.createElement(sName);
48623               if (vValue instanceof Object) {
48624                 loadObjTree(oXMLDoc, oChild, vValue);
48625               } else if (vValue !== null && vValue !== true) {
48626                 oChild.appendChild(oXMLDoc.createTextNode(vValue.toString()));
48627               }
48628               oParentEl.appendChild(oChild);
48629             }
48630           }
48631         }
48632         this.build = function(oXMLParent, nVerbosity, bFreeze, bNesteAttributes) {
48633           var _nVerb = arguments.length > 1 && typeof nVerbosity === "number" ? nVerbosity & 3 : (
48634             /* put here the default verbosity level: */
48635             1
48636           );
48637           return createObjTree(oXMLParent, _nVerb, bFreeze || false, arguments.length > 3 ? bNesteAttributes : _nVerb === 3);
48638         };
48639         this.unbuild = function(oObjTree) {
48640           var oNewDoc = document.implementation.createDocument("", "", null);
48641           loadObjTree(oNewDoc, oNewDoc, oObjTree);
48642           return oNewDoc;
48643         };
48644         this.stringify = function(oObjTree) {
48645           return new XMLSerializer().serializeToString(JXON.unbuild(oObjTree));
48646         };
48647       }();
48648     }
48649   });
48650
48651   // modules/ui/conflicts.js
48652   var conflicts_exports = {};
48653   __export(conflicts_exports, {
48654     uiConflicts: () => uiConflicts
48655   });
48656   function uiConflicts(context) {
48657     var dispatch14 = dispatch_default("cancel", "save");
48658     var keybinding = utilKeybinding("conflicts");
48659     var _origChanges;
48660     var _conflictList;
48661     var _shownConflictIndex;
48662     function keybindingOn() {
48663       select_default2(document).call(keybinding.on("\u238B", cancel, true));
48664     }
48665     function keybindingOff() {
48666       select_default2(document).call(keybinding.unbind);
48667     }
48668     function tryAgain() {
48669       keybindingOff();
48670       dispatch14.call("save");
48671     }
48672     function cancel() {
48673       keybindingOff();
48674       dispatch14.call("cancel");
48675     }
48676     function conflicts(selection2) {
48677       keybindingOn();
48678       var headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
48679       headerEnter.append("button").attr("class", "fr").attr("title", _t("icons.close")).on("click", cancel).call(svgIcon("#iD-icon-close"));
48680       headerEnter.append("h2").call(_t.append("save.conflict.header"));
48681       var bodyEnter = selection2.selectAll(".body").data([0]).enter().append("div").attr("class", "body fillL");
48682       var conflictsHelpEnter = bodyEnter.append("div").attr("class", "conflicts-help").call(_t.append("save.conflict.help"));
48683       var changeset = new osmChangeset();
48684       delete changeset.id;
48685       var data = JXON.stringify(changeset.osmChangeJXON(_origChanges));
48686       var blob = new Blob([data], { type: "text/xml;charset=utf-8;" });
48687       var fileName = "changes.osc";
48688       var linkEnter = conflictsHelpEnter.selectAll(".download-changes").append("a").attr("class", "download-changes");
48689       linkEnter.attr("href", window.URL.createObjectURL(blob)).attr("download", fileName);
48690       linkEnter.call(svgIcon("#iD-icon-load", "inline")).append("span").call(_t.append("save.conflict.download_changes"));
48691       bodyEnter.append("div").attr("class", "conflict-container fillL3").call(showConflict, 0);
48692       bodyEnter.append("div").attr("class", "conflicts-done").attr("opacity", 0).style("display", "none").call(_t.append("save.conflict.done"));
48693       var buttonsEnter = bodyEnter.append("div").attr("class", "buttons col12 joined conflicts-buttons");
48694       buttonsEnter.append("button").attr("disabled", _conflictList.length > 1).attr("class", "action conflicts-button col6").call(_t.append("save.title")).on("click.try_again", tryAgain);
48695       buttonsEnter.append("button").attr("class", "secondary-action conflicts-button col6").call(_t.append("confirm.cancel")).on("click.cancel", cancel);
48696     }
48697     function showConflict(selection2, index) {
48698       index = utilWrap(index, _conflictList.length);
48699       _shownConflictIndex = index;
48700       var parent = select_default2(selection2.node().parentNode);
48701       if (index === _conflictList.length - 1) {
48702         window.setTimeout(function() {
48703           parent.select(".conflicts-button").attr("disabled", null);
48704           parent.select(".conflicts-done").transition().attr("opacity", 1).style("display", "block");
48705         }, 250);
48706       }
48707       var conflict = selection2.selectAll(".conflict").data([_conflictList[index]]);
48708       conflict.exit().remove();
48709       var conflictEnter = conflict.enter().append("div").attr("class", "conflict");
48710       conflictEnter.append("h4").attr("class", "conflict-count").call(_t.append("save.conflict.count", { num: index + 1, total: _conflictList.length }));
48711       conflictEnter.append("a").attr("class", "conflict-description").attr("href", "#").text(function(d2) {
48712         return d2.name;
48713       }).on("click", function(d3_event, d2) {
48714         d3_event.preventDefault();
48715         zoomToEntity(d2.id);
48716       });
48717       var details = conflictEnter.append("div").attr("class", "conflict-detail-container");
48718       details.append("ul").attr("class", "conflict-detail-list").selectAll("li").data(function(d2) {
48719         return d2.details || [];
48720       }).enter().append("li").attr("class", "conflict-detail-item").html(function(d2) {
48721         return d2;
48722       });
48723       details.append("div").attr("class", "conflict-choices").call(addChoices);
48724       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) {
48725         return i3 === 0 && index === 0 || i3 === 1 && index === _conflictList.length - 1 || null;
48726       }).on("click", function(d3_event, d2) {
48727         d3_event.preventDefault();
48728         var container = parent.selectAll(".conflict-container");
48729         var sign2 = d2 === "previous" ? -1 : 1;
48730         container.selectAll(".conflict").remove();
48731         container.call(showConflict, index + sign2);
48732       }).each(function(d2) {
48733         _t.append("save.conflict." + d2)(select_default2(this));
48734       });
48735     }
48736     function addChoices(selection2) {
48737       var choices = selection2.append("ul").attr("class", "layer-list").selectAll("li").data(function(d2) {
48738         return d2.choices || [];
48739       });
48740       var choicesEnter = choices.enter().append("li").attr("class", "layer");
48741       var labelEnter = choicesEnter.append("label");
48742       labelEnter.append("input").attr("type", "radio").attr("name", function(d2) {
48743         return d2.id;
48744       }).on("change", function(d3_event, d2) {
48745         var ul = this.parentNode.parentNode.parentNode;
48746         ul.__data__.chosen = d2.id;
48747         choose(d3_event, ul, d2);
48748       });
48749       labelEnter.append("span").text(function(d2) {
48750         return d2.text;
48751       });
48752       choicesEnter.merge(choices).each(function(d2) {
48753         var ul = this.parentNode;
48754         if (ul.__data__.chosen === d2.id) {
48755           choose(null, ul, d2);
48756         }
48757       });
48758     }
48759     function choose(d3_event, ul, datum2) {
48760       if (d3_event) d3_event.preventDefault();
48761       select_default2(ul).selectAll("li").classed("active", function(d2) {
48762         return d2 === datum2;
48763       }).selectAll("input").property("checked", function(d2) {
48764         return d2 === datum2;
48765       });
48766       var extent = geoExtent();
48767       var entity;
48768       entity = context.graph().hasEntity(datum2.id);
48769       if (entity) extent._extend(entity.extent(context.graph()));
48770       datum2.action();
48771       entity = context.graph().hasEntity(datum2.id);
48772       if (entity) extent._extend(entity.extent(context.graph()));
48773       zoomToEntity(datum2.id, extent);
48774     }
48775     function zoomToEntity(id2, extent) {
48776       context.surface().selectAll(".hover").classed("hover", false);
48777       var entity = context.graph().hasEntity(id2);
48778       if (entity) {
48779         if (extent) {
48780           context.map().trimmedExtent(extent);
48781         } else {
48782           context.map().zoomToEase(entity);
48783         }
48784         context.surface().selectAll(utilEntityOrMemberSelector([entity.id], context.graph())).classed("hover", true);
48785       }
48786     }
48787     conflicts.conflictList = function(_2) {
48788       if (!arguments.length) return _conflictList;
48789       _conflictList = _2;
48790       return conflicts;
48791     };
48792     conflicts.origChanges = function(_2) {
48793       if (!arguments.length) return _origChanges;
48794       _origChanges = _2;
48795       return conflicts;
48796     };
48797     conflicts.shownEntityIds = function() {
48798       if (_conflictList && typeof _shownConflictIndex === "number") {
48799         return [_conflictList[_shownConflictIndex].id];
48800       }
48801       return [];
48802     };
48803     return utilRebind(conflicts, dispatch14, "on");
48804   }
48805   var init_conflicts = __esm({
48806     "modules/ui/conflicts.js"() {
48807       "use strict";
48808       init_src4();
48809       init_src5();
48810       init_localizer();
48811       init_jxon();
48812       init_geo2();
48813       init_osm();
48814       init_icon();
48815       init_util();
48816     }
48817   });
48818
48819   // modules/ui/confirm.js
48820   var confirm_exports = {};
48821   __export(confirm_exports, {
48822     uiConfirm: () => uiConfirm
48823   });
48824   function uiConfirm(selection2) {
48825     var modalSelection = uiModal(selection2);
48826     modalSelection.select(".modal").classed("modal-alert", true);
48827     var section = modalSelection.select(".content");
48828     section.append("div").attr("class", "modal-section header");
48829     section.append("div").attr("class", "modal-section message-text");
48830     var buttons = section.append("div").attr("class", "modal-section buttons cf");
48831     modalSelection.okButton = function() {
48832       buttons.append("button").attr("class", "button ok-button action").on("click.confirm", function() {
48833         modalSelection.remove();
48834       }).call(_t.append("confirm.okay")).node().focus();
48835       return modalSelection;
48836     };
48837     return modalSelection;
48838   }
48839   var init_confirm = __esm({
48840     "modules/ui/confirm.js"() {
48841       "use strict";
48842       init_localizer();
48843       init_modal();
48844     }
48845   });
48846
48847   // modules/ui/popover.js
48848   var popover_exports = {};
48849   __export(popover_exports, {
48850     uiPopover: () => uiPopover
48851   });
48852   function uiPopover(klass) {
48853     var _id = _popoverID++;
48854     var _anchorSelection = select_default2(null);
48855     var popover = function(selection2) {
48856       _anchorSelection = selection2;
48857       selection2.each(setup);
48858     };
48859     var _animation = utilFunctor(false);
48860     var _placement = utilFunctor("top");
48861     var _alignment = utilFunctor("center");
48862     var _scrollContainer = utilFunctor(select_default2(null));
48863     var _content;
48864     var _displayType = utilFunctor("");
48865     var _hasArrow = utilFunctor(true);
48866     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
48867     popover.displayType = function(val) {
48868       if (arguments.length) {
48869         _displayType = utilFunctor(val);
48870         return popover;
48871       } else {
48872         return _displayType;
48873       }
48874     };
48875     popover.hasArrow = function(val) {
48876       if (arguments.length) {
48877         _hasArrow = utilFunctor(val);
48878         return popover;
48879       } else {
48880         return _hasArrow;
48881       }
48882     };
48883     popover.placement = function(val) {
48884       if (arguments.length) {
48885         _placement = utilFunctor(val);
48886         return popover;
48887       } else {
48888         return _placement;
48889       }
48890     };
48891     popover.alignment = function(val) {
48892       if (arguments.length) {
48893         _alignment = utilFunctor(val);
48894         return popover;
48895       } else {
48896         return _alignment;
48897       }
48898     };
48899     popover.scrollContainer = function(val) {
48900       if (arguments.length) {
48901         _scrollContainer = utilFunctor(val);
48902         return popover;
48903       } else {
48904         return _scrollContainer;
48905       }
48906     };
48907     popover.content = function(val) {
48908       if (arguments.length) {
48909         _content = val;
48910         return popover;
48911       } else {
48912         return _content;
48913       }
48914     };
48915     popover.isShown = function() {
48916       var popoverSelection = _anchorSelection.select(".popover-" + _id);
48917       return !popoverSelection.empty() && popoverSelection.classed("in");
48918     };
48919     popover.show = function() {
48920       _anchorSelection.each(show);
48921     };
48922     popover.updateContent = function() {
48923       _anchorSelection.each(updateContent);
48924     };
48925     popover.hide = function() {
48926       _anchorSelection.each(hide);
48927     };
48928     popover.toggle = function() {
48929       _anchorSelection.each(toggle);
48930     };
48931     popover.destroy = function(selection2, selector) {
48932       selector = selector || ".popover-" + _id;
48933       selection2.on(_pointerPrefix + "enter.popover", null).on(_pointerPrefix + "leave.popover", null).on(_pointerPrefix + "up.popover", null).on(_pointerPrefix + "down.popover", null).on("click.popover", null).attr("title", function() {
48934         return this.getAttribute("data-original-title") || this.getAttribute("title");
48935       }).attr("data-original-title", null).selectAll(selector).remove();
48936     };
48937     popover.destroyAny = function(selection2) {
48938       selection2.call(popover.destroy, ".popover");
48939     };
48940     function setup() {
48941       var anchor = select_default2(this);
48942       var animate = _animation.apply(this, arguments);
48943       var popoverSelection = anchor.selectAll(".popover-" + _id).data([0]);
48944       var enter = popoverSelection.enter().append("div").attr("class", "popover popover-" + _id + " " + (klass ? klass : "")).classed("arrowed", _hasArrow.apply(this, arguments));
48945       enter.append("div").attr("class", "popover-arrow");
48946       enter.append("div").attr("class", "popover-inner");
48947       popoverSelection = enter.merge(popoverSelection);
48948       if (animate) {
48949         popoverSelection.classed("fade", true);
48950       }
48951       var display = _displayType.apply(this, arguments);
48952       if (display === "hover") {
48953         var _lastNonMouseEnterTime;
48954         anchor.on(_pointerPrefix + "enter.popover", function(d3_event) {
48955           if (d3_event.pointerType) {
48956             if (d3_event.pointerType !== "mouse") {
48957               _lastNonMouseEnterTime = d3_event.timeStamp;
48958               return;
48959             } else if (_lastNonMouseEnterTime && d3_event.timeStamp - _lastNonMouseEnterTime < 1500) {
48960               return;
48961             }
48962           }
48963           if (d3_event.buttons !== 0) return;
48964           show.apply(this, arguments);
48965         }).on(_pointerPrefix + "leave.popover", function() {
48966           hide.apply(this, arguments);
48967         }).on("focus.popover", function() {
48968           show.apply(this, arguments);
48969         }).on("blur.popover", function() {
48970           hide.apply(this, arguments);
48971         });
48972       } else if (display === "clickFocus") {
48973         anchor.on(_pointerPrefix + "down.popover", function(d3_event) {
48974           d3_event.preventDefault();
48975           d3_event.stopPropagation();
48976         }).on(_pointerPrefix + "up.popover", function(d3_event) {
48977           d3_event.preventDefault();
48978           d3_event.stopPropagation();
48979         }).on("click.popover", toggle);
48980         popoverSelection.attr("tabindex", 0).on("blur.popover", function() {
48981           anchor.each(function() {
48982             hide.apply(this, arguments);
48983           });
48984         });
48985       }
48986     }
48987     function show() {
48988       var anchor = select_default2(this);
48989       var popoverSelection = anchor.selectAll(".popover-" + _id);
48990       if (popoverSelection.empty()) {
48991         anchor.call(popover.destroy);
48992         anchor.each(setup);
48993         popoverSelection = anchor.selectAll(".popover-" + _id);
48994       }
48995       popoverSelection.classed("in", true);
48996       var displayType = _displayType.apply(this, arguments);
48997       if (displayType === "clickFocus") {
48998         anchor.classed("active", true);
48999         popoverSelection.node().focus();
49000       }
49001       anchor.each(updateContent);
49002     }
49003     function updateContent() {
49004       var anchor = select_default2(this);
49005       if (_content) {
49006         anchor.selectAll(".popover-" + _id + " > .popover-inner").call(_content.apply(this, arguments));
49007       }
49008       updatePosition.apply(this, arguments);
49009       updatePosition.apply(this, arguments);
49010       updatePosition.apply(this, arguments);
49011     }
49012     function updatePosition() {
49013       var anchor = select_default2(this);
49014       var popoverSelection = anchor.selectAll(".popover-" + _id);
49015       var scrollContainer = _scrollContainer && _scrollContainer.apply(this, arguments);
49016       var scrollNode = scrollContainer && !scrollContainer.empty() && scrollContainer.node();
49017       var scrollLeft = scrollNode ? scrollNode.scrollLeft : 0;
49018       var scrollTop = scrollNode ? scrollNode.scrollTop : 0;
49019       var placement = _placement.apply(this, arguments);
49020       popoverSelection.classed("left", false).classed("right", false).classed("top", false).classed("bottom", false).classed(placement, true);
49021       var alignment = _alignment.apply(this, arguments);
49022       var alignFactor = 0.5;
49023       if (alignment === "leading") {
49024         alignFactor = 0;
49025       } else if (alignment === "trailing") {
49026         alignFactor = 1;
49027       }
49028       var anchorFrame = getFrame(anchor.node());
49029       var popoverFrame = getFrame(popoverSelection.node());
49030       var position;
49031       switch (placement) {
49032         case "top":
49033           position = {
49034             x: anchorFrame.x + (anchorFrame.w - popoverFrame.w) * alignFactor,
49035             y: anchorFrame.y - popoverFrame.h
49036           };
49037           break;
49038         case "bottom":
49039           position = {
49040             x: anchorFrame.x + (anchorFrame.w - popoverFrame.w) * alignFactor,
49041             y: anchorFrame.y + anchorFrame.h
49042           };
49043           break;
49044         case "left":
49045           position = {
49046             x: anchorFrame.x - popoverFrame.w,
49047             y: anchorFrame.y + (anchorFrame.h - popoverFrame.h) * alignFactor
49048           };
49049           break;
49050         case "right":
49051           position = {
49052             x: anchorFrame.x + anchorFrame.w,
49053             y: anchorFrame.y + (anchorFrame.h - popoverFrame.h) * alignFactor
49054           };
49055           break;
49056       }
49057       if (position) {
49058         if (scrollNode && (placement === "top" || placement === "bottom")) {
49059           var initialPosX = position.x;
49060           if (position.x + popoverFrame.w > scrollNode.offsetWidth - 10) {
49061             position.x = scrollNode.offsetWidth - 10 - popoverFrame.w;
49062           } else if (position.x < 10) {
49063             position.x = 10;
49064           }
49065           var arrow = anchor.selectAll(".popover-" + _id + " > .popover-arrow");
49066           var arrowPosX = Math.min(Math.max(popoverFrame.w / 2 - (position.x - initialPosX), 10), popoverFrame.w - 10);
49067           arrow.style("left", ~~arrowPosX + "px");
49068         }
49069         popoverSelection.style("left", ~~position.x + "px").style("top", ~~position.y + "px");
49070       } else {
49071         popoverSelection.style("left", null).style("top", null);
49072       }
49073       function getFrame(node) {
49074         var positionStyle = select_default2(node).style("position");
49075         if (positionStyle === "absolute" || positionStyle === "static") {
49076           return {
49077             x: node.offsetLeft - scrollLeft,
49078             y: node.offsetTop - scrollTop,
49079             w: node.offsetWidth,
49080             h: node.offsetHeight
49081           };
49082         } else {
49083           return {
49084             x: 0,
49085             y: 0,
49086             w: node.offsetWidth,
49087             h: node.offsetHeight
49088           };
49089         }
49090       }
49091     }
49092     function hide() {
49093       var anchor = select_default2(this);
49094       if (_displayType.apply(this, arguments) === "clickFocus") {
49095         anchor.classed("active", false);
49096       }
49097       anchor.selectAll(".popover-" + _id).classed("in", false);
49098     }
49099     function toggle() {
49100       if (select_default2(this).select(".popover-" + _id).classed("in")) {
49101         hide.apply(this, arguments);
49102       } else {
49103         show.apply(this, arguments);
49104       }
49105     }
49106     return popover;
49107   }
49108   var _popoverID;
49109   var init_popover = __esm({
49110     "modules/ui/popover.js"() {
49111       "use strict";
49112       init_src5();
49113       init_util2();
49114       _popoverID = 0;
49115     }
49116   });
49117
49118   // modules/ui/tooltip.js
49119   var tooltip_exports = {};
49120   __export(tooltip_exports, {
49121     uiTooltip: () => uiTooltip
49122   });
49123   function uiTooltip(klass) {
49124     var tooltip = uiPopover((klass || "") + " tooltip").displayType("hover");
49125     var _title = function() {
49126       var title = this.getAttribute("data-original-title");
49127       if (title) {
49128         return title;
49129       } else {
49130         title = this.getAttribute("title");
49131         this.removeAttribute("title");
49132         this.setAttribute("data-original-title", title);
49133       }
49134       return title;
49135     };
49136     var _heading = utilFunctor(null);
49137     var _keys = utilFunctor(null);
49138     tooltip.title = function(val) {
49139       if (!arguments.length) return _title;
49140       _title = utilFunctor(val);
49141       return tooltip;
49142     };
49143     tooltip.heading = function(val) {
49144       if (!arguments.length) return _heading;
49145       _heading = utilFunctor(val);
49146       return tooltip;
49147     };
49148     tooltip.keys = function(val) {
49149       if (!arguments.length) return _keys;
49150       _keys = utilFunctor(val);
49151       return tooltip;
49152     };
49153     tooltip.content(function() {
49154       var heading2 = _heading.apply(this, arguments);
49155       var text = _title.apply(this, arguments);
49156       var keys2 = _keys.apply(this, arguments);
49157       var headingCallback = typeof heading2 === "function" ? heading2 : (s2) => s2.text(heading2);
49158       var textCallback = typeof text === "function" ? text : (s2) => s2.text(text);
49159       return function(selection2) {
49160         var headingSelect = selection2.selectAll(".tooltip-heading").data(heading2 ? [heading2] : []);
49161         headingSelect.exit().remove();
49162         headingSelect.enter().append("div").attr("class", "tooltip-heading").merge(headingSelect).text("").call(headingCallback);
49163         var textSelect = selection2.selectAll(".tooltip-text").data(text ? [text] : []);
49164         textSelect.exit().remove();
49165         textSelect.enter().append("div").attr("class", "tooltip-text").merge(textSelect).text("").call(textCallback);
49166         var keyhintWrap = selection2.selectAll(".keyhint-wrap").data(keys2 && keys2.length ? [0] : []);
49167         keyhintWrap.exit().remove();
49168         var keyhintWrapEnter = keyhintWrap.enter().append("div").attr("class", "keyhint-wrap");
49169         keyhintWrapEnter.append("span").call(_t.append("tooltip_keyhint"));
49170         keyhintWrap = keyhintWrapEnter.merge(keyhintWrap);
49171         keyhintWrap.selectAll("kbd.shortcut").data(keys2 && keys2.length ? keys2 : []).enter().append("kbd").attr("class", "shortcut").text(function(d2) {
49172           return d2;
49173         });
49174       };
49175     });
49176     return tooltip;
49177   }
49178   var init_tooltip = __esm({
49179     "modules/ui/tooltip.js"() {
49180       "use strict";
49181       init_util2();
49182       init_localizer();
49183       init_popover();
49184     }
49185   });
49186
49187   // modules/ui/combobox.js
49188   var combobox_exports = {};
49189   __export(combobox_exports, {
49190     uiCombobox: () => uiCombobox
49191   });
49192   function uiCombobox(context, klass) {
49193     var dispatch14 = dispatch_default("accept", "cancel", "update");
49194     var container = context.container();
49195     var _suggestions = [];
49196     var _data = [];
49197     var _fetched = {};
49198     var _selected = null;
49199     var _canAutocomplete = true;
49200     var _caseSensitive = false;
49201     var _cancelFetch = false;
49202     var _minItems = 2;
49203     var _tDown = 0;
49204     var _mouseEnterHandler, _mouseLeaveHandler;
49205     var _fetcher = function(val, cb) {
49206       cb(_data.filter(function(d2) {
49207         var terms = d2.terms || [];
49208         terms.push(d2.value);
49209         if (d2.key) {
49210           terms.push(d2.key);
49211         }
49212         return terms.some(function(term) {
49213           return term.toString().toLowerCase().indexOf(val.toLowerCase()) !== -1;
49214         });
49215       }));
49216     };
49217     var combobox = function(input, attachTo) {
49218       if (!input || input.empty()) return;
49219       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() {
49220         var parent = this.parentNode;
49221         var sibling = this.nextSibling;
49222         select_default2(parent).selectAll(".combobox-caret").filter(function(d2) {
49223           return d2 === input.node();
49224         }).data([input.node()]).enter().insert("div", function() {
49225           return sibling;
49226         }).attr("class", "combobox-caret").on("mousedown.combo-caret", function(d3_event) {
49227           d3_event.preventDefault();
49228           input.node().focus();
49229           mousedown(d3_event);
49230         }).on("mouseup.combo-caret", function(d3_event) {
49231           d3_event.preventDefault();
49232           mouseup(d3_event);
49233         });
49234       });
49235       function mousedown(d3_event) {
49236         if (d3_event.button !== 0) return;
49237         if (input.classed("disabled")) return;
49238         _tDown = +/* @__PURE__ */ new Date();
49239         var start2 = input.property("selectionStart");
49240         var end = input.property("selectionEnd");
49241         if (start2 !== end) {
49242           var val = utilGetSetValue(input);
49243           input.node().setSelectionRange(val.length, val.length);
49244           return;
49245         }
49246         input.on("mouseup.combo-input", mouseup);
49247       }
49248       function mouseup(d3_event) {
49249         input.on("mouseup.combo-input", null);
49250         if (d3_event.button !== 0) return;
49251         if (input.classed("disabled")) return;
49252         if (input.node() !== document.activeElement) return;
49253         var start2 = input.property("selectionStart");
49254         var end = input.property("selectionEnd");
49255         if (start2 !== end) return;
49256         var combo = container.selectAll(".combobox");
49257         if (combo.empty() || combo.datum() !== input.node()) {
49258           var tOrig = _tDown;
49259           window.setTimeout(function() {
49260             if (tOrig !== _tDown) return;
49261             fetchComboData("", function() {
49262               show();
49263               render();
49264             });
49265           }, 250);
49266         } else {
49267           hide();
49268         }
49269       }
49270       function focus() {
49271         fetchComboData("");
49272       }
49273       function blur() {
49274         _comboHideTimerID = window.setTimeout(hide, 75);
49275       }
49276       function show() {
49277         hide();
49278         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) {
49279           d3_event.preventDefault();
49280         });
49281         container.on("scroll.combo-scroll", render, true);
49282       }
49283       function hide() {
49284         _hide(container);
49285       }
49286       function keydown(d3_event) {
49287         var shown = !container.selectAll(".combobox").empty();
49288         var tagName = input.node() ? input.node().tagName.toLowerCase() : "";
49289         switch (d3_event.keyCode) {
49290           case 8:
49291           // ⌫ Backspace
49292           case 46:
49293             d3_event.stopPropagation();
49294             _selected = null;
49295             render();
49296             input.on("input.combo-input", function() {
49297               var start2 = input.property("selectionStart");
49298               input.node().setSelectionRange(start2, start2);
49299               input.on("input.combo-input", change);
49300               change(false);
49301             });
49302             break;
49303           case 9:
49304             accept(d3_event);
49305             break;
49306           case 13:
49307             d3_event.preventDefault();
49308             d3_event.stopPropagation();
49309             accept(d3_event);
49310             break;
49311           case 38:
49312             if (tagName === "textarea" && !shown) return;
49313             d3_event.preventDefault();
49314             if (tagName === "input" && !shown) {
49315               show();
49316             }
49317             nav(-1);
49318             break;
49319           case 40:
49320             if (tagName === "textarea" && !shown) return;
49321             d3_event.preventDefault();
49322             if (tagName === "input" && !shown) {
49323               show();
49324             }
49325             nav(1);
49326             break;
49327         }
49328       }
49329       function keyup(d3_event) {
49330         switch (d3_event.keyCode) {
49331           case 27:
49332             cancel();
49333             break;
49334         }
49335       }
49336       function change(doAutoComplete) {
49337         if (doAutoComplete === void 0) doAutoComplete = true;
49338         fetchComboData(value(), function(skipAutosuggest) {
49339           _selected = null;
49340           var val = input.property("value");
49341           if (_suggestions.length) {
49342             if (doAutoComplete && !skipAutosuggest && input.property("selectionEnd") === val.length) {
49343               _selected = tryAutocomplete();
49344             }
49345             if (!_selected) {
49346               _selected = val;
49347             }
49348           }
49349           if (val.length) {
49350             var combo = container.selectAll(".combobox");
49351             if (combo.empty()) {
49352               show();
49353             }
49354           } else {
49355             hide();
49356           }
49357           render();
49358         });
49359       }
49360       function nav(dir) {
49361         if (_suggestions.length) {
49362           var index = -1;
49363           for (var i3 = 0; i3 < _suggestions.length; i3++) {
49364             if (_selected && _suggestions[i3].value === _selected) {
49365               index = i3;
49366               break;
49367             }
49368           }
49369           index = Math.max(Math.min(index + dir, _suggestions.length - 1), 0);
49370           _selected = _suggestions[index].value;
49371           utilGetSetValue(input, _selected);
49372           dispatch14.call("update");
49373         }
49374         render();
49375         ensureVisible();
49376       }
49377       function ensureVisible() {
49378         var _a3;
49379         var combo = container.selectAll(".combobox");
49380         if (combo.empty()) return;
49381         var containerRect = container.node().getBoundingClientRect();
49382         var comboRect = combo.node().getBoundingClientRect();
49383         if (comboRect.bottom > containerRect.bottom) {
49384           var node = attachTo ? attachTo.node() : input.node();
49385           node.scrollIntoView({ behavior: "instant", block: "center" });
49386           render();
49387         }
49388         var selected = combo.selectAll(".combobox-option.selected").node();
49389         if (selected) {
49390           (_a3 = selected.scrollIntoView) == null ? void 0 : _a3.call(selected, { behavior: "smooth", block: "nearest" });
49391         }
49392       }
49393       function value() {
49394         var value2 = input.property("value");
49395         var start2 = input.property("selectionStart");
49396         var end = input.property("selectionEnd");
49397         if (start2 && end) {
49398           value2 = value2.substring(0, start2);
49399         }
49400         return value2;
49401       }
49402       function fetchComboData(v2, cb) {
49403         _cancelFetch = false;
49404         _fetcher.call(input, v2, function(results, skipAutosuggest) {
49405           if (_cancelFetch) return;
49406           _suggestions = results;
49407           results.forEach(function(d2) {
49408             _fetched[d2.value] = d2;
49409           });
49410           if (cb) {
49411             cb(skipAutosuggest);
49412           }
49413         });
49414       }
49415       function tryAutocomplete() {
49416         if (!_canAutocomplete) return;
49417         var val = _caseSensitive ? value() : value().toLowerCase();
49418         if (!val) return;
49419         if (isFinite(val)) return;
49420         const suggestionValues = [];
49421         _suggestions.forEach((s2) => {
49422           suggestionValues.push(s2.value);
49423           if (s2.key && s2.key !== s2.value) {
49424             suggestionValues.push(s2.key);
49425           }
49426         });
49427         var bestIndex = -1;
49428         for (var i3 = 0; i3 < suggestionValues.length; i3++) {
49429           var suggestion = suggestionValues[i3];
49430           var compare2 = _caseSensitive ? suggestion : suggestion.toLowerCase();
49431           if (compare2 === val) {
49432             bestIndex = i3;
49433             break;
49434           } else if (bestIndex === -1 && compare2.indexOf(val) === 0) {
49435             bestIndex = i3;
49436           }
49437         }
49438         if (bestIndex !== -1) {
49439           var bestVal = suggestionValues[bestIndex];
49440           input.property("value", bestVal);
49441           input.node().setSelectionRange(val.length, bestVal.length);
49442           dispatch14.call("update");
49443           return bestVal;
49444         }
49445       }
49446       function render() {
49447         if (_suggestions.length < _minItems || document.activeElement !== input.node()) {
49448           hide();
49449           return;
49450         }
49451         var shown = !container.selectAll(".combobox").empty();
49452         if (!shown) return;
49453         var combo = container.selectAll(".combobox");
49454         var options2 = combo.selectAll(".combobox-option").data(_suggestions, function(d2) {
49455           return d2.value;
49456         });
49457         options2.exit().remove();
49458         options2.enter().append("a").attr("class", function(d2) {
49459           return "combobox-option " + (d2.klass || "");
49460         }).attr("title", function(d2) {
49461           return d2.title;
49462         }).each(function(d2) {
49463           if (d2.display) {
49464             d2.display(select_default2(this));
49465           } else {
49466             select_default2(this).text(d2.value);
49467           }
49468         }).on("mouseenter", _mouseEnterHandler).on("mouseleave", _mouseLeaveHandler).merge(options2).classed("selected", function(d2) {
49469           return d2.value === _selected || d2.key === _selected;
49470         }).on("click.combo-option", accept).order();
49471         var node = attachTo ? attachTo.node() : input.node();
49472         var containerRect = container.node().getBoundingClientRect();
49473         var rect = node.getBoundingClientRect();
49474         combo.style("left", rect.left + 5 - containerRect.left + "px").style("width", rect.width - 10 + "px").style("top", rect.height + rect.top - containerRect.top + "px");
49475       }
49476       function accept(d3_event, d2) {
49477         _cancelFetch = true;
49478         var thiz = input.node();
49479         if (d2) {
49480           utilGetSetValue(input, d2.value);
49481           utilTriggerEvent(input, "change");
49482         }
49483         var val = utilGetSetValue(input);
49484         thiz.setSelectionRange(val.length, val.length);
49485         if (!d2) {
49486           d2 = _fetched[val];
49487         }
49488         dispatch14.call("accept", thiz, d2, val);
49489         hide();
49490       }
49491       function cancel() {
49492         _cancelFetch = true;
49493         var thiz = input.node();
49494         var val = utilGetSetValue(input);
49495         var start2 = input.property("selectionStart");
49496         var end = input.property("selectionEnd");
49497         val = val.slice(0, start2) + val.slice(end);
49498         utilGetSetValue(input, val);
49499         thiz.setSelectionRange(val.length, val.length);
49500         dispatch14.call("cancel", thiz);
49501         hide();
49502       }
49503     };
49504     combobox.canAutocomplete = function(val) {
49505       if (!arguments.length) return _canAutocomplete;
49506       _canAutocomplete = val;
49507       return combobox;
49508     };
49509     combobox.caseSensitive = function(val) {
49510       if (!arguments.length) return _caseSensitive;
49511       _caseSensitive = val;
49512       return combobox;
49513     };
49514     combobox.data = function(val) {
49515       if (!arguments.length) return _data;
49516       _data = val;
49517       return combobox;
49518     };
49519     combobox.fetcher = function(val) {
49520       if (!arguments.length) return _fetcher;
49521       _fetcher = val;
49522       return combobox;
49523     };
49524     combobox.minItems = function(val) {
49525       if (!arguments.length) return _minItems;
49526       _minItems = val;
49527       return combobox;
49528     };
49529     combobox.itemsMouseEnter = function(val) {
49530       if (!arguments.length) return _mouseEnterHandler;
49531       _mouseEnterHandler = val;
49532       return combobox;
49533     };
49534     combobox.itemsMouseLeave = function(val) {
49535       if (!arguments.length) return _mouseLeaveHandler;
49536       _mouseLeaveHandler = val;
49537       return combobox;
49538     };
49539     return utilRebind(combobox, dispatch14, "on");
49540   }
49541   function _hide(container) {
49542     if (_comboHideTimerID) {
49543       window.clearTimeout(_comboHideTimerID);
49544       _comboHideTimerID = void 0;
49545     }
49546     container.selectAll(".combobox").remove();
49547     container.on("scroll.combo-scroll", null);
49548   }
49549   var _comboHideTimerID;
49550   var init_combobox = __esm({
49551     "modules/ui/combobox.js"() {
49552       "use strict";
49553       init_src4();
49554       init_src5();
49555       init_util();
49556       uiCombobox.off = function(input, context) {
49557         _hide(context.container());
49558         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);
49559         context.container().on("scroll.combo-scroll", null);
49560       };
49561     }
49562   });
49563
49564   // modules/ui/intro/helper.js
49565   var helper_exports = {};
49566   __export(helper_exports, {
49567     helpHtml: () => helpHtml,
49568     icon: () => icon,
49569     isMostlySquare: () => isMostlySquare,
49570     localize: () => localize,
49571     missingStrings: () => missingStrings,
49572     pad: () => pad2,
49573     pointBox: () => pointBox,
49574     selectMenuItem: () => selectMenuItem,
49575     transitionTime: () => transitionTime
49576   });
49577   function pointBox(loc, context) {
49578     var rect = context.surfaceRect();
49579     var point = context.curtainProjection(loc);
49580     return {
49581       left: point[0] + rect.left - 40,
49582       top: point[1] + rect.top - 60,
49583       width: 80,
49584       height: 90
49585     };
49586   }
49587   function pad2(locOrBox, padding, context) {
49588     var box;
49589     if (locOrBox instanceof Array) {
49590       var rect = context.surfaceRect();
49591       var point = context.curtainProjection(locOrBox);
49592       box = {
49593         left: point[0] + rect.left,
49594         top: point[1] + rect.top
49595       };
49596     } else {
49597       box = locOrBox;
49598     }
49599     return {
49600       left: box.left - padding,
49601       top: box.top - padding,
49602       width: (box.width || 0) + 2 * padding,
49603       height: (box.width || 0) + 2 * padding
49604     };
49605   }
49606   function icon(name, svgklass, useklass) {
49607     return '<svg class="icon ' + (svgklass || "") + '"><use xlink:href="' + name + '"' + (useklass ? ' class="' + useklass + '"' : "") + "></use></svg>";
49608   }
49609   function helpHtml(id2, replacements) {
49610     if (!helpStringReplacements) {
49611       helpStringReplacements = {
49612         // insert icons corresponding to various UI elements
49613         point_icon: icon("#iD-icon-point", "inline"),
49614         line_icon: icon("#iD-icon-line", "inline"),
49615         area_icon: icon("#iD-icon-area", "inline"),
49616         note_icon: icon("#iD-icon-note", "inline add-note"),
49617         plus: icon("#iD-icon-plus", "inline"),
49618         minus: icon("#iD-icon-minus", "inline"),
49619         layers_icon: icon("#iD-icon-layers", "inline"),
49620         data_icon: icon("#iD-icon-data", "inline"),
49621         inspect: icon("#iD-icon-inspect", "inline"),
49622         help_icon: icon("#iD-icon-help", "inline"),
49623         undo_icon: icon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-redo" : "#iD-icon-undo", "inline"),
49624         redo_icon: icon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-undo" : "#iD-icon-redo", "inline"),
49625         save_icon: icon("#iD-icon-save", "inline"),
49626         // operation icons
49627         circularize_icon: icon("#iD-operation-circularize", "inline operation"),
49628         continue_icon: icon("#iD-operation-continue", "inline operation"),
49629         copy_icon: icon("#iD-operation-copy", "inline operation"),
49630         delete_icon: icon("#iD-operation-delete", "inline operation"),
49631         disconnect_icon: icon("#iD-operation-disconnect", "inline operation"),
49632         downgrade_icon: icon("#iD-operation-downgrade", "inline operation"),
49633         extract_icon: icon("#iD-operation-extract", "inline operation"),
49634         merge_icon: icon("#iD-operation-merge", "inline operation"),
49635         move_icon: icon("#iD-operation-move", "inline operation"),
49636         orthogonalize_icon: icon("#iD-operation-orthogonalize", "inline operation"),
49637         paste_icon: icon("#iD-operation-paste", "inline operation"),
49638         reflect_long_icon: icon("#iD-operation-reflect-long", "inline operation"),
49639         reflect_short_icon: icon("#iD-operation-reflect-short", "inline operation"),
49640         reverse_icon: icon("#iD-operation-reverse", "inline operation"),
49641         rotate_icon: icon("#iD-operation-rotate", "inline operation"),
49642         split_icon: icon("#iD-operation-split", "inline operation"),
49643         straighten_icon: icon("#iD-operation-straighten", "inline operation"),
49644         // interaction icons
49645         leftclick: icon("#iD-walkthrough-mouse-left", "inline operation"),
49646         rightclick: icon("#iD-walkthrough-mouse-right", "inline operation"),
49647         mousewheel_icon: icon("#iD-walkthrough-mousewheel", "inline operation"),
49648         tap_icon: icon("#iD-walkthrough-tap", "inline operation"),
49649         doubletap_icon: icon("#iD-walkthrough-doubletap", "inline operation"),
49650         longpress_icon: icon("#iD-walkthrough-longpress", "inline operation"),
49651         touchdrag_icon: icon("#iD-walkthrough-touchdrag", "inline operation"),
49652         pinch_icon: icon("#iD-walkthrough-pinch-apart", "inline operation"),
49653         // insert keys; may be localized and platform-dependent
49654         shift: uiCmd.display("\u21E7"),
49655         alt: uiCmd.display("\u2325"),
49656         return: uiCmd.display("\u21B5"),
49657         esc: _t.html("shortcuts.key.esc"),
49658         space: _t.html("shortcuts.key.space"),
49659         add_note_key: _t.html("modes.add_note.key"),
49660         help_key: _t.html("help.key"),
49661         shortcuts_key: _t.html("shortcuts.toggle.key"),
49662         // reference localized UI labels directly so that they'll always match
49663         save: _t.html("save.title"),
49664         undo: _t.html("undo.title"),
49665         redo: _t.html("redo.title"),
49666         upload: _t.html("commit.save"),
49667         point: _t.html("modes.add_point.title"),
49668         line: _t.html("modes.add_line.title"),
49669         area: _t.html("modes.add_area.title"),
49670         note: _t.html("modes.add_note.label"),
49671         circularize: _t.html("operations.circularize.title"),
49672         continue: _t.html("operations.continue.title"),
49673         copy: _t.html("operations.copy.title"),
49674         delete: _t.html("operations.delete.title"),
49675         disconnect: _t.html("operations.disconnect.title"),
49676         downgrade: _t.html("operations.downgrade.title"),
49677         extract: _t.html("operations.extract.title"),
49678         merge: _t.html("operations.merge.title"),
49679         move: _t.html("operations.move.title"),
49680         orthogonalize: _t.html("operations.orthogonalize.title"),
49681         paste: _t.html("operations.paste.title"),
49682         reflect_long: _t.html("operations.reflect.title.long"),
49683         reflect_short: _t.html("operations.reflect.title.short"),
49684         reverse: _t.html("operations.reverse.title"),
49685         rotate: _t.html("operations.rotate.title"),
49686         split: _t.html("operations.split.title"),
49687         straighten: _t.html("operations.straighten.title"),
49688         map_data: _t.html("map_data.title"),
49689         osm_notes: _t.html("map_data.layers.notes.title"),
49690         fields: _t.html("inspector.fields"),
49691         tags: _t.html("inspector.tags"),
49692         relations: _t.html("inspector.relations"),
49693         new_relation: _t.html("inspector.new_relation"),
49694         turn_restrictions: _t.html("_tagging.presets.fields.restrictions.label"),
49695         background_settings: _t.html("background.description"),
49696         imagery_offset: _t.html("background.fix_misalignment"),
49697         start_the_walkthrough: _t.html("splash.walkthrough"),
49698         help: _t.html("help.title"),
49699         ok: _t.html("intro.ok")
49700       };
49701       for (var key in helpStringReplacements) {
49702         helpStringReplacements[key] = { html: helpStringReplacements[key] };
49703       }
49704     }
49705     var reps;
49706     if (replacements) {
49707       reps = Object.assign(replacements, helpStringReplacements);
49708     } else {
49709       reps = helpStringReplacements;
49710     }
49711     return _t.html(id2, reps).replace(/\`(.*?)\`/g, "<kbd>$1</kbd>");
49712   }
49713   function slugify(text) {
49714     return text.toString().toLowerCase().replace(/\s+/g, "-").replace(/[^\w\-]+/g, "").replace(/\-\-+/g, "-").replace(/^-+/, "").replace(/-+$/, "");
49715   }
49716   function checkKey(key, text) {
49717     if (_t(key, { default: void 0 }) === void 0) {
49718       if (missingStrings.hasOwnProperty(key)) return;
49719       missingStrings[key] = text;
49720       var missing = key + ": " + text;
49721       if (typeof console !== "undefined") console.log(missing);
49722     }
49723   }
49724   function localize(obj) {
49725     var key;
49726     var name = obj.tags && obj.tags.name;
49727     if (name) {
49728       key = "intro.graph.name." + slugify(name);
49729       obj.tags.name = _t(key, { default: name });
49730       checkKey(key, name);
49731     }
49732     var street = obj.tags && obj.tags["addr:street"];
49733     if (street) {
49734       key = "intro.graph.name." + slugify(street);
49735       obj.tags["addr:street"] = _t(key, { default: street });
49736       checkKey(key, street);
49737       var addrTags = [
49738         "block_number",
49739         "city",
49740         "county",
49741         "district",
49742         "hamlet",
49743         "neighbourhood",
49744         "postcode",
49745         "province",
49746         "quarter",
49747         "state",
49748         "subdistrict",
49749         "suburb"
49750       ];
49751       addrTags.forEach(function(k2) {
49752         var key2 = "intro.graph." + k2;
49753         var tag2 = "addr:" + k2;
49754         var val = obj.tags && obj.tags[tag2];
49755         var str = _t(key2, { default: val });
49756         if (str) {
49757           if (str.match(/^<.*>$/) !== null) {
49758             delete obj.tags[tag2];
49759           } else {
49760             obj.tags[tag2] = str;
49761           }
49762         }
49763       });
49764     }
49765     return obj;
49766   }
49767   function isMostlySquare(points) {
49768     var threshold = 15;
49769     var lowerBound = Math.cos((90 - threshold) * Math.PI / 180);
49770     var upperBound = Math.cos(threshold * Math.PI / 180);
49771     for (var i3 = 0; i3 < points.length; i3++) {
49772       var a2 = points[(i3 - 1 + points.length) % points.length];
49773       var origin = points[i3];
49774       var b2 = points[(i3 + 1) % points.length];
49775       var dotp = geoVecNormalizedDot(a2, b2, origin);
49776       var mag = Math.abs(dotp);
49777       if (mag > lowerBound && mag < upperBound) {
49778         return false;
49779       }
49780     }
49781     return true;
49782   }
49783   function selectMenuItem(context, operation2) {
49784     return context.container().select(".edit-menu .edit-menu-item-" + operation2);
49785   }
49786   function transitionTime(point1, point2) {
49787     var distance = geoSphericalDistance(point1, point2);
49788     if (distance === 0) {
49789       return 0;
49790     } else if (distance < 80) {
49791       return 500;
49792     } else {
49793       return 1e3;
49794     }
49795   }
49796   var helpStringReplacements, missingStrings;
49797   var init_helper = __esm({
49798     "modules/ui/intro/helper.js"() {
49799       "use strict";
49800       init_localizer();
49801       init_geo2();
49802       init_cmd();
49803       missingStrings = {};
49804     }
49805   });
49806
49807   // modules/ui/field_help.js
49808   var field_help_exports = {};
49809   __export(field_help_exports, {
49810     uiFieldHelp: () => uiFieldHelp
49811   });
49812   function uiFieldHelp(context, fieldName) {
49813     var fieldHelp = {};
49814     var _inspector = select_default2(null);
49815     var _wrap = select_default2(null);
49816     var _body = select_default2(null);
49817     var fieldHelpKeys = {
49818       restrictions: [
49819         ["about", [
49820           "about",
49821           "from_via_to",
49822           "maxdist",
49823           "maxvia"
49824         ]],
49825         ["inspecting", [
49826           "about",
49827           "from_shadow",
49828           "allow_shadow",
49829           "restrict_shadow",
49830           "only_shadow",
49831           "restricted",
49832           "only"
49833         ]],
49834         ["modifying", [
49835           "about",
49836           "indicators",
49837           "allow_turn",
49838           "restrict_turn",
49839           "only_turn"
49840         ]],
49841         ["tips", [
49842           "simple",
49843           "simple_example",
49844           "indirect",
49845           "indirect_example",
49846           "indirect_noedit"
49847         ]]
49848       ]
49849     };
49850     var fieldHelpHeadings = {};
49851     var replacements = {
49852       distField: { html: _t.html("restriction.controls.distance") },
49853       viaField: { html: _t.html("restriction.controls.via") },
49854       fromShadow: { html: icon("#iD-turn-shadow", "inline shadow from") },
49855       allowShadow: { html: icon("#iD-turn-shadow", "inline shadow allow") },
49856       restrictShadow: { html: icon("#iD-turn-shadow", "inline shadow restrict") },
49857       onlyShadow: { html: icon("#iD-turn-shadow", "inline shadow only") },
49858       allowTurn: { html: icon("#iD-turn-yes", "inline turn") },
49859       restrictTurn: { html: icon("#iD-turn-no", "inline turn") },
49860       onlyTurn: { html: icon("#iD-turn-only", "inline turn") }
49861     };
49862     var docs = fieldHelpKeys[fieldName].map(function(key) {
49863       var helpkey = "help.field." + fieldName + "." + key[0];
49864       var text = key[1].reduce(function(all, part) {
49865         var subkey = helpkey + "." + part;
49866         var depth = fieldHelpHeadings[subkey];
49867         var hhh = depth ? Array(depth + 1).join("#") + " " : "";
49868         return all + hhh + _t.html(subkey, replacements) + "\n\n";
49869       }, "");
49870       return {
49871         key: helpkey,
49872         title: _t.html(helpkey + ".title"),
49873         html: marked(text.trim())
49874       };
49875     });
49876     function show() {
49877       updatePosition();
49878       _body.classed("hide", false).style("opacity", "0").transition().duration(200).style("opacity", "1");
49879     }
49880     function hide() {
49881       _body.classed("hide", true).transition().duration(200).style("opacity", "0").on("end", function() {
49882         _body.classed("hide", true);
49883       });
49884     }
49885     function clickHelp(index) {
49886       var d2 = docs[index];
49887       var tkeys = fieldHelpKeys[fieldName][index][1];
49888       _body.selectAll(".field-help-nav-item").classed("active", function(d4, i3) {
49889         return i3 === index;
49890       });
49891       var content = _body.selectAll(".field-help-content").html(d2.html);
49892       content.selectAll("p").attr("class", function(d4, i3) {
49893         return tkeys[i3];
49894       });
49895       if (d2.key === "help.field.restrictions.inspecting") {
49896         content.insert("img", "p.from_shadow").attr("class", "field-help-image cf").attr("src", context.imagePath("tr_inspect.gif"));
49897       } else if (d2.key === "help.field.restrictions.modifying") {
49898         content.insert("img", "p.allow_turn").attr("class", "field-help-image cf").attr("src", context.imagePath("tr_modify.gif"));
49899       }
49900     }
49901     fieldHelp.button = function(selection2) {
49902       if (_body.empty()) return;
49903       var button = selection2.selectAll(".field-help-button").data([0]);
49904       button.enter().append("button").attr("class", "field-help-button").call(svgIcon("#iD-icon-help")).merge(button).on("click", function(d3_event) {
49905         d3_event.stopPropagation();
49906         d3_event.preventDefault();
49907         if (_body.classed("hide")) {
49908           show();
49909         } else {
49910           hide();
49911         }
49912       });
49913     };
49914     function updatePosition() {
49915       var wrap2 = _wrap.node();
49916       var inspector = _inspector.node();
49917       var wRect = wrap2.getBoundingClientRect();
49918       var iRect = inspector.getBoundingClientRect();
49919       _body.style("top", wRect.top + inspector.scrollTop - iRect.top + "px");
49920     }
49921     fieldHelp.body = function(selection2) {
49922       _wrap = selection2.selectAll(".form-field-input-wrap");
49923       if (_wrap.empty()) return;
49924       _inspector = context.container().select(".sidebar .entity-editor-pane .inspector-body");
49925       if (_inspector.empty()) return;
49926       _body = _inspector.selectAll(".field-help-body").data([0]);
49927       var enter = _body.enter().append("div").attr("class", "field-help-body hide");
49928       var titleEnter = enter.append("div").attr("class", "field-help-title cf");
49929       titleEnter.append("h2").attr("class", _mainLocalizer.textDirection() === "rtl" ? "fr" : "fl").call(_t.append("help.field." + fieldName + ".title"));
49930       titleEnter.append("button").attr("class", "fr close").attr("title", _t("icons.close")).on("click", function(d3_event) {
49931         d3_event.stopPropagation();
49932         d3_event.preventDefault();
49933         hide();
49934       }).call(svgIcon("#iD-icon-close"));
49935       var navEnter = enter.append("div").attr("class", "field-help-nav cf");
49936       var titles = docs.map(function(d2) {
49937         return d2.title;
49938       });
49939       navEnter.selectAll(".field-help-nav-item").data(titles).enter().append("div").attr("class", "field-help-nav-item").html(function(d2) {
49940         return d2;
49941       }).on("click", function(d3_event, d2) {
49942         d3_event.stopPropagation();
49943         d3_event.preventDefault();
49944         clickHelp(titles.indexOf(d2));
49945       });
49946       enter.append("div").attr("class", "field-help-content");
49947       _body = _body.merge(enter);
49948       clickHelp(0);
49949     };
49950     return fieldHelp;
49951   }
49952   var init_field_help = __esm({
49953     "modules/ui/field_help.js"() {
49954       "use strict";
49955       init_src5();
49956       init_marked_esm();
49957       init_localizer();
49958       init_icon();
49959       init_helper();
49960     }
49961   });
49962
49963   // modules/ui/fields/check.js
49964   var check_exports = {};
49965   __export(check_exports, {
49966     uiFieldCheck: () => uiFieldCheck,
49967     uiFieldDefaultCheck: () => uiFieldCheck,
49968     uiFieldOnewayCheck: () => uiFieldCheck
49969   });
49970   function uiFieldCheck(field, context) {
49971     var dispatch14 = dispatch_default("change");
49972     var options2 = field.options;
49973     var values = [];
49974     var texts = [];
49975     var _tags;
49976     var input = select_default2(null);
49977     var text = select_default2(null);
49978     var label = select_default2(null);
49979     var reverser = select_default2(null);
49980     var _impliedYes;
49981     var _entityIDs = [];
49982     var _value;
49983     var stringsField = field.resolveReference("stringsCrossReference");
49984     if (!options2 && stringsField.options) {
49985       options2 = stringsField.options;
49986     }
49987     if (options2) {
49988       for (var i3 in options2) {
49989         var v2 = options2[i3];
49990         values.push(v2 === "undefined" ? void 0 : v2);
49991         texts.push(stringsField.t.html("options." + v2, { "default": v2 }));
49992       }
49993     } else {
49994       values = [void 0, "yes"];
49995       texts = [_t.html("inspector.unknown"), _t.html("inspector.check.yes")];
49996       if (field.type !== "defaultCheck") {
49997         values.push("no");
49998         texts.push(_t.html("inspector.check.no"));
49999       }
50000     }
50001     function checkImpliedYes() {
50002       _impliedYes = field.id === "oneway_yes";
50003       if (field.id === "oneway") {
50004         var entity = context.entity(_entityIDs[0]);
50005         if (entity.type === "way" && entity.isOneWay()) {
50006           _impliedYes = true;
50007           texts[0] = _t.html("_tagging.presets.fields.oneway_yes.options.undefined");
50008         }
50009       }
50010     }
50011     function reverserHidden() {
50012       if (!context.container().select("div.inspector-hover").empty()) return true;
50013       return !(_value === "yes" || _impliedYes && !_value);
50014     }
50015     function reverserSetText(selection2) {
50016       var entity = _entityIDs.length && context.hasEntity(_entityIDs[0]);
50017       if (reverserHidden() || !entity) return selection2;
50018       var first = entity.first();
50019       var last = entity.isClosed() ? entity.nodes[entity.nodes.length - 2] : entity.last();
50020       var pseudoDirection = first < last;
50021       var icon2 = pseudoDirection ? "#iD-icon-forward" : "#iD-icon-backward";
50022       selection2.selectAll(".reverser-span").html("").call(_t.append("inspector.check.reverser")).call(svgIcon(icon2, "inline"));
50023       return selection2;
50024     }
50025     var check = function(selection2) {
50026       checkImpliedYes();
50027       label = selection2.selectAll(".form-field-input-wrap").data([0]);
50028       var enter = label.enter().append("label").attr("class", "form-field-input-wrap form-field-input-check");
50029       enter.append("input").property("indeterminate", field.type !== "defaultCheck").attr("type", "checkbox").attr("id", field.domId);
50030       enter.append("span").html(texts[0]).attr("class", "value");
50031       if (field.type === "onewayCheck") {
50032         enter.append("button").attr("class", "reverser" + (reverserHidden() ? " hide" : "")).append("span").attr("class", "reverser-span");
50033       }
50034       label = label.merge(enter);
50035       input = label.selectAll("input");
50036       text = label.selectAll("span.value");
50037       input.on("click", function(d3_event) {
50038         d3_event.stopPropagation();
50039         var t2 = {};
50040         if (Array.isArray(_tags[field.key])) {
50041           if (values.indexOf("yes") !== -1) {
50042             t2[field.key] = "yes";
50043           } else {
50044             t2[field.key] = values[0];
50045           }
50046         } else {
50047           t2[field.key] = values[(values.indexOf(_value) + 1) % values.length];
50048         }
50049         if (t2[field.key] === "reversible" || t2[field.key] === "alternating") {
50050           t2[field.key] = values[0];
50051         }
50052         dispatch14.call("change", this, t2);
50053       });
50054       if (field.type === "onewayCheck") {
50055         reverser = label.selectAll(".reverser");
50056         reverser.call(reverserSetText).on("click", function(d3_event) {
50057           d3_event.preventDefault();
50058           d3_event.stopPropagation();
50059           context.perform(
50060             function(graph) {
50061               for (var i4 in _entityIDs) {
50062                 graph = actionReverse(_entityIDs[i4])(graph);
50063               }
50064               return graph;
50065             },
50066             _t("operations.reverse.annotation.line", { n: 1 })
50067           );
50068           context.validator().validate();
50069           select_default2(this).call(reverserSetText);
50070         });
50071       }
50072     };
50073     check.entityIDs = function(val) {
50074       if (!arguments.length) return _entityIDs;
50075       _entityIDs = val;
50076       return check;
50077     };
50078     check.tags = function(tags) {
50079       _tags = tags;
50080       function isChecked(val) {
50081         return val !== "no" && val !== "" && val !== void 0 && val !== null;
50082       }
50083       function textFor(val) {
50084         if (val === "") val = void 0;
50085         var index = values.indexOf(val);
50086         return index !== -1 ? texts[index] : '"' + val + '"';
50087       }
50088       checkImpliedYes();
50089       var isMixed = Array.isArray(tags[field.key]);
50090       _value = !isMixed && tags[field.key] && tags[field.key].toLowerCase();
50091       if (field.type === "onewayCheck" && (_value === "1" || _value === "-1")) {
50092         _value = "yes";
50093       }
50094       input.property("indeterminate", isMixed || field.type !== "defaultCheck" && !_value).property("checked", isChecked(_value));
50095       text.html(isMixed ? _t.html("inspector.multiple_values") : textFor(_value)).classed("mixed", isMixed);
50096       label.classed("set", !!_value);
50097       if (field.type === "onewayCheck") {
50098         reverser.classed("hide", reverserHidden()).call(reverserSetText);
50099       }
50100     };
50101     check.focus = function() {
50102       input.node().focus();
50103     };
50104     return utilRebind(check, dispatch14, "on");
50105   }
50106   var init_check = __esm({
50107     "modules/ui/fields/check.js"() {
50108       "use strict";
50109       init_src4();
50110       init_src5();
50111       init_rebind();
50112       init_localizer();
50113       init_reverse();
50114       init_icon();
50115     }
50116   });
50117
50118   // modules/svg/helpers.js
50119   var helpers_exports = {};
50120   __export(helpers_exports, {
50121     svgMarkerSegments: () => svgMarkerSegments,
50122     svgPassiveVertex: () => svgPassiveVertex,
50123     svgPath: () => svgPath,
50124     svgPointTransform: () => svgPointTransform,
50125     svgRelationMemberTags: () => svgRelationMemberTags,
50126     svgSegmentWay: () => svgSegmentWay
50127   });
50128   function svgPassiveVertex(node, graph, activeID) {
50129     if (!activeID) return 1;
50130     if (activeID === node.id) return 0;
50131     var parents = graph.parentWays(node);
50132     var i3, j2, nodes, isClosed, ix1, ix2, ix3, ix4, max3;
50133     for (i3 = 0; i3 < parents.length; i3++) {
50134       nodes = parents[i3].nodes;
50135       isClosed = parents[i3].isClosed();
50136       for (j2 = 0; j2 < nodes.length; j2++) {
50137         if (nodes[j2] === node.id) {
50138           ix1 = j2 - 2;
50139           ix2 = j2 - 1;
50140           ix3 = j2 + 1;
50141           ix4 = j2 + 2;
50142           if (isClosed) {
50143             max3 = nodes.length - 1;
50144             if (ix1 < 0) ix1 = max3 + ix1;
50145             if (ix2 < 0) ix2 = max3 + ix2;
50146             if (ix3 > max3) ix3 = ix3 - max3;
50147             if (ix4 > max3) ix4 = ix4 - max3;
50148           }
50149           if (nodes[ix1] === activeID) return 0;
50150           else if (nodes[ix2] === activeID) return 2;
50151           else if (nodes[ix3] === activeID) return 2;
50152           else if (nodes[ix4] === activeID) return 0;
50153           else if (isClosed && nodes.indexOf(activeID) !== -1) return 0;
50154         }
50155       }
50156     }
50157     return 1;
50158   }
50159   function svgMarkerSegments(projection2, graph, dt2, shouldReverse = () => false, bothDirections = () => false) {
50160     return function(entity) {
50161       let i3 = 0;
50162       let offset = dt2 / 2;
50163       const segments = [];
50164       const clip = paddedClipExtent(projection2);
50165       const coordinates = graph.childNodes(entity).map(function(n3) {
50166         return n3.loc;
50167       });
50168       let a2, b2;
50169       const _shouldReverse = shouldReverse(entity);
50170       const _bothDirections = bothDirections(entity);
50171       stream_default({
50172         type: "LineString",
50173         coordinates
50174       }, projection2.stream(clip({
50175         lineStart: function() {
50176         },
50177         lineEnd: function() {
50178           a2 = null;
50179         },
50180         point: function(x2, y2) {
50181           b2 = [x2, y2];
50182           if (a2) {
50183             let span = geoVecLength(a2, b2) - offset;
50184             if (span >= 0) {
50185               const heading2 = geoVecAngle(a2, b2);
50186               const dx = dt2 * Math.cos(heading2);
50187               const dy = dt2 * Math.sin(heading2);
50188               let p2 = [
50189                 a2[0] + offset * Math.cos(heading2),
50190                 a2[1] + offset * Math.sin(heading2)
50191               ];
50192               const coord2 = [a2, p2];
50193               for (span -= dt2; span >= 0; span -= dt2) {
50194                 p2 = geoVecAdd(p2, [dx, dy]);
50195                 coord2.push(p2);
50196               }
50197               coord2.push(b2);
50198               let segment = "";
50199               if (!_shouldReverse || _bothDirections) {
50200                 for (let j2 = 0; j2 < coord2.length; j2++) {
50201                   segment += (j2 === 0 ? "M" : "L") + coord2[j2][0] + "," + coord2[j2][1];
50202                 }
50203                 segments.push({ id: entity.id, index: i3++, d: segment });
50204               }
50205               if (_shouldReverse || _bothDirections) {
50206                 segment = "";
50207                 for (let j2 = coord2.length - 1; j2 >= 0; j2--) {
50208                   segment += (j2 === coord2.length - 1 ? "M" : "L") + coord2[j2][0] + "," + coord2[j2][1];
50209                 }
50210                 segments.push({ id: entity.id, index: i3++, d: segment });
50211               }
50212             }
50213             offset = -span;
50214           }
50215           a2 = b2;
50216         }
50217       })));
50218       return segments;
50219     };
50220   }
50221   function svgPath(projection2, graph, isArea) {
50222     const cache = {};
50223     const project = projection2.stream;
50224     const clip = paddedClipExtent(projection2, isArea);
50225     const path = path_default().projection({ stream: function(output) {
50226       return project(clip(output));
50227     } });
50228     const svgpath = function(entity) {
50229       if (entity.id in cache) {
50230         return cache[entity.id];
50231       } else {
50232         return cache[entity.id] = path(entity.asGeoJSON(graph));
50233       }
50234     };
50235     svgpath.geojson = function(d2) {
50236       if (d2.__featurehash__ !== void 0) {
50237         if (d2.__featurehash__ in cache) {
50238           return cache[d2.__featurehash__];
50239         } else {
50240           return cache[d2.__featurehash__] = path(d2);
50241         }
50242       } else {
50243         return path(d2);
50244       }
50245     };
50246     return svgpath;
50247   }
50248   function svgPointTransform(projection2) {
50249     var svgpoint = function(entity) {
50250       var pt2 = projection2(entity.loc);
50251       return "translate(" + pt2[0] + "," + pt2[1] + ")";
50252     };
50253     svgpoint.geojson = function(d2) {
50254       return svgpoint(d2.properties.entity);
50255     };
50256     return svgpoint;
50257   }
50258   function svgRelationMemberTags(graph) {
50259     return function(entity) {
50260       var tags = entity.tags;
50261       var shouldCopyMultipolygonTags = !entity.hasInterestingTags();
50262       graph.parentRelations(entity).forEach(function(relation) {
50263         var type2 = relation.tags.type;
50264         if (type2 === "multipolygon" && shouldCopyMultipolygonTags || type2 === "boundary") {
50265           tags = Object.assign({}, relation.tags, tags);
50266         }
50267       });
50268       return tags;
50269     };
50270   }
50271   function svgSegmentWay(way, graph, activeID) {
50272     if (activeID === void 0) {
50273       return graph.transient(way, "waySegments", getWaySegments);
50274     } else {
50275       return getWaySegments();
50276     }
50277     function getWaySegments() {
50278       var isActiveWay = way.nodes.indexOf(activeID) !== -1;
50279       var features = { passive: [], active: [] };
50280       var start2 = {};
50281       var end = {};
50282       var node, type2;
50283       for (var i3 = 0; i3 < way.nodes.length; i3++) {
50284         node = graph.entity(way.nodes[i3]);
50285         type2 = svgPassiveVertex(node, graph, activeID);
50286         end = { node, type: type2 };
50287         if (start2.type !== void 0) {
50288           if (start2.node.id === activeID || end.node.id === activeID) {
50289           } else if (isActiveWay && (start2.type === 2 || end.type === 2)) {
50290             pushActive(start2, end, i3);
50291           } else if (start2.type === 0 && end.type === 0) {
50292             pushActive(start2, end, i3);
50293           } else {
50294             pushPassive(start2, end, i3);
50295           }
50296         }
50297         start2 = end;
50298       }
50299       return features;
50300       function pushActive(start3, end2, index) {
50301         features.active.push({
50302           type: "Feature",
50303           id: way.id + "-" + index + "-nope",
50304           properties: {
50305             nope: true,
50306             target: true,
50307             entity: way,
50308             nodes: [start3.node, end2.node],
50309             index
50310           },
50311           geometry: {
50312             type: "LineString",
50313             coordinates: [start3.node.loc, end2.node.loc]
50314           }
50315         });
50316       }
50317       function pushPassive(start3, end2, index) {
50318         features.passive.push({
50319           type: "Feature",
50320           id: way.id + "-" + index,
50321           properties: {
50322             target: true,
50323             entity: way,
50324             nodes: [start3.node, end2.node],
50325             index
50326           },
50327           geometry: {
50328             type: "LineString",
50329             coordinates: [start3.node.loc, end2.node.loc]
50330           }
50331         });
50332       }
50333     }
50334   }
50335   function paddedClipExtent(projection2, isArea = false) {
50336     var padding = isArea ? 65 : 5;
50337     var viewport = projection2.clipExtent();
50338     var paddedExtent = [
50339       [viewport[0][0] - padding, viewport[0][1] - padding],
50340       [viewport[1][0] + padding, viewport[1][1] + padding]
50341     ];
50342     return identity_default2().clipExtent(paddedExtent).stream;
50343   }
50344   var init_helpers = __esm({
50345     "modules/svg/helpers.js"() {
50346       "use strict";
50347       init_src2();
50348       init_geo2();
50349     }
50350   });
50351
50352   // modules/svg/tag_classes.js
50353   var tag_classes_exports = {};
50354   __export(tag_classes_exports, {
50355     svgTagClasses: () => svgTagClasses
50356   });
50357   function svgTagClasses() {
50358     var primaries = [
50359       "building",
50360       "highway",
50361       "railway",
50362       "waterway",
50363       "aeroway",
50364       "aerialway",
50365       "piste:type",
50366       "boundary",
50367       "power",
50368       "amenity",
50369       "natural",
50370       "landuse",
50371       "leisure",
50372       "military",
50373       "place",
50374       "man_made",
50375       "route",
50376       "attraction",
50377       "roller_coaster",
50378       "building:part",
50379       "indoor"
50380     ];
50381     var statuses = Object.keys(osmLifecyclePrefixes);
50382     var secondaries = [
50383       "oneway",
50384       "bridge",
50385       "tunnel",
50386       "embankment",
50387       "cutting",
50388       "barrier",
50389       "surface",
50390       "tracktype",
50391       "footway",
50392       "crossing",
50393       "service",
50394       "sport",
50395       "public_transport",
50396       "location",
50397       "parking",
50398       "golf",
50399       "type",
50400       "leisure",
50401       "man_made",
50402       "indoor",
50403       "construction",
50404       "proposed"
50405     ];
50406     var _tags = function(entity) {
50407       return entity.tags;
50408     };
50409     var tagClasses = function(selection2) {
50410       selection2.each(function tagClassesEach(entity) {
50411         var value = this.className;
50412         if (value.baseVal !== void 0) {
50413           value = value.baseVal;
50414         }
50415         var t2 = _tags(entity);
50416         var computed = tagClasses.getClassesString(t2, value);
50417         if (computed !== value) {
50418           select_default2(this).attr("class", computed);
50419         }
50420       });
50421     };
50422     tagClasses.getClassesString = function(t2, value) {
50423       var primary, status;
50424       var i3, j2, k2, v2;
50425       var overrideGeometry;
50426       if (/\bstroke\b/.test(value)) {
50427         if (!!t2.barrier && t2.barrier !== "no") {
50428           overrideGeometry = "line";
50429         }
50430       }
50431       var classes = value.trim().split(/\s+/).filter(function(klass) {
50432         return klass.length && !/^tag-/.test(klass);
50433       }).map(function(klass) {
50434         return klass === "line" || klass === "area" ? overrideGeometry || klass : klass;
50435       });
50436       for (i3 = 0; i3 < primaries.length; i3++) {
50437         k2 = primaries[i3];
50438         v2 = t2[k2];
50439         if (!v2 || v2 === "no") continue;
50440         if (k2 === "piste:type") {
50441           k2 = "piste";
50442         } else if (k2 === "building:part") {
50443           k2 = "building_part";
50444         }
50445         primary = k2;
50446         if (statuses.indexOf(v2) !== -1) {
50447           status = v2;
50448           classes.push("tag-" + k2);
50449         } else {
50450           classes.push("tag-" + k2);
50451           classes.push("tag-" + k2 + "-" + v2);
50452         }
50453         break;
50454       }
50455       if (!primary) {
50456         for (i3 = 0; i3 < statuses.length; i3++) {
50457           for (j2 = 0; j2 < primaries.length; j2++) {
50458             k2 = statuses[i3] + ":" + primaries[j2];
50459             v2 = t2[k2];
50460             if (!v2 || v2 === "no") continue;
50461             status = statuses[i3];
50462             break;
50463           }
50464         }
50465       }
50466       if (!status) {
50467         for (i3 = 0; i3 < statuses.length; i3++) {
50468           k2 = statuses[i3];
50469           v2 = t2[k2];
50470           if (!v2 || v2 === "no") continue;
50471           if (v2 === "yes") {
50472             status = k2;
50473           } else if (primary && primary === v2) {
50474             status = k2;
50475           } else if (!primary && primaries.indexOf(v2) !== -1) {
50476             status = k2;
50477             primary = v2;
50478             classes.push("tag-" + v2);
50479           }
50480           if (status) break;
50481         }
50482       }
50483       if (status) {
50484         classes.push("tag-status");
50485         classes.push("tag-status-" + status);
50486       }
50487       for (i3 = 0; i3 < secondaries.length; i3++) {
50488         k2 = secondaries[i3];
50489         v2 = t2[k2];
50490         if (!v2 || v2 === "no" || k2 === primary) continue;
50491         classes.push("tag-" + k2);
50492         classes.push("tag-" + k2 + "-" + v2);
50493       }
50494       if (primary === "highway" && !osmPathHighwayTagValues[t2.highway] || primary === "aeroway") {
50495         var surface = t2.highway === "track" ? "unpaved" : "paved";
50496         for (k2 in t2) {
50497           v2 = t2[k2];
50498           if (k2 in osmPavedTags) {
50499             surface = osmPavedTags[k2][v2] ? "paved" : "unpaved";
50500           }
50501           if (k2 in osmSemipavedTags && !!osmSemipavedTags[k2][v2]) {
50502             surface = "semipaved";
50503           }
50504         }
50505         classes.push("tag-" + surface);
50506       }
50507       var qid = t2.wikidata || t2["flag:wikidata"] || t2["brand:wikidata"] || t2["network:wikidata"] || t2["operator:wikidata"];
50508       if (qid) {
50509         classes.push("tag-wikidata");
50510       }
50511       return classes.filter((klass) => /^[-_a-z0-9]+$/.test(klass)).join(" ").trim();
50512     };
50513     tagClasses.tags = function(val) {
50514       if (!arguments.length) return _tags;
50515       _tags = val;
50516       return tagClasses;
50517     };
50518     return tagClasses;
50519   }
50520   var init_tag_classes = __esm({
50521     "modules/svg/tag_classes.js"() {
50522       "use strict";
50523       init_src5();
50524       init_tags();
50525     }
50526   });
50527
50528   // modules/svg/tag_pattern.js
50529   var tag_pattern_exports = {};
50530   __export(tag_pattern_exports, {
50531     svgTagPattern: () => svgTagPattern
50532   });
50533   function svgTagPattern(tags) {
50534     if (tags.building && tags.building !== "no") {
50535       return null;
50536     }
50537     for (var tag2 in patterns) {
50538       var entityValue = tags[tag2];
50539       if (!entityValue) continue;
50540       if (typeof patterns[tag2] === "string") {
50541         return "pattern-" + patterns[tag2];
50542       } else {
50543         var values = patterns[tag2];
50544         for (var value in values) {
50545           if (entityValue !== value) continue;
50546           var rules = values[value];
50547           if (typeof rules === "string") {
50548             return "pattern-" + rules;
50549           }
50550           for (var ruleKey in rules) {
50551             var rule = rules[ruleKey];
50552             var pass = true;
50553             for (var criterion in rule) {
50554               if (criterion !== "pattern") {
50555                 var v2 = tags[criterion];
50556                 if (!v2 || v2 !== rule[criterion]) {
50557                   pass = false;
50558                   break;
50559                 }
50560               }
50561             }
50562             if (pass) {
50563               return "pattern-" + rule.pattern;
50564             }
50565           }
50566         }
50567       }
50568     }
50569     return null;
50570   }
50571   var patterns;
50572   var init_tag_pattern = __esm({
50573     "modules/svg/tag_pattern.js"() {
50574       "use strict";
50575       patterns = {
50576         // tag - pattern name
50577         // -or-
50578         // tag - value - pattern name
50579         // -or-
50580         // tag - value - rules (optional tag-values, pattern name)
50581         // (matches earlier rules first, so fallback should be last entry)
50582         amenity: {
50583           grave_yard: "cemetery",
50584           fountain: "water_standing"
50585         },
50586         landuse: {
50587           cemetery: [
50588             { religion: "christian", pattern: "cemetery_christian" },
50589             { religion: "buddhist", pattern: "cemetery_buddhist" },
50590             { religion: "muslim", pattern: "cemetery_muslim" },
50591             { religion: "jewish", pattern: "cemetery_jewish" },
50592             { pattern: "cemetery" }
50593           ],
50594           construction: "construction",
50595           farmland: "farmland",
50596           farmyard: "farmyard",
50597           forest: [
50598             { leaf_type: "broadleaved", pattern: "forest_broadleaved" },
50599             { leaf_type: "needleleaved", pattern: "forest_needleleaved" },
50600             { leaf_type: "leafless", pattern: "forest_leafless" },
50601             { pattern: "forest" }
50602             // same as 'leaf_type:mixed'
50603           ],
50604           grave_yard: "cemetery",
50605           grass: "grass",
50606           landfill: "landfill",
50607           meadow: "meadow",
50608           military: "construction",
50609           orchard: "orchard",
50610           quarry: "quarry",
50611           vineyard: "vineyard"
50612         },
50613         leisure: {
50614           horse_riding: "farmyard"
50615         },
50616         natural: {
50617           beach: "beach",
50618           grassland: "grass",
50619           sand: "beach",
50620           scrub: "scrub",
50621           water: [
50622             { water: "pond", pattern: "pond" },
50623             { water: "reservoir", pattern: "water_standing" },
50624             { pattern: "waves" }
50625           ],
50626           wetland: [
50627             { wetland: "marsh", pattern: "wetland_marsh" },
50628             { wetland: "swamp", pattern: "wetland_swamp" },
50629             { wetland: "bog", pattern: "wetland_bog" },
50630             { wetland: "reedbed", pattern: "wetland_reedbed" },
50631             { pattern: "wetland" }
50632           ],
50633           wood: [
50634             { leaf_type: "broadleaved", pattern: "forest_broadleaved" },
50635             { leaf_type: "needleleaved", pattern: "forest_needleleaved" },
50636             { leaf_type: "leafless", pattern: "forest_leafless" },
50637             { pattern: "forest" }
50638             // same as 'leaf_type:mixed'
50639           ]
50640         },
50641         golf: {
50642           green: "golf_green",
50643           tee: "grass",
50644           fairway: "grass",
50645           rough: "scrub"
50646         },
50647         surface: {
50648           grass: "grass",
50649           sand: "beach"
50650         }
50651       };
50652     }
50653   });
50654
50655   // modules/svg/areas.js
50656   var areas_exports = {};
50657   __export(areas_exports, {
50658     svgAreas: () => svgAreas
50659   });
50660   function svgAreas(projection2, context) {
50661     function getPatternStyle(tags) {
50662       var imageID = svgTagPattern(tags);
50663       if (imageID) {
50664         return 'url("#ideditor-' + imageID + '")';
50665       }
50666       return "";
50667     }
50668     function drawTargets(selection2, graph, entities, filter2) {
50669       var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
50670       var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
50671       var getPath = svgPath(projection2).geojson;
50672       var activeID = context.activeID();
50673       var base = context.history().base();
50674       var data = { targets: [], nopes: [] };
50675       entities.forEach(function(way) {
50676         var features = svgSegmentWay(way, graph, activeID);
50677         data.targets.push.apply(data.targets, features.passive);
50678         data.nopes.push.apply(data.nopes, features.active);
50679       });
50680       var targetData = data.targets.filter(getPath);
50681       var targets = selection2.selectAll(".area.target-allowed").filter(function(d2) {
50682         return filter2(d2.properties.entity);
50683       }).data(targetData, function key(d2) {
50684         return d2.id;
50685       });
50686       targets.exit().remove();
50687       var segmentWasEdited = function(d2) {
50688         var wayID = d2.properties.entity.id;
50689         if (!base.entities[wayID] || !(0, import_fast_deep_equal5.default)(graph.entities[wayID].nodes, base.entities[wayID].nodes)) {
50690           return false;
50691         }
50692         return d2.properties.nodes.some(function(n3) {
50693           return !base.entities[n3.id] || !(0, import_fast_deep_equal5.default)(graph.entities[n3.id].loc, base.entities[n3.id].loc);
50694         });
50695       };
50696       targets.enter().append("path").merge(targets).attr("d", getPath).attr("class", function(d2) {
50697         return "way area target target-allowed " + targetClass + d2.id;
50698       }).classed("segment-edited", segmentWasEdited);
50699       var nopeData = data.nopes.filter(getPath);
50700       var nopes = selection2.selectAll(".area.target-nope").filter(function(d2) {
50701         return filter2(d2.properties.entity);
50702       }).data(nopeData, function key(d2) {
50703         return d2.id;
50704       });
50705       nopes.exit().remove();
50706       nopes.enter().append("path").merge(nopes).attr("d", getPath).attr("class", function(d2) {
50707         return "way area target target-nope " + nopeClass + d2.id;
50708       }).classed("segment-edited", segmentWasEdited);
50709     }
50710     function drawAreas(selection2, graph, entities, filter2) {
50711       var path = svgPath(projection2, graph, true);
50712       var areas = {};
50713       var base = context.history().base();
50714       for (var i3 = 0; i3 < entities.length; i3++) {
50715         var entity = entities[i3];
50716         if (entity.geometry(graph) !== "area") continue;
50717         if (!areas[entity.id]) {
50718           areas[entity.id] = {
50719             entity,
50720             area: Math.abs(entity.area(graph))
50721           };
50722         }
50723       }
50724       var fills = Object.values(areas).filter(function hasPath(a2) {
50725         return path(a2.entity);
50726       });
50727       fills.sort(function areaSort(a2, b2) {
50728         return b2.area - a2.area;
50729       });
50730       fills = fills.map(function(a2) {
50731         return a2.entity;
50732       });
50733       var strokes = fills.filter(function(area) {
50734         return area.type === "way";
50735       });
50736       var data = {
50737         clip: fills,
50738         shadow: strokes,
50739         stroke: strokes,
50740         fill: fills
50741       };
50742       var clipPaths = context.surface().selectAll("defs").selectAll(".clipPath-osm").filter(filter2).data(data.clip, osmEntity.key);
50743       clipPaths.exit().remove();
50744       var clipPathsEnter = clipPaths.enter().append("clipPath").attr("class", "clipPath-osm").attr("id", function(entity2) {
50745         return "ideditor-" + entity2.id + "-clippath";
50746       });
50747       clipPathsEnter.append("path");
50748       clipPaths.merge(clipPathsEnter).selectAll("path").attr("d", path);
50749       var drawLayer = selection2.selectAll(".layer-osm.areas");
50750       var touchLayer = selection2.selectAll(".layer-touch.areas");
50751       var areagroup = drawLayer.selectAll("g.areagroup").data(["fill", "shadow", "stroke"]);
50752       areagroup = areagroup.enter().append("g").attr("class", function(d2) {
50753         return "areagroup area-" + d2;
50754       }).merge(areagroup);
50755       var paths = areagroup.selectAll("path").filter(filter2).data(function(layer) {
50756         return data[layer];
50757       }, osmEntity.key);
50758       paths.exit().remove();
50759       var fillpaths = selection2.selectAll(".area-fill path.area").nodes();
50760       var bisect = bisector(function(node) {
50761         return -node.__data__.area(graph);
50762       }).left;
50763       function sortedByArea(entity2) {
50764         if (this._parent.__data__ === "fill") {
50765           return fillpaths[bisect(fillpaths, -entity2.area(graph))];
50766         }
50767       }
50768       paths = paths.enter().insert("path", sortedByArea).merge(paths).each(function(entity2) {
50769         var layer = this.parentNode.__data__;
50770         this.setAttribute("class", entity2.type + " area " + layer + " " + entity2.id);
50771         if (layer === "fill") {
50772           this.setAttribute("clip-path", "url(#ideditor-" + entity2.id + "-clippath)");
50773           this.style.fill = this.style.stroke = getPatternStyle(entity2.tags);
50774         }
50775       }).classed("added", function(d2) {
50776         return !base.entities[d2.id];
50777       }).classed("geometry-edited", function(d2) {
50778         return graph.entities[d2.id] && base.entities[d2.id] && !(0, import_fast_deep_equal5.default)(graph.entities[d2.id].nodes, base.entities[d2.id].nodes);
50779       }).classed("retagged", function(d2) {
50780         return graph.entities[d2.id] && base.entities[d2.id] && !(0, import_fast_deep_equal5.default)(graph.entities[d2.id].tags, base.entities[d2.id].tags);
50781       }).call(svgTagClasses()).attr("d", path);
50782       touchLayer.call(drawTargets, graph, data.stroke, filter2);
50783     }
50784     return drawAreas;
50785   }
50786   var import_fast_deep_equal5;
50787   var init_areas = __esm({
50788     "modules/svg/areas.js"() {
50789       "use strict";
50790       import_fast_deep_equal5 = __toESM(require_fast_deep_equal());
50791       init_src();
50792       init_osm();
50793       init_helpers();
50794       init_tag_classes();
50795       init_tag_pattern();
50796     }
50797   });
50798
50799   // node_modules/fast-json-stable-stringify/index.js
50800   var require_fast_json_stable_stringify = __commonJS({
50801     "node_modules/fast-json-stable-stringify/index.js"(exports2, module2) {
50802       "use strict";
50803       module2.exports = function(data, opts) {
50804         if (!opts) opts = {};
50805         if (typeof opts === "function") opts = { cmp: opts };
50806         var cycles = typeof opts.cycles === "boolean" ? opts.cycles : false;
50807         var cmp = opts.cmp && /* @__PURE__ */ function(f2) {
50808           return function(node) {
50809             return function(a2, b2) {
50810               var aobj = { key: a2, value: node[a2] };
50811               var bobj = { key: b2, value: node[b2] };
50812               return f2(aobj, bobj);
50813             };
50814           };
50815         }(opts.cmp);
50816         var seen = [];
50817         return function stringify3(node) {
50818           if (node && node.toJSON && typeof node.toJSON === "function") {
50819             node = node.toJSON();
50820           }
50821           if (node === void 0) return;
50822           if (typeof node == "number") return isFinite(node) ? "" + node : "null";
50823           if (typeof node !== "object") return JSON.stringify(node);
50824           var i3, out;
50825           if (Array.isArray(node)) {
50826             out = "[";
50827             for (i3 = 0; i3 < node.length; i3++) {
50828               if (i3) out += ",";
50829               out += stringify3(node[i3]) || "null";
50830             }
50831             return out + "]";
50832           }
50833           if (node === null) return "null";
50834           if (seen.indexOf(node) !== -1) {
50835             if (cycles) return JSON.stringify("__cycle__");
50836             throw new TypeError("Converting circular structure to JSON");
50837           }
50838           var seenIndex = seen.push(node) - 1;
50839           var keys2 = Object.keys(node).sort(cmp && cmp(node));
50840           out = "";
50841           for (i3 = 0; i3 < keys2.length; i3++) {
50842             var key = keys2[i3];
50843             var value = stringify3(node[key]);
50844             if (!value) continue;
50845             if (out) out += ",";
50846             out += JSON.stringify(key) + ":" + value;
50847           }
50848           seen.splice(seenIndex, 1);
50849           return "{" + out + "}";
50850         }(data);
50851       };
50852     }
50853   });
50854
50855   // node_modules/@tmcw/togeojson/dist/togeojson.es.mjs
50856   function $(element, tagName) {
50857     return Array.from(element.getElementsByTagName(tagName));
50858   }
50859   function normalizeId(id2) {
50860     return id2[0] === "#" ? id2 : `#${id2}`;
50861   }
50862   function $ns(element, tagName, ns) {
50863     return Array.from(element.getElementsByTagNameNS(ns, tagName));
50864   }
50865   function nodeVal(node) {
50866     node == null ? void 0 : node.normalize();
50867     return (node == null ? void 0 : node.textContent) || "";
50868   }
50869   function get1(node, tagName, callback) {
50870     const n3 = node.getElementsByTagName(tagName);
50871     const result = n3.length ? n3[0] : null;
50872     if (result && callback)
50873       callback(result);
50874     return result;
50875   }
50876   function get3(node, tagName, callback) {
50877     const properties = {};
50878     if (!node)
50879       return properties;
50880     const n3 = node.getElementsByTagName(tagName);
50881     const result = n3.length ? n3[0] : null;
50882     if (result && callback) {
50883       return callback(result, properties);
50884     }
50885     return properties;
50886   }
50887   function val1(node, tagName, callback) {
50888     const val = nodeVal(get1(node, tagName));
50889     if (val && callback)
50890       return callback(val) || {};
50891     return {};
50892   }
50893   function $num(node, tagName, callback) {
50894     const val = Number.parseFloat(nodeVal(get1(node, tagName)));
50895     if (Number.isNaN(val))
50896       return void 0;
50897     if (val && callback)
50898       return callback(val) || {};
50899     return {};
50900   }
50901   function num1(node, tagName, callback) {
50902     const val = Number.parseFloat(nodeVal(get1(node, tagName)));
50903     if (Number.isNaN(val))
50904       return void 0;
50905     if (callback)
50906       callback(val);
50907     return val;
50908   }
50909   function getMulti(node, propertyNames) {
50910     const properties = {};
50911     for (const property of propertyNames) {
50912       val1(node, property, (val) => {
50913         properties[property] = val;
50914       });
50915     }
50916     return properties;
50917   }
50918   function isElement(node) {
50919     return (node == null ? void 0 : node.nodeType) === 1;
50920   }
50921   function getExtensions(node) {
50922     let values = [];
50923     if (node === null)
50924       return values;
50925     for (const child of Array.from(node.childNodes)) {
50926       if (!isElement(child))
50927         continue;
50928       const name = abbreviateName(child.nodeName);
50929       if (name === "gpxtpx:TrackPointExtension") {
50930         values = values.concat(getExtensions(child));
50931       } else {
50932         const val = nodeVal(child);
50933         values.push([name, parseNumeric(val)]);
50934       }
50935     }
50936     return values;
50937   }
50938   function abbreviateName(name) {
50939     return ["heart", "gpxtpx:hr", "hr"].includes(name) ? "heart" : name;
50940   }
50941   function parseNumeric(val) {
50942     const num = Number.parseFloat(val);
50943     return Number.isNaN(num) ? val : num;
50944   }
50945   function coordPair$1(node) {
50946     const ll = [
50947       Number.parseFloat(node.getAttribute("lon") || ""),
50948       Number.parseFloat(node.getAttribute("lat") || "")
50949     ];
50950     if (Number.isNaN(ll[0]) || Number.isNaN(ll[1])) {
50951       return null;
50952     }
50953     num1(node, "ele", (val) => {
50954       ll.push(val);
50955     });
50956     const time = get1(node, "time");
50957     return {
50958       coordinates: ll,
50959       time: time ? nodeVal(time) : null,
50960       extendedValues: getExtensions(get1(node, "extensions"))
50961     };
50962   }
50963   function getLineStyle(node) {
50964     return get3(node, "line", (lineStyle) => {
50965       const val = Object.assign({}, val1(lineStyle, "color", (color2) => {
50966         return { stroke: `#${color2}` };
50967       }), $num(lineStyle, "opacity", (opacity) => {
50968         return { "stroke-opacity": opacity };
50969       }), $num(lineStyle, "width", (width) => {
50970         return { "stroke-width": width * 96 / 25.4 };
50971       }));
50972       return val;
50973     });
50974   }
50975   function extractProperties(ns, node) {
50976     var _a3;
50977     const properties = getMulti(node, [
50978       "name",
50979       "cmt",
50980       "desc",
50981       "type",
50982       "time",
50983       "keywords"
50984     ]);
50985     for (const [n3, url] of ns) {
50986       for (const child of Array.from(node.getElementsByTagNameNS(url, "*"))) {
50987         properties[child.tagName.replace(":", "_")] = (_a3 = nodeVal(child)) == null ? void 0 : _a3.trim();
50988       }
50989     }
50990     const links = $(node, "link");
50991     if (links.length) {
50992       properties.links = links.map((link3) => Object.assign({ href: link3.getAttribute("href") }, getMulti(link3, ["text", "type"])));
50993     }
50994     return properties;
50995   }
50996   function getPoints$1(node, pointname) {
50997     const pts = $(node, pointname);
50998     const line = [];
50999     const times = [];
51000     const extendedValues = {};
51001     for (let i3 = 0; i3 < pts.length; i3++) {
51002       const c2 = coordPair$1(pts[i3]);
51003       if (!c2) {
51004         continue;
51005       }
51006       line.push(c2.coordinates);
51007       if (c2.time)
51008         times.push(c2.time);
51009       for (const [name, val] of c2.extendedValues) {
51010         const plural = name === "heart" ? name : `${name.replace("gpxtpx:", "")}s`;
51011         if (!extendedValues[plural]) {
51012           extendedValues[plural] = Array(pts.length).fill(null);
51013         }
51014         extendedValues[plural][i3] = val;
51015       }
51016     }
51017     if (line.length < 2)
51018       return;
51019     return {
51020       line,
51021       times,
51022       extendedValues
51023     };
51024   }
51025   function getRoute(ns, node) {
51026     const line = getPoints$1(node, "rtept");
51027     if (!line)
51028       return;
51029     return {
51030       type: "Feature",
51031       properties: Object.assign({ _gpxType: "rte" }, extractProperties(ns, node), getLineStyle(get1(node, "extensions"))),
51032       geometry: {
51033         type: "LineString",
51034         coordinates: line.line
51035       }
51036     };
51037   }
51038   function getTrack(ns, node) {
51039     var _a3;
51040     const segments = $(node, "trkseg");
51041     const track = [];
51042     const times = [];
51043     const extractedLines = [];
51044     for (const segment of segments) {
51045       const line = getPoints$1(segment, "trkpt");
51046       if (line) {
51047         extractedLines.push(line);
51048         if ((_a3 = line.times) == null ? void 0 : _a3.length)
51049           times.push(line.times);
51050       }
51051     }
51052     if (extractedLines.length === 0)
51053       return null;
51054     const multi = extractedLines.length > 1;
51055     const properties = Object.assign({ _gpxType: "trk" }, extractProperties(ns, node), getLineStyle(get1(node, "extensions")), times.length ? {
51056       coordinateProperties: {
51057         times: multi ? times : times[0]
51058       }
51059     } : {});
51060     for (const line of extractedLines) {
51061       track.push(line.line);
51062       if (!properties.coordinateProperties) {
51063         properties.coordinateProperties = {};
51064       }
51065       const props = properties.coordinateProperties;
51066       const entries = Object.entries(line.extendedValues);
51067       for (let i3 = 0; i3 < entries.length; i3++) {
51068         const [name, val] = entries[i3];
51069         if (multi) {
51070           if (!props[name]) {
51071             props[name] = extractedLines.map((line2) => new Array(line2.line.length).fill(null));
51072           }
51073           props[name][i3] = val;
51074         } else {
51075           props[name] = val;
51076         }
51077       }
51078     }
51079     return {
51080       type: "Feature",
51081       properties,
51082       geometry: multi ? {
51083         type: "MultiLineString",
51084         coordinates: track
51085       } : {
51086         type: "LineString",
51087         coordinates: track[0]
51088       }
51089     };
51090   }
51091   function getPoint(ns, node) {
51092     const properties = Object.assign(extractProperties(ns, node), getMulti(node, ["sym"]));
51093     const pair3 = coordPair$1(node);
51094     if (!pair3)
51095       return null;
51096     return {
51097       type: "Feature",
51098       properties,
51099       geometry: {
51100         type: "Point",
51101         coordinates: pair3.coordinates
51102       }
51103     };
51104   }
51105   function* gpxGen(node) {
51106     var _a3, _b2;
51107     const n3 = node;
51108     const GPXX = "gpxx";
51109     const GPXX_URI = "http://www.garmin.com/xmlschemas/GpxExtensions/v3";
51110     const ns = [[GPXX, GPXX_URI]];
51111     const attrs = (_a3 = n3.getElementsByTagName("gpx")[0]) == null ? void 0 : _a3.attributes;
51112     if (attrs) {
51113       for (const attr of Array.from(attrs)) {
51114         if (((_b2 = attr.name) == null ? void 0 : _b2.startsWith("xmlns:")) && attr.value !== GPXX_URI) {
51115           ns.push([attr.name, attr.value]);
51116         }
51117       }
51118     }
51119     for (const track of $(n3, "trk")) {
51120       const feature3 = getTrack(ns, track);
51121       if (feature3)
51122         yield feature3;
51123     }
51124     for (const route of $(n3, "rte")) {
51125       const feature3 = getRoute(ns, route);
51126       if (feature3)
51127         yield feature3;
51128     }
51129     for (const waypoint of $(n3, "wpt")) {
51130       const point = getPoint(ns, waypoint);
51131       if (point)
51132         yield point;
51133     }
51134   }
51135   function gpx(node) {
51136     return {
51137       type: "FeatureCollection",
51138       features: Array.from(gpxGen(node))
51139     };
51140   }
51141   function fixColor(v2, prefix) {
51142     const properties = {};
51143     const colorProp = prefix === "stroke" || prefix === "fill" ? prefix : `${prefix}-color`;
51144     if (v2[0] === "#") {
51145       v2 = v2.substring(1);
51146     }
51147     if (v2.length === 6 || v2.length === 3) {
51148       properties[colorProp] = `#${v2}`;
51149     } else if (v2.length === 8) {
51150       properties[`${prefix}-opacity`] = Number.parseInt(v2.substring(0, 2), 16) / 255;
51151       properties[colorProp] = `#${v2.substring(6, 8)}${v2.substring(4, 6)}${v2.substring(2, 4)}`;
51152     }
51153     return properties;
51154   }
51155   function numericProperty(node, source, target) {
51156     const properties = {};
51157     num1(node, source, (val) => {
51158       properties[target] = val;
51159     });
51160     return properties;
51161   }
51162   function getColor(node, output) {
51163     return get3(node, "color", (elem) => fixColor(nodeVal(elem), output));
51164   }
51165   function extractIconHref(node) {
51166     return get3(node, "Icon", (icon2, properties) => {
51167       val1(icon2, "href", (href) => {
51168         properties.icon = href;
51169       });
51170       return properties;
51171     });
51172   }
51173   function extractIcon(node) {
51174     return get3(node, "IconStyle", (iconStyle) => {
51175       return Object.assign(getColor(iconStyle, "icon"), numericProperty(iconStyle, "scale", "icon-scale"), numericProperty(iconStyle, "heading", "icon-heading"), get3(iconStyle, "hotSpot", (hotspot) => {
51176         const left = Number.parseFloat(hotspot.getAttribute("x") || "");
51177         const top = Number.parseFloat(hotspot.getAttribute("y") || "");
51178         const xunits = hotspot.getAttribute("xunits") || "";
51179         const yunits = hotspot.getAttribute("yunits") || "";
51180         if (!Number.isNaN(left) && !Number.isNaN(top))
51181           return {
51182             "icon-offset": [left, top],
51183             "icon-offset-units": [xunits, yunits]
51184           };
51185         return {};
51186       }), extractIconHref(iconStyle));
51187     });
51188   }
51189   function extractLabel(node) {
51190     return get3(node, "LabelStyle", (labelStyle) => {
51191       return Object.assign(getColor(labelStyle, "label"), numericProperty(labelStyle, "scale", "label-scale"));
51192     });
51193   }
51194   function extractLine(node) {
51195     return get3(node, "LineStyle", (lineStyle) => {
51196       return Object.assign(getColor(lineStyle, "stroke"), numericProperty(lineStyle, "width", "stroke-width"));
51197     });
51198   }
51199   function extractPoly(node) {
51200     return get3(node, "PolyStyle", (polyStyle, properties) => {
51201       return Object.assign(properties, get3(polyStyle, "color", (elem) => fixColor(nodeVal(elem), "fill")), val1(polyStyle, "fill", (fill) => {
51202         if (fill === "0")
51203           return { "fill-opacity": 0 };
51204       }), val1(polyStyle, "outline", (outline) => {
51205         if (outline === "0")
51206           return { "stroke-opacity": 0 };
51207       }));
51208     });
51209   }
51210   function extractStyle(node) {
51211     return Object.assign({}, extractPoly(node), extractLine(node), extractLabel(node), extractIcon(node));
51212   }
51213   function coord1(value) {
51214     return value.replace(removeSpace, "").split(",").map(Number.parseFloat).filter((num) => !Number.isNaN(num)).slice(0, 3);
51215   }
51216   function coord(value) {
51217     return value.replace(trimSpace, "").split(splitSpace).map(coord1).filter((coord2) => {
51218       return coord2.length >= 2;
51219     });
51220   }
51221   function gxCoords(node) {
51222     let elems = $(node, "coord");
51223     if (elems.length === 0) {
51224       elems = $ns(node, "coord", "*");
51225     }
51226     const coordinates = elems.map((elem) => {
51227       return nodeVal(elem).split(" ").map(Number.parseFloat);
51228     });
51229     if (coordinates.length === 0) {
51230       return null;
51231     }
51232     return {
51233       geometry: coordinates.length > 2 ? {
51234         type: "LineString",
51235         coordinates
51236       } : {
51237         type: "Point",
51238         coordinates: coordinates[0]
51239       },
51240       times: $(node, "when").map((elem) => nodeVal(elem))
51241     };
51242   }
51243   function fixRing(ring) {
51244     if (ring.length === 0)
51245       return ring;
51246     const first = ring[0];
51247     const last = ring[ring.length - 1];
51248     let equal = true;
51249     for (let i3 = 0; i3 < Math.max(first.length, last.length); i3++) {
51250       if (first[i3] !== last[i3]) {
51251         equal = false;
51252         break;
51253       }
51254     }
51255     if (!equal) {
51256       return ring.concat([ring[0]]);
51257     }
51258     return ring;
51259   }
51260   function getCoordinates(node) {
51261     return nodeVal(get1(node, "coordinates"));
51262   }
51263   function getGeometry(node) {
51264     let geometries = [];
51265     let coordTimes = [];
51266     for (let i3 = 0; i3 < node.childNodes.length; i3++) {
51267       const child = node.childNodes.item(i3);
51268       if (isElement(child)) {
51269         switch (child.tagName) {
51270           case "MultiGeometry":
51271           case "MultiTrack":
51272           case "gx:MultiTrack": {
51273             const childGeometries = getGeometry(child);
51274             geometries = geometries.concat(childGeometries.geometries);
51275             coordTimes = coordTimes.concat(childGeometries.coordTimes);
51276             break;
51277           }
51278           case "Point": {
51279             const coordinates = coord1(getCoordinates(child));
51280             if (coordinates.length >= 2) {
51281               geometries.push({
51282                 type: "Point",
51283                 coordinates
51284               });
51285             }
51286             break;
51287           }
51288           case "LinearRing":
51289           case "LineString": {
51290             const coordinates = coord(getCoordinates(child));
51291             if (coordinates.length >= 2) {
51292               geometries.push({
51293                 type: "LineString",
51294                 coordinates
51295               });
51296             }
51297             break;
51298           }
51299           case "Polygon": {
51300             const coords = [];
51301             for (const linearRing of $(child, "LinearRing")) {
51302               const ring = fixRing(coord(getCoordinates(linearRing)));
51303               if (ring.length >= 4) {
51304                 coords.push(ring);
51305               }
51306             }
51307             if (coords.length) {
51308               geometries.push({
51309                 type: "Polygon",
51310                 coordinates: coords
51311               });
51312             }
51313             break;
51314           }
51315           case "Track":
51316           case "gx:Track": {
51317             const gx = gxCoords(child);
51318             if (!gx)
51319               break;
51320             const { times, geometry } = gx;
51321             geometries.push(geometry);
51322             if (times.length)
51323               coordTimes.push(times);
51324             break;
51325           }
51326         }
51327       }
51328     }
51329     return {
51330       geometries,
51331       coordTimes
51332     };
51333   }
51334   function extractExtendedData(node, schema) {
51335     return get3(node, "ExtendedData", (extendedData, properties) => {
51336       for (const data of $(extendedData, "Data")) {
51337         properties[data.getAttribute("name") || ""] = nodeVal(get1(data, "value"));
51338       }
51339       for (const simpleData of $(extendedData, "SimpleData")) {
51340         const name = simpleData.getAttribute("name") || "";
51341         const typeConverter = schema[name] || typeConverters.string;
51342         properties[name] = typeConverter(nodeVal(simpleData));
51343       }
51344       return properties;
51345     });
51346   }
51347   function getMaybeHTMLDescription(node) {
51348     const descriptionNode = get1(node, "description");
51349     for (const c2 of Array.from((descriptionNode == null ? void 0 : descriptionNode.childNodes) || [])) {
51350       if (c2.nodeType === 4) {
51351         return {
51352           description: {
51353             "@type": "html",
51354             value: nodeVal(c2)
51355           }
51356         };
51357       }
51358     }
51359     return {};
51360   }
51361   function extractTimeSpan(node) {
51362     return get3(node, "TimeSpan", (timeSpan) => {
51363       return {
51364         timespan: {
51365           begin: nodeVal(get1(timeSpan, "begin")),
51366           end: nodeVal(get1(timeSpan, "end"))
51367         }
51368       };
51369     });
51370   }
51371   function extractTimeStamp(node) {
51372     return get3(node, "TimeStamp", (timeStamp) => {
51373       return { timestamp: nodeVal(get1(timeStamp, "when")) };
51374     });
51375   }
51376   function extractCascadedStyle(node, styleMap) {
51377     return val1(node, "styleUrl", (styleUrl) => {
51378       styleUrl = normalizeId(styleUrl);
51379       if (styleMap[styleUrl]) {
51380         return Object.assign({ styleUrl }, styleMap[styleUrl]);
51381       }
51382       return { styleUrl };
51383     });
51384   }
51385   function getGroundOverlayBox(node) {
51386     const latLonQuad = get1(node, "gx:LatLonQuad");
51387     if (latLonQuad) {
51388       const ring = fixRing(coord(getCoordinates(node)));
51389       return {
51390         geometry: {
51391           type: "Polygon",
51392           coordinates: [ring]
51393         }
51394       };
51395     }
51396     return getLatLonBox(node);
51397   }
51398   function rotateBox(bbox2, coordinates, rotation) {
51399     const center = [(bbox2[0] + bbox2[2]) / 2, (bbox2[1] + bbox2[3]) / 2];
51400     return [
51401       coordinates[0].map((coordinate) => {
51402         const dy = coordinate[1] - center[1];
51403         const dx = coordinate[0] - center[0];
51404         const distance = Math.sqrt(dy ** 2 + dx ** 2);
51405         const angle2 = Math.atan2(dy, dx) + rotation * DEGREES_TO_RADIANS;
51406         return [
51407           center[0] + Math.cos(angle2) * distance,
51408           center[1] + Math.sin(angle2) * distance
51409         ];
51410       })
51411     ];
51412   }
51413   function getLatLonBox(node) {
51414     const latLonBox = get1(node, "LatLonBox");
51415     if (latLonBox) {
51416       const north = num1(latLonBox, "north");
51417       const west = num1(latLonBox, "west");
51418       const east = num1(latLonBox, "east");
51419       const south = num1(latLonBox, "south");
51420       const rotation = num1(latLonBox, "rotation");
51421       if (typeof north === "number" && typeof south === "number" && typeof west === "number" && typeof east === "number") {
51422         const bbox2 = [west, south, east, north];
51423         let coordinates = [
51424           [
51425             [west, north],
51426             // top left
51427             [east, north],
51428             // top right
51429             [east, south],
51430             // top right
51431             [west, south],
51432             // bottom left
51433             [west, north]
51434             // top left (again)
51435           ]
51436         ];
51437         if (typeof rotation === "number") {
51438           coordinates = rotateBox(bbox2, coordinates, rotation);
51439         }
51440         return {
51441           bbox: bbox2,
51442           geometry: {
51443             type: "Polygon",
51444             coordinates
51445           }
51446         };
51447       }
51448     }
51449     return null;
51450   }
51451   function getGroundOverlay(node, styleMap, schema, options2) {
51452     var _a3;
51453     const box = getGroundOverlayBox(node);
51454     const geometry = (box == null ? void 0 : box.geometry) || null;
51455     if (!geometry && options2.skipNullGeometry) {
51456       return null;
51457     }
51458     const feature3 = {
51459       type: "Feature",
51460       geometry,
51461       properties: Object.assign(
51462         /**
51463          * Related to
51464          * https://gist.github.com/tmcw/037a1cb6660d74a392e9da7446540f46
51465          */
51466         { "@geometry-type": "groundoverlay" },
51467         getMulti(node, [
51468           "name",
51469           "address",
51470           "visibility",
51471           "open",
51472           "phoneNumber",
51473           "description"
51474         ]),
51475         getMaybeHTMLDescription(node),
51476         extractCascadedStyle(node, styleMap),
51477         extractStyle(node),
51478         extractIconHref(node),
51479         extractExtendedData(node, schema),
51480         extractTimeSpan(node),
51481         extractTimeStamp(node)
51482       )
51483     };
51484     if (box == null ? void 0 : box.bbox) {
51485       feature3.bbox = box.bbox;
51486     }
51487     if (((_a3 = feature3.properties) == null ? void 0 : _a3.visibility) !== void 0) {
51488       feature3.properties.visibility = feature3.properties.visibility !== "0";
51489     }
51490     const id2 = node.getAttribute("id");
51491     if (id2 !== null && id2 !== "")
51492       feature3.id = id2;
51493     return feature3;
51494   }
51495   function geometryListToGeometry(geometries) {
51496     return geometries.length === 0 ? null : geometries.length === 1 ? geometries[0] : {
51497       type: "GeometryCollection",
51498       geometries
51499     };
51500   }
51501   function getPlacemark(node, styleMap, schema, options2) {
51502     var _a3;
51503     const { coordTimes, geometries } = getGeometry(node);
51504     const geometry = geometryListToGeometry(geometries);
51505     if (!geometry && options2.skipNullGeometry) {
51506       return null;
51507     }
51508     const feature3 = {
51509       type: "Feature",
51510       geometry,
51511       properties: Object.assign(getMulti(node, [
51512         "name",
51513         "address",
51514         "visibility",
51515         "open",
51516         "phoneNumber",
51517         "description"
51518       ]), getMaybeHTMLDescription(node), extractCascadedStyle(node, styleMap), extractStyle(node), extractExtendedData(node, schema), extractTimeSpan(node), extractTimeStamp(node), coordTimes.length ? {
51519         coordinateProperties: {
51520           times: coordTimes.length === 1 ? coordTimes[0] : coordTimes
51521         }
51522       } : {})
51523     };
51524     if (((_a3 = feature3.properties) == null ? void 0 : _a3.visibility) !== void 0) {
51525       feature3.properties.visibility = feature3.properties.visibility !== "0";
51526     }
51527     const id2 = node.getAttribute("id");
51528     if (id2 !== null && id2 !== "")
51529       feature3.id = id2;
51530     return feature3;
51531   }
51532   function getStyleId(style) {
51533     let id2 = style.getAttribute("id");
51534     const parentNode = style.parentNode;
51535     if (!id2 && isElement(parentNode) && parentNode.localName === "CascadingStyle") {
51536       id2 = parentNode.getAttribute("kml:id") || parentNode.getAttribute("id");
51537     }
51538     return normalizeId(id2 || "");
51539   }
51540   function buildStyleMap(node) {
51541     const styleMap = {};
51542     for (const style of $(node, "Style")) {
51543       styleMap[getStyleId(style)] = extractStyle(style);
51544     }
51545     for (const map2 of $(node, "StyleMap")) {
51546       const id2 = normalizeId(map2.getAttribute("id") || "");
51547       val1(map2, "styleUrl", (styleUrl) => {
51548         styleUrl = normalizeId(styleUrl);
51549         if (styleMap[styleUrl]) {
51550           styleMap[id2] = styleMap[styleUrl];
51551         }
51552       });
51553     }
51554     return styleMap;
51555   }
51556   function buildSchema(node) {
51557     const schema = {};
51558     for (const field of $(node, "SimpleField")) {
51559       schema[field.getAttribute("name") || ""] = typeConverters[field.getAttribute("type") || ""] || typeConverters.string;
51560     }
51561     return schema;
51562   }
51563   function* kmlGen(node, options2 = {
51564     skipNullGeometry: false
51565   }) {
51566     const n3 = node;
51567     const styleMap = buildStyleMap(n3);
51568     const schema = buildSchema(n3);
51569     for (const placemark of $(n3, "Placemark")) {
51570       const feature3 = getPlacemark(placemark, styleMap, schema, options2);
51571       if (feature3)
51572         yield feature3;
51573     }
51574     for (const groundOverlay of $(n3, "GroundOverlay")) {
51575       const feature3 = getGroundOverlay(groundOverlay, styleMap, schema, options2);
51576       if (feature3)
51577         yield feature3;
51578     }
51579   }
51580   function kml(node, options2 = {
51581     skipNullGeometry: false
51582   }) {
51583     return {
51584       type: "FeatureCollection",
51585       features: Array.from(kmlGen(node, options2))
51586     };
51587   }
51588   var removeSpace, trimSpace, splitSpace, toNumber2, typeConverters, DEGREES_TO_RADIANS;
51589   var init_togeojson_es = __esm({
51590     "node_modules/@tmcw/togeojson/dist/togeojson.es.mjs"() {
51591       removeSpace = /\s*/g;
51592       trimSpace = /^\s*|\s*$/g;
51593       splitSpace = /\s+/;
51594       toNumber2 = (x2) => Number(x2);
51595       typeConverters = {
51596         string: (x2) => x2,
51597         int: toNumber2,
51598         uint: toNumber2,
51599         short: toNumber2,
51600         ushort: toNumber2,
51601         float: toNumber2,
51602         double: toNumber2,
51603         bool: (x2) => Boolean(x2)
51604       };
51605       DEGREES_TO_RADIANS = Math.PI / 180;
51606     }
51607   });
51608
51609   // modules/svg/data.js
51610   var data_exports = {};
51611   __export(data_exports, {
51612     svgData: () => svgData
51613   });
51614   function svgData(projection2, context, dispatch14) {
51615     var throttledRedraw = throttle_default(function() {
51616       dispatch14.call("change");
51617     }, 1e3);
51618     var _showLabels = true;
51619     var detected = utilDetect();
51620     var layer = select_default2(null);
51621     var _vtService;
51622     var _fileList;
51623     var _template;
51624     var _src;
51625     const supportedFormats = [
51626       ".gpx",
51627       ".kml",
51628       ".geojson",
51629       ".json"
51630     ];
51631     function init2() {
51632       if (_initialized) return;
51633       _geojson = {};
51634       _enabled = true;
51635       function over(d3_event) {
51636         d3_event.stopPropagation();
51637         d3_event.preventDefault();
51638         d3_event.dataTransfer.dropEffect = "copy";
51639       }
51640       context.container().attr("dropzone", "copy").on("drop.svgData", function(d3_event) {
51641         d3_event.stopPropagation();
51642         d3_event.preventDefault();
51643         if (!detected.filedrop) return;
51644         var f2 = d3_event.dataTransfer.files[0];
51645         var extension = getExtension(f2.name);
51646         if (!supportedFormats.includes(extension)) return;
51647         drawData.fileList(d3_event.dataTransfer.files);
51648       }).on("dragenter.svgData", over).on("dragexit.svgData", over).on("dragover.svgData", over);
51649       _initialized = true;
51650     }
51651     function getService() {
51652       if (services.vectorTile && !_vtService) {
51653         _vtService = services.vectorTile;
51654         _vtService.event.on("loadedData", throttledRedraw);
51655       } else if (!services.vectorTile && _vtService) {
51656         _vtService = null;
51657       }
51658       return _vtService;
51659     }
51660     function showLayer() {
51661       layerOn();
51662       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
51663         dispatch14.call("change");
51664       });
51665     }
51666     function hideLayer() {
51667       throttledRedraw.cancel();
51668       layer.transition().duration(250).style("opacity", 0).on("end", layerOff);
51669     }
51670     function layerOn() {
51671       layer.style("display", "block");
51672     }
51673     function layerOff() {
51674       layer.selectAll(".viewfield-group").remove();
51675       layer.style("display", "none");
51676     }
51677     function ensureIDs(gj) {
51678       if (!gj) return null;
51679       if (gj.type === "FeatureCollection") {
51680         for (var i3 = 0; i3 < gj.features.length; i3++) {
51681           ensureFeatureID(gj.features[i3]);
51682         }
51683       } else {
51684         ensureFeatureID(gj);
51685       }
51686       return gj;
51687     }
51688     function ensureFeatureID(feature3) {
51689       if (!feature3) return;
51690       feature3.__featurehash__ = utilHashcode((0, import_fast_json_stable_stringify.default)(feature3));
51691       return feature3;
51692     }
51693     function getFeatures(gj) {
51694       if (!gj) return [];
51695       if (gj.type === "FeatureCollection") {
51696         return gj.features;
51697       } else {
51698         return [gj];
51699       }
51700     }
51701     function featureKey(d2) {
51702       return d2.__featurehash__;
51703     }
51704     function isPolygon(d2) {
51705       return d2.geometry.type === "Polygon" || d2.geometry.type === "MultiPolygon";
51706     }
51707     function clipPathID(d2) {
51708       return "ideditor-data-" + d2.__featurehash__ + "-clippath";
51709     }
51710     function featureClasses(d2) {
51711       return [
51712         "data" + d2.__featurehash__,
51713         d2.geometry.type,
51714         isPolygon(d2) ? "area" : "",
51715         d2.__layerID__ || ""
51716       ].filter(Boolean).join(" ");
51717     }
51718     function drawData(selection2) {
51719       var vtService = getService();
51720       var getPath = svgPath(projection2).geojson;
51721       var getAreaPath = svgPath(projection2, null, true).geojson;
51722       var hasData = drawData.hasData();
51723       layer = selection2.selectAll(".layer-mapdata").data(_enabled && hasData ? [0] : []);
51724       layer.exit().remove();
51725       layer = layer.enter().append("g").attr("class", "layer-mapdata").merge(layer);
51726       var surface = context.surface();
51727       if (!surface || surface.empty()) return;
51728       var geoData, polygonData;
51729       if (_template && vtService) {
51730         var sourceID = _template;
51731         vtService.loadTiles(sourceID, _template, projection2);
51732         geoData = vtService.data(sourceID, projection2);
51733       } else {
51734         geoData = getFeatures(_geojson);
51735       }
51736       geoData = geoData.filter(getPath);
51737       polygonData = geoData.filter(isPolygon);
51738       var clipPaths = surface.selectAll("defs").selectAll(".clipPath-data").data(polygonData, featureKey);
51739       clipPaths.exit().remove();
51740       var clipPathsEnter = clipPaths.enter().append("clipPath").attr("class", "clipPath-data").attr("id", clipPathID);
51741       clipPathsEnter.append("path");
51742       clipPaths.merge(clipPathsEnter).selectAll("path").attr("d", getAreaPath);
51743       var datagroups = layer.selectAll("g.datagroup").data(["fill", "shadow", "stroke"]);
51744       datagroups = datagroups.enter().append("g").attr("class", function(d2) {
51745         return "datagroup datagroup-" + d2;
51746       }).merge(datagroups);
51747       var pathData = {
51748         fill: polygonData,
51749         shadow: geoData,
51750         stroke: geoData
51751       };
51752       var paths = datagroups.selectAll("path").data(function(layer2) {
51753         return pathData[layer2];
51754       }, featureKey);
51755       paths.exit().remove();
51756       paths = paths.enter().append("path").attr("class", function(d2) {
51757         var datagroup = this.parentNode.__data__;
51758         return "pathdata " + datagroup + " " + featureClasses(d2);
51759       }).attr("clip-path", function(d2) {
51760         var datagroup = this.parentNode.__data__;
51761         return datagroup === "fill" ? "url(#" + clipPathID(d2) + ")" : null;
51762       }).merge(paths).attr("d", function(d2) {
51763         var datagroup = this.parentNode.__data__;
51764         return datagroup === "fill" ? getAreaPath(d2) : getPath(d2);
51765       });
51766       layer.call(drawLabels, "label-halo", geoData).call(drawLabels, "label", geoData);
51767       function drawLabels(selection3, textClass, data) {
51768         var labelPath = path_default(projection2);
51769         var labelData = data.filter(function(d2) {
51770           return _showLabels && d2.properties && (d2.properties.desc || d2.properties.name);
51771         });
51772         var labels = selection3.selectAll("text." + textClass).data(labelData, featureKey);
51773         labels.exit().remove();
51774         labels = labels.enter().append("text").attr("class", function(d2) {
51775           return textClass + " " + featureClasses(d2);
51776         }).merge(labels).text(function(d2) {
51777           return d2.properties.desc || d2.properties.name;
51778         }).attr("x", function(d2) {
51779           var centroid = labelPath.centroid(d2);
51780           return centroid[0] + 11;
51781         }).attr("y", function(d2) {
51782           var centroid = labelPath.centroid(d2);
51783           return centroid[1];
51784         });
51785       }
51786     }
51787     function getExtension(fileName) {
51788       if (!fileName) return;
51789       var re3 = /\.(gpx|kml|(geo)?json|png)$/i;
51790       var match = fileName.toLowerCase().match(re3);
51791       return match && match.length && match[0];
51792     }
51793     function xmlToDom(textdata) {
51794       return new DOMParser().parseFromString(textdata, "text/xml");
51795     }
51796     function stringifyGeojsonProperties(feature3) {
51797       const properties = feature3.properties;
51798       for (const key in properties) {
51799         const property = properties[key];
51800         if (typeof property === "number" || typeof property === "boolean" || Array.isArray(property)) {
51801           properties[key] = property.toString();
51802         } else if (property === null) {
51803           properties[key] = "null";
51804         } else if (typeof property === "object") {
51805           properties[key] = JSON.stringify(property);
51806         }
51807       }
51808     }
51809     drawData.setFile = function(extension, data) {
51810       _template = null;
51811       _fileList = null;
51812       _geojson = null;
51813       _src = null;
51814       var gj;
51815       switch (extension) {
51816         case ".gpx":
51817           gj = gpx(xmlToDom(data));
51818           break;
51819         case ".kml":
51820           gj = kml(xmlToDom(data));
51821           break;
51822         case ".geojson":
51823         case ".json":
51824           gj = JSON.parse(data);
51825           if (gj.type === "FeatureCollection") {
51826             gj.features.forEach(stringifyGeojsonProperties);
51827           } else if (gj.type === "Feature") {
51828             stringifyGeojsonProperties(gj);
51829           }
51830           break;
51831       }
51832       gj = gj || {};
51833       if (Object.keys(gj).length) {
51834         _geojson = ensureIDs(gj);
51835         _src = extension + " data file";
51836         this.fitZoom();
51837       }
51838       dispatch14.call("change");
51839       return this;
51840     };
51841     drawData.showLabels = function(val) {
51842       if (!arguments.length) return _showLabels;
51843       _showLabels = val;
51844       return this;
51845     };
51846     drawData.enabled = function(val) {
51847       if (!arguments.length) return _enabled;
51848       _enabled = val;
51849       if (_enabled) {
51850         showLayer();
51851       } else {
51852         hideLayer();
51853       }
51854       dispatch14.call("change");
51855       return this;
51856     };
51857     drawData.hasData = function() {
51858       var gj = _geojson || {};
51859       return !!(_template || Object.keys(gj).length);
51860     };
51861     drawData.template = function(val, src) {
51862       if (!arguments.length) return _template;
51863       var osm = context.connection();
51864       if (osm) {
51865         var blocklists = osm.imageryBlocklists();
51866         var fail = false;
51867         var tested = 0;
51868         var regex;
51869         for (var i3 = 0; i3 < blocklists.length; i3++) {
51870           regex = blocklists[i3];
51871           fail = regex.test(val);
51872           tested++;
51873           if (fail) break;
51874         }
51875         if (!tested) {
51876           regex = /.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/;
51877           fail = regex.test(val);
51878         }
51879       }
51880       _template = val;
51881       _fileList = null;
51882       _geojson = null;
51883       _src = src || "vectortile:" + val.split(/[?#]/)[0];
51884       dispatch14.call("change");
51885       return this;
51886     };
51887     drawData.geojson = function(gj, src) {
51888       if (!arguments.length) return _geojson;
51889       _template = null;
51890       _fileList = null;
51891       _geojson = null;
51892       _src = null;
51893       gj = gj || {};
51894       if (Object.keys(gj).length) {
51895         _geojson = ensureIDs(gj);
51896         _src = src || "unknown.geojson";
51897       }
51898       dispatch14.call("change");
51899       return this;
51900     };
51901     drawData.fileList = function(fileList) {
51902       if (!arguments.length) return _fileList;
51903       _template = null;
51904       _geojson = null;
51905       _src = null;
51906       _fileList = fileList;
51907       if (!fileList || !fileList.length) return this;
51908       var f2 = fileList[0];
51909       var extension = getExtension(f2.name);
51910       var reader = new FileReader();
51911       reader.onload = /* @__PURE__ */ function() {
51912         return function(e3) {
51913           drawData.setFile(extension, e3.target.result);
51914         };
51915       }(f2);
51916       reader.readAsText(f2);
51917       return this;
51918     };
51919     drawData.url = function(url, defaultExtension) {
51920       _template = null;
51921       _fileList = null;
51922       _geojson = null;
51923       _src = null;
51924       var testUrl = url.split(/[?#]/)[0];
51925       var extension = getExtension(testUrl) || defaultExtension;
51926       if (extension) {
51927         _template = null;
51928         text_default3(url).then(function(data) {
51929           drawData.setFile(extension, data);
51930         }).catch(function() {
51931         });
51932       } else {
51933         drawData.template(url);
51934       }
51935       return this;
51936     };
51937     drawData.getSrc = function() {
51938       return _src || "";
51939     };
51940     drawData.fitZoom = function() {
51941       var features = getFeatures(_geojson);
51942       if (!features.length) return;
51943       var map2 = context.map();
51944       var viewport = map2.trimmedExtent().polygon();
51945       var coords = features.reduce(function(coords2, feature3) {
51946         var geom = feature3.geometry;
51947         if (!geom) return coords2;
51948         var c2 = geom.coordinates;
51949         switch (geom.type) {
51950           case "Point":
51951             c2 = [c2];
51952           case "MultiPoint":
51953           case "LineString":
51954             break;
51955           case "MultiPolygon":
51956             c2 = utilArrayFlatten(c2);
51957           case "Polygon":
51958           case "MultiLineString":
51959             c2 = utilArrayFlatten(c2);
51960             break;
51961         }
51962         return utilArrayUnion(coords2, c2);
51963       }, []);
51964       if (!geoPolygonIntersectsPolygon(viewport, coords, true)) {
51965         var extent = geoExtent(bounds_default({ type: "LineString", coordinates: coords }));
51966         map2.centerZoom(extent.center(), map2.trimmedExtentZoom(extent));
51967       }
51968       return this;
51969     };
51970     init2();
51971     return drawData;
51972   }
51973   var import_fast_json_stable_stringify, _initialized, _enabled, _geojson;
51974   var init_data2 = __esm({
51975     "modules/svg/data.js"() {
51976       "use strict";
51977       init_throttle();
51978       init_src2();
51979       init_src18();
51980       init_src5();
51981       import_fast_json_stable_stringify = __toESM(require_fast_json_stable_stringify());
51982       init_togeojson_es();
51983       init_geo2();
51984       init_services();
51985       init_helpers();
51986       init_detect();
51987       init_util();
51988       _initialized = false;
51989       _enabled = false;
51990     }
51991   });
51992
51993   // modules/svg/debug.js
51994   var debug_exports = {};
51995   __export(debug_exports, {
51996     svgDebug: () => svgDebug
51997   });
51998   function svgDebug(projection2, context) {
51999     function drawDebug(selection2) {
52000       const showTile = context.getDebug("tile");
52001       const showCollision = context.getDebug("collision");
52002       const showImagery = context.getDebug("imagery");
52003       const showTouchTargets = context.getDebug("target");
52004       const showDownloaded = context.getDebug("downloaded");
52005       let debugData = [];
52006       if (showTile) {
52007         debugData.push({ class: "red", label: "tile" });
52008       }
52009       if (showCollision) {
52010         debugData.push({ class: "yellow", label: "collision" });
52011       }
52012       if (showImagery) {
52013         debugData.push({ class: "orange", label: "imagery" });
52014       }
52015       if (showTouchTargets) {
52016         debugData.push({ class: "pink", label: "touchTargets" });
52017       }
52018       if (showDownloaded) {
52019         debugData.push({ class: "purple", label: "downloaded" });
52020       }
52021       let legend = context.container().select(".main-content").selectAll(".debug-legend").data(debugData.length ? [0] : []);
52022       legend.exit().remove();
52023       legend = legend.enter().append("div").attr("class", "fillD debug-legend").merge(legend);
52024       let legendItems = legend.selectAll(".debug-legend-item").data(debugData, (d2) => d2.label);
52025       legendItems.exit().remove();
52026       legendItems.enter().append("span").attr("class", (d2) => `debug-legend-item ${d2.class}`).text((d2) => d2.label);
52027       let layer = selection2.selectAll(".layer-debug").data(showImagery || showDownloaded ? [0] : []);
52028       layer.exit().remove();
52029       layer = layer.enter().append("g").attr("class", "layer-debug").merge(layer);
52030       const extent = context.map().extent();
52031       _mainFileFetcher.get("imagery").then((d2) => {
52032         const hits = showImagery && d2.query.bbox(extent.rectangle(), true) || [];
52033         const features = hits.map((d4) => d4.features[d4.id]);
52034         let imagery = layer.selectAll("path.debug-imagery").data(features);
52035         imagery.exit().remove();
52036         imagery.enter().append("path").attr("class", "debug-imagery debug orange");
52037       }).catch(() => {
52038       });
52039       const osm = context.connection();
52040       let dataDownloaded = [];
52041       if (osm && showDownloaded) {
52042         const rtree = osm.caches("get").tile.rtree;
52043         dataDownloaded = rtree.all().map((bbox2) => {
52044           return {
52045             type: "Feature",
52046             properties: { id: bbox2.id },
52047             geometry: {
52048               type: "Polygon",
52049               coordinates: [[
52050                 [bbox2.minX, bbox2.minY],
52051                 [bbox2.minX, bbox2.maxY],
52052                 [bbox2.maxX, bbox2.maxY],
52053                 [bbox2.maxX, bbox2.minY],
52054                 [bbox2.minX, bbox2.minY]
52055               ]]
52056             }
52057           };
52058         });
52059       }
52060       let downloaded = layer.selectAll("path.debug-downloaded").data(showDownloaded ? dataDownloaded : []);
52061       downloaded.exit().remove();
52062       downloaded.enter().append("path").attr("class", "debug-downloaded debug purple");
52063       layer.selectAll("path").attr("d", svgPath(projection2).geojson);
52064     }
52065     drawDebug.enabled = function() {
52066       if (!arguments.length) {
52067         return context.getDebug("tile") || context.getDebug("collision") || context.getDebug("imagery") || context.getDebug("target") || context.getDebug("downloaded");
52068       } else {
52069         return this;
52070       }
52071     };
52072     return drawDebug;
52073   }
52074   var init_debug = __esm({
52075     "modules/svg/debug.js"() {
52076       "use strict";
52077       init_file_fetcher();
52078       init_helpers();
52079     }
52080   });
52081
52082   // modules/svg/defs.js
52083   var defs_exports = {};
52084   __export(defs_exports, {
52085     svgDefs: () => svgDefs
52086   });
52087   function svgDefs(context) {
52088     var _defsSelection = select_default2(null);
52089     var _spritesheetIds = [
52090       "iD-sprite",
52091       "maki-sprite",
52092       "temaki-sprite",
52093       "fa-sprite",
52094       "roentgen-sprite",
52095       "community-sprite"
52096     ];
52097     function drawDefs(selection2) {
52098       _defsSelection = selection2.append("defs");
52099       function addOnewayMarker(name, colour) {
52100         _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");
52101       }
52102       addOnewayMarker("black", "#333");
52103       addOnewayMarker("white", "#fff");
52104       addOnewayMarker("gray", "#eee");
52105       function addSidedMarker(name, color2, offset) {
52106         _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);
52107       }
52108       addSidedMarker("natural", "rgb(170, 170, 170)", 0);
52109       addSidedMarker("coastline", "#77dede", 1);
52110       addSidedMarker("waterway", "#77dede", 1);
52111       addSidedMarker("barrier", "#ddd", 1);
52112       addSidedMarker("man_made", "#fff", 0);
52113       _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");
52114       _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");
52115       var patterns2 = _defsSelection.selectAll("pattern").data([
52116         // pattern name, pattern image name
52117         ["beach", "dots"],
52118         ["construction", "construction"],
52119         ["cemetery", "cemetery"],
52120         ["cemetery_christian", "cemetery_christian"],
52121         ["cemetery_buddhist", "cemetery_buddhist"],
52122         ["cemetery_muslim", "cemetery_muslim"],
52123         ["cemetery_jewish", "cemetery_jewish"],
52124         ["farmland", "farmland"],
52125         ["farmyard", "farmyard"],
52126         ["forest", "forest"],
52127         ["forest_broadleaved", "forest_broadleaved"],
52128         ["forest_needleleaved", "forest_needleleaved"],
52129         ["forest_leafless", "forest_leafless"],
52130         ["golf_green", "grass"],
52131         ["grass", "grass"],
52132         ["landfill", "landfill"],
52133         ["meadow", "grass"],
52134         ["orchard", "orchard"],
52135         ["pond", "pond"],
52136         ["quarry", "quarry"],
52137         ["scrub", "bushes"],
52138         ["vineyard", "vineyard"],
52139         ["water_standing", "lines"],
52140         ["waves", "waves"],
52141         ["wetland", "wetland"],
52142         ["wetland_marsh", "wetland_marsh"],
52143         ["wetland_swamp", "wetland_swamp"],
52144         ["wetland_bog", "wetland_bog"],
52145         ["wetland_reedbed", "wetland_reedbed"]
52146       ]).enter().append("pattern").attr("id", function(d2) {
52147         return "ideditor-pattern-" + d2[0];
52148       }).attr("width", 32).attr("height", 32).attr("patternUnits", "userSpaceOnUse");
52149       patterns2.append("rect").attr("x", 0).attr("y", 0).attr("width", 32).attr("height", 32).attr("class", function(d2) {
52150         return "pattern-color-" + d2[0];
52151       });
52152       patterns2.append("image").attr("x", 0).attr("y", 0).attr("width", 32).attr("height", 32).attr("xlink:href", function(d2) {
52153         return context.imagePath("pattern/" + d2[1] + ".png");
52154       });
52155       _defsSelection.selectAll("clipPath").data([12, 18, 20, 32, 45]).enter().append("clipPath").attr("id", function(d2) {
52156         return "ideditor-clip-square-" + d2;
52157       }).append("rect").attr("x", 0).attr("y", 0).attr("width", function(d2) {
52158         return d2;
52159       }).attr("height", function(d2) {
52160         return d2;
52161       });
52162       const filters = _defsSelection.selectAll("filter").data(["alpha-slope5"]).enter().append("filter").attr("id", (d2) => d2);
52163       const alphaSlope5 = filters.filter("#alpha-slope5").append("feComponentTransfer");
52164       alphaSlope5.append("feFuncR").attr("type", "identity");
52165       alphaSlope5.append("feFuncG").attr("type", "identity");
52166       alphaSlope5.append("feFuncB").attr("type", "identity");
52167       alphaSlope5.append("feFuncA").attr("type", "linear").attr("slope", 5);
52168       addSprites(_spritesheetIds, true);
52169     }
52170     function addSprites(ids, overrideColors) {
52171       _spritesheetIds = utilArrayUniq(_spritesheetIds.concat(ids));
52172       var spritesheets = _defsSelection.selectAll(".spritesheet").data(_spritesheetIds);
52173       spritesheets.enter().append("g").attr("class", function(d2) {
52174         return "spritesheet spritesheet-" + d2;
52175       }).each(function(d2) {
52176         var url = context.imagePath(d2 + ".svg");
52177         var node = select_default2(this).node();
52178         svg(url).then(function(svg2) {
52179           node.appendChild(
52180             select_default2(svg2.documentElement).attr("id", "ideditor-" + d2).node()
52181           );
52182           if (overrideColors && d2 !== "iD-sprite") {
52183             select_default2(node).selectAll("path").attr("fill", "currentColor");
52184           }
52185         }).catch(function() {
52186         });
52187       });
52188       spritesheets.exit().remove();
52189     }
52190     drawDefs.addSprites = addSprites;
52191     return drawDefs;
52192   }
52193   var init_defs = __esm({
52194     "modules/svg/defs.js"() {
52195       "use strict";
52196       init_src18();
52197       init_src5();
52198       init_util();
52199     }
52200   });
52201
52202   // modules/svg/keepRight.js
52203   var keepRight_exports2 = {};
52204   __export(keepRight_exports2, {
52205     svgKeepRight: () => svgKeepRight
52206   });
52207   function svgKeepRight(projection2, context, dispatch14) {
52208     const throttledRedraw = throttle_default(() => dispatch14.call("change"), 1e3);
52209     const minZoom5 = 12;
52210     let touchLayer = select_default2(null);
52211     let drawLayer = select_default2(null);
52212     let layerVisible = false;
52213     function markerPath(selection2, klass) {
52214       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");
52215     }
52216     function getService() {
52217       if (services.keepRight && !_qaService) {
52218         _qaService = services.keepRight;
52219         _qaService.on("loaded", throttledRedraw);
52220       } else if (!services.keepRight && _qaService) {
52221         _qaService = null;
52222       }
52223       return _qaService;
52224     }
52225     function editOn() {
52226       if (!layerVisible) {
52227         layerVisible = true;
52228         drawLayer.style("display", "block");
52229       }
52230     }
52231     function editOff() {
52232       if (layerVisible) {
52233         layerVisible = false;
52234         drawLayer.style("display", "none");
52235         drawLayer.selectAll(".qaItem.keepRight").remove();
52236         touchLayer.selectAll(".qaItem.keepRight").remove();
52237       }
52238     }
52239     function layerOn() {
52240       editOn();
52241       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch14.call("change"));
52242     }
52243     function layerOff() {
52244       throttledRedraw.cancel();
52245       drawLayer.interrupt();
52246       touchLayer.selectAll(".qaItem.keepRight").remove();
52247       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
52248         editOff();
52249         dispatch14.call("change");
52250       });
52251     }
52252     function updateMarkers() {
52253       if (!layerVisible || !_layerEnabled) return;
52254       const service = getService();
52255       const selectedID = context.selectedErrorID();
52256       const data = service ? service.getItems(projection2) : [];
52257       const getTransform = svgPointTransform(projection2);
52258       const markers = drawLayer.selectAll(".qaItem.keepRight").data(data, (d2) => d2.id);
52259       markers.exit().remove();
52260       const markersEnter = markers.enter().append("g").attr("class", (d2) => `qaItem ${d2.service} itemId-${d2.id} itemType-${d2.parentIssueType}`);
52261       markersEnter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
52262       markersEnter.append("path").call(markerPath, "shadow");
52263       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");
52264       markers.merge(markersEnter).sort(sortY).classed("selected", (d2) => d2.id === selectedID).attr("transform", getTransform);
52265       if (touchLayer.empty()) return;
52266       const fillClass = context.getDebug("target") ? "pink " : "nocolor ";
52267       const targets = touchLayer.selectAll(".qaItem.keepRight").data(data, (d2) => d2.id);
52268       targets.exit().remove();
52269       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);
52270       function sortY(a2, b2) {
52271         return a2.id === selectedID ? 1 : b2.id === selectedID ? -1 : a2.severity === "error" && b2.severity !== "error" ? 1 : b2.severity === "error" && a2.severity !== "error" ? -1 : b2.loc[1] - a2.loc[1];
52272       }
52273     }
52274     function drawKeepRight(selection2) {
52275       const service = getService();
52276       const surface = context.surface();
52277       if (surface && !surface.empty()) {
52278         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
52279       }
52280       drawLayer = selection2.selectAll(".layer-keepRight").data(service ? [0] : []);
52281       drawLayer.exit().remove();
52282       drawLayer = drawLayer.enter().append("g").attr("class", "layer-keepRight").style("display", _layerEnabled ? "block" : "none").merge(drawLayer);
52283       if (_layerEnabled) {
52284         if (service && ~~context.map().zoom() >= minZoom5) {
52285           editOn();
52286           service.loadIssues(projection2);
52287           updateMarkers();
52288         } else {
52289           editOff();
52290         }
52291       }
52292     }
52293     drawKeepRight.enabled = function(val) {
52294       if (!arguments.length) return _layerEnabled;
52295       _layerEnabled = val;
52296       if (_layerEnabled) {
52297         layerOn();
52298       } else {
52299         layerOff();
52300         if (context.selectedErrorID()) {
52301           context.enter(modeBrowse(context));
52302         }
52303       }
52304       dispatch14.call("change");
52305       return this;
52306     };
52307     drawKeepRight.supported = () => !!getService();
52308     return drawKeepRight;
52309   }
52310   var _layerEnabled, _qaService;
52311   var init_keepRight2 = __esm({
52312     "modules/svg/keepRight.js"() {
52313       "use strict";
52314       init_throttle();
52315       init_src5();
52316       init_browse();
52317       init_helpers();
52318       init_services();
52319       _layerEnabled = false;
52320     }
52321   });
52322
52323   // modules/svg/geolocate.js
52324   var geolocate_exports = {};
52325   __export(geolocate_exports, {
52326     svgGeolocate: () => svgGeolocate
52327   });
52328   function svgGeolocate(projection2) {
52329     var layer = select_default2(null);
52330     var _position;
52331     function init2() {
52332       if (svgGeolocate.initialized) return;
52333       svgGeolocate.enabled = false;
52334       svgGeolocate.initialized = true;
52335     }
52336     function showLayer() {
52337       layer.style("display", "block");
52338     }
52339     function hideLayer() {
52340       layer.transition().duration(250).style("opacity", 0);
52341     }
52342     function layerOn() {
52343       layer.style("opacity", 0).transition().duration(250).style("opacity", 1);
52344     }
52345     function layerOff() {
52346       layer.style("display", "none");
52347     }
52348     function transform2(d2) {
52349       return svgPointTransform(projection2)(d2);
52350     }
52351     function accuracy(accuracy2, loc) {
52352       var degreesRadius = geoMetersToLat(accuracy2), tangentLoc = [loc[0], loc[1] + degreesRadius], projectedTangent = projection2(tangentLoc), projectedLoc = projection2([loc[0], loc[1]]);
52353       return Math.round(projectedLoc[1] - projectedTangent[1]).toString();
52354     }
52355     function update() {
52356       var geolocation = { loc: [_position.coords.longitude, _position.coords.latitude] };
52357       var groups = layer.selectAll(".geolocations").selectAll(".geolocation").data([geolocation]);
52358       groups.exit().remove();
52359       var pointsEnter = groups.enter().append("g").attr("class", "geolocation");
52360       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");
52361       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");
52362       groups.merge(pointsEnter).attr("transform", transform2);
52363       layer.select(".geolocate-radius").attr("r", accuracy(_position.coords.accuracy, geolocation.loc));
52364     }
52365     function drawLocation(selection2) {
52366       var enabled = svgGeolocate.enabled;
52367       layer = selection2.selectAll(".layer-geolocate").data([0]);
52368       layer.exit().remove();
52369       var layerEnter = layer.enter().append("g").attr("class", "layer-geolocate").style("display", enabled ? "block" : "none");
52370       layerEnter.append("g").attr("class", "geolocations");
52371       layer = layerEnter.merge(layer);
52372       if (enabled) {
52373         update();
52374       } else {
52375         layerOff();
52376       }
52377     }
52378     drawLocation.enabled = function(position, enabled) {
52379       if (!arguments.length) return svgGeolocate.enabled;
52380       _position = position;
52381       svgGeolocate.enabled = enabled;
52382       if (svgGeolocate.enabled) {
52383         showLayer();
52384         layerOn();
52385       } else {
52386         hideLayer();
52387       }
52388       return this;
52389     };
52390     init2();
52391     return drawLocation;
52392   }
52393   var init_geolocate = __esm({
52394     "modules/svg/geolocate.js"() {
52395       "use strict";
52396       init_src5();
52397       init_helpers();
52398       init_geo2();
52399     }
52400   });
52401
52402   // modules/svg/labels.js
52403   var labels_exports = {};
52404   __export(labels_exports, {
52405     svgLabels: () => svgLabels
52406   });
52407   function svgLabels(projection2, context) {
52408     var path = path_default(projection2);
52409     var detected = utilDetect();
52410     var baselineHack = detected.ie || detected.browser.toLowerCase() === "edge" || detected.browser.toLowerCase() === "firefox" && detected.version >= 70;
52411     var _rdrawn = new RBush();
52412     var _rskipped = new RBush();
52413     var _textWidthCache = {};
52414     var _entitybboxes = {};
52415     var labelStack = [
52416       ["line", "aeroway", "*", 12],
52417       ["line", "highway", "motorway", 12],
52418       ["line", "highway", "trunk", 12],
52419       ["line", "highway", "primary", 12],
52420       ["line", "highway", "secondary", 12],
52421       ["line", "highway", "tertiary", 12],
52422       ["line", "highway", "*", 12],
52423       ["line", "railway", "*", 12],
52424       ["line", "waterway", "*", 12],
52425       ["area", "aeroway", "*", 12],
52426       ["area", "amenity", "*", 12],
52427       ["area", "building", "*", 12],
52428       ["area", "historic", "*", 12],
52429       ["area", "leisure", "*", 12],
52430       ["area", "man_made", "*", 12],
52431       ["area", "natural", "*", 12],
52432       ["area", "shop", "*", 12],
52433       ["area", "tourism", "*", 12],
52434       ["area", "camp_site", "*", 12],
52435       ["point", "aeroway", "*", 10],
52436       ["point", "amenity", "*", 10],
52437       ["point", "building", "*", 10],
52438       ["point", "historic", "*", 10],
52439       ["point", "leisure", "*", 10],
52440       ["point", "man_made", "*", 10],
52441       ["point", "natural", "*", 10],
52442       ["point", "shop", "*", 10],
52443       ["point", "tourism", "*", 10],
52444       ["point", "camp_site", "*", 10],
52445       ["line", "ref", "*", 12],
52446       ["area", "ref", "*", 12],
52447       ["point", "ref", "*", 10],
52448       ["line", "name", "*", 12],
52449       ["area", "name", "*", 12],
52450       ["point", "name", "*", 10]
52451     ];
52452     function shouldSkipIcon(preset) {
52453       var noIcons = ["building", "landuse", "natural"];
52454       return noIcons.some(function(s2) {
52455         return preset.id.indexOf(s2) >= 0;
52456       });
52457     }
52458     function get4(array2, prop) {
52459       return function(d2, i3) {
52460         return array2[i3][prop];
52461       };
52462     }
52463     function textWidth(text, size, elem) {
52464       var c2 = _textWidthCache[size];
52465       if (!c2) c2 = _textWidthCache[size] = {};
52466       if (c2[text]) {
52467         return c2[text];
52468       } else if (elem) {
52469         c2[text] = elem.getComputedTextLength();
52470         return c2[text];
52471       } else {
52472         var str = encodeURIComponent(text).match(/%[CDEFcdef]/g);
52473         if (str === null) {
52474           return size / 3 * 2 * text.length;
52475         } else {
52476           return size / 3 * (2 * text.length + str.length);
52477         }
52478       }
52479     }
52480     function drawLinePaths(selection2, entities, filter2, classes, labels) {
52481       var paths = selection2.selectAll("path").filter(filter2).data(entities, osmEntity.key);
52482       paths.exit().remove();
52483       paths.enter().append("path").style("stroke-width", get4(labels, "font-size")).attr("id", function(d2) {
52484         return "ideditor-labelpath-" + d2.id;
52485       }).attr("class", classes).merge(paths).attr("d", get4(labels, "lineString"));
52486     }
52487     function drawLineLabels(selection2, entities, filter2, classes, labels) {
52488       var texts = selection2.selectAll("text." + classes).filter(filter2).data(entities, osmEntity.key);
52489       texts.exit().remove();
52490       texts.enter().append("text").attr("class", function(d2, i3) {
52491         return classes + " " + labels[i3].classes + " " + d2.id;
52492       }).attr("dy", baselineHack ? "0.35em" : null).append("textPath").attr("class", "textpath");
52493       selection2.selectAll("text." + classes).selectAll(".textpath").filter(filter2).data(entities, osmEntity.key).attr("startOffset", "50%").attr("xlink:href", function(d2) {
52494         return "#ideditor-labelpath-" + d2.id;
52495       }).text(utilDisplayNameForPath);
52496     }
52497     function drawPointLabels(selection2, entities, filter2, classes, labels) {
52498       var texts = selection2.selectAll("text." + classes).filter(filter2).data(entities, osmEntity.key);
52499       texts.exit().remove();
52500       texts.enter().append("text").attr("class", function(d2, i3) {
52501         return classes + " " + labels[i3].classes + " " + d2.id;
52502       }).merge(texts).attr("x", get4(labels, "x")).attr("y", get4(labels, "y")).style("text-anchor", get4(labels, "textAnchor")).text(utilDisplayName).each(function(d2, i3) {
52503         textWidth(utilDisplayName(d2), labels[i3].height, this);
52504       });
52505     }
52506     function drawAreaLabels(selection2, entities, filter2, classes, labels) {
52507       entities = entities.filter(hasText);
52508       labels = labels.filter(hasText);
52509       drawPointLabels(selection2, entities, filter2, classes, labels);
52510       function hasText(d2, i3) {
52511         return labels[i3].hasOwnProperty("x") && labels[i3].hasOwnProperty("y");
52512       }
52513     }
52514     function drawAreaIcons(selection2, entities, filter2, classes, labels) {
52515       var icons = selection2.selectAll("use." + classes).filter(filter2).data(entities, osmEntity.key);
52516       icons.exit().remove();
52517       icons.enter().append("use").attr("class", "icon " + classes).attr("width", "17px").attr("height", "17px").merge(icons).attr("transform", get4(labels, "transform")).attr("xlink:href", function(d2) {
52518         var preset = _mainPresetIndex.match(d2, context.graph());
52519         var picon = preset && preset.icon;
52520         return picon ? "#" + picon : "";
52521       });
52522     }
52523     function drawCollisionBoxes(selection2, rtree, which) {
52524       var classes = "debug " + which + " " + (which === "debug-skipped" ? "orange" : "yellow");
52525       var gj = [];
52526       if (context.getDebug("collision")) {
52527         gj = rtree.all().map(function(d2) {
52528           return { type: "Polygon", coordinates: [[
52529             [d2.minX, d2.minY],
52530             [d2.maxX, d2.minY],
52531             [d2.maxX, d2.maxY],
52532             [d2.minX, d2.maxY],
52533             [d2.minX, d2.minY]
52534           ]] };
52535         });
52536       }
52537       var boxes = selection2.selectAll("." + which).data(gj);
52538       boxes.exit().remove();
52539       boxes.enter().append("path").attr("class", classes).merge(boxes).attr("d", path_default());
52540     }
52541     function drawLabels(selection2, graph, entities, filter2, dimensions, fullRedraw) {
52542       var wireframe = context.surface().classed("fill-wireframe");
52543       var zoom = geoScaleToZoom(projection2.scale());
52544       var labelable = [];
52545       var renderNodeAs = {};
52546       var i3, j2, k2, entity, geometry;
52547       for (i3 = 0; i3 < labelStack.length; i3++) {
52548         labelable.push([]);
52549       }
52550       if (fullRedraw) {
52551         _rdrawn.clear();
52552         _rskipped.clear();
52553         _entitybboxes = {};
52554       } else {
52555         for (i3 = 0; i3 < entities.length; i3++) {
52556           entity = entities[i3];
52557           var toRemove = [].concat(_entitybboxes[entity.id] || []).concat(_entitybboxes[entity.id + "I"] || []);
52558           for (j2 = 0; j2 < toRemove.length; j2++) {
52559             _rdrawn.remove(toRemove[j2]);
52560             _rskipped.remove(toRemove[j2]);
52561           }
52562         }
52563       }
52564       for (i3 = 0; i3 < entities.length; i3++) {
52565         entity = entities[i3];
52566         geometry = entity.geometry(graph);
52567         if (geometry === "point" || geometry === "vertex" && isInterestingVertex(entity)) {
52568           var hasDirections = entity.directions(graph, projection2).length;
52569           var markerPadding;
52570           if (!wireframe && geometry === "point" && !(zoom >= 18 && hasDirections)) {
52571             renderNodeAs[entity.id] = "point";
52572             markerPadding = 20;
52573           } else {
52574             renderNodeAs[entity.id] = "vertex";
52575             markerPadding = 0;
52576           }
52577           var coord2 = projection2(entity.loc);
52578           var nodePadding = 10;
52579           var bbox2 = {
52580             minX: coord2[0] - nodePadding,
52581             minY: coord2[1] - nodePadding - markerPadding,
52582             maxX: coord2[0] + nodePadding,
52583             maxY: coord2[1] + nodePadding
52584           };
52585           doInsert(bbox2, entity.id + "P");
52586         }
52587         if (geometry === "vertex") {
52588           geometry = "point";
52589         }
52590         var preset = geometry === "area" && _mainPresetIndex.match(entity, graph);
52591         var icon2 = preset && !shouldSkipIcon(preset) && preset.icon;
52592         if (!icon2 && !utilDisplayName(entity)) continue;
52593         for (k2 = 0; k2 < labelStack.length; k2++) {
52594           var matchGeom = labelStack[k2][0];
52595           var matchKey = labelStack[k2][1];
52596           var matchVal = labelStack[k2][2];
52597           var hasVal = entity.tags[matchKey];
52598           if (geometry === matchGeom && hasVal && (matchVal === "*" || matchVal === hasVal)) {
52599             labelable[k2].push(entity);
52600             break;
52601           }
52602         }
52603       }
52604       var positions = {
52605         point: [],
52606         line: [],
52607         area: []
52608       };
52609       var labelled = {
52610         point: [],
52611         line: [],
52612         area: []
52613       };
52614       for (k2 = 0; k2 < labelable.length; k2++) {
52615         var fontSize = labelStack[k2][3];
52616         for (i3 = 0; i3 < labelable[k2].length; i3++) {
52617           entity = labelable[k2][i3];
52618           geometry = entity.geometry(graph);
52619           var getName = geometry === "line" ? utilDisplayNameForPath : utilDisplayName;
52620           var name = getName(entity);
52621           var width = name && textWidth(name, fontSize);
52622           var p2 = null;
52623           if (geometry === "point" || geometry === "vertex") {
52624             if (wireframe) continue;
52625             var renderAs = renderNodeAs[entity.id];
52626             if (renderAs === "vertex" && zoom < 17) continue;
52627             p2 = getPointLabel(entity, width, fontSize, renderAs);
52628           } else if (geometry === "line") {
52629             p2 = getLineLabel(entity, width, fontSize);
52630           } else if (geometry === "area") {
52631             p2 = getAreaLabel(entity, width, fontSize);
52632           }
52633           if (p2) {
52634             if (geometry === "vertex") {
52635               geometry = "point";
52636             }
52637             p2.classes = geometry + " tag-" + labelStack[k2][1];
52638             positions[geometry].push(p2);
52639             labelled[geometry].push(entity);
52640           }
52641         }
52642       }
52643       function isInterestingVertex(entity2) {
52644         var selectedIDs = context.selectedIDs();
52645         return entity2.hasInterestingTags() || entity2.isEndpoint(graph) || entity2.isConnected(graph) || selectedIDs.indexOf(entity2.id) !== -1 || graph.parentWays(entity2).some(function(parent) {
52646           return selectedIDs.indexOf(parent.id) !== -1;
52647         });
52648       }
52649       function getPointLabel(entity2, width2, height, geometry2) {
52650         var y2 = geometry2 === "point" ? -12 : 0;
52651         var pointOffsets = {
52652           ltr: [15, y2, "start"],
52653           rtl: [-15, y2, "end"]
52654         };
52655         var textDirection = _mainLocalizer.textDirection();
52656         var coord3 = projection2(entity2.loc);
52657         var textPadding = 2;
52658         var offset = pointOffsets[textDirection];
52659         var p3 = {
52660           height,
52661           width: width2,
52662           x: coord3[0] + offset[0],
52663           y: coord3[1] + offset[1],
52664           textAnchor: offset[2]
52665         };
52666         var bbox3;
52667         if (textDirection === "rtl") {
52668           bbox3 = {
52669             minX: p3.x - width2 - textPadding,
52670             minY: p3.y - height / 2 - textPadding,
52671             maxX: p3.x + textPadding,
52672             maxY: p3.y + height / 2 + textPadding
52673           };
52674         } else {
52675           bbox3 = {
52676             minX: p3.x - textPadding,
52677             minY: p3.y - height / 2 - textPadding,
52678             maxX: p3.x + width2 + textPadding,
52679             maxY: p3.y + height / 2 + textPadding
52680           };
52681         }
52682         if (tryInsert([bbox3], entity2.id, true)) {
52683           return p3;
52684         }
52685       }
52686       function getLineLabel(entity2, width2, height) {
52687         var viewport = geoExtent(context.projection.clipExtent()).polygon();
52688         var points = graph.childNodes(entity2).map(function(node) {
52689           return projection2(node.loc);
52690         });
52691         var length2 = geoPathLength(points);
52692         if (length2 < width2 + 20) return;
52693         var lineOffsets = [
52694           50,
52695           45,
52696           55,
52697           40,
52698           60,
52699           35,
52700           65,
52701           30,
52702           70,
52703           25,
52704           75,
52705           20,
52706           80,
52707           15,
52708           95,
52709           10,
52710           90,
52711           5,
52712           95
52713         ];
52714         var padding = 3;
52715         for (var i4 = 0; i4 < lineOffsets.length; i4++) {
52716           var offset = lineOffsets[i4];
52717           var middle = offset / 100 * length2;
52718           var start2 = middle - width2 / 2;
52719           if (start2 < 0 || start2 + width2 > length2) continue;
52720           var sub = subpath(points, start2, start2 + width2);
52721           if (!sub || !geoPolygonIntersectsPolygon(viewport, sub, true)) {
52722             continue;
52723           }
52724           var isReverse = reverse(sub);
52725           if (isReverse) {
52726             sub = sub.reverse();
52727           }
52728           var bboxes = [];
52729           var boxsize = (height + 2) / 2;
52730           for (var j3 = 0; j3 < sub.length - 1; j3++) {
52731             var a2 = sub[j3];
52732             var b2 = sub[j3 + 1];
52733             var num = Math.max(1, Math.floor(geoVecLength(a2, b2) / boxsize / 2));
52734             for (var box = 0; box < num; box++) {
52735               var p3 = geoVecInterp(a2, b2, box / num);
52736               var x05 = p3[0] - boxsize - padding;
52737               var y05 = p3[1] - boxsize - padding;
52738               var x12 = p3[0] + boxsize + padding;
52739               var y12 = p3[1] + boxsize + padding;
52740               bboxes.push({
52741                 minX: Math.min(x05, x12),
52742                 minY: Math.min(y05, y12),
52743                 maxX: Math.max(x05, x12),
52744                 maxY: Math.max(y05, y12)
52745               });
52746             }
52747           }
52748           if (tryInsert(bboxes, entity2.id, false)) {
52749             return {
52750               "font-size": height + 2,
52751               lineString: lineString2(sub),
52752               startOffset: offset + "%"
52753             };
52754           }
52755         }
52756         function reverse(p4) {
52757           var angle2 = Math.atan2(p4[1][1] - p4[0][1], p4[1][0] - p4[0][0]);
52758           return !(p4[0][0] < p4[p4.length - 1][0] && angle2 < Math.PI / 2 && angle2 > -Math.PI / 2);
52759         }
52760         function lineString2(points2) {
52761           return "M" + points2.join("L");
52762         }
52763         function subpath(points2, from, to) {
52764           var sofar = 0;
52765           var start3, end, i0, i1;
52766           for (var i5 = 0; i5 < points2.length - 1; i5++) {
52767             var a3 = points2[i5];
52768             var b3 = points2[i5 + 1];
52769             var current = geoVecLength(a3, b3);
52770             var portion;
52771             if (!start3 && sofar + current >= from) {
52772               portion = (from - sofar) / current;
52773               start3 = [
52774                 a3[0] + portion * (b3[0] - a3[0]),
52775                 a3[1] + portion * (b3[1] - a3[1])
52776               ];
52777               i0 = i5 + 1;
52778             }
52779             if (!end && sofar + current >= to) {
52780               portion = (to - sofar) / current;
52781               end = [
52782                 a3[0] + portion * (b3[0] - a3[0]),
52783                 a3[1] + portion * (b3[1] - a3[1])
52784               ];
52785               i1 = i5 + 1;
52786             }
52787             sofar += current;
52788           }
52789           var result = points2.slice(i0, i1);
52790           result.unshift(start3);
52791           result.push(end);
52792           return result;
52793         }
52794       }
52795       function getAreaLabel(entity2, width2, height) {
52796         var centroid = path.centroid(entity2.asGeoJSON(graph));
52797         var extent = entity2.extent(graph);
52798         var areaWidth = projection2(extent[1])[0] - projection2(extent[0])[0];
52799         if (isNaN(centroid[0]) || areaWidth < 20) return;
52800         var preset2 = _mainPresetIndex.match(entity2, context.graph());
52801         var picon = preset2 && preset2.icon;
52802         var iconSize = 17;
52803         var padding = 2;
52804         var p3 = {};
52805         if (picon) {
52806           if (addIcon()) {
52807             addLabel(iconSize + padding);
52808             return p3;
52809           }
52810         } else {
52811           if (addLabel(0)) {
52812             return p3;
52813           }
52814         }
52815         function addIcon() {
52816           var iconX = centroid[0] - iconSize / 2;
52817           var iconY = centroid[1] - iconSize / 2;
52818           var bbox3 = {
52819             minX: iconX,
52820             minY: iconY,
52821             maxX: iconX + iconSize,
52822             maxY: iconY + iconSize
52823           };
52824           if (tryInsert([bbox3], entity2.id + "I", true)) {
52825             p3.transform = "translate(" + iconX + "," + iconY + ")";
52826             return true;
52827           }
52828           return false;
52829         }
52830         function addLabel(yOffset) {
52831           if (width2 && areaWidth >= width2 + 20) {
52832             var labelX = centroid[0];
52833             var labelY = centroid[1] + yOffset;
52834             var bbox3 = {
52835               minX: labelX - width2 / 2 - padding,
52836               minY: labelY - height / 2 - padding,
52837               maxX: labelX + width2 / 2 + padding,
52838               maxY: labelY + height / 2 + padding
52839             };
52840             if (tryInsert([bbox3], entity2.id, true)) {
52841               p3.x = labelX;
52842               p3.y = labelY;
52843               p3.textAnchor = "middle";
52844               p3.height = height;
52845               return true;
52846             }
52847           }
52848           return false;
52849         }
52850       }
52851       function doInsert(bbox3, id2) {
52852         bbox3.id = id2;
52853         var oldbox = _entitybboxes[id2];
52854         if (oldbox) {
52855           _rdrawn.remove(oldbox);
52856         }
52857         _entitybboxes[id2] = bbox3;
52858         _rdrawn.insert(bbox3);
52859       }
52860       function tryInsert(bboxes, id2, saveSkipped) {
52861         var skipped = false;
52862         for (var i4 = 0; i4 < bboxes.length; i4++) {
52863           var bbox3 = bboxes[i4];
52864           bbox3.id = id2;
52865           if (bbox3.minX < 0 || bbox3.minY < 0 || bbox3.maxX > dimensions[0] || bbox3.maxY > dimensions[1]) {
52866             skipped = true;
52867             break;
52868           }
52869           if (_rdrawn.collides(bbox3)) {
52870             skipped = true;
52871             break;
52872           }
52873         }
52874         _entitybboxes[id2] = bboxes;
52875         if (skipped) {
52876           if (saveSkipped) {
52877             _rskipped.load(bboxes);
52878           }
52879         } else {
52880           _rdrawn.load(bboxes);
52881         }
52882         return !skipped;
52883       }
52884       var layer = selection2.selectAll(".layer-osm.labels");
52885       layer.selectAll(".labels-group").data(["halo", "label", "debug"]).enter().append("g").attr("class", function(d2) {
52886         return "labels-group " + d2;
52887       });
52888       var halo = layer.selectAll(".labels-group.halo");
52889       var label = layer.selectAll(".labels-group.label");
52890       var debug2 = layer.selectAll(".labels-group.debug");
52891       drawPointLabels(label, labelled.point, filter2, "pointlabel", positions.point);
52892       drawPointLabels(halo, labelled.point, filter2, "pointlabel-halo", positions.point);
52893       drawLinePaths(layer, labelled.line, filter2, "", positions.line);
52894       drawLineLabels(label, labelled.line, filter2, "linelabel", positions.line);
52895       drawLineLabels(halo, labelled.line, filter2, "linelabel-halo", positions.line);
52896       drawAreaLabels(label, labelled.area, filter2, "arealabel", positions.area);
52897       drawAreaLabels(halo, labelled.area, filter2, "arealabel-halo", positions.area);
52898       drawAreaIcons(label, labelled.area, filter2, "areaicon", positions.area);
52899       drawAreaIcons(halo, labelled.area, filter2, "areaicon-halo", positions.area);
52900       drawCollisionBoxes(debug2, _rskipped, "debug-skipped");
52901       drawCollisionBoxes(debug2, _rdrawn, "debug-drawn");
52902       layer.call(filterLabels);
52903     }
52904     function filterLabels(selection2) {
52905       var drawLayer = selection2.selectAll(".layer-osm.labels");
52906       var layers = drawLayer.selectAll(".labels-group.halo, .labels-group.label");
52907       layers.selectAll(".nolabel").classed("nolabel", false);
52908       var mouse = context.map().mouse();
52909       var graph = context.graph();
52910       var selectedIDs = context.selectedIDs();
52911       var ids = [];
52912       var pad3, bbox2;
52913       if (mouse) {
52914         pad3 = 20;
52915         bbox2 = { minX: mouse[0] - pad3, minY: mouse[1] - pad3, maxX: mouse[0] + pad3, maxY: mouse[1] + pad3 };
52916         var nearMouse = _rdrawn.search(bbox2).map(function(entity2) {
52917           return entity2.id;
52918         });
52919         ids.push.apply(ids, nearMouse);
52920       }
52921       for (var i3 = 0; i3 < selectedIDs.length; i3++) {
52922         var entity = graph.hasEntity(selectedIDs[i3]);
52923         if (entity && entity.type === "node") {
52924           ids.push(selectedIDs[i3]);
52925         }
52926       }
52927       layers.selectAll(utilEntitySelector(ids)).classed("nolabel", true);
52928       var debug2 = selection2.selectAll(".labels-group.debug");
52929       var gj = [];
52930       if (context.getDebug("collision")) {
52931         gj = bbox2 ? [{
52932           type: "Polygon",
52933           coordinates: [[
52934             [bbox2.minX, bbox2.minY],
52935             [bbox2.maxX, bbox2.minY],
52936             [bbox2.maxX, bbox2.maxY],
52937             [bbox2.minX, bbox2.maxY],
52938             [bbox2.minX, bbox2.minY]
52939           ]]
52940         }] : [];
52941       }
52942       var box = debug2.selectAll(".debug-mouse").data(gj);
52943       box.exit().remove();
52944       box.enter().append("path").attr("class", "debug debug-mouse yellow").merge(box).attr("d", path_default());
52945     }
52946     var throttleFilterLabels = throttle_default(filterLabels, 100);
52947     drawLabels.observe = function(selection2) {
52948       var listener = function() {
52949         throttleFilterLabels(selection2);
52950       };
52951       selection2.on("mousemove.hidelabels", listener);
52952       context.on("enter.hidelabels", listener);
52953     };
52954     drawLabels.off = function(selection2) {
52955       throttleFilterLabels.cancel();
52956       selection2.on("mousemove.hidelabels", null);
52957       context.on("enter.hidelabels", null);
52958     };
52959     return drawLabels;
52960   }
52961   var init_labels = __esm({
52962     "modules/svg/labels.js"() {
52963       "use strict";
52964       init_throttle();
52965       init_src2();
52966       init_rbush();
52967       init_localizer();
52968       init_geo2();
52969       init_presets();
52970       init_osm();
52971       init_detect();
52972       init_util();
52973     }
52974   });
52975
52976   // node_modules/exifr/dist/full.esm.mjs
52977   function l(e3, t2 = o) {
52978     if (n2) try {
52979       return "function" == typeof __require ? Promise.resolve(t2(__require(e3))) : import(
52980         /* webpackIgnore: true */
52981         e3
52982       ).then(t2);
52983     } catch (t3) {
52984       console.warn(`Couldn't load ${e3}`);
52985     }
52986   }
52987   function c(e3, t2, i3) {
52988     return t2 in e3 ? Object.defineProperty(e3, t2, { value: i3, enumerable: true, configurable: true, writable: true }) : e3[t2] = i3, e3;
52989   }
52990   function p(e3) {
52991     return void 0 === e3 || (e3 instanceof Map ? 0 === e3.size : 0 === Object.values(e3).filter(d).length);
52992   }
52993   function g2(e3) {
52994     let t2 = new Error(e3);
52995     throw delete t2.stack, t2;
52996   }
52997   function m(e3) {
52998     return "" === (e3 = function(e4) {
52999       for (; e4.endsWith("\0"); ) e4 = e4.slice(0, -1);
53000       return e4;
53001     }(e3).trim()) ? void 0 : e3;
53002   }
53003   function S(e3) {
53004     let t2 = function(e4) {
53005       let t3 = 0;
53006       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;
53007     }(e3);
53008     return e3.jfif.enabled && (t2 += 50), e3.xmp.enabled && (t2 += 2e4), e3.iptc.enabled && (t2 += 14e3), e3.icc.enabled && (t2 += 6e3), t2;
53009   }
53010   function b(e3) {
53011     return y ? y.decode(e3) : a ? Buffer.from(e3).toString("utf8") : decodeURIComponent(escape(C(e3)));
53012   }
53013   function P(e3, t2) {
53014     g2(`${e3} '${t2}' was not loaded, try using full build of exifr.`);
53015   }
53016   function D(e3, n3) {
53017     return "string" == typeof e3 ? O(e3, n3) : t && !i2 && e3 instanceof HTMLImageElement ? O(e3.src, n3) : e3 instanceof Uint8Array || e3 instanceof ArrayBuffer || e3 instanceof DataView ? new I(e3) : t && e3 instanceof Blob ? x(e3, n3, "blob", R) : void g2("Invalid input argument");
53018   }
53019   function O(e3, i3) {
53020     return (s2 = e3).startsWith("data:") || s2.length > 1e4 ? v(e3, i3, "base64") : n2 && e3.includes("://") ? x(e3, i3, "url", M) : n2 ? v(e3, i3, "fs") : t ? x(e3, i3, "url", M) : void g2("Invalid input argument");
53021     var s2;
53022   }
53023   async function x(e3, t2, i3, n3) {
53024     return A.has(i3) ? v(e3, t2, i3) : n3 ? async function(e4, t3) {
53025       let i4 = await t3(e4);
53026       return new I(i4);
53027     }(e3, n3) : void g2(`Parser ${i3} is not loaded`);
53028   }
53029   async function v(e3, t2, i3) {
53030     let n3 = new (A.get(i3))(e3, t2);
53031     return await n3.read(), n3;
53032   }
53033   function U(e3, t2, i3) {
53034     let n3 = new L();
53035     for (let [e4, t3] of i3) n3.set(e4, t3);
53036     if (Array.isArray(t2)) for (let i4 of t2) e3.set(i4, n3);
53037     else e3.set(t2, n3);
53038     return n3;
53039   }
53040   function F(e3, t2, i3) {
53041     let n3, s2 = e3.get(t2);
53042     for (n3 of i3) s2.set(n3[0], n3[1]);
53043   }
53044   function Q(e3, t2) {
53045     let i3, n3, s2, r2, a2 = [];
53046     for (s2 of t2) {
53047       for (r2 of (i3 = E.get(s2), n3 = [], i3)) (e3.includes(r2[0]) || e3.includes(r2[1])) && n3.push(r2[0]);
53048       n3.length && a2.push([s2, n3]);
53049     }
53050     return a2;
53051   }
53052   function Z(e3, t2) {
53053     return void 0 !== e3 ? e3 : void 0 !== t2 ? t2 : void 0;
53054   }
53055   function ee(e3, t2) {
53056     for (let i3 of t2) e3.add(i3);
53057   }
53058   async function ie(e3, t2) {
53059     let i3 = new te(t2);
53060     return await i3.read(e3), i3.parse();
53061   }
53062   function ae(e3) {
53063     return 192 === e3 || 194 === e3 || 196 === e3 || 219 === e3 || 221 === e3 || 218 === e3 || 254 === e3;
53064   }
53065   function oe(e3) {
53066     return e3 >= 224 && e3 <= 239;
53067   }
53068   function le(e3, t2, i3) {
53069     for (let [n3, s2] of T) if (s2.canHandle(e3, t2, i3)) return n3;
53070   }
53071   function de(e3, t2, i3, n3) {
53072     var s2 = e3 + t2 / 60 + i3 / 3600;
53073     return "S" !== n3 && "W" !== n3 || (s2 *= -1), s2;
53074   }
53075   async function Se(e3) {
53076     let t2 = new te(me);
53077     await t2.read(e3);
53078     let i3 = await t2.parse();
53079     if (i3 && i3.gps) {
53080       let { latitude: e4, longitude: t3 } = i3.gps;
53081       return { latitude: e4, longitude: t3 };
53082     }
53083   }
53084   async function ye(e3) {
53085     let t2 = new te(Ce);
53086     await t2.read(e3);
53087     let i3 = await t2.extractThumbnail();
53088     return i3 && a ? s.from(i3) : i3;
53089   }
53090   async function be(e3) {
53091     let t2 = await this.thumbnail(e3);
53092     if (void 0 !== t2) {
53093       let e4 = new Blob([t2]);
53094       return URL.createObjectURL(e4);
53095     }
53096   }
53097   async function Pe(e3) {
53098     let t2 = new te(Ie);
53099     await t2.read(e3);
53100     let i3 = await t2.parse();
53101     if (i3 && i3.ifd0) return i3.ifd0[274];
53102   }
53103   async function Ae(e3) {
53104     let t2 = await Pe(e3);
53105     return Object.assign({ canvas: we, css: Te }, ke[t2]);
53106   }
53107   function xe(e3, t2, i3) {
53108     return e3 <= t2 && t2 <= i3;
53109   }
53110   function Ge(e3) {
53111     return "object" == typeof e3 && void 0 !== e3.length ? e3[0] : e3;
53112   }
53113   function Ve(e3) {
53114     let t2 = Array.from(e3).slice(1);
53115     return t2[1] > 15 && (t2 = t2.map((e4) => String.fromCharCode(e4))), "0" !== t2[2] && 0 !== t2[2] || t2.pop(), t2.join(".");
53116   }
53117   function ze(e3) {
53118     if ("string" == typeof e3) {
53119       var [t2, i3, n3, s2, r2, a2] = e3.trim().split(/[-: ]/g).map(Number), o2 = new Date(t2, i3 - 1, n3);
53120       return Number.isNaN(s2) || Number.isNaN(r2) || Number.isNaN(a2) || (o2.setHours(s2), o2.setMinutes(r2), o2.setSeconds(a2)), Number.isNaN(+o2) ? e3 : o2;
53121     }
53122   }
53123   function He(e3) {
53124     if ("string" == typeof e3) return e3;
53125     let t2 = [];
53126     if (0 === e3[1] && 0 === e3[e3.length - 1]) for (let i3 = 0; i3 < e3.length; i3 += 2) t2.push(je(e3[i3 + 1], e3[i3]));
53127     else for (let i3 = 0; i3 < e3.length; i3 += 2) t2.push(je(e3[i3], e3[i3 + 1]));
53128     return m(String.fromCodePoint(...t2));
53129   }
53130   function je(e3, t2) {
53131     return e3 << 8 | t2;
53132   }
53133   function _e(e3, t2) {
53134     let i3 = e3.serialize();
53135     void 0 !== i3 && (t2[e3.name] = i3);
53136   }
53137   function qe(e3, t2) {
53138     let i3, n3 = [];
53139     if (!e3) return n3;
53140     for (; null !== (i3 = t2.exec(e3)); ) n3.push(i3);
53141     return n3;
53142   }
53143   function Qe(e3) {
53144     if (function(e4) {
53145       return null == e4 || "null" === e4 || "undefined" === e4 || "" === e4 || "" === e4.trim();
53146     }(e3)) return;
53147     let t2 = Number(e3);
53148     if (!Number.isNaN(t2)) return t2;
53149     let i3 = e3.toLowerCase();
53150     return "true" === i3 || "false" !== i3 && e3.trim();
53151   }
53152   function mt(e3, t2) {
53153     return m(e3.getString(t2, 4));
53154   }
53155   var e, t, i2, n2, s, r, a, o, h, u, f, d, C, y, I, k, w, T, A, M, R, L, E, B, N, G, V, z, H, j, W, K, X, _, Y, $2, J, q, te, ne, se, re2, he, ue, ce, fe, pe, ge, me, Ce, Ie, ke, we, Te, De, Oe, ve, Me, Re, Le, Ue, Fe, Ee, Be, Ne, We, Ke, Xe, Ye, $e, Je, Ze, et, tt, at, ot, lt, ht, ut, ct, ft, dt, pt, gt, St, Ct, yt, full_esm_default;
53156   var init_full_esm = __esm({
53157     "node_modules/exifr/dist/full.esm.mjs"() {
53158       e = "undefined" != typeof self ? self : global;
53159       t = "undefined" != typeof navigator;
53160       i2 = t && "undefined" == typeof HTMLImageElement;
53161       n2 = !("undefined" == typeof global || "undefined" == typeof process || !process.versions || !process.versions.node);
53162       s = e.Buffer;
53163       r = e.BigInt;
53164       a = !!s;
53165       o = (e3) => e3;
53166       h = e.fetch;
53167       u = (e3) => h = e3;
53168       if (!e.fetch) {
53169         const e3 = l("http", (e4) => e4), t2 = l("https", (e4) => e4), i3 = (n3, { headers: s2 } = {}) => new Promise(async (r2, a2) => {
53170           let { port: o2, hostname: l2, pathname: h2, protocol: u2, search: c2 } = new URL(n3);
53171           const f2 = { method: "GET", hostname: l2, path: encodeURI(h2) + c2, headers: s2 };
53172           "" !== o2 && (f2.port = Number(o2));
53173           const d2 = ("https:" === u2 ? await t2 : await e3).request(f2, (e4) => {
53174             if (301 === e4.statusCode || 302 === e4.statusCode) {
53175               let t3 = new URL(e4.headers.location, n3).toString();
53176               return i3(t3, { headers: s2 }).then(r2).catch(a2);
53177             }
53178             r2({ status: e4.statusCode, arrayBuffer: () => new Promise((t3) => {
53179               let i4 = [];
53180               e4.on("data", (e6) => i4.push(e6)), e4.on("end", () => t3(Buffer.concat(i4)));
53181             }) });
53182           });
53183           d2.on("error", a2), d2.end();
53184         });
53185         u(i3);
53186       }
53187       f = (e3) => p(e3) ? void 0 : e3;
53188       d = (e3) => void 0 !== e3;
53189       C = (e3) => String.fromCharCode.apply(null, e3);
53190       y = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : void 0;
53191       I = class _I {
53192         static from(e3, t2) {
53193           return e3 instanceof this && e3.le === t2 ? e3 : new _I(e3, void 0, void 0, t2);
53194         }
53195         constructor(e3, t2 = 0, i3, n3) {
53196           if ("boolean" == typeof n3 && (this.le = n3), Array.isArray(e3) && (e3 = new Uint8Array(e3)), 0 === e3) this.byteOffset = 0, this.byteLength = 0;
53197           else if (e3 instanceof ArrayBuffer) {
53198             void 0 === i3 && (i3 = e3.byteLength - t2);
53199             let n4 = new DataView(e3, t2, i3);
53200             this._swapDataView(n4);
53201           } else if (e3 instanceof Uint8Array || e3 instanceof DataView || e3 instanceof _I) {
53202             void 0 === i3 && (i3 = e3.byteLength - t2), (t2 += e3.byteOffset) + i3 > e3.byteOffset + e3.byteLength && g2("Creating view outside of available memory in ArrayBuffer");
53203             let n4 = new DataView(e3.buffer, t2, i3);
53204             this._swapDataView(n4);
53205           } else if ("number" == typeof e3) {
53206             let t3 = new DataView(new ArrayBuffer(e3));
53207             this._swapDataView(t3);
53208           } else g2("Invalid input argument for BufferView: " + e3);
53209         }
53210         _swapArrayBuffer(e3) {
53211           this._swapDataView(new DataView(e3));
53212         }
53213         _swapBuffer(e3) {
53214           this._swapDataView(new DataView(e3.buffer, e3.byteOffset, e3.byteLength));
53215         }
53216         _swapDataView(e3) {
53217           this.dataView = e3, this.buffer = e3.buffer, this.byteOffset = e3.byteOffset, this.byteLength = e3.byteLength;
53218         }
53219         _lengthToEnd(e3) {
53220           return this.byteLength - e3;
53221         }
53222         set(e3, t2, i3 = _I) {
53223           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);
53224         }
53225         subarray(e3, t2) {
53226           return t2 = t2 || this._lengthToEnd(e3), new _I(this, e3, t2);
53227         }
53228         toUint8() {
53229           return new Uint8Array(this.buffer, this.byteOffset, this.byteLength);
53230         }
53231         getUint8Array(e3, t2) {
53232           return new Uint8Array(this.buffer, this.byteOffset + e3, t2);
53233         }
53234         getString(e3 = 0, t2 = this.byteLength) {
53235           return b(this.getUint8Array(e3, t2));
53236         }
53237         getLatin1String(e3 = 0, t2 = this.byteLength) {
53238           let i3 = this.getUint8Array(e3, t2);
53239           return C(i3);
53240         }
53241         getUnicodeString(e3 = 0, t2 = this.byteLength) {
53242           const i3 = [];
53243           for (let n3 = 0; n3 < t2 && e3 + n3 < this.byteLength; n3 += 2) i3.push(this.getUint16(e3 + n3));
53244           return C(i3);
53245         }
53246         getInt8(e3) {
53247           return this.dataView.getInt8(e3);
53248         }
53249         getUint8(e3) {
53250           return this.dataView.getUint8(e3);
53251         }
53252         getInt16(e3, t2 = this.le) {
53253           return this.dataView.getInt16(e3, t2);
53254         }
53255         getInt32(e3, t2 = this.le) {
53256           return this.dataView.getInt32(e3, t2);
53257         }
53258         getUint16(e3, t2 = this.le) {
53259           return this.dataView.getUint16(e3, t2);
53260         }
53261         getUint32(e3, t2 = this.le) {
53262           return this.dataView.getUint32(e3, t2);
53263         }
53264         getFloat32(e3, t2 = this.le) {
53265           return this.dataView.getFloat32(e3, t2);
53266         }
53267         getFloat64(e3, t2 = this.le) {
53268           return this.dataView.getFloat64(e3, t2);
53269         }
53270         getFloat(e3, t2 = this.le) {
53271           return this.dataView.getFloat32(e3, t2);
53272         }
53273         getDouble(e3, t2 = this.le) {
53274           return this.dataView.getFloat64(e3, t2);
53275         }
53276         getUintBytes(e3, t2, i3) {
53277           switch (t2) {
53278             case 1:
53279               return this.getUint8(e3, i3);
53280             case 2:
53281               return this.getUint16(e3, i3);
53282             case 4:
53283               return this.getUint32(e3, i3);
53284             case 8:
53285               return this.getUint64 && this.getUint64(e3, i3);
53286           }
53287         }
53288         getUint(e3, t2, i3) {
53289           switch (t2) {
53290             case 8:
53291               return this.getUint8(e3, i3);
53292             case 16:
53293               return this.getUint16(e3, i3);
53294             case 32:
53295               return this.getUint32(e3, i3);
53296             case 64:
53297               return this.getUint64 && this.getUint64(e3, i3);
53298           }
53299         }
53300         toString(e3) {
53301           return this.dataView.toString(e3, this.constructor.name);
53302         }
53303         ensureChunk() {
53304         }
53305       };
53306       k = class extends Map {
53307         constructor(e3) {
53308           super(), this.kind = e3;
53309         }
53310         get(e3, t2) {
53311           return this.has(e3) || P(this.kind, e3), t2 && (e3 in t2 || function(e4, t3) {
53312             g2(`Unknown ${e4} '${t3}'.`);
53313           }(this.kind, e3), t2[e3].enabled || P(this.kind, e3)), super.get(e3);
53314         }
53315         keyList() {
53316           return Array.from(this.keys());
53317         }
53318       };
53319       w = new k("file parser");
53320       T = new k("segment parser");
53321       A = new k("file reader");
53322       M = (e3) => h(e3).then((e4) => e4.arrayBuffer());
53323       R = (e3) => new Promise((t2, i3) => {
53324         let n3 = new FileReader();
53325         n3.onloadend = () => t2(n3.result || new ArrayBuffer()), n3.onerror = i3, n3.readAsArrayBuffer(e3);
53326       });
53327       L = class extends Map {
53328         get tagKeys() {
53329           return this.allKeys || (this.allKeys = Array.from(this.keys())), this.allKeys;
53330         }
53331         get tagValues() {
53332           return this.allValues || (this.allValues = Array.from(this.values())), this.allValues;
53333         }
53334       };
53335       E = /* @__PURE__ */ new Map();
53336       B = /* @__PURE__ */ new Map();
53337       N = /* @__PURE__ */ new Map();
53338       G = ["chunked", "firstChunkSize", "firstChunkSizeNode", "firstChunkSizeBrowser", "chunkSize", "chunkLimit"];
53339       V = ["jfif", "xmp", "icc", "iptc", "ihdr"];
53340       z = ["tiff", ...V];
53341       H = ["ifd0", "ifd1", "exif", "gps", "interop"];
53342       j = [...z, ...H];
53343       W = ["makerNote", "userComment"];
53344       K = ["translateKeys", "translateValues", "reviveValues", "multiSegment"];
53345       X = [...K, "sanitize", "mergeOutput", "silentErrors"];
53346       _ = class {
53347         get translate() {
53348           return this.translateKeys || this.translateValues || this.reviveValues;
53349         }
53350       };
53351       Y = class extends _ {
53352         get needed() {
53353           return this.enabled || this.deps.size > 0;
53354         }
53355         constructor(e3, t2, i3, n3) {
53356           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 = H.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);
53357           else if ("object" == typeof i3) {
53358             if (this.enabled = true, this.parse = false !== i3.parse, this.canBeFiltered) {
53359               let { pick: e4, skip: t3 } = i3;
53360               e4 && e4.length > 0 && this.translateTagSet(e4, this.pick), t3 && t3.length > 0 && this.translateTagSet(t3, this.skip);
53361             }
53362             this.applyInheritables(i3);
53363           } else true === i3 || false === i3 ? this.parse = this.enabled = i3 : g2(`Invalid options argument: ${i3}`);
53364         }
53365         applyInheritables(e3) {
53366           let t2, i3;
53367           for (t2 of K) i3 = e3[t2], void 0 !== i3 && (this[t2] = i3);
53368         }
53369         translateTagSet(e3, t2) {
53370           if (this.dict) {
53371             let i3, n3, { tagKeys: s2, tagValues: r2 } = this.dict;
53372             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);
53373           } else for (let i3 of e3) t2.add(i3);
53374         }
53375         finalizeFilters() {
53376           !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);
53377         }
53378       };
53379       $2 = { 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 };
53380       J = /* @__PURE__ */ new Map();
53381       q = class extends _ {
53382         static useCached(e3) {
53383           let t2 = J.get(e3);
53384           return void 0 !== t2 || (t2 = new this(e3), J.set(e3, t2)), t2;
53385         }
53386         constructor(e3) {
53387           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();
53388         }
53389         setupFromUndefined() {
53390           let e3;
53391           for (e3 of G) this[e3] = $2[e3];
53392           for (e3 of X) this[e3] = $2[e3];
53393           for (e3 of W) this[e3] = $2[e3];
53394           for (e3 of j) this[e3] = new Y(e3, $2[e3], void 0, this);
53395         }
53396         setupFromTrue() {
53397           let e3;
53398           for (e3 of G) this[e3] = $2[e3];
53399           for (e3 of X) this[e3] = $2[e3];
53400           for (e3 of W) this[e3] = true;
53401           for (e3 of j) this[e3] = new Y(e3, true, void 0, this);
53402         }
53403         setupFromArray(e3) {
53404           let t2;
53405           for (t2 of G) this[t2] = $2[t2];
53406           for (t2 of X) this[t2] = $2[t2];
53407           for (t2 of W) this[t2] = $2[t2];
53408           for (t2 of j) this[t2] = new Y(t2, false, void 0, this);
53409           this.setupGlobalFilters(e3, void 0, H);
53410         }
53411         setupFromObject(e3) {
53412           let t2;
53413           for (t2 of (H.ifd0 = H.ifd0 || H.image, H.ifd1 = H.ifd1 || H.thumbnail, Object.assign(this, e3), G)) this[t2] = Z(e3[t2], $2[t2]);
53414           for (t2 of X) this[t2] = Z(e3[t2], $2[t2]);
53415           for (t2 of W) this[t2] = Z(e3[t2], $2[t2]);
53416           for (t2 of z) this[t2] = new Y(t2, $2[t2], e3[t2], this);
53417           for (t2 of H) this[t2] = new Y(t2, $2[t2], e3[t2], this.tiff);
53418           this.setupGlobalFilters(e3.pick, e3.skip, H, j), true === e3.tiff ? this.batchEnableWithBool(H, true) : false === e3.tiff ? this.batchEnableWithUserValue(H, e3) : Array.isArray(e3.tiff) ? this.setupGlobalFilters(e3.tiff, void 0, H) : "object" == typeof e3.tiff && this.setupGlobalFilters(e3.tiff.pick, e3.tiff.skip, H);
53419         }
53420         batchEnableWithBool(e3, t2) {
53421           for (let i3 of e3) this[i3].enabled = t2;
53422         }
53423         batchEnableWithUserValue(e3, t2) {
53424           for (let i3 of e3) {
53425             let e4 = t2[i3];
53426             this[i3].enabled = false !== e4 && void 0 !== e4;
53427           }
53428         }
53429         setupGlobalFilters(e3, t2, i3, n3 = i3) {
53430           if (e3 && e3.length) {
53431             for (let e4 of n3) this[e4].enabled = false;
53432             let t3 = Q(e3, i3);
53433             for (let [e4, i4] of t3) ee(this[e4].pick, i4), this[e4].enabled = true;
53434           } else if (t2 && t2.length) {
53435             let e4 = Q(t2, i3);
53436             for (let [t3, i4] of e4) ee(this[t3].skip, i4);
53437           }
53438         }
53439         filterNestedSegmentTags() {
53440           let { ifd0: e3, exif: t2, xmp: i3, iptc: n3, icc: s2 } = this;
53441           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);
53442         }
53443         traverseTiffDependencyTree() {
53444           let { ifd0: e3, exif: t2, gps: i3, interop: n3 } = this;
53445           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 = H.some((e4) => true === this[e4].enabled) || this.makerNote || this.userComment;
53446           for (let e4 of H) this[e4].finalizeFilters();
53447         }
53448         get onlyTiff() {
53449           return !V.map((e3) => this[e3].enabled).some((e3) => true === e3) && this.tiff.enabled;
53450         }
53451         checkLoadedPlugins() {
53452           for (let e3 of z) this[e3].enabled && !T.has(e3) && P("segment parser", e3);
53453         }
53454       };
53455       c(q, "default", $2);
53456       te = class {
53457         constructor(e3) {
53458           c(this, "parsers", {}), c(this, "output", {}), c(this, "errors", []), c(this, "pushToErrors", (e4) => this.errors.push(e4)), this.options = q.useCached(e3);
53459         }
53460         async read(e3) {
53461           this.file = await D(e3, this.options);
53462         }
53463         setup() {
53464           if (this.fileParser) return;
53465           let { file: e3 } = this, t2 = e3.getUint16(0);
53466           for (let [i3, n3] of w) if (n3.canHandle(e3, t2)) return this.fileParser = new n3(this.options, this.file, this.parsers), e3[i3] = true;
53467           this.file.close && this.file.close(), g2("Unknown file format");
53468         }
53469         async parse() {
53470           let { output: e3, errors: t2 } = this;
53471           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);
53472         }
53473         async executeParsers() {
53474           let { output: e3 } = this;
53475           await this.fileParser.parse();
53476           let t2 = Object.values(this.parsers).map(async (t3) => {
53477             let i3 = await t3.parse();
53478             t3.assignToOutput(e3, i3);
53479           });
53480           this.options.silentErrors && (t2 = t2.map((e4) => e4.catch(this.pushToErrors))), await Promise.all(t2);
53481         }
53482         async extractThumbnail() {
53483           this.setup();
53484           let { options: e3, file: t2 } = this, i3 = T.get("tiff", e3);
53485           var n3;
53486           if (t2.tiff ? n3 = { start: 0, type: "tiff" } : t2.jpeg && (n3 = await this.fileParser.getOrFindSegment("tiff")), void 0 === n3) return;
53487           let s2 = await this.fileParser.ensureSegmentChunk(n3), r2 = this.parsers.tiff = new i3(s2, e3, t2), a2 = await r2.extractThumbnail();
53488           return t2.close && t2.close(), a2;
53489         }
53490       };
53491       ne = Object.freeze({ __proto__: null, parse: ie, Exifr: te, fileParsers: w, segmentParsers: T, fileReaders: A, tagKeys: E, tagValues: B, tagRevivers: N, createDictionary: U, extendDictionary: F, fetchUrlAsArrayBuffer: M, readBlobAsArrayBuffer: R, chunkedProps: G, otherSegments: V, segments: z, tiffBlocks: H, segmentsAndBlocks: j, tiffExtractables: W, inheritables: K, allFormatters: X, Options: q });
53492       se = class {
53493         constructor(e3, t2, i3) {
53494           c(this, "errors", []), c(this, "ensureSegmentChunk", async (e4) => {
53495             let t3 = e4.start, i4 = e4.size || 65536;
53496             if (this.file.chunked) if (this.file.available(t3, i4)) e4.chunk = this.file.subarray(t3, i4);
53497             else try {
53498               e4.chunk = await this.file.readChunk(t3, i4);
53499             } catch (t4) {
53500               g2(`Couldn't read segment: ${JSON.stringify(e4)}. ${t4.message}`);
53501             }
53502             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));
53503             return e4.chunk;
53504           }), this.extendOptions && this.extendOptions(e3), this.options = e3, this.file = t2, this.parsers = i3;
53505         }
53506         injectSegment(e3, t2) {
53507           this.options[e3].enabled && this.createParser(e3, t2);
53508         }
53509         createParser(e3, t2) {
53510           let i3 = new (T.get(e3))(t2, this.options, this.file);
53511           return this.parsers[e3] = i3;
53512         }
53513         createParsers(e3) {
53514           for (let t2 of e3) {
53515             let { type: e4, chunk: i3 } = t2, n3 = this.options[e4];
53516             if (n3 && n3.enabled) {
53517               let t3 = this.parsers[e4];
53518               t3 && t3.append || t3 || this.createParser(e4, i3);
53519             }
53520           }
53521         }
53522         async readSegments(e3) {
53523           let t2 = e3.map(this.ensureSegmentChunk);
53524           await Promise.all(t2);
53525         }
53526       };
53527       re2 = class {
53528         static findPosition(e3, t2) {
53529           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;
53530           return { offset: t2, length: i3, headerLength: n3, start: s2, size: r2, end: s2 + r2 };
53531         }
53532         static parse(e3, t2 = {}) {
53533           return new this(e3, new q({ [this.type]: t2 }), e3).parse();
53534         }
53535         normalizeInput(e3) {
53536           return e3 instanceof I ? e3 : new I(e3);
53537         }
53538         constructor(e3, t2 = {}, i3) {
53539           c(this, "errors", []), c(this, "raw", /* @__PURE__ */ new Map()), c(this, "handleError", (e4) => {
53540             if (!this.options.silentErrors) throw e4;
53541             this.errors.push(e4.message);
53542           }), 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;
53543         }
53544         translate() {
53545           this.canTranslate && (this.translated = this.translateBlock(this.raw, this.type));
53546         }
53547         get output() {
53548           return this.translated ? this.translated : this.raw ? Object.fromEntries(this.raw) : void 0;
53549         }
53550         translateBlock(e3, t2) {
53551           let i3 = N.get(t2), n3 = B.get(t2), s2 = E.get(t2), r2 = this.options[t2], a2 = r2.reviveValues && !!i3, o2 = r2.translateValues && !!n3, l2 = r2.translateKeys && !!s2, h2 = {};
53552           for (let [t3, r3] of e3) a2 && 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), h2[t3] = r3;
53553           return h2;
53554         }
53555         translateValue(e3, t2) {
53556           return t2[e3] || t2.DEFAULT || e3;
53557         }
53558         assignToOutput(e3, t2) {
53559           this.assignObjectToOutput(e3, this.constructor.type, t2);
53560         }
53561         assignObjectToOutput(e3, t2, i3) {
53562           if (this.globalOptions.mergeOutput) return Object.assign(e3, i3);
53563           e3[t2] ? Object.assign(e3[t2], i3) : e3[t2] = i3;
53564         }
53565       };
53566       c(re2, "headerLength", 4), c(re2, "type", void 0), c(re2, "multiSegment", false), c(re2, "canHandle", () => false);
53567       he = class extends se {
53568         constructor(...e3) {
53569           super(...e3), c(this, "appSegments", []), c(this, "jpegSegments", []), c(this, "unknownSegments", []);
53570         }
53571         static canHandle(e3, t2) {
53572           return 65496 === t2;
53573         }
53574         async parse() {
53575           await this.findAppSegments(), await this.readSegments(this.appSegments), this.mergeMultiSegments(), this.createParsers(this.mergedAppSegments || this.appSegments);
53576         }
53577         setupSegmentFinderArgs(e3) {
53578           true === e3 ? (this.findAll = true, this.wanted = new Set(T.keyList())) : (e3 = void 0 === e3 ? T.keyList().filter((e4) => this.options[e4].enabled) : e3.filter((e4) => this.options[e4].enabled && T.has(e4)), this.findAll = false, this.remaining = new Set(e3), this.wanted = new Set(e3)), this.unfinishedMultiSegment = false;
53579         }
53580         async findAppSegments(e3 = 0, t2) {
53581           this.setupSegmentFinderArgs(t2);
53582           let { file: i3, findAll: n3, wanted: s2, remaining: r2 } = this;
53583           if (!n3 && this.file.chunked && (n3 = Array.from(s2).some((e4) => {
53584             let t3 = T.get(e4), i4 = this.options[e4];
53585             return t3.multiSegment && i4.multiSegment;
53586           }), n3 && await this.file.readWhole()), e3 = this.findAppSegmentsInRange(e3, i3.byteLength), !this.options.onlyTiff && i3.chunked) {
53587             let t3 = false;
53588             for (; r2.size > 0 && !t3 && (i3.canReadNextChunk || this.unfinishedMultiSegment); ) {
53589               let { nextChunkOffset: n4 } = i3, s3 = this.appSegments.some((e4) => !this.file.available(e4.offset || e4.start, e4.length || e4.size));
53590               if (t3 = e3 > n4 && !s3 ? !await i3.readNextChunk(e3) : !await i3.readNextChunk(n4), void 0 === (e3 = this.findAppSegmentsInRange(e3, i3.byteLength))) return;
53591             }
53592           }
53593         }
53594         findAppSegmentsInRange(e3, t2) {
53595           t2 -= 2;
53596           let i3, n3, s2, r2, a2, o2, { file: l2, findAll: h2, wanted: u2, remaining: c2, options: f2 } = this;
53597           for (; e3 < t2; e3++) if (255 === l2.getUint8(e3)) {
53598             if (i3 = l2.getUint8(e3 + 1), oe(i3)) {
53599               if (n3 = l2.getUint16(e3 + 2), s2 = le(l2, e3, n3), s2 && u2.has(s2) && (r2 = T.get(s2), a2 = r2.findPosition(l2, e3), o2 = f2[s2], a2.type = s2, this.appSegments.push(a2), !h2 && (r2.multiSegment && o2.multiSegment ? (this.unfinishedMultiSegment = a2.chunkNumber < a2.chunkCount, this.unfinishedMultiSegment || c2.delete(s2)) : c2.delete(s2), 0 === c2.size))) break;
53600               f2.recordUnknownSegments && (a2 = re2.findPosition(l2, e3), a2.marker = i3, this.unknownSegments.push(a2)), e3 += n3 + 1;
53601             } else if (ae(i3)) {
53602               if (n3 = l2.getUint16(e3 + 2), 218 === i3 && false !== f2.stopAfterSos) return;
53603               f2.recordJpegSegments && this.jpegSegments.push({ offset: e3, length: n3, marker: i3 }), e3 += n3 + 1;
53604             }
53605           }
53606           return e3;
53607         }
53608         mergeMultiSegments() {
53609           if (!this.appSegments.some((e4) => e4.multiSegment)) return;
53610           let e3 = function(e4, t2) {
53611             let i3, n3, s2, r2 = /* @__PURE__ */ new Map();
53612             for (let a2 = 0; a2 < e4.length; a2++) i3 = e4[a2], n3 = i3[t2], r2.has(n3) ? s2 = r2.get(n3) : r2.set(n3, s2 = []), s2.push(i3);
53613             return Array.from(r2);
53614           }(this.appSegments, "type");
53615           this.mergedAppSegments = e3.map(([e4, t2]) => {
53616             let i3 = T.get(e4, this.options);
53617             if (i3.handleMultiSegments) {
53618               return { type: e4, chunk: i3.handleMultiSegments(t2) };
53619             }
53620             return t2[0];
53621           });
53622         }
53623         getSegment(e3) {
53624           return this.appSegments.find((t2) => t2.type === e3);
53625         }
53626         async getOrFindSegment(e3) {
53627           let t2 = this.getSegment(e3);
53628           return void 0 === t2 && (await this.findAppSegments(0, [e3]), t2 = this.getSegment(e3)), t2;
53629         }
53630       };
53631       c(he, "type", "jpeg"), w.set("jpeg", he);
53632       ue = [void 0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8, 4];
53633       ce = class extends re2 {
53634         parseHeader() {
53635           var e3 = this.chunk.getUint16();
53636           18761 === e3 ? this.le = true : 19789 === e3 && (this.le = false), this.chunk.le = this.le, this.headerParsed = true;
53637         }
53638         parseTags(e3, t2, i3 = /* @__PURE__ */ new Map()) {
53639           let { pick: n3, skip: s2 } = this.options[t2];
53640           n3 = new Set(n3);
53641           let r2 = n3.size > 0, a2 = 0 === s2.size, o2 = this.chunk.getUint16(e3);
53642           e3 += 2;
53643           for (let l2 = 0; l2 < o2; l2++) {
53644             let o3 = this.chunk.getUint16(e3);
53645             if (r2) {
53646               if (n3.has(o3) && (i3.set(o3, this.parseTag(e3, o3, t2)), n3.delete(o3), 0 === n3.size)) break;
53647             } else !a2 && s2.has(o3) || i3.set(o3, this.parseTag(e3, o3, t2));
53648             e3 += 12;
53649           }
53650           return i3;
53651         }
53652         parseTag(e3, t2, i3) {
53653           let { chunk: n3 } = this, s2 = n3.getUint16(e3 + 2), r2 = n3.getUint32(e3 + 4), a2 = ue[s2];
53654           if (a2 * 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);
53655           if (2 === s2) return m(n3.getString(e3, r2));
53656           if (7 === s2) return n3.getUint8Array(e3, r2);
53657           if (1 === r2) return this.parseTagValue(s2, e3);
53658           {
53659             let t3 = new (function(e4) {
53660               switch (e4) {
53661                 case 1:
53662                   return Uint8Array;
53663                 case 3:
53664                   return Uint16Array;
53665                 case 4:
53666                   return Uint32Array;
53667                 case 5:
53668                   return Array;
53669                 case 6:
53670                   return Int8Array;
53671                 case 8:
53672                   return Int16Array;
53673                 case 9:
53674                   return Int32Array;
53675                 case 10:
53676                   return Array;
53677                 case 11:
53678                   return Float32Array;
53679                 case 12:
53680                   return Float64Array;
53681                 default:
53682                   return Array;
53683               }
53684             }(s2))(r2), i4 = a2;
53685             for (let n4 = 0; n4 < r2; n4++) t3[n4] = this.parseTagValue(s2, e3), e3 += i4;
53686             return t3;
53687           }
53688         }
53689         parseTagValue(e3, t2) {
53690           let { chunk: i3 } = this;
53691           switch (e3) {
53692             case 1:
53693               return i3.getUint8(t2);
53694             case 3:
53695               return i3.getUint16(t2);
53696             case 4:
53697               return i3.getUint32(t2);
53698             case 5:
53699               return i3.getUint32(t2) / i3.getUint32(t2 + 4);
53700             case 6:
53701               return i3.getInt8(t2);
53702             case 8:
53703               return i3.getInt16(t2);
53704             case 9:
53705               return i3.getInt32(t2);
53706             case 10:
53707               return i3.getInt32(t2) / i3.getInt32(t2 + 4);
53708             case 11:
53709               return i3.getFloat(t2);
53710             case 12:
53711               return i3.getDouble(t2);
53712             case 13:
53713               return i3.getUint32(t2);
53714             default:
53715               g2(`Invalid tiff type ${e3}`);
53716           }
53717         }
53718       };
53719       fe = class extends ce {
53720         static canHandle(e3, t2) {
53721           return 225 === e3.getUint8(t2 + 1) && 1165519206 === e3.getUint32(t2 + 4) && 0 === e3.getUint16(t2 + 8);
53722         }
53723         async parse() {
53724           this.parseHeader();
53725           let { options: e3 } = this;
53726           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();
53727         }
53728         safeParse(e3) {
53729           let t2 = this[e3]();
53730           return void 0 !== t2.catch && (t2 = t2.catch(this.handleError)), t2;
53731         }
53732         findIfd0Offset() {
53733           void 0 === this.ifd0Offset && (this.ifd0Offset = this.chunk.getUint32(4));
53734         }
53735         findIfd1Offset() {
53736           if (void 0 === this.ifd1Offset) {
53737             this.findIfd0Offset();
53738             let e3 = this.chunk.getUint16(this.ifd0Offset), t2 = this.ifd0Offset + 2 + 12 * e3;
53739             this.ifd1Offset = this.chunk.getUint32(t2);
53740           }
53741         }
53742         parseBlock(e3, t2) {
53743           let i3 = /* @__PURE__ */ new Map();
53744           return this[t2] = i3, this.parseTags(e3, t2, i3), i3;
53745         }
53746         async parseIfd0Block() {
53747           if (this.ifd0) return;
53748           let { file: e3 } = this;
53749           this.findIfd0Offset(), this.ifd0Offset < 8 && g2("Malformed EXIF data"), !e3.chunked && this.ifd0Offset > e3.byteLength && g2(`IFD0 offset points to outside of file.
53750 this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e3.byteLength}`), e3.tiff && await e3.ensureChunk(this.ifd0Offset, S(this.options));
53751           let t2 = this.parseBlock(this.ifd0Offset, "ifd0");
53752           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;
53753         }
53754         async parseExifBlock() {
53755           if (this.exif) return;
53756           if (this.ifd0 || await this.parseIfd0Block(), void 0 === this.exifOffset) return;
53757           this.file.tiff && await this.file.ensureChunk(this.exifOffset, S(this.options));
53758           let e3 = this.parseBlock(this.exifOffset, "exif");
53759           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;
53760         }
53761         unpack(e3, t2) {
53762           let i3 = e3.get(t2);
53763           i3 && 1 === i3.length && e3.set(t2, i3[0]);
53764         }
53765         async parseGpsBlock() {
53766           if (this.gps) return;
53767           if (this.ifd0 || await this.parseIfd0Block(), void 0 === this.gpsOffset) return;
53768           let e3 = this.parseBlock(this.gpsOffset, "gps");
53769           return e3 && e3.has(2) && e3.has(4) && (e3.set("latitude", de(...e3.get(2), e3.get(1))), e3.set("longitude", de(...e3.get(4), e3.get(3)))), e3;
53770         }
53771         async parseInteropBlock() {
53772           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");
53773         }
53774         async parseThumbnailBlock(e3 = false) {
53775           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;
53776         }
53777         async extractThumbnail() {
53778           if (this.headerParsed || this.parseHeader(), this.ifd1Parsed || await this.parseThumbnailBlock(true), void 0 === this.ifd1) return;
53779           let e3 = this.ifd1.get(513), t2 = this.ifd1.get(514);
53780           return this.chunk.getUint8Array(e3, t2);
53781         }
53782         get image() {
53783           return this.ifd0;
53784         }
53785         get thumbnail() {
53786           return this.ifd1;
53787         }
53788         createOutput() {
53789           let e3, t2, i3, n3 = {};
53790           for (t2 of H) if (e3 = this[t2], !p(e3)) if (i3 = this.canTranslate ? this.translateBlock(e3, t2) : Object.fromEntries(e3), this.options.mergeOutput) {
53791             if ("ifd1" === t2) continue;
53792             Object.assign(n3, i3);
53793           } else n3[t2] = i3;
53794           return this.makerNote && (n3.makerNote = this.makerNote), this.userComment && (n3.userComment = this.userComment), n3;
53795         }
53796         assignToOutput(e3, t2) {
53797           if (this.globalOptions.mergeOutput) Object.assign(e3, t2);
53798           else for (let [i3, n3] of Object.entries(t2)) this.assignObjectToOutput(e3, i3, n3);
53799         }
53800       };
53801       c(fe, "type", "tiff"), c(fe, "headerLength", 10), T.set("tiff", fe);
53802       pe = Object.freeze({ __proto__: null, default: ne, Exifr: te, fileParsers: w, segmentParsers: T, fileReaders: A, tagKeys: E, tagValues: B, tagRevivers: N, createDictionary: U, extendDictionary: F, fetchUrlAsArrayBuffer: M, readBlobAsArrayBuffer: R, chunkedProps: G, otherSegments: V, segments: z, tiffBlocks: H, segmentsAndBlocks: j, tiffExtractables: W, inheritables: K, allFormatters: X, Options: q, parse: ie });
53803       ge = { ifd0: false, ifd1: false, exif: false, gps: false, interop: false, sanitize: false, reviveValues: true, translateKeys: false, translateValues: false, mergeOutput: false };
53804       me = Object.assign({}, ge, { firstChunkSize: 4e4, gps: [1, 2, 3, 4] });
53805       Ce = Object.assign({}, ge, { tiff: false, ifd1: true, mergeOutput: false });
53806       Ie = Object.assign({}, ge, { firstChunkSize: 4e4, ifd0: [274] });
53807       ke = 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 } });
53808       we = true;
53809       Te = true;
53810       if ("object" == typeof navigator) {
53811         let e3 = navigator.userAgent;
53812         if (e3.includes("iPad") || e3.includes("iPhone")) {
53813           let t2 = e3.match(/OS (\d+)_(\d+)/);
53814           if (t2) {
53815             let [, e4, i3] = t2, n3 = Number(e4) + 0.1 * Number(i3);
53816             we = n3 < 13.4, Te = false;
53817           }
53818         } else if (e3.includes("OS X 10")) {
53819           let [, t2] = e3.match(/OS X 10[_.](\d+)/);
53820           we = Te = Number(t2) < 15;
53821         }
53822         if (e3.includes("Chrome/")) {
53823           let [, t2] = e3.match(/Chrome\/(\d+)/);
53824           we = Te = Number(t2) < 81;
53825         } else if (e3.includes("Firefox/")) {
53826           let [, t2] = e3.match(/Firefox\/(\d+)/);
53827           we = Te = Number(t2) < 77;
53828         }
53829       }
53830       De = class extends I {
53831         constructor(...e3) {
53832           super(...e3), c(this, "ranges", new Oe()), 0 !== this.byteLength && this.ranges.add(0, this.byteLength);
53833         }
53834         _tryExtend(e3, t2, i3) {
53835           if (0 === e3 && 0 === this.byteLength && i3) {
53836             let e4 = new DataView(i3.buffer || i3, i3.byteOffset, i3.byteLength);
53837             this._swapDataView(e4);
53838           } else {
53839             let i4 = e3 + t2;
53840             if (i4 > this.byteLength) {
53841               let { dataView: e4 } = this._extend(i4);
53842               this._swapDataView(e4);
53843             }
53844           }
53845         }
53846         _extend(e3) {
53847           let t2;
53848           t2 = a ? s.allocUnsafe(e3) : new Uint8Array(e3);
53849           let i3 = new DataView(t2.buffer, t2.byteOffset, t2.byteLength);
53850           return t2.set(new Uint8Array(this.buffer, this.byteOffset, this.byteLength), 0), { uintView: t2, dataView: i3 };
53851         }
53852         subarray(e3, t2, i3 = false) {
53853           return t2 = t2 || this._lengthToEnd(e3), i3 && this._tryExtend(e3, t2), this.ranges.add(e3, t2), super.subarray(e3, t2);
53854         }
53855         set(e3, t2, i3 = false) {
53856           i3 && this._tryExtend(t2, e3.byteLength, e3);
53857           let n3 = super.set(e3, t2);
53858           return this.ranges.add(t2, n3.byteLength), n3;
53859         }
53860         async ensureChunk(e3, t2) {
53861           this.chunked && (this.ranges.available(e3, t2) || await this.readChunk(e3, t2));
53862         }
53863         available(e3, t2) {
53864           return this.ranges.available(e3, t2);
53865         }
53866       };
53867       Oe = class {
53868         constructor() {
53869           c(this, "list", []);
53870         }
53871         get length() {
53872           return this.list.length;
53873         }
53874         add(e3, t2, i3 = 0) {
53875           let n3 = e3 + t2, s2 = this.list.filter((t3) => xe(e3, t3.offset, n3) || xe(e3, t3.end, n3));
53876           if (s2.length > 0) {
53877             e3 = Math.min(e3, ...s2.map((e4) => e4.offset)), n3 = Math.max(n3, ...s2.map((e4) => e4.end)), t2 = n3 - e3;
53878             let i4 = s2.shift();
53879             i4.offset = e3, i4.length = t2, i4.end = n3, this.list = this.list.filter((e4) => !s2.includes(e4));
53880           } else this.list.push({ offset: e3, length: t2, end: n3 });
53881         }
53882         available(e3, t2) {
53883           let i3 = e3 + t2;
53884           return this.list.some((t3) => t3.offset <= e3 && i3 <= t3.end);
53885         }
53886       };
53887       ve = class extends De {
53888         constructor(e3, t2) {
53889           super(0), c(this, "chunksRead", 0), this.input = e3, this.options = t2;
53890         }
53891         async readWhole() {
53892           this.chunked = false, await this.readChunk(this.nextChunkOffset);
53893         }
53894         async readChunked() {
53895           this.chunked = true, await this.readChunk(0, this.options.firstChunkSize);
53896         }
53897         async readNextChunk(e3 = this.nextChunkOffset) {
53898           if (this.fullyRead) return this.chunksRead++, false;
53899           let t2 = this.options.chunkSize, i3 = await this.readChunk(e3, t2);
53900           return !!i3 && i3.byteLength === t2;
53901         }
53902         async readChunk(e3, t2) {
53903           if (this.chunksRead++, 0 !== (t2 = this.safeWrapAddress(e3, t2))) return this._readChunk(e3, t2);
53904         }
53905         safeWrapAddress(e3, t2) {
53906           return void 0 !== this.size && e3 + t2 > this.size ? Math.max(0, this.size - e3) : t2;
53907         }
53908         get nextChunkOffset() {
53909           if (0 !== this.ranges.list.length) return this.ranges.list[0].length;
53910         }
53911         get canReadNextChunk() {
53912           return this.chunksRead < this.options.chunkLimit;
53913         }
53914         get fullyRead() {
53915           return void 0 !== this.size && this.nextChunkOffset === this.size;
53916         }
53917         read() {
53918           return this.options.chunked ? this.readChunked() : this.readWhole();
53919         }
53920         close() {
53921         }
53922       };
53923       A.set("blob", class extends ve {
53924         async readWhole() {
53925           this.chunked = false;
53926           let e3 = await R(this.input);
53927           this._swapArrayBuffer(e3);
53928         }
53929         readChunked() {
53930           return this.chunked = true, this.size = this.input.size, super.readChunked();
53931         }
53932         async _readChunk(e3, t2) {
53933           let i3 = t2 ? e3 + t2 : void 0, n3 = this.input.slice(e3, i3), s2 = await R(n3);
53934           return this.set(s2, e3, true);
53935         }
53936       });
53937       Me = Object.freeze({ __proto__: null, default: pe, Exifr: te, fileParsers: w, segmentParsers: T, fileReaders: A, tagKeys: E, tagValues: B, tagRevivers: N, createDictionary: U, extendDictionary: F, fetchUrlAsArrayBuffer: M, readBlobAsArrayBuffer: R, chunkedProps: G, otherSegments: V, segments: z, tiffBlocks: H, segmentsAndBlocks: j, tiffExtractables: W, inheritables: K, allFormatters: X, Options: q, parse: ie, gpsOnlyOptions: me, gps: Se, thumbnailOnlyOptions: Ce, thumbnail: ye, thumbnailUrl: be, orientationOnlyOptions: Ie, orientation: Pe, rotations: ke, get rotateCanvas() {
53938         return we;
53939       }, get rotateCss() {
53940         return Te;
53941       }, rotation: Ae });
53942       A.set("url", class extends ve {
53943         async readWhole() {
53944           this.chunked = false;
53945           let e3 = await M(this.input);
53946           e3 instanceof ArrayBuffer ? this._swapArrayBuffer(e3) : e3 instanceof Uint8Array && this._swapBuffer(e3);
53947         }
53948         async _readChunk(e3, t2) {
53949           let i3 = t2 ? e3 + t2 - 1 : void 0, n3 = this.options.httpHeaders || {};
53950           (e3 || i3) && (n3.range = `bytes=${[e3, i3].join("-")}`);
53951           let s2 = await h(this.input, { headers: n3 }), r2 = await s2.arrayBuffer(), a2 = r2.byteLength;
53952           if (416 !== s2.status) return a2 !== t2 && (this.size = e3 + a2), this.set(r2, e3, true);
53953         }
53954       });
53955       I.prototype.getUint64 = function(e3) {
53956         let t2 = this.getUint32(e3), i3 = this.getUint32(e3 + 4);
53957         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.");
53958       };
53959       Re = class extends se {
53960         parseBoxes(e3 = 0) {
53961           let t2 = [];
53962           for (; e3 < this.file.byteLength - 4; ) {
53963             let i3 = this.parseBoxHead(e3);
53964             if (t2.push(i3), 0 === i3.length) break;
53965             e3 += i3.length;
53966           }
53967           return t2;
53968         }
53969         parseSubBoxes(e3) {
53970           e3.boxes = this.parseBoxes(e3.start);
53971         }
53972         findBox(e3, t2) {
53973           return void 0 === e3.boxes && this.parseSubBoxes(e3), e3.boxes.find((e4) => e4.kind === t2);
53974         }
53975         parseBoxHead(e3) {
53976           let t2 = this.file.getUint32(e3), i3 = this.file.getString(e3 + 4, 4), n3 = e3 + 8;
53977           return 1 === t2 && (t2 = this.file.getUint64(e3 + 8), n3 += 8), { offset: e3, length: t2, kind: i3, start: n3 };
53978         }
53979         parseBoxFullHead(e3) {
53980           if (void 0 !== e3.version) return;
53981           let t2 = this.file.getUint32(e3.start);
53982           e3.version = t2 >> 24, e3.start += 4;
53983         }
53984       };
53985       Le = class extends Re {
53986         static canHandle(e3, t2) {
53987           if (0 !== t2) return false;
53988           let i3 = e3.getUint16(2);
53989           if (i3 > 50) return false;
53990           let n3 = 16, s2 = [];
53991           for (; n3 < i3; ) s2.push(e3.getString(n3, 4)), n3 += 4;
53992           return s2.includes(this.type);
53993         }
53994         async parse() {
53995           let e3 = this.file.getUint32(0), t2 = this.parseBoxHead(e3);
53996           for (; "meta" !== t2.kind; ) e3 += t2.length, await this.file.ensureChunk(e3, 16), t2 = this.parseBoxHead(e3);
53997           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);
53998         }
53999         async registerSegment(e3, t2, i3) {
54000           await this.file.ensureChunk(t2, i3);
54001           let n3 = this.file.subarray(t2, i3);
54002           this.createParser(e3, n3);
54003         }
54004         async findIcc(e3) {
54005           let t2 = this.findBox(e3, "iprp");
54006           if (void 0 === t2) return;
54007           let i3 = this.findBox(t2, "ipco");
54008           if (void 0 === i3) return;
54009           let n3 = this.findBox(i3, "colr");
54010           void 0 !== n3 && await this.registerSegment("icc", n3.offset + 12, n3.length);
54011         }
54012         async findExif(e3) {
54013           let t2 = this.findBox(e3, "iinf");
54014           if (void 0 === t2) return;
54015           let i3 = this.findBox(e3, "iloc");
54016           if (void 0 === i3) return;
54017           let n3 = this.findExifLocIdInIinf(t2), s2 = this.findExtentInIloc(i3, n3);
54018           if (void 0 === s2) return;
54019           let [r2, a2] = s2;
54020           await this.file.ensureChunk(r2, a2);
54021           let o2 = 4 + this.file.getUint32(r2);
54022           r2 += o2, a2 -= o2, await this.registerSegment("tiff", r2, a2);
54023         }
54024         findExifLocIdInIinf(e3) {
54025           this.parseBoxFullHead(e3);
54026           let t2, i3, n3, s2, r2 = e3.start, a2 = this.file.getUint16(r2);
54027           for (r2 += 2; a2--; ) {
54028             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);
54029             r2 += t2.length;
54030           }
54031         }
54032         get8bits(e3) {
54033           let t2 = this.file.getUint8(e3);
54034           return [t2 >> 4, 15 & t2];
54035         }
54036         findExtentInIloc(e3, t2) {
54037           this.parseBoxFullHead(e3);
54038           let i3 = e3.start, [n3, s2] = this.get8bits(i3++), [r2, a2] = this.get8bits(i3++), o2 = 2 === e3.version ? 4 : 2, l2 = 1 === e3.version || 2 === e3.version ? 2 : 0, h2 = a2 + n3 + s2, u2 = 2 === e3.version ? 4 : 2, c2 = this.file.getUintBytes(i3, u2);
54039           for (i3 += u2; c2--; ) {
54040             let e4 = this.file.getUintBytes(i3, o2);
54041             i3 += o2 + l2 + 2 + r2;
54042             let u3 = this.file.getUint16(i3);
54043             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 + a2, n3), this.file.getUintBytes(i3 + a2 + n3, s2)];
54044             i3 += u3 * h2;
54045           }
54046         }
54047       };
54048       Ue = class extends Le {
54049       };
54050       c(Ue, "type", "heic");
54051       Fe = class extends Le {
54052       };
54053       c(Fe, "type", "avif"), w.set("heic", Ue), w.set("avif", Fe), U(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"]]), U(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"]]), U(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"]]), U(B, ["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" }]]);
54054       Ee = U(B, "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" }]]);
54055       Be = { 1: "No absolute unit of measurement", 2: "Inch", 3: "Centimeter" };
54056       Ee.set(37392, Be), Ee.set(41488, Be);
54057       Ne = { 0: "Normal", 1: "Low", 2: "High" };
54058       Ee.set(41992, Ne), Ee.set(41993, Ne), Ee.set(41994, Ne), U(N, ["ifd0", "ifd1"], [[50827, function(e3) {
54059         return "string" != typeof e3 ? b(e3) : e3;
54060       }], [306, ze], [40091, He], [40092, He], [40093, He], [40094, He], [40095, He]]), U(N, "exif", [[40960, Ve], [36864, Ve], [36867, ze], [36868, ze], [40962, Ge], [40963, Ge]]), U(N, "gps", [[0, (e3) => Array.from(e3).join(".")], [7, (e3) => Array.from(e3).join(":")]]);
54061       We = class extends re2 {
54062         static canHandle(e3, t2) {
54063           return 225 === e3.getUint8(t2 + 1) && 1752462448 === e3.getUint32(t2 + 4) && "http://ns.adobe.com/" === e3.getString(t2 + 4, "http://ns.adobe.com/".length);
54064         }
54065         static headerLength(e3, t2) {
54066           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;
54067         }
54068         static findPosition(e3, t2) {
54069           let i3 = super.findPosition(e3, t2);
54070           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;
54071         }
54072         static handleMultiSegments(e3) {
54073           return e3.map((e4) => e4.chunk.getString()).join("");
54074         }
54075         normalizeInput(e3) {
54076           return "string" == typeof e3 ? e3 : I.from(e3).getString();
54077         }
54078         parse(e3 = this.chunk) {
54079           if (!this.localOptions.parse) return e3;
54080           e3 = function(e4) {
54081             let t3 = {}, i4 = {};
54082             for (let e6 of Ze) t3[e6] = [], i4[e6] = 0;
54083             return e4.replace(et, (e6, n4, s2) => {
54084               if ("<" === n4) {
54085                 let n5 = ++i4[s2];
54086                 return t3[s2].push(n5), `${e6}#${n5}`;
54087               }
54088               return `${e6}#${t3[s2].pop()}`;
54089             });
54090           }(e3);
54091           let t2 = Xe.findAll(e3, "rdf", "Description");
54092           0 === t2.length && t2.push(new Xe("rdf", "Description", void 0, e3));
54093           let i3, n3 = {};
54094           for (let e4 of t2) for (let t3 of e4.properties) i3 = Je(t3.ns, n3), _e(t3, i3);
54095           return function(e4) {
54096             let t3;
54097             for (let i4 in e4) t3 = e4[i4] = f(e4[i4]), void 0 === t3 && delete e4[i4];
54098             return f(e4);
54099           }(n3);
54100         }
54101         assignToOutput(e3, t2) {
54102           if (this.localOptions.parse) for (let [i3, n3] of Object.entries(t2)) switch (i3) {
54103             case "tiff":
54104               this.assignObjectToOutput(e3, "ifd0", n3);
54105               break;
54106             case "exif":
54107               this.assignObjectToOutput(e3, "exif", n3);
54108               break;
54109             case "xmlns":
54110               break;
54111             default:
54112               this.assignObjectToOutput(e3, i3, n3);
54113           }
54114           else e3.xmp = t2;
54115         }
54116       };
54117       c(We, "type", "xmp"), c(We, "multiSegment", true), T.set("xmp", We);
54118       Ke = class _Ke {
54119         static findAll(e3) {
54120           return qe(e3, /([a-zA-Z0-9-]+):([a-zA-Z0-9-]+)=("[^"]*"|'[^']*')/gm).map(_Ke.unpackMatch);
54121         }
54122         static unpackMatch(e3) {
54123           let t2 = e3[1], i3 = e3[2], n3 = e3[3].slice(1, -1);
54124           return n3 = Qe(n3), new _Ke(t2, i3, n3);
54125         }
54126         constructor(e3, t2, i3) {
54127           this.ns = e3, this.name = t2, this.value = i3;
54128         }
54129         serialize() {
54130           return this.value;
54131         }
54132       };
54133       Xe = class _Xe {
54134         static findAll(e3, t2, i3) {
54135           if (void 0 !== t2 || void 0 !== i3) {
54136             t2 = t2 || "[\\w\\d-]+", i3 = i3 || "[\\w\\d-]+";
54137             var n3 = new RegExp(`<(${t2}):(${i3})(#\\d+)?((\\s+?[\\w\\d-:]+=("[^"]*"|'[^']*'))*\\s*)(\\/>|>([\\s\\S]*?)<\\/\\1:\\2\\3>)`, "gm");
54138           } else n3 = /<([\w\d-]+):([\w\d-]+)(#\d+)?((\s+?[\w\d-:]+=("[^"]*"|'[^']*'))*\s*)(\/>|>([\s\S]*?)<\/\1:\2\3>)/gm;
54139           return qe(e3, n3).map(_Xe.unpackMatch);
54140         }
54141         static unpackMatch(e3) {
54142           let t2 = e3[1], i3 = e3[2], n3 = e3[4], s2 = e3[8];
54143           return new _Xe(t2, i3, n3, s2);
54144         }
54145         constructor(e3, t2, i3, n3) {
54146           this.ns = e3, this.name = t2, this.attrString = i3, this.innerXml = n3, this.attrs = Ke.findAll(i3), this.children = _Xe.findAll(n3), this.value = 0 === this.children.length ? Qe(n3) : void 0, this.properties = [...this.attrs, ...this.children];
54147         }
54148         get isPrimitive() {
54149           return void 0 !== this.value && 0 === this.attrs.length && 0 === this.children.length;
54150         }
54151         get isListContainer() {
54152           return 1 === this.children.length && this.children[0].isList;
54153         }
54154         get isList() {
54155           let { ns: e3, name: t2 } = this;
54156           return "rdf" === e3 && ("Seq" === t2 || "Bag" === t2 || "Alt" === t2);
54157         }
54158         get isListItem() {
54159           return "rdf" === this.ns && "li" === this.name;
54160         }
54161         serialize() {
54162           if (0 === this.properties.length && void 0 === this.value) return;
54163           if (this.isPrimitive) return this.value;
54164           if (this.isListContainer) return this.children[0].serialize();
54165           if (this.isList) return $e(this.children.map(Ye));
54166           if (this.isListItem && 1 === this.children.length && 0 === this.attrs.length) return this.children[0].serialize();
54167           let e3 = {};
54168           for (let t2 of this.properties) _e(t2, e3);
54169           return void 0 !== this.value && (e3.value = this.value), f(e3);
54170         }
54171       };
54172       Ye = (e3) => e3.serialize();
54173       $e = (e3) => 1 === e3.length ? e3[0] : e3;
54174       Je = (e3, t2) => t2[e3] ? t2[e3] : t2[e3] = {};
54175       Ze = ["rdf:li", "rdf:Seq", "rdf:Bag", "rdf:Alt", "rdf:Description"];
54176       et = new RegExp(`(<|\\/)(${Ze.join("|")})`, "g");
54177       tt = Object.freeze({ __proto__: null, default: Me, Exifr: te, fileParsers: w, segmentParsers: T, fileReaders: A, tagKeys: E, tagValues: B, tagRevivers: N, createDictionary: U, extendDictionary: F, fetchUrlAsArrayBuffer: M, readBlobAsArrayBuffer: R, chunkedProps: G, otherSegments: V, segments: z, tiffBlocks: H, segmentsAndBlocks: j, tiffExtractables: W, inheritables: K, allFormatters: X, Options: q, parse: ie, gpsOnlyOptions: me, gps: Se, thumbnailOnlyOptions: Ce, thumbnail: ye, thumbnailUrl: be, orientationOnlyOptions: Ie, orientation: Pe, rotations: ke, get rotateCanvas() {
54178         return we;
54179       }, get rotateCss() {
54180         return Te;
54181       }, rotation: Ae });
54182       at = l("fs", (e3) => e3.promises);
54183       A.set("fs", class extends ve {
54184         async readWhole() {
54185           this.chunked = false, this.fs = await at;
54186           let e3 = await this.fs.readFile(this.input);
54187           this._swapBuffer(e3);
54188         }
54189         async readChunked() {
54190           this.chunked = true, this.fs = await at, await this.open(), await this.readChunk(0, this.options.firstChunkSize);
54191         }
54192         async open() {
54193           void 0 === this.fh && (this.fh = await this.fs.open(this.input, "r"), this.size = (await this.fh.stat(this.input)).size);
54194         }
54195         async _readChunk(e3, t2) {
54196           void 0 === this.fh && await this.open(), e3 + t2 > this.size && (t2 = this.size - e3);
54197           var i3 = this.subarray(e3, t2, true);
54198           return await this.fh.read(i3.dataView, 0, t2, e3), i3;
54199         }
54200         async close() {
54201           if (this.fh) {
54202             let e3 = this.fh;
54203             this.fh = void 0, await e3.close();
54204           }
54205         }
54206       });
54207       A.set("base64", class extends ve {
54208         constructor(...e3) {
54209           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);
54210         }
54211         async _readChunk(e3, t2) {
54212           let i3, n3, r2 = this.input;
54213           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);
54214           let o2 = e3 + t2, l2 = i3 + 4 * Math.ceil(o2 / 3);
54215           r2 = r2.slice(i3, l2);
54216           let h2 = Math.min(t2, this.size - e3);
54217           if (a) {
54218             let t3 = s.from(r2, "base64").slice(n3, n3 + h2);
54219             return this.set(t3, e3, true);
54220           }
54221           {
54222             let t3 = this.subarray(e3, h2, true), i4 = atob(r2), s2 = t3.toUint8();
54223             for (let e4 = 0; e4 < h2; e4++) s2[e4] = i4.charCodeAt(n3 + e4);
54224             return t3;
54225           }
54226         }
54227       });
54228       ot = class extends se {
54229         static canHandle(e3, t2) {
54230           return 18761 === t2 || 19789 === t2;
54231         }
54232         extendOptions(e3) {
54233           let { ifd0: t2, xmp: i3, iptc: n3, icc: s2 } = e3;
54234           i3.enabled && t2.deps.add(700), n3.enabled && t2.deps.add(33723), s2.enabled && t2.deps.add(34675), t2.finalizeFilters();
54235         }
54236         async parse() {
54237           let { tiff: e3, xmp: t2, iptc: i3, icc: n3 } = this.options;
54238           if (e3.enabled || t2.enabled || i3.enabled || n3.enabled) {
54239             let e4 = Math.max(S(this.options), this.options.chunkSize);
54240             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");
54241           }
54242         }
54243         adaptTiffPropAsSegment(e3) {
54244           if (this.parsers.tiff[e3]) {
54245             let t2 = this.parsers.tiff[e3];
54246             this.injectSegment(e3, t2);
54247           }
54248         }
54249       };
54250       c(ot, "type", "tiff"), w.set("tiff", ot);
54251       lt = l("zlib");
54252       ht = ["ihdr", "iccp", "text", "itxt", "exif"];
54253       ut = class extends se {
54254         constructor(...e3) {
54255           super(...e3), c(this, "catchError", (e4) => this.errors.push(e4)), c(this, "metaChunks", []), c(this, "unknownChunks", []);
54256         }
54257         static canHandle(e3, t2) {
54258           return 35152 === t2 && 2303741511 === e3.getUint32(0) && 218765834 === e3.getUint32(4);
54259         }
54260         async parse() {
54261           let { file: e3 } = this;
54262           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);
54263         }
54264         async findPngChunksInRange(e3, t2) {
54265           let { file: i3 } = this;
54266           for (; e3 < t2; ) {
54267             let t3 = i3.getUint32(e3), n3 = i3.getUint32(e3 + 4), s2 = i3.getString(e3 + 4, 4).toLowerCase(), r2 = t3 + 4 + 4 + 4, a2 = { type: s2, offset: e3, length: r2, start: e3 + 4 + 4, size: t3, marker: n3 };
54268             ht.includes(s2) ? this.metaChunks.push(a2) : this.unknownChunks.push(a2), e3 += r2;
54269           }
54270         }
54271         parseTextChunks() {
54272           let e3 = this.metaChunks.filter((e4) => "text" === e4.type);
54273           for (let t2 of e3) {
54274             let [e4, i3] = this.file.getString(t2.start, t2.size).split("\0");
54275             this.injectKeyValToIhdr(e4, i3);
54276           }
54277         }
54278         injectKeyValToIhdr(e3, t2) {
54279           let i3 = this.parsers.ihdr;
54280           i3 && i3.raw.set(e3, t2);
54281         }
54282         findIhdr() {
54283           let e3 = this.metaChunks.find((e4) => "ihdr" === e4.type);
54284           e3 && false !== this.options.ihdr.enabled && this.createParser("ihdr", e3.chunk);
54285         }
54286         async findExif() {
54287           let e3 = this.metaChunks.find((e4) => "exif" === e4.type);
54288           e3 && this.injectSegment("tiff", e3.chunk);
54289         }
54290         async findXmp() {
54291           let e3 = this.metaChunks.filter((e4) => "itxt" === e4.type);
54292           for (let t2 of e3) {
54293             "XML:com.adobe.xmp" === t2.chunk.getString(0, "XML:com.adobe.xmp".length) && this.injectSegment("xmp", t2.chunk);
54294           }
54295         }
54296         async findIcc() {
54297           let e3 = this.metaChunks.find((e4) => "iccp" === e4.type);
54298           if (!e3) return;
54299           let { chunk: t2 } = e3, i3 = t2.getUint8Array(0, 81), s2 = 0;
54300           for (; s2 < 80 && 0 !== i3[s2]; ) s2++;
54301           let r2 = s2 + 2, a2 = t2.getString(0, s2);
54302           if (this.injectKeyValToIhdr("ProfileName", a2), n2) {
54303             let e4 = await lt, i4 = t2.getUint8Array(r2);
54304             i4 = e4.inflateSync(i4), this.injectSegment("icc", i4);
54305           }
54306         }
54307       };
54308       c(ut, "type", "png"), w.set("png", ut), U(E, "interop", [[1, "InteropIndex"], [2, "InteropVersion"], [4096, "RelatedImageFileFormat"], [4097, "RelatedImageWidth"], [4098, "RelatedImageHeight"]]), F(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"]]);
54309       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"]];
54310       F(E, "ifd0", ct), F(E, "exif", ct), U(B, "gps", [[23, { M: "Magnetic North", T: "True North" }], [25, { K: "Kilometers", M: "Miles", N: "Nautical Miles" }]]);
54311       ft = class extends re2 {
54312         static canHandle(e3, t2) {
54313           return 224 === e3.getUint8(t2 + 1) && 1246120262 === e3.getUint32(t2 + 4) && 0 === e3.getUint8(t2 + 8);
54314         }
54315         parse() {
54316           return this.parseTags(), this.translate(), this.output;
54317         }
54318         parseTags() {
54319           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)]]);
54320         }
54321       };
54322       c(ft, "type", "jfif"), c(ft, "headerLength", 9), T.set("jfif", ft), U(E, "jfif", [[0, "JFIFVersion"], [2, "ResolutionUnit"], [3, "XResolution"], [5, "YResolution"], [7, "ThumbnailWidth"], [8, "ThumbnailHeight"]]);
54323       dt = class extends re2 {
54324         parse() {
54325           return this.parseTags(), this.translate(), this.output;
54326         }
54327         parseTags() {
54328           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)]);
54329         }
54330       };
54331       c(dt, "type", "ihdr"), T.set("ihdr", dt), U(E, "ihdr", [[0, "ImageWidth"], [4, "ImageHeight"], [8, "BitDepth"], [9, "ColorType"], [10, "Compression"], [11, "Filter"], [12, "Interlace"]]), U(B, "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" }]]);
54332       pt = class extends re2 {
54333         static canHandle(e3, t2) {
54334           return 226 === e3.getUint8(t2 + 1) && 1229144927 === e3.getUint32(t2 + 4);
54335         }
54336         static findPosition(e3, t2) {
54337           let i3 = super.findPosition(e3, t2);
54338           return i3.chunkNumber = e3.getUint8(t2 + 16), i3.chunkCount = e3.getUint8(t2 + 17), i3.multiSegment = i3.chunkCount > 1, i3;
54339         }
54340         static handleMultiSegments(e3) {
54341           return function(e4) {
54342             let t2 = function(e6) {
54343               let t3 = e6[0].constructor, i3 = 0;
54344               for (let t4 of e6) i3 += t4.length;
54345               let n3 = new t3(i3), s2 = 0;
54346               for (let t4 of e6) n3.set(t4, s2), s2 += t4.length;
54347               return n3;
54348             }(e4.map((e6) => e6.chunk.toUint8()));
54349             return new I(t2);
54350           }(e3);
54351         }
54352         parse() {
54353           return this.raw = /* @__PURE__ */ new Map(), this.parseHeader(), this.parseTags(), this.translate(), this.output;
54354         }
54355         parseHeader() {
54356           let { raw: e3 } = this;
54357           this.chunk.byteLength < 84 && g2("ICC header is too short");
54358           for (let [t2, i3] of Object.entries(gt)) {
54359             t2 = parseInt(t2, 10);
54360             let n3 = i3(this.chunk, t2);
54361             "\0\0\0\0" !== n3 && e3.set(t2, n3);
54362           }
54363         }
54364         parseTags() {
54365           let e3, t2, i3, n3, s2, { raw: r2 } = this, a2 = this.chunk.getUint32(128), o2 = 132, l2 = this.chunk.byteLength;
54366           for (; a2--; ) {
54367             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.");
54368             s2 = this.parseTag(n3, t2, i3), void 0 !== s2 && "\0\0\0\0" !== s2 && r2.set(e3, s2), o2 += 12;
54369           }
54370         }
54371         parseTag(e3, t2, i3) {
54372           switch (e3) {
54373             case "desc":
54374               return this.parseDesc(t2);
54375             case "mluc":
54376               return this.parseMluc(t2);
54377             case "text":
54378               return this.parseText(t2, i3);
54379             case "sig ":
54380               return this.parseSig(t2);
54381           }
54382           if (!(t2 + i3 > this.chunk.byteLength)) return this.chunk.getUint8Array(t2, i3);
54383         }
54384         parseDesc(e3) {
54385           let t2 = this.chunk.getUint32(e3 + 8) - 1;
54386           return m(this.chunk.getString(e3 + 12, t2));
54387         }
54388         parseText(e3, t2) {
54389           return m(this.chunk.getString(e3 + 8, t2 - 8));
54390         }
54391         parseSig(e3) {
54392           return m(this.chunk.getString(e3 + 8, 4));
54393         }
54394         parseMluc(e3) {
54395           let { chunk: t2 } = this, i3 = t2.getUint32(e3 + 8), n3 = t2.getUint32(e3 + 12), s2 = e3 + 16, r2 = [];
54396           for (let a2 = 0; a2 < i3; a2++) {
54397             let i4 = t2.getString(s2 + 0, 2), a3 = t2.getString(s2 + 2, 2), o2 = t2.getUint32(s2 + 4), l2 = t2.getUint32(s2 + 8) + e3, h2 = m(t2.getUnicodeString(l2, o2));
54398             r2.push({ lang: i4, country: a3, text: h2 }), s2 += n3;
54399           }
54400           return 1 === i3 ? r2[0].text : r2;
54401         }
54402         translateValue(e3, t2) {
54403           return "string" == typeof e3 ? t2[e3] || t2[e3.toLowerCase()] || e3 : t2[e3] || e3;
54404         }
54405       };
54406       c(pt, "type", "icc"), c(pt, "multiSegment", true), c(pt, "headerLength", 18);
54407       gt = { 4: mt, 8: function(e3, t2) {
54408         return [e3.getUint8(t2), e3.getUint8(t2 + 1) >> 4, e3.getUint8(t2 + 1) % 16].map((e4) => e4.toString(10)).join(".");
54409       }, 12: mt, 16: mt, 20: mt, 24: function(e3, t2) {
54410         const i3 = e3.getUint16(t2), n3 = e3.getUint16(t2 + 2) - 1, s2 = e3.getUint16(t2 + 4), r2 = e3.getUint16(t2 + 6), a2 = e3.getUint16(t2 + 8), o2 = e3.getUint16(t2 + 10);
54411         return new Date(Date.UTC(i3, n3, s2, r2, a2, o2));
54412       }, 36: mt, 40: mt, 48: mt, 52: mt, 64: (e3, t2) => e3.getUint32(t2), 80: mt };
54413       T.set("icc", pt), U(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"]]);
54414       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" };
54415       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!)" };
54416       U(B, "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" }]]);
54417       yt = class extends re2 {
54418         static canHandle(e3, t2, i3) {
54419           return 237 === e3.getUint8(t2 + 1) && "Photoshop" === e3.getString(t2 + 4, 9) && void 0 !== this.containsIptc8bim(e3, t2, i3);
54420         }
54421         static headerLength(e3, t2, i3) {
54422           let n3, s2 = this.containsIptc8bim(e3, t2, i3);
54423           if (void 0 !== s2) return n3 = e3.getUint8(t2 + s2 + 7), n3 % 2 != 0 && (n3 += 1), 0 === n3 && (n3 = 4), s2 + 8 + n3;
54424         }
54425         static containsIptc8bim(e3, t2, i3) {
54426           for (let n3 = 0; n3 < i3; n3++) if (this.isIptcSegmentHead(e3, t2 + n3)) return n3;
54427         }
54428         static isIptcSegmentHead(e3, t2) {
54429           return 56 === e3.getUint8(t2) && 943868237 === e3.getUint32(t2) && 1028 === e3.getUint16(t2 + 4);
54430         }
54431         parse() {
54432           let { raw: e3 } = this, t2 = this.chunk.byteLength - 1, i3 = false;
54433           for (let n3 = 0; n3 < t2; n3++) if (28 === this.chunk.getUint8(n3) && 2 === this.chunk.getUint8(n3 + 1)) {
54434             i3 = true;
54435             let t3 = this.chunk.getUint16(n3 + 3), s2 = this.chunk.getUint8(n3 + 2), r2 = this.chunk.getLatin1String(n3 + 5, t3);
54436             e3.set(s2, this.pluralizeValue(e3.get(s2), r2)), n3 += 4 + t3;
54437           } else if (i3) break;
54438           return this.translate(), this.output;
54439         }
54440         pluralizeValue(e3, t2) {
54441           return void 0 !== e3 ? e3 instanceof Array ? (e3.push(t2), e3) : [e3, t2] : t2;
54442         }
54443       };
54444       c(yt, "type", "iptc"), c(yt, "translateValues", false), c(yt, "reviveValues", false), T.set("iptc", yt), U(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"]]), U(B, "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" }]]);
54445       full_esm_default = tt;
54446     }
54447   });
54448
54449   // modules/services/plane_photo.js
54450   var plane_photo_exports = {};
54451   __export(plane_photo_exports, {
54452     default: () => plane_photo_default
54453   });
54454   function zoomPan(d3_event) {
54455     let t2 = d3_event.transform;
54456     _imageWrapper.call(utilSetTransform, t2.x, t2.y, t2.k);
54457   }
54458   function loadImage(selection2, path) {
54459     return new Promise((resolve) => {
54460       selection2.attr("src", path);
54461       selection2.on("load", () => {
54462         resolve(selection2);
54463       });
54464     });
54465   }
54466   var dispatch5, _photo, _imageWrapper, _planeWrapper, _imgZoom, plane_photo_default;
54467   var init_plane_photo = __esm({
54468     "modules/services/plane_photo.js"() {
54469       "use strict";
54470       init_src4();
54471       init_src12();
54472       init_util();
54473       dispatch5 = dispatch_default("viewerChanged");
54474       _imgZoom = zoom_default2().extent([[0, 0], [320, 240]]).translateExtent([[0, 0], [320, 240]]).scaleExtent([1, 15]);
54475       plane_photo_default = {
54476         init: async function(context, selection2) {
54477           this.event = utilRebind(this, dispatch5, "on");
54478           _planeWrapper = selection2;
54479           _planeWrapper.call(_imgZoom.on("zoom", zoomPan));
54480           _imageWrapper = _planeWrapper.append("div").attr("class", "photo-frame plane-frame").classed("hide", true);
54481           _photo = _imageWrapper.append("img").attr("class", "plane-photo");
54482           context.ui().photoviewer.on("resize.plane", function(dimensions) {
54483             _imgZoom.extent([[0, 0], dimensions]).translateExtent([[0, 0], dimensions]);
54484           });
54485           await Promise.resolve();
54486           return this;
54487         },
54488         /**
54489          * Shows the photo frame if hidden
54490          * @param {*} context the HTML wrap of the frame
54491          */
54492         showPhotoFrame: function(context) {
54493           const isHidden = context.selectAll(".photo-frame.plane-frame.hide").size();
54494           if (isHidden) {
54495             context.selectAll(".photo-frame:not(.plane-frame)").classed("hide", true);
54496             context.selectAll(".photo-frame.plane-frame").classed("hide", false);
54497           }
54498           return this;
54499         },
54500         /**
54501          * Hides the photo frame if shown
54502          * @param {*} context the HTML wrap of the frame
54503          */
54504         hidePhotoFrame: function(context) {
54505           context.select("photo-frame.plane-frame").classed("hide", false);
54506           return this;
54507         },
54508         /**
54509          * Renders an image inside the frame
54510          * @param {*} data the image data, it should contain an image_path attribute, a link to the actual image.
54511          */
54512         selectPhoto: function(data) {
54513           dispatch5.call("viewerChanged");
54514           loadImage(_photo, "");
54515           loadImage(_photo, data.image_path).then(() => {
54516             _planeWrapper.call(_imgZoom.transform, identity2);
54517           });
54518           return this;
54519         },
54520         getYaw: function() {
54521           return 0;
54522         }
54523       };
54524     }
54525   });
54526
54527   // modules/svg/local_photos.js
54528   var local_photos_exports = {};
54529   __export(local_photos_exports, {
54530     svgLocalPhotos: () => svgLocalPhotos
54531   });
54532   function svgLocalPhotos(projection2, context, dispatch14) {
54533     const detected = utilDetect();
54534     let layer = select_default2(null);
54535     let _fileList;
54536     let _photos = [];
54537     let _idAutoinc = 0;
54538     let _photoFrame;
54539     let _activePhotoIdx;
54540     function init2() {
54541       if (_initialized2) return;
54542       _enabled2 = true;
54543       function over(d3_event) {
54544         d3_event.stopPropagation();
54545         d3_event.preventDefault();
54546         d3_event.dataTransfer.dropEffect = "copy";
54547       }
54548       context.container().attr("dropzone", "copy").on("drop.svgLocalPhotos", function(d3_event) {
54549         d3_event.stopPropagation();
54550         d3_event.preventDefault();
54551         if (!detected.filedrop) return;
54552         drawPhotos.fileList(d3_event.dataTransfer.files, (loaded) => {
54553           if (loaded.length > 0) {
54554             drawPhotos.fitZoom(false);
54555           }
54556         });
54557       }).on("dragenter.svgLocalPhotos", over).on("dragexit.svgLocalPhotos", over).on("dragover.svgLocalPhotos", over);
54558       _initialized2 = true;
54559     }
54560     function ensureViewerLoaded(context2) {
54561       if (_photoFrame) {
54562         return Promise.resolve(_photoFrame);
54563       }
54564       const viewer = context2.container().select(".photoviewer").selectAll(".local-photos-wrapper").data([0]);
54565       const viewerEnter = viewer.enter().append("div").attr("class", "photo-wrapper local-photos-wrapper").classed("hide", true);
54566       viewerEnter.append("div").attr("class", "photo-attribution photo-attribution-dual fillD");
54567       const controlsEnter = viewerEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls-local");
54568       controlsEnter.append("button").classed("back", true).on("click.back", () => stepPhotos(-1)).text("\u25C0");
54569       controlsEnter.append("button").classed("forward", true).on("click.forward", () => stepPhotos(1)).text("\u25B6");
54570       return plane_photo_default.init(context2, viewerEnter).then((planePhotoFrame) => {
54571         _photoFrame = planePhotoFrame;
54572       });
54573     }
54574     function stepPhotos(stepBy) {
54575       if (!_photos || _photos.length === 0) return;
54576       if (_activePhotoIdx === void 0) _activePhotoIdx = 0;
54577       const newIndex = _activePhotoIdx + stepBy;
54578       _activePhotoIdx = Math.max(0, Math.min(_photos.length - 1, newIndex));
54579       click(null, _photos[_activePhotoIdx], false);
54580     }
54581     function click(d3_event, image, zoomTo) {
54582       _activePhotoIdx = _photos.indexOf(image);
54583       ensureViewerLoaded(context).then(() => {
54584         const viewer = context.container().select(".photoviewer").datum(image).classed("hide", false);
54585         const viewerWrap = viewer.select(".local-photos-wrapper").classed("hide", false);
54586         const controlsWrap = viewer.select(".photo-controls-wrap");
54587         controlsWrap.select(".back").attr("disabled", _activePhotoIdx <= 0 ? true : null);
54588         controlsWrap.select(".forward").attr("disabled", _activePhotoIdx >= _photos.length - 1 ? true : null);
54589         const attribution = viewerWrap.selectAll(".photo-attribution").text("");
54590         if (image.date) {
54591           attribution.append("span").text(image.date.toLocaleString(_mainLocalizer.localeCode()));
54592         }
54593         if (image.name) {
54594           attribution.append("span").classed("filename", true).text(image.name);
54595         }
54596         _photoFrame.selectPhoto({ image_path: "" });
54597         image.getSrc().then((src) => {
54598           _photoFrame.selectPhoto({ image_path: src }).showPhotoFrame(viewerWrap);
54599           setStyles();
54600         });
54601       });
54602       if (zoomTo) {
54603         context.map().centerEase(image.loc);
54604       }
54605     }
54606     function transform2(d2) {
54607       var svgpoint = projection2(d2.loc);
54608       return "translate(" + svgpoint[0] + "," + svgpoint[1] + ")";
54609     }
54610     function setStyles(hovered) {
54611       const viewer = context.container().select(".photoviewer");
54612       const selected = viewer.empty() ? void 0 : viewer.datum();
54613       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));
54614     }
54615     function display_markers(imageList) {
54616       imageList = imageList.filter((image) => isArray_default(image.loc) && isNumber_default(image.loc[0]) && isNumber_default(image.loc[1]));
54617       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(imageList, function(d2) {
54618         return d2.id;
54619       });
54620       groups.exit().remove();
54621       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", (d3_event, d2) => setStyles(d2)).on("mouseleave", () => setStyles(null)).on("click", click);
54622       groupsEnter.append("g").attr("class", "viewfield-scale");
54623       const markers = groups.merge(groupsEnter).attr("transform", transform2).select(".viewfield-scale");
54624       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
54625       const showViewfields = context.map().zoom() >= minViewfieldZoom;
54626       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
54627       viewfields.exit().remove();
54628       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", function() {
54629         var _a3;
54630         const d2 = this.parentNode.__data__;
54631         return `rotate(${Math.round((_a3 = d2.direction) != null ? _a3 : 0)},0,0),scale(1.5,1.5),translate(-8,-13)`;
54632       }).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() {
54633         const d2 = this.parentNode.__data__;
54634         return isNumber_default(d2.direction) ? "visible" : "hidden";
54635       });
54636     }
54637     function drawPhotos(selection2) {
54638       layer = selection2.selectAll(".layer-local-photos").data(_photos ? [0] : []);
54639       layer.exit().remove();
54640       const layerEnter = layer.enter().append("g").attr("class", "layer-local-photos");
54641       layerEnter.append("g").attr("class", "markers");
54642       layer = layerEnter.merge(layer);
54643       if (_photos) {
54644         display_markers(_photos);
54645       }
54646     }
54647     function readFileAsDataURL(file) {
54648       return new Promise((resolve, reject) => {
54649         const reader = new FileReader();
54650         reader.onload = () => resolve(reader.result);
54651         reader.onerror = (error) => reject(error);
54652         reader.readAsDataURL(file);
54653       });
54654     }
54655     async function readmultifiles(files, callback) {
54656       const loaded = [];
54657       for (const file of files) {
54658         try {
54659           const exifData = await full_esm_default.parse(file);
54660           const photo = {
54661             id: _idAutoinc++,
54662             name: file.name,
54663             getSrc: () => readFileAsDataURL(file),
54664             file,
54665             loc: [exifData.longitude, exifData.latitude],
54666             direction: exifData.GPSImgDirection,
54667             date: exifData.CreateDate || exifData.DateTimeOriginal || exifData.ModifyDate
54668           };
54669           loaded.push(photo);
54670           const sameName = _photos.filter((i3) => i3.name === photo.name);
54671           if (sameName.length === 0) {
54672             _photos.push(photo);
54673           } else {
54674             const thisContent = await photo.getSrc();
54675             const sameNameContent = await Promise.allSettled(sameName.map((i3) => i3.getSrc()));
54676             if (!sameNameContent.some((i3) => i3.value === thisContent)) {
54677               _photos.push(photo);
54678             }
54679           }
54680         } catch {
54681         }
54682       }
54683       if (typeof callback === "function") callback(loaded);
54684       dispatch14.call("change");
54685     }
54686     drawPhotos.setFiles = function(fileList, callback) {
54687       readmultifiles(Array.from(fileList), callback);
54688       return this;
54689     };
54690     drawPhotos.fileList = function(fileList, callback) {
54691       if (!arguments.length) return _fileList;
54692       _fileList = fileList;
54693       if (!fileList || !fileList.length) return this;
54694       drawPhotos.setFiles(_fileList, callback);
54695       return this;
54696     };
54697     drawPhotos.getPhotos = function() {
54698       return _photos;
54699     };
54700     drawPhotos.removePhoto = function(id2) {
54701       _photos = _photos.filter((i3) => i3.id !== id2);
54702       dispatch14.call("change");
54703       return _photos;
54704     };
54705     drawPhotos.openPhoto = click;
54706     drawPhotos.fitZoom = function(force) {
54707       const coords = _photos.map((image) => image.loc).filter((l2) => isArray_default(l2) && isNumber_default(l2[0]) && isNumber_default(l2[1]));
54708       if (coords.length === 0) return;
54709       const extent = coords.map((l2) => geoExtent(l2, l2)).reduce((a2, b2) => a2.extend(b2));
54710       const map2 = context.map();
54711       var viewport = map2.trimmedExtent().polygon();
54712       if (force !== false || !geoPolygonIntersectsPolygon(viewport, coords, true)) {
54713         map2.centerZoom(extent.center(), Math.min(18, map2.trimmedExtentZoom(extent)));
54714       }
54715     };
54716     function showLayer() {
54717       layer.style("display", "block");
54718       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
54719         dispatch14.call("change");
54720       });
54721     }
54722     function hideLayer() {
54723       layer.transition().duration(250).style("opacity", 0).on("end", () => {
54724         layer.selectAll(".viewfield-group").remove();
54725         layer.style("display", "none");
54726       });
54727     }
54728     drawPhotos.enabled = function(val) {
54729       if (!arguments.length) return _enabled2;
54730       _enabled2 = val;
54731       if (_enabled2) {
54732         showLayer();
54733       } else {
54734         hideLayer();
54735       }
54736       dispatch14.call("change");
54737       return this;
54738     };
54739     drawPhotos.hasData = function() {
54740       return isArray_default(_photos) && _photos.length > 0;
54741     };
54742     init2();
54743     return drawPhotos;
54744   }
54745   var _initialized2, _enabled2, minViewfieldZoom;
54746   var init_local_photos = __esm({
54747     "modules/svg/local_photos.js"() {
54748       "use strict";
54749       init_src5();
54750       init_full_esm();
54751       init_lodash();
54752       init_localizer();
54753       init_detect();
54754       init_geo2();
54755       init_plane_photo();
54756       _initialized2 = false;
54757       _enabled2 = false;
54758       minViewfieldZoom = 16;
54759     }
54760   });
54761
54762   // modules/svg/osmose.js
54763   var osmose_exports2 = {};
54764   __export(osmose_exports2, {
54765     svgOsmose: () => svgOsmose
54766   });
54767   function svgOsmose(projection2, context, dispatch14) {
54768     const throttledRedraw = throttle_default(() => dispatch14.call("change"), 1e3);
54769     const minZoom5 = 12;
54770     let touchLayer = select_default2(null);
54771     let drawLayer = select_default2(null);
54772     let layerVisible = false;
54773     function markerPath(selection2, klass) {
54774       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");
54775     }
54776     function getService() {
54777       if (services.osmose && !_qaService2) {
54778         _qaService2 = services.osmose;
54779         _qaService2.on("loaded", throttledRedraw);
54780       } else if (!services.osmose && _qaService2) {
54781         _qaService2 = null;
54782       }
54783       return _qaService2;
54784     }
54785     function editOn() {
54786       if (!layerVisible) {
54787         layerVisible = true;
54788         drawLayer.style("display", "block");
54789       }
54790     }
54791     function editOff() {
54792       if (layerVisible) {
54793         layerVisible = false;
54794         drawLayer.style("display", "none");
54795         drawLayer.selectAll(".qaItem.osmose").remove();
54796         touchLayer.selectAll(".qaItem.osmose").remove();
54797       }
54798     }
54799     function layerOn() {
54800       editOn();
54801       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch14.call("change"));
54802     }
54803     function layerOff() {
54804       throttledRedraw.cancel();
54805       drawLayer.interrupt();
54806       touchLayer.selectAll(".qaItem.osmose").remove();
54807       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
54808         editOff();
54809         dispatch14.call("change");
54810       });
54811     }
54812     function updateMarkers() {
54813       if (!layerVisible || !_layerEnabled2) return;
54814       const service = getService();
54815       const selectedID = context.selectedErrorID();
54816       const data = service ? service.getItems(projection2) : [];
54817       const getTransform = svgPointTransform(projection2);
54818       const markers = drawLayer.selectAll(".qaItem.osmose").data(data, (d2) => d2.id);
54819       markers.exit().remove();
54820       const markersEnter = markers.enter().append("g").attr("class", (d2) => `qaItem ${d2.service} itemId-${d2.id} itemType-${d2.itemType}`);
54821       markersEnter.append("polygon").call(markerPath, "shadow");
54822       markersEnter.append("ellipse").attr("cx", 0).attr("cy", 0).attr("rx", 4.5).attr("ry", 2).attr("class", "stroke");
54823       markersEnter.append("polygon").attr("fill", (d2) => service.getColor(d2.item)).call(markerPath, "qaItem-fill");
54824       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 : "");
54825       markers.merge(markersEnter).sort(sortY).classed("selected", (d2) => d2.id === selectedID).attr("transform", getTransform);
54826       if (touchLayer.empty()) return;
54827       const fillClass = context.getDebug("target") ? "pink" : "nocolor";
54828       const targets = touchLayer.selectAll(".qaItem.osmose").data(data, (d2) => d2.id);
54829       targets.exit().remove();
54830       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);
54831       function sortY(a2, b2) {
54832         return a2.id === selectedID ? 1 : b2.id === selectedID ? -1 : b2.loc[1] - a2.loc[1];
54833       }
54834     }
54835     function drawOsmose(selection2) {
54836       const service = getService();
54837       const surface = context.surface();
54838       if (surface && !surface.empty()) {
54839         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
54840       }
54841       drawLayer = selection2.selectAll(".layer-osmose").data(service ? [0] : []);
54842       drawLayer.exit().remove();
54843       drawLayer = drawLayer.enter().append("g").attr("class", "layer-osmose").style("display", _layerEnabled2 ? "block" : "none").merge(drawLayer);
54844       if (_layerEnabled2) {
54845         if (service && ~~context.map().zoom() >= minZoom5) {
54846           editOn();
54847           service.loadIssues(projection2);
54848           updateMarkers();
54849         } else {
54850           editOff();
54851         }
54852       }
54853     }
54854     drawOsmose.enabled = function(val) {
54855       if (!arguments.length) return _layerEnabled2;
54856       _layerEnabled2 = val;
54857       if (_layerEnabled2) {
54858         getService().loadStrings().then(layerOn).catch((err) => {
54859           console.log(err);
54860         });
54861       } else {
54862         layerOff();
54863         if (context.selectedErrorID()) {
54864           context.enter(modeBrowse(context));
54865         }
54866       }
54867       dispatch14.call("change");
54868       return this;
54869     };
54870     drawOsmose.supported = () => !!getService();
54871     return drawOsmose;
54872   }
54873   var _layerEnabled2, _qaService2;
54874   var init_osmose2 = __esm({
54875     "modules/svg/osmose.js"() {
54876       "use strict";
54877       init_throttle();
54878       init_src5();
54879       init_browse();
54880       init_helpers();
54881       init_services();
54882       _layerEnabled2 = false;
54883     }
54884   });
54885
54886   // modules/svg/streetside.js
54887   var streetside_exports = {};
54888   __export(streetside_exports, {
54889     svgStreetside: () => svgStreetside
54890   });
54891   function svgStreetside(projection2, context, dispatch14) {
54892     var throttledRedraw = throttle_default(function() {
54893       dispatch14.call("change");
54894     }, 1e3);
54895     var minZoom5 = 14;
54896     var minMarkerZoom = 16;
54897     var minViewfieldZoom2 = 18;
54898     var layer = select_default2(null);
54899     var _viewerYaw = 0;
54900     var _selectedSequence = null;
54901     var _streetside;
54902     function init2() {
54903       if (svgStreetside.initialized) return;
54904       svgStreetside.enabled = false;
54905       svgStreetside.initialized = true;
54906     }
54907     function getService() {
54908       if (services.streetside && !_streetside) {
54909         _streetside = services.streetside;
54910         _streetside.event.on("viewerChanged.svgStreetside", viewerChanged).on("loadedImages.svgStreetside", throttledRedraw);
54911       } else if (!services.streetside && _streetside) {
54912         _streetside = null;
54913       }
54914       return _streetside;
54915     }
54916     function showLayer() {
54917       var service = getService();
54918       if (!service) return;
54919       editOn();
54920       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
54921         dispatch14.call("change");
54922       });
54923     }
54924     function hideLayer() {
54925       throttledRedraw.cancel();
54926       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
54927     }
54928     function editOn() {
54929       layer.style("display", "block");
54930     }
54931     function editOff() {
54932       layer.selectAll(".viewfield-group").remove();
54933       layer.style("display", "none");
54934     }
54935     function click(d3_event, d2) {
54936       var service = getService();
54937       if (!service) return;
54938       if (d2.sequenceKey !== _selectedSequence) {
54939         _viewerYaw = 0;
54940       }
54941       _selectedSequence = d2.sequenceKey;
54942       service.ensureViewerLoaded(context).then(function() {
54943         service.selectImage(context, d2.key).yaw(_viewerYaw).showViewer(context);
54944       });
54945       context.map().centerEase(d2.loc);
54946     }
54947     function mouseover(d3_event, d2) {
54948       var service = getService();
54949       if (service) service.setStyles(context, d2);
54950     }
54951     function mouseout() {
54952       var service = getService();
54953       if (service) service.setStyles(context, null);
54954     }
54955     function transform2(d2) {
54956       var t2 = svgPointTransform(projection2)(d2);
54957       var rot = d2.ca + _viewerYaw;
54958       if (rot) {
54959         t2 += " rotate(" + Math.floor(rot) + ",0,0)";
54960       }
54961       return t2;
54962     }
54963     function viewerChanged() {
54964       var service = getService();
54965       if (!service) return;
54966       var viewer = service.viewer();
54967       if (!viewer) return;
54968       _viewerYaw = viewer.getYaw();
54969       if (context.map().isTransformed()) return;
54970       layer.selectAll(".viewfield-group.currentView").attr("transform", transform2);
54971     }
54972     function filterBubbles(bubbles) {
54973       var fromDate = context.photos().fromDate();
54974       var toDate = context.photos().toDate();
54975       var usernames = context.photos().usernames();
54976       if (fromDate) {
54977         var fromTimestamp = new Date(fromDate).getTime();
54978         bubbles = bubbles.filter(function(bubble) {
54979           return new Date(bubble.captured_at).getTime() >= fromTimestamp;
54980         });
54981       }
54982       if (toDate) {
54983         var toTimestamp = new Date(toDate).getTime();
54984         bubbles = bubbles.filter(function(bubble) {
54985           return new Date(bubble.captured_at).getTime() <= toTimestamp;
54986         });
54987       }
54988       if (usernames) {
54989         bubbles = bubbles.filter(function(bubble) {
54990           return usernames.indexOf(bubble.captured_by) !== -1;
54991         });
54992       }
54993       return bubbles;
54994     }
54995     function filterSequences(sequences) {
54996       var fromDate = context.photos().fromDate();
54997       var toDate = context.photos().toDate();
54998       var usernames = context.photos().usernames();
54999       if (fromDate) {
55000         var fromTimestamp = new Date(fromDate).getTime();
55001         sequences = sequences.filter(function(sequences2) {
55002           return new Date(sequences2.properties.captured_at).getTime() >= fromTimestamp;
55003         });
55004       }
55005       if (toDate) {
55006         var toTimestamp = new Date(toDate).getTime();
55007         sequences = sequences.filter(function(sequences2) {
55008           return new Date(sequences2.properties.captured_at).getTime() <= toTimestamp;
55009         });
55010       }
55011       if (usernames) {
55012         sequences = sequences.filter(function(sequences2) {
55013           return usernames.indexOf(sequences2.properties.captured_by) !== -1;
55014         });
55015       }
55016       return sequences;
55017     }
55018     function update() {
55019       var viewer = context.container().select(".photoviewer");
55020       var selected = viewer.empty() ? void 0 : viewer.datum();
55021       var z2 = ~~context.map().zoom();
55022       var showMarkers = z2 >= minMarkerZoom;
55023       var showViewfields = z2 >= minViewfieldZoom2;
55024       var service = getService();
55025       var sequences = [];
55026       var bubbles = [];
55027       if (context.photos().showsPanoramic()) {
55028         sequences = service ? service.sequences(projection2) : [];
55029         bubbles = service && showMarkers ? service.bubbles(projection2) : [];
55030         sequences = filterSequences(sequences);
55031         bubbles = filterBubbles(bubbles);
55032       }
55033       var traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
55034         return d2.properties.key;
55035       });
55036       dispatch14.call("photoDatesChanged", this, "streetside", [...bubbles.map((p2) => p2.captured_at), ...sequences.map((t2) => t2.properties.vintageStart)]);
55037       traces.exit().remove();
55038       traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
55039       var groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(bubbles, function(d2) {
55040         return d2.key + (d2.sequenceKey ? "v1" : "v0");
55041       });
55042       groups.exit().remove();
55043       var groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
55044       groupsEnter.append("g").attr("class", "viewfield-scale");
55045       var markers = groups.merge(groupsEnter).sort(function(a2, b2) {
55046         return a2 === selected ? 1 : b2 === selected ? -1 : b2.loc[1] - a2.loc[1];
55047       }).attr("transform", transform2).select(".viewfield-scale");
55048       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
55049       var viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
55050       viewfields.exit().remove();
55051       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
55052       function viewfieldPath() {
55053         var d2 = this.parentNode.__data__;
55054         if (d2.pano) {
55055           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
55056         } else {
55057           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
55058         }
55059       }
55060     }
55061     function drawImages(selection2) {
55062       var enabled = svgStreetside.enabled;
55063       var service = getService();
55064       layer = selection2.selectAll(".layer-streetside-images").data(service ? [0] : []);
55065       layer.exit().remove();
55066       var layerEnter = layer.enter().append("g").attr("class", "layer-streetside-images").style("display", enabled ? "block" : "none");
55067       layerEnter.append("g").attr("class", "sequences");
55068       layerEnter.append("g").attr("class", "markers");
55069       layer = layerEnter.merge(layer);
55070       if (enabled) {
55071         if (service && ~~context.map().zoom() >= minZoom5) {
55072           editOn();
55073           update();
55074           service.loadBubbles(projection2);
55075         } else {
55076           dispatch14.call("photoDatesChanged", this, "streetside", []);
55077           editOff();
55078         }
55079       } else {
55080         dispatch14.call("photoDatesChanged", this, "streetside", []);
55081       }
55082     }
55083     drawImages.enabled = function(_2) {
55084       if (!arguments.length) return svgStreetside.enabled;
55085       svgStreetside.enabled = _2;
55086       if (svgStreetside.enabled) {
55087         showLayer();
55088         context.photos().on("change.streetside", update);
55089       } else {
55090         hideLayer();
55091         context.photos().on("change.streetside", null);
55092       }
55093       dispatch14.call("change");
55094       return this;
55095     };
55096     drawImages.supported = function() {
55097       return !!getService();
55098     };
55099     drawImages.rendered = function(zoom) {
55100       return zoom >= minZoom5;
55101     };
55102     init2();
55103     return drawImages;
55104   }
55105   var init_streetside = __esm({
55106     "modules/svg/streetside.js"() {
55107       "use strict";
55108       init_throttle();
55109       init_src5();
55110       init_helpers();
55111       init_services();
55112     }
55113   });
55114
55115   // modules/svg/vegbilder.js
55116   var vegbilder_exports = {};
55117   __export(vegbilder_exports, {
55118     svgVegbilder: () => svgVegbilder
55119   });
55120   function svgVegbilder(projection2, context, dispatch14) {
55121     const throttledRedraw = throttle_default(() => dispatch14.call("change"), 1e3);
55122     const minZoom5 = 14;
55123     const minMarkerZoom = 16;
55124     const minViewfieldZoom2 = 18;
55125     let layer = select_default2(null);
55126     let _viewerYaw = 0;
55127     let _vegbilder;
55128     function init2() {
55129       if (svgVegbilder.initialized) return;
55130       svgVegbilder.enabled = false;
55131       svgVegbilder.initialized = true;
55132     }
55133     function getService() {
55134       if (services.vegbilder && !_vegbilder) {
55135         _vegbilder = services.vegbilder;
55136         _vegbilder.event.on("viewerChanged.svgVegbilder", viewerChanged).on("loadedImages.svgVegbilder", throttledRedraw);
55137       } else if (!services.vegbilder && _vegbilder) {
55138         _vegbilder = null;
55139       }
55140       return _vegbilder;
55141     }
55142     function showLayer() {
55143       const service = getService();
55144       if (!service) return;
55145       editOn();
55146       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", () => dispatch14.call("change"));
55147     }
55148     function hideLayer() {
55149       throttledRedraw.cancel();
55150       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
55151     }
55152     function editOn() {
55153       layer.style("display", "block");
55154     }
55155     function editOff() {
55156       layer.selectAll(".viewfield-group").remove();
55157       layer.style("display", "none");
55158     }
55159     function click(d3_event, d2) {
55160       const service = getService();
55161       if (!service) return;
55162       service.ensureViewerLoaded(context).then(() => {
55163         service.selectImage(context, d2.key).showViewer(context);
55164       });
55165       context.map().centerEase(d2.loc);
55166     }
55167     function mouseover(d3_event, d2) {
55168       const service = getService();
55169       if (service) service.setStyles(context, d2);
55170     }
55171     function mouseout() {
55172       const service = getService();
55173       if (service) service.setStyles(context, null);
55174     }
55175     function transform2(d2, selected) {
55176       let t2 = svgPointTransform(projection2)(d2);
55177       let rot = d2.ca;
55178       if (d2 === selected) {
55179         rot += _viewerYaw;
55180       }
55181       if (rot) {
55182         t2 += " rotate(" + Math.floor(rot) + ",0,0)";
55183       }
55184       return t2;
55185     }
55186     function viewerChanged() {
55187       const service = getService();
55188       if (!service) return;
55189       const frame2 = service.photoFrame();
55190       _viewerYaw = frame2.getYaw();
55191       if (context.map().isTransformed()) return;
55192       layer.selectAll(".viewfield-group.currentView").attr("transform", (d2) => transform2(d2, d2));
55193     }
55194     function filterImages(images) {
55195       const photoContext = context.photos();
55196       const fromDateString = photoContext.fromDate();
55197       const toDateString = photoContext.toDate();
55198       const showsFlat = photoContext.showsFlat();
55199       const showsPano = photoContext.showsPanoramic();
55200       if (fromDateString) {
55201         const fromDate = new Date(fromDateString);
55202         images = images.filter((image) => image.captured_at.getTime() >= fromDate.getTime());
55203       }
55204       if (toDateString) {
55205         const toDate = new Date(toDateString);
55206         images = images.filter((image) => image.captured_at.getTime() <= toDate.getTime());
55207       }
55208       if (!showsPano) {
55209         images = images.filter((image) => !image.is_sphere);
55210       }
55211       if (!showsFlat) {
55212         images = images.filter((image) => image.is_sphere);
55213       }
55214       return images;
55215     }
55216     function filterSequences(sequences) {
55217       const photoContext = context.photos();
55218       const fromDateString = photoContext.fromDate();
55219       const toDateString = photoContext.toDate();
55220       const showsFlat = photoContext.showsFlat();
55221       const showsPano = photoContext.showsPanoramic();
55222       if (fromDateString) {
55223         const fromDate = new Date(fromDateString);
55224         sequences = sequences.filter(({ images }) => images[0].captured_at.getTime() >= fromDate.getTime());
55225       }
55226       if (toDateString) {
55227         const toDate = new Date(toDateString);
55228         sequences = sequences.filter(({ images }) => images[images.length - 1].captured_at.getTime() <= toDate.getTime());
55229       }
55230       if (!showsPano) {
55231         sequences = sequences.filter(({ images }) => !images[0].is_sphere);
55232       }
55233       if (!showsFlat) {
55234         sequences = sequences.filter(({ images }) => images[0].is_sphere);
55235       }
55236       return sequences;
55237     }
55238     function update() {
55239       const viewer = context.container().select(".photoviewer");
55240       const selected = viewer.empty() ? void 0 : viewer.datum();
55241       const z2 = ~~context.map().zoom();
55242       const showMarkers = z2 >= minMarkerZoom;
55243       const showViewfields = z2 >= minViewfieldZoom2;
55244       const service = getService();
55245       let sequences = [];
55246       let images = [];
55247       if (service) {
55248         service.loadImages(context);
55249         sequences = service.sequences(projection2);
55250         images = showMarkers ? service.images(projection2) : [];
55251         dispatch14.call("photoDatesChanged", this, "vegbilder", images.map((p2) => p2.captured_at));
55252         images = filterImages(images);
55253         sequences = filterSequences(sequences);
55254       }
55255       let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, (d2) => d2.key);
55256       traces.exit().remove();
55257       traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
55258       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, (d2) => d2.key);
55259       groups.exit().remove();
55260       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
55261       groupsEnter.append("g").attr("class", "viewfield-scale");
55262       const markers = groups.merge(groupsEnter).sort((a2, b2) => {
55263         return a2 === selected ? 1 : b2 === selected ? -1 : b2.loc[1] - a2.loc[1];
55264       }).attr("transform", (d2) => transform2(d2, selected)).select(".viewfield-scale");
55265       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
55266       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
55267       viewfields.exit().remove();
55268       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
55269       function viewfieldPath() {
55270         const d2 = this.parentNode.__data__;
55271         if (d2.is_sphere) {
55272           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
55273         } else {
55274           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
55275         }
55276       }
55277     }
55278     function drawImages(selection2) {
55279       const enabled = svgVegbilder.enabled;
55280       const service = getService();
55281       layer = selection2.selectAll(".layer-vegbilder").data(service ? [0] : []);
55282       layer.exit().remove();
55283       const layerEnter = layer.enter().append("g").attr("class", "layer-vegbilder").style("display", enabled ? "block" : "none");
55284       layerEnter.append("g").attr("class", "sequences");
55285       layerEnter.append("g").attr("class", "markers");
55286       layer = layerEnter.merge(layer);
55287       if (enabled) {
55288         if (service && ~~context.map().zoom() >= minZoom5) {
55289           editOn();
55290           update();
55291           service.loadImages(context);
55292         } else {
55293           editOff();
55294         }
55295       }
55296     }
55297     drawImages.enabled = function(_2) {
55298       if (!arguments.length) return svgVegbilder.enabled;
55299       svgVegbilder.enabled = _2;
55300       if (svgVegbilder.enabled) {
55301         showLayer();
55302         context.photos().on("change.vegbilder", update);
55303       } else {
55304         hideLayer();
55305         context.photos().on("change.vegbilder", null);
55306       }
55307       dispatch14.call("change");
55308       return this;
55309     };
55310     drawImages.supported = function() {
55311       return !!getService();
55312     };
55313     drawImages.rendered = function(zoom) {
55314       return zoom >= minZoom5;
55315     };
55316     drawImages.validHere = function(extent, zoom) {
55317       return zoom >= minZoom5 - 2 && getService().validHere(extent);
55318     };
55319     init2();
55320     return drawImages;
55321   }
55322   var init_vegbilder = __esm({
55323     "modules/svg/vegbilder.js"() {
55324       "use strict";
55325       init_throttle();
55326       init_src5();
55327       init_helpers();
55328       init_services();
55329     }
55330   });
55331
55332   // modules/svg/mapillary_images.js
55333   var mapillary_images_exports = {};
55334   __export(mapillary_images_exports, {
55335     svgMapillaryImages: () => svgMapillaryImages
55336   });
55337   function svgMapillaryImages(projection2, context, dispatch14) {
55338     const throttledRedraw = throttle_default(function() {
55339       dispatch14.call("change");
55340     }, 1e3);
55341     const minZoom5 = 12;
55342     const minMarkerZoom = 16;
55343     const minViewfieldZoom2 = 18;
55344     let layer = select_default2(null);
55345     let _mapillary;
55346     function init2() {
55347       if (svgMapillaryImages.initialized) return;
55348       svgMapillaryImages.enabled = false;
55349       svgMapillaryImages.initialized = true;
55350     }
55351     function getService() {
55352       if (services.mapillary && !_mapillary) {
55353         _mapillary = services.mapillary;
55354         _mapillary.event.on("loadedImages", throttledRedraw);
55355       } else if (!services.mapillary && _mapillary) {
55356         _mapillary = null;
55357       }
55358       return _mapillary;
55359     }
55360     function showLayer() {
55361       const service = getService();
55362       if (!service) return;
55363       editOn();
55364       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
55365         dispatch14.call("change");
55366       });
55367     }
55368     function hideLayer() {
55369       throttledRedraw.cancel();
55370       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
55371     }
55372     function editOn() {
55373       layer.style("display", "block");
55374     }
55375     function editOff() {
55376       layer.selectAll(".viewfield-group").remove();
55377       layer.style("display", "none");
55378     }
55379     function click(d3_event, image) {
55380       const service = getService();
55381       if (!service) return;
55382       service.ensureViewerLoaded(context).then(function() {
55383         service.selectImage(context, image.id).showViewer(context);
55384       });
55385       context.map().centerEase(image.loc);
55386     }
55387     function mouseover(d3_event, image) {
55388       const service = getService();
55389       if (service) service.setStyles(context, image);
55390     }
55391     function mouseout() {
55392       const service = getService();
55393       if (service) service.setStyles(context, null);
55394     }
55395     function transform2(d2) {
55396       let t2 = svgPointTransform(projection2)(d2);
55397       if (d2.ca) {
55398         t2 += " rotate(" + Math.floor(d2.ca) + ",0,0)";
55399       }
55400       return t2;
55401     }
55402     function filterImages(images) {
55403       const showsPano = context.photos().showsPanoramic();
55404       const showsFlat = context.photos().showsFlat();
55405       const fromDate = context.photos().fromDate();
55406       const toDate = context.photos().toDate();
55407       if (!showsPano || !showsFlat) {
55408         images = images.filter(function(image) {
55409           if (image.is_pano) return showsPano;
55410           return showsFlat;
55411         });
55412       }
55413       if (fromDate) {
55414         images = images.filter(function(image) {
55415           return new Date(image.captured_at).getTime() >= new Date(fromDate).getTime();
55416         });
55417       }
55418       if (toDate) {
55419         images = images.filter(function(image) {
55420           return new Date(image.captured_at).getTime() <= new Date(toDate).getTime();
55421         });
55422       }
55423       return images;
55424     }
55425     function filterSequences(sequences) {
55426       const showsPano = context.photos().showsPanoramic();
55427       const showsFlat = context.photos().showsFlat();
55428       const fromDate = context.photos().fromDate();
55429       const toDate = context.photos().toDate();
55430       if (!showsPano || !showsFlat) {
55431         sequences = sequences.filter(function(sequence) {
55432           if (sequence.properties.hasOwnProperty("is_pano")) {
55433             if (sequence.properties.is_pano) return showsPano;
55434             return showsFlat;
55435           }
55436           return false;
55437         });
55438       }
55439       if (fromDate) {
55440         sequences = sequences.filter(function(sequence) {
55441           return new Date(sequence.properties.captured_at).getTime() >= new Date(fromDate).getTime().toString();
55442         });
55443       }
55444       if (toDate) {
55445         sequences = sequences.filter(function(sequence) {
55446           return new Date(sequence.properties.captured_at).getTime() <= new Date(toDate).getTime().toString();
55447         });
55448       }
55449       return sequences;
55450     }
55451     function update() {
55452       const z2 = ~~context.map().zoom();
55453       const showMarkers = z2 >= minMarkerZoom;
55454       const showViewfields = z2 >= minViewfieldZoom2;
55455       const service = getService();
55456       let sequences = service ? service.sequences(projection2) : [];
55457       let images = service && showMarkers ? service.images(projection2) : [];
55458       dispatch14.call("photoDatesChanged", this, "mapillary", [...images.map((p2) => p2.captured_at), ...sequences.map((s2) => s2.properties.captured_at)]);
55459       images = filterImages(images);
55460       sequences = filterSequences(sequences, service);
55461       service.filterViewer(context);
55462       let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
55463         return d2.properties.id;
55464       });
55465       traces.exit().remove();
55466       traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
55467       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d2) {
55468         return d2.id;
55469       });
55470       groups.exit().remove();
55471       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
55472       groupsEnter.append("g").attr("class", "viewfield-scale");
55473       const markers = groups.merge(groupsEnter).sort(function(a2, b2) {
55474         return b2.loc[1] - a2.loc[1];
55475       }).attr("transform", transform2).select(".viewfield-scale");
55476       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
55477       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
55478       viewfields.exit().remove();
55479       viewfields.enter().insert("path", "circle").attr("class", "viewfield").classed("pano", function() {
55480         return this.parentNode.__data__.is_pano;
55481       }).attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
55482       function viewfieldPath() {
55483         if (this.parentNode.__data__.is_pano) {
55484           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
55485         } else {
55486           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
55487         }
55488       }
55489     }
55490     function drawImages(selection2) {
55491       const enabled = svgMapillaryImages.enabled;
55492       const service = getService();
55493       layer = selection2.selectAll(".layer-mapillary").data(service ? [0] : []);
55494       layer.exit().remove();
55495       const layerEnter = layer.enter().append("g").attr("class", "layer-mapillary").style("display", enabled ? "block" : "none");
55496       layerEnter.append("g").attr("class", "sequences");
55497       layerEnter.append("g").attr("class", "markers");
55498       layer = layerEnter.merge(layer);
55499       if (enabled) {
55500         if (service && ~~context.map().zoom() >= minZoom5) {
55501           editOn();
55502           update();
55503           service.loadImages(projection2);
55504         } else {
55505           dispatch14.call("photoDatesChanged", this, "mapillary", []);
55506           editOff();
55507         }
55508       } else {
55509         dispatch14.call("photoDatesChanged", this, "mapillary", []);
55510       }
55511     }
55512     drawImages.enabled = function(_2) {
55513       if (!arguments.length) return svgMapillaryImages.enabled;
55514       svgMapillaryImages.enabled = _2;
55515       if (svgMapillaryImages.enabled) {
55516         showLayer();
55517         context.photos().on("change.mapillary_images", update);
55518       } else {
55519         hideLayer();
55520         context.photos().on("change.mapillary_images", null);
55521       }
55522       dispatch14.call("change");
55523       return this;
55524     };
55525     drawImages.supported = function() {
55526       return !!getService();
55527     };
55528     drawImages.rendered = function(zoom) {
55529       return zoom >= minZoom5;
55530     };
55531     init2();
55532     return drawImages;
55533   }
55534   var init_mapillary_images = __esm({
55535     "modules/svg/mapillary_images.js"() {
55536       "use strict";
55537       init_throttle();
55538       init_src5();
55539       init_helpers();
55540       init_services();
55541     }
55542   });
55543
55544   // modules/svg/mapillary_position.js
55545   var mapillary_position_exports = {};
55546   __export(mapillary_position_exports, {
55547     svgMapillaryPosition: () => svgMapillaryPosition
55548   });
55549   function svgMapillaryPosition(projection2, context) {
55550     const throttledRedraw = throttle_default(function() {
55551       update();
55552     }, 1e3);
55553     const minZoom5 = 12;
55554     const minViewfieldZoom2 = 18;
55555     let layer = select_default2(null);
55556     let _mapillary;
55557     let viewerCompassAngle;
55558     function init2() {
55559       if (svgMapillaryPosition.initialized) return;
55560       svgMapillaryPosition.initialized = true;
55561     }
55562     function getService() {
55563       if (services.mapillary && !_mapillary) {
55564         _mapillary = services.mapillary;
55565         _mapillary.event.on("imageChanged", throttledRedraw);
55566         _mapillary.event.on("bearingChanged", function(e3) {
55567           viewerCompassAngle = e3.bearing;
55568           if (context.map().isTransformed()) return;
55569           layer.selectAll(".viewfield-group.currentView").filter(function(d2) {
55570             return d2.is_pano;
55571           }).attr("transform", transform2);
55572         });
55573       } else if (!services.mapillary && _mapillary) {
55574         _mapillary = null;
55575       }
55576       return _mapillary;
55577     }
55578     function editOn() {
55579       layer.style("display", "block");
55580     }
55581     function editOff() {
55582       layer.selectAll(".viewfield-group").remove();
55583       layer.style("display", "none");
55584     }
55585     function transform2(d2) {
55586       let t2 = svgPointTransform(projection2)(d2);
55587       if (d2.is_pano && viewerCompassAngle !== null && isFinite(viewerCompassAngle)) {
55588         t2 += " rotate(" + Math.floor(viewerCompassAngle) + ",0,0)";
55589       } else if (d2.ca) {
55590         t2 += " rotate(" + Math.floor(d2.ca) + ",0,0)";
55591       }
55592       return t2;
55593     }
55594     function update() {
55595       const z2 = ~~context.map().zoom();
55596       const showViewfields = z2 >= minViewfieldZoom2;
55597       const service = getService();
55598       const image = service && service.getActiveImage();
55599       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(image ? [image] : [], function(d2) {
55600         return d2.id;
55601       });
55602       groups.exit().remove();
55603       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group currentView highlighted");
55604       groupsEnter.append("g").attr("class", "viewfield-scale");
55605       const markers = groups.merge(groupsEnter).attr("transform", transform2).select(".viewfield-scale");
55606       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
55607       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
55608       viewfields.exit().remove();
55609       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");
55610     }
55611     function drawImages(selection2) {
55612       const service = getService();
55613       layer = selection2.selectAll(".layer-mapillary-position").data(service ? [0] : []);
55614       layer.exit().remove();
55615       const layerEnter = layer.enter().append("g").attr("class", "layer-mapillary-position");
55616       layerEnter.append("g").attr("class", "markers");
55617       layer = layerEnter.merge(layer);
55618       if (service && ~~context.map().zoom() >= minZoom5) {
55619         editOn();
55620         update();
55621       } else {
55622         editOff();
55623       }
55624     }
55625     drawImages.enabled = function() {
55626       update();
55627       return this;
55628     };
55629     drawImages.supported = function() {
55630       return !!getService();
55631     };
55632     drawImages.rendered = function(zoom) {
55633       return zoom >= minZoom5;
55634     };
55635     init2();
55636     return drawImages;
55637   }
55638   var init_mapillary_position = __esm({
55639     "modules/svg/mapillary_position.js"() {
55640       "use strict";
55641       init_throttle();
55642       init_src5();
55643       init_helpers();
55644       init_services();
55645     }
55646   });
55647
55648   // modules/svg/mapillary_signs.js
55649   var mapillary_signs_exports = {};
55650   __export(mapillary_signs_exports, {
55651     svgMapillarySigns: () => svgMapillarySigns
55652   });
55653   function svgMapillarySigns(projection2, context, dispatch14) {
55654     const throttledRedraw = throttle_default(function() {
55655       dispatch14.call("change");
55656     }, 1e3);
55657     const minZoom5 = 12;
55658     let layer = select_default2(null);
55659     let _mapillary;
55660     function init2() {
55661       if (svgMapillarySigns.initialized) return;
55662       svgMapillarySigns.enabled = false;
55663       svgMapillarySigns.initialized = true;
55664     }
55665     function getService() {
55666       if (services.mapillary && !_mapillary) {
55667         _mapillary = services.mapillary;
55668         _mapillary.event.on("loadedSigns", throttledRedraw);
55669       } else if (!services.mapillary && _mapillary) {
55670         _mapillary = null;
55671       }
55672       return _mapillary;
55673     }
55674     function showLayer() {
55675       const service = getService();
55676       if (!service) return;
55677       service.loadSignResources(context);
55678       editOn();
55679     }
55680     function hideLayer() {
55681       throttledRedraw.cancel();
55682       editOff();
55683     }
55684     function editOn() {
55685       layer.style("display", "block");
55686     }
55687     function editOff() {
55688       layer.selectAll(".icon-sign").remove();
55689       layer.style("display", "none");
55690     }
55691     function click(d3_event, d2) {
55692       const service = getService();
55693       if (!service) return;
55694       context.map().centerEase(d2.loc);
55695       const selectedImageId = service.getActiveImage() && service.getActiveImage().id;
55696       service.getDetections(d2.id).then((detections) => {
55697         if (detections.length) {
55698           const imageId = detections[0].image.id;
55699           if (imageId === selectedImageId) {
55700             service.highlightDetection(detections[0]).selectImage(context, imageId);
55701           } else {
55702             service.ensureViewerLoaded(context).then(function() {
55703               service.highlightDetection(detections[0]).selectImage(context, imageId).showViewer(context);
55704             });
55705           }
55706         }
55707       });
55708     }
55709     function filterData(detectedFeatures) {
55710       var fromDate = context.photos().fromDate();
55711       var toDate = context.photos().toDate();
55712       if (fromDate) {
55713         var fromTimestamp = new Date(fromDate).getTime();
55714         detectedFeatures = detectedFeatures.filter(function(feature3) {
55715           return new Date(feature3.last_seen_at).getTime() >= fromTimestamp;
55716         });
55717       }
55718       if (toDate) {
55719         var toTimestamp = new Date(toDate).getTime();
55720         detectedFeatures = detectedFeatures.filter(function(feature3) {
55721           return new Date(feature3.first_seen_at).getTime() <= toTimestamp;
55722         });
55723       }
55724       return detectedFeatures;
55725     }
55726     function update() {
55727       const service = getService();
55728       let data = service ? service.signs(projection2) : [];
55729       data = filterData(data);
55730       const transform2 = svgPointTransform(projection2);
55731       const signs = layer.selectAll(".icon-sign").data(data, function(d2) {
55732         return d2.id;
55733       });
55734       signs.exit().remove();
55735       const enter = signs.enter().append("g").attr("class", "icon-sign icon-detected").on("click", click);
55736       enter.append("use").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px").attr("xlink:href", function(d2) {
55737         return "#" + d2.value;
55738       });
55739       enter.append("rect").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px");
55740       signs.merge(enter).attr("transform", transform2);
55741     }
55742     function drawSigns(selection2) {
55743       const enabled = svgMapillarySigns.enabled;
55744       const service = getService();
55745       layer = selection2.selectAll(".layer-mapillary-signs").data(service ? [0] : []);
55746       layer.exit().remove();
55747       layer = layer.enter().append("g").attr("class", "layer-mapillary-signs layer-mapillary-detections").style("display", enabled ? "block" : "none").merge(layer);
55748       if (enabled) {
55749         if (service && ~~context.map().zoom() >= minZoom5) {
55750           editOn();
55751           update();
55752           service.loadSigns(projection2);
55753           service.showSignDetections(true);
55754         } else {
55755           editOff();
55756         }
55757       } else if (service) {
55758         service.showSignDetections(false);
55759       }
55760     }
55761     drawSigns.enabled = function(_2) {
55762       if (!arguments.length) return svgMapillarySigns.enabled;
55763       svgMapillarySigns.enabled = _2;
55764       if (svgMapillarySigns.enabled) {
55765         showLayer();
55766         context.photos().on("change.mapillary_signs", update);
55767       } else {
55768         hideLayer();
55769         context.photos().on("change.mapillary_signs", null);
55770       }
55771       dispatch14.call("change");
55772       return this;
55773     };
55774     drawSigns.supported = function() {
55775       return !!getService();
55776     };
55777     drawSigns.rendered = function(zoom) {
55778       return zoom >= minZoom5;
55779     };
55780     init2();
55781     return drawSigns;
55782   }
55783   var init_mapillary_signs = __esm({
55784     "modules/svg/mapillary_signs.js"() {
55785       "use strict";
55786       init_throttle();
55787       init_src5();
55788       init_helpers();
55789       init_services();
55790     }
55791   });
55792
55793   // modules/svg/mapillary_map_features.js
55794   var mapillary_map_features_exports = {};
55795   __export(mapillary_map_features_exports, {
55796     svgMapillaryMapFeatures: () => svgMapillaryMapFeatures
55797   });
55798   function svgMapillaryMapFeatures(projection2, context, dispatch14) {
55799     const throttledRedraw = throttle_default(function() {
55800       dispatch14.call("change");
55801     }, 1e3);
55802     const minZoom5 = 12;
55803     let layer = select_default2(null);
55804     let _mapillary;
55805     function init2() {
55806       if (svgMapillaryMapFeatures.initialized) return;
55807       svgMapillaryMapFeatures.enabled = false;
55808       svgMapillaryMapFeatures.initialized = true;
55809     }
55810     function getService() {
55811       if (services.mapillary && !_mapillary) {
55812         _mapillary = services.mapillary;
55813         _mapillary.event.on("loadedMapFeatures", throttledRedraw);
55814       } else if (!services.mapillary && _mapillary) {
55815         _mapillary = null;
55816       }
55817       return _mapillary;
55818     }
55819     function showLayer() {
55820       const service = getService();
55821       if (!service) return;
55822       service.loadObjectResources(context);
55823       editOn();
55824     }
55825     function hideLayer() {
55826       throttledRedraw.cancel();
55827       editOff();
55828     }
55829     function editOn() {
55830       layer.style("display", "block");
55831     }
55832     function editOff() {
55833       layer.selectAll(".icon-map-feature").remove();
55834       layer.style("display", "none");
55835     }
55836     function click(d3_event, d2) {
55837       const service = getService();
55838       if (!service) return;
55839       context.map().centerEase(d2.loc);
55840       const selectedImageId = service.getActiveImage() && service.getActiveImage().id;
55841       service.getDetections(d2.id).then((detections) => {
55842         if (detections.length) {
55843           const imageId = detections[0].image.id;
55844           if (imageId === selectedImageId) {
55845             service.highlightDetection(detections[0]).selectImage(context, imageId);
55846           } else {
55847             service.ensureViewerLoaded(context).then(function() {
55848               service.highlightDetection(detections[0]).selectImage(context, imageId).showViewer(context);
55849             });
55850           }
55851         }
55852       });
55853     }
55854     function filterData(detectedFeatures) {
55855       const fromDate = context.photos().fromDate();
55856       const toDate = context.photos().toDate();
55857       if (fromDate) {
55858         detectedFeatures = detectedFeatures.filter(function(feature3) {
55859           return new Date(feature3.last_seen_at).getTime() >= new Date(fromDate).getTime();
55860         });
55861       }
55862       if (toDate) {
55863         detectedFeatures = detectedFeatures.filter(function(feature3) {
55864           return new Date(feature3.first_seen_at).getTime() <= new Date(toDate).getTime();
55865         });
55866       }
55867       return detectedFeatures;
55868     }
55869     function update() {
55870       const service = getService();
55871       let data = service ? service.mapFeatures(projection2) : [];
55872       data = filterData(data);
55873       const transform2 = svgPointTransform(projection2);
55874       const mapFeatures = layer.selectAll(".icon-map-feature").data(data, function(d2) {
55875         return d2.id;
55876       });
55877       mapFeatures.exit().remove();
55878       const enter = mapFeatures.enter().append("g").attr("class", "icon-map-feature icon-detected").on("click", click);
55879       enter.append("title").text(function(d2) {
55880         var id2 = d2.value.replace(/--/g, ".").replace(/-/g, "_");
55881         return _t("mapillary_map_features." + id2);
55882       });
55883       enter.append("use").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px").attr("xlink:href", function(d2) {
55884         if (d2.value === "object--billboard") {
55885           return "#object--sign--advertisement";
55886         }
55887         return "#" + d2.value;
55888       });
55889       enter.append("rect").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px");
55890       mapFeatures.merge(enter).attr("transform", transform2);
55891     }
55892     function drawMapFeatures(selection2) {
55893       const enabled = svgMapillaryMapFeatures.enabled;
55894       const service = getService();
55895       layer = selection2.selectAll(".layer-mapillary-map-features").data(service ? [0] : []);
55896       layer.exit().remove();
55897       layer = layer.enter().append("g").attr("class", "layer-mapillary-map-features layer-mapillary-detections").style("display", enabled ? "block" : "none").merge(layer);
55898       if (enabled) {
55899         if (service && ~~context.map().zoom() >= minZoom5) {
55900           editOn();
55901           update();
55902           service.loadMapFeatures(projection2);
55903           service.showFeatureDetections(true);
55904         } else {
55905           editOff();
55906         }
55907       } else if (service) {
55908         service.showFeatureDetections(false);
55909       }
55910     }
55911     drawMapFeatures.enabled = function(_2) {
55912       if (!arguments.length) return svgMapillaryMapFeatures.enabled;
55913       svgMapillaryMapFeatures.enabled = _2;
55914       if (svgMapillaryMapFeatures.enabled) {
55915         showLayer();
55916         context.photos().on("change.mapillary_map_features", update);
55917       } else {
55918         hideLayer();
55919         context.photos().on("change.mapillary_map_features", null);
55920       }
55921       dispatch14.call("change");
55922       return this;
55923     };
55924     drawMapFeatures.supported = function() {
55925       return !!getService();
55926     };
55927     drawMapFeatures.rendered = function(zoom) {
55928       return zoom >= minZoom5;
55929     };
55930     init2();
55931     return drawMapFeatures;
55932   }
55933   var init_mapillary_map_features = __esm({
55934     "modules/svg/mapillary_map_features.js"() {
55935       "use strict";
55936       init_throttle();
55937       init_src5();
55938       init_helpers();
55939       init_services();
55940       init_localizer();
55941     }
55942   });
55943
55944   // modules/svg/kartaview_images.js
55945   var kartaview_images_exports = {};
55946   __export(kartaview_images_exports, {
55947     svgKartaviewImages: () => svgKartaviewImages
55948   });
55949   function svgKartaviewImages(projection2, context, dispatch14) {
55950     var throttledRedraw = throttle_default(function() {
55951       dispatch14.call("change");
55952     }, 1e3);
55953     var minZoom5 = 12;
55954     var minMarkerZoom = 16;
55955     var minViewfieldZoom2 = 18;
55956     var layer = select_default2(null);
55957     var _kartaview;
55958     function init2() {
55959       if (svgKartaviewImages.initialized) return;
55960       svgKartaviewImages.enabled = false;
55961       svgKartaviewImages.initialized = true;
55962     }
55963     function getService() {
55964       if (services.kartaview && !_kartaview) {
55965         _kartaview = services.kartaview;
55966         _kartaview.event.on("loadedImages", throttledRedraw);
55967       } else if (!services.kartaview && _kartaview) {
55968         _kartaview = null;
55969       }
55970       return _kartaview;
55971     }
55972     function showLayer() {
55973       var service = getService();
55974       if (!service) return;
55975       editOn();
55976       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
55977         dispatch14.call("change");
55978       });
55979     }
55980     function hideLayer() {
55981       throttledRedraw.cancel();
55982       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
55983     }
55984     function editOn() {
55985       layer.style("display", "block");
55986     }
55987     function editOff() {
55988       layer.selectAll(".viewfield-group").remove();
55989       layer.style("display", "none");
55990     }
55991     function click(d3_event, d2) {
55992       var service = getService();
55993       if (!service) return;
55994       service.ensureViewerLoaded(context).then(function() {
55995         service.selectImage(context, d2.key).showViewer(context);
55996       });
55997       context.map().centerEase(d2.loc);
55998     }
55999     function mouseover(d3_event, d2) {
56000       var service = getService();
56001       if (service) service.setStyles(context, d2);
56002     }
56003     function mouseout() {
56004       var service = getService();
56005       if (service) service.setStyles(context, null);
56006     }
56007     function transform2(d2) {
56008       var t2 = svgPointTransform(projection2)(d2);
56009       if (d2.ca) {
56010         t2 += " rotate(" + Math.floor(d2.ca) + ",0,0)";
56011       }
56012       return t2;
56013     }
56014     function filterImages(images) {
56015       var fromDate = context.photos().fromDate();
56016       var toDate = context.photos().toDate();
56017       var usernames = context.photos().usernames();
56018       if (fromDate) {
56019         var fromTimestamp = new Date(fromDate).getTime();
56020         images = images.filter(function(item) {
56021           return new Date(item.captured_at).getTime() >= fromTimestamp;
56022         });
56023       }
56024       if (toDate) {
56025         var toTimestamp = new Date(toDate).getTime();
56026         images = images.filter(function(item) {
56027           return new Date(item.captured_at).getTime() <= toTimestamp;
56028         });
56029       }
56030       if (usernames) {
56031         images = images.filter(function(item) {
56032           return usernames.indexOf(item.captured_by) !== -1;
56033         });
56034       }
56035       return images;
56036     }
56037     function filterSequences(sequences) {
56038       var fromDate = context.photos().fromDate();
56039       var toDate = context.photos().toDate();
56040       var usernames = context.photos().usernames();
56041       if (fromDate) {
56042         var fromTimestamp = new Date(fromDate).getTime();
56043         sequences = sequences.filter(function(sequence) {
56044           return new Date(sequence.properties.captured_at).getTime() >= fromTimestamp;
56045         });
56046       }
56047       if (toDate) {
56048         var toTimestamp = new Date(toDate).getTime();
56049         sequences = sequences.filter(function(sequence) {
56050           return new Date(sequence.properties.captured_at).getTime() <= toTimestamp;
56051         });
56052       }
56053       if (usernames) {
56054         sequences = sequences.filter(function(sequence) {
56055           return usernames.indexOf(sequence.properties.captured_by) !== -1;
56056         });
56057       }
56058       return sequences;
56059     }
56060     function update() {
56061       var viewer = context.container().select(".photoviewer");
56062       var selected = viewer.empty() ? void 0 : viewer.datum();
56063       var z2 = ~~context.map().zoom();
56064       var showMarkers = z2 >= minMarkerZoom;
56065       var showViewfields = z2 >= minViewfieldZoom2;
56066       var service = getService();
56067       var sequences = [];
56068       var images = [];
56069       sequences = service ? service.sequences(projection2) : [];
56070       images = service && showMarkers ? service.images(projection2) : [];
56071       dispatch14.call("photoDatesChanged", this, "kartaview", [...images.map((p2) => p2.captured_at), ...sequences.map((s2) => s2.properties.captured_at)]);
56072       sequences = filterSequences(sequences);
56073       images = filterImages(images);
56074       var traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
56075         return d2.properties.key;
56076       });
56077       traces.exit().remove();
56078       traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
56079       var groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d2) {
56080         return d2.key;
56081       });
56082       groups.exit().remove();
56083       var groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
56084       groupsEnter.append("g").attr("class", "viewfield-scale");
56085       var markers = groups.merge(groupsEnter).sort(function(a2, b2) {
56086         return a2 === selected ? 1 : b2 === selected ? -1 : b2.loc[1] - a2.loc[1];
56087       }).attr("transform", transform2).select(".viewfield-scale");
56088       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
56089       var viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
56090       viewfields.exit().remove();
56091       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");
56092     }
56093     function drawImages(selection2) {
56094       var enabled = svgKartaviewImages.enabled, service = getService();
56095       layer = selection2.selectAll(".layer-kartaview").data(service ? [0] : []);
56096       layer.exit().remove();
56097       var layerEnter = layer.enter().append("g").attr("class", "layer-kartaview").style("display", enabled ? "block" : "none");
56098       layerEnter.append("g").attr("class", "sequences");
56099       layerEnter.append("g").attr("class", "markers");
56100       layer = layerEnter.merge(layer);
56101       if (enabled) {
56102         if (service && ~~context.map().zoom() >= minZoom5) {
56103           editOn();
56104           update();
56105           service.loadImages(projection2);
56106         } else {
56107           dispatch14.call("photoDatesChanged", this, "kartaview", []);
56108           editOff();
56109         }
56110       } else {
56111         dispatch14.call("photoDatesChanged", this, "kartaview", []);
56112       }
56113     }
56114     drawImages.enabled = function(_2) {
56115       if (!arguments.length) return svgKartaviewImages.enabled;
56116       svgKartaviewImages.enabled = _2;
56117       if (svgKartaviewImages.enabled) {
56118         showLayer();
56119         context.photos().on("change.kartaview_images", update);
56120       } else {
56121         hideLayer();
56122         context.photos().on("change.kartaview_images", null);
56123       }
56124       dispatch14.call("change");
56125       return this;
56126     };
56127     drawImages.supported = function() {
56128       return !!getService();
56129     };
56130     drawImages.rendered = function(zoom) {
56131       return zoom >= minZoom5;
56132     };
56133     init2();
56134     return drawImages;
56135   }
56136   var init_kartaview_images = __esm({
56137     "modules/svg/kartaview_images.js"() {
56138       "use strict";
56139       init_throttle();
56140       init_src5();
56141       init_helpers();
56142       init_services();
56143     }
56144   });
56145
56146   // modules/svg/mapilio_images.js
56147   var mapilio_images_exports = {};
56148   __export(mapilio_images_exports, {
56149     svgMapilioImages: () => svgMapilioImages
56150   });
56151   function svgMapilioImages(projection2, context, dispatch14) {
56152     const throttledRedraw = throttle_default(function() {
56153       dispatch14.call("change");
56154     }, 1e3);
56155     const minZoom5 = 12;
56156     let layer = select_default2(null);
56157     let _mapilio;
56158     const viewFieldZoomLevel = 18;
56159     function init2() {
56160       if (svgMapilioImages.initialized) return;
56161       svgMapilioImages.enabled = false;
56162       svgMapilioImages.initialized = true;
56163     }
56164     function getService() {
56165       if (services.mapilio && !_mapilio) {
56166         _mapilio = services.mapilio;
56167         _mapilio.event.on("loadedImages", throttledRedraw);
56168       } else if (!services.mapilio && _mapilio) {
56169         _mapilio = null;
56170       }
56171       return _mapilio;
56172     }
56173     function showLayer() {
56174       const service = getService();
56175       if (!service) return;
56176       editOn();
56177       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
56178         dispatch14.call("change");
56179       });
56180     }
56181     function hideLayer() {
56182       throttledRedraw.cancel();
56183       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
56184     }
56185     function transform2(d2) {
56186       let t2 = svgPointTransform(projection2)(d2);
56187       if (d2.heading) {
56188         t2 += " rotate(" + Math.floor(d2.heading) + ",0,0)";
56189       }
56190       return t2;
56191     }
56192     function editOn() {
56193       layer.style("display", "block");
56194     }
56195     function editOff() {
56196       layer.selectAll(".viewfield-group").remove();
56197       layer.style("display", "none");
56198     }
56199     function click(d3_event, image) {
56200       const service = getService();
56201       if (!service) return;
56202       service.ensureViewerLoaded(context, image.id).then(function() {
56203         service.selectImage(context, image.id).showViewer(context);
56204       });
56205       context.map().centerEase(image.loc);
56206     }
56207     function mouseover(d3_event, image) {
56208       const service = getService();
56209       if (service) service.setStyles(context, image);
56210     }
56211     function mouseout() {
56212       const service = getService();
56213       if (service) service.setStyles(context, null);
56214     }
56215     function filterImages(images) {
56216       var fromDate = context.photos().fromDate();
56217       var toDate = context.photos().toDate();
56218       if (fromDate) {
56219         var fromTimestamp = new Date(fromDate).getTime();
56220         images = images.filter(function(photo) {
56221           return new Date(photo.capture_time).getTime() >= fromTimestamp;
56222         });
56223       }
56224       if (toDate) {
56225         var toTimestamp = new Date(toDate).getTime();
56226         images = images.filter(function(photo) {
56227           return new Date(photo.capture_time).getTime() <= toTimestamp;
56228         });
56229       }
56230       return images;
56231     }
56232     function filterSequences(sequences) {
56233       var fromDate = context.photos().fromDate();
56234       var toDate = context.photos().toDate();
56235       if (fromDate) {
56236         var fromTimestamp = new Date(fromDate).getTime();
56237         sequences = sequences.filter(function(sequence) {
56238           return new Date(sequence.properties.capture_time).getTime() >= fromTimestamp;
56239         });
56240       }
56241       if (toDate) {
56242         var toTimestamp = new Date(toDate).getTime();
56243         sequences = sequences.filter(function(sequence) {
56244           return new Date(sequence.properties.capture_time).getTime() <= toTimestamp;
56245         });
56246       }
56247       return sequences;
56248     }
56249     function update() {
56250       const z2 = ~~context.map().zoom();
56251       const showViewfields = z2 >= viewFieldZoomLevel;
56252       const service = getService();
56253       let sequences = service ? service.sequences(projection2) : [];
56254       let images = service ? service.images(projection2) : [];
56255       dispatch14.call("photoDatesChanged", this, "mapilio", [...images.map((p2) => p2.capture_time), ...sequences.map((s2) => s2.properties.capture_time)]);
56256       sequences = filterSequences(sequences);
56257       images = filterImages(images);
56258       let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
56259         return d2.properties.id;
56260       });
56261       traces.exit().remove();
56262       traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
56263       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d2) {
56264         return d2.id;
56265       });
56266       groups.exit().remove();
56267       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
56268       groupsEnter.append("g").attr("class", "viewfield-scale");
56269       const markers = groups.merge(groupsEnter).sort(function(a2, b2) {
56270         return b2.loc[1] - a2.loc[1];
56271       }).attr("transform", transform2).select(".viewfield-scale");
56272       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
56273       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
56274       viewfields.exit().remove();
56275       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
56276       function viewfieldPath() {
56277         if (this.parentNode.__data__.isPano) {
56278           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
56279         } else {
56280           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
56281         }
56282       }
56283     }
56284     function drawImages(selection2) {
56285       const enabled = svgMapilioImages.enabled;
56286       const service = getService();
56287       layer = selection2.selectAll(".layer-mapilio").data(service ? [0] : []);
56288       layer.exit().remove();
56289       const layerEnter = layer.enter().append("g").attr("class", "layer-mapilio").style("display", enabled ? "block" : "none");
56290       layerEnter.append("g").attr("class", "sequences");
56291       layerEnter.append("g").attr("class", "markers");
56292       layer = layerEnter.merge(layer);
56293       if (enabled) {
56294         if (service && ~~context.map().zoom() >= minZoom5) {
56295           editOn();
56296           update();
56297           service.loadImages(projection2);
56298           service.loadLines(projection2);
56299         } else {
56300           dispatch14.call("photoDatesChanged", this, "mapilio", []);
56301           editOff();
56302         }
56303       } else {
56304         dispatch14.call("photoDatesChanged", this, "mapilio", []);
56305       }
56306     }
56307     drawImages.enabled = function(_2) {
56308       if (!arguments.length) return svgMapilioImages.enabled;
56309       svgMapilioImages.enabled = _2;
56310       if (svgMapilioImages.enabled) {
56311         showLayer();
56312         context.photos().on("change.mapilio_images", update);
56313       } else {
56314         hideLayer();
56315         context.photos().on("change.mapilio_images", null);
56316       }
56317       dispatch14.call("change");
56318       return this;
56319     };
56320     drawImages.supported = function() {
56321       return !!getService();
56322     };
56323     drawImages.rendered = function(zoom) {
56324       return zoom >= minZoom5;
56325     };
56326     init2();
56327     return drawImages;
56328   }
56329   var init_mapilio_images = __esm({
56330     "modules/svg/mapilio_images.js"() {
56331       "use strict";
56332       init_throttle();
56333       init_src5();
56334       init_services();
56335       init_helpers();
56336     }
56337   });
56338
56339   // modules/svg/panoramax_images.js
56340   var panoramax_images_exports = {};
56341   __export(panoramax_images_exports, {
56342     svgPanoramaxImages: () => svgPanoramaxImages
56343   });
56344   function svgPanoramaxImages(projection2, context, dispatch14) {
56345     const throttledRedraw = throttle_default(function() {
56346       dispatch14.call("change");
56347     }, 1e3);
56348     const imageMinZoom2 = 15;
56349     const lineMinZoom2 = 10;
56350     const viewFieldZoomLevel = 18;
56351     let layer = select_default2(null);
56352     let _panoramax;
56353     let _viewerYaw = 0;
56354     let _activeUsernameFilter;
56355     let _activeIds;
56356     function init2() {
56357       if (svgPanoramaxImages.initialized) return;
56358       svgPanoramaxImages.enabled = false;
56359       svgPanoramaxImages.initialized = true;
56360     }
56361     function getService() {
56362       if (services.panoramax && !_panoramax) {
56363         _panoramax = services.panoramax;
56364         _panoramax.event.on("viewerChanged", viewerChanged).on("loadedLines", throttledRedraw).on("loadedImages", throttledRedraw);
56365       } else if (!services.panoramax && _panoramax) {
56366         _panoramax = null;
56367       }
56368       return _panoramax;
56369     }
56370     async function filterImages(images) {
56371       const showsPano = context.photos().showsPanoramic();
56372       const showsFlat = context.photos().showsFlat();
56373       const fromDate = context.photos().fromDate();
56374       const toDate = context.photos().toDate();
56375       const username = context.photos().usernames();
56376       const service = getService();
56377       if (!showsPano || !showsFlat) {
56378         images = images.filter(function(image) {
56379           if (image.isPano) return showsPano;
56380           return showsFlat;
56381         });
56382       }
56383       if (fromDate) {
56384         images = images.filter(function(image) {
56385           return new Date(image.capture_time).getTime() >= new Date(fromDate).getTime();
56386         });
56387       }
56388       if (toDate) {
56389         images = images.filter(function(image) {
56390           return new Date(image.capture_time).getTime() <= new Date(toDate).getTime();
56391         });
56392       }
56393       if (username && service) {
56394         if (_activeUsernameFilter !== username) {
56395           _activeUsernameFilter = username;
56396           const tempIds = await service.getUserIds(username);
56397           _activeIds = {};
56398           tempIds.forEach((id2) => {
56399             _activeIds[id2] = true;
56400           });
56401         }
56402         images = images.filter(function(image) {
56403           return _activeIds[image.account_id];
56404         });
56405       }
56406       return images;
56407     }
56408     async function filterSequences(sequences) {
56409       const showsPano = context.photos().showsPanoramic();
56410       const showsFlat = context.photos().showsFlat();
56411       const fromDate = context.photos().fromDate();
56412       const toDate = context.photos().toDate();
56413       const username = context.photos().usernames();
56414       const service = getService();
56415       if (!showsPano || !showsFlat) {
56416         sequences = sequences.filter(function(sequence) {
56417           if (sequence.properties.type === "equirectangular") return showsPano;
56418           return showsFlat;
56419         });
56420       }
56421       if (fromDate) {
56422         sequences = sequences.filter(function(sequence) {
56423           return new Date(sequence.properties.date).getTime() >= new Date(fromDate).getTime().toString();
56424         });
56425       }
56426       if (toDate) {
56427         sequences = sequences.filter(function(sequence) {
56428           return new Date(sequence.properties.date).getTime() <= new Date(toDate).getTime().toString();
56429         });
56430       }
56431       if (username && service) {
56432         if (_activeUsernameFilter !== username) {
56433           _activeUsernameFilter = username;
56434           const tempIds = await service.getUserIds(username);
56435           _activeIds = {};
56436           tempIds.forEach((id2) => {
56437             _activeIds[id2] = true;
56438           });
56439         }
56440         sequences = sequences.filter(function(sequence) {
56441           return _activeIds[sequence.properties.account_id];
56442         });
56443       }
56444       return sequences;
56445     }
56446     function showLayer() {
56447       const service = getService();
56448       if (!service) return;
56449       editOn();
56450       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
56451         dispatch14.call("change");
56452       });
56453     }
56454     function hideLayer() {
56455       throttledRedraw.cancel();
56456       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
56457     }
56458     function transform2(d2, selectedImageId) {
56459       let t2 = svgPointTransform(projection2)(d2);
56460       let rot = d2.heading;
56461       if (d2.id === selectedImageId) {
56462         rot += _viewerYaw;
56463       }
56464       if (rot) {
56465         t2 += " rotate(" + Math.floor(rot) + ",0,0)";
56466       }
56467       return t2;
56468     }
56469     function editOn() {
56470       layer.style("display", "block");
56471     }
56472     function editOff() {
56473       const service = getService();
56474       service.hideViewer(context);
56475       layer.selectAll(".viewfield-group").remove();
56476       layer.style("display", "none");
56477     }
56478     function click(d3_event, image) {
56479       const service = getService();
56480       if (!service) return;
56481       service.ensureViewerLoaded(context).then(function() {
56482         service.selectImage(context, image.id).showViewer(context);
56483       });
56484       context.map().centerEase(image.loc);
56485     }
56486     function mouseover(d3_event, image) {
56487       const service = getService();
56488       if (service) service.setStyles(context, image);
56489     }
56490     function mouseout() {
56491       const service = getService();
56492       if (service) service.setStyles(context, null);
56493     }
56494     async function update() {
56495       var _a3;
56496       const zoom = ~~context.map().zoom();
56497       const showViewfields = zoom >= viewFieldZoomLevel;
56498       const service = getService();
56499       let sequences = service ? service.sequences(projection2, zoom) : [];
56500       let images = service && zoom >= imageMinZoom2 ? service.images(projection2) : [];
56501       dispatch14.call("photoDatesChanged", this, "panoramax", [...images.map((p2) => p2.capture_time), ...sequences.map((s2) => s2.properties.date)]);
56502       let isHidden = select_default2(".photo-wrapper.panoramax-wrapper.hide").size();
56503       if (isHidden) service.setActiveImage(null);
56504       images = await filterImages(images);
56505       sequences = await filterSequences(sequences, service);
56506       let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
56507         return d2.properties.id;
56508       });
56509       traces.exit().remove();
56510       traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
56511       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d2) {
56512         return d2.id;
56513       });
56514       groups.exit().remove();
56515       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
56516       groupsEnter.append("g").attr("class", "viewfield-scale");
56517       const activeImageId = (_a3 = service.getActiveImage()) == null ? void 0 : _a3.id;
56518       const markers = groups.merge(groupsEnter).sort(function(a2, b2) {
56519         if (a2.id === activeImageId) return 1;
56520         if (b2.id === activeImageId) return -1;
56521         return a2.capture_time_parsed - b2.capture_time_parsed;
56522       }).attr("transform", (d2) => transform2(d2, activeImageId)).select(".viewfield-scale");
56523       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
56524       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
56525       viewfields.exit().remove();
56526       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
56527       service.setStyles(context, null);
56528       function viewfieldPath() {
56529         if (this.parentNode.__data__.isPano) {
56530           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
56531         } else {
56532           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
56533         }
56534       }
56535     }
56536     function viewerChanged() {
56537       const service = getService();
56538       if (!service) return;
56539       const frame2 = service.photoFrame();
56540       if (!frame2) return;
56541       _viewerYaw = frame2.getYaw();
56542       if (context.map().isTransformed()) return;
56543       layer.selectAll(".viewfield-group.currentView").attr("transform", (d2) => transform2(d2, d2.id));
56544     }
56545     function drawImages(selection2) {
56546       const enabled = svgPanoramaxImages.enabled;
56547       const service = getService();
56548       layer = selection2.selectAll(".layer-panoramax").data(service ? [0] : []);
56549       layer.exit().remove();
56550       const layerEnter = layer.enter().append("g").attr("class", "layer-panoramax").style("display", enabled ? "block" : "none");
56551       layerEnter.append("g").attr("class", "sequences");
56552       layerEnter.append("g").attr("class", "markers");
56553       layer = layerEnter.merge(layer);
56554       if (enabled) {
56555         let zoom = ~~context.map().zoom();
56556         if (service) {
56557           if (zoom >= imageMinZoom2) {
56558             editOn();
56559             update();
56560             service.loadImages(projection2);
56561           } else if (zoom >= lineMinZoom2) {
56562             editOn();
56563             update();
56564             service.loadLines(projection2, zoom);
56565           } else {
56566             editOff();
56567             dispatch14.call("photoDatesChanged", this, "panoramax", []);
56568           }
56569         } else {
56570           editOff();
56571         }
56572       } else {
56573         dispatch14.call("photoDatesChanged", this, "panoramax", []);
56574       }
56575     }
56576     drawImages.enabled = function(_2) {
56577       if (!arguments.length) return svgPanoramaxImages.enabled;
56578       svgPanoramaxImages.enabled = _2;
56579       if (svgPanoramaxImages.enabled) {
56580         showLayer();
56581         context.photos().on("change.panoramax_images", update);
56582       } else {
56583         hideLayer();
56584         context.photos().on("change.panoramax_images", null);
56585       }
56586       dispatch14.call("change");
56587       return this;
56588     };
56589     drawImages.supported = function() {
56590       return !!getService();
56591     };
56592     drawImages.rendered = function(zoom) {
56593       return zoom >= lineMinZoom2;
56594     };
56595     init2();
56596     return drawImages;
56597   }
56598   var init_panoramax_images = __esm({
56599     "modules/svg/panoramax_images.js"() {
56600       "use strict";
56601       init_throttle();
56602       init_src5();
56603       init_services();
56604       init_helpers();
56605     }
56606   });
56607
56608   // modules/svg/osm.js
56609   var osm_exports2 = {};
56610   __export(osm_exports2, {
56611     svgOsm: () => svgOsm
56612   });
56613   function svgOsm(projection2, context, dispatch14) {
56614     var enabled = true;
56615     function drawOsm(selection2) {
56616       selection2.selectAll(".layer-osm").data(["covered", "areas", "lines", "points", "labels"]).enter().append("g").attr("class", function(d2) {
56617         return "layer-osm " + d2;
56618       });
56619       selection2.selectAll(".layer-osm.points").selectAll(".points-group").data(["points", "midpoints", "vertices", "turns"]).enter().append("g").attr("class", function(d2) {
56620         return "points-group " + d2;
56621       });
56622     }
56623     function showLayer() {
56624       var layer = context.surface().selectAll(".data-layer.osm");
56625       layer.interrupt();
56626       layer.classed("disabled", false).style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", function() {
56627         dispatch14.call("change");
56628       });
56629     }
56630     function hideLayer() {
56631       var layer = context.surface().selectAll(".data-layer.osm");
56632       layer.interrupt();
56633       layer.transition().duration(250).style("opacity", 0).on("end interrupt", function() {
56634         layer.classed("disabled", true);
56635         dispatch14.call("change");
56636       });
56637     }
56638     drawOsm.enabled = function(val) {
56639       if (!arguments.length) return enabled;
56640       enabled = val;
56641       if (enabled) {
56642         showLayer();
56643       } else {
56644         hideLayer();
56645       }
56646       dispatch14.call("change");
56647       return this;
56648     };
56649     return drawOsm;
56650   }
56651   var init_osm2 = __esm({
56652     "modules/svg/osm.js"() {
56653       "use strict";
56654     }
56655   });
56656
56657   // modules/svg/notes.js
56658   var notes_exports = {};
56659   __export(notes_exports, {
56660     svgNotes: () => svgNotes
56661   });
56662   function svgNotes(projection2, context, dispatch14) {
56663     if (!dispatch14) {
56664       dispatch14 = dispatch_default("change");
56665     }
56666     var throttledRedraw = throttle_default(function() {
56667       dispatch14.call("change");
56668     }, 1e3);
56669     var minZoom5 = 12;
56670     var touchLayer = select_default2(null);
56671     var drawLayer = select_default2(null);
56672     var _notesVisible = false;
56673     function markerPath(selection2, klass) {
56674       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");
56675     }
56676     function getService() {
56677       if (services.osm && !_osmService) {
56678         _osmService = services.osm;
56679         _osmService.on("loadedNotes", throttledRedraw);
56680       } else if (!services.osm && _osmService) {
56681         _osmService = null;
56682       }
56683       return _osmService;
56684     }
56685     function editOn() {
56686       if (!_notesVisible) {
56687         _notesVisible = true;
56688         drawLayer.style("display", "block");
56689       }
56690     }
56691     function editOff() {
56692       if (_notesVisible) {
56693         _notesVisible = false;
56694         drawLayer.style("display", "none");
56695         drawLayer.selectAll(".note").remove();
56696         touchLayer.selectAll(".note").remove();
56697       }
56698     }
56699     function layerOn() {
56700       editOn();
56701       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", function() {
56702         dispatch14.call("change");
56703       });
56704     }
56705     function layerOff() {
56706       throttledRedraw.cancel();
56707       drawLayer.interrupt();
56708       touchLayer.selectAll(".note").remove();
56709       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", function() {
56710         editOff();
56711         dispatch14.call("change");
56712       });
56713     }
56714     function updateMarkers() {
56715       if (!_notesVisible || !_notesEnabled) return;
56716       var service = getService();
56717       var selectedID = context.selectedNoteID();
56718       var data = service ? service.notes(projection2) : [];
56719       var getTransform = svgPointTransform(projection2);
56720       var notes = drawLayer.selectAll(".note").data(data, function(d2) {
56721         return d2.status + d2.id;
56722       });
56723       notes.exit().remove();
56724       var notesEnter = notes.enter().append("g").attr("class", function(d2) {
56725         return "note note-" + d2.id + " " + d2.status;
56726       }).classed("new", function(d2) {
56727         return d2.id < 0;
56728       });
56729       notesEnter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
56730       notesEnter.append("path").call(markerPath, "shadow");
56731       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");
56732       notesEnter.selectAll(".icon-annotation").data(function(d2) {
56733         return [d2];
56734       }).enter().append("use").attr("class", "icon-annotation").attr("width", "10px").attr("height", "10px").attr("x", "-3px").attr("y", "-19px").attr("xlink:href", function(d2) {
56735         if (d2.id < 0) return "#iD-icon-plus";
56736         if (d2.status === "open") return "#iD-icon-close";
56737         return "#iD-icon-apply";
56738       });
56739       notes.merge(notesEnter).sort(sortY).classed("selected", function(d2) {
56740         var mode = context.mode();
56741         var isMoving = mode && mode.id === "drag-note";
56742         return !isMoving && d2.id === selectedID;
56743       }).attr("transform", getTransform);
56744       if (touchLayer.empty()) return;
56745       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
56746       var targets = touchLayer.selectAll(".note").data(data, function(d2) {
56747         return d2.id;
56748       });
56749       targets.exit().remove();
56750       targets.enter().append("rect").attr("width", "20px").attr("height", "20px").attr("x", "-8px").attr("y", "-22px").merge(targets).sort(sortY).attr("class", function(d2) {
56751         var newClass = d2.id < 0 ? "new" : "";
56752         return "note target note-" + d2.id + " " + fillClass + newClass;
56753       }).attr("transform", getTransform);
56754       function sortY(a2, b2) {
56755         if (a2.id === selectedID) return 1;
56756         if (b2.id === selectedID) return -1;
56757         return b2.loc[1] - a2.loc[1];
56758       }
56759     }
56760     function drawNotes(selection2) {
56761       var service = getService();
56762       var surface = context.surface();
56763       if (surface && !surface.empty()) {
56764         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
56765       }
56766       drawLayer = selection2.selectAll(".layer-notes").data(service ? [0] : []);
56767       drawLayer.exit().remove();
56768       drawLayer = drawLayer.enter().append("g").attr("class", "layer-notes").style("display", _notesEnabled ? "block" : "none").merge(drawLayer);
56769       if (_notesEnabled) {
56770         if (service && ~~context.map().zoom() >= minZoom5) {
56771           editOn();
56772           service.loadNotes(projection2);
56773           updateMarkers();
56774         } else {
56775           editOff();
56776         }
56777       }
56778     }
56779     drawNotes.enabled = function(val) {
56780       if (!arguments.length) return _notesEnabled;
56781       _notesEnabled = val;
56782       if (_notesEnabled) {
56783         layerOn();
56784       } else {
56785         layerOff();
56786         if (context.selectedNoteID()) {
56787           context.enter(modeBrowse(context));
56788         }
56789       }
56790       dispatch14.call("change");
56791       return this;
56792     };
56793     return drawNotes;
56794   }
56795   var hash, _notesEnabled, _osmService;
56796   var init_notes = __esm({
56797     "modules/svg/notes.js"() {
56798       "use strict";
56799       init_throttle();
56800       init_src5();
56801       init_src4();
56802       init_browse();
56803       init_helpers();
56804       init_services();
56805       init_util();
56806       hash = utilStringQs(window.location.hash);
56807       _notesEnabled = !!hash.notes;
56808     }
56809   });
56810
56811   // modules/svg/touch.js
56812   var touch_exports = {};
56813   __export(touch_exports, {
56814     svgTouch: () => svgTouch
56815   });
56816   function svgTouch() {
56817     function drawTouch(selection2) {
56818       selection2.selectAll(".layer-touch").data(["areas", "lines", "points", "turns", "markers"]).enter().append("g").attr("class", function(d2) {
56819         return "layer-touch " + d2;
56820       });
56821     }
56822     return drawTouch;
56823   }
56824   var init_touch = __esm({
56825     "modules/svg/touch.js"() {
56826       "use strict";
56827     }
56828   });
56829
56830   // modules/util/dimensions.js
56831   var dimensions_exports = {};
56832   __export(dimensions_exports, {
56833     utilGetDimensions: () => utilGetDimensions,
56834     utilSetDimensions: () => utilSetDimensions
56835   });
56836   function refresh(selection2, node) {
56837     var cr = node.getBoundingClientRect();
56838     var prop = [cr.width, cr.height];
56839     selection2.property("__dimensions__", prop);
56840     return prop;
56841   }
56842   function utilGetDimensions(selection2, force) {
56843     if (!selection2 || selection2.empty()) {
56844       return [0, 0];
56845     }
56846     var node = selection2.node(), cached = selection2.property("__dimensions__");
56847     return !cached || force ? refresh(selection2, node) : cached;
56848   }
56849   function utilSetDimensions(selection2, dimensions) {
56850     if (!selection2 || selection2.empty()) {
56851       return selection2;
56852     }
56853     var node = selection2.node();
56854     if (dimensions === null) {
56855       refresh(selection2, node);
56856       return selection2;
56857     }
56858     return selection2.property("__dimensions__", [dimensions[0], dimensions[1]]).attr("width", dimensions[0]).attr("height", dimensions[1]);
56859   }
56860   var init_dimensions = __esm({
56861     "modules/util/dimensions.js"() {
56862       "use strict";
56863     }
56864   });
56865
56866   // modules/svg/layers.js
56867   var layers_exports = {};
56868   __export(layers_exports, {
56869     svgLayers: () => svgLayers
56870   });
56871   function svgLayers(projection2, context) {
56872     var dispatch14 = dispatch_default("change", "photoDatesChanged");
56873     var svg2 = select_default2(null);
56874     var _layers = [
56875       { id: "osm", layer: svgOsm(projection2, context, dispatch14) },
56876       { id: "notes", layer: svgNotes(projection2, context, dispatch14) },
56877       { id: "data", layer: svgData(projection2, context, dispatch14) },
56878       { id: "keepRight", layer: svgKeepRight(projection2, context, dispatch14) },
56879       { id: "osmose", layer: svgOsmose(projection2, context, dispatch14) },
56880       { id: "streetside", layer: svgStreetside(projection2, context, dispatch14) },
56881       { id: "mapillary", layer: svgMapillaryImages(projection2, context, dispatch14) },
56882       { id: "mapillary-position", layer: svgMapillaryPosition(projection2, context, dispatch14) },
56883       { id: "mapillary-map-features", layer: svgMapillaryMapFeatures(projection2, context, dispatch14) },
56884       { id: "mapillary-signs", layer: svgMapillarySigns(projection2, context, dispatch14) },
56885       { id: "kartaview", layer: svgKartaviewImages(projection2, context, dispatch14) },
56886       { id: "mapilio", layer: svgMapilioImages(projection2, context, dispatch14) },
56887       { id: "vegbilder", layer: svgVegbilder(projection2, context, dispatch14) },
56888       { id: "panoramax", layer: svgPanoramaxImages(projection2, context, dispatch14) },
56889       { id: "local-photos", layer: svgLocalPhotos(projection2, context, dispatch14) },
56890       { id: "debug", layer: svgDebug(projection2, context, dispatch14) },
56891       { id: "geolocate", layer: svgGeolocate(projection2, context, dispatch14) },
56892       { id: "touch", layer: svgTouch(projection2, context, dispatch14) }
56893     ];
56894     function drawLayers(selection2) {
56895       svg2 = selection2.selectAll(".surface").data([0]);
56896       svg2 = svg2.enter().append("svg").attr("class", "surface").merge(svg2);
56897       var defs = svg2.selectAll(".surface-defs").data([0]);
56898       defs.enter().append("defs").attr("class", "surface-defs");
56899       var groups = svg2.selectAll(".data-layer").data(_layers);
56900       groups.exit().remove();
56901       groups.enter().append("g").attr("class", function(d2) {
56902         return "data-layer " + d2.id;
56903       }).merge(groups).each(function(d2) {
56904         select_default2(this).call(d2.layer);
56905       });
56906     }
56907     drawLayers.all = function() {
56908       return _layers;
56909     };
56910     drawLayers.layer = function(id2) {
56911       var obj = _layers.find(function(o2) {
56912         return o2.id === id2;
56913       });
56914       return obj && obj.layer;
56915     };
56916     drawLayers.only = function(what) {
56917       var arr = [].concat(what);
56918       var all = _layers.map(function(layer) {
56919         return layer.id;
56920       });
56921       return drawLayers.remove(utilArrayDifference(all, arr));
56922     };
56923     drawLayers.remove = function(what) {
56924       var arr = [].concat(what);
56925       arr.forEach(function(id2) {
56926         _layers = _layers.filter(function(o2) {
56927           return o2.id !== id2;
56928         });
56929       });
56930       dispatch14.call("change");
56931       return this;
56932     };
56933     drawLayers.add = function(what) {
56934       var arr = [].concat(what);
56935       arr.forEach(function(obj) {
56936         if ("id" in obj && "layer" in obj) {
56937           _layers.push(obj);
56938         }
56939       });
56940       dispatch14.call("change");
56941       return this;
56942     };
56943     drawLayers.dimensions = function(val) {
56944       if (!arguments.length) return utilGetDimensions(svg2);
56945       utilSetDimensions(svg2, val);
56946       return this;
56947     };
56948     return utilRebind(drawLayers, dispatch14, "on");
56949   }
56950   var init_layers = __esm({
56951     "modules/svg/layers.js"() {
56952       "use strict";
56953       init_src4();
56954       init_src5();
56955       init_data2();
56956       init_local_photos();
56957       init_debug();
56958       init_geolocate();
56959       init_keepRight2();
56960       init_osmose2();
56961       init_streetside();
56962       init_vegbilder();
56963       init_mapillary_images();
56964       init_mapillary_position();
56965       init_mapillary_signs();
56966       init_mapillary_map_features();
56967       init_kartaview_images();
56968       init_mapilio_images();
56969       init_panoramax_images();
56970       init_osm2();
56971       init_notes();
56972       init_touch();
56973       init_util();
56974       init_dimensions();
56975     }
56976   });
56977
56978   // modules/svg/lines.js
56979   var lines_exports = {};
56980   __export(lines_exports, {
56981     svgLines: () => svgLines
56982   });
56983   function onewayArrowColour(tags) {
56984     if (tags.highway === "construction" && tags.bridge) return "white";
56985     if (tags.highway === "pedestrian") return "gray";
56986     if (tags.railway) return "gray";
56987     if (tags.aeroway === "runway") return "white";
56988     return "black";
56989   }
56990   function svgLines(projection2, context) {
56991     var detected = utilDetect();
56992     var highway_stack = {
56993       motorway: 0,
56994       motorway_link: 1,
56995       trunk: 2,
56996       trunk_link: 3,
56997       primary: 4,
56998       primary_link: 5,
56999       secondary: 6,
57000       tertiary: 7,
57001       unclassified: 8,
57002       residential: 9,
57003       service: 10,
57004       busway: 11,
57005       footway: 12
57006     };
57007     function drawTargets(selection2, graph, entities, filter2) {
57008       var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
57009       var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
57010       var getPath = svgPath(projection2).geojson;
57011       var activeID = context.activeID();
57012       var base = context.history().base();
57013       var data = { targets: [], nopes: [] };
57014       entities.forEach(function(way) {
57015         var features = svgSegmentWay(way, graph, activeID);
57016         data.targets.push.apply(data.targets, features.passive);
57017         data.nopes.push.apply(data.nopes, features.active);
57018       });
57019       var targetData = data.targets.filter(getPath);
57020       var targets = selection2.selectAll(".line.target-allowed").filter(function(d2) {
57021         return filter2(d2.properties.entity);
57022       }).data(targetData, function key(d2) {
57023         return d2.id;
57024       });
57025       targets.exit().remove();
57026       var segmentWasEdited = function(d2) {
57027         var wayID = d2.properties.entity.id;
57028         if (!base.entities[wayID] || !(0, import_fast_deep_equal6.default)(graph.entities[wayID].nodes, base.entities[wayID].nodes)) {
57029           return false;
57030         }
57031         return d2.properties.nodes.some(function(n3) {
57032           return !base.entities[n3.id] || !(0, import_fast_deep_equal6.default)(graph.entities[n3.id].loc, base.entities[n3.id].loc);
57033         });
57034       };
57035       targets.enter().append("path").merge(targets).attr("d", getPath).attr("class", function(d2) {
57036         return "way line target target-allowed " + targetClass + d2.id;
57037       }).classed("segment-edited", segmentWasEdited);
57038       var nopeData = data.nopes.filter(getPath);
57039       var nopes = selection2.selectAll(".line.target-nope").filter(function(d2) {
57040         return filter2(d2.properties.entity);
57041       }).data(nopeData, function key(d2) {
57042         return d2.id;
57043       });
57044       nopes.exit().remove();
57045       nopes.enter().append("path").merge(nopes).attr("d", getPath).attr("class", function(d2) {
57046         return "way line target target-nope " + nopeClass + d2.id;
57047       }).classed("segment-edited", segmentWasEdited);
57048     }
57049     function drawLines(selection2, graph, entities, filter2) {
57050       var base = context.history().base();
57051       function waystack(a2, b2) {
57052         var selected = context.selectedIDs();
57053         var scoreA = selected.indexOf(a2.id) !== -1 ? 20 : 0;
57054         var scoreB = selected.indexOf(b2.id) !== -1 ? 20 : 0;
57055         if (a2.tags.highway) {
57056           scoreA -= highway_stack[a2.tags.highway];
57057         }
57058         if (b2.tags.highway) {
57059           scoreB -= highway_stack[b2.tags.highway];
57060         }
57061         return scoreA - scoreB;
57062       }
57063       function drawLineGroup(selection3, klass, isSelected) {
57064         var mode = context.mode();
57065         var isDrawing = mode && /^draw/.test(mode.id);
57066         var selectedClass = !isDrawing && isSelected ? "selected " : "";
57067         var lines = selection3.selectAll("path").filter(filter2).data(getPathData(isSelected), osmEntity.key);
57068         lines.exit().remove();
57069         lines.enter().append("path").attr("class", function(d2) {
57070           var prefix = "way line";
57071           if (!d2.hasInterestingTags()) {
57072             var parentRelations = graph.parentRelations(d2);
57073             var parentMultipolygons = parentRelations.filter(function(relation) {
57074               return relation.isMultipolygon();
57075             });
57076             if (parentMultipolygons.length > 0 && // and only multipolygon relations
57077             parentRelations.length === parentMultipolygons.length) {
57078               prefix = "relation area";
57079             }
57080           }
57081           var oldMPClass = oldMultiPolygonOuters[d2.id] ? "old-multipolygon " : "";
57082           return prefix + " " + klass + " " + selectedClass + oldMPClass + d2.id;
57083         }).classed("added", function(d2) {
57084           return !base.entities[d2.id];
57085         }).classed("geometry-edited", function(d2) {
57086           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);
57087         }).classed("retagged", function(d2) {
57088           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);
57089         }).call(svgTagClasses()).merge(lines).sort(waystack).attr("d", getPath).call(svgTagClasses().tags(svgRelationMemberTags(graph)));
57090         return selection3;
57091       }
57092       function getPathData(isSelected) {
57093         return function() {
57094           var layer = this.parentNode.__data__;
57095           var data = pathdata[layer] || [];
57096           return data.filter(function(d2) {
57097             if (isSelected) {
57098               return context.selectedIDs().indexOf(d2.id) !== -1;
57099             } else {
57100               return context.selectedIDs().indexOf(d2.id) === -1;
57101             }
57102           });
57103         };
57104       }
57105       function addMarkers(layergroup, pathclass, groupclass, groupdata, marker) {
57106         var markergroup = layergroup.selectAll("g." + groupclass).data([pathclass]);
57107         markergroup = markergroup.enter().append("g").attr("class", groupclass).merge(markergroup);
57108         var markers = markergroup.selectAll("path").filter(filter2).data(
57109           function data() {
57110             return groupdata[this.parentNode.__data__] || [];
57111           },
57112           function key(d2) {
57113             return [d2.id, d2.index];
57114           }
57115         );
57116         markers.exit().remove();
57117         markers = markers.enter().append("path").attr("class", pathclass).merge(markers).attr("marker-mid", marker).attr("d", function(d2) {
57118           return d2.d;
57119         });
57120         if (detected.ie) {
57121           markers.each(function() {
57122             this.parentNode.insertBefore(this, this);
57123           });
57124         }
57125       }
57126       var getPath = svgPath(projection2, graph);
57127       var ways = [];
57128       var onewaydata = {};
57129       var sideddata = {};
57130       var oldMultiPolygonOuters = {};
57131       for (var i3 = 0; i3 < entities.length; i3++) {
57132         var entity = entities[i3];
57133         if (entity.geometry(graph) === "line" || entity.geometry(graph) === "area" && entity.sidednessIdentifier && entity.sidednessIdentifier() === "coastline") {
57134           ways.push(entity);
57135         }
57136       }
57137       ways = ways.filter(getPath);
57138       const pathdata = utilArrayGroupBy(ways, (way) => Math.trunc(way.layer()));
57139       Object.keys(pathdata).forEach(function(k2) {
57140         var v2 = pathdata[k2];
57141         var onewayArr = v2.filter(function(d2) {
57142           return d2.isOneWay();
57143         });
57144         var onewaySegments = svgMarkerSegments(
57145           projection2,
57146           graph,
57147           36,
57148           (entity2) => entity2.isOneWayBackwards(),
57149           (entity2) => entity2.isBiDirectional()
57150         );
57151         onewaydata[k2] = utilArrayFlatten(onewayArr.map(onewaySegments));
57152         var sidedArr = v2.filter(function(d2) {
57153           return d2.isSided();
57154         });
57155         var sidedSegments = svgMarkerSegments(
57156           projection2,
57157           graph,
57158           30
57159         );
57160         sideddata[k2] = utilArrayFlatten(sidedArr.map(sidedSegments));
57161       });
57162       var covered = selection2.selectAll(".layer-osm.covered");
57163       var uncovered = selection2.selectAll(".layer-osm.lines");
57164       var touchLayer = selection2.selectAll(".layer-touch.lines");
57165       [covered, uncovered].forEach(function(selection3) {
57166         var range3 = selection3 === covered ? range(-10, 0) : range(0, 11);
57167         var layergroup = selection3.selectAll("g.layergroup").data(range3);
57168         layergroup = layergroup.enter().append("g").attr("class", function(d2) {
57169           return "layergroup layer" + String(d2);
57170         }).merge(layergroup);
57171         layergroup.selectAll("g.linegroup").data(["shadow", "casing", "stroke", "shadow-highlighted", "casing-highlighted", "stroke-highlighted"]).enter().append("g").attr("class", function(d2) {
57172           return "linegroup line-" + d2;
57173         });
57174         layergroup.selectAll("g.line-shadow").call(drawLineGroup, "shadow", false);
57175         layergroup.selectAll("g.line-casing").call(drawLineGroup, "casing", false);
57176         layergroup.selectAll("g.line-stroke").call(drawLineGroup, "stroke", false);
57177         layergroup.selectAll("g.line-shadow-highlighted").call(drawLineGroup, "shadow", true);
57178         layergroup.selectAll("g.line-casing-highlighted").call(drawLineGroup, "casing", true);
57179         layergroup.selectAll("g.line-stroke-highlighted").call(drawLineGroup, "stroke", true);
57180         addMarkers(layergroup, "oneway", "onewaygroup", onewaydata, (d2) => {
57181           const category = onewayArrowColour(graph.entity(d2.id).tags);
57182           return `url(#ideditor-oneway-marker-${category})`;
57183         });
57184         addMarkers(
57185           layergroup,
57186           "sided",
57187           "sidedgroup",
57188           sideddata,
57189           function marker(d2) {
57190             var category = graph.entity(d2.id).sidednessIdentifier();
57191             return "url(#ideditor-sided-marker-" + category + ")";
57192           }
57193         );
57194       });
57195       touchLayer.call(drawTargets, graph, ways, filter2);
57196     }
57197     return drawLines;
57198   }
57199   var import_fast_deep_equal6;
57200   var init_lines = __esm({
57201     "modules/svg/lines.js"() {
57202       "use strict";
57203       import_fast_deep_equal6 = __toESM(require_fast_deep_equal());
57204       init_src();
57205       init_helpers();
57206       init_tag_classes();
57207       init_osm();
57208       init_util();
57209       init_detect();
57210     }
57211   });
57212
57213   // modules/svg/midpoints.js
57214   var midpoints_exports = {};
57215   __export(midpoints_exports, {
57216     svgMidpoints: () => svgMidpoints
57217   });
57218   function svgMidpoints(projection2, context) {
57219     var targetRadius = 8;
57220     function drawTargets(selection2, graph, entities, filter2) {
57221       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
57222       var getTransform = svgPointTransform(projection2).geojson;
57223       var data = entities.map(function(midpoint) {
57224         return {
57225           type: "Feature",
57226           id: midpoint.id,
57227           properties: {
57228             target: true,
57229             entity: midpoint
57230           },
57231           geometry: {
57232             type: "Point",
57233             coordinates: midpoint.loc
57234           }
57235         };
57236       });
57237       var targets = selection2.selectAll(".midpoint.target").filter(function(d2) {
57238         return filter2(d2.properties.entity);
57239       }).data(data, function key(d2) {
57240         return d2.id;
57241       });
57242       targets.exit().remove();
57243       targets.enter().append("circle").attr("r", targetRadius).merge(targets).attr("class", function(d2) {
57244         return "node midpoint target " + fillClass + d2.id;
57245       }).attr("transform", getTransform);
57246     }
57247     function drawMidpoints(selection2, graph, entities, filter2, extent) {
57248       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.midpoints");
57249       var touchLayer = selection2.selectAll(".layer-touch.points");
57250       var mode = context.mode();
57251       if (mode && mode.id !== "select" || !context.map().withinEditableZoom()) {
57252         drawLayer.selectAll(".midpoint").remove();
57253         touchLayer.selectAll(".midpoint.target").remove();
57254         return;
57255       }
57256       var poly = extent.polygon();
57257       var midpoints = {};
57258       for (var i3 = 0; i3 < entities.length; i3++) {
57259         var entity = entities[i3];
57260         if (entity.type !== "way") continue;
57261         if (!filter2(entity)) continue;
57262         if (context.selectedIDs().indexOf(entity.id) < 0) continue;
57263         var nodes = graph.childNodes(entity);
57264         for (var j2 = 0; j2 < nodes.length - 1; j2++) {
57265           var a2 = nodes[j2];
57266           var b2 = nodes[j2 + 1];
57267           var id2 = [a2.id, b2.id].sort().join("-");
57268           if (midpoints[id2]) {
57269             midpoints[id2].parents.push(entity);
57270           } else if (geoVecLength(projection2(a2.loc), projection2(b2.loc)) > 40) {
57271             var point = geoVecInterp(a2.loc, b2.loc, 0.5);
57272             var loc = null;
57273             if (extent.intersects(point)) {
57274               loc = point;
57275             } else {
57276               for (var k2 = 0; k2 < 4; k2++) {
57277                 point = geoLineIntersection([a2.loc, b2.loc], [poly[k2], poly[k2 + 1]]);
57278                 if (point && geoVecLength(projection2(a2.loc), projection2(point)) > 20 && geoVecLength(projection2(b2.loc), projection2(point)) > 20) {
57279                   loc = point;
57280                   break;
57281                 }
57282               }
57283             }
57284             if (loc) {
57285               midpoints[id2] = {
57286                 type: "midpoint",
57287                 id: id2,
57288                 loc,
57289                 edge: [a2.id, b2.id],
57290                 parents: [entity]
57291               };
57292             }
57293           }
57294         }
57295       }
57296       function midpointFilter(d2) {
57297         if (midpoints[d2.id]) return true;
57298         for (var i4 = 0; i4 < d2.parents.length; i4++) {
57299           if (filter2(d2.parents[i4])) {
57300             return true;
57301           }
57302         }
57303         return false;
57304       }
57305       var groups = drawLayer.selectAll(".midpoint").filter(midpointFilter).data(Object.values(midpoints), function(d2) {
57306         return d2.id;
57307       });
57308       groups.exit().remove();
57309       var enter = groups.enter().insert("g", ":first-child").attr("class", "midpoint");
57310       enter.append("polygon").attr("points", "-6,8 10,0 -6,-8").attr("class", "shadow");
57311       enter.append("polygon").attr("points", "-3,4 5,0 -3,-4").attr("class", "fill");
57312       groups = groups.merge(enter).attr("transform", function(d2) {
57313         var translate = svgPointTransform(projection2);
57314         var a3 = graph.entity(d2.edge[0]);
57315         var b3 = graph.entity(d2.edge[1]);
57316         var angle2 = geoAngle(a3, b3, projection2) * (180 / Math.PI);
57317         return translate(d2) + " rotate(" + angle2 + ")";
57318       }).call(svgTagClasses().tags(
57319         function(d2) {
57320           return d2.parents[0].tags;
57321         }
57322       ));
57323       groups.select("polygon.shadow");
57324       groups.select("polygon.fill");
57325       touchLayer.call(drawTargets, graph, Object.values(midpoints), midpointFilter);
57326     }
57327     return drawMidpoints;
57328   }
57329   var init_midpoints = __esm({
57330     "modules/svg/midpoints.js"() {
57331       "use strict";
57332       init_helpers();
57333       init_tag_classes();
57334       init_geo2();
57335     }
57336   });
57337
57338   // modules/svg/points.js
57339   var points_exports = {};
57340   __export(points_exports, {
57341     svgPoints: () => svgPoints
57342   });
57343   function svgPoints(projection2, context) {
57344     function markerPath(selection2, klass) {
57345       selection2.attr("class", klass).attr("transform", "translate(-8, -23)").attr("d", "M 17,8 C 17,13 11,21 8.5,23.5 C 6,21 0,13 0,8 C 0,4 4,-0.5 8.5,-0.5 C 13,-0.5 17,4 17,8 z");
57346     }
57347     function sortY(a2, b2) {
57348       return b2.loc[1] - a2.loc[1];
57349     }
57350     function fastEntityKey(d2) {
57351       var mode = context.mode();
57352       var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
57353       return isMoving ? d2.id : osmEntity.key(d2);
57354     }
57355     function drawTargets(selection2, graph, entities, filter2) {
57356       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
57357       var getTransform = svgPointTransform(projection2).geojson;
57358       var activeID = context.activeID();
57359       var data = [];
57360       entities.forEach(function(node) {
57361         if (activeID === node.id) return;
57362         data.push({
57363           type: "Feature",
57364           id: node.id,
57365           properties: {
57366             target: true,
57367             entity: node
57368           },
57369           geometry: node.asGeoJSON()
57370         });
57371       });
57372       var targets = selection2.selectAll(".point.target").filter(function(d2) {
57373         return filter2(d2.properties.entity);
57374       }).data(data, function key(d2) {
57375         return d2.id;
57376       });
57377       targets.exit().remove();
57378       targets.enter().append("rect").attr("x", -10).attr("y", -26).attr("width", 20).attr("height", 30).merge(targets).attr("class", function(d2) {
57379         return "node point target " + fillClass + d2.id;
57380       }).attr("transform", getTransform);
57381     }
57382     function drawPoints(selection2, graph, entities, filter2) {
57383       var wireframe = context.surface().classed("fill-wireframe");
57384       var zoom = geoScaleToZoom(projection2.scale());
57385       var base = context.history().base();
57386       function renderAsPoint(entity) {
57387         return entity.geometry(graph) === "point" && !(zoom >= 18 && entity.directions(graph, projection2).length);
57388       }
57389       var points = wireframe ? [] : entities.filter(renderAsPoint);
57390       points.sort(sortY);
57391       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.points");
57392       var touchLayer = selection2.selectAll(".layer-touch.points");
57393       var groups = drawLayer.selectAll("g.point").filter(filter2).data(points, fastEntityKey);
57394       groups.exit().remove();
57395       var enter = groups.enter().append("g").attr("class", function(d2) {
57396         return "node point " + d2.id;
57397       }).order();
57398       enter.append("path").call(markerPath, "shadow");
57399       enter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
57400       enter.append("path").call(markerPath, "stroke");
57401       enter.append("use").attr("transform", "translate(-5.5, -20)").attr("class", "icon").attr("width", "12px").attr("height", "12px");
57402       groups = groups.merge(enter).attr("transform", svgPointTransform(projection2)).classed("added", function(d2) {
57403         return !base.entities[d2.id];
57404       }).classed("moved", function(d2) {
57405         return base.entities[d2.id] && !(0, import_fast_deep_equal7.default)(graph.entities[d2.id].loc, base.entities[d2.id].loc);
57406       }).classed("retagged", function(d2) {
57407         return base.entities[d2.id] && !(0, import_fast_deep_equal7.default)(graph.entities[d2.id].tags, base.entities[d2.id].tags);
57408       }).call(svgTagClasses());
57409       groups.select(".shadow");
57410       groups.select(".stroke");
57411       groups.select(".icon").attr("xlink:href", function(entity) {
57412         var preset = _mainPresetIndex.match(entity, graph);
57413         var picon = preset && preset.icon;
57414         return picon ? "#" + picon : "";
57415       });
57416       touchLayer.call(drawTargets, graph, points, filter2);
57417     }
57418     return drawPoints;
57419   }
57420   var import_fast_deep_equal7;
57421   var init_points = __esm({
57422     "modules/svg/points.js"() {
57423       "use strict";
57424       import_fast_deep_equal7 = __toESM(require_fast_deep_equal());
57425       init_geo2();
57426       init_osm();
57427       init_helpers();
57428       init_tag_classes();
57429       init_presets();
57430     }
57431   });
57432
57433   // modules/svg/turns.js
57434   var turns_exports = {};
57435   __export(turns_exports, {
57436     svgTurns: () => svgTurns
57437   });
57438   function svgTurns(projection2, context) {
57439     function icon2(turn) {
57440       var u2 = turn.u ? "-u" : "";
57441       if (turn.no) return "#iD-turn-no" + u2;
57442       if (turn.only) return "#iD-turn-only" + u2;
57443       return "#iD-turn-yes" + u2;
57444     }
57445     function drawTurns(selection2, graph, turns) {
57446       function turnTransform(d2) {
57447         var pxRadius = 50;
57448         var toWay = graph.entity(d2.to.way);
57449         var toPoints = graph.childNodes(toWay).map(function(n3) {
57450           return n3.loc;
57451         }).map(projection2);
57452         var toLength = geoPathLength(toPoints);
57453         var mid = toLength / 2;
57454         var toNode = graph.entity(d2.to.node);
57455         var toVertex = graph.entity(d2.to.vertex);
57456         var a2 = geoAngle(toVertex, toNode, projection2);
57457         var o2 = projection2(toVertex.loc);
57458         var r2 = d2.u ? 0 : !toWay.__via ? pxRadius : Math.min(mid, pxRadius);
57459         return "translate(" + (r2 * Math.cos(a2) + o2[0]) + "," + (r2 * Math.sin(a2) + o2[1]) + ") rotate(" + a2 * 180 / Math.PI + ")";
57460       }
57461       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.turns");
57462       var touchLayer = selection2.selectAll(".layer-touch.turns");
57463       var groups = drawLayer.selectAll("g.turn").data(turns, function(d2) {
57464         return d2.key;
57465       });
57466       groups.exit().remove();
57467       var groupsEnter = groups.enter().append("g").attr("class", function(d2) {
57468         return "turn " + d2.key;
57469       });
57470       var turnsEnter = groupsEnter.filter(function(d2) {
57471         return !d2.u;
57472       });
57473       turnsEnter.append("rect").attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
57474       turnsEnter.append("use").attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
57475       var uEnter = groupsEnter.filter(function(d2) {
57476         return d2.u;
57477       });
57478       uEnter.append("circle").attr("r", "16");
57479       uEnter.append("use").attr("transform", "translate(-16, -16)").attr("width", "32").attr("height", "32");
57480       groups = groups.merge(groupsEnter).attr("opacity", function(d2) {
57481         return d2.direct === false ? "0.7" : null;
57482       }).attr("transform", turnTransform);
57483       groups.select("use").attr("xlink:href", icon2);
57484       groups.select("rect");
57485       groups.select("circle");
57486       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
57487       groups = touchLayer.selectAll("g.turn").data(turns, function(d2) {
57488         return d2.key;
57489       });
57490       groups.exit().remove();
57491       groupsEnter = groups.enter().append("g").attr("class", function(d2) {
57492         return "turn " + d2.key;
57493       });
57494       turnsEnter = groupsEnter.filter(function(d2) {
57495         return !d2.u;
57496       });
57497       turnsEnter.append("rect").attr("class", "target " + fillClass).attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
57498       uEnter = groupsEnter.filter(function(d2) {
57499         return d2.u;
57500       });
57501       uEnter.append("circle").attr("class", "target " + fillClass).attr("r", "16");
57502       groups = groups.merge(groupsEnter).attr("transform", turnTransform);
57503       groups.select("rect");
57504       groups.select("circle");
57505       return this;
57506     }
57507     return drawTurns;
57508   }
57509   var init_turns = __esm({
57510     "modules/svg/turns.js"() {
57511       "use strict";
57512       init_geo2();
57513     }
57514   });
57515
57516   // modules/svg/vertices.js
57517   var vertices_exports = {};
57518   __export(vertices_exports, {
57519     svgVertices: () => svgVertices
57520   });
57521   function svgVertices(projection2, context) {
57522     var radiuses = {
57523       //       z16-, z17,   z18+,  w/icon
57524       shadow: [6, 7.5, 7.5, 12],
57525       stroke: [2.5, 3.5, 3.5, 8],
57526       fill: [1, 1.5, 1.5, 1.5]
57527     };
57528     var _currHoverTarget;
57529     var _currPersistent = {};
57530     var _currHover = {};
57531     var _prevHover = {};
57532     var _currSelected = {};
57533     var _prevSelected = {};
57534     var _radii = {};
57535     function sortY(a2, b2) {
57536       return b2.loc[1] - a2.loc[1];
57537     }
57538     function fastEntityKey(d2) {
57539       var mode = context.mode();
57540       var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
57541       return isMoving ? d2.id : osmEntity.key(d2);
57542     }
57543     function draw(selection2, graph, vertices, sets2, filter2) {
57544       sets2 = sets2 || { selected: {}, important: {}, hovered: {} };
57545       var icons = {};
57546       var directions = {};
57547       var wireframe = context.surface().classed("fill-wireframe");
57548       var zoom = geoScaleToZoom(projection2.scale());
57549       var z2 = zoom < 17 ? 0 : zoom < 18 ? 1 : 2;
57550       var activeID = context.activeID();
57551       var base = context.history().base();
57552       function getIcon(d2) {
57553         var entity = graph.entity(d2.id);
57554         if (entity.id in icons) return icons[entity.id];
57555         icons[entity.id] = entity.hasInterestingTags() && _mainPresetIndex.match(entity, graph).icon;
57556         return icons[entity.id];
57557       }
57558       function getDirections(entity) {
57559         if (entity.id in directions) return directions[entity.id];
57560         var angles = entity.directions(graph, projection2);
57561         directions[entity.id] = angles.length ? angles : false;
57562         return angles;
57563       }
57564       function updateAttributes(selection3) {
57565         ["shadow", "stroke", "fill"].forEach(function(klass) {
57566           var rads = radiuses[klass];
57567           selection3.selectAll("." + klass).each(function(entity) {
57568             var i3 = z2 && getIcon(entity);
57569             var r2 = rads[i3 ? 3 : z2];
57570             if (entity.id !== activeID && entity.isEndpoint(graph) && !entity.isConnected(graph)) {
57571               r2 += 1.5;
57572             }
57573             if (klass === "shadow") {
57574               _radii[entity.id] = r2;
57575             }
57576             select_default2(this).attr("r", r2).attr("visibility", i3 && klass === "fill" ? "hidden" : null);
57577           });
57578         });
57579       }
57580       vertices.sort(sortY);
57581       var groups = selection2.selectAll("g.vertex").filter(filter2).data(vertices, fastEntityKey);
57582       groups.exit().remove();
57583       var enter = groups.enter().append("g").attr("class", function(d2) {
57584         return "node vertex " + d2.id;
57585       }).order();
57586       enter.append("circle").attr("class", "shadow");
57587       enter.append("circle").attr("class", "stroke");
57588       enter.filter(function(d2) {
57589         return d2.hasInterestingTags();
57590       }).append("circle").attr("class", "fill");
57591       groups = groups.merge(enter).attr("transform", svgPointTransform(projection2)).classed("sibling", function(d2) {
57592         return d2.id in sets2.selected;
57593       }).classed("shared", function(d2) {
57594         return graph.isShared(d2);
57595       }).classed("endpoint", function(d2) {
57596         return d2.isEndpoint(graph);
57597       }).classed("added", function(d2) {
57598         return !base.entities[d2.id];
57599       }).classed("moved", function(d2) {
57600         return base.entities[d2.id] && !(0, import_fast_deep_equal8.default)(graph.entities[d2.id].loc, base.entities[d2.id].loc);
57601       }).classed("retagged", function(d2) {
57602         return base.entities[d2.id] && !(0, import_fast_deep_equal8.default)(graph.entities[d2.id].tags, base.entities[d2.id].tags);
57603       }).call(svgTagClasses()).call(updateAttributes);
57604       var iconUse = groups.selectAll(".icon").data(function data(d2) {
57605         return zoom >= 17 && getIcon(d2) ? [d2] : [];
57606       }, fastEntityKey);
57607       iconUse.exit().remove();
57608       iconUse.enter().append("use").attr("class", "icon").attr("width", "12px").attr("height", "12px").attr("transform", "translate(-6, -6)").attr("xlink:href", function(d2) {
57609         var picon = getIcon(d2);
57610         return picon ? "#" + picon : "";
57611       });
57612       var dgroups = groups.selectAll(".viewfieldgroup").data(function data(d2) {
57613         return zoom >= 18 && getDirections(d2) ? [d2] : [];
57614       }, fastEntityKey);
57615       dgroups.exit().remove();
57616       dgroups = dgroups.enter().insert("g", ".shadow").attr("class", "viewfieldgroup").merge(dgroups);
57617       var viewfields = dgroups.selectAll(".viewfield").data(getDirections, function key(d2) {
57618         return osmEntity.key(d2);
57619       });
57620       viewfields.exit().remove();
57621       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) {
57622         return "rotate(" + d2 + ")";
57623       });
57624     }
57625     function drawTargets(selection2, graph, entities, filter2) {
57626       var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
57627       var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
57628       var getTransform = svgPointTransform(projection2).geojson;
57629       var activeID = context.activeID();
57630       var data = { targets: [], nopes: [] };
57631       entities.forEach(function(node) {
57632         if (activeID === node.id) return;
57633         var vertexType = svgPassiveVertex(node, graph, activeID);
57634         if (vertexType !== 0) {
57635           data.targets.push({
57636             type: "Feature",
57637             id: node.id,
57638             properties: {
57639               target: true,
57640               entity: node
57641             },
57642             geometry: node.asGeoJSON()
57643           });
57644         } else {
57645           data.nopes.push({
57646             type: "Feature",
57647             id: node.id + "-nope",
57648             properties: {
57649               nope: true,
57650               target: true,
57651               entity: node
57652             },
57653             geometry: node.asGeoJSON()
57654           });
57655         }
57656       });
57657       var targets = selection2.selectAll(".vertex.target-allowed").filter(function(d2) {
57658         return filter2(d2.properties.entity);
57659       }).data(data.targets, function key(d2) {
57660         return d2.id;
57661       });
57662       targets.exit().remove();
57663       targets.enter().append("circle").attr("r", function(d2) {
57664         return _radii[d2.id] || radiuses.shadow[3];
57665       }).merge(targets).attr("class", function(d2) {
57666         return "node vertex target target-allowed " + targetClass + d2.id;
57667       }).attr("transform", getTransform);
57668       var nopes = selection2.selectAll(".vertex.target-nope").filter(function(d2) {
57669         return filter2(d2.properties.entity);
57670       }).data(data.nopes, function key(d2) {
57671         return d2.id;
57672       });
57673       nopes.exit().remove();
57674       nopes.enter().append("circle").attr("r", function(d2) {
57675         return _radii[d2.properties.entity.id] || radiuses.shadow[3];
57676       }).merge(nopes).attr("class", function(d2) {
57677         return "node vertex target target-nope " + nopeClass + d2.id;
57678       }).attr("transform", getTransform);
57679     }
57680     function renderAsVertex(entity, graph, wireframe, zoom) {
57681       var geometry = entity.geometry(graph);
57682       return geometry === "vertex" || geometry === "point" && (wireframe || zoom >= 18 && entity.directions(graph, projection2).length);
57683     }
57684     function isEditedNode(node, base, head) {
57685       var baseNode = base.entities[node.id];
57686       var headNode = head.entities[node.id];
57687       return !headNode || !baseNode || !(0, import_fast_deep_equal8.default)(headNode.tags, baseNode.tags) || !(0, import_fast_deep_equal8.default)(headNode.loc, baseNode.loc);
57688     }
57689     function getSiblingAndChildVertices(ids, graph, wireframe, zoom) {
57690       var results = {};
57691       var seenIds = {};
57692       function addChildVertices(entity) {
57693         if (seenIds[entity.id]) return;
57694         seenIds[entity.id] = true;
57695         var geometry = entity.geometry(graph);
57696         if (!context.features().isHiddenFeature(entity, graph, geometry)) {
57697           var i3;
57698           if (entity.type === "way") {
57699             for (i3 = 0; i3 < entity.nodes.length; i3++) {
57700               var child = graph.hasEntity(entity.nodes[i3]);
57701               if (child) {
57702                 addChildVertices(child);
57703               }
57704             }
57705           } else if (entity.type === "relation") {
57706             for (i3 = 0; i3 < entity.members.length; i3++) {
57707               var member = graph.hasEntity(entity.members[i3].id);
57708               if (member) {
57709                 addChildVertices(member);
57710               }
57711             }
57712           } else if (renderAsVertex(entity, graph, wireframe, zoom)) {
57713             results[entity.id] = entity;
57714           }
57715         }
57716       }
57717       ids.forEach(function(id2) {
57718         var entity = graph.hasEntity(id2);
57719         if (!entity) return;
57720         if (entity.type === "node") {
57721           if (renderAsVertex(entity, graph, wireframe, zoom)) {
57722             results[entity.id] = entity;
57723             graph.parentWays(entity).forEach(function(entity2) {
57724               addChildVertices(entity2);
57725             });
57726           }
57727         } else {
57728           addChildVertices(entity);
57729         }
57730       });
57731       return results;
57732     }
57733     function drawVertices(selection2, graph, entities, filter2, extent, fullRedraw) {
57734       var wireframe = context.surface().classed("fill-wireframe");
57735       var visualDiff = context.surface().classed("highlight-edited");
57736       var zoom = geoScaleToZoom(projection2.scale());
57737       var mode = context.mode();
57738       var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
57739       var base = context.history().base();
57740       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.vertices");
57741       var touchLayer = selection2.selectAll(".layer-touch.points");
57742       if (fullRedraw) {
57743         _currPersistent = {};
57744         _radii = {};
57745       }
57746       for (var i3 = 0; i3 < entities.length; i3++) {
57747         var entity = entities[i3];
57748         var geometry = entity.geometry(graph);
57749         var keep = false;
57750         if (geometry === "point" && renderAsVertex(entity, graph, wireframe, zoom)) {
57751           _currPersistent[entity.id] = entity;
57752           keep = true;
57753         } else if (geometry === "vertex" && (entity.hasInterestingTags() || entity.isEndpoint(graph) || entity.isConnected(graph) || visualDiff && isEditedNode(entity, base, graph))) {
57754           _currPersistent[entity.id] = entity;
57755           keep = true;
57756         }
57757         if (!keep && !fullRedraw) {
57758           delete _currPersistent[entity.id];
57759         }
57760       }
57761       var sets2 = {
57762         persistent: _currPersistent,
57763         // persistent = important vertices (render always)
57764         selected: _currSelected,
57765         // selected + siblings of selected (render always)
57766         hovered: _currHover
57767         // hovered + siblings of hovered (render only in draw modes)
57768       };
57769       var all = Object.assign({}, isMoving ? _currHover : {}, _currSelected, _currPersistent);
57770       var filterRendered = function(d2) {
57771         return d2.id in _currPersistent || d2.id in _currSelected || d2.id in _currHover || filter2(d2);
57772       };
57773       drawLayer.call(draw, graph, currentVisible(all), sets2, filterRendered);
57774       var filterTouch = function(d2) {
57775         return isMoving ? true : filterRendered(d2);
57776       };
57777       touchLayer.call(drawTargets, graph, currentVisible(all), filterTouch);
57778       function currentVisible(which) {
57779         return Object.keys(which).map(graph.hasEntity, graph).filter(function(entity2) {
57780           return entity2 && entity2.intersects(extent, graph);
57781         });
57782       }
57783     }
57784     drawVertices.drawSelected = function(selection2, graph, extent) {
57785       var wireframe = context.surface().classed("fill-wireframe");
57786       var zoom = geoScaleToZoom(projection2.scale());
57787       _prevSelected = _currSelected || {};
57788       if (context.map().isInWideSelection()) {
57789         _currSelected = {};
57790         context.selectedIDs().forEach(function(id2) {
57791           var entity = graph.hasEntity(id2);
57792           if (!entity) return;
57793           if (entity.type === "node") {
57794             if (renderAsVertex(entity, graph, wireframe, zoom)) {
57795               _currSelected[entity.id] = entity;
57796             }
57797           }
57798         });
57799       } else {
57800         _currSelected = getSiblingAndChildVertices(context.selectedIDs(), graph, wireframe, zoom);
57801       }
57802       var filter2 = function(d2) {
57803         return d2.id in _prevSelected;
57804       };
57805       drawVertices(selection2, graph, Object.values(_prevSelected), filter2, extent, false);
57806     };
57807     drawVertices.drawHover = function(selection2, graph, target, extent) {
57808       if (target === _currHoverTarget) return;
57809       var wireframe = context.surface().classed("fill-wireframe");
57810       var zoom = geoScaleToZoom(projection2.scale());
57811       _prevHover = _currHover || {};
57812       _currHoverTarget = target;
57813       var entity = target && target.properties && target.properties.entity;
57814       if (entity) {
57815         _currHover = getSiblingAndChildVertices([entity.id], graph, wireframe, zoom);
57816       } else {
57817         _currHover = {};
57818       }
57819       var filter2 = function(d2) {
57820         return d2.id in _prevHover;
57821       };
57822       drawVertices(selection2, graph, Object.values(_prevHover), filter2, extent, false);
57823     };
57824     return drawVertices;
57825   }
57826   var import_fast_deep_equal8;
57827   var init_vertices = __esm({
57828     "modules/svg/vertices.js"() {
57829       "use strict";
57830       import_fast_deep_equal8 = __toESM(require_fast_deep_equal());
57831       init_src5();
57832       init_presets();
57833       init_geo2();
57834       init_osm();
57835       init_helpers();
57836       init_tag_classes();
57837     }
57838   });
57839
57840   // modules/svg/index.js
57841   var svg_exports = {};
57842   __export(svg_exports, {
57843     svgAreas: () => svgAreas,
57844     svgData: () => svgData,
57845     svgDebug: () => svgDebug,
57846     svgDefs: () => svgDefs,
57847     svgGeolocate: () => svgGeolocate,
57848     svgIcon: () => svgIcon,
57849     svgKartaviewImages: () => svgKartaviewImages,
57850     svgKeepRight: () => svgKeepRight,
57851     svgLabels: () => svgLabels,
57852     svgLayers: () => svgLayers,
57853     svgLines: () => svgLines,
57854     svgMapilioImages: () => svgMapilioImages,
57855     svgMapillaryImages: () => svgMapillaryImages,
57856     svgMapillarySigns: () => svgMapillarySigns,
57857     svgMarkerSegments: () => svgMarkerSegments,
57858     svgMidpoints: () => svgMidpoints,
57859     svgNotes: () => svgNotes,
57860     svgOsm: () => svgOsm,
57861     svgPanoramaxImages: () => svgPanoramaxImages,
57862     svgPassiveVertex: () => svgPassiveVertex,
57863     svgPath: () => svgPath,
57864     svgPointTransform: () => svgPointTransform,
57865     svgPoints: () => svgPoints,
57866     svgRelationMemberTags: () => svgRelationMemberTags,
57867     svgSegmentWay: () => svgSegmentWay,
57868     svgStreetside: () => svgStreetside,
57869     svgTagClasses: () => svgTagClasses,
57870     svgTagPattern: () => svgTagPattern,
57871     svgTouch: () => svgTouch,
57872     svgTurns: () => svgTurns,
57873     svgVegbilder: () => svgVegbilder,
57874     svgVertices: () => svgVertices
57875   });
57876   var init_svg = __esm({
57877     "modules/svg/index.js"() {
57878       "use strict";
57879       init_areas();
57880       init_data2();
57881       init_debug();
57882       init_defs();
57883       init_keepRight2();
57884       init_icon();
57885       init_geolocate();
57886       init_labels();
57887       init_layers();
57888       init_lines();
57889       init_mapillary_images();
57890       init_mapillary_signs();
57891       init_midpoints();
57892       init_notes();
57893       init_helpers();
57894       init_kartaview_images();
57895       init_osm2();
57896       init_helpers();
57897       init_helpers();
57898       init_helpers();
57899       init_points();
57900       init_helpers();
57901       init_helpers();
57902       init_streetside();
57903       init_vegbilder();
57904       init_tag_classes();
57905       init_tag_pattern();
57906       init_touch();
57907       init_turns();
57908       init_vertices();
57909       init_mapilio_images();
57910       init_panoramax_images();
57911     }
57912   });
57913
57914   // modules/ui/length_indicator.js
57915   var length_indicator_exports = {};
57916   __export(length_indicator_exports, {
57917     uiLengthIndicator: () => uiLengthIndicator
57918   });
57919   function uiLengthIndicator(maxChars) {
57920     var _wrap = select_default2(null);
57921     var _tooltip = uiPopover("tooltip max-length-warning").placement("bottom").hasArrow(true).content(() => (selection2) => {
57922       selection2.text("");
57923       selection2.call(svgIcon("#iD-icon-alert", "inline"));
57924       selection2.call(_t.append("inspector.max_length_reached", { maxChars }));
57925     });
57926     var _silent = false;
57927     var lengthIndicator = function(selection2) {
57928       _wrap = selection2.selectAll("span.length-indicator-wrap").data([0]);
57929       _wrap = _wrap.enter().append("span").merge(_wrap).classed("length-indicator-wrap", true);
57930       selection2.call(_tooltip);
57931     };
57932     lengthIndicator.update = function(val) {
57933       const strLen = utilUnicodeCharsCount(utilCleanOsmString(val, Number.POSITIVE_INFINITY));
57934       let indicator = _wrap.selectAll("span.length-indicator").data([strLen]);
57935       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");
57936       if (_silent) return;
57937       if (strLen > maxChars) {
57938         _tooltip.show();
57939       } else {
57940         _tooltip.hide();
57941       }
57942     };
57943     lengthIndicator.silent = function(val) {
57944       if (!arguments.length) return _silent;
57945       _silent = val;
57946       return lengthIndicator;
57947     };
57948     return lengthIndicator;
57949   }
57950   var init_length_indicator = __esm({
57951     "modules/ui/length_indicator.js"() {
57952       "use strict";
57953       init_src5();
57954       init_localizer();
57955       init_svg();
57956       init_util();
57957       init_popover();
57958     }
57959   });
57960
57961   // modules/ui/fields/combo.js
57962   var combo_exports = {};
57963   __export(combo_exports, {
57964     uiFieldCombo: () => uiFieldCombo,
57965     uiFieldManyCombo: () => uiFieldCombo,
57966     uiFieldMultiCombo: () => uiFieldCombo,
57967     uiFieldNetworkCombo: () => uiFieldCombo,
57968     uiFieldSemiCombo: () => uiFieldCombo,
57969     uiFieldTypeCombo: () => uiFieldCombo
57970   });
57971   function uiFieldCombo(field, context) {
57972     var dispatch14 = dispatch_default("change");
57973     var _isMulti = field.type === "multiCombo" || field.type === "manyCombo";
57974     var _isNetwork = field.type === "networkCombo";
57975     var _isSemi = field.type === "semiCombo";
57976     var _showTagInfoSuggestions = field.type !== "manyCombo" && field.autoSuggestions !== false;
57977     var _allowCustomValues = field.type !== "manyCombo" && field.customValues !== false;
57978     var _snake_case = field.snake_case || field.snake_case === void 0;
57979     var _combobox = uiCombobox(context, "combo-" + field.safeid).caseSensitive(field.caseSensitive).minItems(1);
57980     var _container = select_default2(null);
57981     var _inputWrap = select_default2(null);
57982     var _input = select_default2(null);
57983     var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue());
57984     var _comboData = [];
57985     var _multiData = [];
57986     var _entityIDs = [];
57987     var _tags;
57988     var _countryCode;
57989     var _staticPlaceholder;
57990     var _customOptions = [];
57991     var _dataDeprecated = [];
57992     _mainFileFetcher.get("deprecated").then(function(d2) {
57993       _dataDeprecated = d2;
57994     }).catch(function() {
57995     });
57996     if (_isMulti && field.key && /[^:]$/.test(field.key)) {
57997       field.key += ":";
57998     }
57999     function snake(s2) {
58000       return s2.replace(/\s+/g, "_");
58001     }
58002     function clean2(s2) {
58003       return s2.split(";").map(function(s3) {
58004         return s3.trim();
58005       }).join(";");
58006     }
58007     function tagValue(dval) {
58008       dval = clean2(dval || "");
58009       var found = getOptions(true).find(function(o2) {
58010         return o2.key && clean2(o2.value) === dval;
58011       });
58012       if (found) return found.key;
58013       if (field.type === "typeCombo" && !dval) {
58014         return "yes";
58015       }
58016       return restrictTagValueSpelling(dval) || void 0;
58017     }
58018     function restrictTagValueSpelling(dval) {
58019       if (_snake_case) {
58020         dval = snake(dval);
58021       }
58022       if (!field.caseSensitive) {
58023         dval = dval.toLowerCase();
58024       }
58025       return dval;
58026     }
58027     function getLabelId(field2, v2) {
58028       return field2.hasTextForStringId(`options.${v2}.title`) ? `options.${v2}.title` : `options.${v2}`;
58029     }
58030     function displayValue(tval) {
58031       tval = tval || "";
58032       var stringsField = field.resolveReference("stringsCrossReference");
58033       const labelId = getLabelId(stringsField, tval);
58034       if (stringsField.hasTextForStringId(labelId)) {
58035         return stringsField.t(labelId, { default: tval });
58036       }
58037       if (field.type === "typeCombo" && tval.toLowerCase() === "yes") {
58038         return "";
58039       }
58040       return tval;
58041     }
58042     function renderValue(tval) {
58043       tval = tval || "";
58044       var stringsField = field.resolveReference("stringsCrossReference");
58045       const labelId = getLabelId(stringsField, tval);
58046       if (stringsField.hasTextForStringId(labelId)) {
58047         return stringsField.t.append(labelId, { default: tval });
58048       }
58049       if (field.type === "typeCombo" && tval.toLowerCase() === "yes") {
58050         tval = "";
58051       }
58052       return (selection2) => selection2.text(tval);
58053     }
58054     function objectDifference(a2, b2) {
58055       return a2.filter(function(d1) {
58056         return !b2.some(function(d2) {
58057           return d1.value === d2.value;
58058         });
58059       });
58060     }
58061     function initCombo(selection2, attachTo) {
58062       if (!_allowCustomValues) {
58063         selection2.attr("readonly", "readonly");
58064       }
58065       if (_showTagInfoSuggestions && services.taginfo) {
58066         selection2.call(_combobox.fetcher(setTaginfoValues), attachTo);
58067         setTaginfoValues("", setPlaceholder);
58068       } else {
58069         selection2.call(_combobox, attachTo);
58070         setTimeout(() => setStaticValues(setPlaceholder), 0);
58071       }
58072     }
58073     function getOptions(allOptions) {
58074       var stringsField = field.resolveReference("stringsCrossReference");
58075       if (!(field.options || stringsField.options)) return [];
58076       let options2;
58077       if (allOptions !== true) {
58078         options2 = field.options || stringsField.options;
58079       } else {
58080         options2 = [].concat(field.options, stringsField.options).filter(Boolean);
58081       }
58082       const result = options2.map(function(v2) {
58083         const labelId = getLabelId(stringsField, v2);
58084         return {
58085           key: v2,
58086           value: stringsField.t(labelId, { default: v2 }),
58087           title: stringsField.t(`options.${v2}.description`, { default: v2 }),
58088           display: addComboboxIcons(stringsField.t.append(labelId, { default: v2 }), v2),
58089           klass: stringsField.hasTextForStringId(labelId) ? "" : "raw-option"
58090         };
58091       });
58092       return [...result, ..._customOptions];
58093     }
58094     function hasStaticValues() {
58095       return getOptions().length > 0;
58096     }
58097     function setStaticValues(callback, filter2) {
58098       _comboData = getOptions();
58099       if (filter2 !== void 0) {
58100         _comboData = _comboData.filter(filter2);
58101       }
58102       _comboData = objectDifference(_comboData, _multiData);
58103       _combobox.data(_comboData);
58104       _container.classed("empty-combobox", _comboData.length === 0);
58105       if (callback) callback(_comboData);
58106     }
58107     function setTaginfoValues(q2, callback) {
58108       var queryFilter = (d2) => d2.value.toLowerCase().includes(q2.toLowerCase()) || d2.key.toLowerCase().includes(q2.toLowerCase());
58109       if (hasStaticValues()) {
58110         setStaticValues(callback, queryFilter);
58111       }
58112       var stringsField = field.resolveReference("stringsCrossReference");
58113       var fn = _isMulti ? "multikeys" : "values";
58114       var query = (_isMulti ? field.key : "") + q2;
58115       var hasCountryPrefix = _isNetwork && _countryCode && _countryCode.indexOf(q2.toLowerCase()) === 0;
58116       if (hasCountryPrefix) {
58117         query = _countryCode + ":";
58118       }
58119       var params = {
58120         debounce: q2 !== "",
58121         key: field.key,
58122         query
58123       };
58124       if (_entityIDs.length) {
58125         params.geometry = context.graph().geometry(_entityIDs[0]);
58126       }
58127       services.taginfo[fn](params, function(err, data) {
58128         if (err) return;
58129         data = data.filter((d2) => field.type !== "typeCombo" || d2.value !== "yes");
58130         data = data.filter((d2) => {
58131           var value = d2.value;
58132           if (_isMulti) {
58133             value = value.slice(field.key.length);
58134           }
58135           return value === restrictTagValueSpelling(value);
58136         });
58137         var deprecatedValues = deprecatedTagValuesByKey(_dataDeprecated)[field.key];
58138         if (deprecatedValues) {
58139           data = data.filter((d2) => !deprecatedValues.includes(d2.value));
58140         }
58141         if (hasCountryPrefix) {
58142           data = data.filter((d2) => d2.value.toLowerCase().indexOf(_countryCode + ":") === 0);
58143         }
58144         const additionalOptions = (field.options || stringsField.options || []).filter((v2) => !data.some((dv) => dv.value === (_isMulti ? field.key + v2 : v2))).map((v2) => ({ value: v2 }));
58145         _container.classed("empty-combobox", data.length === 0);
58146         _comboData = data.concat(additionalOptions).map(function(d2) {
58147           var v2 = d2.value;
58148           if (_isMulti) v2 = v2.replace(field.key, "");
58149           const labelId = getLabelId(stringsField, v2);
58150           var isLocalizable = stringsField.hasTextForStringId(labelId);
58151           var label = stringsField.t(labelId, { default: v2 });
58152           return {
58153             key: v2,
58154             value: label,
58155             title: stringsField.t(`options.${v2}.description`, { default: isLocalizable ? v2 : d2.title !== label ? d2.title : "" }),
58156             display: addComboboxIcons(stringsField.t.append(labelId, { default: v2 }), v2),
58157             klass: isLocalizable ? "" : "raw-option"
58158           };
58159         });
58160         _comboData = _comboData.filter(queryFilter);
58161         _comboData = objectDifference(_comboData, _multiData);
58162         if (callback) callback(_comboData, hasStaticValues());
58163       });
58164     }
58165     function addComboboxIcons(disp, value) {
58166       const iconsField = field.resolveReference("iconsCrossReference");
58167       if (iconsField.icons) {
58168         return function(selection2) {
58169           var span = selection2.insert("span", ":first-child").attr("class", "tag-value-icon");
58170           if (iconsField.icons[value]) {
58171             span.call(svgIcon(`#${iconsField.icons[value]}`));
58172           }
58173           disp.call(this, selection2);
58174         };
58175       }
58176       return disp;
58177     }
58178     function setPlaceholder(values) {
58179       if (_isMulti || _isSemi) {
58180         _staticPlaceholder = field.placeholder() || _t("inspector.add");
58181       } else {
58182         var vals = values.map(function(d2) {
58183           return d2.value;
58184         }).filter(function(s2) {
58185           return s2.length < 20;
58186         });
58187         var placeholders = vals.length > 1 ? vals : values.map(function(d2) {
58188           return d2.key;
58189         });
58190         _staticPlaceholder = field.placeholder() || placeholders.slice(0, 3).join(", ");
58191       }
58192       if (!/(…|\.\.\.)$/.test(_staticPlaceholder)) {
58193         _staticPlaceholder += "\u2026";
58194       }
58195       var ph;
58196       if (!_isMulti && !_isSemi && _tags && Array.isArray(_tags[field.key])) {
58197         ph = _t("inspector.multiple_values");
58198       } else {
58199         ph = _staticPlaceholder;
58200       }
58201       _container.selectAll("input").attr("placeholder", ph);
58202       var hideAdd = !_allowCustomValues && !values.length;
58203       _container.selectAll(".chiplist .input-wrap").style("display", hideAdd ? "none" : null);
58204     }
58205     function change() {
58206       var t2 = {};
58207       var val;
58208       if (_isMulti || _isSemi) {
58209         var vals;
58210         if (_isMulti) {
58211           vals = [tagValue(utilGetSetValue(_input))];
58212         } else if (_isSemi) {
58213           val = tagValue(utilGetSetValue(_input)) || "";
58214           val = val.replace(/,/g, ";");
58215           vals = val.split(";");
58216         }
58217         vals = vals.filter(Boolean);
58218         if (!vals.length) return;
58219         _container.classed("active", false);
58220         utilGetSetValue(_input, "");
58221         if (_isMulti) {
58222           utilArrayUniq(vals).forEach(function(v2) {
58223             var key = (field.key || "") + v2;
58224             if (_tags) {
58225               var old = _tags[key];
58226               if (typeof old === "string" && old.toLowerCase() !== "no") return;
58227             }
58228             key = context.cleanTagKey(key);
58229             field.keys.push(key);
58230             t2[key] = "yes";
58231           });
58232         } else if (_isSemi) {
58233           var arr = _multiData.map(function(d2) {
58234             return d2.key;
58235           });
58236           arr = arr.concat(vals);
58237           t2[field.key] = context.cleanTagValue(utilArrayUniq(arr).filter(Boolean).join(";"));
58238         }
58239         window.setTimeout(function() {
58240           _input.node().focus();
58241         }, 10);
58242       } else {
58243         var rawValue = utilGetSetValue(_input);
58244         if (!rawValue && Array.isArray(_tags[field.key])) return;
58245         val = context.cleanTagValue(tagValue(rawValue));
58246         t2[field.key] = val || void 0;
58247       }
58248       dispatch14.call("change", this, t2);
58249     }
58250     function removeMultikey(d3_event, d2) {
58251       d3_event.preventDefault();
58252       d3_event.stopPropagation();
58253       var t2 = {};
58254       if (_isMulti) {
58255         t2[d2.key] = void 0;
58256       } else if (_isSemi) {
58257         var arr = _multiData.map(function(md) {
58258           return md.key === d2.key ? null : md.key;
58259         }).filter(Boolean);
58260         arr = utilArrayUniq(arr);
58261         t2[field.key] = arr.length ? arr.join(";") : void 0;
58262         _lengthIndicator.update(t2[field.key]);
58263       }
58264       dispatch14.call("change", this, t2);
58265     }
58266     function invertMultikey(d3_event, d2) {
58267       d3_event.preventDefault();
58268       d3_event.stopPropagation();
58269       var t2 = {};
58270       if (_isMulti) {
58271         t2[d2.key] = _tags[d2.key] === "yes" ? "no" : "yes";
58272       }
58273       dispatch14.call("change", this, t2);
58274     }
58275     function combo(selection2) {
58276       _container = selection2.selectAll(".form-field-input-wrap").data([0]);
58277       var type2 = _isMulti || _isSemi ? "multicombo" : "combo";
58278       _container = _container.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + type2).merge(_container);
58279       if (_isMulti || _isSemi) {
58280         _container = _container.selectAll(".chiplist").data([0]);
58281         var listClass = "chiplist";
58282         if (field.key === "destination" || field.key === "via") {
58283           listClass += " full-line-chips";
58284         }
58285         _container = _container.enter().append("ul").attr("class", listClass).on("click", function() {
58286           window.setTimeout(function() {
58287             _input.node().focus();
58288           }, 10);
58289         }).merge(_container);
58290         _inputWrap = _container.selectAll(".input-wrap").data([0]);
58291         _inputWrap = _inputWrap.enter().append("li").attr("class", "input-wrap").merge(_inputWrap);
58292         var hideAdd = !_allowCustomValues && !_comboData.length;
58293         _inputWrap.style("display", hideAdd ? "none" : null);
58294         _input = _inputWrap.selectAll("input").data([0]);
58295       } else {
58296         _input = _container.selectAll("input").data([0]);
58297       }
58298       _input = _input.enter().append("input").attr("type", "text").attr("id", field.domId).call(utilNoAuto).call(initCombo, _container).merge(_input);
58299       if (_isSemi) {
58300         _inputWrap.call(_lengthIndicator);
58301       } else if (!_isMulti) {
58302         _container.call(_lengthIndicator);
58303       }
58304       if (_isNetwork) {
58305         var extent = combinedEntityExtent();
58306         var countryCode = extent && iso1A2Code(extent.center());
58307         _countryCode = countryCode && countryCode.toLowerCase();
58308       }
58309       _input.on("change", change).on("blur", change).on("input", function() {
58310         let val = utilGetSetValue(_input);
58311         updateIcon(val);
58312         if (_isSemi && _tags[field.key]) {
58313           val += ";" + _tags[field.key];
58314         }
58315         _lengthIndicator.update(val);
58316       });
58317       _input.on("keydown.field", function(d3_event) {
58318         switch (d3_event.keyCode) {
58319           case 13:
58320             _input.node().blur();
58321             d3_event.stopPropagation();
58322             break;
58323         }
58324       });
58325       if (_isMulti || _isSemi) {
58326         _combobox.on("accept", function() {
58327           _input.node().blur();
58328           _input.node().focus();
58329         });
58330         _input.on("focus", function() {
58331           _container.classed("active", true);
58332         });
58333       }
58334       _combobox.on("cancel", function() {
58335         _input.node().blur();
58336       }).on("update", function() {
58337         updateIcon(utilGetSetValue(_input));
58338       });
58339     }
58340     function updateIcon(value) {
58341       value = tagValue(value);
58342       let container = _container;
58343       if (field.type === "multiCombo" || field.type === "semiCombo") {
58344         container = _container.select(".input-wrap");
58345       }
58346       const iconsField = field.resolveReference("iconsCrossReference");
58347       if (iconsField.icons) {
58348         container.selectAll(".tag-value-icon").remove();
58349         if (iconsField.icons[value]) {
58350           container.selectAll(".tag-value-icon").data([value]).enter().insert("div", "input").attr("class", "tag-value-icon").call(svgIcon(`#${iconsField.icons[value]}`));
58351         }
58352       }
58353     }
58354     combo.tags = function(tags) {
58355       _tags = tags;
58356       var stringsField = field.resolveReference("stringsCrossReference");
58357       var isMixed = Array.isArray(tags[field.key]);
58358       var showsValue = (value) => !isMixed && value && !(field.type === "typeCombo" && value === "yes");
58359       var isRawValue = (value) => showsValue(value) && !stringsField.hasTextForStringId(`options.${value}`) && !stringsField.hasTextForStringId(`options.${value}.title`);
58360       var isKnownValue = (value) => showsValue(value) && !isRawValue(value);
58361       var isReadOnly = !_allowCustomValues;
58362       if (_isMulti || _isSemi) {
58363         _multiData = [];
58364         var maxLength;
58365         if (_isMulti) {
58366           for (var k2 in tags) {
58367             if (field.key && k2.indexOf(field.key) !== 0) continue;
58368             if (!field.key && field.keys.indexOf(k2) === -1) continue;
58369             var v2 = tags[k2];
58370             var suffix = field.key ? k2.slice(field.key.length) : k2;
58371             _multiData.push({
58372               key: k2,
58373               value: displayValue(suffix),
58374               display: addComboboxIcons(renderValue(suffix), suffix),
58375               state: typeof v2 === "string" ? v2.toLowerCase() : "",
58376               isMixed: Array.isArray(v2)
58377             });
58378           }
58379           if (field.key) {
58380             field.keys = _multiData.map(function(d2) {
58381               return d2.key;
58382             });
58383             maxLength = context.maxCharsForTagKey() - utilUnicodeCharsCount(field.key);
58384           } else {
58385             maxLength = context.maxCharsForTagKey();
58386           }
58387         } else if (_isSemi) {
58388           var allValues = [];
58389           var commonValues;
58390           if (Array.isArray(tags[field.key])) {
58391             tags[field.key].forEach(function(tagVal) {
58392               var thisVals = utilArrayUniq((tagVal || "").split(";")).filter(Boolean);
58393               allValues = allValues.concat(thisVals);
58394               if (!commonValues) {
58395                 commonValues = thisVals;
58396               } else {
58397                 commonValues = commonValues.filter((value) => thisVals.includes(value));
58398               }
58399             });
58400             allValues = utilArrayUniq(allValues).filter(Boolean);
58401           } else {
58402             allValues = utilArrayUniq((tags[field.key] || "").split(";")).filter(Boolean);
58403             commonValues = allValues;
58404           }
58405           _multiData = allValues.map(function(v3) {
58406             return {
58407               key: v3,
58408               value: displayValue(v3),
58409               display: addComboboxIcons(renderValue(v3), v3),
58410               isMixed: !commonValues.includes(v3)
58411             };
58412           });
58413           var currLength = utilUnicodeCharsCount(commonValues.join(";"));
58414           maxLength = context.maxCharsForTagValue() - currLength;
58415           if (currLength > 0) {
58416             maxLength -= 1;
58417           }
58418         }
58419         maxLength = Math.max(0, maxLength);
58420         var hideAdd = maxLength <= 0 || !_allowCustomValues && !_comboData.length;
58421         _container.selectAll(".chiplist .input-wrap").style("display", hideAdd ? "none" : null);
58422         var allowDragAndDrop = _isSemi && !Array.isArray(tags[field.key]);
58423         var chips = _container.selectAll(".chip").data(_multiData);
58424         chips.exit().remove();
58425         var enter = chips.enter().insert("li", ".input-wrap").attr("class", "chip");
58426         enter.append("span");
58427         const field_buttons = enter.append("div").attr("class", "field_buttons");
58428         field_buttons.append("a").attr("class", "remove");
58429         chips = chips.merge(enter).order().classed("raw-value", function(d2) {
58430           var k3 = d2.key;
58431           if (_isMulti) k3 = k3.replace(field.key, "");
58432           return !stringsField.hasTextForStringId("options." + k3);
58433         }).classed("draggable", allowDragAndDrop).classed("mixed", function(d2) {
58434           return d2.isMixed;
58435         }).attr("title", function(d2) {
58436           if (d2.isMixed) {
58437             return _t("inspector.unshared_value_tooltip");
58438           }
58439           if (!["yes", "no"].includes(d2.state)) {
58440             return d2.state;
58441           }
58442           return null;
58443         }).classed("negated", (d2) => d2.state === "no");
58444         if (!_isSemi) {
58445           chips.selectAll("input[type=checkbox]").remove();
58446           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);
58447         }
58448         if (allowDragAndDrop) {
58449           registerDragAndDrop(chips);
58450         }
58451         chips.each(function(d2) {
58452           const selection2 = select_default2(this);
58453           const text_span = selection2.select("span");
58454           const field_buttons2 = selection2.select(".field_buttons");
58455           const clean_value = d2.value.trim();
58456           text_span.text("");
58457           if (!field_buttons2.select("button").empty()) {
58458             field_buttons2.select("button").remove();
58459           }
58460           if (clean_value.startsWith("https://")) {
58461             text_span.text(clean_value);
58462             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) {
58463               d3_event.preventDefault();
58464               window.open(clean_value, "_blank");
58465             });
58466             return;
58467           }
58468           if (d2.display) {
58469             d2.display(text_span);
58470             return;
58471           }
58472           text_span.text(d2.value);
58473         });
58474         chips.select("a.remove").attr("href", "#").on("click", removeMultikey).attr("class", "remove").text("\xD7");
58475         updateIcon("");
58476       } else {
58477         var mixedValues = isMixed && tags[field.key].map(function(val) {
58478           return displayValue(val);
58479         }).filter(Boolean);
58480         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) {
58481           if (isReadOnly && isKnownValue(tags[field.key]) && (d3_event.keyCode === utilKeybinding.keyCodes["\u232B"] || d3_event.keyCode === utilKeybinding.keyCodes["\u2326"])) {
58482             d3_event.preventDefault();
58483             d3_event.stopPropagation();
58484             var t2 = {};
58485             t2[field.key] = void 0;
58486             dispatch14.call("change", this, t2);
58487           }
58488         });
58489         if (!Array.isArray(tags[field.key])) {
58490           updateIcon(tags[field.key]);
58491         }
58492         if (!isMixed) {
58493           _lengthIndicator.update(tags[field.key]);
58494         }
58495       }
58496       const refreshStyles = () => {
58497         _input.data([tagValue(utilGetSetValue(_input))]).classed("raw-value", isRawValue).classed("known-value", isKnownValue);
58498       };
58499       _input.on("input.refreshStyles", refreshStyles);
58500       _combobox.on("update.refreshStyles", refreshStyles);
58501       refreshStyles();
58502     };
58503     function registerDragAndDrop(selection2) {
58504       var dragOrigin, targetIndex;
58505       selection2.call(
58506         drag_default().on("start", function(d3_event) {
58507           dragOrigin = {
58508             x: d3_event.x,
58509             y: d3_event.y
58510           };
58511           targetIndex = null;
58512         }).on("drag", function(d3_event) {
58513           var x2 = d3_event.x - dragOrigin.x, y2 = d3_event.y - dragOrigin.y;
58514           if (!select_default2(this).classed("dragging") && // don't display drag until dragging beyond a distance threshold
58515           Math.sqrt(Math.pow(x2, 2) + Math.pow(y2, 2)) <= 5) return;
58516           var index = selection2.nodes().indexOf(this);
58517           select_default2(this).classed("dragging", true);
58518           targetIndex = null;
58519           var targetIndexOffsetTop = null;
58520           var draggedTagWidth = select_default2(this).node().offsetWidth;
58521           if (field.key === "destination" || field.key === "via") {
58522             _container.selectAll(".chip").style("transform", function(d2, index2) {
58523               var node = select_default2(this).node();
58524               if (index === index2) {
58525                 return "translate(" + x2 + "px, " + y2 + "px)";
58526               } else if (index2 > index && d3_event.y > node.offsetTop) {
58527                 if (targetIndex === null || index2 > targetIndex) {
58528                   targetIndex = index2;
58529                 }
58530                 return "translateY(-100%)";
58531               } else if (index2 < index && d3_event.y < node.offsetTop + node.offsetHeight) {
58532                 if (targetIndex === null || index2 < targetIndex) {
58533                   targetIndex = index2;
58534                 }
58535                 return "translateY(100%)";
58536               }
58537               return null;
58538             });
58539           } else {
58540             _container.selectAll(".chip").each(function(d2, index2) {
58541               var node = select_default2(this).node();
58542               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) {
58543                 targetIndex = index2;
58544                 targetIndexOffsetTop = node.offsetTop;
58545               }
58546             }).style("transform", function(d2, index2) {
58547               var node = select_default2(this).node();
58548               if (index === index2) {
58549                 return "translate(" + x2 + "px, " + y2 + "px)";
58550               }
58551               if (node.offsetTop === targetIndexOffsetTop) {
58552                 if (index2 < index && index2 >= targetIndex) {
58553                   return "translateX(" + draggedTagWidth + "px)";
58554                 } else if (index2 > index && index2 <= targetIndex) {
58555                   return "translateX(-" + draggedTagWidth + "px)";
58556                 }
58557               }
58558               return null;
58559             });
58560           }
58561         }).on("end", function() {
58562           if (!select_default2(this).classed("dragging")) {
58563             return;
58564           }
58565           var index = selection2.nodes().indexOf(this);
58566           select_default2(this).classed("dragging", false);
58567           _container.selectAll(".chip").style("transform", null);
58568           if (typeof targetIndex === "number") {
58569             var element = _multiData[index];
58570             _multiData.splice(index, 1);
58571             _multiData.splice(targetIndex, 0, element);
58572             var t2 = {};
58573             if (_multiData.length) {
58574               t2[field.key] = _multiData.map(function(element2) {
58575                 return element2.key;
58576               }).join(";");
58577             } else {
58578               t2[field.key] = void 0;
58579             }
58580             dispatch14.call("change", this, t2);
58581           }
58582           dragOrigin = void 0;
58583           targetIndex = void 0;
58584         })
58585       );
58586     }
58587     combo.setCustomOptions = (newValue) => {
58588       _customOptions = newValue;
58589     };
58590     combo.focus = function() {
58591       _input.node().focus();
58592     };
58593     combo.entityIDs = function(val) {
58594       if (!arguments.length) return _entityIDs;
58595       _entityIDs = val;
58596       return combo;
58597     };
58598     function combinedEntityExtent() {
58599       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
58600     }
58601     return utilRebind(combo, dispatch14, "on");
58602   }
58603   var init_combo = __esm({
58604     "modules/ui/fields/combo.js"() {
58605       "use strict";
58606       init_src4();
58607       init_src5();
58608       init_src6();
58609       init_country_coder();
58610       init_file_fetcher();
58611       init_localizer();
58612       init_services();
58613       init_combobox();
58614       init_icon();
58615       init_keybinding();
58616       init_util();
58617       init_length_indicator();
58618       init_deprecated();
58619     }
58620   });
58621
58622   // modules/behavior/hash.js
58623   var hash_exports = {};
58624   __export(hash_exports, {
58625     behaviorHash: () => behaviorHash
58626   });
58627   function behaviorHash(context) {
58628     var _cachedHash = null;
58629     var _latitudeLimit = 90 - 1e-8;
58630     function computedHashParameters() {
58631       var map2 = context.map();
58632       var center = map2.center();
58633       var zoom = map2.zoom();
58634       var precision3 = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
58635       var oldParams = utilObjectOmit(
58636         utilStringQs(window.location.hash),
58637         ["comment", "source", "hashtags", "walkthrough"]
58638       );
58639       var newParams = {};
58640       delete oldParams.id;
58641       var selected = context.selectedIDs().filter(function(id2) {
58642         return context.hasEntity(id2);
58643       });
58644       if (selected.length) {
58645         newParams.id = selected.join(",");
58646       } else if (context.selectedNoteID()) {
58647         newParams.id = `note/${context.selectedNoteID()}`;
58648       }
58649       newParams.map = zoom.toFixed(2) + "/" + center[1].toFixed(precision3) + "/" + center[0].toFixed(precision3);
58650       return Object.assign(oldParams, newParams);
58651     }
58652     function computedHash() {
58653       return "#" + utilQsString(computedHashParameters(), true);
58654     }
58655     function computedTitle(includeChangeCount) {
58656       var baseTitle = context.documentTitleBase() || "iD";
58657       var contextual;
58658       var changeCount;
58659       var titleID;
58660       var selected = context.selectedIDs().filter(function(id2) {
58661         return context.hasEntity(id2);
58662       });
58663       if (selected.length) {
58664         var firstLabel = utilDisplayLabel(context.entity(selected[0]), context.graph());
58665         if (selected.length > 1) {
58666           contextual = _t("title.labeled_and_more", {
58667             labeled: firstLabel,
58668             count: selected.length - 1
58669           });
58670         } else {
58671           contextual = firstLabel;
58672         }
58673         titleID = "context";
58674       }
58675       if (includeChangeCount) {
58676         changeCount = context.history().difference().summary().length;
58677         if (changeCount > 0) {
58678           titleID = contextual ? "changes_context" : "changes";
58679         }
58680       }
58681       if (titleID) {
58682         return _t("title.format." + titleID, {
58683           changes: changeCount,
58684           base: baseTitle,
58685           context: contextual
58686         });
58687       }
58688       return baseTitle;
58689     }
58690     function updateTitle(includeChangeCount) {
58691       if (!context.setsDocumentTitle()) return;
58692       var newTitle = computedTitle(includeChangeCount);
58693       if (document.title !== newTitle) {
58694         document.title = newTitle;
58695       }
58696     }
58697     function updateHashIfNeeded() {
58698       if (context.inIntro()) return;
58699       var latestHash = computedHash();
58700       if (_cachedHash !== latestHash) {
58701         _cachedHash = latestHash;
58702         window.history.replaceState(null, computedTitle(
58703           false
58704           /* includeChangeCount */
58705         ), latestHash);
58706         updateTitle(
58707           true
58708           /* includeChangeCount */
58709         );
58710         const q2 = utilStringQs(latestHash);
58711         if (q2.map) {
58712           corePreferences("map-location", q2.map);
58713         }
58714       }
58715     }
58716     var _throttledUpdate = throttle_default(updateHashIfNeeded, 500);
58717     var _throttledUpdateTitle = throttle_default(function() {
58718       updateTitle(
58719         true
58720         /* includeChangeCount */
58721       );
58722     }, 500);
58723     function hashchange() {
58724       if (window.location.hash === _cachedHash) return;
58725       _cachedHash = window.location.hash;
58726       var q2 = utilStringQs(_cachedHash);
58727       var mapArgs = (q2.map || "").split("/").map(Number);
58728       if (mapArgs.length < 3 || mapArgs.some(isNaN)) {
58729         updateHashIfNeeded();
58730       } else {
58731         if (_cachedHash === computedHash()) return;
58732         var mode = context.mode();
58733         context.map().centerZoom([mapArgs[2], Math.min(_latitudeLimit, Math.max(-_latitudeLimit, mapArgs[1]))], mapArgs[0]);
58734         if (q2.id && mode) {
58735           var ids = q2.id.split(",").filter(function(id2) {
58736             return context.hasEntity(id2) || id2.startsWith("note/");
58737           });
58738           if (ids.length && ["browse", "select-note", "select"].includes(mode.id)) {
58739             if (ids.length === 1 && ids[0].startsWith("note/")) {
58740               context.enter(modeSelectNote(context, ids[0]));
58741             } else if (!utilArrayIdentical(mode.selectedIDs(), ids)) {
58742               context.enter(modeSelect(context, ids));
58743             }
58744             return;
58745           }
58746         }
58747         var center = context.map().center();
58748         var dist = geoSphericalDistance(center, [mapArgs[2], mapArgs[1]]);
58749         var maxdist = 500;
58750         if (mode && mode.id.match(/^draw/) !== null && dist > maxdist) {
58751           context.enter(modeBrowse(context));
58752           return;
58753         }
58754       }
58755     }
58756     function behavior() {
58757       context.map().on("move.behaviorHash", _throttledUpdate);
58758       context.history().on("change.behaviorHash", _throttledUpdateTitle);
58759       context.on("enter.behaviorHash", _throttledUpdate);
58760       select_default2(window).on("hashchange.behaviorHash", hashchange);
58761       var q2 = utilStringQs(window.location.hash);
58762       if (q2.id) {
58763         const selectIds = q2.id.split(",");
58764         if (selectIds.length === 1 && selectIds[0].startsWith("note/")) {
58765           const noteId = selectIds[0].split("/")[1];
58766           context.moveToNote(noteId, !q2.map);
58767         } else {
58768           context.zoomToEntities(
58769             // convert ids to short form id: node/123 -> n123
58770             selectIds.map((id2) => id2.replace(/([nwr])[^/]*\//, "$1")),
58771             !q2.map
58772           );
58773         }
58774       }
58775       if (q2.walkthrough === "true") {
58776         behavior.startWalkthrough = true;
58777       }
58778       if (q2.map) {
58779         behavior.hadLocation = true;
58780       } else if (!q2.id && corePreferences("map-location")) {
58781         const mapArgs = corePreferences("map-location").split("/").map(Number);
58782         context.map().centerZoom([mapArgs[2], Math.min(_latitudeLimit, Math.max(-_latitudeLimit, mapArgs[1]))], mapArgs[0]);
58783         updateHashIfNeeded();
58784         behavior.hadLocation = true;
58785       }
58786       hashchange();
58787       updateTitle(false);
58788     }
58789     behavior.off = function() {
58790       _throttledUpdate.cancel();
58791       _throttledUpdateTitle.cancel();
58792       context.map().on("move.behaviorHash", null);
58793       context.on("enter.behaviorHash", null);
58794       select_default2(window).on("hashchange.behaviorHash", null);
58795       window.location.hash = "";
58796     };
58797     return behavior;
58798   }
58799   var init_hash = __esm({
58800     "modules/behavior/hash.js"() {
58801       "use strict";
58802       init_throttle();
58803       init_src5();
58804       init_geo2();
58805       init_browse();
58806       init_modes2();
58807       init_util();
58808       init_array3();
58809       init_utilDisplayLabel();
58810       init_localizer();
58811       init_preferences();
58812     }
58813   });
58814
58815   // modules/behavior/index.js
58816   var behavior_exports = {};
58817   __export(behavior_exports, {
58818     behaviorAddWay: () => behaviorAddWay,
58819     behaviorBreathe: () => behaviorBreathe,
58820     behaviorDrag: () => behaviorDrag,
58821     behaviorDraw: () => behaviorDraw,
58822     behaviorDrawWay: () => behaviorDrawWay,
58823     behaviorEdit: () => behaviorEdit,
58824     behaviorHash: () => behaviorHash,
58825     behaviorHover: () => behaviorHover,
58826     behaviorLasso: () => behaviorLasso,
58827     behaviorOperation: () => behaviorOperation,
58828     behaviorPaste: () => behaviorPaste,
58829     behaviorSelect: () => behaviorSelect
58830   });
58831   var init_behavior = __esm({
58832     "modules/behavior/index.js"() {
58833       "use strict";
58834       init_add_way();
58835       init_breathe();
58836       init_drag2();
58837       init_draw_way();
58838       init_draw();
58839       init_edit();
58840       init_hash();
58841       init_hover();
58842       init_lasso2();
58843       init_operation();
58844       init_paste();
58845       init_select4();
58846     }
58847   });
58848
58849   // modules/ui/account.js
58850   var account_exports = {};
58851   __export(account_exports, {
58852     uiAccount: () => uiAccount
58853   });
58854   function uiAccount(context) {
58855     const osm = context.connection();
58856     function updateUserDetails(selection2) {
58857       if (!osm) return;
58858       if (!osm.authenticated()) {
58859         render(selection2, null);
58860       } else {
58861         osm.userDetails((err, user) => {
58862           if (err && err.status === 401) {
58863             osm.logout();
58864           }
58865           render(selection2, user);
58866         });
58867       }
58868     }
58869     function render(selection2, user) {
58870       let userInfo = selection2.select(".userInfo");
58871       let loginLogout = selection2.select(".loginLogout");
58872       if (user) {
58873         userInfo.html("").classed("hide", false);
58874         let userLink = userInfo.append("a").attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
58875         if (user.image_url) {
58876           userLink.append("img").attr("class", "icon pre-text user-icon").attr("src", user.image_url);
58877         } else {
58878           userLink.call(svgIcon("#iD-icon-avatar", "pre-text light"));
58879         }
58880         userLink.append("span").attr("class", "label").text(user.display_name);
58881         loginLogout.classed("hide", false).select("a").text(_t("logout")).on("click", (e3) => {
58882           e3.preventDefault();
58883           osm.logout();
58884           osm.authenticate(void 0, { switchUser: true });
58885         });
58886       } else {
58887         userInfo.html("").classed("hide", true);
58888         loginLogout.classed("hide", false).select("a").text(_t("login")).on("click", (e3) => {
58889           e3.preventDefault();
58890           osm.authenticate();
58891         });
58892       }
58893     }
58894     return function(selection2) {
58895       if (!osm) return;
58896       selection2.append("li").attr("class", "userInfo").classed("hide", true);
58897       selection2.append("li").attr("class", "loginLogout").classed("hide", true).append("a").attr("href", "#");
58898       osm.on("change.account", () => updateUserDetails(selection2));
58899       updateUserDetails(selection2);
58900     };
58901   }
58902   var init_account = __esm({
58903     "modules/ui/account.js"() {
58904       "use strict";
58905       init_localizer();
58906       init_icon();
58907     }
58908   });
58909
58910   // modules/ui/attribution.js
58911   var attribution_exports = {};
58912   __export(attribution_exports, {
58913     uiAttribution: () => uiAttribution
58914   });
58915   function uiAttribution(context) {
58916     let _selection = select_default2(null);
58917     function render(selection2, data, klass) {
58918       let div = selection2.selectAll(`.${klass}`).data([0]);
58919       div = div.enter().append("div").attr("class", klass).merge(div);
58920       let attributions = div.selectAll(".attribution").data(data, (d2) => d2.id);
58921       attributions.exit().remove();
58922       attributions = attributions.enter().append("span").attr("class", "attribution").each((d2, i3, nodes) => {
58923         let attribution = select_default2(nodes[i3]);
58924         if (d2.terms_html) {
58925           attribution.html(d2.terms_html);
58926           return;
58927         }
58928         if (d2.terms_url) {
58929           attribution = attribution.append("a").attr("href", d2.terms_url).attr("target", "_blank");
58930         }
58931         const sourceID = d2.id.replace(/\./g, "<TX_DOT>");
58932         const terms_text = _t(
58933           `imagery.${sourceID}.attribution.text`,
58934           { default: d2.terms_text || d2.id || d2.name() }
58935         );
58936         if (d2.icon && !d2.overlay) {
58937           attribution.append("img").attr("class", "source-image").attr("src", d2.icon);
58938         }
58939         attribution.append("span").attr("class", "attribution-text").text(terms_text);
58940       }).merge(attributions);
58941       let copyright = attributions.selectAll(".copyright-notice").data((d2) => {
58942         let notice = d2.copyrightNotices(context.map().zoom(), context.map().extent());
58943         return notice ? [notice] : [];
58944       });
58945       copyright.exit().remove();
58946       copyright = copyright.enter().append("span").attr("class", "copyright-notice").merge(copyright);
58947       copyright.text(String);
58948     }
58949     function update() {
58950       let baselayer = context.background().baseLayerSource();
58951       _selection.call(render, baselayer ? [baselayer] : [], "base-layer-attribution");
58952       const z2 = context.map().zoom();
58953       let overlays = context.background().overlayLayerSources() || [];
58954       _selection.call(render, overlays.filter((s2) => s2.validZoom(z2)), "overlay-layer-attribution");
58955     }
58956     return function(selection2) {
58957       _selection = selection2;
58958       context.background().on("change.attribution", update);
58959       context.map().on("move.attribution", throttle_default(update, 400, { leading: false }));
58960       update();
58961     };
58962   }
58963   var init_attribution = __esm({
58964     "modules/ui/attribution.js"() {
58965       "use strict";
58966       init_throttle();
58967       init_src5();
58968       init_localizer();
58969     }
58970   });
58971
58972   // modules/ui/contributors.js
58973   var contributors_exports = {};
58974   __export(contributors_exports, {
58975     uiContributors: () => uiContributors
58976   });
58977   function uiContributors(context) {
58978     var osm = context.connection(), debouncedUpdate = debounce_default(function() {
58979       update();
58980     }, 1e3), limit = 4, hidden = false, wrap2 = select_default2(null);
58981     function update() {
58982       if (!osm) return;
58983       var users = {}, entities = context.history().intersects(context.map().extent());
58984       entities.forEach(function(entity) {
58985         if (entity && entity.user) users[entity.user] = true;
58986       });
58987       var u2 = Object.keys(users), subset = u2.slice(0, u2.length > limit ? limit - 1 : limit);
58988       wrap2.html("").call(svgIcon("#iD-icon-nearby", "pre-text light"));
58989       var userList = select_default2(document.createElement("span"));
58990       userList.selectAll().data(subset).enter().append("a").attr("class", "user-link").attr("href", function(d2) {
58991         return osm.userURL(d2);
58992       }).attr("target", "_blank").text(String);
58993       if (u2.length > limit) {
58994         var count = select_default2(document.createElement("span"));
58995         var othersNum = u2.length - limit + 1;
58996         count.append("a").attr("target", "_blank").attr("href", function() {
58997           return osm.changesetsURL(context.map().center(), context.map().zoom());
58998         }).text(othersNum);
58999         wrap2.append("span").html(_t.html("contributors.truncated_list", { n: othersNum, users: { html: userList.html() }, count: { html: count.html() } }));
59000       } else {
59001         wrap2.append("span").html(_t.html("contributors.list", { users: { html: userList.html() } }));
59002       }
59003       if (!u2.length) {
59004         hidden = true;
59005         wrap2.transition().style("opacity", 0);
59006       } else if (hidden) {
59007         wrap2.transition().style("opacity", 1);
59008       }
59009     }
59010     return function(selection2) {
59011       if (!osm) return;
59012       wrap2 = selection2;
59013       update();
59014       osm.on("loaded.contributors", debouncedUpdate);
59015       context.map().on("move.contributors", debouncedUpdate);
59016     };
59017   }
59018   var init_contributors = __esm({
59019     "modules/ui/contributors.js"() {
59020       "use strict";
59021       init_debounce();
59022       init_src5();
59023       init_localizer();
59024       init_svg();
59025     }
59026   });
59027
59028   // modules/ui/edit_menu.js
59029   var edit_menu_exports = {};
59030   __export(edit_menu_exports, {
59031     uiEditMenu: () => uiEditMenu
59032   });
59033   function uiEditMenu(context) {
59034     var dispatch14 = dispatch_default("toggled");
59035     var _menu = select_default2(null);
59036     var _operations = [];
59037     var _anchorLoc = [0, 0];
59038     var _anchorLocLonLat = [0, 0];
59039     var _triggerType = "";
59040     var _vpTopMargin = 85;
59041     var _vpBottomMargin = 45;
59042     var _vpSideMargin = 35;
59043     var _menuTop = false;
59044     var _menuHeight;
59045     var _menuWidth;
59046     var _verticalPadding = 4;
59047     var _tooltipWidth = 210;
59048     var _menuSideMargin = 10;
59049     var _tooltips = [];
59050     var editMenu = function(selection2) {
59051       var isTouchMenu = _triggerType.includes("touch") || _triggerType.includes("pen");
59052       var ops = _operations.filter(function(op) {
59053         return !isTouchMenu || !op.mouseOnly;
59054       });
59055       if (!ops.length) return;
59056       _tooltips = [];
59057       _menuTop = isTouchMenu;
59058       var showLabels = isTouchMenu;
59059       var buttonHeight = showLabels ? 32 : 34;
59060       if (showLabels) {
59061         _menuWidth = 52 + Math.min(120, 6 * Math.max.apply(Math, ops.map(function(op) {
59062           return op.title.length;
59063         })));
59064       } else {
59065         _menuWidth = 44;
59066       }
59067       _menuHeight = _verticalPadding * 2 + ops.length * buttonHeight;
59068       _menu = selection2.append("div").attr("class", "edit-menu").classed("touch-menu", isTouchMenu).style("padding", _verticalPadding + "px 0");
59069       var buttons = _menu.selectAll(".edit-menu-item").data(ops);
59070       var buttonsEnter = buttons.enter().append("button").attr("class", function(d2) {
59071         return "edit-menu-item edit-menu-item-" + d2.id;
59072       }).style("height", buttonHeight + "px").on("click", click).on("pointerup", pointerup).on("pointerdown mousedown", function pointerdown(d3_event) {
59073         d3_event.stopPropagation();
59074       }).on("mouseenter.highlight", function(d3_event, d2) {
59075         if (!d2.relatedEntityIds || select_default2(this).classed("disabled")) return;
59076         utilHighlightEntities(d2.relatedEntityIds(), true, context);
59077       }).on("mouseleave.highlight", function(d3_event, d2) {
59078         if (!d2.relatedEntityIds) return;
59079         utilHighlightEntities(d2.relatedEntityIds(), false, context);
59080       });
59081       buttonsEnter.each(function(d2) {
59082         var tooltip = uiTooltip().heading(() => d2.title).title(d2.tooltip).keys([d2.keys[0]]);
59083         _tooltips.push(tooltip);
59084         select_default2(this).call(tooltip).append("div").attr("class", "icon-wrap").call(svgIcon(d2.icon && d2.icon() || "#iD-operation-" + d2.id, "operation"));
59085       });
59086       if (showLabels) {
59087         buttonsEnter.append("span").attr("class", "label").each(function(d2) {
59088           select_default2(this).call(d2.title);
59089         });
59090       }
59091       buttonsEnter.merge(buttons).classed("disabled", function(d2) {
59092         return d2.disabled();
59093       });
59094       updatePosition();
59095       var initialScale = context.projection.scale();
59096       context.map().on("move.edit-menu", function() {
59097         if (initialScale !== context.projection.scale()) {
59098           editMenu.close();
59099         }
59100       }).on("drawn.edit-menu", function(info) {
59101         if (info.full) updatePosition();
59102       });
59103       var lastPointerUpType;
59104       function pointerup(d3_event) {
59105         lastPointerUpType = d3_event.pointerType;
59106       }
59107       function click(d3_event, operation2) {
59108         d3_event.stopPropagation();
59109         if (operation2.relatedEntityIds) {
59110           utilHighlightEntities(operation2.relatedEntityIds(), false, context);
59111         }
59112         if (operation2.disabled()) {
59113           if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
59114             context.ui().flash.duration(4e3).iconName("#iD-operation-" + operation2.id).iconClass("operation disabled").label(operation2.tooltip())();
59115           }
59116         } else {
59117           if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
59118             context.ui().flash.duration(2e3).iconName("#iD-operation-" + operation2.id).iconClass("operation").label(operation2.annotation() || operation2.title)();
59119           }
59120           operation2();
59121           editMenu.close();
59122         }
59123         lastPointerUpType = null;
59124       }
59125       dispatch14.call("toggled", this, true);
59126     };
59127     function updatePosition() {
59128       if (!_menu || _menu.empty()) return;
59129       var anchorLoc = context.projection(_anchorLocLonLat);
59130       var viewport = context.surfaceRect();
59131       if (anchorLoc[0] < 0 || anchorLoc[0] > viewport.width || anchorLoc[1] < 0 || anchorLoc[1] > viewport.height) {
59132         editMenu.close();
59133         return;
59134       }
59135       var menuLeft = displayOnLeft(viewport);
59136       var offset = [0, 0];
59137       offset[0] = menuLeft ? -1 * (_menuSideMargin + _menuWidth) : _menuSideMargin;
59138       if (_menuTop) {
59139         if (anchorLoc[1] - _menuHeight < _vpTopMargin) {
59140           offset[1] = -anchorLoc[1] + _vpTopMargin;
59141         } else {
59142           offset[1] = -_menuHeight;
59143         }
59144       } else {
59145         if (anchorLoc[1] + _menuHeight > viewport.height - _vpBottomMargin) {
59146           offset[1] = -anchorLoc[1] - _menuHeight + viewport.height - _vpBottomMargin;
59147         } else {
59148           offset[1] = 0;
59149         }
59150       }
59151       var origin = geoVecAdd(anchorLoc, offset);
59152       var _verticalOffset = parseFloat(utilGetDimensions(select_default2(".top-toolbar-wrap"))[1]);
59153       origin[1] -= _verticalOffset;
59154       _menu.style("left", origin[0] + "px").style("top", origin[1] + "px");
59155       var tooltipSide = tooltipPosition(viewport, menuLeft);
59156       _tooltips.forEach(function(tooltip) {
59157         tooltip.placement(tooltipSide);
59158       });
59159       function displayOnLeft(viewport2) {
59160         if (_mainLocalizer.textDirection() === "ltr") {
59161           if (anchorLoc[0] + _menuSideMargin + _menuWidth > viewport2.width - _vpSideMargin) {
59162             return true;
59163           }
59164           return false;
59165         } else {
59166           if (anchorLoc[0] - _menuSideMargin - _menuWidth < _vpSideMargin) {
59167             return false;
59168           }
59169           return true;
59170         }
59171       }
59172       function tooltipPosition(viewport2, menuLeft2) {
59173         if (_mainLocalizer.textDirection() === "ltr") {
59174           if (menuLeft2) {
59175             return "left";
59176           }
59177           if (anchorLoc[0] + _menuSideMargin + _menuWidth + _tooltipWidth > viewport2.width - _vpSideMargin) {
59178             return "left";
59179           }
59180           return "right";
59181         } else {
59182           if (!menuLeft2) {
59183             return "right";
59184           }
59185           if (anchorLoc[0] - _menuSideMargin - _menuWidth - _tooltipWidth < _vpSideMargin) {
59186             return "right";
59187           }
59188           return "left";
59189         }
59190       }
59191     }
59192     editMenu.close = function() {
59193       context.map().on("move.edit-menu", null).on("drawn.edit-menu", null);
59194       _menu.remove();
59195       _tooltips = [];
59196       dispatch14.call("toggled", this, false);
59197     };
59198     editMenu.anchorLoc = function(val) {
59199       if (!arguments.length) return _anchorLoc;
59200       _anchorLoc = val;
59201       _anchorLocLonLat = context.projection.invert(_anchorLoc);
59202       return editMenu;
59203     };
59204     editMenu.triggerType = function(val) {
59205       if (!arguments.length) return _triggerType;
59206       _triggerType = val;
59207       return editMenu;
59208     };
59209     editMenu.operations = function(val) {
59210       if (!arguments.length) return _operations;
59211       _operations = val;
59212       return editMenu;
59213     };
59214     return utilRebind(editMenu, dispatch14, "on");
59215   }
59216   var init_edit_menu = __esm({
59217     "modules/ui/edit_menu.js"() {
59218       "use strict";
59219       init_src5();
59220       init_src4();
59221       init_geo2();
59222       init_localizer();
59223       init_tooltip();
59224       init_rebind();
59225       init_util2();
59226       init_dimensions();
59227       init_icon();
59228     }
59229   });
59230
59231   // modules/ui/feature_info.js
59232   var feature_info_exports = {};
59233   __export(feature_info_exports, {
59234     uiFeatureInfo: () => uiFeatureInfo
59235   });
59236   function uiFeatureInfo(context) {
59237     function update(selection2) {
59238       var features = context.features();
59239       var stats = features.stats();
59240       var count = 0;
59241       var hiddenList = features.hidden().map(function(k2) {
59242         if (stats[k2]) {
59243           count += stats[k2];
59244           return _t.append("inspector.title_count", {
59245             title: _t("feature." + k2 + ".description"),
59246             count: stats[k2]
59247           });
59248         }
59249         return null;
59250       }).filter(Boolean);
59251       selection2.text("");
59252       if (hiddenList.length) {
59253         var tooltipBehavior = uiTooltip().placement("top").title(function() {
59254           return (selection3) => {
59255             hiddenList.forEach((hiddenFeature) => {
59256               selection3.append("div").call(hiddenFeature);
59257             });
59258           };
59259         });
59260         selection2.append("a").attr("class", "chip").attr("href", "#").call(_t.append("feature_info.hidden_warning", { count })).call(tooltipBehavior).on("click", function(d3_event) {
59261           tooltipBehavior.hide();
59262           d3_event.preventDefault();
59263           context.ui().togglePanes(context.container().select(".map-panes .map-data-pane"));
59264         });
59265       }
59266       selection2.classed("hide", !hiddenList.length);
59267     }
59268     return function(selection2) {
59269       update(selection2);
59270       context.features().on("change.feature_info", function() {
59271         update(selection2);
59272       });
59273     };
59274   }
59275   var init_feature_info = __esm({
59276     "modules/ui/feature_info.js"() {
59277       "use strict";
59278       init_localizer();
59279       init_tooltip();
59280     }
59281   });
59282
59283   // modules/ui/flash.js
59284   var flash_exports = {};
59285   __export(flash_exports, {
59286     uiFlash: () => uiFlash
59287   });
59288   function uiFlash(context) {
59289     var _flashTimer;
59290     var _duration = 2e3;
59291     var _iconName = "#iD-icon-no";
59292     var _iconClass = "disabled";
59293     var _label = (s2) => s2.text("");
59294     function flash() {
59295       if (_flashTimer) {
59296         _flashTimer.stop();
59297       }
59298       context.container().select(".main-footer-wrap").classed("footer-hide", true).classed("footer-show", false);
59299       context.container().select(".flash-wrap").classed("footer-hide", false).classed("footer-show", true);
59300       var content = context.container().select(".flash-wrap").selectAll(".flash-content").data([0]);
59301       var contentEnter = content.enter().append("div").attr("class", "flash-content");
59302       var iconEnter = contentEnter.append("svg").attr("class", "flash-icon icon").append("g").attr("transform", "translate(10,10)");
59303       iconEnter.append("circle").attr("r", 9);
59304       iconEnter.append("use").attr("transform", "translate(-7,-7)").attr("width", "14").attr("height", "14");
59305       contentEnter.append("div").attr("class", "flash-text");
59306       content = content.merge(contentEnter);
59307       content.selectAll(".flash-icon").attr("class", "icon flash-icon " + (_iconClass || ""));
59308       content.selectAll(".flash-icon use").attr("xlink:href", _iconName);
59309       content.selectAll(".flash-text").attr("class", "flash-text").call(_label);
59310       _flashTimer = timeout_default(function() {
59311         _flashTimer = null;
59312         context.container().select(".main-footer-wrap").classed("footer-hide", false).classed("footer-show", true);
59313         context.container().select(".flash-wrap").classed("footer-hide", true).classed("footer-show", false);
59314       }, _duration);
59315       return content;
59316     }
59317     flash.duration = function(_2) {
59318       if (!arguments.length) return _duration;
59319       _duration = _2;
59320       return flash;
59321     };
59322     flash.label = function(_2) {
59323       if (!arguments.length) return _label;
59324       if (typeof _2 !== "function") {
59325         _label = (selection2) => selection2.text(_2);
59326       } else {
59327         _label = (selection2) => selection2.text("").call(_2);
59328       }
59329       return flash;
59330     };
59331     flash.iconName = function(_2) {
59332       if (!arguments.length) return _iconName;
59333       _iconName = _2;
59334       return flash;
59335     };
59336     flash.iconClass = function(_2) {
59337       if (!arguments.length) return _iconClass;
59338       _iconClass = _2;
59339       return flash;
59340     };
59341     return flash;
59342   }
59343   var init_flash = __esm({
59344     "modules/ui/flash.js"() {
59345       "use strict";
59346       init_src9();
59347     }
59348   });
59349
59350   // modules/ui/full_screen.js
59351   var full_screen_exports = {};
59352   __export(full_screen_exports, {
59353     uiFullScreen: () => uiFullScreen
59354   });
59355   function uiFullScreen(context) {
59356     var element = context.container().node();
59357     function getFullScreenFn() {
59358       if (element.requestFullscreen) {
59359         return element.requestFullscreen;
59360       } else if (element.msRequestFullscreen) {
59361         return element.msRequestFullscreen;
59362       } else if (element.mozRequestFullScreen) {
59363         return element.mozRequestFullScreen;
59364       } else if (element.webkitRequestFullscreen) {
59365         return element.webkitRequestFullscreen;
59366       }
59367     }
59368     function getExitFullScreenFn() {
59369       if (document.exitFullscreen) {
59370         return document.exitFullscreen;
59371       } else if (document.msExitFullscreen) {
59372         return document.msExitFullscreen;
59373       } else if (document.mozCancelFullScreen) {
59374         return document.mozCancelFullScreen;
59375       } else if (document.webkitExitFullscreen) {
59376         return document.webkitExitFullscreen;
59377       }
59378     }
59379     function isFullScreen() {
59380       return document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement;
59381     }
59382     function isSupported() {
59383       return !!getFullScreenFn();
59384     }
59385     function fullScreen(d3_event) {
59386       d3_event.preventDefault();
59387       if (!isFullScreen()) {
59388         getFullScreenFn().apply(element);
59389       } else {
59390         getExitFullScreenFn().apply(document);
59391       }
59392     }
59393     return function() {
59394       if (!isSupported()) return;
59395       var detected = utilDetect();
59396       var keys2 = detected.os === "mac" ? [uiCmd("\u2303\u2318F"), "f11"] : ["f11"];
59397       context.keybinding().on(keys2, fullScreen);
59398     };
59399   }
59400   var init_full_screen = __esm({
59401     "modules/ui/full_screen.js"() {
59402       "use strict";
59403       init_cmd();
59404       init_detect();
59405     }
59406   });
59407
59408   // modules/ui/geolocate.js
59409   var geolocate_exports2 = {};
59410   __export(geolocate_exports2, {
59411     uiGeolocate: () => uiGeolocate
59412   });
59413   function uiGeolocate(context) {
59414     var _geolocationOptions = {
59415       // prioritize speed and power usage over precision
59416       enableHighAccuracy: false,
59417       // don't hang indefinitely getting the location
59418       timeout: 6e3
59419       // 6sec
59420     };
59421     var _locating = uiLoading(context).message(_t.html("geolocate.locating")).blocking(true);
59422     var _layer = context.layers().layer("geolocate");
59423     var _position;
59424     var _extent;
59425     var _timeoutID;
59426     var _button = select_default2(null);
59427     function click() {
59428       if (context.inIntro()) return;
59429       if (!_layer.enabled() && !_locating.isShown()) {
59430         _timeoutID = setTimeout(
59431           error,
59432           1e4
59433           /* 10sec */
59434         );
59435         context.container().call(_locating);
59436         navigator.geolocation.getCurrentPosition(success, error, _geolocationOptions);
59437       } else {
59438         _locating.close();
59439         _layer.enabled(null, false);
59440         updateButtonState();
59441       }
59442     }
59443     function zoomTo() {
59444       context.enter(modeBrowse(context));
59445       var map2 = context.map();
59446       _layer.enabled(_position, true);
59447       updateButtonState();
59448       map2.centerZoomEase(_extent.center(), Math.min(20, map2.extentZoom(_extent)));
59449     }
59450     function success(geolocation) {
59451       _position = geolocation;
59452       var coords = _position.coords;
59453       _extent = geoExtent([coords.longitude, coords.latitude]).padByMeters(coords.accuracy);
59454       zoomTo();
59455       finish();
59456     }
59457     function error() {
59458       if (_position) {
59459         zoomTo();
59460       } else {
59461         context.ui().flash.label(_t.append("geolocate.location_unavailable")).iconName("#iD-icon-geolocate")();
59462       }
59463       finish();
59464     }
59465     function finish() {
59466       _locating.close();
59467       if (_timeoutID) {
59468         clearTimeout(_timeoutID);
59469       }
59470       _timeoutID = void 0;
59471     }
59472     function updateButtonState() {
59473       _button.classed("active", _layer.enabled());
59474       _button.attr("aria-pressed", _layer.enabled());
59475     }
59476     return function(selection2) {
59477       if (!navigator.geolocation || !navigator.geolocation.getCurrentPosition) return;
59478       _button = selection2.append("button").on("click", click).attr("aria-pressed", false).call(svgIcon("#iD-icon-geolocate", "light")).call(
59479         uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(() => _t.append("geolocate.title"))
59480       );
59481     };
59482   }
59483   var init_geolocate2 = __esm({
59484     "modules/ui/geolocate.js"() {
59485       "use strict";
59486       init_src5();
59487       init_localizer();
59488       init_tooltip();
59489       init_geo2();
59490       init_browse();
59491       init_icon();
59492       init_loading();
59493     }
59494   });
59495
59496   // modules/ui/panels/background.js
59497   var background_exports = {};
59498   __export(background_exports, {
59499     uiPanelBackground: () => uiPanelBackground
59500   });
59501   function uiPanelBackground(context) {
59502     var background = context.background();
59503     var _currSourceName = null;
59504     var _metadata = {};
59505     var _metadataKeys = [
59506       "zoom",
59507       "vintage",
59508       "source",
59509       "description",
59510       "resolution",
59511       "accuracy"
59512     ];
59513     var debouncedRedraw = debounce_default(redraw, 250);
59514     function redraw(selection2) {
59515       var source = background.baseLayerSource();
59516       if (!source) return;
59517       var isDG = source.id.match(/^DigitalGlobe/i) !== null;
59518       var sourceLabel = source.label();
59519       if (_currSourceName !== sourceLabel) {
59520         _currSourceName = sourceLabel;
59521         _metadata = {};
59522       }
59523       selection2.text("");
59524       var list2 = selection2.append("ul").attr("class", "background-info");
59525       list2.append("li").call(_currSourceName);
59526       _metadataKeys.forEach(function(k2) {
59527         if (isDG && k2 === "vintage") return;
59528         list2.append("li").attr("class", "background-info-list-" + k2).classed("hide", !_metadata[k2]).call(_t.append("info_panels.background." + k2, { suffix: ":" })).append("span").attr("class", "background-info-span-" + k2).text(_metadata[k2]);
59529       });
59530       debouncedGetMetadata(selection2);
59531       var toggleTiles = context.getDebug("tile") ? "hide_tiles" : "show_tiles";
59532       selection2.append("a").call(_t.append("info_panels.background." + toggleTiles)).attr("href", "#").attr("class", "button button-toggle-tiles").on("click", function(d3_event) {
59533         d3_event.preventDefault();
59534         context.setDebug("tile", !context.getDebug("tile"));
59535         selection2.call(redraw);
59536       });
59537       if (isDG) {
59538         var key = source.id + "-vintage";
59539         var sourceVintage = context.background().findSource(key);
59540         var showsVintage = context.background().showsLayer(sourceVintage);
59541         var toggleVintage = showsVintage ? "hide_vintage" : "show_vintage";
59542         selection2.append("a").call(_t.append("info_panels.background." + toggleVintage)).attr("href", "#").attr("class", "button button-toggle-vintage").on("click", function(d3_event) {
59543           d3_event.preventDefault();
59544           context.background().toggleOverlayLayer(sourceVintage);
59545           selection2.call(redraw);
59546         });
59547       }
59548       ["DigitalGlobe-Premium", "DigitalGlobe-Standard"].forEach(function(layerId) {
59549         if (source.id !== layerId) {
59550           var key2 = layerId + "-vintage";
59551           var sourceVintage2 = context.background().findSource(key2);
59552           if (context.background().showsLayer(sourceVintage2)) {
59553             context.background().toggleOverlayLayer(sourceVintage2);
59554           }
59555         }
59556       });
59557     }
59558     var debouncedGetMetadata = debounce_default(getMetadata, 250);
59559     function getMetadata(selection2) {
59560       var tile = context.container().select(".layer-background img.tile-center");
59561       if (tile.empty()) return;
59562       var sourceName = _currSourceName;
59563       var d2 = tile.datum();
59564       var zoom = d2 && d2.length >= 3 && d2[2] || Math.floor(context.map().zoom());
59565       var center = context.map().center();
59566       _metadata.zoom = String(zoom);
59567       selection2.selectAll(".background-info-list-zoom").classed("hide", false).selectAll(".background-info-span-zoom").text(_metadata.zoom);
59568       if (!d2 || !d2.length >= 3) return;
59569       background.baseLayerSource().getMetadata(center, d2, function(err, result) {
59570         if (err || _currSourceName !== sourceName) return;
59571         var vintage = result.vintage;
59572         _metadata.vintage = vintage && vintage.range || _t("info_panels.background.unknown");
59573         selection2.selectAll(".background-info-list-vintage").classed("hide", false).selectAll(".background-info-span-vintage").text(_metadata.vintage);
59574         _metadataKeys.forEach(function(k2) {
59575           if (k2 === "zoom" || k2 === "vintage") return;
59576           var val = result[k2];
59577           _metadata[k2] = val;
59578           selection2.selectAll(".background-info-list-" + k2).classed("hide", !val).selectAll(".background-info-span-" + k2).text(val);
59579         });
59580       });
59581     }
59582     var panel = function(selection2) {
59583       selection2.call(redraw);
59584       context.map().on("drawn.info-background", function() {
59585         selection2.call(debouncedRedraw);
59586       }).on("move.info-background", function() {
59587         selection2.call(debouncedGetMetadata);
59588       });
59589     };
59590     panel.off = function() {
59591       context.map().on("drawn.info-background", null).on("move.info-background", null);
59592     };
59593     panel.id = "background";
59594     panel.label = _t.append("info_panels.background.title");
59595     panel.key = _t("info_panels.background.key");
59596     return panel;
59597   }
59598   var init_background = __esm({
59599     "modules/ui/panels/background.js"() {
59600       "use strict";
59601       init_debounce();
59602       init_localizer();
59603     }
59604   });
59605
59606   // modules/ui/panels/history.js
59607   var history_exports2 = {};
59608   __export(history_exports2, {
59609     uiPanelHistory: () => uiPanelHistory
59610   });
59611   function uiPanelHistory(context) {
59612     var osm;
59613     function displayTimestamp(timestamp) {
59614       if (!timestamp) return _t("info_panels.history.unknown");
59615       var options2 = {
59616         day: "numeric",
59617         month: "short",
59618         year: "numeric",
59619         hour: "numeric",
59620         minute: "numeric",
59621         second: "numeric"
59622       };
59623       var d2 = new Date(timestamp);
59624       if (isNaN(d2.getTime())) return _t("info_panels.history.unknown");
59625       return d2.toLocaleString(_mainLocalizer.localeCode(), options2);
59626     }
59627     function displayUser(selection2, userName) {
59628       if (!userName) {
59629         selection2.append("span").call(_t.append("info_panels.history.unknown"));
59630         return;
59631       }
59632       selection2.append("span").attr("class", "user-name").text(userName);
59633       var links = selection2.append("div").attr("class", "links");
59634       if (osm) {
59635         links.append("a").attr("class", "user-osm-link").attr("href", osm.userURL(userName)).attr("target", "_blank").call(_t.append("info_panels.history.profile_link"));
59636       }
59637       links.append("a").attr("class", "user-hdyc-link").attr("href", "https://hdyc.neis-one.org/?" + userName).attr("target", "_blank").attr("tabindex", -1).text("HDYC");
59638     }
59639     function displayChangeset(selection2, changeset) {
59640       if (!changeset) {
59641         selection2.append("span").call(_t.append("info_panels.history.unknown"));
59642         return;
59643       }
59644       selection2.append("span").attr("class", "changeset-id").text(changeset);
59645       var links = selection2.append("div").attr("class", "links");
59646       if (osm) {
59647         links.append("a").attr("class", "changeset-osm-link").attr("href", osm.changesetURL(changeset)).attr("target", "_blank").call(_t.append("info_panels.history.changeset_link"));
59648       }
59649       links.append("a").attr("class", "changeset-osmcha-link").attr("href", "https://osmcha.org/changesets/" + changeset).attr("target", "_blank").text("OSMCha");
59650       links.append("a").attr("class", "changeset-achavi-link").attr("href", "https://overpass-api.de/achavi/?changeset=" + changeset).attr("target", "_blank").text("Achavi");
59651     }
59652     function redraw(selection2) {
59653       var selectedNoteID = context.selectedNoteID();
59654       osm = context.connection();
59655       var selected, note, entity;
59656       if (selectedNoteID && osm) {
59657         selected = [_t.html("note.note") + " " + selectedNoteID];
59658         note = osm.getNote(selectedNoteID);
59659       } else {
59660         selected = context.selectedIDs().filter(function(e3) {
59661           return context.hasEntity(e3);
59662         });
59663         if (selected.length) {
59664           entity = context.entity(selected[0]);
59665         }
59666       }
59667       var singular = selected.length === 1 ? selected[0] : null;
59668       selection2.html("");
59669       if (singular) {
59670         selection2.append("h4").attr("class", "history-heading").html(singular);
59671       } else {
59672         selection2.append("h4").attr("class", "history-heading").call(_t.append("info_panels.selected", { n: selected.length }));
59673       }
59674       if (!singular) return;
59675       if (entity) {
59676         selection2.call(redrawEntity, entity);
59677       } else if (note) {
59678         selection2.call(redrawNote, note);
59679       }
59680     }
59681     function redrawNote(selection2, note) {
59682       if (!note || note.isNew()) {
59683         selection2.append("div").call(_t.append("info_panels.history.note_no_history"));
59684         return;
59685       }
59686       var list2 = selection2.append("ul");
59687       list2.append("li").call(_t.append("info_panels.history.note_comments", { suffix: ":" })).append("span").text(note.comments.length);
59688       if (note.comments.length) {
59689         list2.append("li").call(_t.append("info_panels.history.note_created_date", { suffix: ":" })).append("span").text(displayTimestamp(note.comments[0].date));
59690         list2.append("li").call(_t.append("info_panels.history.note_created_user", { suffix: ":" })).call(displayUser, note.comments[0].user);
59691       }
59692       if (osm) {
59693         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"));
59694       }
59695     }
59696     function redrawEntity(selection2, entity) {
59697       if (!entity || entity.isNew()) {
59698         selection2.append("div").call(_t.append("info_panels.history.no_history"));
59699         return;
59700       }
59701       var links = selection2.append("div").attr("class", "links");
59702       if (osm) {
59703         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"));
59704       }
59705       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");
59706       var list2 = selection2.append("ul");
59707       list2.append("li").call(_t.append("info_panels.history.version", { suffix: ":" })).append("span").text(entity.version);
59708       list2.append("li").call(_t.append("info_panels.history.last_edit", { suffix: ":" })).append("span").text(displayTimestamp(entity.timestamp));
59709       list2.append("li").call(_t.append("info_panels.history.edited_by", { suffix: ":" })).call(displayUser, entity.user);
59710       list2.append("li").call(_t.append("info_panels.history.changeset", { suffix: ":" })).call(displayChangeset, entity.changeset);
59711     }
59712     var panel = function(selection2) {
59713       selection2.call(redraw);
59714       context.map().on("drawn.info-history", function() {
59715         selection2.call(redraw);
59716       });
59717       context.on("enter.info-history", function() {
59718         selection2.call(redraw);
59719       });
59720     };
59721     panel.off = function() {
59722       context.map().on("drawn.info-history", null);
59723       context.on("enter.info-history", null);
59724     };
59725     panel.id = "history";
59726     panel.label = _t.append("info_panels.history.title");
59727     panel.key = _t("info_panels.history.key");
59728     return panel;
59729   }
59730   var init_history2 = __esm({
59731     "modules/ui/panels/history.js"() {
59732       "use strict";
59733       init_localizer();
59734       init_svg();
59735     }
59736   });
59737
59738   // modules/ui/panels/location.js
59739   var location_exports = {};
59740   __export(location_exports, {
59741     uiPanelLocation: () => uiPanelLocation
59742   });
59743   function uiPanelLocation(context) {
59744     var currLocation = "";
59745     function redraw(selection2) {
59746       selection2.html("");
59747       var list2 = selection2.append("ul");
59748       var coord2 = context.map().mouseCoordinates();
59749       if (coord2.some(isNaN)) {
59750         coord2 = context.map().center();
59751       }
59752       list2.append("li").text(dmsCoordinatePair(coord2)).append("li").text(decimalCoordinatePair(coord2));
59753       selection2.append("div").attr("class", "location-info").text(currLocation || " ");
59754       debouncedGetLocation(selection2, coord2);
59755     }
59756     var debouncedGetLocation = debounce_default(getLocation, 250);
59757     function getLocation(selection2, coord2) {
59758       if (!services.geocoder) {
59759         currLocation = _t("info_panels.location.unknown_location");
59760         selection2.selectAll(".location-info").text(currLocation);
59761       } else {
59762         services.geocoder.reverse(coord2, function(err, result) {
59763           currLocation = result ? result.display_name : _t("info_panels.location.unknown_location");
59764           selection2.selectAll(".location-info").text(currLocation);
59765         });
59766       }
59767     }
59768     var panel = function(selection2) {
59769       selection2.call(redraw);
59770       context.surface().on(("PointerEvent" in window ? "pointer" : "mouse") + "move.info-location", function() {
59771         selection2.call(redraw);
59772       });
59773     };
59774     panel.off = function() {
59775       context.surface().on(".info-location", null);
59776     };
59777     panel.id = "location";
59778     panel.label = _t.append("info_panels.location.title");
59779     panel.key = _t("info_panels.location.key");
59780     return panel;
59781   }
59782   var init_location = __esm({
59783     "modules/ui/panels/location.js"() {
59784       "use strict";
59785       init_debounce();
59786       init_units();
59787       init_localizer();
59788       init_services();
59789     }
59790   });
59791
59792   // modules/ui/panels/measurement.js
59793   var measurement_exports = {};
59794   __export(measurement_exports, {
59795     uiPanelMeasurement: () => uiPanelMeasurement
59796   });
59797   function uiPanelMeasurement(context) {
59798     function radiansToMeters(r2) {
59799       return r2 * 63710071809e-4;
59800     }
59801     function steradiansToSqmeters(r2) {
59802       return r2 / (4 * Math.PI) * 510065621724e3;
59803     }
59804     function toLineString(feature3) {
59805       if (feature3.type === "LineString") return feature3;
59806       var result = { type: "LineString", coordinates: [] };
59807       if (feature3.type === "Polygon") {
59808         result.coordinates = feature3.coordinates[0];
59809       } else if (feature3.type === "MultiPolygon") {
59810         result.coordinates = feature3.coordinates[0][0];
59811       }
59812       return result;
59813     }
59814     var _isImperial = !_mainLocalizer.usesMetric();
59815     function redraw(selection2) {
59816       var graph = context.graph();
59817       var selectedNoteID = context.selectedNoteID();
59818       var osm = services.osm;
59819       var localeCode = _mainLocalizer.localeCode();
59820       var heading2;
59821       var center, location, centroid;
59822       var closed, geometry;
59823       var totalNodeCount, length2 = 0, area = 0, distance;
59824       if (selectedNoteID && osm) {
59825         var note = osm.getNote(selectedNoteID);
59826         heading2 = _t.html("note.note") + " " + selectedNoteID;
59827         location = note.loc;
59828         geometry = "note";
59829       } else {
59830         var selectedIDs = context.selectedIDs().filter(function(id2) {
59831           return context.hasEntity(id2);
59832         });
59833         var selected = selectedIDs.map(function(id2) {
59834           return context.entity(id2);
59835         });
59836         heading2 = selected.length === 1 ? selected[0].id : _t.html("info_panels.selected", { n: selected.length });
59837         if (selected.length) {
59838           var extent = geoExtent();
59839           for (var i3 in selected) {
59840             var entity = selected[i3];
59841             extent._extend(entity.extent(graph));
59842             geometry = entity.geometry(graph);
59843             if (geometry === "line" || geometry === "area") {
59844               closed = entity.type === "relation" || entity.isClosed() && !entity.isDegenerate();
59845               var feature3 = entity.asGeoJSON(graph);
59846               length2 += radiansToMeters(length_default(toLineString(feature3)));
59847               centroid = path_default(context.projection).centroid(entity.asGeoJSON(graph));
59848               centroid = centroid && context.projection.invert(centroid);
59849               if (!centroid || !isFinite(centroid[0]) || !isFinite(centroid[1])) {
59850                 centroid = entity.extent(graph).center();
59851               }
59852               if (closed) {
59853                 area += steradiansToSqmeters(entity.area(graph));
59854               }
59855             }
59856           }
59857           if (selected.length > 1) {
59858             geometry = null;
59859             closed = null;
59860             centroid = null;
59861           }
59862           if (selected.length === 2 && selected[0].type === "node" && selected[1].type === "node") {
59863             distance = geoSphericalDistance(selected[0].loc, selected[1].loc);
59864           }
59865           if (selected.length === 1 && selected[0].type === "node") {
59866             location = selected[0].loc;
59867           } else {
59868             totalNodeCount = utilGetAllNodes(selectedIDs, context.graph()).length;
59869           }
59870           if (!location && !centroid) {
59871             center = extent.center();
59872           }
59873         }
59874       }
59875       selection2.html("");
59876       if (heading2) {
59877         selection2.append("h4").attr("class", "measurement-heading").html(heading2);
59878       }
59879       var list2 = selection2.append("ul");
59880       var coordItem;
59881       if (geometry) {
59882         list2.append("li").call(_t.append("info_panels.measurement.geometry", { suffix: ":" })).append("span").html(
59883           closed ? _t.html("info_panels.measurement.closed_" + geometry) : _t.html("geometry." + geometry)
59884         );
59885       }
59886       if (totalNodeCount) {
59887         list2.append("li").call(_t.append("info_panels.measurement.node_count", { suffix: ":" })).append("span").text(totalNodeCount.toLocaleString(localeCode));
59888       }
59889       if (area) {
59890         list2.append("li").call(_t.append("info_panels.measurement.area", { suffix: ":" })).append("span").text(displayArea(area, _isImperial));
59891       }
59892       if (length2) {
59893         list2.append("li").call(_t.append("info_panels.measurement." + (closed ? "perimeter" : "length"), { suffix: ":" })).append("span").text(displayLength(length2, _isImperial));
59894       }
59895       if (typeof distance === "number") {
59896         list2.append("li").call(_t.append("info_panels.measurement.distance", { suffix: ":" })).append("span").text(displayLength(distance, _isImperial));
59897       }
59898       if (location) {
59899         coordItem = list2.append("li").call(_t.append("info_panels.measurement.location", { suffix: ":" }));
59900         coordItem.append("span").text(dmsCoordinatePair(location));
59901         coordItem.append("span").text(decimalCoordinatePair(location));
59902       }
59903       if (centroid) {
59904         coordItem = list2.append("li").call(_t.append("info_panels.measurement.centroid", { suffix: ":" }));
59905         coordItem.append("span").text(dmsCoordinatePair(centroid));
59906         coordItem.append("span").text(decimalCoordinatePair(centroid));
59907       }
59908       if (center) {
59909         coordItem = list2.append("li").call(_t.append("info_panels.measurement.center", { suffix: ":" }));
59910         coordItem.append("span").text(dmsCoordinatePair(center));
59911         coordItem.append("span").text(decimalCoordinatePair(center));
59912       }
59913       if (length2 || area || typeof distance === "number") {
59914         var toggle = _isImperial ? "imperial" : "metric";
59915         selection2.append("a").call(_t.append("info_panels.measurement." + toggle)).attr("href", "#").attr("class", "button button-toggle-units").on("click", function(d3_event) {
59916           d3_event.preventDefault();
59917           _isImperial = !_isImperial;
59918           selection2.call(redraw);
59919         });
59920       }
59921     }
59922     var panel = function(selection2) {
59923       selection2.call(redraw);
59924       context.map().on("drawn.info-measurement", function() {
59925         selection2.call(redraw);
59926       });
59927       context.on("enter.info-measurement", function() {
59928         selection2.call(redraw);
59929       });
59930     };
59931     panel.off = function() {
59932       context.map().on("drawn.info-measurement", null);
59933       context.on("enter.info-measurement", null);
59934     };
59935     panel.id = "measurement";
59936     panel.label = _t.append("info_panels.measurement.title");
59937     panel.key = _t("info_panels.measurement.key");
59938     return panel;
59939   }
59940   var init_measurement = __esm({
59941     "modules/ui/panels/measurement.js"() {
59942       "use strict";
59943       init_src2();
59944       init_localizer();
59945       init_units();
59946       init_geo2();
59947       init_services();
59948       init_util();
59949     }
59950   });
59951
59952   // modules/ui/panels/index.js
59953   var panels_exports = {};
59954   __export(panels_exports, {
59955     uiInfoPanels: () => uiInfoPanels,
59956     uiPanelBackground: () => uiPanelBackground,
59957     uiPanelHistory: () => uiPanelHistory,
59958     uiPanelLocation: () => uiPanelLocation,
59959     uiPanelMeasurement: () => uiPanelMeasurement
59960   });
59961   var uiInfoPanels;
59962   var init_panels = __esm({
59963     "modules/ui/panels/index.js"() {
59964       "use strict";
59965       init_background();
59966       init_history2();
59967       init_location();
59968       init_measurement();
59969       init_background();
59970       init_history2();
59971       init_location();
59972       init_measurement();
59973       uiInfoPanels = {
59974         background: uiPanelBackground,
59975         history: uiPanelHistory,
59976         location: uiPanelLocation,
59977         measurement: uiPanelMeasurement
59978       };
59979     }
59980   });
59981
59982   // modules/ui/info.js
59983   var info_exports = {};
59984   __export(info_exports, {
59985     uiInfo: () => uiInfo
59986   });
59987   function uiInfo(context) {
59988     var ids = Object.keys(uiInfoPanels);
59989     var wasActive = ["measurement"];
59990     var panels = {};
59991     var active = {};
59992     ids.forEach(function(k2) {
59993       if (!panels[k2]) {
59994         panels[k2] = uiInfoPanels[k2](context);
59995         active[k2] = false;
59996       }
59997     });
59998     function info(selection2) {
59999       function redraw() {
60000         var activeids = ids.filter(function(k2) {
60001           return active[k2];
60002         }).sort();
60003         var containers = infoPanels.selectAll(".panel-container").data(activeids, function(k2) {
60004           return k2;
60005         });
60006         containers.exit().style("opacity", 1).transition().duration(200).style("opacity", 0).on("end", function(d2) {
60007           select_default2(this).call(panels[d2].off).remove();
60008         });
60009         var enter = containers.enter().append("div").attr("class", function(d2) {
60010           return "fillD2 panel-container panel-container-" + d2;
60011         });
60012         enter.style("opacity", 0).transition().duration(200).style("opacity", 1);
60013         var title = enter.append("div").attr("class", "panel-title fillD2");
60014         title.append("h3").each(function(d2) {
60015           return panels[d2].label(select_default2(this));
60016         });
60017         title.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function(d3_event, d2) {
60018           d3_event.stopImmediatePropagation();
60019           d3_event.preventDefault();
60020           info.toggle(d2);
60021         }).call(svgIcon("#iD-icon-close"));
60022         enter.append("div").attr("class", function(d2) {
60023           return "panel-content panel-content-" + d2;
60024         });
60025         infoPanels.selectAll(".panel-content").each(function(d2) {
60026           select_default2(this).call(panels[d2]);
60027         });
60028       }
60029       info.toggle = function(which) {
60030         var activeids = ids.filter(function(k2) {
60031           return active[k2];
60032         });
60033         if (which) {
60034           active[which] = !active[which];
60035           if (activeids.length === 1 && activeids[0] === which) {
60036             wasActive = [which];
60037           }
60038           context.container().select("." + which + "-panel-toggle-item").classed("active", active[which]).select("input").property("checked", active[which]);
60039         } else {
60040           if (activeids.length) {
60041             wasActive = activeids;
60042             activeids.forEach(function(k2) {
60043               active[k2] = false;
60044             });
60045           } else {
60046             wasActive.forEach(function(k2) {
60047               active[k2] = true;
60048             });
60049           }
60050         }
60051         redraw();
60052       };
60053       var infoPanels = selection2.selectAll(".info-panels").data([0]);
60054       infoPanels = infoPanels.enter().append("div").attr("class", "info-panels").merge(infoPanels);
60055       redraw();
60056       context.keybinding().on(uiCmd("\u2318" + _t("info_panels.key")), function(d3_event) {
60057         if (d3_event.shiftKey) return;
60058         d3_event.stopImmediatePropagation();
60059         d3_event.preventDefault();
60060         info.toggle();
60061       });
60062       ids.forEach(function(k2) {
60063         var key = _t("info_panels." + k2 + ".key", { default: null });
60064         if (!key) return;
60065         context.keybinding().on(uiCmd("\u2318\u21E7" + key), function(d3_event) {
60066           d3_event.stopImmediatePropagation();
60067           d3_event.preventDefault();
60068           info.toggle(k2);
60069         });
60070       });
60071     }
60072     return info;
60073   }
60074   var init_info = __esm({
60075     "modules/ui/info.js"() {
60076       "use strict";
60077       init_src5();
60078       init_localizer();
60079       init_icon();
60080       init_cmd();
60081       init_panels();
60082     }
60083   });
60084
60085   // modules/ui/toggle.js
60086   var toggle_exports = {};
60087   __export(toggle_exports, {
60088     uiToggle: () => uiToggle
60089   });
60090   function uiToggle(show, callback) {
60091     return function(selection2) {
60092       selection2.style("opacity", show ? 0 : 1).classed("hide", false).transition().style("opacity", show ? 1 : 0).on("end", function() {
60093         select_default2(this).classed("hide", !show).style("opacity", null);
60094         if (callback) callback.apply(this);
60095       });
60096     };
60097   }
60098   var init_toggle = __esm({
60099     "modules/ui/toggle.js"() {
60100       "use strict";
60101       init_src5();
60102     }
60103   });
60104
60105   // modules/ui/curtain.js
60106   var curtain_exports = {};
60107   __export(curtain_exports, {
60108     uiCurtain: () => uiCurtain
60109   });
60110   function uiCurtain(containerNode) {
60111     var surface = select_default2(null), tooltip = select_default2(null), darkness = select_default2(null);
60112     function curtain(selection2) {
60113       surface = selection2.append("svg").attr("class", "curtain").style("top", 0).style("left", 0);
60114       darkness = surface.append("path").attr("x", 0).attr("y", 0).attr("class", "curtain-darkness");
60115       select_default2(window).on("resize.curtain", resize);
60116       tooltip = selection2.append("div").attr("class", "tooltip");
60117       tooltip.append("div").attr("class", "popover-arrow");
60118       tooltip.append("div").attr("class", "popover-inner");
60119       resize();
60120       function resize() {
60121         surface.attr("width", containerNode.clientWidth).attr("height", containerNode.clientHeight);
60122         curtain.cut(darkness.datum());
60123       }
60124     }
60125     curtain.reveal = function(box, html3, options2) {
60126       options2 = options2 || {};
60127       if (typeof box === "string") {
60128         box = select_default2(box).node();
60129       }
60130       if (box && box.getBoundingClientRect) {
60131         box = copyBox(box.getBoundingClientRect());
60132       }
60133       if (box) {
60134         var containerRect = containerNode.getBoundingClientRect();
60135         box.top -= containerRect.top;
60136         box.left -= containerRect.left;
60137       }
60138       if (box && options2.padding) {
60139         box.top -= options2.padding;
60140         box.left -= options2.padding;
60141         box.bottom += options2.padding;
60142         box.right += options2.padding;
60143         box.height += options2.padding * 2;
60144         box.width += options2.padding * 2;
60145       }
60146       var tooltipBox;
60147       if (options2.tooltipBox) {
60148         tooltipBox = options2.tooltipBox;
60149         if (typeof tooltipBox === "string") {
60150           tooltipBox = select_default2(tooltipBox).node();
60151         }
60152         if (tooltipBox && tooltipBox.getBoundingClientRect) {
60153           tooltipBox = copyBox(tooltipBox.getBoundingClientRect());
60154         }
60155       } else {
60156         tooltipBox = box;
60157       }
60158       if (tooltipBox && html3) {
60159         if (html3.indexOf("**") !== -1) {
60160           if (html3.indexOf("<span") === 0) {
60161             html3 = html3.replace(/^(<span.*?>)(.+?)(\*\*)/, "$1<span>$2</span>$3");
60162           } else {
60163             html3 = html3.replace(/^(.+?)(\*\*)/, "<span>$1</span>$2");
60164           }
60165           html3 = html3.replace(/\*\*(.*?)\*\*/g, '<span class="instruction">$1</span>');
60166         }
60167         html3 = html3.replace(/\*(.*?)\*/g, "<em>$1</em>");
60168         html3 = html3.replace(/\{br\}/g, "<br/><br/>");
60169         if (options2.buttonText && options2.buttonCallback) {
60170           html3 += '<div class="button-section"><button href="#" class="button action">' + options2.buttonText + "</button></div>";
60171         }
60172         var classes = "curtain-tooltip popover tooltip arrowed in " + (options2.tooltipClass || "");
60173         tooltip.classed(classes, true).selectAll(".popover-inner").html(html3);
60174         if (options2.buttonText && options2.buttonCallback) {
60175           var button = tooltip.selectAll(".button-section .button.action");
60176           button.on("click", function(d3_event) {
60177             d3_event.preventDefault();
60178             options2.buttonCallback();
60179           });
60180         }
60181         var tip = copyBox(tooltip.node().getBoundingClientRect()), w2 = containerNode.clientWidth, h2 = containerNode.clientHeight, tooltipWidth = 200, tooltipArrow = 5, side, pos;
60182         if (options2.tooltipClass === "intro-mouse") {
60183           tip.height += 80;
60184         }
60185         if (tooltipBox.top + tooltipBox.height > h2) {
60186           tooltipBox.height -= tooltipBox.top + tooltipBox.height - h2;
60187         }
60188         if (tooltipBox.left + tooltipBox.width > w2) {
60189           tooltipBox.width -= tooltipBox.left + tooltipBox.width - w2;
60190         }
60191         const onLeftOrRightEdge = tooltipBox.left + tooltipBox.width / 2 > w2 - 100 || tooltipBox.left + tooltipBox.width / 2 < 100;
60192         if (tooltipBox.top + tooltipBox.height < 100 && !onLeftOrRightEdge) {
60193           side = "bottom";
60194           pos = [
60195             tooltipBox.left + tooltipBox.width / 2 - tip.width / 2,
60196             tooltipBox.top + tooltipBox.height
60197           ];
60198         } else if (tooltipBox.top > h2 - 140 && !onLeftOrRightEdge) {
60199           side = "top";
60200           pos = [
60201             tooltipBox.left + tooltipBox.width / 2 - tip.width / 2,
60202             tooltipBox.top - tip.height
60203           ];
60204         } else {
60205           var tipY = tooltipBox.top + tooltipBox.height / 2 - tip.height / 2;
60206           if (_mainLocalizer.textDirection() === "rtl") {
60207             if (tooltipBox.left - tooltipWidth - tooltipArrow < 70) {
60208               side = "right";
60209               pos = [tooltipBox.left + tooltipBox.width + tooltipArrow, tipY];
60210             } else {
60211               side = "left";
60212               pos = [tooltipBox.left - tooltipWidth - tooltipArrow, tipY];
60213             }
60214           } else {
60215             if (tooltipBox.left + tooltipBox.width + tooltipArrow + tooltipWidth > w2 - 70) {
60216               side = "left";
60217               pos = [tooltipBox.left - tooltipWidth - tooltipArrow, tipY];
60218             } else {
60219               side = "right";
60220               pos = [tooltipBox.left + tooltipBox.width + tooltipArrow, tipY];
60221             }
60222           }
60223         }
60224         if (options2.duration !== 0 || !tooltip.classed(side)) {
60225           tooltip.call(uiToggle(true));
60226         }
60227         tooltip.style("top", pos[1] + "px").style("left", pos[0] + "px").attr("class", classes + " " + side);
60228         var shiftY = 0;
60229         if (side === "left" || side === "right") {
60230           if (pos[1] < 60) {
60231             shiftY = 60 - pos[1];
60232           } else if (pos[1] + tip.height > h2 - 100) {
60233             shiftY = h2 - pos[1] - tip.height - 100;
60234           }
60235         }
60236         tooltip.selectAll(".popover-inner").style("top", shiftY + "px");
60237       } else {
60238         tooltip.classed("in", false).call(uiToggle(false));
60239       }
60240       curtain.cut(box, options2.duration);
60241       return tooltip;
60242     };
60243     curtain.cut = function(datum2, duration) {
60244       darkness.datum(datum2).interrupt();
60245       var selection2;
60246       if (duration === 0) {
60247         selection2 = darkness;
60248       } else {
60249         selection2 = darkness.transition().duration(duration || 600).ease(linear2);
60250       }
60251       selection2.attr("d", function(d2) {
60252         var containerWidth = containerNode.clientWidth;
60253         var containerHeight = containerNode.clientHeight;
60254         var string = "M 0,0 L 0," + containerHeight + " L " + containerWidth + "," + containerHeight + "L" + containerWidth + ",0 Z";
60255         if (!d2) return string;
60256         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";
60257       });
60258     };
60259     curtain.remove = function() {
60260       surface.remove();
60261       tooltip.remove();
60262       select_default2(window).on("resize.curtain", null);
60263     };
60264     function copyBox(src) {
60265       return {
60266         top: src.top,
60267         right: src.right,
60268         bottom: src.bottom,
60269         left: src.left,
60270         width: src.width,
60271         height: src.height
60272       };
60273     }
60274     return curtain;
60275   }
60276   var init_curtain = __esm({
60277     "modules/ui/curtain.js"() {
60278       "use strict";
60279       init_src10();
60280       init_src5();
60281       init_localizer();
60282       init_toggle();
60283     }
60284   });
60285
60286   // modules/ui/intro/welcome.js
60287   var welcome_exports = {};
60288   __export(welcome_exports, {
60289     uiIntroWelcome: () => uiIntroWelcome
60290   });
60291   function uiIntroWelcome(context, reveal) {
60292     var dispatch14 = dispatch_default("done");
60293     var chapter = {
60294       title: "intro.welcome.title"
60295     };
60296     function welcome() {
60297       context.map().centerZoom([-85.63591, 41.94285], 19);
60298       reveal(
60299         ".intro-nav-wrap .chapter-welcome",
60300         helpHtml("intro.welcome.welcome"),
60301         { buttonText: _t.html("intro.ok"), buttonCallback: practice }
60302       );
60303     }
60304     function practice() {
60305       reveal(
60306         ".intro-nav-wrap .chapter-welcome",
60307         helpHtml("intro.welcome.practice"),
60308         { buttonText: _t.html("intro.ok"), buttonCallback: words }
60309       );
60310     }
60311     function words() {
60312       reveal(
60313         ".intro-nav-wrap .chapter-welcome",
60314         helpHtml("intro.welcome.words"),
60315         { buttonText: _t.html("intro.ok"), buttonCallback: chapters }
60316       );
60317     }
60318     function chapters() {
60319       dispatch14.call("done");
60320       reveal(
60321         ".intro-nav-wrap .chapter-navigation",
60322         helpHtml("intro.welcome.chapters", { next: _t("intro.navigation.title") })
60323       );
60324     }
60325     chapter.enter = function() {
60326       welcome();
60327     };
60328     chapter.exit = function() {
60329       context.container().select(".curtain-tooltip.intro-mouse").selectAll(".counter").remove();
60330     };
60331     chapter.restart = function() {
60332       chapter.exit();
60333       chapter.enter();
60334     };
60335     return utilRebind(chapter, dispatch14, "on");
60336   }
60337   var init_welcome = __esm({
60338     "modules/ui/intro/welcome.js"() {
60339       "use strict";
60340       init_src4();
60341       init_helper();
60342       init_localizer();
60343       init_rebind();
60344     }
60345   });
60346
60347   // modules/ui/intro/navigation.js
60348   var navigation_exports = {};
60349   __export(navigation_exports, {
60350     uiIntroNavigation: () => uiIntroNavigation
60351   });
60352   function uiIntroNavigation(context, reveal) {
60353     var dispatch14 = dispatch_default("done");
60354     var timeouts = [];
60355     var hallId = "n2061";
60356     var townHall = [-85.63591, 41.94285];
60357     var springStreetId = "w397";
60358     var springStreetEndId = "n1834";
60359     var springStreet = [-85.63582, 41.94255];
60360     var onewayField = _mainPresetIndex.field("oneway");
60361     var maxspeedField = _mainPresetIndex.field("maxspeed");
60362     var chapter = {
60363       title: "intro.navigation.title"
60364     };
60365     function timeout2(f2, t2) {
60366       timeouts.push(window.setTimeout(f2, t2));
60367     }
60368     function eventCancel(d3_event) {
60369       d3_event.stopPropagation();
60370       d3_event.preventDefault();
60371     }
60372     function isTownHallSelected() {
60373       var ids = context.selectedIDs();
60374       return ids.length === 1 && ids[0] === hallId;
60375     }
60376     function dragMap() {
60377       context.enter(modeBrowse(context));
60378       context.history().reset("initial");
60379       var msec = transitionTime(townHall, context.map().center());
60380       if (msec) {
60381         reveal(null, null, { duration: 0 });
60382       }
60383       context.map().centerZoomEase(townHall, 19, msec);
60384       timeout2(function() {
60385         var centerStart = context.map().center();
60386         var textId = context.lastPointerType() === "mouse" ? "drag" : "drag_touch";
60387         var dragString = helpHtml("intro.navigation.map_info") + "{br}" + helpHtml("intro.navigation." + textId);
60388         reveal(".main-map .surface", dragString);
60389         context.map().on("drawn.intro", function() {
60390           reveal(".main-map .surface", dragString, { duration: 0 });
60391         });
60392         context.map().on("move.intro", function() {
60393           var centerNow = context.map().center();
60394           if (centerStart[0] !== centerNow[0] || centerStart[1] !== centerNow[1]) {
60395             context.map().on("move.intro", null);
60396             timeout2(function() {
60397               continueTo(zoomMap);
60398             }, 3e3);
60399           }
60400         });
60401       }, msec + 100);
60402       function continueTo(nextStep) {
60403         context.map().on("move.intro drawn.intro", null);
60404         nextStep();
60405       }
60406     }
60407     function zoomMap() {
60408       var zoomStart = context.map().zoom();
60409       var textId = context.lastPointerType() === "mouse" ? "zoom" : "zoom_touch";
60410       var zoomString = helpHtml("intro.navigation." + textId);
60411       reveal(".main-map .surface", zoomString);
60412       context.map().on("drawn.intro", function() {
60413         reveal(".main-map .surface", zoomString, { duration: 0 });
60414       });
60415       context.map().on("move.intro", function() {
60416         if (context.map().zoom() !== zoomStart) {
60417           context.map().on("move.intro", null);
60418           timeout2(function() {
60419             continueTo(features);
60420           }, 3e3);
60421         }
60422       });
60423       function continueTo(nextStep) {
60424         context.map().on("move.intro drawn.intro", null);
60425         nextStep();
60426       }
60427     }
60428     function features() {
60429       var onClick = function() {
60430         continueTo(pointsLinesAreas);
60431       };
60432       reveal(
60433         ".main-map .surface",
60434         helpHtml("intro.navigation.features"),
60435         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
60436       );
60437       context.map().on("drawn.intro", function() {
60438         reveal(
60439           ".main-map .surface",
60440           helpHtml("intro.navigation.features"),
60441           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
60442         );
60443       });
60444       function continueTo(nextStep) {
60445         context.map().on("drawn.intro", null);
60446         nextStep();
60447       }
60448     }
60449     function pointsLinesAreas() {
60450       var onClick = function() {
60451         continueTo(nodesWays);
60452       };
60453       reveal(
60454         ".main-map .surface",
60455         helpHtml("intro.navigation.points_lines_areas"),
60456         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
60457       );
60458       context.map().on("drawn.intro", function() {
60459         reveal(
60460           ".main-map .surface",
60461           helpHtml("intro.navigation.points_lines_areas"),
60462           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
60463         );
60464       });
60465       function continueTo(nextStep) {
60466         context.map().on("drawn.intro", null);
60467         nextStep();
60468       }
60469     }
60470     function nodesWays() {
60471       var onClick = function() {
60472         continueTo(clickTownHall);
60473       };
60474       reveal(
60475         ".main-map .surface",
60476         helpHtml("intro.navigation.nodes_ways"),
60477         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
60478       );
60479       context.map().on("drawn.intro", function() {
60480         reveal(
60481           ".main-map .surface",
60482           helpHtml("intro.navigation.nodes_ways"),
60483           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
60484         );
60485       });
60486       function continueTo(nextStep) {
60487         context.map().on("drawn.intro", null);
60488         nextStep();
60489       }
60490     }
60491     function clickTownHall() {
60492       context.enter(modeBrowse(context));
60493       context.history().reset("initial");
60494       var entity = context.hasEntity(hallId);
60495       if (!entity) return;
60496       reveal(null, null, { duration: 0 });
60497       context.map().centerZoomEase(entity.loc, 19, 500);
60498       timeout2(function() {
60499         var entity2 = context.hasEntity(hallId);
60500         if (!entity2) return;
60501         var box = pointBox(entity2.loc, context);
60502         var textId = context.lastPointerType() === "mouse" ? "click_townhall" : "tap_townhall";
60503         reveal(box, helpHtml("intro.navigation." + textId));
60504         context.map().on("move.intro drawn.intro", function() {
60505           var entity3 = context.hasEntity(hallId);
60506           if (!entity3) return;
60507           var box2 = pointBox(entity3.loc, context);
60508           reveal(box2, helpHtml("intro.navigation." + textId), { duration: 0 });
60509         });
60510         context.on("enter.intro", function() {
60511           if (isTownHallSelected()) continueTo(selectedTownHall);
60512         });
60513       }, 550);
60514       context.history().on("change.intro", function() {
60515         if (!context.hasEntity(hallId)) {
60516           continueTo(clickTownHall);
60517         }
60518       });
60519       function continueTo(nextStep) {
60520         context.on("enter.intro", null);
60521         context.map().on("move.intro drawn.intro", null);
60522         context.history().on("change.intro", null);
60523         nextStep();
60524       }
60525     }
60526     function selectedTownHall() {
60527       if (!isTownHallSelected()) return clickTownHall();
60528       var entity = context.hasEntity(hallId);
60529       if (!entity) return clickTownHall();
60530       var box = pointBox(entity.loc, context);
60531       var onClick = function() {
60532         continueTo(editorTownHall);
60533       };
60534       reveal(
60535         box,
60536         helpHtml("intro.navigation.selected_townhall"),
60537         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
60538       );
60539       context.map().on("move.intro drawn.intro", function() {
60540         var entity2 = context.hasEntity(hallId);
60541         if (!entity2) return;
60542         var box2 = pointBox(entity2.loc, context);
60543         reveal(
60544           box2,
60545           helpHtml("intro.navigation.selected_townhall"),
60546           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
60547         );
60548       });
60549       context.history().on("change.intro", function() {
60550         if (!context.hasEntity(hallId)) {
60551           continueTo(clickTownHall);
60552         }
60553       });
60554       function continueTo(nextStep) {
60555         context.map().on("move.intro drawn.intro", null);
60556         context.history().on("change.intro", null);
60557         nextStep();
60558       }
60559     }
60560     function editorTownHall() {
60561       if (!isTownHallSelected()) return clickTownHall();
60562       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
60563       var onClick = function() {
60564         continueTo(presetTownHall);
60565       };
60566       reveal(
60567         ".entity-editor-pane",
60568         helpHtml("intro.navigation.editor_townhall"),
60569         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
60570       );
60571       context.on("exit.intro", function() {
60572         continueTo(clickTownHall);
60573       });
60574       context.history().on("change.intro", function() {
60575         if (!context.hasEntity(hallId)) {
60576           continueTo(clickTownHall);
60577         }
60578       });
60579       function continueTo(nextStep) {
60580         context.on("exit.intro", null);
60581         context.history().on("change.intro", null);
60582         context.container().select(".inspector-wrap").on("wheel.intro", null);
60583         nextStep();
60584       }
60585     }
60586     function presetTownHall() {
60587       if (!isTownHallSelected()) return clickTownHall();
60588       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
60589       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
60590       var entity = context.entity(context.selectedIDs()[0]);
60591       var preset = _mainPresetIndex.match(entity, context.graph());
60592       var onClick = function() {
60593         continueTo(fieldsTownHall);
60594       };
60595       reveal(
60596         ".entity-editor-pane .section-feature-type",
60597         helpHtml("intro.navigation.preset_townhall", { preset: preset.name() }),
60598         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
60599       );
60600       context.on("exit.intro", function() {
60601         continueTo(clickTownHall);
60602       });
60603       context.history().on("change.intro", function() {
60604         if (!context.hasEntity(hallId)) {
60605           continueTo(clickTownHall);
60606         }
60607       });
60608       function continueTo(nextStep) {
60609         context.on("exit.intro", null);
60610         context.history().on("change.intro", null);
60611         context.container().select(".inspector-wrap").on("wheel.intro", null);
60612         nextStep();
60613       }
60614     }
60615     function fieldsTownHall() {
60616       if (!isTownHallSelected()) return clickTownHall();
60617       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
60618       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
60619       var onClick = function() {
60620         continueTo(closeTownHall);
60621       };
60622       reveal(
60623         ".entity-editor-pane .section-preset-fields",
60624         helpHtml("intro.navigation.fields_townhall"),
60625         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
60626       );
60627       context.on("exit.intro", function() {
60628         continueTo(clickTownHall);
60629       });
60630       context.history().on("change.intro", function() {
60631         if (!context.hasEntity(hallId)) {
60632           continueTo(clickTownHall);
60633         }
60634       });
60635       function continueTo(nextStep) {
60636         context.on("exit.intro", null);
60637         context.history().on("change.intro", null);
60638         context.container().select(".inspector-wrap").on("wheel.intro", null);
60639         nextStep();
60640       }
60641     }
60642     function closeTownHall() {
60643       if (!isTownHallSelected()) return clickTownHall();
60644       var selector = ".entity-editor-pane button.close svg use";
60645       var href = select_default2(selector).attr("href") || "#iD-icon-close";
60646       reveal(
60647         ".entity-editor-pane",
60648         helpHtml("intro.navigation.close_townhall", { button: { html: icon(href, "inline") } })
60649       );
60650       context.on("exit.intro", function() {
60651         continueTo(searchStreet);
60652       });
60653       context.history().on("change.intro", function() {
60654         var selector2 = ".entity-editor-pane button.close svg use";
60655         var href2 = select_default2(selector2).attr("href") || "#iD-icon-close";
60656         reveal(
60657           ".entity-editor-pane",
60658           helpHtml("intro.navigation.close_townhall", { button: { html: icon(href2, "inline") } }),
60659           { duration: 0 }
60660         );
60661       });
60662       function continueTo(nextStep) {
60663         context.on("exit.intro", null);
60664         context.history().on("change.intro", null);
60665         nextStep();
60666       }
60667     }
60668     function searchStreet() {
60669       context.enter(modeBrowse(context));
60670       context.history().reset("initial");
60671       var msec = transitionTime(springStreet, context.map().center());
60672       if (msec) {
60673         reveal(null, null, { duration: 0 });
60674       }
60675       context.map().centerZoomEase(springStreet, 19, msec);
60676       timeout2(function() {
60677         reveal(
60678           ".search-header input",
60679           helpHtml("intro.navigation.search_street", { name: _t("intro.graph.name.spring-street") })
60680         );
60681         context.container().select(".search-header input").on("keyup.intro", checkSearchResult);
60682       }, msec + 100);
60683     }
60684     function checkSearchResult() {
60685       var first = context.container().select(".feature-list-item:nth-child(0n+2)");
60686       var firstName = first.select(".entity-name");
60687       var name = _t("intro.graph.name.spring-street");
60688       if (!firstName.empty() && firstName.html() === name) {
60689         reveal(
60690           first.node(),
60691           helpHtml("intro.navigation.choose_street", { name }),
60692           { duration: 300 }
60693         );
60694         context.on("exit.intro", function() {
60695           continueTo(selectedStreet);
60696         });
60697         context.container().select(".search-header input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
60698       }
60699       function continueTo(nextStep) {
60700         context.on("exit.intro", null);
60701         context.container().select(".search-header input").on("keydown.intro", null).on("keyup.intro", null);
60702         nextStep();
60703       }
60704     }
60705     function selectedStreet() {
60706       if (!context.hasEntity(springStreetEndId) || !context.hasEntity(springStreetId)) {
60707         return searchStreet();
60708       }
60709       var onClick = function() {
60710         continueTo(editorStreet);
60711       };
60712       var entity = context.entity(springStreetEndId);
60713       var box = pointBox(entity.loc, context);
60714       box.height = 500;
60715       reveal(
60716         box,
60717         helpHtml("intro.navigation.selected_street", { name: _t("intro.graph.name.spring-street") }),
60718         { duration: 600, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
60719       );
60720       timeout2(function() {
60721         context.map().on("move.intro drawn.intro", function() {
60722           var entity2 = context.hasEntity(springStreetEndId);
60723           if (!entity2) return;
60724           var box2 = pointBox(entity2.loc, context);
60725           box2.height = 500;
60726           reveal(
60727             box2,
60728             helpHtml("intro.navigation.selected_street", { name: _t("intro.graph.name.spring-street") }),
60729             { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
60730           );
60731         });
60732       }, 600);
60733       context.on("enter.intro", function(mode) {
60734         if (!context.hasEntity(springStreetId)) {
60735           return continueTo(searchStreet);
60736         }
60737         var ids = context.selectedIDs();
60738         if (mode.id !== "select" || !ids.length || ids[0] !== springStreetId) {
60739           context.enter(modeSelect(context, [springStreetId]));
60740         }
60741       });
60742       context.history().on("change.intro", function() {
60743         if (!context.hasEntity(springStreetEndId) || !context.hasEntity(springStreetId)) {
60744           timeout2(function() {
60745             continueTo(searchStreet);
60746           }, 300);
60747         }
60748       });
60749       function continueTo(nextStep) {
60750         context.map().on("move.intro drawn.intro", null);
60751         context.on("enter.intro", null);
60752         context.history().on("change.intro", null);
60753         nextStep();
60754       }
60755     }
60756     function editorStreet() {
60757       var selector = ".entity-editor-pane button.close svg use";
60758       var href = select_default2(selector).attr("href") || "#iD-icon-close";
60759       reveal(".entity-editor-pane", helpHtml("intro.navigation.street_different_fields") + "{br}" + helpHtml("intro.navigation.editor_street", {
60760         button: { html: icon(href, "inline") },
60761         field1: onewayField.title(),
60762         field2: maxspeedField.title()
60763       }));
60764       context.on("exit.intro", function() {
60765         continueTo(play);
60766       });
60767       context.history().on("change.intro", function() {
60768         var selector2 = ".entity-editor-pane button.close svg use";
60769         var href2 = select_default2(selector2).attr("href") || "#iD-icon-close";
60770         reveal(
60771           ".entity-editor-pane",
60772           helpHtml("intro.navigation.street_different_fields") + "{br}" + helpHtml("intro.navigation.editor_street", {
60773             button: { html: icon(href2, "inline") },
60774             field1: onewayField.title(),
60775             field2: maxspeedField.title()
60776           }),
60777           { duration: 0 }
60778         );
60779       });
60780       function continueTo(nextStep) {
60781         context.on("exit.intro", null);
60782         context.history().on("change.intro", null);
60783         nextStep();
60784       }
60785     }
60786     function play() {
60787       dispatch14.call("done");
60788       reveal(
60789         ".ideditor",
60790         helpHtml("intro.navigation.play", { next: _t("intro.points.title") }),
60791         {
60792           tooltipBox: ".intro-nav-wrap .chapter-point",
60793           buttonText: _t.html("intro.ok"),
60794           buttonCallback: function() {
60795             reveal(".ideditor");
60796           }
60797         }
60798       );
60799     }
60800     chapter.enter = function() {
60801       dragMap();
60802     };
60803     chapter.exit = function() {
60804       timeouts.forEach(window.clearTimeout);
60805       context.on("enter.intro exit.intro", null);
60806       context.map().on("move.intro drawn.intro", null);
60807       context.history().on("change.intro", null);
60808       context.container().select(".inspector-wrap").on("wheel.intro", null);
60809       context.container().select(".search-header input").on("keydown.intro keyup.intro", null);
60810     };
60811     chapter.restart = function() {
60812       chapter.exit();
60813       chapter.enter();
60814     };
60815     return utilRebind(chapter, dispatch14, "on");
60816   }
60817   var init_navigation = __esm({
60818     "modules/ui/intro/navigation.js"() {
60819       "use strict";
60820       init_src4();
60821       init_src5();
60822       init_presets();
60823       init_localizer();
60824       init_browse();
60825       init_select5();
60826       init_rebind();
60827       init_helper();
60828     }
60829   });
60830
60831   // modules/ui/intro/point.js
60832   var point_exports = {};
60833   __export(point_exports, {
60834     uiIntroPoint: () => uiIntroPoint
60835   });
60836   function uiIntroPoint(context, reveal) {
60837     var dispatch14 = dispatch_default("done");
60838     var timeouts = [];
60839     var intersection2 = [-85.63279, 41.94394];
60840     var building = [-85.632422, 41.944045];
60841     var cafePreset = _mainPresetIndex.item("amenity/cafe");
60842     var _pointID = null;
60843     var chapter = {
60844       title: "intro.points.title"
60845     };
60846     function timeout2(f2, t2) {
60847       timeouts.push(window.setTimeout(f2, t2));
60848     }
60849     function eventCancel(d3_event) {
60850       d3_event.stopPropagation();
60851       d3_event.preventDefault();
60852     }
60853     function addPoint() {
60854       context.enter(modeBrowse(context));
60855       context.history().reset("initial");
60856       var msec = transitionTime(intersection2, context.map().center());
60857       if (msec) {
60858         reveal(null, null, { duration: 0 });
60859       }
60860       context.map().centerZoomEase(intersection2, 19, msec);
60861       timeout2(function() {
60862         var tooltip = reveal(
60863           "button.add-point",
60864           helpHtml("intro.points.points_info") + "{br}" + helpHtml("intro.points.add_point")
60865         );
60866         _pointID = null;
60867         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-points");
60868         context.on("enter.intro", function(mode) {
60869           if (mode.id !== "add-point") return;
60870           continueTo(placePoint);
60871         });
60872       }, msec + 100);
60873       function continueTo(nextStep) {
60874         context.on("enter.intro", null);
60875         nextStep();
60876       }
60877     }
60878     function placePoint() {
60879       if (context.mode().id !== "add-point") {
60880         return chapter.restart();
60881       }
60882       var pointBox2 = pad2(building, 150, context);
60883       var textId = context.lastPointerType() === "mouse" ? "place_point" : "place_point_touch";
60884       reveal(pointBox2, helpHtml("intro.points." + textId));
60885       context.map().on("move.intro drawn.intro", function() {
60886         pointBox2 = pad2(building, 150, context);
60887         reveal(pointBox2, helpHtml("intro.points." + textId), { duration: 0 });
60888       });
60889       context.on("enter.intro", function(mode) {
60890         if (mode.id !== "select") return chapter.restart();
60891         _pointID = context.mode().selectedIDs()[0];
60892         if (context.graph().geometry(_pointID) === "vertex") {
60893           context.map().on("move.intro drawn.intro", null);
60894           context.on("enter.intro", null);
60895           reveal(pointBox2, helpHtml("intro.points.place_point_error"), {
60896             buttonText: _t.html("intro.ok"),
60897             buttonCallback: function() {
60898               return chapter.restart();
60899             }
60900           });
60901         } else {
60902           continueTo(searchPreset);
60903         }
60904       });
60905       function continueTo(nextStep) {
60906         context.map().on("move.intro drawn.intro", null);
60907         context.on("enter.intro", null);
60908         nextStep();
60909       }
60910     }
60911     function searchPreset() {
60912       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
60913         return addPoint();
60914       }
60915       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
60916       context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
60917       reveal(
60918         ".preset-search-input",
60919         helpHtml("intro.points.search_cafe", { preset: cafePreset.name() })
60920       );
60921       context.on("enter.intro", function(mode) {
60922         if (!_pointID || !context.hasEntity(_pointID)) {
60923           return continueTo(addPoint);
60924         }
60925         var ids = context.selectedIDs();
60926         if (mode.id !== "select" || !ids.length || ids[0] !== _pointID) {
60927           context.enter(modeSelect(context, [_pointID]));
60928           context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
60929           context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
60930           reveal(
60931             ".preset-search-input",
60932             helpHtml("intro.points.search_cafe", { preset: cafePreset.name() })
60933           );
60934           context.history().on("change.intro", null);
60935         }
60936       });
60937       function checkPresetSearch() {
60938         var first = context.container().select(".preset-list-item:first-child");
60939         if (first.classed("preset-amenity-cafe")) {
60940           context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
60941           reveal(
60942             first.select(".preset-list-button").node(),
60943             helpHtml("intro.points.choose_cafe", { preset: cafePreset.name() }),
60944             { duration: 300 }
60945           );
60946           context.history().on("change.intro", function() {
60947             continueTo(aboutFeatureEditor);
60948           });
60949         }
60950       }
60951       function continueTo(nextStep) {
60952         context.on("enter.intro", null);
60953         context.history().on("change.intro", null);
60954         context.container().select(".inspector-wrap").on("wheel.intro", null);
60955         context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
60956         nextStep();
60957       }
60958     }
60959     function aboutFeatureEditor() {
60960       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
60961         return addPoint();
60962       }
60963       timeout2(function() {
60964         reveal(".entity-editor-pane", helpHtml("intro.points.feature_editor"), {
60965           tooltipClass: "intro-points-describe",
60966           buttonText: _t.html("intro.ok"),
60967           buttonCallback: function() {
60968             continueTo(addName);
60969           }
60970         });
60971       }, 400);
60972       context.on("exit.intro", function() {
60973         continueTo(reselectPoint);
60974       });
60975       function continueTo(nextStep) {
60976         context.on("exit.intro", null);
60977         nextStep();
60978       }
60979     }
60980     function addName() {
60981       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
60982         return addPoint();
60983       }
60984       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
60985       var addNameString = helpHtml("intro.points.fields_info") + "{br}" + helpHtml("intro.points.add_name") + "{br}" + helpHtml("intro.points.add_reminder");
60986       timeout2(function() {
60987         var entity = context.entity(_pointID);
60988         if (entity.tags.name) {
60989           var tooltip = reveal(".entity-editor-pane", addNameString, {
60990             tooltipClass: "intro-points-describe",
60991             buttonText: _t.html("intro.ok"),
60992             buttonCallback: function() {
60993               continueTo(addCloseEditor);
60994             }
60995           });
60996           tooltip.select(".instruction").style("display", "none");
60997         } else {
60998           reveal(
60999             ".entity-editor-pane",
61000             addNameString,
61001             { tooltipClass: "intro-points-describe" }
61002           );
61003         }
61004       }, 400);
61005       context.history().on("change.intro", function() {
61006         continueTo(addCloseEditor);
61007       });
61008       context.on("exit.intro", function() {
61009         continueTo(reselectPoint);
61010       });
61011       function continueTo(nextStep) {
61012         context.on("exit.intro", null);
61013         context.history().on("change.intro", null);
61014         nextStep();
61015       }
61016     }
61017     function addCloseEditor() {
61018       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
61019       var selector = ".entity-editor-pane button.close svg use";
61020       var href = select_default2(selector).attr("href") || "#iD-icon-close";
61021       context.on("exit.intro", function() {
61022         continueTo(reselectPoint);
61023       });
61024       reveal(
61025         ".entity-editor-pane",
61026         helpHtml("intro.points.add_close", { button: { html: icon(href, "inline") } })
61027       );
61028       function continueTo(nextStep) {
61029         context.on("exit.intro", null);
61030         nextStep();
61031       }
61032     }
61033     function reselectPoint() {
61034       if (!_pointID) return chapter.restart();
61035       var entity = context.hasEntity(_pointID);
61036       if (!entity) return chapter.restart();
61037       var oldPreset = _mainPresetIndex.match(entity, context.graph());
61038       context.replace(actionChangePreset(_pointID, oldPreset, cafePreset));
61039       context.enter(modeBrowse(context));
61040       var msec = transitionTime(entity.loc, context.map().center());
61041       if (msec) {
61042         reveal(null, null, { duration: 0 });
61043       }
61044       context.map().centerEase(entity.loc, msec);
61045       timeout2(function() {
61046         var box = pointBox(entity.loc, context);
61047         reveal(box, helpHtml("intro.points.reselect"), { duration: 600 });
61048         timeout2(function() {
61049           context.map().on("move.intro drawn.intro", function() {
61050             var entity2 = context.hasEntity(_pointID);
61051             if (!entity2) return chapter.restart();
61052             var box2 = pointBox(entity2.loc, context);
61053             reveal(box2, helpHtml("intro.points.reselect"), { duration: 0 });
61054           });
61055         }, 600);
61056         context.on("enter.intro", function(mode) {
61057           if (mode.id !== "select") return;
61058           continueTo(updatePoint);
61059         });
61060       }, msec + 100);
61061       function continueTo(nextStep) {
61062         context.map().on("move.intro drawn.intro", null);
61063         context.on("enter.intro", null);
61064         nextStep();
61065       }
61066     }
61067     function updatePoint() {
61068       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
61069         return continueTo(reselectPoint);
61070       }
61071       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
61072       context.on("exit.intro", function() {
61073         continueTo(reselectPoint);
61074       });
61075       context.history().on("change.intro", function() {
61076         continueTo(updateCloseEditor);
61077       });
61078       timeout2(function() {
61079         reveal(
61080           ".entity-editor-pane",
61081           helpHtml("intro.points.update"),
61082           { tooltipClass: "intro-points-describe" }
61083         );
61084       }, 400);
61085       function continueTo(nextStep) {
61086         context.on("exit.intro", null);
61087         context.history().on("change.intro", null);
61088         nextStep();
61089       }
61090     }
61091     function updateCloseEditor() {
61092       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
61093         return continueTo(reselectPoint);
61094       }
61095       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
61096       context.on("exit.intro", function() {
61097         continueTo(rightClickPoint);
61098       });
61099       timeout2(function() {
61100         reveal(
61101           ".entity-editor-pane",
61102           helpHtml("intro.points.update_close", { button: { html: icon("#iD-icon-close", "inline") } })
61103         );
61104       }, 500);
61105       function continueTo(nextStep) {
61106         context.on("exit.intro", null);
61107         nextStep();
61108       }
61109     }
61110     function rightClickPoint() {
61111       if (!_pointID) return chapter.restart();
61112       var entity = context.hasEntity(_pointID);
61113       if (!entity) return chapter.restart();
61114       context.enter(modeBrowse(context));
61115       var box = pointBox(entity.loc, context);
61116       var textId = context.lastPointerType() === "mouse" ? "rightclick" : "edit_menu_touch";
61117       reveal(box, helpHtml("intro.points." + textId), { duration: 600 });
61118       timeout2(function() {
61119         context.map().on("move.intro", function() {
61120           var entity2 = context.hasEntity(_pointID);
61121           if (!entity2) return chapter.restart();
61122           var box2 = pointBox(entity2.loc, context);
61123           reveal(box2, helpHtml("intro.points." + textId), { duration: 0 });
61124         });
61125       }, 600);
61126       context.on("enter.intro", function(mode) {
61127         if (mode.id !== "select") return;
61128         var ids = context.selectedIDs();
61129         if (ids.length !== 1 || ids[0] !== _pointID) return;
61130         timeout2(function() {
61131           var node = selectMenuItem(context, "delete").node();
61132           if (!node) return;
61133           continueTo(enterDelete);
61134         }, 50);
61135       });
61136       function continueTo(nextStep) {
61137         context.on("enter.intro", null);
61138         context.map().on("move.intro", null);
61139         nextStep();
61140       }
61141     }
61142     function enterDelete() {
61143       if (!_pointID) return chapter.restart();
61144       var entity = context.hasEntity(_pointID);
61145       if (!entity) return chapter.restart();
61146       var node = selectMenuItem(context, "delete").node();
61147       if (!node) {
61148         return continueTo(rightClickPoint);
61149       }
61150       reveal(
61151         ".edit-menu",
61152         helpHtml("intro.points.delete"),
61153         { padding: 50 }
61154       );
61155       timeout2(function() {
61156         context.map().on("move.intro", function() {
61157           if (selectMenuItem(context, "delete").empty()) {
61158             return continueTo(rightClickPoint);
61159           }
61160           reveal(
61161             ".edit-menu",
61162             helpHtml("intro.points.delete"),
61163             { duration: 0, padding: 50 }
61164           );
61165         });
61166       }, 300);
61167       context.on("exit.intro", function() {
61168         if (!_pointID) return chapter.restart();
61169         var entity2 = context.hasEntity(_pointID);
61170         if (entity2) return continueTo(rightClickPoint);
61171       });
61172       context.history().on("change.intro", function(changed) {
61173         if (changed.deleted().length) {
61174           continueTo(undo);
61175         }
61176       });
61177       function continueTo(nextStep) {
61178         context.map().on("move.intro", null);
61179         context.history().on("change.intro", null);
61180         context.on("exit.intro", null);
61181         nextStep();
61182       }
61183     }
61184     function undo() {
61185       context.history().on("change.intro", function() {
61186         continueTo(play);
61187       });
61188       reveal(
61189         ".top-toolbar button.undo-button",
61190         helpHtml("intro.points.undo")
61191       );
61192       function continueTo(nextStep) {
61193         context.history().on("change.intro", null);
61194         nextStep();
61195       }
61196     }
61197     function play() {
61198       dispatch14.call("done");
61199       reveal(
61200         ".ideditor",
61201         helpHtml("intro.points.play", { next: _t("intro.areas.title") }),
61202         {
61203           tooltipBox: ".intro-nav-wrap .chapter-area",
61204           buttonText: _t.html("intro.ok"),
61205           buttonCallback: function() {
61206             reveal(".ideditor");
61207           }
61208         }
61209       );
61210     }
61211     chapter.enter = function() {
61212       addPoint();
61213     };
61214     chapter.exit = function() {
61215       timeouts.forEach(window.clearTimeout);
61216       context.on("enter.intro exit.intro", null);
61217       context.map().on("move.intro drawn.intro", null);
61218       context.history().on("change.intro", null);
61219       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
61220       context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
61221     };
61222     chapter.restart = function() {
61223       chapter.exit();
61224       chapter.enter();
61225     };
61226     return utilRebind(chapter, dispatch14, "on");
61227   }
61228   var init_point = __esm({
61229     "modules/ui/intro/point.js"() {
61230       "use strict";
61231       init_src4();
61232       init_src5();
61233       init_presets();
61234       init_localizer();
61235       init_change_preset();
61236       init_browse();
61237       init_select5();
61238       init_rebind();
61239       init_helper();
61240     }
61241   });
61242
61243   // modules/ui/intro/area.js
61244   var area_exports = {};
61245   __export(area_exports, {
61246     uiIntroArea: () => uiIntroArea
61247   });
61248   function uiIntroArea(context, reveal) {
61249     var dispatch14 = dispatch_default("done");
61250     var playground = [-85.63552, 41.94159];
61251     var playgroundPreset = _mainPresetIndex.item("leisure/playground");
61252     var nameField = _mainPresetIndex.field("name");
61253     var descriptionField = _mainPresetIndex.field("description");
61254     var timeouts = [];
61255     var _areaID;
61256     var chapter = {
61257       title: "intro.areas.title"
61258     };
61259     function timeout2(f2, t2) {
61260       timeouts.push(window.setTimeout(f2, t2));
61261     }
61262     function eventCancel(d3_event) {
61263       d3_event.stopPropagation();
61264       d3_event.preventDefault();
61265     }
61266     function revealPlayground(center, text, options2) {
61267       var padding = 180 * Math.pow(2, context.map().zoom() - 19.5);
61268       var box = pad2(center, padding, context);
61269       reveal(box, text, options2);
61270     }
61271     function addArea() {
61272       context.enter(modeBrowse(context));
61273       context.history().reset("initial");
61274       _areaID = null;
61275       var msec = transitionTime(playground, context.map().center());
61276       if (msec) {
61277         reveal(null, null, { duration: 0 });
61278       }
61279       context.map().centerZoomEase(playground, 19, msec);
61280       timeout2(function() {
61281         var tooltip = reveal(
61282           "button.add-area",
61283           helpHtml("intro.areas.add_playground")
61284         );
61285         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-areas");
61286         context.on("enter.intro", function(mode) {
61287           if (mode.id !== "add-area") return;
61288           continueTo(startPlayground);
61289         });
61290       }, msec + 100);
61291       function continueTo(nextStep) {
61292         context.on("enter.intro", null);
61293         nextStep();
61294       }
61295     }
61296     function startPlayground() {
61297       if (context.mode().id !== "add-area") {
61298         return chapter.restart();
61299       }
61300       _areaID = null;
61301       context.map().zoomEase(19.5, 500);
61302       timeout2(function() {
61303         var textId = context.lastPointerType() === "mouse" ? "starting_node_click" : "starting_node_tap";
61304         var startDrawString = helpHtml("intro.areas.start_playground") + helpHtml("intro.areas." + textId);
61305         revealPlayground(
61306           playground,
61307           startDrawString,
61308           { duration: 250 }
61309         );
61310         timeout2(function() {
61311           context.map().on("move.intro drawn.intro", function() {
61312             revealPlayground(
61313               playground,
61314               startDrawString,
61315               { duration: 0 }
61316             );
61317           });
61318           context.on("enter.intro", function(mode) {
61319             if (mode.id !== "draw-area") return chapter.restart();
61320             continueTo(continuePlayground);
61321           });
61322         }, 250);
61323       }, 550);
61324       function continueTo(nextStep) {
61325         context.map().on("move.intro drawn.intro", null);
61326         context.on("enter.intro", null);
61327         nextStep();
61328       }
61329     }
61330     function continuePlayground() {
61331       if (context.mode().id !== "draw-area") {
61332         return chapter.restart();
61333       }
61334       _areaID = null;
61335       revealPlayground(
61336         playground,
61337         helpHtml("intro.areas.continue_playground"),
61338         { duration: 250 }
61339       );
61340       timeout2(function() {
61341         context.map().on("move.intro drawn.intro", function() {
61342           revealPlayground(
61343             playground,
61344             helpHtml("intro.areas.continue_playground"),
61345             { duration: 0 }
61346           );
61347         });
61348       }, 250);
61349       context.on("enter.intro", function(mode) {
61350         if (mode.id === "draw-area") {
61351           var entity = context.hasEntity(context.selectedIDs()[0]);
61352           if (entity && entity.nodes.length >= 6) {
61353             return continueTo(finishPlayground);
61354           } else {
61355             return;
61356           }
61357         } else if (mode.id === "select") {
61358           _areaID = context.selectedIDs()[0];
61359           return continueTo(searchPresets);
61360         } else {
61361           return chapter.restart();
61362         }
61363       });
61364       function continueTo(nextStep) {
61365         context.map().on("move.intro drawn.intro", null);
61366         context.on("enter.intro", null);
61367         nextStep();
61368       }
61369     }
61370     function finishPlayground() {
61371       if (context.mode().id !== "draw-area") {
61372         return chapter.restart();
61373       }
61374       _areaID = null;
61375       var finishString = helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.areas.finish_playground");
61376       revealPlayground(
61377         playground,
61378         finishString,
61379         { duration: 250 }
61380       );
61381       timeout2(function() {
61382         context.map().on("move.intro drawn.intro", function() {
61383           revealPlayground(
61384             playground,
61385             finishString,
61386             { duration: 0 }
61387           );
61388         });
61389       }, 250);
61390       context.on("enter.intro", function(mode) {
61391         if (mode.id === "draw-area") {
61392           return;
61393         } else if (mode.id === "select") {
61394           _areaID = context.selectedIDs()[0];
61395           return continueTo(searchPresets);
61396         } else {
61397           return chapter.restart();
61398         }
61399       });
61400       function continueTo(nextStep) {
61401         context.map().on("move.intro drawn.intro", null);
61402         context.on("enter.intro", null);
61403         nextStep();
61404       }
61405     }
61406     function searchPresets() {
61407       if (!_areaID || !context.hasEntity(_areaID)) {
61408         return addArea();
61409       }
61410       var ids = context.selectedIDs();
61411       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
61412         context.enter(modeSelect(context, [_areaID]));
61413       }
61414       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
61415       timeout2(function() {
61416         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
61417         context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
61418         reveal(
61419           ".preset-search-input",
61420           helpHtml("intro.areas.search_playground", { preset: playgroundPreset.name() })
61421         );
61422       }, 400);
61423       context.on("enter.intro", function(mode) {
61424         if (!_areaID || !context.hasEntity(_areaID)) {
61425           return continueTo(addArea);
61426         }
61427         var ids2 = context.selectedIDs();
61428         if (mode.id !== "select" || !ids2.length || ids2[0] !== _areaID) {
61429           context.enter(modeSelect(context, [_areaID]));
61430           context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
61431           context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
61432           context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
61433           reveal(
61434             ".preset-search-input",
61435             helpHtml("intro.areas.search_playground", { preset: playgroundPreset.name() })
61436           );
61437           context.history().on("change.intro", null);
61438         }
61439       });
61440       function checkPresetSearch() {
61441         var first = context.container().select(".preset-list-item:first-child");
61442         if (first.classed("preset-leisure-playground")) {
61443           reveal(
61444             first.select(".preset-list-button").node(),
61445             helpHtml("intro.areas.choose_playground", { preset: playgroundPreset.name() }),
61446             { duration: 300 }
61447           );
61448           context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
61449           context.history().on("change.intro", function() {
61450             continueTo(clickAddField);
61451           });
61452         }
61453       }
61454       function continueTo(nextStep) {
61455         context.container().select(".inspector-wrap").on("wheel.intro", null);
61456         context.on("enter.intro", null);
61457         context.history().on("change.intro", null);
61458         context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
61459         nextStep();
61460       }
61461     }
61462     function clickAddField() {
61463       if (!_areaID || !context.hasEntity(_areaID)) {
61464         return addArea();
61465       }
61466       var ids = context.selectedIDs();
61467       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
61468         return searchPresets();
61469       }
61470       if (!context.container().select(".form-field-description").empty()) {
61471         return continueTo(describePlayground);
61472       }
61473       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
61474       timeout2(function() {
61475         context.container().select(".inspector-wrap .panewrap").style("right", "0%");
61476         var entity = context.entity(_areaID);
61477         if (entity.tags.description) {
61478           return continueTo(play);
61479         }
61480         var box = context.container().select(".more-fields").node().getBoundingClientRect();
61481         if (box.top > 300) {
61482           var pane = context.container().select(".entity-editor-pane .inspector-body");
61483           var start2 = pane.node().scrollTop;
61484           var end = start2 + (box.top - 300);
61485           pane.transition().duration(250).tween("scroll.inspector", function() {
61486             var node = this;
61487             var i3 = number_default(start2, end);
61488             return function(t2) {
61489               node.scrollTop = i3(t2);
61490             };
61491           });
61492         }
61493         timeout2(function() {
61494           reveal(
61495             ".more-fields .combobox-input",
61496             helpHtml("intro.areas.add_field", {
61497               name: nameField.title(),
61498               description: descriptionField.title()
61499             }),
61500             { duration: 300 }
61501           );
61502           context.container().select(".more-fields .combobox-input").on("click.intro", function() {
61503             var watcher;
61504             watcher = window.setInterval(function() {
61505               if (!context.container().select("div.combobox").empty()) {
61506                 window.clearInterval(watcher);
61507                 continueTo(chooseDescriptionField);
61508               }
61509             }, 300);
61510           });
61511         }, 300);
61512       }, 400);
61513       context.on("exit.intro", function() {
61514         return continueTo(searchPresets);
61515       });
61516       function continueTo(nextStep) {
61517         context.container().select(".inspector-wrap").on("wheel.intro", null);
61518         context.container().select(".more-fields .combobox-input").on("click.intro", null);
61519         context.on("exit.intro", null);
61520         nextStep();
61521       }
61522     }
61523     function chooseDescriptionField() {
61524       if (!_areaID || !context.hasEntity(_areaID)) {
61525         return addArea();
61526       }
61527       var ids = context.selectedIDs();
61528       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
61529         return searchPresets();
61530       }
61531       if (!context.container().select(".form-field-description").empty()) {
61532         return continueTo(describePlayground);
61533       }
61534       if (context.container().select("div.combobox").empty()) {
61535         return continueTo(clickAddField);
61536       }
61537       var watcher;
61538       watcher = window.setInterval(function() {
61539         if (context.container().select("div.combobox").empty()) {
61540           window.clearInterval(watcher);
61541           timeout2(function() {
61542             if (context.container().select(".form-field-description").empty()) {
61543               continueTo(retryChooseDescription);
61544             } else {
61545               continueTo(describePlayground);
61546             }
61547           }, 300);
61548         }
61549       }, 300);
61550       reveal(
61551         "div.combobox",
61552         helpHtml("intro.areas.choose_field", { field: descriptionField.title() }),
61553         { duration: 300 }
61554       );
61555       context.on("exit.intro", function() {
61556         return continueTo(searchPresets);
61557       });
61558       function continueTo(nextStep) {
61559         if (watcher) window.clearInterval(watcher);
61560         context.on("exit.intro", null);
61561         nextStep();
61562       }
61563     }
61564     function describePlayground() {
61565       if (!_areaID || !context.hasEntity(_areaID)) {
61566         return addArea();
61567       }
61568       var ids = context.selectedIDs();
61569       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
61570         return searchPresets();
61571       }
61572       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
61573       if (context.container().select(".form-field-description").empty()) {
61574         return continueTo(retryChooseDescription);
61575       }
61576       context.on("exit.intro", function() {
61577         continueTo(play);
61578       });
61579       reveal(
61580         ".entity-editor-pane",
61581         helpHtml("intro.areas.describe_playground", { button: { html: icon("#iD-icon-close", "inline") } }),
61582         { duration: 300 }
61583       );
61584       function continueTo(nextStep) {
61585         context.on("exit.intro", null);
61586         nextStep();
61587       }
61588     }
61589     function retryChooseDescription() {
61590       if (!_areaID || !context.hasEntity(_areaID)) {
61591         return addArea();
61592       }
61593       var ids = context.selectedIDs();
61594       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
61595         return searchPresets();
61596       }
61597       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
61598       reveal(
61599         ".entity-editor-pane",
61600         helpHtml("intro.areas.retry_add_field", { field: descriptionField.title() }),
61601         {
61602           buttonText: _t.html("intro.ok"),
61603           buttonCallback: function() {
61604             continueTo(clickAddField);
61605           }
61606         }
61607       );
61608       context.on("exit.intro", function() {
61609         return continueTo(searchPresets);
61610       });
61611       function continueTo(nextStep) {
61612         context.on("exit.intro", null);
61613         nextStep();
61614       }
61615     }
61616     function play() {
61617       dispatch14.call("done");
61618       reveal(
61619         ".ideditor",
61620         helpHtml("intro.areas.play", { next: _t("intro.lines.title") }),
61621         {
61622           tooltipBox: ".intro-nav-wrap .chapter-line",
61623           buttonText: _t.html("intro.ok"),
61624           buttonCallback: function() {
61625             reveal(".ideditor");
61626           }
61627         }
61628       );
61629     }
61630     chapter.enter = function() {
61631       addArea();
61632     };
61633     chapter.exit = function() {
61634       timeouts.forEach(window.clearTimeout);
61635       context.on("enter.intro exit.intro", null);
61636       context.map().on("move.intro drawn.intro", null);
61637       context.history().on("change.intro", null);
61638       context.container().select(".inspector-wrap").on("wheel.intro", null);
61639       context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
61640       context.container().select(".more-fields .combobox-input").on("click.intro", null);
61641     };
61642     chapter.restart = function() {
61643       chapter.exit();
61644       chapter.enter();
61645     };
61646     return utilRebind(chapter, dispatch14, "on");
61647   }
61648   var init_area4 = __esm({
61649     "modules/ui/intro/area.js"() {
61650       "use strict";
61651       init_src4();
61652       init_src8();
61653       init_presets();
61654       init_localizer();
61655       init_browse();
61656       init_select5();
61657       init_rebind();
61658       init_helper();
61659     }
61660   });
61661
61662   // modules/ui/intro/line.js
61663   var line_exports = {};
61664   __export(line_exports, {
61665     uiIntroLine: () => uiIntroLine
61666   });
61667   function uiIntroLine(context, reveal) {
61668     var dispatch14 = dispatch_default("done");
61669     var timeouts = [];
61670     var _tulipRoadID = null;
61671     var flowerRoadID = "w646";
61672     var tulipRoadStart = [-85.6297754121684, 41.95805253325314];
61673     var tulipRoadMidpoint = [-85.62975395449628, 41.95787501510204];
61674     var tulipRoadIntersection = [-85.62974496187628, 41.95742515554585];
61675     var roadCategory = _mainPresetIndex.item("category-road_minor");
61676     var residentialPreset = _mainPresetIndex.item("highway/residential");
61677     var woodRoadID = "w525";
61678     var woodRoadEndID = "n2862";
61679     var woodRoadAddNode = [-85.62390110349587, 41.95397111462291];
61680     var woodRoadDragEndpoint = [-85.623867390213, 41.95466987786487];
61681     var woodRoadDragMidpoint = [-85.62386254803509, 41.95430395953872];
61682     var washingtonStreetID = "w522";
61683     var twelfthAvenueID = "w1";
61684     var eleventhAvenueEndID = "n3550";
61685     var twelfthAvenueEndID = "n5";
61686     var _washingtonSegmentID = null;
61687     var eleventhAvenueEnd = context.entity(eleventhAvenueEndID).loc;
61688     var twelfthAvenueEnd = context.entity(twelfthAvenueEndID).loc;
61689     var deleteLinesLoc = [-85.6219395542764, 41.95228033922477];
61690     var twelfthAvenue = [-85.62219310052491, 41.952505413152956];
61691     var chapter = {
61692       title: "intro.lines.title"
61693     };
61694     function timeout2(f2, t2) {
61695       timeouts.push(window.setTimeout(f2, t2));
61696     }
61697     function eventCancel(d3_event) {
61698       d3_event.stopPropagation();
61699       d3_event.preventDefault();
61700     }
61701     function addLine() {
61702       context.enter(modeBrowse(context));
61703       context.history().reset("initial");
61704       var msec = transitionTime(tulipRoadStart, context.map().center());
61705       if (msec) {
61706         reveal(null, null, { duration: 0 });
61707       }
61708       context.map().centerZoomEase(tulipRoadStart, 18.5, msec);
61709       timeout2(function() {
61710         var tooltip = reveal(
61711           "button.add-line",
61712           helpHtml("intro.lines.add_line")
61713         );
61714         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-lines");
61715         context.on("enter.intro", function(mode) {
61716           if (mode.id !== "add-line") return;
61717           continueTo(startLine);
61718         });
61719       }, msec + 100);
61720       function continueTo(nextStep) {
61721         context.on("enter.intro", null);
61722         nextStep();
61723       }
61724     }
61725     function startLine() {
61726       if (context.mode().id !== "add-line") return chapter.restart();
61727       _tulipRoadID = null;
61728       var padding = 70 * Math.pow(2, context.map().zoom() - 18);
61729       var box = pad2(tulipRoadStart, padding, context);
61730       box.height = box.height + 100;
61731       var textId = context.lastPointerType() === "mouse" ? "start_line" : "start_line_tap";
61732       var startLineString = helpHtml("intro.lines.missing_road") + "{br}" + helpHtml("intro.lines.line_draw_info") + helpHtml("intro.lines." + textId);
61733       reveal(box, startLineString);
61734       context.map().on("move.intro drawn.intro", function() {
61735         padding = 70 * Math.pow(2, context.map().zoom() - 18);
61736         box = pad2(tulipRoadStart, padding, context);
61737         box.height = box.height + 100;
61738         reveal(box, startLineString, { duration: 0 });
61739       });
61740       context.on("enter.intro", function(mode) {
61741         if (mode.id !== "draw-line") return chapter.restart();
61742         continueTo(drawLine);
61743       });
61744       function continueTo(nextStep) {
61745         context.map().on("move.intro drawn.intro", null);
61746         context.on("enter.intro", null);
61747         nextStep();
61748       }
61749     }
61750     function drawLine() {
61751       if (context.mode().id !== "draw-line") return chapter.restart();
61752       _tulipRoadID = context.mode().selectedIDs()[0];
61753       context.map().centerEase(tulipRoadMidpoint, 500);
61754       timeout2(function() {
61755         var padding = 200 * Math.pow(2, context.map().zoom() - 18.5);
61756         var box = pad2(tulipRoadMidpoint, padding, context);
61757         box.height = box.height * 2;
61758         reveal(
61759           box,
61760           helpHtml("intro.lines.intersect", { name: _t("intro.graph.name.flower-street") })
61761         );
61762         context.map().on("move.intro drawn.intro", function() {
61763           padding = 200 * Math.pow(2, context.map().zoom() - 18.5);
61764           box = pad2(tulipRoadMidpoint, padding, context);
61765           box.height = box.height * 2;
61766           reveal(
61767             box,
61768             helpHtml("intro.lines.intersect", { name: _t("intro.graph.name.flower-street") }),
61769             { duration: 0 }
61770           );
61771         });
61772       }, 550);
61773       context.history().on("change.intro", function() {
61774         if (isLineConnected()) {
61775           continueTo(continueLine);
61776         }
61777       });
61778       context.on("enter.intro", function(mode) {
61779         if (mode.id === "draw-line") {
61780           return;
61781         } else if (mode.id === "select") {
61782           continueTo(retryIntersect);
61783           return;
61784         } else {
61785           return chapter.restart();
61786         }
61787       });
61788       function continueTo(nextStep) {
61789         context.map().on("move.intro drawn.intro", null);
61790         context.history().on("change.intro", null);
61791         context.on("enter.intro", null);
61792         nextStep();
61793       }
61794     }
61795     function isLineConnected() {
61796       var entity = _tulipRoadID && context.hasEntity(_tulipRoadID);
61797       if (!entity) return false;
61798       var drawNodes = context.graph().childNodes(entity);
61799       return drawNodes.some(function(node) {
61800         return context.graph().parentWays(node).some(function(parent) {
61801           return parent.id === flowerRoadID;
61802         });
61803       });
61804     }
61805     function retryIntersect() {
61806       select_default2(window).on("pointerdown.intro mousedown.intro", eventCancel, true);
61807       var box = pad2(tulipRoadIntersection, 80, context);
61808       reveal(
61809         box,
61810         helpHtml("intro.lines.retry_intersect", { name: _t("intro.graph.name.flower-street") })
61811       );
61812       timeout2(chapter.restart, 3e3);
61813     }
61814     function continueLine() {
61815       if (context.mode().id !== "draw-line") return chapter.restart();
61816       var entity = _tulipRoadID && context.hasEntity(_tulipRoadID);
61817       if (!entity) return chapter.restart();
61818       context.map().centerEase(tulipRoadIntersection, 500);
61819       var continueLineText = helpHtml("intro.lines.continue_line") + "{br}" + helpHtml("intro.lines.finish_line_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.lines.finish_road");
61820       reveal(".main-map .surface", continueLineText);
61821       context.on("enter.intro", function(mode) {
61822         if (mode.id === "draw-line") {
61823           return;
61824         } else if (mode.id === "select") {
61825           return continueTo(chooseCategoryRoad);
61826         } else {
61827           return chapter.restart();
61828         }
61829       });
61830       function continueTo(nextStep) {
61831         context.on("enter.intro", null);
61832         nextStep();
61833       }
61834     }
61835     function chooseCategoryRoad() {
61836       if (context.mode().id !== "select") return chapter.restart();
61837       context.on("exit.intro", function() {
61838         return chapter.restart();
61839       });
61840       var button = context.container().select(".preset-category-road_minor .preset-list-button");
61841       if (button.empty()) return chapter.restart();
61842       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
61843       timeout2(function() {
61844         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
61845         reveal(
61846           button.node(),
61847           helpHtml("intro.lines.choose_category_road", { category: roadCategory.name() })
61848         );
61849         button.on("click.intro", function() {
61850           continueTo(choosePresetResidential);
61851         });
61852       }, 400);
61853       function continueTo(nextStep) {
61854         context.container().select(".inspector-wrap").on("wheel.intro", null);
61855         context.container().select(".preset-list-button").on("click.intro", null);
61856         context.on("exit.intro", null);
61857         nextStep();
61858       }
61859     }
61860     function choosePresetResidential() {
61861       if (context.mode().id !== "select") return chapter.restart();
61862       context.on("exit.intro", function() {
61863         return chapter.restart();
61864       });
61865       var subgrid = context.container().select(".preset-category-road_minor .subgrid");
61866       if (subgrid.empty()) return chapter.restart();
61867       subgrid.selectAll(":not(.preset-highway-residential) .preset-list-button").on("click.intro", function() {
61868         continueTo(retryPresetResidential);
61869       });
61870       subgrid.selectAll(".preset-highway-residential .preset-list-button").on("click.intro", function() {
61871         continueTo(nameRoad);
61872       });
61873       timeout2(function() {
61874         reveal(
61875           subgrid.node(),
61876           helpHtml("intro.lines.choose_preset_residential", { preset: residentialPreset.name() }),
61877           { tooltipBox: ".preset-highway-residential .preset-list-button", duration: 300 }
61878         );
61879       }, 300);
61880       function continueTo(nextStep) {
61881         context.container().select(".preset-list-button").on("click.intro", null);
61882         context.on("exit.intro", null);
61883         nextStep();
61884       }
61885     }
61886     function retryPresetResidential() {
61887       if (context.mode().id !== "select") return chapter.restart();
61888       context.on("exit.intro", function() {
61889         return chapter.restart();
61890       });
61891       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
61892       timeout2(function() {
61893         var button = context.container().select(".entity-editor-pane .preset-list-button");
61894         reveal(
61895           button.node(),
61896           helpHtml("intro.lines.retry_preset_residential", { preset: residentialPreset.name() })
61897         );
61898         button.on("click.intro", function() {
61899           continueTo(chooseCategoryRoad);
61900         });
61901       }, 500);
61902       function continueTo(nextStep) {
61903         context.container().select(".inspector-wrap").on("wheel.intro", null);
61904         context.container().select(".preset-list-button").on("click.intro", null);
61905         context.on("exit.intro", null);
61906         nextStep();
61907       }
61908     }
61909     function nameRoad() {
61910       context.on("exit.intro", function() {
61911         continueTo(didNameRoad);
61912       });
61913       timeout2(function() {
61914         reveal(
61915           ".entity-editor-pane",
61916           helpHtml("intro.lines.name_road", { button: { html: icon("#iD-icon-close", "inline") } }),
61917           { tooltipClass: "intro-lines-name_road" }
61918         );
61919       }, 500);
61920       function continueTo(nextStep) {
61921         context.on("exit.intro", null);
61922         nextStep();
61923       }
61924     }
61925     function didNameRoad() {
61926       context.history().checkpoint("doneAddLine");
61927       timeout2(function() {
61928         reveal(".main-map .surface", helpHtml("intro.lines.did_name_road"), {
61929           buttonText: _t.html("intro.ok"),
61930           buttonCallback: function() {
61931             continueTo(updateLine);
61932           }
61933         });
61934       }, 500);
61935       function continueTo(nextStep) {
61936         nextStep();
61937       }
61938     }
61939     function updateLine() {
61940       context.history().reset("doneAddLine");
61941       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
61942         return chapter.restart();
61943       }
61944       var msec = transitionTime(woodRoadDragMidpoint, context.map().center());
61945       if (msec) {
61946         reveal(null, null, { duration: 0 });
61947       }
61948       context.map().centerZoomEase(woodRoadDragMidpoint, 19, msec);
61949       timeout2(function() {
61950         var padding = 250 * Math.pow(2, context.map().zoom() - 19);
61951         var box = pad2(woodRoadDragMidpoint, padding, context);
61952         var advance = function() {
61953           continueTo(addNode);
61954         };
61955         reveal(
61956           box,
61957           helpHtml("intro.lines.update_line"),
61958           { buttonText: _t.html("intro.ok"), buttonCallback: advance }
61959         );
61960         context.map().on("move.intro drawn.intro", function() {
61961           var padding2 = 250 * Math.pow(2, context.map().zoom() - 19);
61962           var box2 = pad2(woodRoadDragMidpoint, padding2, context);
61963           reveal(
61964             box2,
61965             helpHtml("intro.lines.update_line"),
61966             { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
61967           );
61968         });
61969       }, msec + 100);
61970       function continueTo(nextStep) {
61971         context.map().on("move.intro drawn.intro", null);
61972         nextStep();
61973       }
61974     }
61975     function addNode() {
61976       context.history().reset("doneAddLine");
61977       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
61978         return chapter.restart();
61979       }
61980       var padding = 40 * Math.pow(2, context.map().zoom() - 19);
61981       var box = pad2(woodRoadAddNode, padding, context);
61982       var addNodeString = helpHtml("intro.lines.add_node" + (context.lastPointerType() === "mouse" ? "" : "_touch"));
61983       reveal(box, addNodeString);
61984       context.map().on("move.intro drawn.intro", function() {
61985         var padding2 = 40 * Math.pow(2, context.map().zoom() - 19);
61986         var box2 = pad2(woodRoadAddNode, padding2, context);
61987         reveal(box2, addNodeString, { duration: 0 });
61988       });
61989       context.history().on("change.intro", function(changed) {
61990         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
61991           return continueTo(updateLine);
61992         }
61993         if (changed.created().length === 1) {
61994           timeout2(function() {
61995             continueTo(startDragEndpoint);
61996           }, 500);
61997         }
61998       });
61999       context.on("enter.intro", function(mode) {
62000         if (mode.id !== "select") {
62001           continueTo(updateLine);
62002         }
62003       });
62004       function continueTo(nextStep) {
62005         context.map().on("move.intro drawn.intro", null);
62006         context.history().on("change.intro", null);
62007         context.on("enter.intro", null);
62008         nextStep();
62009       }
62010     }
62011     function startDragEndpoint() {
62012       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
62013         return continueTo(updateLine);
62014       }
62015       var padding = 100 * Math.pow(2, context.map().zoom() - 19);
62016       var box = pad2(woodRoadDragEndpoint, padding, context);
62017       var startDragString = helpHtml("intro.lines.start_drag_endpoint" + (context.lastPointerType() === "mouse" ? "" : "_touch")) + helpHtml("intro.lines.drag_to_intersection");
62018       reveal(box, startDragString);
62019       context.map().on("move.intro drawn.intro", function() {
62020         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
62021           return continueTo(updateLine);
62022         }
62023         var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
62024         var box2 = pad2(woodRoadDragEndpoint, padding2, context);
62025         reveal(box2, startDragString, { duration: 0 });
62026         var entity = context.entity(woodRoadEndID);
62027         if (geoSphericalDistance(entity.loc, woodRoadDragEndpoint) <= 4) {
62028           continueTo(finishDragEndpoint);
62029         }
62030       });
62031       function continueTo(nextStep) {
62032         context.map().on("move.intro drawn.intro", null);
62033         nextStep();
62034       }
62035     }
62036     function finishDragEndpoint() {
62037       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
62038         return continueTo(updateLine);
62039       }
62040       var padding = 100 * Math.pow(2, context.map().zoom() - 19);
62041       var box = pad2(woodRoadDragEndpoint, padding, context);
62042       var finishDragString = helpHtml("intro.lines.spot_looks_good") + helpHtml("intro.lines.finish_drag_endpoint" + (context.lastPointerType() === "mouse" ? "" : "_touch"));
62043       reveal(box, finishDragString);
62044       context.map().on("move.intro drawn.intro", function() {
62045         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
62046           return continueTo(updateLine);
62047         }
62048         var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
62049         var box2 = pad2(woodRoadDragEndpoint, padding2, context);
62050         reveal(box2, finishDragString, { duration: 0 });
62051         var entity = context.entity(woodRoadEndID);
62052         if (geoSphericalDistance(entity.loc, woodRoadDragEndpoint) > 4) {
62053           continueTo(startDragEndpoint);
62054         }
62055       });
62056       context.on("enter.intro", function() {
62057         continueTo(startDragMidpoint);
62058       });
62059       function continueTo(nextStep) {
62060         context.map().on("move.intro drawn.intro", null);
62061         context.on("enter.intro", null);
62062         nextStep();
62063       }
62064     }
62065     function startDragMidpoint() {
62066       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
62067         return continueTo(updateLine);
62068       }
62069       if (context.selectedIDs().indexOf(woodRoadID) === -1) {
62070         context.enter(modeSelect(context, [woodRoadID]));
62071       }
62072       var padding = 80 * Math.pow(2, context.map().zoom() - 19);
62073       var box = pad2(woodRoadDragMidpoint, padding, context);
62074       reveal(box, helpHtml("intro.lines.start_drag_midpoint"));
62075       context.map().on("move.intro drawn.intro", function() {
62076         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
62077           return continueTo(updateLine);
62078         }
62079         var padding2 = 80 * Math.pow(2, context.map().zoom() - 19);
62080         var box2 = pad2(woodRoadDragMidpoint, padding2, context);
62081         reveal(box2, helpHtml("intro.lines.start_drag_midpoint"), { duration: 0 });
62082       });
62083       context.history().on("change.intro", function(changed) {
62084         if (changed.created().length === 1) {
62085           continueTo(continueDragMidpoint);
62086         }
62087       });
62088       context.on("enter.intro", function(mode) {
62089         if (mode.id !== "select") {
62090           context.enter(modeSelect(context, [woodRoadID]));
62091         }
62092       });
62093       function continueTo(nextStep) {
62094         context.map().on("move.intro drawn.intro", null);
62095         context.history().on("change.intro", null);
62096         context.on("enter.intro", null);
62097         nextStep();
62098       }
62099     }
62100     function continueDragMidpoint() {
62101       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
62102         return continueTo(updateLine);
62103       }
62104       var padding = 100 * Math.pow(2, context.map().zoom() - 19);
62105       var box = pad2(woodRoadDragEndpoint, padding, context);
62106       box.height += 400;
62107       var advance = function() {
62108         context.history().checkpoint("doneUpdateLine");
62109         continueTo(deleteLines);
62110       };
62111       reveal(
62112         box,
62113         helpHtml("intro.lines.continue_drag_midpoint"),
62114         { buttonText: _t.html("intro.ok"), buttonCallback: advance }
62115       );
62116       context.map().on("move.intro drawn.intro", function() {
62117         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
62118           return continueTo(updateLine);
62119         }
62120         var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
62121         var box2 = pad2(woodRoadDragEndpoint, padding2, context);
62122         box2.height += 400;
62123         reveal(
62124           box2,
62125           helpHtml("intro.lines.continue_drag_midpoint"),
62126           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
62127         );
62128       });
62129       function continueTo(nextStep) {
62130         context.map().on("move.intro drawn.intro", null);
62131         nextStep();
62132       }
62133     }
62134     function deleteLines() {
62135       context.history().reset("doneUpdateLine");
62136       context.enter(modeBrowse(context));
62137       if (!context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
62138         return chapter.restart();
62139       }
62140       var msec = transitionTime(deleteLinesLoc, context.map().center());
62141       if (msec) {
62142         reveal(null, null, { duration: 0 });
62143       }
62144       context.map().centerZoomEase(deleteLinesLoc, 18, msec);
62145       timeout2(function() {
62146         var padding = 200 * Math.pow(2, context.map().zoom() - 18);
62147         var box = pad2(deleteLinesLoc, padding, context);
62148         box.top -= 200;
62149         box.height += 400;
62150         var advance = function() {
62151           continueTo(rightClickIntersection);
62152         };
62153         reveal(
62154           box,
62155           helpHtml("intro.lines.delete_lines", { street: _t("intro.graph.name.12th-avenue") }),
62156           { buttonText: _t.html("intro.ok"), buttonCallback: advance }
62157         );
62158         context.map().on("move.intro drawn.intro", function() {
62159           var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
62160           var box2 = pad2(deleteLinesLoc, padding2, context);
62161           box2.top -= 200;
62162           box2.height += 400;
62163           reveal(
62164             box2,
62165             helpHtml("intro.lines.delete_lines", { street: _t("intro.graph.name.12th-avenue") }),
62166             { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
62167           );
62168         });
62169         context.history().on("change.intro", function() {
62170           timeout2(function() {
62171             continueTo(deleteLines);
62172           }, 500);
62173         });
62174       }, msec + 100);
62175       function continueTo(nextStep) {
62176         context.map().on("move.intro drawn.intro", null);
62177         context.history().on("change.intro", null);
62178         nextStep();
62179       }
62180     }
62181     function rightClickIntersection() {
62182       context.history().reset("doneUpdateLine");
62183       context.enter(modeBrowse(context));
62184       context.map().centerZoomEase(eleventhAvenueEnd, 18, 500);
62185       var rightClickString = helpHtml("intro.lines.split_street", {
62186         street1: _t("intro.graph.name.11th-avenue"),
62187         street2: _t("intro.graph.name.washington-street")
62188       }) + helpHtml("intro.lines." + (context.lastPointerType() === "mouse" ? "rightclick_intersection" : "edit_menu_intersection_touch"));
62189       timeout2(function() {
62190         var padding = 60 * Math.pow(2, context.map().zoom() - 18);
62191         var box = pad2(eleventhAvenueEnd, padding, context);
62192         reveal(box, rightClickString);
62193         context.map().on("move.intro drawn.intro", function() {
62194           var padding2 = 60 * Math.pow(2, context.map().zoom() - 18);
62195           var box2 = pad2(eleventhAvenueEnd, padding2, context);
62196           reveal(
62197             box2,
62198             rightClickString,
62199             { duration: 0 }
62200           );
62201         });
62202         context.on("enter.intro", function(mode) {
62203           if (mode.id !== "select") return;
62204           var ids = context.selectedIDs();
62205           if (ids.length !== 1 || ids[0] !== eleventhAvenueEndID) return;
62206           timeout2(function() {
62207             var node = selectMenuItem(context, "split").node();
62208             if (!node) return;
62209             continueTo(splitIntersection);
62210           }, 50);
62211         });
62212         context.history().on("change.intro", function() {
62213           timeout2(function() {
62214             continueTo(deleteLines);
62215           }, 300);
62216         });
62217       }, 600);
62218       function continueTo(nextStep) {
62219         context.map().on("move.intro drawn.intro", null);
62220         context.on("enter.intro", null);
62221         context.history().on("change.intro", null);
62222         nextStep();
62223       }
62224     }
62225     function splitIntersection() {
62226       if (!context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
62227         return continueTo(deleteLines);
62228       }
62229       var node = selectMenuItem(context, "split").node();
62230       if (!node) {
62231         return continueTo(rightClickIntersection);
62232       }
62233       var wasChanged = false;
62234       _washingtonSegmentID = null;
62235       reveal(
62236         ".edit-menu",
62237         helpHtml(
62238           "intro.lines.split_intersection",
62239           { street: _t("intro.graph.name.washington-street") }
62240         ),
62241         { padding: 50 }
62242       );
62243       context.map().on("move.intro drawn.intro", function() {
62244         var node2 = selectMenuItem(context, "split").node();
62245         if (!wasChanged && !node2) {
62246           return continueTo(rightClickIntersection);
62247         }
62248         reveal(
62249           ".edit-menu",
62250           helpHtml(
62251             "intro.lines.split_intersection",
62252             { street: _t("intro.graph.name.washington-street") }
62253           ),
62254           { duration: 0, padding: 50 }
62255         );
62256       });
62257       context.history().on("change.intro", function(changed) {
62258         wasChanged = true;
62259         timeout2(function() {
62260           if (context.history().undoAnnotation() === _t("operations.split.annotation.line", { n: 1 })) {
62261             _washingtonSegmentID = changed.created()[0].id;
62262             continueTo(didSplit);
62263           } else {
62264             _washingtonSegmentID = null;
62265             continueTo(retrySplit);
62266           }
62267         }, 300);
62268       });
62269       function continueTo(nextStep) {
62270         context.map().on("move.intro drawn.intro", null);
62271         context.history().on("change.intro", null);
62272         nextStep();
62273       }
62274     }
62275     function retrySplit() {
62276       context.enter(modeBrowse(context));
62277       context.map().centerZoomEase(eleventhAvenueEnd, 18, 500);
62278       var advance = function() {
62279         continueTo(rightClickIntersection);
62280       };
62281       var padding = 60 * Math.pow(2, context.map().zoom() - 18);
62282       var box = pad2(eleventhAvenueEnd, padding, context);
62283       reveal(
62284         box,
62285         helpHtml("intro.lines.retry_split"),
62286         { buttonText: _t.html("intro.ok"), buttonCallback: advance }
62287       );
62288       context.map().on("move.intro drawn.intro", function() {
62289         var padding2 = 60 * Math.pow(2, context.map().zoom() - 18);
62290         var box2 = pad2(eleventhAvenueEnd, padding2, context);
62291         reveal(
62292           box2,
62293           helpHtml("intro.lines.retry_split"),
62294           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
62295         );
62296       });
62297       function continueTo(nextStep) {
62298         context.map().on("move.intro drawn.intro", null);
62299         nextStep();
62300       }
62301     }
62302     function didSplit() {
62303       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
62304         return continueTo(rightClickIntersection);
62305       }
62306       var ids = context.selectedIDs();
62307       var string = "intro.lines.did_split_" + (ids.length > 1 ? "multi" : "single");
62308       var street = _t("intro.graph.name.washington-street");
62309       var padding = 200 * Math.pow(2, context.map().zoom() - 18);
62310       var box = pad2(twelfthAvenue, padding, context);
62311       box.width = box.width / 2;
62312       reveal(
62313         box,
62314         helpHtml(string, { street1: street, street2: street }),
62315         { duration: 500 }
62316       );
62317       timeout2(function() {
62318         context.map().centerZoomEase(twelfthAvenue, 18, 500);
62319         context.map().on("move.intro drawn.intro", function() {
62320           var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
62321           var box2 = pad2(twelfthAvenue, padding2, context);
62322           box2.width = box2.width / 2;
62323           reveal(
62324             box2,
62325             helpHtml(string, { street1: street, street2: street }),
62326             { duration: 0 }
62327           );
62328         });
62329       }, 600);
62330       context.on("enter.intro", function() {
62331         var ids2 = context.selectedIDs();
62332         if (ids2.length === 1 && ids2[0] === _washingtonSegmentID) {
62333           continueTo(multiSelect2);
62334         }
62335       });
62336       context.history().on("change.intro", function() {
62337         if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
62338           return continueTo(rightClickIntersection);
62339         }
62340       });
62341       function continueTo(nextStep) {
62342         context.map().on("move.intro drawn.intro", null);
62343         context.on("enter.intro", null);
62344         context.history().on("change.intro", null);
62345         nextStep();
62346       }
62347     }
62348     function multiSelect2() {
62349       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
62350         return continueTo(rightClickIntersection);
62351       }
62352       var ids = context.selectedIDs();
62353       var hasWashington = ids.indexOf(_washingtonSegmentID) !== -1;
62354       var hasTwelfth = ids.indexOf(twelfthAvenueID) !== -1;
62355       if (hasWashington && hasTwelfth) {
62356         return continueTo(multiRightClick);
62357       } else if (!hasWashington && !hasTwelfth) {
62358         return continueTo(didSplit);
62359       }
62360       context.map().centerZoomEase(twelfthAvenue, 18, 500);
62361       timeout2(function() {
62362         var selected, other2, padding, box;
62363         if (hasWashington) {
62364           selected = _t("intro.graph.name.washington-street");
62365           other2 = _t("intro.graph.name.12th-avenue");
62366           padding = 60 * Math.pow(2, context.map().zoom() - 18);
62367           box = pad2(twelfthAvenueEnd, padding, context);
62368           box.width *= 3;
62369         } else {
62370           selected = _t("intro.graph.name.12th-avenue");
62371           other2 = _t("intro.graph.name.washington-street");
62372           padding = 200 * Math.pow(2, context.map().zoom() - 18);
62373           box = pad2(twelfthAvenue, padding, context);
62374           box.width /= 2;
62375         }
62376         reveal(
62377           box,
62378           helpHtml(
62379             "intro.lines.multi_select",
62380             { selected, other1: other2 }
62381           ) + " " + helpHtml(
62382             "intro.lines.add_to_selection_" + (context.lastPointerType() === "mouse" ? "click" : "touch"),
62383             { selected, other2 }
62384           )
62385         );
62386         context.map().on("move.intro drawn.intro", function() {
62387           if (hasWashington) {
62388             selected = _t("intro.graph.name.washington-street");
62389             other2 = _t("intro.graph.name.12th-avenue");
62390             padding = 60 * Math.pow(2, context.map().zoom() - 18);
62391             box = pad2(twelfthAvenueEnd, padding, context);
62392             box.width *= 3;
62393           } else {
62394             selected = _t("intro.graph.name.12th-avenue");
62395             other2 = _t("intro.graph.name.washington-street");
62396             padding = 200 * Math.pow(2, context.map().zoom() - 18);
62397             box = pad2(twelfthAvenue, padding, context);
62398             box.width /= 2;
62399           }
62400           reveal(
62401             box,
62402             helpHtml(
62403               "intro.lines.multi_select",
62404               { selected, other1: other2 }
62405             ) + " " + helpHtml(
62406               "intro.lines.add_to_selection_" + (context.lastPointerType() === "mouse" ? "click" : "touch"),
62407               { selected, other2 }
62408             ),
62409             { duration: 0 }
62410           );
62411         });
62412         context.on("enter.intro", function() {
62413           continueTo(multiSelect2);
62414         });
62415         context.history().on("change.intro", function() {
62416           if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
62417             return continueTo(rightClickIntersection);
62418           }
62419         });
62420       }, 600);
62421       function continueTo(nextStep) {
62422         context.map().on("move.intro drawn.intro", null);
62423         context.on("enter.intro", null);
62424         context.history().on("change.intro", null);
62425         nextStep();
62426       }
62427     }
62428     function multiRightClick() {
62429       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
62430         return continueTo(rightClickIntersection);
62431       }
62432       var padding = 200 * Math.pow(2, context.map().zoom() - 18);
62433       var box = pad2(twelfthAvenue, padding, context);
62434       var rightClickString = helpHtml("intro.lines.multi_select_success") + helpHtml("intro.lines.multi_" + (context.lastPointerType() === "mouse" ? "rightclick" : "edit_menu_touch"));
62435       reveal(box, rightClickString);
62436       context.map().on("move.intro drawn.intro", function() {
62437         var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
62438         var box2 = pad2(twelfthAvenue, padding2, context);
62439         reveal(box2, rightClickString, { duration: 0 });
62440       });
62441       context.ui().editMenu().on("toggled.intro", function(open) {
62442         if (!open) return;
62443         timeout2(function() {
62444           var ids = context.selectedIDs();
62445           if (ids.length === 2 && ids.indexOf(twelfthAvenueID) !== -1 && ids.indexOf(_washingtonSegmentID) !== -1) {
62446             var node = selectMenuItem(context, "delete").node();
62447             if (!node) return;
62448             continueTo(multiDelete);
62449           } else if (ids.length === 1 && ids.indexOf(_washingtonSegmentID) !== -1) {
62450             return continueTo(multiSelect2);
62451           } else {
62452             return continueTo(didSplit);
62453           }
62454         }, 300);
62455       });
62456       context.history().on("change.intro", function() {
62457         if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
62458           return continueTo(rightClickIntersection);
62459         }
62460       });
62461       function continueTo(nextStep) {
62462         context.map().on("move.intro drawn.intro", null);
62463         context.ui().editMenu().on("toggled.intro", null);
62464         context.history().on("change.intro", null);
62465         nextStep();
62466       }
62467     }
62468     function multiDelete() {
62469       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
62470         return continueTo(rightClickIntersection);
62471       }
62472       var node = selectMenuItem(context, "delete").node();
62473       if (!node) return continueTo(multiRightClick);
62474       reveal(
62475         ".edit-menu",
62476         helpHtml("intro.lines.multi_delete"),
62477         { padding: 50 }
62478       );
62479       context.map().on("move.intro drawn.intro", function() {
62480         reveal(
62481           ".edit-menu",
62482           helpHtml("intro.lines.multi_delete"),
62483           { duration: 0, padding: 50 }
62484         );
62485       });
62486       context.on("exit.intro", function() {
62487         if (context.hasEntity(_washingtonSegmentID) || context.hasEntity(twelfthAvenueID)) {
62488           return continueTo(multiSelect2);
62489         }
62490       });
62491       context.history().on("change.intro", function() {
62492         if (context.hasEntity(_washingtonSegmentID) || context.hasEntity(twelfthAvenueID)) {
62493           continueTo(retryDelete);
62494         } else {
62495           continueTo(play);
62496         }
62497       });
62498       function continueTo(nextStep) {
62499         context.map().on("move.intro drawn.intro", null);
62500         context.on("exit.intro", null);
62501         context.history().on("change.intro", null);
62502         nextStep();
62503       }
62504     }
62505     function retryDelete() {
62506       context.enter(modeBrowse(context));
62507       var padding = 200 * Math.pow(2, context.map().zoom() - 18);
62508       var box = pad2(twelfthAvenue, padding, context);
62509       reveal(box, helpHtml("intro.lines.retry_delete"), {
62510         buttonText: _t.html("intro.ok"),
62511         buttonCallback: function() {
62512           continueTo(multiSelect2);
62513         }
62514       });
62515       function continueTo(nextStep) {
62516         nextStep();
62517       }
62518     }
62519     function play() {
62520       dispatch14.call("done");
62521       reveal(
62522         ".ideditor",
62523         helpHtml("intro.lines.play", { next: _t("intro.buildings.title") }),
62524         {
62525           tooltipBox: ".intro-nav-wrap .chapter-building",
62526           buttonText: _t.html("intro.ok"),
62527           buttonCallback: function() {
62528             reveal(".ideditor");
62529           }
62530         }
62531       );
62532     }
62533     chapter.enter = function() {
62534       addLine();
62535     };
62536     chapter.exit = function() {
62537       timeouts.forEach(window.clearTimeout);
62538       select_default2(window).on("pointerdown.intro mousedown.intro", null, true);
62539       context.on("enter.intro exit.intro", null);
62540       context.map().on("move.intro drawn.intro", null);
62541       context.history().on("change.intro", null);
62542       context.container().select(".inspector-wrap").on("wheel.intro", null);
62543       context.container().select(".preset-list-button").on("click.intro", null);
62544     };
62545     chapter.restart = function() {
62546       chapter.exit();
62547       chapter.enter();
62548     };
62549     return utilRebind(chapter, dispatch14, "on");
62550   }
62551   var init_line2 = __esm({
62552     "modules/ui/intro/line.js"() {
62553       "use strict";
62554       init_src4();
62555       init_src5();
62556       init_presets();
62557       init_localizer();
62558       init_geo2();
62559       init_browse();
62560       init_select5();
62561       init_rebind();
62562       init_helper();
62563     }
62564   });
62565
62566   // modules/ui/intro/building.js
62567   var building_exports = {};
62568   __export(building_exports, {
62569     uiIntroBuilding: () => uiIntroBuilding
62570   });
62571   function uiIntroBuilding(context, reveal) {
62572     var dispatch14 = dispatch_default("done");
62573     var house = [-85.62815, 41.95638];
62574     var tank = [-85.62732, 41.95347];
62575     var buildingCatetory = _mainPresetIndex.item("category-building");
62576     var housePreset = _mainPresetIndex.item("building/house");
62577     var tankPreset = _mainPresetIndex.item("man_made/storage_tank");
62578     var timeouts = [];
62579     var _houseID = null;
62580     var _tankID = null;
62581     var chapter = {
62582       title: "intro.buildings.title"
62583     };
62584     function timeout2(f2, t2) {
62585       timeouts.push(window.setTimeout(f2, t2));
62586     }
62587     function eventCancel(d3_event) {
62588       d3_event.stopPropagation();
62589       d3_event.preventDefault();
62590     }
62591     function revealHouse(center, text, options2) {
62592       var padding = 160 * Math.pow(2, context.map().zoom() - 20);
62593       var box = pad2(center, padding, context);
62594       reveal(box, text, options2);
62595     }
62596     function revealTank(center, text, options2) {
62597       var padding = 190 * Math.pow(2, context.map().zoom() - 19.5);
62598       var box = pad2(center, padding, context);
62599       reveal(box, text, options2);
62600     }
62601     function addHouse() {
62602       context.enter(modeBrowse(context));
62603       context.history().reset("initial");
62604       _houseID = null;
62605       var msec = transitionTime(house, context.map().center());
62606       if (msec) {
62607         reveal(null, null, { duration: 0 });
62608       }
62609       context.map().centerZoomEase(house, 19, msec);
62610       timeout2(function() {
62611         var tooltip = reveal(
62612           "button.add-area",
62613           helpHtml("intro.buildings.add_building")
62614         );
62615         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-buildings");
62616         context.on("enter.intro", function(mode) {
62617           if (mode.id !== "add-area") return;
62618           continueTo(startHouse);
62619         });
62620       }, msec + 100);
62621       function continueTo(nextStep) {
62622         context.on("enter.intro", null);
62623         nextStep();
62624       }
62625     }
62626     function startHouse() {
62627       if (context.mode().id !== "add-area") {
62628         return continueTo(addHouse);
62629       }
62630       _houseID = null;
62631       context.map().zoomEase(20, 500);
62632       timeout2(function() {
62633         var startString = helpHtml("intro.buildings.start_building") + helpHtml("intro.buildings.building_corner_" + (context.lastPointerType() === "mouse" ? "click" : "tap"));
62634         revealHouse(house, startString);
62635         context.map().on("move.intro drawn.intro", function() {
62636           revealHouse(house, startString, { duration: 0 });
62637         });
62638         context.on("enter.intro", function(mode) {
62639           if (mode.id !== "draw-area") return chapter.restart();
62640           continueTo(continueHouse);
62641         });
62642       }, 550);
62643       function continueTo(nextStep) {
62644         context.map().on("move.intro drawn.intro", null);
62645         context.on("enter.intro", null);
62646         nextStep();
62647       }
62648     }
62649     function continueHouse() {
62650       if (context.mode().id !== "draw-area") {
62651         return continueTo(addHouse);
62652       }
62653       _houseID = null;
62654       var continueString = helpHtml("intro.buildings.continue_building") + "{br}" + helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.buildings.finish_building");
62655       revealHouse(house, continueString);
62656       context.map().on("move.intro drawn.intro", function() {
62657         revealHouse(house, continueString, { duration: 0 });
62658       });
62659       context.on("enter.intro", function(mode) {
62660         if (mode.id === "draw-area") {
62661           return;
62662         } else if (mode.id === "select") {
62663           var graph = context.graph();
62664           var way = context.entity(context.selectedIDs()[0]);
62665           var nodes = graph.childNodes(way);
62666           var points = utilArrayUniq(nodes).map(function(n3) {
62667             return context.projection(n3.loc);
62668           });
62669           if (isMostlySquare(points)) {
62670             _houseID = way.id;
62671             return continueTo(chooseCategoryBuilding);
62672           } else {
62673             return continueTo(retryHouse);
62674           }
62675         } else {
62676           return chapter.restart();
62677         }
62678       });
62679       function continueTo(nextStep) {
62680         context.map().on("move.intro drawn.intro", null);
62681         context.on("enter.intro", null);
62682         nextStep();
62683       }
62684     }
62685     function retryHouse() {
62686       var onClick = function() {
62687         continueTo(addHouse);
62688       };
62689       revealHouse(
62690         house,
62691         helpHtml("intro.buildings.retry_building"),
62692         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
62693       );
62694       context.map().on("move.intro drawn.intro", function() {
62695         revealHouse(
62696           house,
62697           helpHtml("intro.buildings.retry_building"),
62698           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
62699         );
62700       });
62701       function continueTo(nextStep) {
62702         context.map().on("move.intro drawn.intro", null);
62703         nextStep();
62704       }
62705     }
62706     function chooseCategoryBuilding() {
62707       if (!_houseID || !context.hasEntity(_houseID)) {
62708         return addHouse();
62709       }
62710       var ids = context.selectedIDs();
62711       if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
62712         context.enter(modeSelect(context, [_houseID]));
62713       }
62714       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
62715       timeout2(function() {
62716         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
62717         var button = context.container().select(".preset-category-building .preset-list-button");
62718         reveal(
62719           button.node(),
62720           helpHtml("intro.buildings.choose_category_building", { category: buildingCatetory.name() })
62721         );
62722         button.on("click.intro", function() {
62723           button.on("click.intro", null);
62724           continueTo(choosePresetHouse);
62725         });
62726       }, 400);
62727       context.on("enter.intro", function(mode) {
62728         if (!_houseID || !context.hasEntity(_houseID)) {
62729           return continueTo(addHouse);
62730         }
62731         var ids2 = context.selectedIDs();
62732         if (mode.id !== "select" || !ids2.length || ids2[0] !== _houseID) {
62733           return continueTo(chooseCategoryBuilding);
62734         }
62735       });
62736       function continueTo(nextStep) {
62737         context.container().select(".inspector-wrap").on("wheel.intro", null);
62738         context.container().select(".preset-list-button").on("click.intro", null);
62739         context.on("enter.intro", null);
62740         nextStep();
62741       }
62742     }
62743     function choosePresetHouse() {
62744       if (!_houseID || !context.hasEntity(_houseID)) {
62745         return addHouse();
62746       }
62747       var ids = context.selectedIDs();
62748       if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
62749         context.enter(modeSelect(context, [_houseID]));
62750       }
62751       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
62752       timeout2(function() {
62753         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
62754         var button = context.container().select(".preset-building-house .preset-list-button");
62755         reveal(
62756           button.node(),
62757           helpHtml("intro.buildings.choose_preset_house", { preset: housePreset.name() }),
62758           { duration: 300 }
62759         );
62760         button.on("click.intro", function() {
62761           button.on("click.intro", null);
62762           continueTo(closeEditorHouse);
62763         });
62764       }, 400);
62765       context.on("enter.intro", function(mode) {
62766         if (!_houseID || !context.hasEntity(_houseID)) {
62767           return continueTo(addHouse);
62768         }
62769         var ids2 = context.selectedIDs();
62770         if (mode.id !== "select" || !ids2.length || ids2[0] !== _houseID) {
62771           return continueTo(chooseCategoryBuilding);
62772         }
62773       });
62774       function continueTo(nextStep) {
62775         context.container().select(".inspector-wrap").on("wheel.intro", null);
62776         context.container().select(".preset-list-button").on("click.intro", null);
62777         context.on("enter.intro", null);
62778         nextStep();
62779       }
62780     }
62781     function closeEditorHouse() {
62782       if (!_houseID || !context.hasEntity(_houseID)) {
62783         return addHouse();
62784       }
62785       var ids = context.selectedIDs();
62786       if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
62787         context.enter(modeSelect(context, [_houseID]));
62788       }
62789       context.history().checkpoint("hasHouse");
62790       context.on("exit.intro", function() {
62791         continueTo(rightClickHouse);
62792       });
62793       timeout2(function() {
62794         reveal(
62795           ".entity-editor-pane",
62796           helpHtml("intro.buildings.close", { button: { html: icon("#iD-icon-close", "inline") } })
62797         );
62798       }, 500);
62799       function continueTo(nextStep) {
62800         context.on("exit.intro", null);
62801         nextStep();
62802       }
62803     }
62804     function rightClickHouse() {
62805       if (!_houseID) return chapter.restart();
62806       context.enter(modeBrowse(context));
62807       context.history().reset("hasHouse");
62808       var zoom = context.map().zoom();
62809       if (zoom < 20) {
62810         zoom = 20;
62811       }
62812       context.map().centerZoomEase(house, zoom, 500);
62813       context.on("enter.intro", function(mode) {
62814         if (mode.id !== "select") return;
62815         var ids = context.selectedIDs();
62816         if (ids.length !== 1 || ids[0] !== _houseID) return;
62817         timeout2(function() {
62818           var node = selectMenuItem(context, "orthogonalize").node();
62819           if (!node) return;
62820           continueTo(clickSquare);
62821         }, 50);
62822       });
62823       context.map().on("move.intro drawn.intro", function() {
62824         var rightclickString = helpHtml("intro.buildings." + (context.lastPointerType() === "mouse" ? "rightclick_building" : "edit_menu_building_touch"));
62825         revealHouse(house, rightclickString, { duration: 0 });
62826       });
62827       context.history().on("change.intro", function() {
62828         continueTo(rightClickHouse);
62829       });
62830       function continueTo(nextStep) {
62831         context.on("enter.intro", null);
62832         context.map().on("move.intro drawn.intro", null);
62833         context.history().on("change.intro", null);
62834         nextStep();
62835       }
62836     }
62837     function clickSquare() {
62838       if (!_houseID) return chapter.restart();
62839       var entity = context.hasEntity(_houseID);
62840       if (!entity) return continueTo(rightClickHouse);
62841       var node = selectMenuItem(context, "orthogonalize").node();
62842       if (!node) {
62843         return continueTo(rightClickHouse);
62844       }
62845       var wasChanged = false;
62846       reveal(
62847         ".edit-menu",
62848         helpHtml("intro.buildings.square_building"),
62849         { padding: 50 }
62850       );
62851       context.on("enter.intro", function(mode) {
62852         if (mode.id === "browse") {
62853           continueTo(rightClickHouse);
62854         } else if (mode.id === "move" || mode.id === "rotate") {
62855           continueTo(retryClickSquare);
62856         }
62857       });
62858       context.map().on("move.intro", function() {
62859         var node2 = selectMenuItem(context, "orthogonalize").node();
62860         if (!wasChanged && !node2) {
62861           return continueTo(rightClickHouse);
62862         }
62863         reveal(
62864           ".edit-menu",
62865           helpHtml("intro.buildings.square_building"),
62866           { duration: 0, padding: 50 }
62867         );
62868       });
62869       context.history().on("change.intro", function() {
62870         wasChanged = true;
62871         context.history().on("change.intro", null);
62872         timeout2(function() {
62873           if (context.history().undoAnnotation() === _t("operations.orthogonalize.annotation.feature", { n: 1 })) {
62874             continueTo(doneSquare);
62875           } else {
62876             continueTo(retryClickSquare);
62877           }
62878         }, 500);
62879       });
62880       function continueTo(nextStep) {
62881         context.on("enter.intro", null);
62882         context.map().on("move.intro", null);
62883         context.history().on("change.intro", null);
62884         nextStep();
62885       }
62886     }
62887     function retryClickSquare() {
62888       context.enter(modeBrowse(context));
62889       revealHouse(house, helpHtml("intro.buildings.retry_square"), {
62890         buttonText: _t.html("intro.ok"),
62891         buttonCallback: function() {
62892           continueTo(rightClickHouse);
62893         }
62894       });
62895       function continueTo(nextStep) {
62896         nextStep();
62897       }
62898     }
62899     function doneSquare() {
62900       context.history().checkpoint("doneSquare");
62901       revealHouse(house, helpHtml("intro.buildings.done_square"), {
62902         buttonText: _t.html("intro.ok"),
62903         buttonCallback: function() {
62904           continueTo(addTank);
62905         }
62906       });
62907       function continueTo(nextStep) {
62908         nextStep();
62909       }
62910     }
62911     function addTank() {
62912       context.enter(modeBrowse(context));
62913       context.history().reset("doneSquare");
62914       _tankID = null;
62915       var msec = transitionTime(tank, context.map().center());
62916       if (msec) {
62917         reveal(null, null, { duration: 0 });
62918       }
62919       context.map().centerZoomEase(tank, 19.5, msec);
62920       timeout2(function() {
62921         reveal(
62922           "button.add-area",
62923           helpHtml("intro.buildings.add_tank")
62924         );
62925         context.on("enter.intro", function(mode) {
62926           if (mode.id !== "add-area") return;
62927           continueTo(startTank);
62928         });
62929       }, msec + 100);
62930       function continueTo(nextStep) {
62931         context.on("enter.intro", null);
62932         nextStep();
62933       }
62934     }
62935     function startTank() {
62936       if (context.mode().id !== "add-area") {
62937         return continueTo(addTank);
62938       }
62939       _tankID = null;
62940       timeout2(function() {
62941         var startString = helpHtml("intro.buildings.start_tank") + helpHtml("intro.buildings.tank_edge_" + (context.lastPointerType() === "mouse" ? "click" : "tap"));
62942         revealTank(tank, startString);
62943         context.map().on("move.intro drawn.intro", function() {
62944           revealTank(tank, startString, { duration: 0 });
62945         });
62946         context.on("enter.intro", function(mode) {
62947           if (mode.id !== "draw-area") return chapter.restart();
62948           continueTo(continueTank);
62949         });
62950       }, 550);
62951       function continueTo(nextStep) {
62952         context.map().on("move.intro drawn.intro", null);
62953         context.on("enter.intro", null);
62954         nextStep();
62955       }
62956     }
62957     function continueTank() {
62958       if (context.mode().id !== "draw-area") {
62959         return continueTo(addTank);
62960       }
62961       _tankID = null;
62962       var continueString = helpHtml("intro.buildings.continue_tank") + "{br}" + helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.buildings.finish_tank");
62963       revealTank(tank, continueString);
62964       context.map().on("move.intro drawn.intro", function() {
62965         revealTank(tank, continueString, { duration: 0 });
62966       });
62967       context.on("enter.intro", function(mode) {
62968         if (mode.id === "draw-area") {
62969           return;
62970         } else if (mode.id === "select") {
62971           _tankID = context.selectedIDs()[0];
62972           return continueTo(searchPresetTank);
62973         } else {
62974           return continueTo(addTank);
62975         }
62976       });
62977       function continueTo(nextStep) {
62978         context.map().on("move.intro drawn.intro", null);
62979         context.on("enter.intro", null);
62980         nextStep();
62981       }
62982     }
62983     function searchPresetTank() {
62984       if (!_tankID || !context.hasEntity(_tankID)) {
62985         return addTank();
62986       }
62987       var ids = context.selectedIDs();
62988       if (context.mode().id !== "select" || !ids.length || ids[0] !== _tankID) {
62989         context.enter(modeSelect(context, [_tankID]));
62990       }
62991       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
62992       timeout2(function() {
62993         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
62994         context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
62995         reveal(
62996           ".preset-search-input",
62997           helpHtml("intro.buildings.search_tank", { preset: tankPreset.name() })
62998         );
62999       }, 400);
63000       context.on("enter.intro", function(mode) {
63001         if (!_tankID || !context.hasEntity(_tankID)) {
63002           return continueTo(addTank);
63003         }
63004         var ids2 = context.selectedIDs();
63005         if (mode.id !== "select" || !ids2.length || ids2[0] !== _tankID) {
63006           context.enter(modeSelect(context, [_tankID]));
63007           context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
63008           context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
63009           context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
63010           reveal(
63011             ".preset-search-input",
63012             helpHtml("intro.buildings.search_tank", { preset: tankPreset.name() })
63013           );
63014           context.history().on("change.intro", null);
63015         }
63016       });
63017       function checkPresetSearch() {
63018         var first = context.container().select(".preset-list-item:first-child");
63019         if (first.classed("preset-man_made-storage_tank")) {
63020           reveal(
63021             first.select(".preset-list-button").node(),
63022             helpHtml("intro.buildings.choose_tank", { preset: tankPreset.name() }),
63023             { duration: 300 }
63024           );
63025           context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
63026           context.history().on("change.intro", function() {
63027             continueTo(closeEditorTank);
63028           });
63029         }
63030       }
63031       function continueTo(nextStep) {
63032         context.container().select(".inspector-wrap").on("wheel.intro", null);
63033         context.on("enter.intro", null);
63034         context.history().on("change.intro", null);
63035         context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
63036         nextStep();
63037       }
63038     }
63039     function closeEditorTank() {
63040       if (!_tankID || !context.hasEntity(_tankID)) {
63041         return addTank();
63042       }
63043       var ids = context.selectedIDs();
63044       if (context.mode().id !== "select" || !ids.length || ids[0] !== _tankID) {
63045         context.enter(modeSelect(context, [_tankID]));
63046       }
63047       context.history().checkpoint("hasTank");
63048       context.on("exit.intro", function() {
63049         continueTo(rightClickTank);
63050       });
63051       timeout2(function() {
63052         reveal(
63053           ".entity-editor-pane",
63054           helpHtml("intro.buildings.close", { button: { html: icon("#iD-icon-close", "inline") } })
63055         );
63056       }, 500);
63057       function continueTo(nextStep) {
63058         context.on("exit.intro", null);
63059         nextStep();
63060       }
63061     }
63062     function rightClickTank() {
63063       if (!_tankID) return continueTo(addTank);
63064       context.enter(modeBrowse(context));
63065       context.history().reset("hasTank");
63066       context.map().centerEase(tank, 500);
63067       timeout2(function() {
63068         context.on("enter.intro", function(mode) {
63069           if (mode.id !== "select") return;
63070           var ids = context.selectedIDs();
63071           if (ids.length !== 1 || ids[0] !== _tankID) return;
63072           timeout2(function() {
63073             var node = selectMenuItem(context, "circularize").node();
63074             if (!node) return;
63075             continueTo(clickCircle);
63076           }, 50);
63077         });
63078         var rightclickString = helpHtml("intro.buildings." + (context.lastPointerType() === "mouse" ? "rightclick_tank" : "edit_menu_tank_touch"));
63079         revealTank(tank, rightclickString);
63080         context.map().on("move.intro drawn.intro", function() {
63081           revealTank(tank, rightclickString, { duration: 0 });
63082         });
63083         context.history().on("change.intro", function() {
63084           continueTo(rightClickTank);
63085         });
63086       }, 600);
63087       function continueTo(nextStep) {
63088         context.on("enter.intro", null);
63089         context.map().on("move.intro drawn.intro", null);
63090         context.history().on("change.intro", null);
63091         nextStep();
63092       }
63093     }
63094     function clickCircle() {
63095       if (!_tankID) return chapter.restart();
63096       var entity = context.hasEntity(_tankID);
63097       if (!entity) return continueTo(rightClickTank);
63098       var node = selectMenuItem(context, "circularize").node();
63099       if (!node) {
63100         return continueTo(rightClickTank);
63101       }
63102       var wasChanged = false;
63103       reveal(
63104         ".edit-menu",
63105         helpHtml("intro.buildings.circle_tank"),
63106         { padding: 50 }
63107       );
63108       context.on("enter.intro", function(mode) {
63109         if (mode.id === "browse") {
63110           continueTo(rightClickTank);
63111         } else if (mode.id === "move" || mode.id === "rotate") {
63112           continueTo(retryClickCircle);
63113         }
63114       });
63115       context.map().on("move.intro", function() {
63116         var node2 = selectMenuItem(context, "circularize").node();
63117         if (!wasChanged && !node2) {
63118           return continueTo(rightClickTank);
63119         }
63120         reveal(
63121           ".edit-menu",
63122           helpHtml("intro.buildings.circle_tank"),
63123           { duration: 0, padding: 50 }
63124         );
63125       });
63126       context.history().on("change.intro", function() {
63127         wasChanged = true;
63128         context.history().on("change.intro", null);
63129         timeout2(function() {
63130           if (context.history().undoAnnotation() === _t("operations.circularize.annotation.feature", { n: 1 })) {
63131             continueTo(play);
63132           } else {
63133             continueTo(retryClickCircle);
63134           }
63135         }, 500);
63136       });
63137       function continueTo(nextStep) {
63138         context.on("enter.intro", null);
63139         context.map().on("move.intro", null);
63140         context.history().on("change.intro", null);
63141         nextStep();
63142       }
63143     }
63144     function retryClickCircle() {
63145       context.enter(modeBrowse(context));
63146       revealTank(tank, helpHtml("intro.buildings.retry_circle"), {
63147         buttonText: _t.html("intro.ok"),
63148         buttonCallback: function() {
63149           continueTo(rightClickTank);
63150         }
63151       });
63152       function continueTo(nextStep) {
63153         nextStep();
63154       }
63155     }
63156     function play() {
63157       dispatch14.call("done");
63158       reveal(
63159         ".ideditor",
63160         helpHtml("intro.buildings.play", { next: _t("intro.startediting.title") }),
63161         {
63162           tooltipBox: ".intro-nav-wrap .chapter-startEditing",
63163           buttonText: _t.html("intro.ok"),
63164           buttonCallback: function() {
63165             reveal(".ideditor");
63166           }
63167         }
63168       );
63169     }
63170     chapter.enter = function() {
63171       addHouse();
63172     };
63173     chapter.exit = function() {
63174       timeouts.forEach(window.clearTimeout);
63175       context.on("enter.intro exit.intro", null);
63176       context.map().on("move.intro drawn.intro", null);
63177       context.history().on("change.intro", null);
63178       context.container().select(".inspector-wrap").on("wheel.intro", null);
63179       context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
63180       context.container().select(".more-fields .combobox-input").on("click.intro", null);
63181     };
63182     chapter.restart = function() {
63183       chapter.exit();
63184       chapter.enter();
63185     };
63186     return utilRebind(chapter, dispatch14, "on");
63187   }
63188   var init_building = __esm({
63189     "modules/ui/intro/building.js"() {
63190       "use strict";
63191       init_src4();
63192       init_presets();
63193       init_localizer();
63194       init_browse();
63195       init_select5();
63196       init_util();
63197       init_helper();
63198     }
63199   });
63200
63201   // modules/ui/intro/start_editing.js
63202   var start_editing_exports = {};
63203   __export(start_editing_exports, {
63204     uiIntroStartEditing: () => uiIntroStartEditing
63205   });
63206   function uiIntroStartEditing(context, reveal) {
63207     var dispatch14 = dispatch_default("done", "startEditing");
63208     var modalSelection = select_default2(null);
63209     var chapter = {
63210       title: "intro.startediting.title"
63211     };
63212     function showHelp() {
63213       reveal(
63214         ".map-control.help-control",
63215         helpHtml("intro.startediting.help"),
63216         {
63217           buttonText: _t.html("intro.ok"),
63218           buttonCallback: function() {
63219             shortcuts();
63220           }
63221         }
63222       );
63223     }
63224     function shortcuts() {
63225       reveal(
63226         ".map-control.help-control",
63227         helpHtml("intro.startediting.shortcuts"),
63228         {
63229           buttonText: _t.html("intro.ok"),
63230           buttonCallback: function() {
63231             showSave();
63232           }
63233         }
63234       );
63235     }
63236     function showSave() {
63237       context.container().selectAll(".shaded").remove();
63238       reveal(
63239         ".top-toolbar button.save",
63240         helpHtml("intro.startediting.save"),
63241         {
63242           buttonText: _t.html("intro.ok"),
63243           buttonCallback: function() {
63244             showStart();
63245           }
63246         }
63247       );
63248     }
63249     function showStart() {
63250       context.container().selectAll(".shaded").remove();
63251       modalSelection = uiModal(context.container());
63252       modalSelection.select(".modal").attr("class", "modal-splash modal");
63253       modalSelection.selectAll(".close").remove();
63254       var startbutton = modalSelection.select(".content").attr("class", "fillL").append("button").attr("class", "modal-section huge-modal-button").on("click", function() {
63255         modalSelection.remove();
63256       });
63257       startbutton.append("svg").attr("class", "illustration").append("use").attr("xlink:href", "#iD-logo-walkthrough");
63258       startbutton.append("h2").call(_t.append("intro.startediting.start"));
63259       dispatch14.call("startEditing");
63260     }
63261     chapter.enter = function() {
63262       showHelp();
63263     };
63264     chapter.exit = function() {
63265       modalSelection.remove();
63266       context.container().selectAll(".shaded").remove();
63267     };
63268     return utilRebind(chapter, dispatch14, "on");
63269   }
63270   var init_start_editing = __esm({
63271     "modules/ui/intro/start_editing.js"() {
63272       "use strict";
63273       init_src4();
63274       init_src5();
63275       init_localizer();
63276       init_helper();
63277       init_modal();
63278       init_rebind();
63279     }
63280   });
63281
63282   // modules/ui/intro/intro.js
63283   var intro_exports = {};
63284   __export(intro_exports, {
63285     uiIntro: () => uiIntro
63286   });
63287   function uiIntro(context) {
63288     const INTRO_IMAGERY = "EsriWorldImageryClarity";
63289     let _introGraph = {};
63290     let _currChapter;
63291     function intro(selection2) {
63292       _mainFileFetcher.get("intro_graph").then((dataIntroGraph) => {
63293         for (let id2 in dataIntroGraph) {
63294           if (!_introGraph[id2]) {
63295             _introGraph[id2] = osmEntity(localize(dataIntroGraph[id2]));
63296           }
63297         }
63298         selection2.call(startIntro);
63299       }).catch(function() {
63300       });
63301     }
63302     function startIntro(selection2) {
63303       context.enter(modeBrowse(context));
63304       let osm = context.connection();
63305       let history = context.history().toJSON();
63306       let hash2 = window.location.hash;
63307       let center = context.map().center();
63308       let zoom = context.map().zoom();
63309       let background = context.background().baseLayerSource();
63310       let overlays = context.background().overlayLayerSources();
63311       let opacity = context.container().selectAll(".main-map .layer-background").style("opacity");
63312       let caches = osm && osm.caches();
63313       let baseEntities = context.history().graph().base().entities;
63314       context.ui().sidebar.expand();
63315       context.container().selectAll("button.sidebar-toggle").classed("disabled", true);
63316       context.inIntro(true);
63317       if (osm) {
63318         osm.toggle(false).reset();
63319       }
63320       context.history().reset();
63321       context.history().merge(Object.values(coreGraph().load(_introGraph).entities));
63322       context.history().checkpoint("initial");
63323       let imagery = context.background().findSource(INTRO_IMAGERY);
63324       if (imagery) {
63325         context.background().baseLayerSource(imagery);
63326       } else {
63327         context.background().bing();
63328       }
63329       overlays.forEach((d2) => context.background().toggleOverlayLayer(d2));
63330       let layers = context.layers();
63331       layers.all().forEach((item) => {
63332         if (typeof item.layer.enabled === "function") {
63333           item.layer.enabled(item.id === "osm");
63334         }
63335       });
63336       context.container().selectAll(".main-map .layer-background").style("opacity", 1);
63337       let curtain = uiCurtain(context.container().node());
63338       selection2.call(curtain);
63339       corePreferences("walkthrough_started", "yes");
63340       let storedProgress = corePreferences("walkthrough_progress") || "";
63341       let progress = storedProgress.split(";").filter(Boolean);
63342       let chapters = chapterFlow.map((chapter, i3) => {
63343         let s2 = chapterUi[chapter](context, curtain.reveal).on("done", () => {
63344           buttons.filter((d2) => d2.title === s2.title).classed("finished", true);
63345           if (i3 < chapterFlow.length - 1) {
63346             const next = chapterFlow[i3 + 1];
63347             context.container().select(`button.chapter-${next}`).classed("next", true);
63348           }
63349           progress.push(chapter);
63350           corePreferences("walkthrough_progress", utilArrayUniq(progress).join(";"));
63351         });
63352         return s2;
63353       });
63354       chapters[chapters.length - 1].on("startEditing", () => {
63355         progress.push("startEditing");
63356         corePreferences("walkthrough_progress", utilArrayUniq(progress).join(";"));
63357         let incomplete = utilArrayDifference(chapterFlow, progress);
63358         if (!incomplete.length) {
63359           corePreferences("walkthrough_completed", "yes");
63360         }
63361         curtain.remove();
63362         navwrap.remove();
63363         context.container().selectAll(".main-map .layer-background").style("opacity", opacity);
63364         context.container().selectAll("button.sidebar-toggle").classed("disabled", false);
63365         if (osm) {
63366           osm.toggle(true).reset().caches(caches);
63367         }
63368         context.history().reset().merge(Object.values(baseEntities));
63369         context.background().baseLayerSource(background);
63370         overlays.forEach((d2) => context.background().toggleOverlayLayer(d2));
63371         if (history) {
63372           context.history().fromJSON(history, false);
63373         }
63374         context.map().centerZoom(center, zoom);
63375         window.location.replace(hash2);
63376         context.inIntro(false);
63377       });
63378       let navwrap = selection2.append("div").attr("class", "intro-nav-wrap fillD");
63379       navwrap.append("svg").attr("class", "intro-nav-wrap-logo").append("use").attr("xlink:href", "#iD-logo-walkthrough");
63380       let buttonwrap = navwrap.append("div").attr("class", "joined").selectAll("button.chapter");
63381       let buttons = buttonwrap.data(chapters).enter().append("button").attr("class", (d2, i3) => `chapter chapter-${chapterFlow[i3]}`).on("click", enterChapter);
63382       buttons.append("span").html((d2) => _t.html(d2.title));
63383       buttons.append("span").attr("class", "status").call(svgIcon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward", "inline"));
63384       enterChapter(null, chapters[0]);
63385       function enterChapter(d3_event, newChapter) {
63386         if (_currChapter) {
63387           _currChapter.exit();
63388         }
63389         context.enter(modeBrowse(context));
63390         _currChapter = newChapter;
63391         _currChapter.enter();
63392         buttons.classed("next", false).classed("active", (d2) => d2.title === _currChapter.title);
63393       }
63394     }
63395     return intro;
63396   }
63397   var chapterUi, chapterFlow;
63398   var init_intro = __esm({
63399     "modules/ui/intro/intro.js"() {
63400       "use strict";
63401       init_localizer();
63402       init_helper();
63403       init_preferences();
63404       init_file_fetcher();
63405       init_graph();
63406       init_browse();
63407       init_entity();
63408       init_icon();
63409       init_curtain();
63410       init_util();
63411       init_welcome();
63412       init_navigation();
63413       init_point();
63414       init_area4();
63415       init_line2();
63416       init_building();
63417       init_start_editing();
63418       chapterUi = {
63419         welcome: uiIntroWelcome,
63420         navigation: uiIntroNavigation,
63421         point: uiIntroPoint,
63422         area: uiIntroArea,
63423         line: uiIntroLine,
63424         building: uiIntroBuilding,
63425         startEditing: uiIntroStartEditing
63426       };
63427       chapterFlow = [
63428         "welcome",
63429         "navigation",
63430         "point",
63431         "area",
63432         "line",
63433         "building",
63434         "startEditing"
63435       ];
63436     }
63437   });
63438
63439   // modules/ui/intro/index.js
63440   var intro_exports2 = {};
63441   __export(intro_exports2, {
63442     uiIntro: () => uiIntro
63443   });
63444   var init_intro2 = __esm({
63445     "modules/ui/intro/index.js"() {
63446       "use strict";
63447       init_intro();
63448     }
63449   });
63450
63451   // modules/ui/issues_info.js
63452   var issues_info_exports = {};
63453   __export(issues_info_exports, {
63454     uiIssuesInfo: () => uiIssuesInfo
63455   });
63456   function uiIssuesInfo(context) {
63457     var warningsItem = {
63458       id: "warnings",
63459       count: 0,
63460       iconID: "iD-icon-alert",
63461       descriptionID: "issues.warnings_and_errors"
63462     };
63463     var resolvedItem = {
63464       id: "resolved",
63465       count: 0,
63466       iconID: "iD-icon-apply",
63467       descriptionID: "issues.user_resolved_issues"
63468     };
63469     function update(selection2) {
63470       var shownItems = [];
63471       var liveIssues = context.validator().getIssues({
63472         what: corePreferences("validate-what") || "edited",
63473         where: corePreferences("validate-where") || "all"
63474       });
63475       if (liveIssues.length) {
63476         warningsItem.count = liveIssues.length;
63477         shownItems.push(warningsItem);
63478       }
63479       if (corePreferences("validate-what") === "all") {
63480         var resolvedIssues = context.validator().getResolvedIssues();
63481         if (resolvedIssues.length) {
63482           resolvedItem.count = resolvedIssues.length;
63483           shownItems.push(resolvedItem);
63484         }
63485       }
63486       var chips = selection2.selectAll(".chip").data(shownItems, function(d2) {
63487         return d2.id;
63488       });
63489       chips.exit().remove();
63490       var enter = chips.enter().append("a").attr("class", function(d2) {
63491         return "chip " + d2.id + "-count";
63492       }).attr("href", "#").each(function(d2) {
63493         var chipSelection = select_default2(this);
63494         var tooltipBehavior = uiTooltip().placement("top").title(() => _t.append(d2.descriptionID));
63495         chipSelection.call(tooltipBehavior).on("click", function(d3_event) {
63496           d3_event.preventDefault();
63497           tooltipBehavior.hide(select_default2(this));
63498           context.ui().togglePanes(context.container().select(".map-panes .issues-pane"));
63499         });
63500         chipSelection.call(svgIcon("#" + d2.iconID));
63501       });
63502       enter.append("span").attr("class", "count");
63503       enter.merge(chips).selectAll("span.count").text(function(d2) {
63504         return d2.count.toString();
63505       });
63506     }
63507     return function(selection2) {
63508       update(selection2);
63509       context.validator().on("validated.infobox", function() {
63510         update(selection2);
63511       });
63512     };
63513   }
63514   var init_issues_info = __esm({
63515     "modules/ui/issues_info.js"() {
63516       "use strict";
63517       init_src5();
63518       init_preferences();
63519       init_icon();
63520       init_localizer();
63521       init_tooltip();
63522     }
63523   });
63524
63525   // modules/util/IntervalTasksQueue.js
63526   var IntervalTasksQueue_exports = {};
63527   __export(IntervalTasksQueue_exports, {
63528     IntervalTasksQueue: () => IntervalTasksQueue
63529   });
63530   var IntervalTasksQueue;
63531   var init_IntervalTasksQueue = __esm({
63532     "modules/util/IntervalTasksQueue.js"() {
63533       "use strict";
63534       IntervalTasksQueue = class {
63535         /**
63536          * Interval in milliseconds inside which only 1 task can execute.
63537          * e.g. if interval is 200ms, and 5 async tasks are unqueued,
63538          * they will complete in ~1s if not cleared
63539          * @param {number} intervalInMs
63540          */
63541         constructor(intervalInMs) {
63542           this.intervalInMs = intervalInMs;
63543           this.pendingHandles = [];
63544           this.time = 0;
63545         }
63546         enqueue(task) {
63547           let taskTimeout = this.time;
63548           this.time += this.intervalInMs;
63549           this.pendingHandles.push(setTimeout(() => {
63550             this.time -= this.intervalInMs;
63551             task();
63552           }, taskTimeout));
63553         }
63554         clear() {
63555           this.pendingHandles.forEach((timeoutHandle) => {
63556             clearTimeout(timeoutHandle);
63557           });
63558           this.pendingHandles = [];
63559           this.time = 0;
63560         }
63561       };
63562     }
63563   });
63564
63565   // modules/renderer/background_source.js
63566   var background_source_exports = {};
63567   __export(background_source_exports, {
63568     rendererBackgroundSource: () => rendererBackgroundSource
63569   });
63570   function localeDateString(s2) {
63571     if (!s2) return null;
63572     var options2 = { day: "numeric", month: "short", year: "numeric" };
63573     var d2 = new Date(s2);
63574     if (isNaN(d2.getTime())) return null;
63575     return d2.toLocaleDateString(_mainLocalizer.localeCode(), options2);
63576   }
63577   function vintageRange(vintage) {
63578     var s2;
63579     if (vintage.start || vintage.end) {
63580       s2 = vintage.start || "?";
63581       if (vintage.start !== vintage.end) {
63582         s2 += " - " + (vintage.end || "?");
63583       }
63584     }
63585     return s2;
63586   }
63587   function rendererBackgroundSource(data) {
63588     var source = Object.assign({}, data);
63589     var _offset = [0, 0];
63590     var _name = source.name;
63591     var _description = source.description;
63592     var _best = !!source.best;
63593     var _template = source.encrypted ? utilAesDecrypt(source.template) : source.template;
63594     source.tileSize = data.tileSize || 256;
63595     source.zoomExtent = data.zoomExtent || [0, 22];
63596     source.overzoom = data.overzoom !== false;
63597     source.offset = function(val) {
63598       if (!arguments.length) return _offset;
63599       _offset = val;
63600       return source;
63601     };
63602     source.nudge = function(val, zoomlevel) {
63603       _offset[0] += val[0] / Math.pow(2, zoomlevel);
63604       _offset[1] += val[1] / Math.pow(2, zoomlevel);
63605       return source;
63606     };
63607     source.name = function() {
63608       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
63609       return _t("imagery." + id_safe + ".name", { default: (0, import_lodash4.escape)(_name) });
63610     };
63611     source.label = function() {
63612       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
63613       return _t.append("imagery." + id_safe + ".name", { default: (0, import_lodash4.escape)(_name) });
63614     };
63615     source.hasDescription = function() {
63616       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
63617       var descriptionText = _mainLocalizer.tInfo("imagery." + id_safe + ".description", { default: (0, import_lodash4.escape)(_description) }).text;
63618       return descriptionText !== "";
63619     };
63620     source.description = function() {
63621       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
63622       return _t.append("imagery." + id_safe + ".description", { default: (0, import_lodash4.escape)(_description) });
63623     };
63624     source.best = function() {
63625       return _best;
63626     };
63627     source.area = function() {
63628       if (!data.polygon) return Number.MAX_VALUE;
63629       var area = area_default({ type: "MultiPolygon", coordinates: [data.polygon] });
63630       return isNaN(area) ? 0 : area;
63631     };
63632     source.imageryUsed = function() {
63633       return _name || source.id;
63634     };
63635     source.template = function(val) {
63636       if (!arguments.length) return _template;
63637       if (source.id === "custom" || source.id === "Bing") {
63638         _template = val;
63639       }
63640       return source;
63641     };
63642     source.url = function(coord2) {
63643       var result = _template.replace(/#[\s\S]*/u, "");
63644       if (result === "") return result;
63645       if (!source.type || source.id === "custom") {
63646         if (/SERVICE=WMS|\{(proj|wkid|bbox)\}/.test(result)) {
63647           source.type = "wms";
63648           source.projection = "EPSG:3857";
63649         } else if (/\{(x|y)\}/.test(result)) {
63650           source.type = "tms";
63651         } else if (/\{u\}/.test(result)) {
63652           source.type = "bing";
63653         }
63654       }
63655       if (source.type === "wms") {
63656         var tileToProjectedCoords = function(x2, y2, z2) {
63657           var zoomSize = Math.pow(2, z2);
63658           var lon = x2 / zoomSize * Math.PI * 2 - Math.PI;
63659           var lat = Math.atan(Math.sinh(Math.PI * (1 - 2 * y2 / zoomSize)));
63660           switch (source.projection) {
63661             case "EPSG:4326":
63662               return {
63663                 x: lon * 180 / Math.PI,
63664                 y: lat * 180 / Math.PI
63665               };
63666             default:
63667               var mercCoords = mercatorRaw(lon, lat);
63668               return {
63669                 x: 2003750834e-2 / Math.PI * mercCoords[0],
63670                 y: 2003750834e-2 / Math.PI * mercCoords[1]
63671               };
63672           }
63673         };
63674         var tileSize = source.tileSize;
63675         var projection2 = source.projection;
63676         var minXmaxY = tileToProjectedCoords(coord2[0], coord2[1], coord2[2]);
63677         var maxXminY = tileToProjectedCoords(coord2[0] + 1, coord2[1] + 1, coord2[2]);
63678         result = result.replace(/\{(\w+)\}/g, function(token, key) {
63679           switch (key) {
63680             case "width":
63681             case "height":
63682               return tileSize;
63683             case "proj":
63684               return projection2;
63685             case "wkid":
63686               return projection2.replace(/^EPSG:/, "");
63687             case "bbox":
63688               if (projection2 === "EPSG:4326" && // The CRS parameter implies version 1.3 (prior versions use SRS)
63689               /VERSION=1.3|CRS={proj}/.test(source.template().toUpperCase())) {
63690                 return maxXminY.y + "," + minXmaxY.x + "," + minXmaxY.y + "," + maxXminY.x;
63691               } else {
63692                 return minXmaxY.x + "," + maxXminY.y + "," + maxXminY.x + "," + minXmaxY.y;
63693               }
63694             case "w":
63695               return minXmaxY.x;
63696             case "s":
63697               return maxXminY.y;
63698             case "n":
63699               return maxXminY.x;
63700             case "e":
63701               return minXmaxY.y;
63702             default:
63703               return token;
63704           }
63705         });
63706       } else if (source.type === "tms") {
63707         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" : "");
63708       } else if (source.type === "bing") {
63709         result = result.replace("{u}", function() {
63710           var u2 = "";
63711           for (var zoom = coord2[2]; zoom > 0; zoom--) {
63712             var b2 = 0;
63713             var mask = 1 << zoom - 1;
63714             if ((coord2[0] & mask) !== 0) b2++;
63715             if ((coord2[1] & mask) !== 0) b2 += 2;
63716             u2 += b2.toString();
63717           }
63718           return u2;
63719         });
63720       }
63721       result = result.replace(/\{switch:([^}]+)\}/, function(s2, r2) {
63722         var subdomains = r2.split(",");
63723         return subdomains[(coord2[0] + coord2[1]) % subdomains.length];
63724       });
63725       return result;
63726     };
63727     source.validZoom = function(z2, underzoom) {
63728       if (underzoom === void 0) underzoom = 0;
63729       return source.zoomExtent[0] - underzoom <= z2 && (source.overzoom || source.zoomExtent[1] > z2);
63730     };
63731     source.isLocatorOverlay = function() {
63732       return source.id === "mapbox_locator_overlay";
63733     };
63734     source.isHidden = function() {
63735       return source.id === "DigitalGlobe-Premium-vintage" || source.id === "DigitalGlobe-Standard-vintage";
63736     };
63737     source.copyrightNotices = function() {
63738     };
63739     source.getMetadata = function(center, tileCoord, callback) {
63740       var vintage = {
63741         start: localeDateString(source.startDate),
63742         end: localeDateString(source.endDate)
63743       };
63744       vintage.range = vintageRange(vintage);
63745       var metadata = { vintage };
63746       callback(null, metadata);
63747     };
63748     return source;
63749   }
63750   var import_lodash4, isRetina, _a2;
63751   var init_background_source = __esm({
63752     "modules/renderer/background_source.js"() {
63753       "use strict";
63754       init_src2();
63755       init_src18();
63756       import_lodash4 = __toESM(require_lodash());
63757       init_localizer();
63758       init_geo2();
63759       init_util();
63760       init_aes();
63761       init_IntervalTasksQueue();
63762       isRetina = window.devicePixelRatio && window.devicePixelRatio >= 2;
63763       (_a2 = window.matchMedia) == null ? void 0 : _a2.call(window, `
63764         (-webkit-min-device-pixel-ratio: 2), /* Safari */
63765         (min-resolution: 2dppx),             /* standard */
63766         (min-resolution: 192dpi)             /* fallback */
63767     `).addListener(function() {
63768         isRetina = window.devicePixelRatio && window.devicePixelRatio >= 2;
63769       });
63770       rendererBackgroundSource.Bing = function(data, dispatch14) {
63771         data.template = "https://ecn.t{switch:0,1,2,3}.tiles.virtualearth.net/tiles/a{u}.jpeg?g=1&pr=odbl&n=z";
63772         var bing = rendererBackgroundSource(data);
63773         var key = utilAesDecrypt("5c875730b09c6b422433e807e1ff060b6536c791dbfffcffc4c6b18a1bdba1f14593d151adb50e19e1be1ab19aef813bf135d0f103475e5c724dec94389e45d0");
63774         const strictParam = "n";
63775         var url = "https://dev.virtualearth.net/REST/v1/Imagery/Metadata/AerialOSM?include=ImageryProviders&uriScheme=https&key=" + key;
63776         var cache = {};
63777         var inflight = {};
63778         var providers = [];
63779         var taskQueue = new IntervalTasksQueue(250);
63780         var metadataLastZoom = -1;
63781         json_default(url).then(function(json) {
63782           let imageryResource = json.resourceSets[0].resources[0];
63783           let template = imageryResource.imageUrl;
63784           let subDomains = imageryResource.imageUrlSubdomains;
63785           let subDomainNumbers = subDomains.map((subDomain) => {
63786             return subDomain.substring(1);
63787           }).join(",");
63788           template = template.replace("{subdomain}", `t{switch:${subDomainNumbers}}`).replace("{quadkey}", "{u}");
63789           if (!new URLSearchParams(template).has(strictParam)) {
63790             template += `&${strictParam}=z`;
63791           }
63792           bing.template(template);
63793           providers = imageryResource.imageryProviders.map(function(provider) {
63794             return {
63795               attribution: provider.attribution,
63796               areas: provider.coverageAreas.map(function(area) {
63797                 return {
63798                   zoom: [area.zoomMin, area.zoomMax],
63799                   extent: geoExtent([area.bbox[1], area.bbox[0]], [area.bbox[3], area.bbox[2]])
63800                 };
63801               })
63802             };
63803           });
63804           dispatch14.call("change");
63805         }).catch(function() {
63806         });
63807         bing.copyrightNotices = function(zoom, extent) {
63808           zoom = Math.min(zoom, 21);
63809           return providers.filter(function(provider) {
63810             return provider.areas.some(function(area) {
63811               return extent.intersects(area.extent) && area.zoom[0] <= zoom && area.zoom[1] >= zoom;
63812             });
63813           }).map(function(provider) {
63814             return provider.attribution;
63815           }).join(", ");
63816         };
63817         bing.getMetadata = function(center, tileCoord, callback) {
63818           var tileID = tileCoord.slice(0, 3).join("/");
63819           var zoom = Math.min(tileCoord[2], 21);
63820           var centerPoint = center[1] + "," + center[0];
63821           var url2 = "https://dev.virtualearth.net/REST/v1/Imagery/BasicMetadata/AerialOSM/" + centerPoint + "?zl=" + zoom + "&key=" + key;
63822           if (inflight[tileID]) return;
63823           if (!cache[tileID]) {
63824             cache[tileID] = {};
63825           }
63826           if (cache[tileID] && cache[tileID].metadata) {
63827             return callback(null, cache[tileID].metadata);
63828           }
63829           inflight[tileID] = true;
63830           if (metadataLastZoom !== tileCoord[2]) {
63831             metadataLastZoom = tileCoord[2];
63832             taskQueue.clear();
63833           }
63834           taskQueue.enqueue(() => {
63835             json_default(url2).then(function(result) {
63836               delete inflight[tileID];
63837               if (!result) {
63838                 throw new Error("Unknown Error");
63839               }
63840               var vintage = {
63841                 start: localeDateString(result.resourceSets[0].resources[0].vintageStart),
63842                 end: localeDateString(result.resourceSets[0].resources[0].vintageEnd)
63843               };
63844               vintage.range = vintageRange(vintage);
63845               var metadata = { vintage };
63846               cache[tileID].metadata = metadata;
63847               if (callback) callback(null, metadata);
63848             }).catch(function(err) {
63849               delete inflight[tileID];
63850               if (callback) callback(err.message);
63851             });
63852           });
63853         };
63854         bing.terms_url = "https://blog.openstreetmap.org/2010/11/30/microsoft-imagery-details";
63855         return bing;
63856       };
63857       rendererBackgroundSource.Esri = function(data) {
63858         if (data.template.match(/blankTile/) === null) {
63859           data.template = data.template + "?blankTile=false";
63860         }
63861         var esri = rendererBackgroundSource(data);
63862         var cache = {};
63863         var inflight = {};
63864         var _prevCenter;
63865         esri.fetchTilemap = function(center) {
63866           if (_prevCenter && geoSphericalDistance(center, _prevCenter) < 5e3) return;
63867           _prevCenter = center;
63868           var z2 = 20;
63869           var dummyUrl = esri.url([1, 2, 3]);
63870           var x2 = Math.floor((center[0] + 180) / 360 * Math.pow(2, z2));
63871           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, z2));
63872           var tilemapUrl = dummyUrl.replace(/tile\/[0-9]+\/[0-9]+\/[0-9]+\?blankTile=false/, "tilemap") + "/" + z2 + "/" + y2 + "/" + x2 + "/8/8";
63873           json_default(tilemapUrl).then(function(tilemap) {
63874             if (!tilemap) {
63875               throw new Error("Unknown Error");
63876             }
63877             var hasTiles = true;
63878             for (var i3 = 0; i3 < tilemap.data.length; i3++) {
63879               if (!tilemap.data[i3]) {
63880                 hasTiles = false;
63881                 break;
63882               }
63883             }
63884             esri.zoomExtent[1] = hasTiles ? 22 : 19;
63885           }).catch(function() {
63886           });
63887         };
63888         esri.getMetadata = function(center, tileCoord, callback) {
63889           if (esri.id !== "EsriWorldImagery") {
63890             return callback(null, {});
63891           }
63892           var tileID = tileCoord.slice(0, 3).join("/");
63893           var zoom = Math.min(tileCoord[2], esri.zoomExtent[1]);
63894           var centerPoint = center[0] + "," + center[1];
63895           var unknown = _t("info_panels.background.unknown");
63896           var vintage = {};
63897           var metadata = {};
63898           if (inflight[tileID]) return;
63899           var url = "https://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/4/query";
63900           url += "?returnGeometry=false&geometry=" + centerPoint + "&inSR=4326&geometryType=esriGeometryPoint&outFields=*&f=json";
63901           if (!cache[tileID]) {
63902             cache[tileID] = {};
63903           }
63904           if (cache[tileID] && cache[tileID].metadata) {
63905             return callback(null, cache[tileID].metadata);
63906           }
63907           inflight[tileID] = true;
63908           json_default(url).then(function(result) {
63909             delete inflight[tileID];
63910             result = result.features.map((f2) => f2.attributes).filter((a2) => a2.MinMapLevel <= zoom && a2.MaxMapLevel >= zoom)[0];
63911             if (!result) {
63912               throw new Error("Unknown Error");
63913             } else if (result.features && result.features.length < 1) {
63914               throw new Error("No Results");
63915             } else if (result.error && result.error.message) {
63916               throw new Error(result.error.message);
63917             }
63918             var captureDate = localeDateString(result.SRC_DATE2);
63919             vintage = {
63920               start: captureDate,
63921               end: captureDate,
63922               range: captureDate
63923             };
63924             metadata = {
63925               vintage,
63926               source: clean2(result.NICE_NAME),
63927               description: clean2(result.NICE_DESC),
63928               resolution: clean2(+Number(result.SRC_RES).toFixed(4)),
63929               accuracy: clean2(+Number(result.SRC_ACC).toFixed(4))
63930             };
63931             if (isFinite(metadata.resolution)) {
63932               metadata.resolution += " m";
63933             }
63934             if (isFinite(metadata.accuracy)) {
63935               metadata.accuracy += " m";
63936             }
63937             cache[tileID].metadata = metadata;
63938             if (callback) callback(null, metadata);
63939           }).catch(function(err) {
63940             delete inflight[tileID];
63941             if (callback) callback(err.message);
63942           });
63943           function clean2(val) {
63944             return String(val).trim() || unknown;
63945           }
63946         };
63947         return esri;
63948       };
63949       rendererBackgroundSource.None = function() {
63950         var source = rendererBackgroundSource({ id: "none", template: "" });
63951         source.name = function() {
63952           return _t("background.none");
63953         };
63954         source.label = function() {
63955           return _t.append("background.none");
63956         };
63957         source.imageryUsed = function() {
63958           return null;
63959         };
63960         source.area = function() {
63961           return -1;
63962         };
63963         return source;
63964       };
63965       rendererBackgroundSource.Custom = function(template) {
63966         var source = rendererBackgroundSource({ id: "custom", template });
63967         source.name = function() {
63968           return _t("background.custom");
63969         };
63970         source.label = function() {
63971           return _t.append("background.custom");
63972         };
63973         source.imageryUsed = function() {
63974           var cleaned = source.template();
63975           if (cleaned.indexOf("?") !== -1) {
63976             var parts = cleaned.split("?", 2);
63977             var qs = utilStringQs(parts[1]);
63978             ["access_token", "connectId", "token", "Signature"].forEach(function(param) {
63979               if (qs[param]) {
63980                 qs[param] = "{apikey}";
63981               }
63982             });
63983             cleaned = parts[0] + "?" + utilQsString(qs, true);
63984           }
63985           cleaned = cleaned.replace(/token\/(\w+)/, "token/{apikey}").replace(/key=(\w+)/, "key={apikey}");
63986           return "Custom (" + cleaned + " )";
63987         };
63988         source.area = function() {
63989           return -2;
63990         };
63991         return source;
63992       };
63993     }
63994   });
63995
63996   // node_modules/@turf/helpers/dist/esm/index.js
63997   function feature2(geom, properties, options2 = {}) {
63998     const feat = { type: "Feature" };
63999     if (options2.id === 0 || options2.id) {
64000       feat.id = options2.id;
64001     }
64002     if (options2.bbox) {
64003       feat.bbox = options2.bbox;
64004     }
64005     feat.properties = properties || {};
64006     feat.geometry = geom;
64007     return feat;
64008   }
64009   function polygon(coordinates, properties, options2 = {}) {
64010     for (const ring of coordinates) {
64011       if (ring.length < 4) {
64012         throw new Error(
64013           "Each LinearRing of a Polygon must have 4 or more Positions."
64014         );
64015       }
64016       if (ring[ring.length - 1].length !== ring[0].length) {
64017         throw new Error("First and last Position are not equivalent.");
64018       }
64019       for (let j2 = 0; j2 < ring[ring.length - 1].length; j2++) {
64020         if (ring[ring.length - 1][j2] !== ring[0][j2]) {
64021           throw new Error("First and last Position are not equivalent.");
64022         }
64023       }
64024     }
64025     const geom = {
64026       type: "Polygon",
64027       coordinates
64028     };
64029     return feature2(geom, properties, options2);
64030   }
64031   function lineString(coordinates, properties, options2 = {}) {
64032     if (coordinates.length < 2) {
64033       throw new Error("coordinates must be an array of two or more positions");
64034     }
64035     const geom = {
64036       type: "LineString",
64037       coordinates
64038     };
64039     return feature2(geom, properties, options2);
64040   }
64041   function multiLineString(coordinates, properties, options2 = {}) {
64042     const geom = {
64043       type: "MultiLineString",
64044       coordinates
64045     };
64046     return feature2(geom, properties, options2);
64047   }
64048   function multiPolygon(coordinates, properties, options2 = {}) {
64049     const geom = {
64050       type: "MultiPolygon",
64051       coordinates
64052     };
64053     return feature2(geom, properties, options2);
64054   }
64055   var earthRadius, factors;
64056   var init_esm3 = __esm({
64057     "node_modules/@turf/helpers/dist/esm/index.js"() {
64058       earthRadius = 63710088e-1;
64059       factors = {
64060         centimeters: earthRadius * 100,
64061         centimetres: earthRadius * 100,
64062         degrees: 360 / (2 * Math.PI),
64063         feet: earthRadius * 3.28084,
64064         inches: earthRadius * 39.37,
64065         kilometers: earthRadius / 1e3,
64066         kilometres: earthRadius / 1e3,
64067         meters: earthRadius,
64068         metres: earthRadius,
64069         miles: earthRadius / 1609.344,
64070         millimeters: earthRadius * 1e3,
64071         millimetres: earthRadius * 1e3,
64072         nauticalmiles: earthRadius / 1852,
64073         radians: 1,
64074         yards: earthRadius * 1.0936
64075       };
64076     }
64077   });
64078
64079   // node_modules/@turf/invariant/dist/esm/index.js
64080   function getGeom(geojson) {
64081     if (geojson.type === "Feature") {
64082       return geojson.geometry;
64083     }
64084     return geojson;
64085   }
64086   var init_esm4 = __esm({
64087     "node_modules/@turf/invariant/dist/esm/index.js"() {
64088     }
64089   });
64090
64091   // node_modules/@turf/bbox-clip/dist/esm/index.js
64092   function lineclip(points, bbox2, result) {
64093     var len = points.length, codeA = bitCode(points[0], bbox2), part = [], i3, codeB, lastCode;
64094     let a2;
64095     let b2;
64096     if (!result) result = [];
64097     for (i3 = 1; i3 < len; i3++) {
64098       a2 = points[i3 - 1];
64099       b2 = points[i3];
64100       codeB = lastCode = bitCode(b2, bbox2);
64101       while (true) {
64102         if (!(codeA | codeB)) {
64103           part.push(a2);
64104           if (codeB !== lastCode) {
64105             part.push(b2);
64106             if (i3 < len - 1) {
64107               result.push(part);
64108               part = [];
64109             }
64110           } else if (i3 === len - 1) {
64111             part.push(b2);
64112           }
64113           break;
64114         } else if (codeA & codeB) {
64115           break;
64116         } else if (codeA) {
64117           a2 = intersect(a2, b2, codeA, bbox2);
64118           codeA = bitCode(a2, bbox2);
64119         } else {
64120           b2 = intersect(a2, b2, codeB, bbox2);
64121           codeB = bitCode(b2, bbox2);
64122         }
64123       }
64124       codeA = lastCode;
64125     }
64126     if (part.length) result.push(part);
64127     return result;
64128   }
64129   function polygonclip(points, bbox2) {
64130     var result, edge, prev, prevInside, i3, p2, inside;
64131     for (edge = 1; edge <= 8; edge *= 2) {
64132       result = [];
64133       prev = points[points.length - 1];
64134       prevInside = !(bitCode(prev, bbox2) & edge);
64135       for (i3 = 0; i3 < points.length; i3++) {
64136         p2 = points[i3];
64137         inside = !(bitCode(p2, bbox2) & edge);
64138         if (inside !== prevInside) result.push(intersect(prev, p2, edge, bbox2));
64139         if (inside) result.push(p2);
64140         prev = p2;
64141         prevInside = inside;
64142       }
64143       points = result;
64144       if (!points.length) break;
64145     }
64146     return result;
64147   }
64148   function intersect(a2, b2, edge, bbox2) {
64149     return edge & 8 ? [a2[0] + (b2[0] - a2[0]) * (bbox2[3] - a2[1]) / (b2[1] - a2[1]), bbox2[3]] : edge & 4 ? [a2[0] + (b2[0] - a2[0]) * (bbox2[1] - a2[1]) / (b2[1] - a2[1]), bbox2[1]] : edge & 2 ? [bbox2[2], a2[1] + (b2[1] - a2[1]) * (bbox2[2] - a2[0]) / (b2[0] - a2[0])] : edge & 1 ? [bbox2[0], a2[1] + (b2[1] - a2[1]) * (bbox2[0] - a2[0]) / (b2[0] - a2[0])] : null;
64150   }
64151   function bitCode(p2, bbox2) {
64152     var code = 0;
64153     if (p2[0] < bbox2[0]) code |= 1;
64154     else if (p2[0] > bbox2[2]) code |= 2;
64155     if (p2[1] < bbox2[1]) code |= 4;
64156     else if (p2[1] > bbox2[3]) code |= 8;
64157     return code;
64158   }
64159   function bboxClip(feature3, bbox2) {
64160     const geom = getGeom(feature3);
64161     const type2 = geom.type;
64162     const properties = feature3.type === "Feature" ? feature3.properties : {};
64163     let coords = geom.coordinates;
64164     switch (type2) {
64165       case "LineString":
64166       case "MultiLineString": {
64167         const lines = [];
64168         if (type2 === "LineString") {
64169           coords = [coords];
64170         }
64171         coords.forEach((line) => {
64172           lineclip(line, bbox2, lines);
64173         });
64174         if (lines.length === 1) {
64175           return lineString(lines[0], properties);
64176         }
64177         return multiLineString(lines, properties);
64178       }
64179       case "Polygon":
64180         return polygon(clipPolygon(coords, bbox2), properties);
64181       case "MultiPolygon":
64182         return multiPolygon(
64183           coords.map((poly) => {
64184             return clipPolygon(poly, bbox2);
64185           }),
64186           properties
64187         );
64188       default:
64189         throw new Error("geometry " + type2 + " not supported");
64190     }
64191   }
64192   function clipPolygon(rings, bbox2) {
64193     const outRings = [];
64194     for (const ring of rings) {
64195       const clipped = polygonclip(ring, bbox2);
64196       if (clipped.length > 0) {
64197         if (clipped[0][0] !== clipped[clipped.length - 1][0] || clipped[0][1] !== clipped[clipped.length - 1][1]) {
64198           clipped.push(clipped[0]);
64199         }
64200         if (clipped.length >= 4) {
64201           outRings.push(clipped);
64202         }
64203       }
64204     }
64205     return outRings;
64206   }
64207   var turf_bbox_clip_default;
64208   var init_esm5 = __esm({
64209     "node_modules/@turf/bbox-clip/dist/esm/index.js"() {
64210       init_esm3();
64211       init_esm4();
64212       turf_bbox_clip_default = bboxClip;
64213     }
64214   });
64215
64216   // node_modules/@turf/meta/dist/esm/index.js
64217   function coordEach(geojson, callback, excludeWrapCoord) {
64218     if (geojson === null) return;
64219     var j2, k2, 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;
64220     for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
64221       geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;
64222       isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
64223       stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
64224       for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {
64225         var multiFeatureIndex = 0;
64226         var geometryIndex = 0;
64227         geometry = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;
64228         if (geometry === null) continue;
64229         coords = geometry.coordinates;
64230         var geomType = geometry.type;
64231         wrapShrink = excludeWrapCoord && (geomType === "Polygon" || geomType === "MultiPolygon") ? 1 : 0;
64232         switch (geomType) {
64233           case null:
64234             break;
64235           case "Point":
64236             if (callback(
64237               coords,
64238               coordIndex,
64239               featureIndex,
64240               multiFeatureIndex,
64241               geometryIndex
64242             ) === false)
64243               return false;
64244             coordIndex++;
64245             multiFeatureIndex++;
64246             break;
64247           case "LineString":
64248           case "MultiPoint":
64249             for (j2 = 0; j2 < coords.length; j2++) {
64250               if (callback(
64251                 coords[j2],
64252                 coordIndex,
64253                 featureIndex,
64254                 multiFeatureIndex,
64255                 geometryIndex
64256               ) === false)
64257                 return false;
64258               coordIndex++;
64259               if (geomType === "MultiPoint") multiFeatureIndex++;
64260             }
64261             if (geomType === "LineString") multiFeatureIndex++;
64262             break;
64263           case "Polygon":
64264           case "MultiLineString":
64265             for (j2 = 0; j2 < coords.length; j2++) {
64266               for (k2 = 0; k2 < coords[j2].length - wrapShrink; k2++) {
64267                 if (callback(
64268                   coords[j2][k2],
64269                   coordIndex,
64270                   featureIndex,
64271                   multiFeatureIndex,
64272                   geometryIndex
64273                 ) === false)
64274                   return false;
64275                 coordIndex++;
64276               }
64277               if (geomType === "MultiLineString") multiFeatureIndex++;
64278               if (geomType === "Polygon") geometryIndex++;
64279             }
64280             if (geomType === "Polygon") multiFeatureIndex++;
64281             break;
64282           case "MultiPolygon":
64283             for (j2 = 0; j2 < coords.length; j2++) {
64284               geometryIndex = 0;
64285               for (k2 = 0; k2 < coords[j2].length; k2++) {
64286                 for (l2 = 0; l2 < coords[j2][k2].length - wrapShrink; l2++) {
64287                   if (callback(
64288                     coords[j2][k2][l2],
64289                     coordIndex,
64290                     featureIndex,
64291                     multiFeatureIndex,
64292                     geometryIndex
64293                   ) === false)
64294                     return false;
64295                   coordIndex++;
64296                 }
64297                 geometryIndex++;
64298               }
64299               multiFeatureIndex++;
64300             }
64301             break;
64302           case "GeometryCollection":
64303             for (j2 = 0; j2 < geometry.geometries.length; j2++)
64304               if (coordEach(geometry.geometries[j2], callback, excludeWrapCoord) === false)
64305                 return false;
64306             break;
64307           default:
64308             throw new Error("Unknown Geometry Type");
64309         }
64310       }
64311     }
64312   }
64313   var init_esm6 = __esm({
64314     "node_modules/@turf/meta/dist/esm/index.js"() {
64315     }
64316   });
64317
64318   // node_modules/@turf/bbox/dist/esm/index.js
64319   function bbox(geojson, options2 = {}) {
64320     if (geojson.bbox != null && true !== options2.recompute) {
64321       return geojson.bbox;
64322     }
64323     const result = [Infinity, Infinity, -Infinity, -Infinity];
64324     coordEach(geojson, (coord2) => {
64325       if (result[0] > coord2[0]) {
64326         result[0] = coord2[0];
64327       }
64328       if (result[1] > coord2[1]) {
64329         result[1] = coord2[1];
64330       }
64331       if (result[2] < coord2[0]) {
64332         result[2] = coord2[0];
64333       }
64334       if (result[3] < coord2[1]) {
64335         result[3] = coord2[1];
64336       }
64337     });
64338     return result;
64339   }
64340   var turf_bbox_default;
64341   var init_esm7 = __esm({
64342     "node_modules/@turf/bbox/dist/esm/index.js"() {
64343       init_esm6();
64344       turf_bbox_default = bbox;
64345     }
64346   });
64347
64348   // modules/renderer/tile_layer.js
64349   var tile_layer_exports = {};
64350   __export(tile_layer_exports, {
64351     rendererTileLayer: () => rendererTileLayer
64352   });
64353   function rendererTileLayer(context) {
64354     var transformProp = utilPrefixCSSProperty("Transform");
64355     var tiler8 = utilTiler();
64356     var _tileSize = 256;
64357     var _projection;
64358     var _cache5 = {};
64359     var _tileOrigin;
64360     var _zoom;
64361     var _source;
64362     var _underzoom = 0;
64363     function tileSizeAtZoom(d2, z2) {
64364       return d2.tileSize * Math.pow(2, z2 - d2[2]) / d2.tileSize;
64365     }
64366     function atZoom(t2, distance) {
64367       var power = Math.pow(2, distance);
64368       return [
64369         Math.floor(t2[0] * power),
64370         Math.floor(t2[1] * power),
64371         t2[2] + distance
64372       ];
64373     }
64374     function lookUp(d2) {
64375       for (var up = -1; up > -d2[2]; up--) {
64376         var tile = atZoom(d2, up);
64377         if (_cache5[_source.url(tile)] !== false) {
64378           return tile;
64379         }
64380       }
64381     }
64382     function uniqueBy(a2, n3) {
64383       var o2 = [];
64384       var seen = {};
64385       for (var i3 = 0; i3 < a2.length; i3++) {
64386         if (seen[a2[i3][n3]] === void 0) {
64387           o2.push(a2[i3]);
64388           seen[a2[i3][n3]] = true;
64389         }
64390       }
64391       return o2;
64392     }
64393     function addSource(d2) {
64394       d2.url = _source.url(d2);
64395       d2.tileSize = _tileSize;
64396       d2.source = _source;
64397       return d2;
64398     }
64399     function background(selection2) {
64400       _zoom = geoScaleToZoom(_projection.scale(), _tileSize);
64401       var pixelOffset;
64402       if (_source) {
64403         pixelOffset = [
64404           _source.offset()[0] * Math.pow(2, _zoom),
64405           _source.offset()[1] * Math.pow(2, _zoom)
64406         ];
64407       } else {
64408         pixelOffset = [0, 0];
64409       }
64410       tiler8.scale(_projection.scale() * 2 * Math.PI).translate([
64411         _projection.translate()[0] + pixelOffset[0],
64412         _projection.translate()[1] + pixelOffset[1]
64413       ]);
64414       _tileOrigin = [
64415         _projection.scale() * Math.PI - _projection.translate()[0],
64416         _projection.scale() * Math.PI - _projection.translate()[1]
64417       ];
64418       render(selection2);
64419     }
64420     function render(selection2) {
64421       if (!_source) return;
64422       var requests = [];
64423       var showDebug = context.getDebug("tile") && !_source.overlay;
64424       if (_source.validZoom(_zoom, _underzoom)) {
64425         tiler8.skipNullIsland(!!_source.overlay);
64426         tiler8().forEach(function(d2) {
64427           addSource(d2);
64428           if (d2.url === "") return;
64429           if (typeof d2.url !== "string") return;
64430           requests.push(d2);
64431           if (_cache5[d2.url] === false && lookUp(d2)) {
64432             requests.push(addSource(lookUp(d2)));
64433           }
64434         });
64435         requests = uniqueBy(requests, "url").filter(function(r2) {
64436           return _cache5[r2.url] !== false;
64437         });
64438       }
64439       function load(d3_event, d2) {
64440         _cache5[d2.url] = true;
64441         select_default2(this).on("error", null).on("load", null);
64442         render(selection2);
64443       }
64444       function error(d3_event, d2) {
64445         _cache5[d2.url] = false;
64446         select_default2(this).on("error", null).on("load", null).remove();
64447         render(selection2);
64448       }
64449       function imageTransform(d2) {
64450         var ts = d2.tileSize * Math.pow(2, _zoom - d2[2]);
64451         var scale = tileSizeAtZoom(d2, _zoom);
64452         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 + ")";
64453       }
64454       function tileCenter(d2) {
64455         var ts = d2.tileSize * Math.pow(2, _zoom - d2[2]);
64456         return [
64457           d2[0] * ts - _tileOrigin[0] + ts / 2,
64458           d2[1] * ts - _tileOrigin[1] + ts / 2
64459         ];
64460       }
64461       function debugTransform(d2) {
64462         var coord2 = tileCenter(d2);
64463         return "translate(" + coord2[0] + "px," + coord2[1] + "px)";
64464       }
64465       var dims = tiler8.size();
64466       var mapCenter = [dims[0] / 2, dims[1] / 2];
64467       var minDist = Math.max(dims[0], dims[1]);
64468       var nearCenter;
64469       requests.forEach(function(d2) {
64470         var c2 = tileCenter(d2);
64471         var dist = geoVecLength(c2, mapCenter);
64472         if (dist < minDist) {
64473           minDist = dist;
64474           nearCenter = d2;
64475         }
64476       });
64477       var image = selection2.selectAll("img").data(requests, function(d2) {
64478         return d2.url;
64479       });
64480       image.exit().style(transformProp, imageTransform).classed("tile-removing", true).classed("tile-center", false).on("transitionend", function() {
64481         const tile = select_default2(this);
64482         if (tile.classed("tile-removing")) {
64483           tile.remove();
64484         }
64485       });
64486       image.enter().append("img").attr("class", "tile").attr("alt", "").attr("draggable", "false").style("width", _tileSize + "px").style("height", _tileSize + "px").attr("src", function(d2) {
64487         return d2.url;
64488       }).on("error", error).on("load", load).merge(image).style(transformProp, imageTransform).classed("tile-debug", showDebug).classed("tile-removing", false).classed("tile-center", function(d2) {
64489         return d2 === nearCenter;
64490       }).sort((a2, b2) => a2[2] - b2[2]);
64491       var debug2 = selection2.selectAll(".tile-label-debug").data(showDebug ? requests : [], function(d2) {
64492         return d2.url;
64493       });
64494       debug2.exit().remove();
64495       if (showDebug) {
64496         var debugEnter = debug2.enter().append("div").attr("class", "tile-label-debug");
64497         debugEnter.append("div").attr("class", "tile-label-debug-coord");
64498         debugEnter.append("div").attr("class", "tile-label-debug-vintage");
64499         debug2 = debug2.merge(debugEnter);
64500         debug2.style(transformProp, debugTransform);
64501         debug2.selectAll(".tile-label-debug-coord").text(function(d2) {
64502           return d2[2] + " / " + d2[0] + " / " + d2[1];
64503         });
64504         debug2.selectAll(".tile-label-debug-vintage").each(function(d2) {
64505           var span = select_default2(this);
64506           var center = context.projection.invert(tileCenter(d2));
64507           _source.getMetadata(center, d2, function(err, result) {
64508             if (result && result.vintage && result.vintage.range) {
64509               span.text(result.vintage.range);
64510             } else {
64511               span.text("");
64512               span.call(_t.append("info_panels.background.vintage"));
64513               span.append("span").text(": ");
64514               span.call(_t.append("info_panels.background.unknown"));
64515             }
64516           });
64517         });
64518       }
64519     }
64520     background.projection = function(val) {
64521       if (!arguments.length) return _projection;
64522       _projection = val;
64523       return background;
64524     };
64525     background.dimensions = function(val) {
64526       if (!arguments.length) return tiler8.size();
64527       tiler8.size(val);
64528       return background;
64529     };
64530     background.source = function(val) {
64531       if (!arguments.length) return _source;
64532       _source = val;
64533       _tileSize = _source.tileSize;
64534       _cache5 = {};
64535       tiler8.tileSize(_source.tileSize).zoomExtent(_source.zoomExtent);
64536       return background;
64537     };
64538     background.underzoom = function(amount) {
64539       if (!arguments.length) return _underzoom;
64540       _underzoom = amount;
64541       return background;
64542     };
64543     return background;
64544   }
64545   var init_tile_layer = __esm({
64546     "modules/renderer/tile_layer.js"() {
64547       "use strict";
64548       init_src5();
64549       init_localizer();
64550       init_geo2();
64551       init_util();
64552     }
64553   });
64554
64555   // modules/renderer/background.js
64556   var background_exports2 = {};
64557   __export(background_exports2, {
64558     rendererBackground: () => rendererBackground
64559   });
64560   function rendererBackground(context) {
64561     const dispatch14 = dispatch_default("change");
64562     const baseLayer = rendererTileLayer(context).projection(context.projection);
64563     let _checkedBlocklists = [];
64564     let _isValid = true;
64565     let _overlayLayers = [];
64566     let _brightness = 1;
64567     let _contrast = 1;
64568     let _saturation = 1;
64569     let _sharpness = 1;
64570     function ensureImageryIndex() {
64571       return _mainFileFetcher.get("imagery").then((sources) => {
64572         if (_imageryIndex) return _imageryIndex;
64573         _imageryIndex = {
64574           imagery: sources,
64575           features: {}
64576         };
64577         const features = sources.map((source) => {
64578           if (!source.polygon) return null;
64579           const rings = source.polygon.map((ring) => [ring]);
64580           const feature3 = {
64581             type: "Feature",
64582             properties: { id: source.id },
64583             geometry: { type: "MultiPolygon", coordinates: rings }
64584           };
64585           _imageryIndex.features[source.id] = feature3;
64586           return feature3;
64587         }).filter(Boolean);
64588         _imageryIndex.query = (0, import_which_polygon3.default)({ type: "FeatureCollection", features });
64589         _imageryIndex.backgrounds = sources.map((source) => {
64590           if (source.type === "bing") {
64591             return rendererBackgroundSource.Bing(source, dispatch14);
64592           } else if (/^EsriWorldImagery/.test(source.id)) {
64593             return rendererBackgroundSource.Esri(source);
64594           } else {
64595             return rendererBackgroundSource(source);
64596           }
64597         });
64598         _imageryIndex.backgrounds.unshift(rendererBackgroundSource.None());
64599         let template = corePreferences("background-custom-template") || "";
64600         const custom = rendererBackgroundSource.Custom(template);
64601         _imageryIndex.backgrounds.unshift(custom);
64602         return _imageryIndex;
64603       });
64604     }
64605     function background(selection2) {
64606       const currSource = baseLayer.source();
64607       if (context.map().zoom() > 18) {
64608         if (currSource && /^EsriWorldImagery/.test(currSource.id)) {
64609           const center = context.map().center();
64610           currSource.fetchTilemap(center);
64611         }
64612       }
64613       const sources = background.sources(context.map().extent());
64614       const wasValid = _isValid;
64615       _isValid = !!sources.filter((d2) => d2 === currSource).length;
64616       if (wasValid !== _isValid) {
64617         background.updateImagery();
64618       }
64619       let baseFilter = "";
64620       if (_brightness !== 1) {
64621         baseFilter += ` brightness(${_brightness})`;
64622       }
64623       if (_contrast !== 1) {
64624         baseFilter += ` contrast(${_contrast})`;
64625       }
64626       if (_saturation !== 1) {
64627         baseFilter += ` saturate(${_saturation})`;
64628       }
64629       if (_sharpness < 1) {
64630         const blur = number_default(0.5, 5)(1 - _sharpness);
64631         baseFilter += ` blur(${blur}px)`;
64632       }
64633       let base = selection2.selectAll(".layer-background").data([0]);
64634       base = base.enter().insert("div", ".layer-data").attr("class", "layer layer-background").merge(base);
64635       base.style("filter", baseFilter || null);
64636       let imagery = base.selectAll(".layer-imagery").data([0]);
64637       imagery.enter().append("div").attr("class", "layer layer-imagery").merge(imagery).call(baseLayer);
64638       let maskFilter = "";
64639       let mixBlendMode = "";
64640       if (_sharpness > 1) {
64641         mixBlendMode = "overlay";
64642         maskFilter = "saturate(0) blur(3px) invert(1)";
64643         let contrast = _sharpness - 1;
64644         maskFilter += ` contrast(${contrast})`;
64645         let brightness = number_default(1, 0.85)(_sharpness - 1);
64646         maskFilter += ` brightness(${brightness})`;
64647       }
64648       let mask = base.selectAll(".layer-unsharp-mask").data(_sharpness > 1 ? [0] : []);
64649       mask.exit().remove();
64650       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);
64651       let overlays = selection2.selectAll(".layer-overlay").data(_overlayLayers, (d2) => d2.source().name());
64652       overlays.exit().remove();
64653       overlays.enter().insert("div", ".layer-data").attr("class", "layer layer-overlay").merge(overlays).each((layer, i3, nodes) => select_default2(nodes[i3]).call(layer));
64654     }
64655     background.updateImagery = function() {
64656       let currSource = baseLayer.source();
64657       if (context.inIntro() || !currSource) return;
64658       let o2 = _overlayLayers.filter((d2) => !d2.source().isLocatorOverlay() && !d2.source().isHidden()).map((d2) => d2.source().id).join(",");
64659       const meters = geoOffsetToMeters(currSource.offset());
64660       const EPSILON = 0.01;
64661       const x2 = +meters[0].toFixed(2);
64662       const y2 = +meters[1].toFixed(2);
64663       let hash2 = utilStringQs(window.location.hash);
64664       let id2 = currSource.id;
64665       if (id2 === "custom") {
64666         id2 = `custom:${currSource.template()}`;
64667       }
64668       if (id2) {
64669         hash2.background = id2;
64670       } else {
64671         delete hash2.background;
64672       }
64673       if (o2) {
64674         hash2.overlays = o2;
64675       } else {
64676         delete hash2.overlays;
64677       }
64678       if (Math.abs(x2) > EPSILON || Math.abs(y2) > EPSILON) {
64679         hash2.offset = `${x2},${y2}`;
64680       } else {
64681         delete hash2.offset;
64682       }
64683       if (!window.mocha) {
64684         window.location.replace("#" + utilQsString(hash2, true));
64685       }
64686       let imageryUsed = [];
64687       let photoOverlaysUsed = [];
64688       const currUsed = currSource.imageryUsed();
64689       if (currUsed && _isValid) {
64690         imageryUsed.push(currUsed);
64691       }
64692       _overlayLayers.filter((d2) => !d2.source().isLocatorOverlay() && !d2.source().isHidden()).forEach((d2) => imageryUsed.push(d2.source().imageryUsed()));
64693       const dataLayer = context.layers().layer("data");
64694       if (dataLayer && dataLayer.enabled() && dataLayer.hasData()) {
64695         imageryUsed.push(dataLayer.getSrc());
64696       }
64697       const photoOverlayLayers = {
64698         streetside: "Bing Streetside",
64699         mapillary: "Mapillary Images",
64700         "mapillary-map-features": "Mapillary Map Features",
64701         "mapillary-signs": "Mapillary Signs",
64702         kartaview: "KartaView Images",
64703         vegbilder: "Norwegian Road Administration Images",
64704         mapilio: "Mapilio Images",
64705         panoramax: "Panoramax Images"
64706       };
64707       for (let layerID in photoOverlayLayers) {
64708         const layer = context.layers().layer(layerID);
64709         if (layer && layer.enabled()) {
64710           photoOverlaysUsed.push(layerID);
64711           imageryUsed.push(photoOverlayLayers[layerID]);
64712         }
64713       }
64714       context.history().imageryUsed(imageryUsed);
64715       context.history().photoOverlaysUsed(photoOverlaysUsed);
64716     };
64717     background.sources = (extent, zoom, includeCurrent) => {
64718       if (!_imageryIndex) return [];
64719       let visible = {};
64720       (_imageryIndex.query.bbox(extent.rectangle(), true) || []).forEach((d2) => visible[d2.id] = true);
64721       const currSource = baseLayer.source();
64722       const osm = context.connection();
64723       const blocklists = osm && osm.imageryBlocklists() || [];
64724       const blocklistChanged = blocklists.length !== _checkedBlocklists.length || blocklists.some((regex, index) => String(regex) !== _checkedBlocklists[index]);
64725       if (blocklistChanged) {
64726         _imageryIndex.backgrounds.forEach((source) => {
64727           source.isBlocked = blocklists.some((regex) => regex.test(source.template()));
64728         });
64729         _checkedBlocklists = blocklists.map((regex) => String(regex));
64730       }
64731       return _imageryIndex.backgrounds.filter((source) => {
64732         if (includeCurrent && currSource === source) return true;
64733         if (source.isBlocked) return false;
64734         if (!source.polygon) return true;
64735         if (zoom && zoom < 6) return false;
64736         return visible[source.id];
64737       });
64738     };
64739     background.dimensions = (val) => {
64740       if (!val) return;
64741       baseLayer.dimensions(val);
64742       _overlayLayers.forEach((layer) => layer.dimensions(val));
64743     };
64744     background.baseLayerSource = function(d2) {
64745       if (!arguments.length) return baseLayer.source();
64746       const osm = context.connection();
64747       if (!osm) return background;
64748       const blocklists = osm.imageryBlocklists();
64749       const template = d2.template();
64750       let fail = false;
64751       let tested = 0;
64752       let regex;
64753       for (let i3 = 0; i3 < blocklists.length; i3++) {
64754         regex = blocklists[i3];
64755         fail = regex.test(template);
64756         tested++;
64757         if (fail) break;
64758       }
64759       if (!tested) {
64760         regex = /.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/;
64761         fail = regex.test(template);
64762       }
64763       baseLayer.source(!fail ? d2 : background.findSource("none"));
64764       dispatch14.call("change");
64765       background.updateImagery();
64766       return background;
64767     };
64768     background.findSource = (id2) => {
64769       if (!id2 || !_imageryIndex) return null;
64770       return _imageryIndex.backgrounds.find((d2) => d2.id && d2.id === id2);
64771     };
64772     background.bing = () => {
64773       background.baseLayerSource(background.findSource("Bing"));
64774     };
64775     background.showsLayer = (d2) => {
64776       const currSource = baseLayer.source();
64777       if (!d2 || !currSource) return false;
64778       return d2.id === currSource.id || _overlayLayers.some((layer) => d2.id === layer.source().id);
64779     };
64780     background.overlayLayerSources = () => {
64781       return _overlayLayers.map((layer) => layer.source());
64782     };
64783     background.toggleOverlayLayer = (d2) => {
64784       let layer;
64785       for (let i3 = 0; i3 < _overlayLayers.length; i3++) {
64786         layer = _overlayLayers[i3];
64787         if (layer.source() === d2) {
64788           _overlayLayers.splice(i3, 1);
64789           dispatch14.call("change");
64790           background.updateImagery();
64791           return;
64792         }
64793       }
64794       layer = rendererTileLayer(context).source(d2).projection(context.projection).dimensions(
64795         baseLayer.dimensions()
64796       );
64797       _overlayLayers.push(layer);
64798       dispatch14.call("change");
64799       background.updateImagery();
64800     };
64801     background.nudge = (d2, zoom) => {
64802       const currSource = baseLayer.source();
64803       if (currSource) {
64804         currSource.nudge(d2, zoom);
64805         dispatch14.call("change");
64806         background.updateImagery();
64807       }
64808       return background;
64809     };
64810     background.offset = function(d2) {
64811       const currSource = baseLayer.source();
64812       if (!arguments.length) {
64813         return currSource && currSource.offset() || [0, 0];
64814       }
64815       if (currSource) {
64816         currSource.offset(d2);
64817         dispatch14.call("change");
64818         background.updateImagery();
64819       }
64820       return background;
64821     };
64822     background.brightness = function(d2) {
64823       if (!arguments.length) return _brightness;
64824       _brightness = d2;
64825       if (context.mode()) dispatch14.call("change");
64826       return background;
64827     };
64828     background.contrast = function(d2) {
64829       if (!arguments.length) return _contrast;
64830       _contrast = d2;
64831       if (context.mode()) dispatch14.call("change");
64832       return background;
64833     };
64834     background.saturation = function(d2) {
64835       if (!arguments.length) return _saturation;
64836       _saturation = d2;
64837       if (context.mode()) dispatch14.call("change");
64838       return background;
64839     };
64840     background.sharpness = function(d2) {
64841       if (!arguments.length) return _sharpness;
64842       _sharpness = d2;
64843       if (context.mode()) dispatch14.call("change");
64844       return background;
64845     };
64846     let _loadPromise;
64847     background.ensureLoaded = () => {
64848       if (_loadPromise) return _loadPromise;
64849       return _loadPromise = ensureImageryIndex();
64850     };
64851     background.init = () => {
64852       const loadPromise = background.ensureLoaded();
64853       const hash2 = utilStringQs(window.location.hash);
64854       const requestedBackground = hash2.background || hash2.layer;
64855       const lastUsedBackground = corePreferences("background-last-used");
64856       return loadPromise.then((imageryIndex) => {
64857         const extent = context.map().extent();
64858         const validBackgrounds = background.sources(extent).filter((d2) => d2.id !== "none" && d2.id !== "custom");
64859         const first = validBackgrounds.length && validBackgrounds[0];
64860         const isLastUsedValid = !!validBackgrounds.find((d2) => d2.id && d2.id === lastUsedBackground);
64861         let best;
64862         if (!requestedBackground && extent) {
64863           const viewArea = extent.area();
64864           best = validBackgrounds.find((s2) => {
64865             if (!s2.best() || s2.overlay) return false;
64866             let bbox2 = turf_bbox_default(turf_bbox_clip_default(
64867               { type: "MultiPolygon", coordinates: [s2.polygon || [extent.polygon()]] },
64868               extent.rectangle()
64869             ));
64870             let area = geoExtent(bbox2.slice(0, 2), bbox2.slice(2, 4)).area();
64871             return area / viewArea > 0.5;
64872           });
64873         }
64874         if (requestedBackground && requestedBackground.indexOf("custom:") === 0) {
64875           const template = requestedBackground.replace(/^custom:/, "");
64876           const custom = background.findSource("custom");
64877           background.baseLayerSource(custom.template(template));
64878           corePreferences("background-custom-template", template);
64879         } else {
64880           background.baseLayerSource(
64881             background.findSource(requestedBackground) || best || isLastUsedValid && background.findSource(lastUsedBackground) || background.findSource("Bing") || first || background.findSource("none")
64882           );
64883         }
64884         const locator = imageryIndex.backgrounds.find((d2) => d2.overlay && d2.default);
64885         if (locator) {
64886           background.toggleOverlayLayer(locator);
64887         }
64888         const overlays = (hash2.overlays || "").split(",");
64889         overlays.forEach((overlay) => {
64890           overlay = background.findSource(overlay);
64891           if (overlay) {
64892             background.toggleOverlayLayer(overlay);
64893           }
64894         });
64895         if (hash2.gpx) {
64896           const gpx2 = context.layers().layer("data");
64897           if (gpx2) {
64898             gpx2.url(hash2.gpx, ".gpx");
64899           }
64900         }
64901         if (hash2.offset) {
64902           const offset = hash2.offset.replace(/;/g, ",").split(",").map((n3) => !isNaN(n3) && n3);
64903           if (offset.length === 2) {
64904             background.offset(geoMetersToOffset(offset));
64905           }
64906         }
64907       }).catch((err) => {
64908         console.error(err);
64909       });
64910     };
64911     return utilRebind(background, dispatch14, "on");
64912   }
64913   var import_which_polygon3, _imageryIndex;
64914   var init_background2 = __esm({
64915     "modules/renderer/background.js"() {
64916       "use strict";
64917       init_src4();
64918       init_src8();
64919       init_src5();
64920       init_esm5();
64921       init_esm7();
64922       import_which_polygon3 = __toESM(require_which_polygon());
64923       init_preferences();
64924       init_file_fetcher();
64925       init_geo2();
64926       init_background_source();
64927       init_tile_layer();
64928       init_util();
64929       init_rebind();
64930       _imageryIndex = null;
64931     }
64932   });
64933
64934   // modules/renderer/features.js
64935   var features_exports = {};
64936   __export(features_exports, {
64937     rendererFeatures: () => rendererFeatures
64938   });
64939   function rendererFeatures(context) {
64940     var dispatch14 = dispatch_default("change", "redraw");
64941     const features = {};
64942     var _deferred2 = /* @__PURE__ */ new Set();
64943     var traffic_roads = {
64944       "motorway": true,
64945       "motorway_link": true,
64946       "trunk": true,
64947       "trunk_link": true,
64948       "primary": true,
64949       "primary_link": true,
64950       "secondary": true,
64951       "secondary_link": true,
64952       "tertiary": true,
64953       "tertiary_link": true,
64954       "residential": true,
64955       "unclassified": true,
64956       "living_street": true,
64957       "busway": true
64958     };
64959     var service_roads = {
64960       "service": true,
64961       "road": true,
64962       "track": true
64963     };
64964     var paths = {
64965       "path": true,
64966       "footway": true,
64967       "cycleway": true,
64968       "bridleway": true,
64969       "steps": true,
64970       "ladder": true,
64971       "pedestrian": true
64972     };
64973     var _cullFactor = 1;
64974     var _cache5 = {};
64975     var _rules = {};
64976     var _stats = {};
64977     var _keys = [];
64978     var _hidden = [];
64979     var _forceVisible = {};
64980     function update() {
64981       if (!window.mocha) {
64982         var hash2 = utilStringQs(window.location.hash);
64983         var disabled = features.disabled();
64984         if (disabled.length) {
64985           hash2.disable_features = disabled.join(",");
64986         } else {
64987           delete hash2.disable_features;
64988         }
64989         window.location.replace("#" + utilQsString(hash2, true));
64990         corePreferences("disabled-features", disabled.join(","));
64991       }
64992       _hidden = features.hidden();
64993       dispatch14.call("change");
64994       dispatch14.call("redraw");
64995     }
64996     function defineRule(k2, filter2, max3) {
64997       var isEnabled = true;
64998       _keys.push(k2);
64999       _rules[k2] = {
65000         filter: filter2,
65001         enabled: isEnabled,
65002         // whether the user wants it enabled..
65003         count: 0,
65004         currentMax: max3 || Infinity,
65005         defaultMax: max3 || Infinity,
65006         enable: function() {
65007           this.enabled = true;
65008           this.currentMax = this.defaultMax;
65009         },
65010         disable: function() {
65011           this.enabled = false;
65012           this.currentMax = 0;
65013         },
65014         hidden: function() {
65015           return this.count === 0 && !this.enabled || this.count > this.currentMax * _cullFactor;
65016         },
65017         autoHidden: function() {
65018           return this.hidden() && this.currentMax > 0;
65019         }
65020       };
65021     }
65022     defineRule("points", function isPoint(tags, geometry) {
65023       return geometry === "point";
65024     }, 200);
65025     defineRule("traffic_roads", function isTrafficRoad(tags) {
65026       return traffic_roads[tags.highway];
65027     });
65028     defineRule("service_roads", function isServiceRoad(tags) {
65029       return service_roads[tags.highway];
65030     });
65031     defineRule("paths", function isPath(tags) {
65032       return paths[tags.highway];
65033     });
65034     defineRule("buildings", function isBuilding(tags) {
65035       return !!tags.building && tags.building !== "no" || tags.parking === "multi-storey" || tags.parking === "sheds" || tags.parking === "carports" || tags.parking === "garage_boxes";
65036     }, 250);
65037     defineRule("building_parts", function isBuildingPart(tags) {
65038       return !!tags["building:part"];
65039     });
65040     defineRule("indoor", function isIndoor(tags) {
65041       return !!tags.indoor && tags.indoor !== "no" || !!tags.indoormark && tags.indoormark !== "no";
65042     });
65043     defineRule("landuse", function isLanduse(tags, geometry) {
65044       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);
65045     });
65046     defineRule("boundaries", function isBoundary(tags, geometry) {
65047       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);
65048     });
65049     defineRule("water", function isWater(tags) {
65050       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";
65051     });
65052     defineRule("rail", function isRail(tags) {
65053       return (!!tags.railway || tags.landuse === "railway") && !(traffic_roads[tags.highway] || service_roads[tags.highway] || paths[tags.highway]);
65054     });
65055     defineRule("pistes", function isPiste(tags) {
65056       return tags["piste:type"];
65057     });
65058     defineRule("aerialways", function isAerialways(tags) {
65059       return !!(tags == null ? void 0 : tags.aerialway) && tags.aerialway !== "yes" && tags.aerialway !== "station";
65060     });
65061     defineRule("power", function isPower(tags) {
65062       return !!tags.power;
65063     });
65064     defineRule("past_future", function isPastFuture(tags) {
65065       if (traffic_roads[tags.highway] || service_roads[tags.highway] || paths[tags.highway]) {
65066         return false;
65067       }
65068       const keys2 = Object.keys(tags);
65069       for (let i3 = 0; i3 < keys2.length; i3++) {
65070         const key = keys2[i3];
65071         const s2 = key.split(":")[0];
65072         if (osmLifecyclePrefixes[s2] || osmLifecyclePrefixes[tags[key]]) return true;
65073       }
65074       return false;
65075     });
65076     defineRule("others", function isOther(tags, geometry) {
65077       return geometry === "line" || geometry === "area";
65078     });
65079     features.features = function() {
65080       return _rules;
65081     };
65082     features.keys = function() {
65083       return _keys;
65084     };
65085     features.enabled = function(k2) {
65086       if (!arguments.length) {
65087         return _keys.filter(function(k3) {
65088           return _rules[k3].enabled;
65089         });
65090       }
65091       return _rules[k2] && _rules[k2].enabled;
65092     };
65093     features.disabled = function(k2) {
65094       if (!arguments.length) {
65095         return _keys.filter(function(k3) {
65096           return !_rules[k3].enabled;
65097         });
65098       }
65099       return _rules[k2] && !_rules[k2].enabled;
65100     };
65101     features.hidden = function(k2) {
65102       var _a3;
65103       if (!arguments.length) {
65104         return _keys.filter(function(k3) {
65105           return _rules[k3].hidden();
65106         });
65107       }
65108       return (_a3 = _rules[k2]) == null ? void 0 : _a3.hidden();
65109     };
65110     features.autoHidden = function(k2) {
65111       if (!arguments.length) {
65112         return _keys.filter(function(k3) {
65113           return _rules[k3].autoHidden();
65114         });
65115       }
65116       return _rules[k2] && _rules[k2].autoHidden();
65117     };
65118     features.enable = function(k2) {
65119       if (_rules[k2] && !_rules[k2].enabled) {
65120         _rules[k2].enable();
65121         update();
65122       }
65123     };
65124     features.enableAll = function() {
65125       var didEnable = false;
65126       for (var k2 in _rules) {
65127         if (!_rules[k2].enabled) {
65128           didEnable = true;
65129           _rules[k2].enable();
65130         }
65131       }
65132       if (didEnable) update();
65133     };
65134     features.disable = function(k2) {
65135       if (_rules[k2] && _rules[k2].enabled) {
65136         _rules[k2].disable();
65137         update();
65138       }
65139     };
65140     features.disableAll = function() {
65141       var didDisable = false;
65142       for (var k2 in _rules) {
65143         if (_rules[k2].enabled) {
65144           didDisable = true;
65145           _rules[k2].disable();
65146         }
65147       }
65148       if (didDisable) update();
65149     };
65150     features.toggle = function(k2) {
65151       if (_rules[k2]) {
65152         (function(f2) {
65153           return f2.enabled ? f2.disable() : f2.enable();
65154         })(_rules[k2]);
65155         update();
65156       }
65157     };
65158     features.resetStats = function() {
65159       for (var i3 = 0; i3 < _keys.length; i3++) {
65160         _rules[_keys[i3]].count = 0;
65161       }
65162       dispatch14.call("change");
65163     };
65164     features.gatherStats = function(d2, resolver, dimensions) {
65165       var needsRedraw = false;
65166       var types = utilArrayGroupBy(d2, "type");
65167       var entities = [].concat(types.relation || [], types.way || [], types.node || []);
65168       var currHidden, geometry, matches, i3, j2;
65169       for (i3 = 0; i3 < _keys.length; i3++) {
65170         _rules[_keys[i3]].count = 0;
65171       }
65172       _cullFactor = dimensions[0] * dimensions[1] / 1e6;
65173       for (i3 = 0; i3 < entities.length; i3++) {
65174         geometry = entities[i3].geometry(resolver);
65175         matches = Object.keys(features.getMatches(entities[i3], resolver, geometry));
65176         for (j2 = 0; j2 < matches.length; j2++) {
65177           _rules[matches[j2]].count++;
65178         }
65179       }
65180       currHidden = features.hidden();
65181       if (currHidden !== _hidden) {
65182         _hidden = currHidden;
65183         needsRedraw = true;
65184         dispatch14.call("change");
65185       }
65186       return needsRedraw;
65187     };
65188     features.stats = function() {
65189       for (var i3 = 0; i3 < _keys.length; i3++) {
65190         _stats[_keys[i3]] = _rules[_keys[i3]].count;
65191       }
65192       return _stats;
65193     };
65194     features.clear = function(d2) {
65195       for (var i3 = 0; i3 < d2.length; i3++) {
65196         features.clearEntity(d2[i3]);
65197       }
65198     };
65199     features.clearEntity = function(entity) {
65200       delete _cache5[osmEntity.key(entity)];
65201     };
65202     features.reset = function() {
65203       Array.from(_deferred2).forEach(function(handle) {
65204         window.cancelIdleCallback(handle);
65205         _deferred2.delete(handle);
65206       });
65207       _cache5 = {};
65208     };
65209     function relationShouldBeChecked(relation) {
65210       return relation.tags.type === "boundary";
65211     }
65212     features.getMatches = function(entity, resolver, geometry) {
65213       if (geometry === "vertex" || geometry === "relation" && !relationShouldBeChecked(entity)) return {};
65214       var ent = osmEntity.key(entity);
65215       if (!_cache5[ent]) {
65216         _cache5[ent] = {};
65217       }
65218       if (!_cache5[ent].matches) {
65219         var matches = {};
65220         var hasMatch = false;
65221         for (var i3 = 0; i3 < _keys.length; i3++) {
65222           if (_keys[i3] === "others") {
65223             if (hasMatch) continue;
65224             if (entity.type === "way") {
65225               var parents = features.getParents(entity, resolver, geometry);
65226               if (parents.length === 1 && parents[0].isMultipolygon() || // 2b. or belongs only to boundary relations
65227               parents.length > 0 && parents.every(function(parent) {
65228                 return parent.tags.type === "boundary";
65229               })) {
65230                 var pkey = osmEntity.key(parents[0]);
65231                 if (_cache5[pkey] && _cache5[pkey].matches) {
65232                   matches = Object.assign({}, _cache5[pkey].matches);
65233                   continue;
65234                 }
65235               }
65236             }
65237           }
65238           if (_rules[_keys[i3]].filter(entity.tags, geometry)) {
65239             matches[_keys[i3]] = hasMatch = true;
65240           }
65241         }
65242         _cache5[ent].matches = matches;
65243       }
65244       return _cache5[ent].matches;
65245     };
65246     features.getParents = function(entity, resolver, geometry) {
65247       if (geometry === "point") return [];
65248       var ent = osmEntity.key(entity);
65249       if (!_cache5[ent]) {
65250         _cache5[ent] = {};
65251       }
65252       if (!_cache5[ent].parents) {
65253         var parents = [];
65254         if (geometry === "vertex") {
65255           parents = resolver.parentWays(entity);
65256         } else {
65257           parents = resolver.parentRelations(entity);
65258         }
65259         _cache5[ent].parents = parents;
65260       }
65261       return _cache5[ent].parents;
65262     };
65263     features.isHiddenPreset = function(preset, geometry) {
65264       if (!_hidden.length) return false;
65265       if (!preset.tags) return false;
65266       var test = preset.setTags({}, geometry);
65267       for (var key in _rules) {
65268         if (_rules[key].filter(test, geometry)) {
65269           if (_hidden.indexOf(key) !== -1) {
65270             return key;
65271           }
65272           return false;
65273         }
65274       }
65275       return false;
65276     };
65277     features.isHiddenFeature = function(entity, resolver, geometry) {
65278       if (!_hidden.length) return false;
65279       if (!entity.version) return false;
65280       if (_forceVisible[entity.id]) return false;
65281       var matches = Object.keys(features.getMatches(entity, resolver, geometry));
65282       return matches.length && matches.every(function(k2) {
65283         return features.hidden(k2);
65284       });
65285     };
65286     features.isHiddenChild = function(entity, resolver, geometry) {
65287       if (!_hidden.length) return false;
65288       if (!entity.version || geometry === "point") return false;
65289       if (_forceVisible[entity.id]) return false;
65290       var parents = features.getParents(entity, resolver, geometry);
65291       if (!parents.length) return false;
65292       for (var i3 = 0; i3 < parents.length; i3++) {
65293         if (!features.isHidden(parents[i3], resolver, parents[i3].geometry(resolver))) {
65294           return false;
65295         }
65296       }
65297       return true;
65298     };
65299     features.hasHiddenConnections = function(entity, resolver) {
65300       if (!_hidden.length) return false;
65301       var childNodes, connections;
65302       if (entity.type === "midpoint") {
65303         childNodes = [resolver.entity(entity.edge[0]), resolver.entity(entity.edge[1])];
65304         connections = [];
65305       } else {
65306         childNodes = entity.nodes ? resolver.childNodes(entity) : [];
65307         connections = features.getParents(entity, resolver, entity.geometry(resolver));
65308       }
65309       connections = childNodes.reduce(function(result, e3) {
65310         return resolver.isShared(e3) ? utilArrayUnion(result, resolver.parentWays(e3)) : result;
65311       }, connections);
65312       return connections.some(function(e3) {
65313         return features.isHidden(e3, resolver, e3.geometry(resolver));
65314       });
65315     };
65316     features.isHidden = function(entity, resolver, geometry) {
65317       if (!_hidden.length) return false;
65318       if (!entity.version) return false;
65319       var fn = geometry === "vertex" ? features.isHiddenChild : features.isHiddenFeature;
65320       return fn(entity, resolver, geometry);
65321     };
65322     features.filter = function(d2, resolver) {
65323       if (!_hidden.length) return d2;
65324       var result = [];
65325       for (var i3 = 0; i3 < d2.length; i3++) {
65326         var entity = d2[i3];
65327         if (!features.isHidden(entity, resolver, entity.geometry(resolver))) {
65328           result.push(entity);
65329         }
65330       }
65331       return result;
65332     };
65333     features.forceVisible = function(entityIDs) {
65334       if (!arguments.length) return Object.keys(_forceVisible);
65335       _forceVisible = {};
65336       for (var i3 = 0; i3 < entityIDs.length; i3++) {
65337         _forceVisible[entityIDs[i3]] = true;
65338         var entity = context.hasEntity(entityIDs[i3]);
65339         if (entity && entity.type === "relation") {
65340           for (var j2 in entity.members) {
65341             _forceVisible[entity.members[j2].id] = true;
65342           }
65343         }
65344       }
65345       return features;
65346     };
65347     features.init = function() {
65348       var storage = corePreferences("disabled-features");
65349       if (storage) {
65350         var storageDisabled = storage.replace(/;/g, ",").split(",");
65351         storageDisabled.forEach(features.disable);
65352       }
65353       var hash2 = utilStringQs(window.location.hash);
65354       if (hash2.disable_features) {
65355         var hashDisabled = hash2.disable_features.replace(/;/g, ",").split(",");
65356         hashDisabled.forEach(features.disable);
65357       }
65358     };
65359     context.history().on("merge.features", function(newEntities) {
65360       if (!newEntities) return;
65361       var handle = window.requestIdleCallback(function() {
65362         var graph = context.graph();
65363         var types = utilArrayGroupBy(newEntities, "type");
65364         var entities = [].concat(types.relation || [], types.way || [], types.node || []);
65365         for (var i3 = 0; i3 < entities.length; i3++) {
65366           var geometry = entities[i3].geometry(graph);
65367           features.getMatches(entities[i3], graph, geometry);
65368         }
65369       });
65370       _deferred2.add(handle);
65371     });
65372     return utilRebind(features, dispatch14, "on");
65373   }
65374   var init_features = __esm({
65375     "modules/renderer/features.js"() {
65376       "use strict";
65377       init_src4();
65378       init_preferences();
65379       init_osm();
65380       init_rebind();
65381       init_util();
65382     }
65383   });
65384
65385   // modules/util/bind_once.js
65386   var bind_once_exports = {};
65387   __export(bind_once_exports, {
65388     utilBindOnce: () => utilBindOnce
65389   });
65390   function utilBindOnce(target, type2, listener, capture) {
65391     var typeOnce = type2 + ".once";
65392     function one2() {
65393       target.on(typeOnce, null);
65394       listener.apply(this, arguments);
65395     }
65396     target.on(typeOnce, one2, capture);
65397     return this;
65398   }
65399   var init_bind_once = __esm({
65400     "modules/util/bind_once.js"() {
65401       "use strict";
65402     }
65403   });
65404
65405   // modules/util/zoom_pan.js
65406   var zoom_pan_exports = {};
65407   __export(zoom_pan_exports, {
65408     utilZoomPan: () => utilZoomPan
65409   });
65410   function defaultFilter3(d3_event) {
65411     return !d3_event.ctrlKey && !d3_event.button;
65412   }
65413   function defaultExtent2() {
65414     var e3 = this;
65415     if (e3 instanceof SVGElement) {
65416       e3 = e3.ownerSVGElement || e3;
65417       if (e3.hasAttribute("viewBox")) {
65418         e3 = e3.viewBox.baseVal;
65419         return [[e3.x, e3.y], [e3.x + e3.width, e3.y + e3.height]];
65420       }
65421       return [[0, 0], [e3.width.baseVal.value, e3.height.baseVal.value]];
65422     }
65423     return [[0, 0], [e3.clientWidth, e3.clientHeight]];
65424   }
65425   function defaultWheelDelta2(d3_event) {
65426     return -d3_event.deltaY * (d3_event.deltaMode === 1 ? 0.05 : d3_event.deltaMode ? 1 : 2e-3);
65427   }
65428   function defaultConstrain2(transform2, extent, translateExtent) {
65429     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];
65430     return transform2.translate(
65431       dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),
65432       dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)
65433     );
65434   }
65435   function utilZoomPan() {
65436     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;
65437     function zoom(selection2) {
65438       selection2.on("pointerdown.zoom", pointerdown).on("wheel.zoom", wheeled).style("touch-action", "none").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
65439       select_default2(window).on("pointermove.zoompan", pointermove).on("pointerup.zoompan pointercancel.zoompan", pointerup);
65440     }
65441     zoom.transform = function(collection, transform2, point) {
65442       var selection2 = collection.selection ? collection.selection() : collection;
65443       if (collection !== selection2) {
65444         schedule(collection, transform2, point);
65445       } else {
65446         selection2.interrupt().each(function() {
65447           gesture(this, arguments).start(null).zoom(null, null, typeof transform2 === "function" ? transform2.apply(this, arguments) : transform2).end(null);
65448         });
65449       }
65450     };
65451     zoom.scaleBy = function(selection2, k2, p2) {
65452       zoom.scaleTo(selection2, function() {
65453         var k0 = _transform.k, k1 = typeof k2 === "function" ? k2.apply(this, arguments) : k2;
65454         return k0 * k1;
65455       }, p2);
65456     };
65457     zoom.scaleTo = function(selection2, k2, p2) {
65458       zoom.transform(selection2, function() {
65459         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 k2 === "function" ? k2.apply(this, arguments) : k2;
65460         return constrain(translate(scale(t02, k1), p02, p1), e3, translateExtent);
65461       }, p2);
65462     };
65463     zoom.translateBy = function(selection2, x2, y2) {
65464       zoom.transform(selection2, function() {
65465         return constrain(_transform.translate(
65466           typeof x2 === "function" ? x2.apply(this, arguments) : x2,
65467           typeof y2 === "function" ? y2.apply(this, arguments) : y2
65468         ), extent.apply(this, arguments), translateExtent);
65469       });
65470     };
65471     zoom.translateTo = function(selection2, x2, y2, p2) {
65472       zoom.transform(selection2, function() {
65473         var e3 = extent.apply(this, arguments), t2 = _transform, p02 = !p2 ? centroid(e3) : typeof p2 === "function" ? p2.apply(this, arguments) : p2;
65474         return constrain(identity2.translate(p02[0], p02[1]).scale(t2.k).translate(
65475           typeof x2 === "function" ? -x2.apply(this, arguments) : -x2,
65476           typeof y2 === "function" ? -y2.apply(this, arguments) : -y2
65477         ), e3, translateExtent);
65478       }, p2);
65479     };
65480     function scale(transform2, k2) {
65481       k2 = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k2));
65482       return k2 === transform2.k ? transform2 : new Transform(k2, transform2.x, transform2.y);
65483     }
65484     function translate(transform2, p02, p1) {
65485       var x2 = p02[0] - p1[0] * transform2.k, y2 = p02[1] - p1[1] * transform2.k;
65486       return x2 === transform2.x && y2 === transform2.y ? transform2 : new Transform(transform2.k, x2, y2);
65487     }
65488     function centroid(extent2) {
65489       return [(+extent2[0][0] + +extent2[1][0]) / 2, (+extent2[0][1] + +extent2[1][1]) / 2];
65490     }
65491     function schedule(transition2, transform2, point) {
65492       transition2.on("start.zoom", function() {
65493         gesture(this, arguments).start(null);
65494       }).on("interrupt.zoom end.zoom", function() {
65495         gesture(this, arguments).end(null);
65496       }).tween("zoom", function() {
65497         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, w2 = Math.max(e3[1][0] - e3[0][0], e3[1][1] - e3[0][1]), a2 = _transform, b2 = typeof transform2 === "function" ? transform2.apply(that, args) : transform2, i3 = interpolate(a2.invert(p2).concat(w2 / a2.k), b2.invert(p2).concat(w2 / b2.k));
65498         return function(t2) {
65499           if (t2 === 1) {
65500             t2 = b2;
65501           } else {
65502             var l2 = i3(t2);
65503             var k2 = w2 / l2[2];
65504             t2 = new Transform(k2, p2[0] - l2[0] * k2, p2[1] - l2[1] * k2);
65505           }
65506           g3.zoom(null, null, t2);
65507         };
65508       });
65509     }
65510     function gesture(that, args, clean2) {
65511       return !clean2 && _activeGesture || new Gesture(that, args);
65512     }
65513     function Gesture(that, args) {
65514       this.that = that;
65515       this.args = args;
65516       this.active = 0;
65517       this.extent = extent.apply(that, args);
65518     }
65519     Gesture.prototype = {
65520       start: function(d3_event) {
65521         if (++this.active === 1) {
65522           _activeGesture = this;
65523           dispatch14.call("start", this, d3_event);
65524         }
65525         return this;
65526       },
65527       zoom: function(d3_event, key, transform2) {
65528         if (this.mouse && key !== "mouse") this.mouse[1] = transform2.invert(this.mouse[0]);
65529         if (this.pointer0 && key !== "touch") this.pointer0[1] = transform2.invert(this.pointer0[0]);
65530         if (this.pointer1 && key !== "touch") this.pointer1[1] = transform2.invert(this.pointer1[0]);
65531         _transform = transform2;
65532         dispatch14.call("zoom", this, d3_event, key, transform2);
65533         return this;
65534       },
65535       end: function(d3_event) {
65536         if (--this.active === 0) {
65537           _activeGesture = null;
65538           dispatch14.call("end", this, d3_event);
65539         }
65540         return this;
65541       }
65542     };
65543     function wheeled(d3_event) {
65544       if (!filter2.apply(this, arguments)) return;
65545       var g3 = gesture(this, arguments), t2 = _transform, k2 = Math.max(scaleExtent[0], Math.min(scaleExtent[1], t2.k * Math.pow(2, wheelDelta.apply(this, arguments)))), p2 = utilFastMouse(this)(d3_event);
65546       if (g3.wheel) {
65547         if (g3.mouse[0][0] !== p2[0] || g3.mouse[0][1] !== p2[1]) {
65548           g3.mouse[1] = t2.invert(g3.mouse[0] = p2);
65549         }
65550         clearTimeout(g3.wheel);
65551       } else {
65552         g3.mouse = [p2, t2.invert(p2)];
65553         interrupt_default(this);
65554         g3.start(d3_event);
65555       }
65556       d3_event.preventDefault();
65557       d3_event.stopImmediatePropagation();
65558       g3.wheel = setTimeout(wheelidled, _wheelDelay);
65559       g3.zoom(d3_event, "mouse", constrain(translate(scale(t2, k2), g3.mouse[0], g3.mouse[1]), g3.extent, translateExtent));
65560       function wheelidled() {
65561         g3.wheel = null;
65562         g3.end(d3_event);
65563       }
65564     }
65565     var _downPointerIDs = /* @__PURE__ */ new Set();
65566     var _pointerLocGetter;
65567     function pointerdown(d3_event) {
65568       _downPointerIDs.add(d3_event.pointerId);
65569       if (!filter2.apply(this, arguments)) return;
65570       var g3 = gesture(this, arguments, _downPointerIDs.size === 1);
65571       var started;
65572       d3_event.stopImmediatePropagation();
65573       _pointerLocGetter = utilFastMouse(this);
65574       var loc = _pointerLocGetter(d3_event);
65575       var p2 = [loc, _transform.invert(loc), d3_event.pointerId];
65576       if (!g3.pointer0) {
65577         g3.pointer0 = p2;
65578         started = true;
65579       } else if (!g3.pointer1 && g3.pointer0[2] !== p2[2]) {
65580         g3.pointer1 = p2;
65581       }
65582       if (started) {
65583         interrupt_default(this);
65584         g3.start(d3_event);
65585       }
65586     }
65587     function pointermove(d3_event) {
65588       if (!_downPointerIDs.has(d3_event.pointerId)) return;
65589       if (!_activeGesture || !_pointerLocGetter) return;
65590       var g3 = gesture(this, arguments);
65591       var isPointer0 = g3.pointer0 && g3.pointer0[2] === d3_event.pointerId;
65592       var isPointer1 = !isPointer0 && g3.pointer1 && g3.pointer1[2] === d3_event.pointerId;
65593       if ((isPointer0 || isPointer1) && "buttons" in d3_event && !d3_event.buttons) {
65594         if (g3.pointer0) _downPointerIDs.delete(g3.pointer0[2]);
65595         if (g3.pointer1) _downPointerIDs.delete(g3.pointer1[2]);
65596         g3.end(d3_event);
65597         return;
65598       }
65599       d3_event.preventDefault();
65600       d3_event.stopImmediatePropagation();
65601       var loc = _pointerLocGetter(d3_event);
65602       var t2, p2, l2;
65603       if (isPointer0) g3.pointer0[0] = loc;
65604       else if (isPointer1) g3.pointer1[0] = loc;
65605       t2 = _transform;
65606       if (g3.pointer1) {
65607         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;
65608         t2 = scale(t2, Math.sqrt(dp / dl));
65609         p2 = [(p02[0] + p1[0]) / 2, (p02[1] + p1[1]) / 2];
65610         l2 = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
65611       } else if (g3.pointer0) {
65612         p2 = g3.pointer0[0];
65613         l2 = g3.pointer0[1];
65614       } else {
65615         return;
65616       }
65617       g3.zoom(d3_event, "touch", constrain(translate(t2, p2, l2), g3.extent, translateExtent));
65618     }
65619     function pointerup(d3_event) {
65620       if (!_downPointerIDs.has(d3_event.pointerId)) return;
65621       _downPointerIDs.delete(d3_event.pointerId);
65622       if (!_activeGesture) return;
65623       var g3 = gesture(this, arguments);
65624       d3_event.stopImmediatePropagation();
65625       if (g3.pointer0 && g3.pointer0[2] === d3_event.pointerId) delete g3.pointer0;
65626       else if (g3.pointer1 && g3.pointer1[2] === d3_event.pointerId) delete g3.pointer1;
65627       if (g3.pointer1 && !g3.pointer0) {
65628         g3.pointer0 = g3.pointer1;
65629         delete g3.pointer1;
65630       }
65631       if (g3.pointer0) {
65632         g3.pointer0[1] = _transform.invert(g3.pointer0[0]);
65633       } else {
65634         g3.end(d3_event);
65635       }
65636     }
65637     zoom.wheelDelta = function(_2) {
65638       return arguments.length ? (wheelDelta = utilFunctor(+_2), zoom) : wheelDelta;
65639     };
65640     zoom.filter = function(_2) {
65641       return arguments.length ? (filter2 = utilFunctor(!!_2), zoom) : filter2;
65642     };
65643     zoom.extent = function(_2) {
65644       return arguments.length ? (extent = utilFunctor([[+_2[0][0], +_2[0][1]], [+_2[1][0], +_2[1][1]]]), zoom) : extent;
65645     };
65646     zoom.scaleExtent = function(_2) {
65647       return arguments.length ? (scaleExtent[0] = +_2[0], scaleExtent[1] = +_2[1], zoom) : [scaleExtent[0], scaleExtent[1]];
65648     };
65649     zoom.translateExtent = function(_2) {
65650       return arguments.length ? (translateExtent[0][0] = +_2[0][0], translateExtent[1][0] = +_2[1][0], translateExtent[0][1] = +_2[0][1], translateExtent[1][1] = +_2[1][1], zoom) : [[translateExtent[0][0], translateExtent[0][1]], [translateExtent[1][0], translateExtent[1][1]]];
65651     };
65652     zoom.constrain = function(_2) {
65653       return arguments.length ? (constrain = _2, zoom) : constrain;
65654     };
65655     zoom.interpolate = function(_2) {
65656       return arguments.length ? (interpolate = _2, zoom) : interpolate;
65657     };
65658     zoom._transform = function(_2) {
65659       return arguments.length ? (_transform = _2, zoom) : _transform;
65660     };
65661     return utilRebind(zoom, dispatch14, "on");
65662   }
65663   var init_zoom_pan = __esm({
65664     "modules/util/zoom_pan.js"() {
65665       "use strict";
65666       init_src4();
65667       init_src8();
65668       init_src5();
65669       init_src11();
65670       init_src12();
65671       init_transform3();
65672       init_util2();
65673       init_rebind();
65674     }
65675   });
65676
65677   // modules/util/double_up.js
65678   var double_up_exports = {};
65679   __export(double_up_exports, {
65680     utilDoubleUp: () => utilDoubleUp
65681   });
65682   function utilDoubleUp() {
65683     var dispatch14 = dispatch_default("doubleUp");
65684     var _maxTimespan = 500;
65685     var _maxDistance = 20;
65686     var _pointer;
65687     function pointerIsValidFor(loc) {
65688       return (/* @__PURE__ */ new Date()).getTime() - _pointer.startTime <= _maxTimespan && // all pointer events must occur within a small distance of the first pointerdown
65689       geoVecLength(_pointer.startLoc, loc) <= _maxDistance;
65690     }
65691     function pointerdown(d3_event) {
65692       if (d3_event.ctrlKey || d3_event.button === 2) return;
65693       var loc = [d3_event.clientX, d3_event.clientY];
65694       if (_pointer && !pointerIsValidFor(loc)) {
65695         _pointer = void 0;
65696       }
65697       if (!_pointer) {
65698         _pointer = {
65699           startLoc: loc,
65700           startTime: (/* @__PURE__ */ new Date()).getTime(),
65701           upCount: 0,
65702           pointerId: d3_event.pointerId
65703         };
65704       } else {
65705         _pointer.pointerId = d3_event.pointerId;
65706       }
65707     }
65708     function pointerup(d3_event) {
65709       if (d3_event.ctrlKey || d3_event.button === 2) return;
65710       if (!_pointer || _pointer.pointerId !== d3_event.pointerId) return;
65711       _pointer.upCount += 1;
65712       if (_pointer.upCount === 2) {
65713         var loc = [d3_event.clientX, d3_event.clientY];
65714         if (pointerIsValidFor(loc)) {
65715           var locInThis = utilFastMouse(this)(d3_event);
65716           dispatch14.call("doubleUp", this, d3_event, locInThis);
65717         }
65718         _pointer = void 0;
65719       }
65720     }
65721     function doubleUp(selection2) {
65722       if ("PointerEvent" in window) {
65723         selection2.on("pointerdown.doubleUp", pointerdown).on("pointerup.doubleUp", pointerup);
65724       } else {
65725         selection2.on("dblclick.doubleUp", function(d3_event) {
65726           dispatch14.call("doubleUp", this, d3_event, utilFastMouse(this)(d3_event));
65727         });
65728       }
65729     }
65730     doubleUp.off = function(selection2) {
65731       selection2.on("pointerdown.doubleUp", null).on("pointerup.doubleUp", null).on("dblclick.doubleUp", null);
65732     };
65733     return utilRebind(doubleUp, dispatch14, "on");
65734   }
65735   var init_double_up = __esm({
65736     "modules/util/double_up.js"() {
65737       "use strict";
65738       init_src4();
65739       init_util2();
65740       init_rebind();
65741       init_vector();
65742     }
65743   });
65744
65745   // modules/renderer/map.js
65746   var map_exports = {};
65747   __export(map_exports, {
65748     rendererMap: () => rendererMap
65749   });
65750   function clamp2(num, min3, max3) {
65751     return Math.max(min3, Math.min(num, max3));
65752   }
65753   function rendererMap(context) {
65754     var dispatch14 = dispatch_default(
65755       "move",
65756       "drawn",
65757       "crossEditableZoom",
65758       "hitMinZoom",
65759       "changeHighlighting",
65760       "changeAreaFill"
65761     );
65762     var projection2 = context.projection;
65763     var curtainProjection = context.curtainProjection;
65764     var drawLayers;
65765     var drawPoints;
65766     var drawVertices;
65767     var drawLines;
65768     var drawAreas;
65769     var drawMidpoints;
65770     var drawLabels;
65771     var _selection = select_default2(null);
65772     var supersurface = select_default2(null);
65773     var wrapper = select_default2(null);
65774     var surface = select_default2(null);
65775     var _dimensions = [1, 1];
65776     var _dblClickZoomEnabled = true;
65777     var _redrawEnabled = true;
65778     var _gestureTransformStart;
65779     var _transformStart = projection2.transform();
65780     var _transformLast;
65781     var _isTransformed = false;
65782     var _minzoom = 0;
65783     var _getMouseCoords;
65784     var _lastPointerEvent;
65785     var _lastWithinEditableZoom;
65786     var _pointerDown = false;
65787     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
65788     var _zoomerPannerFunction = "PointerEvent" in window ? utilZoomPan : zoom_default2;
65789     var _zoomerPanner = _zoomerPannerFunction().scaleExtent([kMin, kMax]).interpolate(value_default).filter(zoomEventFilter).on("zoom.map", zoomPan2).on("start.map", function(d3_event) {
65790       _pointerDown = d3_event && (d3_event.type === "pointerdown" || d3_event.sourceEvent && d3_event.sourceEvent.type === "pointerdown");
65791     }).on("end.map", function() {
65792       _pointerDown = false;
65793     });
65794     var _doubleUpHandler = utilDoubleUp();
65795     var scheduleRedraw = throttle_default(redraw, 750);
65796     function cancelPendingRedraw() {
65797       scheduleRedraw.cancel();
65798     }
65799     function map2(selection2) {
65800       _selection = selection2;
65801       context.on("change.map", immediateRedraw);
65802       var osm = context.connection();
65803       if (osm) {
65804         osm.on("change.map", immediateRedraw);
65805       }
65806       function didUndoOrRedo(targetTransform) {
65807         var mode = context.mode().id;
65808         if (mode !== "browse" && mode !== "select") return;
65809         if (targetTransform) {
65810           map2.transformEase(targetTransform);
65811         }
65812       }
65813       context.history().on("merge.map", function() {
65814         scheduleRedraw();
65815       }).on("change.map", immediateRedraw).on("undone.map", function(stack, fromStack) {
65816         didUndoOrRedo(fromStack.transform);
65817       }).on("redone.map", function(stack) {
65818         didUndoOrRedo(stack.transform);
65819       });
65820       context.background().on("change.map", immediateRedraw);
65821       context.features().on("redraw.map", immediateRedraw);
65822       drawLayers.on("change.map", function() {
65823         context.background().updateImagery();
65824         immediateRedraw();
65825       });
65826       selection2.on("wheel.map mousewheel.map", function(d3_event) {
65827         d3_event.preventDefault();
65828       }).call(_zoomerPanner).call(_zoomerPanner.transform, projection2.transform()).on("dblclick.zoom", null);
65829       map2.supersurface = supersurface = selection2.append("div").attr("class", "supersurface").call(utilSetTransform, 0, 0);
65830       wrapper = supersurface.append("div").attr("class", "layer layer-data");
65831       map2.surface = surface = wrapper.call(drawLayers).selectAll(".surface");
65832       surface.call(drawLabels.observe).call(_doubleUpHandler).on(_pointerPrefix + "down.zoom", function(d3_event) {
65833         _lastPointerEvent = d3_event;
65834         if (d3_event.button === 2) {
65835           d3_event.stopPropagation();
65836         }
65837       }, true).on(_pointerPrefix + "up.zoom", function(d3_event) {
65838         _lastPointerEvent = d3_event;
65839         if (resetTransform()) {
65840           immediateRedraw();
65841         }
65842       }).on(_pointerPrefix + "move.map", function(d3_event) {
65843         _lastPointerEvent = d3_event;
65844       }).on(_pointerPrefix + "over.vertices", function(d3_event) {
65845         if (map2.editableDataEnabled() && !_isTransformed) {
65846           var hover = d3_event.target.__data__;
65847           surface.call(drawVertices.drawHover, context.graph(), hover, map2.extent());
65848           dispatch14.call("drawn", this, { full: false });
65849         }
65850       }).on(_pointerPrefix + "out.vertices", function(d3_event) {
65851         if (map2.editableDataEnabled() && !_isTransformed) {
65852           var hover = d3_event.relatedTarget && d3_event.relatedTarget.__data__;
65853           surface.call(drawVertices.drawHover, context.graph(), hover, map2.extent());
65854           dispatch14.call("drawn", this, { full: false });
65855         }
65856       });
65857       var detected = utilDetect();
65858       if ("GestureEvent" in window && // Listening for gesture events on iOS 13.4+ breaks double-tapping,
65859       // but we only need to do this on desktop Safari anyway. – #7694
65860       !detected.isMobileWebKit) {
65861         surface.on("gesturestart.surface", function(d3_event) {
65862           d3_event.preventDefault();
65863           _gestureTransformStart = projection2.transform();
65864         }).on("gesturechange.surface", gestureChange);
65865       }
65866       updateAreaFill();
65867       _doubleUpHandler.on("doubleUp.map", function(d3_event, p02) {
65868         if (!_dblClickZoomEnabled) return;
65869         if (typeof d3_event.target.__data__ === "object" && // or area fills
65870         !select_default2(d3_event.target).classed("fill")) return;
65871         var zoomOut2 = d3_event.shiftKey;
65872         var t2 = projection2.transform();
65873         var p1 = t2.invert(p02);
65874         t2 = t2.scale(zoomOut2 ? 0.5 : 2);
65875         t2.x = p02[0] - p1[0] * t2.k;
65876         t2.y = p02[1] - p1[1] * t2.k;
65877         map2.transformEase(t2);
65878       });
65879       context.on("enter.map", function() {
65880         if (!map2.editableDataEnabled(
65881           true
65882           /* skip zoom check */
65883         )) return;
65884         if (_isTransformed) return;
65885         var graph = context.graph();
65886         var selectedAndParents = {};
65887         context.selectedIDs().forEach(function(id2) {
65888           var entity = graph.hasEntity(id2);
65889           if (entity) {
65890             selectedAndParents[entity.id] = entity;
65891             if (entity.type === "node") {
65892               graph.parentWays(entity).forEach(function(parent) {
65893                 selectedAndParents[parent.id] = parent;
65894               });
65895             }
65896           }
65897         });
65898         var data = Object.values(selectedAndParents);
65899         var filter2 = function(d2) {
65900           return d2.id in selectedAndParents;
65901         };
65902         data = context.features().filter(data, graph);
65903         surface.call(drawVertices.drawSelected, graph, map2.extent()).call(drawLines, graph, data, filter2).call(drawAreas, graph, data, filter2).call(drawMidpoints, graph, data, filter2, map2.trimmedExtent());
65904         dispatch14.call("drawn", this, { full: false });
65905         scheduleRedraw();
65906       });
65907       map2.dimensions(utilGetDimensions(selection2));
65908     }
65909     function zoomEventFilter(d3_event) {
65910       if (d3_event.type === "mousedown") {
65911         var hasOrphan = false;
65912         var listeners = window.__on;
65913         for (var i3 = 0; i3 < listeners.length; i3++) {
65914           var listener = listeners[i3];
65915           if (listener.name === "zoom" && listener.type === "mouseup") {
65916             hasOrphan = true;
65917             break;
65918           }
65919         }
65920         if (hasOrphan) {
65921           var event = window.CustomEvent;
65922           if (event) {
65923             event = new event("mouseup");
65924           } else {
65925             event = window.document.createEvent("Event");
65926             event.initEvent("mouseup", false, false);
65927           }
65928           event.view = window;
65929           window.dispatchEvent(event);
65930         }
65931       }
65932       return d3_event.button !== 2;
65933     }
65934     function pxCenter() {
65935       return [_dimensions[0] / 2, _dimensions[1] / 2];
65936     }
65937     function drawEditable(difference2, extent) {
65938       var mode = context.mode();
65939       var graph = context.graph();
65940       var features = context.features();
65941       var all = context.history().intersects(map2.extent());
65942       var fullRedraw = false;
65943       var data;
65944       var set4;
65945       var filter2;
65946       var applyFeatureLayerFilters = true;
65947       if (map2.isInWideSelection()) {
65948         data = [];
65949         utilEntityAndDeepMemberIDs(mode.selectedIDs(), context.graph()).forEach(function(id2) {
65950           var entity = context.hasEntity(id2);
65951           if (entity) data.push(entity);
65952         });
65953         fullRedraw = true;
65954         filter2 = utilFunctor(true);
65955         applyFeatureLayerFilters = false;
65956       } else if (difference2) {
65957         var complete = difference2.complete(map2.extent());
65958         data = Object.values(complete).filter(Boolean);
65959         set4 = new Set(Object.keys(complete));
65960         filter2 = function(d2) {
65961           return set4.has(d2.id);
65962         };
65963         features.clear(data);
65964       } else {
65965         if (features.gatherStats(all, graph, _dimensions)) {
65966           extent = void 0;
65967         }
65968         if (extent) {
65969           data = context.history().intersects(map2.extent().intersection(extent));
65970           set4 = new Set(data.map(function(entity) {
65971             return entity.id;
65972           }));
65973           filter2 = function(d2) {
65974             return set4.has(d2.id);
65975           };
65976         } else {
65977           data = all;
65978           fullRedraw = true;
65979           filter2 = utilFunctor(true);
65980         }
65981       }
65982       if (applyFeatureLayerFilters) {
65983         data = features.filter(data, graph);
65984       } else {
65985         context.features().resetStats();
65986       }
65987       if (mode && mode.id === "select") {
65988         surface.call(drawVertices.drawSelected, graph, map2.extent());
65989       }
65990       surface.call(drawVertices, graph, data, filter2, map2.extent(), fullRedraw).call(drawLines, graph, data, filter2).call(drawAreas, graph, data, filter2).call(drawMidpoints, graph, data, filter2, map2.trimmedExtent()).call(drawLabels, graph, data, filter2, _dimensions, fullRedraw).call(drawPoints, graph, data, filter2);
65991       dispatch14.call("drawn", this, { full: true });
65992     }
65993     map2.init = function() {
65994       drawLayers = svgLayers(projection2, context);
65995       drawPoints = svgPoints(projection2, context);
65996       drawVertices = svgVertices(projection2, context);
65997       drawLines = svgLines(projection2, context);
65998       drawAreas = svgAreas(projection2, context);
65999       drawMidpoints = svgMidpoints(projection2, context);
66000       drawLabels = svgLabels(projection2, context);
66001     };
66002     function editOff() {
66003       context.features().resetStats();
66004       surface.selectAll(".layer-osm *").remove();
66005       surface.selectAll(".layer-touch:not(.markers) *").remove();
66006       var allowed = {
66007         "browse": true,
66008         "save": true,
66009         "select-note": true,
66010         "select-data": true,
66011         "select-error": true
66012       };
66013       var mode = context.mode();
66014       if (mode && !allowed[mode.id]) {
66015         context.enter(modeBrowse(context));
66016       }
66017       dispatch14.call("drawn", this, { full: true });
66018     }
66019     function gestureChange(d3_event) {
66020       var e3 = d3_event;
66021       e3.preventDefault();
66022       var props = {
66023         deltaMode: 0,
66024         // dummy values to ignore in zoomPan
66025         deltaY: 1,
66026         // dummy values to ignore in zoomPan
66027         clientX: e3.clientX,
66028         clientY: e3.clientY,
66029         screenX: e3.screenX,
66030         screenY: e3.screenY,
66031         x: e3.x,
66032         y: e3.y
66033       };
66034       var e22 = new WheelEvent("wheel", props);
66035       e22._scale = e3.scale;
66036       e22._rotation = e3.rotation;
66037       _selection.node().dispatchEvent(e22);
66038     }
66039     function zoomPan2(event, key, transform2) {
66040       var source = event && event.sourceEvent || event;
66041       var eventTransform = transform2 || event && event.transform;
66042       var x2 = eventTransform.x;
66043       var y2 = eventTransform.y;
66044       var k2 = eventTransform.k;
66045       if (source && source.type === "wheel") {
66046         if (_pointerDown) return;
66047         var detected = utilDetect();
66048         var dX = source.deltaX;
66049         var dY = source.deltaY;
66050         var x22 = x2;
66051         var y22 = y2;
66052         var k22 = k2;
66053         var t02, p02, p1;
66054         if (source.deltaMode === 1) {
66055           var lines = Math.abs(source.deltaY);
66056           var sign2 = source.deltaY > 0 ? 1 : -1;
66057           dY = sign2 * clamp2(
66058             lines * 18.001,
66059             4.000244140625,
66060             // min
66061             350.000244140625
66062             // max
66063           );
66064           t02 = _isTransformed ? _transformLast : _transformStart;
66065           p02 = _getMouseCoords(source);
66066           p1 = t02.invert(p02);
66067           k22 = t02.k * Math.pow(2, -dY / 500);
66068           k22 = clamp2(k22, kMin, kMax);
66069           x22 = p02[0] - p1[0] * k22;
66070           y22 = p02[1] - p1[1] * k22;
66071         } else if (source._scale) {
66072           t02 = _gestureTransformStart;
66073           p02 = _getMouseCoords(source);
66074           p1 = t02.invert(p02);
66075           k22 = t02.k * source._scale;
66076           k22 = clamp2(k22, kMin, kMax);
66077           x22 = p02[0] - p1[0] * k22;
66078           y22 = p02[1] - p1[1] * k22;
66079         } else if (source.ctrlKey && !isInteger(dY)) {
66080           dY *= 6;
66081           t02 = _isTransformed ? _transformLast : _transformStart;
66082           p02 = _getMouseCoords(source);
66083           p1 = t02.invert(p02);
66084           k22 = t02.k * Math.pow(2, -dY / 500);
66085           k22 = clamp2(k22, kMin, kMax);
66086           x22 = p02[0] - p1[0] * k22;
66087           y22 = p02[1] - p1[1] * k22;
66088         } else if ((source.altKey || source.shiftKey) && isInteger(dY)) {
66089           t02 = _isTransformed ? _transformLast : _transformStart;
66090           p02 = _getMouseCoords(source);
66091           p1 = t02.invert(p02);
66092           k22 = t02.k * Math.pow(2, -dY / 500);
66093           k22 = clamp2(k22, kMin, kMax);
66094           x22 = p02[0] - p1[0] * k22;
66095           y22 = p02[1] - p1[1] * k22;
66096         } else if (detected.os === "mac" && detected.browser !== "Firefox" && !source.ctrlKey && isInteger(dX) && isInteger(dY)) {
66097           p1 = projection2.translate();
66098           x22 = p1[0] - dX;
66099           y22 = p1[1] - dY;
66100           k22 = projection2.scale();
66101           k22 = clamp2(k22, kMin, kMax);
66102         }
66103         if (x22 !== x2 || y22 !== y2 || k22 !== k2) {
66104           x2 = x22;
66105           y2 = y22;
66106           k2 = k22;
66107           eventTransform = identity2.translate(x22, y22).scale(k22);
66108           if (_zoomerPanner._transform) {
66109             _zoomerPanner._transform(eventTransform);
66110           } else {
66111             _selection.node().__zoom = eventTransform;
66112           }
66113         }
66114       }
66115       if (_transformStart.x === x2 && _transformStart.y === y2 && _transformStart.k === k2) {
66116         return;
66117       }
66118       if (geoScaleToZoom(k2, TILESIZE) < _minzoom) {
66119         surface.interrupt();
66120         dispatch14.call("hitMinZoom", this, map2);
66121         setCenterZoom(map2.center(), context.minEditableZoom(), 0, true);
66122         scheduleRedraw();
66123         dispatch14.call("move", this, map2);
66124         return;
66125       }
66126       projection2.transform(eventTransform);
66127       var withinEditableZoom = map2.withinEditableZoom();
66128       if (_lastWithinEditableZoom !== withinEditableZoom) {
66129         if (_lastWithinEditableZoom !== void 0) {
66130           dispatch14.call("crossEditableZoom", this, withinEditableZoom);
66131         }
66132         _lastWithinEditableZoom = withinEditableZoom;
66133       }
66134       var scale = k2 / _transformStart.k;
66135       var tX = (x2 / scale - _transformStart.x) * scale;
66136       var tY = (y2 / scale - _transformStart.y) * scale;
66137       if (context.inIntro()) {
66138         curtainProjection.transform({
66139           x: x2 - tX,
66140           y: y2 - tY,
66141           k: k2
66142         });
66143       }
66144       if (source) {
66145         _lastPointerEvent = event;
66146       }
66147       _isTransformed = true;
66148       _transformLast = eventTransform;
66149       utilSetTransform(supersurface, tX, tY, scale);
66150       scheduleRedraw();
66151       dispatch14.call("move", this, map2);
66152       function isInteger(val) {
66153         return typeof val === "number" && isFinite(val) && Math.floor(val) === val;
66154       }
66155     }
66156     function resetTransform() {
66157       if (!_isTransformed) return false;
66158       utilSetTransform(supersurface, 0, 0);
66159       _isTransformed = false;
66160       if (context.inIntro()) {
66161         curtainProjection.transform(projection2.transform());
66162       }
66163       return true;
66164     }
66165     function redraw(difference2, extent) {
66166       if (typeof window === "undefined") return;
66167       if (surface.empty() || !_redrawEnabled) return;
66168       if (resetTransform()) {
66169         difference2 = extent = void 0;
66170       }
66171       var zoom = map2.zoom();
66172       var z2 = String(~~zoom);
66173       if (surface.attr("data-zoom") !== z2) {
66174         surface.attr("data-zoom", z2);
66175       }
66176       var lat = map2.center()[1];
66177       var lowzoom = linear3().domain([-60, 0, 60]).range([17, 18.5, 17]).clamp(true);
66178       surface.classed("low-zoom", zoom <= lowzoom(lat));
66179       if (!difference2) {
66180         supersurface.call(context.background());
66181         wrapper.call(drawLayers);
66182       }
66183       if (map2.editableDataEnabled() || map2.isInWideSelection()) {
66184         context.loadTiles(projection2);
66185         drawEditable(difference2, extent);
66186       } else {
66187         editOff();
66188       }
66189       _transformStart = projection2.transform();
66190       return map2;
66191     }
66192     var immediateRedraw = function(difference2, extent) {
66193       if (!difference2 && !extent) cancelPendingRedraw();
66194       redraw(difference2, extent);
66195     };
66196     map2.lastPointerEvent = function() {
66197       return _lastPointerEvent;
66198     };
66199     map2.mouse = function(d3_event) {
66200       var event = d3_event || _lastPointerEvent;
66201       if (event) {
66202         var s2;
66203         while (s2 = event.sourceEvent) {
66204           event = s2;
66205         }
66206         return _getMouseCoords(event);
66207       }
66208       return null;
66209     };
66210     map2.mouseCoordinates = function() {
66211       var coord2 = map2.mouse() || pxCenter();
66212       return projection2.invert(coord2);
66213     };
66214     map2.dblclickZoomEnable = function(val) {
66215       if (!arguments.length) return _dblClickZoomEnabled;
66216       _dblClickZoomEnabled = val;
66217       return map2;
66218     };
66219     map2.redrawEnable = function(val) {
66220       if (!arguments.length) return _redrawEnabled;
66221       _redrawEnabled = val;
66222       return map2;
66223     };
66224     map2.isTransformed = function() {
66225       return _isTransformed;
66226     };
66227     function setTransform(t2, duration, force) {
66228       var t3 = projection2.transform();
66229       if (!force && t2.k === t3.k && t2.x === t3.x && t2.y === t3.y) return false;
66230       if (duration) {
66231         _selection.transition().duration(duration).on("start", function() {
66232           map2.startEase();
66233         }).call(_zoomerPanner.transform, identity2.translate(t2.x, t2.y).scale(t2.k));
66234       } else {
66235         projection2.transform(t2);
66236         _transformStart = t2;
66237         _selection.call(_zoomerPanner.transform, _transformStart);
66238       }
66239       return true;
66240     }
66241     function setCenterZoom(loc2, z2, duration, force) {
66242       var c2 = map2.center();
66243       var z3 = map2.zoom();
66244       if (loc2[0] === c2[0] && loc2[1] === c2[1] && z2 === z3 && !force) return false;
66245       var proj = geoRawMercator().transform(projection2.transform());
66246       var k2 = clamp2(geoZoomToScale(z2, TILESIZE), kMin, kMax);
66247       proj.scale(k2);
66248       var t2 = proj.translate();
66249       var point = proj(loc2);
66250       var center = pxCenter();
66251       t2[0] += center[0] - point[0];
66252       t2[1] += center[1] - point[1];
66253       return setTransform(identity2.translate(t2[0], t2[1]).scale(k2), duration, force);
66254     }
66255     map2.pan = function(delta, duration) {
66256       var t2 = projection2.translate();
66257       var k2 = projection2.scale();
66258       t2[0] += delta[0];
66259       t2[1] += delta[1];
66260       if (duration) {
66261         _selection.transition().duration(duration).on("start", function() {
66262           map2.startEase();
66263         }).call(_zoomerPanner.transform, identity2.translate(t2[0], t2[1]).scale(k2));
66264       } else {
66265         projection2.translate(t2);
66266         _transformStart = projection2.transform();
66267         _selection.call(_zoomerPanner.transform, _transformStart);
66268         dispatch14.call("move", this, map2);
66269         immediateRedraw();
66270       }
66271       return map2;
66272     };
66273     map2.dimensions = function(val) {
66274       if (!arguments.length) return _dimensions;
66275       _dimensions = val;
66276       drawLayers.dimensions(_dimensions);
66277       context.background().dimensions(_dimensions);
66278       projection2.clipExtent([[0, 0], _dimensions]);
66279       _getMouseCoords = utilFastMouse(supersurface.node());
66280       scheduleRedraw();
66281       return map2;
66282     };
66283     function zoomIn(delta) {
66284       setCenterZoom(map2.center(), ~~map2.zoom() + delta, 250, true);
66285     }
66286     function zoomOut(delta) {
66287       setCenterZoom(map2.center(), ~~map2.zoom() - delta, 250, true);
66288     }
66289     map2.zoomIn = function() {
66290       zoomIn(1);
66291     };
66292     map2.zoomInFurther = function() {
66293       zoomIn(4);
66294     };
66295     map2.canZoomIn = function() {
66296       return map2.zoom() < maxZoom;
66297     };
66298     map2.zoomOut = function() {
66299       zoomOut(1);
66300     };
66301     map2.zoomOutFurther = function() {
66302       zoomOut(4);
66303     };
66304     map2.canZoomOut = function() {
66305       return map2.zoom() > minZoom2;
66306     };
66307     map2.center = function(loc2) {
66308       if (!arguments.length) {
66309         return projection2.invert(pxCenter());
66310       }
66311       if (setCenterZoom(loc2, map2.zoom())) {
66312         dispatch14.call("move", this, map2);
66313       }
66314       scheduleRedraw();
66315       return map2;
66316     };
66317     map2.unobscuredCenterZoomEase = function(loc, zoom) {
66318       var offset = map2.unobscuredOffsetPx();
66319       var proj = geoRawMercator().transform(projection2.transform());
66320       proj.scale(geoZoomToScale(zoom, TILESIZE));
66321       var locPx = proj(loc);
66322       var offsetLocPx = [locPx[0] + offset[0], locPx[1] + offset[1]];
66323       var offsetLoc = proj.invert(offsetLocPx);
66324       map2.centerZoomEase(offsetLoc, zoom);
66325     };
66326     map2.unobscuredOffsetPx = function() {
66327       var openPane = context.container().select(".map-panes .map-pane.shown");
66328       if (!openPane.empty()) {
66329         return [openPane.node().offsetWidth / 2, 0];
66330       }
66331       return [0, 0];
66332     };
66333     map2.zoom = function(z2) {
66334       if (!arguments.length) {
66335         return Math.max(geoScaleToZoom(projection2.scale(), TILESIZE), 0);
66336       }
66337       if (z2 < _minzoom) {
66338         surface.interrupt();
66339         dispatch14.call("hitMinZoom", this, map2);
66340         z2 = context.minEditableZoom();
66341       }
66342       if (setCenterZoom(map2.center(), z2)) {
66343         dispatch14.call("move", this, map2);
66344       }
66345       scheduleRedraw();
66346       return map2;
66347     };
66348     map2.centerZoom = function(loc2, z2) {
66349       if (setCenterZoom(loc2, z2)) {
66350         dispatch14.call("move", this, map2);
66351       }
66352       scheduleRedraw();
66353       return map2;
66354     };
66355     map2.zoomTo = function(entities) {
66356       if (!isArray_default(entities)) {
66357         entities = [entities];
66358       }
66359       if (entities.length === 0) return map2;
66360       var extent = entities.map((entity) => entity.extent(context.graph())).reduce((a2, b2) => a2.extend(b2));
66361       if (!isFinite(extent.area())) return map2;
66362       var z2 = clamp2(map2.trimmedExtentZoom(extent), 0, 20);
66363       return map2.centerZoom(extent.center(), z2);
66364     };
66365     map2.centerEase = function(loc2, duration) {
66366       duration = duration || 250;
66367       setCenterZoom(loc2, map2.zoom(), duration);
66368       return map2;
66369     };
66370     map2.zoomEase = function(z2, duration) {
66371       duration = duration || 250;
66372       setCenterZoom(map2.center(), z2, duration, false);
66373       return map2;
66374     };
66375     map2.centerZoomEase = function(loc2, z2, duration) {
66376       duration = duration || 250;
66377       setCenterZoom(loc2, z2, duration, false);
66378       return map2;
66379     };
66380     map2.transformEase = function(t2, duration) {
66381       duration = duration || 250;
66382       setTransform(
66383         t2,
66384         duration,
66385         false
66386         /* don't force */
66387       );
66388       return map2;
66389     };
66390     map2.zoomToEase = function(obj, duration) {
66391       var extent;
66392       if (Array.isArray(obj)) {
66393         obj.forEach(function(entity) {
66394           var entityExtent = entity.extent(context.graph());
66395           if (!extent) {
66396             extent = entityExtent;
66397           } else {
66398             extent = extent.extend(entityExtent);
66399           }
66400         });
66401       } else {
66402         extent = obj.extent(context.graph());
66403       }
66404       if (!isFinite(extent.area())) return map2;
66405       var z2 = clamp2(map2.trimmedExtentZoom(extent), 0, 20);
66406       return map2.centerZoomEase(extent.center(), z2, duration);
66407     };
66408     map2.startEase = function() {
66409       utilBindOnce(surface, _pointerPrefix + "down.ease", function() {
66410         map2.cancelEase();
66411       });
66412       return map2;
66413     };
66414     map2.cancelEase = function() {
66415       _selection.interrupt();
66416       return map2;
66417     };
66418     map2.extent = function(val) {
66419       if (!arguments.length) {
66420         return new geoExtent(
66421           projection2.invert([0, _dimensions[1]]),
66422           projection2.invert([_dimensions[0], 0])
66423         );
66424       } else {
66425         var extent = geoExtent(val);
66426         map2.centerZoom(extent.center(), map2.extentZoom(extent));
66427       }
66428     };
66429     map2.trimmedExtent = function(val) {
66430       if (!arguments.length) {
66431         var headerY = 71;
66432         var footerY = 30;
66433         var pad3 = 10;
66434         return new geoExtent(
66435           projection2.invert([pad3, _dimensions[1] - footerY - pad3]),
66436           projection2.invert([_dimensions[0] - pad3, headerY + pad3])
66437         );
66438       } else {
66439         var extent = geoExtent(val);
66440         map2.centerZoom(extent.center(), map2.trimmedExtentZoom(extent));
66441       }
66442     };
66443     function calcExtentZoom(extent, dim) {
66444       var tl = projection2([extent[0][0], extent[1][1]]);
66445       var br2 = projection2([extent[1][0], extent[0][1]]);
66446       var hFactor = (br2[0] - tl[0]) / dim[0];
66447       var vFactor = (br2[1] - tl[1]) / dim[1];
66448       var hZoomDiff = Math.log(Math.abs(hFactor)) / Math.LN2;
66449       var vZoomDiff = Math.log(Math.abs(vFactor)) / Math.LN2;
66450       var newZoom = map2.zoom() - Math.max(hZoomDiff, vZoomDiff);
66451       return newZoom;
66452     }
66453     map2.extentZoom = function(val) {
66454       return calcExtentZoom(geoExtent(val), _dimensions);
66455     };
66456     map2.trimmedExtentZoom = function(val) {
66457       var trimY = 120;
66458       var trimX = 40;
66459       var trimmed = [_dimensions[0] - trimX, _dimensions[1] - trimY];
66460       return calcExtentZoom(geoExtent(val), trimmed);
66461     };
66462     map2.withinEditableZoom = function() {
66463       return map2.zoom() >= context.minEditableZoom();
66464     };
66465     map2.isInWideSelection = function() {
66466       return !map2.withinEditableZoom() && context.selectedIDs().length;
66467     };
66468     map2.editableDataEnabled = function(skipZoomCheck) {
66469       var layer = context.layers().layer("osm");
66470       if (!layer || !layer.enabled()) return false;
66471       return skipZoomCheck || map2.withinEditableZoom();
66472     };
66473     map2.notesEditable = function() {
66474       var layer = context.layers().layer("notes");
66475       if (!layer || !layer.enabled()) return false;
66476       return map2.withinEditableZoom();
66477     };
66478     map2.minzoom = function(val) {
66479       if (!arguments.length) return _minzoom;
66480       _minzoom = val;
66481       return map2;
66482     };
66483     map2.toggleHighlightEdited = function() {
66484       surface.classed("highlight-edited", !surface.classed("highlight-edited"));
66485       map2.pan([0, 0]);
66486       dispatch14.call("changeHighlighting", this);
66487     };
66488     map2.areaFillOptions = ["wireframe", "partial", "full"];
66489     map2.activeAreaFill = function(val) {
66490       if (!arguments.length) return corePreferences("area-fill") || "partial";
66491       corePreferences("area-fill", val);
66492       if (val !== "wireframe") {
66493         corePreferences("area-fill-toggle", val);
66494       }
66495       updateAreaFill();
66496       map2.pan([0, 0]);
66497       dispatch14.call("changeAreaFill", this);
66498       return map2;
66499     };
66500     map2.toggleWireframe = function() {
66501       var activeFill = map2.activeAreaFill();
66502       if (activeFill === "wireframe") {
66503         activeFill = corePreferences("area-fill-toggle") || "partial";
66504       } else {
66505         activeFill = "wireframe";
66506       }
66507       map2.activeAreaFill(activeFill);
66508     };
66509     function updateAreaFill() {
66510       var activeFill = map2.activeAreaFill();
66511       map2.areaFillOptions.forEach(function(opt) {
66512         surface.classed("fill-" + opt, Boolean(opt === activeFill));
66513       });
66514     }
66515     map2.layers = () => drawLayers;
66516     map2.doubleUpHandler = function() {
66517       return _doubleUpHandler;
66518     };
66519     return utilRebind(map2, dispatch14, "on");
66520   }
66521   var TILESIZE, minZoom2, maxZoom, kMin, kMax;
66522   var init_map = __esm({
66523     "modules/renderer/map.js"() {
66524       "use strict";
66525       init_throttle();
66526       init_src4();
66527       init_src8();
66528       init_src16();
66529       init_src5();
66530       init_src12();
66531       init_preferences();
66532       init_geo2();
66533       init_browse();
66534       init_svg();
66535       init_util2();
66536       init_bind_once();
66537       init_detect();
66538       init_dimensions();
66539       init_rebind();
66540       init_zoom_pan();
66541       init_double_up();
66542       init_lodash();
66543       TILESIZE = 256;
66544       minZoom2 = 2;
66545       maxZoom = 24;
66546       kMin = geoZoomToScale(minZoom2, TILESIZE);
66547       kMax = geoZoomToScale(maxZoom, TILESIZE);
66548     }
66549   });
66550
66551   // modules/renderer/photos.js
66552   var photos_exports = {};
66553   __export(photos_exports, {
66554     rendererPhotos: () => rendererPhotos
66555   });
66556   function rendererPhotos(context) {
66557     var dispatch14 = dispatch_default("change");
66558     var _layerIDs = ["streetside", "mapillary", "mapillary-map-features", "mapillary-signs", "kartaview", "mapilio", "vegbilder", "panoramax"];
66559     var _allPhotoTypes = ["flat", "panoramic"];
66560     var _shownPhotoTypes = _allPhotoTypes.slice();
66561     var _dateFilters = ["fromDate", "toDate"];
66562     var _fromDate;
66563     var _toDate;
66564     var _usernames;
66565     function photos() {
66566     }
66567     function updateStorage() {
66568       if (window.mocha) return;
66569       var hash2 = utilStringQs(window.location.hash);
66570       var enabled = context.layers().all().filter(function(d2) {
66571         return _layerIDs.indexOf(d2.id) !== -1 && d2.layer && d2.layer.supported() && d2.layer.enabled();
66572       }).map(function(d2) {
66573         return d2.id;
66574       });
66575       if (enabled.length) {
66576         hash2.photo_overlay = enabled.join(",");
66577       } else {
66578         delete hash2.photo_overlay;
66579       }
66580       window.location.replace("#" + utilQsString(hash2, true));
66581     }
66582     photos.overlayLayerIDs = function() {
66583       return _layerIDs;
66584     };
66585     photos.allPhotoTypes = function() {
66586       return _allPhotoTypes;
66587     };
66588     photos.dateFilters = function() {
66589       return _dateFilters;
66590     };
66591     photos.dateFilterValue = function(val) {
66592       return val === _dateFilters[0] ? _fromDate : _toDate;
66593     };
66594     photos.setDateFilter = function(type2, val, updateUrl) {
66595       var date = val && new Date(val);
66596       if (date && !isNaN(date)) {
66597         val = date.toISOString().slice(0, 10);
66598       } else {
66599         val = null;
66600       }
66601       if (type2 === _dateFilters[0]) {
66602         _fromDate = val;
66603         if (_fromDate && _toDate && new Date(_toDate) < new Date(_fromDate)) {
66604           _toDate = _fromDate;
66605         }
66606       }
66607       if (type2 === _dateFilters[1]) {
66608         _toDate = val;
66609         if (_fromDate && _toDate && new Date(_toDate) < new Date(_fromDate)) {
66610           _fromDate = _toDate;
66611         }
66612       }
66613       dispatch14.call("change", this);
66614       if (updateUrl) {
66615         var rangeString;
66616         if (_fromDate || _toDate) {
66617           rangeString = (_fromDate || "") + "_" + (_toDate || "");
66618         }
66619         setUrlFilterValue("photo_dates", rangeString);
66620       }
66621     };
66622     photos.setUsernameFilter = function(val, updateUrl) {
66623       if (val && typeof val === "string") val = val.replace(/;/g, ",").split(",");
66624       if (val) {
66625         val = val.map((d2) => d2.trim()).filter(Boolean);
66626         if (!val.length) {
66627           val = null;
66628         }
66629       }
66630       _usernames = val;
66631       dispatch14.call("change", this);
66632       if (updateUrl) {
66633         var hashString;
66634         if (_usernames) {
66635           hashString = _usernames.join(",");
66636         }
66637         setUrlFilterValue("photo_username", hashString);
66638       }
66639     };
66640     photos.togglePhotoType = function(val, updateUrl) {
66641       var index = _shownPhotoTypes.indexOf(val);
66642       if (index !== -1) {
66643         _shownPhotoTypes.splice(index, 1);
66644       } else {
66645         _shownPhotoTypes.push(val);
66646       }
66647       if (updateUrl) {
66648         var hashString;
66649         if (_shownPhotoTypes) {
66650           hashString = _shownPhotoTypes.join(",");
66651         }
66652         setUrlFilterValue("photo_type", hashString);
66653       }
66654       dispatch14.call("change", this);
66655       return photos;
66656     };
66657     function setUrlFilterValue(property, val) {
66658       if (!window.mocha) {
66659         var hash2 = utilStringQs(window.location.hash);
66660         if (val) {
66661           if (hash2[property] === val) return;
66662           hash2[property] = val;
66663         } else {
66664           if (!(property in hash2)) return;
66665           delete hash2[property];
66666         }
66667         window.location.replace("#" + utilQsString(hash2, true));
66668       }
66669     }
66670     function showsLayer(id2) {
66671       var layer = context.layers().layer(id2);
66672       return layer && layer.supported() && layer.enabled();
66673     }
66674     photos.shouldFilterDateBySlider = function() {
66675       return showsLayer("mapillary") || showsLayer("kartaview") || showsLayer("mapilio") || showsLayer("streetside") || showsLayer("vegbilder") || showsLayer("panoramax");
66676     };
66677     photos.shouldFilterByPhotoType = function() {
66678       return showsLayer("mapillary") || showsLayer("streetside") && showsLayer("kartaview") || showsLayer("vegbilder") || showsLayer("panoramax");
66679     };
66680     photos.shouldFilterByUsername = function() {
66681       return !showsLayer("mapillary") && showsLayer("kartaview") && !showsLayer("streetside") || showsLayer("panoramax");
66682     };
66683     photos.showsPhotoType = function(val) {
66684       if (!photos.shouldFilterByPhotoType()) return true;
66685       return _shownPhotoTypes.indexOf(val) !== -1;
66686     };
66687     photos.showsFlat = function() {
66688       return photos.showsPhotoType("flat");
66689     };
66690     photos.showsPanoramic = function() {
66691       return photos.showsPhotoType("panoramic");
66692     };
66693     photos.fromDate = function() {
66694       return _fromDate;
66695     };
66696     photos.toDate = function() {
66697       return _toDate;
66698     };
66699     photos.usernames = function() {
66700       return _usernames;
66701     };
66702     photos.init = function() {
66703       var hash2 = utilStringQs(window.location.hash);
66704       var parts;
66705       if (hash2.photo_dates) {
66706         parts = /^(.*)[–_](.*)$/g.exec(hash2.photo_dates.trim());
66707         this.setDateFilter("fromDate", parts && parts.length >= 2 && parts[1], false);
66708         this.setDateFilter("toDate", parts && parts.length >= 3 && parts[2], false);
66709       }
66710       if (hash2.photo_username) {
66711         this.setUsernameFilter(hash2.photo_username, false);
66712       }
66713       if (hash2.photo_type) {
66714         parts = hash2.photo_type.replace(/;/g, ",").split(",");
66715         _allPhotoTypes.forEach((d2) => {
66716           if (!parts.includes(d2)) this.togglePhotoType(d2, false);
66717         });
66718       }
66719       if (hash2.photo_overlay) {
66720         var hashOverlayIDs = hash2.photo_overlay.replace(/;/g, ",").split(",");
66721         hashOverlayIDs.forEach(function(id2) {
66722           if (id2 === "openstreetcam") id2 = "kartaview";
66723           var layer2 = _layerIDs.indexOf(id2) !== -1 && context.layers().layer(id2);
66724           if (layer2 && !layer2.enabled()) layer2.enabled(true);
66725         });
66726       }
66727       if (hash2.photo) {
66728         var photoIds = hash2.photo.replace(/;/g, ",").split(",");
66729         var photoId = photoIds.length && photoIds[0].trim();
66730         var results = /(.*)\/(.*)/g.exec(photoId);
66731         if (results && results.length >= 3) {
66732           var serviceId = results[1];
66733           if (serviceId === "openstreetcam") serviceId = "kartaview";
66734           var photoKey = results[2];
66735           var service = services[serviceId];
66736           if (service && service.ensureViewerLoaded) {
66737             var layer = _layerIDs.indexOf(serviceId) !== -1 && context.layers().layer(serviceId);
66738             if (layer && !layer.enabled()) layer.enabled(true);
66739             var baselineTime = Date.now();
66740             service.on("loadedImages.rendererPhotos", function() {
66741               if (Date.now() - baselineTime > 45e3) {
66742                 service.on("loadedImages.rendererPhotos", null);
66743                 return;
66744               }
66745               if (!service.cachedImage(photoKey)) return;
66746               service.on("loadedImages.rendererPhotos", null);
66747               service.ensureViewerLoaded(context).then(function() {
66748                 service.selectImage(context, photoKey).showViewer(context);
66749               });
66750             });
66751           }
66752         }
66753       }
66754       context.layers().on("change.rendererPhotos", updateStorage);
66755     };
66756     return utilRebind(photos, dispatch14, "on");
66757   }
66758   var init_photos = __esm({
66759     "modules/renderer/photos.js"() {
66760       "use strict";
66761       init_src4();
66762       init_services();
66763       init_rebind();
66764       init_util();
66765     }
66766   });
66767
66768   // modules/renderer/index.js
66769   var renderer_exports = {};
66770   __export(renderer_exports, {
66771     rendererBackground: () => rendererBackground,
66772     rendererBackgroundSource: () => rendererBackgroundSource,
66773     rendererFeatures: () => rendererFeatures,
66774     rendererMap: () => rendererMap,
66775     rendererPhotos: () => rendererPhotos,
66776     rendererTileLayer: () => rendererTileLayer
66777   });
66778   var init_renderer = __esm({
66779     "modules/renderer/index.js"() {
66780       "use strict";
66781       init_background_source();
66782       init_background2();
66783       init_features();
66784       init_map();
66785       init_photos();
66786       init_tile_layer();
66787     }
66788   });
66789
66790   // modules/ui/map_in_map.js
66791   var map_in_map_exports = {};
66792   __export(map_in_map_exports, {
66793     uiMapInMap: () => uiMapInMap
66794   });
66795   function uiMapInMap(context) {
66796     function mapInMap(selection2) {
66797       var backgroundLayer = rendererTileLayer(context).underzoom(2);
66798       var overlayLayers = {};
66799       var projection2 = geoRawMercator();
66800       var dataLayer = svgData(projection2, context).showLabels(false);
66801       var debugLayer = svgDebug(projection2, context);
66802       var zoom = zoom_default2().scaleExtent([geoZoomToScale(0.5), geoZoomToScale(24)]).on("start", zoomStarted).on("zoom", zoomed).on("end", zoomEnded);
66803       var wrap2 = select_default2(null);
66804       var tiles = select_default2(null);
66805       var viewport = select_default2(null);
66806       var _isTransformed = false;
66807       var _isHidden = true;
66808       var _skipEvents = false;
66809       var _gesture = null;
66810       var _zDiff = 6;
66811       var _dMini;
66812       var _cMini;
66813       var _tStart;
66814       var _tCurr;
66815       var _timeoutID;
66816       function zoomStarted() {
66817         if (_skipEvents) return;
66818         _tStart = _tCurr = projection2.transform();
66819         _gesture = null;
66820       }
66821       function zoomed(d3_event) {
66822         if (_skipEvents) return;
66823         var x2 = d3_event.transform.x;
66824         var y2 = d3_event.transform.y;
66825         var k2 = d3_event.transform.k;
66826         var isZooming = k2 !== _tStart.k;
66827         var isPanning = x2 !== _tStart.x || y2 !== _tStart.y;
66828         if (!isZooming && !isPanning) {
66829           return;
66830         }
66831         if (!_gesture) {
66832           _gesture = isZooming ? "zoom" : "pan";
66833         }
66834         var tMini = projection2.transform();
66835         var tX, tY, scale;
66836         if (_gesture === "zoom") {
66837           scale = k2 / tMini.k;
66838           tX = (_cMini[0] / scale - _cMini[0]) * scale;
66839           tY = (_cMini[1] / scale - _cMini[1]) * scale;
66840         } else {
66841           k2 = tMini.k;
66842           scale = 1;
66843           tX = x2 - tMini.x;
66844           tY = y2 - tMini.y;
66845         }
66846         utilSetTransform(tiles, tX, tY, scale);
66847         utilSetTransform(viewport, 0, 0, scale);
66848         _isTransformed = true;
66849         _tCurr = identity2.translate(x2, y2).scale(k2);
66850         var zMain = geoScaleToZoom(context.projection.scale());
66851         var zMini = geoScaleToZoom(k2);
66852         _zDiff = zMain - zMini;
66853         queueRedraw();
66854       }
66855       function zoomEnded() {
66856         if (_skipEvents) return;
66857         if (_gesture !== "pan") return;
66858         updateProjection();
66859         _gesture = null;
66860         context.map().center(projection2.invert(_cMini));
66861       }
66862       function updateProjection() {
66863         var loc = context.map().center();
66864         var tMain = context.projection.transform();
66865         var zMain = geoScaleToZoom(tMain.k);
66866         var zMini = Math.max(zMain - _zDiff, 0.5);
66867         var kMini = geoZoomToScale(zMini);
66868         projection2.translate([tMain.x, tMain.y]).scale(kMini);
66869         var point = projection2(loc);
66870         var mouse = _gesture === "pan" ? geoVecSubtract([_tCurr.x, _tCurr.y], [_tStart.x, _tStart.y]) : [0, 0];
66871         var xMini = _cMini[0] - point[0] + tMain.x + mouse[0];
66872         var yMini = _cMini[1] - point[1] + tMain.y + mouse[1];
66873         projection2.translate([xMini, yMini]).clipExtent([[0, 0], _dMini]);
66874         _tCurr = projection2.transform();
66875         if (_isTransformed) {
66876           utilSetTransform(tiles, 0, 0);
66877           utilSetTransform(viewport, 0, 0);
66878           _isTransformed = false;
66879         }
66880         zoom.scaleExtent([geoZoomToScale(0.5), geoZoomToScale(zMain - 3)]);
66881         _skipEvents = true;
66882         wrap2.call(zoom.transform, _tCurr);
66883         _skipEvents = false;
66884       }
66885       function redraw() {
66886         clearTimeout(_timeoutID);
66887         if (_isHidden) return;
66888         updateProjection();
66889         var zMini = geoScaleToZoom(projection2.scale());
66890         tiles = wrap2.selectAll(".map-in-map-tiles").data([0]);
66891         tiles = tiles.enter().append("div").attr("class", "map-in-map-tiles").merge(tiles);
66892         backgroundLayer.source(context.background().baseLayerSource()).projection(projection2).dimensions(_dMini);
66893         var background = tiles.selectAll(".map-in-map-background").data([0]);
66894         background.enter().append("div").attr("class", "map-in-map-background").merge(background).call(backgroundLayer);
66895         var overlaySources = context.background().overlayLayerSources();
66896         var activeOverlayLayers = [];
66897         for (var i3 = 0; i3 < overlaySources.length; i3++) {
66898           if (overlaySources[i3].validZoom(zMini)) {
66899             if (!overlayLayers[i3]) overlayLayers[i3] = rendererTileLayer(context);
66900             activeOverlayLayers.push(overlayLayers[i3].source(overlaySources[i3]).projection(projection2).dimensions(_dMini));
66901           }
66902         }
66903         var overlay = tiles.selectAll(".map-in-map-overlay").data([0]);
66904         overlay = overlay.enter().append("div").attr("class", "map-in-map-overlay").merge(overlay);
66905         var overlays = overlay.selectAll("div").data(activeOverlayLayers, function(d2) {
66906           return d2.source().name();
66907         });
66908         overlays.exit().remove();
66909         overlays = overlays.enter().append("div").merge(overlays).each(function(layer) {
66910           select_default2(this).call(layer);
66911         });
66912         var dataLayers = tiles.selectAll(".map-in-map-data").data([0]);
66913         dataLayers.exit().remove();
66914         dataLayers = dataLayers.enter().append("svg").attr("class", "map-in-map-data").merge(dataLayers).call(dataLayer).call(debugLayer);
66915         if (_gesture !== "pan") {
66916           var getPath = path_default(projection2);
66917           var bbox2 = { type: "Polygon", coordinates: [context.map().extent().polygon()] };
66918           viewport = wrap2.selectAll(".map-in-map-viewport").data([0]);
66919           viewport = viewport.enter().append("svg").attr("class", "map-in-map-viewport").merge(viewport);
66920           var path = viewport.selectAll(".map-in-map-bbox").data([bbox2]);
66921           path.enter().append("path").attr("class", "map-in-map-bbox").merge(path).attr("d", getPath).classed("thick", function(d2) {
66922             return getPath.area(d2) < 30;
66923           });
66924         }
66925       }
66926       function queueRedraw() {
66927         clearTimeout(_timeoutID);
66928         _timeoutID = setTimeout(function() {
66929           redraw();
66930         }, 750);
66931       }
66932       function toggle(d3_event) {
66933         if (d3_event) d3_event.preventDefault();
66934         _isHidden = !_isHidden;
66935         context.container().select(".minimap-toggle-item").classed("active", !_isHidden).select("input").property("checked", !_isHidden);
66936         if (_isHidden) {
66937           wrap2.style("display", "block").style("opacity", "1").transition().duration(200).style("opacity", "0").on("end", function() {
66938             selection2.selectAll(".map-in-map").style("display", "none");
66939           });
66940         } else {
66941           wrap2.style("display", "block").style("opacity", "0").transition().duration(200).style("opacity", "1").on("end", function() {
66942             redraw();
66943           });
66944         }
66945       }
66946       uiMapInMap.toggle = toggle;
66947       wrap2 = selection2.selectAll(".map-in-map").data([0]);
66948       wrap2 = wrap2.enter().append("div").attr("class", "map-in-map").style("display", _isHidden ? "none" : "block").call(zoom).on("dblclick.zoom", null).merge(wrap2);
66949       _dMini = [200, 150];
66950       _cMini = geoVecScale(_dMini, 0.5);
66951       context.map().on("drawn.map-in-map", function(drawn) {
66952         if (drawn.full === true) {
66953           redraw();
66954         }
66955       });
66956       redraw();
66957       context.keybinding().on(_t("background.minimap.key"), toggle);
66958     }
66959     return mapInMap;
66960   }
66961   var init_map_in_map = __esm({
66962     "modules/ui/map_in_map.js"() {
66963       "use strict";
66964       init_src2();
66965       init_src5();
66966       init_src12();
66967       init_localizer();
66968       init_geo2();
66969       init_renderer();
66970       init_svg();
66971       init_util();
66972     }
66973   });
66974
66975   // modules/ui/notice.js
66976   var notice_exports = {};
66977   __export(notice_exports, {
66978     uiNotice: () => uiNotice
66979   });
66980   function uiNotice(context) {
66981     return function(selection2) {
66982       var div = selection2.append("div").attr("class", "notice");
66983       var button = div.append("button").attr("class", "zoom-to notice fillD").on("click", function() {
66984         context.map().zoomEase(context.minEditableZoom());
66985       }).on("wheel", function(d3_event) {
66986         var e22 = new WheelEvent(d3_event.type, d3_event);
66987         context.surface().node().dispatchEvent(e22);
66988       });
66989       button.call(svgIcon("#iD-icon-plus", "pre-text")).append("span").attr("class", "label").call(_t.append("zoom_in_edit"));
66990       function disableTooHigh() {
66991         var canEdit = context.map().zoom() >= context.minEditableZoom();
66992         div.style("display", canEdit ? "none" : "block");
66993       }
66994       context.map().on("move.notice", debounce_default(disableTooHigh, 500));
66995       disableTooHigh();
66996     };
66997   }
66998   var init_notice = __esm({
66999     "modules/ui/notice.js"() {
67000       "use strict";
67001       init_debounce();
67002       init_localizer();
67003       init_svg();
67004     }
67005   });
67006
67007   // modules/ui/photoviewer.js
67008   var photoviewer_exports = {};
67009   __export(photoviewer_exports, {
67010     uiPhotoviewer: () => uiPhotoviewer
67011   });
67012   function uiPhotoviewer(context) {
67013     var dispatch14 = dispatch_default("resize");
67014     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
67015     const addPhotoIdButton = /* @__PURE__ */ new Set(["mapillary", "panoramax"]);
67016     function photoviewer(selection2) {
67017       selection2.append("button").attr("class", "thumb-hide").attr("title", _t("icons.close")).on("click", function() {
67018         if (services.streetside) {
67019           services.streetside.hideViewer(context);
67020         }
67021         if (services.mapillary) {
67022           services.mapillary.hideViewer(context);
67023         }
67024         if (services.kartaview) {
67025           services.kartaview.hideViewer(context);
67026         }
67027         if (services.mapilio) {
67028           services.mapilio.hideViewer(context);
67029         }
67030         if (services.panoramax) {
67031           services.panoramax.hideViewer(context);
67032         }
67033         if (services.vegbilder) {
67034           services.vegbilder.hideViewer(context);
67035         }
67036       }).append("div").call(svgIcon("#iD-icon-close"));
67037       function preventDefault(d3_event) {
67038         d3_event.preventDefault();
67039       }
67040       selection2.append("button").attr("class", "resize-handle-xy").on("touchstart touchdown touchend", preventDefault).on(
67041         _pointerPrefix + "down",
67042         buildResizeListener(selection2, "resize", dispatch14, { resizeOnX: true, resizeOnY: true })
67043       );
67044       selection2.append("button").attr("class", "resize-handle-x").on("touchstart touchdown touchend", preventDefault).on(
67045         _pointerPrefix + "down",
67046         buildResizeListener(selection2, "resize", dispatch14, { resizeOnX: true })
67047       );
67048       selection2.append("button").attr("class", "resize-handle-y").on("touchstart touchdown touchend", preventDefault).on(
67049         _pointerPrefix + "down",
67050         buildResizeListener(selection2, "resize", dispatch14, { resizeOnY: true })
67051       );
67052       context.features().on("change.setPhotoFromViewer", function() {
67053         setPhotoTagButton();
67054       });
67055       context.history().on("change.setPhotoFromViewer", function() {
67056         setPhotoTagButton();
67057       });
67058       function setPhotoTagButton() {
67059         const service = getServiceId();
67060         const isActiveForService = addPhotoIdButton.has(service) && services[service].isViewerOpen();
67061         if (isActiveForService) {
67062           let setPhotoId2 = function() {
67063             const activeServiceId = getServiceId();
67064             const image = services[activeServiceId].getActiveImage();
67065             const action = (graph) => context.selectedIDs().reduce((graph2, entityID) => {
67066               const tags = graph2.entity(entityID).tags;
67067               const action2 = actionChangeTags(entityID, { ...tags, [activeServiceId]: image.id });
67068               return action2(graph2);
67069             }, graph);
67070             const annotation = _t("operations.change_tags.annotation");
67071             context.perform(action, annotation);
67072           };
67073           var setPhotoId = setPhotoId2;
67074           if (context.mode().id !== "select" || !layerEnabled(service)) {
67075             buttonRemove();
67076           } else {
67077             if (selection2.select(".set-photo-from-viewer").empty()) {
67078               const button = buttonCreate();
67079               button.on("click", function(e3) {
67080                 e3.preventDefault();
67081                 e3.stopPropagation();
67082                 setPhotoId2();
67083                 buttonDisable("already_set");
67084               });
67085             }
67086             buttonShowHide(service);
67087           }
67088         }
67089         function layerEnabled(which) {
67090           const layers = context.layers();
67091           const layer = layers.layer(which);
67092           return layer.enabled();
67093         }
67094         function getServiceId() {
67095           const hash2 = utilStringQs(window.location.hash);
67096           let serviceId;
67097           if (hash2.photo) {
67098             let result = hash2.photo.split("/");
67099             serviceId = result[0];
67100           }
67101           return serviceId;
67102         }
67103         function buttonCreate() {
67104           const button = selection2.selectAll(".set-photo-from-viewer").data([0]);
67105           const buttonEnter = button.enter().append("button").attr("class", "set-photo-from-viewer").call(svgIcon("#fas-eye-dropper")).call(
67106             uiTooltip().title(() => _t.append("inspector.set_photo_from_viewer.enable")).placement("right")
67107           );
67108           buttonEnter.select(".tooltip").classed("dark", true).style("width", "300px");
67109           if (service === "panoramax") {
67110             const panoramaxControls = selection2.select(".pnlm-zoom-controls.pnlm-controls");
67111             panoramaxControls.style("margin-top", "36px");
67112           }
67113           return buttonEnter;
67114         }
67115         function buttonRemove() {
67116           const button = selection2.selectAll(".set-photo-from-viewer").data([0]);
67117           button.remove();
67118           if (service === "panoramax") {
67119             const panoramaxControls = selection2.select(".pnlm-zoom-controls.pnlm-controls");
67120             panoramaxControls.style("margin-top", "6px");
67121           }
67122         }
67123         function buttonShowHide(tagName) {
67124           const activeImage = services[tagName].getActiveImage();
67125           const graph = context.graph();
67126           const entities = context.selectedIDs().map((id2) => graph.entity(id2));
67127           if (entities.map((entity) => entity.tags[tagName]).every((value) => value === (activeImage == null ? void 0 : activeImage.id))) {
67128             buttonDisable("already_set");
67129           } else if (activeImage && entities.map((entity) => entity.extent(context.graph()).center()).every((loc) => geoSphericalDistance(loc, activeImage.loc) > 100)) {
67130             buttonDisable("too_far");
67131           } else {
67132             buttonDisable(false);
67133           }
67134         }
67135         function buttonDisable(reason) {
67136           const disabled = reason !== false;
67137           const button = selection2.selectAll(".set-photo-from-viewer").data([0]);
67138           button.attr("disabled", disabled ? "true" : null);
67139           button.classed("disabled", disabled);
67140           button.call(uiTooltip().destroyAny);
67141           if (disabled) {
67142             button.call(
67143               uiTooltip().title(() => _t.append(`inspector.set_photo_from_viewer.disable.${reason}`)).placement("right")
67144             );
67145           } else {
67146             button.call(
67147               uiTooltip().title(() => _t.append("inspector.set_photo_from_viewer.enable")).placement("right")
67148             );
67149           }
67150           button.select(".tooltip").classed("dark", true).style("width", "300px");
67151         }
67152       }
67153       function buildResizeListener(target, eventName, dispatch15, options2) {
67154         var resizeOnX = !!options2.resizeOnX;
67155         var resizeOnY = !!options2.resizeOnY;
67156         var minHeight = options2.minHeight || 240;
67157         var minWidth = options2.minWidth || 320;
67158         var pointerId;
67159         var startX;
67160         var startY;
67161         var startWidth;
67162         var startHeight;
67163         function startResize(d3_event) {
67164           if (pointerId !== (d3_event.pointerId || "mouse")) return;
67165           d3_event.preventDefault();
67166           d3_event.stopPropagation();
67167           var mapSize = context.map().dimensions();
67168           if (resizeOnX) {
67169             var mapWidth = mapSize[0];
67170             const viewerMargin = parseInt(select_default2(".photoviewer").style("margin-left"), 10);
67171             var newWidth = clamp3(startWidth + d3_event.clientX - startX, minWidth, mapWidth - viewerMargin * 2);
67172             target.style("width", newWidth + "px");
67173           }
67174           if (resizeOnY) {
67175             const menuHeight = utilGetDimensions(select_default2(".top-toolbar"))[1] + utilGetDimensions(select_default2(".map-footer"))[1];
67176             const viewerMargin = parseInt(select_default2(".photoviewer").style("margin-bottom"), 10);
67177             var maxHeight = mapSize[1] - menuHeight - viewerMargin * 2;
67178             var newHeight = clamp3(startHeight + startY - d3_event.clientY, minHeight, maxHeight);
67179             target.style("height", newHeight + "px");
67180           }
67181           dispatch15.call(eventName, target, subtractPadding(utilGetDimensions(target, true), target));
67182         }
67183         function clamp3(num, min3, max3) {
67184           return Math.max(min3, Math.min(num, max3));
67185         }
67186         function stopResize(d3_event) {
67187           if (pointerId !== (d3_event.pointerId || "mouse")) return;
67188           d3_event.preventDefault();
67189           d3_event.stopPropagation();
67190           select_default2(window).on("." + eventName, null);
67191         }
67192         return function initResize(d3_event) {
67193           d3_event.preventDefault();
67194           d3_event.stopPropagation();
67195           pointerId = d3_event.pointerId || "mouse";
67196           startX = d3_event.clientX;
67197           startY = d3_event.clientY;
67198           var targetRect = target.node().getBoundingClientRect();
67199           startWidth = targetRect.width;
67200           startHeight = targetRect.height;
67201           select_default2(window).on(_pointerPrefix + "move." + eventName, startResize, false).on(_pointerPrefix + "up." + eventName, stopResize, false);
67202           if (_pointerPrefix === "pointer") {
67203             select_default2(window).on("pointercancel." + eventName, stopResize, false);
67204           }
67205         };
67206       }
67207     }
67208     photoviewer.onMapResize = function() {
67209       var photoviewer2 = context.container().select(".photoviewer");
67210       var content = context.container().select(".main-content");
67211       var mapDimensions = utilGetDimensions(content, true);
67212       const menuHeight = utilGetDimensions(select_default2(".top-toolbar"))[1] + utilGetDimensions(select_default2(".map-footer"))[1];
67213       const viewerMargin = parseInt(select_default2(".photoviewer").style("margin-bottom"), 10);
67214       var photoDimensions = utilGetDimensions(photoviewer2, true);
67215       if (photoDimensions[0] > mapDimensions[0] || photoDimensions[1] > mapDimensions[1] - menuHeight - viewerMargin * 2) {
67216         var setPhotoDimensions = [
67217           Math.min(photoDimensions[0], mapDimensions[0]),
67218           Math.min(photoDimensions[1], mapDimensions[1] - menuHeight - viewerMargin * 2)
67219         ];
67220         photoviewer2.style("width", setPhotoDimensions[0] + "px").style("height", setPhotoDimensions[1] + "px");
67221         dispatch14.call("resize", photoviewer2, subtractPadding(setPhotoDimensions, photoviewer2));
67222       }
67223     };
67224     function subtractPadding(dimensions, selection2) {
67225       return [
67226         dimensions[0] - parseFloat(selection2.style("padding-left")) - parseFloat(selection2.style("padding-right")),
67227         dimensions[1] - parseFloat(selection2.style("padding-top")) - parseFloat(selection2.style("padding-bottom"))
67228       ];
67229     }
67230     return utilRebind(photoviewer, dispatch14, "on");
67231   }
67232   var init_photoviewer = __esm({
67233     "modules/ui/photoviewer.js"() {
67234       "use strict";
67235       init_src5();
67236       init_localizer();
67237       init_src4();
67238       init_icon();
67239       init_dimensions();
67240       init_util();
67241       init_services();
67242       init_tooltip();
67243       init_actions();
67244       init_geo2();
67245     }
67246   });
67247
67248   // modules/ui/restore.js
67249   var restore_exports = {};
67250   __export(restore_exports, {
67251     uiRestore: () => uiRestore
67252   });
67253   function uiRestore(context) {
67254     return function(selection2) {
67255       if (!context.history().hasRestorableChanges()) return;
67256       let modalSelection = uiModal(selection2, true);
67257       modalSelection.select(".modal").attr("class", "modal fillL");
67258       let introModal = modalSelection.select(".content");
67259       introModal.append("div").attr("class", "modal-section").append("h3").call(_t.append("restore.heading"));
67260       introModal.append("div").attr("class", "modal-section").append("p").call(_t.append("restore.description"));
67261       let buttonWrap = introModal.append("div").attr("class", "modal-actions");
67262       let restore = buttonWrap.append("button").attr("class", "restore").on("click", () => {
67263         context.history().restore();
67264         modalSelection.remove();
67265       });
67266       restore.append("svg").attr("class", "logo logo-restore").append("use").attr("xlink:href", "#iD-logo-restore");
67267       restore.append("div").call(_t.append("restore.restore"));
67268       let reset = buttonWrap.append("button").attr("class", "reset").on("click", () => {
67269         context.history().clearSaved();
67270         modalSelection.remove();
67271       });
67272       reset.append("svg").attr("class", "logo logo-reset").append("use").attr("xlink:href", "#iD-logo-reset");
67273       reset.append("div").call(_t.append("restore.reset"));
67274       restore.node().focus();
67275     };
67276   }
67277   var init_restore = __esm({
67278     "modules/ui/restore.js"() {
67279       "use strict";
67280       init_localizer();
67281       init_modal();
67282     }
67283   });
67284
67285   // modules/ui/scale.js
67286   var scale_exports2 = {};
67287   __export(scale_exports2, {
67288     uiScale: () => uiScale
67289   });
67290   function uiScale(context) {
67291     var projection2 = context.projection, isImperial = !_mainLocalizer.usesMetric(), maxLength = 180, tickHeight = 8;
67292     function scaleDefs(loc1, loc2) {
67293       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;
67294       if (isImperial) {
67295         buckets = [528e4, 528e3, 52800, 5280, 500, 50, 5, 1];
67296       } else {
67297         buckets = [5e6, 5e5, 5e4, 5e3, 500, 50, 5, 1];
67298       }
67299       for (i3 = 0; i3 < buckets.length; i3++) {
67300         val = buckets[i3];
67301         if (dist >= val) {
67302           scale.dist = Math.floor(dist / val) * val;
67303           break;
67304         } else {
67305           scale.dist = +dist.toFixed(2);
67306         }
67307       }
67308       dLon = geoMetersToLon(scale.dist / conversion, lat);
67309       scale.px = Math.round(projection2([loc1[0] + dLon, loc1[1]])[0]);
67310       scale.text = displayLength(scale.dist / conversion, isImperial);
67311       return scale;
67312     }
67313     function update(selection2) {
67314       var dims = context.map().dimensions(), loc1 = projection2.invert([0, dims[1]]), loc2 = projection2.invert([maxLength, dims[1]]), scale = scaleDefs(loc1, loc2);
67315       selection2.select(".scale-path").attr("d", "M0.5,0.5v" + tickHeight + "h" + scale.px + "v-" + tickHeight);
67316       selection2.select(".scale-text").style(_mainLocalizer.textDirection() === "ltr" ? "left" : "right", scale.px + 16 + "px").text(scale.text);
67317     }
67318     return function(selection2) {
67319       function switchUnits() {
67320         isImperial = !isImperial;
67321         selection2.call(update);
67322       }
67323       var scalegroup = selection2.append("svg").attr("class", "scale").on("click", switchUnits).append("g").attr("transform", "translate(10,11)");
67324       scalegroup.append("path").attr("class", "scale-path");
67325       selection2.append("div").attr("class", "scale-text");
67326       selection2.call(update);
67327       context.map().on("move.scale", function() {
67328         update(selection2);
67329       });
67330     };
67331   }
67332   var init_scale2 = __esm({
67333     "modules/ui/scale.js"() {
67334       "use strict";
67335       init_units();
67336       init_geo2();
67337       init_localizer();
67338     }
67339   });
67340
67341   // modules/ui/shortcuts.js
67342   var shortcuts_exports = {};
67343   __export(shortcuts_exports, {
67344     uiShortcuts: () => uiShortcuts
67345   });
67346   function uiShortcuts(context) {
67347     var detected = utilDetect();
67348     var _activeTab = 0;
67349     var _modalSelection;
67350     var _selection = select_default2(null);
67351     var _dataShortcuts;
67352     function shortcutsModal(_modalSelection2) {
67353       _modalSelection2.select(".modal").classed("modal-shortcuts", true);
67354       var content = _modalSelection2.select(".content");
67355       content.append("div").attr("class", "modal-section header").append("h2").call(_t.append("shortcuts.title"));
67356       _mainFileFetcher.get("shortcuts").then(function(data) {
67357         _dataShortcuts = data;
67358         content.call(render);
67359       }).catch(function() {
67360       });
67361     }
67362     function render(selection2) {
67363       if (!_dataShortcuts) return;
67364       var wrapper = selection2.selectAll(".wrapper").data([0]);
67365       var wrapperEnter = wrapper.enter().append("div").attr("class", "wrapper modal-section");
67366       var tabsBar = wrapperEnter.append("div").attr("class", "tabs-bar");
67367       var shortcutsList = wrapperEnter.append("div").attr("class", "shortcuts-list");
67368       wrapper = wrapper.merge(wrapperEnter);
67369       var tabs = tabsBar.selectAll(".tab").data(_dataShortcuts);
67370       var tabsEnter = tabs.enter().append("a").attr("class", "tab").attr("href", "#").on("click", function(d3_event, d2) {
67371         d3_event.preventDefault();
67372         var i3 = _dataShortcuts.indexOf(d2);
67373         _activeTab = i3;
67374         render(selection2);
67375       });
67376       tabsEnter.append("span").html(function(d2) {
67377         return _t.html(d2.text);
67378       });
67379       wrapper.selectAll(".tab").classed("active", function(d2, i3) {
67380         return i3 === _activeTab;
67381       });
67382       var shortcuts = shortcutsList.selectAll(".shortcut-tab").data(_dataShortcuts);
67383       var shortcutsEnter = shortcuts.enter().append("div").attr("class", function(d2) {
67384         return "shortcut-tab shortcut-tab-" + d2.tab;
67385       });
67386       var columnsEnter = shortcutsEnter.selectAll(".shortcut-column").data(function(d2) {
67387         return d2.columns;
67388       }).enter().append("table").attr("class", "shortcut-column");
67389       var rowsEnter = columnsEnter.selectAll(".shortcut-row").data(function(d2) {
67390         return d2.rows;
67391       }).enter().append("tr").attr("class", "shortcut-row");
67392       var sectionRows = rowsEnter.filter(function(d2) {
67393         return !d2.shortcuts;
67394       });
67395       sectionRows.append("td");
67396       sectionRows.append("td").attr("class", "shortcut-section").append("h3").html(function(d2) {
67397         return _t.html(d2.text);
67398       });
67399       var shortcutRows = rowsEnter.filter(function(d2) {
67400         return d2.shortcuts;
67401       });
67402       var shortcutKeys = shortcutRows.append("td").attr("class", "shortcut-keys");
67403       var modifierKeys = shortcutKeys.filter(function(d2) {
67404         return d2.modifiers;
67405       });
67406       modifierKeys.selectAll("kbd.modifier").data(function(d2) {
67407         if (detected.os === "win" && d2.text === "shortcuts.editing.commands.redo") {
67408           return ["\u2318"];
67409         } else if (detected.os !== "mac" && d2.text === "shortcuts.browsing.display_options.fullscreen") {
67410           return [];
67411         } else {
67412           return d2.modifiers;
67413         }
67414       }).enter().each(function() {
67415         var selection3 = select_default2(this);
67416         selection3.append("kbd").attr("class", "modifier").text(function(d2) {
67417           return uiCmd.display(d2);
67418         });
67419         selection3.append("span").text("+");
67420       });
67421       shortcutKeys.selectAll("kbd.shortcut").data(function(d2) {
67422         var arr = d2.shortcuts;
67423         if (detected.os === "win" && d2.text === "shortcuts.editing.commands.redo") {
67424           arr = ["Y"];
67425         } else if (detected.os !== "mac" && d2.text === "shortcuts.browsing.display_options.fullscreen") {
67426           arr = ["F11"];
67427         }
67428         arr = arr.map(function(s2) {
67429           return uiCmd.display(s2.indexOf(".") !== -1 ? _t(s2) : s2);
67430         });
67431         return utilArrayUniq(arr).map(function(s2) {
67432           return {
67433             shortcut: s2,
67434             separator: d2.separator,
67435             suffix: d2.suffix
67436           };
67437         });
67438       }).enter().each(function(d2, i3, nodes) {
67439         var selection3 = select_default2(this);
67440         var click = d2.shortcut.toLowerCase().match(/(.*).click/);
67441         if (click && click[1]) {
67442           selection3.call(svgIcon("#iD-walkthrough-mouse-" + click[1], "operation"));
67443         } else if (d2.shortcut.toLowerCase() === "long-press") {
67444           selection3.call(svgIcon("#iD-walkthrough-longpress", "longpress operation"));
67445         } else if (d2.shortcut.toLowerCase() === "tap") {
67446           selection3.call(svgIcon("#iD-walkthrough-tap", "tap operation"));
67447         } else {
67448           selection3.append("kbd").attr("class", "shortcut").text(function(d4) {
67449             return d4.shortcut;
67450           });
67451         }
67452         if (i3 < nodes.length - 1) {
67453           selection3.append("span").html(d2.separator || "\xA0" + _t.html("shortcuts.or") + "\xA0");
67454         } else if (i3 === nodes.length - 1 && d2.suffix) {
67455           selection3.append("span").text(d2.suffix);
67456         }
67457       });
67458       shortcutKeys.filter(function(d2) {
67459         return d2.gesture;
67460       }).each(function() {
67461         var selection3 = select_default2(this);
67462         selection3.append("span").text("+");
67463         selection3.append("span").attr("class", "gesture").html(function(d2) {
67464           return _t.html(d2.gesture);
67465         });
67466       });
67467       shortcutRows.append("td").attr("class", "shortcut-desc").html(function(d2) {
67468         return d2.text ? _t.html(d2.text) : "\xA0";
67469       });
67470       wrapper.selectAll(".shortcut-tab").style("display", function(d2, i3) {
67471         return i3 === _activeTab ? "flex" : "none";
67472       });
67473     }
67474     return function(selection2, show) {
67475       _selection = selection2;
67476       if (show) {
67477         _modalSelection = uiModal(selection2);
67478         _modalSelection.call(shortcutsModal);
67479       } else {
67480         context.keybinding().on([_t("shortcuts.toggle.key"), "?"], function() {
67481           if (context.container().selectAll(".modal-shortcuts").size()) {
67482             if (_modalSelection) {
67483               _modalSelection.close();
67484               _modalSelection = null;
67485             }
67486           } else {
67487             _modalSelection = uiModal(_selection);
67488             _modalSelection.call(shortcutsModal);
67489           }
67490         });
67491       }
67492     };
67493   }
67494   var init_shortcuts = __esm({
67495     "modules/ui/shortcuts.js"() {
67496       "use strict";
67497       init_src5();
67498       init_file_fetcher();
67499       init_localizer();
67500       init_icon();
67501       init_cmd();
67502       init_modal();
67503       init_util();
67504       init_detect();
67505     }
67506   });
67507
67508   // modules/ui/data_header.js
67509   var data_header_exports = {};
67510   __export(data_header_exports, {
67511     uiDataHeader: () => uiDataHeader
67512   });
67513   function uiDataHeader() {
67514     var _datum;
67515     function dataHeader(selection2) {
67516       var header = selection2.selectAll(".data-header").data(
67517         _datum ? [_datum] : [],
67518         function(d2) {
67519           return d2.__featurehash__;
67520         }
67521       );
67522       header.exit().remove();
67523       var headerEnter = header.enter().append("div").attr("class", "data-header");
67524       var iconEnter = headerEnter.append("div").attr("class", "data-header-icon");
67525       iconEnter.append("div").attr("class", "preset-icon-28").call(svgIcon("#iD-icon-data", "note-fill"));
67526       headerEnter.append("div").attr("class", "data-header-label").call(_t.append("map_data.layers.custom.title"));
67527     }
67528     dataHeader.datum = function(val) {
67529       if (!arguments.length) return _datum;
67530       _datum = val;
67531       return this;
67532     };
67533     return dataHeader;
67534   }
67535   var init_data_header = __esm({
67536     "modules/ui/data_header.js"() {
67537       "use strict";
67538       init_localizer();
67539       init_icon();
67540     }
67541   });
67542
67543   // modules/ui/disclosure.js
67544   var disclosure_exports = {};
67545   __export(disclosure_exports, {
67546     uiDisclosure: () => uiDisclosure
67547   });
67548   function uiDisclosure(context, key, expandedDefault) {
67549     var dispatch14 = dispatch_default("toggled");
67550     var _expanded;
67551     var _label = utilFunctor("");
67552     var _updatePreference = true;
67553     var _content = function() {
67554     };
67555     var disclosure = function(selection2) {
67556       if (_expanded === void 0 || _expanded === null) {
67557         var preference = corePreferences("disclosure." + key + ".expanded");
67558         _expanded = preference === null ? !!expandedDefault : preference === "true";
67559       }
67560       var hideToggle = selection2.selectAll(".hide-toggle-" + key).data([0]);
67561       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"));
67562       hideToggleEnter.append("span").attr("class", "hide-toggle-text");
67563       hideToggle = hideToggleEnter.merge(hideToggle);
67564       hideToggle.on("click", toggle).attr("title", _t(`icons.${_expanded ? "collapse" : "expand"}`)).attr("aria-expanded", _expanded).classed("expanded", _expanded);
67565       const label = _label();
67566       const labelSelection = hideToggle.selectAll(".hide-toggle-text");
67567       if (typeof label !== "function") {
67568         labelSelection.text(_label());
67569       } else {
67570         labelSelection.text("").call(label);
67571       }
67572       hideToggle.selectAll(".hide-toggle-icon").attr(
67573         "xlink:href",
67574         _expanded ? "#iD-icon-down" : _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward"
67575       );
67576       var wrap2 = selection2.selectAll(".disclosure-wrap").data([0]);
67577       wrap2 = wrap2.enter().append("div").attr("class", "disclosure-wrap disclosure-wrap-" + key).merge(wrap2).classed("hide", !_expanded);
67578       if (_expanded) {
67579         wrap2.call(_content);
67580       }
67581       function toggle(d3_event) {
67582         d3_event.preventDefault();
67583         _expanded = !_expanded;
67584         if (_updatePreference) {
67585           corePreferences("disclosure." + key + ".expanded", _expanded);
67586         }
67587         hideToggle.classed("expanded", _expanded).attr("aria-expanded", _expanded).attr("title", _t(`icons.${_expanded ? "collapse" : "expand"}`));
67588         hideToggle.selectAll(".hide-toggle-icon").attr(
67589           "xlink:href",
67590           _expanded ? "#iD-icon-down" : _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward"
67591         );
67592         wrap2.call(uiToggle(_expanded));
67593         if (_expanded) {
67594           wrap2.call(_content);
67595         }
67596         dispatch14.call("toggled", this, _expanded);
67597       }
67598     };
67599     disclosure.label = function(val) {
67600       if (!arguments.length) return _label;
67601       _label = utilFunctor(val);
67602       return disclosure;
67603     };
67604     disclosure.expanded = function(val) {
67605       if (!arguments.length) return _expanded;
67606       _expanded = val;
67607       return disclosure;
67608     };
67609     disclosure.updatePreference = function(val) {
67610       if (!arguments.length) return _updatePreference;
67611       _updatePreference = val;
67612       return disclosure;
67613     };
67614     disclosure.content = function(val) {
67615       if (!arguments.length) return _content;
67616       _content = val;
67617       return disclosure;
67618     };
67619     return utilRebind(disclosure, dispatch14, "on");
67620   }
67621   var init_disclosure = __esm({
67622     "modules/ui/disclosure.js"() {
67623       "use strict";
67624       init_src4();
67625       init_preferences();
67626       init_icon();
67627       init_util();
67628       init_rebind();
67629       init_toggle();
67630       init_localizer();
67631     }
67632   });
67633
67634   // modules/ui/section.js
67635   var section_exports = {};
67636   __export(section_exports, {
67637     uiSection: () => uiSection
67638   });
67639   function uiSection(id2, context) {
67640     var _classes = utilFunctor("");
67641     var _shouldDisplay;
67642     var _content;
67643     var _disclosure;
67644     var _label;
67645     var _expandedByDefault = utilFunctor(true);
67646     var _disclosureContent;
67647     var _disclosureExpanded;
67648     var _containerSelection = select_default2(null);
67649     var section = {
67650       id: id2
67651     };
67652     section.classes = function(val) {
67653       if (!arguments.length) return _classes;
67654       _classes = utilFunctor(val);
67655       return section;
67656     };
67657     section.label = function(val) {
67658       if (!arguments.length) return _label;
67659       _label = utilFunctor(val);
67660       return section;
67661     };
67662     section.expandedByDefault = function(val) {
67663       if (!arguments.length) return _expandedByDefault;
67664       _expandedByDefault = utilFunctor(val);
67665       return section;
67666     };
67667     section.shouldDisplay = function(val) {
67668       if (!arguments.length) return _shouldDisplay;
67669       _shouldDisplay = utilFunctor(val);
67670       return section;
67671     };
67672     section.content = function(val) {
67673       if (!arguments.length) return _content;
67674       _content = val;
67675       return section;
67676     };
67677     section.disclosureContent = function(val) {
67678       if (!arguments.length) return _disclosureContent;
67679       _disclosureContent = val;
67680       return section;
67681     };
67682     section.disclosureExpanded = function(val) {
67683       if (!arguments.length) return _disclosureExpanded;
67684       _disclosureExpanded = val;
67685       return section;
67686     };
67687     section.render = function(selection2) {
67688       _containerSelection = selection2.selectAll(".section-" + id2).data([0]);
67689       var sectionEnter = _containerSelection.enter().append("div").attr("class", "section section-" + id2 + " " + (_classes && _classes() || ""));
67690       _containerSelection = sectionEnter.merge(_containerSelection);
67691       _containerSelection.call(renderContent);
67692     };
67693     section.reRender = function() {
67694       _containerSelection.call(renderContent);
67695     };
67696     section.selection = function() {
67697       return _containerSelection;
67698     };
67699     section.disclosure = function() {
67700       return _disclosure;
67701     };
67702     function renderContent(selection2) {
67703       if (_shouldDisplay) {
67704         var shouldDisplay = _shouldDisplay();
67705         selection2.classed("hide", !shouldDisplay);
67706         if (!shouldDisplay) {
67707           selection2.html("");
67708           return;
67709         }
67710       }
67711       if (_disclosureContent) {
67712         if (!_disclosure) {
67713           _disclosure = uiDisclosure(context, id2.replace(/-/g, "_"), _expandedByDefault()).label(_label || "").content(_disclosureContent);
67714         }
67715         if (_disclosureExpanded !== void 0) {
67716           _disclosure.expanded(_disclosureExpanded);
67717           _disclosureExpanded = void 0;
67718         }
67719         selection2.call(_disclosure);
67720         return;
67721       }
67722       if (_content) {
67723         selection2.call(_content);
67724       }
67725     }
67726     return section;
67727   }
67728   var init_section = __esm({
67729     "modules/ui/section.js"() {
67730       "use strict";
67731       init_src5();
67732       init_disclosure();
67733       init_util();
67734     }
67735   });
67736
67737   // modules/ui/tag_reference.js
67738   var tag_reference_exports = {};
67739   __export(tag_reference_exports, {
67740     uiTagReference: () => uiTagReference
67741   });
67742   function uiTagReference(what) {
67743     var wikibase = what.qid ? services.wikidata : services.osmWikibase;
67744     var tagReference = {};
67745     var _button = select_default2(null);
67746     var _body = select_default2(null);
67747     var _loaded;
67748     var _showing;
67749     function load() {
67750       if (!wikibase) return;
67751       _button.classed("tag-reference-loading", true);
67752       wikibase.getDocs(what, gotDocs);
67753     }
67754     function gotDocs(err, docs) {
67755       _body.html("");
67756       if (!docs || !docs.title) {
67757         _body.append("p").attr("class", "tag-reference-description").call(_t.append("inspector.no_documentation_key"));
67758         done();
67759         return;
67760       }
67761       if (docs.imageURL) {
67762         _body.append("img").attr("class", "tag-reference-wiki-image").attr("alt", docs.title).attr("src", docs.imageURL).on("load", function() {
67763           done();
67764         }).on("error", function() {
67765           select_default2(this).remove();
67766           done();
67767         });
67768       } else {
67769         done();
67770       }
67771       var tagReferenceDescription = _body.append("p").attr("class", "tag-reference-description").append("span");
67772       if (docs.description) {
67773         tagReferenceDescription = tagReferenceDescription.attr("class", "localized-text").attr("lang", docs.descriptionLocaleCode || "und").call(docs.description);
67774       } else {
67775         tagReferenceDescription = tagReferenceDescription.call(_t.append("inspector.no_documentation_key"));
67776       }
67777       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"));
67778       if (docs.wiki) {
67779         _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));
67780       }
67781       if (what.key === "comment") {
67782         _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"));
67783       }
67784     }
67785     function done() {
67786       _loaded = true;
67787       _button.classed("tag-reference-loading", false);
67788       _body.classed("expanded", true).transition().duration(200).style("max-height", "200px").style("opacity", "1");
67789       _showing = true;
67790       _button.selectAll("svg.icon use").each(function() {
67791         var iconUse = select_default2(this);
67792         if (iconUse.attr("href") === "#iD-icon-info") {
67793           iconUse.attr("href", "#iD-icon-info-filled");
67794         }
67795       });
67796     }
67797     function hide() {
67798       _body.transition().duration(200).style("max-height", "0px").style("opacity", "0").on("end", function() {
67799         _body.classed("expanded", false);
67800       });
67801       _showing = false;
67802       _button.selectAll("svg.icon use").each(function() {
67803         var iconUse = select_default2(this);
67804         if (iconUse.attr("href") === "#iD-icon-info-filled") {
67805           iconUse.attr("href", "#iD-icon-info");
67806         }
67807       });
67808     }
67809     tagReference.button = function(selection2, klass, iconName) {
67810       _button = selection2.selectAll(".tag-reference-button").data([0]);
67811       _button = _button.enter().append("button").attr("class", "tag-reference-button " + (klass || "")).attr("title", _t("icons.information")).call(svgIcon("#iD-icon-" + (iconName || "inspect"))).merge(_button);
67812       _button.on("click", function(d3_event) {
67813         d3_event.stopPropagation();
67814         d3_event.preventDefault();
67815         this.blur();
67816         if (_showing) {
67817           hide();
67818         } else if (_loaded) {
67819           done();
67820         } else {
67821           load();
67822         }
67823       });
67824     };
67825     tagReference.body = function(selection2) {
67826       var itemID = what.qid || what.key + "-" + (what.value || "");
67827       _body = selection2.selectAll(".tag-reference-body").data([itemID], function(d2) {
67828         return d2;
67829       });
67830       _body.exit().remove();
67831       _body = _body.enter().append("div").attr("class", "tag-reference-body").style("max-height", "0").style("opacity", "0").merge(_body);
67832       if (_showing === false) {
67833         hide();
67834       }
67835     };
67836     tagReference.showing = function(val) {
67837       if (!arguments.length) return _showing;
67838       _showing = val;
67839       return tagReference;
67840     };
67841     return tagReference;
67842   }
67843   var init_tag_reference = __esm({
67844     "modules/ui/tag_reference.js"() {
67845       "use strict";
67846       init_src5();
67847       init_localizer();
67848       init_services();
67849       init_icon();
67850     }
67851   });
67852
67853   // modules/ui/sections/raw_tag_editor.js
67854   var raw_tag_editor_exports = {};
67855   __export(raw_tag_editor_exports, {
67856     uiSectionRawTagEditor: () => uiSectionRawTagEditor
67857   });
67858   function uiSectionRawTagEditor(id2, context) {
67859     var section = uiSection(id2, context).classes("raw-tag-editor").label(function() {
67860       var count = Object.keys(_tags).filter(function(d2) {
67861         return d2;
67862       }).length;
67863       return _t.append("inspector.title_count", { title: _t("inspector.tags"), count });
67864     }).expandedByDefault(false).disclosureContent(renderDisclosureContent);
67865     var taginfo = services.taginfo;
67866     var dispatch14 = dispatch_default("change");
67867     var availableViews = [
67868       { id: "list", icon: "#fas-th-list" },
67869       { id: "text", icon: "#fas-i-cursor" }
67870     ];
67871     let _discardTags = {};
67872     _mainFileFetcher.get("discarded").then((d2) => {
67873       _discardTags = d2;
67874     }).catch(() => {
67875     });
67876     var _tagView = corePreferences("raw-tag-editor-view") || "list";
67877     var _readOnlyTags = [];
67878     var _orderedKeys = [];
67879     var _showBlank = false;
67880     var _pendingChange = null;
67881     var _state;
67882     var _presets;
67883     var _tags;
67884     var _entityIDs;
67885     var _didInteract = false;
67886     function interacted() {
67887       _didInteract = true;
67888     }
67889     function renderDisclosureContent(wrap2) {
67890       _orderedKeys = _orderedKeys.filter(function(key) {
67891         return _tags[key] !== void 0;
67892       });
67893       var all = Object.keys(_tags).sort();
67894       var missingKeys = utilArrayDifference(all, _orderedKeys);
67895       for (var i3 in missingKeys) {
67896         _orderedKeys.push(missingKeys[i3]);
67897       }
67898       var rowData = _orderedKeys.map(function(key, i4) {
67899         return { index: i4, key, value: _tags[key] };
67900       });
67901       if (!rowData.length || _showBlank) {
67902         _showBlank = false;
67903         rowData.push({ index: rowData.length, key: "", value: "" });
67904       }
67905       var options2 = wrap2.selectAll(".raw-tag-options").data([0]);
67906       options2.exit().remove();
67907       var optionsEnter = options2.enter().insert("div", ":first-child").attr("class", "raw-tag-options").attr("role", "tablist");
67908       var optionEnter = optionsEnter.selectAll(".raw-tag-option").data(availableViews, function(d2) {
67909         return d2.id;
67910       }).enter();
67911       optionEnter.append("button").attr("class", function(d2) {
67912         return "raw-tag-option raw-tag-option-" + d2.id + (_tagView === d2.id ? " selected" : "");
67913       }).attr("aria-selected", function(d2) {
67914         return _tagView === d2.id;
67915       }).attr("role", "tab").attr("title", function(d2) {
67916         return _t("icons." + d2.id);
67917       }).on("click", function(d3_event, d2) {
67918         _tagView = d2.id;
67919         corePreferences("raw-tag-editor-view", d2.id);
67920         wrap2.selectAll(".raw-tag-option").classed("selected", function(datum2) {
67921           return datum2 === d2;
67922         }).attr("aria-selected", function(datum2) {
67923           return datum2 === d2;
67924         });
67925         wrap2.selectAll(".tag-text").classed("hide", d2.id !== "text").each(setTextareaHeight);
67926         wrap2.selectAll(".tag-list, .add-row").classed("hide", d2.id !== "list");
67927       }).each(function(d2) {
67928         select_default2(this).call(svgIcon(d2.icon));
67929       });
67930       var textData = rowsToText(rowData);
67931       var textarea = wrap2.selectAll(".tag-text").data([0]);
67932       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);
67933       textarea.call(utilGetSetValue, textData).each(setTextareaHeight).on("input", setTextareaHeight).on("focus", interacted).on("blur", textChanged).on("change", textChanged);
67934       var list2 = wrap2.selectAll(".tag-list").data([0]);
67935       list2 = list2.enter().append("ul").attr("class", "tag-list" + (_tagView !== "list" ? " hide" : "")).merge(list2);
67936       var addRowEnter = wrap2.selectAll(".add-row").data([0]).enter().append("div").attr("class", "add-row" + (_tagView !== "list" ? " hide" : ""));
67937       addRowEnter.append("button").attr("class", "add-tag").attr("aria-label", _t("inspector.add_to_tag")).call(svgIcon("#iD-icon-plus", "light")).call(uiTooltip().title(() => _t.append("inspector.add_to_tag")).placement(_mainLocalizer.textDirection() === "ltr" ? "right" : "left")).on("click", addTag);
67938       addRowEnter.append("div").attr("class", "space-value");
67939       addRowEnter.append("div").attr("class", "space-buttons");
67940       var items = list2.selectAll(".tag-row").data(rowData, function(d2) {
67941         return d2.key;
67942       });
67943       items.exit().each(unbind).remove();
67944       var itemsEnter = items.enter().append("li").attr("class", "tag-row").classed("readonly", isReadOnly);
67945       var innerWrap = itemsEnter.append("div").attr("class", "inner-wrap");
67946       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);
67947       innerWrap.append("div").attr("class", "value-wrap").append("input").property("type", "text").attr("class", "value").call(utilNoAuto).on("focus", interacted).on("blur", valueChange).on("change", valueChange).on("keydown.push-more", pushMore);
67948       innerWrap.append("button").attr("class", "form-field-button remove").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
67949       items = items.merge(itemsEnter).sort(function(a2, b2) {
67950         return a2.index - b2.index;
67951       });
67952       items.each(function(d2) {
67953         var row = select_default2(this);
67954         var key = row.select("input.key");
67955         var value = row.select("input.value");
67956         if (_entityIDs && taginfo && _state !== "hover") {
67957           bindTypeahead(key, value);
67958         }
67959         var referenceOptions = { key: d2.key };
67960         if (typeof d2.value === "string") {
67961           referenceOptions.value = d2.value;
67962         }
67963         var reference = uiTagReference(referenceOptions, context);
67964         if (_state === "hover") {
67965           reference.showing(false);
67966         }
67967         row.select(".inner-wrap").call(reference.button);
67968         row.call(reference.body);
67969         row.select("button.remove");
67970       });
67971       items.selectAll("input.key").attr("title", function(d2) {
67972         return d2.key;
67973       }).call(utilGetSetValue, function(d2) {
67974         return d2.key;
67975       }).attr("readonly", function(d2) {
67976         return isReadOnly(d2) || null;
67977       });
67978       items.selectAll("input.value").attr("title", function(d2) {
67979         return Array.isArray(d2.value) ? d2.value.filter(Boolean).join("\n") : d2.value;
67980       }).classed("mixed", function(d2) {
67981         return Array.isArray(d2.value);
67982       }).attr("placeholder", function(d2) {
67983         return typeof d2.value === "string" ? null : _t("inspector.multiple_values");
67984       }).call(utilGetSetValue, function(d2) {
67985         return typeof d2.value === "string" ? d2.value : "";
67986       }).attr("readonly", function(d2) {
67987         return isReadOnly(d2) || null;
67988       });
67989       items.selectAll("button.remove").on(
67990         ("PointerEvent" in window ? "pointer" : "mouse") + "down",
67991         // 'click' fires too late - #5878
67992         (d3_event, d2) => {
67993           if (d3_event.button !== 0) return;
67994           removeTag(d3_event, d2);
67995         }
67996       );
67997     }
67998     function isReadOnly(d2) {
67999       for (var i3 = 0; i3 < _readOnlyTags.length; i3++) {
68000         if (d2.key.match(_readOnlyTags[i3]) !== null) {
68001           return true;
68002         }
68003       }
68004       return false;
68005     }
68006     function setTextareaHeight() {
68007       if (_tagView !== "text") return;
68008       var selection2 = select_default2(this);
68009       var matches = selection2.node().value.match(/\n/g);
68010       var lineCount = 2 + Number(matches && matches.length);
68011       var lineHeight = 20;
68012       selection2.style("height", lineCount * lineHeight + "px");
68013     }
68014     function stringify3(s2) {
68015       const stringified = JSON.stringify(s2).slice(1, -1);
68016       if (stringified !== s2) {
68017         return `"${stringified}"`;
68018       } else {
68019         return s2;
68020       }
68021     }
68022     function unstringify(s2) {
68023       const isQuoted = s2.length > 1 && s2.charAt(0) === '"' && s2.charAt(s2.length - 1) === '"';
68024       if (isQuoted) {
68025         try {
68026           return JSON.parse(s2);
68027         } catch {
68028           return s2;
68029         }
68030       } else {
68031         return s2;
68032       }
68033     }
68034     function rowsToText(rows) {
68035       var str = rows.filter(function(row) {
68036         return row.key && row.key.trim() !== "";
68037       }).map(function(row) {
68038         var rawVal = row.value;
68039         if (typeof rawVal !== "string") rawVal = "*";
68040         var val = rawVal ? stringify3(rawVal) : "";
68041         return stringify3(row.key) + "=" + val;
68042       }).join("\n");
68043       if (_state !== "hover" && str.length) {
68044         return str + "\n";
68045       }
68046       return str;
68047     }
68048     function textChanged() {
68049       var newText = this.value.trim();
68050       var newTags = {};
68051       newText.split("\n").forEach(function(row) {
68052         var m2 = row.match(/^\s*([^=]+)=(.*)$/);
68053         if (m2 !== null) {
68054           var k2 = context.cleanTagKey(unstringify(m2[1].trim()));
68055           var v2 = context.cleanTagValue(unstringify(m2[2].trim()));
68056           newTags[k2] = v2;
68057         }
68058       });
68059       var tagDiff = utilTagDiff(_tags, newTags);
68060       _pendingChange = _pendingChange || {};
68061       tagDiff.forEach(function(change) {
68062         if (isReadOnly({ key: change.key })) return;
68063         if (change.newVal === "*" && typeof change.oldVal !== "string") return;
68064         if (change.type === "-") {
68065           _pendingChange[change.key] = void 0;
68066         } else if (change.type === "+") {
68067           _pendingChange[change.key] = change.newVal || "";
68068         }
68069       });
68070       if (Object.keys(_pendingChange).length === 0) {
68071         _pendingChange = null;
68072         section.reRender();
68073         return;
68074       }
68075       scheduleChange();
68076     }
68077     function pushMore(d3_event) {
68078       if (d3_event.keyCode === 9 && !d3_event.shiftKey && section.selection().selectAll(".tag-list li:last-child input.value").node() === this && utilGetSetValue(select_default2(this))) {
68079         addTag();
68080       }
68081     }
68082     function bindTypeahead(key, value) {
68083       if (isReadOnly(key.datum())) return;
68084       if (Array.isArray(value.datum().value)) {
68085         value.call(uiCombobox(context, "tag-value").minItems(1).fetcher(function(value2, callback) {
68086           var keyString = utilGetSetValue(key);
68087           if (!_tags[keyString]) return;
68088           var data = _tags[keyString].map(function(tagValue) {
68089             if (!tagValue) {
68090               return {
68091                 value: " ",
68092                 title: _t("inspector.empty"),
68093                 display: (selection2) => selection2.text("").classed("virtual-option", true).call(_t.append("inspector.empty"))
68094               };
68095             }
68096             return {
68097               value: tagValue,
68098               title: tagValue
68099             };
68100           });
68101           callback(data);
68102         }));
68103         return;
68104       }
68105       var geometry = context.graph().geometry(_entityIDs[0]);
68106       key.call(uiCombobox(context, "tag-key").fetcher(function(value2, callback) {
68107         taginfo.keys({
68108           debounce: true,
68109           geometry,
68110           query: value2
68111         }, function(err, data) {
68112           if (!err) {
68113             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()));
68114             callback(sort(value2, filtered));
68115           }
68116         });
68117       }));
68118       value.call(uiCombobox(context, "tag-value").fetcher(function(value2, callback) {
68119         taginfo.values({
68120           debounce: true,
68121           key: utilGetSetValue(key),
68122           geometry,
68123           query: value2
68124         }, function(err, data) {
68125           if (!err) {
68126             const filtered = data.filter((d2) => d2.value.toLowerCase().includes(value2.toLowerCase()));
68127             callback(sort(value2, filtered));
68128           }
68129         });
68130       }).caseSensitive(allowUpperCaseTagValues.test(utilGetSetValue(key))));
68131       function sort(value2, data) {
68132         var sameletter = [];
68133         var other2 = [];
68134         for (var i3 = 0; i3 < data.length; i3++) {
68135           if (data[i3].value.substring(0, value2.length) === value2) {
68136             sameletter.push(data[i3]);
68137           } else {
68138             other2.push(data[i3]);
68139           }
68140         }
68141         return sameletter.concat(other2);
68142       }
68143     }
68144     function unbind() {
68145       var row = select_default2(this);
68146       row.selectAll("input.key").call(uiCombobox.off, context);
68147       row.selectAll("input.value").call(uiCombobox.off, context);
68148     }
68149     function keyChange(d3_event, d2) {
68150       if (select_default2(this).attr("readonly")) return;
68151       var kOld = d2.key;
68152       if (_pendingChange && _pendingChange.hasOwnProperty(kOld) && _pendingChange[kOld] === void 0) return;
68153       var kNew = context.cleanTagKey(this.value.trim());
68154       if (isReadOnly({ key: kNew })) {
68155         this.value = kOld;
68156         return;
68157       }
68158       if (kNew && kNew !== kOld && _tags[kNew] !== void 0) {
68159         this.value = kOld;
68160         section.selection().selectAll(".tag-list input.value").each(function(d4) {
68161           if (d4.key === kNew) {
68162             var input = select_default2(this).node();
68163             input.focus();
68164             input.select();
68165           }
68166         });
68167         return;
68168       }
68169       _pendingChange = _pendingChange || {};
68170       if (kOld) {
68171         if (kOld === kNew) return;
68172         _pendingChange[kNew] = _pendingChange[kOld] || { oldKey: kOld };
68173         _pendingChange[kOld] = void 0;
68174       } else {
68175         let row = this.parentNode.parentNode;
68176         let inputVal = select_default2(row).selectAll("input.value");
68177         let vNew = context.cleanTagValue(utilGetSetValue(inputVal));
68178         _pendingChange[kNew] = vNew;
68179         utilGetSetValue(inputVal, vNew);
68180       }
68181       var existingKeyIndex = _orderedKeys.indexOf(kOld);
68182       if (existingKeyIndex !== -1) _orderedKeys[existingKeyIndex] = kNew;
68183       d2.key = kNew;
68184       this.value = kNew;
68185       scheduleChange();
68186     }
68187     function valueChange(d3_event, d2) {
68188       if (isReadOnly(d2)) return;
68189       if (typeof d2.value !== "string" && !this.value) return;
68190       if (_pendingChange && _pendingChange.hasOwnProperty(d2.key) && _pendingChange[d2.key] === void 0) return;
68191       _pendingChange = _pendingChange || {};
68192       _pendingChange[d2.key] = context.cleanTagValue(this.value);
68193       scheduleChange();
68194     }
68195     function removeTag(d3_event, d2) {
68196       if (isReadOnly(d2)) return;
68197       if (d2.key === "") {
68198         _showBlank = false;
68199         section.reRender();
68200       } else {
68201         _orderedKeys = _orderedKeys.filter(function(key) {
68202           return key !== d2.key;
68203         });
68204         _pendingChange = _pendingChange || {};
68205         _pendingChange[d2.key] = void 0;
68206         scheduleChange();
68207       }
68208     }
68209     function addTag() {
68210       window.setTimeout(function() {
68211         _showBlank = true;
68212         section.reRender();
68213         section.selection().selectAll(".tag-list li:last-child input.key").node().focus();
68214       }, 20);
68215     }
68216     function scheduleChange() {
68217       var entityIDs = _entityIDs;
68218       window.setTimeout(function() {
68219         if (!_pendingChange) return;
68220         dispatch14.call("change", this, entityIDs, _pendingChange);
68221         _pendingChange = null;
68222       }, 10);
68223     }
68224     section.state = function(val) {
68225       if (!arguments.length) return _state;
68226       if (_state !== val) {
68227         _orderedKeys = [];
68228         _state = val;
68229       }
68230       return section;
68231     };
68232     section.presets = function(val) {
68233       if (!arguments.length) return _presets;
68234       _presets = val;
68235       if (_presets && _presets.length && _presets[0].isFallback()) {
68236         section.disclosureExpanded(true);
68237       } else if (!_didInteract) {
68238         section.disclosureExpanded(null);
68239       }
68240       return section;
68241     };
68242     section.tags = function(val) {
68243       if (!arguments.length) return _tags;
68244       _tags = val;
68245       return section;
68246     };
68247     section.entityIDs = function(val) {
68248       if (!arguments.length) return _entityIDs;
68249       if (!_entityIDs || !val || !utilArrayIdentical(_entityIDs, val)) {
68250         _entityIDs = val;
68251         _orderedKeys = [];
68252       }
68253       return section;
68254     };
68255     section.readOnlyTags = function(val) {
68256       if (!arguments.length) return _readOnlyTags;
68257       _readOnlyTags = val;
68258       return section;
68259     };
68260     return utilRebind(section, dispatch14, "on");
68261   }
68262   var init_raw_tag_editor = __esm({
68263     "modules/ui/sections/raw_tag_editor.js"() {
68264       "use strict";
68265       init_src4();
68266       init_src5();
68267       init_services();
68268       init_icon();
68269       init_combobox();
68270       init_section();
68271       init_tag_reference();
68272       init_preferences();
68273       init_localizer();
68274       init_array3();
68275       init_util();
68276       init_ui();
68277       init_tags();
68278       init_core();
68279     }
68280   });
68281
68282   // modules/ui/data_editor.js
68283   var data_editor_exports = {};
68284   __export(data_editor_exports, {
68285     uiDataEditor: () => uiDataEditor
68286   });
68287   function uiDataEditor(context) {
68288     var dataHeader = uiDataHeader();
68289     var rawTagEditor = uiSectionRawTagEditor("custom-data-tag-editor", context).expandedByDefault(true).readOnlyTags([/./]);
68290     var _datum;
68291     function dataEditor(selection2) {
68292       var header = selection2.selectAll(".header").data([0]);
68293       var headerEnter = header.enter().append("div").attr("class", "header fillL");
68294       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
68295         context.enter(modeBrowse(context));
68296       }).call(svgIcon("#iD-icon-close"));
68297       headerEnter.append("h2").call(_t.append("map_data.title"));
68298       var body = selection2.selectAll(".body").data([0]);
68299       body = body.enter().append("div").attr("class", "body").merge(body);
68300       var editor = body.selectAll(".data-editor").data([0]);
68301       editor.enter().append("div").attr("class", "modal-section data-editor").merge(editor).call(dataHeader.datum(_datum));
68302       var rte = body.selectAll(".raw-tag-editor").data([0]);
68303       rte.enter().append("div").attr("class", "raw-tag-editor data-editor").merge(rte).call(
68304         rawTagEditor.tags(_datum && _datum.properties || {}).state("hover").render
68305       ).selectAll("textarea.tag-text").attr("readonly", true).classed("readonly", true);
68306     }
68307     dataEditor.datum = function(val) {
68308       if (!arguments.length) return _datum;
68309       _datum = val;
68310       return this;
68311     };
68312     return dataEditor;
68313   }
68314   var init_data_editor = __esm({
68315     "modules/ui/data_editor.js"() {
68316       "use strict";
68317       init_localizer();
68318       init_browse();
68319       init_icon();
68320       init_data_header();
68321       init_raw_tag_editor();
68322     }
68323   });
68324
68325   // node_modules/@mapbox/sexagesimal/index.js
68326   var require_sexagesimal = __commonJS({
68327     "node_modules/@mapbox/sexagesimal/index.js"(exports2, module2) {
68328       module2.exports = element;
68329       module2.exports.pair = pair3;
68330       module2.exports.format = format2;
68331       module2.exports.formatPair = formatPair;
68332       module2.exports.coordToDMS = coordToDMS;
68333       function element(input, dims) {
68334         var result = search(input, dims);
68335         return result === null ? null : result.val;
68336       }
68337       function formatPair(input) {
68338         return format2(input.lat, "lat") + " " + format2(input.lon, "lon");
68339       }
68340       function format2(input, dim) {
68341         var dms = coordToDMS(input, dim);
68342         return dms.whole + "\xB0 " + (dms.minutes ? dms.minutes + "' " : "") + (dms.seconds ? dms.seconds + '" ' : "") + dms.dir;
68343       }
68344       function coordToDMS(input, dim) {
68345         var dirs = { lat: ["N", "S"], lon: ["E", "W"] }[dim] || "";
68346         var dir = dirs[input >= 0 ? 0 : 1];
68347         var abs3 = Math.abs(input);
68348         var whole = Math.floor(abs3);
68349         var fraction = abs3 - whole;
68350         var fractionMinutes = fraction * 60;
68351         var minutes = Math.floor(fractionMinutes);
68352         var seconds = Math.floor((fractionMinutes - minutes) * 60);
68353         return {
68354           whole,
68355           minutes,
68356           seconds,
68357           dir
68358         };
68359       }
68360       function search(input, dims) {
68361         if (!dims) dims = "NSEW";
68362         if (typeof input !== "string") return null;
68363         input = input.toUpperCase();
68364         var regex = /^[\s\,]*([NSEW])?\s*([\-|\—|\―]?[0-9.]+)[°º˚]?\s*(?:([0-9.]+)['’′‘]\s*)?(?:([0-9.]+)(?:''|"|”|″)\s*)?([NSEW])?/;
68365         var m2 = input.match(regex);
68366         if (!m2) return null;
68367         var matched = m2[0];
68368         var dim;
68369         if (m2[1] && m2[5]) {
68370           dim = m2[1];
68371           matched = matched.slice(0, -1);
68372         } else {
68373           dim = m2[1] || m2[5];
68374         }
68375         if (dim && dims.indexOf(dim) === -1) return null;
68376         var deg = m2[2] ? parseFloat(m2[2]) : 0;
68377         var min3 = m2[3] ? parseFloat(m2[3]) / 60 : 0;
68378         var sec = m2[4] ? parseFloat(m2[4]) / 3600 : 0;
68379         var sign2 = deg < 0 ? -1 : 1;
68380         if (dim === "S" || dim === "W") sign2 *= -1;
68381         return {
68382           val: (Math.abs(deg) + min3 + sec) * sign2,
68383           dim,
68384           matched,
68385           remain: input.slice(matched.length)
68386         };
68387       }
68388       function pair3(input, dims) {
68389         input = input.trim();
68390         var one2 = search(input, dims);
68391         if (!one2) return null;
68392         input = one2.remain.trim();
68393         var two = search(input, dims);
68394         if (!two || two.remain) return null;
68395         if (one2.dim) {
68396           return swapdim(one2.val, two.val, one2.dim);
68397         } else {
68398           return [one2.val, two.val];
68399         }
68400       }
68401       function swapdim(a2, b2, dim) {
68402         if (dim === "N" || dim === "S") return [a2, b2];
68403         if (dim === "W" || dim === "E") return [b2, a2];
68404       }
68405     }
68406   });
68407
68408   // modules/ui/feature_list.js
68409   var feature_list_exports = {};
68410   __export(feature_list_exports, {
68411     uiFeatureList: () => uiFeatureList
68412   });
68413   function uiFeatureList(context) {
68414     var _geocodeResults;
68415     function featureList(selection2) {
68416       var header = selection2.append("div").attr("class", "header fillL");
68417       header.append("h2").call(_t.append("inspector.feature_list"));
68418       var searchWrap = selection2.append("div").attr("class", "search-header");
68419       searchWrap.call(svgIcon("#iD-icon-search", "pre-text"));
68420       var search = searchWrap.append("input").attr("placeholder", _t("inspector.search")).attr("type", "search").call(utilNoAuto).on("keypress", keypress).on("keydown", keydown).on("input", inputevent);
68421       var listWrap = selection2.append("div").attr("class", "inspector-body");
68422       var list2 = listWrap.append("div").attr("class", "feature-list");
68423       context.on("exit.feature-list", clearSearch);
68424       context.map().on("drawn.feature-list", mapDrawn);
68425       context.keybinding().on(uiCmd("\u2318F"), focusSearch);
68426       function focusSearch(d3_event) {
68427         var mode = context.mode() && context.mode().id;
68428         if (mode !== "browse") return;
68429         d3_event.preventDefault();
68430         search.node().focus();
68431       }
68432       function keydown(d3_event) {
68433         if (d3_event.keyCode === 27) {
68434           search.node().blur();
68435         }
68436       }
68437       function keypress(d3_event) {
68438         var q2 = search.property("value"), items = list2.selectAll(".feature-list-item");
68439         if (d3_event.keyCode === 13 && // ↩ Return
68440         q2.length && items.size()) {
68441           click(d3_event, items.datum());
68442         }
68443       }
68444       function inputevent() {
68445         _geocodeResults = void 0;
68446         drawList();
68447       }
68448       function clearSearch() {
68449         search.property("value", "");
68450         drawList();
68451       }
68452       function mapDrawn(e3) {
68453         if (e3.full) {
68454           drawList();
68455         }
68456       }
68457       function features() {
68458         var graph = context.graph();
68459         var visibleCenter = context.map().extent().center();
68460         var q2 = search.property("value").toLowerCase().trim();
68461         if (!q2) return [];
68462         const locationMatch = sexagesimal.pair(q2.toUpperCase()) || dmsMatcher(q2);
68463         const coordResult = [];
68464         if (locationMatch) {
68465           const latLon = [Number(locationMatch[0]), Number(locationMatch[1])];
68466           const lonLat = [latLon[1], latLon[0]];
68467           const isLatLonValid = latLon[0] >= -90 && latLon[0] <= 90 && latLon[1] >= -180 && latLon[1] <= 180;
68468           let isLonLatValid = lonLat[0] >= -90 && lonLat[0] <= 90 && lonLat[1] >= -180 && lonLat[1] <= 180;
68469           isLonLatValid && (isLonLatValid = !q2.match(/[NSEW]/i));
68470           isLonLatValid && (isLonLatValid = !locationMatch[2]);
68471           isLonLatValid && (isLonLatValid = lonLat[0] !== lonLat[1]);
68472           if (isLatLonValid) {
68473             coordResult.push({
68474               id: latLon[0] + "/" + latLon[1],
68475               geometry: "point",
68476               type: _t("inspector.location"),
68477               name: dmsCoordinatePair([latLon[1], latLon[0]]),
68478               location: latLon,
68479               zoom: locationMatch[2]
68480             });
68481           }
68482           if (isLonLatValid) {
68483             coordResult.push({
68484               id: lonLat[0] + "/" + lonLat[1],
68485               geometry: "point",
68486               type: _t("inspector.location"),
68487               name: dmsCoordinatePair([lonLat[1], lonLat[0]]),
68488               location: lonLat
68489             });
68490           }
68491         }
68492         const idMatch = !locationMatch && q2.match(/(?:^|\W)(node|way|relation|note|[nwr])\W{0,2}0*([1-9]\d*)(?:\W|$)/i);
68493         const idResult = [];
68494         if (idMatch) {
68495           var elemType = idMatch[1] === "note" ? idMatch[1] : idMatch[1].charAt(0);
68496           var elemId = idMatch[2];
68497           idResult.push({
68498             id: elemType + elemId,
68499             geometry: elemType === "n" ? "point" : elemType === "w" ? "line" : elemType === "note" ? "note" : "relation",
68500             type: elemType === "n" ? _t("inspector.node") : elemType === "w" ? _t("inspector.way") : elemType === "note" ? _t("note.note") : _t("inspector.relation"),
68501             name: elemId
68502           });
68503         }
68504         var allEntities = graph.entities;
68505         const localResults = [];
68506         for (var id2 in allEntities) {
68507           var entity = allEntities[id2];
68508           if (!entity) continue;
68509           var name = utilDisplayName(entity) || "";
68510           if (name.toLowerCase().indexOf(q2) < 0) continue;
68511           var matched = _mainPresetIndex.match(entity, graph);
68512           var type2 = matched && matched.name() || utilDisplayType(entity.id);
68513           var extent = entity.extent(graph);
68514           var distance = extent ? geoSphericalDistance(visibleCenter, extent.center()) : 0;
68515           localResults.push({
68516             id: entity.id,
68517             entity,
68518             geometry: entity.geometry(graph),
68519             type: type2,
68520             name,
68521             distance
68522           });
68523           if (localResults.length > 100) break;
68524         }
68525         localResults.sort((a2, b2) => a2.distance - b2.distance);
68526         const geocodeResults = [];
68527         (_geocodeResults || []).forEach(function(d2) {
68528           if (d2.osm_type && d2.osm_id) {
68529             var id3 = osmEntity.id.fromOSM(d2.osm_type, d2.osm_id);
68530             var tags = {};
68531             tags[d2.class] = d2.type;
68532             var attrs = { id: id3, type: d2.osm_type, tags };
68533             if (d2.osm_type === "way") {
68534               attrs.nodes = ["a", "a"];
68535             }
68536             var tempEntity = osmEntity(attrs);
68537             var tempGraph = coreGraph([tempEntity]);
68538             var matched2 = _mainPresetIndex.match(tempEntity, tempGraph);
68539             var type3 = matched2 && matched2.name() || utilDisplayType(id3);
68540             geocodeResults.push({
68541               id: tempEntity.id,
68542               geometry: tempEntity.geometry(tempGraph),
68543               type: type3,
68544               name: d2.display_name,
68545               extent: new geoExtent(
68546                 [Number(d2.boundingbox[3]), Number(d2.boundingbox[0])],
68547                 [Number(d2.boundingbox[2]), Number(d2.boundingbox[1])]
68548               )
68549             });
68550           }
68551         });
68552         const extraResults = [];
68553         if (q2.match(/^[0-9]+$/)) {
68554           extraResults.push({
68555             id: "n" + q2,
68556             geometry: "point",
68557             type: _t("inspector.node"),
68558             name: q2
68559           });
68560           extraResults.push({
68561             id: "w" + q2,
68562             geometry: "line",
68563             type: _t("inspector.way"),
68564             name: q2
68565           });
68566           extraResults.push({
68567             id: "r" + q2,
68568             geometry: "relation",
68569             type: _t("inspector.relation"),
68570             name: q2
68571           });
68572           extraResults.push({
68573             id: "note" + q2,
68574             geometry: "note",
68575             type: _t("note.note"),
68576             name: q2
68577           });
68578         }
68579         return [...idResult, ...localResults, ...coordResult, ...geocodeResults, ...extraResults];
68580       }
68581       function drawList() {
68582         var value = search.property("value");
68583         var results = features();
68584         list2.classed("filtered", value.length);
68585         var resultsIndicator = list2.selectAll(".no-results-item").data([0]).enter().append("button").property("disabled", true).attr("class", "no-results-item").call(svgIcon("#iD-icon-alert", "pre-text"));
68586         resultsIndicator.append("span").attr("class", "entity-name");
68587         list2.selectAll(".no-results-item .entity-name").html("").call(_t.append("geocoder.no_results_worldwide"));
68588         if (services.geocoder) {
68589           list2.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"));
68590         }
68591         list2.selectAll(".no-results-item").style("display", value.length && !results.length ? "block" : "none");
68592         list2.selectAll(".geocode-item").style("display", value && _geocodeResults === void 0 ? "block" : "none");
68593         var items = list2.selectAll(".feature-list-item").data(results, function(d2) {
68594           return d2.id;
68595         });
68596         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);
68597         var label = enter.append("div").attr("class", "label");
68598         label.each(function(d2) {
68599           select_default2(this).call(svgIcon("#iD-icon-" + d2.geometry, "pre-text"));
68600         });
68601         label.append("span").attr("class", "entity-type").text(function(d2) {
68602           return d2.type;
68603         });
68604         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) {
68605           return d2.name;
68606         });
68607         enter.style("opacity", 0).transition().style("opacity", 1);
68608         items.exit().each((d2) => mouseout(void 0, d2)).remove();
68609         items.merge(enter).order();
68610       }
68611       function mouseover(d3_event, d2) {
68612         if (d2.location !== void 0) return;
68613         utilHighlightEntities([d2.id], true, context);
68614       }
68615       function mouseout(d3_event, d2) {
68616         if (d2.location !== void 0) return;
68617         utilHighlightEntities([d2.id], false, context);
68618       }
68619       function click(d3_event, d2) {
68620         d3_event.preventDefault();
68621         if (d2.location) {
68622           context.map().centerZoomEase([d2.location[1], d2.location[0]], d2.zoom || 19);
68623         } else if (d2.entity) {
68624           utilHighlightEntities([d2.id], false, context);
68625           context.enter(modeSelect(context, [d2.entity.id]));
68626           context.map().zoomToEase(d2.entity);
68627         } else if (d2.geometry === "note") {
68628           const noteId = d2.id.replace(/\D/g, "");
68629           context.moveToNote(noteId);
68630         } else {
68631           context.zoomToEntity(d2.id);
68632         }
68633       }
68634       function geocoderSearch() {
68635         services.geocoder.search(search.property("value"), function(err, resp) {
68636           _geocodeResults = resp || [];
68637           drawList();
68638         });
68639       }
68640     }
68641     return featureList;
68642   }
68643   var sexagesimal;
68644   var init_feature_list = __esm({
68645     "modules/ui/feature_list.js"() {
68646       "use strict";
68647       init_src5();
68648       sexagesimal = __toESM(require_sexagesimal());
68649       init_presets();
68650       init_localizer();
68651       init_units();
68652       init_graph();
68653       init_geo();
68654       init_geo2();
68655       init_select5();
68656       init_entity();
68657       init_tags();
68658       init_services();
68659       init_icon();
68660       init_cmd();
68661       init_util();
68662     }
68663   });
68664
68665   // modules/ui/sections/entity_issues.js
68666   var entity_issues_exports = {};
68667   __export(entity_issues_exports, {
68668     uiSectionEntityIssues: () => uiSectionEntityIssues
68669   });
68670   function uiSectionEntityIssues(context) {
68671     var preference = corePreferences("entity-issues.reference.expanded");
68672     var _expanded = preference === null ? true : preference === "true";
68673     var _entityIDs = [];
68674     var _issues = [];
68675     var _activeIssueID;
68676     var section = uiSection("entity-issues", context).shouldDisplay(function() {
68677       return _issues.length > 0;
68678     }).label(function() {
68679       return _t.append("inspector.title_count", { title: _t("issues.list_title"), count: _issues.length });
68680     }).disclosureContent(renderDisclosureContent);
68681     context.validator().on("validated.entity_issues", function() {
68682       reloadIssues();
68683       section.reRender();
68684     }).on("focusedIssue.entity_issues", function(issue) {
68685       makeActiveIssue(issue.id);
68686     });
68687     function reloadIssues() {
68688       _issues = context.validator().getSharedEntityIssues(_entityIDs, { includeDisabledRules: true });
68689     }
68690     function makeActiveIssue(issueID) {
68691       _activeIssueID = issueID;
68692       section.selection().selectAll(".issue-container").classed("active", function(d2) {
68693         return d2.id === _activeIssueID;
68694       });
68695     }
68696     function renderDisclosureContent(selection2) {
68697       selection2.classed("grouped-items-area", true);
68698       _activeIssueID = _issues.length > 0 ? _issues[0].id : null;
68699       var containers = selection2.selectAll(".issue-container").data(_issues, function(d2) {
68700         return d2.key;
68701       });
68702       containers.exit().remove();
68703       var containersEnter = containers.enter().append("div").attr("class", "issue-container");
68704       var itemsEnter = containersEnter.append("div").attr("class", function(d2) {
68705         return "issue severity-" + d2.severity;
68706       }).on("mouseover.highlight", function(d3_event, d2) {
68707         var ids = d2.entityIds.filter(function(e3) {
68708           return _entityIDs.indexOf(e3) === -1;
68709         });
68710         utilHighlightEntities(ids, true, context);
68711       }).on("mouseout.highlight", function(d3_event, d2) {
68712         var ids = d2.entityIds.filter(function(e3) {
68713           return _entityIDs.indexOf(e3) === -1;
68714         });
68715         utilHighlightEntities(ids, false, context);
68716       });
68717       var labelsEnter = itemsEnter.append("div").attr("class", "issue-label");
68718       var textEnter = labelsEnter.append("button").attr("class", "issue-text").on("click", function(d3_event, d2) {
68719         makeActiveIssue(d2.id);
68720         var extent = d2.extent(context.graph());
68721         if (extent) {
68722           var setZoom = Math.max(context.map().zoom(), 19);
68723           context.map().unobscuredCenterZoomEase(extent.center(), setZoom);
68724         }
68725       });
68726       textEnter.each(function(d2) {
68727         var iconName = "#iD-icon-" + (d2.severity === "warning" ? "alert" : "error");
68728         select_default2(this).call(svgIcon(iconName, "issue-icon"));
68729       });
68730       textEnter.append("span").attr("class", "issue-message");
68731       var infoButton = labelsEnter.append("button").attr("class", "issue-info-button").attr("title", _t("icons.information")).call(svgIcon("#iD-icon-inspect"));
68732       infoButton.on("click", function(d3_event) {
68733         d3_event.stopPropagation();
68734         d3_event.preventDefault();
68735         this.blur();
68736         var container = select_default2(this.parentNode.parentNode.parentNode);
68737         var info = container.selectAll(".issue-info");
68738         var isExpanded = info.classed("expanded");
68739         _expanded = !isExpanded;
68740         corePreferences("entity-issues.reference.expanded", _expanded);
68741         if (isExpanded) {
68742           info.transition().duration(200).style("max-height", "0px").style("opacity", "0").on("end", function() {
68743             info.classed("expanded", false);
68744           });
68745         } else {
68746           info.classed("expanded", true).transition().duration(200).style("max-height", "200px").style("opacity", "1").on("end", function() {
68747             info.style("max-height", null);
68748           });
68749         }
68750       });
68751       itemsEnter.append("ul").attr("class", "issue-fix-list");
68752       containersEnter.append("div").attr("class", "issue-info" + (_expanded ? " expanded" : "")).style("max-height", _expanded ? null : "0").style("opacity", _expanded ? "1" : "0").each(function(d2) {
68753         if (typeof d2.reference === "function") {
68754           select_default2(this).call(d2.reference);
68755         } else {
68756           select_default2(this).call(_t.append("inspector.no_documentation_key"));
68757         }
68758       });
68759       containers = containers.merge(containersEnter).classed("active", function(d2) {
68760         return d2.id === _activeIssueID;
68761       });
68762       containers.selectAll(".issue-message").text("").each(function(d2) {
68763         return d2.message(context)(select_default2(this));
68764       });
68765       var fixLists = containers.selectAll(".issue-fix-list");
68766       var fixes = fixLists.selectAll(".issue-fix-item").data(function(d2) {
68767         return d2.fixes ? d2.fixes(context) : [];
68768       }, function(fix) {
68769         return fix.id;
68770       });
68771       fixes.exit().remove();
68772       var fixesEnter = fixes.enter().append("li").attr("class", "issue-fix-item");
68773       var buttons = fixesEnter.append("button").on("click", function(d3_event, d2) {
68774         if (select_default2(this).attr("disabled") || !d2.onClick) return;
68775         if (d2.issue.dateLastRanFix && /* @__PURE__ */ new Date() - d2.issue.dateLastRanFix < 1e3) return;
68776         d2.issue.dateLastRanFix = /* @__PURE__ */ new Date();
68777         utilHighlightEntities(d2.issue.entityIds.concat(d2.entityIds), false, context);
68778         new Promise(function(resolve, reject) {
68779           d2.onClick(context, resolve, reject);
68780           if (d2.onClick.length <= 1) {
68781             resolve();
68782           }
68783         }).then(function() {
68784           context.validator().validate();
68785         });
68786       }).on("mouseover.highlight", function(d3_event, d2) {
68787         utilHighlightEntities(d2.entityIds, true, context);
68788       }).on("mouseout.highlight", function(d3_event, d2) {
68789         utilHighlightEntities(d2.entityIds, false, context);
68790       });
68791       buttons.each(function(d2) {
68792         var iconName = d2.icon || "iD-icon-wrench";
68793         if (iconName.startsWith("maki")) {
68794           iconName += "-15";
68795         }
68796         select_default2(this).call(svgIcon("#" + iconName, "fix-icon"));
68797       });
68798       buttons.append("span").attr("class", "fix-message").each(function(d2) {
68799         return d2.title(select_default2(this));
68800       });
68801       fixesEnter.merge(fixes).selectAll("button").classed("actionable", function(d2) {
68802         return d2.onClick;
68803       }).attr("disabled", function(d2) {
68804         return d2.onClick ? null : "true";
68805       }).attr("title", function(d2) {
68806         if (d2.disabledReason) {
68807           return d2.disabledReason;
68808         }
68809         return null;
68810       });
68811     }
68812     section.entityIDs = function(val) {
68813       if (!arguments.length) return _entityIDs;
68814       if (!_entityIDs || !val || !utilArrayIdentical(_entityIDs, val)) {
68815         _entityIDs = val;
68816         _activeIssueID = null;
68817         reloadIssues();
68818       }
68819       return section;
68820     };
68821     return section;
68822   }
68823   var init_entity_issues = __esm({
68824     "modules/ui/sections/entity_issues.js"() {
68825       "use strict";
68826       init_src5();
68827       init_preferences();
68828       init_icon();
68829       init_array3();
68830       init_localizer();
68831       init_util();
68832       init_section();
68833     }
68834   });
68835
68836   // modules/ui/preset_icon.js
68837   var preset_icon_exports = {};
68838   __export(preset_icon_exports, {
68839     uiPresetIcon: () => uiPresetIcon
68840   });
68841   function uiPresetIcon() {
68842     let _preset;
68843     let _geometry;
68844     function presetIcon(selection2) {
68845       selection2.each(render);
68846     }
68847     function getIcon(p2, geom) {
68848       if (p2.isFallback && p2.isFallback()) return geom === "vertex" ? "" : "iD-icon-" + p2.id;
68849       if (p2.icon) return p2.icon;
68850       if (geom === "line") return "iD-other-line";
68851       if (geom === "vertex") return "temaki-vertex";
68852       return "maki-marker-stroked";
68853     }
68854     function renderPointBorder(container, drawPoint) {
68855       let pointBorder = container.selectAll(".preset-icon-point-border").data(drawPoint ? [0] : []);
68856       pointBorder.exit().remove();
68857       let pointBorderEnter = pointBorder.enter();
68858       const w2 = 40;
68859       const h2 = 40;
68860       pointBorderEnter.append("svg").attr("class", "preset-icon-fill preset-icon-point-border").attr("width", w2).attr("height", h2).attr("viewBox", `0 0 ${w2} ${h2}`).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");
68861       pointBorder = pointBorderEnter.merge(pointBorder);
68862     }
68863     function renderCategoryBorder(container, category) {
68864       let categoryBorder = container.selectAll(".preset-icon-category-border").data(category ? [0] : []);
68865       categoryBorder.exit().remove();
68866       let categoryBorderEnter = categoryBorder.enter();
68867       const d2 = 60;
68868       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}`);
68869       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");
68870       categoryBorder = categoryBorderEnter.merge(categoryBorder);
68871       if (category) {
68872         categoryBorder.selectAll("path").attr("class", `area ${category.id}`);
68873       }
68874     }
68875     function renderCircleFill(container, drawVertex) {
68876       let vertexFill = container.selectAll(".preset-icon-fill-vertex").data(drawVertex ? [0] : []);
68877       vertexFill.exit().remove();
68878       let vertexFillEnter = vertexFill.enter();
68879       const w2 = 60;
68880       const h2 = 60;
68881       const d2 = 40;
68882       vertexFillEnter.append("svg").attr("class", "preset-icon-fill preset-icon-fill-vertex").attr("width", w2).attr("height", h2).attr("viewBox", `0 0 ${w2} ${h2}`).append("circle").attr("cx", w2 / 2).attr("cy", h2 / 2).attr("r", d2 / 2);
68883       vertexFill = vertexFillEnter.merge(vertexFill);
68884     }
68885     function renderSquareFill(container, drawArea, tagClasses) {
68886       let fill = container.selectAll(".preset-icon-fill-area").data(drawArea ? [0] : []);
68887       fill.exit().remove();
68888       let fillEnter = fill.enter();
68889       const d2 = 60;
68890       const w2 = d2;
68891       const h2 = d2;
68892       const l2 = d2 * 2 / 3;
68893       const c1 = (w2 - l2) / 2;
68894       const c2 = c1 + l2;
68895       fillEnter = fillEnter.append("svg").attr("class", "preset-icon-fill preset-icon-fill-area").attr("width", w2).attr("height", h2).attr("viewBox", `0 0 ${w2} ${h2}`);
68896       ["fill", "stroke"].forEach((klass) => {
68897         fillEnter.append("path").attr("d", `M${c1} ${c1} L${c1} ${c2} L${c2} ${c2} L${c2} ${c1} Z`).attr("class", `area ${klass}`);
68898       });
68899       const rVertex = 2.5;
68900       [[c1, c1], [c1, c2], [c2, c2], [c2, c1]].forEach((point) => {
68901         fillEnter.append("circle").attr("class", "vertex").attr("cx", point[0]).attr("cy", point[1]).attr("r", rVertex);
68902       });
68903       const rMidpoint = 1.25;
68904       [[c1, w2 / 2], [c2, w2 / 2], [h2 / 2, c1], [h2 / 2, c2]].forEach((point) => {
68905         fillEnter.append("circle").attr("class", "midpoint").attr("cx", point[0]).attr("cy", point[1]).attr("r", rMidpoint);
68906       });
68907       fill = fillEnter.merge(fill);
68908       fill.selectAll("path.stroke").attr("class", `area stroke ${tagClasses}`);
68909       fill.selectAll("path.fill").attr("class", `area fill ${tagClasses}`);
68910     }
68911     function renderLine(container, drawLine, tagClasses) {
68912       let line = container.selectAll(".preset-icon-line").data(drawLine ? [0] : []);
68913       line.exit().remove();
68914       let lineEnter = line.enter();
68915       const d2 = 60;
68916       const w2 = d2;
68917       const h2 = d2;
68918       const y2 = Math.round(d2 * 0.72);
68919       const l2 = Math.round(d2 * 0.6);
68920       const r2 = 2.5;
68921       const x12 = (w2 - l2) / 2;
68922       const x2 = x12 + l2;
68923       lineEnter = lineEnter.append("svg").attr("class", "preset-icon-line").attr("width", w2).attr("height", h2).attr("viewBox", `0 0 ${w2} ${h2}`);
68924       ["casing", "stroke"].forEach((klass) => {
68925         lineEnter.append("path").attr("d", `M${x12} ${y2} L${x2} ${y2}`).attr("class", `line ${klass}`);
68926       });
68927       [[x12 - 1, y2], [x2 + 1, y2]].forEach((point) => {
68928         lineEnter.append("circle").attr("class", "vertex").attr("cx", point[0]).attr("cy", point[1]).attr("r", r2);
68929       });
68930       line = lineEnter.merge(line);
68931       line.selectAll("path.stroke").attr("class", `line stroke ${tagClasses}`);
68932       line.selectAll("path.casing").attr("class", `line casing ${tagClasses}`);
68933     }
68934     function renderRoute(container, drawRoute, p2) {
68935       let route = container.selectAll(".preset-icon-route").data(drawRoute ? [0] : []);
68936       route.exit().remove();
68937       let routeEnter = route.enter();
68938       const d2 = 60;
68939       const w2 = d2;
68940       const h2 = d2;
68941       const y12 = Math.round(d2 * 0.8);
68942       const y2 = Math.round(d2 * 0.68);
68943       const l2 = Math.round(d2 * 0.6);
68944       const r2 = 2;
68945       const x12 = (w2 - l2) / 2;
68946       const x2 = x12 + l2 / 3;
68947       const x3 = x2 + l2 / 3;
68948       const x4 = x3 + l2 / 3;
68949       routeEnter = routeEnter.append("svg").attr("class", "preset-icon-route").attr("width", w2).attr("height", h2).attr("viewBox", `0 0 ${w2} ${h2}`);
68950       ["casing", "stroke"].forEach((klass) => {
68951         routeEnter.append("path").attr("d", `M${x12} ${y12} L${x2} ${y2}`).attr("class", `segment0 line ${klass}`);
68952         routeEnter.append("path").attr("d", `M${x2} ${y2} L${x3} ${y12}`).attr("class", `segment1 line ${klass}`);
68953         routeEnter.append("path").attr("d", `M${x3} ${y12} L${x4} ${y2}`).attr("class", `segment2 line ${klass}`);
68954       });
68955       [[x12, y12], [x2, y2], [x3, y12], [x4, y2]].forEach((point) => {
68956         routeEnter.append("circle").attr("class", "vertex").attr("cx", point[0]).attr("cy", point[1]).attr("r", r2);
68957       });
68958       route = routeEnter.merge(route);
68959       if (drawRoute) {
68960         let routeType = p2.tags.type === "waterway" ? "waterway" : p2.tags.route;
68961         const segmentPresetIDs = routeSegments[routeType];
68962         for (let i3 in segmentPresetIDs) {
68963           const segmentPreset = _mainPresetIndex.item(segmentPresetIDs[i3]);
68964           const segmentTagClasses = svgTagClasses().getClassesString(segmentPreset.tags, "");
68965           route.selectAll(`path.stroke.segment${i3}`).attr("class", `segment${i3} line stroke ${segmentTagClasses}`);
68966           route.selectAll(`path.casing.segment${i3}`).attr("class", `segment${i3} line casing ${segmentTagClasses}`);
68967         }
68968       }
68969     }
68970     function renderSvgIcon(container, picon, geom, isFramed, category, tagClasses) {
68971       const isMaki = picon && /^maki-/.test(picon);
68972       const isTemaki = picon && /^temaki-/.test(picon);
68973       const isFa = picon && /^fa[srb]-/.test(picon);
68974       const isR\u00F6ntgen = picon && /^roentgen-/.test(picon);
68975       const isiDIcon = picon && !(isMaki || isTemaki || isFa || isR\u00F6ntgen);
68976       let icon2 = container.selectAll(".preset-icon").data(picon ? [0] : []);
68977       icon2.exit().remove();
68978       icon2 = icon2.enter().append("div").attr("class", "preset-icon").call(svgIcon("")).merge(icon2);
68979       icon2.attr("class", "preset-icon " + (geom ? geom + "-geom" : "")).classed("category", category).classed("framed", isFramed).classed("preset-icon-iD", isiDIcon);
68980       icon2.selectAll("svg").attr("class", "icon " + picon + " " + (!isiDIcon && geom !== "line" ? "" : tagClasses));
68981       icon2.selectAll("use").attr("href", "#" + picon);
68982     }
68983     function renderImageIcon(container, imageURL) {
68984       let imageIcon = container.selectAll("img.image-icon").data(imageURL ? [0] : []);
68985       imageIcon.exit().remove();
68986       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);
68987       imageIcon.attr("src", imageURL);
68988     }
68989     const routeSegments = {
68990       bicycle: ["highway/cycleway", "highway/cycleway", "highway/cycleway"],
68991       bus: ["highway/unclassified", "highway/secondary", "highway/primary"],
68992       trolleybus: ["highway/unclassified", "highway/secondary", "highway/primary"],
68993       detour: ["highway/tertiary", "highway/residential", "highway/unclassified"],
68994       ferry: ["route/ferry", "route/ferry", "route/ferry"],
68995       foot: ["highway/footway", "highway/footway", "highway/footway"],
68996       hiking: ["highway/path", "highway/path", "highway/path"],
68997       horse: ["highway/bridleway", "highway/bridleway", "highway/bridleway"],
68998       light_rail: ["railway/light_rail", "railway/light_rail", "railway/light_rail"],
68999       monorail: ["railway/monorail", "railway/monorail", "railway/monorail"],
69000       mtb: ["highway/path", "highway/track", "highway/bridleway"],
69001       pipeline: ["man_made/pipeline", "man_made/pipeline", "man_made/pipeline"],
69002       piste: ["piste/downhill", "piste/hike", "piste/nordic"],
69003       power: ["power/line", "power/line", "power/line"],
69004       road: ["highway/secondary", "highway/primary", "highway/trunk"],
69005       subway: ["railway/subway", "railway/subway", "railway/subway"],
69006       train: ["railway/rail", "railway/rail", "railway/rail"],
69007       tram: ["railway/tram", "railway/tram", "railway/tram"],
69008       railway: ["railway/rail", "railway/rail", "railway/rail"],
69009       waterway: ["waterway/stream", "waterway/stream", "waterway/stream"]
69010     };
69011     function render() {
69012       let p2 = _preset.apply(this, arguments);
69013       let geom = _geometry ? _geometry.apply(this, arguments) : null;
69014       if (geom === "relation" && p2.tags && (p2.tags.type === "route" && p2.tags.route && routeSegments[p2.tags.route] || p2.tags.type === "waterway")) {
69015         geom = "route";
69016       }
69017       const showThirdPartyIcons = corePreferences("preferences.privacy.thirdpartyicons") || "true";
69018       const isFallback = p2.isFallback && p2.isFallback();
69019       const imageURL = showThirdPartyIcons === "true" && p2.imageURL;
69020       const picon = getIcon(p2, geom);
69021       const isCategory = !p2.setTags;
69022       const drawPoint = false;
69023       const drawVertex = picon !== null && geom === "vertex";
69024       const drawLine = picon && geom === "line" && !isFallback && !isCategory;
69025       const drawArea = picon && geom === "area" && !isFallback && !isCategory;
69026       const drawRoute = picon && geom === "route";
69027       const isFramed = drawVertex || drawArea || drawLine || drawRoute || isCategory;
69028       let tags = !isCategory ? p2.setTags({}, geom) : {};
69029       for (let k2 in tags) {
69030         if (tags[k2] === "*") {
69031           tags[k2] = "yes";
69032         }
69033       }
69034       let tagClasses = svgTagClasses().getClassesString(tags, "");
69035       let selection2 = select_default2(this);
69036       let container = selection2.selectAll(".preset-icon-container").data([0]);
69037       container = container.enter().append("div").attr("class", "preset-icon-container").merge(container);
69038       container.classed("showing-img", !!imageURL).classed("fallback", isFallback);
69039       renderCategoryBorder(container, isCategory && p2);
69040       renderPointBorder(container, drawPoint);
69041       renderCircleFill(container, drawVertex);
69042       renderSquareFill(container, drawArea, tagClasses);
69043       renderLine(container, drawLine, tagClasses);
69044       renderRoute(container, drawRoute, p2);
69045       renderSvgIcon(container, picon, geom, isFramed, isCategory, tagClasses);
69046       renderImageIcon(container, imageURL);
69047     }
69048     presetIcon.preset = function(val) {
69049       if (!arguments.length) return _preset;
69050       _preset = utilFunctor(val);
69051       return presetIcon;
69052     };
69053     presetIcon.geometry = function(val) {
69054       if (!arguments.length) return _geometry;
69055       _geometry = utilFunctor(val);
69056       return presetIcon;
69057     };
69058     return presetIcon;
69059   }
69060   var init_preset_icon = __esm({
69061     "modules/ui/preset_icon.js"() {
69062       "use strict";
69063       init_src5();
69064       init_presets();
69065       init_preferences();
69066       init_svg();
69067       init_util();
69068     }
69069   });
69070
69071   // modules/ui/sections/feature_type.js
69072   var feature_type_exports = {};
69073   __export(feature_type_exports, {
69074     uiSectionFeatureType: () => uiSectionFeatureType
69075   });
69076   function uiSectionFeatureType(context) {
69077     var dispatch14 = dispatch_default("choose");
69078     var _entityIDs = [];
69079     var _presets = [];
69080     var _tagReference;
69081     var section = uiSection("feature-type", context).label(() => _t.append("inspector.feature_type")).disclosureContent(renderDisclosureContent);
69082     function renderDisclosureContent(selection2) {
69083       selection2.classed("preset-list-item", true);
69084       selection2.classed("mixed-types", _presets.length > 1);
69085       var presetButtonWrap = selection2.selectAll(".preset-list-button-wrap").data([0]).enter().append("div").attr("class", "preset-list-button-wrap");
69086       var presetButton = presetButtonWrap.append("button").attr("class", "preset-list-button preset-reset").call(
69087         uiTooltip().title(() => _t.append("inspector.back_tooltip")).placement("bottom")
69088       );
69089       presetButton.append("div").attr("class", "preset-icon-container");
69090       presetButton.append("div").attr("class", "label").append("div").attr("class", "label-inner");
69091       presetButtonWrap.append("div").attr("class", "accessory-buttons");
69092       var tagReferenceBodyWrap = selection2.selectAll(".tag-reference-body-wrap").data([0]);
69093       tagReferenceBodyWrap = tagReferenceBodyWrap.enter().append("div").attr("class", "tag-reference-body-wrap").merge(tagReferenceBodyWrap);
69094       if (_tagReference) {
69095         selection2.selectAll(".preset-list-button-wrap .accessory-buttons").style("display", _presets.length === 1 ? null : "none").call(_tagReference.button);
69096         tagReferenceBodyWrap.style("display", _presets.length === 1 ? null : "none").call(_tagReference.body);
69097       }
69098       selection2.selectAll(".preset-reset").on("click", function() {
69099         dispatch14.call("choose", this, _presets);
69100       }).on("pointerdown pointerup mousedown mouseup", function(d3_event) {
69101         d3_event.preventDefault();
69102         d3_event.stopPropagation();
69103       });
69104       var geometries = entityGeometries();
69105       selection2.select(".preset-list-item button").call(
69106         uiPresetIcon().geometry(_presets.length === 1 ? geometries.length === 1 && geometries[0] : null).preset(_presets.length === 1 ? _presets[0] : _mainPresetIndex.item("point"))
69107       );
69108       var names = _presets.length === 1 ? [
69109         _presets[0].nameLabel(),
69110         _presets[0].subtitleLabel()
69111       ].filter(Boolean) : [_t.append("inspector.multiple_types")];
69112       var label = selection2.select(".label-inner");
69113       var nameparts = label.selectAll(".namepart").data(names, (d2) => d2.stringId);
69114       nameparts.exit().remove();
69115       nameparts.enter().append("div").attr("class", "namepart").text("").each(function(d2) {
69116         d2(select_default2(this));
69117       });
69118     }
69119     section.entityIDs = function(val) {
69120       if (!arguments.length) return _entityIDs;
69121       _entityIDs = val;
69122       return section;
69123     };
69124     section.presets = function(val) {
69125       if (!arguments.length) return _presets;
69126       if (!utilArrayIdentical(val, _presets)) {
69127         _presets = val;
69128         if (_presets.length === 1) {
69129           _tagReference = uiTagReference(_presets[0].reference(), context).showing(false);
69130         }
69131       }
69132       return section;
69133     };
69134     function entityGeometries() {
69135       var counts = {};
69136       for (var i3 in _entityIDs) {
69137         var geometry = context.graph().geometry(_entityIDs[i3]);
69138         if (!counts[geometry]) counts[geometry] = 0;
69139         counts[geometry] += 1;
69140       }
69141       return Object.keys(counts).sort(function(geom1, geom2) {
69142         return counts[geom2] - counts[geom1];
69143       });
69144     }
69145     return utilRebind(section, dispatch14, "on");
69146   }
69147   var init_feature_type = __esm({
69148     "modules/ui/sections/feature_type.js"() {
69149       "use strict";
69150       init_src4();
69151       init_src5();
69152       init_presets();
69153       init_array3();
69154       init_localizer();
69155       init_tooltip();
69156       init_util();
69157       init_preset_icon();
69158       init_section();
69159       init_tag_reference();
69160     }
69161   });
69162
69163   // modules/ui/form_fields.js
69164   var form_fields_exports = {};
69165   __export(form_fields_exports, {
69166     uiFormFields: () => uiFormFields
69167   });
69168   function uiFormFields(context) {
69169     var moreCombo = uiCombobox(context, "more-fields").minItems(1);
69170     var _fieldsArr = [];
69171     var _lastPlaceholder = "";
69172     var _state = "";
69173     var _klass = "";
69174     function formFields(selection2) {
69175       var allowedFields = _fieldsArr.filter(function(field) {
69176         return field.isAllowed();
69177       });
69178       var shown = allowedFields.filter(function(field) {
69179         return field.isShown();
69180       });
69181       var notShown = allowedFields.filter(function(field) {
69182         return !field.isShown();
69183       }).sort(function(a2, b2) {
69184         return a2.universal === b2.universal ? 0 : a2.universal ? 1 : -1;
69185       });
69186       var container = selection2.selectAll(".form-fields-container").data([0]);
69187       container = container.enter().append("div").attr("class", "form-fields-container " + (_klass || "")).merge(container);
69188       var fields = container.selectAll(".wrap-form-field").data(shown, function(d2) {
69189         return d2.id + (d2.entityIDs ? d2.entityIDs.join() : "");
69190       });
69191       fields.exit().remove();
69192       var enter = fields.enter().append("div").attr("class", function(d2) {
69193         return "wrap-form-field wrap-form-field-" + d2.safeid;
69194       });
69195       fields = fields.merge(enter);
69196       fields.order().each(function(d2) {
69197         select_default2(this).call(d2.render);
69198       });
69199       var titles = [];
69200       var moreFields = notShown.map(function(field) {
69201         var title = field.title();
69202         titles.push(title);
69203         var terms = field.terms();
69204         if (field.key) terms.push(field.key);
69205         if (field.keys) terms = terms.concat(field.keys);
69206         return {
69207           display: field.label(),
69208           value: title,
69209           title,
69210           field,
69211           terms
69212         };
69213       });
69214       var placeholder = titles.slice(0, 3).join(", ") + (titles.length > 3 ? "\u2026" : "");
69215       var more = selection2.selectAll(".more-fields").data(_state === "hover" || moreFields.length === 0 ? [] : [0]);
69216       more.exit().remove();
69217       var moreEnter = more.enter().append("div").attr("class", "more-fields").append("label");
69218       moreEnter.append("span").call(_t.append("inspector.add_fields"));
69219       more = moreEnter.merge(more);
69220       var input = more.selectAll(".value").data([0]);
69221       input.exit().remove();
69222       input = input.enter().append("input").attr("class", "value").attr("type", "text").attr("placeholder", placeholder).call(utilNoAuto).merge(input);
69223       input.call(utilGetSetValue, "").call(
69224         moreCombo.data(moreFields).on("accept", function(d2) {
69225           if (!d2) return;
69226           var field = d2.field;
69227           field.show();
69228           selection2.call(formFields);
69229           field.focus();
69230         })
69231       );
69232       if (_lastPlaceholder !== placeholder) {
69233         input.attr("placeholder", placeholder);
69234         _lastPlaceholder = placeholder;
69235       }
69236     }
69237     formFields.fieldsArr = function(val) {
69238       if (!arguments.length) return _fieldsArr;
69239       _fieldsArr = val || [];
69240       return formFields;
69241     };
69242     formFields.state = function(val) {
69243       if (!arguments.length) return _state;
69244       _state = val;
69245       return formFields;
69246     };
69247     formFields.klass = function(val) {
69248       if (!arguments.length) return _klass;
69249       _klass = val;
69250       return formFields;
69251     };
69252     return formFields;
69253   }
69254   var init_form_fields = __esm({
69255     "modules/ui/form_fields.js"() {
69256       "use strict";
69257       init_src5();
69258       init_localizer();
69259       init_combobox();
69260       init_util();
69261     }
69262   });
69263
69264   // modules/ui/sections/preset_fields.js
69265   var preset_fields_exports = {};
69266   __export(preset_fields_exports, {
69267     uiSectionPresetFields: () => uiSectionPresetFields
69268   });
69269   function uiSectionPresetFields(context) {
69270     var section = uiSection("preset-fields", context).label(() => _t.append("inspector.fields")).disclosureContent(renderDisclosureContent);
69271     var dispatch14 = dispatch_default("change", "revert");
69272     var formFields = uiFormFields(context);
69273     var _state;
69274     var _fieldsArr;
69275     var _presets = [];
69276     var _tags;
69277     var _entityIDs;
69278     function renderDisclosureContent(selection2) {
69279       if (!_fieldsArr) {
69280         var graph = context.graph();
69281         var geometries = Object.keys(_entityIDs.reduce(function(geoms, entityID) {
69282           geoms[graph.entity(entityID).geometry(graph)] = true;
69283           return geoms;
69284         }, {}));
69285         const loc = _entityIDs.reduce(function(extent, entityID) {
69286           var entity = context.graph().entity(entityID);
69287           return extent.extend(entity.extent(context.graph()));
69288         }, geoExtent()).center();
69289         var presetsManager = _mainPresetIndex;
69290         var allFields = [];
69291         var allMoreFields = [];
69292         var sharedTotalFields;
69293         _presets.forEach(function(preset) {
69294           var fields = preset.fields(loc);
69295           var moreFields = preset.moreFields(loc);
69296           allFields = utilArrayUnion(allFields, fields);
69297           allMoreFields = utilArrayUnion(allMoreFields, moreFields);
69298           if (!sharedTotalFields) {
69299             sharedTotalFields = utilArrayUnion(fields, moreFields);
69300           } else {
69301             sharedTotalFields = sharedTotalFields.filter(function(field) {
69302               return fields.indexOf(field) !== -1 || moreFields.indexOf(field) !== -1;
69303             });
69304           }
69305         });
69306         var sharedFields = allFields.filter(function(field) {
69307           return sharedTotalFields.indexOf(field) !== -1;
69308         });
69309         var sharedMoreFields = allMoreFields.filter(function(field) {
69310           return sharedTotalFields.indexOf(field) !== -1;
69311         });
69312         _fieldsArr = [];
69313         sharedFields.forEach(function(field) {
69314           if (field.matchAllGeometry(geometries)) {
69315             _fieldsArr.push(
69316               uiField(context, field, _entityIDs)
69317             );
69318           }
69319         });
69320         var singularEntity = _entityIDs.length === 1 && graph.hasEntity(_entityIDs[0]);
69321         if (singularEntity && singularEntity.type === "node" && singularEntity.isHighwayIntersection(graph) && presetsManager.field("restrictions")) {
69322           _fieldsArr.push(
69323             uiField(context, presetsManager.field("restrictions"), _entityIDs)
69324           );
69325         }
69326         var additionalFields = utilArrayUnion(sharedMoreFields, presetsManager.universal());
69327         additionalFields.sort(function(field1, field2) {
69328           return field1.title().localeCompare(field2.title(), _mainLocalizer.localeCode());
69329         });
69330         additionalFields.forEach(function(field) {
69331           if (sharedFields.indexOf(field) === -1 && field.matchAllGeometry(geometries)) {
69332             _fieldsArr.push(
69333               uiField(context, field, _entityIDs, { show: false })
69334             );
69335           }
69336         });
69337         _fieldsArr.forEach(function(field) {
69338           field.on("change", function(t2, onInput) {
69339             dispatch14.call("change", field, _entityIDs, t2, onInput);
69340           }).on("revert", function(keys2) {
69341             dispatch14.call("revert", field, keys2);
69342           });
69343         });
69344       }
69345       _fieldsArr.forEach(function(field) {
69346         field.state(_state).tags(_tags);
69347       });
69348       selection2.call(
69349         formFields.fieldsArr(_fieldsArr).state(_state).klass("grouped-items-area")
69350       );
69351     }
69352     section.presets = function(val) {
69353       if (!arguments.length) return _presets;
69354       if (!_presets || !val || !utilArrayIdentical(_presets, val)) {
69355         _presets = val;
69356         _fieldsArr = null;
69357       }
69358       return section;
69359     };
69360     section.state = function(val) {
69361       if (!arguments.length) return _state;
69362       _state = val;
69363       return section;
69364     };
69365     section.tags = function(val) {
69366       if (!arguments.length) return _tags;
69367       _tags = val;
69368       return section;
69369     };
69370     section.entityIDs = function(val) {
69371       if (!arguments.length) return _entityIDs;
69372       if (!val || !_entityIDs || !utilArrayIdentical(_entityIDs, val)) {
69373         _entityIDs = val;
69374         _fieldsArr = null;
69375       }
69376       return section;
69377     };
69378     return utilRebind(section, dispatch14, "on");
69379   }
69380   var init_preset_fields = __esm({
69381     "modules/ui/sections/preset_fields.js"() {
69382       "use strict";
69383       init_src4();
69384       init_presets();
69385       init_localizer();
69386       init_array3();
69387       init_util();
69388       init_extent();
69389       init_field2();
69390       init_form_fields();
69391       init_section();
69392     }
69393   });
69394
69395   // modules/ui/sections/raw_member_editor.js
69396   var raw_member_editor_exports = {};
69397   __export(raw_member_editor_exports, {
69398     uiSectionRawMemberEditor: () => uiSectionRawMemberEditor
69399   });
69400   function uiSectionRawMemberEditor(context) {
69401     var section = uiSection("raw-member-editor", context).shouldDisplay(function() {
69402       if (!_entityIDs || _entityIDs.length !== 1) return false;
69403       var entity = context.hasEntity(_entityIDs[0]);
69404       return entity && entity.type === "relation";
69405     }).label(function() {
69406       var entity = context.hasEntity(_entityIDs[0]);
69407       if (!entity) return "";
69408       var gt2 = entity.members.length > _maxMembers ? ">" : "";
69409       var count = gt2 + entity.members.slice(0, _maxMembers).length;
69410       return _t.append("inspector.title_count", { title: _t("inspector.members"), count });
69411     }).disclosureContent(renderDisclosureContent);
69412     var taginfo = services.taginfo;
69413     var _entityIDs;
69414     var _maxMembers = 1e3;
69415     function downloadMember(d3_event, d2) {
69416       d3_event.preventDefault();
69417       select_default2(this).classed("loading", true);
69418       context.loadEntity(d2.id, function() {
69419         section.reRender();
69420       });
69421     }
69422     function zoomToMember(d3_event, d2) {
69423       d3_event.preventDefault();
69424       var entity = context.entity(d2.id);
69425       context.map().zoomToEase(entity);
69426       utilHighlightEntities([d2.id], true, context);
69427     }
69428     function selectMember(d3_event, d2) {
69429       d3_event.preventDefault();
69430       utilHighlightEntities([d2.id], false, context);
69431       var entity = context.entity(d2.id);
69432       var mapExtent = context.map().extent();
69433       if (!entity.intersects(mapExtent, context.graph())) {
69434         context.map().zoomToEase(entity);
69435       }
69436       context.enter(modeSelect(context, [d2.id]));
69437     }
69438     function changeRole(d3_event, d2) {
69439       var oldRole = d2.role;
69440       var newRole = context.cleanRelationRole(select_default2(this).property("value"));
69441       if (oldRole !== newRole) {
69442         var member = { id: d2.id, type: d2.type, role: newRole };
69443         context.perform(
69444           actionChangeMember(d2.relation.id, member, d2.index),
69445           _t("operations.change_role.annotation", {
69446             n: 1
69447           })
69448         );
69449         context.validator().validate();
69450       }
69451     }
69452     function deleteMember(d3_event, d2) {
69453       utilHighlightEntities([d2.id], false, context);
69454       context.perform(
69455         actionDeleteMember(d2.relation.id, d2.index),
69456         _t("operations.delete_member.annotation", {
69457           n: 1
69458         })
69459       );
69460       if (!context.hasEntity(d2.relation.id)) {
69461         context.enter(modeBrowse(context));
69462       } else {
69463         context.validator().validate();
69464       }
69465     }
69466     function renderDisclosureContent(selection2) {
69467       var entityID = _entityIDs[0];
69468       var memberships = [];
69469       var entity = context.entity(entityID);
69470       entity.members.slice(0, _maxMembers).forEach(function(member, index) {
69471         memberships.push({
69472           index,
69473           id: member.id,
69474           type: member.type,
69475           role: member.role,
69476           relation: entity,
69477           member: context.hasEntity(member.id),
69478           domId: utilUniqueDomId(entityID + "-member-" + index)
69479         });
69480       });
69481       var list2 = selection2.selectAll(".member-list").data([0]);
69482       list2 = list2.enter().append("ul").attr("class", "member-list").merge(list2);
69483       var items = list2.selectAll("li").data(memberships, function(d2) {
69484         return osmEntity.key(d2.relation) + "," + d2.index + "," + (d2.member ? osmEntity.key(d2.member) : "incomplete");
69485       });
69486       items.exit().each(unbind).remove();
69487       var itemsEnter = items.enter().append("li").attr("class", "member-row form-field").classed("member-incomplete", function(d2) {
69488         return !d2.member;
69489       });
69490       itemsEnter.each(function(d2) {
69491         var item = select_default2(this);
69492         var label = item.append("label").attr("class", "field-label").attr("for", d2.domId);
69493         if (d2.member) {
69494           item.on("mouseover", function() {
69495             utilHighlightEntities([d2.id], true, context);
69496           }).on("mouseout", function() {
69497             utilHighlightEntities([d2.id], false, context);
69498           });
69499           var labelLink = label.append("span").attr("class", "label-text").append("a").attr("href", "#").on("click", selectMember);
69500           labelLink.append("span").attr("class", "member-entity-type").text(function(d4) {
69501             var matched = _mainPresetIndex.match(d4.member, context.graph());
69502             return matched && matched.name() || utilDisplayType(d4.member.id);
69503           });
69504           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) {
69505             return utilDisplayName(d4.member);
69506           });
69507           label.append("button").attr("title", _t("icons.remove")).attr("class", "remove member-delete").call(svgIcon("#iD-operation-delete"));
69508           label.append("button").attr("class", "member-zoom").attr("title", _t("icons.zoom_to")).call(svgIcon("#iD-icon-framed-dot", "monochrome")).on("click", zoomToMember);
69509         } else {
69510           var labelText = label.append("span").attr("class", "label-text");
69511           labelText.append("span").attr("class", "member-entity-type").call(_t.append("inspector." + d2.type, { id: d2.id }));
69512           labelText.append("span").attr("class", "member-entity-name").call(_t.append("inspector.incomplete", { id: d2.id }));
69513           label.append("button").attr("class", "member-download").attr("title", _t("icons.download")).call(svgIcon("#iD-icon-load")).on("click", downloadMember);
69514         }
69515       });
69516       var wrapEnter = itemsEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
69517       wrapEnter.append("input").attr("class", "member-role").attr("id", function(d2) {
69518         return d2.domId;
69519       }).property("type", "text").attr("placeholder", _t("inspector.role")).call(utilNoAuto);
69520       if (taginfo) {
69521         wrapEnter.each(bindTypeahead);
69522       }
69523       items = items.merge(itemsEnter).order();
69524       items.select("input.member-role").property("value", function(d2) {
69525         return d2.role;
69526       }).on("blur", changeRole).on("change", changeRole);
69527       items.select("button.member-delete").on("click", deleteMember);
69528       var dragOrigin, targetIndex;
69529       items.call(
69530         drag_default().on("start", function(d3_event) {
69531           dragOrigin = {
69532             x: d3_event.x,
69533             y: d3_event.y
69534           };
69535           targetIndex = null;
69536         }).on("drag", function(d3_event) {
69537           var x2 = d3_event.x - dragOrigin.x, y2 = d3_event.y - dragOrigin.y;
69538           if (!select_default2(this).classed("dragging") && // don't display drag until dragging beyond a distance threshold
69539           Math.sqrt(Math.pow(x2, 2) + Math.pow(y2, 2)) <= 5) return;
69540           var index = items.nodes().indexOf(this);
69541           select_default2(this).classed("dragging", true);
69542           targetIndex = null;
69543           selection2.selectAll("li.member-row").style("transform", function(d2, index2) {
69544             var node = select_default2(this).node();
69545             if (index === index2) {
69546               return "translate(" + x2 + "px, " + y2 + "px)";
69547             } else if (index2 > index && d3_event.y > node.offsetTop) {
69548               if (targetIndex === null || index2 > targetIndex) {
69549                 targetIndex = index2;
69550               }
69551               return "translateY(-100%)";
69552             } else if (index2 < index && d3_event.y < node.offsetTop + node.offsetHeight) {
69553               if (targetIndex === null || index2 < targetIndex) {
69554                 targetIndex = index2;
69555               }
69556               return "translateY(100%)";
69557             }
69558             return null;
69559           });
69560         }).on("end", function(d3_event, d2) {
69561           if (!select_default2(this).classed("dragging")) return;
69562           var index = items.nodes().indexOf(this);
69563           select_default2(this).classed("dragging", false);
69564           selection2.selectAll("li.member-row").style("transform", null);
69565           if (targetIndex !== null) {
69566             context.perform(
69567               actionMoveMember(d2.relation.id, index, targetIndex),
69568               _t("operations.reorder_members.annotation")
69569             );
69570             context.validator().validate();
69571           }
69572         })
69573       );
69574       function bindTypeahead(d2) {
69575         var row = select_default2(this);
69576         var role = row.selectAll("input.member-role");
69577         var origValue = role.property("value");
69578         function sort(value, data) {
69579           var sameletter = [];
69580           var other2 = [];
69581           for (var i3 = 0; i3 < data.length; i3++) {
69582             if (data[i3].value.substring(0, value.length) === value) {
69583               sameletter.push(data[i3]);
69584             } else {
69585               other2.push(data[i3]);
69586             }
69587           }
69588           return sameletter.concat(other2);
69589         }
69590         role.call(
69591           uiCombobox(context, "member-role").fetcher(function(role2, callback) {
69592             var geometry;
69593             if (d2.member) {
69594               geometry = context.graph().geometry(d2.member.id);
69595             } else if (d2.type === "relation") {
69596               geometry = "relation";
69597             } else if (d2.type === "way") {
69598               geometry = "line";
69599             } else {
69600               geometry = "point";
69601             }
69602             var rtype = entity.tags.type;
69603             taginfo.roles({
69604               debounce: true,
69605               rtype: rtype || "",
69606               geometry,
69607               query: role2
69608             }, function(err, data) {
69609               if (!err) callback(sort(role2, data));
69610             });
69611           }).on("cancel", function() {
69612             role.property("value", origValue);
69613           })
69614         );
69615       }
69616       function unbind() {
69617         var row = select_default2(this);
69618         row.selectAll("input.member-role").call(uiCombobox.off, context);
69619       }
69620     }
69621     section.entityIDs = function(val) {
69622       if (!arguments.length) return _entityIDs;
69623       _entityIDs = val;
69624       return section;
69625     };
69626     return section;
69627   }
69628   var init_raw_member_editor = __esm({
69629     "modules/ui/sections/raw_member_editor.js"() {
69630       "use strict";
69631       init_src6();
69632       init_src5();
69633       init_presets();
69634       init_localizer();
69635       init_change_member();
69636       init_delete_member();
69637       init_move_member();
69638       init_browse();
69639       init_select5();
69640       init_osm();
69641       init_tags();
69642       init_icon();
69643       init_services();
69644       init_combobox();
69645       init_section();
69646       init_util();
69647     }
69648   });
69649
69650   // modules/ui/sections/raw_membership_editor.js
69651   var raw_membership_editor_exports = {};
69652   __export(raw_membership_editor_exports, {
69653     uiSectionRawMembershipEditor: () => uiSectionRawMembershipEditor
69654   });
69655   function uiSectionRawMembershipEditor(context) {
69656     var section = uiSection("raw-membership-editor", context).shouldDisplay(function() {
69657       return _entityIDs && _entityIDs.length;
69658     }).label(function() {
69659       var parents = getSharedParentRelations();
69660       var gt2 = parents.length > _maxMemberships ? ">" : "";
69661       var count = gt2 + parents.slice(0, _maxMemberships).length;
69662       return _t.append("inspector.title_count", { title: _t("inspector.relations"), count });
69663     }).disclosureContent(renderDisclosureContent);
69664     var taginfo = services.taginfo;
69665     var nearbyCombo = uiCombobox(context, "parent-relation").minItems(1).fetcher(fetchNearbyRelations).itemsMouseEnter(function(d3_event, d2) {
69666       if (d2.relation) utilHighlightEntities([d2.relation.id], true, context);
69667     }).itemsMouseLeave(function(d3_event, d2) {
69668       if (d2.relation) utilHighlightEntities([d2.relation.id], false, context);
69669     });
69670     var _inChange = false;
69671     var _entityIDs = [];
69672     var _showBlank;
69673     var _maxMemberships = 1e3;
69674     const recentlyAdded = /* @__PURE__ */ new Set();
69675     function getSharedParentRelations() {
69676       var parents = [];
69677       for (var i3 = 0; i3 < _entityIDs.length; i3++) {
69678         var entity = context.graph().hasEntity(_entityIDs[i3]);
69679         if (!entity) continue;
69680         if (i3 === 0) {
69681           parents = context.graph().parentRelations(entity);
69682         } else {
69683           parents = utilArrayIntersection(parents, context.graph().parentRelations(entity));
69684         }
69685         if (!parents.length) break;
69686       }
69687       return parents;
69688     }
69689     function getMemberships() {
69690       var memberships = [];
69691       var relations = getSharedParentRelations().slice(0, _maxMemberships);
69692       var isMultiselect = _entityIDs.length > 1;
69693       var i3, relation, membership, index, member, indexedMember;
69694       for (i3 = 0; i3 < relations.length; i3++) {
69695         relation = relations[i3];
69696         membership = {
69697           relation,
69698           members: [],
69699           hash: osmEntity.key(relation)
69700         };
69701         for (index = 0; index < relation.members.length; index++) {
69702           member = relation.members[index];
69703           if (_entityIDs.indexOf(member.id) !== -1) {
69704             indexedMember = Object.assign({}, member, { index });
69705             membership.members.push(indexedMember);
69706             membership.hash += "," + index.toString();
69707             if (!isMultiselect) {
69708               memberships.push(membership);
69709               membership = {
69710                 relation,
69711                 members: [],
69712                 hash: osmEntity.key(relation)
69713               };
69714             }
69715           }
69716         }
69717         if (membership.members.length) memberships.push(membership);
69718       }
69719       memberships.forEach(function(membership2) {
69720         membership2.domId = utilUniqueDomId("membership-" + membership2.relation.id);
69721         var roles = [];
69722         membership2.members.forEach(function(member2) {
69723           if (roles.indexOf(member2.role) === -1) roles.push(member2.role);
69724         });
69725         membership2.role = roles.length === 1 ? roles[0] : roles;
69726       });
69727       const existingRelations = memberships.filter((membership2) => !recentlyAdded.has(membership2.relation.id)).map((membership2) => ({
69728         ...membership2,
69729         // We only sort relations that were not added just now.
69730         // Sorting uses the same label as shown in the UI.
69731         // If the label is not unique, the relation ID ensures
69732         // that the sort order is still stable.
69733         _sortKey: [
69734           baseDisplayValue(membership2.relation),
69735           membership2.relation.id
69736         ].join("-")
69737       })).sort((a2, b2) => {
69738         return a2._sortKey.localeCompare(
69739           b2._sortKey,
69740           _mainLocalizer.localeCodes(),
69741           { numeric: true }
69742         );
69743       });
69744       const newlyAddedRelations = memberships.filter((membership2) => recentlyAdded.has(membership2.relation.id));
69745       return [
69746         // the sorted relations come first
69747         ...existingRelations,
69748         // then the ones that were just added from this panel
69749         ...newlyAddedRelations
69750       ];
69751     }
69752     function selectRelation(d3_event, d2) {
69753       d3_event.preventDefault();
69754       utilHighlightEntities([d2.relation.id], false, context);
69755       context.enter(modeSelect(context, [d2.relation.id]));
69756     }
69757     function zoomToRelation(d3_event, d2) {
69758       d3_event.preventDefault();
69759       var entity = context.entity(d2.relation.id);
69760       context.map().zoomToEase(entity);
69761       utilHighlightEntities([d2.relation.id], true, context);
69762     }
69763     function changeRole(d3_event, d2) {
69764       if (d2 === 0) return;
69765       if (_inChange) return;
69766       var newRole = context.cleanRelationRole(select_default2(this).property("value"));
69767       if (!newRole.trim() && typeof d2.role !== "string") return;
69768       var membersToUpdate = d2.members.filter(function(member) {
69769         return member.role !== newRole;
69770       });
69771       if (membersToUpdate.length) {
69772         _inChange = true;
69773         context.perform(
69774           function actionChangeMemberRoles(graph) {
69775             membersToUpdate.forEach(function(member) {
69776               var newMember = Object.assign({}, member, { role: newRole });
69777               delete newMember.index;
69778               graph = actionChangeMember(d2.relation.id, newMember, member.index)(graph);
69779             });
69780             return graph;
69781           },
69782           _t("operations.change_role.annotation", {
69783             n: membersToUpdate.length
69784           })
69785         );
69786         context.validator().validate();
69787       }
69788       _inChange = false;
69789     }
69790     function addMembership(d2, role) {
69791       _showBlank = false;
69792       function actionAddMembers(relationId, ids, role2) {
69793         return function(graph) {
69794           for (var i3 in ids) {
69795             var member = { id: ids[i3], type: graph.entity(ids[i3]).type, role: role2 };
69796             graph = actionAddMember(relationId, member)(graph);
69797           }
69798           return graph;
69799         };
69800       }
69801       if (d2.relation) {
69802         recentlyAdded.add(d2.relation.id);
69803         context.perform(
69804           actionAddMembers(d2.relation.id, _entityIDs, role),
69805           _t("operations.add_member.annotation", {
69806             n: _entityIDs.length
69807           })
69808         );
69809         context.validator().validate();
69810       } else {
69811         var relation = osmRelation();
69812         context.perform(
69813           actionAddEntity(relation),
69814           actionAddMembers(relation.id, _entityIDs, role),
69815           _t("operations.add.annotation.relation")
69816         );
69817         context.enter(modeSelect(context, [relation.id]).newFeature(true));
69818       }
69819     }
69820     function downloadMembers(d3_event, d2) {
69821       d3_event.preventDefault();
69822       const button = select_default2(this);
69823       button.classed("loading", true);
69824       context.loadEntity(d2.relation.id, function() {
69825         section.reRender();
69826       });
69827     }
69828     function deleteMembership(d3_event, d2) {
69829       this.blur();
69830       if (d2 === 0) return;
69831       utilHighlightEntities([d2.relation.id], false, context);
69832       var indexes = d2.members.map(function(member) {
69833         return member.index;
69834       });
69835       context.perform(
69836         actionDeleteMembers(d2.relation.id, indexes),
69837         _t("operations.delete_member.annotation", {
69838           n: _entityIDs.length
69839         })
69840       );
69841       context.validator().validate();
69842     }
69843     function fetchNearbyRelations(q2, callback) {
69844       var newRelation = {
69845         relation: null,
69846         value: _t("inspector.new_relation"),
69847         display: _t.append("inspector.new_relation")
69848       };
69849       var entityID = _entityIDs[0];
69850       var result = [];
69851       var graph = context.graph();
69852       function baseDisplayLabel(entity) {
69853         var matched = _mainPresetIndex.match(entity, graph);
69854         var presetName = matched && matched.name() || _t("inspector.relation");
69855         var entityName = utilDisplayName(entity) || "";
69856         return (selection2) => {
69857           selection2.append("b").text(presetName + " ");
69858           selection2.append("span").classed("has-colour", entity.tags.colour && isColourValid(entity.tags.colour)).style("border-color", entity.tags.colour).text(entityName);
69859         };
69860       }
69861       var explicitRelation = q2 && context.hasEntity(q2.toLowerCase());
69862       if (explicitRelation && explicitRelation.type === "relation" && explicitRelation.id !== entityID) {
69863         result.push({
69864           relation: explicitRelation,
69865           value: baseDisplayValue(explicitRelation) + " " + explicitRelation.id,
69866           display: baseDisplayLabel(explicitRelation)
69867         });
69868       } else {
69869         context.history().intersects(context.map().extent()).forEach(function(entity) {
69870           if (entity.type !== "relation" || entity.id === entityID) return;
69871           var value = baseDisplayValue(entity);
69872           if (q2 && (value + " " + entity.id).toLowerCase().indexOf(q2.toLowerCase()) === -1) return;
69873           result.push({
69874             relation: entity,
69875             value,
69876             display: baseDisplayLabel(entity)
69877           });
69878         });
69879         result.sort(function(a2, b2) {
69880           return osmRelation.creationOrder(a2.relation, b2.relation);
69881         });
69882         var dupeGroups = Object.values(utilArrayGroupBy(result, "value")).filter(function(v2) {
69883           return v2.length > 1;
69884         });
69885         dupeGroups.forEach(function(group) {
69886           group.forEach(function(obj) {
69887             obj.value += " " + obj.relation.id;
69888           });
69889         });
69890       }
69891       result.forEach(function(obj) {
69892         obj.title = obj.value;
69893       });
69894       result.unshift(newRelation);
69895       callback(result);
69896     }
69897     function baseDisplayValue(entity) {
69898       const graph = context.graph();
69899       var matched = _mainPresetIndex.match(entity, graph);
69900       var presetName = matched && matched.name() || _t("inspector.relation");
69901       var entityName = utilDisplayName(entity) || "";
69902       return presetName + " " + entityName;
69903     }
69904     function renderDisclosureContent(selection2) {
69905       var memberships = getMemberships();
69906       var list2 = selection2.selectAll(".member-list").data([0]);
69907       list2 = list2.enter().append("ul").attr("class", "member-list").merge(list2);
69908       var items = list2.selectAll("li.member-row-normal").data(memberships, function(d2) {
69909         return d2.hash;
69910       });
69911       items.exit().each(unbind).remove();
69912       var itemsEnter = items.enter().append("li").attr("class", "member-row member-row-normal form-field");
69913       itemsEnter.on("mouseover", function(d3_event, d2) {
69914         utilHighlightEntities([d2.relation.id], true, context);
69915       }).on("mouseout", function(d3_event, d2) {
69916         utilHighlightEntities([d2.relation.id], false, context);
69917       });
69918       var labelEnter = itemsEnter.append("label").attr("class", "field-label").attr("for", function(d2) {
69919         return d2.domId;
69920       });
69921       var labelLink = labelEnter.append("span").attr("class", "label-text").append("a").attr("href", "#").on("click", selectRelation);
69922       labelLink.append("span").attr("class", "member-entity-type").text(function(d2) {
69923         var matched = _mainPresetIndex.match(d2.relation, context.graph());
69924         return matched && matched.name() || _t.html("inspector.relation");
69925       });
69926       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).html(function(d2) {
69927         const matched = _mainPresetIndex.match(d2.relation, context.graph());
69928         return utilDisplayName(d2.relation, matched.suggestion);
69929       });
69930       labelEnter.append("button").attr("class", "members-download").attr("title", _t("icons.download")).call(svgIcon("#iD-icon-load")).on("click", downloadMembers);
69931       labelEnter.append("button").attr("class", "remove member-delete").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete")).on("click", deleteMembership);
69932       labelEnter.append("button").attr("class", "member-zoom").attr("title", _t("icons.zoom_to")).call(svgIcon("#iD-icon-framed-dot", "monochrome")).on("click", zoomToRelation);
69933       items = items.merge(itemsEnter);
69934       items.selectAll("button.members-download").classed("hide", (d2) => {
69935         const graph = context.graph();
69936         return d2.relation.members.every((m2) => graph.hasEntity(m2.id));
69937       });
69938       var wrapEnter = itemsEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
69939       wrapEnter.append("input").attr("class", "member-role").attr("id", function(d2) {
69940         return d2.domId;
69941       }).property("type", "text").property("value", function(d2) {
69942         return typeof d2.role === "string" ? d2.role : "";
69943       }).attr("title", function(d2) {
69944         return Array.isArray(d2.role) ? d2.role.filter(Boolean).join("\n") : d2.role;
69945       }).attr("placeholder", function(d2) {
69946         return Array.isArray(d2.role) ? _t("inspector.multiple_roles") : _t("inspector.role");
69947       }).classed("mixed", function(d2) {
69948         return Array.isArray(d2.role);
69949       }).call(utilNoAuto).on("blur", changeRole).on("change", changeRole);
69950       if (taginfo) {
69951         wrapEnter.each(bindTypeahead);
69952       }
69953       var newMembership = list2.selectAll(".member-row-new").data(_showBlank ? [0] : []);
69954       newMembership.exit().remove();
69955       var newMembershipEnter = newMembership.enter().append("li").attr("class", "member-row member-row-new form-field");
69956       var newLabelEnter = newMembershipEnter.append("label").attr("class", "field-label");
69957       newLabelEnter.append("input").attr("placeholder", _t("inspector.choose_relation")).attr("type", "text").attr("class", "member-entity-input").call(utilNoAuto);
69958       newLabelEnter.append("button").attr("class", "remove member-delete").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete")).on("click", function() {
69959         list2.selectAll(".member-row-new").remove();
69960       });
69961       var newWrapEnter = newMembershipEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
69962       newWrapEnter.append("input").attr("class", "member-role").property("type", "text").attr("placeholder", _t("inspector.role")).call(utilNoAuto);
69963       newMembership = newMembership.merge(newMembershipEnter);
69964       newMembership.selectAll(".member-entity-input").on("blur", cancelEntity).call(
69965         nearbyCombo.on("accept", function(d2) {
69966           this.blur();
69967           acceptEntity.call(this, d2);
69968         }).on("cancel", cancelEntity)
69969       );
69970       var addRow = selection2.selectAll(".add-row").data([0]);
69971       var addRowEnter = addRow.enter().append("div").attr("class", "add-row");
69972       var addRelationButton = addRowEnter.append("button").attr("class", "add-relation").attr("aria-label", _t("inspector.add_to_relation"));
69973       addRelationButton.call(svgIcon("#iD-icon-plus", "light"));
69974       addRelationButton.call(uiTooltip().title(() => _t.append("inspector.add_to_relation")).placement(_mainLocalizer.textDirection() === "ltr" ? "right" : "left"));
69975       addRowEnter.append("div").attr("class", "space-value");
69976       addRowEnter.append("div").attr("class", "space-buttons");
69977       addRow = addRow.merge(addRowEnter);
69978       addRow.select(".add-relation").on("click", function() {
69979         _showBlank = true;
69980         section.reRender();
69981         list2.selectAll(".member-entity-input").node().focus();
69982       });
69983       function acceptEntity(d2) {
69984         if (!d2) {
69985           cancelEntity();
69986           return;
69987         }
69988         if (d2.relation) utilHighlightEntities([d2.relation.id], false, context);
69989         var role = context.cleanRelationRole(list2.selectAll(".member-row-new .member-role").property("value"));
69990         addMembership(d2, role);
69991       }
69992       function cancelEntity() {
69993         var input = newMembership.selectAll(".member-entity-input");
69994         input.property("value", "");
69995         context.surface().selectAll(".highlighted").classed("highlighted", false);
69996       }
69997       function bindTypeahead(d2) {
69998         var row = select_default2(this);
69999         var role = row.selectAll("input.member-role");
70000         var origValue = role.property("value");
70001         function sort(value, data) {
70002           var sameletter = [];
70003           var other2 = [];
70004           for (var i3 = 0; i3 < data.length; i3++) {
70005             if (data[i3].value.substring(0, value.length) === value) {
70006               sameletter.push(data[i3]);
70007             } else {
70008               other2.push(data[i3]);
70009             }
70010           }
70011           return sameletter.concat(other2);
70012         }
70013         role.call(
70014           uiCombobox(context, "member-role").fetcher(function(role2, callback) {
70015             var rtype = d2.relation.tags.type;
70016             taginfo.roles({
70017               debounce: true,
70018               rtype: rtype || "",
70019               geometry: context.graph().geometry(_entityIDs[0]),
70020               query: role2
70021             }, function(err, data) {
70022               if (!err) callback(sort(role2, data));
70023             });
70024           }).on("cancel", function() {
70025             role.property("value", origValue);
70026           })
70027         );
70028       }
70029       function unbind() {
70030         var row = select_default2(this);
70031         row.selectAll("input.member-role").call(uiCombobox.off, context);
70032       }
70033     }
70034     section.entityIDs = function(val) {
70035       if (!arguments.length) return _entityIDs;
70036       const didChange = _entityIDs.join(",") !== val.join(",");
70037       _entityIDs = val;
70038       _showBlank = false;
70039       if (didChange) {
70040         recentlyAdded.clear();
70041       }
70042       return section;
70043     };
70044     return section;
70045   }
70046   var init_raw_membership_editor = __esm({
70047     "modules/ui/sections/raw_membership_editor.js"() {
70048       "use strict";
70049       init_src5();
70050       init_presets();
70051       init_localizer();
70052       init_add_entity();
70053       init_add_member();
70054       init_change_member();
70055       init_delete_members();
70056       init_select5();
70057       init_osm();
70058       init_tags();
70059       init_services();
70060       init_icon();
70061       init_combobox();
70062       init_section();
70063       init_tooltip();
70064       init_array3();
70065       init_util();
70066     }
70067   });
70068
70069   // modules/ui/sections/selection_list.js
70070   var selection_list_exports = {};
70071   __export(selection_list_exports, {
70072     uiSectionSelectionList: () => uiSectionSelectionList
70073   });
70074   function uiSectionSelectionList(context) {
70075     var _selectedIDs = [];
70076     var section = uiSection("selected-features", context).shouldDisplay(function() {
70077       return _selectedIDs.length > 1;
70078     }).label(function() {
70079       return _t.append("inspector.title_count", { title: _t("inspector.features"), count: _selectedIDs.length });
70080     }).disclosureContent(renderDisclosureContent);
70081     context.history().on("change.selectionList", function(difference2) {
70082       if (difference2) {
70083         section.reRender();
70084       }
70085     });
70086     section.entityIDs = function(val) {
70087       if (!arguments.length) return _selectedIDs;
70088       _selectedIDs = val;
70089       return section;
70090     };
70091     function selectEntity(d3_event, entity) {
70092       context.enter(modeSelect(context, [entity.id]));
70093     }
70094     function deselectEntity(d3_event, entity) {
70095       var selectedIDs = _selectedIDs.slice();
70096       var index = selectedIDs.indexOf(entity.id);
70097       if (index > -1) {
70098         selectedIDs.splice(index, 1);
70099         context.enter(modeSelect(context, selectedIDs));
70100       }
70101     }
70102     function renderDisclosureContent(selection2) {
70103       var list2 = selection2.selectAll(".feature-list").data([0]);
70104       list2 = list2.enter().append("ul").attr("class", "feature-list").merge(list2);
70105       var entities = _selectedIDs.map(function(id2) {
70106         return context.hasEntity(id2);
70107       }).filter(Boolean);
70108       var items = list2.selectAll(".feature-list-item").data(entities, osmEntity.key);
70109       items.exit().remove();
70110       var enter = items.enter().append("li").attr("class", "feature-list-item").each(function(d2) {
70111         select_default2(this).on("mouseover", function() {
70112           utilHighlightEntities([d2.id], true, context);
70113         }).on("mouseout", function() {
70114           utilHighlightEntities([d2.id], false, context);
70115         });
70116       });
70117       var label = enter.append("button").attr("class", "label").on("click", selectEntity);
70118       label.append("span").attr("class", "entity-geom-icon").call(svgIcon("", "pre-text"));
70119       label.append("span").attr("class", "entity-type");
70120       label.append("span").attr("class", "entity-name");
70121       enter.append("button").attr("class", "close").attr("title", _t("icons.deselect")).on("click", deselectEntity).call(svgIcon("#iD-icon-close"));
70122       items = items.merge(enter);
70123       items.selectAll(".entity-geom-icon use").attr("href", function() {
70124         var entity = this.parentNode.parentNode.__data__;
70125         return "#iD-icon-" + entity.geometry(context.graph());
70126       });
70127       items.selectAll(".entity-type").text(function(entity) {
70128         return _mainPresetIndex.match(entity, context.graph()).name();
70129       });
70130       items.selectAll(".entity-name").text(function(d2) {
70131         var entity = context.entity(d2.id);
70132         return utilDisplayName(entity);
70133       });
70134     }
70135     return section;
70136   }
70137   var init_selection_list = __esm({
70138     "modules/ui/sections/selection_list.js"() {
70139       "use strict";
70140       init_src5();
70141       init_presets();
70142       init_select5();
70143       init_osm();
70144       init_icon();
70145       init_section();
70146       init_localizer();
70147       init_util();
70148     }
70149   });
70150
70151   // modules/ui/entity_editor.js
70152   var entity_editor_exports = {};
70153   __export(entity_editor_exports, {
70154     uiEntityEditor: () => uiEntityEditor
70155   });
70156   function uiEntityEditor(context) {
70157     var dispatch14 = dispatch_default("choose");
70158     var _state = "select";
70159     var _coalesceChanges = false;
70160     var _modified = false;
70161     var _base;
70162     var _entityIDs;
70163     var _activePresets = [];
70164     var _newFeature;
70165     var _sections;
70166     function entityEditor(selection2) {
70167       var combinedTags = utilCombinedTags(_entityIDs, context.graph());
70168       var header = selection2.selectAll(".header").data([0]);
70169       var headerEnter = header.enter().append("div").attr("class", "header fillL");
70170       var direction = _mainLocalizer.textDirection() === "rtl" ? "forward" : "backward";
70171       headerEnter.append("button").attr("class", "preset-reset preset-choose").attr("title", _t("inspector.back_tooltip")).call(svgIcon(`#iD-icon-${direction}`));
70172       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
70173         context.enter(modeBrowse(context));
70174       }).call(svgIcon(_modified ? "#iD-icon-apply" : "#iD-icon-close"));
70175       headerEnter.append("h2");
70176       header = header.merge(headerEnter);
70177       header.selectAll("h2").text("").call(_entityIDs.length === 1 ? _t.append("inspector.edit") : _t.append("inspector.edit_features"));
70178       header.selectAll(".preset-reset").on("click", function() {
70179         dispatch14.call("choose", this, _activePresets);
70180       });
70181       var body = selection2.selectAll(".inspector-body").data([0]);
70182       var bodyEnter = body.enter().append("div").attr("class", "entity-editor inspector-body sep-top");
70183       body = body.merge(bodyEnter);
70184       if (!_sections) {
70185         _sections = [
70186           uiSectionSelectionList(context),
70187           uiSectionFeatureType(context).on("choose", function(presets) {
70188             dispatch14.call("choose", this, presets);
70189           }),
70190           uiSectionEntityIssues(context),
70191           uiSectionPresetFields(context).on("change", changeTags).on("revert", revertTags),
70192           uiSectionRawTagEditor("raw-tag-editor", context).on("change", changeTags),
70193           uiSectionRawMemberEditor(context),
70194           uiSectionRawMembershipEditor(context)
70195         ];
70196       }
70197       _sections.forEach(function(section) {
70198         if (section.entityIDs) {
70199           section.entityIDs(_entityIDs);
70200         }
70201         if (section.presets) {
70202           section.presets(_activePresets);
70203         }
70204         if (section.tags) {
70205           section.tags(combinedTags);
70206         }
70207         if (section.state) {
70208           section.state(_state);
70209         }
70210         body.call(section.render);
70211       });
70212       context.history().on("change.entity-editor", historyChanged);
70213       function historyChanged(difference2) {
70214         if (selection2.selectAll(".entity-editor").empty()) return;
70215         if (_state === "hide") return;
70216         var significant = !difference2 || difference2.didChange.properties || difference2.didChange.addition || difference2.didChange.deletion;
70217         if (!significant) return;
70218         _entityIDs = _entityIDs.filter(context.hasEntity);
70219         if (!_entityIDs.length) return;
70220         var priorActivePreset = _activePresets.length === 1 && _activePresets[0];
70221         loadActivePresets();
70222         var graph = context.graph();
70223         entityEditor.modified(_base !== graph);
70224         entityEditor(selection2);
70225         if (priorActivePreset && _activePresets.length === 1 && priorActivePreset !== _activePresets[0]) {
70226           context.container().selectAll(".entity-editor button.preset-reset .label").style("background-color", "#fff").transition().duration(750).style("background-color", null);
70227         }
70228       }
70229     }
70230     function changeTags(entityIDs, changed, onInput) {
70231       var actions = [];
70232       for (var i3 in entityIDs) {
70233         var entityID = entityIDs[i3];
70234         var entity = context.entity(entityID);
70235         var tags = Object.assign({}, entity.tags);
70236         if (typeof changed === "function") {
70237           tags = changed(tags);
70238         } else {
70239           for (var k2 in changed) {
70240             if (!k2) continue;
70241             var v2 = changed[k2];
70242             if (typeof v2 === "object") {
70243               tags[k2] = tags[v2.oldKey];
70244             } else if (v2 !== void 0 || tags.hasOwnProperty(k2)) {
70245               tags[k2] = v2;
70246             }
70247           }
70248         }
70249         if (!onInput) {
70250           tags = utilCleanTags(tags);
70251         }
70252         if (!(0, import_fast_deep_equal9.default)(entity.tags, tags)) {
70253           actions.push(actionChangeTags(entityID, tags));
70254         }
70255       }
70256       if (actions.length) {
70257         var combinedAction = function(graph) {
70258           actions.forEach(function(action) {
70259             graph = action(graph);
70260           });
70261           return graph;
70262         };
70263         var annotation = _t("operations.change_tags.annotation");
70264         if (_coalesceChanges) {
70265           context.overwrite(combinedAction, annotation);
70266         } else {
70267           context.perform(combinedAction, annotation);
70268           _coalesceChanges = !!onInput;
70269         }
70270       }
70271       if (!onInput) {
70272         context.validator().validate();
70273       }
70274     }
70275     function revertTags(keys2) {
70276       var actions = [];
70277       for (var i3 in _entityIDs) {
70278         var entityID = _entityIDs[i3];
70279         var original = context.graph().base().entities[entityID];
70280         var changed = {};
70281         for (var j2 in keys2) {
70282           var key = keys2[j2];
70283           changed[key] = original ? original.tags[key] : void 0;
70284         }
70285         var entity = context.entity(entityID);
70286         var tags = Object.assign({}, entity.tags);
70287         for (var k2 in changed) {
70288           if (!k2) continue;
70289           var v2 = changed[k2];
70290           if (v2 !== void 0 || tags.hasOwnProperty(k2)) {
70291             tags[k2] = v2;
70292           }
70293         }
70294         tags = utilCleanTags(tags);
70295         if (!(0, import_fast_deep_equal9.default)(entity.tags, tags)) {
70296           actions.push(actionChangeTags(entityID, tags));
70297         }
70298       }
70299       if (actions.length) {
70300         var combinedAction = function(graph) {
70301           actions.forEach(function(action) {
70302             graph = action(graph);
70303           });
70304           return graph;
70305         };
70306         var annotation = _t("operations.change_tags.annotation");
70307         if (_coalesceChanges) {
70308           context.overwrite(combinedAction, annotation);
70309         } else {
70310           context.perform(combinedAction, annotation);
70311           _coalesceChanges = false;
70312         }
70313       }
70314       context.validator().validate();
70315     }
70316     entityEditor.modified = function(val) {
70317       if (!arguments.length) return _modified;
70318       _modified = val;
70319       return entityEditor;
70320     };
70321     entityEditor.state = function(val) {
70322       if (!arguments.length) return _state;
70323       _state = val;
70324       return entityEditor;
70325     };
70326     entityEditor.entityIDs = function(val) {
70327       if (!arguments.length) return _entityIDs;
70328       _base = context.graph();
70329       _coalesceChanges = false;
70330       if (val && _entityIDs && utilArrayIdentical(_entityIDs, val)) return entityEditor;
70331       _entityIDs = val;
70332       loadActivePresets(true);
70333       return entityEditor.modified(false);
70334     };
70335     entityEditor.newFeature = function(val) {
70336       if (!arguments.length) return _newFeature;
70337       _newFeature = val;
70338       return entityEditor;
70339     };
70340     function loadActivePresets(isForNewSelection) {
70341       var graph = context.graph();
70342       var counts = {};
70343       for (var i3 in _entityIDs) {
70344         var entity = graph.hasEntity(_entityIDs[i3]);
70345         if (!entity) return;
70346         var match = _mainPresetIndex.match(entity, graph);
70347         if (!counts[match.id]) counts[match.id] = 0;
70348         counts[match.id] += 1;
70349       }
70350       var matches = Object.keys(counts).sort(function(p1, p2) {
70351         return counts[p2] - counts[p1];
70352       }).map(function(pID) {
70353         return _mainPresetIndex.item(pID);
70354       });
70355       if (!isForNewSelection) {
70356         var weakPreset = _activePresets.length === 1 && !_activePresets[0].isFallback() && Object.keys(_activePresets[0].addTags || {}).length === 0;
70357         if (weakPreset && matches.length === 1 && matches[0].isFallback()) return;
70358       }
70359       entityEditor.presets(matches);
70360     }
70361     entityEditor.presets = function(val) {
70362       if (!arguments.length) return _activePresets;
70363       if (!utilArrayIdentical(val, _activePresets)) {
70364         _activePresets = val;
70365       }
70366       return entityEditor;
70367     };
70368     return utilRebind(entityEditor, dispatch14, "on");
70369   }
70370   var import_fast_deep_equal9;
70371   var init_entity_editor = __esm({
70372     "modules/ui/entity_editor.js"() {
70373       "use strict";
70374       init_src4();
70375       import_fast_deep_equal9 = __toESM(require_fast_deep_equal());
70376       init_presets();
70377       init_localizer();
70378       init_change_tags();
70379       init_browse();
70380       init_icon();
70381       init_array3();
70382       init_util();
70383       init_entity_issues();
70384       init_feature_type();
70385       init_preset_fields();
70386       init_raw_member_editor();
70387       init_raw_membership_editor();
70388       init_raw_tag_editor();
70389       init_selection_list();
70390     }
70391   });
70392
70393   // modules/ui/preset_list.js
70394   var preset_list_exports = {};
70395   __export(preset_list_exports, {
70396     uiPresetList: () => uiPresetList
70397   });
70398   function uiPresetList(context) {
70399     var dispatch14 = dispatch_default("cancel", "choose");
70400     var _entityIDs;
70401     var _currLoc;
70402     var _currentPresets;
70403     var _autofocus = false;
70404     function presetList(selection2) {
70405       if (!_entityIDs) return;
70406       var presets = _mainPresetIndex.matchAllGeometry(entityGeometries());
70407       selection2.html("");
70408       var messagewrap = selection2.append("div").attr("class", "header fillL");
70409       var message = messagewrap.append("h2").call(_t.append("inspector.choose"));
70410       messagewrap.append("button").attr("class", "preset-choose").attr("title", _entityIDs.length === 1 ? _t("inspector.edit") : _t("inspector.edit_features")).on("click", function() {
70411         dispatch14.call("cancel", this);
70412       }).call(svgIcon("#iD-icon-close"));
70413       function initialKeydown(d3_event) {
70414         if (search.property("value").length === 0 && (d3_event.keyCode === utilKeybinding.keyCodes["\u232B"] || d3_event.keyCode === utilKeybinding.keyCodes["\u2326"])) {
70415           d3_event.preventDefault();
70416           d3_event.stopPropagation();
70417           operationDelete(context, _entityIDs)();
70418         } else if (search.property("value").length === 0 && (d3_event.ctrlKey || d3_event.metaKey) && d3_event.keyCode === utilKeybinding.keyCodes.z) {
70419           d3_event.preventDefault();
70420           d3_event.stopPropagation();
70421           context.undo();
70422         } else if (!d3_event.ctrlKey && !d3_event.metaKey) {
70423           select_default2(this).on("keydown", keydown);
70424           keydown.call(this, d3_event);
70425         }
70426       }
70427       function keydown(d3_event) {
70428         if (d3_event.keyCode === utilKeybinding.keyCodes["\u2193"] && // if insertion point is at the end of the string
70429         search.node().selectionStart === search.property("value").length) {
70430           d3_event.preventDefault();
70431           d3_event.stopPropagation();
70432           var buttons = list2.selectAll(".preset-list-button");
70433           if (!buttons.empty()) buttons.nodes()[0].focus();
70434         }
70435       }
70436       function keypress(d3_event) {
70437         var value = search.property("value");
70438         if (d3_event.keyCode === 13 && // ↩ Return
70439         value.length) {
70440           list2.selectAll(".preset-list-item:first-child").each(function(d2) {
70441             d2.choose.call(this);
70442           });
70443         }
70444       }
70445       function inputevent() {
70446         var value = search.property("value");
70447         list2.classed("filtered", value.length);
70448         var results, messageText;
70449         if (value.length) {
70450           results = presets.search(value, entityGeometries()[0], _currLoc);
70451           messageText = _t.html("inspector.results", {
70452             n: results.collection.length,
70453             search: value
70454           });
70455         } else {
70456           var entityPresets2 = _entityIDs.map((entityID) => _mainPresetIndex.match(context.graph().entity(entityID), context.graph()));
70457           results = _mainPresetIndex.defaults(entityGeometries()[0], 36, !context.inIntro(), _currLoc, entityPresets2);
70458           messageText = _t.html("inspector.choose");
70459         }
70460         list2.call(drawList, results);
70461         message.html(messageText);
70462       }
70463       var searchWrap = selection2.append("div").attr("class", "search-header");
70464       searchWrap.call(svgIcon("#iD-icon-search", "pre-text"));
70465       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));
70466       if (_autofocus) {
70467         search.node().focus();
70468         setTimeout(function() {
70469           search.node().focus();
70470         }, 0);
70471       }
70472       var listWrap = selection2.append("div").attr("class", "inspector-body");
70473       var entityPresets = _entityIDs.map((entityID) => _mainPresetIndex.match(context.graph().entity(entityID), context.graph()));
70474       var list2 = listWrap.append("div").attr("class", "preset-list").call(drawList, _mainPresetIndex.defaults(entityGeometries()[0], 36, !context.inIntro(), _currLoc, entityPresets));
70475       context.features().on("change.preset-list", updateForFeatureHiddenState);
70476     }
70477     function drawList(list2, presets) {
70478       presets = presets.matchAllGeometry(entityGeometries());
70479       var collection = presets.collection.reduce(function(collection2, preset) {
70480         if (!preset) return collection2;
70481         if (preset.members) {
70482           if (preset.members.collection.filter(function(preset2) {
70483             return preset2.addable();
70484           }).length > 1) {
70485             collection2.push(CategoryItem(preset));
70486           }
70487         } else if (preset.addable()) {
70488           collection2.push(PresetItem(preset));
70489         }
70490         return collection2;
70491       }, []);
70492       var items = list2.selectAll(".preset-list-item").data(collection, function(d2) {
70493         return d2.preset.id;
70494       });
70495       items.order();
70496       items.exit().remove();
70497       items.enter().append("div").attr("class", function(item) {
70498         return "preset-list-item preset-" + item.preset.id.replace("/", "-");
70499       }).classed("current", function(item) {
70500         return _currentPresets.indexOf(item.preset) !== -1;
70501       }).each(function(item) {
70502         select_default2(this).call(item);
70503       }).style("opacity", 0).transition().style("opacity", 1);
70504       updateForFeatureHiddenState();
70505     }
70506     function itemKeydown(d3_event) {
70507       var item = select_default2(this.closest(".preset-list-item"));
70508       var parentItem = select_default2(item.node().parentNode.closest(".preset-list-item"));
70509       if (d3_event.keyCode === utilKeybinding.keyCodes["\u2193"]) {
70510         d3_event.preventDefault();
70511         d3_event.stopPropagation();
70512         var nextItem = select_default2(item.node().nextElementSibling);
70513         if (nextItem.empty()) {
70514           if (!parentItem.empty()) {
70515             nextItem = select_default2(parentItem.node().nextElementSibling);
70516           }
70517         } else if (select_default2(this).classed("expanded")) {
70518           nextItem = item.select(".subgrid .preset-list-item:first-child");
70519         }
70520         if (!nextItem.empty()) {
70521           nextItem.select(".preset-list-button").node().focus();
70522         }
70523       } else if (d3_event.keyCode === utilKeybinding.keyCodes["\u2191"]) {
70524         d3_event.preventDefault();
70525         d3_event.stopPropagation();
70526         var previousItem = select_default2(item.node().previousElementSibling);
70527         if (previousItem.empty()) {
70528           if (!parentItem.empty()) {
70529             previousItem = parentItem;
70530           }
70531         } else if (previousItem.select(".preset-list-button").classed("expanded")) {
70532           previousItem = previousItem.select(".subgrid .preset-list-item:last-child");
70533         }
70534         if (!previousItem.empty()) {
70535           previousItem.select(".preset-list-button").node().focus();
70536         } else {
70537           var search = select_default2(this.closest(".preset-list-pane")).select(".preset-search-input");
70538           search.node().focus();
70539         }
70540       } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2192" : "\u2190"]) {
70541         d3_event.preventDefault();
70542         d3_event.stopPropagation();
70543         if (!parentItem.empty()) {
70544           parentItem.select(".preset-list-button").node().focus();
70545         }
70546       } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2190" : "\u2192"]) {
70547         d3_event.preventDefault();
70548         d3_event.stopPropagation();
70549         item.datum().choose.call(select_default2(this).node());
70550       }
70551     }
70552     function CategoryItem(preset) {
70553       var box, sublist, shown = false;
70554       function item(selection2) {
70555         var wrap2 = selection2.append("div").attr("class", "preset-list-button-wrap category");
70556         function click() {
70557           var isExpanded = select_default2(this).classed("expanded");
70558           var iconName = isExpanded ? _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward" : "#iD-icon-down";
70559           select_default2(this).classed("expanded", !isExpanded).attr("title", !isExpanded ? _t("icons.collapse") : _t("icons.expand"));
70560           select_default2(this).selectAll("div.label-inner svg.icon use").attr("href", iconName);
70561           item.choose();
70562         }
70563         var geometries = entityGeometries();
70564         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) {
70565           if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2190" : "\u2192"]) {
70566             d3_event.preventDefault();
70567             d3_event.stopPropagation();
70568             if (!select_default2(this).classed("expanded")) {
70569               click.call(this, d3_event);
70570             }
70571           } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2192" : "\u2190"]) {
70572             d3_event.preventDefault();
70573             d3_event.stopPropagation();
70574             if (select_default2(this).classed("expanded")) {
70575               click.call(this, d3_event);
70576             }
70577           } else {
70578             itemKeydown.call(this, d3_event);
70579           }
70580         });
70581         var label = button.append("div").attr("class", "label").append("div").attr("class", "label-inner");
70582         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");
70583         box = selection2.append("div").attr("class", "subgrid").style("max-height", "0px").style("opacity", 0);
70584         box.append("div").attr("class", "arrow");
70585         sublist = box.append("div").attr("class", "preset-list fillL3");
70586       }
70587       item.choose = function() {
70588         if (!box || !sublist) return;
70589         if (shown) {
70590           shown = false;
70591           box.transition().duration(200).style("opacity", "0").style("max-height", "0px").style("padding-bottom", "0px");
70592         } else {
70593           shown = true;
70594           var members = preset.members.matchAllGeometry(entityGeometries());
70595           sublist.call(drawList, members);
70596           box.transition().duration(200).style("opacity", "1").style("max-height", 200 + members.collection.length * 190 + "px").style("padding-bottom", "10px");
70597         }
70598       };
70599       item.preset = preset;
70600       return item;
70601     }
70602     function PresetItem(preset) {
70603       function item(selection2) {
70604         var wrap2 = selection2.append("div").attr("class", "preset-list-button-wrap");
70605         var geometries = entityGeometries();
70606         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);
70607         var label = button.append("div").attr("class", "label").append("div").attr("class", "label-inner");
70608         var nameparts = [
70609           preset.nameLabel(),
70610           preset.subtitleLabel()
70611         ].filter(Boolean);
70612         label.selectAll(".namepart").data(nameparts, (d2) => d2.stringId).enter().append("div").attr("class", "namepart").text("").each(function(d2) {
70613           d2(select_default2(this));
70614         });
70615         wrap2.call(item.reference.button);
70616         selection2.call(item.reference.body);
70617       }
70618       item.choose = function() {
70619         if (select_default2(this).classed("disabled")) return;
70620         if (!context.inIntro()) {
70621           _mainPresetIndex.setMostRecent(preset, entityGeometries()[0]);
70622         }
70623         context.perform(
70624           function(graph) {
70625             for (var i3 in _entityIDs) {
70626               var entityID = _entityIDs[i3];
70627               var oldPreset = _mainPresetIndex.match(graph.entity(entityID), graph);
70628               graph = actionChangePreset(entityID, oldPreset, preset)(graph);
70629             }
70630             return graph;
70631           },
70632           _t("operations.change_tags.annotation")
70633         );
70634         context.validator().validate();
70635         dispatch14.call("choose", this, preset);
70636       };
70637       item.help = function(d3_event) {
70638         d3_event.stopPropagation();
70639         item.reference.toggle();
70640       };
70641       item.preset = preset;
70642       item.reference = uiTagReference(preset.reference(), context);
70643       return item;
70644     }
70645     function updateForFeatureHiddenState() {
70646       if (!_entityIDs.every(context.hasEntity)) return;
70647       var geometries = entityGeometries();
70648       var button = context.container().selectAll(".preset-list .preset-list-button");
70649       button.call(uiTooltip().destroyAny);
70650       button.each(function(item, index) {
70651         var hiddenPresetFeaturesId;
70652         for (var i3 in geometries) {
70653           hiddenPresetFeaturesId = context.features().isHiddenPreset(item.preset, geometries[i3]);
70654           if (hiddenPresetFeaturesId) break;
70655         }
70656         var isHiddenPreset = !context.inIntro() && !!hiddenPresetFeaturesId && (_currentPresets.length !== 1 || item.preset !== _currentPresets[0]);
70657         select_default2(this).classed("disabled", isHiddenPreset);
70658         if (isHiddenPreset) {
70659           var isAutoHidden = context.features().autoHidden(hiddenPresetFeaturesId);
70660           select_default2(this).call(
70661             uiTooltip().title(() => _t.append("inspector.hidden_preset." + (isAutoHidden ? "zoom" : "manual"), {
70662               features: _t("feature." + hiddenPresetFeaturesId + ".description")
70663             })).placement(index < 2 ? "bottom" : "top")
70664           );
70665         }
70666       });
70667     }
70668     presetList.autofocus = function(val) {
70669       if (!arguments.length) return _autofocus;
70670       _autofocus = val;
70671       return presetList;
70672     };
70673     presetList.entityIDs = function(val) {
70674       if (!arguments.length) return _entityIDs;
70675       _entityIDs = val;
70676       _currLoc = null;
70677       if (_entityIDs && _entityIDs.length) {
70678         const extent = _entityIDs.reduce(function(extent2, entityID) {
70679           var entity = context.graph().entity(entityID);
70680           return extent2.extend(entity.extent(context.graph()));
70681         }, geoExtent());
70682         _currLoc = extent.center();
70683         var presets = _entityIDs.map(function(entityID) {
70684           return _mainPresetIndex.match(context.entity(entityID), context.graph());
70685         });
70686         presetList.presets(presets);
70687       }
70688       return presetList;
70689     };
70690     presetList.presets = function(val) {
70691       if (!arguments.length) return _currentPresets;
70692       _currentPresets = val;
70693       return presetList;
70694     };
70695     function entityGeometries() {
70696       var counts = {};
70697       for (var i3 in _entityIDs) {
70698         var entityID = _entityIDs[i3];
70699         var entity = context.entity(entityID);
70700         var geometry = entity.geometry(context.graph());
70701         if (geometry === "vertex" && entity.isOnAddressLine(context.graph())) {
70702           geometry = "point";
70703         }
70704         if (!counts[geometry]) counts[geometry] = 0;
70705         counts[geometry] += 1;
70706       }
70707       return Object.keys(counts).sort(function(geom1, geom2) {
70708         return counts[geom2] - counts[geom1];
70709       });
70710     }
70711     return utilRebind(presetList, dispatch14, "on");
70712   }
70713   var init_preset_list = __esm({
70714     "modules/ui/preset_list.js"() {
70715       "use strict";
70716       init_src4();
70717       init_src5();
70718       init_debounce();
70719       init_presets();
70720       init_localizer();
70721       init_change_preset();
70722       init_delete();
70723       init_svg();
70724       init_tooltip();
70725       init_extent();
70726       init_preset_icon();
70727       init_tag_reference();
70728       init_util();
70729     }
70730   });
70731
70732   // modules/ui/inspector.js
70733   var inspector_exports = {};
70734   __export(inspector_exports, {
70735     uiInspector: () => uiInspector
70736   });
70737   function uiInspector(context) {
70738     var presetList = uiPresetList(context);
70739     var entityEditor = uiEntityEditor(context);
70740     var wrap2 = select_default2(null), presetPane = select_default2(null), editorPane = select_default2(null);
70741     var _state = "select";
70742     var _entityIDs;
70743     var _newFeature = false;
70744     function inspector(selection2) {
70745       presetList.entityIDs(_entityIDs).autofocus(_newFeature).on("choose", inspector.setPreset).on("cancel", function() {
70746         inspector.setPreset();
70747       });
70748       entityEditor.state(_state).entityIDs(_entityIDs).on("choose", inspector.showList);
70749       wrap2 = selection2.selectAll(".panewrap").data([0]);
70750       var enter = wrap2.enter().append("div").attr("class", "panewrap");
70751       enter.append("div").attr("class", "preset-list-pane pane");
70752       enter.append("div").attr("class", "entity-editor-pane pane");
70753       wrap2 = wrap2.merge(enter);
70754       presetPane = wrap2.selectAll(".preset-list-pane");
70755       editorPane = wrap2.selectAll(".entity-editor-pane");
70756       function shouldDefaultToPresetList() {
70757         if (_state !== "select") return false;
70758         if (_entityIDs.length !== 1) return false;
70759         var entityID = _entityIDs[0];
70760         var entity = context.hasEntity(entityID);
70761         if (!entity) return false;
70762         if (entity.hasNonGeometryTags()) return false;
70763         if (_newFeature) return true;
70764         if (entity.geometry(context.graph()) !== "vertex") return false;
70765         if (context.graph().parentRelations(entity).length) return false;
70766         if (context.validator().getEntityIssues(entityID).length) return false;
70767         if (entity.type === "node" && entity.isHighwayIntersection(context.graph())) return false;
70768         return true;
70769       }
70770       if (shouldDefaultToPresetList()) {
70771         wrap2.style("right", "-100%");
70772         editorPane.classed("hide", true);
70773         presetPane.classed("hide", false).call(presetList);
70774       } else {
70775         wrap2.style("right", "0%");
70776         presetPane.classed("hide", true);
70777         editorPane.classed("hide", false).call(entityEditor);
70778       }
70779       var footer = selection2.selectAll(".footer").data([0]);
70780       footer = footer.enter().append("div").attr("class", "footer").merge(footer);
70781       footer.call(
70782         uiViewOnOSM(context).what(context.hasEntity(_entityIDs.length === 1 && _entityIDs[0]))
70783       );
70784     }
70785     inspector.showList = function(presets) {
70786       presetPane.classed("hide", false);
70787       wrap2.transition().styleTween("right", function() {
70788         return value_default("0%", "-100%");
70789       }).on("end", function() {
70790         editorPane.classed("hide", true);
70791       });
70792       if (presets) {
70793         presetList.presets(presets);
70794       }
70795       presetPane.call(presetList.autofocus(true));
70796     };
70797     inspector.setPreset = function(preset) {
70798       if (preset && preset.id === "type/multipolygon") {
70799         presetPane.call(presetList.autofocus(true));
70800       } else {
70801         editorPane.classed("hide", false);
70802         wrap2.transition().styleTween("right", function() {
70803           return value_default("-100%", "0%");
70804         }).on("end", function() {
70805           presetPane.classed("hide", true);
70806         });
70807         if (preset) {
70808           entityEditor.presets([preset]);
70809         }
70810         editorPane.call(entityEditor);
70811       }
70812     };
70813     inspector.state = function(val) {
70814       if (!arguments.length) return _state;
70815       _state = val;
70816       entityEditor.state(_state);
70817       context.container().selectAll(".field-help-body").remove();
70818       return inspector;
70819     };
70820     inspector.entityIDs = function(val) {
70821       if (!arguments.length) return _entityIDs;
70822       _entityIDs = val;
70823       return inspector;
70824     };
70825     inspector.newFeature = function(val) {
70826       if (!arguments.length) return _newFeature;
70827       _newFeature = val;
70828       return inspector;
70829     };
70830     return inspector;
70831   }
70832   var init_inspector = __esm({
70833     "modules/ui/inspector.js"() {
70834       "use strict";
70835       init_src8();
70836       init_src5();
70837       init_entity_editor();
70838       init_preset_list();
70839       init_view_on_osm();
70840     }
70841   });
70842
70843   // modules/ui/keepRight_details.js
70844   var keepRight_details_exports = {};
70845   __export(keepRight_details_exports, {
70846     uiKeepRightDetails: () => uiKeepRightDetails
70847   });
70848   function uiKeepRightDetails(context) {
70849     let _qaItem;
70850     function issueDetail(d2) {
70851       const { itemType, parentIssueType } = d2;
70852       const unknown = { html: _t.html("inspector.unknown") };
70853       let replacements = d2.replacements || {};
70854       replacements.default = unknown;
70855       if (_mainLocalizer.hasTextForStringId(`QA.keepRight.errorTypes.${itemType}.title`)) {
70856         return _t.html(`QA.keepRight.errorTypes.${itemType}.description`, replacements);
70857       } else {
70858         return _t.html(`QA.keepRight.errorTypes.${parentIssueType}.description`, replacements);
70859       }
70860     }
70861     function keepRightDetails(selection2) {
70862       const details = selection2.selectAll(".error-details").data(
70863         _qaItem ? [_qaItem] : [],
70864         (d2) => `${d2.id}-${d2.status || 0}`
70865       );
70866       details.exit().remove();
70867       const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
70868       const descriptionEnter = detailsEnter.append("div").attr("class", "qa-details-subsection");
70869       descriptionEnter.append("h4").call(_t.append("QA.keepRight.detail_description"));
70870       descriptionEnter.append("div").attr("class", "qa-details-description-text").html(issueDetail);
70871       let relatedEntities = [];
70872       descriptionEnter.selectAll(".error_entity_link, .error_object_link").attr("href", "#").each(function() {
70873         const link3 = select_default2(this);
70874         const isObjectLink = link3.classed("error_object_link");
70875         const entityID = isObjectLink ? utilEntityRoot(_qaItem.objectType) + _qaItem.objectId : this.textContent;
70876         const entity = context.hasEntity(entityID);
70877         relatedEntities.push(entityID);
70878         link3.on("mouseenter", () => {
70879           utilHighlightEntities([entityID], true, context);
70880         }).on("mouseleave", () => {
70881           utilHighlightEntities([entityID], false, context);
70882         }).on("click", (d3_event) => {
70883           d3_event.preventDefault();
70884           utilHighlightEntities([entityID], false, context);
70885           const osmlayer = context.layers().layer("osm");
70886           if (!osmlayer.enabled()) {
70887             osmlayer.enabled(true);
70888           }
70889           context.map().centerZoomEase(_qaItem.loc, 20);
70890           if (entity) {
70891             context.enter(modeSelect(context, [entityID]));
70892           } else {
70893             context.loadEntity(entityID, (err, result) => {
70894               if (err) return;
70895               const entity2 = result.data.find((e3) => e3.id === entityID);
70896               if (entity2) context.enter(modeSelect(context, [entityID]));
70897             });
70898           }
70899         });
70900         if (entity) {
70901           let name = utilDisplayName(entity);
70902           if (!name && !isObjectLink) {
70903             const preset = _mainPresetIndex.match(entity, context.graph());
70904             name = preset && !preset.isFallback() && preset.name();
70905           }
70906           if (name) {
70907             this.innerText = name;
70908           }
70909         }
70910       });
70911       context.features().forceVisible(relatedEntities);
70912       context.map().pan([0, 0]);
70913     }
70914     keepRightDetails.issue = function(val) {
70915       if (!arguments.length) return _qaItem;
70916       _qaItem = val;
70917       return keepRightDetails;
70918     };
70919     return keepRightDetails;
70920   }
70921   var init_keepRight_details = __esm({
70922     "modules/ui/keepRight_details.js"() {
70923       "use strict";
70924       init_src5();
70925       init_presets();
70926       init_select5();
70927       init_localizer();
70928       init_util();
70929     }
70930   });
70931
70932   // modules/ui/keepRight_header.js
70933   var keepRight_header_exports = {};
70934   __export(keepRight_header_exports, {
70935     uiKeepRightHeader: () => uiKeepRightHeader
70936   });
70937   function uiKeepRightHeader() {
70938     let _qaItem;
70939     function issueTitle(d2) {
70940       const { itemType, parentIssueType } = d2;
70941       const unknown = _t.html("inspector.unknown");
70942       let replacements = d2.replacements || {};
70943       replacements.default = { html: unknown };
70944       if (_mainLocalizer.hasTextForStringId(`QA.keepRight.errorTypes.${itemType}.title`)) {
70945         return _t.html(`QA.keepRight.errorTypes.${itemType}.title`, replacements);
70946       } else {
70947         return _t.html(`QA.keepRight.errorTypes.${parentIssueType}.title`, replacements);
70948       }
70949     }
70950     function keepRightHeader(selection2) {
70951       const header = selection2.selectAll(".qa-header").data(
70952         _qaItem ? [_qaItem] : [],
70953         (d2) => `${d2.id}-${d2.status || 0}`
70954       );
70955       header.exit().remove();
70956       const headerEnter = header.enter().append("div").attr("class", "qa-header");
70957       const iconEnter = headerEnter.append("div").attr("class", "qa-header-icon").classed("new", (d2) => d2.id < 0);
70958       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"));
70959       headerEnter.append("div").attr("class", "qa-header-label").html(issueTitle);
70960     }
70961     keepRightHeader.issue = function(val) {
70962       if (!arguments.length) return _qaItem;
70963       _qaItem = val;
70964       return keepRightHeader;
70965     };
70966     return keepRightHeader;
70967   }
70968   var init_keepRight_header = __esm({
70969     "modules/ui/keepRight_header.js"() {
70970       "use strict";
70971       init_icon();
70972       init_localizer();
70973     }
70974   });
70975
70976   // modules/ui/view_on_keepRight.js
70977   var view_on_keepRight_exports = {};
70978   __export(view_on_keepRight_exports, {
70979     uiViewOnKeepRight: () => uiViewOnKeepRight
70980   });
70981   function uiViewOnKeepRight() {
70982     let _qaItem;
70983     function viewOnKeepRight(selection2) {
70984       let url;
70985       if (services.keepRight && _qaItem instanceof QAItem) {
70986         url = services.keepRight.issueURL(_qaItem);
70987       }
70988       const link3 = selection2.selectAll(".view-on-keepRight").data(url ? [url] : []);
70989       link3.exit().remove();
70990       const linkEnter = link3.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"));
70991       linkEnter.append("span").call(_t.append("inspector.view_on_keepRight"));
70992     }
70993     viewOnKeepRight.what = function(val) {
70994       if (!arguments.length) return _qaItem;
70995       _qaItem = val;
70996       return viewOnKeepRight;
70997     };
70998     return viewOnKeepRight;
70999   }
71000   var init_view_on_keepRight = __esm({
71001     "modules/ui/view_on_keepRight.js"() {
71002       "use strict";
71003       init_localizer();
71004       init_services();
71005       init_icon();
71006       init_osm();
71007     }
71008   });
71009
71010   // modules/ui/keepRight_editor.js
71011   var keepRight_editor_exports = {};
71012   __export(keepRight_editor_exports, {
71013     uiKeepRightEditor: () => uiKeepRightEditor
71014   });
71015   function uiKeepRightEditor(context) {
71016     const dispatch14 = dispatch_default("change");
71017     const qaDetails = uiKeepRightDetails(context);
71018     const qaHeader = uiKeepRightHeader(context);
71019     let _qaItem;
71020     function keepRightEditor(selection2) {
71021       const headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
71022       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
71023       headerEnter.append("h2").call(_t.append("QA.keepRight.title"));
71024       let body = selection2.selectAll(".body").data([0]);
71025       body = body.enter().append("div").attr("class", "body").merge(body);
71026       const editor = body.selectAll(".qa-editor").data([0]);
71027       editor.enter().append("div").attr("class", "modal-section qa-editor").merge(editor).call(qaHeader.issue(_qaItem)).call(qaDetails.issue(_qaItem)).call(keepRightSaveSection);
71028       const footer = selection2.selectAll(".footer").data([0]);
71029       footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnKeepRight(context).what(_qaItem));
71030     }
71031     function keepRightSaveSection(selection2) {
71032       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
71033       const isShown = _qaItem && (isSelected || _qaItem.newComment || _qaItem.comment);
71034       let saveSection = selection2.selectAll(".qa-save").data(
71035         isShown ? [_qaItem] : [],
71036         (d2) => `${d2.id}-${d2.status || 0}`
71037       );
71038       saveSection.exit().remove();
71039       const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
71040       saveSectionEnter.append("h4").attr("class", ".qa-save-header").call(_t.append("QA.keepRight.comment"));
71041       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);
71042       saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
71043       function changeInput() {
71044         const input = select_default2(this);
71045         let val = input.property("value").trim();
71046         if (val === _qaItem.comment) {
71047           val = void 0;
71048         }
71049         _qaItem = _qaItem.update({ newComment: val });
71050         const qaService = services.keepRight;
71051         if (qaService) {
71052           qaService.replaceItem(_qaItem);
71053         }
71054         saveSection.call(qaSaveButtons);
71055       }
71056     }
71057     function qaSaveButtons(selection2) {
71058       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
71059       let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d2) => d2.status + d2.id);
71060       buttonSection.exit().remove();
71061       const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
71062       buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("QA.keepRight.save_comment"));
71063       buttonEnter.append("button").attr("class", "button close-button action");
71064       buttonEnter.append("button").attr("class", "button ignore-button action");
71065       buttonSection = buttonSection.merge(buttonEnter);
71066       buttonSection.select(".comment-button").attr("disabled", (d2) => d2.newComment ? null : true).on("click.comment", function(d3_event, d2) {
71067         this.blur();
71068         const qaService = services.keepRight;
71069         if (qaService) {
71070           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
71071         }
71072       });
71073       buttonSection.select(".close-button").html((d2) => {
71074         const andComment = d2.newComment ? "_comment" : "";
71075         return _t.html(`QA.keepRight.close${andComment}`);
71076       }).on("click.close", function(d3_event, d2) {
71077         this.blur();
71078         const qaService = services.keepRight;
71079         if (qaService) {
71080           d2.newStatus = "ignore_t";
71081           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
71082         }
71083       });
71084       buttonSection.select(".ignore-button").html((d2) => {
71085         const andComment = d2.newComment ? "_comment" : "";
71086         return _t.html(`QA.keepRight.ignore${andComment}`);
71087       }).on("click.ignore", function(d3_event, d2) {
71088         this.blur();
71089         const qaService = services.keepRight;
71090         if (qaService) {
71091           d2.newStatus = "ignore";
71092           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
71093         }
71094       });
71095     }
71096     keepRightEditor.error = function(val) {
71097       if (!arguments.length) return _qaItem;
71098       _qaItem = val;
71099       return keepRightEditor;
71100     };
71101     return utilRebind(keepRightEditor, dispatch14, "on");
71102   }
71103   var init_keepRight_editor = __esm({
71104     "modules/ui/keepRight_editor.js"() {
71105       "use strict";
71106       init_src4();
71107       init_src5();
71108       init_localizer();
71109       init_services();
71110       init_browse();
71111       init_icon();
71112       init_keepRight_details();
71113       init_keepRight_header();
71114       init_view_on_keepRight();
71115       init_util();
71116     }
71117   });
71118
71119   // modules/ui/osmose_details.js
71120   var osmose_details_exports = {};
71121   __export(osmose_details_exports, {
71122     uiOsmoseDetails: () => uiOsmoseDetails
71123   });
71124   function uiOsmoseDetails(context) {
71125     let _qaItem;
71126     function issueString(d2, type2) {
71127       if (!d2) return "";
71128       const s2 = services.osmose.getStrings(d2.itemType);
71129       return type2 in s2 ? s2[type2] : "";
71130     }
71131     function osmoseDetails(selection2) {
71132       const details = selection2.selectAll(".error-details").data(
71133         _qaItem ? [_qaItem] : [],
71134         (d2) => `${d2.id}-${d2.status || 0}`
71135       );
71136       details.exit().remove();
71137       const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
71138       if (issueString(_qaItem, "detail")) {
71139         const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
71140         div.append("h4").call(_t.append("QA.keepRight.detail_description"));
71141         div.append("p").attr("class", "qa-details-description-text").html((d2) => issueString(d2, "detail")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
71142       }
71143       const detailsDiv = detailsEnter.append("div").attr("class", "qa-details-subsection");
71144       const elemsDiv = detailsEnter.append("div").attr("class", "qa-details-subsection");
71145       if (issueString(_qaItem, "fix")) {
71146         const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
71147         div.append("h4").call(_t.append("QA.osmose.fix_title"));
71148         div.append("p").html((d2) => issueString(d2, "fix")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
71149       }
71150       if (issueString(_qaItem, "trap")) {
71151         const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
71152         div.append("h4").call(_t.append("QA.osmose.trap_title"));
71153         div.append("p").html((d2) => issueString(d2, "trap")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
71154       }
71155       const thisItem = _qaItem;
71156       services.osmose.loadIssueDetail(_qaItem).then((d2) => {
71157         if (!d2.elems || d2.elems.length === 0) return;
71158         if (context.selectedErrorID() !== thisItem.id && context.container().selectAll(`.qaItem.osmose.hover.itemId-${thisItem.id}`).empty()) return;
71159         if (d2.detail) {
71160           detailsDiv.append("h4").call(_t.append("QA.osmose.detail_title"));
71161           detailsDiv.append("p").html((d4) => d4.detail).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
71162         }
71163         elemsDiv.append("h4").call(_t.append("QA.osmose.elems_title"));
71164         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() {
71165           const link3 = select_default2(this);
71166           const entityID = this.textContent;
71167           const entity = context.hasEntity(entityID);
71168           link3.on("mouseenter", () => {
71169             utilHighlightEntities([entityID], true, context);
71170           }).on("mouseleave", () => {
71171             utilHighlightEntities([entityID], false, context);
71172           }).on("click", (d3_event) => {
71173             d3_event.preventDefault();
71174             utilHighlightEntities([entityID], false, context);
71175             const osmlayer = context.layers().layer("osm");
71176             if (!osmlayer.enabled()) {
71177               osmlayer.enabled(true);
71178             }
71179             context.map().centerZoom(d2.loc, 20);
71180             if (entity) {
71181               context.enter(modeSelect(context, [entityID]));
71182             } else {
71183               context.loadEntity(entityID, (err, result) => {
71184                 if (err) return;
71185                 const entity2 = result.data.find((e3) => e3.id === entityID);
71186                 if (entity2) context.enter(modeSelect(context, [entityID]));
71187               });
71188             }
71189           });
71190           if (entity) {
71191             let name = utilDisplayName(entity);
71192             if (!name) {
71193               const preset = _mainPresetIndex.match(entity, context.graph());
71194               name = preset && !preset.isFallback() && preset.name();
71195             }
71196             if (name) {
71197               this.innerText = name;
71198             }
71199           }
71200         });
71201         context.features().forceVisible(d2.elems);
71202         context.map().pan([0, 0]);
71203       }).catch((err) => {
71204         console.log(err);
71205       });
71206     }
71207     osmoseDetails.issue = function(val) {
71208       if (!arguments.length) return _qaItem;
71209       _qaItem = val;
71210       return osmoseDetails;
71211     };
71212     return osmoseDetails;
71213   }
71214   var init_osmose_details = __esm({
71215     "modules/ui/osmose_details.js"() {
71216       "use strict";
71217       init_src5();
71218       init_presets();
71219       init_select5();
71220       init_localizer();
71221       init_services();
71222       init_util();
71223     }
71224   });
71225
71226   // modules/ui/osmose_header.js
71227   var osmose_header_exports = {};
71228   __export(osmose_header_exports, {
71229     uiOsmoseHeader: () => uiOsmoseHeader
71230   });
71231   function uiOsmoseHeader() {
71232     let _qaItem;
71233     function issueTitle(d2) {
71234       const unknown = _t("inspector.unknown");
71235       if (!d2) return unknown;
71236       const s2 = services.osmose.getStrings(d2.itemType);
71237       return "title" in s2 ? s2.title : unknown;
71238     }
71239     function osmoseHeader(selection2) {
71240       const header = selection2.selectAll(".qa-header").data(
71241         _qaItem ? [_qaItem] : [],
71242         (d2) => `${d2.id}-${d2.status || 0}`
71243       );
71244       header.exit().remove();
71245       const headerEnter = header.enter().append("div").attr("class", "qa-header");
71246       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}`);
71247       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");
71248       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 : "");
71249       headerEnter.append("div").attr("class", "qa-header-label").text(issueTitle);
71250     }
71251     osmoseHeader.issue = function(val) {
71252       if (!arguments.length) return _qaItem;
71253       _qaItem = val;
71254       return osmoseHeader;
71255     };
71256     return osmoseHeader;
71257   }
71258   var init_osmose_header = __esm({
71259     "modules/ui/osmose_header.js"() {
71260       "use strict";
71261       init_services();
71262       init_localizer();
71263     }
71264   });
71265
71266   // modules/ui/view_on_osmose.js
71267   var view_on_osmose_exports = {};
71268   __export(view_on_osmose_exports, {
71269     uiViewOnOsmose: () => uiViewOnOsmose
71270   });
71271   function uiViewOnOsmose() {
71272     let _qaItem;
71273     function viewOnOsmose(selection2) {
71274       let url;
71275       if (services.osmose && _qaItem instanceof QAItem) {
71276         url = services.osmose.itemURL(_qaItem);
71277       }
71278       const link3 = selection2.selectAll(".view-on-osmose").data(url ? [url] : []);
71279       link3.exit().remove();
71280       const linkEnter = link3.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"));
71281       linkEnter.append("span").call(_t.append("inspector.view_on_osmose"));
71282     }
71283     viewOnOsmose.what = function(val) {
71284       if (!arguments.length) return _qaItem;
71285       _qaItem = val;
71286       return viewOnOsmose;
71287     };
71288     return viewOnOsmose;
71289   }
71290   var init_view_on_osmose = __esm({
71291     "modules/ui/view_on_osmose.js"() {
71292       "use strict";
71293       init_localizer();
71294       init_services();
71295       init_icon();
71296       init_osm();
71297     }
71298   });
71299
71300   // modules/ui/osmose_editor.js
71301   var osmose_editor_exports = {};
71302   __export(osmose_editor_exports, {
71303     uiOsmoseEditor: () => uiOsmoseEditor
71304   });
71305   function uiOsmoseEditor(context) {
71306     const dispatch14 = dispatch_default("change");
71307     const qaDetails = uiOsmoseDetails(context);
71308     const qaHeader = uiOsmoseHeader(context);
71309     let _qaItem;
71310     function osmoseEditor(selection2) {
71311       const header = selection2.selectAll(".header").data([0]);
71312       const headerEnter = header.enter().append("div").attr("class", "header fillL");
71313       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
71314       headerEnter.append("h2").call(_t.append("QA.osmose.title"));
71315       let body = selection2.selectAll(".body").data([0]);
71316       body = body.enter().append("div").attr("class", "body").merge(body);
71317       let editor = body.selectAll(".qa-editor").data([0]);
71318       editor.enter().append("div").attr("class", "modal-section qa-editor").merge(editor).call(qaHeader.issue(_qaItem)).call(qaDetails.issue(_qaItem)).call(osmoseSaveSection);
71319       const footer = selection2.selectAll(".footer").data([0]);
71320       footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnOsmose(context).what(_qaItem));
71321     }
71322     function osmoseSaveSection(selection2) {
71323       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
71324       const isShown = _qaItem && isSelected;
71325       let saveSection = selection2.selectAll(".qa-save").data(
71326         isShown ? [_qaItem] : [],
71327         (d2) => `${d2.id}-${d2.status || 0}`
71328       );
71329       saveSection.exit().remove();
71330       const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
71331       saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
71332     }
71333     function qaSaveButtons(selection2) {
71334       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
71335       let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d2) => d2.status + d2.id);
71336       buttonSection.exit().remove();
71337       const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
71338       buttonEnter.append("button").attr("class", "button close-button action");
71339       buttonEnter.append("button").attr("class", "button ignore-button action");
71340       buttonSection = buttonSection.merge(buttonEnter);
71341       buttonSection.select(".close-button").call(_t.append("QA.keepRight.close")).on("click.close", function(d3_event, d2) {
71342         this.blur();
71343         const qaService = services.osmose;
71344         if (qaService) {
71345           d2.newStatus = "done";
71346           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
71347         }
71348       });
71349       buttonSection.select(".ignore-button").call(_t.append("QA.keepRight.ignore")).on("click.ignore", function(d3_event, d2) {
71350         this.blur();
71351         const qaService = services.osmose;
71352         if (qaService) {
71353           d2.newStatus = "false";
71354           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
71355         }
71356       });
71357     }
71358     osmoseEditor.error = function(val) {
71359       if (!arguments.length) return _qaItem;
71360       _qaItem = val;
71361       return osmoseEditor;
71362     };
71363     return utilRebind(osmoseEditor, dispatch14, "on");
71364   }
71365   var init_osmose_editor = __esm({
71366     "modules/ui/osmose_editor.js"() {
71367       "use strict";
71368       init_src4();
71369       init_localizer();
71370       init_services();
71371       init_browse();
71372       init_icon();
71373       init_osmose_details();
71374       init_osmose_header();
71375       init_view_on_osmose();
71376       init_util();
71377     }
71378   });
71379
71380   // modules/ui/sidebar.js
71381   var sidebar_exports = {};
71382   __export(sidebar_exports, {
71383     uiSidebar: () => uiSidebar
71384   });
71385   function uiSidebar(context) {
71386     var inspector = uiInspector(context);
71387     var dataEditor = uiDataEditor(context);
71388     var noteEditor = uiNoteEditor(context);
71389     var keepRightEditor = uiKeepRightEditor(context);
71390     var osmoseEditor = uiOsmoseEditor(context);
71391     var _current;
71392     var _wasData = false;
71393     var _wasNote = false;
71394     var _wasQaItem = false;
71395     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
71396     function sidebar(selection2) {
71397       var container = context.container();
71398       var minWidth = 240;
71399       var sidebarWidth;
71400       var containerWidth;
71401       var dragOffset;
71402       selection2.style("min-width", minWidth + "px").style("max-width", "400px").style("width", "33.3333%");
71403       var resizer = selection2.append("div").attr("class", "sidebar-resizer").on(_pointerPrefix + "down.sidebar-resizer", pointerdown);
71404       var downPointerId, lastClientX, containerLocGetter;
71405       function pointerdown(d3_event) {
71406         if (downPointerId) return;
71407         if ("button" in d3_event && d3_event.button !== 0) return;
71408         downPointerId = d3_event.pointerId || "mouse";
71409         lastClientX = d3_event.clientX;
71410         containerLocGetter = utilFastMouse(container.node());
71411         dragOffset = utilFastMouse(resizer.node())(d3_event)[0] - 1;
71412         sidebarWidth = selection2.node().getBoundingClientRect().width;
71413         containerWidth = container.node().getBoundingClientRect().width;
71414         var widthPct = sidebarWidth / containerWidth * 100;
71415         selection2.style("width", widthPct + "%").style("max-width", "85%");
71416         resizer.classed("dragging", true);
71417         select_default2(window).on("touchmove.sidebar-resizer", function(d3_event2) {
71418           d3_event2.preventDefault();
71419         }, { passive: false }).on(_pointerPrefix + "move.sidebar-resizer", pointermove).on(_pointerPrefix + "up.sidebar-resizer pointercancel.sidebar-resizer", pointerup);
71420       }
71421       function pointermove(d3_event) {
71422         if (downPointerId !== (d3_event.pointerId || "mouse")) return;
71423         d3_event.preventDefault();
71424         var dx = d3_event.clientX - lastClientX;
71425         lastClientX = d3_event.clientX;
71426         var isRTL = _mainLocalizer.textDirection() === "rtl";
71427         var scaleX = isRTL ? 0 : 1;
71428         var xMarginProperty = isRTL ? "margin-right" : "margin-left";
71429         var x2 = containerLocGetter(d3_event)[0] - dragOffset;
71430         sidebarWidth = isRTL ? containerWidth - x2 : x2;
71431         var isCollapsed = selection2.classed("collapsed");
71432         var shouldCollapse = sidebarWidth < minWidth;
71433         selection2.classed("collapsed", shouldCollapse);
71434         if (shouldCollapse) {
71435           if (!isCollapsed) {
71436             selection2.style(xMarginProperty, "-400px").style("width", "400px");
71437             context.ui().onResize([(sidebarWidth - dx) * scaleX, 0]);
71438           }
71439         } else {
71440           var widthPct = sidebarWidth / containerWidth * 100;
71441           selection2.style(xMarginProperty, null).style("width", widthPct + "%");
71442           if (isCollapsed) {
71443             context.ui().onResize([-sidebarWidth * scaleX, 0]);
71444           } else {
71445             context.ui().onResize([-dx * scaleX, 0]);
71446           }
71447         }
71448       }
71449       function pointerup(d3_event) {
71450         if (downPointerId !== (d3_event.pointerId || "mouse")) return;
71451         downPointerId = null;
71452         resizer.classed("dragging", false);
71453         select_default2(window).on("touchmove.sidebar-resizer", null).on(_pointerPrefix + "move.sidebar-resizer", null).on(_pointerPrefix + "up.sidebar-resizer pointercancel.sidebar-resizer", null);
71454       }
71455       var featureListWrap = selection2.append("div").attr("class", "feature-list-pane").call(uiFeatureList(context));
71456       var inspectorWrap = selection2.append("div").attr("class", "inspector-hidden inspector-wrap");
71457       var hoverModeSelect = function(targets) {
71458         context.container().selectAll(".feature-list-item button").classed("hover", false);
71459         if (context.selectedIDs().length > 1 && targets && targets.length) {
71460           var elements = context.container().selectAll(".feature-list-item button").filter(function(node) {
71461             return targets.indexOf(node) !== -1;
71462           });
71463           if (!elements.empty()) {
71464             elements.classed("hover", true);
71465           }
71466         }
71467       };
71468       sidebar.hoverModeSelect = throttle_default(hoverModeSelect, 200);
71469       function hover(targets) {
71470         var datum2 = targets && targets.length && targets[0];
71471         if (datum2 && datum2.__featurehash__) {
71472           _wasData = true;
71473           sidebar.show(dataEditor.datum(datum2));
71474           selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
71475         } else if (datum2 instanceof osmNote) {
71476           if (context.mode().id === "drag-note") return;
71477           _wasNote = true;
71478           var osm = services.osm;
71479           if (osm) {
71480             datum2 = osm.getNote(datum2.id);
71481           }
71482           sidebar.show(noteEditor.note(datum2));
71483           selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
71484         } else if (datum2 instanceof QAItem) {
71485           _wasQaItem = true;
71486           var errService = services[datum2.service];
71487           if (errService) {
71488             datum2 = errService.getError(datum2.id);
71489           }
71490           var errEditor;
71491           if (datum2.service === "keepRight") {
71492             errEditor = keepRightEditor;
71493           } else {
71494             errEditor = osmoseEditor;
71495           }
71496           context.container().selectAll(".qaItem." + datum2.service).classed("hover", function(d2) {
71497             return d2.id === datum2.id;
71498           });
71499           sidebar.show(errEditor.error(datum2));
71500           selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
71501         } else if (!_current && datum2 instanceof osmEntity) {
71502           featureListWrap.classed("inspector-hidden", true);
71503           inspectorWrap.classed("inspector-hidden", false).classed("inspector-hover", true);
71504           if (!inspector.entityIDs() || !utilArrayIdentical(inspector.entityIDs(), [datum2.id]) || inspector.state() !== "hover") {
71505             inspector.state("hover").entityIDs([datum2.id]).newFeature(false);
71506             inspectorWrap.call(inspector);
71507           }
71508         } else if (!_current) {
71509           featureListWrap.classed("inspector-hidden", false);
71510           inspectorWrap.classed("inspector-hidden", true);
71511           inspector.state("hide");
71512         } else if (_wasData || _wasNote || _wasQaItem) {
71513           _wasNote = false;
71514           _wasData = false;
71515           _wasQaItem = false;
71516           context.container().selectAll(".note").classed("hover", false);
71517           context.container().selectAll(".qaItem").classed("hover", false);
71518           sidebar.hide();
71519         }
71520       }
71521       sidebar.hover = throttle_default(hover, 200);
71522       sidebar.intersects = function(extent) {
71523         var rect = selection2.node().getBoundingClientRect();
71524         return extent.intersects([
71525           context.projection.invert([0, rect.height]),
71526           context.projection.invert([rect.width, 0])
71527         ]);
71528       };
71529       sidebar.select = function(ids, newFeature) {
71530         sidebar.hide();
71531         if (ids && ids.length) {
71532           var entity = ids.length === 1 && context.entity(ids[0]);
71533           if (entity && newFeature && selection2.classed("collapsed")) {
71534             var extent = entity.extent(context.graph());
71535             sidebar.expand(sidebar.intersects(extent));
71536           }
71537           featureListWrap.classed("inspector-hidden", true);
71538           inspectorWrap.classed("inspector-hidden", false).classed("inspector-hover", false);
71539           inspector.state("select").entityIDs(ids).newFeature(newFeature);
71540           inspectorWrap.call(inspector);
71541         } else {
71542           inspector.state("hide");
71543         }
71544       };
71545       sidebar.showPresetList = function() {
71546         inspector.showList();
71547       };
71548       sidebar.show = function(component, element) {
71549         featureListWrap.classed("inspector-hidden", true);
71550         inspectorWrap.classed("inspector-hidden", true);
71551         if (_current) _current.remove();
71552         _current = selection2.append("div").attr("class", "sidebar-component").call(component, element);
71553       };
71554       sidebar.hide = function() {
71555         featureListWrap.classed("inspector-hidden", false);
71556         inspectorWrap.classed("inspector-hidden", true);
71557         if (_current) _current.remove();
71558         _current = null;
71559       };
71560       sidebar.expand = function(moveMap) {
71561         if (selection2.classed("collapsed")) {
71562           sidebar.toggle(moveMap);
71563         }
71564       };
71565       sidebar.collapse = function(moveMap) {
71566         if (!selection2.classed("collapsed")) {
71567           sidebar.toggle(moveMap);
71568         }
71569       };
71570       sidebar.toggle = function(moveMap) {
71571         if (context.inIntro()) return;
71572         var isCollapsed = selection2.classed("collapsed");
71573         var isCollapsing = !isCollapsed;
71574         var isRTL = _mainLocalizer.textDirection() === "rtl";
71575         var scaleX = isRTL ? 0 : 1;
71576         var xMarginProperty = isRTL ? "margin-right" : "margin-left";
71577         sidebarWidth = selection2.node().getBoundingClientRect().width;
71578         selection2.style("width", sidebarWidth + "px");
71579         var startMargin, endMargin, lastMargin;
71580         if (isCollapsing) {
71581           startMargin = lastMargin = 0;
71582           endMargin = -sidebarWidth;
71583         } else {
71584           startMargin = lastMargin = -sidebarWidth;
71585           endMargin = 0;
71586         }
71587         if (!isCollapsing) {
71588           selection2.classed("collapsed", isCollapsing);
71589         }
71590         selection2.transition().style(xMarginProperty, endMargin + "px").tween("panner", function() {
71591           var i3 = number_default(startMargin, endMargin);
71592           return function(t2) {
71593             var dx = lastMargin - Math.round(i3(t2));
71594             lastMargin = lastMargin - dx;
71595             context.ui().onResize(moveMap ? void 0 : [dx * scaleX, 0]);
71596           };
71597         }).on("end", function() {
71598           if (isCollapsing) {
71599             selection2.classed("collapsed", isCollapsing);
71600           }
71601           if (!isCollapsing) {
71602             var containerWidth2 = container.node().getBoundingClientRect().width;
71603             var widthPct = sidebarWidth / containerWidth2 * 100;
71604             selection2.style(xMarginProperty, null).style("width", widthPct + "%");
71605           }
71606         });
71607       };
71608       resizer.on("dblclick", function(d3_event) {
71609         d3_event.preventDefault();
71610         if (d3_event.sourceEvent) {
71611           d3_event.sourceEvent.preventDefault();
71612         }
71613         sidebar.toggle();
71614       });
71615       context.map().on("crossEditableZoom.sidebar", function(within) {
71616         if (!within && !selection2.select(".inspector-hover").empty()) {
71617           hover([]);
71618         }
71619       });
71620     }
71621     sidebar.showPresetList = function() {
71622     };
71623     sidebar.hover = function() {
71624     };
71625     sidebar.hover.cancel = function() {
71626     };
71627     sidebar.intersects = function() {
71628     };
71629     sidebar.select = function() {
71630     };
71631     sidebar.show = function() {
71632     };
71633     sidebar.hide = function() {
71634     };
71635     sidebar.expand = function() {
71636     };
71637     sidebar.collapse = function() {
71638     };
71639     sidebar.toggle = function() {
71640     };
71641     return sidebar;
71642   }
71643   var init_sidebar = __esm({
71644     "modules/ui/sidebar.js"() {
71645       "use strict";
71646       init_throttle();
71647       init_src8();
71648       init_src5();
71649       init_array3();
71650       init_util();
71651       init_osm();
71652       init_services();
71653       init_data_editor();
71654       init_feature_list();
71655       init_inspector();
71656       init_keepRight_editor();
71657       init_osmose_editor();
71658       init_note_editor();
71659       init_localizer();
71660     }
71661   });
71662
71663   // modules/ui/source_switch.js
71664   var source_switch_exports = {};
71665   __export(source_switch_exports, {
71666     uiSourceSwitch: () => uiSourceSwitch
71667   });
71668   function uiSourceSwitch(context) {
71669     var keys2;
71670     function click(d3_event) {
71671       d3_event.preventDefault();
71672       var osm = context.connection();
71673       if (!osm) return;
71674       if (context.inIntro()) return;
71675       if (context.history().hasChanges() && !window.confirm(_t("source_switch.lose_changes"))) return;
71676       var isLive = select_default2(this).classed("live");
71677       isLive = !isLive;
71678       context.enter(modeBrowse(context));
71679       context.history().clearSaved();
71680       context.flush();
71681       select_default2(this).html(isLive ? _t.html("source_switch.live") : _t.html("source_switch.dev")).classed("live", isLive).classed("chip", isLive);
71682       osm.switch(isLive ? keys2[0] : keys2[1]);
71683     }
71684     var sourceSwitch = function(selection2) {
71685       selection2.append("a").attr("href", "#").call(_t.append("source_switch.live")).attr("class", "live chip").on("click", click);
71686     };
71687     sourceSwitch.keys = function(_2) {
71688       if (!arguments.length) return keys2;
71689       keys2 = _2;
71690       return sourceSwitch;
71691     };
71692     return sourceSwitch;
71693   }
71694   var init_source_switch = __esm({
71695     "modules/ui/source_switch.js"() {
71696       "use strict";
71697       init_src5();
71698       init_localizer();
71699       init_browse();
71700     }
71701   });
71702
71703   // modules/ui/spinner.js
71704   var spinner_exports = {};
71705   __export(spinner_exports, {
71706     uiSpinner: () => uiSpinner
71707   });
71708   function uiSpinner(context) {
71709     var osm = context.connection();
71710     return function(selection2) {
71711       var img = selection2.append("img").attr("src", context.imagePath("loader-black.gif")).style("opacity", 0);
71712       if (osm) {
71713         osm.on("loading.spinner", function() {
71714           img.transition().style("opacity", 1);
71715         }).on("loaded.spinner", function() {
71716           img.transition().style("opacity", 0);
71717         });
71718       }
71719     };
71720   }
71721   var init_spinner = __esm({
71722     "modules/ui/spinner.js"() {
71723       "use strict";
71724     }
71725   });
71726
71727   // modules/ui/sections/privacy.js
71728   var privacy_exports = {};
71729   __export(privacy_exports, {
71730     uiSectionPrivacy: () => uiSectionPrivacy
71731   });
71732   function uiSectionPrivacy(context) {
71733     let section = uiSection("preferences-third-party", context).label(() => _t.append("preferences.privacy.title")).disclosureContent(renderDisclosureContent);
71734     function renderDisclosureContent(selection2) {
71735       selection2.selectAll(".privacy-options-list").data([0]).enter().append("ul").attr("class", "layer-list privacy-options-list");
71736       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(
71737         uiTooltip().title(() => _t.append("preferences.privacy.third_party_icons.tooltip")).placement("bottom")
71738       );
71739       thirdPartyIconsEnter.append("input").attr("type", "checkbox").on("change", (d3_event, d2) => {
71740         d3_event.preventDefault();
71741         corePreferences("preferences.privacy.thirdpartyicons", d2 === "true" ? "false" : "true");
71742       });
71743       thirdPartyIconsEnter.append("span").call(_t.append("preferences.privacy.third_party_icons.description"));
71744       selection2.selectAll(".privacy-third-party-icons-item").classed("active", (d2) => d2 === "true").select("input").property("checked", (d2) => d2 === "true");
71745       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"));
71746     }
71747     corePreferences.onChange("preferences.privacy.thirdpartyicons", section.reRender);
71748     return section;
71749   }
71750   var init_privacy = __esm({
71751     "modules/ui/sections/privacy.js"() {
71752       "use strict";
71753       init_preferences();
71754       init_localizer();
71755       init_tooltip();
71756       init_icon();
71757       init_section();
71758     }
71759   });
71760
71761   // modules/ui/splash.js
71762   var splash_exports = {};
71763   __export(splash_exports, {
71764     uiSplash: () => uiSplash
71765   });
71766   function uiSplash(context) {
71767     return (selection2) => {
71768       if (context.history().hasRestorableChanges()) return;
71769       let updateMessage = "";
71770       const sawPrivacyVersion = corePreferences("sawPrivacyVersion");
71771       let showSplash = !corePreferences("sawSplash");
71772       if (sawPrivacyVersion && sawPrivacyVersion !== context.privacyVersion) {
71773         updateMessage = _t("splash.privacy_update");
71774         showSplash = true;
71775       }
71776       if (!showSplash) return;
71777       corePreferences("sawSplash", true);
71778       corePreferences("sawPrivacyVersion", context.privacyVersion);
71779       _mainFileFetcher.get("intro_graph");
71780       let modalSelection = uiModal(selection2);
71781       modalSelection.select(".modal").attr("class", "modal-splash modal");
71782       let introModal = modalSelection.select(".content").append("div").attr("class", "fillL");
71783       introModal.append("div").attr("class", "modal-section").append("h3").call(_t.append("splash.welcome"));
71784       let modalSection = introModal.append("div").attr("class", "modal-section");
71785       modalSection.append("p").html(_t.html("splash.text", {
71786         version: context.version,
71787         website: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/blob/develop/CHANGELOG.md#whats-new">' + _t.html("splash.changelog") + "</a>" },
71788         github: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/issues">github.com</a>' }
71789       }));
71790       modalSection.append("p").html(_t.html("splash.privacy", {
71791         updateMessage,
71792         privacyLink: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/blob/release/PRIVACY.md">' + _t("splash.privacy_policy") + "</a>" }
71793       }));
71794       uiSectionPrivacy(context).label(() => _t.append("splash.privacy_settings")).render(modalSection);
71795       let buttonWrap = introModal.append("div").attr("class", "modal-actions");
71796       let walkthrough = buttonWrap.append("button").attr("class", "walkthrough").on("click", () => {
71797         context.container().call(uiIntro(context));
71798         modalSelection.close();
71799       });
71800       walkthrough.append("svg").attr("class", "logo logo-walkthrough").append("use").attr("xlink:href", "#iD-logo-walkthrough");
71801       walkthrough.append("div").call(_t.append("splash.walkthrough"));
71802       let startEditing = buttonWrap.append("button").attr("class", "start-editing").on("click", modalSelection.close);
71803       startEditing.append("svg").attr("class", "logo logo-features").append("use").attr("xlink:href", "#iD-logo-features");
71804       startEditing.append("div").call(_t.append("splash.start"));
71805       modalSelection.select("button.close").attr("class", "hide");
71806     };
71807   }
71808   var init_splash = __esm({
71809     "modules/ui/splash.js"() {
71810       "use strict";
71811       init_preferences();
71812       init_file_fetcher();
71813       init_localizer();
71814       init_intro2();
71815       init_modal();
71816       init_privacy();
71817     }
71818   });
71819
71820   // modules/ui/status.js
71821   var status_exports = {};
71822   __export(status_exports, {
71823     uiStatus: () => uiStatus
71824   });
71825   function uiStatus(context) {
71826     var osm = context.connection();
71827     return function(selection2) {
71828       if (!osm) return;
71829       function update(err, apiStatus) {
71830         selection2.html("");
71831         if (err) {
71832           if (apiStatus === "connectionSwitched") {
71833             return;
71834           } else if (apiStatus === "rateLimited") {
71835             if (!osm.authenticated()) {
71836               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) {
71837                 d3_event.preventDefault();
71838                 osm.authenticate();
71839               });
71840             } else {
71841               selection2.call(_t.append("osm_api_status.message.rateLimited"));
71842             }
71843           } else {
71844             var throttledRetry = throttle_default(function() {
71845               context.loadTiles(context.projection);
71846               osm.reloadApiStatus();
71847             }, 2e3);
71848             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) {
71849               d3_event.preventDefault();
71850               throttledRetry();
71851             });
71852           }
71853         } else if (apiStatus === "readonly") {
71854           selection2.call(_t.append("osm_api_status.message.readonly"));
71855         } else if (apiStatus === "offline") {
71856           selection2.call(_t.append("osm_api_status.message.offline"));
71857         }
71858         selection2.attr("class", "api-status " + (err ? "error" : apiStatus));
71859       }
71860       osm.on("apiStatusChange.uiStatus", update);
71861       context.history().on("storage_error", () => {
71862         selection2.selectAll("span.local-storage-full").remove();
71863         selection2.append("span").attr("class", "local-storage-full").call(_t.append("osm_api_status.message.local_storage_full"));
71864         selection2.classed("error", true);
71865       });
71866       window.setInterval(function() {
71867         osm.reloadApiStatus();
71868       }, 9e4);
71869       osm.reloadApiStatus();
71870     };
71871   }
71872   var init_status = __esm({
71873     "modules/ui/status.js"() {
71874       "use strict";
71875       init_throttle();
71876       init_localizer();
71877       init_icon();
71878     }
71879   });
71880
71881   // modules/ui/tools/modes.js
71882   var modes_exports = {};
71883   __export(modes_exports, {
71884     uiToolDrawModes: () => uiToolDrawModes
71885   });
71886   function uiToolDrawModes(context) {
71887     var tool = {
71888       id: "old_modes",
71889       label: _t.append("toolbar.add_feature")
71890     };
71891     var modes = [
71892       modeAddPoint(context, {
71893         title: _t.append("modes.add_point.title"),
71894         button: "point",
71895         description: _t.append("modes.add_point.description"),
71896         preset: _mainPresetIndex.item("point"),
71897         key: "1"
71898       }),
71899       modeAddLine(context, {
71900         title: _t.append("modes.add_line.title"),
71901         button: "line",
71902         description: _t.append("modes.add_line.description"),
71903         preset: _mainPresetIndex.item("line"),
71904         key: "2"
71905       }),
71906       modeAddArea(context, {
71907         title: _t.append("modes.add_area.title"),
71908         button: "area",
71909         description: _t.append("modes.add_area.description"),
71910         preset: _mainPresetIndex.item("area"),
71911         key: "3"
71912       })
71913     ];
71914     function enabled(_mode) {
71915       return osmEditable();
71916     }
71917     function osmEditable() {
71918       return context.editable();
71919     }
71920     modes.forEach(function(mode) {
71921       context.keybinding().on(mode.key, function() {
71922         if (!enabled(mode)) return;
71923         if (mode.id === context.mode().id) {
71924           context.enter(modeBrowse(context));
71925         } else {
71926           context.enter(mode);
71927         }
71928       });
71929     });
71930     tool.render = function(selection2) {
71931       var wrap2 = selection2.append("div").attr("class", "joined").style("display", "flex");
71932       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
71933       context.map().on("move.modes", debouncedUpdate).on("drawn.modes", debouncedUpdate);
71934       context.on("enter.modes", update);
71935       update();
71936       function update() {
71937         var buttons = wrap2.selectAll("button.add-button").data(modes, function(d2) {
71938           return d2.id;
71939         });
71940         buttons.exit().remove();
71941         var buttonsEnter = buttons.enter().append("button").attr("class", function(d2) {
71942           return d2.id + " add-button bar-button";
71943         }).on("click.mode-buttons", function(d3_event, d2) {
71944           if (!enabled(d2)) return;
71945           var currMode = context.mode().id;
71946           if (/^draw/.test(currMode)) return;
71947           if (d2.id === currMode) {
71948             context.enter(modeBrowse(context));
71949           } else {
71950             context.enter(d2);
71951           }
71952         }).call(
71953           uiTooltip().placement("bottom").title(function(d2) {
71954             return d2.description;
71955           }).keys(function(d2) {
71956             return [d2.key];
71957           }).scrollContainer(context.container().select(".top-toolbar"))
71958         );
71959         buttonsEnter.each(function(d2) {
71960           select_default2(this).call(svgIcon("#iD-icon-" + d2.button));
71961         });
71962         buttonsEnter.append("span").attr("class", "label").text("").each(function(mode) {
71963           mode.title(select_default2(this));
71964         });
71965         if (buttons.enter().size() || buttons.exit().size()) {
71966           context.ui().checkOverflow(".top-toolbar", true);
71967         }
71968         buttons = buttons.merge(buttonsEnter).attr("aria-disabled", function(d2) {
71969           return !enabled(d2);
71970         }).classed("disabled", function(d2) {
71971           return !enabled(d2);
71972         }).attr("aria-pressed", function(d2) {
71973           return context.mode() && context.mode().button === d2.button;
71974         }).classed("active", function(d2) {
71975           return context.mode() && context.mode().button === d2.button;
71976         });
71977       }
71978     };
71979     return tool;
71980   }
71981   var init_modes = __esm({
71982     "modules/ui/tools/modes.js"() {
71983       "use strict";
71984       init_debounce();
71985       init_src5();
71986       init_modes2();
71987       init_presets();
71988       init_localizer();
71989       init_svg();
71990       init_tooltip();
71991     }
71992   });
71993
71994   // modules/ui/tools/notes.js
71995   var notes_exports2 = {};
71996   __export(notes_exports2, {
71997     uiToolNotes: () => uiToolNotes
71998   });
71999   function uiToolNotes(context) {
72000     var tool = {
72001       id: "notes",
72002       label: _t.append("modes.add_note.label")
72003     };
72004     var mode = modeAddNote(context);
72005     function enabled() {
72006       return notesEnabled() && notesEditable();
72007     }
72008     function notesEnabled() {
72009       var noteLayer = context.layers().layer("notes");
72010       return noteLayer && noteLayer.enabled();
72011     }
72012     function notesEditable() {
72013       var mode2 = context.mode();
72014       return context.map().notesEditable() && mode2 && mode2.id !== "save";
72015     }
72016     context.keybinding().on(mode.key, function() {
72017       if (!enabled()) return;
72018       if (mode.id === context.mode().id) {
72019         context.enter(modeBrowse(context));
72020       } else {
72021         context.enter(mode);
72022       }
72023     });
72024     tool.render = function(selection2) {
72025       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
72026       context.map().on("move.notes", debouncedUpdate).on("drawn.notes", debouncedUpdate);
72027       context.on("enter.notes", update);
72028       update();
72029       function update() {
72030         var showNotes = notesEnabled();
72031         var data = showNotes ? [mode] : [];
72032         var buttons = selection2.selectAll("button.add-button").data(data, function(d2) {
72033           return d2.id;
72034         });
72035         buttons.exit().remove();
72036         var buttonsEnter = buttons.enter().append("button").attr("class", function(d2) {
72037           return d2.id + " add-button bar-button";
72038         }).on("click.notes", function(d3_event, d2) {
72039           if (!enabled()) return;
72040           var currMode = context.mode().id;
72041           if (/^draw/.test(currMode)) return;
72042           if (d2.id === currMode) {
72043             context.enter(modeBrowse(context));
72044           } else {
72045             context.enter(d2);
72046           }
72047         }).call(
72048           uiTooltip().placement("bottom").title(function(d2) {
72049             return d2.description;
72050           }).keys(function(d2) {
72051             return [d2.key];
72052           }).scrollContainer(context.container().select(".top-toolbar"))
72053         );
72054         buttonsEnter.each(function(d2) {
72055           select_default2(this).call(svgIcon(d2.icon || "#iD-icon-" + d2.button));
72056         });
72057         if (buttons.enter().size() || buttons.exit().size()) {
72058           context.ui().checkOverflow(".top-toolbar", true);
72059         }
72060         buttons = buttons.merge(buttonsEnter).classed("disabled", function() {
72061           return !enabled();
72062         }).attr("aria-disabled", function() {
72063           return !enabled();
72064         }).classed("active", function(d2) {
72065           return context.mode() && context.mode().button === d2.button;
72066         }).attr("aria-pressed", function(d2) {
72067           return context.mode() && context.mode().button === d2.button;
72068         });
72069       }
72070     };
72071     tool.uninstall = function() {
72072       context.on("enter.editor.notes", null).on("exit.editor.notes", null).on("enter.notes", null);
72073       context.map().on("move.notes", null).on("drawn.notes", null);
72074     };
72075     return tool;
72076   }
72077   var init_notes2 = __esm({
72078     "modules/ui/tools/notes.js"() {
72079       "use strict";
72080       init_debounce();
72081       init_src5();
72082       init_modes2();
72083       init_localizer();
72084       init_svg();
72085       init_tooltip();
72086     }
72087   });
72088
72089   // modules/ui/tools/save.js
72090   var save_exports = {};
72091   __export(save_exports, {
72092     uiToolSave: () => uiToolSave
72093   });
72094   function uiToolSave(context) {
72095     var tool = {
72096       id: "save",
72097       label: _t.append("save.title")
72098     };
72099     var button = null;
72100     var tooltipBehavior = null;
72101     var history = context.history();
72102     var key = uiCmd("\u2318S");
72103     var _numChanges = 0;
72104     function isSaving() {
72105       var mode = context.mode();
72106       return mode && mode.id === "save";
72107     }
72108     function isDisabled() {
72109       return _numChanges === 0 || isSaving();
72110     }
72111     function save(d3_event) {
72112       d3_event.preventDefault();
72113       if (!context.inIntro() && !isSaving() && history.hasChanges()) {
72114         context.enter(modeSave(context));
72115       }
72116     }
72117     function bgColor(numChanges) {
72118       var step;
72119       if (numChanges === 0) {
72120         return null;
72121       } else if (numChanges <= 50) {
72122         step = numChanges / 50;
72123         return rgb_default("#fff", "#ff8")(step);
72124       } else {
72125         step = Math.min((numChanges - 50) / 50, 1);
72126         return rgb_default("#ff8", "#f88")(step);
72127       }
72128     }
72129     function updateCount() {
72130       var val = history.difference().summary().length;
72131       if (val === _numChanges) return;
72132       _numChanges = val;
72133       if (tooltipBehavior) {
72134         tooltipBehavior.title(() => _t.append(_numChanges > 0 ? "save.help" : "save.no_changes")).keys([key]);
72135       }
72136       if (button) {
72137         button.classed("disabled", isDisabled()).style("background", bgColor(_numChanges));
72138         button.select("span.count").text(_numChanges);
72139       }
72140     }
72141     tool.render = function(selection2) {
72142       tooltipBehavior = uiTooltip().placement("bottom").title(() => _t.append("save.no_changes")).keys([key]).scrollContainer(context.container().select(".top-toolbar"));
72143       var lastPointerUpType;
72144       button = selection2.append("button").attr("class", "save disabled bar-button").on("pointerup", function(d3_event) {
72145         lastPointerUpType = d3_event.pointerType;
72146       }).on("click", function(d3_event) {
72147         save(d3_event);
72148         if (_numChanges === 0 && (lastPointerUpType === "touch" || lastPointerUpType === "pen")) {
72149           context.ui().flash.duration(2e3).iconName("#iD-icon-save").iconClass("disabled").label(_t.append("save.no_changes"))();
72150         }
72151         lastPointerUpType = null;
72152       }).call(tooltipBehavior);
72153       button.call(svgIcon("#iD-icon-save"));
72154       button.append("span").attr("class", "count").attr("aria-hidden", "true").text("0");
72155       updateCount();
72156       context.keybinding().on(key, save, true);
72157       context.history().on("change.save", updateCount);
72158       context.on("enter.save", function() {
72159         if (button) {
72160           button.classed("disabled", isDisabled());
72161           if (isSaving()) {
72162             button.call(tooltipBehavior.hide);
72163           }
72164         }
72165       });
72166     };
72167     tool.uninstall = function() {
72168       context.keybinding().off(key, true);
72169       context.history().on("change.save", null);
72170       context.on("enter.save", null);
72171       button = null;
72172       tooltipBehavior = null;
72173     };
72174     return tool;
72175   }
72176   var init_save = __esm({
72177     "modules/ui/tools/save.js"() {
72178       "use strict";
72179       init_src8();
72180       init_localizer();
72181       init_modes2();
72182       init_svg();
72183       init_cmd();
72184       init_tooltip();
72185     }
72186   });
72187
72188   // modules/ui/tools/sidebar_toggle.js
72189   var sidebar_toggle_exports = {};
72190   __export(sidebar_toggle_exports, {
72191     uiToolSidebarToggle: () => uiToolSidebarToggle
72192   });
72193   function uiToolSidebarToggle(context) {
72194     var tool = {
72195       id: "sidebar_toggle",
72196       label: _t.append("toolbar.inspect")
72197     };
72198     tool.render = function(selection2) {
72199       selection2.append("button").attr("class", "bar-button").attr("aria-label", _t("sidebar.tooltip")).on("click", function() {
72200         context.ui().sidebar.toggle();
72201       }).call(
72202         uiTooltip().placement("bottom").title(() => _t.append("sidebar.tooltip")).keys([_t("sidebar.key")]).scrollContainer(context.container().select(".top-toolbar"))
72203       ).call(svgIcon("#iD-icon-sidebar-" + (_mainLocalizer.textDirection() === "rtl" ? "right" : "left")));
72204     };
72205     return tool;
72206   }
72207   var init_sidebar_toggle = __esm({
72208     "modules/ui/tools/sidebar_toggle.js"() {
72209       "use strict";
72210       init_localizer();
72211       init_svg();
72212       init_tooltip();
72213     }
72214   });
72215
72216   // modules/ui/tools/undo_redo.js
72217   var undo_redo_exports = {};
72218   __export(undo_redo_exports, {
72219     uiToolUndoRedo: () => uiToolUndoRedo
72220   });
72221   function uiToolUndoRedo(context) {
72222     var tool = {
72223       id: "undo_redo",
72224       label: _t.append("toolbar.undo_redo")
72225     };
72226     var commands = [{
72227       id: "undo",
72228       cmd: uiCmd("\u2318Z"),
72229       action: function() {
72230         context.undo();
72231       },
72232       annotation: function() {
72233         return context.history().undoAnnotation();
72234       },
72235       icon: "iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")
72236     }, {
72237       id: "redo",
72238       cmd: uiCmd("\u2318\u21E7Z"),
72239       action: function() {
72240         context.redo();
72241       },
72242       annotation: function() {
72243         return context.history().redoAnnotation();
72244       },
72245       icon: "iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "undo" : "redo")
72246     }];
72247     function editable() {
72248       return context.mode() && context.mode().id !== "save" && context.map().editableDataEnabled(
72249         true
72250         /* ignore min zoom */
72251       );
72252     }
72253     tool.render = function(selection2) {
72254       var tooltipBehavior = uiTooltip().placement("bottom").title(function(d2) {
72255         return d2.annotation() ? _t.append(d2.id + ".tooltip", { action: d2.annotation() }) : _t.append(d2.id + ".nothing");
72256       }).keys(function(d2) {
72257         return [d2.cmd];
72258       }).scrollContainer(context.container().select(".top-toolbar"));
72259       var lastPointerUpType;
72260       var buttons = selection2.selectAll("button").data(commands).enter().append("button").attr("class", function(d2) {
72261         return "disabled " + d2.id + "-button bar-button";
72262       }).on("pointerup", function(d3_event) {
72263         lastPointerUpType = d3_event.pointerType;
72264       }).on("click", function(d3_event, d2) {
72265         d3_event.preventDefault();
72266         var annotation = d2.annotation();
72267         if (editable() && annotation) {
72268           d2.action();
72269         }
72270         if (editable() && (lastPointerUpType === "touch" || lastPointerUpType === "pen")) {
72271           var label = annotation ? _t.append(d2.id + ".tooltip", { action: annotation }) : _t.append(d2.id + ".nothing");
72272           context.ui().flash.duration(2e3).iconName("#" + d2.icon).iconClass(annotation ? "" : "disabled").label(label)();
72273         }
72274         lastPointerUpType = null;
72275       }).call(tooltipBehavior);
72276       buttons.each(function(d2) {
72277         select_default2(this).call(svgIcon("#" + d2.icon));
72278       });
72279       context.keybinding().on(commands[0].cmd, function(d3_event) {
72280         d3_event.preventDefault();
72281         if (editable()) commands[0].action();
72282       }).on(commands[1].cmd, function(d3_event) {
72283         d3_event.preventDefault();
72284         if (editable()) commands[1].action();
72285       });
72286       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
72287       context.map().on("move.undo_redo", debouncedUpdate).on("drawn.undo_redo", debouncedUpdate);
72288       context.history().on("change.undo_redo", function(difference2) {
72289         if (difference2) update();
72290       });
72291       context.on("enter.undo_redo", update);
72292       function update() {
72293         buttons.classed("disabled", function(d2) {
72294           return !editable() || !d2.annotation();
72295         }).each(function() {
72296           var selection3 = select_default2(this);
72297           if (!selection3.select(".tooltip.in").empty()) {
72298             selection3.call(tooltipBehavior.updateContent);
72299           }
72300         });
72301       }
72302     };
72303     tool.uninstall = function() {
72304       context.keybinding().off(commands[0].cmd).off(commands[1].cmd);
72305       context.map().on("move.undo_redo", null).on("drawn.undo_redo", null);
72306       context.history().on("change.undo_redo", null);
72307       context.on("enter.undo_redo", null);
72308     };
72309     return tool;
72310   }
72311   var init_undo_redo = __esm({
72312     "modules/ui/tools/undo_redo.js"() {
72313       "use strict";
72314       init_debounce();
72315       init_src5();
72316       init_localizer();
72317       init_svg();
72318       init_cmd();
72319       init_tooltip();
72320     }
72321   });
72322
72323   // modules/ui/tools/index.js
72324   var tools_exports = {};
72325   __export(tools_exports, {
72326     uiToolDrawModes: () => uiToolDrawModes,
72327     uiToolNotes: () => uiToolNotes,
72328     uiToolSave: () => uiToolSave,
72329     uiToolSidebarToggle: () => uiToolSidebarToggle,
72330     uiToolUndoRedo: () => uiToolUndoRedo
72331   });
72332   var init_tools = __esm({
72333     "modules/ui/tools/index.js"() {
72334       "use strict";
72335       init_modes();
72336       init_notes2();
72337       init_save();
72338       init_sidebar_toggle();
72339       init_undo_redo();
72340     }
72341   });
72342
72343   // modules/ui/top_toolbar.js
72344   var top_toolbar_exports = {};
72345   __export(top_toolbar_exports, {
72346     uiTopToolbar: () => uiTopToolbar
72347   });
72348   function uiTopToolbar(context) {
72349     var sidebarToggle = uiToolSidebarToggle(context), modes = uiToolDrawModes(context), notes = uiToolNotes(context), undoRedo = uiToolUndoRedo(context), save = uiToolSave(context);
72350     function notesEnabled() {
72351       var noteLayer = context.layers().layer("notes");
72352       return noteLayer && noteLayer.enabled();
72353     }
72354     function topToolbar(bar) {
72355       bar.on("wheel.topToolbar", function(d3_event) {
72356         if (!d3_event.deltaX) {
72357           bar.node().scrollLeft += d3_event.deltaY;
72358         }
72359       });
72360       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
72361       context.layers().on("change.topToolbar", debouncedUpdate);
72362       update();
72363       function update() {
72364         var tools = [
72365           sidebarToggle,
72366           "spacer",
72367           modes
72368         ];
72369         tools.push("spacer");
72370         if (notesEnabled()) {
72371           tools = tools.concat([notes, "spacer"]);
72372         }
72373         tools = tools.concat([undoRedo, save]);
72374         var toolbarItems = bar.selectAll(".toolbar-item").data(tools, function(d2) {
72375           return d2.id || d2;
72376         });
72377         toolbarItems.exit().each(function(d2) {
72378           if (d2.uninstall) {
72379             d2.uninstall();
72380           }
72381         }).remove();
72382         var itemsEnter = toolbarItems.enter().append("div").attr("class", function(d2) {
72383           var classes = "toolbar-item " + (d2.id || d2).replace("_", "-");
72384           if (d2.klass) classes += " " + d2.klass;
72385           return classes;
72386         });
72387         var actionableItems = itemsEnter.filter(function(d2) {
72388           return d2 !== "spacer";
72389         });
72390         actionableItems.append("div").attr("class", "item-content").each(function(d2) {
72391           select_default2(this).call(d2.render, bar);
72392         });
72393         actionableItems.append("div").attr("class", "item-label").each(function(d2) {
72394           d2.label(select_default2(this));
72395         });
72396       }
72397     }
72398     return topToolbar;
72399   }
72400   var init_top_toolbar = __esm({
72401     "modules/ui/top_toolbar.js"() {
72402       "use strict";
72403       init_src5();
72404       init_debounce();
72405       init_tools();
72406     }
72407   });
72408
72409   // modules/ui/version.js
72410   var version_exports = {};
72411   __export(version_exports, {
72412     uiVersion: () => uiVersion
72413   });
72414   function uiVersion(context) {
72415     var currVersion = context.version;
72416     var matchedVersion = currVersion.match(/\d+\.\d+\.\d+.*/);
72417     if (sawVersion === null && matchedVersion !== null) {
72418       if (corePreferences("sawVersion")) {
72419         isNewUser = false;
72420         isNewVersion = corePreferences("sawVersion") !== currVersion && currVersion.indexOf("-") === -1;
72421       } else {
72422         isNewUser = true;
72423         isNewVersion = true;
72424       }
72425       corePreferences("sawVersion", currVersion);
72426       sawVersion = currVersion;
72427     }
72428     return function(selection2) {
72429       selection2.append("a").attr("target", "_blank").attr("href", "https://github.com/openstreetmap/iD").text(currVersion);
72430       if (isNewVersion && !isNewUser) {
72431         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(
72432           uiTooltip().title(() => _t.append("version.whats_new", { version: currVersion })).placement("top").scrollContainer(context.container().select(".main-footer-wrap"))
72433         );
72434       }
72435     };
72436   }
72437   var sawVersion, isNewVersion, isNewUser;
72438   var init_version = __esm({
72439     "modules/ui/version.js"() {
72440       "use strict";
72441       init_preferences();
72442       init_localizer();
72443       init_icon();
72444       init_tooltip();
72445       sawVersion = null;
72446       isNewVersion = false;
72447       isNewUser = false;
72448     }
72449   });
72450
72451   // modules/ui/zoom.js
72452   var zoom_exports = {};
72453   __export(zoom_exports, {
72454     uiZoom: () => uiZoom
72455   });
72456   function uiZoom(context) {
72457     var zooms = [{
72458       id: "zoom-in",
72459       icon: "iD-icon-plus",
72460       title: _t.append("zoom.in"),
72461       action: zoomIn,
72462       disabled: function() {
72463         return !context.map().canZoomIn();
72464       },
72465       disabledTitle: _t.append("zoom.disabled.in"),
72466       key: "+"
72467     }, {
72468       id: "zoom-out",
72469       icon: "iD-icon-minus",
72470       title: _t.append("zoom.out"),
72471       action: zoomOut,
72472       disabled: function() {
72473         return !context.map().canZoomOut();
72474       },
72475       disabledTitle: _t.append("zoom.disabled.out"),
72476       key: "-"
72477     }];
72478     function zoomIn(d3_event) {
72479       if (d3_event.shiftKey) return;
72480       d3_event.preventDefault();
72481       context.map().zoomIn();
72482     }
72483     function zoomOut(d3_event) {
72484       if (d3_event.shiftKey) return;
72485       d3_event.preventDefault();
72486       context.map().zoomOut();
72487     }
72488     function zoomInFurther(d3_event) {
72489       if (d3_event.shiftKey) return;
72490       d3_event.preventDefault();
72491       context.map().zoomInFurther();
72492     }
72493     function zoomOutFurther(d3_event) {
72494       if (d3_event.shiftKey) return;
72495       d3_event.preventDefault();
72496       context.map().zoomOutFurther();
72497     }
72498     return function(selection2) {
72499       var tooltipBehavior = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(function(d2) {
72500         if (d2.disabled()) {
72501           return d2.disabledTitle;
72502         }
72503         return d2.title;
72504       }).keys(function(d2) {
72505         return [d2.key];
72506       });
72507       var lastPointerUpType;
72508       var buttons = selection2.selectAll("button").data(zooms).enter().append("button").attr("class", function(d2) {
72509         return d2.id;
72510       }).on("pointerup.editor", function(d3_event) {
72511         lastPointerUpType = d3_event.pointerType;
72512       }).on("click.editor", function(d3_event, d2) {
72513         if (!d2.disabled()) {
72514           d2.action(d3_event);
72515         } else if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
72516           context.ui().flash.duration(2e3).iconName("#" + d2.icon).iconClass("disabled").label(d2.disabledTitle)();
72517         }
72518         lastPointerUpType = null;
72519       }).call(tooltipBehavior);
72520       buttons.each(function(d2) {
72521         select_default2(this).call(svgIcon("#" + d2.icon, "light"));
72522       });
72523       utilKeybinding.plusKeys.forEach(function(key) {
72524         context.keybinding().on([key], zoomIn);
72525         context.keybinding().on([uiCmd("\u2325" + key)], zoomInFurther);
72526       });
72527       utilKeybinding.minusKeys.forEach(function(key) {
72528         context.keybinding().on([key], zoomOut);
72529         context.keybinding().on([uiCmd("\u2325" + key)], zoomOutFurther);
72530       });
72531       function updateButtonStates() {
72532         buttons.classed("disabled", function(d2) {
72533           return d2.disabled();
72534         }).each(function() {
72535           var selection3 = select_default2(this);
72536           if (!selection3.select(".tooltip.in").empty()) {
72537             selection3.call(tooltipBehavior.updateContent);
72538           }
72539         });
72540       }
72541       updateButtonStates();
72542       context.map().on("move.uiZoom", updateButtonStates);
72543     };
72544   }
72545   var init_zoom3 = __esm({
72546     "modules/ui/zoom.js"() {
72547       "use strict";
72548       init_src5();
72549       init_localizer();
72550       init_icon();
72551       init_cmd();
72552       init_tooltip();
72553       init_keybinding();
72554     }
72555   });
72556
72557   // modules/ui/zoom_to_selection.js
72558   var zoom_to_selection_exports = {};
72559   __export(zoom_to_selection_exports, {
72560     uiZoomToSelection: () => uiZoomToSelection
72561   });
72562   function uiZoomToSelection(context) {
72563     function isDisabled() {
72564       var mode = context.mode();
72565       return !mode || !mode.zoomToSelected;
72566     }
72567     var _lastPointerUpType;
72568     function pointerup(d3_event) {
72569       _lastPointerUpType = d3_event.pointerType;
72570     }
72571     function click(d3_event) {
72572       d3_event.preventDefault();
72573       if (isDisabled()) {
72574         if (_lastPointerUpType === "touch" || _lastPointerUpType === "pen") {
72575           context.ui().flash.duration(2e3).iconName("#iD-icon-framed-dot").iconClass("disabled").label(_t.append("inspector.zoom_to.no_selection"))();
72576         }
72577       } else {
72578         var mode = context.mode();
72579         if (mode && mode.zoomToSelected) {
72580           mode.zoomToSelected();
72581         }
72582       }
72583       _lastPointerUpType = null;
72584     }
72585     return function(selection2) {
72586       var tooltipBehavior = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(function() {
72587         if (isDisabled()) {
72588           return _t.append("inspector.zoom_to.no_selection");
72589         }
72590         return _t.append("inspector.zoom_to.title");
72591       }).keys([_t("inspector.zoom_to.key")]);
72592       var button = selection2.append("button").on("pointerup", pointerup).on("click", click).call(svgIcon("#iD-icon-framed-dot", "light")).call(tooltipBehavior);
72593       function setEnabledState() {
72594         button.classed("disabled", isDisabled());
72595         if (!button.select(".tooltip.in").empty()) {
72596           button.call(tooltipBehavior.updateContent);
72597         }
72598       }
72599       context.on("enter.uiZoomToSelection", setEnabledState);
72600       setEnabledState();
72601     };
72602   }
72603   var init_zoom_to_selection = __esm({
72604     "modules/ui/zoom_to_selection.js"() {
72605       "use strict";
72606       init_localizer();
72607       init_tooltip();
72608       init_icon();
72609     }
72610   });
72611
72612   // modules/ui/pane.js
72613   var pane_exports = {};
72614   __export(pane_exports, {
72615     uiPane: () => uiPane
72616   });
72617   function uiPane(id2, context) {
72618     var _key;
72619     var _label = "";
72620     var _description = "";
72621     var _iconName = "";
72622     var _sections;
72623     var _paneSelection = select_default2(null);
72624     var _paneTooltip;
72625     var pane = {
72626       id: id2
72627     };
72628     pane.label = function(val) {
72629       if (!arguments.length) return _label;
72630       _label = val;
72631       return pane;
72632     };
72633     pane.key = function(val) {
72634       if (!arguments.length) return _key;
72635       _key = val;
72636       return pane;
72637     };
72638     pane.description = function(val) {
72639       if (!arguments.length) return _description;
72640       _description = val;
72641       return pane;
72642     };
72643     pane.iconName = function(val) {
72644       if (!arguments.length) return _iconName;
72645       _iconName = val;
72646       return pane;
72647     };
72648     pane.sections = function(val) {
72649       if (!arguments.length) return _sections;
72650       _sections = val;
72651       return pane;
72652     };
72653     pane.selection = function() {
72654       return _paneSelection;
72655     };
72656     function hidePane() {
72657       context.ui().togglePanes();
72658     }
72659     pane.togglePane = function(d3_event) {
72660       if (d3_event) d3_event.preventDefault();
72661       _paneTooltip.hide();
72662       context.ui().togglePanes(!_paneSelection.classed("shown") ? _paneSelection : void 0);
72663     };
72664     pane.renderToggleButton = function(selection2) {
72665       if (!_paneTooltip) {
72666         _paneTooltip = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(() => _description).keys([_key]);
72667       }
72668       selection2.append("button").on("click", pane.togglePane).call(svgIcon("#" + _iconName, "light")).call(_paneTooltip);
72669     };
72670     pane.renderContent = function(selection2) {
72671       if (_sections) {
72672         _sections.forEach(function(section) {
72673           selection2.call(section.render);
72674         });
72675       }
72676     };
72677     pane.renderPane = function(selection2) {
72678       _paneSelection = selection2.append("div").attr("class", "fillL map-pane hide " + id2 + "-pane").attr("pane", id2);
72679       var heading2 = _paneSelection.append("div").attr("class", "pane-heading");
72680       heading2.append("h2").text("").call(_label);
72681       heading2.append("button").attr("title", _t("icons.close")).on("click", hidePane).call(svgIcon("#iD-icon-close"));
72682       _paneSelection.append("div").attr("class", "pane-content").call(pane.renderContent);
72683       if (_key) {
72684         context.keybinding().on(_key, pane.togglePane);
72685       }
72686     };
72687     return pane;
72688   }
72689   var init_pane = __esm({
72690     "modules/ui/pane.js"() {
72691       "use strict";
72692       init_src5();
72693       init_icon();
72694       init_localizer();
72695       init_tooltip();
72696     }
72697   });
72698
72699   // modules/ui/sections/background_display_options.js
72700   var background_display_options_exports = {};
72701   __export(background_display_options_exports, {
72702     uiSectionBackgroundDisplayOptions: () => uiSectionBackgroundDisplayOptions
72703   });
72704   function uiSectionBackgroundDisplayOptions(context) {
72705     var section = uiSection("background-display-options", context).label(() => _t.append("background.display_options")).disclosureContent(renderDisclosureContent);
72706     var _storedOpacity = corePreferences("background-opacity");
72707     var _minVal = 0;
72708     var _maxVal = 3;
72709     var _sliders = ["brightness", "contrast", "saturation", "sharpness"];
72710     var _options = {
72711       brightness: _storedOpacity !== null ? +_storedOpacity : 1,
72712       contrast: 1,
72713       saturation: 1,
72714       sharpness: 1
72715     };
72716     function clamp3(x2, min3, max3) {
72717       return Math.max(min3, Math.min(x2, max3));
72718     }
72719     function updateValue(d2, val) {
72720       val = clamp3(val, _minVal, _maxVal);
72721       _options[d2] = val;
72722       context.background()[d2](val);
72723       if (d2 === "brightness") {
72724         corePreferences("background-opacity", val);
72725       }
72726       section.reRender();
72727     }
72728     function renderDisclosureContent(selection2) {
72729       var container = selection2.selectAll(".display-options-container").data([0]);
72730       var containerEnter = container.enter().append("div").attr("class", "display-options-container controls-list");
72731       var slidersEnter = containerEnter.selectAll(".display-control").data(_sliders).enter().append("label").attr("class", function(d2) {
72732         return "display-control display-control-" + d2;
72733       });
72734       slidersEnter.html(function(d2) {
72735         return _t.html("background." + d2);
72736       }).append("span").attr("class", function(d2) {
72737         return "display-option-value display-option-value-" + d2;
72738       });
72739       var sildersControlEnter = slidersEnter.append("div").attr("class", "control-wrap");
72740       sildersControlEnter.append("input").attr("class", function(d2) {
72741         return "display-option-input display-option-input-" + d2;
72742       }).attr("type", "range").attr("min", _minVal).attr("max", _maxVal).attr("step", "0.01").on("input", function(d3_event, d2) {
72743         var val = select_default2(this).property("value");
72744         if (!val && d3_event && d3_event.target) {
72745           val = d3_event.target.value;
72746         }
72747         updateValue(d2, val);
72748       });
72749       sildersControlEnter.append("button").attr("title", function(d2) {
72750         return `${_t("background.reset")} ${_t("background." + d2)}`;
72751       }).attr("class", function(d2) {
72752         return "display-option-reset display-option-reset-" + d2;
72753       }).on("click", function(d3_event, d2) {
72754         if (d3_event.button !== 0) return;
72755         updateValue(d2, 1);
72756       }).call(svgIcon("#iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")));
72757       containerEnter.append("a").attr("class", "display-option-resetlink").attr("role", "button").attr("href", "#").call(_t.append("background.reset_all")).on("click", function(d3_event) {
72758         d3_event.preventDefault();
72759         for (var i3 = 0; i3 < _sliders.length; i3++) {
72760           updateValue(_sliders[i3], 1);
72761         }
72762       });
72763       container = containerEnter.merge(container);
72764       container.selectAll(".display-option-input").property("value", function(d2) {
72765         return _options[d2];
72766       });
72767       container.selectAll(".display-option-value").text(function(d2) {
72768         return Math.floor(_options[d2] * 100) + "%";
72769       });
72770       container.selectAll(".display-option-reset").classed("disabled", function(d2) {
72771         return _options[d2] === 1;
72772       });
72773       if (containerEnter.size() && _options.brightness !== 1) {
72774         context.background().brightness(_options.brightness);
72775       }
72776     }
72777     return section;
72778   }
72779   var init_background_display_options = __esm({
72780     "modules/ui/sections/background_display_options.js"() {
72781       "use strict";
72782       init_src5();
72783       init_preferences();
72784       init_localizer();
72785       init_icon();
72786       init_section();
72787     }
72788   });
72789
72790   // modules/ui/settings/custom_background.js
72791   var custom_background_exports = {};
72792   __export(custom_background_exports, {
72793     uiSettingsCustomBackground: () => uiSettingsCustomBackground
72794   });
72795   function uiSettingsCustomBackground() {
72796     var dispatch14 = dispatch_default("change");
72797     function render(selection2) {
72798       var _origSettings = {
72799         template: corePreferences("background-custom-template")
72800       };
72801       var _currSettings = {
72802         template: corePreferences("background-custom-template")
72803       };
72804       var example = "https://tile.openstreetmap.org/{zoom}/{x}/{y}.png";
72805       var modal = uiConfirm(selection2).okButton();
72806       modal.classed("settings-modal settings-custom-background", true);
72807       modal.select(".modal-section.header").append("h3").call(_t.append("settings.custom_background.header"));
72808       var textSection = modal.select(".modal-section.message-text");
72809       var instructions = `${_t.html("settings.custom_background.instructions.info")}
72810
72811 #### ${_t.html("settings.custom_background.instructions.wms.tokens_label")}
72812 * ${_t.html("settings.custom_background.instructions.wms.tokens.proj")}
72813 * ${_t.html("settings.custom_background.instructions.wms.tokens.wkid")}
72814 * ${_t.html("settings.custom_background.instructions.wms.tokens.dimensions")}
72815 * ${_t.html("settings.custom_background.instructions.wms.tokens.bbox")}
72816
72817 #### ${_t.html("settings.custom_background.instructions.tms.tokens_label")}
72818 * ${_t.html("settings.custom_background.instructions.tms.tokens.xyz")}
72819 * ${_t.html("settings.custom_background.instructions.tms.tokens.flipped_y")}
72820 * ${_t.html("settings.custom_background.instructions.tms.tokens.switch")}
72821 * ${_t.html("settings.custom_background.instructions.tms.tokens.quadtile")}
72822 * ${_t.html("settings.custom_background.instructions.tms.tokens.scale_factor")}
72823
72824 #### ${_t.html("settings.custom_background.instructions.example")}
72825 \`${example}\``;
72826       textSection.append("div").attr("class", "instructions-template").html(marked(instructions));
72827       textSection.append("textarea").attr("class", "field-template").attr("placeholder", _t("settings.custom_background.template.placeholder")).call(utilNoAuto).property("value", _currSettings.template);
72828       var buttonSection = modal.select(".modal-section.buttons");
72829       buttonSection.insert("button", ".ok-button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
72830       buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
72831       buttonSection.select(".ok-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
72832       function isSaveDisabled() {
72833         return null;
72834       }
72835       function clickCancel() {
72836         textSection.select(".field-template").property("value", _origSettings.template);
72837         corePreferences("background-custom-template", _origSettings.template);
72838         this.blur();
72839         modal.close();
72840       }
72841       function clickSave() {
72842         _currSettings.template = textSection.select(".field-template").property("value");
72843         corePreferences("background-custom-template", _currSettings.template);
72844         this.blur();
72845         modal.close();
72846         dispatch14.call("change", this, _currSettings);
72847       }
72848     }
72849     return utilRebind(render, dispatch14, "on");
72850   }
72851   var init_custom_background = __esm({
72852     "modules/ui/settings/custom_background.js"() {
72853       "use strict";
72854       init_src4();
72855       init_marked_esm();
72856       init_preferences();
72857       init_localizer();
72858       init_confirm();
72859       init_util();
72860     }
72861   });
72862
72863   // modules/ui/sections/background_list.js
72864   var background_list_exports = {};
72865   __export(background_list_exports, {
72866     uiSectionBackgroundList: () => uiSectionBackgroundList
72867   });
72868   function uiSectionBackgroundList(context) {
72869     var _backgroundList = select_default2(null);
72870     var _customSource = context.background().findSource("custom");
72871     var _settingsCustomBackground = uiSettingsCustomBackground(context).on("change", customChanged);
72872     var section = uiSection("background-list", context).label(() => _t.append("background.backgrounds")).disclosureContent(renderDisclosureContent);
72873     function previousBackgroundID() {
72874       return corePreferences("background-last-used-toggle");
72875     }
72876     function renderDisclosureContent(selection2) {
72877       var container = selection2.selectAll(".layer-background-list").data([0]);
72878       _backgroundList = container.enter().append("ul").attr("class", "layer-list layer-background-list").attr("dir", "auto").merge(container);
72879       var bgExtrasListEnter = selection2.selectAll(".bg-extras-list").data([0]).enter().append("ul").attr("class", "layer-list bg-extras-list");
72880       var minimapLabelEnter = bgExtrasListEnter.append("li").attr("class", "minimap-toggle-item").append("label").call(
72881         uiTooltip().title(() => _t.append("background.minimap.tooltip")).keys([_t("background.minimap.key")]).placement("top")
72882       );
72883       minimapLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
72884         d3_event.preventDefault();
72885         uiMapInMap.toggle();
72886       });
72887       minimapLabelEnter.append("span").call(_t.append("background.minimap.description"));
72888       var panelLabelEnter = bgExtrasListEnter.append("li").attr("class", "background-panel-toggle-item").append("label").call(
72889         uiTooltip().title(() => _t.append("background.panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.background.key"))]).placement("top")
72890       );
72891       panelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
72892         d3_event.preventDefault();
72893         context.ui().info.toggle("background");
72894       });
72895       panelLabelEnter.append("span").call(_t.append("background.panel.description"));
72896       var locPanelLabelEnter = bgExtrasListEnter.append("li").attr("class", "location-panel-toggle-item").append("label").call(
72897         uiTooltip().title(() => _t.append("background.location_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.location.key"))]).placement("top")
72898       );
72899       locPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
72900         d3_event.preventDefault();
72901         context.ui().info.toggle("location");
72902       });
72903       locPanelLabelEnter.append("span").call(_t.append("background.location_panel.description"));
72904       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"));
72905       _backgroundList.call(drawListItems, "radio", function(d3_event, d2) {
72906         chooseBackground(d2);
72907       }, function(d2) {
72908         return !d2.isHidden() && !d2.overlay;
72909       });
72910     }
72911     function setTooltips(selection2) {
72912       selection2.each(function(d2, i3, nodes) {
72913         var item = select_default2(this).select("label");
72914         var span = item.select("span");
72915         var placement = i3 < nodes.length / 2 ? "bottom" : "top";
72916         var hasDescription = d2.hasDescription();
72917         var isOverflowing = span.property("clientWidth") !== span.property("scrollWidth");
72918         item.call(uiTooltip().destroyAny);
72919         if (d2.id === previousBackgroundID()) {
72920           item.call(
72921             uiTooltip().placement(placement).title(() => _t.append("background.switch")).keys([uiCmd("\u2318" + _t("background.key"))])
72922           );
72923         } else if (hasDescription || isOverflowing) {
72924           item.call(
72925             uiTooltip().placement(placement).title(() => hasDescription ? d2.description() : d2.label())
72926           );
72927         }
72928       });
72929     }
72930     function drawListItems(layerList, type2, change, filter2) {
72931       var sources = context.background().sources(context.map().extent(), context.map().zoom(), true).filter(filter2).sort(function(a2, b2) {
72932         return a2.best() && !b2.best() ? -1 : b2.best() && !a2.best() ? 1 : descending(a2.area(), b2.area()) || ascending(a2.name(), b2.name()) || 0;
72933       });
72934       var layerLinks = layerList.selectAll("li").data(sources, function(d2, i3) {
72935         return d2.id + "---" + i3;
72936       });
72937       layerLinks.exit().remove();
72938       var enter = layerLinks.enter().append("li").classed("layer-custom", function(d2) {
72939         return d2.id === "custom";
72940       }).classed("best", function(d2) {
72941         return d2.best();
72942       });
72943       var label = enter.append("label");
72944       label.append("input").attr("type", type2).attr("name", "background-layer").attr("value", function(d2) {
72945         return d2.id;
72946       }).on("change", change);
72947       label.append("span").each(function(d2) {
72948         d2.label()(select_default2(this));
72949       });
72950       enter.filter(function(d2) {
72951         return d2.id === "custom";
72952       }).append("button").attr("class", "layer-browse").call(
72953         uiTooltip().title(() => _t.append("settings.custom_background.tooltip")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
72954       ).on("click", function(d3_event) {
72955         d3_event.preventDefault();
72956         editCustom();
72957       }).call(svgIcon("#iD-icon-more"));
72958       enter.filter(function(d2) {
72959         return d2.best();
72960       }).append("div").attr("class", "best").call(
72961         uiTooltip().title(() => _t.append("background.best_imagery")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
72962       ).append("span").text("\u2605");
72963       layerList.call(updateLayerSelections);
72964     }
72965     function updateLayerSelections(selection2) {
72966       function active(d2) {
72967         return context.background().showsLayer(d2);
72968       }
72969       selection2.selectAll("li").classed("active", active).classed("switch", function(d2) {
72970         return d2.id === previousBackgroundID();
72971       }).call(setTooltips).selectAll("input").property("checked", active);
72972     }
72973     function chooseBackground(d2) {
72974       if (d2.id === "custom" && !d2.template()) {
72975         return editCustom();
72976       }
72977       var previousBackground = context.background().baseLayerSource();
72978       corePreferences("background-last-used-toggle", previousBackground.id);
72979       corePreferences("background-last-used", d2.id);
72980       context.background().baseLayerSource(d2);
72981     }
72982     function customChanged(d2) {
72983       if (d2 && d2.template) {
72984         _customSource.template(d2.template);
72985         chooseBackground(_customSource);
72986       } else {
72987         _customSource.template("");
72988         chooseBackground(context.background().findSource("none"));
72989       }
72990     }
72991     function editCustom() {
72992       context.container().call(_settingsCustomBackground);
72993     }
72994     context.background().on("change.background_list", function() {
72995       _backgroundList.call(updateLayerSelections);
72996     });
72997     context.map().on(
72998       "move.background_list",
72999       debounce_default(function() {
73000         window.requestIdleCallback(section.reRender);
73001       }, 1e3)
73002     );
73003     return section;
73004   }
73005   var init_background_list = __esm({
73006     "modules/ui/sections/background_list.js"() {
73007       "use strict";
73008       init_debounce();
73009       init_src();
73010       init_src5();
73011       init_preferences();
73012       init_localizer();
73013       init_tooltip();
73014       init_icon();
73015       init_cmd();
73016       init_custom_background();
73017       init_map_in_map();
73018       init_section();
73019     }
73020   });
73021
73022   // modules/ui/sections/background_offset.js
73023   var background_offset_exports = {};
73024   __export(background_offset_exports, {
73025     uiSectionBackgroundOffset: () => uiSectionBackgroundOffset
73026   });
73027   function uiSectionBackgroundOffset(context) {
73028     var section = uiSection("background-offset", context).label(() => _t.append("background.fix_misalignment")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
73029     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
73030     var _directions = [
73031       ["top", [0, -0.5]],
73032       ["left", [-0.5, 0]],
73033       ["right", [0.5, 0]],
73034       ["bottom", [0, 0.5]]
73035     ];
73036     function updateValue() {
73037       var meters = geoOffsetToMeters(context.background().offset());
73038       var x2 = +meters[0].toFixed(2);
73039       var y2 = +meters[1].toFixed(2);
73040       context.container().selectAll(".nudge-inner-rect").select("input").classed("error", false).property("value", x2 + ", " + y2);
73041       context.container().selectAll(".nudge-reset").classed("disabled", function() {
73042         return x2 === 0 && y2 === 0;
73043       });
73044     }
73045     function resetOffset() {
73046       context.background().offset([0, 0]);
73047       updateValue();
73048     }
73049     function nudge(d2) {
73050       context.background().nudge(d2, context.map().zoom());
73051       updateValue();
73052     }
73053     function inputOffset() {
73054       var input = select_default2(this);
73055       var d2 = input.node().value;
73056       if (d2 === "") return resetOffset();
73057       d2 = d2.replace(/;/g, ",").split(",").map(function(n3) {
73058         return !isNaN(n3) && n3;
73059       });
73060       if (d2.length !== 2 || !d2[0] || !d2[1]) {
73061         input.classed("error", true);
73062         return;
73063       }
73064       context.background().offset(geoMetersToOffset(d2));
73065       updateValue();
73066     }
73067     function dragOffset(d3_event) {
73068       if (d3_event.button !== 0) return;
73069       var origin = [d3_event.clientX, d3_event.clientY];
73070       var pointerId = d3_event.pointerId || "mouse";
73071       context.container().append("div").attr("class", "nudge-surface");
73072       select_default2(window).on(_pointerPrefix + "move.drag-bg-offset", pointermove).on(_pointerPrefix + "up.drag-bg-offset", pointerup);
73073       if (_pointerPrefix === "pointer") {
73074         select_default2(window).on("pointercancel.drag-bg-offset", pointerup);
73075       }
73076       function pointermove(d3_event2) {
73077         if (pointerId !== (d3_event2.pointerId || "mouse")) return;
73078         var latest = [d3_event2.clientX, d3_event2.clientY];
73079         var d2 = [
73080           -(origin[0] - latest[0]) / 4,
73081           -(origin[1] - latest[1]) / 4
73082         ];
73083         origin = latest;
73084         nudge(d2);
73085       }
73086       function pointerup(d3_event2) {
73087         if (pointerId !== (d3_event2.pointerId || "mouse")) return;
73088         if (d3_event2.button !== 0) return;
73089         context.container().selectAll(".nudge-surface").remove();
73090         select_default2(window).on(".drag-bg-offset", null);
73091       }
73092     }
73093     function renderDisclosureContent(selection2) {
73094       var container = selection2.selectAll(".nudge-container").data([0]);
73095       var containerEnter = container.enter().append("div").attr("class", "nudge-container");
73096       containerEnter.append("div").attr("class", "nudge-instructions").call(_t.append("background.offset"));
73097       var nudgeWrapEnter = containerEnter.append("div").attr("class", "nudge-controls-wrap");
73098       var nudgeEnter = nudgeWrapEnter.append("div").attr("class", "nudge-outer-rect").on(_pointerPrefix + "down", dragOffset);
73099       nudgeEnter.append("div").attr("class", "nudge-inner-rect").append("input").attr("type", "text").attr("aria-label", _t("background.offset_label")).on("change", inputOffset);
73100       nudgeWrapEnter.append("div").selectAll("button").data(_directions).enter().append("button").attr("title", function(d2) {
73101         return _t(`background.nudge.${d2[0]}`);
73102       }).attr("class", function(d2) {
73103         return d2[0] + " nudge";
73104       }).on("click", function(d3_event, d2) {
73105         nudge(d2[1]);
73106       });
73107       nudgeWrapEnter.append("button").attr("title", _t("background.reset")).attr("class", "nudge-reset disabled").on("click", function(d3_event) {
73108         d3_event.preventDefault();
73109         resetOffset();
73110       }).call(svgIcon("#iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")));
73111       updateValue();
73112     }
73113     context.background().on("change.backgroundOffset-update", updateValue);
73114     return section;
73115   }
73116   var init_background_offset = __esm({
73117     "modules/ui/sections/background_offset.js"() {
73118       "use strict";
73119       init_src5();
73120       init_localizer();
73121       init_geo2();
73122       init_icon();
73123       init_section();
73124     }
73125   });
73126
73127   // modules/ui/sections/overlay_list.js
73128   var overlay_list_exports = {};
73129   __export(overlay_list_exports, {
73130     uiSectionOverlayList: () => uiSectionOverlayList
73131   });
73132   function uiSectionOverlayList(context) {
73133     var section = uiSection("overlay-list", context).label(() => _t.append("background.overlays")).disclosureContent(renderDisclosureContent);
73134     var _overlayList = select_default2(null);
73135     function setTooltips(selection2) {
73136       selection2.each(function(d2, i3, nodes) {
73137         var item = select_default2(this).select("label");
73138         var span = item.select("span");
73139         var placement = i3 < nodes.length / 2 ? "bottom" : "top";
73140         var description = d2.description();
73141         var isOverflowing = span.property("clientWidth") !== span.property("scrollWidth");
73142         item.call(uiTooltip().destroyAny);
73143         if (description || isOverflowing) {
73144           item.call(
73145             uiTooltip().placement(placement).title(() => description || d2.name())
73146           );
73147         }
73148       });
73149     }
73150     function updateLayerSelections(selection2) {
73151       function active(d2) {
73152         return context.background().showsLayer(d2);
73153       }
73154       selection2.selectAll("li").classed("active", active).call(setTooltips).selectAll("input").property("checked", active);
73155     }
73156     function chooseOverlay(d3_event, d2) {
73157       d3_event.preventDefault();
73158       context.background().toggleOverlayLayer(d2);
73159       _overlayList.call(updateLayerSelections);
73160       document.activeElement.blur();
73161     }
73162     function drawListItems(layerList, type2, change, filter2) {
73163       var sources = context.background().sources(context.map().extent(), context.map().zoom(), true).filter(filter2);
73164       var layerLinks = layerList.selectAll("li").data(sources, function(d2) {
73165         return d2.name();
73166       });
73167       layerLinks.exit().remove();
73168       var enter = layerLinks.enter().append("li");
73169       var label = enter.append("label");
73170       label.append("input").attr("type", type2).attr("name", "layers").on("change", change);
73171       label.append("span").each(function(d2) {
73172         d2.label()(select_default2(this));
73173       });
73174       layerList.selectAll("li").sort(sortSources);
73175       layerList.call(updateLayerSelections);
73176       function sortSources(a2, b2) {
73177         return a2.best() && !b2.best() ? -1 : b2.best() && !a2.best() ? 1 : descending(a2.area(), b2.area()) || ascending(a2.name(), b2.name()) || 0;
73178       }
73179     }
73180     function renderDisclosureContent(selection2) {
73181       var container = selection2.selectAll(".layer-overlay-list").data([0]);
73182       _overlayList = container.enter().append("ul").attr("class", "layer-list layer-overlay-list").attr("dir", "auto").merge(container);
73183       _overlayList.call(drawListItems, "checkbox", chooseOverlay, function(d2) {
73184         return !d2.isHidden() && d2.overlay;
73185       });
73186     }
73187     context.map().on(
73188       "move.overlay_list",
73189       debounce_default(function() {
73190         window.requestIdleCallback(section.reRender);
73191       }, 1e3)
73192     );
73193     return section;
73194   }
73195   var init_overlay_list = __esm({
73196     "modules/ui/sections/overlay_list.js"() {
73197       "use strict";
73198       init_debounce();
73199       init_src();
73200       init_src5();
73201       init_localizer();
73202       init_tooltip();
73203       init_section();
73204     }
73205   });
73206
73207   // modules/ui/panes/background.js
73208   var background_exports3 = {};
73209   __export(background_exports3, {
73210     uiPaneBackground: () => uiPaneBackground
73211   });
73212   function uiPaneBackground(context) {
73213     var backgroundPane = uiPane("background", context).key(_t("background.key")).label(_t.append("background.title")).description(_t.append("background.description")).iconName("iD-icon-layers").sections([
73214       uiSectionBackgroundList(context),
73215       uiSectionOverlayList(context),
73216       uiSectionBackgroundDisplayOptions(context),
73217       uiSectionBackgroundOffset(context)
73218     ]);
73219     return backgroundPane;
73220   }
73221   var init_background3 = __esm({
73222     "modules/ui/panes/background.js"() {
73223       "use strict";
73224       init_localizer();
73225       init_pane();
73226       init_background_display_options();
73227       init_background_list();
73228       init_background_offset();
73229       init_overlay_list();
73230     }
73231   });
73232
73233   // modules/ui/panes/help.js
73234   var help_exports = {};
73235   __export(help_exports, {
73236     uiPaneHelp: () => uiPaneHelp
73237   });
73238   function uiPaneHelp(context) {
73239     var docKeys = [
73240       ["help", [
73241         "welcome",
73242         "open_data_h",
73243         "open_data",
73244         "before_start_h",
73245         "before_start",
73246         "open_source_h",
73247         "open_source",
73248         "open_source_attribution",
73249         "open_source_help"
73250       ]],
73251       ["overview", [
73252         "navigation_h",
73253         "navigation_drag",
73254         "navigation_zoom",
73255         "features_h",
73256         "features",
73257         "nodes_ways"
73258       ]],
73259       ["editing", [
73260         "select_h",
73261         "select_left_click",
73262         "select_right_click",
73263         "select_space",
73264         "multiselect_h",
73265         "multiselect",
73266         "multiselect_shift_click",
73267         "multiselect_lasso",
73268         "undo_redo_h",
73269         "undo_redo",
73270         "save_h",
73271         "save",
73272         "save_validation",
73273         "upload_h",
73274         "upload",
73275         "backups_h",
73276         "backups",
73277         "keyboard_h",
73278         "keyboard"
73279       ]],
73280       ["feature_editor", [
73281         "intro",
73282         "definitions",
73283         "type_h",
73284         "type",
73285         "type_picker",
73286         "fields_h",
73287         "fields_all_fields",
73288         "fields_example",
73289         "fields_add_field",
73290         "tags_h",
73291         "tags_all_tags",
73292         "tags_resources"
73293       ]],
73294       ["points", [
73295         "intro",
73296         "add_point_h",
73297         "add_point",
73298         "add_point_finish",
73299         "move_point_h",
73300         "move_point",
73301         "delete_point_h",
73302         "delete_point",
73303         "delete_point_command"
73304       ]],
73305       ["lines", [
73306         "intro",
73307         "add_line_h",
73308         "add_line",
73309         "add_line_draw",
73310         "add_line_continue",
73311         "add_line_finish",
73312         "modify_line_h",
73313         "modify_line_dragnode",
73314         "modify_line_addnode",
73315         "connect_line_h",
73316         "connect_line",
73317         "connect_line_display",
73318         "connect_line_drag",
73319         "connect_line_tag",
73320         "disconnect_line_h",
73321         "disconnect_line_command",
73322         "move_line_h",
73323         "move_line_command",
73324         "move_line_connected",
73325         "delete_line_h",
73326         "delete_line",
73327         "delete_line_command"
73328       ]],
73329       ["areas", [
73330         "intro",
73331         "point_or_area_h",
73332         "point_or_area",
73333         "add_area_h",
73334         "add_area_command",
73335         "add_area_draw",
73336         "add_area_continue",
73337         "add_area_finish",
73338         "square_area_h",
73339         "square_area_command",
73340         "modify_area_h",
73341         "modify_area_dragnode",
73342         "modify_area_addnode",
73343         "delete_area_h",
73344         "delete_area",
73345         "delete_area_command"
73346       ]],
73347       ["relations", [
73348         "intro",
73349         "edit_relation_h",
73350         "edit_relation",
73351         "edit_relation_add",
73352         "edit_relation_delete",
73353         "maintain_relation_h",
73354         "maintain_relation",
73355         "relation_types_h",
73356         "multipolygon_h",
73357         "multipolygon",
73358         "multipolygon_create",
73359         "multipolygon_merge",
73360         "turn_restriction_h",
73361         "turn_restriction",
73362         "turn_restriction_field",
73363         "turn_restriction_editing",
73364         "route_h",
73365         "route",
73366         "route_add",
73367         "boundary_h",
73368         "boundary",
73369         "boundary_add"
73370       ]],
73371       ["operations", [
73372         "intro",
73373         "intro_2",
73374         "straighten",
73375         "orthogonalize",
73376         "circularize",
73377         "move",
73378         "rotate",
73379         "reflect",
73380         "continue",
73381         "reverse",
73382         "disconnect",
73383         "split",
73384         "extract",
73385         "merge",
73386         "delete",
73387         "downgrade",
73388         "copy_paste"
73389       ]],
73390       ["notes", [
73391         "intro",
73392         "add_note_h",
73393         "add_note",
73394         "place_note",
73395         "move_note",
73396         "update_note_h",
73397         "update_note",
73398         "save_note_h",
73399         "save_note"
73400       ]],
73401       ["imagery", [
73402         "intro",
73403         "sources_h",
73404         "choosing",
73405         "sources",
73406         "offsets_h",
73407         "offset",
73408         "offset_change"
73409       ]],
73410       ["streetlevel", [
73411         "intro",
73412         "using_h",
73413         "using",
73414         "photos",
73415         "viewer"
73416       ]],
73417       ["gps", [
73418         "intro",
73419         "survey",
73420         "using_h",
73421         "using",
73422         "tracing",
73423         "upload"
73424       ]],
73425       ["qa", [
73426         "intro",
73427         "tools_h",
73428         "tools",
73429         "issues_h",
73430         "issues"
73431       ]]
73432     ];
73433     var headings = {
73434       "help.help.open_data_h": 3,
73435       "help.help.before_start_h": 3,
73436       "help.help.open_source_h": 3,
73437       "help.overview.navigation_h": 3,
73438       "help.overview.features_h": 3,
73439       "help.editing.select_h": 3,
73440       "help.editing.multiselect_h": 3,
73441       "help.editing.undo_redo_h": 3,
73442       "help.editing.save_h": 3,
73443       "help.editing.upload_h": 3,
73444       "help.editing.backups_h": 3,
73445       "help.editing.keyboard_h": 3,
73446       "help.feature_editor.type_h": 3,
73447       "help.feature_editor.fields_h": 3,
73448       "help.feature_editor.tags_h": 3,
73449       "help.points.add_point_h": 3,
73450       "help.points.move_point_h": 3,
73451       "help.points.delete_point_h": 3,
73452       "help.lines.add_line_h": 3,
73453       "help.lines.modify_line_h": 3,
73454       "help.lines.connect_line_h": 3,
73455       "help.lines.disconnect_line_h": 3,
73456       "help.lines.move_line_h": 3,
73457       "help.lines.delete_line_h": 3,
73458       "help.areas.point_or_area_h": 3,
73459       "help.areas.add_area_h": 3,
73460       "help.areas.square_area_h": 3,
73461       "help.areas.modify_area_h": 3,
73462       "help.areas.delete_area_h": 3,
73463       "help.relations.edit_relation_h": 3,
73464       "help.relations.maintain_relation_h": 3,
73465       "help.relations.relation_types_h": 2,
73466       "help.relations.multipolygon_h": 3,
73467       "help.relations.turn_restriction_h": 3,
73468       "help.relations.route_h": 3,
73469       "help.relations.boundary_h": 3,
73470       "help.notes.add_note_h": 3,
73471       "help.notes.update_note_h": 3,
73472       "help.notes.save_note_h": 3,
73473       "help.imagery.sources_h": 3,
73474       "help.imagery.offsets_h": 3,
73475       "help.streetlevel.using_h": 3,
73476       "help.gps.using_h": 3,
73477       "help.qa.tools_h": 3,
73478       "help.qa.issues_h": 3
73479     };
73480     var docs = docKeys.map(function(key) {
73481       var helpkey = "help." + key[0];
73482       var helpPaneReplacements = { version: context.version };
73483       var text = key[1].reduce(function(all, part) {
73484         var subkey = helpkey + "." + part;
73485         var depth = headings[subkey];
73486         var hhh = depth ? Array(depth + 1).join("#") + " " : "";
73487         return all + hhh + helpHtml(subkey, helpPaneReplacements) + "\n\n";
73488       }, "");
73489       return {
73490         title: _t.html(helpkey + ".title"),
73491         content: marked(text.trim()).replace(/<code>/g, "<kbd>").replace(/<\/code>/g, "</kbd>")
73492       };
73493     });
73494     var helpPane = uiPane("help", context).key(_t("help.key")).label(_t.append("help.title")).description(_t.append("help.title")).iconName("iD-icon-help");
73495     helpPane.renderContent = function(content) {
73496       function clickHelp(d2, i3) {
73497         var rtl = _mainLocalizer.textDirection() === "rtl";
73498         content.property("scrollTop", 0);
73499         helpPane.selection().select(".pane-heading h2").html(d2.title);
73500         body.html(d2.content);
73501         body.selectAll("a").attr("target", "_blank");
73502         menuItems.classed("selected", function(m2) {
73503           return m2.title === d2.title;
73504         });
73505         nav.html("");
73506         if (rtl) {
73507           nav.call(drawNext).call(drawPrevious);
73508         } else {
73509           nav.call(drawPrevious).call(drawNext);
73510         }
73511         function drawNext(selection2) {
73512           if (i3 < docs.length - 1) {
73513             var nextLink = selection2.append("a").attr("href", "#").attr("class", "next").on("click", function(d3_event) {
73514               d3_event.preventDefault();
73515               clickHelp(docs[i3 + 1], i3 + 1);
73516             });
73517             nextLink.append("span").html(docs[i3 + 1].title).call(svgIcon(rtl ? "#iD-icon-backward" : "#iD-icon-forward", "inline"));
73518           }
73519         }
73520         function drawPrevious(selection2) {
73521           if (i3 > 0) {
73522             var prevLink = selection2.append("a").attr("href", "#").attr("class", "previous").on("click", function(d3_event) {
73523               d3_event.preventDefault();
73524               clickHelp(docs[i3 - 1], i3 - 1);
73525             });
73526             prevLink.call(svgIcon(rtl ? "#iD-icon-forward" : "#iD-icon-backward", "inline")).append("span").html(docs[i3 - 1].title);
73527           }
73528         }
73529       }
73530       function clickWalkthrough(d3_event) {
73531         d3_event.preventDefault();
73532         if (context.inIntro()) return;
73533         context.container().call(uiIntro(context));
73534         context.ui().togglePanes();
73535       }
73536       function clickShortcuts(d3_event) {
73537         d3_event.preventDefault();
73538         context.container().call(context.ui().shortcuts, true);
73539       }
73540       var toc = content.append("ul").attr("class", "toc");
73541       var menuItems = toc.selectAll("li").data(docs).enter().append("li").append("a").attr("role", "button").attr("href", "#").html(function(d2) {
73542         return d2.title;
73543       }).on("click", function(d3_event, d2) {
73544         d3_event.preventDefault();
73545         clickHelp(d2, docs.indexOf(d2));
73546       });
73547       var shortcuts = toc.append("li").attr("class", "shortcuts").call(
73548         uiTooltip().title(() => _t.append("shortcuts.tooltip")).keys(["?"]).placement("top")
73549       ).append("a").attr("href", "#").on("click", clickShortcuts);
73550       shortcuts.append("div").call(_t.append("shortcuts.title"));
73551       var walkthrough = toc.append("li").attr("class", "walkthrough").append("a").attr("href", "#").on("click", clickWalkthrough);
73552       walkthrough.append("svg").attr("class", "logo logo-walkthrough").append("use").attr("xlink:href", "#iD-logo-walkthrough");
73553       walkthrough.append("div").call(_t.append("splash.walkthrough"));
73554       var helpContent = content.append("div").attr("class", "left-content");
73555       var body = helpContent.append("div").attr("class", "body");
73556       var nav = helpContent.append("div").attr("class", "nav");
73557       clickHelp(docs[0], 0);
73558     };
73559     return helpPane;
73560   }
73561   var init_help = __esm({
73562     "modules/ui/panes/help.js"() {
73563       "use strict";
73564       init_marked_esm();
73565       init_icon();
73566       init_intro();
73567       init_pane();
73568       init_localizer();
73569       init_tooltip();
73570       init_helper();
73571     }
73572   });
73573
73574   // modules/ui/sections/validation_issues.js
73575   var validation_issues_exports = {};
73576   __export(validation_issues_exports, {
73577     uiSectionValidationIssues: () => uiSectionValidationIssues
73578   });
73579   function uiSectionValidationIssues(id2, severity, context) {
73580     var _issues = [];
73581     var section = uiSection(id2, context).label(function() {
73582       if (!_issues) return "";
73583       var issueCountText = _issues.length > 1e3 ? "1000+" : String(_issues.length);
73584       return _t.append("inspector.title_count", { title: _t("issues." + severity + "s.list_title"), count: issueCountText });
73585     }).disclosureContent(renderDisclosureContent).shouldDisplay(function() {
73586       return _issues && _issues.length;
73587     });
73588     function getOptions() {
73589       return {
73590         what: corePreferences("validate-what") || "edited",
73591         where: corePreferences("validate-where") || "all"
73592       };
73593     }
73594     function reloadIssues() {
73595       _issues = context.validator().getIssuesBySeverity(getOptions())[severity];
73596     }
73597     function renderDisclosureContent(selection2) {
73598       var center = context.map().center();
73599       var graph = context.graph();
73600       var issues = _issues.map(function withDistance(issue) {
73601         var extent = issue.extent(graph);
73602         var dist = extent ? geoSphericalDistance(center, extent.center()) : 0;
73603         return Object.assign(issue, { dist });
73604       }).sort(function byDistance(a2, b2) {
73605         return a2.dist - b2.dist;
73606       });
73607       issues = issues.slice(0, 1e3);
73608       selection2.call(drawIssuesList, issues);
73609     }
73610     function drawIssuesList(selection2, issues) {
73611       var list2 = selection2.selectAll(".issues-list").data([0]);
73612       list2 = list2.enter().append("ul").attr("class", "layer-list issues-list " + severity + "s-list").merge(list2);
73613       var items = list2.selectAll("li").data(issues, function(d2) {
73614         return d2.key;
73615       });
73616       items.exit().remove();
73617       var itemsEnter = items.enter().append("li").attr("class", function(d2) {
73618         return "issue severity-" + d2.severity;
73619       });
73620       var labelsEnter = itemsEnter.append("button").attr("class", "issue-label").on("click", function(d3_event, d2) {
73621         context.validator().focusIssue(d2);
73622       }).on("mouseover", function(d3_event, d2) {
73623         utilHighlightEntities(d2.entityIds, true, context);
73624       }).on("mouseout", function(d3_event, d2) {
73625         utilHighlightEntities(d2.entityIds, false, context);
73626       });
73627       var textEnter = labelsEnter.append("span").attr("class", "issue-text");
73628       textEnter.append("span").attr("class", "issue-icon").each(function(d2) {
73629         var iconName = "#iD-icon-" + (d2.severity === "warning" ? "alert" : "error");
73630         select_default2(this).call(svgIcon(iconName));
73631       });
73632       textEnter.append("span").attr("class", "issue-message");
73633       items = items.merge(itemsEnter).order();
73634       items.selectAll(".issue-message").text("").each(function(d2) {
73635         return d2.message(context)(select_default2(this));
73636       });
73637     }
73638     context.validator().on("validated.uiSectionValidationIssues" + id2, function() {
73639       window.requestIdleCallback(function() {
73640         reloadIssues();
73641         section.reRender();
73642       });
73643     });
73644     context.map().on(
73645       "move.uiSectionValidationIssues" + id2,
73646       debounce_default(function() {
73647         window.requestIdleCallback(function() {
73648           if (getOptions().where === "visible") {
73649             reloadIssues();
73650           }
73651           section.reRender();
73652         });
73653       }, 1e3)
73654     );
73655     return section;
73656   }
73657   var init_validation_issues = __esm({
73658     "modules/ui/sections/validation_issues.js"() {
73659       "use strict";
73660       init_debounce();
73661       init_src5();
73662       init_geo2();
73663       init_icon();
73664       init_preferences();
73665       init_localizer();
73666       init_util();
73667       init_section();
73668     }
73669   });
73670
73671   // modules/ui/sections/validation_options.js
73672   var validation_options_exports = {};
73673   __export(validation_options_exports, {
73674     uiSectionValidationOptions: () => uiSectionValidationOptions
73675   });
73676   function uiSectionValidationOptions(context) {
73677     var section = uiSection("issues-options", context).content(renderContent);
73678     function renderContent(selection2) {
73679       var container = selection2.selectAll(".issues-options-container").data([0]);
73680       container = container.enter().append("div").attr("class", "issues-options-container").merge(container);
73681       var data = [
73682         { key: "what", values: ["edited", "all"] },
73683         { key: "where", values: ["visible", "all"] }
73684       ];
73685       var options2 = container.selectAll(".issues-option").data(data, function(d2) {
73686         return d2.key;
73687       });
73688       var optionsEnter = options2.enter().append("div").attr("class", function(d2) {
73689         return "issues-option issues-option-" + d2.key;
73690       });
73691       optionsEnter.append("div").attr("class", "issues-option-title").html(function(d2) {
73692         return _t.html("issues.options." + d2.key + ".title");
73693       });
73694       var valuesEnter = optionsEnter.selectAll("label").data(function(d2) {
73695         return d2.values.map(function(val) {
73696           return { value: val, key: d2.key };
73697         });
73698       }).enter().append("label");
73699       valuesEnter.append("input").attr("type", "radio").attr("name", function(d2) {
73700         return "issues-option-" + d2.key;
73701       }).attr("value", function(d2) {
73702         return d2.value;
73703       }).property("checked", function(d2) {
73704         return getOptions()[d2.key] === d2.value;
73705       }).on("change", function(d3_event, d2) {
73706         updateOptionValue(d3_event, d2.key, d2.value);
73707       });
73708       valuesEnter.append("span").html(function(d2) {
73709         return _t.html("issues.options." + d2.key + "." + d2.value);
73710       });
73711     }
73712     function getOptions() {
73713       return {
73714         what: corePreferences("validate-what") || "edited",
73715         // 'all', 'edited'
73716         where: corePreferences("validate-where") || "all"
73717         // 'all', 'visible'
73718       };
73719     }
73720     function updateOptionValue(d3_event, d2, val) {
73721       if (!val && d3_event && d3_event.target) {
73722         val = d3_event.target.value;
73723       }
73724       corePreferences("validate-" + d2, val);
73725       context.validator().validate();
73726     }
73727     return section;
73728   }
73729   var init_validation_options = __esm({
73730     "modules/ui/sections/validation_options.js"() {
73731       "use strict";
73732       init_preferences();
73733       init_localizer();
73734       init_section();
73735     }
73736   });
73737
73738   // modules/ui/sections/validation_rules.js
73739   var validation_rules_exports = {};
73740   __export(validation_rules_exports, {
73741     uiSectionValidationRules: () => uiSectionValidationRules
73742   });
73743   function uiSectionValidationRules(context) {
73744     var MINSQUARE = 0;
73745     var MAXSQUARE = 20;
73746     var DEFAULTSQUARE = 5;
73747     var section = uiSection("issues-rules", context).disclosureContent(renderDisclosureContent).label(() => _t.append("issues.rules.title"));
73748     var _ruleKeys = context.validator().getRuleKeys().filter(function(key) {
73749       return key !== "maprules";
73750     }).sort(function(key1, key2) {
73751       return _t("issues." + key1 + ".title") < _t("issues." + key2 + ".title") ? -1 : 1;
73752     });
73753     function renderDisclosureContent(selection2) {
73754       var container = selection2.selectAll(".issues-rulelist-container").data([0]);
73755       var containerEnter = container.enter().append("div").attr("class", "issues-rulelist-container");
73756       containerEnter.append("ul").attr("class", "layer-list issue-rules-list");
73757       var ruleLinks = containerEnter.append("div").attr("class", "issue-rules-links section-footer");
73758       ruleLinks.append("a").attr("class", "issue-rules-link").attr("role", "button").attr("href", "#").call(_t.append("issues.disable_all")).on("click", function(d3_event) {
73759         d3_event.preventDefault();
73760         context.validator().disableRules(_ruleKeys);
73761       });
73762       ruleLinks.append("a").attr("class", "issue-rules-link").attr("role", "button").attr("href", "#").call(_t.append("issues.enable_all")).on("click", function(d3_event) {
73763         d3_event.preventDefault();
73764         context.validator().disableRules([]);
73765       });
73766       container = container.merge(containerEnter);
73767       container.selectAll(".issue-rules-list").call(drawListItems, _ruleKeys, "checkbox", "rule", toggleRule, isRuleEnabled);
73768     }
73769     function drawListItems(selection2, data, type2, name, change, active) {
73770       var items = selection2.selectAll("li").data(data);
73771       items.exit().remove();
73772       var enter = items.enter().append("li");
73773       if (name === "rule") {
73774         enter.call(
73775           uiTooltip().title(function(d2) {
73776             return _t.append("issues." + d2 + ".tip");
73777           }).placement("top")
73778         );
73779       }
73780       var label = enter.append("label");
73781       label.append("input").attr("type", type2).attr("name", name).on("change", change);
73782       label.append("span").html(function(d2) {
73783         var params = {};
73784         if (d2 === "unsquare_way") {
73785           params.val = { html: '<span class="square-degrees"></span>' };
73786         }
73787         return _t.html("issues." + d2 + ".title", params);
73788       });
73789       items = items.merge(enter);
73790       items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", false);
73791       var degStr = corePreferences("validate-square-degrees");
73792       if (degStr === null) {
73793         degStr = DEFAULTSQUARE.toString();
73794       }
73795       var span = items.selectAll(".square-degrees");
73796       var input = span.selectAll(".square-degrees-input").data([0]);
73797       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) {
73798         d3_event.preventDefault();
73799         d3_event.stopPropagation();
73800         this.select();
73801       }).on("keyup", function(d3_event) {
73802         if (d3_event.keyCode === 13) {
73803           this.blur();
73804           this.select();
73805         }
73806       }).on("blur", changeSquare).merge(input).property("value", degStr);
73807     }
73808     function changeSquare() {
73809       var input = select_default2(this);
73810       var degStr = utilGetSetValue(input).trim();
73811       var degNum = Number(degStr);
73812       if (!isFinite(degNum)) {
73813         degNum = DEFAULTSQUARE;
73814       } else if (degNum > MAXSQUARE) {
73815         degNum = MAXSQUARE;
73816       } else if (degNum < MINSQUARE) {
73817         degNum = MINSQUARE;
73818       }
73819       degNum = Math.round(degNum * 10) / 10;
73820       degStr = degNum.toString();
73821       input.property("value", degStr);
73822       corePreferences("validate-square-degrees", degStr);
73823       context.validator().revalidateUnsquare();
73824     }
73825     function isRuleEnabled(d2) {
73826       return context.validator().isRuleEnabled(d2);
73827     }
73828     function toggleRule(d3_event, d2) {
73829       context.validator().toggleRule(d2);
73830     }
73831     context.validator().on("validated.uiSectionValidationRules", function() {
73832       window.requestIdleCallback(section.reRender);
73833     });
73834     return section;
73835   }
73836   var init_validation_rules = __esm({
73837     "modules/ui/sections/validation_rules.js"() {
73838       "use strict";
73839       init_src5();
73840       init_preferences();
73841       init_localizer();
73842       init_util();
73843       init_tooltip();
73844       init_section();
73845     }
73846   });
73847
73848   // modules/ui/sections/validation_status.js
73849   var validation_status_exports = {};
73850   __export(validation_status_exports, {
73851     uiSectionValidationStatus: () => uiSectionValidationStatus
73852   });
73853   function uiSectionValidationStatus(context) {
73854     var section = uiSection("issues-status", context).content(renderContent).shouldDisplay(function() {
73855       var issues = context.validator().getIssues(getOptions());
73856       return issues.length === 0;
73857     });
73858     function getOptions() {
73859       return {
73860         what: corePreferences("validate-what") || "edited",
73861         where: corePreferences("validate-where") || "all"
73862       };
73863     }
73864     function renderContent(selection2) {
73865       var box = selection2.selectAll(".box").data([0]);
73866       var boxEnter = box.enter().append("div").attr("class", "box");
73867       boxEnter.append("div").call(svgIcon("#iD-icon-apply", "pre-text"));
73868       var noIssuesMessage = boxEnter.append("span");
73869       noIssuesMessage.append("strong").attr("class", "message");
73870       noIssuesMessage.append("br");
73871       noIssuesMessage.append("span").attr("class", "details");
73872       renderIgnoredIssuesReset(selection2);
73873       setNoIssuesText(selection2);
73874     }
73875     function renderIgnoredIssuesReset(selection2) {
73876       var ignoredIssues = context.validator().getIssues({ what: "all", where: "all", includeDisabledRules: true, includeIgnored: "only" });
73877       var resetIgnored = selection2.selectAll(".reset-ignored").data(ignoredIssues.length ? [0] : []);
73878       resetIgnored.exit().remove();
73879       var resetIgnoredEnter = resetIgnored.enter().append("div").attr("class", "reset-ignored section-footer");
73880       resetIgnoredEnter.append("a").attr("href", "#");
73881       resetIgnored = resetIgnored.merge(resetIgnoredEnter);
73882       resetIgnored.select("a").html(_t.html("inspector.title_count", { title: { html: _t.html("issues.reset_ignored") }, count: ignoredIssues.length }));
73883       resetIgnored.on("click", function(d3_event) {
73884         d3_event.preventDefault();
73885         context.validator().resetIgnoredIssues();
73886       });
73887     }
73888     function setNoIssuesText(selection2) {
73889       var opts = getOptions();
73890       function checkForHiddenIssues(cases) {
73891         for (var type2 in cases) {
73892           var hiddenOpts = cases[type2];
73893           var hiddenIssues = context.validator().getIssues(hiddenOpts);
73894           if (hiddenIssues.length) {
73895             selection2.select(".box .details").html("").call(_t.append(
73896               "issues.no_issues.hidden_issues." + type2,
73897               { count: hiddenIssues.length.toString() }
73898             ));
73899             return;
73900           }
73901         }
73902         selection2.select(".box .details").html("").call(_t.append("issues.no_issues.hidden_issues.none"));
73903       }
73904       var messageType;
73905       if (opts.what === "edited" && opts.where === "visible") {
73906         messageType = "edits_in_view";
73907         checkForHiddenIssues({
73908           elsewhere: { what: "edited", where: "all" },
73909           everything_else: { what: "all", where: "visible" },
73910           disabled_rules: { what: "edited", where: "visible", includeDisabledRules: "only" },
73911           everything_else_elsewhere: { what: "all", where: "all" },
73912           disabled_rules_elsewhere: { what: "edited", where: "all", includeDisabledRules: "only" },
73913           ignored_issues: { what: "edited", where: "visible", includeIgnored: "only" },
73914           ignored_issues_elsewhere: { what: "edited", where: "all", includeIgnored: "only" }
73915         });
73916       } else if (opts.what === "edited" && opts.where === "all") {
73917         messageType = "edits";
73918         checkForHiddenIssues({
73919           everything_else: { what: "all", where: "all" },
73920           disabled_rules: { what: "edited", where: "all", includeDisabledRules: "only" },
73921           ignored_issues: { what: "edited", where: "all", includeIgnored: "only" }
73922         });
73923       } else if (opts.what === "all" && opts.where === "visible") {
73924         messageType = "everything_in_view";
73925         checkForHiddenIssues({
73926           elsewhere: { what: "all", where: "all" },
73927           disabled_rules: { what: "all", where: "visible", includeDisabledRules: "only" },
73928           disabled_rules_elsewhere: { what: "all", where: "all", includeDisabledRules: "only" },
73929           ignored_issues: { what: "all", where: "visible", includeIgnored: "only" },
73930           ignored_issues_elsewhere: { what: "all", where: "all", includeIgnored: "only" }
73931         });
73932       } else if (opts.what === "all" && opts.where === "all") {
73933         messageType = "everything";
73934         checkForHiddenIssues({
73935           disabled_rules: { what: "all", where: "all", includeDisabledRules: "only" },
73936           ignored_issues: { what: "all", where: "all", includeIgnored: "only" }
73937         });
73938       }
73939       if (opts.what === "edited" && context.history().difference().summary().length === 0) {
73940         messageType = "no_edits";
73941       }
73942       selection2.select(".box .message").html("").call(_t.append("issues.no_issues.message." + messageType));
73943     }
73944     context.validator().on("validated.uiSectionValidationStatus", function() {
73945       window.requestIdleCallback(section.reRender);
73946     });
73947     context.map().on(
73948       "move.uiSectionValidationStatus",
73949       debounce_default(function() {
73950         window.requestIdleCallback(section.reRender);
73951       }, 1e3)
73952     );
73953     return section;
73954   }
73955   var init_validation_status = __esm({
73956     "modules/ui/sections/validation_status.js"() {
73957       "use strict";
73958       init_debounce();
73959       init_icon();
73960       init_preferences();
73961       init_localizer();
73962       init_section();
73963     }
73964   });
73965
73966   // modules/ui/panes/issues.js
73967   var issues_exports = {};
73968   __export(issues_exports, {
73969     uiPaneIssues: () => uiPaneIssues
73970   });
73971   function uiPaneIssues(context) {
73972     var issuesPane = uiPane("issues", context).key(_t("issues.key")).label(_t.append("issues.title")).description(_t.append("issues.title")).iconName("iD-icon-alert").sections([
73973       uiSectionValidationOptions(context),
73974       uiSectionValidationStatus(context),
73975       uiSectionValidationIssues("issues-errors", "error", context),
73976       uiSectionValidationIssues("issues-warnings", "warning", context),
73977       uiSectionValidationRules(context)
73978     ]);
73979     return issuesPane;
73980   }
73981   var init_issues = __esm({
73982     "modules/ui/panes/issues.js"() {
73983       "use strict";
73984       init_localizer();
73985       init_pane();
73986       init_validation_issues();
73987       init_validation_options();
73988       init_validation_rules();
73989       init_validation_status();
73990     }
73991   });
73992
73993   // modules/ui/settings/custom_data.js
73994   var custom_data_exports = {};
73995   __export(custom_data_exports, {
73996     uiSettingsCustomData: () => uiSettingsCustomData
73997   });
73998   function uiSettingsCustomData(context) {
73999     var dispatch14 = dispatch_default("change");
74000     function render(selection2) {
74001       var dataLayer = context.layers().layer("data");
74002       var _origSettings = {
74003         fileList: dataLayer && dataLayer.fileList() || null,
74004         url: corePreferences("settings-custom-data-url")
74005       };
74006       var _currSettings = {
74007         fileList: dataLayer && dataLayer.fileList() || null
74008         // url: prefs('settings-custom-data-url')
74009       };
74010       var modal = uiConfirm(selection2).okButton();
74011       modal.classed("settings-modal settings-custom-data", true);
74012       modal.select(".modal-section.header").append("h3").call(_t.append("settings.custom_data.header"));
74013       var textSection = modal.select(".modal-section.message-text");
74014       textSection.append("pre").attr("class", "instructions-file").call(_t.append("settings.custom_data.file.instructions"));
74015       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) {
74016         var files = d3_event.target.files;
74017         if (files && files.length) {
74018           _currSettings.url = "";
74019           textSection.select(".field-url").property("value", "");
74020           _currSettings.fileList = files;
74021         } else {
74022           _currSettings.fileList = null;
74023         }
74024       });
74025       textSection.append("h4").call(_t.append("settings.custom_data.or"));
74026       textSection.append("pre").attr("class", "instructions-url").call(_t.append("settings.custom_data.url.instructions"));
74027       textSection.append("textarea").attr("class", "field-url").attr("placeholder", _t("settings.custom_data.url.placeholder")).call(utilNoAuto).property("value", _currSettings.url);
74028       var buttonSection = modal.select(".modal-section.buttons");
74029       buttonSection.insert("button", ".ok-button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
74030       buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
74031       buttonSection.select(".ok-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
74032       function isSaveDisabled() {
74033         return null;
74034       }
74035       function clickCancel() {
74036         textSection.select(".field-url").property("value", _origSettings.url);
74037         corePreferences("settings-custom-data-url", _origSettings.url);
74038         this.blur();
74039         modal.close();
74040       }
74041       function clickSave() {
74042         _currSettings.url = textSection.select(".field-url").property("value").trim();
74043         if (_currSettings.url) {
74044           _currSettings.fileList = null;
74045         }
74046         if (_currSettings.fileList) {
74047           _currSettings.url = "";
74048         }
74049         corePreferences("settings-custom-data-url", _currSettings.url);
74050         this.blur();
74051         modal.close();
74052         dispatch14.call("change", this, _currSettings);
74053       }
74054     }
74055     return utilRebind(render, dispatch14, "on");
74056   }
74057   var init_custom_data = __esm({
74058     "modules/ui/settings/custom_data.js"() {
74059       "use strict";
74060       init_src4();
74061       init_preferences();
74062       init_localizer();
74063       init_confirm();
74064       init_util();
74065     }
74066   });
74067
74068   // modules/ui/sections/data_layers.js
74069   var data_layers_exports = {};
74070   __export(data_layers_exports, {
74071     uiSectionDataLayers: () => uiSectionDataLayers
74072   });
74073   function uiSectionDataLayers(context) {
74074     var settingsCustomData = uiSettingsCustomData(context).on("change", customChanged);
74075     var layers = context.layers();
74076     var section = uiSection("data-layers", context).label(() => _t.append("map_data.data_layers")).disclosureContent(renderDisclosureContent);
74077     function renderDisclosureContent(selection2) {
74078       var container = selection2.selectAll(".data-layer-container").data([0]);
74079       container.enter().append("div").attr("class", "data-layer-container").merge(container).call(drawOsmItems).call(drawQAItems).call(drawCustomDataItems).call(drawVectorItems).call(drawPanelItems);
74080     }
74081     function showsLayer(which) {
74082       var layer = layers.layer(which);
74083       if (layer) {
74084         return layer.enabled();
74085       }
74086       return false;
74087     }
74088     function setLayer(which, enabled) {
74089       var mode = context.mode();
74090       if (mode && /^draw/.test(mode.id)) return;
74091       var layer = layers.layer(which);
74092       if (layer) {
74093         layer.enabled(enabled);
74094         if (!enabled && (which === "osm" || which === "notes")) {
74095           context.enter(modeBrowse(context));
74096         }
74097       }
74098     }
74099     function toggleLayer(which) {
74100       setLayer(which, !showsLayer(which));
74101     }
74102     function drawOsmItems(selection2) {
74103       var osmKeys = ["osm", "notes"];
74104       var osmLayers = layers.all().filter(function(obj) {
74105         return osmKeys.indexOf(obj.id) !== -1;
74106       });
74107       var ul = selection2.selectAll(".layer-list-osm").data([0]);
74108       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-osm").merge(ul);
74109       var li = ul.selectAll(".list-item").data(osmLayers);
74110       li.exit().remove();
74111       var liEnter = li.enter().append("li").attr("class", function(d2) {
74112         return "list-item list-item-" + d2.id;
74113       });
74114       var labelEnter = liEnter.append("label").each(function(d2) {
74115         if (d2.id === "osm") {
74116           select_default2(this).call(
74117             uiTooltip().title(() => _t.append("map_data.layers." + d2.id + ".tooltip")).keys([uiCmd("\u2325" + _t("area_fill.wireframe.key"))]).placement("bottom")
74118           );
74119         } else {
74120           select_default2(this).call(
74121             uiTooltip().title(() => _t.append("map_data.layers." + d2.id + ".tooltip")).placement("bottom")
74122           );
74123         }
74124       });
74125       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
74126         toggleLayer(d2.id);
74127       });
74128       labelEnter.append("span").html(function(d2) {
74129         return _t.html("map_data.layers." + d2.id + ".title");
74130       });
74131       li.merge(liEnter).classed("active", function(d2) {
74132         return d2.layer.enabled();
74133       }).selectAll("input").property("checked", function(d2) {
74134         return d2.layer.enabled();
74135       });
74136     }
74137     function drawQAItems(selection2) {
74138       var qaKeys = ["keepRight", "osmose"];
74139       var qaLayers = layers.all().filter(function(obj) {
74140         return qaKeys.indexOf(obj.id) !== -1;
74141       });
74142       var ul = selection2.selectAll(".layer-list-qa").data([0]);
74143       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-qa").merge(ul);
74144       var li = ul.selectAll(".list-item").data(qaLayers);
74145       li.exit().remove();
74146       var liEnter = li.enter().append("li").attr("class", function(d2) {
74147         return "list-item list-item-" + d2.id;
74148       });
74149       var labelEnter = liEnter.append("label").each(function(d2) {
74150         select_default2(this).call(
74151           uiTooltip().title(() => _t.append("map_data.layers." + d2.id + ".tooltip")).placement("bottom")
74152         );
74153       });
74154       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
74155         toggleLayer(d2.id);
74156       });
74157       labelEnter.append("span").each(function(d2) {
74158         _t.append("map_data.layers." + d2.id + ".title")(select_default2(this));
74159       });
74160       li.merge(liEnter).classed("active", function(d2) {
74161         return d2.layer.enabled();
74162       }).selectAll("input").property("checked", function(d2) {
74163         return d2.layer.enabled();
74164       });
74165     }
74166     function drawVectorItems(selection2) {
74167       var dataLayer = layers.layer("data");
74168       var vtData = [
74169         {
74170           name: "Detroit Neighborhoods/Parks",
74171           src: "neighborhoods-parks",
74172           tooltip: "Neighborhood boundaries and parks as compiled by City of Detroit in concert with community groups.",
74173           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"
74174         },
74175         {
74176           name: "Detroit Composite POIs",
74177           src: "composite-poi",
74178           tooltip: "Fire Inspections, Business Licenses, and other public location data collated from the City of Detroit.",
74179           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"
74180         },
74181         {
74182           name: "Detroit All-The-Places POIs",
74183           src: "alltheplaces-poi",
74184           tooltip: "Public domain business location data created by web scrapers.",
74185           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"
74186         }
74187       ];
74188       var detroit = geoExtent([-83.5, 42.1], [-82.8, 42.5]);
74189       var showVectorItems = context.map().zoom() > 9 && detroit.contains(context.map().center());
74190       var container = selection2.selectAll(".vectortile-container").data(showVectorItems ? [0] : []);
74191       container.exit().remove();
74192       var containerEnter = container.enter().append("div").attr("class", "vectortile-container");
74193       containerEnter.append("h4").attr("class", "vectortile-header").text("Detroit Vector Tiles (Beta)");
74194       containerEnter.append("ul").attr("class", "layer-list layer-list-vectortile");
74195       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");
74196       container = container.merge(containerEnter);
74197       var ul = container.selectAll(".layer-list-vectortile");
74198       var li = ul.selectAll(".list-item").data(vtData);
74199       li.exit().remove();
74200       var liEnter = li.enter().append("li").attr("class", function(d2) {
74201         return "list-item list-item-" + d2.src;
74202       });
74203       var labelEnter = liEnter.append("label").each(function(d2) {
74204         select_default2(this).call(
74205           uiTooltip().title(d2.tooltip).placement("top")
74206         );
74207       });
74208       labelEnter.append("input").attr("type", "radio").attr("name", "vectortile").on("change", selectVTLayer);
74209       labelEnter.append("span").text(function(d2) {
74210         return d2.name;
74211       });
74212       li.merge(liEnter).classed("active", isVTLayerSelected).selectAll("input").property("checked", isVTLayerSelected);
74213       function isVTLayerSelected(d2) {
74214         return dataLayer && dataLayer.template() === d2.template;
74215       }
74216       function selectVTLayer(d3_event, d2) {
74217         corePreferences("settings-custom-data-url", d2.template);
74218         if (dataLayer) {
74219           dataLayer.template(d2.template, d2.src);
74220           dataLayer.enabled(true);
74221         }
74222       }
74223     }
74224     function drawCustomDataItems(selection2) {
74225       var dataLayer = layers.layer("data");
74226       var hasData = dataLayer && dataLayer.hasData();
74227       var showsData = hasData && dataLayer.enabled();
74228       var ul = selection2.selectAll(".layer-list-data").data(dataLayer ? [0] : []);
74229       ul.exit().remove();
74230       var ulEnter = ul.enter().append("ul").attr("class", "layer-list layer-list-data");
74231       var liEnter = ulEnter.append("li").attr("class", "list-item-data");
74232       var labelEnter = liEnter.append("label").call(
74233         uiTooltip().title(() => _t.append("map_data.layers.custom.tooltip")).placement("top")
74234       );
74235       labelEnter.append("input").attr("type", "checkbox").on("change", function() {
74236         toggleLayer("data");
74237       });
74238       labelEnter.append("span").call(_t.append("map_data.layers.custom.title"));
74239       liEnter.append("button").attr("class", "open-data-options").call(
74240         uiTooltip().title(() => _t.append("settings.custom_data.tooltip")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
74241       ).on("click", function(d3_event) {
74242         d3_event.preventDefault();
74243         editCustom();
74244       }).call(svgIcon("#iD-icon-more"));
74245       liEnter.append("button").attr("class", "zoom-to-data").call(
74246         uiTooltip().title(() => _t.append("map_data.layers.custom.zoom")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
74247       ).on("click", function(d3_event) {
74248         if (select_default2(this).classed("disabled")) return;
74249         d3_event.preventDefault();
74250         d3_event.stopPropagation();
74251         dataLayer.fitZoom();
74252       }).call(svgIcon("#iD-icon-framed-dot", "monochrome"));
74253       ul = ul.merge(ulEnter);
74254       ul.selectAll(".list-item-data").classed("active", showsData).selectAll("label").classed("deemphasize", !hasData).selectAll("input").property("disabled", !hasData).property("checked", showsData);
74255       ul.selectAll("button.zoom-to-data").classed("disabled", !hasData);
74256     }
74257     function editCustom() {
74258       context.container().call(settingsCustomData);
74259     }
74260     function customChanged(d2) {
74261       var dataLayer = layers.layer("data");
74262       if (d2 && d2.url) {
74263         dataLayer.url(d2.url);
74264       } else if (d2 && d2.fileList) {
74265         dataLayer.fileList(d2.fileList);
74266       }
74267     }
74268     function drawPanelItems(selection2) {
74269       var panelsListEnter = selection2.selectAll(".md-extras-list").data([0]).enter().append("ul").attr("class", "layer-list md-extras-list");
74270       var historyPanelLabelEnter = panelsListEnter.append("li").attr("class", "history-panel-toggle-item").append("label").call(
74271         uiTooltip().title(() => _t.append("map_data.history_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.history.key"))]).placement("top")
74272       );
74273       historyPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
74274         d3_event.preventDefault();
74275         context.ui().info.toggle("history");
74276       });
74277       historyPanelLabelEnter.append("span").call(_t.append("map_data.history_panel.title"));
74278       var measurementPanelLabelEnter = panelsListEnter.append("li").attr("class", "measurement-panel-toggle-item").append("label").call(
74279         uiTooltip().title(() => _t.append("map_data.measurement_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.measurement.key"))]).placement("top")
74280       );
74281       measurementPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
74282         d3_event.preventDefault();
74283         context.ui().info.toggle("measurement");
74284       });
74285       measurementPanelLabelEnter.append("span").call(_t.append("map_data.measurement_panel.title"));
74286     }
74287     context.layers().on("change.uiSectionDataLayers", section.reRender);
74288     context.map().on(
74289       "move.uiSectionDataLayers",
74290       debounce_default(function() {
74291         window.requestIdleCallback(section.reRender);
74292       }, 1e3)
74293     );
74294     return section;
74295   }
74296   var init_data_layers = __esm({
74297     "modules/ui/sections/data_layers.js"() {
74298       "use strict";
74299       init_debounce();
74300       init_src5();
74301       init_preferences();
74302       init_localizer();
74303       init_tooltip();
74304       init_icon();
74305       init_geo2();
74306       init_browse();
74307       init_cmd();
74308       init_section();
74309       init_custom_data();
74310     }
74311   });
74312
74313   // modules/ui/sections/map_features.js
74314   var map_features_exports = {};
74315   __export(map_features_exports, {
74316     uiSectionMapFeatures: () => uiSectionMapFeatures
74317   });
74318   function uiSectionMapFeatures(context) {
74319     var _features = context.features().keys();
74320     var section = uiSection("map-features", context).label(() => _t.append("map_data.map_features")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
74321     function renderDisclosureContent(selection2) {
74322       var container = selection2.selectAll(".layer-feature-list-container").data([0]);
74323       var containerEnter = container.enter().append("div").attr("class", "layer-feature-list-container");
74324       containerEnter.append("ul").attr("class", "layer-list layer-feature-list");
74325       var footer = containerEnter.append("div").attr("class", "feature-list-links section-footer");
74326       footer.append("a").attr("class", "feature-list-link").attr("role", "button").attr("href", "#").call(_t.append("issues.disable_all")).on("click", function(d3_event) {
74327         d3_event.preventDefault();
74328         context.features().disableAll();
74329       });
74330       footer.append("a").attr("class", "feature-list-link").attr("role", "button").attr("href", "#").call(_t.append("issues.enable_all")).on("click", function(d3_event) {
74331         d3_event.preventDefault();
74332         context.features().enableAll();
74333       });
74334       container = container.merge(containerEnter);
74335       container.selectAll(".layer-feature-list").call(drawListItems, _features, "checkbox", "feature", clickFeature, showsFeature);
74336     }
74337     function drawListItems(selection2, data, type2, name, change, active) {
74338       var items = selection2.selectAll("li").data(data);
74339       items.exit().remove();
74340       var enter = items.enter().append("li").call(
74341         uiTooltip().title(function(d2) {
74342           var tip = _t.append(name + "." + d2 + ".tooltip");
74343           if (autoHiddenFeature(d2)) {
74344             var msg = showsLayer("osm") ? _t.append("map_data.autohidden") : _t.append("map_data.osmhidden");
74345             return (selection3) => {
74346               selection3.call(tip);
74347               selection3.append("div").call(msg);
74348             };
74349           }
74350           return tip;
74351         }).placement("top")
74352       );
74353       var label = enter.append("label");
74354       label.append("input").attr("type", type2).attr("name", name).on("change", change);
74355       label.append("span").html(function(d2) {
74356         return _t.html(name + "." + d2 + ".description");
74357       });
74358       items = items.merge(enter);
74359       items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", autoHiddenFeature);
74360     }
74361     function autoHiddenFeature(d2) {
74362       return context.features().autoHidden(d2);
74363     }
74364     function showsFeature(d2) {
74365       return context.features().enabled(d2);
74366     }
74367     function clickFeature(d3_event, d2) {
74368       context.features().toggle(d2);
74369     }
74370     function showsLayer(id2) {
74371       var layer = context.layers().layer(id2);
74372       return layer && layer.enabled();
74373     }
74374     context.features().on("change.map_features", section.reRender);
74375     return section;
74376   }
74377   var init_map_features = __esm({
74378     "modules/ui/sections/map_features.js"() {
74379       "use strict";
74380       init_localizer();
74381       init_tooltip();
74382       init_section();
74383     }
74384   });
74385
74386   // modules/ui/sections/map_style_options.js
74387   var map_style_options_exports = {};
74388   __export(map_style_options_exports, {
74389     uiSectionMapStyleOptions: () => uiSectionMapStyleOptions
74390   });
74391   function uiSectionMapStyleOptions(context) {
74392     var section = uiSection("fill-area", context).label(() => _t.append("map_data.style_options")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
74393     function renderDisclosureContent(selection2) {
74394       var container = selection2.selectAll(".layer-fill-list").data([0]);
74395       container.enter().append("ul").attr("class", "layer-list layer-fill-list").merge(container).call(drawListItems, context.map().areaFillOptions, "radio", "area_fill", setFill, isActiveFill);
74396       var container2 = selection2.selectAll(".layer-visual-diff-list").data([0]);
74397       container2.enter().append("ul").attr("class", "layer-list layer-visual-diff-list").merge(container2).call(drawListItems, ["highlight_edits"], "checkbox", "visual_diff", toggleHighlightEdited, function() {
74398         return context.surface().classed("highlight-edited");
74399       });
74400     }
74401     function drawListItems(selection2, data, type2, name, change, active) {
74402       var items = selection2.selectAll("li").data(data);
74403       items.exit().remove();
74404       var enter = items.enter().append("li").call(
74405         uiTooltip().title(function(d2) {
74406           return _t.append(name + "." + d2 + ".tooltip");
74407         }).keys(function(d2) {
74408           var key = d2 === "wireframe" ? _t("area_fill.wireframe.key") : null;
74409           if (d2 === "highlight_edits") key = _t("map_data.highlight_edits.key");
74410           return key ? [key] : null;
74411         }).placement("top")
74412       );
74413       var label = enter.append("label");
74414       label.append("input").attr("type", type2).attr("name", name).on("change", change);
74415       label.append("span").html(function(d2) {
74416         return _t.html(name + "." + d2 + ".description");
74417       });
74418       items = items.merge(enter);
74419       items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", false);
74420     }
74421     function isActiveFill(d2) {
74422       return context.map().activeAreaFill() === d2;
74423     }
74424     function toggleHighlightEdited(d3_event) {
74425       d3_event.preventDefault();
74426       context.map().toggleHighlightEdited();
74427     }
74428     function setFill(d3_event, d2) {
74429       context.map().activeAreaFill(d2);
74430     }
74431     context.map().on("changeHighlighting.ui_style, changeAreaFill.ui_style", section.reRender);
74432     return section;
74433   }
74434   var init_map_style_options = __esm({
74435     "modules/ui/sections/map_style_options.js"() {
74436       "use strict";
74437       init_localizer();
74438       init_tooltip();
74439       init_section();
74440     }
74441   });
74442
74443   // modules/ui/settings/local_photos.js
74444   var local_photos_exports2 = {};
74445   __export(local_photos_exports2, {
74446     uiSettingsLocalPhotos: () => uiSettingsLocalPhotos
74447   });
74448   function uiSettingsLocalPhotos(context) {
74449     var dispatch14 = dispatch_default("change");
74450     var photoLayer = context.layers().layer("local-photos");
74451     var modal;
74452     function render(selection2) {
74453       modal = uiConfirm(selection2).okButton();
74454       modal.classed("settings-modal settings-local-photos", true);
74455       modal.select(".modal-section.header").append("h3").call(_t.append("local_photos.header"));
74456       modal.select(".modal-section.message-text").append("div").classed("local-photos", true);
74457       var instructionsSection = modal.select(".modal-section.message-text .local-photos").append("div").classed("instructions", true);
74458       instructionsSection.append("p").classed("instructions-local-photos", true).call(_t.append("local_photos.file.instructions"));
74459       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) {
74460         var files = d3_event.target.files;
74461         if (files && files.length) {
74462           photoList.select("ul").append("li").classed("placeholder", true).append("div");
74463           dispatch14.call("change", this, files);
74464         }
74465         d3_event.target.value = null;
74466       });
74467       instructionsSection.append("label").attr("for", "local-photo-files").classed("button", true).call(_t.append("local_photos.file.label"));
74468       const photoList = modal.select(".modal-section.message-text .local-photos").append("div").append("div").classed("list-local-photos", true);
74469       photoList.append("ul");
74470       updatePhotoList(photoList.select("ul"));
74471       context.layers().on("change", () => updatePhotoList(photoList.select("ul")));
74472     }
74473     function updatePhotoList(container) {
74474       var _a3;
74475       function locationUnavailable(d2) {
74476         return !(isArray_default(d2.loc) && isNumber_default(d2.loc[0]) && isNumber_default(d2.loc[1]));
74477       }
74478       container.selectAll("li.placeholder").remove();
74479       let selection2 = container.selectAll("li").data((_a3 = photoLayer.getPhotos()) != null ? _a3 : [], (d2) => d2.id);
74480       selection2.exit().remove();
74481       const selectionEnter = selection2.enter().append("li");
74482       selectionEnter.append("span").classed("filename", true);
74483       selectionEnter.append("button").classed("form-field-button zoom-to-data", true).attr("title", _t("local_photos.zoom_single")).call(svgIcon("#iD-icon-framed-dot"));
74484       selectionEnter.append("button").classed("form-field-button no-geolocation", true).call(svgIcon("#iD-icon-alert")).call(
74485         uiTooltip().title(() => _t.append("local_photos.no_geolocation.tooltip")).placement("left")
74486       );
74487       selectionEnter.append("button").classed("form-field-button remove", true).attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
74488       selection2 = selection2.merge(selectionEnter);
74489       selection2.classed("invalid", locationUnavailable);
74490       selection2.select("span.filename").text((d2) => d2.name).attr("title", (d2) => d2.name);
74491       selection2.select("span.filename").on("click", (d3_event, d2) => {
74492         photoLayer.openPhoto(d3_event, d2, false);
74493       });
74494       selection2.select("button.zoom-to-data").on("click", (d3_event, d2) => {
74495         photoLayer.openPhoto(d3_event, d2, true);
74496       });
74497       selection2.select("button.remove").on("click", (d3_event, d2) => {
74498         photoLayer.removePhoto(d2.id);
74499         updatePhotoList(container);
74500       });
74501     }
74502     return utilRebind(render, dispatch14, "on");
74503   }
74504   var init_local_photos2 = __esm({
74505     "modules/ui/settings/local_photos.js"() {
74506       "use strict";
74507       init_src4();
74508       init_lodash();
74509       init_localizer();
74510       init_confirm();
74511       init_util();
74512       init_tooltip();
74513       init_svg();
74514     }
74515   });
74516
74517   // modules/ui/sections/photo_overlays.js
74518   var photo_overlays_exports = {};
74519   __export(photo_overlays_exports, {
74520     uiSectionPhotoOverlays: () => uiSectionPhotoOverlays
74521   });
74522   function uiSectionPhotoOverlays(context) {
74523     let _savedLayers = [];
74524     let _layersHidden = false;
74525     const _streetLayerIDs = ["streetside", "mapillary", "mapillary-map-features", "mapillary-signs", "kartaview", "mapilio", "vegbilder", "panoramax"];
74526     var settingsLocalPhotos = uiSettingsLocalPhotos(context).on("change", localPhotosChanged);
74527     var layers = context.layers();
74528     var section = uiSection("photo-overlays", context).label(() => _t.append("photo_overlays.title")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
74529     const photoDates = {};
74530     const now3 = +/* @__PURE__ */ new Date();
74531     function renderDisclosureContent(selection2) {
74532       var container = selection2.selectAll(".photo-overlay-container").data([0]);
74533       container.enter().append("div").attr("class", "photo-overlay-container").merge(container).call(drawPhotoItems).call(drawPhotoTypeItems).call(drawDateSlider).call(drawUsernameFilter).call(drawLocalPhotos);
74534     }
74535     function drawPhotoItems(selection2) {
74536       var photoKeys = context.photos().overlayLayerIDs();
74537       var photoLayers = layers.all().filter(function(obj) {
74538         return photoKeys.indexOf(obj.id) !== -1;
74539       });
74540       var data = photoLayers.filter(function(obj) {
74541         if (!obj.layer.supported()) return false;
74542         if (layerEnabled(obj)) return true;
74543         if (typeof obj.layer.validHere === "function") {
74544           return obj.layer.validHere(context.map().extent(), context.map().zoom());
74545         }
74546         return true;
74547       });
74548       function layerSupported(d2) {
74549         return d2.layer && d2.layer.supported();
74550       }
74551       function layerEnabled(d2) {
74552         return layerSupported(d2) && (d2.layer.enabled() || _savedLayers.includes(d2.id));
74553       }
74554       function layerRendered(d2) {
74555         var _a3, _b2, _c;
74556         return (_c = (_b2 = (_a3 = d2.layer).rendered) == null ? void 0 : _b2.call(_a3, context.map().zoom())) != null ? _c : true;
74557       }
74558       var ul = selection2.selectAll(".layer-list-photos").data([0]);
74559       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-photos").merge(ul);
74560       var li = ul.selectAll(".list-item-photos").data(data, (d2) => d2.id);
74561       li.exit().remove();
74562       var liEnter = li.enter().append("li").attr("class", function(d2) {
74563         var classes = "list-item-photos list-item-" + d2.id;
74564         if (d2.id === "mapillary-signs" || d2.id === "mapillary-map-features") {
74565           classes += " indented";
74566         }
74567         return classes;
74568       });
74569       var labelEnter = liEnter.append("label").each(function(d2) {
74570         var titleID;
74571         if (d2.id === "mapillary-signs") titleID = "mapillary.signs.tooltip";
74572         else if (d2.id === "mapillary") titleID = "mapillary_images.tooltip";
74573         else if (d2.id === "kartaview") titleID = "kartaview_images.tooltip";
74574         else titleID = d2.id.replace(/-/g, "_") + ".tooltip";
74575         select_default2(this).call(
74576           uiTooltip().title(() => {
74577             if (!layerRendered(d2)) {
74578               return _t.append("street_side.minzoom_tooltip");
74579             } else {
74580               return _t.append(titleID);
74581             }
74582           }).placement("top")
74583         );
74584       });
74585       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
74586         toggleLayer(d2.id);
74587       });
74588       labelEnter.append("span").html(function(d2) {
74589         var id2 = d2.id;
74590         if (id2 === "mapillary-signs") id2 = "photo_overlays.traffic_signs";
74591         return _t.html(id2.replace(/-/g, "_") + ".title");
74592       });
74593       li.merge(liEnter).classed("active", layerEnabled).selectAll("input").property("disabled", (d2) => !layerRendered(d2)).property("checked", layerEnabled);
74594     }
74595     function drawPhotoTypeItems(selection2) {
74596       var data = context.photos().allPhotoTypes();
74597       function typeEnabled(d2) {
74598         return context.photos().showsPhotoType(d2);
74599       }
74600       var ul = selection2.selectAll(".layer-list-photo-types").data([0]);
74601       ul.exit().remove();
74602       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-photo-types").merge(ul);
74603       var li = ul.selectAll(".list-item-photo-types").data(context.photos().shouldFilterByPhotoType() ? data : []);
74604       li.exit().remove();
74605       var liEnter = li.enter().append("li").attr("class", function(d2) {
74606         return "list-item-photo-types list-item-" + d2;
74607       });
74608       var labelEnter = liEnter.append("label").each(function(d2) {
74609         select_default2(this).call(
74610           uiTooltip().title(() => _t.append("photo_overlays.photo_type." + d2 + ".tooltip")).placement("top")
74611         );
74612       });
74613       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
74614         context.photos().togglePhotoType(d2, true);
74615       });
74616       labelEnter.append("span").html(function(d2) {
74617         return _t.html("photo_overlays.photo_type." + d2 + ".title");
74618       });
74619       li.merge(liEnter).classed("active", typeEnabled).selectAll("input").property("checked", typeEnabled);
74620     }
74621     function drawDateSlider(selection2) {
74622       var ul = selection2.selectAll(".layer-list-date-slider").data([0]);
74623       ul.exit().remove();
74624       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-date-slider").merge(ul);
74625       var li = ul.selectAll(".list-item-date-slider").data(context.photos().shouldFilterDateBySlider() ? ["date-slider"] : []);
74626       li.exit().remove();
74627       var liEnter = li.enter().append("li").attr("class", "list-item-date-slider");
74628       var labelEnter = liEnter.append("label").each(function() {
74629         select_default2(this).call(
74630           uiTooltip().title(() => _t.append("photo_overlays.age_slider_filter.tooltip")).placement("top")
74631         );
74632       });
74633       labelEnter.append("span").attr("class", "dateSliderSpan").call(_t.append("photo_overlays.age_slider_filter.title"));
74634       let sliderWrap = labelEnter.append("div").attr("class", "slider-wrap");
74635       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() {
74636         let value = select_default2(this).property("value");
74637         setYearFilter(value, true, "from");
74638       });
74639       selection2.select("input.from-date").each(function() {
74640         this.value = dateSliderValue("from");
74641       });
74642       sliderWrap.append("div").attr("class", "date-slider-label");
74643       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() {
74644         let value = select_default2(this).property("value");
74645         setYearFilter(1 - value, true, "to");
74646       });
74647       selection2.select("input.to-date").each(function() {
74648         this.value = 1 - dateSliderValue("to");
74649       });
74650       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", {
74651         date: new Date(now3 - Math.pow(dateSliderValue("from"), 1.45) * 10 * 365.25 * 86400 * 1e3).toLocaleDateString(_mainLocalizer.localeCode())
74652       }));
74653       sliderWrap.append("datalist").attr("class", "date-slider-values").attr("id", "photo-overlay-data-range");
74654       sliderWrap.append("datalist").attr("class", "date-slider-values").attr("id", "photo-overlay-data-range-inverted");
74655       const dateTicks = /* @__PURE__ */ new Set();
74656       for (const dates of Object.values(photoDates)) {
74657         dates.forEach((date) => {
74658           dateTicks.add(Math.round(1e3 * Math.pow((now3 - date) / (10 * 365.25 * 86400 * 1e3), 1 / 1.45)) / 1e3);
74659         });
74660       }
74661       const ticks2 = selection2.select("datalist#photo-overlay-data-range").selectAll("option").data([...dateTicks].concat([1, 0]));
74662       ticks2.exit().remove();
74663       ticks2.enter().append("option").merge(ticks2).attr("value", (d2) => d2);
74664       const ticksInverted = selection2.select("datalist#photo-overlay-data-range-inverted").selectAll("option").data([...dateTicks].concat([1, 0]));
74665       ticksInverted.exit().remove();
74666       ticksInverted.enter().append("option").merge(ticksInverted).attr("value", (d2) => 1 - d2);
74667       li.merge(liEnter).classed("active", filterEnabled);
74668       function filterEnabled() {
74669         return !!context.photos().fromDate();
74670       }
74671     }
74672     function dateSliderValue(which) {
74673       const val = which === "from" ? context.photos().fromDate() : context.photos().toDate();
74674       if (val) {
74675         const date = +new Date(val);
74676         return Math.pow((now3 - date) / (10 * 365.25 * 86400 * 1e3), 1 / 1.45);
74677       } else return which === "from" ? 1 : 0;
74678     }
74679     function setYearFilter(value, updateUrl, which) {
74680       value = +value + (which === "from" ? 1e-3 : -1e-3);
74681       if (value < 1 && value > 0) {
74682         const date = new Date(now3 - Math.pow(value, 1.45) * 10 * 365.25 * 86400 * 1e3).toISOString().substring(0, 10);
74683         context.photos().setDateFilter(`${which}Date`, date, updateUrl);
74684       } else {
74685         context.photos().setDateFilter(`${which}Date`, null, updateUrl);
74686       }
74687     }
74688     ;
74689     function drawUsernameFilter(selection2) {
74690       function filterEnabled() {
74691         return context.photos().usernames();
74692       }
74693       var ul = selection2.selectAll(".layer-list-username-filter").data([0]);
74694       ul.exit().remove();
74695       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-username-filter").merge(ul);
74696       var li = ul.selectAll(".list-item-username-filter").data(context.photos().shouldFilterByUsername() ? ["username-filter"] : []);
74697       li.exit().remove();
74698       var liEnter = li.enter().append("li").attr("class", "list-item-username-filter");
74699       var labelEnter = liEnter.append("label").each(function() {
74700         select_default2(this).call(
74701           uiTooltip().title(() => _t.append("photo_overlays.username_filter.tooltip")).placement("top")
74702         );
74703       });
74704       labelEnter.append("span").call(_t.append("photo_overlays.username_filter.title"));
74705       labelEnter.append("input").attr("type", "text").attr("class", "list-item-input").call(utilNoAuto).property("value", usernameValue).on("change", function() {
74706         var value = select_default2(this).property("value");
74707         context.photos().setUsernameFilter(value, true);
74708         select_default2(this).property("value", usernameValue);
74709       });
74710       li.merge(liEnter).classed("active", filterEnabled);
74711       function usernameValue() {
74712         var usernames = context.photos().usernames();
74713         if (usernames) return usernames.join("; ");
74714         return usernames;
74715       }
74716     }
74717     function toggleLayer(which) {
74718       setLayer(which, !showsLayer(which));
74719     }
74720     function showsLayer(which) {
74721       var layer = layers.layer(which);
74722       if (layer) {
74723         return layer.enabled();
74724       }
74725       return false;
74726     }
74727     function setLayer(which, enabled) {
74728       var layer = layers.layer(which);
74729       if (layer) {
74730         layer.enabled(enabled);
74731       }
74732     }
74733     function drawLocalPhotos(selection2) {
74734       var photoLayer = layers.layer("local-photos");
74735       var hasData = photoLayer && photoLayer.hasData();
74736       var showsData = hasData && photoLayer.enabled();
74737       var ul = selection2.selectAll(".layer-list-local-photos").data(photoLayer ? [0] : []);
74738       ul.exit().remove();
74739       var ulEnter = ul.enter().append("ul").attr("class", "layer-list layer-list-local-photos");
74740       var localPhotosEnter = ulEnter.append("li").attr("class", "list-item-local-photos");
74741       var localPhotosLabelEnter = localPhotosEnter.append("label").call(uiTooltip().title(() => _t.append("local_photos.tooltip")));
74742       localPhotosLabelEnter.append("input").attr("type", "checkbox").on("change", function() {
74743         toggleLayer("local-photos");
74744       });
74745       localPhotosLabelEnter.call(_t.append("local_photos.header"));
74746       localPhotosEnter.append("button").attr("class", "open-data-options").call(
74747         uiTooltip().title(() => _t.append("local_photos.tooltip_edit")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
74748       ).on("click", function(d3_event) {
74749         d3_event.preventDefault();
74750         editLocalPhotos();
74751       }).call(svgIcon("#iD-icon-more"));
74752       localPhotosEnter.append("button").attr("class", "zoom-to-data").call(
74753         uiTooltip().title(() => _t.append("local_photos.zoom")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
74754       ).on("click", function(d3_event) {
74755         if (select_default2(this).classed("disabled")) return;
74756         d3_event.preventDefault();
74757         d3_event.stopPropagation();
74758         photoLayer.fitZoom();
74759       }).call(svgIcon("#iD-icon-framed-dot", "monochrome"));
74760       ul = ul.merge(ulEnter);
74761       ul.selectAll(".list-item-local-photos").classed("active", showsData).selectAll("label").classed("deemphasize", !hasData).selectAll("input").property("disabled", !hasData).property("checked", showsData);
74762       ul.selectAll("button.zoom-to-data").classed("disabled", !hasData);
74763     }
74764     function editLocalPhotos() {
74765       context.container().call(settingsLocalPhotos);
74766     }
74767     function localPhotosChanged(d2) {
74768       var localPhotosLayer = layers.layer("local-photos");
74769       localPhotosLayer.fileList(d2);
74770     }
74771     function toggleStreetSide() {
74772       let layerContainer = select_default2(".photo-overlay-container");
74773       if (!_layersHidden) {
74774         layers.all().forEach((d2) => {
74775           if (_streetLayerIDs.includes(d2.id)) {
74776             if (showsLayer(d2.id)) _savedLayers.push(d2.id);
74777             setLayer(d2.id, false);
74778           }
74779         });
74780         layerContainer.classed("disabled-panel", true);
74781       } else {
74782         _savedLayers.forEach((d2) => {
74783           setLayer(d2, true);
74784         });
74785         _savedLayers = [];
74786         layerContainer.classed("disabled-panel", false);
74787       }
74788       _layersHidden = !_layersHidden;
74789     }
74790     ;
74791     context.layers().on("change.uiSectionPhotoOverlays", section.reRender);
74792     context.photos().on("change.uiSectionPhotoOverlays", section.reRender);
74793     context.layers().on("photoDatesChanged.uiSectionPhotoOverlays", function(service, dates) {
74794       photoDates[service] = dates.map((date) => +new Date(date));
74795       section.reRender();
74796     });
74797     context.keybinding().on("\u21E7P", toggleStreetSide);
74798     context.map().on(
74799       "move.photo_overlays",
74800       debounce_default(function() {
74801         window.requestIdleCallback(section.reRender);
74802       }, 1e3)
74803     );
74804     return section;
74805   }
74806   var init_photo_overlays = __esm({
74807     "modules/ui/sections/photo_overlays.js"() {
74808       "use strict";
74809       init_debounce();
74810       init_src5();
74811       init_localizer();
74812       init_tooltip();
74813       init_section();
74814       init_util();
74815       init_local_photos2();
74816       init_svg();
74817     }
74818   });
74819
74820   // modules/ui/panes/map_data.js
74821   var map_data_exports = {};
74822   __export(map_data_exports, {
74823     uiPaneMapData: () => uiPaneMapData
74824   });
74825   function uiPaneMapData(context) {
74826     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([
74827       uiSectionDataLayers(context),
74828       uiSectionPhotoOverlays(context),
74829       uiSectionMapStyleOptions(context),
74830       uiSectionMapFeatures(context)
74831     ]);
74832     return mapDataPane;
74833   }
74834   var init_map_data = __esm({
74835     "modules/ui/panes/map_data.js"() {
74836       "use strict";
74837       init_localizer();
74838       init_pane();
74839       init_data_layers();
74840       init_map_features();
74841       init_map_style_options();
74842       init_photo_overlays();
74843     }
74844   });
74845
74846   // modules/ui/panes/preferences.js
74847   var preferences_exports2 = {};
74848   __export(preferences_exports2, {
74849     uiPanePreferences: () => uiPanePreferences
74850   });
74851   function uiPanePreferences(context) {
74852     let preferencesPane = uiPane("preferences", context).key(_t("preferences.key")).label(_t.append("preferences.title")).description(_t.append("preferences.description")).iconName("fas-user-cog").sections([
74853       uiSectionPrivacy(context)
74854     ]);
74855     return preferencesPane;
74856   }
74857   var init_preferences2 = __esm({
74858     "modules/ui/panes/preferences.js"() {
74859       "use strict";
74860       init_localizer();
74861       init_pane();
74862       init_privacy();
74863     }
74864   });
74865
74866   // modules/ui/init.js
74867   var init_exports = {};
74868   __export(init_exports, {
74869     uiInit: () => uiInit
74870   });
74871   function uiInit(context) {
74872     var _initCounter = 0;
74873     var _needWidth = {};
74874     var _lastPointerType;
74875     var overMap;
74876     function render(container) {
74877       container.on("click.ui", function(d3_event) {
74878         if (d3_event.button !== 0) return;
74879         if (!d3_event.composedPath) return;
74880         var isOkayTarget = d3_event.composedPath().some(function(node) {
74881           return node.nodeType === 1 && // clicking <input> focuses it and/or changes a value
74882           (node.nodeName === "INPUT" || // clicking <label> affects its <input> by default
74883           node.nodeName === "LABEL" || // clicking <a> opens a hyperlink by default
74884           node.nodeName === "A");
74885         });
74886         if (isOkayTarget) return;
74887         d3_event.preventDefault();
74888       });
74889       var detected = utilDetect();
74890       if ("GestureEvent" in window && // Listening for gesture events on iOS 13.4+ breaks double-tapping,
74891       // but we only need to do this on desktop Safari anyway. – #7694
74892       !detected.isMobileWebKit) {
74893         container.on("gesturestart.ui gesturechange.ui gestureend.ui", function(d3_event) {
74894           d3_event.preventDefault();
74895         });
74896       }
74897       if ("PointerEvent" in window) {
74898         select_default2(window).on("pointerdown.ui pointerup.ui", function(d3_event) {
74899           var pointerType = d3_event.pointerType || "mouse";
74900           if (_lastPointerType !== pointerType) {
74901             _lastPointerType = pointerType;
74902             container.attr("pointer", pointerType);
74903           }
74904         }, true);
74905       } else {
74906         _lastPointerType = "mouse";
74907         container.attr("pointer", "mouse");
74908       }
74909       container.attr("lang", _mainLocalizer.localeCode()).attr("dir", _mainLocalizer.textDirection());
74910       container.call(uiFullScreen(context));
74911       var map2 = context.map();
74912       map2.redrawEnable(false);
74913       map2.on("hitMinZoom.ui", function() {
74914         ui.flash.iconName("#iD-icon-no").label(_t.append("cannot_zoom"))();
74915       });
74916       container.append("svg").attr("id", "ideditor-defs").call(ui.svgDefs);
74917       container.append("div").attr("class", "sidebar").call(ui.sidebar);
74918       var content = container.append("div").attr("class", "main-content active");
74919       content.append("div").attr("class", "top-toolbar-wrap").append("div").attr("class", "top-toolbar fillD").call(uiTopToolbar(context));
74920       content.append("div").attr("class", "main-map").attr("dir", "ltr").call(map2);
74921       overMap = content.append("div").attr("class", "over-map");
74922       overMap.append("div").attr("class", "select-trap").text("t");
74923       overMap.call(uiMapInMap(context)).call(uiNotice(context));
74924       overMap.append("div").attr("class", "spinner").call(uiSpinner(context));
74925       var controlsWrap = overMap.append("div").attr("class", "map-controls-wrap");
74926       var controls = controlsWrap.append("div").attr("class", "map-controls");
74927       controls.append("div").attr("class", "map-control zoombuttons").call(uiZoom(context));
74928       controls.append("div").attr("class", "map-control zoom-to-selection-control").call(uiZoomToSelection(context));
74929       controls.append("div").attr("class", "map-control geolocate-control").call(uiGeolocate(context));
74930       controlsWrap.on("wheel.mapControls", function(d3_event) {
74931         if (!d3_event.deltaX) {
74932           controlsWrap.node().scrollTop += d3_event.deltaY;
74933         }
74934       });
74935       var panes = overMap.append("div").attr("class", "map-panes");
74936       var uiPanes = [
74937         uiPaneBackground(context),
74938         uiPaneMapData(context),
74939         uiPaneIssues(context),
74940         uiPanePreferences(context),
74941         uiPaneHelp(context)
74942       ];
74943       uiPanes.forEach(function(pane) {
74944         controls.append("div").attr("class", "map-control map-pane-control " + pane.id + "-control").call(pane.renderToggleButton);
74945         panes.call(pane.renderPane);
74946       });
74947       ui.info = uiInfo(context);
74948       overMap.call(ui.info);
74949       overMap.append("div").attr("class", "photoviewer").classed("al", true).classed("hide", true).call(ui.photoviewer);
74950       overMap.append("div").attr("class", "attribution-wrap").attr("dir", "ltr").call(uiAttribution(context));
74951       var about = content.append("div").attr("class", "map-footer");
74952       about.append("div").attr("class", "api-status").call(uiStatus(context));
74953       var footer = about.append("div").attr("class", "map-footer-bar fillD");
74954       footer.append("div").attr("class", "flash-wrap footer-hide");
74955       var footerWrap = footer.append("div").attr("class", "main-footer-wrap footer-show");
74956       footerWrap.append("div").attr("class", "scale-block").call(uiScale(context));
74957       var aboutList = footerWrap.append("div").attr("class", "info-block").append("ul").attr("class", "map-footer-list");
74958       aboutList.append("li").attr("class", "user-list").call(uiContributors(context));
74959       var apiConnections = context.connection().apiConnections();
74960       if (apiConnections && apiConnections.length > 1) {
74961         aboutList.append("li").attr("class", "source-switch").call(
74962           uiSourceSwitch(context).keys(apiConnections)
74963         );
74964       }
74965       aboutList.append("li").attr("class", "issues-info").call(uiIssuesInfo(context));
74966       aboutList.append("li").attr("class", "feature-warning").call(uiFeatureInfo(context));
74967       var issueLinks = aboutList.append("li");
74968       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"));
74969       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"));
74970       aboutList.append("li").attr("class", "version").call(uiVersion(context));
74971       if (!context.embed()) {
74972         aboutList.call(uiAccount(context));
74973       }
74974       ui.onResize();
74975       map2.redrawEnable(true);
74976       ui.hash = behaviorHash(context);
74977       ui.hash();
74978       if (!ui.hash.hadLocation) {
74979         map2.centerZoom([0, 0], 2);
74980       }
74981       window.onbeforeunload = function() {
74982         return context.save();
74983       };
74984       window.onunload = function() {
74985         context.history().unlock();
74986       };
74987       select_default2(window).on("resize.editor", function() {
74988         ui.onResize();
74989       });
74990       var panPixels = 80;
74991       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) {
74992         if (d3_event) {
74993           d3_event.stopImmediatePropagation();
74994           d3_event.preventDefault();
74995         }
74996         var previousBackground = context.background().findSource(corePreferences("background-last-used-toggle"));
74997         if (previousBackground) {
74998           var currentBackground = context.background().baseLayerSource();
74999           corePreferences("background-last-used-toggle", currentBackground.id);
75000           corePreferences("background-last-used", previousBackground.id);
75001           context.background().baseLayerSource(previousBackground);
75002         }
75003       }).on(_t("area_fill.wireframe.key"), function toggleWireframe(d3_event) {
75004         d3_event.preventDefault();
75005         d3_event.stopPropagation();
75006         context.map().toggleWireframe();
75007       }).on(uiCmd("\u2325" + _t("area_fill.wireframe.key")), function toggleOsmData(d3_event) {
75008         d3_event.preventDefault();
75009         d3_event.stopPropagation();
75010         var mode = context.mode();
75011         if (mode && /^draw/.test(mode.id)) return;
75012         var layer = context.layers().layer("osm");
75013         if (layer) {
75014           layer.enabled(!layer.enabled());
75015           if (!layer.enabled()) {
75016             context.enter(modeBrowse(context));
75017           }
75018         }
75019       }).on(_t("map_data.highlight_edits.key"), function toggleHighlightEdited(d3_event) {
75020         d3_event.preventDefault();
75021         context.map().toggleHighlightEdited();
75022       });
75023       context.on("enter.editor", function(entered) {
75024         container.classed("mode-" + entered.id, true);
75025       }).on("exit.editor", function(exited) {
75026         container.classed("mode-" + exited.id, false);
75027       });
75028       context.enter(modeBrowse(context));
75029       if (!_initCounter++) {
75030         if (!ui.hash.startWalkthrough) {
75031           context.container().call(uiSplash(context)).call(uiRestore(context));
75032         }
75033         context.container().call(ui.shortcuts);
75034       }
75035       var osm = context.connection();
75036       var auth = uiLoading(context).message(_t.html("loading_auth")).blocking(true);
75037       if (osm && auth) {
75038         osm.on("authLoading.ui", function() {
75039           context.container().call(auth);
75040         }).on("authDone.ui", function() {
75041           auth.close();
75042         });
75043       }
75044       _initCounter++;
75045       if (ui.hash.startWalkthrough) {
75046         ui.hash.startWalkthrough = false;
75047         context.container().call(uiIntro(context));
75048       }
75049       function pan(d2) {
75050         return function(d3_event) {
75051           if (d3_event.shiftKey) return;
75052           if (context.container().select(".combobox").size()) return;
75053           d3_event.preventDefault();
75054           context.map().pan(d2, 100);
75055         };
75056       }
75057     }
75058     let ui = {};
75059     let _loadPromise;
75060     ui.ensureLoaded = () => {
75061       if (_loadPromise) return _loadPromise;
75062       return _loadPromise = Promise.all([
75063         // must have strings and presets before loading the UI
75064         _mainLocalizer.ensureLoaded(),
75065         _mainPresetIndex.ensureLoaded()
75066       ]).then(() => {
75067         if (!context.container().empty()) render(context.container());
75068       }).catch((err) => console.error(err));
75069     };
75070     ui.restart = function() {
75071       context.keybinding().clear();
75072       _loadPromise = null;
75073       context.container().selectAll("*").remove();
75074       ui.ensureLoaded();
75075     };
75076     ui.lastPointerType = function() {
75077       return _lastPointerType;
75078     };
75079     ui.svgDefs = svgDefs(context);
75080     ui.flash = uiFlash(context);
75081     ui.sidebar = uiSidebar(context);
75082     ui.photoviewer = uiPhotoviewer(context);
75083     ui.shortcuts = uiShortcuts(context);
75084     ui.onResize = function(withPan) {
75085       var map2 = context.map();
75086       var mapDimensions = utilGetDimensions(context.container().select(".main-content"), true);
75087       utilGetDimensions(context.container().select(".sidebar"), true);
75088       if (withPan !== void 0) {
75089         map2.redrawEnable(false);
75090         map2.pan(withPan);
75091         map2.redrawEnable(true);
75092       }
75093       map2.dimensions(mapDimensions);
75094       ui.photoviewer.onMapResize();
75095       ui.checkOverflow(".top-toolbar");
75096       ui.checkOverflow(".map-footer-bar");
75097       var resizeWindowEvent = document.createEvent("Event");
75098       resizeWindowEvent.initEvent("resizeWindow", true, true);
75099       document.dispatchEvent(resizeWindowEvent);
75100     };
75101     ui.checkOverflow = function(selector, reset) {
75102       if (reset) {
75103         delete _needWidth[selector];
75104       }
75105       var selection2 = context.container().select(selector);
75106       if (selection2.empty()) return;
75107       var scrollWidth = selection2.property("scrollWidth");
75108       var clientWidth = selection2.property("clientWidth");
75109       var needed = _needWidth[selector] || scrollWidth;
75110       if (scrollWidth > clientWidth) {
75111         selection2.classed("narrow", true);
75112         if (!_needWidth[selector]) {
75113           _needWidth[selector] = scrollWidth;
75114         }
75115       } else if (scrollWidth >= needed) {
75116         selection2.classed("narrow", false);
75117       }
75118     };
75119     ui.togglePanes = function(showPane) {
75120       var hidePanes = context.container().selectAll(".map-pane.shown");
75121       var side = _mainLocalizer.textDirection() === "ltr" ? "right" : "left";
75122       hidePanes.classed("shown", false).classed("hide", true);
75123       context.container().selectAll(".map-pane-control button").classed("active", false);
75124       if (showPane) {
75125         hidePanes.classed("shown", false).classed("hide", true).style(side, "-500px");
75126         context.container().selectAll("." + showPane.attr("pane") + "-control button").classed("active", true);
75127         showPane.classed("shown", true).classed("hide", false);
75128         if (hidePanes.empty()) {
75129           showPane.style(side, "-500px").transition().duration(200).style(side, "0px");
75130         } else {
75131           showPane.style(side, "0px");
75132         }
75133       } else {
75134         hidePanes.classed("shown", true).classed("hide", false).style(side, "0px").transition().duration(200).style(side, "-500px").on("end", function() {
75135           select_default2(this).classed("shown", false).classed("hide", true);
75136         });
75137       }
75138     };
75139     var _editMenu = uiEditMenu(context);
75140     ui.editMenu = function() {
75141       return _editMenu;
75142     };
75143     ui.showEditMenu = function(anchorPoint, triggerType, operations) {
75144       ui.closeEditMenu();
75145       if (!operations && context.mode().operations) operations = context.mode().operations();
75146       if (!operations || !operations.length) return;
75147       if (!context.map().editableDataEnabled()) return;
75148       var surfaceNode = context.surface().node();
75149       if (surfaceNode.focus) {
75150         surfaceNode.focus();
75151       }
75152       operations.forEach(function(operation2) {
75153         if (operation2.point) operation2.point(anchorPoint);
75154       });
75155       _editMenu.anchorLoc(anchorPoint).triggerType(triggerType).operations(operations);
75156       overMap.call(_editMenu);
75157     };
75158     ui.closeEditMenu = function() {
75159       if (overMap !== void 0) {
75160         overMap.select(".edit-menu").remove();
75161       }
75162     };
75163     var _saveLoading = select_default2(null);
75164     context.uploader().on("saveStarted.ui", function() {
75165       _saveLoading = uiLoading(context).message(_t.html("save.uploading")).blocking(true);
75166       context.container().call(_saveLoading);
75167     }).on("saveEnded.ui", function() {
75168       _saveLoading.close();
75169       _saveLoading = select_default2(null);
75170     });
75171     marked.use({
75172       mangle: false,
75173       headerIds: false
75174     });
75175     return ui;
75176   }
75177   var init_init2 = __esm({
75178     "modules/ui/init.js"() {
75179       "use strict";
75180       init_marked_esm();
75181       init_src5();
75182       init_preferences();
75183       init_localizer();
75184       init_presets();
75185       init_behavior();
75186       init_browse();
75187       init_svg();
75188       init_detect();
75189       init_dimensions();
75190       init_account();
75191       init_attribution();
75192       init_contributors();
75193       init_edit_menu();
75194       init_feature_info();
75195       init_flash();
75196       init_full_screen();
75197       init_geolocate2();
75198       init_info();
75199       init_intro2();
75200       init_issues_info();
75201       init_loading();
75202       init_map_in_map();
75203       init_notice();
75204       init_photoviewer();
75205       init_restore();
75206       init_scale2();
75207       init_shortcuts();
75208       init_sidebar();
75209       init_source_switch();
75210       init_spinner();
75211       init_splash();
75212       init_status();
75213       init_tooltip();
75214       init_top_toolbar();
75215       init_version();
75216       init_zoom3();
75217       init_zoom_to_selection();
75218       init_cmd();
75219       init_background3();
75220       init_help();
75221       init_issues();
75222       init_map_data();
75223       init_preferences2();
75224     }
75225   });
75226
75227   // modules/ui/commit_warnings.js
75228   var commit_warnings_exports = {};
75229   __export(commit_warnings_exports, {
75230     uiCommitWarnings: () => uiCommitWarnings
75231   });
75232   function uiCommitWarnings(context) {
75233     function commitWarnings(selection2) {
75234       var issuesBySeverity = context.validator().getIssuesBySeverity({ what: "edited", where: "all", includeDisabledRules: true });
75235       for (var severity in issuesBySeverity) {
75236         var issues = issuesBySeverity[severity];
75237         if (severity !== "error") {
75238           issues = issues.filter(function(issue) {
75239             return issue.type !== "help_request";
75240           });
75241         }
75242         var section = severity + "-section";
75243         var issueItem = severity + "-item";
75244         var container = selection2.selectAll("." + section).data(issues.length ? [0] : []);
75245         container.exit().remove();
75246         var containerEnter = container.enter().append("div").attr("class", "modal-section " + section + " fillL2");
75247         containerEnter.append("h3").call(severity === "warning" ? _t.append("commit.warnings") : _t.append("commit.errors"));
75248         containerEnter.append("ul").attr("class", "changeset-list");
75249         container = containerEnter.merge(container);
75250         var items = container.select("ul").selectAll("li").data(issues, function(d2) {
75251           return d2.key;
75252         });
75253         items.exit().remove();
75254         var itemsEnter = items.enter().append("li").attr("class", issueItem);
75255         var buttons = itemsEnter.append("button").on("mouseover", function(d3_event, d2) {
75256           if (d2.entityIds) {
75257             context.surface().selectAll(
75258               utilEntityOrMemberSelector(
75259                 d2.entityIds,
75260                 context.graph()
75261               )
75262             ).classed("hover", true);
75263           }
75264         }).on("mouseout", function() {
75265           context.surface().selectAll(".hover").classed("hover", false);
75266         }).on("click", function(d3_event, d2) {
75267           context.validator().focusIssue(d2);
75268         });
75269         buttons.call(svgIcon("#iD-icon-alert", "pre-text"));
75270         buttons.append("strong").attr("class", "issue-message");
75271         buttons.filter(function(d2) {
75272           return d2.tooltip;
75273         }).call(
75274           uiTooltip().title(function(d2) {
75275             return d2.tooltip;
75276           }).placement("top")
75277         );
75278         items = itemsEnter.merge(items);
75279         items.selectAll(".issue-message").text("").each(function(d2) {
75280           return d2.message(context)(select_default2(this));
75281         });
75282       }
75283     }
75284     return commitWarnings;
75285   }
75286   var init_commit_warnings = __esm({
75287     "modules/ui/commit_warnings.js"() {
75288       "use strict";
75289       init_src5();
75290       init_localizer();
75291       init_icon();
75292       init_tooltip();
75293       init_util();
75294     }
75295   });
75296
75297   // modules/ui/lasso.js
75298   var lasso_exports = {};
75299   __export(lasso_exports, {
75300     uiLasso: () => uiLasso
75301   });
75302   function uiLasso(context) {
75303     var group, polygon2;
75304     lasso.coordinates = [];
75305     function lasso(selection2) {
75306       context.container().classed("lasso", true);
75307       group = selection2.append("g").attr("class", "lasso hide");
75308       polygon2 = group.append("path").attr("class", "lasso-path");
75309       group.call(uiToggle(true));
75310     }
75311     function draw() {
75312       if (polygon2) {
75313         polygon2.data([lasso.coordinates]).attr("d", function(d2) {
75314           return "M" + d2.join(" L") + " Z";
75315         });
75316       }
75317     }
75318     lasso.extent = function() {
75319       return lasso.coordinates.reduce(function(extent, point) {
75320         return extent.extend(geoExtent(point));
75321       }, geoExtent());
75322     };
75323     lasso.p = function(_2) {
75324       if (!arguments.length) return lasso;
75325       lasso.coordinates.push(_2);
75326       draw();
75327       return lasso;
75328     };
75329     lasso.close = function() {
75330       if (group) {
75331         group.call(uiToggle(false, function() {
75332           select_default2(this).remove();
75333         }));
75334       }
75335       context.container().classed("lasso", false);
75336     };
75337     return lasso;
75338   }
75339   var init_lasso = __esm({
75340     "modules/ui/lasso.js"() {
75341       "use strict";
75342       init_src5();
75343       init_geo2();
75344       init_toggle();
75345     }
75346   });
75347
75348   // node_modules/osm-community-index/lib/simplify.js
75349   function simplify(str) {
75350     if (typeof str !== "string") return "";
75351     return import_diacritics.default.remove(
75352       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()
75353     );
75354   }
75355   var import_diacritics;
75356   var init_simplify = __esm({
75357     "node_modules/osm-community-index/lib/simplify.js"() {
75358       import_diacritics = __toESM(require_diacritics(), 1);
75359     }
75360   });
75361
75362   // node_modules/osm-community-index/lib/resolve_strings.js
75363   function resolveStrings(item, defaults, localizerFn) {
75364     let itemStrings = Object.assign({}, item.strings);
75365     let defaultStrings = Object.assign({}, defaults[item.type]);
75366     const anyToken = new RegExp(/(\{\w+\})/, "gi");
75367     if (localizerFn) {
75368       if (itemStrings.community) {
75369         const communityID = simplify(itemStrings.community);
75370         itemStrings.community = localizerFn(`_communities.${communityID}`);
75371       }
75372       ["name", "description", "extendedDescription"].forEach((prop) => {
75373         if (defaultStrings[prop]) defaultStrings[prop] = localizerFn(`_defaults.${item.type}.${prop}`);
75374         if (itemStrings[prop]) itemStrings[prop] = localizerFn(`${item.id}.${prop}`);
75375       });
75376     }
75377     let replacements = {
75378       account: item.account,
75379       community: itemStrings.community,
75380       signupUrl: itemStrings.signupUrl,
75381       url: itemStrings.url
75382     };
75383     if (!replacements.signupUrl) {
75384       replacements.signupUrl = resolve(itemStrings.signupUrl || defaultStrings.signupUrl);
75385     }
75386     if (!replacements.url) {
75387       replacements.url = resolve(itemStrings.url || defaultStrings.url);
75388     }
75389     let resolved = {
75390       name: resolve(itemStrings.name || defaultStrings.name),
75391       url: resolve(itemStrings.url || defaultStrings.url),
75392       signupUrl: resolve(itemStrings.signupUrl || defaultStrings.signupUrl),
75393       description: resolve(itemStrings.description || defaultStrings.description),
75394       extendedDescription: resolve(itemStrings.extendedDescription || defaultStrings.extendedDescription)
75395     };
75396     resolved.nameHTML = linkify(resolved.url, resolved.name);
75397     resolved.urlHTML = linkify(resolved.url);
75398     resolved.signupUrlHTML = linkify(resolved.signupUrl);
75399     resolved.descriptionHTML = resolve(itemStrings.description || defaultStrings.description, true);
75400     resolved.extendedDescriptionHTML = resolve(itemStrings.extendedDescription || defaultStrings.extendedDescription, true);
75401     return resolved;
75402     function resolve(s2, addLinks) {
75403       if (!s2) return void 0;
75404       let result = s2;
75405       for (let key in replacements) {
75406         const token = `{${key}}`;
75407         const regex = new RegExp(token, "g");
75408         if (regex.test(result)) {
75409           let replacement = replacements[key];
75410           if (!replacement) {
75411             throw new Error(`Cannot resolve token: ${token}`);
75412           } else {
75413             if (addLinks && (key === "signupUrl" || key === "url")) {
75414               replacement = linkify(replacement);
75415             }
75416             result = result.replace(regex, replacement);
75417           }
75418         }
75419       }
75420       const leftovers = result.match(anyToken);
75421       if (leftovers) {
75422         throw new Error(`Cannot resolve tokens: ${leftovers}`);
75423       }
75424       if (addLinks && item.type === "reddit") {
75425         result = result.replace(/(\/r\/\w+\/*)/i, (match) => linkify(resolved.url, match));
75426       }
75427       return result;
75428     }
75429     function linkify(url, text) {
75430       if (!url) return void 0;
75431       text = text || url;
75432       return `<a target="_blank" href="${url}">${text}</a>`;
75433     }
75434   }
75435   var init_resolve_strings = __esm({
75436     "node_modules/osm-community-index/lib/resolve_strings.js"() {
75437       init_simplify();
75438     }
75439   });
75440
75441   // node_modules/osm-community-index/index.mjs
75442   var init_osm_community_index = __esm({
75443     "node_modules/osm-community-index/index.mjs"() {
75444       init_resolve_strings();
75445       init_simplify();
75446     }
75447   });
75448
75449   // modules/ui/success.js
75450   var success_exports = {};
75451   __export(success_exports, {
75452     uiSuccess: () => uiSuccess
75453   });
75454   function uiSuccess(context) {
75455     const MAXEVENTS = 2;
75456     const dispatch14 = dispatch_default("cancel");
75457     let _changeset2;
75458     let _location;
75459     ensureOSMCommunityIndex();
75460     function ensureOSMCommunityIndex() {
75461       const data = _mainFileFetcher;
75462       return Promise.all([
75463         data.get("oci_features"),
75464         data.get("oci_resources"),
75465         data.get("oci_defaults")
75466       ]).then((vals) => {
75467         if (_oci) return _oci;
75468         if (vals[0] && Array.isArray(vals[0].features)) {
75469           _sharedLocationManager.mergeCustomGeoJSON(vals[0]);
75470         }
75471         let ociResources = Object.values(vals[1].resources);
75472         if (ociResources.length) {
75473           return _sharedLocationManager.mergeLocationSets(ociResources).then(() => {
75474             _oci = {
75475               resources: ociResources,
75476               defaults: vals[2].defaults
75477             };
75478             return _oci;
75479           });
75480         } else {
75481           _oci = {
75482             resources: [],
75483             // no resources?
75484             defaults: vals[2].defaults
75485           };
75486           return _oci;
75487         }
75488       });
75489     }
75490     function parseEventDate(when) {
75491       if (!when) return;
75492       let raw = when.trim();
75493       if (!raw) return;
75494       if (!/Z$/.test(raw)) {
75495         raw += "Z";
75496       }
75497       const parsed = new Date(raw);
75498       return new Date(parsed.toUTCString().slice(0, 25));
75499     }
75500     function success(selection2) {
75501       let header = selection2.append("div").attr("class", "header fillL");
75502       header.append("h2").call(_t.append("success.just_edited"));
75503       header.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => dispatch14.call("cancel")).call(svgIcon("#iD-icon-close"));
75504       let body = selection2.append("div").attr("class", "body save-success fillL");
75505       let summary = body.append("div").attr("class", "save-summary");
75506       summary.append("h3").call(_t.append("success.thank_you" + (_location ? "_location" : ""), { where: _location }));
75507       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"));
75508       let osm = context.connection();
75509       if (!osm) return;
75510       let changesetURL = osm.changesetURL(_changeset2.id);
75511       let table = summary.append("table").attr("class", "summary-table");
75512       let row = table.append("tr").attr("class", "summary-row");
75513       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");
75514       let summaryDetail = row.append("td").attr("class", "cell-detail summary-detail");
75515       summaryDetail.append("a").attr("class", "cell-detail summary-view-on-osm").attr("target", "_blank").attr("href", changesetURL).call(_t.append("success.view_on_osm"));
75516       summaryDetail.append("div").html(_t.html("success.changeset_id", {
75517         changeset_id: { html: `<a href="${changesetURL}" target="_blank">${_changeset2.id}</a>` }
75518       }));
75519       if (showDonationMessage !== false) {
75520         const donationUrl = "https://supporting.openstreetmap.org/";
75521         let supporting = body.append("div").attr("class", "save-supporting");
75522         supporting.append("h3").call(_t.append("success.supporting.title"));
75523         supporting.append("p").call(_t.append("success.supporting.details"));
75524         table = supporting.append("table").attr("class", "supporting-table");
75525         row = table.append("tr").attr("class", "supporting-row");
75526         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");
75527         let supportingDetail = row.append("td").attr("class", "cell-detail supporting-detail");
75528         supportingDetail.append("a").attr("class", "cell-detail support-the-map").attr("target", "_blank").attr("href", donationUrl).call(_t.append("success.supporting.donation.title"));
75529         supportingDetail.append("div").call(_t.append("success.supporting.donation.details"));
75530       }
75531       ensureOSMCommunityIndex().then((oci) => {
75532         const loc = context.map().center();
75533         const validHere = _sharedLocationManager.locationSetsAt(loc);
75534         let communities = [];
75535         oci.resources.forEach((resource) => {
75536           let area = validHere[resource.locationSetID];
75537           if (!area) return;
75538           const localizer = (stringID) => _t.html(`community.${stringID}`);
75539           resource.resolved = resolveStrings(resource, oci.defaults, localizer);
75540           communities.push({
75541             area,
75542             order: resource.order || 0,
75543             resource
75544           });
75545         });
75546         communities.sort((a2, b2) => a2.area - b2.area || b2.order - a2.order);
75547         body.call(showCommunityLinks, communities.map((c2) => c2.resource));
75548       });
75549     }
75550     function showCommunityLinks(selection2, resources) {
75551       let communityLinks = selection2.append("div").attr("class", "save-communityLinks");
75552       communityLinks.append("h3").call(_t.append("success.like_osm"));
75553       let table = communityLinks.append("table").attr("class", "community-table");
75554       let row = table.selectAll(".community-row").data(resources);
75555       let rowEnter = row.enter().append("tr").attr("class", "community-row");
75556       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}`);
75557       let communityDetail = rowEnter.append("td").attr("class", "cell-detail community-detail");
75558       communityDetail.each(showCommunityDetails);
75559       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"));
75560     }
75561     function showCommunityDetails(d2) {
75562       let selection2 = select_default2(this);
75563       let communityID = d2.id;
75564       selection2.append("div").attr("class", "community-name").html(d2.resolved.nameHTML);
75565       selection2.append("div").attr("class", "community-description").html(d2.resolved.descriptionHTML);
75566       if (d2.resolved.extendedDescriptionHTML || d2.languageCodes && d2.languageCodes.length) {
75567         selection2.append("div").call(
75568           uiDisclosure(context, `community-more-${d2.id}`, false).expanded(false).updatePreference(false).label(() => _t.append("success.more")).content(showMore)
75569         );
75570       }
75571       let nextEvents = (d2.events || []).map((event) => {
75572         event.date = parseEventDate(event.when);
75573         return event;
75574       }).filter((event) => {
75575         const t2 = event.date.getTime();
75576         const now3 = (/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0);
75577         return !isNaN(t2) && t2 >= now3;
75578       }).sort((a2, b2) => {
75579         return a2.date < b2.date ? -1 : a2.date > b2.date ? 1 : 0;
75580       }).slice(0, MAXEVENTS);
75581       if (nextEvents.length) {
75582         selection2.append("div").call(
75583           uiDisclosure(context, `community-events-${d2.id}`, false).expanded(false).updatePreference(false).label(_t.html("success.events")).content(showNextEvents)
75584         ).select(".hide-toggle").append("span").attr("class", "badge-text").text(nextEvents.length);
75585       }
75586       function showMore(selection3) {
75587         let more = selection3.selectAll(".community-more").data([0]);
75588         let moreEnter = more.enter().append("div").attr("class", "community-more");
75589         if (d2.resolved.extendedDescriptionHTML) {
75590           moreEnter.append("div").attr("class", "community-extended-description").html(d2.resolved.extendedDescriptionHTML);
75591         }
75592         if (d2.languageCodes && d2.languageCodes.length) {
75593           const languageList = d2.languageCodes.map((code) => _mainLocalizer.languageName(code)).join(", ");
75594           moreEnter.append("div").attr("class", "community-languages").call(_t.append("success.languages", { languages: languageList }));
75595         }
75596       }
75597       function showNextEvents(selection3) {
75598         let events = selection3.append("div").attr("class", "community-events");
75599         let item = events.selectAll(".community-event").data(nextEvents);
75600         let itemEnter = item.enter().append("div").attr("class", "community-event");
75601         itemEnter.append("div").attr("class", "community-event-name").append("a").attr("target", "_blank").attr("href", (d4) => d4.url).text((d4) => {
75602           let name = d4.name;
75603           if (d4.i18n && d4.id) {
75604             name = _t(`community.${communityID}.events.${d4.id}.name`, { default: name });
75605           }
75606           return name;
75607         });
75608         itemEnter.append("div").attr("class", "community-event-when").text((d4) => {
75609           let options2 = { weekday: "short", day: "numeric", month: "short", year: "numeric" };
75610           if (d4.date.getHours() || d4.date.getMinutes()) {
75611             options2.hour = "numeric";
75612             options2.minute = "numeric";
75613           }
75614           return d4.date.toLocaleString(_mainLocalizer.localeCode(), options2);
75615         });
75616         itemEnter.append("div").attr("class", "community-event-where").text((d4) => {
75617           let where = d4.where;
75618           if (d4.i18n && d4.id) {
75619             where = _t(`community.${communityID}.events.${d4.id}.where`, { default: where });
75620           }
75621           return where;
75622         });
75623         itemEnter.append("div").attr("class", "community-event-description").text((d4) => {
75624           let description = d4.description;
75625           if (d4.i18n && d4.id) {
75626             description = _t(`community.${communityID}.events.${d4.id}.description`, { default: description });
75627           }
75628           return description;
75629         });
75630       }
75631     }
75632     success.changeset = function(val) {
75633       if (!arguments.length) return _changeset2;
75634       _changeset2 = val;
75635       return success;
75636     };
75637     success.location = function(val) {
75638       if (!arguments.length) return _location;
75639       _location = val;
75640       return success;
75641     };
75642     return utilRebind(success, dispatch14, "on");
75643   }
75644   var _oci;
75645   var init_success = __esm({
75646     "modules/ui/success.js"() {
75647       "use strict";
75648       init_src4();
75649       init_src5();
75650       init_osm_community_index();
75651       init_id();
75652       init_file_fetcher();
75653       init_LocationManager();
75654       init_localizer();
75655       init_icon();
75656       init_disclosure();
75657       init_rebind();
75658       _oci = null;
75659     }
75660   });
75661
75662   // modules/ui/index.js
75663   var ui_exports = {};
75664   __export(ui_exports, {
75665     uiAccount: () => uiAccount,
75666     uiAttribution: () => uiAttribution,
75667     uiChangesetEditor: () => uiChangesetEditor,
75668     uiCmd: () => uiCmd,
75669     uiCombobox: () => uiCombobox,
75670     uiCommit: () => uiCommit,
75671     uiCommitWarnings: () => uiCommitWarnings,
75672     uiConfirm: () => uiConfirm,
75673     uiConflicts: () => uiConflicts,
75674     uiContributors: () => uiContributors,
75675     uiCurtain: () => uiCurtain,
75676     uiDataEditor: () => uiDataEditor,
75677     uiDataHeader: () => uiDataHeader,
75678     uiDisclosure: () => uiDisclosure,
75679     uiEditMenu: () => uiEditMenu,
75680     uiEntityEditor: () => uiEntityEditor,
75681     uiFeatureInfo: () => uiFeatureInfo,
75682     uiFeatureList: () => uiFeatureList,
75683     uiField: () => uiField,
75684     uiFieldHelp: () => uiFieldHelp,
75685     uiFlash: () => uiFlash,
75686     uiFormFields: () => uiFormFields,
75687     uiFullScreen: () => uiFullScreen,
75688     uiGeolocate: () => uiGeolocate,
75689     uiInfo: () => uiInfo,
75690     uiInit: () => uiInit,
75691     uiInspector: () => uiInspector,
75692     uiIssuesInfo: () => uiIssuesInfo,
75693     uiKeepRightDetails: () => uiKeepRightDetails,
75694     uiKeepRightEditor: () => uiKeepRightEditor,
75695     uiKeepRightHeader: () => uiKeepRightHeader,
75696     uiLasso: () => uiLasso,
75697     uiLengthIndicator: () => uiLengthIndicator,
75698     uiLoading: () => uiLoading,
75699     uiMapInMap: () => uiMapInMap,
75700     uiModal: () => uiModal,
75701     uiNoteComments: () => uiNoteComments,
75702     uiNoteEditor: () => uiNoteEditor,
75703     uiNoteHeader: () => uiNoteHeader,
75704     uiNoteReport: () => uiNoteReport,
75705     uiNotice: () => uiNotice,
75706     uiPopover: () => uiPopover,
75707     uiPresetIcon: () => uiPresetIcon,
75708     uiPresetList: () => uiPresetList,
75709     uiRestore: () => uiRestore,
75710     uiScale: () => uiScale,
75711     uiSidebar: () => uiSidebar,
75712     uiSourceSwitch: () => uiSourceSwitch,
75713     uiSpinner: () => uiSpinner,
75714     uiSplash: () => uiSplash,
75715     uiStatus: () => uiStatus,
75716     uiSuccess: () => uiSuccess,
75717     uiTagReference: () => uiTagReference,
75718     uiToggle: () => uiToggle,
75719     uiTooltip: () => uiTooltip,
75720     uiVersion: () => uiVersion,
75721     uiViewOnKeepRight: () => uiViewOnKeepRight,
75722     uiViewOnOSM: () => uiViewOnOSM,
75723     uiZoom: () => uiZoom
75724   });
75725   var init_ui = __esm({
75726     "modules/ui/index.js"() {
75727       "use strict";
75728       init_init2();
75729       init_account();
75730       init_attribution();
75731       init_changeset_editor();
75732       init_cmd();
75733       init_combobox();
75734       init_commit();
75735       init_commit_warnings();
75736       init_confirm();
75737       init_conflicts();
75738       init_contributors();
75739       init_curtain();
75740       init_data_editor();
75741       init_data_header();
75742       init_disclosure();
75743       init_edit_menu();
75744       init_entity_editor();
75745       init_feature_info();
75746       init_feature_list();
75747       init_field2();
75748       init_field_help();
75749       init_flash();
75750       init_form_fields();
75751       init_full_screen();
75752       init_geolocate2();
75753       init_info();
75754       init_inspector();
75755       init_issues_info();
75756       init_keepRight_details();
75757       init_keepRight_editor();
75758       init_keepRight_header();
75759       init_length_indicator();
75760       init_lasso();
75761       init_loading();
75762       init_map_in_map();
75763       init_modal();
75764       init_notice();
75765       init_note_comments();
75766       init_note_editor();
75767       init_note_header();
75768       init_note_report();
75769       init_popover();
75770       init_preset_icon();
75771       init_preset_list();
75772       init_restore();
75773       init_scale2();
75774       init_sidebar();
75775       init_source_switch();
75776       init_spinner();
75777       init_splash();
75778       init_status();
75779       init_success();
75780       init_tag_reference();
75781       init_toggle();
75782       init_tooltip();
75783       init_version();
75784       init_view_on_osm();
75785       init_view_on_keepRight();
75786       init_zoom3();
75787     }
75788   });
75789
75790   // modules/ui/fields/input.js
75791   var input_exports = {};
75792   __export(input_exports, {
75793     likelyRawNumberFormat: () => likelyRawNumberFormat,
75794     uiFieldColour: () => uiFieldText,
75795     uiFieldEmail: () => uiFieldText,
75796     uiFieldIdentifier: () => uiFieldText,
75797     uiFieldNumber: () => uiFieldText,
75798     uiFieldTel: () => uiFieldText,
75799     uiFieldText: () => uiFieldText,
75800     uiFieldUrl: () => uiFieldText
75801   });
75802   function uiFieldText(field, context) {
75803     var dispatch14 = dispatch_default("change");
75804     var input = select_default2(null);
75805     var outlinkButton = select_default2(null);
75806     var wrap2 = select_default2(null);
75807     var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue());
75808     var _entityIDs = [];
75809     var _tags;
75810     var _phoneFormats = {};
75811     const isDirectionField = field.key.split(":").some((keyPart) => keyPart === "direction");
75812     const formatFloat = _mainLocalizer.floatFormatter(_mainLocalizer.languageCode());
75813     const parseLocaleFloat = _mainLocalizer.floatParser(_mainLocalizer.languageCode());
75814     const countDecimalPlaces = _mainLocalizer.decimalPlaceCounter(_mainLocalizer.languageCode());
75815     if (field.type === "tel") {
75816       _mainFileFetcher.get("phone_formats").then(function(d2) {
75817         _phoneFormats = d2;
75818         updatePhonePlaceholder();
75819       }).catch(function() {
75820       });
75821     }
75822     function calcLocked() {
75823       var isLocked = (field.id === "brand" || field.id === "network" || field.id === "operator" || field.id === "flag") && _entityIDs.length && _entityIDs.some(function(entityID) {
75824         var entity = context.graph().hasEntity(entityID);
75825         if (!entity) return false;
75826         if (entity.tags.wikidata) return true;
75827         var preset = _mainPresetIndex.match(entity, context.graph());
75828         var isSuggestion = preset && preset.suggestion;
75829         var which = field.id;
75830         return isSuggestion && !!entity.tags[which] && !!entity.tags[which + ":wikidata"];
75831       });
75832       field.locked(isLocked);
75833     }
75834     function i3(selection2) {
75835       calcLocked();
75836       var isLocked = field.locked();
75837       wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
75838       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
75839       input = wrap2.selectAll("input").data([0]);
75840       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);
75841       input.classed("disabled", !!isLocked).attr("readonly", isLocked || null).on("input", change(true)).on("blur", change()).on("change", change());
75842       wrap2.call(_lengthIndicator);
75843       if (field.type === "tel") {
75844         updatePhonePlaceholder();
75845       } else if (field.type === "number") {
75846         var rtl = _mainLocalizer.textDirection() === "rtl";
75847         input.attr("type", "text");
75848         var inc = field.increment;
75849         var buttons = wrap2.selectAll(".increment, .decrement").data(rtl ? [inc, -inc] : [-inc, inc]);
75850         buttons.enter().append("button").attr("class", function(d2) {
75851           var which = d2 > 0 ? "increment" : "decrement";
75852           return "form-field-button " + which;
75853         }).attr("title", function(d2) {
75854           var which = d2 > 0 ? "increment" : "decrement";
75855           return _t(`inspector.${which}`);
75856         }).merge(buttons).on("click", function(d3_event, d2) {
75857           d3_event.preventDefault();
75858           var isMixed = Array.isArray(_tags[field.key]);
75859           if (isMixed) return;
75860           var raw_vals = input.node().value || "0";
75861           var vals = raw_vals.split(";");
75862           vals = vals.map(function(v2) {
75863             v2 = v2.trim();
75864             const isRawNumber = likelyRawNumberFormat.test(v2);
75865             var num = isRawNumber ? parseFloat(v2) : parseLocaleFloat(v2);
75866             if (isDirectionField) {
75867               const compassDir = cardinal[v2.toLowerCase()];
75868               if (compassDir !== void 0) {
75869                 num = compassDir;
75870               }
75871             }
75872             if (!isFinite(num)) return v2;
75873             num = parseFloat(num);
75874             if (!isFinite(num)) return v2;
75875             num += d2;
75876             if (isDirectionField) {
75877               num = (num % 360 + 360) % 360;
75878             }
75879             return formatFloat(clamped(num), isRawNumber ? v2.includes(".") ? v2.split(".")[1].length : 0 : countDecimalPlaces(v2));
75880           });
75881           input.node().value = vals.join(";");
75882           change()();
75883         });
75884       } else if (field.type === "identifier" && field.urlFormat && field.pattern) {
75885         input.attr("type", "text");
75886         outlinkButton = wrap2.selectAll(".foreign-id-permalink").data([0]);
75887         outlinkButton = outlinkButton.enter().append("button").call(svgIcon("#iD-icon-out-link")).attr("class", "form-field-button foreign-id-permalink").attr("title", function() {
75888           var domainResults = /^https?:\/\/(.{1,}?)\//.exec(field.urlFormat);
75889           if (domainResults.length >= 2 && domainResults[1]) {
75890             var domain = domainResults[1];
75891             return _t("icons.view_on", { domain });
75892           }
75893           return "";
75894         }).merge(outlinkButton);
75895         outlinkButton.on("click", function(d3_event) {
75896           d3_event.preventDefault();
75897           var value = validIdentifierValueForLink();
75898           if (value) {
75899             var url = field.urlFormat.replace(/{value}/, encodeURIComponent(value));
75900             window.open(url, "_blank");
75901           }
75902         }).classed("disabled", () => !validIdentifierValueForLink()).merge(outlinkButton);
75903       } else if (field.type === "url") {
75904         input.attr("type", "text");
75905         outlinkButton = wrap2.selectAll(".foreign-id-permalink").data([0]);
75906         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) {
75907           d3_event.preventDefault();
75908           const value = validIdentifierValueForLink();
75909           if (value) window.open(value, "_blank");
75910         }).merge(outlinkButton);
75911       } else if (field.type === "colour") {
75912         input.attr("type", "text");
75913         updateColourPreview();
75914       } else if (field.type === "date") {
75915         input.attr("type", "text");
75916         updateDateField();
75917       }
75918     }
75919     function updateColourPreview() {
75920       wrap2.selectAll(".colour-preview").remove();
75921       const colour = utilGetSetValue(input);
75922       if (!isColourValid(colour) && colour !== "") {
75923         wrap2.selectAll("input.colour-selector").remove();
75924         wrap2.selectAll(".form-field-button").remove();
75925         return;
75926       }
75927       var colourSelector = wrap2.selectAll(".colour-selector").data([0]);
75928       colourSelector.enter().append("input").attr("type", "color").attr("class", "colour-selector").on("input", debounce_default(function(d3_event) {
75929         d3_event.preventDefault();
75930         var colour2 = this.value;
75931         if (!isColourValid(colour2)) return;
75932         utilGetSetValue(input, this.value);
75933         change()();
75934         updateColourPreview();
75935       }, 100));
75936       wrap2.selectAll("input.colour-selector").attr("value", colour);
75937       var chooserButton = wrap2.selectAll(".colour-preview").data([colour]);
75938       chooserButton = chooserButton.enter().append("div").attr("class", "form-field-button colour-preview").append("div").style("background-color", (d2) => d2).attr("class", "colour-box");
75939       if (colour === "") {
75940         chooserButton = chooserButton.call(svgIcon("#iD-icon-edit"));
75941       }
75942       chooserButton.on("click", () => wrap2.select(".colour-selector").node().showPicker());
75943     }
75944     function updateDateField() {
75945       function isDateValid(date2) {
75946         return date2.match(/^[0-9]{4}(-[0-9]{2}(-[0-9]{2})?)?$/);
75947       }
75948       const date = utilGetSetValue(input);
75949       const now3 = /* @__PURE__ */ new Date();
75950       const today = new Date(now3.getTime() - now3.getTimezoneOffset() * 6e4).toISOString().split("T")[0];
75951       if ((field.key === "check_date" || field.key === "survey:date") && date !== today) {
75952         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", () => {
75953           utilGetSetValue(input, today);
75954           change()();
75955           updateDateField();
75956         });
75957       } else {
75958         wrap2.selectAll(".date-set-today").remove();
75959       }
75960       if (!isDateValid(date) && date !== "") {
75961         wrap2.selectAll("input.date-selector").remove();
75962         wrap2.selectAll(".date-calendar").remove();
75963         return;
75964       }
75965       if (utilDetect().browser !== "Safari") {
75966         var dateSelector = wrap2.selectAll(".date-selector").data([0]);
75967         dateSelector.enter().append("input").attr("type", "date").attr("class", "date-selector").on("input", debounce_default(function(d3_event) {
75968           d3_event.preventDefault();
75969           var date2 = this.value;
75970           if (!isDateValid(date2)) return;
75971           utilGetSetValue(input, this.value);
75972           change()();
75973           updateDateField();
75974         }, 100));
75975         wrap2.selectAll("input.date-selector").attr("value", date);
75976         var calendarButton = wrap2.selectAll(".date-calendar").data([date]);
75977         calendarButton = calendarButton.enter().append("button").attr("class", "form-field-button date-calendar").call(svgIcon("#fas-calendar-days"));
75978         calendarButton.on("click", () => wrap2.select(".date-selector").node().showPicker());
75979       }
75980     }
75981     function updatePhonePlaceholder() {
75982       if (input.empty() || !Object.keys(_phoneFormats).length) return;
75983       var extent = combinedEntityExtent();
75984       var countryCode = extent && iso1A2Code(extent.center());
75985       var format2 = countryCode && _phoneFormats[countryCode.toLowerCase()];
75986       if (format2) input.attr("placeholder", format2);
75987     }
75988     function validIdentifierValueForLink() {
75989       var _a3;
75990       const value = utilGetSetValue(input).trim();
75991       if (field.type === "url" && value) {
75992         try {
75993           return new URL(value).href;
75994         } catch {
75995           return null;
75996         }
75997       }
75998       if (field.type === "identifier" && field.pattern) {
75999         return value && ((_a3 = value.match(new RegExp(field.pattern))) == null ? void 0 : _a3[0]);
76000       }
76001       return null;
76002     }
76003     function clamped(num) {
76004       if (field.minValue !== void 0) {
76005         num = Math.max(num, field.minValue);
76006       }
76007       if (field.maxValue !== void 0) {
76008         num = Math.min(num, field.maxValue);
76009       }
76010       return num;
76011     }
76012     function getVals(tags) {
76013       if (field.keys) {
76014         const multiSelection = context.selectedIDs();
76015         tags = multiSelection.length > 1 ? context.selectedIDs().map((id2) => context.graph().entity(id2)).map((entity) => entity.tags) : [tags];
76016         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((a2, b2) => /* @__PURE__ */ new Set([...a2, ...b2]));
76017       } else {
76018         return new Set([].concat(tags[field.key]));
76019       }
76020     }
76021     function change(onInput) {
76022       return function() {
76023         var t2 = {};
76024         var val = utilGetSetValue(input);
76025         if (!onInput) val = context.cleanTagValue(val);
76026         if (!val && getVals(_tags).size > 1) return;
76027         var displayVal = val;
76028         if (field.type === "number" && val) {
76029           var numbers2 = val.split(";");
76030           numbers2 = numbers2.map(function(v2) {
76031             if (likelyRawNumberFormat.test(v2)) {
76032               return v2;
76033             }
76034             var num = parseLocaleFloat(v2);
76035             const fractionDigits = countDecimalPlaces(v2);
76036             return isFinite(num) ? clamped(num).toFixed(fractionDigits) : v2;
76037           });
76038           val = numbers2.join(";");
76039         }
76040         if (!onInput) utilGetSetValue(input, displayVal);
76041         t2[field.key] = val || void 0;
76042         if (field.keys) {
76043           dispatch14.call("change", this, (tags) => {
76044             if (field.keys.some((key) => tags[key])) {
76045               field.keys.filter((key) => tags[key]).forEach((key) => {
76046                 tags[key] = val || void 0;
76047               });
76048             } else {
76049               tags[field.key] = val || void 0;
76050             }
76051             return tags;
76052           }, onInput);
76053         } else {
76054           dispatch14.call("change", this, t2, onInput);
76055         }
76056       };
76057     }
76058     i3.entityIDs = function(val) {
76059       if (!arguments.length) return _entityIDs;
76060       _entityIDs = val;
76061       return i3;
76062     };
76063     i3.tags = function(tags) {
76064       var _a3;
76065       _tags = tags;
76066       const vals = getVals(tags);
76067       const isMixed = vals.size > 1;
76068       var val = vals.size === 1 ? (_a3 = [...vals][0]) != null ? _a3 : "" : "";
76069       var shouldUpdate;
76070       if (field.type === "number" && val) {
76071         var numbers2 = val.split(";");
76072         var oriNumbers = utilGetSetValue(input).split(";");
76073         if (numbers2.length !== oriNumbers.length) shouldUpdate = true;
76074         numbers2 = numbers2.map(function(v2) {
76075           v2 = v2.trim();
76076           var num = Number(v2);
76077           if (!isFinite(num) || v2 === "") return v2;
76078           const fractionDigits = v2.includes(".") ? v2.split(".")[1].length : 0;
76079           return formatFloat(num, fractionDigits);
76080         });
76081         val = numbers2.join(";");
76082         shouldUpdate = (inputValue, setValue) => {
76083           const inputNums = inputValue.split(";").map(
76084             (setVal) => likelyRawNumberFormat.test(setVal) ? parseFloat(setVal) : parseLocaleFloat(setVal)
76085           );
76086           const setNums = setValue.split(";").map(parseLocaleFloat);
76087           return !isEqual_default(inputNums, setNums);
76088         };
76089       }
76090       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);
76091       if (field.type === "number") {
76092         const buttons = wrap2.selectAll(".increment, .decrement");
76093         if (isMixed) {
76094           buttons.attr("disabled", "disabled").classed("disabled", true);
76095         } else {
76096           var raw_vals = tags[field.key] || "0";
76097           const canIncDec = raw_vals.split(";").some(
76098             (val2) => isFinite(Number(val2)) || isDirectionField && val2.trim().toLowerCase() in cardinal
76099           );
76100           buttons.attr("disabled", canIncDec ? null : "disabled").classed("disabled", !canIncDec);
76101         }
76102       }
76103       if (field.type === "tel") updatePhonePlaceholder();
76104       if (field.type === "colour") updateColourPreview();
76105       if (field.type === "date") updateDateField();
76106       if (outlinkButton && !outlinkButton.empty()) {
76107         var disabled = !validIdentifierValueForLink();
76108         outlinkButton.classed("disabled", disabled);
76109       }
76110       if (!isMixed) {
76111         _lengthIndicator.update(tags[field.key]);
76112       }
76113     };
76114     i3.focus = function() {
76115       var node = input.node();
76116       if (node) node.focus();
76117     };
76118     function combinedEntityExtent() {
76119       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
76120     }
76121     return utilRebind(i3, dispatch14, "on");
76122   }
76123   var likelyRawNumberFormat;
76124   var init_input = __esm({
76125     "modules/ui/fields/input.js"() {
76126       "use strict";
76127       init_src4();
76128       init_src5();
76129       init_debounce();
76130       init_country_coder();
76131       init_presets();
76132       init_file_fetcher();
76133       init_localizer();
76134       init_util();
76135       init_icon();
76136       init_node2();
76137       init_tags();
76138       init_ui();
76139       init_tooltip();
76140       init_lodash();
76141       likelyRawNumberFormat = /^-?(0\.\d*|\d*\.\d{0,2}(\d{4,})?|\d{4,}\.\d{3})$/;
76142     }
76143   });
76144
76145   // modules/ui/fields/access.js
76146   var access_exports = {};
76147   __export(access_exports, {
76148     uiFieldAccess: () => uiFieldAccess
76149   });
76150   function uiFieldAccess(field, context) {
76151     var dispatch14 = dispatch_default("change");
76152     var items = select_default2(null);
76153     var _tags;
76154     function access(selection2) {
76155       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
76156       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
76157       var list2 = wrap2.selectAll("ul").data([0]);
76158       list2 = list2.enter().append("ul").attr("class", "rows").merge(list2);
76159       items = list2.selectAll("li").data(field.keys);
76160       var enter = items.enter().append("li").attr("class", function(d2) {
76161         return "labeled-input preset-access-" + d2;
76162       });
76163       enter.append("div").attr("class", "label preset-label-access").attr("for", function(d2) {
76164         return "preset-input-access-" + d2;
76165       }).html(function(d2) {
76166         return field.t.html("types." + d2);
76167       });
76168       enter.append("div").attr("class", "preset-input-access-wrap").append("input").attr("type", "text").attr("class", function(d2) {
76169         return "preset-input-access preset-input-access-" + d2;
76170       }).call(utilNoAuto).each(function(d2) {
76171         select_default2(this).call(
76172           uiCombobox(context, "access-" + d2).data(access.options(d2))
76173         );
76174       });
76175       items = items.merge(enter);
76176       wrap2.selectAll(".preset-input-access").on("change", change).on("blur", change);
76177     }
76178     function change(d3_event, d2) {
76179       var tag2 = {};
76180       var value = context.cleanTagValue(utilGetSetValue(select_default2(this)));
76181       if (!value && typeof _tags[d2] !== "string") return;
76182       tag2[d2] = value || void 0;
76183       dispatch14.call("change", this, tag2);
76184     }
76185     access.options = function(type2) {
76186       var options2 = [
76187         "yes",
76188         "no",
76189         "designated",
76190         "permissive",
76191         "destination",
76192         "customers",
76193         "private",
76194         "permit",
76195         "unknown"
76196       ];
76197       if (type2 === "access") {
76198         options2 = options2.filter((v2) => v2 !== "yes" && v2 !== "designated");
76199       }
76200       if (type2 === "bicycle") {
76201         options2.splice(options2.length - 4, 0, "dismount");
76202       }
76203       var stringsField = field.resolveReference("stringsCrossReference");
76204       return options2.map(function(option) {
76205         return {
76206           title: stringsField.t("options." + option + ".description"),
76207           value: option
76208         };
76209       });
76210     };
76211     const placeholdersByTag = {
76212       highway: {
76213         footway: {
76214           foot: "designated",
76215           motor_vehicle: "no"
76216         },
76217         steps: {
76218           foot: "yes",
76219           motor_vehicle: "no",
76220           bicycle: "no",
76221           horse: "no"
76222         },
76223         ladder: {
76224           foot: "yes",
76225           motor_vehicle: "no",
76226           bicycle: "no",
76227           horse: "no"
76228         },
76229         pedestrian: {
76230           foot: "yes",
76231           motor_vehicle: "no"
76232         },
76233         cycleway: {
76234           motor_vehicle: "no",
76235           bicycle: "designated"
76236         },
76237         bridleway: {
76238           motor_vehicle: "no",
76239           horse: "designated"
76240         },
76241         path: {
76242           foot: "yes",
76243           motor_vehicle: "no",
76244           bicycle: "yes",
76245           horse: "yes"
76246         },
76247         motorway: {
76248           foot: "no",
76249           motor_vehicle: "yes",
76250           bicycle: "no",
76251           horse: "no"
76252         },
76253         trunk: {
76254           motor_vehicle: "yes"
76255         },
76256         primary: {
76257           foot: "yes",
76258           motor_vehicle: "yes",
76259           bicycle: "yes",
76260           horse: "yes"
76261         },
76262         secondary: {
76263           foot: "yes",
76264           motor_vehicle: "yes",
76265           bicycle: "yes",
76266           horse: "yes"
76267         },
76268         tertiary: {
76269           foot: "yes",
76270           motor_vehicle: "yes",
76271           bicycle: "yes",
76272           horse: "yes"
76273         },
76274         residential: {
76275           foot: "yes",
76276           motor_vehicle: "yes",
76277           bicycle: "yes",
76278           horse: "yes"
76279         },
76280         unclassified: {
76281           foot: "yes",
76282           motor_vehicle: "yes",
76283           bicycle: "yes",
76284           horse: "yes"
76285         },
76286         service: {
76287           foot: "yes",
76288           motor_vehicle: "yes",
76289           bicycle: "yes",
76290           horse: "yes"
76291         },
76292         motorway_link: {
76293           foot: "no",
76294           motor_vehicle: "yes",
76295           bicycle: "no",
76296           horse: "no"
76297         },
76298         trunk_link: {
76299           motor_vehicle: "yes"
76300         },
76301         primary_link: {
76302           foot: "yes",
76303           motor_vehicle: "yes",
76304           bicycle: "yes",
76305           horse: "yes"
76306         },
76307         secondary_link: {
76308           foot: "yes",
76309           motor_vehicle: "yes",
76310           bicycle: "yes",
76311           horse: "yes"
76312         },
76313         tertiary_link: {
76314           foot: "yes",
76315           motor_vehicle: "yes",
76316           bicycle: "yes",
76317           horse: "yes"
76318         },
76319         construction: {
76320           access: "no"
76321         },
76322         busway: {
76323           access: "no",
76324           bus: "designated",
76325           emergency: "yes"
76326         }
76327       },
76328       barrier: {
76329         bollard: {
76330           access: "no",
76331           bicycle: "yes",
76332           foot: "yes"
76333         },
76334         bus_trap: {
76335           motor_vehicle: "no",
76336           psv: "yes",
76337           foot: "yes",
76338           bicycle: "yes"
76339         },
76340         city_wall: {
76341           access: "no"
76342         },
76343         coupure: {
76344           access: "yes"
76345         },
76346         cycle_barrier: {
76347           motor_vehicle: "no"
76348         },
76349         ditch: {
76350           access: "no"
76351         },
76352         entrance: {
76353           access: "yes"
76354         },
76355         fence: {
76356           access: "no"
76357         },
76358         hedge: {
76359           access: "no"
76360         },
76361         jersey_barrier: {
76362           access: "no"
76363         },
76364         motorcycle_barrier: {
76365           motor_vehicle: "no"
76366         },
76367         rail_guard: {
76368           access: "no"
76369         }
76370       }
76371     };
76372     access.tags = function(tags) {
76373       _tags = tags;
76374       utilGetSetValue(items.selectAll(".preset-input-access"), function(d2) {
76375         return typeof tags[d2] === "string" ? tags[d2] : "";
76376       }).classed("mixed", function(accessField) {
76377         return tags[accessField] && Array.isArray(tags[accessField]) || new Set(getAllPlaceholders(tags, accessField)).size > 1;
76378       }).attr("title", function(accessField) {
76379         return tags[accessField] && Array.isArray(tags[accessField]) && tags[accessField].filter(Boolean).join("\n");
76380       }).attr("placeholder", function(accessField) {
76381         let placeholders = getAllPlaceholders(tags, accessField);
76382         if (new Set(placeholders).size === 1) {
76383           return placeholders[0];
76384         } else {
76385           return _t("inspector.multiple_values");
76386         }
76387       });
76388       function getAllPlaceholders(tags2, accessField) {
76389         let allTags = tags2[Symbol.for("allTags")];
76390         if (allTags && allTags.length > 1) {
76391           const placeholders = [];
76392           allTags.forEach((tags3) => {
76393             placeholders.push(getPlaceholder(tags3, accessField));
76394           });
76395           return placeholders;
76396         } else {
76397           return [getPlaceholder(tags2, accessField)];
76398         }
76399       }
76400       function getPlaceholder(tags2, accessField) {
76401         if (tags2[accessField]) {
76402           return tags2[accessField];
76403         }
76404         if (tags2.motorroad === "yes" && (accessField === "foot" || accessField === "bicycle" || accessField === "horse")) {
76405           return "no";
76406         }
76407         if (tags2.vehicle && (accessField === "bicycle" || accessField === "motor_vehicle")) {
76408           return tags2.vehicle;
76409         }
76410         if (tags2.access) {
76411           return tags2.access;
76412         }
76413         for (const key in placeholdersByTag) {
76414           if (tags2[key]) {
76415             if (placeholdersByTag[key][tags2[key]] && placeholdersByTag[key][tags2[key]][accessField]) {
76416               return placeholdersByTag[key][tags2[key]][accessField];
76417             }
76418           }
76419         }
76420         if (accessField === "access" && !tags2.barrier) {
76421           return "yes";
76422         }
76423         return field.placeholder();
76424       }
76425     };
76426     access.focus = function() {
76427       items.selectAll(".preset-input-access").node().focus();
76428     };
76429     return utilRebind(access, dispatch14, "on");
76430   }
76431   var init_access = __esm({
76432     "modules/ui/fields/access.js"() {
76433       "use strict";
76434       init_src4();
76435       init_src5();
76436       init_combobox();
76437       init_util();
76438       init_localizer();
76439     }
76440   });
76441
76442   // modules/ui/fields/address.js
76443   var address_exports = {};
76444   __export(address_exports, {
76445     uiFieldAddress: () => uiFieldAddress
76446   });
76447   function uiFieldAddress(field, context) {
76448     var dispatch14 = dispatch_default("change");
76449     var _selection = select_default2(null);
76450     var _wrap = select_default2(null);
76451     var addrField = _mainPresetIndex.field("address");
76452     var _entityIDs = [];
76453     var _tags;
76454     var _countryCode;
76455     var _addressFormats = [{
76456       format: [
76457         ["housenumber", "street"],
76458         ["city", "postcode"]
76459       ]
76460     }];
76461     _mainFileFetcher.get("address_formats").then(function(d2) {
76462       _addressFormats = d2;
76463       if (!_selection.empty()) {
76464         _selection.call(address);
76465       }
76466     }).catch(function() {
76467     });
76468     function getNear(isAddressable, type2, searchRadius, resultProp) {
76469       var extent = combinedEntityExtent();
76470       var l2 = extent.center();
76471       var box = geoExtent(l2).padByMeters(searchRadius);
76472       var features = context.history().intersects(box).filter(isAddressable).map((d2) => {
76473         let dist = geoSphericalDistance(d2.extent(context.graph()).center(), l2);
76474         if (d2.geometry(context.graph()) === "line") {
76475           var loc = context.projection([
76476             (extent[0][0] + extent[1][0]) / 2,
76477             (extent[0][1] + extent[1][1]) / 2
76478           ]);
76479           var choice = geoChooseEdge(context.graph().childNodes(d2), loc, context.projection);
76480           dist = geoSphericalDistance(choice.loc, l2);
76481         }
76482         const value = resultProp && d2.tags[resultProp] ? d2.tags[resultProp] : d2.tags.name;
76483         let title = value;
76484         if (type2 === "street") {
76485           title = `${addrField.t("placeholders.street")}: ${title}`;
76486         } else if (type2 === "place") {
76487           title = `${addrField.t("placeholders.place")}: ${title}`;
76488         }
76489         return {
76490           title,
76491           value,
76492           dist,
76493           type: type2,
76494           klass: `address-${type2}`
76495         };
76496       }).sort(function(a2, b2) {
76497         return a2.dist - b2.dist;
76498       });
76499       return utilArrayUniqBy(features, "value");
76500     }
76501     function getNearStreets() {
76502       function isAddressable(d2) {
76503         return d2.tags.highway && d2.tags.name && d2.type === "way";
76504       }
76505       return getNear(isAddressable, "street", 200);
76506     }
76507     function getNearPlaces() {
76508       function isAddressable(d2) {
76509         if (d2.tags.name) {
76510           if (d2.tags.place) return true;
76511           if (d2.tags.boundary === "administrative" && d2.tags.admin_level > 8) return true;
76512         }
76513         return false;
76514       }
76515       return getNear(isAddressable, "place", 200);
76516     }
76517     function getNearCities() {
76518       function isAddressable(d2) {
76519         if (d2.tags.name) {
76520           if (d2.tags.boundary === "administrative" && d2.tags.admin_level === "8") return true;
76521           if (d2.tags.border_type === "city") return true;
76522           if (d2.tags.place === "city" || d2.tags.place === "town" || d2.tags.place === "village") return true;
76523         }
76524         if (d2.tags[`${field.key}:city`]) return true;
76525         return false;
76526       }
76527       return getNear(isAddressable, "city", 200, `${field.key}:city`);
76528     }
76529     function getNearPostcodes() {
76530       const postcodes = [].concat(getNearValues("postcode")).concat(getNear((d2) => d2.tags.postal_code, "postcode", 200, "postal_code"));
76531       return utilArrayUniqBy(postcodes, (item) => item.value);
76532     }
76533     function getNearValues(key) {
76534       const tagKey = `${field.key}:${key}`;
76535       function hasTag(d2) {
76536         return _entityIDs.indexOf(d2.id) === -1 && d2.tags[tagKey];
76537       }
76538       return getNear(hasTag, key, 200, tagKey);
76539     }
76540     function updateForCountryCode() {
76541       if (!_countryCode) return;
76542       var addressFormat;
76543       for (var i3 = 0; i3 < _addressFormats.length; i3++) {
76544         var format2 = _addressFormats[i3];
76545         if (!format2.countryCodes) {
76546           addressFormat = format2;
76547         } else if (format2.countryCodes.indexOf(_countryCode) !== -1) {
76548           addressFormat = format2;
76549           break;
76550         }
76551       }
76552       var dropdowns = addressFormat.dropdowns || [
76553         "city",
76554         "county",
76555         "country",
76556         "district",
76557         "hamlet",
76558         "neighbourhood",
76559         "place",
76560         "postcode",
76561         "province",
76562         "quarter",
76563         "state",
76564         "street",
76565         "street+place",
76566         "subdistrict",
76567         "suburb"
76568       ];
76569       var widths = addressFormat.widths || {
76570         housenumber: 1 / 5,
76571         unit: 1 / 5,
76572         street: 1 / 2,
76573         place: 1 / 2,
76574         city: 2 / 3,
76575         state: 1 / 4,
76576         postcode: 1 / 3
76577       };
76578       function row(r2) {
76579         var total = r2.reduce(function(sum, key) {
76580           return sum + (widths[key] || 0.5);
76581         }, 0);
76582         return r2.map(function(key) {
76583           return {
76584             id: key,
76585             width: (widths[key] || 0.5) / total
76586           };
76587         });
76588       }
76589       var rows = _wrap.selectAll(".addr-row").data(addressFormat.format, function(d2) {
76590         return d2.toString();
76591       });
76592       rows.exit().remove();
76593       rows.enter().append("div").attr("class", "addr-row").selectAll("input").data(row).enter().append("input").property("type", "text").attr("class", function(d2) {
76594         return "addr-" + d2.id;
76595       }).call(utilNoAuto).each(addDropdown).call(updatePlaceholder).style("width", function(d2) {
76596         return d2.width * 100 + "%";
76597       });
76598       function addDropdown(d2) {
76599         if (dropdowns.indexOf(d2.id) === -1) return;
76600         var nearValues;
76601         switch (d2.id) {
76602           case "street":
76603             nearValues = getNearStreets;
76604             break;
76605           case "place":
76606             nearValues = getNearPlaces;
76607             break;
76608           case "street+place":
76609             nearValues = () => [].concat(getNearStreets()).concat(getNearPlaces());
76610             d2.isAutoStreetPlace = true;
76611             d2.id = _tags[`${field.key}:place`] ? "place" : "street";
76612             break;
76613           case "city":
76614             nearValues = getNearCities;
76615             break;
76616           case "postcode":
76617             nearValues = getNearPostcodes;
76618             break;
76619           default:
76620             nearValues = getNearValues;
76621         }
76622         select_default2(this).call(
76623           uiCombobox(context, `address-${d2.isAutoStreetPlace ? "street-place" : d2.id}`).minItems(1).caseSensitive(true).fetcher(function(typedValue, callback) {
76624             typedValue = typedValue.toLowerCase();
76625             callback(nearValues(d2.id).filter((v2) => v2.value.toLowerCase().indexOf(typedValue) !== -1));
76626           }).on("accept", function(selected) {
76627             if (d2.isAutoStreetPlace) {
76628               d2.id = selected ? selected.type : "street";
76629               utilTriggerEvent(select_default2(this), "change");
76630             }
76631           })
76632         );
76633       }
76634       _wrap.selectAll("input").on("blur", change()).on("change", change());
76635       _wrap.selectAll("input:not(.combobox-input)").on("input", change(true));
76636       if (_tags) updateTags(_tags);
76637     }
76638     function address(selection2) {
76639       _selection = selection2;
76640       _wrap = selection2.selectAll(".form-field-input-wrap").data([0]);
76641       _wrap = _wrap.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(_wrap);
76642       var extent = combinedEntityExtent();
76643       if (extent) {
76644         var countryCode;
76645         if (context.inIntro()) {
76646           countryCode = _t("intro.graph.countrycode");
76647         } else {
76648           var center = extent.center();
76649           countryCode = iso1A2Code(center);
76650         }
76651         if (countryCode) {
76652           _countryCode = countryCode.toLowerCase();
76653           updateForCountryCode();
76654         }
76655       }
76656     }
76657     function change(onInput) {
76658       return function() {
76659         var tags = {};
76660         _wrap.selectAll("input").each(function(subfield) {
76661           var key = field.key + ":" + subfield.id;
76662           var value = this.value;
76663           if (!onInput) value = context.cleanTagValue(value);
76664           if (Array.isArray(_tags[key]) && !value) return;
76665           if (subfield.isAutoStreetPlace) {
76666             if (subfield.id === "street") {
76667               tags[`${field.key}:place`] = void 0;
76668             } else if (subfield.id === "place") {
76669               tags[`${field.key}:street`] = void 0;
76670             }
76671           }
76672           tags[key] = value || void 0;
76673         });
76674         Object.keys(tags).filter((k2) => tags[k2]).forEach((k2) => _tags[k2] = tags[k2]);
76675         dispatch14.call("change", this, tags, onInput);
76676       };
76677     }
76678     function updatePlaceholder(inputSelection) {
76679       return inputSelection.attr("placeholder", function(subfield) {
76680         if (_tags && Array.isArray(_tags[field.key + ":" + subfield.id])) {
76681           return _t("inspector.multiple_values");
76682         }
76683         if (subfield.isAutoStreetPlace) {
76684           return `${getLocalPlaceholder("street")} / ${getLocalPlaceholder("place")}`;
76685         }
76686         return getLocalPlaceholder(subfield.id);
76687       });
76688     }
76689     function getLocalPlaceholder(key) {
76690       if (_countryCode) {
76691         var localkey = key + "!" + _countryCode;
76692         var tkey = addrField.hasTextForStringId("placeholders." + localkey) ? localkey : key;
76693         return addrField.t("placeholders." + tkey);
76694       }
76695     }
76696     function updateTags(tags) {
76697       utilGetSetValue(_wrap.selectAll("input"), (subfield) => {
76698         var val;
76699         if (subfield.isAutoStreetPlace) {
76700           const streetKey = `${field.key}:street`;
76701           const placeKey = `${field.key}:place`;
76702           if (tags[streetKey] !== void 0 || tags[placeKey] === void 0) {
76703             val = tags[streetKey];
76704             subfield.id = "street";
76705           } else {
76706             val = tags[placeKey];
76707             subfield.id = "place";
76708           }
76709         } else {
76710           val = tags[`${field.key}:${subfield.id}`];
76711         }
76712         return typeof val === "string" ? val : "";
76713       }).attr("title", function(subfield) {
76714         var val = tags[field.key + ":" + subfield.id];
76715         return val && Array.isArray(val) ? val.filter(Boolean).join("\n") : void 0;
76716       }).classed("mixed", function(subfield) {
76717         return Array.isArray(tags[field.key + ":" + subfield.id]);
76718       }).call(updatePlaceholder);
76719     }
76720     function combinedEntityExtent() {
76721       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
76722     }
76723     address.entityIDs = function(val) {
76724       if (!arguments.length) return _entityIDs;
76725       _entityIDs = val;
76726       return address;
76727     };
76728     address.tags = function(tags) {
76729       _tags = tags;
76730       updateTags(tags);
76731     };
76732     address.focus = function() {
76733       var node = _wrap.selectAll("input").node();
76734       if (node) node.focus();
76735     };
76736     return utilRebind(address, dispatch14, "on");
76737   }
76738   var init_address = __esm({
76739     "modules/ui/fields/address.js"() {
76740       "use strict";
76741       init_src4();
76742       init_src5();
76743       init_country_coder();
76744       init_presets();
76745       init_file_fetcher();
76746       init_geo2();
76747       init_combobox();
76748       init_util();
76749       init_localizer();
76750     }
76751   });
76752
76753   // modules/ui/fields/directional_combo.js
76754   var directional_combo_exports = {};
76755   __export(directional_combo_exports, {
76756     uiFieldDirectionalCombo: () => uiFieldDirectionalCombo
76757   });
76758   function uiFieldDirectionalCombo(field, context) {
76759     var dispatch14 = dispatch_default("change");
76760     var items = select_default2(null);
76761     var wrap2 = select_default2(null);
76762     var _tags;
76763     var _combos = {};
76764     if (field.type === "cycleway") {
76765       field = {
76766         ...field,
76767         key: field.keys[0],
76768         keys: field.keys.slice(1)
76769       };
76770     }
76771     function directionalCombo(selection2) {
76772       function stripcolon(s2) {
76773         return s2.replace(":", "");
76774       }
76775       wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
76776       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
76777       var div = wrap2.selectAll("ul").data([0]);
76778       div = div.enter().append("ul").attr("class", "rows rows-table").merge(div);
76779       items = div.selectAll("li").data(field.keys);
76780       var enter = items.enter().append("li").attr("class", function(d2) {
76781         return "labeled-input preset-directionalcombo-" + stripcolon(d2);
76782       });
76783       enter.append("div").attr("class", "label preset-label-directionalcombo").attr("for", function(d2) {
76784         return "preset-input-directionalcombo-" + stripcolon(d2);
76785       }).html(function(d2) {
76786         return field.t.html("types." + d2);
76787       });
76788       enter.append("div").attr("class", "preset-input-directionalcombo-wrap form-field-input-wrap").each(function(key) {
76789         const subField = {
76790           ...field,
76791           type: "combo",
76792           key
76793         };
76794         const combo = uiFieldCombo(subField, context);
76795         combo.on("change", (t2) => change(key, t2[key]));
76796         _combos[key] = combo;
76797         select_default2(this).call(combo);
76798       });
76799       items = items.merge(enter);
76800       wrap2.selectAll(".preset-input-directionalcombo").on("change", change).on("blur", change);
76801     }
76802     function change(key, newValue) {
76803       const commonKey = field.key;
76804       const otherCommonKey = field.key.endsWith(":both") ? field.key.replace(/:both$/, "") : `${field.key}:both`;
76805       const otherKey = key === field.keys[0] ? field.keys[1] : field.keys[0];
76806       dispatch14.call("change", this, (tags) => {
76807         const otherValue = tags[otherKey] || tags[commonKey] || tags[otherCommonKey];
76808         if (newValue === otherValue) {
76809           tags[commonKey] = newValue;
76810           delete tags[key];
76811           delete tags[otherKey];
76812           delete tags[otherCommonKey];
76813         } else {
76814           tags[key] = newValue;
76815           delete tags[commonKey];
76816           delete tags[otherCommonKey];
76817           tags[otherKey] = otherValue;
76818         }
76819         return tags;
76820       });
76821     }
76822     directionalCombo.tags = function(tags) {
76823       _tags = tags;
76824       const commonKey = field.key.replace(/:both$/, "");
76825       for (let key in _combos) {
76826         const uniqueValues = [...new Set([].concat(_tags[commonKey]).concat(_tags[`${commonKey}:both`]).concat(_tags[key]).filter(Boolean))];
76827         _combos[key].tags({ [key]: uniqueValues.length > 1 ? uniqueValues : uniqueValues[0] });
76828       }
76829     };
76830     directionalCombo.focus = function() {
76831       var node = wrap2.selectAll("input").node();
76832       if (node) node.focus();
76833     };
76834     return utilRebind(directionalCombo, dispatch14, "on");
76835   }
76836   var init_directional_combo = __esm({
76837     "modules/ui/fields/directional_combo.js"() {
76838       "use strict";
76839       init_src4();
76840       init_src5();
76841       init_util();
76842       init_combo();
76843     }
76844   });
76845
76846   // modules/ui/fields/lanes.js
76847   var lanes_exports2 = {};
76848   __export(lanes_exports2, {
76849     uiFieldLanes: () => uiFieldLanes
76850   });
76851   function uiFieldLanes(field, context) {
76852     var dispatch14 = dispatch_default("change");
76853     var LANE_WIDTH = 40;
76854     var LANE_HEIGHT = 200;
76855     var _entityIDs = [];
76856     function lanes(selection2) {
76857       var lanesData = context.entity(_entityIDs[0]).lanes();
76858       if (!context.container().select(".inspector-wrap.inspector-hidden").empty() || !selection2.node().parentNode) {
76859         selection2.call(lanes.off);
76860         return;
76861       }
76862       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
76863       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
76864       var surface = wrap2.selectAll(".surface").data([0]);
76865       var d2 = utilGetDimensions(wrap2);
76866       var freeSpace = d2[0] - lanesData.lanes.length * LANE_WIDTH * 1.5 + LANE_WIDTH * 0.5;
76867       surface = surface.enter().append("svg").attr("width", d2[0]).attr("height", 300).attr("class", "surface").merge(surface);
76868       var lanesSelection = surface.selectAll(".lanes").data([0]);
76869       lanesSelection = lanesSelection.enter().append("g").attr("class", "lanes").merge(lanesSelection);
76870       lanesSelection.attr("transform", function() {
76871         return "translate(" + freeSpace / 2 + ", 0)";
76872       });
76873       var lane = lanesSelection.selectAll(".lane").data(lanesData.lanes);
76874       lane.exit().remove();
76875       var enter = lane.enter().append("g").attr("class", "lane");
76876       enter.append("g").append("rect").attr("y", 50).attr("width", LANE_WIDTH).attr("height", LANE_HEIGHT);
76877       enter.append("g").attr("class", "forward").append("text").attr("y", 40).attr("x", 14).text("\u25B2");
76878       enter.append("g").attr("class", "bothways").append("text").attr("y", 40).attr("x", 14).text("\u25B2\u25BC");
76879       enter.append("g").attr("class", "backward").append("text").attr("y", 40).attr("x", 14).text("\u25BC");
76880       lane = lane.merge(enter);
76881       lane.attr("transform", function(d4) {
76882         return "translate(" + LANE_WIDTH * d4.index * 1.5 + ", 0)";
76883       });
76884       lane.select(".forward").style("visibility", function(d4) {
76885         return d4.direction === "forward" ? "visible" : "hidden";
76886       });
76887       lane.select(".bothways").style("visibility", function(d4) {
76888         return d4.direction === "bothways" ? "visible" : "hidden";
76889       });
76890       lane.select(".backward").style("visibility", function(d4) {
76891         return d4.direction === "backward" ? "visible" : "hidden";
76892       });
76893     }
76894     lanes.entityIDs = function(val) {
76895       _entityIDs = val;
76896     };
76897     lanes.tags = function() {
76898     };
76899     lanes.focus = function() {
76900     };
76901     lanes.off = function() {
76902     };
76903     return utilRebind(lanes, dispatch14, "on");
76904   }
76905   var init_lanes2 = __esm({
76906     "modules/ui/fields/lanes.js"() {
76907       "use strict";
76908       init_src4();
76909       init_rebind();
76910       init_dimensions();
76911       uiFieldLanes.supportsMultiselection = false;
76912     }
76913   });
76914
76915   // modules/ui/fields/localized.js
76916   var localized_exports = {};
76917   __export(localized_exports, {
76918     LANGUAGE_SUFFIX_REGEX: () => LANGUAGE_SUFFIX_REGEX,
76919     uiFieldLocalized: () => uiFieldLocalized
76920   });
76921   function uiFieldLocalized(field, context) {
76922     var dispatch14 = dispatch_default("change", "input");
76923     var wikipedia = services.wikipedia;
76924     var input = select_default2(null);
76925     var localizedInputs = select_default2(null);
76926     var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue());
76927     var _countryCode;
76928     var _tags;
76929     _mainFileFetcher.get("languages").then(loadLanguagesArray).catch(function() {
76930     });
76931     var _territoryLanguages = {};
76932     _mainFileFetcher.get("territory_languages").then(function(d2) {
76933       _territoryLanguages = d2;
76934     }).catch(function() {
76935     });
76936     var langCombo = uiCombobox(context, "localized-lang").fetcher(fetchLanguages).minItems(0);
76937     var _selection = select_default2(null);
76938     var _multilingual = [];
76939     var _buttonTip = uiTooltip().title(() => _t.append("translate.translate")).placement("left");
76940     var _wikiTitles;
76941     var _entityIDs = [];
76942     function loadLanguagesArray(dataLanguages) {
76943       if (_languagesArray.length !== 0) return;
76944       var replacements = {
76945         sr: "sr-Cyrl",
76946         // in OSM, `sr` implies Cyrillic
76947         "sr-Cyrl": false
76948         // `sr-Cyrl` isn't used in OSM
76949       };
76950       for (var code in dataLanguages) {
76951         if (replacements[code] === false) continue;
76952         var metaCode = code;
76953         if (replacements[code]) metaCode = replacements[code];
76954         _languagesArray.push({
76955           localName: _mainLocalizer.languageName(metaCode, { localOnly: true }),
76956           nativeName: dataLanguages[metaCode].nativeName,
76957           code,
76958           label: _mainLocalizer.languageName(metaCode)
76959         });
76960       }
76961     }
76962     function calcLocked() {
76963       var isLocked = field.id === "name" && _entityIDs.length && _entityIDs.some(function(entityID) {
76964         var entity = context.graph().hasEntity(entityID);
76965         if (!entity) return false;
76966         if (entity.tags.wikidata) return true;
76967         if (entity.tags["name:etymology:wikidata"]) return true;
76968         var preset = _mainPresetIndex.match(entity, context.graph());
76969         if (preset) {
76970           var isSuggestion = preset.suggestion;
76971           var fields = preset.fields(entity.extent(context.graph()).center());
76972           var showsBrandField = fields.some(function(d2) {
76973             return d2.id === "brand";
76974           });
76975           var showsOperatorField = fields.some(function(d2) {
76976             return d2.id === "operator";
76977           });
76978           var setsName = preset.addTags.name;
76979           var setsBrandWikidata = preset.addTags["brand:wikidata"];
76980           var setsOperatorWikidata = preset.addTags["operator:wikidata"];
76981           return isSuggestion && setsName && (setsBrandWikidata && !showsBrandField || setsOperatorWikidata && !showsOperatorField);
76982         }
76983         return false;
76984       });
76985       field.locked(isLocked);
76986     }
76987     function calcMultilingual(tags) {
76988       var existingLangsOrdered = _multilingual.map(function(item2) {
76989         return item2.lang;
76990       });
76991       var existingLangs = new Set(existingLangsOrdered.filter(Boolean));
76992       for (var k2 in tags) {
76993         var m2 = k2.match(LANGUAGE_SUFFIX_REGEX);
76994         if (m2 && m2[1] === field.key && m2[2]) {
76995           var item = { lang: m2[2], value: tags[k2] };
76996           if (existingLangs.has(item.lang)) {
76997             _multilingual[existingLangsOrdered.indexOf(item.lang)].value = item.value;
76998             existingLangs.delete(item.lang);
76999           } else {
77000             _multilingual.push(item);
77001           }
77002         }
77003       }
77004       _multilingual.forEach(function(item2) {
77005         if (item2.lang && existingLangs.has(item2.lang)) {
77006           item2.value = "";
77007         }
77008       });
77009     }
77010     function localized(selection2) {
77011       _selection = selection2;
77012       calcLocked();
77013       var isLocked = field.locked();
77014       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
77015       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
77016       input = wrap2.selectAll(".localized-main").data([0]);
77017       input = input.enter().append("input").attr("type", "text").attr("id", field.domId).attr("class", "localized-main").call(utilNoAuto).merge(input);
77018       input.classed("disabled", !!isLocked).attr("readonly", isLocked || null).on("input", change(true)).on("blur", change()).on("change", change());
77019       wrap2.call(_lengthIndicator);
77020       var translateButton = wrap2.selectAll(".localized-add").data([0]);
77021       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);
77022       translateButton.classed("disabled", !!isLocked).call(isLocked ? _buttonTip.destroy : _buttonTip).on("click", addNew);
77023       if (_tags && !_multilingual.length) {
77024         calcMultilingual(_tags);
77025       }
77026       localizedInputs = selection2.selectAll(".localized-multilingual").data([0]);
77027       localizedInputs = localizedInputs.enter().append("div").attr("class", "localized-multilingual").merge(localizedInputs);
77028       localizedInputs.call(renderMultilingual);
77029       localizedInputs.selectAll("button, input").classed("disabled", !!isLocked).attr("readonly", isLocked || null);
77030       selection2.selectAll(".combobox-caret").classed("nope", true);
77031       function addNew(d3_event) {
77032         d3_event.preventDefault();
77033         if (field.locked()) return;
77034         var defaultLang = _mainLocalizer.languageCode().toLowerCase();
77035         var langExists = _multilingual.find(function(datum2) {
77036           return datum2.lang === defaultLang;
77037         });
77038         var isLangEn = defaultLang.indexOf("en") > -1;
77039         if (isLangEn || langExists) {
77040           defaultLang = "";
77041           langExists = _multilingual.find(function(datum2) {
77042             return datum2.lang === defaultLang;
77043           });
77044         }
77045         if (!langExists) {
77046           _multilingual.unshift({ lang: defaultLang, value: "" });
77047           localizedInputs.call(renderMultilingual);
77048         }
77049       }
77050       function change(onInput) {
77051         return function(d3_event) {
77052           if (field.locked()) {
77053             d3_event.preventDefault();
77054             return;
77055           }
77056           var val = utilGetSetValue(select_default2(this));
77057           if (!onInput) val = context.cleanTagValue(val);
77058           if (!val && Array.isArray(_tags[field.key])) return;
77059           var t2 = {};
77060           t2[field.key] = val || void 0;
77061           dispatch14.call("change", this, t2, onInput);
77062         };
77063       }
77064     }
77065     function key(lang) {
77066       return field.key + ":" + lang;
77067     }
77068     function changeLang(d3_event, d2) {
77069       var tags = {};
77070       var lang = utilGetSetValue(select_default2(this)).toLowerCase();
77071       var language = _languagesArray.find(function(d4) {
77072         return d4.label.toLowerCase() === lang || d4.localName && d4.localName.toLowerCase() === lang || d4.nativeName && d4.nativeName.toLowerCase() === lang;
77073       });
77074       if (language) lang = language.code;
77075       if (d2.lang && d2.lang !== lang) {
77076         tags[key(d2.lang)] = void 0;
77077       }
77078       var newKey = lang && context.cleanTagKey(key(lang));
77079       var value = utilGetSetValue(select_default2(this.parentNode).selectAll(".localized-value"));
77080       if (newKey && value) {
77081         tags[newKey] = value;
77082       } else if (newKey && _wikiTitles && _wikiTitles[d2.lang]) {
77083         tags[newKey] = _wikiTitles[d2.lang];
77084       }
77085       d2.lang = lang;
77086       dispatch14.call("change", this, tags);
77087     }
77088     function changeValue(d3_event, d2) {
77089       if (!d2.lang) return;
77090       var value = context.cleanTagValue(utilGetSetValue(select_default2(this))) || void 0;
77091       if (!value && Array.isArray(d2.value)) return;
77092       var t2 = {};
77093       t2[key(d2.lang)] = value;
77094       d2.value = value;
77095       dispatch14.call("change", this, t2);
77096     }
77097     function fetchLanguages(value, cb) {
77098       var v2 = value.toLowerCase();
77099       var langCodes = [_mainLocalizer.localeCode(), _mainLocalizer.languageCode()];
77100       if (_countryCode && _territoryLanguages[_countryCode]) {
77101         langCodes = langCodes.concat(_territoryLanguages[_countryCode]);
77102       }
77103       var langItems = [];
77104       langCodes.forEach(function(code) {
77105         var langItem = _languagesArray.find(function(item) {
77106           return item.code === code;
77107         });
77108         if (langItem) langItems.push(langItem);
77109       });
77110       langItems = utilArrayUniq(langItems.concat(_languagesArray));
77111       cb(langItems.filter(function(d2) {
77112         return d2.label.toLowerCase().indexOf(v2) >= 0 || d2.localName && d2.localName.toLowerCase().indexOf(v2) >= 0 || d2.nativeName && d2.nativeName.toLowerCase().indexOf(v2) >= 0 || d2.code.toLowerCase().indexOf(v2) >= 0;
77113       }).map(function(d2) {
77114         return { value: d2.label };
77115       }));
77116     }
77117     function renderMultilingual(selection2) {
77118       var entries = selection2.selectAll("div.entry").data(_multilingual, function(d2) {
77119         return d2.lang;
77120       });
77121       entries.exit().style("top", "0").style("max-height", "240px").transition().duration(200).style("opacity", "0").style("max-height", "0px").remove();
77122       var entriesEnter = entries.enter().append("div").attr("class", "entry").each(function(_2, index) {
77123         var wrap2 = select_default2(this);
77124         var domId = utilUniqueDomId(index);
77125         var label = wrap2.append("label").attr("class", "field-label").attr("for", domId);
77126         var text = label.append("span").attr("class", "label-text");
77127         text.append("span").attr("class", "label-textvalue").call(_t.append("translate.localized_translation_label"));
77128         text.append("span").attr("class", "label-textannotation");
77129         label.append("button").attr("class", "remove-icon-multilingual").attr("title", _t("icons.remove")).on("click", function(d3_event, d2) {
77130           if (field.locked()) return;
77131           d3_event.preventDefault();
77132           _multilingual.splice(_multilingual.indexOf(d2), 1);
77133           var langKey = d2.lang && key(d2.lang);
77134           if (langKey && langKey in _tags) {
77135             delete _tags[langKey];
77136             var t2 = {};
77137             t2[langKey] = void 0;
77138             dispatch14.call("change", this, t2);
77139             return;
77140           }
77141           renderMultilingual(selection2);
77142         }).call(svgIcon("#iD-operation-delete"));
77143         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);
77144         wrap2.append("input").attr("type", "text").attr("class", "localized-value").on("blur", changeValue).on("change", changeValue);
77145       });
77146       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() {
77147         select_default2(this).style("max-height", "").style("overflow", "visible");
77148       });
77149       entries = entries.merge(entriesEnter);
77150       entries.order();
77151       entries.classed("present", true);
77152       utilGetSetValue(entries.select(".localized-lang"), function(d2) {
77153         var langItem = _languagesArray.find(function(item) {
77154           return item.code === d2.lang;
77155         });
77156         if (langItem) return langItem.label;
77157         return d2.lang;
77158       });
77159       utilGetSetValue(entries.select(".localized-value"), function(d2) {
77160         return typeof d2.value === "string" ? d2.value : "";
77161       }).attr("title", function(d2) {
77162         return Array.isArray(d2.value) ? d2.value.filter(Boolean).join("\n") : null;
77163       }).attr("placeholder", function(d2) {
77164         return Array.isArray(d2.value) ? _t("inspector.multiple_values") : _t("translate.localized_translation_name");
77165       }).attr("lang", function(d2) {
77166         return d2.lang;
77167       }).classed("mixed", function(d2) {
77168         return Array.isArray(d2.value);
77169       });
77170     }
77171     localized.tags = function(tags) {
77172       _tags = tags;
77173       if (typeof tags.wikipedia === "string" && !_wikiTitles) {
77174         _wikiTitles = {};
77175         var wm = tags.wikipedia.match(/([^:]+):(.+)/);
77176         if (wm && wm[0] && wm[1]) {
77177           wikipedia.translations(wm[1], wm[2], function(err, d2) {
77178             if (err || !d2) return;
77179             _wikiTitles = d2;
77180           });
77181         }
77182       }
77183       var isMixed = Array.isArray(tags[field.key]);
77184       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);
77185       calcMultilingual(tags);
77186       _selection.call(localized);
77187       if (!isMixed) {
77188         _lengthIndicator.update(tags[field.key]);
77189       }
77190     };
77191     localized.focus = function() {
77192       input.node().focus();
77193     };
77194     localized.entityIDs = function(val) {
77195       if (!arguments.length) return _entityIDs;
77196       _entityIDs = val;
77197       _multilingual = [];
77198       loadCountryCode();
77199       return localized;
77200     };
77201     function loadCountryCode() {
77202       var extent = combinedEntityExtent();
77203       var countryCode = extent && iso1A2Code(extent.center());
77204       _countryCode = countryCode && countryCode.toLowerCase();
77205     }
77206     function combinedEntityExtent() {
77207       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
77208     }
77209     return utilRebind(localized, dispatch14, "on");
77210   }
77211   var _languagesArray, LANGUAGE_SUFFIX_REGEX;
77212   var init_localized = __esm({
77213     "modules/ui/fields/localized.js"() {
77214       "use strict";
77215       init_src4();
77216       init_src5();
77217       init_country_coder();
77218       init_presets();
77219       init_file_fetcher();
77220       init_localizer();
77221       init_services();
77222       init_svg();
77223       init_tooltip();
77224       init_combobox();
77225       init_util();
77226       init_length_indicator();
77227       _languagesArray = [];
77228       LANGUAGE_SUFFIX_REGEX = /^(.*):([a-z]{2,3}(?:-[A-Z][a-z]{3})?(?:-[A-Z]{2})?)$/;
77229     }
77230   });
77231
77232   // modules/ui/fields/roadheight.js
77233   var roadheight_exports = {};
77234   __export(roadheight_exports, {
77235     uiFieldRoadheight: () => uiFieldRoadheight
77236   });
77237   function uiFieldRoadheight(field, context) {
77238     var dispatch14 = dispatch_default("change");
77239     var primaryUnitInput = select_default2(null);
77240     var primaryInput = select_default2(null);
77241     var secondaryInput = select_default2(null);
77242     var secondaryUnitInput = select_default2(null);
77243     var _entityIDs = [];
77244     var _tags;
77245     var _isImperial;
77246     var formatFloat = _mainLocalizer.floatFormatter(_mainLocalizer.languageCode());
77247     var parseLocaleFloat = _mainLocalizer.floatParser(_mainLocalizer.languageCode());
77248     var primaryUnits = [
77249       {
77250         value: "m",
77251         title: _t("inspector.roadheight.meter")
77252       },
77253       {
77254         value: "ft",
77255         title: _t("inspector.roadheight.foot")
77256       }
77257     ];
77258     var unitCombo = uiCombobox(context, "roadheight-unit").data(primaryUnits);
77259     function roadheight(selection2) {
77260       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
77261       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
77262       primaryInput = wrap2.selectAll("input.roadheight-number").data([0]);
77263       primaryInput = primaryInput.enter().append("input").attr("type", "text").attr("class", "roadheight-number").attr("id", field.domId).call(utilNoAuto).merge(primaryInput);
77264       primaryInput.on("change", change).on("blur", change);
77265       var loc = combinedEntityExtent().center();
77266       _isImperial = roadHeightUnit(loc) === "ft";
77267       primaryUnitInput = wrap2.selectAll("input.roadheight-unit").data([0]);
77268       primaryUnitInput = primaryUnitInput.enter().append("input").attr("type", "text").attr("class", "roadheight-unit").call(unitCombo).merge(primaryUnitInput);
77269       primaryUnitInput.on("blur", changeUnits).on("change", changeUnits);
77270       secondaryInput = wrap2.selectAll("input.roadheight-secondary-number").data([0]);
77271       secondaryInput = secondaryInput.enter().append("input").attr("type", "text").attr("class", "roadheight-secondary-number").call(utilNoAuto).merge(secondaryInput);
77272       secondaryInput.on("change", change).on("blur", change);
77273       secondaryUnitInput = wrap2.selectAll("input.roadheight-secondary-unit").data([0]);
77274       secondaryUnitInput = secondaryUnitInput.enter().append("input").attr("type", "text").call(utilNoAuto).classed("disabled", true).classed("roadheight-secondary-unit", true).attr("readonly", "readonly").merge(secondaryUnitInput);
77275       function changeUnits() {
77276         var primaryUnit = utilGetSetValue(primaryUnitInput);
77277         if (primaryUnit === "m") {
77278           _isImperial = false;
77279         } else if (primaryUnit === "ft") {
77280           _isImperial = true;
77281         }
77282         utilGetSetValue(primaryUnitInput, _isImperial ? "ft" : "m");
77283         setUnitSuggestions();
77284         change();
77285       }
77286     }
77287     function setUnitSuggestions() {
77288       utilGetSetValue(primaryUnitInput, _isImperial ? "ft" : "m");
77289     }
77290     function change() {
77291       var tag2 = {};
77292       var primaryValue = utilGetSetValue(primaryInput).trim();
77293       var secondaryValue = utilGetSetValue(secondaryInput).trim();
77294       if (!primaryValue && !secondaryValue && Array.isArray(_tags[field.key])) return;
77295       if (!primaryValue && !secondaryValue) {
77296         tag2[field.key] = void 0;
77297       } else {
77298         var rawPrimaryValue = likelyRawNumberFormat.test(primaryValue) ? parseFloat(primaryValue) : parseLocaleFloat(primaryValue);
77299         if (isNaN(rawPrimaryValue)) rawPrimaryValue = primaryValue;
77300         var rawSecondaryValue = likelyRawNumberFormat.test(secondaryValue) ? parseFloat(secondaryValue) : parseLocaleFloat(secondaryValue);
77301         if (isNaN(rawSecondaryValue)) rawSecondaryValue = secondaryValue;
77302         if (isNaN(rawPrimaryValue) || isNaN(rawSecondaryValue) || !_isImperial) {
77303           tag2[field.key] = context.cleanTagValue(rawPrimaryValue);
77304         } else {
77305           if (rawPrimaryValue !== "") {
77306             rawPrimaryValue = rawPrimaryValue + "'";
77307           }
77308           if (rawSecondaryValue !== "") {
77309             rawSecondaryValue = rawSecondaryValue + '"';
77310           }
77311           tag2[field.key] = context.cleanTagValue(rawPrimaryValue + rawSecondaryValue);
77312         }
77313       }
77314       dispatch14.call("change", this, tag2);
77315     }
77316     roadheight.tags = function(tags) {
77317       _tags = tags;
77318       var primaryValue = tags[field.key];
77319       var secondaryValue;
77320       var isMixed = Array.isArray(primaryValue);
77321       if (!isMixed) {
77322         if (primaryValue && (primaryValue.indexOf("'") >= 0 || primaryValue.indexOf('"') >= 0)) {
77323           secondaryValue = primaryValue.match(/(-?[\d.]+)"/);
77324           if (secondaryValue !== null) {
77325             secondaryValue = formatFloat(parseFloat(secondaryValue[1]));
77326           }
77327           primaryValue = primaryValue.match(/(-?[\d.]+)'/);
77328           if (primaryValue !== null) {
77329             primaryValue = formatFloat(parseFloat(primaryValue[1]));
77330           }
77331           _isImperial = true;
77332         } else if (primaryValue) {
77333           var rawValue = primaryValue;
77334           primaryValue = parseFloat(rawValue);
77335           if (isNaN(primaryValue)) {
77336             primaryValue = rawValue;
77337           } else {
77338             primaryValue = formatFloat(primaryValue);
77339           }
77340           _isImperial = false;
77341         }
77342       }
77343       setUnitSuggestions();
77344       var inchesPlaceholder = formatFloat(0);
77345       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);
77346       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");
77347       secondaryUnitInput.attr("value", _isImperial ? _t("inspector.roadheight.inch") : null);
77348     };
77349     roadheight.focus = function() {
77350       primaryInput.node().focus();
77351     };
77352     roadheight.entityIDs = function(val) {
77353       _entityIDs = val;
77354     };
77355     function combinedEntityExtent() {
77356       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
77357     }
77358     return utilRebind(roadheight, dispatch14, "on");
77359   }
77360   var init_roadheight = __esm({
77361     "modules/ui/fields/roadheight.js"() {
77362       "use strict";
77363       init_src4();
77364       init_src5();
77365       init_country_coder();
77366       init_combobox();
77367       init_localizer();
77368       init_util();
77369       init_input();
77370     }
77371   });
77372
77373   // modules/ui/fields/roadspeed.js
77374   var roadspeed_exports = {};
77375   __export(roadspeed_exports, {
77376     uiFieldRoadspeed: () => uiFieldRoadspeed
77377   });
77378   function uiFieldRoadspeed(field, context) {
77379     var dispatch14 = dispatch_default("change");
77380     var unitInput = select_default2(null);
77381     var input = select_default2(null);
77382     var _entityIDs = [];
77383     var _tags;
77384     var _isImperial;
77385     var formatFloat = _mainLocalizer.floatFormatter(_mainLocalizer.languageCode());
77386     var parseLocaleFloat = _mainLocalizer.floatParser(_mainLocalizer.languageCode());
77387     var speedCombo = uiCombobox(context, "roadspeed");
77388     var unitCombo = uiCombobox(context, "roadspeed-unit").data(["km/h", "mph"].map(comboValues));
77389     var metricValues = [20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120];
77390     var imperialValues = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80];
77391     function roadspeed(selection2) {
77392       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
77393       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
77394       input = wrap2.selectAll("input.roadspeed-number").data([0]);
77395       input = input.enter().append("input").attr("type", "text").attr("class", "roadspeed-number").attr("id", field.domId).call(utilNoAuto).call(speedCombo).merge(input);
77396       input.on("change", change).on("blur", change);
77397       var loc = combinedEntityExtent().center();
77398       _isImperial = roadSpeedUnit(loc) === "mph";
77399       unitInput = wrap2.selectAll("input.roadspeed-unit").data([0]);
77400       unitInput = unitInput.enter().append("input").attr("type", "text").attr("class", "roadspeed-unit").attr("aria-label", _t("inspector.speed_unit")).call(unitCombo).merge(unitInput);
77401       unitInput.on("blur", changeUnits).on("change", changeUnits);
77402       function changeUnits() {
77403         var unit2 = utilGetSetValue(unitInput);
77404         if (unit2 === "km/h") {
77405           _isImperial = false;
77406         } else if (unit2 === "mph") {
77407           _isImperial = true;
77408         }
77409         utilGetSetValue(unitInput, _isImperial ? "mph" : "km/h");
77410         setUnitSuggestions();
77411         change();
77412       }
77413     }
77414     function setUnitSuggestions() {
77415       speedCombo.data((_isImperial ? imperialValues : metricValues).map(comboValues));
77416       utilGetSetValue(unitInput, _isImperial ? "mph" : "km/h");
77417     }
77418     function comboValues(d2) {
77419       return {
77420         value: formatFloat(d2),
77421         title: formatFloat(d2)
77422       };
77423     }
77424     function change() {
77425       var tag2 = {};
77426       var value = utilGetSetValue(input).trim();
77427       if (!value && Array.isArray(_tags[field.key])) return;
77428       if (!value) {
77429         tag2[field.key] = void 0;
77430       } else {
77431         var rawValue = likelyRawNumberFormat.test(value) ? parseFloat(value) : parseLocaleFloat(value);
77432         if (isNaN(rawValue)) rawValue = value;
77433         if (isNaN(rawValue) || !_isImperial) {
77434           tag2[field.key] = context.cleanTagValue(rawValue);
77435         } else {
77436           tag2[field.key] = context.cleanTagValue(rawValue + " mph");
77437         }
77438       }
77439       dispatch14.call("change", this, tag2);
77440     }
77441     roadspeed.tags = function(tags) {
77442       _tags = tags;
77443       var rawValue = tags[field.key];
77444       var value = rawValue;
77445       var isMixed = Array.isArray(value);
77446       if (!isMixed) {
77447         if (rawValue && rawValue.indexOf("mph") >= 0) {
77448           _isImperial = true;
77449         } else if (rawValue) {
77450           _isImperial = false;
77451         }
77452         value = parseInt(value, 10);
77453         if (isNaN(value)) {
77454           value = rawValue;
77455         } else {
77456           value = formatFloat(value);
77457         }
77458       }
77459       setUnitSuggestions();
77460       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);
77461     };
77462     roadspeed.focus = function() {
77463       input.node().focus();
77464     };
77465     roadspeed.entityIDs = function(val) {
77466       _entityIDs = val;
77467     };
77468     function combinedEntityExtent() {
77469       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
77470     }
77471     return utilRebind(roadspeed, dispatch14, "on");
77472   }
77473   var init_roadspeed = __esm({
77474     "modules/ui/fields/roadspeed.js"() {
77475       "use strict";
77476       init_src4();
77477       init_src5();
77478       init_country_coder();
77479       init_combobox();
77480       init_localizer();
77481       init_util();
77482       init_input();
77483     }
77484   });
77485
77486   // modules/ui/fields/radio.js
77487   var radio_exports = {};
77488   __export(radio_exports, {
77489     uiFieldRadio: () => uiFieldRadio,
77490     uiFieldStructureRadio: () => uiFieldRadio
77491   });
77492   function uiFieldRadio(field, context) {
77493     var dispatch14 = dispatch_default("change");
77494     var placeholder = select_default2(null);
77495     var wrap2 = select_default2(null);
77496     var labels = select_default2(null);
77497     var radios = select_default2(null);
77498     var radioData = (field.options || field.keys).slice();
77499     var typeField;
77500     var layerField;
77501     var _oldType = {};
77502     var _entityIDs = [];
77503     function selectedKey() {
77504       var node = wrap2.selectAll(".form-field-input-radio label.active input");
77505       return !node.empty() && node.datum();
77506     }
77507     function radio(selection2) {
77508       selection2.classed("preset-radio", true);
77509       wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
77510       var enter = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-radio");
77511       enter.append("span").attr("class", "placeholder");
77512       wrap2 = wrap2.merge(enter);
77513       placeholder = wrap2.selectAll(".placeholder");
77514       labels = wrap2.selectAll("label").data(radioData);
77515       enter = labels.enter().append("label");
77516       var stringsField = field.resolveReference("stringsCrossReference");
77517       enter.append("input").attr("type", "radio").attr("name", field.id).attr("value", function(d2) {
77518         return stringsField.t("options." + d2, { "default": d2 });
77519       }).attr("checked", false);
77520       enter.append("span").each(function(d2) {
77521         stringsField.t.append("options." + d2, { "default": d2 })(select_default2(this));
77522       });
77523       labels = labels.merge(enter);
77524       radios = labels.selectAll("input").on("change", changeRadio);
77525     }
77526     function structureExtras(selection2, tags) {
77527       var selected = selectedKey() || tags.layer !== void 0;
77528       var type2 = _mainPresetIndex.field(selected);
77529       var layer = _mainPresetIndex.field("layer");
77530       var showLayer = selected === "bridge" || selected === "tunnel" || tags.layer !== void 0;
77531       var extrasWrap = selection2.selectAll(".structure-extras-wrap").data(selected ? [0] : []);
77532       extrasWrap.exit().remove();
77533       extrasWrap = extrasWrap.enter().append("div").attr("class", "structure-extras-wrap").merge(extrasWrap);
77534       var list2 = extrasWrap.selectAll("ul").data([0]);
77535       list2 = list2.enter().append("ul").attr("class", "rows").merge(list2);
77536       if (type2) {
77537         if (!typeField || typeField.id !== selected) {
77538           typeField = uiField(context, type2, _entityIDs, { wrap: false }).on("change", changeType);
77539         }
77540         typeField.tags(tags);
77541       } else {
77542         typeField = null;
77543       }
77544       var typeItem = list2.selectAll(".structure-type-item").data(typeField ? [typeField] : [], function(d2) {
77545         return d2.id;
77546       });
77547       typeItem.exit().remove();
77548       var typeEnter = typeItem.enter().insert("li", ":first-child").attr("class", "labeled-input structure-type-item");
77549       typeEnter.append("div").attr("class", "label structure-label-type").attr("for", "preset-input-" + selected).call(_t.append("inspector.radio.structure.type"));
77550       typeEnter.append("div").attr("class", "structure-input-type-wrap");
77551       typeItem = typeItem.merge(typeEnter);
77552       if (typeField) {
77553         typeItem.selectAll(".structure-input-type-wrap").call(typeField.render);
77554       }
77555       if (layer && showLayer) {
77556         if (!layerField) {
77557           layerField = uiField(context, layer, _entityIDs, { wrap: false }).on("change", changeLayer);
77558         }
77559         layerField.tags(tags);
77560         field.keys = utilArrayUnion(field.keys, ["layer"]);
77561       } else {
77562         layerField = null;
77563         field.keys = field.keys.filter(function(k2) {
77564           return k2 !== "layer";
77565         });
77566       }
77567       var layerItem = list2.selectAll(".structure-layer-item").data(layerField ? [layerField] : []);
77568       layerItem.exit().remove();
77569       var layerEnter = layerItem.enter().append("li").attr("class", "labeled-input structure-layer-item");
77570       layerEnter.append("div").attr("class", "label structure-label-layer").attr("for", "preset-input-layer").call(_t.append("inspector.radio.structure.layer"));
77571       layerEnter.append("div").attr("class", "structure-input-layer-wrap");
77572       layerItem = layerItem.merge(layerEnter);
77573       if (layerField) {
77574         layerItem.selectAll(".structure-input-layer-wrap").call(layerField.render);
77575       }
77576     }
77577     function changeType(t2, onInput) {
77578       var key = selectedKey();
77579       if (!key) return;
77580       var val = t2[key];
77581       if (val !== "no") {
77582         _oldType[key] = val;
77583       }
77584       if (field.type === "structureRadio") {
77585         if (val === "no" || key !== "bridge" && key !== "tunnel" || key === "tunnel" && val === "building_passage") {
77586           t2.layer = void 0;
77587         }
77588         if (t2.layer === void 0) {
77589           if (key === "bridge" && val !== "no") {
77590             t2.layer = "1";
77591           }
77592           if (key === "tunnel" && val !== "no" && val !== "building_passage") {
77593             t2.layer = "-1";
77594           }
77595         }
77596       }
77597       dispatch14.call("change", this, t2, onInput);
77598     }
77599     function changeLayer(t2, onInput) {
77600       if (t2.layer === "0") {
77601         t2.layer = void 0;
77602       }
77603       dispatch14.call("change", this, t2, onInput);
77604     }
77605     function changeRadio() {
77606       var t2 = {};
77607       var activeKey;
77608       if (field.key) {
77609         t2[field.key] = void 0;
77610       }
77611       radios.each(function(d2) {
77612         var active = select_default2(this).property("checked");
77613         if (active) activeKey = d2;
77614         if (field.key) {
77615           if (active) t2[field.key] = d2;
77616         } else {
77617           var val = _oldType[activeKey] || "yes";
77618           t2[d2] = active ? val : void 0;
77619         }
77620       });
77621       if (field.type === "structureRadio") {
77622         if (activeKey === "bridge") {
77623           t2.layer = "1";
77624         } else if (activeKey === "tunnel" && t2.tunnel !== "building_passage") {
77625           t2.layer = "-1";
77626         } else {
77627           t2.layer = void 0;
77628         }
77629       }
77630       dispatch14.call("change", this, t2);
77631     }
77632     radio.tags = function(tags) {
77633       function isOptionChecked(d2) {
77634         if (field.key) {
77635           return tags[field.key] === d2;
77636         }
77637         return !!(typeof tags[d2] === "string" && tags[d2].toLowerCase() !== "no");
77638       }
77639       function isMixed(d2) {
77640         if (field.key) {
77641           return Array.isArray(tags[field.key]) && tags[field.key].includes(d2);
77642         }
77643         return Array.isArray(tags[d2]);
77644       }
77645       radios.property("checked", function(d2) {
77646         return isOptionChecked(d2) && (field.key || field.options.filter(isOptionChecked).length === 1);
77647       });
77648       labels.classed("active", function(d2) {
77649         if (field.key) {
77650           return Array.isArray(tags[field.key]) && tags[field.key].includes(d2) || tags[field.key] === d2;
77651         }
77652         return Array.isArray(tags[d2]) && tags[d2].some((v2) => typeof v2 === "string" && v2.toLowerCase() !== "no") || !!(typeof tags[d2] === "string" && tags[d2].toLowerCase() !== "no");
77653       }).classed("mixed", isMixed).attr("title", function(d2) {
77654         return isMixed(d2) ? _t("inspector.unshared_value_tooltip") : null;
77655       });
77656       var selection2 = radios.filter(function() {
77657         return this.checked;
77658       });
77659       if (selection2.empty()) {
77660         placeholder.text("");
77661         placeholder.call(_t.append("inspector.none"));
77662       } else {
77663         placeholder.text(selection2.attr("value"));
77664         _oldType[selection2.datum()] = tags[selection2.datum()];
77665       }
77666       if (field.type === "structureRadio") {
77667         if (!!tags.waterway && !_oldType.tunnel) {
77668           _oldType.tunnel = "culvert";
77669         }
77670         if (!!tags.waterway && !_oldType.bridge) {
77671           _oldType.bridge = "aqueduct";
77672         }
77673         wrap2.call(structureExtras, tags);
77674       }
77675     };
77676     radio.focus = function() {
77677       radios.node().focus();
77678     };
77679     radio.entityIDs = function(val) {
77680       if (!arguments.length) return _entityIDs;
77681       _entityIDs = val;
77682       _oldType = {};
77683       return radio;
77684     };
77685     radio.isAllowed = function() {
77686       return _entityIDs.length === 1;
77687     };
77688     return utilRebind(radio, dispatch14, "on");
77689   }
77690   var init_radio = __esm({
77691     "modules/ui/fields/radio.js"() {
77692       "use strict";
77693       init_src4();
77694       init_src5();
77695       init_presets();
77696       init_localizer();
77697       init_field2();
77698       init_util();
77699     }
77700   });
77701
77702   // modules/ui/fields/restrictions.js
77703   var restrictions_exports = {};
77704   __export(restrictions_exports, {
77705     uiFieldRestrictions: () => uiFieldRestrictions
77706   });
77707   function uiFieldRestrictions(field, context) {
77708     var dispatch14 = dispatch_default("change");
77709     var breathe = behaviorBreathe(context);
77710     corePreferences("turn-restriction-via-way", null);
77711     var storedViaWay = corePreferences("turn-restriction-via-way0");
77712     var storedDistance = corePreferences("turn-restriction-distance");
77713     var _maxViaWay = storedViaWay !== null ? +storedViaWay : 0;
77714     var _maxDistance = storedDistance ? +storedDistance : 30;
77715     var _initialized3 = false;
77716     var _parent = select_default2(null);
77717     var _container = select_default2(null);
77718     var _oldTurns;
77719     var _graph;
77720     var _vertexID;
77721     var _intersection;
77722     var _fromWayID;
77723     var _lastXPos;
77724     function restrictions(selection2) {
77725       _parent = selection2;
77726       if (_vertexID && (context.graph() !== _graph || !_intersection)) {
77727         _graph = context.graph();
77728         _intersection = osmIntersection(_graph, _vertexID, _maxDistance);
77729       }
77730       var isOK = _intersection && _intersection.vertices.length && // has vertices
77731       _intersection.vertices.filter(function(vertex) {
77732         return vertex.id === _vertexID;
77733       }).length && _intersection.ways.length > 2;
77734       select_default2(selection2.node().parentNode).classed("hide", !isOK);
77735       if (!isOK || !context.container().select(".inspector-wrap.inspector-hidden").empty() || !selection2.node().parentNode || !selection2.node().parentNode.parentNode) {
77736         selection2.call(restrictions.off);
77737         return;
77738       }
77739       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
77740       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
77741       var container = wrap2.selectAll(".restriction-container").data([0]);
77742       var containerEnter = container.enter().append("div").attr("class", "restriction-container");
77743       containerEnter.append("div").attr("class", "restriction-help");
77744       _container = containerEnter.merge(container).call(renderViewer);
77745       var controls = wrap2.selectAll(".restriction-controls").data([0]);
77746       controls.enter().append("div").attr("class", "restriction-controls-container").append("div").attr("class", "restriction-controls").merge(controls).call(renderControls);
77747     }
77748     function renderControls(selection2) {
77749       var distControl = selection2.selectAll(".restriction-distance").data([0]);
77750       distControl.exit().remove();
77751       var distControlEnter = distControl.enter().append("div").attr("class", "restriction-control restriction-distance");
77752       distControlEnter.append("span").attr("class", "restriction-control-label restriction-distance-label").call(_t.append("restriction.controls.distance", { suffix: ":" }));
77753       distControlEnter.append("input").attr("class", "restriction-distance-input").attr("type", "range").attr("min", "20").attr("max", "50").attr("step", "5");
77754       distControlEnter.append("span").attr("class", "restriction-distance-text");
77755       selection2.selectAll(".restriction-distance-input").property("value", _maxDistance).on("input", function() {
77756         var val = select_default2(this).property("value");
77757         _maxDistance = +val;
77758         _intersection = null;
77759         _container.selectAll(".layer-osm .layer-turns *").remove();
77760         corePreferences("turn-restriction-distance", _maxDistance);
77761         _parent.call(restrictions);
77762       });
77763       selection2.selectAll(".restriction-distance-text").call(displayMaxDistance(_maxDistance));
77764       var viaControl = selection2.selectAll(".restriction-via-way").data([0]);
77765       viaControl.exit().remove();
77766       var viaControlEnter = viaControl.enter().append("div").attr("class", "restriction-control restriction-via-way");
77767       viaControlEnter.append("span").attr("class", "restriction-control-label restriction-via-way-label").call(_t.append("restriction.controls.via", { suffix: ":" }));
77768       viaControlEnter.append("input").attr("class", "restriction-via-way-input").attr("type", "range").attr("min", "0").attr("max", "2").attr("step", "1");
77769       viaControlEnter.append("span").attr("class", "restriction-via-way-text");
77770       selection2.selectAll(".restriction-via-way-input").property("value", _maxViaWay).on("input", function() {
77771         var val = select_default2(this).property("value");
77772         _maxViaWay = +val;
77773         _container.selectAll(".layer-osm .layer-turns *").remove();
77774         corePreferences("turn-restriction-via-way0", _maxViaWay);
77775         _parent.call(restrictions);
77776       });
77777       selection2.selectAll(".restriction-via-way-text").call(displayMaxVia(_maxViaWay));
77778     }
77779     function renderViewer(selection2) {
77780       if (!_intersection) return;
77781       var vgraph = _intersection.graph;
77782       var filter2 = utilFunctor(true);
77783       var projection2 = geoRawMercator();
77784       var sdims = utilGetDimensions(context.container().select(".sidebar"));
77785       var d2 = [sdims[0] - 50, 370];
77786       var c2 = geoVecScale(d2, 0.5);
77787       var z2 = 22;
77788       projection2.scale(geoZoomToScale(z2));
77789       var extent = geoExtent();
77790       for (var i3 = 0; i3 < _intersection.vertices.length; i3++) {
77791         extent._extend(_intersection.vertices[i3].extent());
77792       }
77793       var padTop = 35;
77794       if (_intersection.vertices.length > 1) {
77795         var hPadding = Math.min(160, Math.max(110, d2[0] * 0.4));
77796         var vPadding = 160;
77797         var tl = projection2([extent[0][0], extent[1][1]]);
77798         var br2 = projection2([extent[1][0], extent[0][1]]);
77799         var hFactor = (br2[0] - tl[0]) / (d2[0] - hPadding);
77800         var vFactor = (br2[1] - tl[1]) / (d2[1] - vPadding - padTop);
77801         var hZoomDiff = Math.log(Math.abs(hFactor)) / Math.LN2;
77802         var vZoomDiff = Math.log(Math.abs(vFactor)) / Math.LN2;
77803         z2 = z2 - Math.max(hZoomDiff, vZoomDiff);
77804         projection2.scale(geoZoomToScale(z2));
77805       }
77806       var extentCenter = projection2(extent.center());
77807       extentCenter[1] = extentCenter[1] - padTop / 2;
77808       projection2.translate(geoVecSubtract(c2, extentCenter)).clipExtent([[0, 0], d2]);
77809       var drawLayers = svgLayers(projection2, context).only(["osm", "touch"]).dimensions(d2);
77810       var drawVertices = svgVertices(projection2, context);
77811       var drawLines = svgLines(projection2, context);
77812       var drawTurns = svgTurns(projection2, context);
77813       var firstTime = selection2.selectAll(".surface").empty();
77814       selection2.call(drawLayers);
77815       var surface = selection2.selectAll(".surface").classed("tr", true);
77816       if (firstTime) {
77817         _initialized3 = true;
77818         surface.call(breathe);
77819       }
77820       if (_fromWayID && !vgraph.hasEntity(_fromWayID)) {
77821         _fromWayID = null;
77822         _oldTurns = null;
77823       }
77824       surface.call(utilSetDimensions, d2).call(drawVertices, vgraph, _intersection.vertices, filter2, extent, z2).call(drawLines, vgraph, _intersection.ways, filter2).call(drawTurns, vgraph, _intersection.turns(_fromWayID, _maxViaWay));
77825       surface.on("click.restrictions", click).on("mouseover.restrictions", mouseover);
77826       surface.selectAll(".selected").classed("selected", false);
77827       surface.selectAll(".related").classed("related", false);
77828       var way;
77829       if (_fromWayID) {
77830         way = vgraph.entity(_fromWayID);
77831         surface.selectAll("." + _fromWayID).classed("selected", true).classed("related", true);
77832       }
77833       document.addEventListener("resizeWindow", function() {
77834         utilSetDimensions(_container, null);
77835         redraw(1);
77836       }, false);
77837       updateHints(null);
77838       function click(d3_event) {
77839         surface.call(breathe.off).call(breathe);
77840         var datum2 = d3_event.target.__data__;
77841         var entity = datum2 && datum2.properties && datum2.properties.entity;
77842         if (entity) {
77843           datum2 = entity;
77844         }
77845         if (datum2 instanceof osmWay && (datum2.__from || datum2.__via)) {
77846           _fromWayID = datum2.id;
77847           _oldTurns = null;
77848           redraw();
77849         } else if (datum2 instanceof osmTurn) {
77850           var actions, extraActions, turns, i4;
77851           var restrictionType = osmInferRestriction(vgraph, datum2, projection2);
77852           if (datum2.restrictionID && !datum2.direct) {
77853             return;
77854           } else if (datum2.restrictionID && !datum2.only) {
77855             var seen = {};
77856             var datumOnly = JSON.parse(JSON.stringify(datum2));
77857             datumOnly.only = true;
77858             restrictionType = restrictionType.replace(/^no/, "only");
77859             turns = _intersection.turns(_fromWayID, 2);
77860             extraActions = [];
77861             _oldTurns = [];
77862             for (i4 = 0; i4 < turns.length; i4++) {
77863               var turn = turns[i4];
77864               if (seen[turn.restrictionID]) continue;
77865               if (turn.direct && turn.path[1] === datum2.path[1]) {
77866                 seen[turns[i4].restrictionID] = true;
77867                 turn.restrictionType = osmInferRestriction(vgraph, turn, projection2);
77868                 _oldTurns.push(turn);
77869                 extraActions.push(actionUnrestrictTurn(turn));
77870               }
77871             }
77872             actions = _intersection.actions.concat(extraActions, [
77873               actionRestrictTurn(datumOnly, restrictionType),
77874               _t("operations.restriction.annotation.create")
77875             ]);
77876           } else if (datum2.restrictionID) {
77877             turns = _oldTurns || [];
77878             extraActions = [];
77879             for (i4 = 0; i4 < turns.length; i4++) {
77880               if (turns[i4].key !== datum2.key) {
77881                 extraActions.push(actionRestrictTurn(turns[i4], turns[i4].restrictionType));
77882               }
77883             }
77884             _oldTurns = null;
77885             actions = _intersection.actions.concat(extraActions, [
77886               actionUnrestrictTurn(datum2),
77887               _t("operations.restriction.annotation.delete")
77888             ]);
77889           } else {
77890             actions = _intersection.actions.concat([
77891               actionRestrictTurn(datum2, restrictionType),
77892               _t("operations.restriction.annotation.create")
77893             ]);
77894           }
77895           context.perform.apply(context, actions);
77896           var s2 = surface.selectAll("." + datum2.key);
77897           datum2 = s2.empty() ? null : s2.datum();
77898           updateHints(datum2);
77899         } else {
77900           _fromWayID = null;
77901           _oldTurns = null;
77902           redraw();
77903         }
77904       }
77905       function mouseover(d3_event) {
77906         var datum2 = d3_event.target.__data__;
77907         updateHints(datum2);
77908       }
77909       _lastXPos = _lastXPos || sdims[0];
77910       function redraw(minChange) {
77911         var xPos = -1;
77912         if (minChange) {
77913           xPos = utilGetDimensions(context.container().select(".sidebar"))[0];
77914         }
77915         if (!minChange || minChange && Math.abs(xPos - _lastXPos) >= minChange) {
77916           if (context.hasEntity(_vertexID)) {
77917             _lastXPos = xPos;
77918             _container.call(renderViewer);
77919           }
77920         }
77921       }
77922       function highlightPathsFrom(wayID) {
77923         surface.selectAll(".related").classed("related", false).classed("allow", false).classed("restrict", false).classed("only", false);
77924         surface.selectAll("." + wayID).classed("related", true);
77925         if (wayID) {
77926           var turns = _intersection.turns(wayID, _maxViaWay);
77927           for (var i4 = 0; i4 < turns.length; i4++) {
77928             var turn = turns[i4];
77929             var ids = [turn.to.way];
77930             var klass = turn.no ? "restrict" : turn.only ? "only" : "allow";
77931             if (turn.only || turns.length === 1) {
77932               if (turn.via.ways) {
77933                 ids = ids.concat(turn.via.ways);
77934               }
77935             } else if (turn.to.way === wayID) {
77936               continue;
77937             }
77938             surface.selectAll(utilEntitySelector(ids)).classed("related", true).classed("allow", klass === "allow").classed("restrict", klass === "restrict").classed("only", klass === "only");
77939           }
77940         }
77941       }
77942       function updateHints(datum2) {
77943         var help = _container.selectAll(".restriction-help").html("");
77944         var placeholders = {};
77945         ["from", "via", "to"].forEach(function(k2) {
77946           placeholders[k2] = { html: '<span class="qualifier">' + _t("restriction.help." + k2) + "</span>" };
77947         });
77948         var entity = datum2 && datum2.properties && datum2.properties.entity;
77949         if (entity) {
77950           datum2 = entity;
77951         }
77952         if (_fromWayID) {
77953           way = vgraph.entity(_fromWayID);
77954           surface.selectAll("." + _fromWayID).classed("selected", true).classed("related", true);
77955         }
77956         if (datum2 instanceof osmWay && datum2.__from) {
77957           way = datum2;
77958           highlightPathsFrom(_fromWayID ? null : way.id);
77959           surface.selectAll("." + way.id).classed("related", true);
77960           var clickSelect = !_fromWayID || _fromWayID !== way.id;
77961           help.append("div").html(_t.html("restriction.help." + (clickSelect ? "select_from_name" : "from_name"), {
77962             from: placeholders.from,
77963             fromName: displayName(way.id, vgraph)
77964           }));
77965         } else if (datum2 instanceof osmTurn) {
77966           var restrictionType = osmInferRestriction(vgraph, datum2, projection2);
77967           var turnType = restrictionType.replace(/^(only|no)\_/, "");
77968           var indirect = datum2.direct === false ? _t.html("restriction.help.indirect") : "";
77969           var klass, turnText, nextText;
77970           if (datum2.no) {
77971             klass = "restrict";
77972             turnText = _t.html("restriction.help.turn.no_" + turnType, { indirect: { html: indirect } });
77973             nextText = _t.html("restriction.help.turn.only_" + turnType, { indirect: "" });
77974           } else if (datum2.only) {
77975             klass = "only";
77976             turnText = _t.html("restriction.help.turn.only_" + turnType, { indirect: { html: indirect } });
77977             nextText = _t.html("restriction.help.turn.allowed_" + turnType, { indirect: "" });
77978           } else {
77979             klass = "allow";
77980             turnText = _t.html("restriction.help.turn.allowed_" + turnType, { indirect: { html: indirect } });
77981             nextText = _t.html("restriction.help.turn.no_" + turnType, { indirect: "" });
77982           }
77983           help.append("div").attr("class", "qualifier " + klass).html(turnText);
77984           help.append("div").html(_t.html("restriction.help.from_name_to_name", {
77985             from: placeholders.from,
77986             fromName: displayName(datum2.from.way, vgraph),
77987             to: placeholders.to,
77988             toName: displayName(datum2.to.way, vgraph)
77989           }));
77990           if (datum2.via.ways && datum2.via.ways.length) {
77991             var names = [];
77992             for (var i4 = 0; i4 < datum2.via.ways.length; i4++) {
77993               var prev = names[names.length - 1];
77994               var curr = displayName(datum2.via.ways[i4], vgraph);
77995               if (!prev || curr !== prev) {
77996                 names.push(curr);
77997               }
77998             }
77999             help.append("div").html(_t.html("restriction.help.via_names", {
78000               via: placeholders.via,
78001               viaNames: names.join(", ")
78002             }));
78003           }
78004           if (!indirect) {
78005             help.append("div").html(_t.html("restriction.help.toggle", { turn: { html: nextText.trim() } }));
78006           }
78007           highlightPathsFrom(null);
78008           var alongIDs = datum2.path.slice();
78009           surface.selectAll(utilEntitySelector(alongIDs)).classed("related", true).classed("allow", klass === "allow").classed("restrict", klass === "restrict").classed("only", klass === "only");
78010         } else {
78011           highlightPathsFrom(null);
78012           if (_fromWayID) {
78013             help.append("div").html(_t.html("restriction.help.from_name", {
78014               from: placeholders.from,
78015               fromName: displayName(_fromWayID, vgraph)
78016             }));
78017           } else {
78018             help.append("div").html(_t.html("restriction.help.select_from", {
78019               from: placeholders.from
78020             }));
78021           }
78022         }
78023       }
78024     }
78025     function displayMaxDistance(maxDist) {
78026       return (selection2) => {
78027         var isImperial = !_mainLocalizer.usesMetric();
78028         var opts;
78029         if (isImperial) {
78030           var distToFeet = {
78031             // imprecise conversion for prettier display
78032             20: 70,
78033             25: 85,
78034             30: 100,
78035             35: 115,
78036             40: 130,
78037             45: 145,
78038             50: 160
78039           }[maxDist];
78040           opts = { distance: _t("units.feet", { quantity: distToFeet }) };
78041         } else {
78042           opts = { distance: _t("units.meters", { quantity: maxDist }) };
78043         }
78044         return selection2.html("").call(_t.append("restriction.controls.distance_up_to", opts));
78045       };
78046     }
78047     function displayMaxVia(maxVia) {
78048       return (selection2) => {
78049         selection2 = selection2.html("");
78050         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"));
78051       };
78052     }
78053     function displayName(entityID, graph) {
78054       var entity = graph.entity(entityID);
78055       var name = utilDisplayName(entity) || "";
78056       var matched = _mainPresetIndex.match(entity, graph);
78057       var type2 = matched && matched.name() || utilDisplayType(entity.id);
78058       return name || type2;
78059     }
78060     restrictions.entityIDs = function(val) {
78061       _intersection = null;
78062       _fromWayID = null;
78063       _oldTurns = null;
78064       _vertexID = val[0];
78065     };
78066     restrictions.tags = function() {
78067     };
78068     restrictions.focus = function() {
78069     };
78070     restrictions.off = function(selection2) {
78071       if (!_initialized3) return;
78072       selection2.selectAll(".surface").call(breathe.off).on("click.restrictions", null).on("mouseover.restrictions", null);
78073       select_default2(window).on("resize.restrictions", null);
78074     };
78075     return utilRebind(restrictions, dispatch14, "on");
78076   }
78077   var init_restrictions = __esm({
78078     "modules/ui/fields/restrictions.js"() {
78079       "use strict";
78080       init_src4();
78081       init_src5();
78082       init_presets();
78083       init_preferences();
78084       init_localizer();
78085       init_restrict_turn();
78086       init_unrestrict_turn();
78087       init_breathe();
78088       init_geo2();
78089       init_osm();
78090       init_svg();
78091       init_util();
78092       init_dimensions();
78093       uiFieldRestrictions.supportsMultiselection = false;
78094     }
78095   });
78096
78097   // modules/ui/fields/textarea.js
78098   var textarea_exports = {};
78099   __export(textarea_exports, {
78100     uiFieldTextarea: () => uiFieldTextarea
78101   });
78102   function uiFieldTextarea(field, context) {
78103     var dispatch14 = dispatch_default("change");
78104     var input = select_default2(null);
78105     var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue()).silent(field.usage === "changeset" && field.key === "comment");
78106     var _tags;
78107     function textarea(selection2) {
78108       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
78109       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).style("position", "relative").merge(wrap2);
78110       input = wrap2.selectAll("textarea").data([0]);
78111       input = input.enter().append("textarea").attr("id", field.domId).call(utilNoAuto).on("input", change(true)).on("blur", change()).on("change", change()).merge(input);
78112       wrap2.call(_lengthIndicator);
78113       function change(onInput) {
78114         return function() {
78115           var val = utilGetSetValue(input);
78116           if (!onInput) val = context.cleanTagValue(val);
78117           if (!val && Array.isArray(_tags[field.key])) return;
78118           var t2 = {};
78119           t2[field.key] = val || void 0;
78120           dispatch14.call("change", this, t2, onInput);
78121         };
78122       }
78123     }
78124     textarea.tags = function(tags) {
78125       _tags = tags;
78126       var isMixed = Array.isArray(tags[field.key]);
78127       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);
78128       if (!isMixed) {
78129         _lengthIndicator.update(tags[field.key]);
78130       }
78131     };
78132     textarea.focus = function() {
78133       input.node().focus();
78134     };
78135     return utilRebind(textarea, dispatch14, "on");
78136   }
78137   var init_textarea = __esm({
78138     "modules/ui/fields/textarea.js"() {
78139       "use strict";
78140       init_src4();
78141       init_src5();
78142       init_localizer();
78143       init_util();
78144       init_ui();
78145     }
78146   });
78147
78148   // modules/ui/fields/wikidata.js
78149   var wikidata_exports = {};
78150   __export(wikidata_exports, {
78151     uiFieldWikidata: () => uiFieldWikidata
78152   });
78153   function uiFieldWikidata(field, context) {
78154     var wikidata = services.wikidata;
78155     var dispatch14 = dispatch_default("change");
78156     var _selection = select_default2(null);
78157     var _searchInput = select_default2(null);
78158     var _qid = null;
78159     var _wikidataEntity = null;
78160     var _wikiURL = "";
78161     var _entityIDs = [];
78162     var _wikipediaKey = field.keys && field.keys.find(function(key) {
78163       return key.includes("wikipedia");
78164     });
78165     var _hintKey = field.key === "wikidata" ? "name" : field.key.split(":")[0];
78166     var combobox = uiCombobox(context, "combo-" + field.safeid).caseSensitive(true).minItems(1);
78167     function wiki(selection2) {
78168       _selection = selection2;
78169       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
78170       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
78171       var list2 = wrap2.selectAll("ul").data([0]);
78172       list2 = list2.enter().append("ul").attr("class", "rows").merge(list2);
78173       var searchRow = list2.selectAll("li.wikidata-search").data([0]);
78174       var searchRowEnter = searchRow.enter().append("li").attr("class", "wikidata-search");
78175       searchRowEnter.append("input").attr("type", "text").attr("id", field.domId).style("flex", "1").call(utilNoAuto).on("focus", function() {
78176         var node = select_default2(this).node();
78177         node.setSelectionRange(0, node.value.length);
78178       }).on("blur", function() {
78179         setLabelForEntity();
78180       }).call(combobox.fetcher(fetchWikidataItems));
78181       combobox.on("accept", function(d2) {
78182         if (d2) {
78183           _qid = d2.id;
78184           change();
78185         }
78186       }).on("cancel", function() {
78187         setLabelForEntity();
78188       });
78189       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) {
78190         d3_event.preventDefault();
78191         if (_wikiURL) window.open(_wikiURL, "_blank");
78192       });
78193       searchRow = searchRow.merge(searchRowEnter);
78194       _searchInput = searchRow.select("input");
78195       var wikidataProperties = ["description", "identifier"];
78196       var items = list2.selectAll("li.labeled-input").data(wikidataProperties);
78197       var enter = items.enter().append("li").attr("class", function(d2) {
78198         return "labeled-input preset-wikidata-" + d2;
78199       });
78200       enter.append("div").attr("class", "label").html(function(d2) {
78201         return _t.html("wikidata." + d2);
78202       });
78203       enter.append("input").attr("type", "text").call(utilNoAuto).classed("disabled", "true").attr("readonly", "true");
78204       enter.append("button").attr("class", "form-field-button").attr("title", _t("icons.copy")).call(svgIcon("#iD-operation-copy")).on("click", function(d3_event) {
78205         d3_event.preventDefault();
78206         select_default2(this.parentNode).select("input").node().select();
78207         document.execCommand("copy");
78208       });
78209     }
78210     function fetchWikidataItems(q2, callback) {
78211       if (!q2 && _hintKey) {
78212         for (var i3 in _entityIDs) {
78213           var entity = context.hasEntity(_entityIDs[i3]);
78214           if (entity.tags[_hintKey]) {
78215             q2 = entity.tags[_hintKey];
78216             break;
78217           }
78218         }
78219       }
78220       wikidata.itemsForSearchQuery(q2, function(err, data) {
78221         if (err) {
78222           if (err !== "No query") console.error(err);
78223           return;
78224         }
78225         var result = data.map(function(item) {
78226           return {
78227             id: item.id,
78228             value: item.display.label.value + " (" + item.id + ")",
78229             display: (selection2) => selection2.append("span").attr("class", "localized-text").attr("lang", item.display.label.language).text(item.display.label.value),
78230             title: item.display.description && item.display.description.value,
78231             terms: item.aliases
78232           };
78233         });
78234         if (callback) callback(result);
78235       });
78236     }
78237     function change() {
78238       var syncTags = {};
78239       syncTags[field.key] = _qid;
78240       dispatch14.call("change", this, syncTags);
78241       var initGraph = context.graph();
78242       var initEntityIDs = _entityIDs;
78243       wikidata.entityByQID(_qid, function(err, entity) {
78244         if (err) return;
78245         if (context.graph() !== initGraph) return;
78246         if (!entity.sitelinks) return;
78247         var langs = wikidata.languagesToQuery();
78248         ["labels", "descriptions"].forEach(function(key) {
78249           if (!entity[key]) return;
78250           var valueLangs = Object.keys(entity[key]);
78251           if (valueLangs.length === 0) return;
78252           var valueLang = valueLangs[0];
78253           if (langs.indexOf(valueLang) === -1) {
78254             langs.push(valueLang);
78255           }
78256         });
78257         var newWikipediaValue;
78258         if (_wikipediaKey) {
78259           var foundPreferred;
78260           for (var i3 in langs) {
78261             var lang = langs[i3];
78262             var siteID = lang.replace("-", "_") + "wiki";
78263             if (entity.sitelinks[siteID]) {
78264               foundPreferred = true;
78265               newWikipediaValue = lang + ":" + entity.sitelinks[siteID].title;
78266               break;
78267             }
78268           }
78269           if (!foundPreferred) {
78270             var wikiSiteKeys = Object.keys(entity.sitelinks).filter(function(site) {
78271               return site.endsWith("wiki");
78272             });
78273             if (wikiSiteKeys.length === 0) {
78274               newWikipediaValue = null;
78275             } else {
78276               var wikiLang = wikiSiteKeys[0].slice(0, -4).replace("_", "-");
78277               var wikiTitle = entity.sitelinks[wikiSiteKeys[0]].title;
78278               newWikipediaValue = wikiLang + ":" + wikiTitle;
78279             }
78280           }
78281         }
78282         if (newWikipediaValue) {
78283           newWikipediaValue = context.cleanTagValue(newWikipediaValue);
78284         }
78285         if (typeof newWikipediaValue === "undefined") return;
78286         var actions = initEntityIDs.map(function(entityID) {
78287           var entity2 = context.hasEntity(entityID);
78288           if (!entity2) return null;
78289           var currTags = Object.assign({}, entity2.tags);
78290           if (newWikipediaValue === null) {
78291             if (!currTags[_wikipediaKey]) return null;
78292             delete currTags[_wikipediaKey];
78293           } else {
78294             currTags[_wikipediaKey] = newWikipediaValue;
78295           }
78296           return actionChangeTags(entityID, currTags);
78297         }).filter(Boolean);
78298         if (!actions.length) return;
78299         context.overwrite(
78300           function actionUpdateWikipediaTags(graph) {
78301             actions.forEach(function(action) {
78302               graph = action(graph);
78303             });
78304             return graph;
78305           },
78306           context.history().undoAnnotation()
78307         );
78308       });
78309     }
78310     function setLabelForEntity() {
78311       var label = {
78312         value: ""
78313       };
78314       if (_wikidataEntity) {
78315         label = entityPropertyForDisplay(_wikidataEntity, "labels");
78316         if (label.value.length === 0) {
78317           label.value = _wikidataEntity.id.toString();
78318         }
78319       }
78320       utilGetSetValue(_searchInput, label.value).attr("lang", label.language);
78321     }
78322     wiki.tags = function(tags) {
78323       var isMixed = Array.isArray(tags[field.key]);
78324       _searchInput.attr("title", isMixed ? tags[field.key].filter(Boolean).join("\n") : null).attr("placeholder", isMixed ? _t("inspector.multiple_values") : "").classed("mixed", isMixed);
78325       _qid = typeof tags[field.key] === "string" && tags[field.key] || "";
78326       if (!/^Q[0-9]*$/.test(_qid)) {
78327         unrecognized();
78328         return;
78329       }
78330       _wikiURL = "https://wikidata.org/wiki/" + _qid;
78331       wikidata.entityByQID(_qid, function(err, entity) {
78332         if (err) {
78333           unrecognized();
78334           return;
78335         }
78336         _wikidataEntity = entity;
78337         setLabelForEntity();
78338         var description = entityPropertyForDisplay(entity, "descriptions");
78339         _selection.select("button.wiki-link").classed("disabled", false);
78340         _selection.select(".preset-wikidata-description").style("display", function() {
78341           return description.value.length > 0 ? "flex" : "none";
78342         }).select("input").attr("value", description.value).attr("lang", description.language);
78343         _selection.select(".preset-wikidata-identifier").style("display", function() {
78344           return entity.id ? "flex" : "none";
78345         }).select("input").attr("value", entity.id);
78346       });
78347       function unrecognized() {
78348         _wikidataEntity = null;
78349         setLabelForEntity();
78350         _selection.select(".preset-wikidata-description").style("display", "none");
78351         _selection.select(".preset-wikidata-identifier").style("display", "none");
78352         _selection.select("button.wiki-link").classed("disabled", true);
78353         if (_qid && _qid !== "") {
78354           _wikiURL = "https://wikidata.org/wiki/Special:Search?search=" + _qid;
78355         } else {
78356           _wikiURL = "";
78357         }
78358       }
78359     };
78360     function entityPropertyForDisplay(wikidataEntity, propKey) {
78361       var blankResponse = { value: "" };
78362       if (!wikidataEntity[propKey]) return blankResponse;
78363       var propObj = wikidataEntity[propKey];
78364       var langKeys = Object.keys(propObj);
78365       if (langKeys.length === 0) return blankResponse;
78366       var langs = wikidata.languagesToQuery();
78367       for (var i3 in langs) {
78368         var lang = langs[i3];
78369         var valueObj = propObj[lang];
78370         if (valueObj && valueObj.value && valueObj.value.length > 0) return valueObj;
78371       }
78372       return propObj[langKeys[0]];
78373     }
78374     wiki.entityIDs = function(val) {
78375       if (!arguments.length) return _entityIDs;
78376       _entityIDs = val;
78377       return wiki;
78378     };
78379     wiki.focus = function() {
78380       _searchInput.node().focus();
78381     };
78382     return utilRebind(wiki, dispatch14, "on");
78383   }
78384   var init_wikidata = __esm({
78385     "modules/ui/fields/wikidata.js"() {
78386       "use strict";
78387       init_src4();
78388       init_src5();
78389       init_change_tags();
78390       init_services();
78391       init_icon();
78392       init_util();
78393       init_combobox();
78394       init_localizer();
78395     }
78396   });
78397
78398   // modules/ui/fields/wikipedia.js
78399   var wikipedia_exports = {};
78400   __export(wikipedia_exports, {
78401     uiFieldWikipedia: () => uiFieldWikipedia
78402   });
78403   function uiFieldWikipedia(field, context) {
78404     const scheme = "https://";
78405     const domain = "wikipedia.org";
78406     const dispatch14 = dispatch_default("change");
78407     const wikipedia = services.wikipedia;
78408     const wikidata = services.wikidata;
78409     let _langInput = select_default2(null);
78410     let _titleInput = select_default2(null);
78411     let _wikiURL = "";
78412     let _entityIDs;
78413     let _tags;
78414     let _dataWikipedia = [];
78415     _mainFileFetcher.get("wmf_sitematrix").then((d2) => {
78416       _dataWikipedia = d2;
78417       if (_tags) updateForTags(_tags);
78418     }).catch(() => {
78419     });
78420     const langCombo = uiCombobox(context, "wikipedia-lang").fetcher((value, callback) => {
78421       const v2 = value.toLowerCase();
78422       callback(
78423         _dataWikipedia.filter((d2) => {
78424           return d2[0].toLowerCase().indexOf(v2) >= 0 || d2[1].toLowerCase().indexOf(v2) >= 0 || d2[2].toLowerCase().indexOf(v2) >= 0;
78425         }).map((d2) => ({ value: d2[1] }))
78426       );
78427     });
78428     const titleCombo = uiCombobox(context, "wikipedia-title").fetcher((value, callback) => {
78429       if (!value) {
78430         value = "";
78431         for (let i3 in _entityIDs) {
78432           let entity = context.hasEntity(_entityIDs[i3]);
78433           if (entity.tags.name) {
78434             value = entity.tags.name;
78435             break;
78436           }
78437         }
78438       }
78439       const searchfn = value.length > 7 ? wikipedia.search : wikipedia.suggestions;
78440       searchfn(language()[2], value, (query, data) => {
78441         callback(data.map((d2) => ({ value: d2 })));
78442       });
78443     });
78444     function wiki(selection2) {
78445       let wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
78446       wrap2 = wrap2.enter().append("div").attr("class", `form-field-input-wrap form-field-input-${field.type}`).merge(wrap2);
78447       let langContainer = wrap2.selectAll(".wiki-lang-container").data([0]);
78448       langContainer = langContainer.enter().append("div").attr("class", "wiki-lang-container").merge(langContainer);
78449       _langInput = langContainer.selectAll("input.wiki-lang").data([0]);
78450       _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);
78451       _langInput.on("blur", changeLang).on("change", changeLang);
78452       let titleContainer = wrap2.selectAll(".wiki-title-container").data([0]);
78453       titleContainer = titleContainer.enter().append("div").attr("class", "wiki-title-container").merge(titleContainer);
78454       _titleInput = titleContainer.selectAll("input.wiki-title").data([0]);
78455       _titleInput = _titleInput.enter().append("input").attr("type", "text").attr("class", "wiki-title").attr("id", field.domId).call(utilNoAuto).call(titleCombo).merge(_titleInput);
78456       _titleInput.on("blur", function() {
78457         change(true);
78458       }).on("change", function() {
78459         change(false);
78460       });
78461       let link3 = titleContainer.selectAll(".wiki-link").data([0]);
78462       link3 = link3.enter().append("button").attr("class", "form-field-button wiki-link").attr("title", _t("icons.view_on", { domain })).call(svgIcon("#iD-icon-out-link")).merge(link3);
78463       link3.on("click", (d3_event) => {
78464         d3_event.preventDefault();
78465         if (_wikiURL) window.open(_wikiURL, "_blank");
78466       });
78467     }
78468     function defaultLanguageInfo(skipEnglishFallback) {
78469       const langCode = _mainLocalizer.languageCode().toLowerCase();
78470       for (let i3 in _dataWikipedia) {
78471         let d2 = _dataWikipedia[i3];
78472         if (d2[2] === langCode) return d2;
78473       }
78474       return skipEnglishFallback ? ["", "", ""] : ["English", "English", "en"];
78475     }
78476     function language(skipEnglishFallback) {
78477       const value = utilGetSetValue(_langInput).toLowerCase();
78478       for (let i3 in _dataWikipedia) {
78479         let d2 = _dataWikipedia[i3];
78480         if (d2[0].toLowerCase() === value || d2[1].toLowerCase() === value || d2[2] === value) return d2;
78481       }
78482       return defaultLanguageInfo(skipEnglishFallback);
78483     }
78484     function changeLang() {
78485       utilGetSetValue(_langInput, language()[1]);
78486       change(true);
78487     }
78488     function change(skipWikidata) {
78489       let value = utilGetSetValue(_titleInput);
78490       const m2 = value.match(/https?:\/\/([-a-z]+)\.wikipedia\.org\/(?:wiki|\1-[-a-z]+)\/([^#]+)(?:#(.+))?/);
78491       const langInfo = m2 && _dataWikipedia.find((d2) => m2[1] === d2[2]);
78492       let syncTags = {};
78493       if (langInfo) {
78494         const nativeLangName = langInfo[1];
78495         value = decodeURIComponent(m2[2]).replace(/_/g, " ");
78496         if (m2[3]) {
78497           let anchor;
78498           anchor = decodeURIComponent(m2[3]);
78499           value += "#" + anchor.replace(/_/g, " ");
78500         }
78501         value = value.slice(0, 1).toUpperCase() + value.slice(1);
78502         utilGetSetValue(_langInput, nativeLangName).attr("lang", langInfo[2]);
78503         utilGetSetValue(_titleInput, value);
78504       }
78505       if (value) {
78506         syncTags.wikipedia = context.cleanTagValue(language()[2] + ":" + value);
78507       } else {
78508         syncTags.wikipedia = void 0;
78509       }
78510       dispatch14.call("change", this, syncTags);
78511       if (skipWikidata || !value || !language()[2]) return;
78512       const initGraph = context.graph();
78513       const initEntityIDs = _entityIDs;
78514       wikidata.itemsByTitle(language()[2], value, (err, data) => {
78515         if (err || !data || !Object.keys(data).length) return;
78516         if (context.graph() !== initGraph) return;
78517         const qids = Object.keys(data);
78518         const value2 = qids && qids.find((id2) => id2.match(/^Q\d+$/));
78519         let actions = initEntityIDs.map((entityID) => {
78520           let entity = context.entity(entityID).tags;
78521           let currTags = Object.assign({}, entity);
78522           if (currTags.wikidata !== value2) {
78523             currTags.wikidata = value2;
78524             return actionChangeTags(entityID, currTags);
78525           }
78526           return null;
78527         }).filter(Boolean);
78528         if (!actions.length) return;
78529         context.overwrite(
78530           function actionUpdateWikidataTags(graph) {
78531             actions.forEach(function(action) {
78532               graph = action(graph);
78533             });
78534             return graph;
78535           },
78536           context.history().undoAnnotation()
78537         );
78538       });
78539     }
78540     wiki.tags = (tags) => {
78541       _tags = tags;
78542       updateForTags(tags);
78543     };
78544     function updateForTags(tags) {
78545       const value = typeof tags[field.key] === "string" ? tags[field.key] : "";
78546       const m2 = value.match(/([^:]+):([^#]+)(?:#(.+))?/);
78547       const tagLang = m2 && m2[1];
78548       const tagArticleTitle = m2 && m2[2];
78549       let anchor = m2 && m2[3];
78550       const tagLangInfo = tagLang && _dataWikipedia.find((d2) => tagLang === d2[2]);
78551       if (tagLangInfo) {
78552         const nativeLangName = tagLangInfo[1];
78553         utilGetSetValue(_langInput, nativeLangName);
78554         _titleInput.attr("lang", tagLangInfo[2]);
78555         utilGetSetValue(_titleInput, tagArticleTitle + (anchor ? "#" + anchor : ""));
78556         _wikiURL = `${scheme}${tagLang}.${domain}/wiki/${wiki.encodePath(tagArticleTitle, anchor)}`;
78557       } else {
78558         utilGetSetValue(_titleInput, value);
78559         if (value && value !== "") {
78560           utilGetSetValue(_langInput, "");
78561           const defaultLangInfo = defaultLanguageInfo();
78562           _wikiURL = `${scheme}${defaultLangInfo[2]}.${domain}/w/index.php?fulltext=1&search=${value}`;
78563         } else {
78564           const shownOrDefaultLangInfo = language(
78565             true
78566             /* skipEnglishFallback */
78567           );
78568           utilGetSetValue(_langInput, shownOrDefaultLangInfo[1]);
78569           _wikiURL = "";
78570         }
78571       }
78572     }
78573     wiki.encodePath = (tagArticleTitle, anchor) => {
78574       const underscoredTitle = tagArticleTitle.replace(/ /g, "_");
78575       const uriEncodedUnderscoredTitle = encodeURIComponent(underscoredTitle);
78576       const uriEncodedAnchorFragment = wiki.encodeURIAnchorFragment(anchor);
78577       return `${uriEncodedUnderscoredTitle}${uriEncodedAnchorFragment}`;
78578     };
78579     wiki.encodeURIAnchorFragment = (anchor) => {
78580       if (!anchor) return "";
78581       const underscoredAnchor = anchor.replace(/ /g, "_");
78582       return "#" + encodeURIComponent(underscoredAnchor);
78583     };
78584     wiki.entityIDs = (val) => {
78585       if (!arguments.length) return _entityIDs;
78586       _entityIDs = val;
78587       return wiki;
78588     };
78589     wiki.focus = () => {
78590       _titleInput.node().focus();
78591     };
78592     return utilRebind(wiki, dispatch14, "on");
78593   }
78594   var init_wikipedia = __esm({
78595     "modules/ui/fields/wikipedia.js"() {
78596       "use strict";
78597       init_src4();
78598       init_src5();
78599       init_file_fetcher();
78600       init_localizer();
78601       init_change_tags();
78602       init_services();
78603       init_icon();
78604       init_combobox();
78605       init_util();
78606       uiFieldWikipedia.supportsMultiselection = false;
78607     }
78608   });
78609
78610   // modules/ui/fields/index.js
78611   var fields_exports = {};
78612   __export(fields_exports, {
78613     LANGUAGE_SUFFIX_REGEX: () => LANGUAGE_SUFFIX_REGEX,
78614     likelyRawNumberFormat: () => likelyRawNumberFormat,
78615     uiFieldAccess: () => uiFieldAccess,
78616     uiFieldAddress: () => uiFieldAddress,
78617     uiFieldCheck: () => uiFieldCheck,
78618     uiFieldColour: () => uiFieldText,
78619     uiFieldCombo: () => uiFieldCombo,
78620     uiFieldDefaultCheck: () => uiFieldCheck,
78621     uiFieldDirectionalCombo: () => uiFieldDirectionalCombo,
78622     uiFieldEmail: () => uiFieldText,
78623     uiFieldIdentifier: () => uiFieldText,
78624     uiFieldLanes: () => uiFieldLanes,
78625     uiFieldLocalized: () => uiFieldLocalized,
78626     uiFieldManyCombo: () => uiFieldCombo,
78627     uiFieldMultiCombo: () => uiFieldCombo,
78628     uiFieldNetworkCombo: () => uiFieldCombo,
78629     uiFieldNumber: () => uiFieldText,
78630     uiFieldOnewayCheck: () => uiFieldCheck,
78631     uiFieldRadio: () => uiFieldRadio,
78632     uiFieldRestrictions: () => uiFieldRestrictions,
78633     uiFieldRoadheight: () => uiFieldRoadheight,
78634     uiFieldRoadspeed: () => uiFieldRoadspeed,
78635     uiFieldSemiCombo: () => uiFieldCombo,
78636     uiFieldStructureRadio: () => uiFieldRadio,
78637     uiFieldTel: () => uiFieldText,
78638     uiFieldText: () => uiFieldText,
78639     uiFieldTextarea: () => uiFieldTextarea,
78640     uiFieldTypeCombo: () => uiFieldCombo,
78641     uiFieldUrl: () => uiFieldText,
78642     uiFieldWikidata: () => uiFieldWikidata,
78643     uiFieldWikipedia: () => uiFieldWikipedia,
78644     uiFields: () => uiFields
78645   });
78646   var uiFields;
78647   var init_fields = __esm({
78648     "modules/ui/fields/index.js"() {
78649       "use strict";
78650       init_check();
78651       init_combo();
78652       init_input();
78653       init_access();
78654       init_address();
78655       init_directional_combo();
78656       init_lanes2();
78657       init_localized();
78658       init_roadheight();
78659       init_roadspeed();
78660       init_radio();
78661       init_restrictions();
78662       init_textarea();
78663       init_wikidata();
78664       init_wikipedia();
78665       init_check();
78666       init_combo();
78667       init_input();
78668       init_radio();
78669       init_access();
78670       init_address();
78671       init_directional_combo();
78672       init_lanes2();
78673       init_localized();
78674       init_roadheight();
78675       init_roadspeed();
78676       init_restrictions();
78677       init_textarea();
78678       init_wikidata();
78679       init_wikipedia();
78680       uiFields = {
78681         access: uiFieldAccess,
78682         address: uiFieldAddress,
78683         check: uiFieldCheck,
78684         colour: uiFieldText,
78685         combo: uiFieldCombo,
78686         cycleway: uiFieldDirectionalCombo,
78687         date: uiFieldText,
78688         defaultCheck: uiFieldCheck,
78689         directionalCombo: uiFieldDirectionalCombo,
78690         email: uiFieldText,
78691         identifier: uiFieldText,
78692         lanes: uiFieldLanes,
78693         localized: uiFieldLocalized,
78694         roadheight: uiFieldRoadheight,
78695         roadspeed: uiFieldRoadspeed,
78696         manyCombo: uiFieldCombo,
78697         multiCombo: uiFieldCombo,
78698         networkCombo: uiFieldCombo,
78699         number: uiFieldText,
78700         onewayCheck: uiFieldCheck,
78701         radio: uiFieldRadio,
78702         restrictions: uiFieldRestrictions,
78703         semiCombo: uiFieldCombo,
78704         structureRadio: uiFieldRadio,
78705         tel: uiFieldText,
78706         text: uiFieldText,
78707         textarea: uiFieldTextarea,
78708         typeCombo: uiFieldCombo,
78709         url: uiFieldText,
78710         wikidata: uiFieldWikidata,
78711         wikipedia: uiFieldWikipedia
78712       };
78713     }
78714   });
78715
78716   // modules/ui/field.js
78717   var field_exports2 = {};
78718   __export(field_exports2, {
78719     uiField: () => uiField
78720   });
78721   function uiField(context, presetField2, entityIDs, options2) {
78722     options2 = Object.assign({
78723       show: true,
78724       wrap: true,
78725       remove: true,
78726       revert: true,
78727       info: true
78728     }, options2);
78729     var dispatch14 = dispatch_default("change", "revert");
78730     var field = Object.assign({}, presetField2);
78731     field.domId = utilUniqueDomId("form-field-" + field.safeid);
78732     var _show = options2.show;
78733     var _state = "";
78734     var _tags = {};
78735     var _entityExtent;
78736     if (entityIDs && entityIDs.length) {
78737       _entityExtent = entityIDs.reduce(function(extent, entityID) {
78738         var entity = context.graph().entity(entityID);
78739         return extent.extend(entity.extent(context.graph()));
78740       }, geoExtent());
78741     }
78742     var _locked = false;
78743     var _lockedTip = uiTooltip().title(() => _t.append("inspector.lock.suggestion", { label: field.title })).placement("bottom");
78744     if (_show && !field.impl) {
78745       createField();
78746     }
78747     function createField() {
78748       field.impl = uiFields[field.type](field, context).on("change", function(t2, onInput) {
78749         dispatch14.call("change", field, t2, onInput);
78750       });
78751       if (entityIDs) {
78752         field.entityIDs = entityIDs;
78753         if (field.impl.entityIDs) {
78754           field.impl.entityIDs(entityIDs);
78755         }
78756       }
78757     }
78758     function allKeys() {
78759       let keys2 = field.keys || [field.key];
78760       if (field.type === "directionalCombo" && field.key) {
78761         const baseKey = field.key.replace(/:both$/, "");
78762         keys2 = keys2.concat(baseKey, `${baseKey}:both`);
78763       }
78764       return keys2;
78765     }
78766     function isModified() {
78767       if (!entityIDs || !entityIDs.length) return false;
78768       return entityIDs.some(function(entityID) {
78769         var original = context.graph().base().entities[entityID];
78770         var latest = context.graph().entity(entityID);
78771         return allKeys().some(function(key) {
78772           return original ? latest.tags[key] !== original.tags[key] : latest.tags[key];
78773         });
78774       });
78775     }
78776     function tagsContainFieldKey() {
78777       return allKeys().some(function(key) {
78778         if (field.type === "multiCombo") {
78779           for (var tagKey in _tags) {
78780             if (tagKey.indexOf(key) === 0) {
78781               return true;
78782             }
78783           }
78784           return false;
78785         }
78786         if (field.type === "localized") {
78787           for (let tagKey2 in _tags) {
78788             let match = tagKey2.match(LANGUAGE_SUFFIX_REGEX);
78789             if (match && match[1] === field.key && match[2]) {
78790               return true;
78791             }
78792           }
78793         }
78794         return _tags[key] !== void 0;
78795       });
78796     }
78797     function revert(d3_event, d2) {
78798       d3_event.stopPropagation();
78799       d3_event.preventDefault();
78800       if (!entityIDs || _locked) return;
78801       dispatch14.call("revert", d2, allKeys());
78802     }
78803     function remove2(d3_event, d2) {
78804       d3_event.stopPropagation();
78805       d3_event.preventDefault();
78806       if (_locked) return;
78807       var t2 = {};
78808       allKeys().forEach(function(key) {
78809         t2[key] = void 0;
78810       });
78811       dispatch14.call("change", d2, t2);
78812     }
78813     field.render = function(selection2) {
78814       var container = selection2.selectAll(".form-field").data([field]);
78815       var enter = container.enter().append("div").attr("class", function(d2) {
78816         return "form-field form-field-" + d2.safeid;
78817       }).classed("nowrap", !options2.wrap);
78818       if (options2.wrap) {
78819         var labelEnter = enter.append("label").attr("class", "field-label").attr("for", function(d2) {
78820           return d2.domId;
78821         });
78822         var textEnter = labelEnter.append("span").attr("class", "label-text");
78823         textEnter.append("span").attr("class", "label-textvalue").each(function(d2) {
78824           d2.label()(select_default2(this));
78825         });
78826         textEnter.append("span").attr("class", "label-textannotation");
78827         if (options2.remove) {
78828           labelEnter.append("button").attr("class", "remove-icon").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
78829         }
78830         if (options2.revert) {
78831           labelEnter.append("button").attr("class", "modified-icon").attr("title", _t("icons.undo")).call(svgIcon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-redo" : "#iD-icon-undo"));
78832         }
78833       }
78834       container = container.merge(enter);
78835       container.select(".field-label > .remove-icon").on("click", remove2);
78836       container.select(".field-label > .modified-icon").on("click", revert);
78837       container.each(function(d2) {
78838         var selection3 = select_default2(this);
78839         if (!d2.impl) {
78840           createField();
78841         }
78842         var reference, help;
78843         if (options2.wrap && field.type === "restrictions") {
78844           help = uiFieldHelp(context, "restrictions");
78845         }
78846         if (options2.wrap && options2.info) {
78847           var referenceKey = d2.key || "";
78848           if (d2.type === "multiCombo") {
78849             referenceKey = referenceKey.replace(/:$/, "");
78850           }
78851           var referenceOptions = d2.reference || {
78852             key: referenceKey,
78853             value: _tags[referenceKey]
78854           };
78855           reference = uiTagReference(referenceOptions, context);
78856           if (_state === "hover") {
78857             reference.showing(false);
78858           }
78859         }
78860         selection3.call(d2.impl);
78861         if (help) {
78862           selection3.call(help.body).select(".field-label").call(help.button);
78863         }
78864         if (reference) {
78865           selection3.call(reference.body).select(".field-label").call(reference.button);
78866         }
78867         d2.impl.tags(_tags);
78868       });
78869       container.classed("locked", _locked).classed("modified", isModified()).classed("present", tagsContainFieldKey());
78870       var annotation = container.selectAll(".field-label .label-textannotation");
78871       var icon2 = annotation.selectAll(".icon").data(_locked ? [0] : []);
78872       icon2.exit().remove();
78873       icon2.enter().append("svg").attr("class", "icon").append("use").attr("xlink:href", "#fas-lock");
78874       container.call(_locked ? _lockedTip : _lockedTip.destroy);
78875     };
78876     field.state = function(val) {
78877       if (!arguments.length) return _state;
78878       _state = val;
78879       return field;
78880     };
78881     field.tags = function(val) {
78882       if (!arguments.length) return _tags;
78883       _tags = val;
78884       if (tagsContainFieldKey() && !_show) {
78885         _show = true;
78886         if (!field.impl) {
78887           createField();
78888         }
78889       }
78890       return field;
78891     };
78892     field.locked = function(val) {
78893       if (!arguments.length) return _locked;
78894       _locked = val;
78895       return field;
78896     };
78897     field.show = function() {
78898       _show = true;
78899       if (!field.impl) {
78900         createField();
78901       }
78902       if (field.default && field.key && _tags[field.key] !== field.default) {
78903         var t2 = {};
78904         t2[field.key] = field.default;
78905         dispatch14.call("change", this, t2);
78906       }
78907     };
78908     field.isShown = function() {
78909       return _show;
78910     };
78911     field.isAllowed = function() {
78912       if (entityIDs && entityIDs.length > 1 && uiFields[field.type].supportsMultiselection === false) return false;
78913       if (field.geometry && !entityIDs.every(function(entityID) {
78914         return field.matchGeometry(context.graph().geometry(entityID));
78915       })) return false;
78916       if (entityIDs && _entityExtent && field.locationSetID) {
78917         var validHere = _sharedLocationManager.locationSetsAt(_entityExtent.center());
78918         if (!validHere[field.locationSetID]) return false;
78919       }
78920       var prerequisiteTag = field.prerequisiteTag;
78921       if (entityIDs && !tagsContainFieldKey() && // ignore tagging prerequisites if a value is already present
78922       prerequisiteTag) {
78923         if (!entityIDs.every(function(entityID) {
78924           var entity = context.graph().entity(entityID);
78925           if (prerequisiteTag.key) {
78926             var value = entity.tags[prerequisiteTag.key];
78927             if (!value) return false;
78928             if (prerequisiteTag.valueNot) {
78929               return prerequisiteTag.valueNot !== value;
78930             }
78931             if (prerequisiteTag.value) {
78932               return prerequisiteTag.value === value;
78933             }
78934           } else if (prerequisiteTag.keyNot) {
78935             if (entity.tags[prerequisiteTag.keyNot]) return false;
78936           }
78937           return true;
78938         })) return false;
78939       }
78940       return true;
78941     };
78942     field.focus = function() {
78943       if (field.impl) {
78944         field.impl.focus();
78945       }
78946     };
78947     return utilRebind(field, dispatch14, "on");
78948   }
78949   var init_field2 = __esm({
78950     "modules/ui/field.js"() {
78951       "use strict";
78952       init_src4();
78953       init_src5();
78954       init_localizer();
78955       init_LocationManager();
78956       init_icon();
78957       init_tooltip();
78958       init_extent();
78959       init_field_help();
78960       init_fields();
78961       init_localized();
78962       init_tag_reference();
78963       init_util();
78964     }
78965   });
78966
78967   // modules/ui/changeset_editor.js
78968   var changeset_editor_exports = {};
78969   __export(changeset_editor_exports, {
78970     uiChangesetEditor: () => uiChangesetEditor
78971   });
78972   function uiChangesetEditor(context) {
78973     var dispatch14 = dispatch_default("change");
78974     var formFields = uiFormFields(context);
78975     var commentCombo = uiCombobox(context, "comment").caseSensitive(true);
78976     var _fieldsArr;
78977     var _tags;
78978     var _changesetID;
78979     function changesetEditor(selection2) {
78980       render(selection2);
78981     }
78982     function render(selection2) {
78983       var _a3;
78984       var initial = false;
78985       if (!_fieldsArr) {
78986         initial = true;
78987         var presets = _mainPresetIndex;
78988         _fieldsArr = [
78989           uiField(context, presets.field("comment"), null, { show: true, revert: false }),
78990           uiField(context, presets.field("source"), null, { show: true, revert: false }),
78991           uiField(context, presets.field("hashtags"), null, { show: false, revert: false })
78992         ];
78993         _fieldsArr.forEach(function(field) {
78994           field.on("change", function(t2, onInput) {
78995             dispatch14.call("change", field, void 0, t2, onInput);
78996           });
78997         });
78998       }
78999       _fieldsArr.forEach(function(field) {
79000         field.tags(_tags);
79001       });
79002       selection2.call(formFields.fieldsArr(_fieldsArr));
79003       if (initial) {
79004         var commentField = selection2.select(".form-field-comment textarea");
79005         const sourceField = _fieldsArr.find((field) => field.id === "source");
79006         var commentNode = commentField.node();
79007         if (commentNode) {
79008           commentNode.focus();
79009           commentNode.select();
79010         }
79011         utilTriggerEvent(commentField, "blur");
79012         var osm = context.connection();
79013         if (osm) {
79014           osm.userChangesets(function(err, changesets) {
79015             if (err) return;
79016             var comments = changesets.map(function(changeset) {
79017               var comment = changeset.tags.comment;
79018               return comment ? { title: comment, value: comment } : null;
79019             }).filter(Boolean);
79020             commentField.call(
79021               commentCombo.data(utilArrayUniqBy(comments, "title"))
79022             );
79023             const recentSources = changesets.flatMap((changeset) => {
79024               var _a4;
79025               return (_a4 = changeset.tags.source) == null ? void 0 : _a4.split(";");
79026             }).filter((value) => !sourceField.options.includes(value)).filter(Boolean).map((title) => ({ title, value: title, klass: "raw-option" }));
79027             sourceField.impl.setCustomOptions(utilArrayUniqBy(recentSources, "title"));
79028           });
79029         }
79030       }
79031       const warnings = [];
79032       if ((_a3 = _tags.comment) == null ? void 0 : _a3.match(/google/i)) {
79033         warnings.push({
79034           id: 'contains "google"',
79035           msg: _t.append("commit.google_warning"),
79036           link: _t("commit.google_warning_link")
79037         });
79038       }
79039       const maxChars = context.maxCharsForTagValue();
79040       const strLen = utilUnicodeCharsCount(utilCleanOsmString(_tags.comment, Number.POSITIVE_INFINITY));
79041       if (strLen > maxChars || false) {
79042         warnings.push({
79043           id: "message too long",
79044           msg: _t.append("commit.changeset_comment_length_warning", { maxChars })
79045         });
79046       }
79047       var commentWarning = selection2.select(".form-field-comment").selectAll(".comment-warning").data(warnings, (d2) => d2.id);
79048       commentWarning.exit().transition().duration(200).style("opacity", 0).remove();
79049       var commentEnter = commentWarning.enter().insert("div", ".comment-warning").attr("class", "comment-warning field-warning").style("opacity", 0);
79050       commentEnter.call(svgIcon("#iD-icon-alert", "inline")).append("span");
79051       commentEnter.transition().duration(200).style("opacity", 1);
79052       commentWarning.merge(commentEnter).selectAll("div > span").text("").each(function(d2) {
79053         let selection3 = select_default2(this);
79054         if (d2.link) {
79055           selection3 = selection3.append("a").attr("target", "_blank").attr("href", d2.link);
79056         }
79057         selection3.call(d2.msg);
79058       });
79059     }
79060     changesetEditor.tags = function(_2) {
79061       if (!arguments.length) return _tags;
79062       _tags = _2;
79063       return changesetEditor;
79064     };
79065     changesetEditor.changesetID = function(_2) {
79066       if (!arguments.length) return _changesetID;
79067       if (_changesetID === _2) return changesetEditor;
79068       _changesetID = _2;
79069       _fieldsArr = null;
79070       return changesetEditor;
79071     };
79072     return utilRebind(changesetEditor, dispatch14, "on");
79073   }
79074   var init_changeset_editor = __esm({
79075     "modules/ui/changeset_editor.js"() {
79076       "use strict";
79077       init_src4();
79078       init_src5();
79079       init_presets();
79080       init_localizer();
79081       init_icon();
79082       init_combobox();
79083       init_field2();
79084       init_form_fields();
79085       init_util();
79086     }
79087   });
79088
79089   // modules/ui/sections/changes.js
79090   var changes_exports = {};
79091   __export(changes_exports, {
79092     uiSectionChanges: () => uiSectionChanges
79093   });
79094   function uiSectionChanges(context) {
79095     var _discardTags = {};
79096     _mainFileFetcher.get("discarded").then(function(d2) {
79097       _discardTags = d2;
79098     }).catch(function() {
79099     });
79100     var section = uiSection("changes-list", context).label(function() {
79101       var history = context.history();
79102       var summary = history.difference().summary();
79103       return _t.append("inspector.title_count", { title: _t("commit.changes"), count: summary.length });
79104     }).disclosureContent(renderDisclosureContent);
79105     function renderDisclosureContent(selection2) {
79106       var history = context.history();
79107       var summary = history.difference().summary();
79108       var container = selection2.selectAll(".commit-section").data([0]);
79109       var containerEnter = container.enter().append("div").attr("class", "commit-section");
79110       containerEnter.append("ul").attr("class", "changeset-list");
79111       container = containerEnter.merge(container);
79112       var items = container.select("ul").selectAll("li").data(summary);
79113       var itemsEnter = items.enter().append("li").attr("class", "change-item");
79114       var buttons = itemsEnter.append("button").on("mouseover", mouseover).on("mouseout", mouseout).on("click", click);
79115       buttons.each(function(d2) {
79116         select_default2(this).call(svgIcon("#iD-icon-" + d2.entity.geometry(d2.graph), "pre-text " + d2.changeType));
79117       });
79118       buttons.append("span").attr("class", "change-type").html(function(d2) {
79119         return _t.html("commit." + d2.changeType) + " ";
79120       });
79121       buttons.append("strong").attr("class", "entity-type").text(function(d2) {
79122         var matched = _mainPresetIndex.match(d2.entity, d2.graph);
79123         return matched && matched.name() || utilDisplayType(d2.entity.id);
79124       });
79125       buttons.append("span").attr("class", "entity-name").text(function(d2) {
79126         var name = utilDisplayName(d2.entity) || "", string = "";
79127         if (name !== "") {
79128           string += ":";
79129         }
79130         return string += " " + name;
79131       });
79132       items = itemsEnter.merge(items);
79133       var changeset = new osmChangeset().update({ id: void 0 });
79134       var changes = history.changes(actionDiscardTags(history.difference(), _discardTags));
79135       delete changeset.id;
79136       var data = JXON.stringify(changeset.osmChangeJXON(changes));
79137       var blob = new Blob([data], { type: "text/xml;charset=utf-8;" });
79138       var fileName = "changes.osc";
79139       var linkEnter = container.selectAll(".download-changes").data([0]).enter().append("a").attr("class", "download-changes");
79140       linkEnter.attr("href", window.URL.createObjectURL(blob)).attr("download", fileName);
79141       linkEnter.call(svgIcon("#iD-icon-load", "inline")).append("span").call(_t.append("commit.download_changes"));
79142       function mouseover(d2) {
79143         if (d2.entity) {
79144           context.surface().selectAll(
79145             utilEntityOrMemberSelector([d2.entity.id], context.graph())
79146           ).classed("hover", true);
79147         }
79148       }
79149       function mouseout() {
79150         context.surface().selectAll(".hover").classed("hover", false);
79151       }
79152       function click(d3_event, change) {
79153         if (change.changeType !== "deleted") {
79154           var entity = change.entity;
79155           context.map().zoomToEase(entity);
79156           context.surface().selectAll(utilEntityOrMemberSelector([entity.id], context.graph())).classed("hover", true);
79157         }
79158       }
79159     }
79160     return section;
79161   }
79162   var init_changes = __esm({
79163     "modules/ui/sections/changes.js"() {
79164       "use strict";
79165       init_src5();
79166       init_presets();
79167       init_file_fetcher();
79168       init_localizer();
79169       init_jxon();
79170       init_discard_tags();
79171       init_osm();
79172       init_icon();
79173       init_section();
79174       init_util();
79175     }
79176   });
79177
79178   // modules/ui/commit.js
79179   var commit_exports = {};
79180   __export(commit_exports, {
79181     uiCommit: () => uiCommit
79182   });
79183   function uiCommit(context) {
79184     var dispatch14 = dispatch_default("cancel");
79185     var _userDetails2;
79186     var _selection;
79187     var changesetEditor = uiChangesetEditor(context).on("change", changeTags);
79188     var rawTagEditor = uiSectionRawTagEditor("changeset-tag-editor", context).on("change", changeTags).readOnlyTags(readOnlyTags);
79189     var commitChanges = uiSectionChanges(context);
79190     var commitWarnings = uiCommitWarnings(context);
79191     function commit(selection2) {
79192       _selection = selection2;
79193       if (!context.changeset) initChangeset();
79194       loadDerivedChangesetTags();
79195       selection2.call(render);
79196     }
79197     function initChangeset() {
79198       var commentDate = +corePreferences("commentDate") || 0;
79199       var currDate = Date.now();
79200       var cutoff = 2 * 86400 * 1e3;
79201       if (commentDate > currDate || currDate - commentDate > cutoff) {
79202         corePreferences("comment", null);
79203         corePreferences("hashtags", null);
79204         corePreferences("source", null);
79205       }
79206       if (context.defaultChangesetComment()) {
79207         corePreferences("comment", context.defaultChangesetComment());
79208         corePreferences("commentDate", Date.now());
79209       }
79210       if (context.defaultChangesetSource()) {
79211         corePreferences("source", context.defaultChangesetSource());
79212         corePreferences("commentDate", Date.now());
79213       }
79214       if (context.defaultChangesetHashtags()) {
79215         corePreferences("hashtags", context.defaultChangesetHashtags());
79216         corePreferences("commentDate", Date.now());
79217       }
79218       var detected = utilDetect();
79219       var tags = {
79220         comment: corePreferences("comment") || "",
79221         created_by: context.cleanTagValue("iD " + context.version),
79222         host: context.cleanTagValue(detected.host),
79223         locale: context.cleanTagValue(_mainLocalizer.localeCode())
79224       };
79225       findHashtags(tags, true);
79226       var hashtags = corePreferences("hashtags");
79227       if (hashtags) {
79228         tags.hashtags = hashtags;
79229       }
79230       var source = corePreferences("source");
79231       if (source) {
79232         tags.source = source;
79233       }
79234       var photoOverlaysUsed = context.history().photoOverlaysUsed();
79235       if (photoOverlaysUsed.length) {
79236         var sources = (tags.source || "").split(";");
79237         if (sources.indexOf("streetlevel imagery") === -1) {
79238           sources.push("streetlevel imagery");
79239         }
79240         photoOverlaysUsed.forEach(function(photoOverlay) {
79241           if (sources.indexOf(photoOverlay) === -1) {
79242             sources.push(photoOverlay);
79243           }
79244         });
79245         tags.source = context.cleanTagValue(sources.filter(Boolean).join(";"));
79246       }
79247       context.changeset = new osmChangeset({ tags });
79248     }
79249     function loadDerivedChangesetTags() {
79250       var osm = context.connection();
79251       if (!osm) return;
79252       var tags = Object.assign({}, context.changeset.tags);
79253       var imageryUsed = context.cleanTagValue(context.history().imageryUsed().join(";"));
79254       tags.imagery_used = imageryUsed || "None";
79255       var osmClosed = osm.getClosedIDs();
79256       var itemType;
79257       if (osmClosed.length) {
79258         tags["closed:note"] = context.cleanTagValue(osmClosed.join(";"));
79259       }
79260       if (services.keepRight) {
79261         var krClosed = services.keepRight.getClosedIDs();
79262         if (krClosed.length) {
79263           tags["closed:keepright"] = context.cleanTagValue(krClosed.join(";"));
79264         }
79265       }
79266       if (services.osmose) {
79267         var osmoseClosed = services.osmose.getClosedCounts();
79268         for (itemType in osmoseClosed) {
79269           tags["closed:osmose:" + itemType] = context.cleanTagValue(osmoseClosed[itemType].toString());
79270         }
79271       }
79272       for (var key in tags) {
79273         if (key.match(/(^warnings:)|(^resolved:)/)) {
79274           delete tags[key];
79275         }
79276       }
79277       function addIssueCounts(issues, prefix) {
79278         var issuesByType = utilArrayGroupBy(issues, "type");
79279         for (var issueType in issuesByType) {
79280           var issuesOfType = issuesByType[issueType];
79281           if (issuesOfType[0].subtype) {
79282             var issuesBySubtype = utilArrayGroupBy(issuesOfType, "subtype");
79283             for (var issueSubtype in issuesBySubtype) {
79284               var issuesOfSubtype = issuesBySubtype[issueSubtype];
79285               tags[prefix + ":" + issueType + ":" + issueSubtype] = context.cleanTagValue(issuesOfSubtype.length.toString());
79286             }
79287           } else {
79288             tags[prefix + ":" + issueType] = context.cleanTagValue(issuesOfType.length.toString());
79289           }
79290         }
79291       }
79292       var warnings = context.validator().getIssuesBySeverity({ what: "edited", where: "all", includeIgnored: true, includeDisabledRules: true }).warning.filter(function(issue) {
79293         return issue.type !== "help_request";
79294       });
79295       addIssueCounts(warnings, "warnings");
79296       var resolvedIssues = context.validator().getResolvedIssues();
79297       addIssueCounts(resolvedIssues, "resolved");
79298       context.changeset = context.changeset.update({ tags });
79299     }
79300     function render(selection2) {
79301       var osm = context.connection();
79302       if (!osm) return;
79303       var header = selection2.selectAll(".header").data([0]);
79304       var headerTitle = header.enter().append("div").attr("class", "header fillL");
79305       headerTitle.append("div").append("h2").call(_t.append("commit.title"));
79306       headerTitle.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
79307         dispatch14.call("cancel", this);
79308       }).call(svgIcon("#iD-icon-close"));
79309       var body = selection2.selectAll(".body").data([0]);
79310       body = body.enter().append("div").attr("class", "body").merge(body);
79311       var changesetSection = body.selectAll(".changeset-editor").data([0]);
79312       changesetSection = changesetSection.enter().append("div").attr("class", "modal-section changeset-editor").merge(changesetSection);
79313       changesetSection.call(
79314         changesetEditor.changesetID(context.changeset.id).tags(context.changeset.tags)
79315       );
79316       body.call(commitWarnings);
79317       var saveSection = body.selectAll(".save-section").data([0]);
79318       saveSection = saveSection.enter().append("div").attr("class", "modal-section save-section fillL").merge(saveSection);
79319       var prose = saveSection.selectAll(".commit-info").data([0]);
79320       if (prose.enter().size()) {
79321         _userDetails2 = null;
79322       }
79323       prose = prose.enter().append("p").attr("class", "commit-info").call(_t.append("commit.upload_explanation")).merge(prose);
79324       osm.userDetails(function(err, user) {
79325         if (err) return;
79326         if (_userDetails2 === user) return;
79327         _userDetails2 = user;
79328         var userLink = select_default2(document.createElement("div"));
79329         if (user.image_url) {
79330           userLink.append("img").attr("src", user.image_url).attr("class", "icon pre-text user-icon");
79331         }
79332         userLink.append("a").attr("class", "user-info").text(user.display_name).attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
79333         prose.html(_t.html("commit.upload_explanation_with_user", { user: { html: userLink.html() } }));
79334       });
79335       var requestReview = saveSection.selectAll(".request-review").data([0]);
79336       var requestReviewEnter = requestReview.enter().append("div").attr("class", "request-review");
79337       var requestReviewDomId = utilUniqueDomId("commit-input-request-review");
79338       var labelEnter = requestReviewEnter.append("label").attr("for", requestReviewDomId);
79339       if (!labelEnter.empty()) {
79340         labelEnter.call(uiTooltip().title(() => _t.append("commit.request_review_info")).placement("top"));
79341       }
79342       labelEnter.append("input").attr("type", "checkbox").attr("id", requestReviewDomId);
79343       labelEnter.append("span").call(_t.append("commit.request_review"));
79344       requestReview = requestReview.merge(requestReviewEnter);
79345       var requestReviewInput = requestReview.selectAll("input").property("checked", isReviewRequested(context.changeset.tags)).on("change", toggleRequestReview);
79346       var buttonSection = saveSection.selectAll(".buttons").data([0]);
79347       var buttonEnter = buttonSection.enter().append("div").attr("class", "buttons fillL");
79348       buttonEnter.append("button").attr("class", "secondary-action button cancel-button").append("span").attr("class", "label").call(_t.append("commit.cancel"));
79349       var uploadButton = buttonEnter.append("button").attr("class", "action button save-button");
79350       uploadButton.append("span").attr("class", "label").call(_t.append("commit.save"));
79351       var uploadBlockerTooltipText = getUploadBlockerMessage();
79352       buttonSection = buttonSection.merge(buttonEnter);
79353       buttonSection.selectAll(".cancel-button").on("click.cancel", function() {
79354         dispatch14.call("cancel", this);
79355       });
79356       buttonSection.selectAll(".save-button").classed("disabled", uploadBlockerTooltipText !== null).on("click.save", function() {
79357         if (!select_default2(this).classed("disabled")) {
79358           this.blur();
79359           for (var key in context.changeset.tags) {
79360             if (!key) delete context.changeset.tags[key];
79361           }
79362           context.uploader().save(context.changeset);
79363         }
79364       });
79365       uiTooltip().destroyAny(buttonSection.selectAll(".save-button"));
79366       if (uploadBlockerTooltipText) {
79367         buttonSection.selectAll(".save-button").call(uiTooltip().title(() => uploadBlockerTooltipText).placement("top"));
79368       }
79369       var tagSection = body.selectAll(".tag-section.raw-tag-editor").data([0]);
79370       tagSection = tagSection.enter().append("div").attr("class", "modal-section tag-section raw-tag-editor").merge(tagSection);
79371       tagSection.call(
79372         rawTagEditor.tags(Object.assign({}, context.changeset.tags)).render
79373       );
79374       var changesSection = body.selectAll(".commit-changes-section").data([0]);
79375       changesSection = changesSection.enter().append("div").attr("class", "modal-section commit-changes-section").merge(changesSection);
79376       changesSection.call(commitChanges.render);
79377       function toggleRequestReview() {
79378         var rr = requestReviewInput.property("checked");
79379         updateChangeset({ review_requested: rr ? "yes" : void 0 });
79380         tagSection.call(
79381           rawTagEditor.tags(Object.assign({}, context.changeset.tags)).render
79382         );
79383       }
79384     }
79385     function getUploadBlockerMessage() {
79386       var errors = context.validator().getIssuesBySeverity({ what: "edited", where: "all" }).error;
79387       if (errors.length) {
79388         return _t.append("commit.outstanding_errors_message", { count: errors.length });
79389       } else {
79390         var hasChangesetComment = context.changeset && context.changeset.tags.comment && context.changeset.tags.comment.trim().length;
79391         if (!hasChangesetComment) {
79392           return _t.append("commit.comment_needed_message");
79393         }
79394       }
79395       return null;
79396     }
79397     function changeTags(_2, changed, onInput) {
79398       if (changed.hasOwnProperty("comment")) {
79399         if (!onInput) {
79400           corePreferences("comment", changed.comment);
79401           corePreferences("commentDate", Date.now());
79402         }
79403       }
79404       if (changed.hasOwnProperty("source")) {
79405         if (changed.source === void 0) {
79406           corePreferences("source", null);
79407         } else if (!onInput) {
79408           corePreferences("source", changed.source);
79409           corePreferences("commentDate", Date.now());
79410         }
79411       }
79412       updateChangeset(changed, onInput);
79413       if (_selection) {
79414         _selection.call(render);
79415       }
79416     }
79417     function findHashtags(tags, commentOnly) {
79418       var detectedHashtags = commentHashtags();
79419       if (detectedHashtags.length) {
79420         corePreferences("hashtags", null);
79421       }
79422       if (!detectedHashtags.length || !commentOnly) {
79423         detectedHashtags = detectedHashtags.concat(hashtagHashtags());
79424       }
79425       var allLowerCase = /* @__PURE__ */ new Set();
79426       return detectedHashtags.filter(function(hashtag) {
79427         var lowerCase = hashtag.toLowerCase();
79428         if (!allLowerCase.has(lowerCase)) {
79429           allLowerCase.add(lowerCase);
79430           return true;
79431         }
79432         return false;
79433       });
79434       function commentHashtags() {
79435         var matches = (tags.comment || "").replace(/http\S*/g, "").match(hashtagRegex);
79436         return matches || [];
79437       }
79438       function hashtagHashtags() {
79439         var matches = (tags.hashtags || "").split(/[,;\s]+/).map(function(s2) {
79440           if (s2[0] !== "#") {
79441             s2 = "#" + s2;
79442           }
79443           var matched = s2.match(hashtagRegex);
79444           return matched && matched[0];
79445         }).filter(Boolean);
79446         return matches || [];
79447       }
79448     }
79449     function isReviewRequested(tags) {
79450       var rr = tags.review_requested;
79451       if (rr === void 0) return false;
79452       rr = rr.trim().toLowerCase();
79453       return !(rr === "" || rr === "no");
79454     }
79455     function updateChangeset(changed, onInput) {
79456       var tags = Object.assign({}, context.changeset.tags);
79457       Object.keys(changed).forEach(function(k2) {
79458         var v2 = changed[k2];
79459         k2 = context.cleanTagKey(k2);
79460         if (readOnlyTags.indexOf(k2) !== -1) return;
79461         if (v2 === void 0) {
79462           delete tags[k2];
79463         } else if (onInput) {
79464           tags[k2] = v2;
79465         } else {
79466           tags[k2] = context.cleanTagValue(v2);
79467         }
79468       });
79469       if (!onInput) {
79470         var commentOnly = changed.hasOwnProperty("comment") && changed.comment !== "";
79471         var arr = findHashtags(tags, commentOnly);
79472         if (arr.length) {
79473           tags.hashtags = context.cleanTagValue(arr.join(";"));
79474           corePreferences("hashtags", tags.hashtags);
79475         } else {
79476           delete tags.hashtags;
79477           corePreferences("hashtags", null);
79478         }
79479       }
79480       if (_userDetails2 && _userDetails2.changesets_count !== void 0) {
79481         var changesetsCount = parseInt(_userDetails2.changesets_count, 10) + 1;
79482         tags.changesets_count = String(changesetsCount);
79483         if (changesetsCount <= 100) {
79484           var s2;
79485           s2 = corePreferences("walkthrough_completed");
79486           if (s2) {
79487             tags["ideditor:walkthrough_completed"] = s2;
79488           }
79489           s2 = corePreferences("walkthrough_progress");
79490           if (s2) {
79491             tags["ideditor:walkthrough_progress"] = s2;
79492           }
79493           s2 = corePreferences("walkthrough_started");
79494           if (s2) {
79495             tags["ideditor:walkthrough_started"] = s2;
79496           }
79497         }
79498       } else {
79499         delete tags.changesets_count;
79500       }
79501       if (!(0, import_fast_deep_equal10.default)(context.changeset.tags, tags)) {
79502         context.changeset = context.changeset.update({ tags });
79503       }
79504     }
79505     commit.reset = function() {
79506       context.changeset = null;
79507     };
79508     return utilRebind(commit, dispatch14, "on");
79509   }
79510   var import_fast_deep_equal10, readOnlyTags, hashtagRegex;
79511   var init_commit = __esm({
79512     "modules/ui/commit.js"() {
79513       "use strict";
79514       init_src4();
79515       init_src5();
79516       import_fast_deep_equal10 = __toESM(require_fast_deep_equal());
79517       init_preferences();
79518       init_localizer();
79519       init_osm();
79520       init_icon();
79521       init_services();
79522       init_tooltip();
79523       init_changeset_editor();
79524       init_changes();
79525       init_commit_warnings();
79526       init_raw_tag_editor();
79527       init_util();
79528       init_detect();
79529       readOnlyTags = [
79530         /^changesets_count$/,
79531         /^created_by$/,
79532         /^ideditor:/,
79533         /^imagery_used$/,
79534         /^host$/,
79535         /^locale$/,
79536         /^warnings:/,
79537         /^resolved:/,
79538         /^closed:note$/,
79539         /^closed:keepright$/,
79540         /^closed:osmose:/
79541       ];
79542       hashtagRegex = /([##][^\u2000-\u206F\u2E00-\u2E7F\s\\'!"#$%()*,.\/:;<=>?@\[\]^`{|}~]+)/g;
79543     }
79544   });
79545
79546   // modules/modes/save.js
79547   var save_exports2 = {};
79548   __export(save_exports2, {
79549     modeSave: () => modeSave
79550   });
79551   function modeSave(context) {
79552     var mode = { id: "save" };
79553     var keybinding = utilKeybinding("modeSave");
79554     var commit = uiCommit(context).on("cancel", cancel);
79555     var _conflictsUi;
79556     var _location;
79557     var _success;
79558     var uploader = context.uploader().on("saveStarted.modeSave", function() {
79559       keybindingOff();
79560     }).on("willAttemptUpload.modeSave", prepareForSuccess).on("progressChanged.modeSave", showProgress).on("resultNoChanges.modeSave", function() {
79561       cancel();
79562     }).on("resultErrors.modeSave", showErrors).on("resultConflicts.modeSave", showConflicts).on("resultSuccess.modeSave", showSuccess);
79563     function cancel() {
79564       context.enter(modeBrowse(context));
79565     }
79566     function showProgress(num, total) {
79567       var modal = context.container().select(".loading-modal .modal-section");
79568       var progress = modal.selectAll(".progress").data([0]);
79569       progress.enter().append("div").attr("class", "progress").merge(progress).text(_t("save.conflict_progress", { num, total }));
79570     }
79571     function showConflicts(changeset, conflicts, origChanges) {
79572       var selection2 = context.container().select(".sidebar").append("div").attr("class", "sidebar-component");
79573       context.container().selectAll(".main-content").classed("active", true).classed("inactive", false);
79574       _conflictsUi = uiConflicts(context).conflictList(conflicts).origChanges(origChanges).on("cancel", function() {
79575         context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
79576         selection2.remove();
79577         keybindingOn();
79578         uploader.cancelConflictResolution();
79579       }).on("save", function() {
79580         context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
79581         selection2.remove();
79582         uploader.processResolvedConflicts(changeset);
79583       });
79584       selection2.call(_conflictsUi);
79585     }
79586     function showErrors(errors) {
79587       keybindingOn();
79588       var selection2 = uiConfirm(context.container());
79589       selection2.select(".modal-section.header").append("h3").text(_t("save.error"));
79590       addErrors(selection2, errors);
79591       selection2.okButton();
79592     }
79593     function addErrors(selection2, data) {
79594       var message = selection2.select(".modal-section.message-text");
79595       var items = message.selectAll(".error-container").data(data);
79596       var enter = items.enter().append("div").attr("class", "error-container");
79597       enter.append("a").attr("class", "error-description").attr("href", "#").classed("hide-toggle", true).text(function(d2) {
79598         return d2.msg || _t("save.unknown_error_details");
79599       }).on("click", function(d3_event) {
79600         d3_event.preventDefault();
79601         var error = select_default2(this);
79602         var detail = select_default2(this.nextElementSibling);
79603         var exp2 = error.classed("expanded");
79604         detail.style("display", exp2 ? "none" : "block");
79605         error.classed("expanded", !exp2);
79606       });
79607       var details = enter.append("div").attr("class", "error-detail-container").style("display", "none");
79608       details.append("ul").attr("class", "error-detail-list").selectAll("li").data(function(d2) {
79609         return d2.details || [];
79610       }).enter().append("li").attr("class", "error-detail-item").text(function(d2) {
79611         return d2;
79612       });
79613       items.exit().remove();
79614     }
79615     function showSuccess(changeset) {
79616       commit.reset();
79617       var ui = _success.changeset(changeset).location(_location).on("cancel", function() {
79618         context.ui().sidebar.hide();
79619       });
79620       context.enter(modeBrowse(context).sidebar(ui));
79621     }
79622     function keybindingOn() {
79623       select_default2(document).call(keybinding.on("\u238B", cancel, true));
79624     }
79625     function keybindingOff() {
79626       select_default2(document).call(keybinding.unbind);
79627     }
79628     function prepareForSuccess() {
79629       _success = uiSuccess(context);
79630       _location = null;
79631       if (!services.geocoder) return;
79632       services.geocoder.reverse(context.map().center(), function(err, result) {
79633         if (err || !result || !result.address) return;
79634         var addr = result.address;
79635         var place = addr && (addr.town || addr.city || addr.county) || "";
79636         var region = addr && (addr.state || addr.country) || "";
79637         var separator = place && region ? _t("success.thank_you_where.separator") : "";
79638         _location = _t(
79639           "success.thank_you_where.format",
79640           { place, separator, region }
79641         );
79642       });
79643     }
79644     mode.selectedIDs = function() {
79645       return _conflictsUi ? _conflictsUi.shownEntityIds() : [];
79646     };
79647     mode.enter = function() {
79648       context.ui().sidebar.expand();
79649       function done() {
79650         context.ui().sidebar.show(commit);
79651       }
79652       keybindingOn();
79653       context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
79654       var osm = context.connection();
79655       if (!osm) {
79656         cancel();
79657         return;
79658       }
79659       if (osm.authenticated()) {
79660         done();
79661       } else {
79662         osm.authenticate(function(err) {
79663           if (err) {
79664             cancel();
79665           } else {
79666             done();
79667           }
79668         });
79669       }
79670     };
79671     mode.exit = function() {
79672       keybindingOff();
79673       context.container().selectAll(".main-content").classed("active", true).classed("inactive", false);
79674       context.ui().sidebar.hide();
79675     };
79676     return mode;
79677   }
79678   var init_save2 = __esm({
79679     "modules/modes/save.js"() {
79680       "use strict";
79681       init_src5();
79682       init_localizer();
79683       init_browse();
79684       init_services();
79685       init_conflicts();
79686       init_confirm();
79687       init_commit();
79688       init_success();
79689       init_util();
79690     }
79691   });
79692
79693   // modules/modes/select_error.js
79694   var select_error_exports = {};
79695   __export(select_error_exports, {
79696     modeSelectError: () => modeSelectError
79697   });
79698   function modeSelectError(context, selectedErrorID, selectedErrorService) {
79699     var mode = {
79700       id: "select-error",
79701       button: "browse"
79702     };
79703     var keybinding = utilKeybinding("select-error");
79704     var errorService = services[selectedErrorService];
79705     var errorEditor;
79706     switch (selectedErrorService) {
79707       case "keepRight":
79708         errorEditor = uiKeepRightEditor(context).on("change", function() {
79709           context.map().pan([0, 0]);
79710           var error = checkSelectedID();
79711           if (!error) return;
79712           context.ui().sidebar.show(errorEditor.error(error));
79713         });
79714         break;
79715       case "osmose":
79716         errorEditor = uiOsmoseEditor(context).on("change", function() {
79717           context.map().pan([0, 0]);
79718           var error = checkSelectedID();
79719           if (!error) return;
79720           context.ui().sidebar.show(errorEditor.error(error));
79721         });
79722         break;
79723     }
79724     var behaviors = [
79725       behaviorBreathe(context),
79726       behaviorHover(context),
79727       behaviorSelect(context),
79728       behaviorLasso(context),
79729       modeDragNode(context).behavior,
79730       modeDragNote(context).behavior
79731     ];
79732     function checkSelectedID() {
79733       if (!errorService) return;
79734       var error = errorService.getError(selectedErrorID);
79735       if (!error) {
79736         context.enter(modeBrowse(context));
79737       }
79738       return error;
79739     }
79740     mode.zoomToSelected = function() {
79741       if (!errorService) return;
79742       var error = errorService.getError(selectedErrorID);
79743       if (error) {
79744         context.map().centerZoomEase(error.loc, 20);
79745       }
79746     };
79747     mode.enter = function() {
79748       var error = checkSelectedID();
79749       if (!error) return;
79750       behaviors.forEach(context.install);
79751       keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
79752       select_default2(document).call(keybinding);
79753       selectError();
79754       var sidebar = context.ui().sidebar;
79755       sidebar.show(errorEditor.error(error));
79756       context.map().on("drawn.select-error", selectError);
79757       function selectError(d3_event, drawn) {
79758         if (!checkSelectedID()) return;
79759         var selection2 = context.surface().selectAll(".itemId-" + selectedErrorID + "." + selectedErrorService);
79760         if (selection2.empty()) {
79761           var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
79762           if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
79763             context.enter(modeBrowse(context));
79764           }
79765         } else {
79766           selection2.classed("selected", true);
79767           context.selectedErrorID(selectedErrorID);
79768         }
79769       }
79770       function esc() {
79771         if (context.container().select(".combobox").size()) return;
79772         context.enter(modeBrowse(context));
79773       }
79774     };
79775     mode.exit = function() {
79776       behaviors.forEach(context.uninstall);
79777       select_default2(document).call(keybinding.unbind);
79778       context.surface().selectAll(".qaItem.selected").classed("selected hover", false);
79779       context.map().on("drawn.select-error", null);
79780       context.ui().sidebar.hide();
79781       context.selectedErrorID(null);
79782       context.features().forceVisible([]);
79783     };
79784     return mode;
79785   }
79786   var init_select_error = __esm({
79787     "modules/modes/select_error.js"() {
79788       "use strict";
79789       init_src5();
79790       init_breathe();
79791       init_hover();
79792       init_lasso2();
79793       init_select4();
79794       init_localizer();
79795       init_services();
79796       init_browse();
79797       init_drag_node();
79798       init_drag_note();
79799       init_keepRight_editor();
79800       init_osmose_editor();
79801       init_util();
79802     }
79803   });
79804
79805   // modules/modes/index.js
79806   var modes_exports2 = {};
79807   __export(modes_exports2, {
79808     modeAddArea: () => modeAddArea,
79809     modeAddLine: () => modeAddLine,
79810     modeAddNote: () => modeAddNote,
79811     modeAddPoint: () => modeAddPoint,
79812     modeBrowse: () => modeBrowse,
79813     modeDragNode: () => modeDragNode,
79814     modeDragNote: () => modeDragNote,
79815     modeDrawArea: () => modeDrawArea,
79816     modeDrawLine: () => modeDrawLine,
79817     modeMove: () => modeMove,
79818     modeRotate: () => modeRotate,
79819     modeSave: () => modeSave,
79820     modeSelect: () => modeSelect,
79821     modeSelectData: () => modeSelectData,
79822     modeSelectError: () => modeSelectError,
79823     modeSelectNote: () => modeSelectNote
79824   });
79825   var init_modes2 = __esm({
79826     "modules/modes/index.js"() {
79827       "use strict";
79828       init_add_area();
79829       init_add_line();
79830       init_add_point();
79831       init_add_note();
79832       init_browse();
79833       init_drag_node();
79834       init_drag_note();
79835       init_draw_area();
79836       init_draw_line();
79837       init_move3();
79838       init_rotate2();
79839       init_save2();
79840       init_select5();
79841       init_select_data();
79842       init_select_error();
79843       init_select_note();
79844     }
79845   });
79846
79847   // modules/core/context.js
79848   var context_exports = {};
79849   __export(context_exports, {
79850     coreContext: () => coreContext
79851   });
79852   function coreContext() {
79853     const dispatch14 = dispatch_default("enter", "exit", "change");
79854     const context = {};
79855     let _deferred2 = /* @__PURE__ */ new Set();
79856     context.version = package_default.version;
79857     context.privacyVersion = "20201202";
79858     context.initialHashParams = window.location.hash ? utilStringQs(window.location.hash) : {};
79859     context.changeset = null;
79860     let _defaultChangesetComment = context.initialHashParams.comment;
79861     let _defaultChangesetSource = context.initialHashParams.source;
79862     let _defaultChangesetHashtags = context.initialHashParams.hashtags;
79863     context.defaultChangesetComment = function(val) {
79864       if (!arguments.length) return _defaultChangesetComment;
79865       _defaultChangesetComment = val;
79866       return context;
79867     };
79868     context.defaultChangesetSource = function(val) {
79869       if (!arguments.length) return _defaultChangesetSource;
79870       _defaultChangesetSource = val;
79871       return context;
79872     };
79873     context.defaultChangesetHashtags = function(val) {
79874       if (!arguments.length) return _defaultChangesetHashtags;
79875       _defaultChangesetHashtags = val;
79876       return context;
79877     };
79878     let _setsDocumentTitle = true;
79879     context.setsDocumentTitle = function(val) {
79880       if (!arguments.length) return _setsDocumentTitle;
79881       _setsDocumentTitle = val;
79882       return context;
79883     };
79884     let _documentTitleBase = document.title;
79885     context.documentTitleBase = function(val) {
79886       if (!arguments.length) return _documentTitleBase;
79887       _documentTitleBase = val;
79888       return context;
79889     };
79890     let _ui;
79891     context.ui = () => _ui;
79892     context.lastPointerType = () => _ui.lastPointerType();
79893     let _keybinding = utilKeybinding("context");
79894     context.keybinding = () => _keybinding;
79895     select_default2(document).call(_keybinding);
79896     let _connection = services.osm;
79897     let _history;
79898     let _validator;
79899     let _uploader;
79900     context.connection = () => _connection;
79901     context.history = () => _history;
79902     context.validator = () => _validator;
79903     context.uploader = () => _uploader;
79904     context.preauth = (options2) => {
79905       if (_connection) {
79906         _connection.switch(options2);
79907       }
79908       return context;
79909     };
79910     context.locale = function(locale3) {
79911       if (!arguments.length) return _mainLocalizer.localeCode();
79912       _mainLocalizer.preferredLocaleCodes(locale3);
79913       return context;
79914     };
79915     function afterLoad(cid, callback) {
79916       return (err, result) => {
79917         if (err) {
79918           if (typeof callback === "function") {
79919             callback(err);
79920           }
79921           return;
79922         } else if (_connection && _connection.getConnectionId() !== cid) {
79923           if (typeof callback === "function") {
79924             callback({ message: "Connection Switched", status: -1 });
79925           }
79926           return;
79927         } else {
79928           _history.merge(result.data, result.extent);
79929           if (typeof callback === "function") {
79930             callback(err, result);
79931           }
79932           return;
79933         }
79934       };
79935     }
79936     context.loadTiles = (projection2, callback) => {
79937       const handle = window.requestIdleCallback(() => {
79938         _deferred2.delete(handle);
79939         if (_connection && context.editableDataEnabled()) {
79940           const cid = _connection.getConnectionId();
79941           _connection.loadTiles(projection2, afterLoad(cid, callback));
79942         }
79943       });
79944       _deferred2.add(handle);
79945     };
79946     context.loadTileAtLoc = (loc, callback) => {
79947       const handle = window.requestIdleCallback(() => {
79948         _deferred2.delete(handle);
79949         if (_connection && context.editableDataEnabled()) {
79950           const cid = _connection.getConnectionId();
79951           _connection.loadTileAtLoc(loc, afterLoad(cid, callback));
79952         }
79953       });
79954       _deferred2.add(handle);
79955     };
79956     context.loadEntity = (entityID, callback) => {
79957       if (_connection) {
79958         const cid = _connection.getConnectionId();
79959         _connection.loadEntity(entityID, afterLoad(cid, callback));
79960         _connection.loadEntityRelations(entityID, afterLoad(cid, callback));
79961       }
79962     };
79963     context.loadNote = (entityID, callback) => {
79964       if (_connection) {
79965         const cid = _connection.getConnectionId();
79966         _connection.loadEntityNote(entityID, afterLoad(cid, callback));
79967       }
79968     };
79969     context.zoomToEntity = (entityID, zoomTo) => {
79970       context.zoomToEntities([entityID], zoomTo);
79971     };
79972     context.zoomToEntities = (entityIDs, zoomTo) => {
79973       let loadedEntities = [];
79974       const throttledZoomTo = throttle_default(() => _map.zoomTo(loadedEntities), 500);
79975       entityIDs.forEach((entityID) => context.loadEntity(entityID, (err, result) => {
79976         if (err) return;
79977         const entity = result.data.find((e3) => e3.id === entityID);
79978         if (!entity) return;
79979         loadedEntities.push(entity);
79980         if (zoomTo !== false) {
79981           throttledZoomTo();
79982         }
79983       }));
79984       _map.on("drawn.zoomToEntity", () => {
79985         if (!entityIDs.every((entityID) => context.hasEntity(entityID))) return;
79986         _map.on("drawn.zoomToEntity", null);
79987         context.on("enter.zoomToEntity", null);
79988         context.enter(modeSelect(context, entityIDs));
79989       });
79990       context.on("enter.zoomToEntity", () => {
79991         if (_mode.id !== "browse") {
79992           _map.on("drawn.zoomToEntity", null);
79993           context.on("enter.zoomToEntity", null);
79994         }
79995       });
79996     };
79997     context.moveToNote = (noteId, moveTo) => {
79998       context.loadNote(noteId, (err, result) => {
79999         if (err) return;
80000         const entity = result.data.find((e3) => e3.id === noteId);
80001         if (!entity) return;
80002         const note = services.osm.getNote(noteId);
80003         if (moveTo !== false) {
80004           context.map().center(note.loc);
80005         }
80006         const noteLayer = context.layers().layer("notes");
80007         noteLayer.enabled(true);
80008         context.enter(modeSelectNote(context, noteId));
80009       });
80010     };
80011     let _minEditableZoom = 16;
80012     context.minEditableZoom = function(val) {
80013       if (!arguments.length) return _minEditableZoom;
80014       _minEditableZoom = val;
80015       if (_connection) {
80016         _connection.tileZoom(val);
80017       }
80018       return context;
80019     };
80020     context.maxCharsForTagKey = () => 255;
80021     context.maxCharsForTagValue = () => 255;
80022     context.maxCharsForRelationRole = () => 255;
80023     context.cleanTagKey = (val) => utilCleanOsmString(val, context.maxCharsForTagKey());
80024     context.cleanTagValue = (val) => utilCleanOsmString(val, context.maxCharsForTagValue());
80025     context.cleanRelationRole = (val) => utilCleanOsmString(val, context.maxCharsForRelationRole());
80026     let _inIntro = false;
80027     context.inIntro = function(val) {
80028       if (!arguments.length) return _inIntro;
80029       _inIntro = val;
80030       return context;
80031     };
80032     context.save = () => {
80033       if (_inIntro || context.container().select(".modal").size()) return;
80034       let canSave;
80035       if (_mode && _mode.id === "save") {
80036         canSave = false;
80037         if (services.osm && services.osm.isChangesetInflight()) {
80038           _history.clearSaved();
80039           return;
80040         }
80041       } else {
80042         canSave = context.selectedIDs().every((id2) => {
80043           const entity = context.hasEntity(id2);
80044           return entity && !entity.isDegenerate();
80045         });
80046       }
80047       if (canSave) {
80048         _history.save();
80049       }
80050       if (_history.hasChanges()) {
80051         return _t("save.unsaved_changes");
80052       }
80053     };
80054     context.debouncedSave = debounce_default(context.save, 350);
80055     function withDebouncedSave(fn) {
80056       return function() {
80057         const result = fn.apply(_history, arguments);
80058         context.debouncedSave();
80059         return result;
80060       };
80061     }
80062     context.hasEntity = (id2) => _history.graph().hasEntity(id2);
80063     context.entity = (id2) => _history.graph().entity(id2);
80064     let _mode;
80065     context.mode = () => _mode;
80066     context.enter = (newMode) => {
80067       if (_mode) {
80068         _mode.exit();
80069         dispatch14.call("exit", this, _mode);
80070       }
80071       _mode = newMode;
80072       _mode.enter();
80073       dispatch14.call("enter", this, _mode);
80074     };
80075     context.selectedIDs = () => _mode && _mode.selectedIDs && _mode.selectedIDs() || [];
80076     context.activeID = () => _mode && _mode.activeID && _mode.activeID();
80077     let _selectedNoteID;
80078     context.selectedNoteID = function(noteID) {
80079       if (!arguments.length) return _selectedNoteID;
80080       _selectedNoteID = noteID;
80081       return context;
80082     };
80083     let _selectedErrorID;
80084     context.selectedErrorID = function(errorID) {
80085       if (!arguments.length) return _selectedErrorID;
80086       _selectedErrorID = errorID;
80087       return context;
80088     };
80089     context.install = (behavior) => context.surface().call(behavior);
80090     context.uninstall = (behavior) => context.surface().call(behavior.off);
80091     let _copyGraph;
80092     context.copyGraph = () => _copyGraph;
80093     let _copyIDs = [];
80094     context.copyIDs = function(val) {
80095       if (!arguments.length) return _copyIDs;
80096       _copyIDs = val;
80097       _copyGraph = _history.graph();
80098       return context;
80099     };
80100     let _copyLonLat;
80101     context.copyLonLat = function(val) {
80102       if (!arguments.length) return _copyLonLat;
80103       _copyLonLat = val;
80104       return context;
80105     };
80106     let _background;
80107     context.background = () => _background;
80108     let _features;
80109     context.features = () => _features;
80110     context.hasHiddenConnections = (id2) => {
80111       const graph = _history.graph();
80112       const entity = graph.entity(id2);
80113       return _features.hasHiddenConnections(entity, graph);
80114     };
80115     let _photos;
80116     context.photos = () => _photos;
80117     let _map;
80118     context.map = () => _map;
80119     context.layers = () => _map.layers();
80120     context.surface = () => _map.surface;
80121     context.editableDataEnabled = () => _map.editableDataEnabled();
80122     context.surfaceRect = () => _map.surface.node().getBoundingClientRect();
80123     context.editable = () => {
80124       const mode = context.mode();
80125       if (!mode || mode.id === "save") return false;
80126       return _map.editableDataEnabled();
80127     };
80128     let _debugFlags = {
80129       tile: false,
80130       // tile boundaries
80131       collision: false,
80132       // label collision bounding boxes
80133       imagery: false,
80134       // imagery bounding polygons
80135       target: false,
80136       // touch targets
80137       downloaded: false
80138       // downloaded data from osm
80139     };
80140     context.debugFlags = () => _debugFlags;
80141     context.getDebug = (flag) => flag && _debugFlags[flag];
80142     context.setDebug = function(flag, val) {
80143       if (arguments.length === 1) val = true;
80144       _debugFlags[flag] = val;
80145       dispatch14.call("change");
80146       return context;
80147     };
80148     let _container = select_default2(null);
80149     context.container = function(val) {
80150       if (!arguments.length) return _container;
80151       _container = val;
80152       _container.classed("ideditor", true);
80153       return context;
80154     };
80155     context.containerNode = function(val) {
80156       if (!arguments.length) return context.container().node();
80157       context.container(select_default2(val));
80158       return context;
80159     };
80160     let _embed;
80161     context.embed = function(val) {
80162       if (!arguments.length) return _embed;
80163       _embed = val;
80164       return context;
80165     };
80166     let _assetPath = "";
80167     context.assetPath = function(val) {
80168       if (!arguments.length) return _assetPath;
80169       _assetPath = val;
80170       _mainFileFetcher.assetPath(val);
80171       return context;
80172     };
80173     let _assetMap = {};
80174     context.assetMap = function(val) {
80175       if (!arguments.length) return _assetMap;
80176       _assetMap = val;
80177       _mainFileFetcher.assetMap(val);
80178       return context;
80179     };
80180     context.asset = (val) => {
80181       if (/^http(s)?:\/\//i.test(val)) return val;
80182       const filename = _assetPath + val;
80183       return _assetMap[filename] || filename;
80184     };
80185     context.imagePath = (val) => context.asset(`img/${val}`);
80186     context.reset = context.flush = () => {
80187       context.debouncedSave.cancel();
80188       Array.from(_deferred2).forEach((handle) => {
80189         window.cancelIdleCallback(handle);
80190         _deferred2.delete(handle);
80191       });
80192       Object.values(services).forEach((service) => {
80193         if (service && typeof service.reset === "function") {
80194           service.reset(context);
80195         }
80196       });
80197       context.changeset = null;
80198       _validator.reset();
80199       _features.reset();
80200       _history.reset();
80201       _uploader.reset();
80202       context.container().select(".inspector-wrap *").remove();
80203       return context;
80204     };
80205     context.projection = geoRawMercator();
80206     context.curtainProjection = geoRawMercator();
80207     context.init = () => {
80208       instantiateInternal();
80209       initializeDependents();
80210       return context;
80211       function instantiateInternal() {
80212         _history = coreHistory(context);
80213         context.graph = _history.graph;
80214         context.pauseChangeDispatch = _history.pauseChangeDispatch;
80215         context.resumeChangeDispatch = _history.resumeChangeDispatch;
80216         context.perform = withDebouncedSave(_history.perform);
80217         context.replace = withDebouncedSave(_history.replace);
80218         context.pop = withDebouncedSave(_history.pop);
80219         context.overwrite = withDebouncedSave(_history.overwrite);
80220         context.undo = withDebouncedSave(_history.undo);
80221         context.redo = withDebouncedSave(_history.redo);
80222         _validator = coreValidator(context);
80223         _uploader = coreUploader(context);
80224         _background = rendererBackground(context);
80225         _features = rendererFeatures(context);
80226         _map = rendererMap(context);
80227         _photos = rendererPhotos(context);
80228         _ui = uiInit(context);
80229       }
80230       function initializeDependents() {
80231         if (context.initialHashParams.presets) {
80232           _mainPresetIndex.addablePresetIDs(new Set(context.initialHashParams.presets.split(",")));
80233         }
80234         if (context.initialHashParams.locale) {
80235           _mainLocalizer.preferredLocaleCodes(context.initialHashParams.locale);
80236         }
80237         _mainLocalizer.ensureLoaded();
80238         _mainPresetIndex.ensureLoaded();
80239         _background.ensureLoaded();
80240         Object.values(services).forEach((service) => {
80241           if (service && typeof service.init === "function") {
80242             service.init();
80243           }
80244         });
80245         _map.init();
80246         _validator.init();
80247         _features.init();
80248         if (services.maprules && context.initialHashParams.maprules) {
80249           json_default(context.initialHashParams.maprules).then((mapcss) => {
80250             services.maprules.init();
80251             mapcss.forEach((mapcssSelector) => services.maprules.addRule(mapcssSelector));
80252           }).catch(() => {
80253           });
80254         }
80255         if (!context.container().empty()) {
80256           _ui.ensureLoaded().then(() => {
80257             _background.init();
80258             _photos.init();
80259           });
80260         }
80261       }
80262     };
80263     return utilRebind(context, dispatch14, "on");
80264   }
80265   var init_context2 = __esm({
80266     "modules/core/context.js"() {
80267       "use strict";
80268       init_debounce();
80269       init_throttle();
80270       init_src4();
80271       init_src18();
80272       init_src5();
80273       init_package();
80274       init_localizer();
80275       init_file_fetcher();
80276       init_localizer();
80277       init_history();
80278       init_validator();
80279       init_uploader();
80280       init_raw_mercator();
80281       init_modes2();
80282       init_presets();
80283       init_renderer();
80284       init_services();
80285       init_init2();
80286       init_util();
80287     }
80288   });
80289
80290   // modules/core/index.js
80291   var core_exports = {};
80292   __export(core_exports, {
80293     LocationManager: () => LocationManager,
80294     coreContext: () => coreContext,
80295     coreDifference: () => coreDifference,
80296     coreFileFetcher: () => coreFileFetcher,
80297     coreGraph: () => coreGraph,
80298     coreHistory: () => coreHistory,
80299     coreLocalizer: () => coreLocalizer,
80300     coreTree: () => coreTree,
80301     coreUploader: () => coreUploader,
80302     coreValidator: () => coreValidator,
80303     fileFetcher: () => _mainFileFetcher,
80304     localizer: () => _mainLocalizer,
80305     locationManager: () => _sharedLocationManager,
80306     prefs: () => corePreferences,
80307     t: () => _t
80308   });
80309   var init_core = __esm({
80310     "modules/core/index.js"() {
80311       "use strict";
80312       init_context2();
80313       init_file_fetcher();
80314       init_difference();
80315       init_graph();
80316       init_history();
80317       init_localizer();
80318       init_LocationManager();
80319       init_preferences();
80320       init_tree();
80321       init_uploader();
80322       init_validator();
80323     }
80324   });
80325
80326   // modules/services/nominatim.js
80327   var nominatim_exports = {};
80328   __export(nominatim_exports, {
80329     default: () => nominatim_default
80330   });
80331   var apibase, _inflight, _nominatimCache, nominatim_default;
80332   var init_nominatim = __esm({
80333     "modules/services/nominatim.js"() {
80334       "use strict";
80335       init_src18();
80336       init_rbush();
80337       init_geo2();
80338       init_util();
80339       init_core();
80340       init_id();
80341       apibase = nominatimApiUrl;
80342       _inflight = {};
80343       nominatim_default = {
80344         init: function() {
80345           _inflight = {};
80346           _nominatimCache = new RBush();
80347         },
80348         reset: function() {
80349           Object.values(_inflight).forEach(function(controller) {
80350             controller.abort();
80351           });
80352           _inflight = {};
80353           _nominatimCache = new RBush();
80354         },
80355         countryCode: function(location, callback) {
80356           this.reverse(location, function(err, result) {
80357             if (err) {
80358               return callback(err);
80359             } else if (result.address) {
80360               return callback(null, result.address.country_code);
80361             } else {
80362               return callback("Unable to geocode", null);
80363             }
80364           });
80365         },
80366         reverse: function(loc, callback) {
80367           var cached = _nominatimCache.search(
80368             { minX: loc[0], minY: loc[1], maxX: loc[0], maxY: loc[1] }
80369           );
80370           if (cached.length > 0) {
80371             if (callback) callback(null, cached[0].data);
80372             return;
80373           }
80374           var params = { zoom: 13, format: "json", addressdetails: 1, lat: loc[1], lon: loc[0] };
80375           var url = apibase + "reverse?" + utilQsString(params);
80376           if (_inflight[url]) return;
80377           var controller = new AbortController();
80378           _inflight[url] = controller;
80379           json_default(url, {
80380             signal: controller.signal,
80381             headers: {
80382               "Accept-Language": _mainLocalizer.localeCodes().join(",")
80383             }
80384           }).then(function(result) {
80385             delete _inflight[url];
80386             if (result && result.error) {
80387               throw new Error(result.error);
80388             }
80389             var extent = geoExtent(loc).padByMeters(200);
80390             _nominatimCache.insert(Object.assign(extent.bbox(), { data: result }));
80391             if (callback) callback(null, result);
80392           }).catch(function(err) {
80393             delete _inflight[url];
80394             if (err.name === "AbortError") return;
80395             if (callback) callback(err.message);
80396           });
80397         },
80398         search: function(val, callback) {
80399           const params = {
80400             q: val,
80401             limit: 10,
80402             format: "json"
80403           };
80404           var url = apibase + "search?" + utilQsString(params);
80405           if (_inflight[url]) return;
80406           var controller = new AbortController();
80407           _inflight[url] = controller;
80408           json_default(url, {
80409             signal: controller.signal,
80410             headers: {
80411               "Accept-Language": _mainLocalizer.localeCodes().join(",")
80412             }
80413           }).then(function(result) {
80414             delete _inflight[url];
80415             if (result && result.error) {
80416               throw new Error(result.error);
80417             }
80418             if (callback) callback(null, result);
80419           }).catch(function(err) {
80420             delete _inflight[url];
80421             if (err.name === "AbortError") return;
80422             if (callback) callback(err.message);
80423           });
80424         }
80425       };
80426     }
80427   });
80428
80429   // node_modules/name-suggestion-index/lib/simplify.js
80430   function simplify2(str) {
80431     if (typeof str !== "string") return "";
80432     return import_diacritics2.default.remove(
80433       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()
80434     );
80435   }
80436   var import_diacritics2;
80437   var init_simplify2 = __esm({
80438     "node_modules/name-suggestion-index/lib/simplify.js"() {
80439       import_diacritics2 = __toESM(require_diacritics(), 1);
80440     }
80441   });
80442
80443   // node_modules/name-suggestion-index/config/matchGroups.json
80444   var matchGroups_default;
80445   var init_matchGroups = __esm({
80446     "node_modules/name-suggestion-index/config/matchGroups.json"() {
80447       matchGroups_default = {
80448         matchGroups: {
80449           adult_gaming_centre: [
80450             "amenity/casino",
80451             "amenity/gambling",
80452             "leisure/adult_gaming_centre"
80453           ],
80454           bar: [
80455             "amenity/bar",
80456             "amenity/pub",
80457             "amenity/restaurant"
80458           ],
80459           beauty: [
80460             "shop/beauty",
80461             "shop/hairdresser_supply"
80462           ],
80463           bed: [
80464             "shop/bed",
80465             "shop/furniture"
80466           ],
80467           beverages: [
80468             "shop/alcohol",
80469             "shop/beer",
80470             "shop/beverages",
80471             "shop/kiosk",
80472             "shop/wine"
80473           ],
80474           camping: [
80475             "tourism/camp_site",
80476             "tourism/caravan_site"
80477           ],
80478           car_parts: [
80479             "shop/car_parts",
80480             "shop/car_repair",
80481             "shop/tires",
80482             "shop/tyres"
80483           ],
80484           clinic: [
80485             "amenity/clinic",
80486             "amenity/doctors",
80487             "healthcare/clinic",
80488             "healthcare/laboratory",
80489             "healthcare/physiotherapist",
80490             "healthcare/sample_collection",
80491             "healthcare/dialysis"
80492           ],
80493           convenience: [
80494             "shop/beauty",
80495             "shop/chemist",
80496             "shop/convenience",
80497             "shop/cosmetics",
80498             "shop/grocery",
80499             "shop/kiosk",
80500             "shop/newsagent",
80501             "shop/perfumery"
80502           ],
80503           coworking: [
80504             "amenity/coworking_space",
80505             "office/coworking",
80506             "office/coworking_space"
80507           ],
80508           dentist: [
80509             "amenity/dentist",
80510             "amenity/doctors",
80511             "healthcare/dentist"
80512           ],
80513           electronics: [
80514             "office/telecommunication",
80515             "shop/appliance",
80516             "shop/computer",
80517             "shop/electronics",
80518             "shop/hifi",
80519             "shop/kiosk",
80520             "shop/mobile",
80521             "shop/mobile_phone",
80522             "shop/telecommunication",
80523             "shop/video_games"
80524           ],
80525           estate_agents: [
80526             "office/estate_agent",
80527             "shop/estate_agent",
80528             "office/mortgage",
80529             "office/financial"
80530           ],
80531           fabric: [
80532             "shop/fabric",
80533             "shop/haberdashery",
80534             "shop/sewing"
80535           ],
80536           fashion: [
80537             "shop/accessories",
80538             "shop/bag",
80539             "shop/boutique",
80540             "shop/clothes",
80541             "shop/department_store",
80542             "shop/fashion",
80543             "shop/fashion_accessories",
80544             "shop/sports",
80545             "shop/shoes"
80546           ],
80547           financial: [
80548             "amenity/bank",
80549             "office/accountant",
80550             "office/financial",
80551             "office/financial_advisor",
80552             "office/tax_advisor",
80553             "shop/tax"
80554           ],
80555           fitness: [
80556             "leisure/fitness_centre",
80557             "leisure/fitness_center",
80558             "leisure/sports_centre",
80559             "leisure/sports_center"
80560           ],
80561           food: [
80562             "amenity/cafe",
80563             "amenity/fast_food",
80564             "amenity/ice_cream",
80565             "amenity/restaurant",
80566             "shop/bakery",
80567             "shop/candy",
80568             "shop/chocolate",
80569             "shop/coffee",
80570             "shop/confectionary",
80571             "shop/confectionery",
80572             "shop/deli",
80573             "shop/food",
80574             "shop/kiosk",
80575             "shop/ice_cream",
80576             "shop/pastry",
80577             "shop/tea"
80578           ],
80579           fuel: [
80580             "amenity/fuel",
80581             "shop/gas",
80582             "shop/convenience;gas",
80583             "shop/gas;convenience"
80584           ],
80585           gift: [
80586             "shop/gift",
80587             "shop/card",
80588             "shop/cards",
80589             "shop/kiosk",
80590             "shop/stationery"
80591           ],
80592           glass: [
80593             "craft/window_construction",
80594             "craft/glaziery",
80595             "shop/car_repair"
80596           ],
80597           hardware: [
80598             "shop/bathroom_furnishing",
80599             "shop/carpet",
80600             "shop/diy",
80601             "shop/doityourself",
80602             "shop/doors",
80603             "shop/electrical",
80604             "shop/flooring",
80605             "shop/hardware",
80606             "shop/hardware_store",
80607             "shop/power_tools",
80608             "shop/tool_hire",
80609             "shop/tools",
80610             "shop/trade"
80611           ],
80612           health_food: [
80613             "shop/health",
80614             "shop/health_food",
80615             "shop/herbalist",
80616             "shop/nutrition_supplements"
80617           ],
80618           hobby: [
80619             "shop/electronics",
80620             "shop/hobby",
80621             "shop/books",
80622             "shop/games",
80623             "shop/collector",
80624             "shop/toys",
80625             "shop/model",
80626             "shop/video_games",
80627             "shop/anime"
80628           ],
80629           hospital: [
80630             "amenity/doctors",
80631             "amenity/hospital",
80632             "healthcare/hospital"
80633           ],
80634           houseware: [
80635             "shop/houseware",
80636             "shop/interior_decoration"
80637           ],
80638           water_rescue: [
80639             "amenity/lifeboat_station",
80640             "emergency/lifeboat_station",
80641             "emergency/marine_rescue",
80642             "emergency/water_rescue"
80643           ],
80644           locksmith: [
80645             "craft/key_cutter",
80646             "craft/locksmith",
80647             "shop/locksmith"
80648           ],
80649           lodging: [
80650             "tourism/guest_house",
80651             "tourism/hotel",
80652             "tourism/motel"
80653           ],
80654           money_transfer: [
80655             "amenity/money_transfer",
80656             "shop/money_transfer"
80657           ],
80658           music: ["shop/music", "shop/musical_instrument"],
80659           office_supplies: [
80660             "shop/office_supplies",
80661             "shop/stationary",
80662             "shop/stationery"
80663           ],
80664           outdoor: [
80665             "shop/clothes",
80666             "shop/outdoor",
80667             "shop/sports"
80668           ],
80669           parcel_locker: [
80670             "amenity/parcel_locker",
80671             "amenity/vending_machine"
80672           ],
80673           pharmacy: [
80674             "amenity/doctors",
80675             "amenity/pharmacy",
80676             "healthcare/pharmacy",
80677             "shop/chemist"
80678           ],
80679           playground: [
80680             "amenity/theme_park",
80681             "leisure/amusement_arcade",
80682             "leisure/playground"
80683           ],
80684           rental: [
80685             "amenity/bicycle_rental",
80686             "amenity/boat_rental",
80687             "amenity/car_rental",
80688             "amenity/truck_rental",
80689             "amenity/vehicle_rental",
80690             "shop/kiosk",
80691             "shop/plant_hire",
80692             "shop/rental",
80693             "shop/tool_hire"
80694           ],
80695           school: [
80696             "amenity/childcare",
80697             "amenity/college",
80698             "amenity/kindergarten",
80699             "amenity/language_school",
80700             "amenity/prep_school",
80701             "amenity/school",
80702             "amenity/university"
80703           ],
80704           storage: [
80705             "shop/storage_units",
80706             "shop/storage_rental"
80707           ],
80708           substation: [
80709             "power/station",
80710             "power/substation",
80711             "power/sub_station"
80712           ],
80713           supermarket: [
80714             "shop/food",
80715             "shop/frozen_food",
80716             "shop/greengrocer",
80717             "shop/grocery",
80718             "shop/supermarket",
80719             "shop/wholesale"
80720           ],
80721           thrift: [
80722             "shop/charity",
80723             "shop/clothes",
80724             "shop/second_hand"
80725           ],
80726           tobacco: [
80727             "shop/e-cigarette",
80728             "shop/tobacco"
80729           ],
80730           variety_store: [
80731             "shop/variety_store",
80732             "shop/discount",
80733             "shop/convenience"
80734           ],
80735           vending: [
80736             "amenity/vending_machine",
80737             "shop/kiosk",
80738             "shop/vending_machine"
80739           ],
80740           weight_loss: [
80741             "amenity/clinic",
80742             "amenity/doctors",
80743             "amenity/weight_clinic",
80744             "healthcare/counselling",
80745             "leisure/fitness_centre",
80746             "office/therapist",
80747             "shop/beauty",
80748             "shop/diet",
80749             "shop/food",
80750             "shop/health_food",
80751             "shop/herbalist",
80752             "shop/nutrition",
80753             "shop/nutrition_supplements",
80754             "shop/weight_loss"
80755           ],
80756           wholesale: [
80757             "shop/wholesale",
80758             "shop/supermarket",
80759             "shop/department_store"
80760           ]
80761         }
80762       };
80763     }
80764   });
80765
80766   // node_modules/name-suggestion-index/config/genericWords.json
80767   var genericWords_default;
80768   var init_genericWords = __esm({
80769     "node_modules/name-suggestion-index/config/genericWords.json"() {
80770       genericWords_default = {
80771         genericWords: [
80772           "^(barn|bazaa?r|bench|bou?tique|building|casa|church)$",
80773           "^(baseball|basketball|football|soccer|softball|tennis(halle)?)\\s?(field|court)?$",
80774           "^(club|green|out|ware)\\s?house$",
80775           "^(driveway|el \xE1rbol|fountain|generic|golf|government|graveyard)$",
80776           "^(fixme|n\\s?\\/?\\s?a|name|no\\s?name|none|null|temporary|test|unknown)$",
80777           "^(hofladen|librairie|magazine?|maison|toko)$",
80778           "^(mobile home|skate)?\\s?park$",
80779           "^(obuwie|pond|pool|sale|shops?|sklep|stores?)$",
80780           "^\\?+$",
80781           "^private$",
80782           "^tattoo( studio)?$",
80783           "^windmill$",
80784           "^\u0446\u0435\u0440\u043A\u043E\u0432\u043D\u0430\u044F( \u043B\u0430\u0432\u043A\u0430)?$"
80785         ]
80786       };
80787     }
80788   });
80789
80790   // node_modules/name-suggestion-index/config/trees.json
80791   var trees_default;
80792   var init_trees = __esm({
80793     "node_modules/name-suggestion-index/config/trees.json"() {
80794       trees_default = {
80795         trees: {
80796           brands: {
80797             emoji: "\u{1F354}",
80798             mainTag: "brand:wikidata",
80799             sourceTags: ["brand", "name"],
80800             nameTags: {
80801               primary: "^(name|name:\\w+)$",
80802               alternate: "^(brand|brand:\\w+|operator|operator:\\w+|\\w+_name|\\w+_name:\\w+)$"
80803             }
80804           },
80805           flags: {
80806             emoji: "\u{1F6A9}",
80807             mainTag: "flag:wikidata",
80808             nameTags: {
80809               primary: "^(flag:name|flag:name:\\w+)$",
80810               alternate: "^(country|country:\\w+|flag|flag:\\w+|subject|subject:\\w+)$"
80811             }
80812           },
80813           operators: {
80814             emoji: "\u{1F4BC}",
80815             mainTag: "operator:wikidata",
80816             sourceTags: ["operator"],
80817             nameTags: {
80818               primary: "^(name|name:\\w+|operator|operator:\\w+)$",
80819               alternate: "^(brand|brand:\\w+|\\w+_name|\\w+_name:\\w+)$"
80820             }
80821           },
80822           transit: {
80823             emoji: "\u{1F687}",
80824             mainTag: "network:wikidata",
80825             sourceTags: ["network"],
80826             nameTags: {
80827               primary: "^network$",
80828               alternate: "^(operator|operator:\\w+|network:\\w+|\\w+_name|\\w+_name:\\w+)$"
80829             }
80830           }
80831         }
80832       };
80833     }
80834   });
80835
80836   // node_modules/name-suggestion-index/lib/matcher.js
80837   var import_which_polygon4, matchGroups, trees, Matcher;
80838   var init_matcher2 = __esm({
80839     "node_modules/name-suggestion-index/lib/matcher.js"() {
80840       import_which_polygon4 = __toESM(require_which_polygon(), 1);
80841       init_simplify2();
80842       init_matchGroups();
80843       init_genericWords();
80844       init_trees();
80845       matchGroups = matchGroups_default.matchGroups;
80846       trees = trees_default.trees;
80847       Matcher = class {
80848         //
80849         // `constructor`
80850         // initialize the genericWords regexes
80851         constructor() {
80852           this.matchIndex = void 0;
80853           this.genericWords = /* @__PURE__ */ new Map();
80854           (genericWords_default.genericWords || []).forEach((s2) => this.genericWords.set(s2, new RegExp(s2, "i")));
80855           this.itemLocation = void 0;
80856           this.locationSets = void 0;
80857           this.locationIndex = void 0;
80858           this.warnings = [];
80859         }
80860         //
80861         // `buildMatchIndex()`
80862         // Call this to prepare the matcher for use
80863         //
80864         // `data` needs to be an Object indexed on a 'tree/key/value' path.
80865         // (e.g. cache filled by `fileTree.read` or data found in `dist/nsi.json`)
80866         // {
80867         //    'brands/amenity/bank': { properties: {}, items: [ {}, {}, … ] },
80868         //    'brands/amenity/bar':  { properties: {}, items: [ {}, {}, … ] },
80869         //    …
80870         // }
80871         //
80872         buildMatchIndex(data) {
80873           const that = this;
80874           if (that.matchIndex) return;
80875           that.matchIndex = /* @__PURE__ */ new Map();
80876           const seenTree = /* @__PURE__ */ new Map();
80877           Object.keys(data).forEach((tkv) => {
80878             const category = data[tkv];
80879             const parts = tkv.split("/", 3);
80880             const t2 = parts[0];
80881             const k2 = parts[1];
80882             const v2 = parts[2];
80883             const thiskv = `${k2}/${v2}`;
80884             const tree = trees[t2];
80885             let branch = that.matchIndex.get(thiskv);
80886             if (!branch) {
80887               branch = {
80888                 primary: /* @__PURE__ */ new Map(),
80889                 alternate: /* @__PURE__ */ new Map(),
80890                 excludeGeneric: /* @__PURE__ */ new Map(),
80891                 excludeNamed: /* @__PURE__ */ new Map()
80892               };
80893               that.matchIndex.set(thiskv, branch);
80894             }
80895             const properties = category.properties || {};
80896             const exclude = properties.exclude || {};
80897             (exclude.generic || []).forEach((s2) => branch.excludeGeneric.set(s2, new RegExp(s2, "i")));
80898             (exclude.named || []).forEach((s2) => branch.excludeNamed.set(s2, new RegExp(s2, "i")));
80899             const excludeRegexes = [...branch.excludeGeneric.values(), ...branch.excludeNamed.values()];
80900             let items = category.items;
80901             if (!Array.isArray(items) || !items.length) return;
80902             const primaryName = new RegExp(tree.nameTags.primary, "i");
80903             const alternateName = new RegExp(tree.nameTags.alternate, "i");
80904             const notName = /:(colou?r|type|forward|backward|left|right|etymology|pronunciation|wikipedia)$/i;
80905             const skipGenericKV = skipGenericKVMatches(t2, k2, v2);
80906             const genericKV = /* @__PURE__ */ new Set([`${k2}/yes`, `building/yes`]);
80907             const matchGroupKV = /* @__PURE__ */ new Set();
80908             Object.values(matchGroups).forEach((matchGroup) => {
80909               const inGroup = matchGroup.some((otherkv) => otherkv === thiskv);
80910               if (!inGroup) return;
80911               matchGroup.forEach((otherkv) => {
80912                 if (otherkv === thiskv) return;
80913                 matchGroupKV.add(otherkv);
80914                 const otherk = otherkv.split("/", 2)[0];
80915                 genericKV.add(`${otherk}/yes`);
80916               });
80917             });
80918             items.forEach((item) => {
80919               if (!item.id) return;
80920               if (Array.isArray(item.matchTags) && item.matchTags.length) {
80921                 item.matchTags = item.matchTags.filter((matchTag) => !matchGroupKV.has(matchTag) && matchTag !== thiskv && !genericKV.has(matchTag));
80922                 if (!item.matchTags.length) delete item.matchTags;
80923               }
80924               let kvTags = [`${thiskv}`].concat(item.matchTags || []);
80925               if (!skipGenericKV) {
80926                 kvTags = kvTags.concat(Array.from(genericKV));
80927               }
80928               Object.keys(item.tags).forEach((osmkey) => {
80929                 if (notName.test(osmkey)) return;
80930                 const osmvalue = item.tags[osmkey];
80931                 if (!osmvalue || excludeRegexes.some((regex) => regex.test(osmvalue))) return;
80932                 if (primaryName.test(osmkey)) {
80933                   kvTags.forEach((kv) => insertName("primary", t2, kv, simplify2(osmvalue), item.id));
80934                 } else if (alternateName.test(osmkey)) {
80935                   kvTags.forEach((kv) => insertName("alternate", t2, kv, simplify2(osmvalue), item.id));
80936                 }
80937               });
80938               let keepMatchNames = /* @__PURE__ */ new Set();
80939               (item.matchNames || []).forEach((matchName) => {
80940                 const nsimple = simplify2(matchName);
80941                 kvTags.forEach((kv) => {
80942                   const branch2 = that.matchIndex.get(kv);
80943                   const primaryLeaf = branch2 && branch2.primary.get(nsimple);
80944                   const alternateLeaf = branch2 && branch2.alternate.get(nsimple);
80945                   const inPrimary = primaryLeaf && primaryLeaf.has(item.id);
80946                   const inAlternate = alternateLeaf && alternateLeaf.has(item.id);
80947                   if (!inPrimary && !inAlternate) {
80948                     insertName("alternate", t2, kv, nsimple, item.id);
80949                     keepMatchNames.add(matchName);
80950                   }
80951                 });
80952               });
80953               if (keepMatchNames.size) {
80954                 item.matchNames = Array.from(keepMatchNames);
80955               } else {
80956                 delete item.matchNames;
80957               }
80958             });
80959           });
80960           function insertName(which, t2, kv, nsimple, itemID) {
80961             if (!nsimple) {
80962               that.warnings.push(`Warning: skipping empty ${which} name for item ${t2}/${kv}: ${itemID}`);
80963               return;
80964             }
80965             let branch = that.matchIndex.get(kv);
80966             if (!branch) {
80967               branch = {
80968                 primary: /* @__PURE__ */ new Map(),
80969                 alternate: /* @__PURE__ */ new Map(),
80970                 excludeGeneric: /* @__PURE__ */ new Map(),
80971                 excludeNamed: /* @__PURE__ */ new Map()
80972               };
80973               that.matchIndex.set(kv, branch);
80974             }
80975             let leaf = branch[which].get(nsimple);
80976             if (!leaf) {
80977               leaf = /* @__PURE__ */ new Set();
80978               branch[which].set(nsimple, leaf);
80979             }
80980             leaf.add(itemID);
80981             if (!/yes$/.test(kv)) {
80982               const kvnsimple = `${kv}/${nsimple}`;
80983               const existing = seenTree.get(kvnsimple);
80984               if (existing && existing !== t2) {
80985                 const items = Array.from(leaf);
80986                 that.warnings.push(`Duplicate cache key "${kvnsimple}" in trees "${t2}" and "${existing}", check items: ${items}`);
80987                 return;
80988               }
80989               seenTree.set(kvnsimple, t2);
80990             }
80991           }
80992           function skipGenericKVMatches(t2, k2, v2) {
80993             return t2 === "flags" || t2 === "transit" || k2 === "landuse" || v2 === "atm" || v2 === "bicycle_parking" || v2 === "car_sharing" || v2 === "caravan_site" || v2 === "charging_station" || v2 === "dog_park" || v2 === "parking" || v2 === "phone" || v2 === "playground" || v2 === "post_box" || v2 === "public_bookcase" || v2 === "recycling" || v2 === "vending_machine";
80994           }
80995         }
80996         //
80997         // `buildLocationIndex()`
80998         // Call this to prepare a which-polygon location index.
80999         // This *resolves* all the locationSets into GeoJSON, which takes some time.
81000         // You can skip this step if you don't care about matching within a location.
81001         //
81002         // `data` needs to be an Object indexed on a 'tree/key/value' path.
81003         // (e.g. cache filled by `fileTree.read` or data found in `dist/nsi.json`)
81004         // {
81005         //    'brands/amenity/bank': { properties: {}, items: [ {}, {}, … ] },
81006         //    'brands/amenity/bar':  { properties: {}, items: [ {}, {}, … ] },
81007         //    …
81008         // }
81009         //
81010         buildLocationIndex(data, loco) {
81011           const that = this;
81012           if (that.locationIndex) return;
81013           that.itemLocation = /* @__PURE__ */ new Map();
81014           that.locationSets = /* @__PURE__ */ new Map();
81015           Object.keys(data).forEach((tkv) => {
81016             const items = data[tkv].items;
81017             if (!Array.isArray(items) || !items.length) return;
81018             items.forEach((item) => {
81019               if (that.itemLocation.has(item.id)) return;
81020               let resolved;
81021               try {
81022                 resolved = loco.resolveLocationSet(item.locationSet);
81023               } catch (err) {
81024                 console.warn(`buildLocationIndex: ${err.message}`);
81025               }
81026               if (!resolved || !resolved.id) return;
81027               that.itemLocation.set(item.id, resolved.id);
81028               if (that.locationSets.has(resolved.id)) return;
81029               let feature3 = _cloneDeep2(resolved.feature);
81030               feature3.id = resolved.id;
81031               feature3.properties.id = resolved.id;
81032               if (!feature3.geometry.coordinates.length || !feature3.properties.area) {
81033                 console.warn(`buildLocationIndex: locationSet ${resolved.id} for ${item.id} resolves to an empty feature:`);
81034                 console.warn(JSON.stringify(feature3));
81035                 return;
81036               }
81037               that.locationSets.set(resolved.id, feature3);
81038             });
81039           });
81040           that.locationIndex = (0, import_which_polygon4.default)({ type: "FeatureCollection", features: [...that.locationSets.values()] });
81041           function _cloneDeep2(obj) {
81042             return JSON.parse(JSON.stringify(obj));
81043           }
81044         }
81045         //
81046         // `match()`
81047         // Pass parts and return an Array of matches.
81048         // `k` - key
81049         // `v` - value
81050         // `n` - namelike
81051         // `loc` - optional - [lon,lat] location to search
81052         //
81053         // 1. If the [k,v,n] tuple matches a canonical item…
81054         // Return an Array of match results.
81055         // Each result will include the area in km² that the item is valid.
81056         //
81057         // Order of results:
81058         // Primary ordering will be on the "match" column:
81059         //   "primary" - where the query matches the `name` tag, followed by
81060         //   "alternate" - where the query matches an alternate name tag (e.g. short_name, brand, operator, etc)
81061         // Secondary ordering will be on the "area" column:
81062         //   "area descending" if no location was provided, (worldwide before local)
81063         //   "area ascending" if location was provided (local before worldwide)
81064         //
81065         // [
81066         //   { match: 'primary',   itemID: String,  area: Number,  kv: String,  nsimple: String },
81067         //   { match: 'primary',   itemID: String,  area: Number,  kv: String,  nsimple: String },
81068         //   { match: 'alternate', itemID: String,  area: Number,  kv: String,  nsimple: String },
81069         //   { match: 'alternate', itemID: String,  area: Number,  kv: String,  nsimple: String },
81070         //   …
81071         // ]
81072         //
81073         // -or-
81074         //
81075         // 2. If the [k,v,n] tuple matches an exclude pattern…
81076         // Return an Array with a single exclude result, either
81077         //
81078         // [ { match: 'excludeGeneric', pattern: String,  kv: String } ]  // "generic" e.g. "Food Court"
81079         //   or
81080         // [ { match: 'excludeNamed', pattern: String,  kv: String } ]    // "named", e.g. "Kebabai"
81081         //
81082         // About results
81083         //   "generic" - a generic word that is probably not really a name.
81084         //     For these, iD should warn the user "Hey don't put 'food court' in the name tag".
81085         //   "named" - a real name like "Kebabai" that is just common, but not a brand.
81086         //     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.
81087         //
81088         // -or-
81089         //
81090         // 3. If the [k,v,n] tuple matches nothing of any kind, return `null`
81091         //
81092         //
81093         match(k2, v2, n3, loc) {
81094           const that = this;
81095           if (!that.matchIndex) {
81096             throw new Error("match:  matchIndex not built.");
81097           }
81098           let matchLocations;
81099           if (Array.isArray(loc) && that.locationIndex) {
81100             matchLocations = that.locationIndex([loc[0], loc[1], loc[0], loc[1]], true);
81101           }
81102           const nsimple = simplify2(n3);
81103           let seen = /* @__PURE__ */ new Set();
81104           let results = [];
81105           gatherResults("primary");
81106           gatherResults("alternate");
81107           if (results.length) return results;
81108           gatherResults("exclude");
81109           return results.length ? results : null;
81110           function gatherResults(which) {
81111             const kv = `${k2}/${v2}`;
81112             let didMatch = tryMatch(which, kv);
81113             if (didMatch) return;
81114             for (let mg in matchGroups) {
81115               const matchGroup = matchGroups[mg];
81116               const inGroup = matchGroup.some((otherkv) => otherkv === kv);
81117               if (!inGroup) continue;
81118               for (let i3 = 0; i3 < matchGroup.length; i3++) {
81119                 const otherkv = matchGroup[i3];
81120                 if (otherkv === kv) continue;
81121                 didMatch = tryMatch(which, otherkv);
81122                 if (didMatch) return;
81123               }
81124             }
81125             if (which === "exclude") {
81126               const regex = [...that.genericWords.values()].find((regex2) => regex2.test(n3));
81127               if (regex) {
81128                 results.push({ match: "excludeGeneric", pattern: String(regex) });
81129                 return;
81130               }
81131             }
81132           }
81133           function tryMatch(which, kv) {
81134             const branch = that.matchIndex.get(kv);
81135             if (!branch) return;
81136             if (which === "exclude") {
81137               let regex = [...branch.excludeNamed.values()].find((regex2) => regex2.test(n3));
81138               if (regex) {
81139                 results.push({ match: "excludeNamed", pattern: String(regex), kv });
81140                 return;
81141               }
81142               regex = [...branch.excludeGeneric.values()].find((regex2) => regex2.test(n3));
81143               if (regex) {
81144                 results.push({ match: "excludeGeneric", pattern: String(regex), kv });
81145                 return;
81146               }
81147               return;
81148             }
81149             const leaf = branch[which].get(nsimple);
81150             if (!leaf || !leaf.size) return;
81151             let hits = Array.from(leaf).map((itemID) => {
81152               let area = Infinity;
81153               if (that.itemLocation && that.locationSets) {
81154                 const location = that.locationSets.get(that.itemLocation.get(itemID));
81155                 area = location && location.properties.area || Infinity;
81156               }
81157               return { match: which, itemID, area, kv, nsimple };
81158             });
81159             let sortFn = byAreaDescending;
81160             if (matchLocations) {
81161               hits = hits.filter(isValidLocation);
81162               sortFn = byAreaAscending;
81163             }
81164             if (!hits.length) return;
81165             hits.sort(sortFn).forEach((hit) => {
81166               if (seen.has(hit.itemID)) return;
81167               seen.add(hit.itemID);
81168               results.push(hit);
81169             });
81170             return true;
81171             function isValidLocation(hit) {
81172               if (!that.itemLocation) return true;
81173               return matchLocations.find((props) => props.id === that.itemLocation.get(hit.itemID));
81174             }
81175             function byAreaAscending(hitA, hitB) {
81176               return hitA.area - hitB.area;
81177             }
81178             function byAreaDescending(hitA, hitB) {
81179               return hitB.area - hitA.area;
81180             }
81181           }
81182         }
81183         //
81184         // `getWarnings()`
81185         // Return any warnings discovered when buiding the index.
81186         // (currently this does nothing)
81187         //
81188         getWarnings() {
81189           return this.warnings;
81190         }
81191       };
81192     }
81193   });
81194
81195   // node_modules/name-suggestion-index/lib/stemmer.js
81196   var init_stemmer = __esm({
81197     "node_modules/name-suggestion-index/lib/stemmer.js"() {
81198       init_simplify2();
81199     }
81200   });
81201
81202   // node_modules/name-suggestion-index/index.mjs
81203   var init_name_suggestion_index = __esm({
81204     "node_modules/name-suggestion-index/index.mjs"() {
81205       init_matcher2();
81206       init_simplify2();
81207       init_stemmer();
81208     }
81209   });
81210
81211   // modules/services/nsi.js
81212   var nsi_exports = {};
81213   __export(nsi_exports, {
81214     default: () => nsi_default
81215   });
81216   function setNsiSources() {
81217     const nsiVersion = package_default.dependencies["name-suggestion-index"] || package_default.devDependencies["name-suggestion-index"];
81218     const v2 = (0, import_vparse.default)(nsiVersion);
81219     const vMinor = `${v2.major}.${v2.minor}`;
81220     const cdn = nsiCdnUrl.replace("{version}", vMinor);
81221     const sources = {
81222       "nsi_data": cdn + "dist/nsi.min.json",
81223       "nsi_dissolved": cdn + "dist/dissolved.min.json",
81224       "nsi_features": cdn + "dist/featureCollection.min.json",
81225       "nsi_generics": cdn + "dist/genericWords.min.json",
81226       "nsi_presets": cdn + "dist/presets/nsi-id-presets.min.json",
81227       "nsi_replacements": cdn + "dist/replacements.min.json",
81228       "nsi_trees": cdn + "dist/trees.min.json"
81229     };
81230     let fileMap = _mainFileFetcher.fileMap();
81231     for (const k2 in sources) {
81232       if (!fileMap[k2]) fileMap[k2] = sources[k2];
81233     }
81234   }
81235   function loadNsiPresets() {
81236     return Promise.all([
81237       _mainFileFetcher.get("nsi_presets"),
81238       _mainFileFetcher.get("nsi_features")
81239     ]).then((vals) => {
81240       Object.values(vals[0].presets).forEach((preset) => preset.suggestion = true);
81241       Object.values(vals[0].presets).forEach((preset) => {
81242         if (preset.tags["brand:wikidata"]) {
81243           preset.removeTags = { "brand:wikipedia": "*", ...preset.removeTags || preset.addTags || preset.tags };
81244         }
81245         if (preset.tags["operator:wikidata"]) {
81246           preset.removeTags = { "operator:wikipedia": "*", ...preset.removeTags || preset.addTags || preset.tags };
81247         }
81248         if (preset.tags["network:wikidata"]) {
81249           preset.removeTags = { "network:wikipedia": "*", ...preset.removeTags || preset.addTags || preset.tags };
81250         }
81251       });
81252       _mainPresetIndex.merge({
81253         presets: vals[0].presets,
81254         featureCollection: vals[1]
81255       });
81256     });
81257   }
81258   function loadNsiData() {
81259     return Promise.all([
81260       _mainFileFetcher.get("nsi_data"),
81261       _mainFileFetcher.get("nsi_dissolved"),
81262       _mainFileFetcher.get("nsi_replacements"),
81263       _mainFileFetcher.get("nsi_trees")
81264     ]).then((vals) => {
81265       _nsi = {
81266         data: vals[0].nsi,
81267         // the raw name-suggestion-index data
81268         dissolved: vals[1].dissolved,
81269         // list of dissolved items
81270         replacements: vals[2].replacements,
81271         // trivial old->new qid replacements
81272         trees: vals[3].trees,
81273         // metadata about trees, main tags
81274         kvt: /* @__PURE__ */ new Map(),
81275         // Map (k -> Map (v -> t) )
81276         qids: /* @__PURE__ */ new Map(),
81277         // Map (wd/wp tag values -> qids)
81278         ids: /* @__PURE__ */ new Map()
81279         // Map (id -> NSI item)
81280       };
81281       const matcher = _nsi.matcher = new Matcher();
81282       matcher.buildMatchIndex(_nsi.data);
81283       matcher.itemLocation = /* @__PURE__ */ new Map();
81284       matcher.locationSets = /* @__PURE__ */ new Map();
81285       Object.keys(_nsi.data).forEach((tkv) => {
81286         const items = _nsi.data[tkv].items;
81287         if (!Array.isArray(items) || !items.length) return;
81288         items.forEach((item) => {
81289           if (matcher.itemLocation.has(item.id)) return;
81290           const locationSetID = _sharedLocationManager.locationSetID(item.locationSet);
81291           matcher.itemLocation.set(item.id, locationSetID);
81292           if (matcher.locationSets.has(locationSetID)) return;
81293           const fakeFeature = { id: locationSetID, properties: { id: locationSetID, area: 1 } };
81294           matcher.locationSets.set(locationSetID, fakeFeature);
81295         });
81296       });
81297       matcher.locationIndex = (bbox2) => {
81298         const validHere = _sharedLocationManager.locationSetsAt([bbox2[0], bbox2[1]]);
81299         const results = [];
81300         for (const [locationSetID, area] of Object.entries(validHere)) {
81301           const fakeFeature = matcher.locationSets.get(locationSetID);
81302           if (fakeFeature) {
81303             fakeFeature.properties.area = area;
81304             results.push(fakeFeature);
81305           }
81306         }
81307         return results;
81308       };
81309       Object.keys(_nsi.data).forEach((tkv) => {
81310         const category = _nsi.data[tkv];
81311         const parts = tkv.split("/", 3);
81312         const t2 = parts[0];
81313         const k2 = parts[1];
81314         const v2 = parts[2];
81315         let vmap = _nsi.kvt.get(k2);
81316         if (!vmap) {
81317           vmap = /* @__PURE__ */ new Map();
81318           _nsi.kvt.set(k2, vmap);
81319         }
81320         vmap.set(v2, t2);
81321         const tree = _nsi.trees[t2];
81322         const mainTag = tree.mainTag;
81323         const items = category.items || [];
81324         items.forEach((item) => {
81325           item.tkv = tkv;
81326           item.mainTag = mainTag;
81327           _nsi.ids.set(item.id, item);
81328           const wd = item.tags[mainTag];
81329           const wp = item.tags[mainTag.replace("wikidata", "wikipedia")];
81330           if (wd) _nsi.qids.set(wd, wd);
81331           if (wp && wd) _nsi.qids.set(wp, wd);
81332         });
81333       });
81334     });
81335   }
81336   function gatherKVs(tags) {
81337     let primary = /* @__PURE__ */ new Set();
81338     let alternate = /* @__PURE__ */ new Set();
81339     Object.keys(tags).forEach((osmkey) => {
81340       const osmvalue = tags[osmkey];
81341       if (!osmvalue) return;
81342       if (osmkey === "route_master") osmkey = "route";
81343       const vmap = _nsi.kvt.get(osmkey);
81344       if (!vmap) return;
81345       if (vmap.get(osmvalue)) {
81346         primary.add(`${osmkey}/${osmvalue}`);
81347       } else if (osmvalue === "yes") {
81348         alternate.add(`${osmkey}/${osmvalue}`);
81349       }
81350     });
81351     const preset = _mainPresetIndex.matchTags(tags, "area");
81352     if (buildingPreset[preset.id]) {
81353       alternate.add("building/yes");
81354     }
81355     return { primary, alternate };
81356   }
81357   function identifyTree(tags) {
81358     let unknown;
81359     let t2;
81360     Object.keys(tags).forEach((osmkey) => {
81361       if (t2) return;
81362       const osmvalue = tags[osmkey];
81363       if (!osmvalue) return;
81364       if (osmkey === "route_master") osmkey = "route";
81365       const vmap = _nsi.kvt.get(osmkey);
81366       if (!vmap) return;
81367       if (osmvalue === "yes") {
81368         unknown = "unknown";
81369       } else {
81370         t2 = vmap.get(osmvalue);
81371       }
81372     });
81373     return t2 || unknown || null;
81374   }
81375   function gatherNames(tags) {
81376     const empty2 = { primary: /* @__PURE__ */ new Set(), alternate: /* @__PURE__ */ new Set() };
81377     let primary = /* @__PURE__ */ new Set();
81378     let alternate = /* @__PURE__ */ new Set();
81379     let foundSemi = false;
81380     let testNameFragments = false;
81381     let patterns2;
81382     let t2 = identifyTree(tags);
81383     if (!t2) return empty2;
81384     if (t2 === "transit") {
81385       patterns2 = {
81386         primary: /^network$/i,
81387         alternate: /^(operator|operator:\w+|network:\w+|\w+_name|\w+_name:\w+)$/i
81388       };
81389     } else if (t2 === "flags") {
81390       patterns2 = {
81391         primary: /^(flag:name|flag:name:\w+)$/i,
81392         alternate: /^(flag|flag:\w+|subject|subject:\w+)$/i
81393         // note: no `country`, we special-case it below
81394       };
81395     } else if (t2 === "brands") {
81396       testNameFragments = true;
81397       patterns2 = {
81398         primary: /^(name|name:\w+)$/i,
81399         alternate: /^(brand|brand:\w+|operator|operator:\w+|\w+_name|\w+_name:\w+)/i
81400       };
81401     } else if (t2 === "operators") {
81402       testNameFragments = true;
81403       patterns2 = {
81404         primary: /^(name|name:\w+|operator|operator:\w+)$/i,
81405         alternate: /^(brand|brand:\w+|\w+_name|\w+_name:\w+)/i
81406       };
81407     } else {
81408       testNameFragments = true;
81409       patterns2 = {
81410         primary: /^(name|name:\w+)$/i,
81411         alternate: /^(brand|brand:\w+|network|network:\w+|operator|operator:\w+|\w+_name|\w+_name:\w+)/i
81412       };
81413     }
81414     if (tags.name && testNameFragments) {
81415       const nameParts = tags.name.split(/[\s\-\/,.]/);
81416       for (let split = nameParts.length; split > 0; split--) {
81417         const name = nameParts.slice(0, split).join(" ");
81418         primary.add(name);
81419       }
81420     }
81421     Object.keys(tags).forEach((osmkey) => {
81422       const osmvalue = tags[osmkey];
81423       if (!osmvalue) return;
81424       if (isNamelike(osmkey, "primary")) {
81425         if (/;/.test(osmvalue)) {
81426           foundSemi = true;
81427         } else {
81428           primary.add(osmvalue);
81429           alternate.delete(osmvalue);
81430         }
81431       } else if (!primary.has(osmvalue) && isNamelike(osmkey, "alternate")) {
81432         if (/;/.test(osmvalue)) {
81433           foundSemi = true;
81434         } else {
81435           alternate.add(osmvalue);
81436         }
81437       }
81438     });
81439     if (tags.man_made === "flagpole" && !primary.size && !alternate.size && !!tags.country) {
81440       const osmvalue = tags.country;
81441       if (/;/.test(osmvalue)) {
81442         foundSemi = true;
81443       } else {
81444         alternate.add(osmvalue);
81445       }
81446     }
81447     if (foundSemi) {
81448       return empty2;
81449     } else {
81450       return { primary, alternate };
81451     }
81452     function isNamelike(osmkey, which) {
81453       if (osmkey === "old_name") return false;
81454       return patterns2[which].test(osmkey) && !notNames.test(osmkey);
81455     }
81456   }
81457   function gatherTuples(tryKVs, tryNames) {
81458     let tuples = [];
81459     ["primary", "alternate"].forEach((whichName) => {
81460       const arr = Array.from(tryNames[whichName]).sort((a2, b2) => b2.length - a2.length);
81461       arr.forEach((n3) => {
81462         ["primary", "alternate"].forEach((whichKV) => {
81463           tryKVs[whichKV].forEach((kv) => {
81464             const parts = kv.split("/", 2);
81465             const k2 = parts[0];
81466             const v2 = parts[1];
81467             tuples.push({ k: k2, v: v2, n: n3 });
81468           });
81469         });
81470       });
81471     });
81472     return tuples;
81473   }
81474   function _upgradeTags(tags, loc) {
81475     let newTags = Object.assign({}, tags);
81476     let changed = false;
81477     Object.keys(newTags).forEach((osmkey) => {
81478       const matchTag = osmkey.match(/^(\w+:)?wikidata$/);
81479       if (matchTag) {
81480         const prefix = matchTag[1] || "";
81481         const wd = newTags[osmkey];
81482         const replace = _nsi.replacements[wd];
81483         if (replace && replace.wikidata !== void 0) {
81484           changed = true;
81485           if (replace.wikidata) {
81486             newTags[osmkey] = replace.wikidata;
81487           } else {
81488             delete newTags[osmkey];
81489           }
81490         }
81491         if (replace && replace.wikipedia !== void 0) {
81492           changed = true;
81493           const wpkey = `${prefix}wikipedia`;
81494           if (replace.wikipedia) {
81495             newTags[wpkey] = replace.wikipedia;
81496           } else {
81497             delete newTags[wpkey];
81498           }
81499         }
81500       }
81501     });
81502     const isRouteMaster = tags.type === "route_master";
81503     const tryKVs = gatherKVs(tags);
81504     if (!tryKVs.primary.size && !tryKVs.alternate.size) {
81505       return changed ? { newTags, matched: null } : null;
81506     }
81507     const tryNames = gatherNames(tags);
81508     const foundQID = _nsi.qids.get(tags.wikidata) || _nsi.qids.get(tags.wikipedia);
81509     if (foundQID) tryNames.primary.add(foundQID);
81510     if (!tryNames.primary.size && !tryNames.alternate.size) {
81511       return changed ? { newTags, matched: null } : null;
81512     }
81513     const tuples = gatherTuples(tryKVs, tryNames);
81514     for (let i3 = 0; i3 < tuples.length; i3++) {
81515       const tuple = tuples[i3];
81516       const hits = _nsi.matcher.match(tuple.k, tuple.v, tuple.n, loc);
81517       if (!hits || !hits.length) continue;
81518       if (hits[0].match !== "primary" && hits[0].match !== "alternate") break;
81519       let itemID, item;
81520       for (let j2 = 0; j2 < hits.length; j2++) {
81521         const hit = hits[j2];
81522         itemID = hit.itemID;
81523         if (_nsi.dissolved[itemID]) continue;
81524         item = _nsi.ids.get(itemID);
81525         if (!item) continue;
81526         const mainTag = item.mainTag;
81527         const itemQID = item.tags[mainTag];
81528         const notQID = newTags[`not:${mainTag}`];
81529         if (
81530           // Exceptions, skip this hit
81531           !itemQID || itemQID === notQID || // No `*:wikidata` or matched a `not:*:wikidata`
81532           newTags.office && !item.tags.office
81533         ) {
81534           item = null;
81535           continue;
81536         } else {
81537           break;
81538         }
81539       }
81540       if (!item) continue;
81541       item = JSON.parse(JSON.stringify(item));
81542       const tkv = item.tkv;
81543       const parts = tkv.split("/", 3);
81544       const k2 = parts[1];
81545       const v2 = parts[2];
81546       const category = _nsi.data[tkv];
81547       const properties = category.properties || {};
81548       let preserveTags = item.preserveTags || properties.preserveTags || [];
81549       ["building", "emergency", "internet_access", "opening_hours", "takeaway"].forEach((osmkey) => {
81550         if (k2 !== osmkey) preserveTags.push(`^${osmkey}$`);
81551       });
81552       const regexes = preserveTags.map((s2) => new RegExp(s2, "i"));
81553       let keepTags = {};
81554       Object.keys(newTags).forEach((osmkey) => {
81555         if (regexes.some((regex) => regex.test(osmkey))) {
81556           keepTags[osmkey] = newTags[osmkey];
81557         }
81558       });
81559       _nsi.kvt.forEach((vmap, k3) => {
81560         if (newTags[k3] === "yes") delete newTags[k3];
81561       });
81562       if (foundQID) {
81563         delete newTags.wikipedia;
81564         delete newTags.wikidata;
81565       }
81566       Object.assign(newTags, item.tags, keepTags);
81567       if (isRouteMaster) {
81568         newTags.route_master = newTags.route;
81569         delete newTags.route;
81570       }
81571       const origName = tags.name;
81572       const newName = newTags.name;
81573       if (newName && origName && newName !== origName && !newTags.branch) {
81574         const newNames = gatherNames(newTags);
81575         const newSet = /* @__PURE__ */ new Set([...newNames.primary, ...newNames.alternate]);
81576         const isMoved = newSet.has(origName);
81577         if (!isMoved) {
81578           const nameParts = origName.split(/[\s\-\/,.]/);
81579           for (let split = nameParts.length; split > 0; split--) {
81580             const name = nameParts.slice(0, split).join(" ");
81581             const branch = nameParts.slice(split).join(" ");
81582             const nameHits = _nsi.matcher.match(k2, v2, name, loc);
81583             if (!nameHits || !nameHits.length) continue;
81584             if (nameHits.some((hit) => hit.itemID === itemID)) {
81585               if (branch) {
81586                 if (notBranches.test(branch)) {
81587                   newTags.name = origName;
81588                 } else {
81589                   const branchHits = _nsi.matcher.match(k2, v2, branch, loc);
81590                   if (branchHits && branchHits.length) {
81591                     if (branchHits[0].match === "primary" || branchHits[0].match === "alternate") {
81592                       return null;
81593                     }
81594                   } else {
81595                     newTags.branch = branch;
81596                   }
81597                 }
81598               }
81599               break;
81600             }
81601           }
81602         }
81603       }
81604       return { newTags, matched: item };
81605     }
81606     return changed ? { newTags, matched: null } : null;
81607   }
81608   function _isGenericName(tags) {
81609     const n3 = tags.name;
81610     if (!n3) return false;
81611     const tryNames = { primary: /* @__PURE__ */ new Set([n3]), alternate: /* @__PURE__ */ new Set() };
81612     const tryKVs = gatherKVs(tags);
81613     if (!tryKVs.primary.size && !tryKVs.alternate.size) return false;
81614     const tuples = gatherTuples(tryKVs, tryNames);
81615     for (let i3 = 0; i3 < tuples.length; i3++) {
81616       const tuple = tuples[i3];
81617       const hits = _nsi.matcher.match(tuple.k, tuple.v, tuple.n);
81618       if (hits && hits.length && hits[0].match === "excludeGeneric") return true;
81619     }
81620     return false;
81621   }
81622   var import_vparse, _nsiStatus, _nsi, buildingPreset, notNames, notBranches, nsi_default;
81623   var init_nsi = __esm({
81624     "modules/services/nsi.js"() {
81625       "use strict";
81626       init_name_suggestion_index();
81627       import_vparse = __toESM(require_vparse());
81628       init_core();
81629       init_presets();
81630       init_id();
81631       init_package();
81632       _nsiStatus = "loading";
81633       _nsi = {};
81634       buildingPreset = {
81635         "building/commercial": true,
81636         "building/government": true,
81637         "building/hotel": true,
81638         "building/retail": true,
81639         "building/office": true,
81640         "building/supermarket": true,
81641         "building/yes": true
81642       };
81643       notNames = /:(colou?r|type|forward|backward|left|right|etymology|pronunciation|wikipedia)$/i;
81644       notBranches = /(coop|express|wireless|factory|outlet)/i;
81645       nsi_default = {
81646         // `init()`
81647         // On init, start preparing the name-suggestion-index
81648         //
81649         init: () => {
81650           setNsiSources();
81651           _mainPresetIndex.ensureLoaded().then(() => loadNsiPresets()).then(() => loadNsiData()).then(() => _nsiStatus = "ok").catch(() => _nsiStatus = "failed");
81652         },
81653         // `reset()`
81654         // Reset is called when user saves data to OSM (does nothing here)
81655         //
81656         reset: () => {
81657         },
81658         // `status()`
81659         // To let other code know how it's going...
81660         //
81661         // Returns
81662         //   `String`: 'loading', 'ok', 'failed'
81663         //
81664         status: () => _nsiStatus,
81665         // `isGenericName()`
81666         // Is the `name` tag generic?
81667         //
81668         // Arguments
81669         //   `tags`: `Object` containing the feature's OSM tags
81670         // Returns
81671         //   `true` if it is generic, `false` if not
81672         //
81673         isGenericName: (tags) => _isGenericName(tags),
81674         // `upgradeTags()`
81675         // Suggest tag upgrades.
81676         // This function will not modify the input tags, it makes a copy.
81677         //
81678         // Arguments
81679         //   `tags`: `Object` containing the feature's OSM tags
81680         //   `loc`: Location where this feature exists, as a [lon, lat]
81681         // Returns
81682         //   `Object` containing the result, or `null` if no changes needed:
81683         //   {
81684         //     'newTags': `Object` - The tags the the feature should have
81685         //     'matched': `Object` - The matched item
81686         //   }
81687         //
81688         upgradeTags: (tags, loc) => _upgradeTags(tags, loc),
81689         // `cache()`
81690         // Direct access to the NSI cache, useful for testing or breaking things
81691         //
81692         // Returns
81693         //   `Object`: the internal NSI cache
81694         //
81695         cache: () => _nsi
81696       };
81697     }
81698   });
81699
81700   // modules/services/kartaview.js
81701   var kartaview_exports = {};
81702   __export(kartaview_exports, {
81703     default: () => kartaview_default
81704   });
81705   function abortRequest3(controller) {
81706     controller.abort();
81707   }
81708   function maxPageAtZoom(z2) {
81709     if (z2 < 15) return 2;
81710     if (z2 === 15) return 5;
81711     if (z2 === 16) return 10;
81712     if (z2 === 17) return 20;
81713     if (z2 === 18) return 40;
81714     if (z2 > 18) return 80;
81715   }
81716   function loadTiles2(which, url, projection2) {
81717     var currZoom = Math.floor(geoScaleToZoom(projection2.scale()));
81718     var tiles = tiler3.getTiles(projection2);
81719     var cache = _oscCache[which];
81720     Object.keys(cache.inflight).forEach(function(k2) {
81721       var wanted = tiles.find(function(tile) {
81722         return k2.indexOf(tile.id + ",") === 0;
81723       });
81724       if (!wanted) {
81725         abortRequest3(cache.inflight[k2]);
81726         delete cache.inflight[k2];
81727       }
81728     });
81729     tiles.forEach(function(tile) {
81730       loadNextTilePage(which, currZoom, url, tile);
81731     });
81732   }
81733   function loadNextTilePage(which, currZoom, url, tile) {
81734     var cache = _oscCache[which];
81735     var bbox2 = tile.extent.bbox();
81736     var maxPages = maxPageAtZoom(currZoom);
81737     var nextPage = cache.nextPage[tile.id] || 1;
81738     var params = utilQsString({
81739       ipp: maxResults,
81740       page: nextPage,
81741       // client_id: clientId,
81742       bbTopLeft: [bbox2.maxY, bbox2.minX].join(","),
81743       bbBottomRight: [bbox2.minY, bbox2.maxX].join(",")
81744     }, true);
81745     if (nextPage > maxPages) return;
81746     var id2 = tile.id + "," + String(nextPage);
81747     if (cache.loaded[id2] || cache.inflight[id2]) return;
81748     var controller = new AbortController();
81749     cache.inflight[id2] = controller;
81750     var options2 = {
81751       method: "POST",
81752       signal: controller.signal,
81753       body: params,
81754       headers: { "Content-Type": "application/x-www-form-urlencoded" }
81755     };
81756     json_default(url, options2).then(function(data) {
81757       cache.loaded[id2] = true;
81758       delete cache.inflight[id2];
81759       if (!data || !data.currentPageItems || !data.currentPageItems.length) {
81760         throw new Error("No Data");
81761       }
81762       var features = data.currentPageItems.map(function(item) {
81763         var loc = [+item.lng, +item.lat];
81764         var d2;
81765         if (which === "images") {
81766           d2 = {
81767             loc,
81768             key: item.id,
81769             ca: +item.heading,
81770             captured_at: item.shot_date || item.date_added,
81771             captured_by: item.username,
81772             imagePath: item.name,
81773             sequence_id: item.sequence_id,
81774             sequence_index: +item.sequence_index
81775           };
81776           var seq = _oscCache.sequences[d2.sequence_id];
81777           if (!seq) {
81778             seq = { rotation: 0, images: [] };
81779             _oscCache.sequences[d2.sequence_id] = seq;
81780           }
81781           seq.images[d2.sequence_index] = d2;
81782           _oscCache.images.forImageKey[d2.key] = d2;
81783         }
81784         return {
81785           minX: loc[0],
81786           minY: loc[1],
81787           maxX: loc[0],
81788           maxY: loc[1],
81789           data: d2
81790         };
81791       });
81792       cache.rtree.load(features);
81793       if (data.currentPageItems.length === maxResults) {
81794         cache.nextPage[tile.id] = nextPage + 1;
81795         loadNextTilePage(which, currZoom, url, tile);
81796       } else {
81797         cache.nextPage[tile.id] = Infinity;
81798       }
81799       if (which === "images") {
81800         dispatch6.call("loadedImages");
81801       }
81802     }).catch(function() {
81803       cache.loaded[id2] = true;
81804       delete cache.inflight[id2];
81805     });
81806   }
81807   function partitionViewport2(projection2) {
81808     var z2 = geoScaleToZoom(projection2.scale());
81809     var z22 = Math.ceil(z2 * 2) / 2 + 2.5;
81810     var tiler8 = utilTiler().zoomExtent([z22, z22]);
81811     return tiler8.getTiles(projection2).map(function(tile) {
81812       return tile.extent;
81813     });
81814   }
81815   function searchLimited2(limit, projection2, rtree) {
81816     limit = limit || 5;
81817     return partitionViewport2(projection2).reduce(function(result, extent) {
81818       var found = rtree.search(extent.bbox()).slice(0, limit).map(function(d2) {
81819         return d2.data;
81820       });
81821       return found.length ? result.concat(found) : result;
81822     }, []);
81823   }
81824   var apibase2, maxResults, tileZoom, tiler3, dispatch6, imgZoom, _oscCache, _oscSelectedImage, _loadViewerPromise2, kartaview_default;
81825   var init_kartaview = __esm({
81826     "modules/services/kartaview.js"() {
81827       "use strict";
81828       init_src4();
81829       init_src18();
81830       init_src12();
81831       init_rbush();
81832       init_localizer();
81833       init_geo2();
81834       init_util();
81835       apibase2 = "https://kartaview.org";
81836       maxResults = 1e3;
81837       tileZoom = 14;
81838       tiler3 = utilTiler().zoomExtent([tileZoom, tileZoom]).skipNullIsland(true);
81839       dispatch6 = dispatch_default("loadedImages");
81840       imgZoom = zoom_default2().extent([[0, 0], [320, 240]]).translateExtent([[0, 0], [320, 240]]).scaleExtent([1, 15]);
81841       kartaview_default = {
81842         init: function() {
81843           if (!_oscCache) {
81844             this.reset();
81845           }
81846           this.event = utilRebind(this, dispatch6, "on");
81847         },
81848         reset: function() {
81849           if (_oscCache) {
81850             Object.values(_oscCache.images.inflight).forEach(abortRequest3);
81851           }
81852           _oscCache = {
81853             images: { inflight: {}, loaded: {}, nextPage: {}, rtree: new RBush(), forImageKey: {} },
81854             sequences: {}
81855           };
81856           _oscSelectedImage = null;
81857         },
81858         images: function(projection2) {
81859           var limit = 5;
81860           return searchLimited2(limit, projection2, _oscCache.images.rtree);
81861         },
81862         sequences: function(projection2) {
81863           var viewport = projection2.clipExtent();
81864           var min3 = [viewport[0][0], viewport[1][1]];
81865           var max3 = [viewport[1][0], viewport[0][1]];
81866           var bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
81867           var sequenceKeys = {};
81868           _oscCache.images.rtree.search(bbox2).forEach(function(d2) {
81869             sequenceKeys[d2.data.sequence_id] = true;
81870           });
81871           var lineStrings = [];
81872           Object.keys(sequenceKeys).forEach(function(sequenceKey) {
81873             var seq = _oscCache.sequences[sequenceKey];
81874             var images = seq && seq.images;
81875             if (images) {
81876               lineStrings.push({
81877                 type: "LineString",
81878                 coordinates: images.map(function(d2) {
81879                   return d2.loc;
81880                 }).filter(Boolean),
81881                 properties: {
81882                   captured_at: images[0] ? images[0].captured_at : null,
81883                   captured_by: images[0] ? images[0].captured_by : null,
81884                   key: sequenceKey
81885                 }
81886               });
81887             }
81888           });
81889           return lineStrings;
81890         },
81891         cachedImage: function(imageKey) {
81892           return _oscCache.images.forImageKey[imageKey];
81893         },
81894         loadImages: function(projection2) {
81895           var url = apibase2 + "/1.0/list/nearby-photos/";
81896           loadTiles2("images", url, projection2);
81897         },
81898         ensureViewerLoaded: function(context) {
81899           if (_loadViewerPromise2) return _loadViewerPromise2;
81900           var wrap2 = context.container().select(".photoviewer").selectAll(".kartaview-wrapper").data([0]);
81901           var that = this;
81902           var wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper kartaview-wrapper").classed("hide", true).call(imgZoom.on("zoom", zoomPan2)).on("dblclick.zoom", null);
81903           wrapEnter.append("div").attr("class", "photo-attribution fillD");
81904           var controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
81905           controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
81906           controlsEnter.append("button").on("click.rotate-ccw", rotate(-90)).text("\u293F");
81907           controlsEnter.append("button").on("click.rotate-cw", rotate(90)).text("\u293E");
81908           controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
81909           wrapEnter.append("div").attr("class", "kartaview-image-wrap");
81910           context.ui().photoviewer.on("resize.kartaview", function(dimensions) {
81911             imgZoom.extent([[0, 0], dimensions]).translateExtent([[0, 0], dimensions]);
81912           });
81913           function zoomPan2(d3_event) {
81914             var t2 = d3_event.transform;
81915             context.container().select(".photoviewer .kartaview-image-wrap").call(utilSetTransform, t2.x, t2.y, t2.k);
81916           }
81917           function rotate(deg) {
81918             return function() {
81919               if (!_oscSelectedImage) return;
81920               var sequenceKey = _oscSelectedImage.sequence_id;
81921               var sequence = _oscCache.sequences[sequenceKey];
81922               if (!sequence) return;
81923               var r2 = sequence.rotation || 0;
81924               r2 += deg;
81925               if (r2 > 180) r2 -= 360;
81926               if (r2 < -180) r2 += 360;
81927               sequence.rotation = r2;
81928               var wrap3 = context.container().select(".photoviewer .kartaview-wrapper");
81929               wrap3.transition().duration(100).call(imgZoom.transform, identity2);
81930               wrap3.selectAll(".kartaview-image").transition().duration(100).style("transform", "rotate(" + r2 + "deg)");
81931             };
81932           }
81933           function step(stepBy) {
81934             return function() {
81935               if (!_oscSelectedImage) return;
81936               var sequenceKey = _oscSelectedImage.sequence_id;
81937               var sequence = _oscCache.sequences[sequenceKey];
81938               if (!sequence) return;
81939               var nextIndex = _oscSelectedImage.sequence_index + stepBy;
81940               var nextImage = sequence.images[nextIndex];
81941               if (!nextImage) return;
81942               context.map().centerEase(nextImage.loc);
81943               that.selectImage(context, nextImage.key);
81944             };
81945           }
81946           _loadViewerPromise2 = Promise.resolve();
81947           return _loadViewerPromise2;
81948         },
81949         showViewer: function(context) {
81950           var viewer = context.container().select(".photoviewer").classed("hide", false);
81951           var isHidden = viewer.selectAll(".photo-wrapper.kartaview-wrapper.hide").size();
81952           if (isHidden) {
81953             viewer.selectAll(".photo-wrapper:not(.kartaview-wrapper)").classed("hide", true);
81954             viewer.selectAll(".photo-wrapper.kartaview-wrapper").classed("hide", false);
81955           }
81956           return this;
81957         },
81958         hideViewer: function(context) {
81959           _oscSelectedImage = null;
81960           this.updateUrlImage(null);
81961           var viewer = context.container().select(".photoviewer");
81962           if (!viewer.empty()) viewer.datum(null);
81963           viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
81964           context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
81965           return this.setStyles(context, null, true);
81966         },
81967         selectImage: function(context, imageKey) {
81968           var d2 = this.cachedImage(imageKey);
81969           _oscSelectedImage = d2;
81970           this.updateUrlImage(imageKey);
81971           var viewer = context.container().select(".photoviewer");
81972           if (!viewer.empty()) viewer.datum(d2);
81973           this.setStyles(context, null, true);
81974           context.container().selectAll(".icon-sign").classed("currentView", false);
81975           if (!d2) return this;
81976           var wrap2 = context.container().select(".photoviewer .kartaview-wrapper");
81977           var imageWrap = wrap2.selectAll(".kartaview-image-wrap");
81978           var attribution = wrap2.selectAll(".photo-attribution").text("");
81979           wrap2.transition().duration(100).call(imgZoom.transform, identity2);
81980           imageWrap.selectAll(".kartaview-image").remove();
81981           if (d2) {
81982             var sequence = _oscCache.sequences[d2.sequence_id];
81983             var r2 = sequence && sequence.rotation || 0;
81984             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)");
81985             if (d2.captured_by) {
81986               attribution.append("a").attr("class", "captured_by").attr("target", "_blank").attr("href", "https://kartaview.org/user/" + encodeURIComponent(d2.captured_by)).text("@" + d2.captured_by);
81987               attribution.append("span").text("|");
81988             }
81989             if (d2.captured_at) {
81990               attribution.append("span").attr("class", "captured_at").text(localeDateString2(d2.captured_at));
81991               attribution.append("span").text("|");
81992             }
81993             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");
81994           }
81995           return this;
81996           function localeDateString2(s2) {
81997             if (!s2) return null;
81998             var options2 = { day: "numeric", month: "short", year: "numeric" };
81999             var d4 = new Date(s2);
82000             if (isNaN(d4.getTime())) return null;
82001             return d4.toLocaleDateString(_mainLocalizer.localeCode(), options2);
82002           }
82003         },
82004         getSelectedImage: function() {
82005           return _oscSelectedImage;
82006         },
82007         getSequenceKeyForImage: function(d2) {
82008           return d2 && d2.sequence_id;
82009         },
82010         // Updates the currently highlighted sequence and selected bubble.
82011         // Reset is only necessary when interacting with the viewport because
82012         // this implicitly changes the currently selected bubble/sequence
82013         setStyles: function(context, hovered, reset) {
82014           if (reset) {
82015             context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
82016             context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
82017           }
82018           var hoveredImageId = hovered && hovered.key;
82019           var hoveredSequenceId = this.getSequenceKeyForImage(hovered);
82020           var viewer = context.container().select(".photoviewer");
82021           var selected = viewer.empty() ? void 0 : viewer.datum();
82022           var selectedImageId = selected && selected.key;
82023           var selectedSequenceId = this.getSequenceKeyForImage(selected);
82024           context.container().selectAll(".layer-kartaview .viewfield-group").classed("highlighted", function(d2) {
82025             return d2.sequence_id === selectedSequenceId || d2.id === hoveredImageId;
82026           }).classed("hovered", function(d2) {
82027             return d2.key === hoveredImageId;
82028           }).classed("currentView", function(d2) {
82029             return d2.key === selectedImageId;
82030           });
82031           context.container().selectAll(".layer-kartaview .sequence").classed("highlighted", function(d2) {
82032             return d2.properties.key === hoveredSequenceId;
82033           }).classed("currentView", function(d2) {
82034             return d2.properties.key === selectedSequenceId;
82035           });
82036           context.container().selectAll(".layer-kartaview .viewfield-group .viewfield").attr("d", viewfieldPath);
82037           function viewfieldPath() {
82038             var d2 = this.parentNode.__data__;
82039             if (d2.pano && d2.key !== selectedImageId) {
82040               return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
82041             } else {
82042               return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
82043             }
82044           }
82045           return this;
82046         },
82047         updateUrlImage: function(imageKey) {
82048           if (!window.mocha) {
82049             var hash2 = utilStringQs(window.location.hash);
82050             if (imageKey) {
82051               hash2.photo = "kartaview/" + imageKey;
82052             } else {
82053               delete hash2.photo;
82054             }
82055             window.location.replace("#" + utilQsString(hash2, true));
82056           }
82057         },
82058         cache: function() {
82059           return _oscCache;
82060         }
82061       };
82062     }
82063   });
82064
82065   // modules/services/pannellum_photo.js
82066   var pannellum_photo_exports = {};
82067   __export(pannellum_photo_exports, {
82068     default: () => pannellum_photo_default
82069   });
82070   var pannellumViewerCSS, pannellumViewerJS, dispatch7, _currScenes, _pannellumViewer, pannellum_photo_default;
82071   var init_pannellum_photo = __esm({
82072     "modules/services/pannellum_photo.js"() {
82073       "use strict";
82074       init_src5();
82075       init_src4();
82076       init_util();
82077       pannellumViewerCSS = "pannellum/pannellum.css";
82078       pannellumViewerJS = "pannellum/pannellum.js";
82079       dispatch7 = dispatch_default("viewerChanged");
82080       _currScenes = [];
82081       pannellum_photo_default = {
82082         init: async function(context, selection2) {
82083           selection2.append("div").attr("class", "photo-frame pannellum-frame").attr("id", "ideditor-pannellum-viewer").classed("hide", true).on("mousedown", function(e3) {
82084             e3.stopPropagation();
82085           }).on("keydown", function(e3) {
82086             e3.stopPropagation();
82087           });
82088           if (!window.pannellum) {
82089             await this.loadPannellum(context);
82090           }
82091           const options2 = {
82092             "default": { firstScene: "" },
82093             scenes: {},
82094             minHfov: 20
82095           };
82096           _pannellumViewer = window.pannellum.viewer("ideditor-pannellum-viewer", options2);
82097           _pannellumViewer.on("mousedown", () => {
82098             select_default2(window).on("pointermove.pannellum mousemove.pannellum", () => {
82099               dispatch7.call("viewerChanged");
82100             });
82101           }).on("mouseup", () => {
82102             select_default2(window).on("pointermove.pannellum mousemove.pannellum", null);
82103           }).on("animatefinished", () => {
82104             dispatch7.call("viewerChanged");
82105           });
82106           context.ui().photoviewer.on("resize.pannellum", () => {
82107             _pannellumViewer.resize();
82108           });
82109           this.event = utilRebind(this, dispatch7, "on");
82110           return this;
82111         },
82112         loadPannellum: function(context) {
82113           const head = select_default2("head");
82114           return Promise.all([
82115             new Promise((resolve, reject) => {
82116               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);
82117             }),
82118             new Promise((resolve, reject) => {
82119               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);
82120             })
82121           ]);
82122         },
82123         /**
82124          * Shows the photo frame if hidden
82125          * @param {*} context the HTML wrap of the frame
82126          */
82127         showPhotoFrame: function(context) {
82128           const isHidden = context.selectAll(".photo-frame.pannellum-frame.hide").size();
82129           if (isHidden) {
82130             context.selectAll(".photo-frame:not(.pannellum-frame)").classed("hide", true);
82131             context.selectAll(".photo-frame.pannellum-frame").classed("hide", false);
82132           }
82133           return this;
82134         },
82135         /**
82136          * Hides the photo frame if shown
82137          * @param {*} context the HTML wrap of the frame
82138          */
82139         hidePhotoFrame: function(viewerContext) {
82140           viewerContext.select("photo-frame.pannellum-frame").classed("hide", false);
82141           return this;
82142         },
82143         /**
82144          * Renders an image inside the frame
82145          * @param {*} data the image data, it should contain an image_path attribute, a link to the actual image.
82146          * @param {boolean} keepOrientation if true, HFOV, pitch and yaw will be kept between images
82147          */
82148         selectPhoto: function(data, keepOrientation) {
82149           const { key } = data;
82150           if (!(key in _currScenes)) {
82151             let newSceneOptions = {
82152               showFullscreenCtrl: false,
82153               autoLoad: false,
82154               compass: false,
82155               yaw: 0,
82156               type: "equirectangular",
82157               preview: data.preview_path,
82158               panorama: data.image_path,
82159               northOffset: data.ca
82160             };
82161             _currScenes.push(key);
82162             _pannellumViewer.addScene(key, newSceneOptions);
82163           }
82164           let yaw = 0;
82165           let pitch = 0;
82166           let hfov = 0;
82167           if (keepOrientation) {
82168             yaw = this.getYaw();
82169             pitch = this.getPitch();
82170             hfov = this.getHfov();
82171           }
82172           _pannellumViewer.loadScene(key, pitch, yaw, hfov);
82173           dispatch7.call("viewerChanged");
82174           if (_currScenes.length > 3) {
82175             const old_key = _currScenes.shift();
82176             _pannellumViewer.removeScene(old_key);
82177           }
82178           _pannellumViewer.resize();
82179           return this;
82180         },
82181         getYaw: function() {
82182           return _pannellumViewer.getYaw();
82183         },
82184         getPitch: function() {
82185           return _pannellumViewer.getPitch();
82186         },
82187         getHfov: function() {
82188           return _pannellumViewer.getHfov();
82189         }
82190       };
82191     }
82192   });
82193
82194   // modules/services/vegbilder.js
82195   var vegbilder_exports2 = {};
82196   __export(vegbilder_exports2, {
82197     default: () => vegbilder_default
82198   });
82199   async function fetchAvailableLayers() {
82200     var _a3, _b2, _c;
82201     const params = {
82202       service: "WFS",
82203       request: "GetCapabilities",
82204       version: "2.0.0"
82205     };
82206     const urlForRequest = owsEndpoint + utilQsString(params);
82207     const response = await xml_default(urlForRequest);
82208     const regexMatcher = /^vegbilder_1_0:Vegbilder(?<image_type>_360)?_(?<year>\d{4})$/;
82209     const availableLayers = [];
82210     for (const node of response.querySelectorAll("FeatureType > Name")) {
82211       const match = (_a3 = node.textContent) == null ? void 0 : _a3.match(regexMatcher);
82212       if (match) {
82213         availableLayers.push({
82214           name: match[0],
82215           is_sphere: !!((_b2 = match.groups) == null ? void 0 : _b2.image_type),
82216           year: parseInt((_c = match.groups) == null ? void 0 : _c.year, 10)
82217         });
82218       }
82219     }
82220     return availableLayers;
82221   }
82222   function filterAvailableLayers(photoContex) {
82223     const fromDateString = photoContex.fromDate();
82224     const toDateString = photoContex.toDate();
82225     const fromYear = fromDateString ? new Date(fromDateString).getFullYear() : 2016;
82226     const toYear = toDateString ? new Date(toDateString).getFullYear() : null;
82227     const showsFlat = photoContex.showsFlat();
82228     const showsPano = photoContex.showsPanoramic();
82229     return Array.from(_vegbilderCache.wfslayers.values()).filter(({ layerInfo }) => layerInfo.year >= fromYear && (!toYear || layerInfo.year <= toYear) && (!layerInfo.is_sphere && showsFlat || layerInfo.is_sphere && showsPano));
82230   }
82231   function loadWFSLayers(projection2, margin, wfslayers) {
82232     const tiles = tiler4.margin(margin).getTiles(projection2);
82233     for (const cache of wfslayers) {
82234       loadWFSLayer(projection2, cache, tiles);
82235     }
82236   }
82237   function loadWFSLayer(projection2, cache, tiles) {
82238     for (const [key, controller] of cache.inflight.entries()) {
82239       const wanted = tiles.some((tile) => key === tile.id);
82240       if (!wanted) {
82241         controller.abort();
82242         cache.inflight.delete(key);
82243       }
82244     }
82245     Promise.all(tiles.map(
82246       (tile) => loadTile2(cache, cache.layerInfo.name, tile)
82247     )).then(() => orderSequences(projection2, cache));
82248   }
82249   async function loadTile2(cache, typename, tile) {
82250     const bbox2 = tile.extent.bbox();
82251     const tileid = tile.id;
82252     if (cache.loaded.get(tileid) === true || cache.inflight.has(tileid)) return;
82253     const params = {
82254       service: "WFS",
82255       request: "GetFeature",
82256       version: "2.0.0",
82257       typenames: typename,
82258       bbox: [bbox2.minY, bbox2.minX, bbox2.maxY, bbox2.maxX].join(","),
82259       outputFormat: "json"
82260     };
82261     const controller = new AbortController();
82262     cache.inflight.set(tileid, controller);
82263     const options2 = {
82264       method: "GET",
82265       signal: controller.signal
82266     };
82267     const urlForRequest = owsEndpoint + utilQsString(params);
82268     let featureCollection;
82269     try {
82270       featureCollection = await json_default(urlForRequest, options2);
82271     } catch {
82272       cache.loaded.set(tileid, false);
82273       return;
82274     } finally {
82275       cache.inflight.delete(tileid);
82276     }
82277     cache.loaded.set(tileid, true);
82278     if (featureCollection.features.length === 0) {
82279       return;
82280     }
82281     const features = featureCollection.features.map((feature3) => {
82282       const loc = feature3.geometry.coordinates;
82283       const key = feature3.id;
82284       const properties = feature3.properties;
82285       const {
82286         RETNING: ca,
82287         TIDSPUNKT: captured_at,
82288         URL: image_path,
82289         URLPREVIEW: preview_path,
82290         BILDETYPE: image_type,
82291         METER: metering,
82292         FELTKODE: lane_code
82293       } = properties;
82294       const lane_number = parseInt(lane_code.match(/^[0-9]+/)[0], 10);
82295       const direction = lane_number % 2 === 0 ? directionEnum.backward : directionEnum.forward;
82296       const data = {
82297         loc,
82298         key,
82299         ca,
82300         image_path,
82301         preview_path,
82302         road_reference: roadReference(properties),
82303         metering,
82304         lane_code,
82305         direction,
82306         captured_at: new Date(captured_at),
82307         is_sphere: image_type === "360"
82308       };
82309       cache.points.set(key, data);
82310       return {
82311         minX: loc[0],
82312         minY: loc[1],
82313         maxX: loc[0],
82314         maxY: loc[1],
82315         data
82316       };
82317     });
82318     _vegbilderCache.rtree.load(features);
82319     dispatch8.call("loadedImages");
82320   }
82321   function orderSequences(projection2, cache) {
82322     const { points } = cache;
82323     const grouped = Array.from(points.values()).reduce((grouped2, image) => {
82324       const key = image.road_reference;
82325       if (grouped2.has(key)) {
82326         grouped2.get(key).push(image);
82327       } else {
82328         grouped2.set(key, [image]);
82329       }
82330       return grouped2;
82331     }, /* @__PURE__ */ new Map());
82332     const imageSequences = Array.from(grouped.values()).reduce((imageSequences2, imageGroup) => {
82333       imageGroup.sort((a2, b2) => {
82334         if (a2.captured_at.valueOf() > b2.captured_at.valueOf()) {
82335           return 1;
82336         } else if (a2.captured_at.valueOf() < b2.captured_at.valueOf()) {
82337           return -1;
82338         } else {
82339           const { direction } = a2;
82340           if (direction === directionEnum.forward) {
82341             return a2.metering - b2.metering;
82342           } else {
82343             return b2.metering - a2.metering;
82344           }
82345         }
82346       });
82347       let imageSequence = [imageGroup[0]];
82348       let angle2 = null;
82349       for (const [lastImage, image] of pairs(imageGroup)) {
82350         if (lastImage.ca === null) {
82351           const b2 = projection2(lastImage.loc);
82352           const a2 = projection2(image.loc);
82353           if (!geoVecEqual(a2, b2)) {
82354             angle2 = geoVecAngle(a2, b2);
82355             angle2 *= 180 / Math.PI;
82356             angle2 -= 90;
82357             angle2 = angle2 >= 0 ? angle2 : angle2 + 360;
82358           }
82359           lastImage.ca = angle2;
82360         }
82361         if (image.direction === lastImage.direction && image.captured_at.valueOf() - lastImage.captured_at.valueOf() <= 2e4) {
82362           imageSequence.push(image);
82363         } else {
82364           imageSequences2.push(imageSequence);
82365           imageSequence = [image];
82366         }
82367       }
82368       imageSequences2.push(imageSequence);
82369       return imageSequences2;
82370     }, []);
82371     cache.sequences = imageSequences.map((images) => {
82372       const sequence = {
82373         images,
82374         key: images[0].key,
82375         geometry: {
82376           type: "LineString",
82377           coordinates: images.map((image) => image.loc)
82378         }
82379       };
82380       for (const image of images) {
82381         _vegbilderCache.image2sequence_map.set(image.key, sequence);
82382       }
82383       return sequence;
82384     });
82385   }
82386   function roadReference(properties) {
82387     const {
82388       FYLKENUMMER: county_number,
82389       VEGKATEGORI: road_class,
82390       VEGSTATUS: road_status,
82391       VEGNUMMER: road_number,
82392       STREKNING: section,
82393       DELSTREKNING: subsection,
82394       HP: parcel,
82395       KRYSSDEL: junction_part,
82396       SIDEANLEGGSDEL: services_part,
82397       ANKERPUNKT: anker_point,
82398       AAR: year
82399     } = properties;
82400     let reference;
82401     if (year >= 2020) {
82402       reference = `${road_class}${road_status}${road_number} S${section}D${subsection}`;
82403       if (junction_part) {
82404         reference = `${reference} M${anker_point} KD${junction_part}`;
82405       } else if (services_part) {
82406         reference = `${reference} M${anker_point} SD${services_part}`;
82407       }
82408     } else {
82409       reference = `${county_number}${road_class}${road_status}${road_number} HP${parcel}`;
82410     }
82411     return reference;
82412   }
82413   function localeTimestamp(date) {
82414     const options2 = {
82415       day: "2-digit",
82416       month: "2-digit",
82417       year: "numeric",
82418       hour: "numeric",
82419       minute: "numeric",
82420       second: "numeric"
82421     };
82422     return date.toLocaleString(_mainLocalizer.localeCode(), options2);
82423   }
82424   function partitionViewport3(projection2) {
82425     const zoom = geoScaleToZoom(projection2.scale());
82426     const roundZoom = Math.ceil(zoom * 2) / 2 + 2.5;
82427     const tiler8 = utilTiler().zoomExtent([roundZoom, roundZoom]);
82428     return tiler8.getTiles(projection2).map((tile) => tile.extent);
82429   }
82430   function searchLimited3(limit, projection2, rtree) {
82431     limit != null ? limit : limit = 5;
82432     return partitionViewport3(projection2).reduce((result, extent) => {
82433       const found = rtree.search(extent.bbox()).slice(0, limit).map((d2) => d2.data);
82434       return result.concat(found);
82435     }, []);
82436   }
82437   var owsEndpoint, tileZoom2, tiler4, dispatch8, directionEnum, _planeFrame, _pannellumFrame, _currentFrame, _loadViewerPromise3, _vegbilderCache, vegbilder_default;
82438   var init_vegbilder2 = __esm({
82439     "modules/services/vegbilder.js"() {
82440       "use strict";
82441       init_src18();
82442       init_src4();
82443       init_src();
82444       init_rbush();
82445       init_country_coder();
82446       init_localizer();
82447       init_util();
82448       init_geo2();
82449       init_pannellum_photo();
82450       init_plane_photo();
82451       owsEndpoint = "https://www.vegvesen.no/kart/ogc/vegbilder_1_0/ows?";
82452       tileZoom2 = 14;
82453       tiler4 = utilTiler().zoomExtent([tileZoom2, tileZoom2]).skipNullIsland(true);
82454       dispatch8 = dispatch_default("loadedImages", "viewerChanged");
82455       directionEnum = Object.freeze({
82456         forward: Symbol(0),
82457         backward: Symbol(1)
82458       });
82459       vegbilder_default = {
82460         init: function() {
82461           this.event = utilRebind(this, dispatch8, "on");
82462         },
82463         reset: async function() {
82464           if (_vegbilderCache) {
82465             for (const layer of _vegbilderCache.wfslayers.values()) {
82466               for (const controller of layer.inflight.values()) {
82467                 controller.abort();
82468               }
82469             }
82470           }
82471           _vegbilderCache = {
82472             wfslayers: /* @__PURE__ */ new Map(),
82473             rtree: new RBush(),
82474             image2sequence_map: /* @__PURE__ */ new Map()
82475           };
82476           const availableLayers = await fetchAvailableLayers();
82477           const { wfslayers } = _vegbilderCache;
82478           for (const layerInfo of availableLayers) {
82479             const cache = {
82480               layerInfo,
82481               loaded: /* @__PURE__ */ new Map(),
82482               inflight: /* @__PURE__ */ new Map(),
82483               points: /* @__PURE__ */ new Map(),
82484               sequences: []
82485             };
82486             wfslayers.set(layerInfo.name, cache);
82487           }
82488         },
82489         images: function(projection2) {
82490           const limit = 5;
82491           return searchLimited3(limit, projection2, _vegbilderCache.rtree);
82492         },
82493         sequences: function(projection2) {
82494           const viewport = projection2.clipExtent();
82495           const min3 = [viewport[0][0], viewport[1][1]];
82496           const max3 = [viewport[1][0], viewport[0][1]];
82497           const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
82498           const seen = /* @__PURE__ */ new Set();
82499           const line_strings = [];
82500           for (const { data } of _vegbilderCache.rtree.search(bbox2)) {
82501             const sequence = _vegbilderCache.image2sequence_map.get(data.key);
82502             if (!sequence) continue;
82503             const { key, geometry, images } = sequence;
82504             if (seen.has(key)) continue;
82505             seen.add(key);
82506             const line = {
82507               type: "LineString",
82508               coordinates: geometry.coordinates,
82509               key,
82510               images
82511             };
82512             line_strings.push(line);
82513           }
82514           return line_strings;
82515         },
82516         cachedImage: function(key) {
82517           for (const { points } of _vegbilderCache.wfslayers.values()) {
82518             if (points.has(key)) return points.get(key);
82519           }
82520         },
82521         getSequenceForImage: function(image) {
82522           return _vegbilderCache == null ? void 0 : _vegbilderCache.image2sequence_map.get(image == null ? void 0 : image.key);
82523         },
82524         loadImages: async function(context, margin) {
82525           if (!_vegbilderCache) {
82526             await this.reset();
82527           }
82528           margin != null ? margin : margin = 1;
82529           const wfslayers = filterAvailableLayers(context.photos());
82530           loadWFSLayers(context.projection, margin, wfslayers);
82531         },
82532         photoFrame: function() {
82533           return _currentFrame;
82534         },
82535         ensureViewerLoaded: function(context) {
82536           if (_loadViewerPromise3) return _loadViewerPromise3;
82537           const step = (stepBy) => () => {
82538             const viewer = context.container().select(".photoviewer");
82539             const selected = viewer.empty() ? void 0 : viewer.datum();
82540             if (!selected) return;
82541             const sequence = this.getSequenceForImage(selected);
82542             const nextIndex = sequence.images.indexOf(selected) + stepBy;
82543             const nextImage = sequence.images[nextIndex];
82544             if (!nextImage) return;
82545             context.map().centerEase(nextImage.loc);
82546             this.selectImage(context, nextImage.key, true);
82547           };
82548           const wrap2 = context.container().select(".photoviewer").selectAll(".vegbilder-wrapper").data([0]);
82549           const wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper vegbilder-wrapper").classed("hide", true);
82550           wrapEnter.append("div").attr("class", "photo-attribution fillD");
82551           const controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
82552           controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
82553           controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
82554           _loadViewerPromise3 = Promise.all([
82555             pannellum_photo_default.init(context, wrapEnter),
82556             plane_photo_default.init(context, wrapEnter)
82557           ]).then(([pannellumPhotoFrame, planePhotoFrame]) => {
82558             _pannellumFrame = pannellumPhotoFrame;
82559             _pannellumFrame.event.on("viewerChanged", () => dispatch8.call("viewerChanged"));
82560             _planeFrame = planePhotoFrame;
82561             _planeFrame.event.on("viewerChanged", () => dispatch8.call("viewerChanged"));
82562           });
82563           return _loadViewerPromise3;
82564         },
82565         selectImage: function(context, key, keepOrientation) {
82566           const d2 = this.cachedImage(key);
82567           this.updateUrlImage(key);
82568           const viewer = context.container().select(".photoviewer");
82569           if (!viewer.empty()) {
82570             viewer.datum(d2);
82571           }
82572           this.setStyles(context, null, true);
82573           if (!d2) return this;
82574           const wrap2 = context.container().select(".photoviewer .vegbilder-wrapper");
82575           const attribution = wrap2.selectAll(".photo-attribution").text("");
82576           if (d2.captured_at) {
82577             attribution.append("span").attr("class", "captured_at").text(localeTimestamp(d2.captured_at));
82578           }
82579           attribution.append("a").attr("target", "_blank").attr("href", "https://vegvesen.no").call(_t.append("vegbilder.publisher"));
82580           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"));
82581           _currentFrame = d2.is_sphere ? _pannellumFrame : _planeFrame;
82582           _currentFrame.selectPhoto(d2, keepOrientation).showPhotoFrame(wrap2);
82583           return this;
82584         },
82585         showViewer: function(context) {
82586           const viewer = context.container().select(".photoviewer").classed("hide", false);
82587           const isHidden = viewer.selectAll(".photo-wrapper.vegbilder-wrapper.hide").size();
82588           if (isHidden) {
82589             viewer.selectAll(".photo-wrapper:not(.vegbilder-wrapper)").classed("hide", true);
82590             viewer.selectAll(".photo-wrapper.vegbilder-wrapper").classed("hide", false);
82591           }
82592           return this;
82593         },
82594         hideViewer: function(context) {
82595           this.updateUrlImage(null);
82596           const viewer = context.container().select(".photoviewer");
82597           if (!viewer.empty()) viewer.datum(null);
82598           viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
82599           context.container().selectAll(".viewfield-group, .sequence").classed("currentView", false);
82600           return this.setStyles(context, null, true);
82601         },
82602         // Updates the currently highlighted sequence and selected bubble.
82603         // Reset is only necessary when interacting with the viewport because
82604         // this implicitly changes the currently selected bubble/sequence
82605         setStyles: function(context, hovered, reset) {
82606           var _a3, _b2;
82607           if (reset) {
82608             context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
82609             context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
82610           }
82611           const hoveredImageKey = hovered == null ? void 0 : hovered.key;
82612           const hoveredSequence = this.getSequenceForImage(hovered);
82613           const hoveredSequenceKey = hoveredSequence == null ? void 0 : hoveredSequence.key;
82614           const hoveredImageKeys = (_a3 = hoveredSequence == null ? void 0 : hoveredSequence.images.map((d2) => d2.key)) != null ? _a3 : [];
82615           const viewer = context.container().select(".photoviewer");
82616           const selected = viewer.empty() ? void 0 : viewer.datum();
82617           const selectedImageKey = selected == null ? void 0 : selected.key;
82618           const selectedSequence = this.getSequenceForImage(selected);
82619           const selectedSequenceKey = selectedSequence == null ? void 0 : selectedSequence.key;
82620           const selectedImageKeys = (_b2 = selectedSequence == null ? void 0 : selectedSequence.images.map((d2) => d2.key)) != null ? _b2 : [];
82621           const highlightedImageKeys = utilArrayUnion(hoveredImageKeys, selectedImageKeys);
82622           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);
82623           context.container().selectAll(".layer-vegbilder .sequence").classed("highlighted", (d2) => d2.key === hoveredSequenceKey).classed("currentView", (d2) => d2.key === selectedSequenceKey);
82624           context.container().selectAll(".layer-vegbilder .viewfield-group .viewfield").attr("d", viewfieldPath);
82625           function viewfieldPath() {
82626             const d2 = this.parentNode.__data__;
82627             if (d2.is_sphere && d2.key !== selectedImageKey) {
82628               return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
82629             } else {
82630               return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
82631             }
82632           }
82633           return this;
82634         },
82635         updateUrlImage: function(key) {
82636           if (!window.mocha) {
82637             const hash2 = utilStringQs(window.location.hash);
82638             if (key) {
82639               hash2.photo = "vegbilder/" + key;
82640             } else {
82641               delete hash2.photo;
82642             }
82643             window.location.replace("#" + utilQsString(hash2, true));
82644           }
82645         },
82646         validHere: function(extent) {
82647           const bbox2 = Object.values(extent.bbox());
82648           return iso1A2Codes(bbox2).includes("NO");
82649         },
82650         cache: function() {
82651           return _vegbilderCache;
82652         }
82653       };
82654     }
82655   });
82656
82657   // node_modules/osm-auth/src/osm-auth.mjs
82658   function osmAuth(o2) {
82659     var oauth2 = {};
82660     var _store = null;
82661     try {
82662       _store = window.localStorage;
82663     } catch (e3) {
82664       var _mock = /* @__PURE__ */ new Map();
82665       _store = {
82666         isMocked: true,
82667         hasItem: (k2) => _mock.has(k2),
82668         getItem: (k2) => _mock.get(k2),
82669         setItem: (k2, v2) => _mock.set(k2, v2),
82670         removeItem: (k2) => _mock.delete(k2),
82671         clear: () => _mock.clear()
82672       };
82673     }
82674     function token(k2, v2) {
82675       var key = o2.url + k2;
82676       if (arguments.length === 1) {
82677         var val = _store.getItem(key) || "";
82678         return val.replace(/"/g, "");
82679       } else if (arguments.length === 2) {
82680         if (v2) {
82681           return _store.setItem(key, v2);
82682         } else {
82683           return _store.removeItem(key);
82684         }
82685       }
82686     }
82687     oauth2.authenticated = function() {
82688       return !!token("oauth2_access_token");
82689     };
82690     oauth2.logout = function() {
82691       token("oauth2_access_token", "");
82692       token("oauth_token", "");
82693       token("oauth_token_secret", "");
82694       token("oauth_request_token_secret", "");
82695       return oauth2;
82696     };
82697     oauth2.authenticate = function(callback, options2) {
82698       if (oauth2.authenticated()) {
82699         callback(null, oauth2);
82700         return;
82701       }
82702       oauth2.logout();
82703       _preopenPopup(function(error, popup) {
82704         if (error) {
82705           callback(error);
82706         } else {
82707           _generatePkceChallenge(function(pkce) {
82708             _authenticate(pkce, options2, popup, callback);
82709           });
82710         }
82711       });
82712     };
82713     oauth2.authenticateAsync = function(options2) {
82714       if (oauth2.authenticated()) {
82715         return Promise.resolve(oauth2);
82716       }
82717       oauth2.logout();
82718       return new Promise((resolve, reject) => {
82719         var errback = (err, result) => {
82720           if (err) {
82721             reject(err);
82722           } else {
82723             resolve(result);
82724           }
82725         };
82726         _preopenPopup((error, popup) => {
82727           if (error) {
82728             errback(error);
82729           } else {
82730             _generatePkceChallenge((pkce) => _authenticate(pkce, options2, popup, errback));
82731           }
82732         });
82733       });
82734     };
82735     function _preopenPopup(callback) {
82736       if (o2.singlepage) {
82737         callback(null, void 0);
82738         return;
82739       }
82740       var w2 = 550;
82741       var h2 = 610;
82742       var settings = [
82743         ["width", w2],
82744         ["height", h2],
82745         ["left", window.screen.width / 2 - w2 / 2],
82746         ["top", window.screen.height / 2 - h2 / 2]
82747       ].map(function(x2) {
82748         return x2.join("=");
82749       }).join(",");
82750       var popup = window.open("about:blank", "oauth_window", settings);
82751       if (popup) {
82752         callback(null, popup);
82753       } else {
82754         var error = new Error("Popup was blocked");
82755         error.status = "popup-blocked";
82756         callback(error);
82757       }
82758     }
82759     function _authenticate(pkce, options2, popup, callback) {
82760       var state = generateState();
82761       var path = "/oauth2/authorize?" + utilQsString2({
82762         client_id: o2.client_id,
82763         redirect_uri: o2.redirect_uri,
82764         response_type: "code",
82765         scope: o2.scope,
82766         state,
82767         code_challenge: pkce.code_challenge,
82768         code_challenge_method: pkce.code_challenge_method,
82769         locale: o2.locale || ""
82770       });
82771       var url = (options2 == null ? void 0 : options2.switchUser) ? `${o2.url}/logout?referer=${encodeURIComponent(`/login?referer=${encodeURIComponent(path)}`)}` : o2.url + path;
82772       if (o2.singlepage) {
82773         if (_store.isMocked) {
82774           var error = new Error("localStorage unavailable, but required in singlepage mode");
82775           error.status = "pkce-localstorage-unavailable";
82776           callback(error);
82777           return;
82778         }
82779         var params = utilStringQs2(window.location.search.slice(1));
82780         if (params.code) {
82781           oauth2.bootstrapToken(params.code, callback);
82782         } else {
82783           token("oauth2_state", state);
82784           token("oauth2_pkce_code_verifier", pkce.code_verifier);
82785           window.location = url;
82786         }
82787       } else {
82788         var popupClosedWatcher = setInterval(function() {
82789           if (popup.closed) {
82790             var error2 = new Error("Popup was closed prematurely");
82791             error2.status = "popup-closed";
82792             callback(error2);
82793             window.clearInterval(popupClosedWatcher);
82794             delete window.authComplete;
82795           }
82796         }, 1e3);
82797         oauth2.popupWindow = popup;
82798         popup.location = url;
82799       }
82800       window.authComplete = function(url2) {
82801         clearTimeout(popupClosedWatcher);
82802         var params2 = utilStringQs2(url2.split("?")[1]);
82803         if (params2.state !== state) {
82804           var error2 = new Error("Invalid state");
82805           error2.status = "invalid-state";
82806           callback(error2);
82807           return;
82808         }
82809         _getAccessToken(params2.code, pkce.code_verifier, accessTokenDone);
82810         delete window.authComplete;
82811       };
82812       function accessTokenDone(err, xhr) {
82813         o2.done();
82814         if (err) {
82815           callback(err);
82816           return;
82817         }
82818         var access_token = JSON.parse(xhr.response);
82819         token("oauth2_access_token", access_token.access_token);
82820         callback(null, oauth2);
82821       }
82822     }
82823     function _getAccessToken(auth_code, code_verifier, accessTokenDone) {
82824       var url = o2.url + "/oauth2/token?" + utilQsString2({
82825         client_id: o2.client_id,
82826         redirect_uri: o2.redirect_uri,
82827         grant_type: "authorization_code",
82828         code: auth_code,
82829         code_verifier
82830       });
82831       oauth2.rawxhr("POST", url, null, null, null, accessTokenDone);
82832       o2.loading();
82833     }
82834     oauth2.bringPopupWindowToFront = function() {
82835       var broughtPopupToFront = false;
82836       try {
82837         if (oauth2.popupWindow && !oauth2.popupWindow.closed) {
82838           oauth2.popupWindow.focus();
82839           broughtPopupToFront = true;
82840         }
82841       } catch (err) {
82842       }
82843       return broughtPopupToFront;
82844     };
82845     oauth2.bootstrapToken = function(auth_code, callback) {
82846       var state = token("oauth2_state");
82847       token("oauth2_state", "");
82848       var params = utilStringQs2(window.location.search.slice(1));
82849       if (params.state !== state) {
82850         var error = new Error("Invalid state");
82851         error.status = "invalid-state";
82852         callback(error);
82853         return;
82854       }
82855       var code_verifier = token("oauth2_pkce_code_verifier");
82856       token("oauth2_pkce_code_verifier", "");
82857       _getAccessToken(auth_code, code_verifier, accessTokenDone);
82858       function accessTokenDone(err, xhr) {
82859         o2.done();
82860         if (err) {
82861           callback(err);
82862           return;
82863         }
82864         var access_token = JSON.parse(xhr.response);
82865         token("oauth2_access_token", access_token.access_token);
82866         callback(null, oauth2);
82867       }
82868     };
82869     oauth2.fetch = function(resource, options2) {
82870       if (oauth2.authenticated()) {
82871         return _doFetch();
82872       } else {
82873         if (o2.auto) {
82874           return oauth2.authenticateAsync().then(_doFetch);
82875         } else {
82876           return Promise.reject(new Error("not authenticated"));
82877         }
82878       }
82879       function _doFetch() {
82880         options2 = options2 || {};
82881         if (!options2.headers) {
82882           options2.headers = { "Content-Type": "application/x-www-form-urlencoded" };
82883         }
82884         options2.headers.Authorization = "Bearer " + token("oauth2_access_token");
82885         return fetch(resource, options2);
82886       }
82887     };
82888     oauth2.xhr = function(options2, callback) {
82889       if (oauth2.authenticated()) {
82890         return _doXHR();
82891       } else {
82892         if (o2.auto) {
82893           oauth2.authenticate(_doXHR);
82894           return;
82895         } else {
82896           callback("not authenticated", null);
82897           return;
82898         }
82899       }
82900       function _doXHR() {
82901         var url = options2.prefix !== false ? o2.apiUrl + options2.path : options2.path;
82902         return oauth2.rawxhr(
82903           options2.method,
82904           url,
82905           token("oauth2_access_token"),
82906           options2.content,
82907           options2.headers,
82908           done
82909         );
82910       }
82911       function done(err, xhr) {
82912         if (err) {
82913           callback(err);
82914         } else if (xhr.responseXML) {
82915           callback(err, xhr.responseXML);
82916         } else {
82917           callback(err, xhr.response);
82918         }
82919       }
82920     };
82921     oauth2.rawxhr = function(method, url, access_token, data, headers, callback) {
82922       headers = headers || { "Content-Type": "application/x-www-form-urlencoded" };
82923       if (access_token) {
82924         headers.Authorization = "Bearer " + access_token;
82925       }
82926       var xhr = new XMLHttpRequest();
82927       xhr.onreadystatechange = function() {
82928         if (4 === xhr.readyState && 0 !== xhr.status) {
82929           if (/^20\d$/.test(xhr.status)) {
82930             callback(null, xhr);
82931           } else {
82932             callback(xhr, null);
82933           }
82934         }
82935       };
82936       xhr.onerror = function(e3) {
82937         callback(e3, null);
82938       };
82939       xhr.open(method, url, true);
82940       for (var h2 in headers) xhr.setRequestHeader(h2, headers[h2]);
82941       xhr.send(data);
82942       return xhr;
82943     };
82944     oauth2.preauth = function(val) {
82945       if (val && val.access_token) {
82946         token("oauth2_access_token", val.access_token);
82947       }
82948       return oauth2;
82949     };
82950     oauth2.options = function(val) {
82951       if (!arguments.length) return o2;
82952       o2 = val;
82953       o2.apiUrl = o2.apiUrl || "https://api.openstreetmap.org";
82954       o2.url = o2.url || "https://www.openstreetmap.org";
82955       o2.auto = o2.auto || false;
82956       o2.singlepage = o2.singlepage || false;
82957       o2.loading = o2.loading || function() {
82958       };
82959       o2.done = o2.done || function() {
82960       };
82961       return oauth2.preauth(o2);
82962     };
82963     oauth2.options(o2);
82964     return oauth2;
82965   }
82966   function utilQsString2(obj) {
82967     return Object.keys(obj).filter(function(key) {
82968       return obj[key] !== void 0;
82969     }).sort().map(function(key) {
82970       return encodeURIComponent(key) + "=" + encodeURIComponent(obj[key]);
82971     }).join("&");
82972   }
82973   function utilStringQs2(str) {
82974     var i3 = 0;
82975     while (i3 < str.length && (str[i3] === "?" || str[i3] === "#")) i3++;
82976     str = str.slice(i3);
82977     return str.split("&").reduce(function(obj, pair3) {
82978       var parts = pair3.split("=");
82979       if (parts.length === 2) {
82980         obj[parts[0]] = decodeURIComponent(parts[1]);
82981       }
82982       return obj;
82983     }, {});
82984   }
82985   function supportsWebCryptoAPI() {
82986     return window && window.crypto && window.crypto.getRandomValues && window.crypto.subtle && window.crypto.subtle.digest;
82987   }
82988   function _generatePkceChallenge(callback) {
82989     var code_verifier;
82990     if (supportsWebCryptoAPI()) {
82991       var random = window.crypto.getRandomValues(new Uint8Array(32));
82992       code_verifier = base64(random.buffer);
82993       var verifier = Uint8Array.from(Array.from(code_verifier).map(function(char) {
82994         return char.charCodeAt(0);
82995       }));
82996       window.crypto.subtle.digest("SHA-256", verifier).then(function(hash2) {
82997         var code_challenge = base64(hash2);
82998         callback({
82999           code_challenge,
83000           code_verifier,
83001           code_challenge_method: "S256"
83002         });
83003       });
83004     } else {
83005       var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
83006       code_verifier = "";
83007       for (var i3 = 0; i3 < 64; i3++) {
83008         code_verifier += chars[Math.floor(Math.random() * chars.length)];
83009       }
83010       callback({
83011         code_verifier,
83012         code_challenge: code_verifier,
83013         code_challenge_method: "plain"
83014       });
83015     }
83016   }
83017   function generateState() {
83018     var state;
83019     if (supportsWebCryptoAPI()) {
83020       var random = window.crypto.getRandomValues(new Uint8Array(32));
83021       state = base64(random.buffer);
83022     } else {
83023       var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
83024       state = "";
83025       for (var i3 = 0; i3 < 64; i3++) {
83026         state += chars[Math.floor(Math.random() * chars.length)];
83027       }
83028     }
83029     return state;
83030   }
83031   function base64(buffer) {
83032     return btoa(String.fromCharCode.apply(null, new Uint8Array(buffer))).replace(/\//g, "_").replace(/\+/g, "-").replace(/[=]/g, "");
83033   }
83034   var init_osm_auth = __esm({
83035     "node_modules/osm-auth/src/osm-auth.mjs"() {
83036     }
83037   });
83038
83039   // modules/services/osm.js
83040   var osm_exports3 = {};
83041   __export(osm_exports3, {
83042     default: () => osm_default
83043   });
83044   function authLoading() {
83045     dispatch9.call("authLoading");
83046   }
83047   function authDone() {
83048     dispatch9.call("authDone");
83049   }
83050   function abortRequest4(controllerOrXHR) {
83051     if (controllerOrXHR) {
83052       controllerOrXHR.abort();
83053     }
83054   }
83055   function hasInflightRequests(cache) {
83056     return Object.keys(cache.inflight).length;
83057   }
83058   function abortUnwantedRequests3(cache, visibleTiles) {
83059     Object.keys(cache.inflight).forEach(function(k2) {
83060       if (cache.toLoad[k2]) return;
83061       if (visibleTiles.find(function(tile) {
83062         return k2 === tile.id;
83063       })) return;
83064       abortRequest4(cache.inflight[k2]);
83065       delete cache.inflight[k2];
83066     });
83067   }
83068   function getLoc(attrs) {
83069     var lon = attrs.lon && attrs.lon.value;
83070     var lat = attrs.lat && attrs.lat.value;
83071     return [Number(lon), Number(lat)];
83072   }
83073   function getNodes(obj) {
83074     var elems = obj.getElementsByTagName("nd");
83075     var nodes = new Array(elems.length);
83076     for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
83077       nodes[i3] = "n" + elems[i3].attributes.ref.value;
83078     }
83079     return nodes;
83080   }
83081   function getNodesJSON(obj) {
83082     var elems = obj.nodes;
83083     var nodes = new Array(elems.length);
83084     for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
83085       nodes[i3] = "n" + elems[i3];
83086     }
83087     return nodes;
83088   }
83089   function getTags(obj) {
83090     var elems = obj.getElementsByTagName("tag");
83091     var tags = {};
83092     for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
83093       var attrs = elems[i3].attributes;
83094       tags[attrs.k.value] = attrs.v.value;
83095     }
83096     return tags;
83097   }
83098   function getMembers(obj) {
83099     var elems = obj.getElementsByTagName("member");
83100     var members = new Array(elems.length);
83101     for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
83102       var attrs = elems[i3].attributes;
83103       members[i3] = {
83104         id: attrs.type.value[0] + attrs.ref.value,
83105         type: attrs.type.value,
83106         role: attrs.role.value
83107       };
83108     }
83109     return members;
83110   }
83111   function getMembersJSON(obj) {
83112     var elems = obj.members;
83113     var members = new Array(elems.length);
83114     for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
83115       var attrs = elems[i3];
83116       members[i3] = {
83117         id: attrs.type[0] + attrs.ref,
83118         type: attrs.type,
83119         role: attrs.role
83120       };
83121     }
83122     return members;
83123   }
83124   function getVisible(attrs) {
83125     return !attrs.visible || attrs.visible.value !== "false";
83126   }
83127   function parseComments(comments) {
83128     var parsedComments = [];
83129     for (var i3 = 0; i3 < comments.length; i3++) {
83130       var comment = comments[i3];
83131       if (comment.nodeName === "comment") {
83132         var childNodes = comment.childNodes;
83133         var parsedComment = {};
83134         for (var j2 = 0; j2 < childNodes.length; j2++) {
83135           var node = childNodes[j2];
83136           var nodeName = node.nodeName;
83137           if (nodeName === "#text") continue;
83138           parsedComment[nodeName] = node.textContent;
83139           if (nodeName === "uid") {
83140             var uid = node.textContent;
83141             if (uid && !_userCache.user[uid]) {
83142               _userCache.toLoad[uid] = true;
83143             }
83144           }
83145         }
83146         if (parsedComment) {
83147           parsedComments.push(parsedComment);
83148         }
83149       }
83150     }
83151     return parsedComments;
83152   }
83153   function encodeNoteRtree(note) {
83154     return {
83155       minX: note.loc[0],
83156       minY: note.loc[1],
83157       maxX: note.loc[0],
83158       maxY: note.loc[1],
83159       data: note
83160     };
83161   }
83162   function parseJSON(payload, callback, options2) {
83163     options2 = Object.assign({ skipSeen: true }, options2);
83164     if (!payload) {
83165       return callback({ message: "No JSON", status: -1 });
83166     }
83167     var json = payload;
83168     if (typeof json !== "object") json = JSON.parse(payload);
83169     if (!json.elements) return callback({ message: "No JSON", status: -1 });
83170     var children2 = json.elements;
83171     var handle = window.requestIdleCallback(function() {
83172       _deferred.delete(handle);
83173       var results = [];
83174       var result;
83175       for (var i3 = 0; i3 < children2.length; i3++) {
83176         result = parseChild(children2[i3]);
83177         if (result) results.push(result);
83178       }
83179       callback(null, results);
83180     });
83181     _deferred.add(handle);
83182     function parseChild(child) {
83183       var parser3 = jsonparsers[child.type];
83184       if (!parser3) return null;
83185       var uid;
83186       uid = osmEntity.id.fromOSM(child.type, child.id);
83187       if (options2.skipSeen) {
83188         if (_tileCache.seen[uid]) return null;
83189         _tileCache.seen[uid] = true;
83190       }
83191       return parser3(child, uid);
83192     }
83193   }
83194   function parseUserJSON(payload, callback, options2) {
83195     options2 = Object.assign({ skipSeen: true }, options2);
83196     if (!payload) {
83197       return callback({ message: "No JSON", status: -1 });
83198     }
83199     var json = payload;
83200     if (typeof json !== "object") json = JSON.parse(payload);
83201     if (!json.users && !json.user) return callback({ message: "No JSON", status: -1 });
83202     var objs = json.users || [json];
83203     var handle = window.requestIdleCallback(function() {
83204       _deferred.delete(handle);
83205       var results = [];
83206       var result;
83207       for (var i3 = 0; i3 < objs.length; i3++) {
83208         result = parseObj(objs[i3]);
83209         if (result) results.push(result);
83210       }
83211       callback(null, results);
83212     });
83213     _deferred.add(handle);
83214     function parseObj(obj) {
83215       var uid = obj.user.id && obj.user.id.toString();
83216       if (options2.skipSeen && _userCache.user[uid]) {
83217         delete _userCache.toLoad[uid];
83218         return null;
83219       }
83220       var user = jsonparsers.user(obj.user, uid);
83221       _userCache.user[uid] = user;
83222       delete _userCache.toLoad[uid];
83223       return user;
83224     }
83225   }
83226   function parseXML(xml, callback, options2) {
83227     options2 = Object.assign({ skipSeen: true }, options2);
83228     if (!xml || !xml.childNodes) {
83229       return callback({ message: "No XML", status: -1 });
83230     }
83231     var root3 = xml.childNodes[0];
83232     var children2 = root3.childNodes;
83233     var handle = window.requestIdleCallback(function() {
83234       _deferred.delete(handle);
83235       var results = [];
83236       var result;
83237       for (var i3 = 0; i3 < children2.length; i3++) {
83238         result = parseChild(children2[i3]);
83239         if (result) results.push(result);
83240       }
83241       callback(null, results);
83242     });
83243     _deferred.add(handle);
83244     function parseChild(child) {
83245       var parser3 = parsers[child.nodeName];
83246       if (!parser3) return null;
83247       var uid;
83248       if (child.nodeName === "user") {
83249         uid = child.attributes.id.value;
83250         if (options2.skipSeen && _userCache.user[uid]) {
83251           delete _userCache.toLoad[uid];
83252           return null;
83253         }
83254       } else if (child.nodeName === "note") {
83255         uid = child.getElementsByTagName("id")[0].textContent;
83256       } else {
83257         uid = osmEntity.id.fromOSM(child.nodeName, child.attributes.id.value);
83258         if (options2.skipSeen) {
83259           if (_tileCache.seen[uid]) return null;
83260           _tileCache.seen[uid] = true;
83261         }
83262       }
83263       return parser3(child, uid);
83264     }
83265   }
83266   function updateRtree3(item, replace) {
83267     _noteCache.rtree.remove(item, function isEql(a2, b2) {
83268       return a2.data.id === b2.data.id;
83269     });
83270     if (replace) {
83271       _noteCache.rtree.insert(item);
83272     }
83273   }
83274   function wrapcb(thisArg, callback, cid) {
83275     return function(err, result) {
83276       if (err) {
83277         return callback.call(thisArg, err);
83278       } else if (thisArg.getConnectionId() !== cid) {
83279         return callback.call(thisArg, { message: "Connection Switched", status: -1 });
83280       } else {
83281         return callback.call(thisArg, err, result);
83282       }
83283     };
83284   }
83285   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;
83286   var init_osm3 = __esm({
83287     "modules/services/osm.js"() {
83288       "use strict";
83289       init_throttle();
83290       init_src4();
83291       init_src18();
83292       init_osm_auth();
83293       init_rbush();
83294       init_jxon();
83295       init_geo2();
83296       init_osm();
83297       init_util();
83298       init_localizer();
83299       init_id();
83300       tiler5 = utilTiler();
83301       dispatch9 = dispatch_default("apiStatusChange", "authLoading", "authDone", "change", "loading", "loaded", "loadedNotes");
83302       urlroot = osmApiConnections[0].url;
83303       apiUrlroot = osmApiConnections[0].apiUrl || urlroot;
83304       redirectPath = window.location.origin + window.location.pathname;
83305       oauth = osmAuth({
83306         url: urlroot,
83307         apiUrl: apiUrlroot,
83308         client_id: osmApiConnections[0].client_id,
83309         scope: "read_prefs write_prefs write_api read_gpx write_notes",
83310         redirect_uri: redirectPath + "land.html",
83311         loading: authLoading,
83312         done: authDone
83313       });
83314       _apiConnections = osmApiConnections;
83315       _imageryBlocklists = [/.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/];
83316       _tileCache = { toLoad: {}, loaded: {}, inflight: {}, seen: {}, rtree: new RBush() };
83317       _noteCache = { toLoad: {}, loaded: {}, inflight: {}, inflightPost: {}, note: {}, closed: {}, rtree: new RBush() };
83318       _userCache = { toLoad: {}, user: {} };
83319       _changeset = {};
83320       _deferred = /* @__PURE__ */ new Set();
83321       _connectionID = 1;
83322       _tileZoom3 = 16;
83323       _noteZoom = 12;
83324       _maxWayNodes = 2e3;
83325       jsonparsers = {
83326         node: function nodeData(obj, uid) {
83327           return new osmNode({
83328             id: uid,
83329             visible: typeof obj.visible === "boolean" ? obj.visible : true,
83330             version: obj.version && obj.version.toString(),
83331             changeset: obj.changeset && obj.changeset.toString(),
83332             timestamp: obj.timestamp,
83333             user: obj.user,
83334             uid: obj.uid && obj.uid.toString(),
83335             loc: [Number(obj.lon), Number(obj.lat)],
83336             tags: obj.tags
83337           });
83338         },
83339         way: function wayData(obj, uid) {
83340           return new osmWay({
83341             id: uid,
83342             visible: typeof obj.visible === "boolean" ? obj.visible : true,
83343             version: obj.version && obj.version.toString(),
83344             changeset: obj.changeset && obj.changeset.toString(),
83345             timestamp: obj.timestamp,
83346             user: obj.user,
83347             uid: obj.uid && obj.uid.toString(),
83348             tags: obj.tags,
83349             nodes: getNodesJSON(obj)
83350           });
83351         },
83352         relation: function relationData(obj, uid) {
83353           return new osmRelation({
83354             id: uid,
83355             visible: typeof obj.visible === "boolean" ? obj.visible : true,
83356             version: obj.version && obj.version.toString(),
83357             changeset: obj.changeset && obj.changeset.toString(),
83358             timestamp: obj.timestamp,
83359             user: obj.user,
83360             uid: obj.uid && obj.uid.toString(),
83361             tags: obj.tags,
83362             members: getMembersJSON(obj)
83363           });
83364         },
83365         user: function parseUser(obj, uid) {
83366           return {
83367             id: uid,
83368             display_name: obj.display_name,
83369             account_created: obj.account_created,
83370             image_url: obj.img && obj.img.href,
83371             changesets_count: obj.changesets && obj.changesets.count && obj.changesets.count.toString() || "0",
83372             active_blocks: obj.blocks && obj.blocks.received && obj.blocks.received.active && obj.blocks.received.active.toString() || "0"
83373           };
83374         }
83375       };
83376       parsers = {
83377         node: function nodeData2(obj, uid) {
83378           var attrs = obj.attributes;
83379           return new osmNode({
83380             id: uid,
83381             visible: getVisible(attrs),
83382             version: attrs.version.value,
83383             changeset: attrs.changeset && attrs.changeset.value,
83384             timestamp: attrs.timestamp && attrs.timestamp.value,
83385             user: attrs.user && attrs.user.value,
83386             uid: attrs.uid && attrs.uid.value,
83387             loc: getLoc(attrs),
83388             tags: getTags(obj)
83389           });
83390         },
83391         way: function wayData2(obj, uid) {
83392           var attrs = obj.attributes;
83393           return new osmWay({
83394             id: uid,
83395             visible: getVisible(attrs),
83396             version: attrs.version.value,
83397             changeset: attrs.changeset && attrs.changeset.value,
83398             timestamp: attrs.timestamp && attrs.timestamp.value,
83399             user: attrs.user && attrs.user.value,
83400             uid: attrs.uid && attrs.uid.value,
83401             tags: getTags(obj),
83402             nodes: getNodes(obj)
83403           });
83404         },
83405         relation: function relationData2(obj, uid) {
83406           var attrs = obj.attributes;
83407           return new osmRelation({
83408             id: uid,
83409             visible: getVisible(attrs),
83410             version: attrs.version.value,
83411             changeset: attrs.changeset && attrs.changeset.value,
83412             timestamp: attrs.timestamp && attrs.timestamp.value,
83413             user: attrs.user && attrs.user.value,
83414             uid: attrs.uid && attrs.uid.value,
83415             tags: getTags(obj),
83416             members: getMembers(obj)
83417           });
83418         },
83419         note: function parseNote(obj, uid) {
83420           var attrs = obj.attributes;
83421           var childNodes = obj.childNodes;
83422           var props = {};
83423           props.id = uid;
83424           props.loc = getLoc(attrs);
83425           if (!_noteCache.note[uid]) {
83426             let coincident = false;
83427             const epsilon3 = 1e-5;
83428             do {
83429               if (coincident) {
83430                 props.loc = geoVecAdd(props.loc, [epsilon3, epsilon3]);
83431               }
83432               const bbox2 = geoExtent(props.loc).bbox();
83433               coincident = _noteCache.rtree.search(bbox2).length;
83434             } while (coincident);
83435           } else {
83436             props.loc = _noteCache.note[uid].loc;
83437           }
83438           for (var i3 = 0; i3 < childNodes.length; i3++) {
83439             var node = childNodes[i3];
83440             var nodeName = node.nodeName;
83441             if (nodeName === "#text") continue;
83442             if (nodeName === "comments") {
83443               props[nodeName] = parseComments(node.childNodes);
83444             } else {
83445               props[nodeName] = node.textContent;
83446             }
83447           }
83448           var note = new osmNote(props);
83449           var item = encodeNoteRtree(note);
83450           _noteCache.note[note.id] = note;
83451           updateRtree3(item, true);
83452           return note;
83453         },
83454         user: function parseUser2(obj, uid) {
83455           var attrs = obj.attributes;
83456           var user = {
83457             id: uid,
83458             display_name: attrs.display_name && attrs.display_name.value,
83459             account_created: attrs.account_created && attrs.account_created.value,
83460             changesets_count: "0",
83461             active_blocks: "0"
83462           };
83463           var img = obj.getElementsByTagName("img");
83464           if (img && img[0] && img[0].getAttribute("href")) {
83465             user.image_url = img[0].getAttribute("href");
83466           }
83467           var changesets = obj.getElementsByTagName("changesets");
83468           if (changesets && changesets[0] && changesets[0].getAttribute("count")) {
83469             user.changesets_count = changesets[0].getAttribute("count");
83470           }
83471           var blocks = obj.getElementsByTagName("blocks");
83472           if (blocks && blocks[0]) {
83473             var received = blocks[0].getElementsByTagName("received");
83474             if (received && received[0] && received[0].getAttribute("active")) {
83475               user.active_blocks = received[0].getAttribute("active");
83476             }
83477           }
83478           _userCache.user[uid] = user;
83479           delete _userCache.toLoad[uid];
83480           return user;
83481         }
83482       };
83483       osm_default = {
83484         init: function() {
83485           utilRebind(this, dispatch9, "on");
83486         },
83487         reset: function() {
83488           Array.from(_deferred).forEach(function(handle) {
83489             window.cancelIdleCallback(handle);
83490             _deferred.delete(handle);
83491           });
83492           _connectionID++;
83493           _userChangesets = void 0;
83494           _userDetails = void 0;
83495           _rateLimitError = void 0;
83496           Object.values(_tileCache.inflight).forEach(abortRequest4);
83497           Object.values(_noteCache.inflight).forEach(abortRequest4);
83498           Object.values(_noteCache.inflightPost).forEach(abortRequest4);
83499           if (_changeset.inflight) abortRequest4(_changeset.inflight);
83500           _tileCache = { toLoad: {}, loaded: {}, inflight: {}, seen: {}, rtree: new RBush() };
83501           _noteCache = { toLoad: {}, loaded: {}, inflight: {}, inflightPost: {}, note: {}, closed: {}, rtree: new RBush() };
83502           _userCache = { toLoad: {}, user: {} };
83503           _cachedApiStatus = void 0;
83504           _changeset = {};
83505           return this;
83506         },
83507         getConnectionId: function() {
83508           return _connectionID;
83509         },
83510         getUrlRoot: function() {
83511           return urlroot;
83512         },
83513         getApiUrlRoot: function() {
83514           return apiUrlroot;
83515         },
83516         changesetURL: function(changesetID) {
83517           return urlroot + "/changeset/" + changesetID;
83518         },
83519         changesetsURL: function(center, zoom) {
83520           var precision3 = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
83521           return urlroot + "/history#map=" + Math.floor(zoom) + "/" + center[1].toFixed(precision3) + "/" + center[0].toFixed(precision3);
83522         },
83523         entityURL: function(entity) {
83524           return urlroot + "/" + entity.type + "/" + entity.osmId();
83525         },
83526         historyURL: function(entity) {
83527           return urlroot + "/" + entity.type + "/" + entity.osmId() + "/history";
83528         },
83529         userURL: function(username) {
83530           return urlroot + "/user/" + encodeURIComponent(username);
83531         },
83532         noteURL: function(note) {
83533           return urlroot + "/note/" + note.id;
83534         },
83535         noteReportURL: function(note) {
83536           return urlroot + "/reports/new?reportable_type=Note&reportable_id=" + note.id;
83537         },
83538         // Generic method to load data from the OSM API
83539         // Can handle either auth or unauth calls.
83540         loadFromAPI: function(path, callback, options2) {
83541           options2 = Object.assign({ skipSeen: true }, options2);
83542           var that = this;
83543           var cid = _connectionID;
83544           function done(err, payload) {
83545             if (that.getConnectionId() !== cid) {
83546               if (callback) callback({ message: "Connection Switched", status: -1 });
83547               return;
83548             }
83549             if (err && _cachedApiStatus === "online" || !err && _cachedApiStatus !== "online") {
83550               that.reloadApiStatus();
83551             }
83552             if (callback) {
83553               if (err) {
83554                 console.error("API error:", err);
83555                 return callback(err);
83556               } else {
83557                 if (path.indexOf(".json") !== -1) {
83558                   return parseJSON(payload, callback, options2);
83559                 } else {
83560                   return parseXML(payload, callback, options2);
83561                 }
83562               }
83563             }
83564           }
83565           if (this.authenticated()) {
83566             return oauth.xhr({
83567               method: "GET",
83568               path
83569             }, done);
83570           } else {
83571             var url = apiUrlroot + path;
83572             var controller = new AbortController();
83573             var fn;
83574             if (path.indexOf(".json") !== -1) {
83575               fn = json_default;
83576             } else {
83577               fn = xml_default;
83578             }
83579             fn(url, { signal: controller.signal }).then(function(data) {
83580               done(null, data);
83581             }).catch(function(err) {
83582               if (err.name === "AbortError") return;
83583               var match = err.message.match(/^\d{3}/);
83584               if (match) {
83585                 done({ status: +match[0], statusText: err.message });
83586               } else {
83587                 done(err.message);
83588               }
83589             });
83590             return controller;
83591           }
83592         },
83593         // Load a single entity by id (ways and relations use the `/full` call to include
83594         // nodes and members). Parent relations are not included, see `loadEntityRelations`.
83595         // GET /api/0.6/node/#id
83596         // GET /api/0.6/[way|relation]/#id/full
83597         loadEntity: function(id2, callback) {
83598           var type2 = osmEntity.id.type(id2);
83599           var osmID = osmEntity.id.toOSM(id2);
83600           var options2 = { skipSeen: false };
83601           this.loadFromAPI(
83602             "/api/0.6/" + type2 + "/" + osmID + (type2 !== "node" ? "/full" : "") + ".json",
83603             function(err, entities) {
83604               if (callback) callback(err, { data: entities });
83605             },
83606             options2
83607           );
83608         },
83609         // Load a single note by id , XML format
83610         // GET /api/0.6/notes/#id
83611         loadEntityNote: function(id2, callback) {
83612           var options2 = { skipSeen: false };
83613           this.loadFromAPI(
83614             "/api/0.6/notes/" + id2,
83615             function(err, entities) {
83616               if (callback) callback(err, { data: entities });
83617             },
83618             options2
83619           );
83620         },
83621         // Load a single entity with a specific version
83622         // GET /api/0.6/[node|way|relation]/#id/#version
83623         loadEntityVersion: function(id2, version, callback) {
83624           var type2 = osmEntity.id.type(id2);
83625           var osmID = osmEntity.id.toOSM(id2);
83626           var options2 = { skipSeen: false };
83627           this.loadFromAPI(
83628             "/api/0.6/" + type2 + "/" + osmID + "/" + version + ".json",
83629             function(err, entities) {
83630               if (callback) callback(err, { data: entities });
83631             },
83632             options2
83633           );
83634         },
83635         // Load the relations of a single entity with the given.
83636         // GET /api/0.6/[node|way|relation]/#id/relations
83637         loadEntityRelations: function(id2, callback) {
83638           var type2 = osmEntity.id.type(id2);
83639           var osmID = osmEntity.id.toOSM(id2);
83640           var options2 = { skipSeen: false };
83641           this.loadFromAPI(
83642             "/api/0.6/" + type2 + "/" + osmID + "/relations.json",
83643             function(err, entities) {
83644               if (callback) callback(err, { data: entities });
83645             },
83646             options2
83647           );
83648         },
83649         // Load multiple entities in chunks
83650         // (note: callback may be called multiple times)
83651         // Unlike `loadEntity`, child nodes and members are not fetched
83652         // GET /api/0.6/[nodes|ways|relations]?#parameters
83653         loadMultiple: function(ids, callback) {
83654           var that = this;
83655           var groups = utilArrayGroupBy(utilArrayUniq(ids), osmEntity.id.type);
83656           Object.keys(groups).forEach(function(k2) {
83657             var type2 = k2 + "s";
83658             var osmIDs = groups[k2].map(function(id2) {
83659               return osmEntity.id.toOSM(id2);
83660             });
83661             var options2 = { skipSeen: false };
83662             utilArrayChunk(osmIDs, 150).forEach(function(arr) {
83663               that.loadFromAPI(
83664                 "/api/0.6/" + type2 + ".json?" + type2 + "=" + arr.join(),
83665                 function(err, entities) {
83666                   if (callback) callback(err, { data: entities });
83667                 },
83668                 options2
83669               );
83670             });
83671           });
83672         },
83673         // Create, upload, and close a changeset
83674         // PUT /api/0.6/changeset/create
83675         // POST /api/0.6/changeset/#id/upload
83676         // PUT /api/0.6/changeset/#id/close
83677         putChangeset: function(changeset, changes, callback) {
83678           var cid = _connectionID;
83679           if (_changeset.inflight) {
83680             return callback({ message: "Changeset already inflight", status: -2 }, changeset);
83681           } else if (_changeset.open) {
83682             return createdChangeset.call(this, null, _changeset.open);
83683           } else {
83684             var options2 = {
83685               method: "PUT",
83686               path: "/api/0.6/changeset/create",
83687               headers: { "Content-Type": "text/xml" },
83688               content: JXON.stringify(changeset.asJXON())
83689             };
83690             _changeset.inflight = oauth.xhr(
83691               options2,
83692               wrapcb(this, createdChangeset, cid)
83693             );
83694           }
83695           function createdChangeset(err, changesetID) {
83696             _changeset.inflight = null;
83697             if (err) {
83698               return callback(err, changeset);
83699             }
83700             _changeset.open = changesetID;
83701             changeset = changeset.update({ id: changesetID });
83702             var options3 = {
83703               method: "POST",
83704               path: "/api/0.6/changeset/" + changesetID + "/upload",
83705               headers: { "Content-Type": "text/xml" },
83706               content: JXON.stringify(changeset.osmChangeJXON(changes))
83707             };
83708             _changeset.inflight = oauth.xhr(
83709               options3,
83710               wrapcb(this, uploadedChangeset, cid)
83711             );
83712           }
83713           function uploadedChangeset(err) {
83714             _changeset.inflight = null;
83715             if (err) return callback(err, changeset);
83716             window.setTimeout(function() {
83717               callback(null, changeset);
83718             }, 2500);
83719             _changeset.open = null;
83720             if (this.getConnectionId() === cid) {
83721               oauth.xhr({
83722                 method: "PUT",
83723                 path: "/api/0.6/changeset/" + changeset.id + "/close",
83724                 headers: { "Content-Type": "text/xml" }
83725               }, function() {
83726                 return true;
83727               });
83728             }
83729           }
83730         },
83731         /** updates the tags on an existing unclosed changeset */
83732         // PUT /api/0.6/changeset/#id
83733         updateChangesetTags: (changeset) => {
83734           return oauth.fetch(`${oauth.options().apiUrl}/api/0.6/changeset/${changeset.id}`, {
83735             method: "PUT",
83736             headers: { "Content-Type": "text/xml" },
83737             body: JXON.stringify(changeset.asJXON())
83738           });
83739         },
83740         // Load multiple users in chunks
83741         // (note: callback may be called multiple times)
83742         // GET /api/0.6/users?users=#id1,#id2,...,#idn
83743         loadUsers: function(uids, callback) {
83744           var toLoad = [];
83745           var cached = [];
83746           utilArrayUniq(uids).forEach(function(uid) {
83747             if (_userCache.user[uid]) {
83748               delete _userCache.toLoad[uid];
83749               cached.push(_userCache.user[uid]);
83750             } else {
83751               toLoad.push(uid);
83752             }
83753           });
83754           if (cached.length || !this.authenticated()) {
83755             callback(void 0, cached);
83756             if (!this.authenticated()) return;
83757           }
83758           utilArrayChunk(toLoad, 150).forEach((function(arr) {
83759             oauth.xhr({
83760               method: "GET",
83761               path: "/api/0.6/users.json?users=" + arr.join()
83762             }, wrapcb(this, done, _connectionID));
83763           }).bind(this));
83764           function done(err, payload) {
83765             if (err) return callback(err);
83766             var options2 = { skipSeen: true };
83767             return parseUserJSON(payload, function(err2, results) {
83768               if (err2) return callback(err2);
83769               return callback(void 0, results);
83770             }, options2);
83771           }
83772         },
83773         // Load a given user by id
83774         // GET /api/0.6/user/#id
83775         loadUser: function(uid, callback) {
83776           if (_userCache.user[uid] || !this.authenticated()) {
83777             delete _userCache.toLoad[uid];
83778             return callback(void 0, _userCache.user[uid]);
83779           }
83780           oauth.xhr({
83781             method: "GET",
83782             path: "/api/0.6/user/" + uid + ".json"
83783           }, wrapcb(this, done, _connectionID));
83784           function done(err, payload) {
83785             if (err) return callback(err);
83786             var options2 = { skipSeen: true };
83787             return parseUserJSON(payload, function(err2, results) {
83788               if (err2) return callback(err2);
83789               return callback(void 0, results[0]);
83790             }, options2);
83791           }
83792         },
83793         // Load the details of the logged-in user
83794         // GET /api/0.6/user/details
83795         userDetails: function(callback) {
83796           if (_userDetails) {
83797             return callback(void 0, _userDetails);
83798           }
83799           oauth.xhr({
83800             method: "GET",
83801             path: "/api/0.6/user/details.json"
83802           }, wrapcb(this, done, _connectionID));
83803           function done(err, payload) {
83804             if (err) return callback(err);
83805             var options2 = { skipSeen: false };
83806             return parseUserJSON(payload, function(err2, results) {
83807               if (err2) return callback(err2);
83808               _userDetails = results[0];
83809               return callback(void 0, _userDetails);
83810             }, options2);
83811           }
83812         },
83813         // Load previous changesets for the logged in user
83814         // GET /api/0.6/changesets?user=#id
83815         userChangesets: function(callback) {
83816           if (_userChangesets) {
83817             return callback(void 0, _userChangesets);
83818           }
83819           this.userDetails(
83820             wrapcb(this, gotDetails, _connectionID)
83821           );
83822           function gotDetails(err, user) {
83823             if (err) {
83824               return callback(err);
83825             }
83826             oauth.xhr({
83827               method: "GET",
83828               path: "/api/0.6/changesets?user=" + user.id
83829             }, wrapcb(this, done, _connectionID));
83830           }
83831           function done(err, xml) {
83832             if (err) {
83833               return callback(err);
83834             }
83835             _userChangesets = Array.prototype.map.call(
83836               xml.getElementsByTagName("changeset"),
83837               function(changeset) {
83838                 return { tags: getTags(changeset) };
83839               }
83840             ).filter(function(changeset) {
83841               var comment = changeset.tags.comment;
83842               return comment && comment !== "";
83843             });
83844             return callback(void 0, _userChangesets);
83845           }
83846         },
83847         // Fetch the status of the OSM API
83848         // GET /api/capabilities
83849         status: function(callback) {
83850           var url = apiUrlroot + "/api/capabilities";
83851           var errback = wrapcb(this, done, _connectionID);
83852           xml_default(url).then(function(data) {
83853             errback(null, data);
83854           }).catch(function(err) {
83855             errback(err.message);
83856           });
83857           function done(err, xml) {
83858             if (err) {
83859               return callback(err, null);
83860             }
83861             var elements = xml.getElementsByTagName("blacklist");
83862             var regexes = [];
83863             for (var i3 = 0; i3 < elements.length; i3++) {
83864               var regexString = elements[i3].getAttribute("regex");
83865               if (regexString) {
83866                 try {
83867                   var regex = new RegExp(regexString);
83868                   regexes.push(regex);
83869                 } catch {
83870                 }
83871               }
83872             }
83873             if (regexes.length) {
83874               _imageryBlocklists = regexes;
83875             }
83876             if (_rateLimitError) {
83877               return callback(_rateLimitError, "rateLimited");
83878             } else {
83879               var waynodes = xml.getElementsByTagName("waynodes");
83880               var maxWayNodes = waynodes.length && parseInt(waynodes[0].getAttribute("maximum"), 10);
83881               if (maxWayNodes && isFinite(maxWayNodes)) _maxWayNodes = maxWayNodes;
83882               var apiStatus = xml.getElementsByTagName("status");
83883               var val = apiStatus[0].getAttribute("api");
83884               return callback(void 0, val);
83885             }
83886           }
83887         },
83888         // Calls `status` and dispatches an `apiStatusChange` event if the returned
83889         // status differs from the cached status.
83890         reloadApiStatus: function() {
83891           if (!this.throttledReloadApiStatus) {
83892             var that = this;
83893             this.throttledReloadApiStatus = throttle_default(function() {
83894               that.status(function(err, status) {
83895                 if (status !== _cachedApiStatus) {
83896                   _cachedApiStatus = status;
83897                   dispatch9.call("apiStatusChange", that, err, status);
83898                 }
83899               });
83900             }, 500);
83901           }
83902           this.throttledReloadApiStatus();
83903         },
83904         // Returns the maximum number of nodes a single way can have
83905         maxWayNodes: function() {
83906           return _maxWayNodes;
83907         },
83908         // Load data (entities) from the API in tiles
83909         // GET /api/0.6/map?bbox=
83910         loadTiles: function(projection2, callback) {
83911           if (_off) return;
83912           var tiles = tiler5.zoomExtent([_tileZoom3, _tileZoom3]).getTiles(projection2);
83913           var hadRequests = hasInflightRequests(_tileCache);
83914           abortUnwantedRequests3(_tileCache, tiles);
83915           if (hadRequests && !hasInflightRequests(_tileCache)) {
83916             if (_rateLimitError) {
83917               _rateLimitError = void 0;
83918               dispatch9.call("change");
83919               this.reloadApiStatus();
83920             }
83921             dispatch9.call("loaded");
83922           }
83923           tiles.forEach(function(tile) {
83924             this.loadTile(tile, callback);
83925           }, this);
83926         },
83927         // Load a single data tile
83928         // GET /api/0.6/map?bbox=
83929         loadTile: function(tile, callback) {
83930           if (_off) return;
83931           if (_tileCache.loaded[tile.id] || _tileCache.inflight[tile.id]) return;
83932           if (!hasInflightRequests(_tileCache)) {
83933             dispatch9.call("loading");
83934           }
83935           var path = "/api/0.6/map.json?bbox=";
83936           var options2 = { skipSeen: true };
83937           _tileCache.inflight[tile.id] = this.loadFromAPI(
83938             path + tile.extent.toParam(),
83939             tileCallback.bind(this),
83940             options2
83941           );
83942           function tileCallback(err, parsed) {
83943             if (!err) {
83944               delete _tileCache.inflight[tile.id];
83945               delete _tileCache.toLoad[tile.id];
83946               _tileCache.loaded[tile.id] = true;
83947               var bbox2 = tile.extent.bbox();
83948               bbox2.id = tile.id;
83949               _tileCache.rtree.insert(bbox2);
83950             } else {
83951               if (!_rateLimitError && err.status === 509 || err.status === 429) {
83952                 _rateLimitError = err;
83953                 dispatch9.call("change");
83954                 this.reloadApiStatus();
83955               }
83956               setTimeout(() => {
83957                 delete _tileCache.inflight[tile.id];
83958                 this.loadTile(tile, callback);
83959               }, 8e3);
83960             }
83961             if (callback) {
83962               callback(err, Object.assign({ data: parsed }, tile));
83963             }
83964             if (!hasInflightRequests(_tileCache)) {
83965               if (_rateLimitError) {
83966                 _rateLimitError = void 0;
83967                 dispatch9.call("change");
83968                 this.reloadApiStatus();
83969               }
83970               dispatch9.call("loaded");
83971             }
83972           }
83973         },
83974         isDataLoaded: function(loc) {
83975           var bbox2 = { minX: loc[0], minY: loc[1], maxX: loc[0], maxY: loc[1] };
83976           return _tileCache.rtree.collides(bbox2);
83977         },
83978         // load the tile that covers the given `loc`
83979         loadTileAtLoc: function(loc, callback) {
83980           if (Object.keys(_tileCache.toLoad).length > 50) return;
83981           var k2 = geoZoomToScale(_tileZoom3 + 1);
83982           var offset = geoRawMercator().scale(k2)(loc);
83983           var projection2 = geoRawMercator().transform({ k: k2, x: -offset[0], y: -offset[1] });
83984           var tiles = tiler5.zoomExtent([_tileZoom3, _tileZoom3]).getTiles(projection2);
83985           tiles.forEach(function(tile) {
83986             if (_tileCache.toLoad[tile.id] || _tileCache.loaded[tile.id] || _tileCache.inflight[tile.id]) return;
83987             _tileCache.toLoad[tile.id] = true;
83988             this.loadTile(tile, callback);
83989           }, this);
83990         },
83991         // Load notes from the API in tiles
83992         // GET /api/0.6/notes?bbox=
83993         loadNotes: function(projection2, noteOptions) {
83994           noteOptions = Object.assign({ limit: 1e4, closed: 7 }, noteOptions);
83995           if (_off) return;
83996           var that = this;
83997           var path = "/api/0.6/notes?limit=" + noteOptions.limit + "&closed=" + noteOptions.closed + "&bbox=";
83998           var throttleLoadUsers = throttle_default(function() {
83999             var uids = Object.keys(_userCache.toLoad);
84000             if (!uids.length) return;
84001             that.loadUsers(uids, function() {
84002             });
84003           }, 750);
84004           var tiles = tiler5.zoomExtent([_noteZoom, _noteZoom]).getTiles(projection2);
84005           abortUnwantedRequests3(_noteCache, tiles);
84006           tiles.forEach(function(tile) {
84007             if (_noteCache.loaded[tile.id] || _noteCache.inflight[tile.id]) return;
84008             var options2 = { skipSeen: false };
84009             _noteCache.inflight[tile.id] = that.loadFromAPI(
84010               path + tile.extent.toParam(),
84011               function(err) {
84012                 delete _noteCache.inflight[tile.id];
84013                 if (!err) {
84014                   _noteCache.loaded[tile.id] = true;
84015                 }
84016                 throttleLoadUsers();
84017                 dispatch9.call("loadedNotes");
84018               },
84019               options2
84020             );
84021           });
84022         },
84023         // Create a note
84024         // POST /api/0.6/notes?params
84025         postNoteCreate: function(note, callback) {
84026           if (!this.authenticated()) {
84027             return callback({ message: "Not Authenticated", status: -3 }, note);
84028           }
84029           if (_noteCache.inflightPost[note.id]) {
84030             return callback({ message: "Note update already inflight", status: -2 }, note);
84031           }
84032           if (!note.loc[0] || !note.loc[1] || !note.newComment) return;
84033           var comment = note.newComment;
84034           if (note.newCategory && note.newCategory !== "None") {
84035             comment += " #" + note.newCategory;
84036           }
84037           var path = "/api/0.6/notes?" + utilQsString({ lon: note.loc[0], lat: note.loc[1], text: comment });
84038           _noteCache.inflightPost[note.id] = oauth.xhr({
84039             method: "POST",
84040             path
84041           }, wrapcb(this, done, _connectionID));
84042           function done(err, xml) {
84043             delete _noteCache.inflightPost[note.id];
84044             if (err) {
84045               return callback(err);
84046             }
84047             this.removeNote(note);
84048             var options2 = { skipSeen: false };
84049             return parseXML(xml, function(err2, results) {
84050               if (err2) {
84051                 return callback(err2);
84052               } else {
84053                 return callback(void 0, results[0]);
84054               }
84055             }, options2);
84056           }
84057         },
84058         // Update a note
84059         // POST /api/0.6/notes/#id/comment?text=comment
84060         // POST /api/0.6/notes/#id/close?text=comment
84061         // POST /api/0.6/notes/#id/reopen?text=comment
84062         postNoteUpdate: function(note, newStatus, callback) {
84063           if (!this.authenticated()) {
84064             return callback({ message: "Not Authenticated", status: -3 }, note);
84065           }
84066           if (_noteCache.inflightPost[note.id]) {
84067             return callback({ message: "Note update already inflight", status: -2 }, note);
84068           }
84069           var action;
84070           if (note.status !== "closed" && newStatus === "closed") {
84071             action = "close";
84072           } else if (note.status !== "open" && newStatus === "open") {
84073             action = "reopen";
84074           } else {
84075             action = "comment";
84076             if (!note.newComment) return;
84077           }
84078           var path = "/api/0.6/notes/" + note.id + "/" + action;
84079           if (note.newComment) {
84080             path += "?" + utilQsString({ text: note.newComment });
84081           }
84082           _noteCache.inflightPost[note.id] = oauth.xhr({
84083             method: "POST",
84084             path
84085           }, wrapcb(this, done, _connectionID));
84086           function done(err, xml) {
84087             delete _noteCache.inflightPost[note.id];
84088             if (err) {
84089               return callback(err);
84090             }
84091             this.removeNote(note);
84092             if (action === "close") {
84093               _noteCache.closed[note.id] = true;
84094             } else if (action === "reopen") {
84095               delete _noteCache.closed[note.id];
84096             }
84097             var options2 = { skipSeen: false };
84098             return parseXML(xml, function(err2, results) {
84099               if (err2) {
84100                 return callback(err2);
84101               } else {
84102                 return callback(void 0, results[0]);
84103               }
84104             }, options2);
84105           }
84106         },
84107         /* connection options for source switcher (optional) */
84108         apiConnections: function(val) {
84109           if (!arguments.length) return _apiConnections;
84110           _apiConnections = val;
84111           return this;
84112         },
84113         switch: function(newOptions) {
84114           urlroot = newOptions.url;
84115           apiUrlroot = newOptions.apiUrl || urlroot;
84116           if (newOptions.url && !newOptions.apiUrl) {
84117             newOptions = {
84118               ...newOptions,
84119               apiUrl: newOptions.url
84120             };
84121           }
84122           const oldOptions = utilObjectOmit(oauth.options(), "access_token");
84123           oauth.options({ ...oldOptions, ...newOptions });
84124           this.reset();
84125           this.userChangesets(function() {
84126           });
84127           dispatch9.call("change");
84128           return this;
84129         },
84130         toggle: function(val) {
84131           _off = !val;
84132           return this;
84133         },
84134         isChangesetInflight: function() {
84135           return !!_changeset.inflight;
84136         },
84137         // get/set cached data
84138         // This is used to save/restore the state when entering/exiting the walkthrough
84139         // Also used for testing purposes.
84140         caches: function(obj) {
84141           function cloneCache(source) {
84142             var target = {};
84143             Object.keys(source).forEach(function(k2) {
84144               if (k2 === "rtree") {
84145                 target.rtree = new RBush().fromJSON(source.rtree.toJSON());
84146               } else if (k2 === "note") {
84147                 target.note = {};
84148                 Object.keys(source.note).forEach(function(id2) {
84149                   target.note[id2] = osmNote(source.note[id2]);
84150                 });
84151               } else {
84152                 target[k2] = JSON.parse(JSON.stringify(source[k2]));
84153               }
84154             });
84155             return target;
84156           }
84157           if (!arguments.length) {
84158             return {
84159               tile: cloneCache(_tileCache),
84160               note: cloneCache(_noteCache),
84161               user: cloneCache(_userCache)
84162             };
84163           }
84164           if (obj === "get") {
84165             return {
84166               tile: _tileCache,
84167               note: _noteCache,
84168               user: _userCache
84169             };
84170           }
84171           if (obj.tile) {
84172             _tileCache = obj.tile;
84173             _tileCache.inflight = {};
84174           }
84175           if (obj.note) {
84176             _noteCache = obj.note;
84177             _noteCache.inflight = {};
84178             _noteCache.inflightPost = {};
84179           }
84180           if (obj.user) {
84181             _userCache = obj.user;
84182           }
84183           return this;
84184         },
84185         logout: function() {
84186           _userChangesets = void 0;
84187           _userDetails = void 0;
84188           oauth.logout();
84189           dispatch9.call("change");
84190           return this;
84191         },
84192         authenticated: function() {
84193           return oauth.authenticated();
84194         },
84195         /** @param {import('osm-auth').LoginOptions} options */
84196         authenticate: function(callback, options2) {
84197           var that = this;
84198           var cid = _connectionID;
84199           _userChangesets = void 0;
84200           _userDetails = void 0;
84201           function done(err, res) {
84202             if (err) {
84203               if (callback) callback(err);
84204               return;
84205             }
84206             if (that.getConnectionId() !== cid) {
84207               if (callback) callback({ message: "Connection Switched", status: -1 });
84208               return;
84209             }
84210             _rateLimitError = void 0;
84211             dispatch9.call("change");
84212             if (callback) callback(err, res);
84213             that.userChangesets(function() {
84214             });
84215           }
84216           oauth.options({
84217             ...oauth.options(),
84218             locale: _mainLocalizer.localeCode()
84219           });
84220           oauth.authenticate(done, options2);
84221         },
84222         imageryBlocklists: function() {
84223           return _imageryBlocklists;
84224         },
84225         tileZoom: function(val) {
84226           if (!arguments.length) return _tileZoom3;
84227           _tileZoom3 = val;
84228           return this;
84229         },
84230         // get all cached notes covering the viewport
84231         notes: function(projection2) {
84232           var viewport = projection2.clipExtent();
84233           var min3 = [viewport[0][0], viewport[1][1]];
84234           var max3 = [viewport[1][0], viewport[0][1]];
84235           var bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
84236           return _noteCache.rtree.search(bbox2).map(function(d2) {
84237             return d2.data;
84238           });
84239         },
84240         // get a single note from the cache
84241         getNote: function(id2) {
84242           return _noteCache.note[id2];
84243         },
84244         // remove a single note from the cache
84245         removeNote: function(note) {
84246           if (!(note instanceof osmNote) || !note.id) return;
84247           delete _noteCache.note[note.id];
84248           updateRtree3(encodeNoteRtree(note), false);
84249         },
84250         // replace a single note in the cache
84251         replaceNote: function(note) {
84252           if (!(note instanceof osmNote) || !note.id) return;
84253           _noteCache.note[note.id] = note;
84254           updateRtree3(encodeNoteRtree(note), true);
84255           return note;
84256         },
84257         // Get an array of note IDs closed during this session.
84258         // Used to populate `closed:note` changeset tag
84259         getClosedIDs: function() {
84260           return Object.keys(_noteCache.closed).sort();
84261         }
84262       };
84263     }
84264   });
84265
84266   // modules/services/osm_wikibase.js
84267   var osm_wikibase_exports = {};
84268   __export(osm_wikibase_exports, {
84269     default: () => osm_wikibase_default
84270   });
84271   function request(url, callback) {
84272     if (_inflight2[url]) return;
84273     var controller = new AbortController();
84274     _inflight2[url] = controller;
84275     json_default(url, { signal: controller.signal }).then(function(result) {
84276       delete _inflight2[url];
84277       if (callback) callback(null, result);
84278     }).catch(function(err) {
84279       delete _inflight2[url];
84280       if (err.name === "AbortError") return;
84281       if (callback) callback(err.message);
84282     });
84283   }
84284   var apibase3, _inflight2, _wikibaseCache, _localeIDs, debouncedRequest, osm_wikibase_default;
84285   var init_osm_wikibase = __esm({
84286     "modules/services/osm_wikibase.js"() {
84287       "use strict";
84288       init_debounce();
84289       init_src18();
84290       init_localizer();
84291       init_util();
84292       apibase3 = "https://wiki.openstreetmap.org/w/api.php";
84293       _inflight2 = {};
84294       _wikibaseCache = {};
84295       _localeIDs = { en: false };
84296       debouncedRequest = debounce_default(request, 500, { leading: false });
84297       osm_wikibase_default = {
84298         init: function() {
84299           _inflight2 = {};
84300           _wikibaseCache = {};
84301           _localeIDs = {};
84302         },
84303         reset: function() {
84304           Object.values(_inflight2).forEach(function(controller) {
84305             controller.abort();
84306           });
84307           _inflight2 = {};
84308         },
84309         /**
84310          * Get the best value for the property, or undefined if not found
84311          * @param entity object from wikibase
84312          * @param property string e.g. 'P4' for image
84313          * @param langCode string e.g. 'fr' for French
84314          */
84315         claimToValue: function(entity, property, langCode) {
84316           if (!entity.claims[property]) return void 0;
84317           var locale3 = _localeIDs[langCode];
84318           var preferredPick, localePick;
84319           entity.claims[property].forEach(function(stmt) {
84320             if (!preferredPick && stmt.rank === "preferred") {
84321               preferredPick = stmt;
84322             }
84323             if (locale3 && stmt.qualifiers && stmt.qualifiers.P26 && stmt.qualifiers.P26[0].datavalue.value.id === locale3) {
84324               localePick = stmt;
84325             }
84326           });
84327           var result = localePick || preferredPick;
84328           if (result) {
84329             var datavalue = result.mainsnak.datavalue;
84330             return datavalue.type === "wikibase-entityid" ? datavalue.value.id : datavalue.value;
84331           } else {
84332             return void 0;
84333           }
84334         },
84335         /**
84336          * Convert monolingual property into a key-value object (language -> value)
84337          * @param entity object from wikibase
84338          * @param property string e.g. 'P31' for monolingual wiki page title
84339          */
84340         monolingualClaimToValueObj: function(entity, property) {
84341           if (!entity || !entity.claims[property]) return void 0;
84342           return entity.claims[property].reduce(function(acc, obj) {
84343             var value = obj.mainsnak.datavalue.value;
84344             acc[value.language] = value.text;
84345             return acc;
84346           }, {});
84347         },
84348         toSitelink: function(key, value) {
84349           var result = value ? "Tag:" + key + "=" + value : "Key:" + key;
84350           return result.replace(/_/g, " ").trim();
84351         },
84352         /**
84353          * Converts text like `tag:...=...` into clickable links
84354          *
84355          * @param {string} unsafeText - unsanitized text
84356          */
84357         linkifyWikiText(unsafeText) {
84358           return (selection2) => {
84359             const segments = unsafeText.split(/(key|tag):([\w-]+)(=([\w-]+))?/g);
84360             for (let i3 = 0; i3 < segments.length; i3 += 5) {
84361               const [plainText, , key, , value] = segments.slice(i3);
84362               if (plainText) {
84363                 selection2.append("span").text(plainText);
84364               }
84365               if (key) {
84366                 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 || "*"}`);
84367               }
84368             }
84369           };
84370         },
84371         //
84372         // Pass params object of the form:
84373         // {
84374         //   key: 'string',
84375         //   value: 'string',
84376         //   langCode: 'string'
84377         // }
84378         //
84379         getEntity: function(params, callback) {
84380           var doRequest = params.debounce ? debouncedRequest : request;
84381           var that = this;
84382           var titles = [];
84383           var result = {};
84384           var rtypeSitelink = params.key === "type" && params.value ? ("Relation:" + params.value).replace(/_/g, " ").trim() : false;
84385           var keySitelink = params.key ? this.toSitelink(params.key) : false;
84386           var tagSitelink = params.key && params.value ? this.toSitelink(params.key, params.value) : false;
84387           const localeSitelinks = [];
84388           if (params.langCodes) {
84389             params.langCodes.forEach(function(langCode) {
84390               if (_localeIDs[langCode] === void 0) {
84391                 let localeSitelink = ("Locale:" + langCode).replace(/_/g, " ").trim();
84392                 titles.push(localeSitelink);
84393                 that.addLocale(langCode, false);
84394               }
84395             });
84396           }
84397           if (rtypeSitelink) {
84398             if (_wikibaseCache[rtypeSitelink]) {
84399               result.rtype = _wikibaseCache[rtypeSitelink];
84400             } else {
84401               titles.push(rtypeSitelink);
84402             }
84403           }
84404           if (keySitelink) {
84405             if (_wikibaseCache[keySitelink]) {
84406               result.key = _wikibaseCache[keySitelink];
84407             } else {
84408               titles.push(keySitelink);
84409             }
84410           }
84411           if (tagSitelink) {
84412             if (_wikibaseCache[tagSitelink]) {
84413               result.tag = _wikibaseCache[tagSitelink];
84414             } else {
84415               titles.push(tagSitelink);
84416             }
84417           }
84418           if (!titles.length) {
84419             return callback(null, result);
84420           }
84421           var obj = {
84422             action: "wbgetentities",
84423             sites: "wiki",
84424             titles: titles.join("|"),
84425             languages: params.langCodes.join("|"),
84426             languagefallback: 1,
84427             origin: "*",
84428             format: "json"
84429             // There is an MW Wikibase API bug https://phabricator.wikimedia.org/T212069
84430             // We shouldn't use v1 until it gets fixed, but should switch to it afterwards
84431             // formatversion: 2,
84432           };
84433           var url = apibase3 + "?" + utilQsString(obj);
84434           doRequest(url, function(err, d2) {
84435             if (err) {
84436               callback(err);
84437             } else if (!d2.success || d2.error) {
84438               callback(d2.error.messages.map(function(v2) {
84439                 return v2.html["*"];
84440               }).join("<br>"));
84441             } else {
84442               Object.values(d2.entities).forEach(function(res) {
84443                 if (res.missing !== "") {
84444                   var title = res.sitelinks.wiki.title;
84445                   if (title === rtypeSitelink) {
84446                     _wikibaseCache[rtypeSitelink] = res;
84447                     result.rtype = res;
84448                   } else if (title === keySitelink) {
84449                     _wikibaseCache[keySitelink] = res;
84450                     result.key = res;
84451                   } else if (title === tagSitelink) {
84452                     _wikibaseCache[tagSitelink] = res;
84453                     result.tag = res;
84454                   } else if (localeSitelinks.includes(title)) {
84455                     const langCode = title.replace(/ /g, "_").replace(/^Locale:/, "");
84456                     that.addLocale(langCode, res.id);
84457                   } else {
84458                     console.log("Unexpected title " + title);
84459                   }
84460                 }
84461               });
84462               callback(null, result);
84463             }
84464           });
84465         },
84466         //
84467         // Pass params object of the form:
84468         // {
84469         //   key: 'string',     // required
84470         //   value: 'string'    // optional
84471         // }
84472         //
84473         // Get an result object used to display tag documentation
84474         // {
84475         //   title:        'string',
84476         //   description:  'string',
84477         //   editURL:      'string',
84478         //   imageURL:     'string',
84479         //   wiki:         { title: 'string', text: 'string', url: 'string' }
84480         // }
84481         //
84482         getDocs: function(params, callback) {
84483           var that = this;
84484           var langCodes = _mainLocalizer.localeCodes().map(function(code) {
84485             return code.toLowerCase();
84486           });
84487           params.langCodes = langCodes;
84488           this.getEntity(params, function(err, data) {
84489             if (err) {
84490               callback(err);
84491               return;
84492             }
84493             var entity = data.rtype || data.tag || data.key;
84494             if (!entity) {
84495               callback("No entity");
84496               return;
84497             }
84498             var i3;
84499             var description;
84500             for (i3 in langCodes) {
84501               let code2 = langCodes[i3];
84502               if (entity.descriptions[code2] && entity.descriptions[code2].language === code2) {
84503                 description = entity.descriptions[code2];
84504                 break;
84505               }
84506             }
84507             if (!description && Object.values(entity.descriptions).length) description = Object.values(entity.descriptions)[0];
84508             var result = {
84509               title: entity.title,
84510               description: that.linkifyWikiText((description == null ? void 0 : description.value) || ""),
84511               descriptionLocaleCode: description ? description.language : "",
84512               editURL: "https://wiki.openstreetmap.org/wiki/" + entity.title
84513             };
84514             if (entity.claims) {
84515               var imageroot;
84516               var image = that.claimToValue(entity, "P4", langCodes[0]);
84517               if (image) {
84518                 imageroot = "https://commons.wikimedia.org/w/index.php";
84519               } else {
84520                 image = that.claimToValue(entity, "P28", langCodes[0]);
84521                 if (image) {
84522                   imageroot = "https://wiki.openstreetmap.org/w/index.php";
84523                 }
84524               }
84525               if (imageroot && image) {
84526                 result.imageURL = imageroot + "?" + utilQsString({
84527                   title: "Special:Redirect/file/" + image,
84528                   width: 400
84529                 });
84530               }
84531             }
84532             var rtypeWiki = that.monolingualClaimToValueObj(data.rtype, "P31");
84533             var tagWiki = that.monolingualClaimToValueObj(data.tag, "P31");
84534             var keyWiki = that.monolingualClaimToValueObj(data.key, "P31");
84535             var wikis = [rtypeWiki, tagWiki, keyWiki];
84536             for (i3 in wikis) {
84537               var wiki = wikis[i3];
84538               for (var j2 in langCodes) {
84539                 var code = langCodes[j2];
84540                 var referenceId = langCodes[0].split("-")[0] !== "en" && code.split("-")[0] === "en" ? "inspector.wiki_en_reference" : "inspector.wiki_reference";
84541                 var info = getWikiInfo(wiki, code, referenceId);
84542                 if (info) {
84543                   result.wiki = info;
84544                   break;
84545                 }
84546               }
84547               if (result.wiki) break;
84548             }
84549             callback(null, result);
84550             function getWikiInfo(wiki2, langCode, tKey) {
84551               if (wiki2 && wiki2[langCode]) {
84552                 return {
84553                   title: wiki2[langCode],
84554                   text: tKey,
84555                   url: "https://wiki.openstreetmap.org/wiki/" + wiki2[langCode]
84556                 };
84557               }
84558             }
84559           });
84560         },
84561         addLocale: function(langCode, qid) {
84562           _localeIDs[langCode] = qid;
84563         },
84564         apibase: function(val) {
84565           if (!arguments.length) return apibase3;
84566           apibase3 = val;
84567           return this;
84568         }
84569       };
84570     }
84571   });
84572
84573   // modules/services/streetside.js
84574   var streetside_exports2 = {};
84575   __export(streetside_exports2, {
84576     default: () => streetside_default
84577   });
84578   function abortRequest5(i3) {
84579     i3.abort();
84580   }
84581   function localeTimestamp2(s2) {
84582     if (!s2) return null;
84583     const options2 = { day: "numeric", month: "short", year: "numeric" };
84584     const d2 = new Date(s2);
84585     if (isNaN(d2.getTime())) return null;
84586     return d2.toLocaleString(_mainLocalizer.localeCode(), options2);
84587   }
84588   function loadTiles3(which, url, projection2, margin) {
84589     const tiles = tiler6.margin(margin).getTiles(projection2);
84590     const cache = _ssCache[which];
84591     Object.keys(cache.inflight).forEach((k2) => {
84592       const wanted = tiles.find((tile) => k2.indexOf(tile.id + ",") === 0);
84593       if (!wanted) {
84594         abortRequest5(cache.inflight[k2]);
84595         delete cache.inflight[k2];
84596       }
84597     });
84598     tiles.forEach((tile) => loadNextTilePage2(which, url, tile));
84599   }
84600   function loadNextTilePage2(which, url, tile) {
84601     const cache = _ssCache[which];
84602     const nextPage = cache.nextPage[tile.id] || 0;
84603     const id2 = tile.id + "," + String(nextPage);
84604     if (cache.loaded[id2] || cache.inflight[id2]) return;
84605     cache.inflight[id2] = getBubbles(url, tile, (response) => {
84606       cache.loaded[id2] = true;
84607       delete cache.inflight[id2];
84608       if (!response) return;
84609       if (response.resourceSets[0].resources.length === maxResults2) {
84610         const split = tile.extent.split();
84611         loadNextTilePage2(which, url, { id: tile.id + ",a", extent: split[0] });
84612         loadNextTilePage2(which, url, { id: tile.id + ",b", extent: split[1] });
84613         loadNextTilePage2(which, url, { id: tile.id + ",c", extent: split[2] });
84614         loadNextTilePage2(which, url, { id: tile.id + ",d", extent: split[3] });
84615       }
84616       const features = response.resourceSets[0].resources.map((bubble) => {
84617         const bubbleId = bubble.imageUrl;
84618         if (cache.points[bubbleId]) return null;
84619         const loc = [
84620           bubble.lon || bubble.longitude,
84621           bubble.lat || bubble.latitude
84622         ];
84623         const d2 = {
84624           loc,
84625           key: bubbleId,
84626           imageUrl: bubble.imageUrl.replace("{subdomain}", bubble.imageUrlSubdomains[0]),
84627           ca: bubble.he || bubble.heading,
84628           captured_at: bubble.vintageEnd,
84629           captured_by: "microsoft",
84630           pano: true,
84631           sequenceKey: null
84632         };
84633         cache.points[bubbleId] = d2;
84634         return {
84635           minX: loc[0],
84636           minY: loc[1],
84637           maxX: loc[0],
84638           maxY: loc[1],
84639           data: d2
84640         };
84641       }).filter(Boolean);
84642       cache.rtree.load(features);
84643       if (which === "bubbles") {
84644         dispatch10.call("loadedImages");
84645       }
84646     });
84647   }
84648   function getBubbles(url, tile, callback) {
84649     let rect = tile.extent.rectangle();
84650     let urlForRequest = url.replace("{key}", bubbleAppKey).replace("{bbox}", [rect[1], rect[0], rect[3], rect[2]].join(",")).replace("{count}", maxResults2);
84651     const controller = new AbortController();
84652     fetch(urlForRequest, { signal: controller.signal }).then(function(response) {
84653       if (!response.ok) {
84654         throw new Error(response.status + " " + response.statusText);
84655       }
84656       return response.json();
84657     }).then(function(result) {
84658       if (!result) {
84659         callback(null);
84660       }
84661       return callback(result || []);
84662     }).catch(function(err) {
84663       if (err.name === "AbortError") {
84664       } else {
84665         throw new Error(err);
84666       }
84667     });
84668     return controller;
84669   }
84670   function partitionViewport4(projection2) {
84671     let z2 = geoScaleToZoom(projection2.scale());
84672     let z22 = Math.ceil(z2 * 2) / 2 + 2.5;
84673     let tiler8 = utilTiler().zoomExtent([z22, z22]);
84674     return tiler8.getTiles(projection2).map((tile) => tile.extent);
84675   }
84676   function searchLimited4(limit, projection2, rtree) {
84677     limit = limit || 5;
84678     return partitionViewport4(projection2).reduce((result, extent) => {
84679       let found = rtree.search(extent.bbox()).slice(0, limit).map((d2) => d2.data);
84680       return found.length ? result.concat(found) : result;
84681     }, []);
84682   }
84683   function loadImage2(imgInfo) {
84684     return new Promise((resolve) => {
84685       let img = new Image();
84686       img.onload = () => {
84687         let canvas = document.getElementById("ideditor-canvas" + imgInfo.face);
84688         let ctx = canvas.getContext("2d");
84689         ctx.drawImage(img, imgInfo.x, imgInfo.y);
84690         resolve({ imgInfo, status: "ok" });
84691       };
84692       img.onerror = () => {
84693         resolve({ data: imgInfo, status: "error" });
84694       };
84695       img.setAttribute("crossorigin", "");
84696       img.src = imgInfo.url;
84697     });
84698   }
84699   function loadCanvas(imageGroup) {
84700     return Promise.all(imageGroup.map(loadImage2)).then((data) => {
84701       let canvas = document.getElementById("ideditor-canvas" + data[0].imgInfo.face);
84702       const which = { "01": 0, "02": 1, "03": 2, "10": 3, "11": 4, "12": 5 };
84703       let face = data[0].imgInfo.face;
84704       _sceneOptions.cubeMap[which[face]] = canvas.toDataURL("image/jpeg", 1);
84705       return { status: "loadCanvas for face " + data[0].imgInfo.face + "ok" };
84706     });
84707   }
84708   function loadFaces(faceGroup) {
84709     return Promise.all(faceGroup.map(loadCanvas)).then(() => {
84710       return { status: "loadFaces done" };
84711     });
84712   }
84713   function setupCanvas(selection2, reset) {
84714     if (reset) {
84715       selection2.selectAll("#ideditor-stitcher-canvases").remove();
84716     }
84717     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);
84718   }
84719   function qkToXY(qk) {
84720     let x2 = 0;
84721     let y2 = 0;
84722     let scale = 256;
84723     for (let i3 = qk.length; i3 > 0; i3--) {
84724       const key = qk[i3 - 1];
84725       x2 += +(key === "1" || key === "3") * scale;
84726       y2 += +(key === "2" || key === "3") * scale;
84727       scale *= 2;
84728     }
84729     return [x2, y2];
84730   }
84731   function getQuadKeys() {
84732     let dim = _resolution / 256;
84733     let quadKeys;
84734     if (dim === 16) {
84735       quadKeys = [
84736         "0000",
84737         "0001",
84738         "0010",
84739         "0011",
84740         "0100",
84741         "0101",
84742         "0110",
84743         "0111",
84744         "1000",
84745         "1001",
84746         "1010",
84747         "1011",
84748         "1100",
84749         "1101",
84750         "1110",
84751         "1111",
84752         "0002",
84753         "0003",
84754         "0012",
84755         "0013",
84756         "0102",
84757         "0103",
84758         "0112",
84759         "0113",
84760         "1002",
84761         "1003",
84762         "1012",
84763         "1013",
84764         "1102",
84765         "1103",
84766         "1112",
84767         "1113",
84768         "0020",
84769         "0021",
84770         "0030",
84771         "0031",
84772         "0120",
84773         "0121",
84774         "0130",
84775         "0131",
84776         "1020",
84777         "1021",
84778         "1030",
84779         "1031",
84780         "1120",
84781         "1121",
84782         "1130",
84783         "1131",
84784         "0022",
84785         "0023",
84786         "0032",
84787         "0033",
84788         "0122",
84789         "0123",
84790         "0132",
84791         "0133",
84792         "1022",
84793         "1023",
84794         "1032",
84795         "1033",
84796         "1122",
84797         "1123",
84798         "1132",
84799         "1133",
84800         "0200",
84801         "0201",
84802         "0210",
84803         "0211",
84804         "0300",
84805         "0301",
84806         "0310",
84807         "0311",
84808         "1200",
84809         "1201",
84810         "1210",
84811         "1211",
84812         "1300",
84813         "1301",
84814         "1310",
84815         "1311",
84816         "0202",
84817         "0203",
84818         "0212",
84819         "0213",
84820         "0302",
84821         "0303",
84822         "0312",
84823         "0313",
84824         "1202",
84825         "1203",
84826         "1212",
84827         "1213",
84828         "1302",
84829         "1303",
84830         "1312",
84831         "1313",
84832         "0220",
84833         "0221",
84834         "0230",
84835         "0231",
84836         "0320",
84837         "0321",
84838         "0330",
84839         "0331",
84840         "1220",
84841         "1221",
84842         "1230",
84843         "1231",
84844         "1320",
84845         "1321",
84846         "1330",
84847         "1331",
84848         "0222",
84849         "0223",
84850         "0232",
84851         "0233",
84852         "0322",
84853         "0323",
84854         "0332",
84855         "0333",
84856         "1222",
84857         "1223",
84858         "1232",
84859         "1233",
84860         "1322",
84861         "1323",
84862         "1332",
84863         "1333",
84864         "2000",
84865         "2001",
84866         "2010",
84867         "2011",
84868         "2100",
84869         "2101",
84870         "2110",
84871         "2111",
84872         "3000",
84873         "3001",
84874         "3010",
84875         "3011",
84876         "3100",
84877         "3101",
84878         "3110",
84879         "3111",
84880         "2002",
84881         "2003",
84882         "2012",
84883         "2013",
84884         "2102",
84885         "2103",
84886         "2112",
84887         "2113",
84888         "3002",
84889         "3003",
84890         "3012",
84891         "3013",
84892         "3102",
84893         "3103",
84894         "3112",
84895         "3113",
84896         "2020",
84897         "2021",
84898         "2030",
84899         "2031",
84900         "2120",
84901         "2121",
84902         "2130",
84903         "2131",
84904         "3020",
84905         "3021",
84906         "3030",
84907         "3031",
84908         "3120",
84909         "3121",
84910         "3130",
84911         "3131",
84912         "2022",
84913         "2023",
84914         "2032",
84915         "2033",
84916         "2122",
84917         "2123",
84918         "2132",
84919         "2133",
84920         "3022",
84921         "3023",
84922         "3032",
84923         "3033",
84924         "3122",
84925         "3123",
84926         "3132",
84927         "3133",
84928         "2200",
84929         "2201",
84930         "2210",
84931         "2211",
84932         "2300",
84933         "2301",
84934         "2310",
84935         "2311",
84936         "3200",
84937         "3201",
84938         "3210",
84939         "3211",
84940         "3300",
84941         "3301",
84942         "3310",
84943         "3311",
84944         "2202",
84945         "2203",
84946         "2212",
84947         "2213",
84948         "2302",
84949         "2303",
84950         "2312",
84951         "2313",
84952         "3202",
84953         "3203",
84954         "3212",
84955         "3213",
84956         "3302",
84957         "3303",
84958         "3312",
84959         "3313",
84960         "2220",
84961         "2221",
84962         "2230",
84963         "2231",
84964         "2320",
84965         "2321",
84966         "2330",
84967         "2331",
84968         "3220",
84969         "3221",
84970         "3230",
84971         "3231",
84972         "3320",
84973         "3321",
84974         "3330",
84975         "3331",
84976         "2222",
84977         "2223",
84978         "2232",
84979         "2233",
84980         "2322",
84981         "2323",
84982         "2332",
84983         "2333",
84984         "3222",
84985         "3223",
84986         "3232",
84987         "3233",
84988         "3322",
84989         "3323",
84990         "3332",
84991         "3333"
84992       ];
84993     } else if (dim === 8) {
84994       quadKeys = [
84995         "000",
84996         "001",
84997         "010",
84998         "011",
84999         "100",
85000         "101",
85001         "110",
85002         "111",
85003         "002",
85004         "003",
85005         "012",
85006         "013",
85007         "102",
85008         "103",
85009         "112",
85010         "113",
85011         "020",
85012         "021",
85013         "030",
85014         "031",
85015         "120",
85016         "121",
85017         "130",
85018         "131",
85019         "022",
85020         "023",
85021         "032",
85022         "033",
85023         "122",
85024         "123",
85025         "132",
85026         "133",
85027         "200",
85028         "201",
85029         "210",
85030         "211",
85031         "300",
85032         "301",
85033         "310",
85034         "311",
85035         "202",
85036         "203",
85037         "212",
85038         "213",
85039         "302",
85040         "303",
85041         "312",
85042         "313",
85043         "220",
85044         "221",
85045         "230",
85046         "231",
85047         "320",
85048         "321",
85049         "330",
85050         "331",
85051         "222",
85052         "223",
85053         "232",
85054         "233",
85055         "322",
85056         "323",
85057         "332",
85058         "333"
85059       ];
85060     } else if (dim === 4) {
85061       quadKeys = [
85062         "00",
85063         "01",
85064         "10",
85065         "11",
85066         "02",
85067         "03",
85068         "12",
85069         "13",
85070         "20",
85071         "21",
85072         "30",
85073         "31",
85074         "22",
85075         "23",
85076         "32",
85077         "33"
85078       ];
85079     } else {
85080       quadKeys = [
85081         "0",
85082         "1",
85083         "2",
85084         "3"
85085       ];
85086     }
85087     return quadKeys;
85088   }
85089   var streetsideApi, maxResults2, bubbleAppKey, pannellumViewerCSS2, pannellumViewerJS2, tileZoom3, tiler6, dispatch10, minHfov, maxHfov, defaultHfov, _hires, _resolution, _currScene, _ssCache, _pannellumViewer2, _sceneOptions, _loadViewerPromise4, streetside_default;
85090   var init_streetside2 = __esm({
85091     "modules/services/streetside.js"() {
85092       "use strict";
85093       init_src4();
85094       init_src9();
85095       init_src5();
85096       init_rbush();
85097       init_localizer();
85098       init_geo2();
85099       init_util();
85100       streetsideApi = "https://dev.virtualearth.net/REST/v1/Imagery/MetaData/Streetside?mapArea={bbox}&key={key}&count={count}&uriScheme=https";
85101       maxResults2 = 500;
85102       bubbleAppKey = utilAesDecrypt("5c875730b09c6b422433e807e1ff060b6536c791dbfffcffc4c6b18a1bdba1f14593d151adb50e19e1be1ab19aef813bf135d0f103475e5c724dec94389e45d0");
85103       pannellumViewerCSS2 = "pannellum/pannellum.css";
85104       pannellumViewerJS2 = "pannellum/pannellum.js";
85105       tileZoom3 = 16.5;
85106       tiler6 = utilTiler().zoomExtent([tileZoom3, tileZoom3]).skipNullIsland(true);
85107       dispatch10 = dispatch_default("loadedImages", "viewerChanged");
85108       minHfov = 10;
85109       maxHfov = 90;
85110       defaultHfov = 45;
85111       _hires = false;
85112       _resolution = 512;
85113       _currScene = 0;
85114       _sceneOptions = {
85115         showFullscreenCtrl: false,
85116         autoLoad: true,
85117         compass: true,
85118         yaw: 0,
85119         minHfov,
85120         maxHfov,
85121         hfov: defaultHfov,
85122         type: "cubemap",
85123         cubeMap: []
85124       };
85125       streetside_default = {
85126         /**
85127          * init() initialize streetside.
85128          */
85129         init: function() {
85130           if (!_ssCache) {
85131             this.reset();
85132           }
85133           this.event = utilRebind(this, dispatch10, "on");
85134         },
85135         /**
85136          * reset() reset the cache.
85137          */
85138         reset: function() {
85139           if (_ssCache) {
85140             Object.values(_ssCache.bubbles.inflight).forEach(abortRequest5);
85141           }
85142           _ssCache = {
85143             bubbles: { inflight: {}, loaded: {}, nextPage: {}, rtree: new RBush(), points: {} },
85144             sequences: {}
85145           };
85146         },
85147         /**
85148          * bubbles()
85149          */
85150         bubbles: function(projection2) {
85151           const limit = 5;
85152           return searchLimited4(limit, projection2, _ssCache.bubbles.rtree);
85153         },
85154         cachedImage: function(imageKey) {
85155           return _ssCache.bubbles.points[imageKey];
85156         },
85157         sequences: function(projection2) {
85158           const viewport = projection2.clipExtent();
85159           const min3 = [viewport[0][0], viewport[1][1]];
85160           const max3 = [viewport[1][0], viewport[0][1]];
85161           const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
85162           let seen = {};
85163           let results = [];
85164           _ssCache.bubbles.rtree.search(bbox2).forEach((d2) => {
85165             const key = d2.data.sequenceKey;
85166             if (key && !seen[key]) {
85167               seen[key] = true;
85168               results.push(_ssCache.sequences[key].geojson);
85169             }
85170           });
85171           return results;
85172         },
85173         /**
85174          * loadBubbles()
85175          */
85176         loadBubbles: function(projection2, margin) {
85177           if (margin === void 0) margin = 2;
85178           loadTiles3("bubbles", streetsideApi, projection2, margin);
85179         },
85180         viewer: function() {
85181           return _pannellumViewer2;
85182         },
85183         initViewer: function() {
85184           if (!window.pannellum) return;
85185           if (_pannellumViewer2) return;
85186           _currScene += 1;
85187           const sceneID = _currScene.toString();
85188           const options2 = {
85189             "default": { firstScene: sceneID },
85190             scenes: {}
85191           };
85192           options2.scenes[sceneID] = _sceneOptions;
85193           _pannellumViewer2 = window.pannellum.viewer("ideditor-viewer-streetside", options2);
85194         },
85195         ensureViewerLoaded: function(context) {
85196           if (_loadViewerPromise4) return _loadViewerPromise4;
85197           let wrap2 = context.container().select(".photoviewer").selectAll(".ms-wrapper").data([0]);
85198           let wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper ms-wrapper").classed("hide", true);
85199           let that = this;
85200           let pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
85201           wrapEnter.append("div").attr("id", "ideditor-viewer-streetside").on(pointerPrefix + "down.streetside", () => {
85202             select_default2(window).on(pointerPrefix + "move.streetside", () => {
85203               dispatch10.call("viewerChanged");
85204             }, true);
85205           }).on(pointerPrefix + "up.streetside pointercancel.streetside", () => {
85206             select_default2(window).on(pointerPrefix + "move.streetside", null);
85207             let t2 = timer((elapsed) => {
85208               dispatch10.call("viewerChanged");
85209               if (elapsed > 2e3) {
85210                 t2.stop();
85211               }
85212             });
85213           }).append("div").attr("class", "photo-attribution fillD");
85214           let controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
85215           controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
85216           controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
85217           wrap2 = wrap2.merge(wrapEnter).call(setupCanvas, true);
85218           context.ui().photoviewer.on("resize.streetside", () => {
85219             if (_pannellumViewer2) {
85220               _pannellumViewer2.resize();
85221             }
85222           });
85223           _loadViewerPromise4 = new Promise((resolve, reject) => {
85224             let loadedCount = 0;
85225             function loaded() {
85226               loadedCount += 1;
85227               if (loadedCount === 2) resolve();
85228             }
85229             const head = select_default2("head");
85230             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() {
85231               reject();
85232             });
85233             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() {
85234               reject();
85235             });
85236           }).catch(function() {
85237             _loadViewerPromise4 = null;
85238           });
85239           return _loadViewerPromise4;
85240           function step(stepBy) {
85241             return () => {
85242               let viewer = context.container().select(".photoviewer");
85243               let selected = viewer.empty() ? void 0 : viewer.datum();
85244               if (!selected) return;
85245               let nextID = stepBy === 1 ? selected.ne : selected.pr;
85246               let yaw = _pannellumViewer2.getYaw();
85247               let ca = selected.ca + yaw;
85248               let origin = selected.loc;
85249               const meters = 35;
85250               let p1 = [
85251                 origin[0] + geoMetersToLon(meters / 5, origin[1]),
85252                 origin[1]
85253               ];
85254               let p2 = [
85255                 origin[0] + geoMetersToLon(meters / 2, origin[1]),
85256                 origin[1] + geoMetersToLat(meters)
85257               ];
85258               let p3 = [
85259                 origin[0] - geoMetersToLon(meters / 2, origin[1]),
85260                 origin[1] + geoMetersToLat(meters)
85261               ];
85262               let p4 = [
85263                 origin[0] - geoMetersToLon(meters / 5, origin[1]),
85264                 origin[1]
85265               ];
85266               let poly = [p1, p2, p3, p4, p1];
85267               let angle2 = (stepBy === 1 ? ca : ca + 180) * (Math.PI / 180);
85268               poly = geoRotate(poly, -angle2, origin);
85269               let extent = poly.reduce((extent2, point) => {
85270                 return extent2.extend(geoExtent(point));
85271               }, geoExtent());
85272               let minDist = Infinity;
85273               _ssCache.bubbles.rtree.search(extent.bbox()).forEach((d2) => {
85274                 if (d2.data.key === selected.key) return;
85275                 if (!geoPointInPolygon(d2.data.loc, poly)) return;
85276                 let dist = geoVecLength(d2.data.loc, selected.loc);
85277                 let theta = selected.ca - d2.data.ca;
85278                 let minTheta = Math.min(Math.abs(theta), 360 - Math.abs(theta));
85279                 if (minTheta > 20) {
85280                   dist += 5;
85281                 }
85282                 if (dist < minDist) {
85283                   nextID = d2.data.key;
85284                   minDist = dist;
85285                 }
85286               });
85287               let nextBubble = nextID && that.cachedImage(nextID);
85288               if (!nextBubble) return;
85289               context.map().centerEase(nextBubble.loc);
85290               that.selectImage(context, nextBubble.key).yaw(yaw).showViewer(context);
85291             };
85292           }
85293         },
85294         yaw: function(yaw) {
85295           if (typeof yaw !== "number") return yaw;
85296           _sceneOptions.yaw = yaw;
85297           return this;
85298         },
85299         /**
85300          * showViewer()
85301          */
85302         showViewer: function(context) {
85303           let wrap2 = context.container().select(".photoviewer").classed("hide", false);
85304           let isHidden = wrap2.selectAll(".photo-wrapper.ms-wrapper.hide").size();
85305           if (isHidden) {
85306             wrap2.selectAll(".photo-wrapper:not(.ms-wrapper)").classed("hide", true);
85307             wrap2.selectAll(".photo-wrapper.ms-wrapper").classed("hide", false);
85308           }
85309           return this;
85310         },
85311         /**
85312          * hideViewer()
85313          */
85314         hideViewer: function(context) {
85315           let viewer = context.container().select(".photoviewer");
85316           if (!viewer.empty()) viewer.datum(null);
85317           viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
85318           context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
85319           this.updateUrlImage(null);
85320           return this.setStyles(context, null, true);
85321         },
85322         /**
85323          * selectImage().
85324          */
85325         selectImage: function(context, key) {
85326           let that = this;
85327           let d2 = this.cachedImage(key);
85328           let viewer = context.container().select(".photoviewer");
85329           if (!viewer.empty()) viewer.datum(d2);
85330           this.setStyles(context, null, true);
85331           let wrap2 = context.container().select(".photoviewer .ms-wrapper");
85332           let attribution = wrap2.selectAll(".photo-attribution").html("");
85333           wrap2.selectAll(".pnlm-load-box").style("display", "block");
85334           if (!d2) return this;
85335           this.updateUrlImage(key);
85336           _sceneOptions.northOffset = d2.ca;
85337           let line1 = attribution.append("div").attr("class", "attribution-row");
85338           const hiresDomId = utilUniqueDomId("streetside-hires");
85339           let label = line1.append("label").attr("for", hiresDomId).attr("class", "streetside-hires");
85340           label.append("input").attr("type", "checkbox").attr("id", hiresDomId).property("checked", _hires).on("click", (d3_event) => {
85341             d3_event.stopPropagation();
85342             _hires = !_hires;
85343             _resolution = _hires ? 1024 : 512;
85344             wrap2.call(setupCanvas, true);
85345             let viewstate = {
85346               yaw: _pannellumViewer2.getYaw(),
85347               pitch: _pannellumViewer2.getPitch(),
85348               hfov: _pannellumViewer2.getHfov()
85349             };
85350             _sceneOptions = Object.assign(_sceneOptions, viewstate);
85351             that.selectImage(context, d2.key).showViewer(context);
85352           });
85353           label.append("span").call(_t.append("streetside.hires"));
85354           let captureInfo = line1.append("div").attr("class", "attribution-capture-info");
85355           if (d2.captured_by) {
85356             const yyyy = (/* @__PURE__ */ new Date()).getFullYear();
85357             captureInfo.append("a").attr("class", "captured_by").attr("target", "_blank").attr("href", "https://www.microsoft.com/en-us/maps/streetside").text("\xA9" + yyyy + " Microsoft");
85358             captureInfo.append("span").text("|");
85359           }
85360           if (d2.captured_at) {
85361             captureInfo.append("span").attr("class", "captured_at").text(localeTimestamp2(d2.captured_at));
85362           }
85363           let line2 = attribution.append("div").attr("class", "attribution-row");
85364           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"));
85365           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"));
85366           const faceKeys = ["01", "02", "03", "10", "11", "12"];
85367           let quadKeys = getQuadKeys();
85368           let faces = faceKeys.map((faceKey) => {
85369             return quadKeys.map((quadKey) => {
85370               const xy = qkToXY(quadKey);
85371               return {
85372                 face: faceKey,
85373                 url: d2.imageUrl.replace("{faceId}", faceKey).replace("{tileId}", quadKey),
85374                 x: xy[0],
85375                 y: xy[1]
85376               };
85377             });
85378           });
85379           loadFaces(faces).then(function() {
85380             if (!_pannellumViewer2) {
85381               that.initViewer();
85382             } else {
85383               _currScene += 1;
85384               let sceneID = _currScene.toString();
85385               _pannellumViewer2.addScene(sceneID, _sceneOptions).loadScene(sceneID);
85386               if (_currScene > 2) {
85387                 sceneID = (_currScene - 1).toString();
85388                 _pannellumViewer2.removeScene(sceneID);
85389               }
85390             }
85391           });
85392           return this;
85393         },
85394         getSequenceKeyForBubble: function(d2) {
85395           return d2 && d2.sequenceKey;
85396         },
85397         // Updates the currently highlighted sequence and selected bubble.
85398         // Reset is only necessary when interacting with the viewport because
85399         // this implicitly changes the currently selected bubble/sequence
85400         setStyles: function(context, hovered, reset) {
85401           if (reset) {
85402             context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
85403             context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
85404           }
85405           let hoveredBubbleKey = hovered && hovered.key;
85406           let hoveredSequenceKey = this.getSequenceKeyForBubble(hovered);
85407           let hoveredSequence = hoveredSequenceKey && _ssCache.sequences[hoveredSequenceKey];
85408           let hoveredBubbleKeys = hoveredSequence && hoveredSequence.bubbles.map((d2) => d2.key) || [];
85409           let viewer = context.container().select(".photoviewer");
85410           let selected = viewer.empty() ? void 0 : viewer.datum();
85411           let selectedBubbleKey = selected && selected.key;
85412           let selectedSequenceKey = this.getSequenceKeyForBubble(selected);
85413           let selectedSequence = selectedSequenceKey && _ssCache.sequences[selectedSequenceKey];
85414           let selectedBubbleKeys = selectedSequence && selectedSequence.bubbles.map((d2) => d2.key) || [];
85415           let highlightedBubbleKeys = utilArrayUnion(hoveredBubbleKeys, selectedBubbleKeys);
85416           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);
85417           context.container().selectAll(".layer-streetside-images .sequence").classed("highlighted", (d2) => d2.properties.key === hoveredSequenceKey).classed("currentView", (d2) => d2.properties.key === selectedSequenceKey);
85418           context.container().selectAll(".layer-streetside-images .viewfield-group .viewfield").attr("d", viewfieldPath);
85419           function viewfieldPath() {
85420             let d2 = this.parentNode.__data__;
85421             if (d2.pano && d2.key !== selectedBubbleKey) {
85422               return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
85423             } else {
85424               return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
85425             }
85426           }
85427           return this;
85428         },
85429         updateUrlImage: function(imageKey) {
85430           if (!window.mocha) {
85431             var hash2 = utilStringQs(window.location.hash);
85432             if (imageKey) {
85433               hash2.photo = "streetside/" + imageKey;
85434             } else {
85435               delete hash2.photo;
85436             }
85437             window.location.replace("#" + utilQsString(hash2, true));
85438           }
85439         },
85440         /**
85441          * cache().
85442          */
85443         cache: function() {
85444           return _ssCache;
85445         }
85446       };
85447     }
85448   });
85449
85450   // modules/services/taginfo.js
85451   var taginfo_exports = {};
85452   __export(taginfo_exports, {
85453     default: () => taginfo_default
85454   });
85455   function sets(params, n3, o2) {
85456     if (params.geometry && o2[params.geometry]) {
85457       params[n3] = o2[params.geometry];
85458     }
85459     return params;
85460   }
85461   function setFilter(params) {
85462     return sets(params, "filter", tag_filters);
85463   }
85464   function setSort(params) {
85465     return sets(params, "sortname", tag_sorts);
85466   }
85467   function setSortMembers(params) {
85468     return sets(params, "sortname", tag_sort_members);
85469   }
85470   function clean(params) {
85471     return utilObjectOmit(params, ["geometry", "debounce"]);
85472   }
85473   function filterKeys(type2) {
85474     var count_type = type2 ? "count_" + type2 : "count_all";
85475     return function(d2) {
85476       return Number(d2[count_type]) > 2500 || d2.in_wiki;
85477     };
85478   }
85479   function filterMultikeys(prefix) {
85480     return function(d2) {
85481       var re3 = new RegExp("^" + prefix + "(.*)$", "i");
85482       var matches = d2.key.match(re3) || [];
85483       return matches.length === 2 && matches[1].indexOf(":") === -1;
85484     };
85485   }
85486   function filterValues(allowUpperCase) {
85487     return function(d2) {
85488       if (d2.value.match(/[;,]/) !== null) return false;
85489       if (!allowUpperCase && d2.value.match(/[A-Z*]/) !== null) return false;
85490       return d2.count > 100 || d2.in_wiki;
85491     };
85492   }
85493   function filterRoles(geometry) {
85494     return function(d2) {
85495       if (d2.role === "") return false;
85496       if (d2.role.match(/[A-Z*;,]/) !== null) return false;
85497       return Number(d2[tag_members_fractions[geometry]]) > 0;
85498     };
85499   }
85500   function valKey(d2) {
85501     return {
85502       value: d2.key,
85503       title: d2.key
85504     };
85505   }
85506   function valKeyDescription(d2) {
85507     var obj = {
85508       value: d2.value,
85509       title: d2.description || d2.value
85510     };
85511     return obj;
85512   }
85513   function roleKey(d2) {
85514     return {
85515       value: d2.role,
85516       title: d2.role
85517     };
85518   }
85519   function sortKeys(a2, b2) {
85520     return a2.key.indexOf(":") === -1 && b2.key.indexOf(":") !== -1 ? -1 : a2.key.indexOf(":") !== -1 && b2.key.indexOf(":") === -1 ? 1 : 0;
85521   }
85522   function request2(url, params, exactMatch, callback, loaded) {
85523     if (_inflight3[url]) return;
85524     if (checkCache(url, params, exactMatch, callback)) return;
85525     var controller = new AbortController();
85526     _inflight3[url] = controller;
85527     json_default(url, { signal: controller.signal }).then(function(result) {
85528       delete _inflight3[url];
85529       if (loaded) loaded(null, result);
85530     }).catch(function(err) {
85531       delete _inflight3[url];
85532       if (err.name === "AbortError") return;
85533       if (loaded) loaded(err.message);
85534     });
85535   }
85536   function checkCache(url, params, exactMatch, callback) {
85537     var rp = params.rp || 25;
85538     var testQuery = params.query || "";
85539     var testUrl = url;
85540     do {
85541       var hit = _taginfoCache[testUrl];
85542       if (hit && (url === testUrl || hit.length < rp)) {
85543         callback(null, hit);
85544         return true;
85545       }
85546       if (exactMatch || !testQuery.length) return false;
85547       testQuery = testQuery.slice(0, -1);
85548       testUrl = url.replace(/&query=(.*?)&/, "&query=" + testQuery + "&");
85549     } while (testQuery.length >= 0);
85550     return false;
85551   }
85552   var apibase4, _inflight3, _popularKeys, _taginfoCache, tag_sorts, tag_sort_members, tag_filters, tag_members_fractions, debouncedRequest2, taginfo_default;
85553   var init_taginfo = __esm({
85554     "modules/services/taginfo.js"() {
85555       "use strict";
85556       init_debounce();
85557       init_src18();
85558       init_util();
85559       init_localizer();
85560       init_tags();
85561       init_id();
85562       apibase4 = taginfoApiUrl;
85563       _inflight3 = {};
85564       _popularKeys = {};
85565       _taginfoCache = {};
85566       tag_sorts = {
85567         point: "count_nodes",
85568         vertex: "count_nodes",
85569         area: "count_ways",
85570         line: "count_ways"
85571       };
85572       tag_sort_members = {
85573         point: "count_node_members",
85574         vertex: "count_node_members",
85575         area: "count_way_members",
85576         line: "count_way_members",
85577         relation: "count_relation_members"
85578       };
85579       tag_filters = {
85580         point: "nodes",
85581         vertex: "nodes",
85582         area: "ways",
85583         line: "ways"
85584       };
85585       tag_members_fractions = {
85586         point: "count_node_members_fraction",
85587         vertex: "count_node_members_fraction",
85588         area: "count_way_members_fraction",
85589         line: "count_way_members_fraction",
85590         relation: "count_relation_members_fraction"
85591       };
85592       debouncedRequest2 = debounce_default(request2, 300, { leading: false });
85593       taginfo_default = {
85594         init: function() {
85595           _inflight3 = {};
85596           _taginfoCache = {};
85597           _popularKeys = {
85598             // manually exclude some keys – #5377, #7485
85599             postal_code: true,
85600             full_name: true,
85601             loc_name: true,
85602             reg_name: true,
85603             short_name: true,
85604             sorting_name: true,
85605             artist_name: true,
85606             nat_name: true,
85607             long_name: true,
85608             via: true,
85609             "bridge:name": true
85610           };
85611           var params = {
85612             rp: 100,
85613             sortname: "values_all",
85614             sortorder: "desc",
85615             page: 1,
85616             debounce: false,
85617             lang: _mainLocalizer.languageCode()
85618           };
85619           this.keys(params, function(err, data) {
85620             if (err) return;
85621             data.forEach(function(d2) {
85622               if (d2.value === "opening_hours") return;
85623               _popularKeys[d2.value] = true;
85624             });
85625           });
85626         },
85627         reset: function() {
85628           Object.values(_inflight3).forEach(function(controller) {
85629             controller.abort();
85630           });
85631           _inflight3 = {};
85632         },
85633         keys: function(params, callback) {
85634           var doRequest = params.debounce ? debouncedRequest2 : request2;
85635           params = clean(setSort(params));
85636           params = Object.assign({
85637             rp: 10,
85638             sortname: "count_all",
85639             sortorder: "desc",
85640             page: 1,
85641             lang: _mainLocalizer.languageCode()
85642           }, params);
85643           var url = apibase4 + "keys/all?" + utilQsString(params);
85644           doRequest(url, params, false, callback, function(err, d2) {
85645             if (err) {
85646               callback(err);
85647             } else {
85648               var f2 = filterKeys(params.filter);
85649               var result = d2.data.filter(f2).sort(sortKeys).map(valKey);
85650               _taginfoCache[url] = result;
85651               callback(null, result);
85652             }
85653           });
85654         },
85655         multikeys: function(params, callback) {
85656           var doRequest = params.debounce ? debouncedRequest2 : request2;
85657           params = clean(setSort(params));
85658           params = Object.assign({
85659             rp: 25,
85660             sortname: "count_all",
85661             sortorder: "desc",
85662             page: 1,
85663             lang: _mainLocalizer.languageCode()
85664           }, params);
85665           var prefix = params.query;
85666           var url = apibase4 + "keys/all?" + utilQsString(params);
85667           doRequest(url, params, true, callback, function(err, d2) {
85668             if (err) {
85669               callback(err);
85670             } else {
85671               var f2 = filterMultikeys(prefix);
85672               var result = d2.data.filter(f2).map(valKey);
85673               _taginfoCache[url] = result;
85674               callback(null, result);
85675             }
85676           });
85677         },
85678         values: function(params, callback) {
85679           var key = params.key;
85680           if (key && _popularKeys[key]) {
85681             callback(null, []);
85682             return;
85683           }
85684           var doRequest = params.debounce ? debouncedRequest2 : request2;
85685           params = clean(setSort(setFilter(params)));
85686           params = Object.assign({
85687             rp: 25,
85688             sortname: "count_all",
85689             sortorder: "desc",
85690             page: 1,
85691             lang: _mainLocalizer.languageCode()
85692           }, params);
85693           var url = apibase4 + "key/values?" + utilQsString(params);
85694           doRequest(url, params, false, callback, function(err, d2) {
85695             if (err) {
85696               callback(err);
85697             } else {
85698               var allowUpperCase = allowUpperCaseTagValues.test(params.key);
85699               var f2 = filterValues(allowUpperCase);
85700               var result = d2.data.filter(f2).map(valKeyDescription);
85701               _taginfoCache[url] = result;
85702               callback(null, result);
85703             }
85704           });
85705         },
85706         roles: function(params, callback) {
85707           var doRequest = params.debounce ? debouncedRequest2 : request2;
85708           var geometry = params.geometry;
85709           params = clean(setSortMembers(params));
85710           params = Object.assign({
85711             rp: 25,
85712             sortname: "count_all_members",
85713             sortorder: "desc",
85714             page: 1,
85715             lang: _mainLocalizer.languageCode()
85716           }, params);
85717           var url = apibase4 + "relation/roles?" + utilQsString(params);
85718           doRequest(url, params, true, callback, function(err, d2) {
85719             if (err) {
85720               callback(err);
85721             } else {
85722               var f2 = filterRoles(geometry);
85723               var result = d2.data.filter(f2).map(roleKey);
85724               _taginfoCache[url] = result;
85725               callback(null, result);
85726             }
85727           });
85728         },
85729         docs: function(params, callback) {
85730           var doRequest = params.debounce ? debouncedRequest2 : request2;
85731           params = clean(setSort(params));
85732           var path = "key/wiki_pages?";
85733           if (params.value) {
85734             path = "tag/wiki_pages?";
85735           } else if (params.rtype) {
85736             path = "relation/wiki_pages?";
85737           }
85738           var url = apibase4 + path + utilQsString(params);
85739           doRequest(url, params, true, callback, function(err, d2) {
85740             if (err) {
85741               callback(err);
85742             } else {
85743               _taginfoCache[url] = d2.data;
85744               callback(null, d2.data);
85745             }
85746           });
85747         },
85748         apibase: function(_2) {
85749           if (!arguments.length) return apibase4;
85750           apibase4 = _2;
85751           return this;
85752         }
85753       };
85754     }
85755   });
85756
85757   // node_modules/polygon-clipping/dist/polygon-clipping.umd.js
85758   var require_polygon_clipping_umd = __commonJS({
85759     "node_modules/polygon-clipping/dist/polygon-clipping.umd.js"(exports2, module2) {
85760       (function(global2, factory) {
85761         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());
85762       })(exports2, function() {
85763         "use strict";
85764         function __generator(thisArg, body) {
85765           var _2 = {
85766             label: 0,
85767             sent: function() {
85768               if (t2[0] & 1) throw t2[1];
85769               return t2[1];
85770             },
85771             trys: [],
85772             ops: []
85773           }, f2, y2, t2, g3;
85774           return g3 = {
85775             next: verb(0),
85776             "throw": verb(1),
85777             "return": verb(2)
85778           }, typeof Symbol === "function" && (g3[Symbol.iterator] = function() {
85779             return this;
85780           }), g3;
85781           function verb(n3) {
85782             return function(v2) {
85783               return step([n3, v2]);
85784             };
85785           }
85786           function step(op) {
85787             if (f2) throw new TypeError("Generator is already executing.");
85788             while (_2) try {
85789               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;
85790               if (y2 = 0, t2) op = [op[0] & 2, t2.value];
85791               switch (op[0]) {
85792                 case 0:
85793                 case 1:
85794                   t2 = op;
85795                   break;
85796                 case 4:
85797                   _2.label++;
85798                   return {
85799                     value: op[1],
85800                     done: false
85801                   };
85802                 case 5:
85803                   _2.label++;
85804                   y2 = op[1];
85805                   op = [0];
85806                   continue;
85807                 case 7:
85808                   op = _2.ops.pop();
85809                   _2.trys.pop();
85810                   continue;
85811                 default:
85812                   if (!(t2 = _2.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) {
85813                     _2 = 0;
85814                     continue;
85815                   }
85816                   if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) {
85817                     _2.label = op[1];
85818                     break;
85819                   }
85820                   if (op[0] === 6 && _2.label < t2[1]) {
85821                     _2.label = t2[1];
85822                     t2 = op;
85823                     break;
85824                   }
85825                   if (t2 && _2.label < t2[2]) {
85826                     _2.label = t2[2];
85827                     _2.ops.push(op);
85828                     break;
85829                   }
85830                   if (t2[2]) _2.ops.pop();
85831                   _2.trys.pop();
85832                   continue;
85833               }
85834               op = body.call(thisArg, _2);
85835             } catch (e3) {
85836               op = [6, e3];
85837               y2 = 0;
85838             } finally {
85839               f2 = t2 = 0;
85840             }
85841             if (op[0] & 5) throw op[1];
85842             return {
85843               value: op[0] ? op[1] : void 0,
85844               done: true
85845             };
85846           }
85847         }
85848         var Node = (
85849           /** @class */
85850           /* @__PURE__ */ function() {
85851             function Node2(key, data) {
85852               this.next = null;
85853               this.key = key;
85854               this.data = data;
85855               this.left = null;
85856               this.right = null;
85857             }
85858             return Node2;
85859           }()
85860         );
85861         function DEFAULT_COMPARE(a2, b2) {
85862           return a2 > b2 ? 1 : a2 < b2 ? -1 : 0;
85863         }
85864         function splay(i3, t2, comparator) {
85865           var N2 = new Node(null, null);
85866           var l2 = N2;
85867           var r2 = N2;
85868           while (true) {
85869             var cmp2 = comparator(i3, t2.key);
85870             if (cmp2 < 0) {
85871               if (t2.left === null) break;
85872               if (comparator(i3, t2.left.key) < 0) {
85873                 var y2 = t2.left;
85874                 t2.left = y2.right;
85875                 y2.right = t2;
85876                 t2 = y2;
85877                 if (t2.left === null) break;
85878               }
85879               r2.left = t2;
85880               r2 = t2;
85881               t2 = t2.left;
85882             } else if (cmp2 > 0) {
85883               if (t2.right === null) break;
85884               if (comparator(i3, t2.right.key) > 0) {
85885                 var y2 = t2.right;
85886                 t2.right = y2.left;
85887                 y2.left = t2;
85888                 t2 = y2;
85889                 if (t2.right === null) break;
85890               }
85891               l2.right = t2;
85892               l2 = t2;
85893               t2 = t2.right;
85894             } else break;
85895           }
85896           l2.right = t2.left;
85897           r2.left = t2.right;
85898           t2.left = N2.right;
85899           t2.right = N2.left;
85900           return t2;
85901         }
85902         function insert(i3, data, t2, comparator) {
85903           var node = new Node(i3, data);
85904           if (t2 === null) {
85905             node.left = node.right = null;
85906             return node;
85907           }
85908           t2 = splay(i3, t2, comparator);
85909           var cmp2 = comparator(i3, t2.key);
85910           if (cmp2 < 0) {
85911             node.left = t2.left;
85912             node.right = t2;
85913             t2.left = null;
85914           } else if (cmp2 >= 0) {
85915             node.right = t2.right;
85916             node.left = t2;
85917             t2.right = null;
85918           }
85919           return node;
85920         }
85921         function split(key, v2, comparator) {
85922           var left = null;
85923           var right = null;
85924           if (v2) {
85925             v2 = splay(key, v2, comparator);
85926             var cmp2 = comparator(v2.key, key);
85927             if (cmp2 === 0) {
85928               left = v2.left;
85929               right = v2.right;
85930             } else if (cmp2 < 0) {
85931               right = v2.right;
85932               v2.right = null;
85933               left = v2;
85934             } else {
85935               left = v2.left;
85936               v2.left = null;
85937               right = v2;
85938             }
85939           }
85940           return {
85941             left,
85942             right
85943           };
85944         }
85945         function merge3(left, right, comparator) {
85946           if (right === null) return left;
85947           if (left === null) return right;
85948           right = splay(left.key, right, comparator);
85949           right.left = left;
85950           return right;
85951         }
85952         function printRow(root3, prefix, isTail, out, printNode) {
85953           if (root3) {
85954             out("" + prefix + (isTail ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ") + printNode(root3) + "\n");
85955             var indent = prefix + (isTail ? "    " : "\u2502   ");
85956             if (root3.left) printRow(root3.left, indent, false, out, printNode);
85957             if (root3.right) printRow(root3.right, indent, true, out, printNode);
85958           }
85959         }
85960         var Tree = (
85961           /** @class */
85962           function() {
85963             function Tree2(comparator) {
85964               if (comparator === void 0) {
85965                 comparator = DEFAULT_COMPARE;
85966               }
85967               this._root = null;
85968               this._size = 0;
85969               this._comparator = comparator;
85970             }
85971             Tree2.prototype.insert = function(key, data) {
85972               this._size++;
85973               return this._root = insert(key, data, this._root, this._comparator);
85974             };
85975             Tree2.prototype.add = function(key, data) {
85976               var node = new Node(key, data);
85977               if (this._root === null) {
85978                 node.left = node.right = null;
85979                 this._size++;
85980                 this._root = node;
85981               }
85982               var comparator = this._comparator;
85983               var t2 = splay(key, this._root, comparator);
85984               var cmp2 = comparator(key, t2.key);
85985               if (cmp2 === 0) this._root = t2;
85986               else {
85987                 if (cmp2 < 0) {
85988                   node.left = t2.left;
85989                   node.right = t2;
85990                   t2.left = null;
85991                 } else if (cmp2 > 0) {
85992                   node.right = t2.right;
85993                   node.left = t2;
85994                   t2.right = null;
85995                 }
85996                 this._size++;
85997                 this._root = node;
85998               }
85999               return this._root;
86000             };
86001             Tree2.prototype.remove = function(key) {
86002               this._root = this._remove(key, this._root, this._comparator);
86003             };
86004             Tree2.prototype._remove = function(i3, t2, comparator) {
86005               var x2;
86006               if (t2 === null) return null;
86007               t2 = splay(i3, t2, comparator);
86008               var cmp2 = comparator(i3, t2.key);
86009               if (cmp2 === 0) {
86010                 if (t2.left === null) {
86011                   x2 = t2.right;
86012                 } else {
86013                   x2 = splay(i3, t2.left, comparator);
86014                   x2.right = t2.right;
86015                 }
86016                 this._size--;
86017                 return x2;
86018               }
86019               return t2;
86020             };
86021             Tree2.prototype.pop = function() {
86022               var node = this._root;
86023               if (node) {
86024                 while (node.left) node = node.left;
86025                 this._root = splay(node.key, this._root, this._comparator);
86026                 this._root = this._remove(node.key, this._root, this._comparator);
86027                 return {
86028                   key: node.key,
86029                   data: node.data
86030                 };
86031               }
86032               return null;
86033             };
86034             Tree2.prototype.findStatic = function(key) {
86035               var current = this._root;
86036               var compare2 = this._comparator;
86037               while (current) {
86038                 var cmp2 = compare2(key, current.key);
86039                 if (cmp2 === 0) return current;
86040                 else if (cmp2 < 0) current = current.left;
86041                 else current = current.right;
86042               }
86043               return null;
86044             };
86045             Tree2.prototype.find = function(key) {
86046               if (this._root) {
86047                 this._root = splay(key, this._root, this._comparator);
86048                 if (this._comparator(key, this._root.key) !== 0) return null;
86049               }
86050               return this._root;
86051             };
86052             Tree2.prototype.contains = function(key) {
86053               var current = this._root;
86054               var compare2 = this._comparator;
86055               while (current) {
86056                 var cmp2 = compare2(key, current.key);
86057                 if (cmp2 === 0) return true;
86058                 else if (cmp2 < 0) current = current.left;
86059                 else current = current.right;
86060               }
86061               return false;
86062             };
86063             Tree2.prototype.forEach = function(visitor, ctx) {
86064               var current = this._root;
86065               var Q2 = [];
86066               var done = false;
86067               while (!done) {
86068                 if (current !== null) {
86069                   Q2.push(current);
86070                   current = current.left;
86071                 } else {
86072                   if (Q2.length !== 0) {
86073                     current = Q2.pop();
86074                     visitor.call(ctx, current);
86075                     current = current.right;
86076                   } else done = true;
86077                 }
86078               }
86079               return this;
86080             };
86081             Tree2.prototype.range = function(low, high, fn, ctx) {
86082               var Q2 = [];
86083               var compare2 = this._comparator;
86084               var node = this._root;
86085               var cmp2;
86086               while (Q2.length !== 0 || node) {
86087                 if (node) {
86088                   Q2.push(node);
86089                   node = node.left;
86090                 } else {
86091                   node = Q2.pop();
86092                   cmp2 = compare2(node.key, high);
86093                   if (cmp2 > 0) {
86094                     break;
86095                   } else if (compare2(node.key, low) >= 0) {
86096                     if (fn.call(ctx, node)) return this;
86097                   }
86098                   node = node.right;
86099                 }
86100               }
86101               return this;
86102             };
86103             Tree2.prototype.keys = function() {
86104               var keys2 = [];
86105               this.forEach(function(_a3) {
86106                 var key = _a3.key;
86107                 return keys2.push(key);
86108               });
86109               return keys2;
86110             };
86111             Tree2.prototype.values = function() {
86112               var values = [];
86113               this.forEach(function(_a3) {
86114                 var data = _a3.data;
86115                 return values.push(data);
86116               });
86117               return values;
86118             };
86119             Tree2.prototype.min = function() {
86120               if (this._root) return this.minNode(this._root).key;
86121               return null;
86122             };
86123             Tree2.prototype.max = function() {
86124               if (this._root) return this.maxNode(this._root).key;
86125               return null;
86126             };
86127             Tree2.prototype.minNode = function(t2) {
86128               if (t2 === void 0) {
86129                 t2 = this._root;
86130               }
86131               if (t2) while (t2.left) t2 = t2.left;
86132               return t2;
86133             };
86134             Tree2.prototype.maxNode = function(t2) {
86135               if (t2 === void 0) {
86136                 t2 = this._root;
86137               }
86138               if (t2) while (t2.right) t2 = t2.right;
86139               return t2;
86140             };
86141             Tree2.prototype.at = function(index2) {
86142               var current = this._root;
86143               var done = false;
86144               var i3 = 0;
86145               var Q2 = [];
86146               while (!done) {
86147                 if (current) {
86148                   Q2.push(current);
86149                   current = current.left;
86150                 } else {
86151                   if (Q2.length > 0) {
86152                     current = Q2.pop();
86153                     if (i3 === index2) return current;
86154                     i3++;
86155                     current = current.right;
86156                   } else done = true;
86157                 }
86158               }
86159               return null;
86160             };
86161             Tree2.prototype.next = function(d2) {
86162               var root3 = this._root;
86163               var successor = null;
86164               if (d2.right) {
86165                 successor = d2.right;
86166                 while (successor.left) successor = successor.left;
86167                 return successor;
86168               }
86169               var comparator = this._comparator;
86170               while (root3) {
86171                 var cmp2 = comparator(d2.key, root3.key);
86172                 if (cmp2 === 0) break;
86173                 else if (cmp2 < 0) {
86174                   successor = root3;
86175                   root3 = root3.left;
86176                 } else root3 = root3.right;
86177               }
86178               return successor;
86179             };
86180             Tree2.prototype.prev = function(d2) {
86181               var root3 = this._root;
86182               var predecessor = null;
86183               if (d2.left !== null) {
86184                 predecessor = d2.left;
86185                 while (predecessor.right) predecessor = predecessor.right;
86186                 return predecessor;
86187               }
86188               var comparator = this._comparator;
86189               while (root3) {
86190                 var cmp2 = comparator(d2.key, root3.key);
86191                 if (cmp2 === 0) break;
86192                 else if (cmp2 < 0) root3 = root3.left;
86193                 else {
86194                   predecessor = root3;
86195                   root3 = root3.right;
86196                 }
86197               }
86198               return predecessor;
86199             };
86200             Tree2.prototype.clear = function() {
86201               this._root = null;
86202               this._size = 0;
86203               return this;
86204             };
86205             Tree2.prototype.toList = function() {
86206               return toList(this._root);
86207             };
86208             Tree2.prototype.load = function(keys2, values, presort) {
86209               if (values === void 0) {
86210                 values = [];
86211               }
86212               if (presort === void 0) {
86213                 presort = false;
86214               }
86215               var size = keys2.length;
86216               var comparator = this._comparator;
86217               if (presort) sort(keys2, values, 0, size - 1, comparator);
86218               if (this._root === null) {
86219                 this._root = loadRecursive(keys2, values, 0, size);
86220                 this._size = size;
86221               } else {
86222                 var mergedList = mergeLists(this.toList(), createList(keys2, values), comparator);
86223                 size = this._size + size;
86224                 this._root = sortedListToBST({
86225                   head: mergedList
86226                 }, 0, size);
86227               }
86228               return this;
86229             };
86230             Tree2.prototype.isEmpty = function() {
86231               return this._root === null;
86232             };
86233             Object.defineProperty(Tree2.prototype, "size", {
86234               get: function() {
86235                 return this._size;
86236               },
86237               enumerable: true,
86238               configurable: true
86239             });
86240             Object.defineProperty(Tree2.prototype, "root", {
86241               get: function() {
86242                 return this._root;
86243               },
86244               enumerable: true,
86245               configurable: true
86246             });
86247             Tree2.prototype.toString = function(printNode) {
86248               if (printNode === void 0) {
86249                 printNode = function(n3) {
86250                   return String(n3.key);
86251                 };
86252               }
86253               var out = [];
86254               printRow(this._root, "", true, function(v2) {
86255                 return out.push(v2);
86256               }, printNode);
86257               return out.join("");
86258             };
86259             Tree2.prototype.update = function(key, newKey, newData) {
86260               var comparator = this._comparator;
86261               var _a3 = split(key, this._root, comparator), left = _a3.left, right = _a3.right;
86262               if (comparator(key, newKey) < 0) {
86263                 right = insert(newKey, newData, right, comparator);
86264               } else {
86265                 left = insert(newKey, newData, left, comparator);
86266               }
86267               this._root = merge3(left, right, comparator);
86268             };
86269             Tree2.prototype.split = function(key) {
86270               return split(key, this._root, this._comparator);
86271             };
86272             Tree2.prototype[Symbol.iterator] = function() {
86273               var current, Q2, done;
86274               return __generator(this, function(_a3) {
86275                 switch (_a3.label) {
86276                   case 0:
86277                     current = this._root;
86278                     Q2 = [];
86279                     done = false;
86280                     _a3.label = 1;
86281                   case 1:
86282                     if (!!done) return [3, 6];
86283                     if (!(current !== null)) return [3, 2];
86284                     Q2.push(current);
86285                     current = current.left;
86286                     return [3, 5];
86287                   case 2:
86288                     if (!(Q2.length !== 0)) return [3, 4];
86289                     current = Q2.pop();
86290                     return [4, current];
86291                   case 3:
86292                     _a3.sent();
86293                     current = current.right;
86294                     return [3, 5];
86295                   case 4:
86296                     done = true;
86297                     _a3.label = 5;
86298                   case 5:
86299                     return [3, 1];
86300                   case 6:
86301                     return [
86302                       2
86303                       /*return*/
86304                     ];
86305                 }
86306               });
86307             };
86308             return Tree2;
86309           }()
86310         );
86311         function loadRecursive(keys2, values, start2, end) {
86312           var size = end - start2;
86313           if (size > 0) {
86314             var middle = start2 + Math.floor(size / 2);
86315             var key = keys2[middle];
86316             var data = values[middle];
86317             var node = new Node(key, data);
86318             node.left = loadRecursive(keys2, values, start2, middle);
86319             node.right = loadRecursive(keys2, values, middle + 1, end);
86320             return node;
86321           }
86322           return null;
86323         }
86324         function createList(keys2, values) {
86325           var head = new Node(null, null);
86326           var p2 = head;
86327           for (var i3 = 0; i3 < keys2.length; i3++) {
86328             p2 = p2.next = new Node(keys2[i3], values[i3]);
86329           }
86330           p2.next = null;
86331           return head.next;
86332         }
86333         function toList(root3) {
86334           var current = root3;
86335           var Q2 = [];
86336           var done = false;
86337           var head = new Node(null, null);
86338           var p2 = head;
86339           while (!done) {
86340             if (current) {
86341               Q2.push(current);
86342               current = current.left;
86343             } else {
86344               if (Q2.length > 0) {
86345                 current = p2 = p2.next = Q2.pop();
86346                 current = current.right;
86347               } else done = true;
86348             }
86349           }
86350           p2.next = null;
86351           return head.next;
86352         }
86353         function sortedListToBST(list2, start2, end) {
86354           var size = end - start2;
86355           if (size > 0) {
86356             var middle = start2 + Math.floor(size / 2);
86357             var left = sortedListToBST(list2, start2, middle);
86358             var root3 = list2.head;
86359             root3.left = left;
86360             list2.head = list2.head.next;
86361             root3.right = sortedListToBST(list2, middle + 1, end);
86362             return root3;
86363           }
86364           return null;
86365         }
86366         function mergeLists(l1, l2, compare2) {
86367           var head = new Node(null, null);
86368           var p2 = head;
86369           var p1 = l1;
86370           var p22 = l2;
86371           while (p1 !== null && p22 !== null) {
86372             if (compare2(p1.key, p22.key) < 0) {
86373               p2.next = p1;
86374               p1 = p1.next;
86375             } else {
86376               p2.next = p22;
86377               p22 = p22.next;
86378             }
86379             p2 = p2.next;
86380           }
86381           if (p1 !== null) {
86382             p2.next = p1;
86383           } else if (p22 !== null) {
86384             p2.next = p22;
86385           }
86386           return head.next;
86387         }
86388         function sort(keys2, values, left, right, compare2) {
86389           if (left >= right) return;
86390           var pivot = keys2[left + right >> 1];
86391           var i3 = left - 1;
86392           var j2 = right + 1;
86393           while (true) {
86394             do
86395               i3++;
86396             while (compare2(keys2[i3], pivot) < 0);
86397             do
86398               j2--;
86399             while (compare2(keys2[j2], pivot) > 0);
86400             if (i3 >= j2) break;
86401             var tmp = keys2[i3];
86402             keys2[i3] = keys2[j2];
86403             keys2[j2] = tmp;
86404             tmp = values[i3];
86405             values[i3] = values[j2];
86406             values[j2] = tmp;
86407           }
86408           sort(keys2, values, left, j2, compare2);
86409           sort(keys2, values, j2 + 1, right, compare2);
86410         }
86411         const isInBbox2 = (bbox2, point) => {
86412           return bbox2.ll.x <= point.x && point.x <= bbox2.ur.x && bbox2.ll.y <= point.y && point.y <= bbox2.ur.y;
86413         };
86414         const getBboxOverlap2 = (b1, b2) => {
86415           if (b2.ur.x < b1.ll.x || b1.ur.x < b2.ll.x || b2.ur.y < b1.ll.y || b1.ur.y < b2.ll.y) return null;
86416           const lowerX = b1.ll.x < b2.ll.x ? b2.ll.x : b1.ll.x;
86417           const upperX = b1.ur.x < b2.ur.x ? b1.ur.x : b2.ur.x;
86418           const lowerY = b1.ll.y < b2.ll.y ? b2.ll.y : b1.ll.y;
86419           const upperY = b1.ur.y < b2.ur.y ? b1.ur.y : b2.ur.y;
86420           return {
86421             ll: {
86422               x: lowerX,
86423               y: lowerY
86424             },
86425             ur: {
86426               x: upperX,
86427               y: upperY
86428             }
86429           };
86430         };
86431         let epsilon$1 = Number.EPSILON;
86432         if (epsilon$1 === void 0) epsilon$1 = Math.pow(2, -52);
86433         const EPSILON_SQ = epsilon$1 * epsilon$1;
86434         const cmp = (a2, b2) => {
86435           if (-epsilon$1 < a2 && a2 < epsilon$1) {
86436             if (-epsilon$1 < b2 && b2 < epsilon$1) {
86437               return 0;
86438             }
86439           }
86440           const ab = a2 - b2;
86441           if (ab * ab < EPSILON_SQ * a2 * b2) {
86442             return 0;
86443           }
86444           return a2 < b2 ? -1 : 1;
86445         };
86446         class PtRounder {
86447           constructor() {
86448             this.reset();
86449           }
86450           reset() {
86451             this.xRounder = new CoordRounder();
86452             this.yRounder = new CoordRounder();
86453           }
86454           round(x2, y2) {
86455             return {
86456               x: this.xRounder.round(x2),
86457               y: this.yRounder.round(y2)
86458             };
86459           }
86460         }
86461         class CoordRounder {
86462           constructor() {
86463             this.tree = new Tree();
86464             this.round(0);
86465           }
86466           // Note: this can rounds input values backwards or forwards.
86467           //       You might ask, why not restrict this to just rounding
86468           //       forwards? Wouldn't that allow left endpoints to always
86469           //       remain left endpoints during splitting (never change to
86470           //       right). No - it wouldn't, because we snap intersections
86471           //       to endpoints (to establish independence from the segment
86472           //       angle for t-intersections).
86473           round(coord2) {
86474             const node = this.tree.add(coord2);
86475             const prevNode = this.tree.prev(node);
86476             if (prevNode !== null && cmp(node.key, prevNode.key) === 0) {
86477               this.tree.remove(coord2);
86478               return prevNode.key;
86479             }
86480             const nextNode = this.tree.next(node);
86481             if (nextNode !== null && cmp(node.key, nextNode.key) === 0) {
86482               this.tree.remove(coord2);
86483               return nextNode.key;
86484             }
86485             return coord2;
86486           }
86487         }
86488         const rounder = new PtRounder();
86489         const epsilon3 = 11102230246251565e-32;
86490         const splitter = 134217729;
86491         const resulterrbound = (3 + 8 * epsilon3) * epsilon3;
86492         function sum(elen, e3, flen, f2, h2) {
86493           let Q2, Qnew, hh, bvirt;
86494           let enow = e3[0];
86495           let fnow = f2[0];
86496           let eindex = 0;
86497           let findex = 0;
86498           if (fnow > enow === fnow > -enow) {
86499             Q2 = enow;
86500             enow = e3[++eindex];
86501           } else {
86502             Q2 = fnow;
86503             fnow = f2[++findex];
86504           }
86505           let hindex = 0;
86506           if (eindex < elen && findex < flen) {
86507             if (fnow > enow === fnow > -enow) {
86508               Qnew = enow + Q2;
86509               hh = Q2 - (Qnew - enow);
86510               enow = e3[++eindex];
86511             } else {
86512               Qnew = fnow + Q2;
86513               hh = Q2 - (Qnew - fnow);
86514               fnow = f2[++findex];
86515             }
86516             Q2 = Qnew;
86517             if (hh !== 0) {
86518               h2[hindex++] = hh;
86519             }
86520             while (eindex < elen && findex < flen) {
86521               if (fnow > enow === fnow > -enow) {
86522                 Qnew = Q2 + enow;
86523                 bvirt = Qnew - Q2;
86524                 hh = Q2 - (Qnew - bvirt) + (enow - bvirt);
86525                 enow = e3[++eindex];
86526               } else {
86527                 Qnew = Q2 + fnow;
86528                 bvirt = Qnew - Q2;
86529                 hh = Q2 - (Qnew - bvirt) + (fnow - bvirt);
86530                 fnow = f2[++findex];
86531               }
86532               Q2 = Qnew;
86533               if (hh !== 0) {
86534                 h2[hindex++] = hh;
86535               }
86536             }
86537           }
86538           while (eindex < elen) {
86539             Qnew = Q2 + enow;
86540             bvirt = Qnew - Q2;
86541             hh = Q2 - (Qnew - bvirt) + (enow - bvirt);
86542             enow = e3[++eindex];
86543             Q2 = Qnew;
86544             if (hh !== 0) {
86545               h2[hindex++] = hh;
86546             }
86547           }
86548           while (findex < flen) {
86549             Qnew = Q2 + fnow;
86550             bvirt = Qnew - Q2;
86551             hh = Q2 - (Qnew - bvirt) + (fnow - bvirt);
86552             fnow = f2[++findex];
86553             Q2 = Qnew;
86554             if (hh !== 0) {
86555               h2[hindex++] = hh;
86556             }
86557           }
86558           if (Q2 !== 0 || hindex === 0) {
86559             h2[hindex++] = Q2;
86560           }
86561           return hindex;
86562         }
86563         function estimate(elen, e3) {
86564           let Q2 = e3[0];
86565           for (let i3 = 1; i3 < elen; i3++) Q2 += e3[i3];
86566           return Q2;
86567         }
86568         function vec(n3) {
86569           return new Float64Array(n3);
86570         }
86571         const ccwerrboundA = (3 + 16 * epsilon3) * epsilon3;
86572         const ccwerrboundB = (2 + 12 * epsilon3) * epsilon3;
86573         const ccwerrboundC = (9 + 64 * epsilon3) * epsilon3 * epsilon3;
86574         const B2 = vec(4);
86575         const C1 = vec(8);
86576         const C2 = vec(12);
86577         const D2 = vec(16);
86578         const u2 = vec(4);
86579         function orient2dadapt(ax, ay, bx, by, cx, cy, detsum) {
86580           let acxtail, acytail, bcxtail, bcytail;
86581           let bvirt, c2, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t12, t02, u3;
86582           const acx = ax - cx;
86583           const bcx = bx - cx;
86584           const acy = ay - cy;
86585           const bcy = by - cy;
86586           s1 = acx * bcy;
86587           c2 = splitter * acx;
86588           ahi = c2 - (c2 - acx);
86589           alo = acx - ahi;
86590           c2 = splitter * bcy;
86591           bhi = c2 - (c2 - bcy);
86592           blo = bcy - bhi;
86593           s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
86594           t12 = acy * bcx;
86595           c2 = splitter * acy;
86596           ahi = c2 - (c2 - acy);
86597           alo = acy - ahi;
86598           c2 = splitter * bcx;
86599           bhi = c2 - (c2 - bcx);
86600           blo = bcx - bhi;
86601           t02 = alo * blo - (t12 - ahi * bhi - alo * bhi - ahi * blo);
86602           _i = s0 - t02;
86603           bvirt = s0 - _i;
86604           B2[0] = s0 - (_i + bvirt) + (bvirt - t02);
86605           _j = s1 + _i;
86606           bvirt = _j - s1;
86607           _0 = s1 - (_j - bvirt) + (_i - bvirt);
86608           _i = _0 - t12;
86609           bvirt = _0 - _i;
86610           B2[1] = _0 - (_i + bvirt) + (bvirt - t12);
86611           u3 = _j + _i;
86612           bvirt = u3 - _j;
86613           B2[2] = _j - (u3 - bvirt) + (_i - bvirt);
86614           B2[3] = u3;
86615           let det = estimate(4, B2);
86616           let errbound = ccwerrboundB * detsum;
86617           if (det >= errbound || -det >= errbound) {
86618             return det;
86619           }
86620           bvirt = ax - acx;
86621           acxtail = ax - (acx + bvirt) + (bvirt - cx);
86622           bvirt = bx - bcx;
86623           bcxtail = bx - (bcx + bvirt) + (bvirt - cx);
86624           bvirt = ay - acy;
86625           acytail = ay - (acy + bvirt) + (bvirt - cy);
86626           bvirt = by - bcy;
86627           bcytail = by - (bcy + bvirt) + (bvirt - cy);
86628           if (acxtail === 0 && acytail === 0 && bcxtail === 0 && bcytail === 0) {
86629             return det;
86630           }
86631           errbound = ccwerrboundC * detsum + resulterrbound * Math.abs(det);
86632           det += acx * bcytail + bcy * acxtail - (acy * bcxtail + bcx * acytail);
86633           if (det >= errbound || -det >= errbound) return det;
86634           s1 = acxtail * bcy;
86635           c2 = splitter * acxtail;
86636           ahi = c2 - (c2 - acxtail);
86637           alo = acxtail - ahi;
86638           c2 = splitter * bcy;
86639           bhi = c2 - (c2 - bcy);
86640           blo = bcy - bhi;
86641           s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
86642           t12 = acytail * bcx;
86643           c2 = splitter * acytail;
86644           ahi = c2 - (c2 - acytail);
86645           alo = acytail - ahi;
86646           c2 = splitter * bcx;
86647           bhi = c2 - (c2 - bcx);
86648           blo = bcx - bhi;
86649           t02 = alo * blo - (t12 - ahi * bhi - alo * bhi - ahi * blo);
86650           _i = s0 - t02;
86651           bvirt = s0 - _i;
86652           u2[0] = s0 - (_i + bvirt) + (bvirt - t02);
86653           _j = s1 + _i;
86654           bvirt = _j - s1;
86655           _0 = s1 - (_j - bvirt) + (_i - bvirt);
86656           _i = _0 - t12;
86657           bvirt = _0 - _i;
86658           u2[1] = _0 - (_i + bvirt) + (bvirt - t12);
86659           u3 = _j + _i;
86660           bvirt = u3 - _j;
86661           u2[2] = _j - (u3 - bvirt) + (_i - bvirt);
86662           u2[3] = u3;
86663           const C1len = sum(4, B2, 4, u2, C1);
86664           s1 = acx * bcytail;
86665           c2 = splitter * acx;
86666           ahi = c2 - (c2 - acx);
86667           alo = acx - ahi;
86668           c2 = splitter * bcytail;
86669           bhi = c2 - (c2 - bcytail);
86670           blo = bcytail - bhi;
86671           s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
86672           t12 = acy * bcxtail;
86673           c2 = splitter * acy;
86674           ahi = c2 - (c2 - acy);
86675           alo = acy - ahi;
86676           c2 = splitter * bcxtail;
86677           bhi = c2 - (c2 - bcxtail);
86678           blo = bcxtail - bhi;
86679           t02 = alo * blo - (t12 - ahi * bhi - alo * bhi - ahi * blo);
86680           _i = s0 - t02;
86681           bvirt = s0 - _i;
86682           u2[0] = s0 - (_i + bvirt) + (bvirt - t02);
86683           _j = s1 + _i;
86684           bvirt = _j - s1;
86685           _0 = s1 - (_j - bvirt) + (_i - bvirt);
86686           _i = _0 - t12;
86687           bvirt = _0 - _i;
86688           u2[1] = _0 - (_i + bvirt) + (bvirt - t12);
86689           u3 = _j + _i;
86690           bvirt = u3 - _j;
86691           u2[2] = _j - (u3 - bvirt) + (_i - bvirt);
86692           u2[3] = u3;
86693           const C2len = sum(C1len, C1, 4, u2, C2);
86694           s1 = acxtail * bcytail;
86695           c2 = splitter * acxtail;
86696           ahi = c2 - (c2 - acxtail);
86697           alo = acxtail - ahi;
86698           c2 = splitter * bcytail;
86699           bhi = c2 - (c2 - bcytail);
86700           blo = bcytail - bhi;
86701           s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
86702           t12 = acytail * bcxtail;
86703           c2 = splitter * acytail;
86704           ahi = c2 - (c2 - acytail);
86705           alo = acytail - ahi;
86706           c2 = splitter * bcxtail;
86707           bhi = c2 - (c2 - bcxtail);
86708           blo = bcxtail - bhi;
86709           t02 = alo * blo - (t12 - ahi * bhi - alo * bhi - ahi * blo);
86710           _i = s0 - t02;
86711           bvirt = s0 - _i;
86712           u2[0] = s0 - (_i + bvirt) + (bvirt - t02);
86713           _j = s1 + _i;
86714           bvirt = _j - s1;
86715           _0 = s1 - (_j - bvirt) + (_i - bvirt);
86716           _i = _0 - t12;
86717           bvirt = _0 - _i;
86718           u2[1] = _0 - (_i + bvirt) + (bvirt - t12);
86719           u3 = _j + _i;
86720           bvirt = u3 - _j;
86721           u2[2] = _j - (u3 - bvirt) + (_i - bvirt);
86722           u2[3] = u3;
86723           const Dlen = sum(C2len, C2, 4, u2, D2);
86724           return D2[Dlen - 1];
86725         }
86726         function orient2d(ax, ay, bx, by, cx, cy) {
86727           const detleft = (ay - cy) * (bx - cx);
86728           const detright = (ax - cx) * (by - cy);
86729           const det = detleft - detright;
86730           const detsum = Math.abs(detleft + detright);
86731           if (Math.abs(det) >= ccwerrboundA * detsum) return det;
86732           return -orient2dadapt(ax, ay, bx, by, cx, cy, detsum);
86733         }
86734         const crossProduct2 = (a2, b2) => a2.x * b2.y - a2.y * b2.x;
86735         const dotProduct2 = (a2, b2) => a2.x * b2.x + a2.y * b2.y;
86736         const compareVectorAngles = (basePt, endPt1, endPt2) => {
86737           const res = orient2d(basePt.x, basePt.y, endPt1.x, endPt1.y, endPt2.x, endPt2.y);
86738           if (res > 0) return -1;
86739           if (res < 0) return 1;
86740           return 0;
86741         };
86742         const length2 = (v2) => Math.sqrt(dotProduct2(v2, v2));
86743         const sineOfAngle2 = (pShared, pBase, pAngle) => {
86744           const vBase = {
86745             x: pBase.x - pShared.x,
86746             y: pBase.y - pShared.y
86747           };
86748           const vAngle = {
86749             x: pAngle.x - pShared.x,
86750             y: pAngle.y - pShared.y
86751           };
86752           return crossProduct2(vAngle, vBase) / length2(vAngle) / length2(vBase);
86753         };
86754         const cosineOfAngle2 = (pShared, pBase, pAngle) => {
86755           const vBase = {
86756             x: pBase.x - pShared.x,
86757             y: pBase.y - pShared.y
86758           };
86759           const vAngle = {
86760             x: pAngle.x - pShared.x,
86761             y: pAngle.y - pShared.y
86762           };
86763           return dotProduct2(vAngle, vBase) / length2(vAngle) / length2(vBase);
86764         };
86765         const horizontalIntersection2 = (pt2, v2, y2) => {
86766           if (v2.y === 0) return null;
86767           return {
86768             x: pt2.x + v2.x / v2.y * (y2 - pt2.y),
86769             y: y2
86770           };
86771         };
86772         const verticalIntersection2 = (pt2, v2, x2) => {
86773           if (v2.x === 0) return null;
86774           return {
86775             x: x2,
86776             y: pt2.y + v2.y / v2.x * (x2 - pt2.x)
86777           };
86778         };
86779         const intersection$1 = (pt1, v1, pt2, v2) => {
86780           if (v1.x === 0) return verticalIntersection2(pt2, v2, pt1.x);
86781           if (v2.x === 0) return verticalIntersection2(pt1, v1, pt2.x);
86782           if (v1.y === 0) return horizontalIntersection2(pt2, v2, pt1.y);
86783           if (v2.y === 0) return horizontalIntersection2(pt1, v1, pt2.y);
86784           const kross = crossProduct2(v1, v2);
86785           if (kross == 0) return null;
86786           const ve2 = {
86787             x: pt2.x - pt1.x,
86788             y: pt2.y - pt1.y
86789           };
86790           const d1 = crossProduct2(ve2, v1) / kross;
86791           const d2 = crossProduct2(ve2, v2) / kross;
86792           const x12 = pt1.x + d2 * v1.x, x2 = pt2.x + d1 * v2.x;
86793           const y12 = pt1.y + d2 * v1.y, y2 = pt2.y + d1 * v2.y;
86794           const x3 = (x12 + x2) / 2;
86795           const y3 = (y12 + y2) / 2;
86796           return {
86797             x: x3,
86798             y: y3
86799           };
86800         };
86801         class SweepEvent2 {
86802           // for ordering sweep events in the sweep event queue
86803           static compare(a2, b2) {
86804             const ptCmp = SweepEvent2.comparePoints(a2.point, b2.point);
86805             if (ptCmp !== 0) return ptCmp;
86806             if (a2.point !== b2.point) a2.link(b2);
86807             if (a2.isLeft !== b2.isLeft) return a2.isLeft ? 1 : -1;
86808             return Segment2.compare(a2.segment, b2.segment);
86809           }
86810           // for ordering points in sweep line order
86811           static comparePoints(aPt, bPt) {
86812             if (aPt.x < bPt.x) return -1;
86813             if (aPt.x > bPt.x) return 1;
86814             if (aPt.y < bPt.y) return -1;
86815             if (aPt.y > bPt.y) return 1;
86816             return 0;
86817           }
86818           // Warning: 'point' input will be modified and re-used (for performance)
86819           constructor(point, isLeft) {
86820             if (point.events === void 0) point.events = [this];
86821             else point.events.push(this);
86822             this.point = point;
86823             this.isLeft = isLeft;
86824           }
86825           link(other2) {
86826             if (other2.point === this.point) {
86827               throw new Error("Tried to link already linked events");
86828             }
86829             const otherEvents = other2.point.events;
86830             for (let i3 = 0, iMax = otherEvents.length; i3 < iMax; i3++) {
86831               const evt = otherEvents[i3];
86832               this.point.events.push(evt);
86833               evt.point = this.point;
86834             }
86835             this.checkForConsuming();
86836           }
86837           /* Do a pass over our linked events and check to see if any pair
86838            * of segments match, and should be consumed. */
86839           checkForConsuming() {
86840             const numEvents = this.point.events.length;
86841             for (let i3 = 0; i3 < numEvents; i3++) {
86842               const evt1 = this.point.events[i3];
86843               if (evt1.segment.consumedBy !== void 0) continue;
86844               for (let j2 = i3 + 1; j2 < numEvents; j2++) {
86845                 const evt2 = this.point.events[j2];
86846                 if (evt2.consumedBy !== void 0) continue;
86847                 if (evt1.otherSE.point.events !== evt2.otherSE.point.events) continue;
86848                 evt1.segment.consume(evt2.segment);
86849               }
86850             }
86851           }
86852           getAvailableLinkedEvents() {
86853             const events = [];
86854             for (let i3 = 0, iMax = this.point.events.length; i3 < iMax; i3++) {
86855               const evt = this.point.events[i3];
86856               if (evt !== this && !evt.segment.ringOut && evt.segment.isInResult()) {
86857                 events.push(evt);
86858               }
86859             }
86860             return events;
86861           }
86862           /**
86863            * Returns a comparator function for sorting linked events that will
86864            * favor the event that will give us the smallest left-side angle.
86865            * All ring construction starts as low as possible heading to the right,
86866            * so by always turning left as sharp as possible we'll get polygons
86867            * without uncessary loops & holes.
86868            *
86869            * The comparator function has a compute cache such that it avoids
86870            * re-computing already-computed values.
86871            */
86872           getLeftmostComparator(baseEvent) {
86873             const cache = /* @__PURE__ */ new Map();
86874             const fillCache = (linkedEvent) => {
86875               const nextEvent = linkedEvent.otherSE;
86876               cache.set(linkedEvent, {
86877                 sine: sineOfAngle2(this.point, baseEvent.point, nextEvent.point),
86878                 cosine: cosineOfAngle2(this.point, baseEvent.point, nextEvent.point)
86879               });
86880             };
86881             return (a2, b2) => {
86882               if (!cache.has(a2)) fillCache(a2);
86883               if (!cache.has(b2)) fillCache(b2);
86884               const {
86885                 sine: asine,
86886                 cosine: acosine
86887               } = cache.get(a2);
86888               const {
86889                 sine: bsine,
86890                 cosine: bcosine
86891               } = cache.get(b2);
86892               if (asine >= 0 && bsine >= 0) {
86893                 if (acosine < bcosine) return 1;
86894                 if (acosine > bcosine) return -1;
86895                 return 0;
86896               }
86897               if (asine < 0 && bsine < 0) {
86898                 if (acosine < bcosine) return -1;
86899                 if (acosine > bcosine) return 1;
86900                 return 0;
86901               }
86902               if (bsine < asine) return -1;
86903               if (bsine > asine) return 1;
86904               return 0;
86905             };
86906           }
86907         }
86908         let segmentId2 = 0;
86909         class Segment2 {
86910           /* This compare() function is for ordering segments in the sweep
86911            * line tree, and does so according to the following criteria:
86912            *
86913            * Consider the vertical line that lies an infinestimal step to the
86914            * right of the right-more of the two left endpoints of the input
86915            * segments. Imagine slowly moving a point up from negative infinity
86916            * in the increasing y direction. Which of the two segments will that
86917            * point intersect first? That segment comes 'before' the other one.
86918            *
86919            * If neither segment would be intersected by such a line, (if one
86920            * or more of the segments are vertical) then the line to be considered
86921            * is directly on the right-more of the two left inputs.
86922            */
86923           static compare(a2, b2) {
86924             const alx = a2.leftSE.point.x;
86925             const blx = b2.leftSE.point.x;
86926             const arx = a2.rightSE.point.x;
86927             const brx = b2.rightSE.point.x;
86928             if (brx < alx) return 1;
86929             if (arx < blx) return -1;
86930             const aly = a2.leftSE.point.y;
86931             const bly = b2.leftSE.point.y;
86932             const ary = a2.rightSE.point.y;
86933             const bry = b2.rightSE.point.y;
86934             if (alx < blx) {
86935               if (bly < aly && bly < ary) return 1;
86936               if (bly > aly && bly > ary) return -1;
86937               const aCmpBLeft = a2.comparePoint(b2.leftSE.point);
86938               if (aCmpBLeft < 0) return 1;
86939               if (aCmpBLeft > 0) return -1;
86940               const bCmpARight = b2.comparePoint(a2.rightSE.point);
86941               if (bCmpARight !== 0) return bCmpARight;
86942               return -1;
86943             }
86944             if (alx > blx) {
86945               if (aly < bly && aly < bry) return -1;
86946               if (aly > bly && aly > bry) return 1;
86947               const bCmpALeft = b2.comparePoint(a2.leftSE.point);
86948               if (bCmpALeft !== 0) return bCmpALeft;
86949               const aCmpBRight = a2.comparePoint(b2.rightSE.point);
86950               if (aCmpBRight < 0) return 1;
86951               if (aCmpBRight > 0) return -1;
86952               return 1;
86953             }
86954             if (aly < bly) return -1;
86955             if (aly > bly) return 1;
86956             if (arx < brx) {
86957               const bCmpARight = b2.comparePoint(a2.rightSE.point);
86958               if (bCmpARight !== 0) return bCmpARight;
86959             }
86960             if (arx > brx) {
86961               const aCmpBRight = a2.comparePoint(b2.rightSE.point);
86962               if (aCmpBRight < 0) return 1;
86963               if (aCmpBRight > 0) return -1;
86964             }
86965             if (arx !== brx) {
86966               const ay = ary - aly;
86967               const ax = arx - alx;
86968               const by = bry - bly;
86969               const bx = brx - blx;
86970               if (ay > ax && by < bx) return 1;
86971               if (ay < ax && by > bx) return -1;
86972             }
86973             if (arx > brx) return 1;
86974             if (arx < brx) return -1;
86975             if (ary < bry) return -1;
86976             if (ary > bry) return 1;
86977             if (a2.id < b2.id) return -1;
86978             if (a2.id > b2.id) return 1;
86979             return 0;
86980           }
86981           /* Warning: a reference to ringWindings input will be stored,
86982            *  and possibly will be later modified */
86983           constructor(leftSE, rightSE, rings, windings) {
86984             this.id = ++segmentId2;
86985             this.leftSE = leftSE;
86986             leftSE.segment = this;
86987             leftSE.otherSE = rightSE;
86988             this.rightSE = rightSE;
86989             rightSE.segment = this;
86990             rightSE.otherSE = leftSE;
86991             this.rings = rings;
86992             this.windings = windings;
86993           }
86994           static fromRing(pt1, pt2, ring) {
86995             let leftPt, rightPt, winding;
86996             const cmpPts = SweepEvent2.comparePoints(pt1, pt2);
86997             if (cmpPts < 0) {
86998               leftPt = pt1;
86999               rightPt = pt2;
87000               winding = 1;
87001             } else if (cmpPts > 0) {
87002               leftPt = pt2;
87003               rightPt = pt1;
87004               winding = -1;
87005             } else throw new Error(`Tried to create degenerate segment at [${pt1.x}, ${pt1.y}]`);
87006             const leftSE = new SweepEvent2(leftPt, true);
87007             const rightSE = new SweepEvent2(rightPt, false);
87008             return new Segment2(leftSE, rightSE, [ring], [winding]);
87009           }
87010           /* When a segment is split, the rightSE is replaced with a new sweep event */
87011           replaceRightSE(newRightSE) {
87012             this.rightSE = newRightSE;
87013             this.rightSE.segment = this;
87014             this.rightSE.otherSE = this.leftSE;
87015             this.leftSE.otherSE = this.rightSE;
87016           }
87017           bbox() {
87018             const y12 = this.leftSE.point.y;
87019             const y2 = this.rightSE.point.y;
87020             return {
87021               ll: {
87022                 x: this.leftSE.point.x,
87023                 y: y12 < y2 ? y12 : y2
87024               },
87025               ur: {
87026                 x: this.rightSE.point.x,
87027                 y: y12 > y2 ? y12 : y2
87028               }
87029             };
87030           }
87031           /* A vector from the left point to the right */
87032           vector() {
87033             return {
87034               x: this.rightSE.point.x - this.leftSE.point.x,
87035               y: this.rightSE.point.y - this.leftSE.point.y
87036             };
87037           }
87038           isAnEndpoint(pt2) {
87039             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;
87040           }
87041           /* Compare this segment with a point.
87042            *
87043            * A point P is considered to be colinear to a segment if there
87044            * exists a distance D such that if we travel along the segment
87045            * from one * endpoint towards the other a distance D, we find
87046            * ourselves at point P.
87047            *
87048            * Return value indicates:
87049            *
87050            *   1: point lies above the segment (to the left of vertical)
87051            *   0: point is colinear to segment
87052            *  -1: point lies below the segment (to the right of vertical)
87053            */
87054           comparePoint(point) {
87055             if (this.isAnEndpoint(point)) return 0;
87056             const lPt = this.leftSE.point;
87057             const rPt = this.rightSE.point;
87058             const v2 = this.vector();
87059             if (lPt.x === rPt.x) {
87060               if (point.x === lPt.x) return 0;
87061               return point.x < lPt.x ? 1 : -1;
87062             }
87063             const yDist = (point.y - lPt.y) / v2.y;
87064             const xFromYDist = lPt.x + yDist * v2.x;
87065             if (point.x === xFromYDist) return 0;
87066             const xDist = (point.x - lPt.x) / v2.x;
87067             const yFromXDist = lPt.y + xDist * v2.y;
87068             if (point.y === yFromXDist) return 0;
87069             return point.y < yFromXDist ? -1 : 1;
87070           }
87071           /**
87072            * Given another segment, returns the first non-trivial intersection
87073            * between the two segments (in terms of sweep line ordering), if it exists.
87074            *
87075            * A 'non-trivial' intersection is one that will cause one or both of the
87076            * segments to be split(). As such, 'trivial' vs. 'non-trivial' intersection:
87077            *
87078            *   * endpoint of segA with endpoint of segB --> trivial
87079            *   * endpoint of segA with point along segB --> non-trivial
87080            *   * endpoint of segB with point along segA --> non-trivial
87081            *   * point along segA with point along segB --> non-trivial
87082            *
87083            * If no non-trivial intersection exists, return null
87084            * Else, return null.
87085            */
87086           getIntersection(other2) {
87087             const tBbox = this.bbox();
87088             const oBbox = other2.bbox();
87089             const bboxOverlap = getBboxOverlap2(tBbox, oBbox);
87090             if (bboxOverlap === null) return null;
87091             const tlp = this.leftSE.point;
87092             const trp = this.rightSE.point;
87093             const olp = other2.leftSE.point;
87094             const orp = other2.rightSE.point;
87095             const touchesOtherLSE = isInBbox2(tBbox, olp) && this.comparePoint(olp) === 0;
87096             const touchesThisLSE = isInBbox2(oBbox, tlp) && other2.comparePoint(tlp) === 0;
87097             const touchesOtherRSE = isInBbox2(tBbox, orp) && this.comparePoint(orp) === 0;
87098             const touchesThisRSE = isInBbox2(oBbox, trp) && other2.comparePoint(trp) === 0;
87099             if (touchesThisLSE && touchesOtherLSE) {
87100               if (touchesThisRSE && !touchesOtherRSE) return trp;
87101               if (!touchesThisRSE && touchesOtherRSE) return orp;
87102               return null;
87103             }
87104             if (touchesThisLSE) {
87105               if (touchesOtherRSE) {
87106                 if (tlp.x === orp.x && tlp.y === orp.y) return null;
87107               }
87108               return tlp;
87109             }
87110             if (touchesOtherLSE) {
87111               if (touchesThisRSE) {
87112                 if (trp.x === olp.x && trp.y === olp.y) return null;
87113               }
87114               return olp;
87115             }
87116             if (touchesThisRSE && touchesOtherRSE) return null;
87117             if (touchesThisRSE) return trp;
87118             if (touchesOtherRSE) return orp;
87119             const pt2 = intersection$1(tlp, this.vector(), olp, other2.vector());
87120             if (pt2 === null) return null;
87121             if (!isInBbox2(bboxOverlap, pt2)) return null;
87122             return rounder.round(pt2.x, pt2.y);
87123           }
87124           /**
87125            * Split the given segment into multiple segments on the given points.
87126            *  * Each existing segment will retain its leftSE and a new rightSE will be
87127            *    generated for it.
87128            *  * A new segment will be generated which will adopt the original segment's
87129            *    rightSE, and a new leftSE will be generated for it.
87130            *  * If there are more than two points given to split on, new segments
87131            *    in the middle will be generated with new leftSE and rightSE's.
87132            *  * An array of the newly generated SweepEvents will be returned.
87133            *
87134            * Warning: input array of points is modified
87135            */
87136           split(point) {
87137             const newEvents = [];
87138             const alreadyLinked = point.events !== void 0;
87139             const newLeftSE = new SweepEvent2(point, true);
87140             const newRightSE = new SweepEvent2(point, false);
87141             const oldRightSE = this.rightSE;
87142             this.replaceRightSE(newRightSE);
87143             newEvents.push(newRightSE);
87144             newEvents.push(newLeftSE);
87145             const newSeg = new Segment2(newLeftSE, oldRightSE, this.rings.slice(), this.windings.slice());
87146             if (SweepEvent2.comparePoints(newSeg.leftSE.point, newSeg.rightSE.point) > 0) {
87147               newSeg.swapEvents();
87148             }
87149             if (SweepEvent2.comparePoints(this.leftSE.point, this.rightSE.point) > 0) {
87150               this.swapEvents();
87151             }
87152             if (alreadyLinked) {
87153               newLeftSE.checkForConsuming();
87154               newRightSE.checkForConsuming();
87155             }
87156             return newEvents;
87157           }
87158           /* Swap which event is left and right */
87159           swapEvents() {
87160             const tmpEvt = this.rightSE;
87161             this.rightSE = this.leftSE;
87162             this.leftSE = tmpEvt;
87163             this.leftSE.isLeft = true;
87164             this.rightSE.isLeft = false;
87165             for (let i3 = 0, iMax = this.windings.length; i3 < iMax; i3++) {
87166               this.windings[i3] *= -1;
87167             }
87168           }
87169           /* Consume another segment. We take their rings under our wing
87170            * and mark them as consumed. Use for perfectly overlapping segments */
87171           consume(other2) {
87172             let consumer = this;
87173             let consumee = other2;
87174             while (consumer.consumedBy) consumer = consumer.consumedBy;
87175             while (consumee.consumedBy) consumee = consumee.consumedBy;
87176             const cmp2 = Segment2.compare(consumer, consumee);
87177             if (cmp2 === 0) return;
87178             if (cmp2 > 0) {
87179               const tmp = consumer;
87180               consumer = consumee;
87181               consumee = tmp;
87182             }
87183             if (consumer.prev === consumee) {
87184               const tmp = consumer;
87185               consumer = consumee;
87186               consumee = tmp;
87187             }
87188             for (let i3 = 0, iMax = consumee.rings.length; i3 < iMax; i3++) {
87189               const ring = consumee.rings[i3];
87190               const winding = consumee.windings[i3];
87191               const index2 = consumer.rings.indexOf(ring);
87192               if (index2 === -1) {
87193                 consumer.rings.push(ring);
87194                 consumer.windings.push(winding);
87195               } else consumer.windings[index2] += winding;
87196             }
87197             consumee.rings = null;
87198             consumee.windings = null;
87199             consumee.consumedBy = consumer;
87200             consumee.leftSE.consumedBy = consumer.leftSE;
87201             consumee.rightSE.consumedBy = consumer.rightSE;
87202           }
87203           /* The first segment previous segment chain that is in the result */
87204           prevInResult() {
87205             if (this._prevInResult !== void 0) return this._prevInResult;
87206             if (!this.prev) this._prevInResult = null;
87207             else if (this.prev.isInResult()) this._prevInResult = this.prev;
87208             else this._prevInResult = this.prev.prevInResult();
87209             return this._prevInResult;
87210           }
87211           beforeState() {
87212             if (this._beforeState !== void 0) return this._beforeState;
87213             if (!this.prev) this._beforeState = {
87214               rings: [],
87215               windings: [],
87216               multiPolys: []
87217             };
87218             else {
87219               const seg = this.prev.consumedBy || this.prev;
87220               this._beforeState = seg.afterState();
87221             }
87222             return this._beforeState;
87223           }
87224           afterState() {
87225             if (this._afterState !== void 0) return this._afterState;
87226             const beforeState = this.beforeState();
87227             this._afterState = {
87228               rings: beforeState.rings.slice(0),
87229               windings: beforeState.windings.slice(0),
87230               multiPolys: []
87231             };
87232             const ringsAfter = this._afterState.rings;
87233             const windingsAfter = this._afterState.windings;
87234             const mpsAfter = this._afterState.multiPolys;
87235             for (let i3 = 0, iMax = this.rings.length; i3 < iMax; i3++) {
87236               const ring = this.rings[i3];
87237               const winding = this.windings[i3];
87238               const index2 = ringsAfter.indexOf(ring);
87239               if (index2 === -1) {
87240                 ringsAfter.push(ring);
87241                 windingsAfter.push(winding);
87242               } else windingsAfter[index2] += winding;
87243             }
87244             const polysAfter = [];
87245             const polysExclude = [];
87246             for (let i3 = 0, iMax = ringsAfter.length; i3 < iMax; i3++) {
87247               if (windingsAfter[i3] === 0) continue;
87248               const ring = ringsAfter[i3];
87249               const poly = ring.poly;
87250               if (polysExclude.indexOf(poly) !== -1) continue;
87251               if (ring.isExterior) polysAfter.push(poly);
87252               else {
87253                 if (polysExclude.indexOf(poly) === -1) polysExclude.push(poly);
87254                 const index2 = polysAfter.indexOf(ring.poly);
87255                 if (index2 !== -1) polysAfter.splice(index2, 1);
87256               }
87257             }
87258             for (let i3 = 0, iMax = polysAfter.length; i3 < iMax; i3++) {
87259               const mp = polysAfter[i3].multiPoly;
87260               if (mpsAfter.indexOf(mp) === -1) mpsAfter.push(mp);
87261             }
87262             return this._afterState;
87263           }
87264           /* Is this segment part of the final result? */
87265           isInResult() {
87266             if (this.consumedBy) return false;
87267             if (this._isInResult !== void 0) return this._isInResult;
87268             const mpsBefore = this.beforeState().multiPolys;
87269             const mpsAfter = this.afterState().multiPolys;
87270             switch (operation2.type) {
87271               case "union": {
87272                 const noBefores = mpsBefore.length === 0;
87273                 const noAfters = mpsAfter.length === 0;
87274                 this._isInResult = noBefores !== noAfters;
87275                 break;
87276               }
87277               case "intersection": {
87278                 let least;
87279                 let most;
87280                 if (mpsBefore.length < mpsAfter.length) {
87281                   least = mpsBefore.length;
87282                   most = mpsAfter.length;
87283                 } else {
87284                   least = mpsAfter.length;
87285                   most = mpsBefore.length;
87286                 }
87287                 this._isInResult = most === operation2.numMultiPolys && least < most;
87288                 break;
87289               }
87290               case "xor": {
87291                 const diff = Math.abs(mpsBefore.length - mpsAfter.length);
87292                 this._isInResult = diff % 2 === 1;
87293                 break;
87294               }
87295               case "difference": {
87296                 const isJustSubject = (mps) => mps.length === 1 && mps[0].isSubject;
87297                 this._isInResult = isJustSubject(mpsBefore) !== isJustSubject(mpsAfter);
87298                 break;
87299               }
87300               default:
87301                 throw new Error(`Unrecognized operation type found ${operation2.type}`);
87302             }
87303             return this._isInResult;
87304           }
87305         }
87306         class RingIn2 {
87307           constructor(geomRing, poly, isExterior) {
87308             if (!Array.isArray(geomRing) || geomRing.length === 0) {
87309               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
87310             }
87311             this.poly = poly;
87312             this.isExterior = isExterior;
87313             this.segments = [];
87314             if (typeof geomRing[0][0] !== "number" || typeof geomRing[0][1] !== "number") {
87315               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
87316             }
87317             const firstPoint = rounder.round(geomRing[0][0], geomRing[0][1]);
87318             this.bbox = {
87319               ll: {
87320                 x: firstPoint.x,
87321                 y: firstPoint.y
87322               },
87323               ur: {
87324                 x: firstPoint.x,
87325                 y: firstPoint.y
87326               }
87327             };
87328             let prevPoint = firstPoint;
87329             for (let i3 = 1, iMax = geomRing.length; i3 < iMax; i3++) {
87330               if (typeof geomRing[i3][0] !== "number" || typeof geomRing[i3][1] !== "number") {
87331                 throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
87332               }
87333               let point = rounder.round(geomRing[i3][0], geomRing[i3][1]);
87334               if (point.x === prevPoint.x && point.y === prevPoint.y) continue;
87335               this.segments.push(Segment2.fromRing(prevPoint, point, this));
87336               if (point.x < this.bbox.ll.x) this.bbox.ll.x = point.x;
87337               if (point.y < this.bbox.ll.y) this.bbox.ll.y = point.y;
87338               if (point.x > this.bbox.ur.x) this.bbox.ur.x = point.x;
87339               if (point.y > this.bbox.ur.y) this.bbox.ur.y = point.y;
87340               prevPoint = point;
87341             }
87342             if (firstPoint.x !== prevPoint.x || firstPoint.y !== prevPoint.y) {
87343               this.segments.push(Segment2.fromRing(prevPoint, firstPoint, this));
87344             }
87345           }
87346           getSweepEvents() {
87347             const sweepEvents = [];
87348             for (let i3 = 0, iMax = this.segments.length; i3 < iMax; i3++) {
87349               const segment = this.segments[i3];
87350               sweepEvents.push(segment.leftSE);
87351               sweepEvents.push(segment.rightSE);
87352             }
87353             return sweepEvents;
87354           }
87355         }
87356         class PolyIn2 {
87357           constructor(geomPoly, multiPoly) {
87358             if (!Array.isArray(geomPoly)) {
87359               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
87360             }
87361             this.exteriorRing = new RingIn2(geomPoly[0], this, true);
87362             this.bbox = {
87363               ll: {
87364                 x: this.exteriorRing.bbox.ll.x,
87365                 y: this.exteriorRing.bbox.ll.y
87366               },
87367               ur: {
87368                 x: this.exteriorRing.bbox.ur.x,
87369                 y: this.exteriorRing.bbox.ur.y
87370               }
87371             };
87372             this.interiorRings = [];
87373             for (let i3 = 1, iMax = geomPoly.length; i3 < iMax; i3++) {
87374               const ring = new RingIn2(geomPoly[i3], this, false);
87375               if (ring.bbox.ll.x < this.bbox.ll.x) this.bbox.ll.x = ring.bbox.ll.x;
87376               if (ring.bbox.ll.y < this.bbox.ll.y) this.bbox.ll.y = ring.bbox.ll.y;
87377               if (ring.bbox.ur.x > this.bbox.ur.x) this.bbox.ur.x = ring.bbox.ur.x;
87378               if (ring.bbox.ur.y > this.bbox.ur.y) this.bbox.ur.y = ring.bbox.ur.y;
87379               this.interiorRings.push(ring);
87380             }
87381             this.multiPoly = multiPoly;
87382           }
87383           getSweepEvents() {
87384             const sweepEvents = this.exteriorRing.getSweepEvents();
87385             for (let i3 = 0, iMax = this.interiorRings.length; i3 < iMax; i3++) {
87386               const ringSweepEvents = this.interiorRings[i3].getSweepEvents();
87387               for (let j2 = 0, jMax = ringSweepEvents.length; j2 < jMax; j2++) {
87388                 sweepEvents.push(ringSweepEvents[j2]);
87389               }
87390             }
87391             return sweepEvents;
87392           }
87393         }
87394         class MultiPolyIn2 {
87395           constructor(geom, isSubject) {
87396             if (!Array.isArray(geom)) {
87397               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
87398             }
87399             try {
87400               if (typeof geom[0][0][0] === "number") geom = [geom];
87401             } catch (ex) {
87402             }
87403             this.polys = [];
87404             this.bbox = {
87405               ll: {
87406                 x: Number.POSITIVE_INFINITY,
87407                 y: Number.POSITIVE_INFINITY
87408               },
87409               ur: {
87410                 x: Number.NEGATIVE_INFINITY,
87411                 y: Number.NEGATIVE_INFINITY
87412               }
87413             };
87414             for (let i3 = 0, iMax = geom.length; i3 < iMax; i3++) {
87415               const poly = new PolyIn2(geom[i3], this);
87416               if (poly.bbox.ll.x < this.bbox.ll.x) this.bbox.ll.x = poly.bbox.ll.x;
87417               if (poly.bbox.ll.y < this.bbox.ll.y) this.bbox.ll.y = poly.bbox.ll.y;
87418               if (poly.bbox.ur.x > this.bbox.ur.x) this.bbox.ur.x = poly.bbox.ur.x;
87419               if (poly.bbox.ur.y > this.bbox.ur.y) this.bbox.ur.y = poly.bbox.ur.y;
87420               this.polys.push(poly);
87421             }
87422             this.isSubject = isSubject;
87423           }
87424           getSweepEvents() {
87425             const sweepEvents = [];
87426             for (let i3 = 0, iMax = this.polys.length; i3 < iMax; i3++) {
87427               const polySweepEvents = this.polys[i3].getSweepEvents();
87428               for (let j2 = 0, jMax = polySweepEvents.length; j2 < jMax; j2++) {
87429                 sweepEvents.push(polySweepEvents[j2]);
87430               }
87431             }
87432             return sweepEvents;
87433           }
87434         }
87435         class RingOut2 {
87436           /* Given the segments from the sweep line pass, compute & return a series
87437            * of closed rings from all the segments marked to be part of the result */
87438           static factory(allSegments) {
87439             const ringsOut = [];
87440             for (let i3 = 0, iMax = allSegments.length; i3 < iMax; i3++) {
87441               const segment = allSegments[i3];
87442               if (!segment.isInResult() || segment.ringOut) continue;
87443               let prevEvent = null;
87444               let event = segment.leftSE;
87445               let nextEvent = segment.rightSE;
87446               const events = [event];
87447               const startingPoint = event.point;
87448               const intersectionLEs = [];
87449               while (true) {
87450                 prevEvent = event;
87451                 event = nextEvent;
87452                 events.push(event);
87453                 if (event.point === startingPoint) break;
87454                 while (true) {
87455                   const availableLEs = event.getAvailableLinkedEvents();
87456                   if (availableLEs.length === 0) {
87457                     const firstPt = events[0].point;
87458                     const lastPt = events[events.length - 1].point;
87459                     throw new Error(`Unable to complete output ring starting at [${firstPt.x}, ${firstPt.y}]. Last matching segment found ends at [${lastPt.x}, ${lastPt.y}].`);
87460                   }
87461                   if (availableLEs.length === 1) {
87462                     nextEvent = availableLEs[0].otherSE;
87463                     break;
87464                   }
87465                   let indexLE = null;
87466                   for (let j2 = 0, jMax = intersectionLEs.length; j2 < jMax; j2++) {
87467                     if (intersectionLEs[j2].point === event.point) {
87468                       indexLE = j2;
87469                       break;
87470                     }
87471                   }
87472                   if (indexLE !== null) {
87473                     const intersectionLE = intersectionLEs.splice(indexLE)[0];
87474                     const ringEvents = events.splice(intersectionLE.index);
87475                     ringEvents.unshift(ringEvents[0].otherSE);
87476                     ringsOut.push(new RingOut2(ringEvents.reverse()));
87477                     continue;
87478                   }
87479                   intersectionLEs.push({
87480                     index: events.length,
87481                     point: event.point
87482                   });
87483                   const comparator = event.getLeftmostComparator(prevEvent);
87484                   nextEvent = availableLEs.sort(comparator)[0].otherSE;
87485                   break;
87486                 }
87487               }
87488               ringsOut.push(new RingOut2(events));
87489             }
87490             return ringsOut;
87491           }
87492           constructor(events) {
87493             this.events = events;
87494             for (let i3 = 0, iMax = events.length; i3 < iMax; i3++) {
87495               events[i3].segment.ringOut = this;
87496             }
87497             this.poly = null;
87498           }
87499           getGeom() {
87500             let prevPt = this.events[0].point;
87501             const points = [prevPt];
87502             for (let i3 = 1, iMax = this.events.length - 1; i3 < iMax; i3++) {
87503               const pt3 = this.events[i3].point;
87504               const nextPt2 = this.events[i3 + 1].point;
87505               if (compareVectorAngles(pt3, prevPt, nextPt2) === 0) continue;
87506               points.push(pt3);
87507               prevPt = pt3;
87508             }
87509             if (points.length === 1) return null;
87510             const pt2 = points[0];
87511             const nextPt = points[1];
87512             if (compareVectorAngles(pt2, prevPt, nextPt) === 0) points.shift();
87513             points.push(points[0]);
87514             const step = this.isExteriorRing() ? 1 : -1;
87515             const iStart = this.isExteriorRing() ? 0 : points.length - 1;
87516             const iEnd = this.isExteriorRing() ? points.length : -1;
87517             const orderedPoints = [];
87518             for (let i3 = iStart; i3 != iEnd; i3 += step) orderedPoints.push([points[i3].x, points[i3].y]);
87519             return orderedPoints;
87520           }
87521           isExteriorRing() {
87522             if (this._isExteriorRing === void 0) {
87523               const enclosing = this.enclosingRing();
87524               this._isExteriorRing = enclosing ? !enclosing.isExteriorRing() : true;
87525             }
87526             return this._isExteriorRing;
87527           }
87528           enclosingRing() {
87529             if (this._enclosingRing === void 0) {
87530               this._enclosingRing = this._calcEnclosingRing();
87531             }
87532             return this._enclosingRing;
87533           }
87534           /* Returns the ring that encloses this one, if any */
87535           _calcEnclosingRing() {
87536             let leftMostEvt = this.events[0];
87537             for (let i3 = 1, iMax = this.events.length; i3 < iMax; i3++) {
87538               const evt = this.events[i3];
87539               if (SweepEvent2.compare(leftMostEvt, evt) > 0) leftMostEvt = evt;
87540             }
87541             let prevSeg = leftMostEvt.segment.prevInResult();
87542             let prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
87543             while (true) {
87544               if (!prevSeg) return null;
87545               if (!prevPrevSeg) return prevSeg.ringOut;
87546               if (prevPrevSeg.ringOut !== prevSeg.ringOut) {
87547                 if (prevPrevSeg.ringOut.enclosingRing() !== prevSeg.ringOut) {
87548                   return prevSeg.ringOut;
87549                 } else return prevSeg.ringOut.enclosingRing();
87550               }
87551               prevSeg = prevPrevSeg.prevInResult();
87552               prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
87553             }
87554           }
87555         }
87556         class PolyOut2 {
87557           constructor(exteriorRing) {
87558             this.exteriorRing = exteriorRing;
87559             exteriorRing.poly = this;
87560             this.interiorRings = [];
87561           }
87562           addInterior(ring) {
87563             this.interiorRings.push(ring);
87564             ring.poly = this;
87565           }
87566           getGeom() {
87567             const geom = [this.exteriorRing.getGeom()];
87568             if (geom[0] === null) return null;
87569             for (let i3 = 0, iMax = this.interiorRings.length; i3 < iMax; i3++) {
87570               const ringGeom = this.interiorRings[i3].getGeom();
87571               if (ringGeom === null) continue;
87572               geom.push(ringGeom);
87573             }
87574             return geom;
87575           }
87576         }
87577         class MultiPolyOut2 {
87578           constructor(rings) {
87579             this.rings = rings;
87580             this.polys = this._composePolys(rings);
87581           }
87582           getGeom() {
87583             const geom = [];
87584             for (let i3 = 0, iMax = this.polys.length; i3 < iMax; i3++) {
87585               const polyGeom = this.polys[i3].getGeom();
87586               if (polyGeom === null) continue;
87587               geom.push(polyGeom);
87588             }
87589             return geom;
87590           }
87591           _composePolys(rings) {
87592             const polys = [];
87593             for (let i3 = 0, iMax = rings.length; i3 < iMax; i3++) {
87594               const ring = rings[i3];
87595               if (ring.poly) continue;
87596               if (ring.isExteriorRing()) polys.push(new PolyOut2(ring));
87597               else {
87598                 const enclosingRing = ring.enclosingRing();
87599                 if (!enclosingRing.poly) polys.push(new PolyOut2(enclosingRing));
87600                 enclosingRing.poly.addInterior(ring);
87601               }
87602             }
87603             return polys;
87604           }
87605         }
87606         class SweepLine2 {
87607           constructor(queue) {
87608             let comparator = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Segment2.compare;
87609             this.queue = queue;
87610             this.tree = new Tree(comparator);
87611             this.segments = [];
87612           }
87613           process(event) {
87614             const segment = event.segment;
87615             const newEvents = [];
87616             if (event.consumedBy) {
87617               if (event.isLeft) this.queue.remove(event.otherSE);
87618               else this.tree.remove(segment);
87619               return newEvents;
87620             }
87621             const node = event.isLeft ? this.tree.add(segment) : this.tree.find(segment);
87622             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.`);
87623             let prevNode = node;
87624             let nextNode = node;
87625             let prevSeg = void 0;
87626             let nextSeg = void 0;
87627             while (prevSeg === void 0) {
87628               prevNode = this.tree.prev(prevNode);
87629               if (prevNode === null) prevSeg = null;
87630               else if (prevNode.key.consumedBy === void 0) prevSeg = prevNode.key;
87631             }
87632             while (nextSeg === void 0) {
87633               nextNode = this.tree.next(nextNode);
87634               if (nextNode === null) nextSeg = null;
87635               else if (nextNode.key.consumedBy === void 0) nextSeg = nextNode.key;
87636             }
87637             if (event.isLeft) {
87638               let prevMySplitter = null;
87639               if (prevSeg) {
87640                 const prevInter = prevSeg.getIntersection(segment);
87641                 if (prevInter !== null) {
87642                   if (!segment.isAnEndpoint(prevInter)) prevMySplitter = prevInter;
87643                   if (!prevSeg.isAnEndpoint(prevInter)) {
87644                     const newEventsFromSplit = this._splitSafely(prevSeg, prevInter);
87645                     for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
87646                       newEvents.push(newEventsFromSplit[i3]);
87647                     }
87648                   }
87649                 }
87650               }
87651               let nextMySplitter = null;
87652               if (nextSeg) {
87653                 const nextInter = nextSeg.getIntersection(segment);
87654                 if (nextInter !== null) {
87655                   if (!segment.isAnEndpoint(nextInter)) nextMySplitter = nextInter;
87656                   if (!nextSeg.isAnEndpoint(nextInter)) {
87657                     const newEventsFromSplit = this._splitSafely(nextSeg, nextInter);
87658                     for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
87659                       newEvents.push(newEventsFromSplit[i3]);
87660                     }
87661                   }
87662                 }
87663               }
87664               if (prevMySplitter !== null || nextMySplitter !== null) {
87665                 let mySplitter = null;
87666                 if (prevMySplitter === null) mySplitter = nextMySplitter;
87667                 else if (nextMySplitter === null) mySplitter = prevMySplitter;
87668                 else {
87669                   const cmpSplitters = SweepEvent2.comparePoints(prevMySplitter, nextMySplitter);
87670                   mySplitter = cmpSplitters <= 0 ? prevMySplitter : nextMySplitter;
87671                 }
87672                 this.queue.remove(segment.rightSE);
87673                 newEvents.push(segment.rightSE);
87674                 const newEventsFromSplit = segment.split(mySplitter);
87675                 for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
87676                   newEvents.push(newEventsFromSplit[i3]);
87677                 }
87678               }
87679               if (newEvents.length > 0) {
87680                 this.tree.remove(segment);
87681                 newEvents.push(event);
87682               } else {
87683                 this.segments.push(segment);
87684                 segment.prev = prevSeg;
87685               }
87686             } else {
87687               if (prevSeg && nextSeg) {
87688                 const inter = prevSeg.getIntersection(nextSeg);
87689                 if (inter !== null) {
87690                   if (!prevSeg.isAnEndpoint(inter)) {
87691                     const newEventsFromSplit = this._splitSafely(prevSeg, inter);
87692                     for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
87693                       newEvents.push(newEventsFromSplit[i3]);
87694                     }
87695                   }
87696                   if (!nextSeg.isAnEndpoint(inter)) {
87697                     const newEventsFromSplit = this._splitSafely(nextSeg, inter);
87698                     for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
87699                       newEvents.push(newEventsFromSplit[i3]);
87700                     }
87701                   }
87702                 }
87703               }
87704               this.tree.remove(segment);
87705             }
87706             return newEvents;
87707           }
87708           /* Safely split a segment that is currently in the datastructures
87709            * IE - a segment other than the one that is currently being processed. */
87710           _splitSafely(seg, pt2) {
87711             this.tree.remove(seg);
87712             const rightSE = seg.rightSE;
87713             this.queue.remove(rightSE);
87714             const newEvents = seg.split(pt2);
87715             newEvents.push(rightSE);
87716             if (seg.consumedBy === void 0) this.tree.add(seg);
87717             return newEvents;
87718           }
87719         }
87720         const POLYGON_CLIPPING_MAX_QUEUE_SIZE = typeof process !== "undefined" && process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE || 1e6;
87721         const POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS = typeof process !== "undefined" && process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS || 1e6;
87722         class Operation2 {
87723           run(type2, geom, moreGeoms) {
87724             operation2.type = type2;
87725             rounder.reset();
87726             const multipolys = [new MultiPolyIn2(geom, true)];
87727             for (let i3 = 0, iMax = moreGeoms.length; i3 < iMax; i3++) {
87728               multipolys.push(new MultiPolyIn2(moreGeoms[i3], false));
87729             }
87730             operation2.numMultiPolys = multipolys.length;
87731             if (operation2.type === "difference") {
87732               const subject = multipolys[0];
87733               let i3 = 1;
87734               while (i3 < multipolys.length) {
87735                 if (getBboxOverlap2(multipolys[i3].bbox, subject.bbox) !== null) i3++;
87736                 else multipolys.splice(i3, 1);
87737               }
87738             }
87739             if (operation2.type === "intersection") {
87740               for (let i3 = 0, iMax = multipolys.length; i3 < iMax; i3++) {
87741                 const mpA = multipolys[i3];
87742                 for (let j2 = i3 + 1, jMax = multipolys.length; j2 < jMax; j2++) {
87743                   if (getBboxOverlap2(mpA.bbox, multipolys[j2].bbox) === null) return [];
87744                 }
87745               }
87746             }
87747             const queue = new Tree(SweepEvent2.compare);
87748             for (let i3 = 0, iMax = multipolys.length; i3 < iMax; i3++) {
87749               const sweepEvents = multipolys[i3].getSweepEvents();
87750               for (let j2 = 0, jMax = sweepEvents.length; j2 < jMax; j2++) {
87751                 queue.insert(sweepEvents[j2]);
87752                 if (queue.size > POLYGON_CLIPPING_MAX_QUEUE_SIZE) {
87753                   throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).");
87754                 }
87755               }
87756             }
87757             const sweepLine = new SweepLine2(queue);
87758             let prevQueueSize = queue.size;
87759             let node = queue.pop();
87760             while (node) {
87761               const evt = node.key;
87762               if (queue.size === prevQueueSize) {
87763                 const seg = evt.segment;
87764                 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.`);
87765               }
87766               if (queue.size > POLYGON_CLIPPING_MAX_QUEUE_SIZE) {
87767                 throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");
87768               }
87769               if (sweepLine.segments.length > POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS) {
87770                 throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");
87771               }
87772               const newEvents = sweepLine.process(evt);
87773               for (let i3 = 0, iMax = newEvents.length; i3 < iMax; i3++) {
87774                 const evt2 = newEvents[i3];
87775                 if (evt2.consumedBy === void 0) queue.insert(evt2);
87776               }
87777               prevQueueSize = queue.size;
87778               node = queue.pop();
87779             }
87780             rounder.reset();
87781             const ringsOut = RingOut2.factory(sweepLine.segments);
87782             const result = new MultiPolyOut2(ringsOut);
87783             return result.getGeom();
87784           }
87785         }
87786         const operation2 = new Operation2();
87787         const union2 = function(geom) {
87788           for (var _len = arguments.length, moreGeoms = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
87789             moreGeoms[_key - 1] = arguments[_key];
87790           }
87791           return operation2.run("union", geom, moreGeoms);
87792         };
87793         const intersection2 = function(geom) {
87794           for (var _len2 = arguments.length, moreGeoms = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
87795             moreGeoms[_key2 - 1] = arguments[_key2];
87796           }
87797           return operation2.run("intersection", geom, moreGeoms);
87798         };
87799         const xor = function(geom) {
87800           for (var _len3 = arguments.length, moreGeoms = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
87801             moreGeoms[_key3 - 1] = arguments[_key3];
87802           }
87803           return operation2.run("xor", geom, moreGeoms);
87804         };
87805         const difference2 = function(subjectGeom) {
87806           for (var _len4 = arguments.length, clippingGeoms = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
87807             clippingGeoms[_key4 - 1] = arguments[_key4];
87808           }
87809           return operation2.run("difference", subjectGeom, clippingGeoms);
87810         };
87811         var index = {
87812           union: union2,
87813           intersection: intersection2,
87814           xor,
87815           difference: difference2
87816         };
87817         return index;
87818       });
87819     }
87820   });
87821
87822   // modules/services/vector_tile.js
87823   var vector_tile_exports = {};
87824   __export(vector_tile_exports, {
87825     default: () => vector_tile_default
87826   });
87827   function abortRequest6(controller) {
87828     controller.abort();
87829   }
87830   function vtToGeoJSON(data, tile, mergeCache) {
87831     var vectorTile = new VectorTile(new Pbf(data));
87832     var layers = Object.keys(vectorTile.layers);
87833     if (!Array.isArray(layers)) {
87834       layers = [layers];
87835     }
87836     var features = [];
87837     layers.forEach(function(layerID) {
87838       var layer = vectorTile.layers[layerID];
87839       if (layer) {
87840         for (var i3 = 0; i3 < layer.length; i3++) {
87841           var feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
87842           var geometry = feature3.geometry;
87843           if (geometry.type === "Polygon") {
87844             geometry.type = "MultiPolygon";
87845             geometry.coordinates = [geometry.coordinates];
87846           }
87847           var isClipped = false;
87848           if (geometry.type === "MultiPolygon") {
87849             var featureClip = turf_bbox_clip_default(feature3, tile.extent.rectangle());
87850             if (!(0, import_fast_deep_equal11.default)(feature3.geometry, featureClip.geometry)) {
87851               isClipped = true;
87852             }
87853             if (!feature3.geometry.coordinates.length) continue;
87854             if (!feature3.geometry.coordinates[0].length) continue;
87855           }
87856           var featurehash = utilHashcode((0, import_fast_json_stable_stringify2.default)(feature3));
87857           var propertyhash = utilHashcode((0, import_fast_json_stable_stringify2.default)(feature3.properties || {}));
87858           feature3.__layerID__ = layerID.replace(/[^_a-zA-Z0-9\-]/g, "_");
87859           feature3.__featurehash__ = featurehash;
87860           feature3.__propertyhash__ = propertyhash;
87861           features.push(feature3);
87862           if (isClipped && geometry.type === "MultiPolygon") {
87863             var merged = mergeCache[propertyhash];
87864             if (merged && merged.length) {
87865               var other2 = merged[0];
87866               var coords = import_polygon_clipping.default.union(
87867                 feature3.geometry.coordinates,
87868                 other2.geometry.coordinates
87869               );
87870               if (!coords || !coords.length) {
87871                 continue;
87872               }
87873               merged.push(feature3);
87874               for (var j2 = 0; j2 < merged.length; j2++) {
87875                 merged[j2].geometry.coordinates = coords;
87876                 merged[j2].__featurehash__ = featurehash;
87877               }
87878             } else {
87879               mergeCache[propertyhash] = [feature3];
87880             }
87881           }
87882         }
87883       }
87884     });
87885     return features;
87886   }
87887   function loadTile3(source, tile) {
87888     if (source.loaded[tile.id] || source.inflight[tile.id]) return;
87889     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) {
87890       var subdomains = r2.split(",");
87891       return subdomains[(tile.xyz[0] + tile.xyz[1]) % subdomains.length];
87892     });
87893     var controller = new AbortController();
87894     source.inflight[tile.id] = controller;
87895     fetch(url, { signal: controller.signal }).then(function(response) {
87896       if (!response.ok) {
87897         throw new Error(response.status + " " + response.statusText);
87898       }
87899       source.loaded[tile.id] = [];
87900       delete source.inflight[tile.id];
87901       return response.arrayBuffer();
87902     }).then(function(data) {
87903       if (!data) {
87904         throw new Error("No Data");
87905       }
87906       var z2 = tile.xyz[2];
87907       if (!source.canMerge[z2]) {
87908         source.canMerge[z2] = {};
87909       }
87910       source.loaded[tile.id] = vtToGeoJSON(data, tile, source.canMerge[z2]);
87911       dispatch11.call("loadedData");
87912     }).catch(function() {
87913       source.loaded[tile.id] = [];
87914       delete source.inflight[tile.id];
87915     });
87916   }
87917   var import_fast_deep_equal11, import_fast_json_stable_stringify2, import_polygon_clipping, tiler7, dispatch11, _vtCache, vector_tile_default;
87918   var init_vector_tile2 = __esm({
87919     "modules/services/vector_tile.js"() {
87920       "use strict";
87921       init_src4();
87922       import_fast_deep_equal11 = __toESM(require_fast_deep_equal());
87923       init_esm5();
87924       import_fast_json_stable_stringify2 = __toESM(require_fast_json_stable_stringify());
87925       import_polygon_clipping = __toESM(require_polygon_clipping_umd());
87926       init_pbf();
87927       init_vector_tile();
87928       init_util();
87929       tiler7 = utilTiler().tileSize(512).margin(1);
87930       dispatch11 = dispatch_default("loadedData");
87931       vector_tile_default = {
87932         init: function() {
87933           if (!_vtCache) {
87934             this.reset();
87935           }
87936           this.event = utilRebind(this, dispatch11, "on");
87937         },
87938         reset: function() {
87939           for (var sourceID in _vtCache) {
87940             var source = _vtCache[sourceID];
87941             if (source && source.inflight) {
87942               Object.values(source.inflight).forEach(abortRequest6);
87943             }
87944           }
87945           _vtCache = {};
87946         },
87947         addSource: function(sourceID, template) {
87948           _vtCache[sourceID] = { template, inflight: {}, loaded: {}, canMerge: {} };
87949           return _vtCache[sourceID];
87950         },
87951         data: function(sourceID, projection2) {
87952           var source = _vtCache[sourceID];
87953           if (!source) return [];
87954           var tiles = tiler7.getTiles(projection2);
87955           var seen = {};
87956           var results = [];
87957           for (var i3 = 0; i3 < tiles.length; i3++) {
87958             var features = source.loaded[tiles[i3].id];
87959             if (!features || !features.length) continue;
87960             for (var j2 = 0; j2 < features.length; j2++) {
87961               var feature3 = features[j2];
87962               var hash2 = feature3.__featurehash__;
87963               if (seen[hash2]) continue;
87964               seen[hash2] = true;
87965               results.push(Object.assign({}, feature3));
87966             }
87967           }
87968           return results;
87969         },
87970         loadTiles: function(sourceID, template, projection2) {
87971           var source = _vtCache[sourceID];
87972           if (!source) {
87973             source = this.addSource(sourceID, template);
87974           }
87975           var tiles = tiler7.getTiles(projection2);
87976           Object.keys(source.inflight).forEach(function(k2) {
87977             var wanted = tiles.find(function(tile) {
87978               return k2 === tile.id;
87979             });
87980             if (!wanted) {
87981               abortRequest6(source.inflight[k2]);
87982               delete source.inflight[k2];
87983             }
87984           });
87985           tiles.forEach(function(tile) {
87986             loadTile3(source, tile);
87987           });
87988         },
87989         cache: function() {
87990           return _vtCache;
87991         }
87992       };
87993     }
87994   });
87995
87996   // modules/services/wikidata.js
87997   var wikidata_exports2 = {};
87998   __export(wikidata_exports2, {
87999     default: () => wikidata_default
88000   });
88001   var apibase5, _wikidataCache, wikidata_default;
88002   var init_wikidata2 = __esm({
88003     "modules/services/wikidata.js"() {
88004       "use strict";
88005       init_src18();
88006       init_util();
88007       init_localizer();
88008       apibase5 = "https://www.wikidata.org/w/api.php?";
88009       _wikidataCache = {};
88010       wikidata_default = {
88011         init: function() {
88012         },
88013         reset: function() {
88014           _wikidataCache = {};
88015         },
88016         // Search for Wikidata items matching the query
88017         itemsForSearchQuery: function(query, callback, language) {
88018           if (!query) {
88019             if (callback) callback("No query", {});
88020             return;
88021           }
88022           var lang = this.languagesToQuery()[0];
88023           var url = apibase5 + utilQsString({
88024             action: "wbsearchentities",
88025             format: "json",
88026             formatversion: 2,
88027             search: query,
88028             type: "item",
88029             // the language to search
88030             language: language || lang,
88031             // the language for the label and description in the result
88032             uselang: lang,
88033             limit: 10,
88034             origin: "*"
88035           });
88036           json_default(url).then((result) => {
88037             if (result && result.error) {
88038               if (result.error.code === "badvalue" && result.error.info.includes(lang) && !language && lang.includes("-")) {
88039                 this.itemsForSearchQuery(query, callback, lang.split("-")[0]);
88040                 return;
88041               } else {
88042                 throw new Error(result.error);
88043               }
88044             }
88045             if (callback) callback(null, result.search || {});
88046           }).catch(function(err) {
88047             if (callback) callback(err.message, {});
88048           });
88049         },
88050         // Given a Wikipedia language and article title,
88051         // return an array of corresponding Wikidata entities.
88052         itemsByTitle: function(lang, title, callback) {
88053           if (!title) {
88054             if (callback) callback("No title", {});
88055             return;
88056           }
88057           lang = lang || "en";
88058           var url = apibase5 + utilQsString({
88059             action: "wbgetentities",
88060             format: "json",
88061             formatversion: 2,
88062             sites: lang.replace(/-/g, "_") + "wiki",
88063             titles: title,
88064             languages: "en",
88065             // shrink response by filtering to one language
88066             origin: "*"
88067           });
88068           json_default(url).then(function(result) {
88069             if (result && result.error) {
88070               throw new Error(result.error);
88071             }
88072             if (callback) callback(null, result.entities || {});
88073           }).catch(function(err) {
88074             if (callback) callback(err.message, {});
88075           });
88076         },
88077         languagesToQuery: function() {
88078           return _mainLocalizer.localeCodes().map(function(code) {
88079             return code.toLowerCase();
88080           }).filter(function(code) {
88081             return code !== "en-us";
88082           });
88083         },
88084         entityByQID: function(qid, callback) {
88085           if (!qid) {
88086             callback("No qid", {});
88087             return;
88088           }
88089           if (_wikidataCache[qid]) {
88090             if (callback) callback(null, _wikidataCache[qid]);
88091             return;
88092           }
88093           var langs = this.languagesToQuery();
88094           var url = apibase5 + utilQsString({
88095             action: "wbgetentities",
88096             format: "json",
88097             formatversion: 2,
88098             ids: qid,
88099             props: "labels|descriptions|claims|sitelinks",
88100             sitefilter: langs.map(function(d2) {
88101               return d2 + "wiki";
88102             }).join("|"),
88103             languages: langs.join("|"),
88104             languagefallback: 1,
88105             origin: "*"
88106           });
88107           json_default(url).then(function(result) {
88108             if (result && result.error) {
88109               throw new Error(result.error);
88110             }
88111             if (callback) callback(null, result.entities[qid] || {});
88112           }).catch(function(err) {
88113             if (callback) callback(err.message, {});
88114           });
88115         },
88116         // Pass `params` object of the form:
88117         // {
88118         //   qid: 'string'      // brand wikidata  (e.g. 'Q37158')
88119         // }
88120         //
88121         // Get an result object used to display tag documentation
88122         // {
88123         //   title:        'string',
88124         //   description:  'string',
88125         //   editURL:      'string',
88126         //   imageURL:     'string',
88127         //   wiki:         { title: 'string', text: 'string', url: 'string' }
88128         // }
88129         //
88130         getDocs: function(params, callback) {
88131           var langs = this.languagesToQuery();
88132           this.entityByQID(params.qid, function(err, entity) {
88133             if (err || !entity) {
88134               callback(err || "No entity");
88135               return;
88136             }
88137             var i3;
88138             var description;
88139             for (i3 in langs) {
88140               let code = langs[i3];
88141               if (entity.descriptions[code] && entity.descriptions[code].language === code) {
88142                 description = entity.descriptions[code];
88143                 break;
88144               }
88145             }
88146             if (!description && Object.values(entity.descriptions).length) description = Object.values(entity.descriptions)[0];
88147             var result = {
88148               title: entity.id,
88149               description: (selection2) => selection2.text(description ? description.value : ""),
88150               descriptionLocaleCode: description ? description.language : "",
88151               editURL: "https://www.wikidata.org/wiki/" + entity.id
88152             };
88153             if (entity.claims) {
88154               var imageroot = "https://commons.wikimedia.org/w/index.php";
88155               var props = ["P154", "P18"];
88156               var prop, image;
88157               for (i3 = 0; i3 < props.length; i3++) {
88158                 prop = entity.claims[props[i3]];
88159                 if (prop && Object.keys(prop).length > 0) {
88160                   image = prop[Object.keys(prop)[0]].mainsnak.datavalue.value;
88161                   if (image) {
88162                     result.imageURL = imageroot + "?" + utilQsString({
88163                       title: "Special:Redirect/file/" + image,
88164                       width: 400
88165                     });
88166                     break;
88167                   }
88168                 }
88169               }
88170             }
88171             if (entity.sitelinks) {
88172               var englishLocale = _mainLocalizer.languageCode().toLowerCase() === "en";
88173               for (i3 = 0; i3 < langs.length; i3++) {
88174                 var w2 = langs[i3] + "wiki";
88175                 if (entity.sitelinks[w2]) {
88176                   var title = entity.sitelinks[w2].title;
88177                   var tKey = "inspector.wiki_reference";
88178                   if (!englishLocale && langs[i3] === "en") {
88179                     tKey = "inspector.wiki_en_reference";
88180                   }
88181                   result.wiki = {
88182                     title,
88183                     text: tKey,
88184                     url: "https://" + langs[i3] + ".wikipedia.org/wiki/" + title.replace(/ /g, "_")
88185                   };
88186                   break;
88187                 }
88188               }
88189             }
88190             callback(null, result);
88191           });
88192         }
88193       };
88194     }
88195   });
88196
88197   // modules/services/wikipedia.js
88198   var wikipedia_exports2 = {};
88199   __export(wikipedia_exports2, {
88200     default: () => wikipedia_default
88201   });
88202   var endpoint, wikipedia_default;
88203   var init_wikipedia2 = __esm({
88204     "modules/services/wikipedia.js"() {
88205       "use strict";
88206       init_src18();
88207       init_util();
88208       endpoint = "https://en.wikipedia.org/w/api.php?";
88209       wikipedia_default = {
88210         init: function() {
88211         },
88212         reset: function() {
88213         },
88214         search: function(lang, query, callback) {
88215           if (!query) {
88216             if (callback) callback("No Query", []);
88217             return;
88218           }
88219           lang = lang || "en";
88220           var url = endpoint.replace("en", lang) + utilQsString({
88221             action: "query",
88222             list: "search",
88223             srlimit: "10",
88224             srinfo: "suggestion",
88225             format: "json",
88226             origin: "*",
88227             srsearch: query
88228           });
88229           json_default(url).then(function(result) {
88230             if (result && result.error) {
88231               throw new Error(result.error);
88232             } else if (!result || !result.query || !result.query.search) {
88233               throw new Error("No Results");
88234             }
88235             if (callback) {
88236               var titles = result.query.search.map(function(d2) {
88237                 return d2.title;
88238               });
88239               callback(null, titles);
88240             }
88241           }).catch(function(err) {
88242             if (callback) callback(err, []);
88243           });
88244         },
88245         suggestions: function(lang, query, callback) {
88246           if (!query) {
88247             if (callback) callback("", []);
88248             return;
88249           }
88250           lang = lang || "en";
88251           var url = endpoint.replace("en", lang) + utilQsString({
88252             action: "opensearch",
88253             namespace: 0,
88254             suggest: "",
88255             format: "json",
88256             origin: "*",
88257             search: query
88258           });
88259           json_default(url).then(function(result) {
88260             if (result && result.error) {
88261               throw new Error(result.error);
88262             } else if (!result || result.length < 2) {
88263               throw new Error("No Results");
88264             }
88265             if (callback) callback(null, result[1] || []);
88266           }).catch(function(err) {
88267             if (callback) callback(err.message, []);
88268           });
88269         },
88270         translations: function(lang, title, callback) {
88271           if (!title) {
88272             if (callback) callback("No Title");
88273             return;
88274           }
88275           var url = endpoint.replace("en", lang) + utilQsString({
88276             action: "query",
88277             prop: "langlinks",
88278             format: "json",
88279             origin: "*",
88280             lllimit: 500,
88281             titles: title
88282           });
88283           json_default(url).then(function(result) {
88284             if (result && result.error) {
88285               throw new Error(result.error);
88286             } else if (!result || !result.query || !result.query.pages) {
88287               throw new Error("No Results");
88288             }
88289             if (callback) {
88290               var list2 = result.query.pages[Object.keys(result.query.pages)[0]];
88291               var translations = {};
88292               if (list2 && list2.langlinks) {
88293                 list2.langlinks.forEach(function(d2) {
88294                   translations[d2.lang] = d2["*"];
88295                 });
88296               }
88297               callback(null, translations);
88298             }
88299           }).catch(function(err) {
88300             if (callback) callback(err.message);
88301           });
88302         }
88303       };
88304     }
88305   });
88306
88307   // modules/services/mapilio.js
88308   var mapilio_exports = {};
88309   __export(mapilio_exports, {
88310     default: () => mapilio_default
88311   });
88312   function partitionViewport5(projection2) {
88313     const z2 = geoScaleToZoom(projection2.scale());
88314     const z22 = Math.ceil(z2 * 2) / 2 + 2.5;
88315     const tiler8 = utilTiler().zoomExtent([z22, z22]);
88316     return tiler8.getTiles(projection2).map(function(tile) {
88317       return tile.extent;
88318     });
88319   }
88320   function searchLimited5(limit, projection2, rtree) {
88321     limit = limit || 5;
88322     return partitionViewport5(projection2).reduce(function(result, extent) {
88323       const found = rtree.search(extent.bbox()).slice(0, limit).map(function(d2) {
88324         return d2.data;
88325       });
88326       return found.length ? result.concat(found) : result;
88327     }, []);
88328   }
88329   function loadTiles4(which, url, maxZoom2, projection2) {
88330     const tiler8 = utilTiler().zoomExtent([minZoom3, maxZoom2]).skipNullIsland(true);
88331     const tiles = tiler8.getTiles(projection2);
88332     tiles.forEach(function(tile) {
88333       loadTile4(which, url, tile);
88334     });
88335   }
88336   function loadTile4(which, url, tile) {
88337     const cache = _cache3.requests;
88338     const tileId = `${tile.id}-${which}`;
88339     if (cache.loaded[tileId] || cache.inflight[tileId]) return;
88340     const controller = new AbortController();
88341     cache.inflight[tileId] = controller;
88342     const requestUrl = url.replace("{x}", tile.xyz[0]).replace("{y}", tile.xyz[1]).replace("{z}", tile.xyz[2]);
88343     fetch(requestUrl, { signal: controller.signal }).then(function(response) {
88344       if (!response.ok) {
88345         throw new Error(response.status + " " + response.statusText);
88346       }
88347       cache.loaded[tileId] = true;
88348       delete cache.inflight[tileId];
88349       return response.arrayBuffer();
88350     }).then(function(data) {
88351       if (data.byteLength === 0) {
88352         throw new Error("No Data");
88353       }
88354       loadTileDataToCache2(data, tile, which);
88355       if (which === "images") {
88356         dispatch12.call("loadedImages");
88357       } else {
88358         dispatch12.call("loadedLines");
88359       }
88360     }).catch(function(e3) {
88361       if (e3.message === "No Data") {
88362         cache.loaded[tileId] = true;
88363       } else {
88364         console.error(e3);
88365       }
88366     });
88367   }
88368   function loadTileDataToCache2(data, tile) {
88369     const vectorTile = new VectorTile(new Pbf(data));
88370     if (vectorTile.layers.hasOwnProperty(pointLayer)) {
88371       const features = [];
88372       const cache = _cache3.images;
88373       const layer = vectorTile.layers[pointLayer];
88374       for (let i3 = 0; i3 < layer.length; i3++) {
88375         const feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
88376         const loc = feature3.geometry.coordinates;
88377         let resolutionArr = feature3.properties.resolution.split("x");
88378         let sourceWidth = Math.max(resolutionArr[0], resolutionArr[1]);
88379         let sourceHeight = Math.min(resolutionArr[0], resolutionArr[1]);
88380         let isPano = sourceWidth % sourceHeight === 0;
88381         const d2 = {
88382           loc,
88383           capture_time: feature3.properties.capture_time,
88384           id: feature3.properties.id,
88385           sequence_id: feature3.properties.sequence_uuid,
88386           heading: feature3.properties.heading,
88387           resolution: feature3.properties.resolution,
88388           isPano
88389         };
88390         cache.forImageId[d2.id] = d2;
88391         features.push({
88392           minX: loc[0],
88393           minY: loc[1],
88394           maxX: loc[0],
88395           maxY: loc[1],
88396           data: d2
88397         });
88398       }
88399       if (cache.rtree) {
88400         cache.rtree.load(features);
88401       }
88402     }
88403     if (vectorTile.layers.hasOwnProperty(lineLayer)) {
88404       const cache = _cache3.sequences;
88405       const layer = vectorTile.layers[lineLayer];
88406       for (let i3 = 0; i3 < layer.length; i3++) {
88407         const feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
88408         if (cache.lineString[feature3.properties.sequence_uuid]) {
88409           const cacheEntry = cache.lineString[feature3.properties.sequence_uuid];
88410           if (cacheEntry.some((f2) => {
88411             const cachedCoords = f2.geometry.coordinates;
88412             const featureCoords = feature3.geometry.coordinates;
88413             return (0, import_lodash5.isEqual)(cachedCoords, featureCoords);
88414           })) continue;
88415           cacheEntry.push(feature3);
88416         } else {
88417           cache.lineString[feature3.properties.sequence_uuid] = [feature3];
88418         }
88419       }
88420     }
88421   }
88422   function getImageData(imageId, sequenceId) {
88423     return fetch(apiUrl2 + `/api/sequence-detail?sequence_uuid=${sequenceId}`, { method: "GET" }).then(function(response) {
88424       if (!response.ok) {
88425         throw new Error(response.status + " " + response.statusText);
88426       }
88427       return response.json();
88428     }).then(function(data) {
88429       let index = data.data.findIndex((feature3) => feature3.id === imageId);
88430       const { filename, uploaded_hash } = data.data[index];
88431       _sceneOptions2.panorama = imageBaseUrl + "/" + uploaded_hash + "/" + filename + "/" + resolution;
88432     });
88433   }
88434   var import_lodash5, apiUrl2, imageBaseUrl, baseTileUrl2, pointLayer, lineLayer, tileStyle, minZoom3, dispatch12, imgZoom2, pannellumViewerCSS3, pannellumViewerJS3, resolution, _activeImage, _cache3, _loadViewerPromise5, _pannellumViewer3, _sceneOptions2, _currScene2, mapilio_default;
88435   var init_mapilio = __esm({
88436     "modules/services/mapilio.js"() {
88437       "use strict";
88438       init_src4();
88439       init_src5();
88440       init_src12();
88441       init_pbf();
88442       init_rbush();
88443       init_vector_tile();
88444       import_lodash5 = __toESM(require_lodash());
88445       init_util();
88446       init_geo2();
88447       init_localizer();
88448       apiUrl2 = "https://end.mapilio.com";
88449       imageBaseUrl = "https://cdn.mapilio.com/im";
88450       baseTileUrl2 = "https://geo.mapilio.com/geoserver/gwc/service/wmts?REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&LAYER=mapilio:";
88451       pointLayer = "map_points";
88452       lineLayer = "map_roads_line";
88453       tileStyle = "&STYLE=&TILEMATRIX=EPSG:900913:{z}&TILEMATRIXSET=EPSG:900913&FORMAT=application/vnd.mapbox-vector-tile&TILECOL={x}&TILEROW={y}";
88454       minZoom3 = 14;
88455       dispatch12 = dispatch_default("loadedImages", "loadedLines");
88456       imgZoom2 = zoom_default2().extent([[0, 0], [320, 240]]).translateExtent([[0, 0], [320, 240]]).scaleExtent([1, 15]);
88457       pannellumViewerCSS3 = "pannellum/pannellum.css";
88458       pannellumViewerJS3 = "pannellum/pannellum.js";
88459       resolution = 1080;
88460       _sceneOptions2 = {
88461         showFullscreenCtrl: false,
88462         autoLoad: true,
88463         yaw: 0,
88464         minHfov: 10,
88465         maxHfov: 90,
88466         hfov: 60
88467       };
88468       _currScene2 = 0;
88469       mapilio_default = {
88470         // Initialize Mapilio
88471         init: function() {
88472           if (!_cache3) {
88473             this.reset();
88474           }
88475           this.event = utilRebind(this, dispatch12, "on");
88476         },
88477         // Reset cache and state
88478         reset: function() {
88479           if (_cache3) {
88480             Object.values(_cache3.requests.inflight).forEach(function(request3) {
88481               request3.abort();
88482             });
88483           }
88484           _cache3 = {
88485             images: { rtree: new RBush(), forImageId: {} },
88486             sequences: { rtree: new RBush(), lineString: {} },
88487             requests: { loaded: {}, inflight: {} }
88488           };
88489           _activeImage = null;
88490         },
88491         // Get visible images
88492         images: function(projection2) {
88493           const limit = 5;
88494           return searchLimited5(limit, projection2, _cache3.images.rtree);
88495         },
88496         cachedImage: function(imageKey) {
88497           return _cache3.images.forImageId[imageKey];
88498         },
88499         // Load images in the visible area
88500         loadImages: function(projection2) {
88501           let url = baseTileUrl2 + pointLayer + tileStyle;
88502           loadTiles4("images", url, 14, projection2);
88503         },
88504         // Load line in the visible area
88505         loadLines: function(projection2) {
88506           let url = baseTileUrl2 + lineLayer + tileStyle;
88507           loadTiles4("line", url, 14, projection2);
88508         },
88509         // Get visible sequences
88510         sequences: function(projection2) {
88511           const viewport = projection2.clipExtent();
88512           const min3 = [viewport[0][0], viewport[1][1]];
88513           const max3 = [viewport[1][0], viewport[0][1]];
88514           const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
88515           const sequenceIds = {};
88516           let lineStrings = [];
88517           _cache3.images.rtree.search(bbox2).forEach(function(d2) {
88518             if (d2.data.sequence_id) {
88519               sequenceIds[d2.data.sequence_id] = true;
88520             }
88521           });
88522           Object.keys(sequenceIds).forEach(function(sequenceId) {
88523             if (_cache3.sequences.lineString[sequenceId]) {
88524               lineStrings = lineStrings.concat(_cache3.sequences.lineString[sequenceId]);
88525             }
88526           });
88527           return lineStrings;
88528         },
88529         // Set the currently visible image
88530         setActiveImage: function(image) {
88531           if (image) {
88532             _activeImage = {
88533               id: image.id,
88534               sequence_id: image.sequence_id
88535             };
88536           } else {
88537             _activeImage = null;
88538           }
88539         },
88540         // Update the currently highlighted sequence and selected bubble.
88541         setStyles: function(context, hovered) {
88542           const hoveredImageId = hovered && hovered.id;
88543           const hoveredSequenceId = hovered && hovered.sequence_id;
88544           const selectedSequenceId = _activeImage && _activeImage.sequence_id;
88545           const selectedImageId = _activeImage && _activeImage.id;
88546           const markers = context.container().selectAll(".layer-mapilio .viewfield-group");
88547           const sequences = context.container().selectAll(".layer-mapilio .sequence");
88548           markers.classed("highlighted", function(d2) {
88549             return d2.id === hoveredImageId;
88550           }).classed("hovered", function(d2) {
88551             return d2.id === hoveredImageId;
88552           }).classed("currentView", function(d2) {
88553             return d2.id === selectedImageId;
88554           });
88555           sequences.classed("highlighted", function(d2) {
88556             return d2.properties.sequence_uuid === hoveredSequenceId;
88557           }).classed("currentView", function(d2) {
88558             return d2.properties.sequence_uuid === selectedSequenceId;
88559           });
88560           return this;
88561         },
88562         updateUrlImage: function(imageKey) {
88563           if (!window.mocha) {
88564             var hash2 = utilStringQs(window.location.hash);
88565             if (imageKey) {
88566               hash2.photo = "mapilio/" + imageKey;
88567             } else {
88568               delete hash2.photo;
88569             }
88570             window.location.replace("#" + utilQsString(hash2, true));
88571           }
88572         },
88573         initViewer: function() {
88574           if (!window.pannellum) return;
88575           if (_pannellumViewer3) return;
88576           _currScene2 += 1;
88577           const sceneID = _currScene2.toString();
88578           const options2 = {
88579             "default": { firstScene: sceneID },
88580             scenes: {}
88581           };
88582           options2.scenes[sceneID] = _sceneOptions2;
88583           _pannellumViewer3 = window.pannellum.viewer("ideditor-viewer-mapilio-pnlm", options2);
88584         },
88585         selectImage: function(context, id2) {
88586           let that = this;
88587           let d2 = this.cachedImage(id2);
88588           this.setActiveImage(d2);
88589           this.updateUrlImage(d2.id);
88590           let viewer = context.container().select(".photoviewer");
88591           if (!viewer.empty()) viewer.datum(d2);
88592           this.setStyles(context, null);
88593           if (!d2) return this;
88594           let wrap2 = context.container().select(".photoviewer .mapilio-wrapper");
88595           let attribution = wrap2.selectAll(".photo-attribution").text("");
88596           if (d2.capture_time) {
88597             attribution.append("span").attr("class", "captured_at").text(localeDateString2(d2.capture_time));
88598             attribution.append("span").text("|");
88599           }
88600           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");
88601           wrap2.transition().duration(100).call(imgZoom2.transform, identity2);
88602           wrap2.selectAll("img").remove();
88603           wrap2.selectAll("button.back").classed("hide", !_cache3.images.forImageId.hasOwnProperty(+id2 - 1));
88604           wrap2.selectAll("button.forward").classed("hide", !_cache3.images.forImageId.hasOwnProperty(+id2 + 1));
88605           getImageData(d2.id, d2.sequence_id).then(function() {
88606             if (d2.isPano) {
88607               if (!_pannellumViewer3) {
88608                 that.initViewer();
88609               } else {
88610                 _currScene2 += 1;
88611                 let sceneID = _currScene2.toString();
88612                 _pannellumViewer3.addScene(sceneID, _sceneOptions2).loadScene(sceneID);
88613                 if (_currScene2 > 2) {
88614                   sceneID = (_currScene2 - 1).toString();
88615                   _pannellumViewer3.removeScene(sceneID);
88616                 }
88617               }
88618             } else {
88619               that.initOnlyPhoto(context);
88620             }
88621           });
88622           function localeDateString2(s2) {
88623             if (!s2) return null;
88624             var options2 = { day: "numeric", month: "short", year: "numeric" };
88625             var d4 = new Date(s2);
88626             if (isNaN(d4.getTime())) return null;
88627             return d4.toLocaleDateString(_mainLocalizer.localeCode(), options2);
88628           }
88629           return this;
88630         },
88631         initOnlyPhoto: function(context) {
88632           if (_pannellumViewer3) {
88633             _pannellumViewer3.destroy();
88634             _pannellumViewer3 = null;
88635           }
88636           let wrap2 = context.container().select("#ideditor-viewer-mapilio-simple");
88637           let imgWrap = wrap2.select("img");
88638           if (!imgWrap.empty()) {
88639             imgWrap.attr("src", _sceneOptions2.panorama);
88640           } else {
88641             wrap2.append("img").attr("src", _sceneOptions2.panorama);
88642           }
88643         },
88644         ensureViewerLoaded: function(context) {
88645           let that = this;
88646           let imgWrap = context.container().select("#ideditor-viewer-mapilio-simple > img");
88647           if (!imgWrap.empty()) {
88648             imgWrap.remove();
88649           }
88650           if (_loadViewerPromise5) return _loadViewerPromise5;
88651           let wrap2 = context.container().select(".photoviewer").selectAll(".mapilio-wrapper").data([0]);
88652           let wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper mapilio-wrapper").classed("hide", true).on("dblclick.zoom", null);
88653           wrapEnter.append("div").attr("class", "photo-attribution fillD");
88654           const controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls-mapilio");
88655           controlsEnter.append("button").classed("back", true).on("click.back", step(-1)).text("\u25C4");
88656           controlsEnter.append("button").classed("forward", true).on("click.forward", step(1)).text("\u25BA");
88657           wrapEnter.append("div").attr("id", "ideditor-viewer-mapilio-pnlm");
88658           wrapEnter.append("div").attr("id", "ideditor-viewer-mapilio-simple-wrap").call(imgZoom2.on("zoom", zoomPan2)).append("div").attr("id", "ideditor-viewer-mapilio-simple");
88659           context.ui().photoviewer.on("resize.mapilio", () => {
88660             if (_pannellumViewer3) {
88661               _pannellumViewer3.resize();
88662             }
88663           });
88664           _loadViewerPromise5 = new Promise((resolve, reject) => {
88665             let loadedCount = 0;
88666             function loaded() {
88667               loadedCount += 1;
88668               if (loadedCount === 2) resolve();
88669             }
88670             const head = select_default2("head");
88671             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() {
88672               reject();
88673             });
88674             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() {
88675               reject();
88676             });
88677           }).catch(function() {
88678             _loadViewerPromise5 = null;
88679           });
88680           function step(stepBy) {
88681             return function() {
88682               if (!_activeImage) return;
88683               const imageId = _activeImage.id;
88684               const nextIndex = imageId + stepBy;
88685               if (!nextIndex) return;
88686               const nextImage = _cache3.images.forImageId[nextIndex];
88687               context.map().centerEase(nextImage.loc);
88688               that.selectImage(context, nextImage.id);
88689             };
88690           }
88691           function zoomPan2(d3_event) {
88692             var t2 = d3_event.transform;
88693             context.container().select(".photoviewer #ideditor-viewer-mapilio-simple").call(utilSetTransform, t2.x, t2.y, t2.k);
88694           }
88695           return _loadViewerPromise5;
88696         },
88697         showViewer: function(context) {
88698           let wrap2 = context.container().select(".photoviewer").classed("hide", false);
88699           let isHidden = wrap2.selectAll(".photo-wrapper.mapilio-wrapper.hide").size();
88700           if (isHidden) {
88701             wrap2.selectAll(".photo-wrapper:not(.mapilio-wrapper)").classed("hide", true);
88702             wrap2.selectAll(".photo-wrapper.mapilio-wrapper").classed("hide", false);
88703           }
88704           return this;
88705         },
88706         /**
88707          * hideViewer()
88708          */
88709         hideViewer: function(context) {
88710           let viewer = context.container().select(".photoviewer");
88711           if (!viewer.empty()) viewer.datum(null);
88712           this.updateUrlImage(null);
88713           viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
88714           context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
88715           this.setActiveImage();
88716           return this.setStyles(context, null);
88717         },
88718         // Return the current cache
88719         cache: function() {
88720           return _cache3;
88721         }
88722       };
88723     }
88724   });
88725
88726   // modules/services/panoramax.js
88727   var panoramax_exports = {};
88728   __export(panoramax_exports, {
88729     default: () => panoramax_default
88730   });
88731   function partitionViewport6(projection2) {
88732     const z2 = geoScaleToZoom(projection2.scale());
88733     const z22 = Math.ceil(z2 * 2) / 2 + 2.5;
88734     const tiler8 = utilTiler().zoomExtent([z22, z22]);
88735     return tiler8.getTiles(projection2).map(function(tile) {
88736       return tile.extent;
88737     });
88738   }
88739   function searchLimited6(limit, projection2, rtree) {
88740     limit = limit || 5;
88741     return partitionViewport6(projection2).reduce(function(result, extent) {
88742       let found = rtree.search(extent.bbox());
88743       const spacing = Math.max(1, Math.floor(found.length / limit));
88744       found = found.filter((d2, idx) => idx % spacing === 0 || d2.data.id === (_activeImage2 == null ? void 0 : _activeImage2.id)).sort((a2, b2) => {
88745         if (a2.data.id === (_activeImage2 == null ? void 0 : _activeImage2.id)) return -1;
88746         if (b2.data.id === (_activeImage2 == null ? void 0 : _activeImage2.id)) return 1;
88747         return 0;
88748       }).slice(0, limit).map((d2) => d2.data);
88749       return found.length ? result.concat(found) : result;
88750     }, []);
88751   }
88752   function loadTiles5(which, url, maxZoom2, projection2, zoom) {
88753     const tiler8 = utilTiler().zoomExtent([minZoom4, maxZoom2]).skipNullIsland(true);
88754     const tiles = tiler8.getTiles(projection2);
88755     tiles.forEach(function(tile) {
88756       loadTile5(which, url, tile, zoom);
88757     });
88758   }
88759   function loadTile5(which, url, tile, zoom) {
88760     const cache = _cache4.requests;
88761     const tileId = `${tile.id}-${which}`;
88762     if (cache.loaded[tileId] || cache.inflight[tileId]) return;
88763     const controller = new AbortController();
88764     cache.inflight[tileId] = controller;
88765     const requestUrl = url.replace("{x}", tile.xyz[0]).replace("{y}", tile.xyz[1]).replace("{z}", tile.xyz[2]);
88766     fetch(requestUrl, { signal: controller.signal }).then(function(response) {
88767       if (!response.ok) {
88768         throw new Error(response.status + " " + response.statusText);
88769       }
88770       cache.loaded[tileId] = true;
88771       delete cache.inflight[tileId];
88772       return response.arrayBuffer();
88773     }).then(function(data) {
88774       if (data.byteLength === 0) {
88775         throw new Error("No Data");
88776       }
88777       loadTileDataToCache3(data, tile, zoom);
88778       if (which === "images") {
88779         dispatch13.call("loadedImages");
88780       } else {
88781         dispatch13.call("loadedLines");
88782       }
88783     }).catch(function(e3) {
88784       if (e3.message === "No Data") {
88785         cache.loaded[tileId] = true;
88786       } else {
88787         console.error(e3);
88788       }
88789     });
88790   }
88791   function loadTileDataToCache3(data, tile, zoom) {
88792     const vectorTile = new VectorTile(new Pbf(data));
88793     let features, cache, layer, i3, feature3, loc, d2;
88794     if (vectorTile.layers.hasOwnProperty(pictureLayer)) {
88795       features = [];
88796       cache = _cache4.images;
88797       layer = vectorTile.layers[pictureLayer];
88798       for (i3 = 0; i3 < layer.length; i3++) {
88799         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
88800         loc = feature3.geometry.coordinates;
88801         d2 = {
88802           loc,
88803           capture_time: feature3.properties.ts,
88804           capture_time_parsed: new Date(feature3.properties.ts),
88805           id: feature3.properties.id,
88806           account_id: feature3.properties.account_id,
88807           sequence_id: feature3.properties.sequences.split('"')[1],
88808           heading: parseInt(feature3.properties.heading, 10),
88809           image_path: "",
88810           isPano: feature3.properties.type === "equirectangular",
88811           model: feature3.properties.model
88812         };
88813         cache.forImageId[d2.id] = d2;
88814         features.push({
88815           minX: loc[0],
88816           minY: loc[1],
88817           maxX: loc[0],
88818           maxY: loc[1],
88819           data: d2
88820         });
88821       }
88822       if (cache.rtree) {
88823         cache.rtree.load(features);
88824       }
88825     }
88826     if (vectorTile.layers.hasOwnProperty(sequenceLayer)) {
88827       cache = _cache4.sequences;
88828       if (zoom >= lineMinZoom && zoom < imageMinZoom) cache = _cache4.mockSequences;
88829       layer = vectorTile.layers[sequenceLayer];
88830       for (i3 = 0; i3 < layer.length; i3++) {
88831         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
88832         if (cache.lineString[feature3.properties.id]) {
88833           cache.lineString[feature3.properties.id].push(feature3);
88834         } else {
88835           cache.lineString[feature3.properties.id] = [feature3];
88836         }
88837       }
88838     }
88839   }
88840   async function getUsername(user_id) {
88841     const requestUrl = usernameURL.replace("{userId}", user_id);
88842     const response = await fetch(requestUrl, { method: "GET" });
88843     if (!response.ok) {
88844       throw new Error(response.status + " " + response.statusText);
88845     }
88846     const data = await response.json();
88847     return data.name;
88848   }
88849   var apiUrl3, tileUrl2, imageDataUrl, userIdUrl, usernameURL, viewerUrl, highDefinition, standardDefinition, pictureLayer, sequenceLayer, minZoom4, imageMinZoom, lineMinZoom, dispatch13, _cache4, _loadViewerPromise6, _definition, _isHD, _planeFrame2, _pannellumFrame2, _currentFrame2, _currentScene, _activeImage2, _isViewerOpen2, panoramax_default;
88850   var init_panoramax = __esm({
88851     "modules/services/panoramax.js"() {
88852       "use strict";
88853       init_src4();
88854       init_pbf();
88855       init_rbush();
88856       init_vector_tile();
88857       init_util();
88858       init_geo2();
88859       init_localizer();
88860       init_pannellum_photo();
88861       init_plane_photo();
88862       apiUrl3 = "https://api.panoramax.xyz/";
88863       tileUrl2 = apiUrl3 + "api/map/{z}/{x}/{y}.mvt";
88864       imageDataUrl = apiUrl3 + "api/collections/{collectionId}/items/{itemId}";
88865       userIdUrl = apiUrl3 + "api/users/search?q={username}";
88866       usernameURL = apiUrl3 + "api/users/{userId}";
88867       viewerUrl = apiUrl3;
88868       highDefinition = "hd";
88869       standardDefinition = "sd";
88870       pictureLayer = "pictures";
88871       sequenceLayer = "sequences";
88872       minZoom4 = 10;
88873       imageMinZoom = 15;
88874       lineMinZoom = 10;
88875       dispatch13 = dispatch_default("loadedImages", "loadedLines", "viewerChanged");
88876       _definition = standardDefinition;
88877       _isHD = false;
88878       _currentScene = {
88879         currentImage: null,
88880         nextImage: null,
88881         prevImage: null
88882       };
88883       _isViewerOpen2 = false;
88884       panoramax_default = {
88885         init: function() {
88886           if (!_cache4) {
88887             this.reset();
88888           }
88889           this.event = utilRebind(this, dispatch13, "on");
88890         },
88891         reset: function() {
88892           if (_cache4) {
88893             Object.values(_cache4.requests.inflight).forEach(function(request3) {
88894               request3.abort();
88895             });
88896           }
88897           _cache4 = {
88898             images: { rtree: new RBush(), forImageId: {} },
88899             sequences: { rtree: new RBush(), lineString: {} },
88900             mockSequences: { rtree: new RBush(), lineString: {} },
88901             requests: { loaded: {}, inflight: {} }
88902           };
88903           _currentScene.currentImage = null;
88904           _activeImage2 = null;
88905         },
88906         /**
88907          * Get visible images from cache
88908          * @param {*} projection Current Projection
88909          * @returns images data for the current projection
88910          */
88911         images: function(projection2) {
88912           const limit = 5;
88913           return searchLimited6(limit, projection2, _cache4.images.rtree);
88914         },
88915         /**
88916          * Get a specific image from cache
88917          * @param {*} imageKey the image id
88918          * @returns
88919          */
88920         cachedImage: function(imageKey) {
88921           return _cache4.images.forImageId[imageKey];
88922         },
88923         /**
88924          * Fetches images data for the visible area
88925          * @param {*} projection Current Projection
88926          */
88927         loadImages: function(projection2) {
88928           loadTiles5("images", tileUrl2, imageMinZoom, projection2);
88929         },
88930         /**
88931          * Fetches sequences data for the visible area
88932          * @param {*} projection Current Projection
88933          */
88934         loadLines: function(projection2, zoom) {
88935           loadTiles5("line", tileUrl2, lineMinZoom, projection2, zoom);
88936         },
88937         /**
88938          * Fetches all possible userIDs from Panoramax
88939          * @param {string} usernames one or multiple usernames
88940          * @returns userIDs
88941          */
88942         getUserIds: async function(usernames) {
88943           const requestUrls = usernames.map((username) => userIdUrl.replace("{username}", username));
88944           const responses = await Promise.all(requestUrls.map((requestUrl) => fetch(requestUrl, { method: "GET" })));
88945           if (responses.some((response) => !response.ok)) {
88946             const response = responses.find((response2) => !response2.ok);
88947             throw new Error(response.status + " " + response.statusText);
88948           }
88949           const data = await Promise.all(responses.map((response) => response.json()));
88950           return data.flatMap((d2, i3) => d2.features.filter((f2) => f2.name === usernames[i3]).map((f2) => f2.id));
88951         },
88952         /**
88953          * Get visible sequences from cache
88954          * @param {*} projection Current Projection
88955          * @param {number} zoom Current zoom (if zoom < `lineMinZoom` less accurate lines will be drawn)
88956          * @returns sequences data for the current projection
88957          */
88958         sequences: function(projection2, zoom) {
88959           const viewport = projection2.clipExtent();
88960           const min3 = [viewport[0][0], viewport[1][1]];
88961           const max3 = [viewport[1][0], viewport[0][1]];
88962           const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
88963           const sequenceIds = {};
88964           let lineStrings = [];
88965           if (zoom >= imageMinZoom) {
88966             _cache4.images.rtree.search(bbox2).forEach(function(d2) {
88967               if (d2.data.sequence_id) {
88968                 sequenceIds[d2.data.sequence_id] = true;
88969               }
88970             });
88971             Object.keys(sequenceIds).forEach(function(sequenceId) {
88972               if (_cache4.sequences.lineString[sequenceId]) {
88973                 lineStrings = lineStrings.concat(_cache4.sequences.lineString[sequenceId]);
88974               }
88975             });
88976             return lineStrings;
88977           }
88978           if (zoom >= lineMinZoom) {
88979             Object.keys(_cache4.mockSequences.lineString).forEach(function(sequenceId) {
88980               lineStrings = lineStrings.concat(_cache4.mockSequences.lineString[sequenceId]);
88981             });
88982           }
88983           return lineStrings;
88984         },
88985         /**
88986          * Updates the data for the currently visible image
88987          * @param {*} image Image data
88988          */
88989         setActiveImage: function(image) {
88990           if (image && image.id && image.sequence_id) {
88991             _activeImage2 = {
88992               id: image.id,
88993               sequence_id: image.sequence_id,
88994               loc: image.loc
88995             };
88996           } else {
88997             _activeImage2 = null;
88998           }
88999         },
89000         getActiveImage: function() {
89001           return _activeImage2;
89002         },
89003         /**
89004          * Update the currently highlighted sequence and selected bubble
89005          * @param {*} context Current HTML context
89006          * @param {*} [hovered] The hovered bubble image
89007          */
89008         setStyles: function(context, hovered) {
89009           const hoveredImageId = hovered && hovered.id;
89010           const hoveredSequenceId = hovered && hovered.sequence_id;
89011           const selectedSequenceId = _activeImage2 && _activeImage2.sequence_id;
89012           const selectedImageId = _activeImage2 && _activeImage2.id;
89013           const markers = context.container().selectAll(".layer-panoramax .viewfield-group");
89014           const sequences = context.container().selectAll(".layer-panoramax .sequence");
89015           markers.classed("highlighted", function(d2) {
89016             return d2.sequence_id === selectedSequenceId || d2.id === hoveredImageId;
89017           }).classed("hovered", function(d2) {
89018             return d2.id === hoveredImageId;
89019           }).classed("currentView", function(d2) {
89020             return d2.id === selectedImageId;
89021           });
89022           sequences.classed("highlighted", function(d2) {
89023             return d2.properties.id === hoveredSequenceId;
89024           }).classed("currentView", function(d2) {
89025             return d2.properties.id === selectedSequenceId;
89026           });
89027           context.container().selectAll(".layer-panoramax .viewfield-group .viewfield").attr("d", viewfieldPath);
89028           function viewfieldPath() {
89029             let d2 = this.parentNode.__data__;
89030             if (d2.isPano && d2.id !== selectedImageId) {
89031               return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
89032             } else {
89033               return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
89034             }
89035           }
89036           return this;
89037         },
89038         // Get viewer status
89039         isViewerOpen: function() {
89040           return _isViewerOpen2;
89041         },
89042         /**
89043          * Updates the URL to save the current shown image
89044          * @param {*} imageKey
89045          */
89046         updateUrlImage: function(imageKey) {
89047           if (!window.mocha) {
89048             var hash2 = utilStringQs(window.location.hash);
89049             if (imageKey) {
89050               hash2.photo = "panoramax/" + imageKey;
89051             } else {
89052               delete hash2.photo;
89053             }
89054             window.location.replace("#" + utilQsString(hash2, true));
89055           }
89056         },
89057         /**
89058          * Loads the selected image in the frame
89059          * @param {*} context Current HTML context
89060          * @param {*} id of the selected image
89061          * @returns
89062          */
89063         selectImage: function(context, id2) {
89064           let that = this;
89065           let d2 = that.cachedImage(id2);
89066           that.setActiveImage(d2);
89067           that.updateUrlImage(d2.id);
89068           const viewerLink = `${viewerUrl}#pic=${d2.id}&focus=pic`;
89069           let viewer = context.container().select(".photoviewer");
89070           if (!viewer.empty()) viewer.datum(d2);
89071           this.setStyles(context, null);
89072           if (!d2) return this;
89073           let wrap2 = context.container().select(".photoviewer .panoramax-wrapper");
89074           let attribution = wrap2.selectAll(".photo-attribution").text("");
89075           let line1 = attribution.append("div").attr("class", "attribution-row");
89076           const hdDomId = utilUniqueDomId("panoramax-hd");
89077           let label = line1.append("label").attr("for", hdDomId).attr("class", "panoramax-hd");
89078           label.append("input").attr("type", "checkbox").attr("id", hdDomId).property("checked", _isHD).on("click", (d3_event) => {
89079             d3_event.stopPropagation();
89080             _isHD = !_isHD;
89081             _definition = _isHD ? highDefinition : standardDefinition;
89082             that.selectImage(context, d2.id).showViewer(context);
89083           });
89084           label.append("span").call(_t.append("panoramax.hd"));
89085           if (d2.capture_time) {
89086             attribution.append("span").attr("class", "captured_at").text(localeDateString2(d2.capture_time));
89087             attribution.append("span").text("|");
89088           }
89089           attribution.append("a").attr("class", "report-photo").attr("href", "mailto:signalement.ign@panoramax.fr").call(_t.append("panoramax.report"));
89090           attribution.append("span").text("|");
89091           attribution.append("a").attr("class", "image-link").attr("target", "_blank").attr("href", viewerLink).text("panoramax.xyz");
89092           this.getImageData(d2.sequence_id, d2.id).then(function(data) {
89093             _currentScene = {
89094               currentImage: null,
89095               nextImage: null,
89096               prevImage: null
89097             };
89098             _currentScene.currentImage = data.assets[_definition];
89099             const nextIndex = data.links.findIndex((x2) => x2.rel === "next");
89100             const prevIndex = data.links.findIndex((x2) => x2.rel === "prev");
89101             if (nextIndex !== -1) {
89102               _currentScene.nextImage = data.links[nextIndex];
89103             }
89104             if (prevIndex !== -1) {
89105               _currentScene.prevImage = data.links[prevIndex];
89106             }
89107             d2.image_path = _currentScene.currentImage.href;
89108             wrap2.selectAll("button.back").classed("hide", _currentScene.prevImage === null);
89109             wrap2.selectAll("button.forward").classed("hide", _currentScene.nextImage === null);
89110             _currentFrame2 = d2.isPano ? _pannellumFrame2 : _planeFrame2;
89111             _currentFrame2.showPhotoFrame(wrap2).selectPhoto(d2, true);
89112           });
89113           function localeDateString2(s2) {
89114             if (!s2) return null;
89115             var options2 = { day: "numeric", month: "short", year: "numeric" };
89116             var d4 = new Date(s2);
89117             if (isNaN(d4.getTime())) return null;
89118             return d4.toLocaleDateString(_mainLocalizer.localeCode(), options2);
89119           }
89120           if (d2.account_id) {
89121             attribution.append("span").text("|");
89122             let line2 = attribution.append("span").attr("class", "attribution-row");
89123             getUsername(d2.account_id).then(function(username) {
89124               line2.append("span").attr("class", "captured_by").text("@" + username);
89125             });
89126           }
89127           return this;
89128         },
89129         photoFrame: function() {
89130           return _currentFrame2;
89131         },
89132         /**
89133          * Fetches the data for a specific image
89134          * @param {*} collection_id
89135          * @param {*} image_id
89136          * @returns The fetched image data
89137          */
89138         getImageData: async function(collection_id, image_id) {
89139           const requestUrl = imageDataUrl.replace("{collectionId}", collection_id).replace("{itemId}", image_id);
89140           const response = await fetch(requestUrl, { method: "GET" });
89141           if (!response.ok) {
89142             throw new Error(response.status + " " + response.statusText);
89143           }
89144           const data = await response.json();
89145           return data;
89146         },
89147         ensureViewerLoaded: function(context) {
89148           let that = this;
89149           let imgWrap = context.container().select("#ideditor-viewer-panoramax-simple > img");
89150           if (!imgWrap.empty()) {
89151             imgWrap.remove();
89152           }
89153           if (_loadViewerPromise6) return _loadViewerPromise6;
89154           let wrap2 = context.container().select(".photoviewer").selectAll(".panoramax-wrapper").data([0]);
89155           let wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper panoramax-wrapper").classed("hide", true).on("dblclick.zoom", null);
89156           wrapEnter.append("div").attr("class", "photo-attribution fillD");
89157           const controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls-panoramax");
89158           controlsEnter.append("button").classed("back", true).on("click.back", step(-1)).text("\u25C4");
89159           controlsEnter.append("button").classed("forward", true).on("click.forward", step(1)).text("\u25BA");
89160           _loadViewerPromise6 = Promise.all([
89161             pannellum_photo_default.init(context, wrapEnter),
89162             plane_photo_default.init(context, wrapEnter)
89163           ]).then(([pannellumPhotoFrame, planePhotoFrame]) => {
89164             _pannellumFrame2 = pannellumPhotoFrame;
89165             _pannellumFrame2.event.on("viewerChanged", () => dispatch13.call("viewerChanged"));
89166             _planeFrame2 = planePhotoFrame;
89167             _planeFrame2.event.on("viewerChanged", () => dispatch13.call("viewerChanged"));
89168           });
89169           function step(stepBy) {
89170             return function() {
89171               if (!_currentScene.currentImage) return;
89172               let nextId;
89173               if (stepBy === 1) nextId = _currentScene.nextImage.id;
89174               else nextId = _currentScene.prevImage.id;
89175               if (!nextId) return;
89176               const nextImage = _cache4.images.forImageId[nextId];
89177               if (nextImage) {
89178                 context.map().centerEase(nextImage.loc);
89179                 that.selectImage(context, nextImage.id);
89180               }
89181             };
89182           }
89183           return _loadViewerPromise6;
89184         },
89185         /**
89186          * Shows the current viewer if hidden
89187          * @param {*} context
89188          */
89189         showViewer: function(context) {
89190           let wrap2 = context.container().select(".photoviewer").classed("hide", false);
89191           let isHidden = wrap2.selectAll(".photo-wrapper.panoramax-wrapper.hide").size();
89192           if (isHidden) {
89193             wrap2.selectAll(".photo-wrapper:not(.panoramax-wrapper)").classed("hide", true);
89194             wrap2.selectAll(".photo-wrapper.panoramax-wrapper").classed("hide", false);
89195           }
89196           _isViewerOpen2 = true;
89197           return this;
89198         },
89199         /**
89200          * Hides the current viewer if shown, resets the active image and sequence
89201          * @param {*} context
89202          */
89203         hideViewer: function(context) {
89204           let viewer = context.container().select(".photoviewer");
89205           if (!viewer.empty()) viewer.datum(null);
89206           this.updateUrlImage(null);
89207           viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
89208           context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
89209           this.setActiveImage(null);
89210           _isViewerOpen2 = false;
89211           return this.setStyles(context, null);
89212         },
89213         cache: function() {
89214           return _cache4;
89215         }
89216       };
89217     }
89218   });
89219
89220   // modules/services/index.js
89221   var services_exports = {};
89222   __export(services_exports, {
89223     serviceKartaview: () => kartaview_default,
89224     serviceKeepRight: () => keepRight_default,
89225     serviceMapRules: () => maprules_default,
89226     serviceMapilio: () => mapilio_default,
89227     serviceMapillary: () => mapillary_default,
89228     serviceNominatim: () => nominatim_default,
89229     serviceNsi: () => nsi_default,
89230     serviceOsm: () => osm_default,
89231     serviceOsmWikibase: () => osm_wikibase_default,
89232     serviceOsmose: () => osmose_default,
89233     servicePanoramax: () => panoramax_default,
89234     serviceStreetside: () => streetside_default,
89235     serviceTaginfo: () => taginfo_default,
89236     serviceVectorTile: () => vector_tile_default,
89237     serviceVegbilder: () => vegbilder_default,
89238     serviceWikidata: () => wikidata_default,
89239     serviceWikipedia: () => wikipedia_default,
89240     services: () => services
89241   });
89242   var services;
89243   var init_services = __esm({
89244     "modules/services/index.js"() {
89245       "use strict";
89246       init_keepRight();
89247       init_osmose();
89248       init_mapillary();
89249       init_maprules();
89250       init_nominatim();
89251       init_nsi();
89252       init_kartaview();
89253       init_vegbilder2();
89254       init_osm3();
89255       init_osm_wikibase();
89256       init_streetside2();
89257       init_taginfo();
89258       init_vector_tile2();
89259       init_wikidata2();
89260       init_wikipedia2();
89261       init_mapilio();
89262       init_panoramax();
89263       services = {
89264         geocoder: nominatim_default,
89265         keepRight: keepRight_default,
89266         osmose: osmose_default,
89267         mapillary: mapillary_default,
89268         nsi: nsi_default,
89269         kartaview: kartaview_default,
89270         vegbilder: vegbilder_default,
89271         osm: osm_default,
89272         osmWikibase: osm_wikibase_default,
89273         maprules: maprules_default,
89274         streetside: streetside_default,
89275         taginfo: taginfo_default,
89276         vectorTile: vector_tile_default,
89277         wikidata: wikidata_default,
89278         wikipedia: wikipedia_default,
89279         mapilio: mapilio_default,
89280         panoramax: panoramax_default
89281       };
89282     }
89283   });
89284
89285   // modules/modes/drag_note.js
89286   var drag_note_exports = {};
89287   __export(drag_note_exports, {
89288     modeDragNote: () => modeDragNote
89289   });
89290   function modeDragNote(context) {
89291     var mode = {
89292       id: "drag-note",
89293       button: "browse"
89294     };
89295     var edit2 = behaviorEdit(context);
89296     var _nudgeInterval;
89297     var _lastLoc;
89298     var _note;
89299     function startNudge(d3_event, nudge) {
89300       if (_nudgeInterval) window.clearInterval(_nudgeInterval);
89301       _nudgeInterval = window.setInterval(function() {
89302         context.map().pan(nudge);
89303         doMove(d3_event, nudge);
89304       }, 50);
89305     }
89306     function stopNudge() {
89307       if (_nudgeInterval) {
89308         window.clearInterval(_nudgeInterval);
89309         _nudgeInterval = null;
89310       }
89311     }
89312     function origin(note) {
89313       return context.projection(note.loc);
89314     }
89315     function start2(d3_event, note) {
89316       _note = note;
89317       var osm = services.osm;
89318       if (osm) {
89319         _note = osm.getNote(_note.id);
89320       }
89321       context.surface().selectAll(".note-" + _note.id).classed("active", true);
89322       context.perform(actionNoop());
89323       context.enter(mode);
89324       context.selectedNoteID(_note.id);
89325     }
89326     function move(d3_event, entity, point) {
89327       d3_event.stopPropagation();
89328       _lastLoc = context.projection.invert(point);
89329       doMove(d3_event);
89330       var nudge = geoViewportEdge(point, context.map().dimensions());
89331       if (nudge) {
89332         startNudge(d3_event, nudge);
89333       } else {
89334         stopNudge();
89335       }
89336     }
89337     function doMove(d3_event, nudge) {
89338       nudge = nudge || [0, 0];
89339       var currPoint = d3_event && d3_event.point || context.projection(_lastLoc);
89340       var currMouse = geoVecSubtract(currPoint, nudge);
89341       var loc = context.projection.invert(currMouse);
89342       _note = _note.move(loc);
89343       var osm = services.osm;
89344       if (osm) {
89345         osm.replaceNote(_note);
89346       }
89347       context.replace(actionNoop());
89348     }
89349     function end() {
89350       context.replace(actionNoop());
89351       context.selectedNoteID(_note.id).enter(modeSelectNote(context, _note.id));
89352     }
89353     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);
89354     mode.enter = function() {
89355       context.install(edit2);
89356     };
89357     mode.exit = function() {
89358       context.ui().sidebar.hover.cancel();
89359       context.uninstall(edit2);
89360       context.surface().selectAll(".active").classed("active", false);
89361       stopNudge();
89362     };
89363     mode.behavior = drag;
89364     return mode;
89365   }
89366   var init_drag_note = __esm({
89367     "modules/modes/drag_note.js"() {
89368       "use strict";
89369       init_services();
89370       init_noop2();
89371       init_drag2();
89372       init_edit();
89373       init_geo2();
89374       init_select_note();
89375     }
89376   });
89377
89378   // modules/modes/select_data.js
89379   var select_data_exports = {};
89380   __export(select_data_exports, {
89381     modeSelectData: () => modeSelectData
89382   });
89383   function modeSelectData(context, selectedDatum) {
89384     var mode = {
89385       id: "select-data",
89386       button: "browse"
89387     };
89388     var keybinding = utilKeybinding("select-data");
89389     var dataEditor = uiDataEditor(context);
89390     var behaviors = [
89391       behaviorBreathe(context),
89392       behaviorHover(context),
89393       behaviorSelect(context),
89394       behaviorLasso(context),
89395       modeDragNode(context).behavior,
89396       modeDragNote(context).behavior
89397     ];
89398     function selectData(d3_event, drawn) {
89399       var selection2 = context.surface().selectAll(".layer-mapdata .data" + selectedDatum.__featurehash__);
89400       if (selection2.empty()) {
89401         var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
89402         if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
89403           context.enter(modeBrowse(context));
89404         }
89405       } else {
89406         selection2.classed("selected", true);
89407       }
89408     }
89409     function esc() {
89410       if (context.container().select(".combobox").size()) return;
89411       context.enter(modeBrowse(context));
89412     }
89413     mode.zoomToSelected = function() {
89414       var extent = geoExtent(bounds_default(selectedDatum));
89415       context.map().centerZoomEase(extent.center(), context.map().trimmedExtentZoom(extent));
89416     };
89417     mode.enter = function() {
89418       behaviors.forEach(context.install);
89419       keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
89420       select_default2(document).call(keybinding);
89421       selectData();
89422       var sidebar = context.ui().sidebar;
89423       sidebar.show(dataEditor.datum(selectedDatum));
89424       var extent = geoExtent(bounds_default(selectedDatum));
89425       sidebar.expand(sidebar.intersects(extent));
89426       context.map().on("drawn.select-data", selectData);
89427     };
89428     mode.exit = function() {
89429       behaviors.forEach(context.uninstall);
89430       select_default2(document).call(keybinding.unbind);
89431       context.surface().selectAll(".layer-mapdata .selected").classed("selected hover", false);
89432       context.map().on("drawn.select-data", null);
89433       context.ui().sidebar.hide();
89434     };
89435     return mode;
89436   }
89437   var init_select_data = __esm({
89438     "modules/modes/select_data.js"() {
89439       "use strict";
89440       init_src2();
89441       init_src5();
89442       init_breathe();
89443       init_hover();
89444       init_lasso2();
89445       init_select4();
89446       init_localizer();
89447       init_geo2();
89448       init_browse();
89449       init_drag_node();
89450       init_drag_note();
89451       init_data_editor();
89452       init_util();
89453     }
89454   });
89455
89456   // modules/behavior/select.js
89457   var select_exports = {};
89458   __export(select_exports, {
89459     behaviorSelect: () => behaviorSelect
89460   });
89461   function behaviorSelect(context) {
89462     var _tolerancePx = 4;
89463     var _lastMouseEvent = null;
89464     var _showMenu = false;
89465     var _downPointers = {};
89466     var _longPressTimeout = null;
89467     var _lastInteractionType = null;
89468     var _multiselectionPointerId = null;
89469     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
89470     function keydown(d3_event) {
89471       if (d3_event.keyCode === 32) {
89472         var activeNode = document.activeElement;
89473         if (activeNode && (/* @__PURE__ */ new Set(["INPUT", "TEXTAREA"])).has(activeNode.nodeName)) return;
89474       }
89475       if (d3_event.keyCode === 93 || // context menu key
89476       d3_event.keyCode === 32) {
89477         d3_event.preventDefault();
89478       }
89479       if (d3_event.repeat) return;
89480       cancelLongPress();
89481       if (d3_event.shiftKey) {
89482         context.surface().classed("behavior-multiselect", true);
89483       }
89484       if (d3_event.keyCode === 32) {
89485         if (!_downPointers.spacebar && _lastMouseEvent) {
89486           cancelLongPress();
89487           _longPressTimeout = window.setTimeout(didLongPress, 500, "spacebar", "spacebar");
89488           _downPointers.spacebar = {
89489             firstEvent: _lastMouseEvent,
89490             lastEvent: _lastMouseEvent
89491           };
89492         }
89493       }
89494     }
89495     function keyup(d3_event) {
89496       cancelLongPress();
89497       if (!d3_event.shiftKey) {
89498         context.surface().classed("behavior-multiselect", false);
89499       }
89500       if (d3_event.keyCode === 93) {
89501         d3_event.preventDefault();
89502         _lastInteractionType = "menukey";
89503         contextmenu(d3_event);
89504       } else if (d3_event.keyCode === 32) {
89505         var pointer = _downPointers.spacebar;
89506         if (pointer) {
89507           delete _downPointers.spacebar;
89508           if (pointer.done) return;
89509           d3_event.preventDefault();
89510           _lastInteractionType = "spacebar";
89511           click(pointer.firstEvent, pointer.lastEvent, "spacebar");
89512         }
89513       }
89514     }
89515     function pointerdown(d3_event) {
89516       var id2 = (d3_event.pointerId || "mouse").toString();
89517       cancelLongPress();
89518       if (d3_event.buttons && d3_event.buttons !== 1) return;
89519       context.ui().closeEditMenu();
89520       if (d3_event.pointerType !== "mouse") {
89521         _longPressTimeout = window.setTimeout(didLongPress, 500, id2, "longdown-" + (d3_event.pointerType || "mouse"));
89522       }
89523       _downPointers[id2] = {
89524         firstEvent: d3_event,
89525         lastEvent: d3_event
89526       };
89527     }
89528     function didLongPress(id2, interactionType) {
89529       var pointer = _downPointers[id2];
89530       if (!pointer) return;
89531       for (var i3 in _downPointers) {
89532         _downPointers[i3].done = true;
89533       }
89534       _longPressTimeout = null;
89535       _lastInteractionType = interactionType;
89536       _showMenu = true;
89537       click(pointer.firstEvent, pointer.lastEvent, id2);
89538     }
89539     function pointermove(d3_event) {
89540       var id2 = (d3_event.pointerId || "mouse").toString();
89541       if (_downPointers[id2]) {
89542         _downPointers[id2].lastEvent = d3_event;
89543       }
89544       if (!d3_event.pointerType || d3_event.pointerType === "mouse") {
89545         _lastMouseEvent = d3_event;
89546         if (_downPointers.spacebar) {
89547           _downPointers.spacebar.lastEvent = d3_event;
89548         }
89549       }
89550     }
89551     function pointerup(d3_event) {
89552       var id2 = (d3_event.pointerId || "mouse").toString();
89553       var pointer = _downPointers[id2];
89554       if (!pointer) return;
89555       delete _downPointers[id2];
89556       if (_multiselectionPointerId === id2) {
89557         _multiselectionPointerId = null;
89558       }
89559       if (pointer.done) return;
89560       click(pointer.firstEvent, d3_event, id2);
89561     }
89562     function pointercancel(d3_event) {
89563       var id2 = (d3_event.pointerId || "mouse").toString();
89564       if (!_downPointers[id2]) return;
89565       delete _downPointers[id2];
89566       if (_multiselectionPointerId === id2) {
89567         _multiselectionPointerId = null;
89568       }
89569     }
89570     function contextmenu(d3_event) {
89571       d3_event.preventDefault();
89572       if (!+d3_event.clientX && !+d3_event.clientY) {
89573         if (_lastMouseEvent) {
89574           d3_event = _lastMouseEvent;
89575         } else {
89576           return;
89577         }
89578       } else {
89579         _lastMouseEvent = d3_event;
89580         if (d3_event.pointerType === "touch" || d3_event.pointerType === "pen" || d3_event.mozInputSource && // firefox doesn't give a pointerType on contextmenu events
89581         (d3_event.mozInputSource === MouseEvent.MOZ_SOURCE_TOUCH || d3_event.mozInputSource === MouseEvent.MOZ_SOURCE_PEN)) {
89582           _lastInteractionType = "touch";
89583         } else {
89584           _lastInteractionType = "rightclick";
89585         }
89586       }
89587       _showMenu = true;
89588       click(d3_event, d3_event);
89589     }
89590     function click(firstEvent, lastEvent, pointerId) {
89591       cancelLongPress();
89592       var mapNode = context.container().select(".main-map").node();
89593       var pointGetter = utilFastMouse(mapNode);
89594       var p1 = pointGetter(firstEvent);
89595       var p2 = pointGetter(lastEvent);
89596       var dist = geoVecLength(p1, p2);
89597       if (dist > _tolerancePx || !mapContains(lastEvent)) {
89598         resetProperties();
89599         return;
89600       }
89601       var targetDatum = lastEvent.target.__data__;
89602       var multiselectEntityId;
89603       if (!_multiselectionPointerId) {
89604         var selectPointerInfo = pointerDownOnSelection(pointerId);
89605         if (selectPointerInfo) {
89606           _multiselectionPointerId = selectPointerInfo.pointerId;
89607           multiselectEntityId = !selectPointerInfo.selected && selectPointerInfo.entityId;
89608           _downPointers[selectPointerInfo.pointerId].done = true;
89609         }
89610       }
89611       var isMultiselect = context.mode().id === "select" && // and shift key is down
89612       (lastEvent && lastEvent.shiftKey || // or we're lasso-selecting
89613       context.surface().select(".lasso").node() || // or a pointer is down over a selected feature
89614       _multiselectionPointerId && !multiselectEntityId);
89615       processClick(targetDatum, isMultiselect, p2, multiselectEntityId);
89616       function mapContains(event) {
89617         var rect = mapNode.getBoundingClientRect();
89618         return event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
89619       }
89620       function pointerDownOnSelection(skipPointerId) {
89621         var mode = context.mode();
89622         var selectedIDs = mode.id === "select" ? mode.selectedIDs() : [];
89623         for (var pointerId2 in _downPointers) {
89624           if (pointerId2 === "spacebar" || pointerId2 === skipPointerId) continue;
89625           var pointerInfo = _downPointers[pointerId2];
89626           var p12 = pointGetter(pointerInfo.firstEvent);
89627           var p22 = pointGetter(pointerInfo.lastEvent);
89628           if (geoVecLength(p12, p22) > _tolerancePx) continue;
89629           var datum2 = pointerInfo.firstEvent.target.__data__;
89630           var entity = datum2 && datum2.properties && datum2.properties.entity || datum2;
89631           if (context.graph().hasEntity(entity.id)) {
89632             return {
89633               pointerId: pointerId2,
89634               entityId: entity.id,
89635               selected: selectedIDs.indexOf(entity.id) !== -1
89636             };
89637           }
89638         }
89639         return null;
89640       }
89641     }
89642     function processClick(datum2, isMultiselect, point, alsoSelectId) {
89643       var mode = context.mode();
89644       var showMenu = _showMenu;
89645       var interactionType = _lastInteractionType;
89646       var entity = datum2 && datum2.properties && datum2.properties.entity;
89647       if (entity) datum2 = entity;
89648       if (datum2 && datum2.type === "midpoint") {
89649         datum2 = datum2.parents[0];
89650       }
89651       var newMode;
89652       if (datum2 instanceof osmEntity) {
89653         var selectedIDs = context.selectedIDs();
89654         context.selectedNoteID(null);
89655         context.selectedErrorID(null);
89656         if (!isMultiselect) {
89657           if (!showMenu || selectedIDs.length <= 1 || selectedIDs.indexOf(datum2.id) === -1) {
89658             if (alsoSelectId === datum2.id) alsoSelectId = null;
89659             selectedIDs = (alsoSelectId ? [alsoSelectId] : []).concat([datum2.id]);
89660             newMode = mode.id === "select" ? mode.selectedIDs(selectedIDs) : modeSelect(context, selectedIDs).selectBehavior(behavior);
89661             context.enter(newMode);
89662           }
89663         } else {
89664           if (selectedIDs.indexOf(datum2.id) !== -1) {
89665             if (!showMenu) {
89666               selectedIDs = selectedIDs.filter(function(id2) {
89667                 return id2 !== datum2.id;
89668               });
89669               newMode = selectedIDs.length ? mode.selectedIDs(selectedIDs) : modeBrowse(context).selectBehavior(behavior);
89670               context.enter(newMode);
89671             }
89672           } else {
89673             selectedIDs = selectedIDs.concat([datum2.id]);
89674             newMode = mode.selectedIDs(selectedIDs);
89675             context.enter(newMode);
89676           }
89677         }
89678       } else if (datum2 && datum2.__featurehash__ && !isMultiselect) {
89679         context.selectedNoteID(null).enter(modeSelectData(context, datum2));
89680       } else if (datum2 instanceof osmNote && !isMultiselect) {
89681         context.selectedNoteID(datum2.id).enter(modeSelectNote(context, datum2.id));
89682       } else if (datum2 instanceof QAItem && !isMultiselect) {
89683         context.selectedErrorID(datum2.id).enter(modeSelectError(context, datum2.id, datum2.service));
89684       } else {
89685         context.selectedNoteID(null);
89686         context.selectedErrorID(null);
89687         if (!isMultiselect && mode.id !== "browse") {
89688           context.enter(modeBrowse(context));
89689         }
89690       }
89691       context.ui().closeEditMenu();
89692       if (showMenu) context.ui().showEditMenu(point, interactionType);
89693       resetProperties();
89694     }
89695     function cancelLongPress() {
89696       if (_longPressTimeout) window.clearTimeout(_longPressTimeout);
89697       _longPressTimeout = null;
89698     }
89699     function resetProperties() {
89700       cancelLongPress();
89701       _showMenu = false;
89702       _lastInteractionType = null;
89703     }
89704     function behavior(selection2) {
89705       resetProperties();
89706       _lastMouseEvent = context.map().lastPointerEvent();
89707       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) {
89708         var e3 = d3_event;
89709         if (+e3.clientX === 0 && +e3.clientY === 0) {
89710           d3_event.preventDefault();
89711         }
89712       });
89713       selection2.on(_pointerPrefix + "down.select", pointerdown).on("contextmenu.select", contextmenu);
89714     }
89715     behavior.off = function(selection2) {
89716       cancelLongPress();
89717       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);
89718       selection2.on(_pointerPrefix + "down.select", null).on("contextmenu.select", null);
89719       context.surface().classed("behavior-multiselect", false);
89720     };
89721     return behavior;
89722   }
89723   var init_select4 = __esm({
89724     "modules/behavior/select.js"() {
89725       "use strict";
89726       init_src5();
89727       init_geo2();
89728       init_browse();
89729       init_select5();
89730       init_select_data();
89731       init_select_note();
89732       init_select_error();
89733       init_osm();
89734       init_util2();
89735     }
89736   });
89737
89738   // modules/operations/continue.js
89739   var continue_exports = {};
89740   __export(continue_exports, {
89741     operationContinue: () => operationContinue
89742   });
89743   function operationContinue(context, selectedIDs) {
89744     var _entities = selectedIDs.map(function(id2) {
89745       return context.graph().entity(id2);
89746     });
89747     var _geometries = Object.assign(
89748       { line: [], vertex: [] },
89749       utilArrayGroupBy(_entities, function(entity) {
89750         return entity.geometry(context.graph());
89751       })
89752     );
89753     var _vertex = _geometries.vertex.length && _geometries.vertex[0];
89754     function candidateWays() {
89755       return _vertex ? context.graph().parentWays(_vertex).filter(function(parent) {
89756         const geom = parent.geometry(context.graph());
89757         return (geom === "line" || geom === "area") && !parent.isClosed() && parent.affix(_vertex.id) && (_geometries.line.length === 0 || _geometries.line[0] === parent);
89758       }) : [];
89759     }
89760     var _candidates = candidateWays();
89761     var operation2 = function() {
89762       var candidate = _candidates[0];
89763       const tagsToRemove = /* @__PURE__ */ new Set();
89764       if (_vertex.tags.fixme === "continue") tagsToRemove.add("fixme");
89765       if (_vertex.tags.noexit === "yes") tagsToRemove.add("noexit");
89766       if (tagsToRemove.size) {
89767         context.perform((graph) => {
89768           const newTags = { ..._vertex.tags };
89769           for (const key of tagsToRemove) {
89770             delete newTags[key];
89771           }
89772           return actionChangeTags(_vertex.id, newTags)(graph);
89773         }, operation2.annotation());
89774       }
89775       context.enter(
89776         modeDrawLine(context, candidate.id, context.graph(), "line", candidate.affix(_vertex.id), true)
89777       );
89778     };
89779     operation2.relatedEntityIds = function() {
89780       return _candidates.length ? [_candidates[0].id] : [];
89781     };
89782     operation2.available = function() {
89783       return _geometries.vertex.length === 1 && _geometries.line.length <= 1 && !context.features().hasHiddenConnections(_vertex, context.graph());
89784     };
89785     operation2.disabled = function() {
89786       if (_candidates.length === 0) {
89787         return "not_eligible";
89788       } else if (_candidates.length > 1) {
89789         return "multiple";
89790       }
89791       return false;
89792     };
89793     operation2.tooltip = function() {
89794       var disable = operation2.disabled();
89795       return disable ? _t.append("operations.continue." + disable) : _t.append("operations.continue.description");
89796     };
89797     operation2.annotation = function() {
89798       return _t("operations.continue.annotation.line");
89799     };
89800     operation2.id = "continue";
89801     operation2.keys = [_t("operations.continue.key")];
89802     operation2.title = _t.append("operations.continue.title");
89803     operation2.behavior = behaviorOperation(context).which(operation2);
89804     return operation2;
89805   }
89806   var init_continue = __esm({
89807     "modules/operations/continue.js"() {
89808       "use strict";
89809       init_localizer();
89810       init_draw_line();
89811       init_operation();
89812       init_util();
89813       init_actions();
89814     }
89815   });
89816
89817   // modules/operations/copy.js
89818   var copy_exports = {};
89819   __export(copy_exports, {
89820     operationCopy: () => operationCopy
89821   });
89822   function operationCopy(context, selectedIDs) {
89823     function getFilteredIdsToCopy() {
89824       return selectedIDs.filter(function(selectedID) {
89825         var entity = context.graph().hasEntity(selectedID);
89826         return entity.hasInterestingTags() || entity.geometry(context.graph()) !== "vertex";
89827       });
89828     }
89829     var operation2 = function() {
89830       var graph = context.graph();
89831       var selected = groupEntities(getFilteredIdsToCopy(), graph);
89832       var canCopy = [];
89833       var skip = {};
89834       var entity;
89835       var i3;
89836       for (i3 = 0; i3 < selected.relation.length; i3++) {
89837         entity = selected.relation[i3];
89838         if (!skip[entity.id] && entity.isComplete(graph)) {
89839           canCopy.push(entity.id);
89840           skip = getDescendants(entity.id, graph, skip);
89841         }
89842       }
89843       for (i3 = 0; i3 < selected.way.length; i3++) {
89844         entity = selected.way[i3];
89845         if (!skip[entity.id]) {
89846           canCopy.push(entity.id);
89847           skip = getDescendants(entity.id, graph, skip);
89848         }
89849       }
89850       for (i3 = 0; i3 < selected.node.length; i3++) {
89851         entity = selected.node[i3];
89852         if (!skip[entity.id]) {
89853           canCopy.push(entity.id);
89854         }
89855       }
89856       context.copyIDs(canCopy);
89857       if (_point && (canCopy.length !== 1 || graph.entity(canCopy[0]).type !== "node")) {
89858         context.copyLonLat(context.projection.invert(_point));
89859       } else {
89860         context.copyLonLat(null);
89861       }
89862     };
89863     function groupEntities(ids, graph) {
89864       var entities = ids.map(function(id2) {
89865         return graph.entity(id2);
89866       });
89867       return Object.assign(
89868         { relation: [], way: [], node: [] },
89869         utilArrayGroupBy(entities, "type")
89870       );
89871     }
89872     function getDescendants(id2, graph, descendants) {
89873       var entity = graph.entity(id2);
89874       var children2;
89875       descendants = descendants || {};
89876       if (entity.type === "relation") {
89877         children2 = entity.members.map(function(m2) {
89878           return m2.id;
89879         });
89880       } else if (entity.type === "way") {
89881         children2 = entity.nodes;
89882       } else {
89883         children2 = [];
89884       }
89885       for (var i3 = 0; i3 < children2.length; i3++) {
89886         if (!descendants[children2[i3]]) {
89887           descendants[children2[i3]] = true;
89888           descendants = getDescendants(children2[i3], graph, descendants);
89889         }
89890       }
89891       return descendants;
89892     }
89893     operation2.available = function() {
89894       return getFilteredIdsToCopy().length > 0;
89895     };
89896     operation2.disabled = function() {
89897       var extent = utilTotalExtent(getFilteredIdsToCopy(), context.graph());
89898       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
89899         return "too_large";
89900       }
89901       return false;
89902     };
89903     operation2.availableForKeypress = function() {
89904       var selection2 = window.getSelection && window.getSelection();
89905       return !selection2 || !selection2.toString();
89906     };
89907     operation2.tooltip = function() {
89908       var disable = operation2.disabled();
89909       return disable ? _t.append("operations.copy." + disable, { n: selectedIDs.length }) : _t.append("operations.copy.description", { n: selectedIDs.length });
89910     };
89911     operation2.annotation = function() {
89912       return _t("operations.copy.annotation", { n: selectedIDs.length });
89913     };
89914     var _point;
89915     operation2.point = function(val) {
89916       _point = val;
89917       return operation2;
89918     };
89919     operation2.id = "copy";
89920     operation2.keys = [uiCmd("\u2318C")];
89921     operation2.title = _t.append("operations.copy.title");
89922     operation2.behavior = behaviorOperation(context).which(operation2);
89923     return operation2;
89924   }
89925   var init_copy = __esm({
89926     "modules/operations/copy.js"() {
89927       "use strict";
89928       init_localizer();
89929       init_operation();
89930       init_cmd();
89931       init_util();
89932     }
89933   });
89934
89935   // modules/operations/disconnect.js
89936   var disconnect_exports2 = {};
89937   __export(disconnect_exports2, {
89938     operationDisconnect: () => operationDisconnect
89939   });
89940   function operationDisconnect(context, selectedIDs) {
89941     var _vertexIDs = [];
89942     var _wayIDs = [];
89943     var _otherIDs = [];
89944     var _actions = [];
89945     selectedIDs.forEach(function(id2) {
89946       var entity = context.entity(id2);
89947       if (entity.type === "way") {
89948         _wayIDs.push(id2);
89949       } else if (entity.geometry(context.graph()) === "vertex") {
89950         _vertexIDs.push(id2);
89951       } else {
89952         _otherIDs.push(id2);
89953       }
89954     });
89955     var _coords, _descriptionID = "", _annotationID = "features";
89956     var _disconnectingVertexIds = [];
89957     var _disconnectingWayIds = [];
89958     if (_vertexIDs.length > 0) {
89959       _disconnectingVertexIds = _vertexIDs;
89960       _vertexIDs.forEach(function(vertexID) {
89961         var action = actionDisconnect(vertexID);
89962         if (_wayIDs.length > 0) {
89963           var waysIDsForVertex = _wayIDs.filter(function(wayID) {
89964             var way = context.entity(wayID);
89965             return way.nodes.indexOf(vertexID) !== -1;
89966           });
89967           action.limitWays(waysIDsForVertex);
89968         }
89969         _actions.push(action);
89970         _disconnectingWayIds = _disconnectingWayIds.concat(context.graph().parentWays(context.graph().entity(vertexID)).map((d2) => d2.id));
89971       });
89972       _disconnectingWayIds = utilArrayUniq(_disconnectingWayIds).filter(function(id2) {
89973         return _wayIDs.indexOf(id2) === -1;
89974       });
89975       _descriptionID += _actions.length === 1 ? "single_point." : "multiple_points.";
89976       if (_wayIDs.length === 1) {
89977         _descriptionID += "single_way." + context.graph().geometry(_wayIDs[0]);
89978       } else {
89979         _descriptionID += _wayIDs.length === 0 ? "no_ways" : "multiple_ways";
89980       }
89981     } else if (_wayIDs.length > 0) {
89982       var ways = _wayIDs.map(function(id2) {
89983         return context.entity(id2);
89984       });
89985       var nodes = utilGetAllNodes(_wayIDs, context.graph());
89986       _coords = nodes.map(function(n3) {
89987         return n3.loc;
89988       });
89989       var sharedActions = [];
89990       var sharedNodes = [];
89991       var unsharedActions = [];
89992       var unsharedNodes = [];
89993       nodes.forEach(function(node) {
89994         var action = actionDisconnect(node.id).limitWays(_wayIDs);
89995         if (action.disabled(context.graph()) !== "not_connected") {
89996           var count = 0;
89997           for (var i3 in ways) {
89998             var way = ways[i3];
89999             if (way.nodes.indexOf(node.id) !== -1) {
90000               count += 1;
90001             }
90002             if (count > 1) break;
90003           }
90004           if (count > 1) {
90005             sharedActions.push(action);
90006             sharedNodes.push(node);
90007           } else {
90008             unsharedActions.push(action);
90009             unsharedNodes.push(node);
90010           }
90011         }
90012       });
90013       _descriptionID += "no_points.";
90014       _descriptionID += _wayIDs.length === 1 ? "single_way." : "multiple_ways.";
90015       if (sharedActions.length) {
90016         _actions = sharedActions;
90017         _disconnectingVertexIds = sharedNodes.map((node) => node.id);
90018         _descriptionID += "conjoined";
90019         _annotationID = "from_each_other";
90020       } else {
90021         _actions = unsharedActions;
90022         _disconnectingVertexIds = unsharedNodes.map((node) => node.id);
90023         if (_wayIDs.length === 1) {
90024           _descriptionID += context.graph().geometry(_wayIDs[0]);
90025         } else {
90026           _descriptionID += "separate";
90027         }
90028       }
90029     }
90030     var _extent = utilTotalExtent(_disconnectingVertexIds, context.graph());
90031     var operation2 = function() {
90032       context.perform(function(graph) {
90033         return _actions.reduce(function(graph2, action) {
90034           return action(graph2);
90035         }, graph);
90036       }, operation2.annotation());
90037       context.validator().validate();
90038     };
90039     operation2.relatedEntityIds = function() {
90040       if (_vertexIDs.length) {
90041         return _disconnectingWayIds;
90042       }
90043       return _disconnectingVertexIds;
90044     };
90045     operation2.available = function() {
90046       if (_actions.length === 0) return false;
90047       if (_otherIDs.length !== 0) return false;
90048       if (_vertexIDs.length !== 0 && _wayIDs.length !== 0 && !_wayIDs.every(function(wayID) {
90049         return _vertexIDs.some(function(vertexID) {
90050           var way = context.entity(wayID);
90051           return way.nodes.indexOf(vertexID) !== -1;
90052         });
90053       })) return false;
90054       return true;
90055     };
90056     operation2.disabled = function() {
90057       var reason;
90058       for (var actionIndex in _actions) {
90059         reason = _actions[actionIndex].disabled(context.graph());
90060         if (reason) return reason;
90061       }
90062       if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
90063         return "too_large." + ((_vertexIDs.length ? _vertexIDs : _wayIDs).length === 1 ? "single" : "multiple");
90064       } else if (_coords && someMissing()) {
90065         return "not_downloaded";
90066       } else if (selectedIDs.some(context.hasHiddenConnections)) {
90067         return "connected_to_hidden";
90068       }
90069       return false;
90070       function someMissing() {
90071         if (context.inIntro()) return false;
90072         var osm = context.connection();
90073         if (osm) {
90074           var missing = _coords.filter(function(loc) {
90075             return !osm.isDataLoaded(loc);
90076           });
90077           if (missing.length) {
90078             missing.forEach(function(loc) {
90079               context.loadTileAtLoc(loc);
90080             });
90081             return true;
90082           }
90083         }
90084         return false;
90085       }
90086     };
90087     operation2.tooltip = function() {
90088       var disable = operation2.disabled();
90089       return disable ? _t.append("operations.disconnect." + disable) : _t.append("operations.disconnect.description." + _descriptionID);
90090     };
90091     operation2.annotation = function() {
90092       return _t("operations.disconnect.annotation." + _annotationID);
90093     };
90094     operation2.id = "disconnect";
90095     operation2.keys = [_t("operations.disconnect.key")];
90096     operation2.title = _t.append("operations.disconnect.title");
90097     operation2.behavior = behaviorOperation(context).which(operation2);
90098     return operation2;
90099   }
90100   var init_disconnect2 = __esm({
90101     "modules/operations/disconnect.js"() {
90102       "use strict";
90103       init_localizer();
90104       init_disconnect();
90105       init_operation();
90106       init_array3();
90107       init_util2();
90108     }
90109   });
90110
90111   // modules/operations/downgrade.js
90112   var downgrade_exports = {};
90113   __export(downgrade_exports, {
90114     operationDowngrade: () => operationDowngrade
90115   });
90116   function operationDowngrade(context, selectedIDs) {
90117     var _affectedFeatureCount = 0;
90118     var _downgradeType = downgradeTypeForEntityIDs(selectedIDs);
90119     var _multi = _affectedFeatureCount === 1 ? "single" : "multiple";
90120     function downgradeTypeForEntityIDs(entityIds) {
90121       var downgradeType;
90122       _affectedFeatureCount = 0;
90123       for (var i3 in entityIds) {
90124         var entityID = entityIds[i3];
90125         var type2 = downgradeTypeForEntityID(entityID);
90126         if (type2) {
90127           _affectedFeatureCount += 1;
90128           if (downgradeType && type2 !== downgradeType) {
90129             if (downgradeType !== "generic" && type2 !== "generic") {
90130               downgradeType = "building_address";
90131             } else {
90132               downgradeType = "generic";
90133             }
90134           } else {
90135             downgradeType = type2;
90136           }
90137         }
90138       }
90139       return downgradeType;
90140     }
90141     function downgradeTypeForEntityID(entityID) {
90142       var graph = context.graph();
90143       var entity = graph.entity(entityID);
90144       var preset = _mainPresetIndex.match(entity, graph);
90145       if (!preset || preset.isFallback()) return null;
90146       if (entity.type === "node" && preset.id !== "address" && Object.keys(entity.tags).some(function(key) {
90147         return key.match(/^addr:.{1,}/);
90148       })) {
90149         return "address";
90150       }
90151       var geometry = entity.geometry(graph);
90152       if (geometry === "area" && entity.tags.building && !preset.tags.building) {
90153         return "building";
90154       }
90155       if (geometry === "vertex" && Object.keys(entity.tags).length) {
90156         return "generic";
90157       }
90158       return null;
90159     }
90160     var buildingKeysToKeep = ["architect", "building", "height", "layer", "nycdoitt:bin", "source", "type", "wheelchair"];
90161     var addressKeysToKeep = ["source"];
90162     var operation2 = function() {
90163       context.perform(function(graph) {
90164         for (var i3 in selectedIDs) {
90165           var entityID = selectedIDs[i3];
90166           var type2 = downgradeTypeForEntityID(entityID);
90167           if (!type2) continue;
90168           var tags = Object.assign({}, graph.entity(entityID).tags);
90169           for (var key in tags) {
90170             if (type2 === "address" && addressKeysToKeep.indexOf(key) !== -1) continue;
90171             if (type2 === "building") {
90172               if (buildingKeysToKeep.indexOf(key) !== -1 || key.match(/^building:.{1,}/) || key.match(/^roof:.{1,}/)) continue;
90173             }
90174             if (type2 !== "generic") {
90175               if (key.match(/^addr:.{1,}/) || key.match(/^source:.{1,}/)) continue;
90176             }
90177             delete tags[key];
90178           }
90179           graph = actionChangeTags(entityID, tags)(graph);
90180         }
90181         return graph;
90182       }, operation2.annotation());
90183       context.validator().validate();
90184       context.enter(modeSelect(context, selectedIDs));
90185     };
90186     operation2.available = function() {
90187       return _downgradeType;
90188     };
90189     operation2.disabled = function() {
90190       if (selectedIDs.some(hasWikidataTag)) {
90191         return "has_wikidata_tag";
90192       }
90193       return false;
90194       function hasWikidataTag(id2) {
90195         var entity = context.entity(id2);
90196         return entity.tags.wikidata && entity.tags.wikidata.trim().length > 0;
90197       }
90198     };
90199     operation2.tooltip = function() {
90200       var disable = operation2.disabled();
90201       return disable ? _t.append("operations.downgrade." + disable + "." + _multi) : _t.append("operations.downgrade.description." + _downgradeType);
90202     };
90203     operation2.annotation = function() {
90204       var suffix;
90205       if (_downgradeType === "building_address") {
90206         suffix = "generic";
90207       } else {
90208         suffix = _downgradeType;
90209       }
90210       return _t("operations.downgrade.annotation." + suffix, { n: _affectedFeatureCount });
90211     };
90212     operation2.id = "downgrade";
90213     operation2.keys = [uiCmd("\u232B")];
90214     operation2.title = _t.append("operations.downgrade.title");
90215     operation2.behavior = behaviorOperation(context).which(operation2);
90216     return operation2;
90217   }
90218   var init_downgrade = __esm({
90219     "modules/operations/downgrade.js"() {
90220       "use strict";
90221       init_change_tags();
90222       init_operation();
90223       init_select5();
90224       init_localizer();
90225       init_cmd();
90226       init_presets();
90227     }
90228   });
90229
90230   // modules/operations/extract.js
90231   var extract_exports2 = {};
90232   __export(extract_exports2, {
90233     operationExtract: () => operationExtract
90234   });
90235   function operationExtract(context, selectedIDs) {
90236     var _amount = selectedIDs.length === 1 ? "single" : "multiple";
90237     var _geometries = utilArrayUniq(selectedIDs.map(function(entityID) {
90238       return context.graph().hasEntity(entityID) && context.graph().geometry(entityID);
90239     }).filter(Boolean));
90240     var _geometryID = _geometries.length === 1 ? _geometries[0] : "feature";
90241     var _extent;
90242     var _actions = selectedIDs.map(function(entityID) {
90243       var graph = context.graph();
90244       var entity = graph.hasEntity(entityID);
90245       if (!entity || !entity.hasInterestingTags()) return null;
90246       if (entity.type === "node" && graph.parentWays(entity).length === 0) return null;
90247       if (entity.type !== "node") {
90248         var preset = _mainPresetIndex.match(entity, graph);
90249         if (preset.geometry.indexOf("point") === -1) return null;
90250       }
90251       _extent = _extent ? _extent.extend(entity.extent(graph)) : entity.extent(graph);
90252       return actionExtract(entityID, context.projection);
90253     }).filter(Boolean);
90254     var operation2 = function(d3_event) {
90255       const shiftKeyPressed = (d3_event == null ? void 0 : d3_event.shiftKey) || false;
90256       var combinedAction = function(graph) {
90257         _actions.forEach(function(action) {
90258           graph = action(graph, shiftKeyPressed);
90259         });
90260         return graph;
90261       };
90262       context.perform(combinedAction, operation2.annotation());
90263       var extractedNodeIDs = _actions.map(function(action) {
90264         return action.getExtractedNodeID();
90265       });
90266       context.enter(modeSelect(context, extractedNodeIDs));
90267     };
90268     operation2.available = function() {
90269       return _actions.length && selectedIDs.length === _actions.length;
90270     };
90271     operation2.disabled = function() {
90272       if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
90273         return "too_large";
90274       } else if (selectedIDs.some(function(entityID) {
90275         return context.graph().geometry(entityID) === "vertex" && context.hasHiddenConnections(entityID);
90276       })) {
90277         return "connected_to_hidden";
90278       }
90279       return false;
90280     };
90281     operation2.tooltip = function() {
90282       var disableReason = operation2.disabled();
90283       if (disableReason) {
90284         return _t.append("operations.extract." + disableReason + "." + _amount);
90285       } else {
90286         return _t.append("operations.extract.description." + _geometryID + "." + _amount);
90287       }
90288     };
90289     operation2.annotation = function() {
90290       return _t("operations.extract.annotation", { n: selectedIDs.length });
90291     };
90292     operation2.id = "extract";
90293     operation2.keys = [_t("operations.extract.key")];
90294     operation2.title = _t.append("operations.extract.title");
90295     operation2.behavior = behaviorOperation(context).which(operation2);
90296     return operation2;
90297   }
90298   var init_extract2 = __esm({
90299     "modules/operations/extract.js"() {
90300       "use strict";
90301       init_extract();
90302       init_operation();
90303       init_select5();
90304       init_localizer();
90305       init_presets();
90306       init_array3();
90307     }
90308   });
90309
90310   // modules/operations/merge.js
90311   var merge_exports2 = {};
90312   __export(merge_exports2, {
90313     operationMerge: () => operationMerge
90314   });
90315   function operationMerge(context, selectedIDs) {
90316     var _action = getAction();
90317     function getAction() {
90318       var join = actionJoin(selectedIDs);
90319       if (!join.disabled(context.graph())) return join;
90320       var merge3 = actionMerge(selectedIDs);
90321       if (!merge3.disabled(context.graph())) return merge3;
90322       var mergePolygon = actionMergePolygon(selectedIDs);
90323       if (!mergePolygon.disabled(context.graph())) return mergePolygon;
90324       var mergeNodes = actionMergeNodes(selectedIDs);
90325       if (!mergeNodes.disabled(context.graph())) return mergeNodes;
90326       if (join.disabled(context.graph()) !== "not_eligible") return join;
90327       if (merge3.disabled(context.graph()) !== "not_eligible") return merge3;
90328       if (mergePolygon.disabled(context.graph()) !== "not_eligible") return mergePolygon;
90329       return mergeNodes;
90330     }
90331     var operation2 = function() {
90332       if (operation2.disabled()) return;
90333       context.perform(_action, operation2.annotation());
90334       context.validator().validate();
90335       var resultIDs = selectedIDs.filter(context.hasEntity);
90336       if (resultIDs.length > 1) {
90337         var interestingIDs = resultIDs.filter(function(id2) {
90338           return context.entity(id2).hasInterestingTags();
90339         });
90340         if (interestingIDs.length) resultIDs = interestingIDs;
90341       }
90342       context.enter(modeSelect(context, resultIDs));
90343     };
90344     operation2.available = function() {
90345       return selectedIDs.length >= 2;
90346     };
90347     operation2.disabled = function() {
90348       var actionDisabled = _action.disabled(context.graph());
90349       if (actionDisabled) return actionDisabled;
90350       var osm = context.connection();
90351       if (osm && _action.resultingWayNodesLength && _action.resultingWayNodesLength(context.graph()) > osm.maxWayNodes()) {
90352         return "too_many_vertices";
90353       }
90354       return false;
90355     };
90356     operation2.tooltip = function() {
90357       var disabled = operation2.disabled();
90358       if (disabled) {
90359         if (disabled === "conflicting_relations") {
90360           return _t.append("operations.merge.conflicting_relations");
90361         }
90362         if (disabled === "restriction" || disabled === "connectivity") {
90363           return _t.append(
90364             "operations.merge.damage_relation",
90365             { relation: _mainPresetIndex.item("type/" + disabled).name() }
90366           );
90367         }
90368         return _t.append("operations.merge." + disabled);
90369       }
90370       return _t.append("operations.merge.description");
90371     };
90372     operation2.annotation = function() {
90373       return _t("operations.merge.annotation", { n: selectedIDs.length });
90374     };
90375     operation2.id = "merge";
90376     operation2.keys = [_t("operations.merge.key")];
90377     operation2.title = _t.append("operations.merge.title");
90378     operation2.behavior = behaviorOperation(context).which(operation2);
90379     return operation2;
90380   }
90381   var init_merge6 = __esm({
90382     "modules/operations/merge.js"() {
90383       "use strict";
90384       init_localizer();
90385       init_join2();
90386       init_merge5();
90387       init_merge_nodes();
90388       init_merge_polygon();
90389       init_operation();
90390       init_select5();
90391       init_presets();
90392     }
90393   });
90394
90395   // modules/operations/paste.js
90396   var paste_exports2 = {};
90397   __export(paste_exports2, {
90398     operationPaste: () => operationPaste
90399   });
90400   function operationPaste(context) {
90401     var _pastePoint;
90402     var operation2 = function() {
90403       if (!_pastePoint) return;
90404       var oldIDs = context.copyIDs();
90405       if (!oldIDs.length) return;
90406       var projection2 = context.projection;
90407       var extent = geoExtent();
90408       var oldGraph = context.copyGraph();
90409       var newIDs = [];
90410       var action = actionCopyEntities(oldIDs, oldGraph);
90411       context.perform(action);
90412       var copies = action.copies();
90413       var originals = /* @__PURE__ */ new Set();
90414       Object.values(copies).forEach(function(entity) {
90415         originals.add(entity.id);
90416       });
90417       for (var id2 in copies) {
90418         var oldEntity = oldGraph.entity(id2);
90419         var newEntity = copies[id2];
90420         extent._extend(oldEntity.extent(oldGraph));
90421         var parents = context.graph().parentWays(newEntity);
90422         var parentCopied = parents.some(function(parent) {
90423           return originals.has(parent.id);
90424         });
90425         if (!parentCopied) {
90426           newIDs.push(newEntity.id);
90427         }
90428       }
90429       var copyPoint = context.copyLonLat() && projection2(context.copyLonLat()) || projection2(extent.center());
90430       var delta = geoVecSubtract(_pastePoint, copyPoint);
90431       context.replace(actionMove(newIDs, delta, projection2), operation2.annotation());
90432       context.enter(modeSelect(context, newIDs));
90433     };
90434     operation2.point = function(val) {
90435       _pastePoint = val;
90436       return operation2;
90437     };
90438     operation2.available = function() {
90439       return context.mode().id === "browse";
90440     };
90441     operation2.disabled = function() {
90442       return !context.copyIDs().length;
90443     };
90444     operation2.tooltip = function() {
90445       var oldGraph = context.copyGraph();
90446       var ids = context.copyIDs();
90447       if (!ids.length) {
90448         return _t.append("operations.paste.nothing_copied");
90449       }
90450       return _t.append("operations.paste.description", { feature: utilDisplayLabel(oldGraph.entity(ids[0]), oldGraph), n: ids.length });
90451     };
90452     operation2.annotation = function() {
90453       var ids = context.copyIDs();
90454       return _t("operations.paste.annotation", { n: ids.length });
90455     };
90456     operation2.id = "paste";
90457     operation2.keys = [uiCmd("\u2318V")];
90458     operation2.title = _t.append("operations.paste.title");
90459     return operation2;
90460   }
90461   var init_paste2 = __esm({
90462     "modules/operations/paste.js"() {
90463       "use strict";
90464       init_copy_entities();
90465       init_move();
90466       init_select5();
90467       init_geo2();
90468       init_localizer();
90469       init_cmd();
90470       init_utilDisplayLabel();
90471     }
90472   });
90473
90474   // modules/operations/reverse.js
90475   var reverse_exports2 = {};
90476   __export(reverse_exports2, {
90477     operationReverse: () => operationReverse
90478   });
90479   function operationReverse(context, selectedIDs) {
90480     var operation2 = function() {
90481       context.perform(function combinedReverseAction(graph) {
90482         actions().forEach(function(action) {
90483           graph = action(graph);
90484         });
90485         return graph;
90486       }, operation2.annotation());
90487       context.validator().validate();
90488     };
90489     function actions(situation) {
90490       return selectedIDs.map(function(entityID) {
90491         var entity = context.hasEntity(entityID);
90492         if (!entity) return null;
90493         if (situation === "toolbar") {
90494           if (entity.type === "way" && (!entity.isOneWay() && !entity.isSided())) return null;
90495         }
90496         var geometry = entity.geometry(context.graph());
90497         if (entity.type !== "node" && geometry !== "line") return null;
90498         var action = actionReverse(entityID);
90499         if (action.disabled(context.graph())) return null;
90500         return action;
90501       }).filter(Boolean);
90502     }
90503     function reverseTypeID() {
90504       var acts = actions();
90505       var nodeActionCount = acts.filter(function(act) {
90506         var entity = context.hasEntity(act.entityID());
90507         return entity && entity.type === "node";
90508       }).length;
90509       if (nodeActionCount === 0) return "line";
90510       if (nodeActionCount === acts.length) return "point";
90511       return "feature";
90512     }
90513     operation2.available = function(situation) {
90514       return actions(situation).length > 0;
90515     };
90516     operation2.disabled = function() {
90517       return false;
90518     };
90519     operation2.tooltip = function() {
90520       return _t.append("operations.reverse.description." + reverseTypeID());
90521     };
90522     operation2.annotation = function() {
90523       var acts = actions();
90524       return _t("operations.reverse.annotation." + reverseTypeID(), { n: acts.length });
90525     };
90526     operation2.id = "reverse";
90527     operation2.keys = [_t("operations.reverse.key")];
90528     operation2.title = _t.append("operations.reverse.title");
90529     operation2.behavior = behaviorOperation(context).which(operation2);
90530     return operation2;
90531   }
90532   var init_reverse2 = __esm({
90533     "modules/operations/reverse.js"() {
90534       "use strict";
90535       init_localizer();
90536       init_reverse();
90537       init_operation();
90538     }
90539   });
90540
90541   // modules/operations/straighten.js
90542   var straighten_exports = {};
90543   __export(straighten_exports, {
90544     operationStraighten: () => operationStraighten
90545   });
90546   function operationStraighten(context, selectedIDs) {
90547     var _wayIDs = selectedIDs.filter(function(id2) {
90548       return id2.charAt(0) === "w";
90549     });
90550     var _nodeIDs = selectedIDs.filter(function(id2) {
90551       return id2.charAt(0) === "n";
90552     });
90553     var _amount = (_wayIDs.length ? _wayIDs : _nodeIDs).length === 1 ? "single" : "multiple";
90554     var _nodes = utilGetAllNodes(selectedIDs, context.graph());
90555     var _coords = _nodes.map(function(n3) {
90556       return n3.loc;
90557     });
90558     var _extent = utilTotalExtent(selectedIDs, context.graph());
90559     var _action = chooseAction();
90560     var _geometry;
90561     function chooseAction() {
90562       if (_wayIDs.length === 0 && _nodeIDs.length > 2) {
90563         _geometry = "point";
90564         return actionStraightenNodes(_nodeIDs, context.projection);
90565       } else if (_wayIDs.length > 0 && (_nodeIDs.length === 0 || _nodeIDs.length === 2)) {
90566         var startNodeIDs = [];
90567         var endNodeIDs = [];
90568         for (var i3 = 0; i3 < selectedIDs.length; i3++) {
90569           var entity = context.entity(selectedIDs[i3]);
90570           if (entity.type === "node") {
90571             continue;
90572           } else if (entity.type !== "way" || entity.isClosed()) {
90573             return null;
90574           }
90575           startNodeIDs.push(entity.first());
90576           endNodeIDs.push(entity.last());
90577         }
90578         startNodeIDs = startNodeIDs.filter(function(n3) {
90579           return startNodeIDs.indexOf(n3) === startNodeIDs.lastIndexOf(n3);
90580         });
90581         endNodeIDs = endNodeIDs.filter(function(n3) {
90582           return endNodeIDs.indexOf(n3) === endNodeIDs.lastIndexOf(n3);
90583         });
90584         if (utilArrayDifference(startNodeIDs, endNodeIDs).length + utilArrayDifference(endNodeIDs, startNodeIDs).length !== 2) return null;
90585         var wayNodeIDs = utilGetAllNodes(_wayIDs, context.graph()).map(function(node) {
90586           return node.id;
90587         });
90588         if (wayNodeIDs.length <= 2) return null;
90589         if (_nodeIDs.length === 2 && (wayNodeIDs.indexOf(_nodeIDs[0]) === -1 || wayNodeIDs.indexOf(_nodeIDs[1]) === -1)) return null;
90590         if (_nodeIDs.length) {
90591           _extent = utilTotalExtent(_nodeIDs, context.graph());
90592         }
90593         _geometry = "line";
90594         return actionStraightenWay(selectedIDs, context.projection);
90595       }
90596       return null;
90597     }
90598     function operation2() {
90599       if (!_action) return;
90600       context.perform(_action, operation2.annotation());
90601       window.setTimeout(function() {
90602         context.validator().validate();
90603       }, 300);
90604     }
90605     operation2.available = function() {
90606       return Boolean(_action);
90607     };
90608     operation2.disabled = function() {
90609       var reason = _action.disabled(context.graph());
90610       if (reason) {
90611         return reason;
90612       } else if (_extent.percentContainedIn(context.map().extent()) < 0.8) {
90613         return "too_large";
90614       } else if (someMissing()) {
90615         return "not_downloaded";
90616       } else if (selectedIDs.some(context.hasHiddenConnections)) {
90617         return "connected_to_hidden";
90618       }
90619       return false;
90620       function someMissing() {
90621         if (context.inIntro()) return false;
90622         var osm = context.connection();
90623         if (osm) {
90624           var missing = _coords.filter(function(loc) {
90625             return !osm.isDataLoaded(loc);
90626           });
90627           if (missing.length) {
90628             missing.forEach(function(loc) {
90629               context.loadTileAtLoc(loc);
90630             });
90631             return true;
90632           }
90633         }
90634         return false;
90635       }
90636     };
90637     operation2.tooltip = function() {
90638       var disable = operation2.disabled();
90639       return disable ? _t.append("operations.straighten." + disable + "." + _amount) : _t.append("operations.straighten.description." + _geometry + (_wayIDs.length === 1 ? "" : "s"));
90640     };
90641     operation2.annotation = function() {
90642       return _t("operations.straighten.annotation." + _geometry, { n: _wayIDs.length ? _wayIDs.length : _nodeIDs.length });
90643     };
90644     operation2.id = "straighten";
90645     operation2.keys = [_t("operations.straighten.key")];
90646     operation2.title = _t.append("operations.straighten.title");
90647     operation2.behavior = behaviorOperation(context).which(operation2);
90648     return operation2;
90649   }
90650   var init_straighten = __esm({
90651     "modules/operations/straighten.js"() {
90652       "use strict";
90653       init_localizer();
90654       init_straighten_nodes();
90655       init_straighten_way();
90656       init_operation();
90657       init_util();
90658     }
90659   });
90660
90661   // modules/operations/index.js
90662   var operations_exports = {};
90663   __export(operations_exports, {
90664     operationCircularize: () => operationCircularize,
90665     operationContinue: () => operationContinue,
90666     operationCopy: () => operationCopy,
90667     operationDelete: () => operationDelete,
90668     operationDisconnect: () => operationDisconnect,
90669     operationDowngrade: () => operationDowngrade,
90670     operationExtract: () => operationExtract,
90671     operationMerge: () => operationMerge,
90672     operationMove: () => operationMove,
90673     operationOrthogonalize: () => operationOrthogonalize,
90674     operationPaste: () => operationPaste,
90675     operationReflectLong: () => operationReflectLong,
90676     operationReflectShort: () => operationReflectShort,
90677     operationReverse: () => operationReverse,
90678     operationRotate: () => operationRotate,
90679     operationSplit: () => operationSplit,
90680     operationStraighten: () => operationStraighten
90681   });
90682   var init_operations = __esm({
90683     "modules/operations/index.js"() {
90684       "use strict";
90685       init_circularize2();
90686       init_continue();
90687       init_copy();
90688       init_delete();
90689       init_disconnect2();
90690       init_downgrade();
90691       init_extract2();
90692       init_merge6();
90693       init_move2();
90694       init_orthogonalize2();
90695       init_paste2();
90696       init_reflect2();
90697       init_reverse2();
90698       init_rotate3();
90699       init_split2();
90700       init_straighten();
90701     }
90702   });
90703
90704   // modules/modes/select.js
90705   var select_exports2 = {};
90706   __export(select_exports2, {
90707     modeSelect: () => modeSelect
90708   });
90709   function modeSelect(context, selectedIDs) {
90710     var mode = {
90711       id: "select",
90712       button: "browse"
90713     };
90714     var keybinding = utilKeybinding("select");
90715     var _breatheBehavior = behaviorBreathe(context);
90716     var _modeDragNode = modeDragNode(context);
90717     var _selectBehavior;
90718     var _behaviors = [];
90719     var _operations = [];
90720     var _newFeature = false;
90721     var _follow = false;
90722     var _focusedParentWayId;
90723     var _focusedVertexIds;
90724     function singular() {
90725       if (selectedIDs && selectedIDs.length === 1) {
90726         return context.hasEntity(selectedIDs[0]);
90727       }
90728     }
90729     function selectedEntities() {
90730       return selectedIDs.map(function(id2) {
90731         return context.hasEntity(id2);
90732       }).filter(Boolean);
90733     }
90734     function checkSelectedIDs() {
90735       var ids = [];
90736       if (Array.isArray(selectedIDs)) {
90737         ids = selectedIDs.filter(function(id2) {
90738           return context.hasEntity(id2);
90739         });
90740       }
90741       if (!ids.length) {
90742         context.enter(modeBrowse(context));
90743         return false;
90744       } else if (selectedIDs.length > 1 && ids.length === 1 || selectedIDs.length === 1 && ids.length > 1) {
90745         context.enter(modeSelect(context, ids));
90746         return false;
90747       }
90748       selectedIDs = ids;
90749       return true;
90750     }
90751     function parentWaysIdsOfSelection(onlyCommonParents) {
90752       var graph = context.graph();
90753       var parents = [];
90754       for (var i3 = 0; i3 < selectedIDs.length; i3++) {
90755         var entity = context.hasEntity(selectedIDs[i3]);
90756         if (!entity || entity.geometry(graph) !== "vertex") {
90757           return [];
90758         }
90759         var currParents = graph.parentWays(entity).map(function(w2) {
90760           return w2.id;
90761         });
90762         if (!parents.length) {
90763           parents = currParents;
90764           continue;
90765         }
90766         parents = (onlyCommonParents ? utilArrayIntersection : utilArrayUnion)(parents, currParents);
90767         if (!parents.length) {
90768           return [];
90769         }
90770       }
90771       return parents;
90772     }
90773     function childNodeIdsOfSelection(onlyCommon) {
90774       var graph = context.graph();
90775       var childs = [];
90776       for (var i3 = 0; i3 < selectedIDs.length; i3++) {
90777         var entity = context.hasEntity(selectedIDs[i3]);
90778         if (!entity || !["area", "line"].includes(entity.geometry(graph))) {
90779           return [];
90780         }
90781         var currChilds = graph.childNodes(entity).map(function(node) {
90782           return node.id;
90783         });
90784         if (!childs.length) {
90785           childs = currChilds;
90786           continue;
90787         }
90788         childs = (onlyCommon ? utilArrayIntersection : utilArrayUnion)(childs, currChilds);
90789         if (!childs.length) {
90790           return [];
90791         }
90792       }
90793       return childs;
90794     }
90795     function checkFocusedParent() {
90796       if (_focusedParentWayId) {
90797         var parents = parentWaysIdsOfSelection(true);
90798         if (parents.indexOf(_focusedParentWayId) === -1) _focusedParentWayId = null;
90799       }
90800     }
90801     function parentWayIdForVertexNavigation() {
90802       var parentIds = parentWaysIdsOfSelection(true);
90803       if (_focusedParentWayId && parentIds.indexOf(_focusedParentWayId) !== -1) {
90804         return _focusedParentWayId;
90805       }
90806       return parentIds.length ? parentIds[0] : null;
90807     }
90808     mode.selectedIDs = function(val) {
90809       if (!arguments.length) return selectedIDs;
90810       selectedIDs = val;
90811       return mode;
90812     };
90813     mode.zoomToSelected = function() {
90814       context.map().zoomToEase(selectedEntities());
90815     };
90816     mode.newFeature = function(val) {
90817       if (!arguments.length) return _newFeature;
90818       _newFeature = val;
90819       return mode;
90820     };
90821     mode.selectBehavior = function(val) {
90822       if (!arguments.length) return _selectBehavior;
90823       _selectBehavior = val;
90824       return mode;
90825     };
90826     mode.follow = function(val) {
90827       if (!arguments.length) return _follow;
90828       _follow = val;
90829       return mode;
90830     };
90831     function loadOperations() {
90832       _operations.forEach(function(operation2) {
90833         if (operation2.behavior) {
90834           context.uninstall(operation2.behavior);
90835         }
90836       });
90837       _operations = Object.values(operations_exports).map(function(o2) {
90838         return o2(context, selectedIDs);
90839       }).filter(function(o2) {
90840         return o2.id !== "delete" && o2.id !== "downgrade" && o2.id !== "copy";
90841       }).concat([
90842         // group copy/downgrade/delete operation together at the end of the list
90843         operationCopy(context, selectedIDs),
90844         operationDowngrade(context, selectedIDs),
90845         operationDelete(context, selectedIDs)
90846       ]).filter(function(operation2) {
90847         return operation2.available();
90848       });
90849       _operations.forEach(function(operation2) {
90850         if (operation2.behavior) {
90851           context.install(operation2.behavior);
90852         }
90853       });
90854       context.ui().closeEditMenu();
90855     }
90856     mode.operations = function() {
90857       return _operations;
90858     };
90859     mode.enter = function() {
90860       if (!checkSelectedIDs()) return;
90861       context.features().forceVisible(selectedIDs);
90862       _modeDragNode.restoreSelectedIDs(selectedIDs);
90863       loadOperations();
90864       if (!_behaviors.length) {
90865         if (!_selectBehavior) _selectBehavior = behaviorSelect(context);
90866         _behaviors = [
90867           behaviorPaste(context),
90868           _breatheBehavior,
90869           behaviorHover(context).on("hover", context.ui().sidebar.hoverModeSelect),
90870           _selectBehavior,
90871           behaviorLasso(context),
90872           _modeDragNode.behavior,
90873           modeDragNote(context).behavior
90874         ];
90875       }
90876       _behaviors.forEach(context.install);
90877       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);
90878       select_default2(document).call(keybinding);
90879       context.ui().sidebar.select(selectedIDs, _newFeature);
90880       context.history().on("change.select", function() {
90881         loadOperations();
90882         selectElements();
90883       }).on("undone.select", checkSelectedIDs).on("redone.select", checkSelectedIDs);
90884       context.map().on("drawn.select", selectElements).on("crossEditableZoom.select", function() {
90885         selectElements();
90886         _breatheBehavior.restartIfNeeded(context.surface());
90887       });
90888       context.map().doubleUpHandler().on("doubleUp.modeSelect", didDoubleUp);
90889       selectElements();
90890       if (_follow) {
90891         var extent = geoExtent();
90892         var graph = context.graph();
90893         selectedIDs.forEach(function(id2) {
90894           var entity = context.entity(id2);
90895           extent._extend(entity.extent(graph));
90896         });
90897         var loc = extent.center();
90898         context.map().centerEase(loc);
90899         _follow = false;
90900       }
90901       function nudgeSelection(delta) {
90902         return function() {
90903           if (!context.map().withinEditableZoom()) return;
90904           var moveOp = operationMove(context, selectedIDs);
90905           if (moveOp.disabled()) {
90906             context.ui().flash.duration(4e3).iconName("#iD-operation-" + moveOp.id).iconClass("operation disabled").label(moveOp.tooltip())();
90907           } else {
90908             context.perform(actionMove(selectedIDs, delta, context.projection), moveOp.annotation());
90909             context.validator().validate();
90910           }
90911         };
90912       }
90913       function scaleSelection(factor) {
90914         return function() {
90915           if (!context.map().withinEditableZoom()) return;
90916           let nodes = utilGetAllNodes(selectedIDs, context.graph());
90917           let isUp = factor > 1;
90918           if (nodes.length <= 1) return;
90919           let extent2 = utilTotalExtent(selectedIDs, context.graph());
90920           function scalingDisabled() {
90921             if (tooSmall()) {
90922               return "too_small";
90923             } else if (extent2.percentContainedIn(context.map().extent()) < 0.8) {
90924               return "too_large";
90925             } else if (someMissing() || selectedIDs.some(incompleteRelation)) {
90926               return "not_downloaded";
90927             } else if (selectedIDs.some(context.hasHiddenConnections)) {
90928               return "connected_to_hidden";
90929             }
90930             return false;
90931             function tooSmall() {
90932               if (isUp) return false;
90933               let dLon = Math.abs(extent2[1][0] - extent2[0][0]);
90934               let dLat = Math.abs(extent2[1][1] - extent2[0][1]);
90935               return dLon < geoMetersToLon(1, extent2[1][1]) && dLat < geoMetersToLat(1);
90936             }
90937             function someMissing() {
90938               if (context.inIntro()) return false;
90939               let osm = context.connection();
90940               if (osm) {
90941                 let missing = nodes.filter(function(n3) {
90942                   return !osm.isDataLoaded(n3.loc);
90943                 });
90944                 if (missing.length) {
90945                   missing.forEach(function(loc2) {
90946                     context.loadTileAtLoc(loc2);
90947                   });
90948                   return true;
90949                 }
90950               }
90951               return false;
90952             }
90953             function incompleteRelation(id2) {
90954               let entity = context.entity(id2);
90955               return entity.type === "relation" && !entity.isComplete(context.graph());
90956             }
90957           }
90958           const disabled = scalingDisabled();
90959           if (disabled) {
90960             let multi = selectedIDs.length === 1 ? "single" : "multiple";
90961             context.ui().flash.duration(4e3).iconName("#iD-icon-no").iconClass("operation disabled").label(_t.append("operations.scale." + disabled + "." + multi))();
90962           } else {
90963             const pivot = context.projection(extent2.center());
90964             const annotation = _t("operations.scale.annotation." + (isUp ? "up" : "down") + ".feature", { n: selectedIDs.length });
90965             context.perform(actionScale(selectedIDs, pivot, factor, context.projection), annotation);
90966             context.validator().validate();
90967           }
90968         };
90969       }
90970       function didDoubleUp(d3_event, loc2) {
90971         if (!context.map().withinEditableZoom()) return;
90972         var target = select_default2(d3_event.target);
90973         var datum2 = target.datum();
90974         var entity = datum2 && datum2.properties && datum2.properties.entity;
90975         if (!entity) return;
90976         if (entity instanceof osmWay && target.classed("target")) {
90977           var choice = geoChooseEdge(context.graph().childNodes(entity), loc2, context.projection);
90978           var prev = entity.nodes[choice.index - 1];
90979           var next = entity.nodes[choice.index];
90980           context.perform(
90981             actionAddMidpoint({ loc: choice.loc, edge: [prev, next] }, osmNode()),
90982             _t("operations.add.annotation.vertex")
90983           );
90984           context.validator().validate();
90985         } else if (entity.type === "midpoint") {
90986           context.perform(
90987             actionAddMidpoint({ loc: entity.loc, edge: entity.edge }, osmNode()),
90988             _t("operations.add.annotation.vertex")
90989           );
90990           context.validator().validate();
90991         }
90992       }
90993       function selectElements() {
90994         if (!checkSelectedIDs()) return;
90995         var surface = context.surface();
90996         surface.selectAll(".selected-member").classed("selected-member", false);
90997         surface.selectAll(".selected").classed("selected", false);
90998         surface.selectAll(".related").classed("related", false);
90999         checkFocusedParent();
91000         if (_focusedParentWayId) {
91001           surface.selectAll(utilEntitySelector([_focusedParentWayId])).classed("related", true);
91002         }
91003         if (context.map().withinEditableZoom()) {
91004           surface.selectAll(utilDeepMemberSelector(
91005             selectedIDs,
91006             context.graph(),
91007             true
91008             /* skipMultipolgonMembers */
91009           )).classed("selected-member", true);
91010           surface.selectAll(utilEntityOrDeepMemberSelector(selectedIDs, context.graph())).classed("selected", true);
91011         }
91012       }
91013       function esc() {
91014         if (context.container().select(".combobox").size()) return;
91015         context.enter(modeBrowse(context));
91016       }
91017       function firstVertex(d3_event) {
91018         d3_event.preventDefault();
91019         var entity = singular();
91020         var parentId = parentWayIdForVertexNavigation();
91021         var way;
91022         if (entity && entity.type === "way") {
91023           way = entity;
91024         } else if (parentId) {
91025           way = context.entity(parentId);
91026         }
91027         _focusedParentWayId = way && way.id;
91028         if (way) {
91029           context.enter(
91030             mode.selectedIDs([way.first()]).follow(true)
91031           );
91032         }
91033       }
91034       function lastVertex(d3_event) {
91035         d3_event.preventDefault();
91036         var entity = singular();
91037         var parentId = parentWayIdForVertexNavigation();
91038         var way;
91039         if (entity && entity.type === "way") {
91040           way = entity;
91041         } else if (parentId) {
91042           way = context.entity(parentId);
91043         }
91044         _focusedParentWayId = way && way.id;
91045         if (way) {
91046           context.enter(
91047             mode.selectedIDs([way.last()]).follow(true)
91048           );
91049         }
91050       }
91051       function previousVertex(d3_event) {
91052         d3_event.preventDefault();
91053         var parentId = parentWayIdForVertexNavigation();
91054         _focusedParentWayId = parentId;
91055         if (!parentId) return;
91056         var way = context.entity(parentId);
91057         var length2 = way.nodes.length;
91058         var curr = way.nodes.indexOf(selectedIDs[0]);
91059         var index = -1;
91060         if (curr > 0) {
91061           index = curr - 1;
91062         } else if (way.isClosed()) {
91063           index = length2 - 2;
91064         }
91065         if (index !== -1) {
91066           context.enter(
91067             mode.selectedIDs([way.nodes[index]]).follow(true)
91068           );
91069         }
91070       }
91071       function nextVertex(d3_event) {
91072         d3_event.preventDefault();
91073         var parentId = parentWayIdForVertexNavigation();
91074         _focusedParentWayId = parentId;
91075         if (!parentId) return;
91076         var way = context.entity(parentId);
91077         var length2 = way.nodes.length;
91078         var curr = way.nodes.indexOf(selectedIDs[0]);
91079         var index = -1;
91080         if (curr < length2 - 1) {
91081           index = curr + 1;
91082         } else if (way.isClosed()) {
91083           index = 0;
91084         }
91085         if (index !== -1) {
91086           context.enter(
91087             mode.selectedIDs([way.nodes[index]]).follow(true)
91088           );
91089         }
91090       }
91091       function focusNextParent(d3_event) {
91092         d3_event.preventDefault();
91093         var parents = parentWaysIdsOfSelection(true);
91094         if (!parents || parents.length < 2) return;
91095         var index = parents.indexOf(_focusedParentWayId);
91096         if (index < 0 || index > parents.length - 2) {
91097           _focusedParentWayId = parents[0];
91098         } else {
91099           _focusedParentWayId = parents[index + 1];
91100         }
91101         var surface = context.surface();
91102         surface.selectAll(".related").classed("related", false);
91103         if (_focusedParentWayId) {
91104           surface.selectAll(utilEntitySelector([_focusedParentWayId])).classed("related", true);
91105         }
91106       }
91107       function selectParent(d3_event) {
91108         d3_event.preventDefault();
91109         var currentSelectedIds = mode.selectedIDs();
91110         var parentIds = _focusedParentWayId ? [_focusedParentWayId] : parentWaysIdsOfSelection(false);
91111         if (!parentIds.length) return;
91112         context.enter(
91113           mode.selectedIDs(parentIds)
91114         );
91115         _focusedVertexIds = currentSelectedIds;
91116       }
91117       function selectChild(d3_event) {
91118         d3_event.preventDefault();
91119         var currentSelectedIds = mode.selectedIDs();
91120         var childIds = _focusedVertexIds ? _focusedVertexIds.filter((id2) => context.hasEntity(id2)) : childNodeIdsOfSelection(true);
91121         if (!childIds || !childIds.length) return;
91122         if (currentSelectedIds.length === 1) _focusedParentWayId = currentSelectedIds[0];
91123         context.enter(
91124           mode.selectedIDs(childIds)
91125         );
91126       }
91127     };
91128     mode.exit = function() {
91129       _newFeature = false;
91130       _focusedVertexIds = null;
91131       _operations.forEach(function(operation2) {
91132         if (operation2.behavior) {
91133           context.uninstall(operation2.behavior);
91134         }
91135       });
91136       _operations = [];
91137       _behaviors.forEach(context.uninstall);
91138       select_default2(document).call(keybinding.unbind);
91139       context.ui().closeEditMenu();
91140       context.history().on("change.select", null).on("undone.select", null).on("redone.select", null);
91141       var surface = context.surface();
91142       surface.selectAll(".selected-member").classed("selected-member", false);
91143       surface.selectAll(".selected").classed("selected", false);
91144       surface.selectAll(".highlighted").classed("highlighted", false);
91145       surface.selectAll(".related").classed("related", false);
91146       context.map().on("drawn.select", null);
91147       context.ui().sidebar.hide();
91148       context.features().forceVisible([]);
91149       var entity = singular();
91150       if (_newFeature && entity && entity.type === "relation" && // no tags
91151       Object.keys(entity.tags).length === 0 && // no parent relations
91152       context.graph().parentRelations(entity).length === 0 && // no members or one member with no role
91153       (entity.members.length === 0 || entity.members.length === 1 && !entity.members[0].role)) {
91154         var deleteAction = actionDeleteRelation(
91155           entity.id,
91156           true
91157           /* don't delete untagged members */
91158         );
91159         context.perform(deleteAction, _t("operations.delete.annotation.relation"));
91160         context.validator().validate();
91161       }
91162     };
91163     return mode;
91164   }
91165   var init_select5 = __esm({
91166     "modules/modes/select.js"() {
91167       "use strict";
91168       init_src5();
91169       init_localizer();
91170       init_add_midpoint();
91171       init_delete_relation();
91172       init_move();
91173       init_scale();
91174       init_breathe();
91175       init_hover();
91176       init_lasso2();
91177       init_paste();
91178       init_select4();
91179       init_move2();
91180       init_geo2();
91181       init_browse();
91182       init_drag_node();
91183       init_drag_note();
91184       init_osm();
91185       init_operations();
91186       init_cmd();
91187       init_util();
91188     }
91189   });
91190
91191   // modules/behavior/lasso.js
91192   var lasso_exports2 = {};
91193   __export(lasso_exports2, {
91194     behaviorLasso: () => behaviorLasso
91195   });
91196   function behaviorLasso(context) {
91197     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
91198     var behavior = function(selection2) {
91199       var lasso;
91200       function pointerdown(d3_event) {
91201         var button = 0;
91202         if (d3_event.button === button && d3_event.shiftKey === true) {
91203           lasso = null;
91204           select_default2(window).on(_pointerPrefix + "move.lasso", pointermove).on(_pointerPrefix + "up.lasso", pointerup);
91205           d3_event.stopPropagation();
91206         }
91207       }
91208       function pointermove() {
91209         if (!lasso) {
91210           lasso = uiLasso(context);
91211           context.surface().call(lasso);
91212         }
91213         lasso.p(context.map().mouse());
91214       }
91215       function normalize2(a2, b2) {
91216         return [
91217           [Math.min(a2[0], b2[0]), Math.min(a2[1], b2[1])],
91218           [Math.max(a2[0], b2[0]), Math.max(a2[1], b2[1])]
91219         ];
91220       }
91221       function lassoed() {
91222         if (!lasso) return [];
91223         var graph = context.graph();
91224         var limitToNodes;
91225         if (context.map().editableDataEnabled(
91226           true
91227           /* skipZoomCheck */
91228         ) && context.map().isInWideSelection()) {
91229           limitToNodes = new Set(utilGetAllNodes(context.selectedIDs(), graph));
91230         } else if (!context.map().editableDataEnabled()) {
91231           return [];
91232         }
91233         var bounds = lasso.extent().map(context.projection.invert);
91234         var extent = geoExtent(normalize2(bounds[0], bounds[1]));
91235         var intersects2 = context.history().intersects(extent).filter(function(entity) {
91236           return entity.type === "node" && (!limitToNodes || limitToNodes.has(entity)) && geoPointInPolygon(context.projection(entity.loc), lasso.coordinates) && !context.features().isHidden(entity, graph, entity.geometry(graph));
91237         });
91238         intersects2.sort(function(node1, node2) {
91239           var parents1 = graph.parentWays(node1);
91240           var parents2 = graph.parentWays(node2);
91241           if (parents1.length && parents2.length) {
91242             var sharedParents = utilArrayIntersection(parents1, parents2);
91243             if (sharedParents.length) {
91244               var sharedParentNodes = sharedParents[0].nodes;
91245               return sharedParentNodes.indexOf(node1.id) - sharedParentNodes.indexOf(node2.id);
91246             } else {
91247               return Number(parents1[0].id.slice(1)) - Number(parents2[0].id.slice(1));
91248             }
91249           } else if (parents1.length || parents2.length) {
91250             return parents1.length - parents2.length;
91251           }
91252           return node1.loc[0] - node2.loc[0];
91253         });
91254         return intersects2.map(function(entity) {
91255           return entity.id;
91256         });
91257       }
91258       function pointerup() {
91259         select_default2(window).on(_pointerPrefix + "move.lasso", null).on(_pointerPrefix + "up.lasso", null);
91260         if (!lasso) return;
91261         var ids = lassoed();
91262         lasso.close();
91263         if (ids.length) {
91264           context.enter(modeSelect(context, ids));
91265         }
91266       }
91267       selection2.on(_pointerPrefix + "down.lasso", pointerdown);
91268     };
91269     behavior.off = function(selection2) {
91270       selection2.on(_pointerPrefix + "down.lasso", null);
91271     };
91272     return behavior;
91273   }
91274   var init_lasso2 = __esm({
91275     "modules/behavior/lasso.js"() {
91276       "use strict";
91277       init_src5();
91278       init_geo2();
91279       init_select5();
91280       init_lasso();
91281       init_array3();
91282       init_util2();
91283     }
91284   });
91285
91286   // modules/modes/browse.js
91287   var browse_exports = {};
91288   __export(browse_exports, {
91289     modeBrowse: () => modeBrowse
91290   });
91291   function modeBrowse(context) {
91292     var mode = {
91293       button: "browse",
91294       id: "browse",
91295       title: _t.append("modes.browse.title"),
91296       description: _t.append("modes.browse.description")
91297     };
91298     var sidebar;
91299     var _selectBehavior;
91300     var _behaviors = [];
91301     mode.selectBehavior = function(val) {
91302       if (!arguments.length) return _selectBehavior;
91303       _selectBehavior = val;
91304       return mode;
91305     };
91306     mode.enter = function() {
91307       if (!_behaviors.length) {
91308         if (!_selectBehavior) _selectBehavior = behaviorSelect(context);
91309         _behaviors = [
91310           behaviorPaste(context),
91311           behaviorHover(context).on("hover", context.ui().sidebar.hover),
91312           _selectBehavior,
91313           behaviorLasso(context),
91314           modeDragNode(context).behavior,
91315           modeDragNote(context).behavior
91316         ];
91317       }
91318       _behaviors.forEach(context.install);
91319       if (document.activeElement && document.activeElement.blur) {
91320         document.activeElement.blur();
91321       }
91322       if (sidebar) {
91323         context.ui().sidebar.show(sidebar);
91324       } else {
91325         context.ui().sidebar.select(null);
91326       }
91327     };
91328     mode.exit = function() {
91329       context.ui().sidebar.hover.cancel();
91330       _behaviors.forEach(context.uninstall);
91331       if (sidebar) {
91332         context.ui().sidebar.hide();
91333       }
91334     };
91335     mode.sidebar = function(_2) {
91336       if (!arguments.length) return sidebar;
91337       sidebar = _2;
91338       return mode;
91339     };
91340     mode.operations = function() {
91341       return [operationPaste(context)];
91342     };
91343     return mode;
91344   }
91345   var init_browse = __esm({
91346     "modules/modes/browse.js"() {
91347       "use strict";
91348       init_localizer();
91349       init_hover();
91350       init_lasso2();
91351       init_paste();
91352       init_select4();
91353       init_drag_node();
91354       init_drag_note();
91355       init_paste2();
91356     }
91357   });
91358
91359   // modules/behavior/add_way.js
91360   var add_way_exports = {};
91361   __export(add_way_exports, {
91362     behaviorAddWay: () => behaviorAddWay
91363   });
91364   function behaviorAddWay(context) {
91365     var dispatch14 = dispatch_default("start", "startFromWay", "startFromNode");
91366     var draw = behaviorDraw(context);
91367     function behavior(surface) {
91368       draw.on("click", function() {
91369         dispatch14.apply("start", this, arguments);
91370       }).on("clickWay", function() {
91371         dispatch14.apply("startFromWay", this, arguments);
91372       }).on("clickNode", function() {
91373         dispatch14.apply("startFromNode", this, arguments);
91374       }).on("cancel", behavior.cancel).on("finish", behavior.cancel);
91375       context.map().dblclickZoomEnable(false);
91376       surface.call(draw);
91377     }
91378     behavior.off = function(surface) {
91379       surface.call(draw.off);
91380     };
91381     behavior.cancel = function() {
91382       window.setTimeout(function() {
91383         context.map().dblclickZoomEnable(true);
91384       }, 1e3);
91385       context.enter(modeBrowse(context));
91386     };
91387     return utilRebind(behavior, dispatch14, "on");
91388   }
91389   var init_add_way = __esm({
91390     "modules/behavior/add_way.js"() {
91391       "use strict";
91392       init_src4();
91393       init_draw();
91394       init_browse();
91395       init_rebind();
91396     }
91397   });
91398
91399   // modules/globals.d.ts
91400   var globals_d_exports = {};
91401   var init_globals_d = __esm({
91402     "modules/globals.d.ts"() {
91403       "use strict";
91404     }
91405   });
91406
91407   // modules/ui/panes/index.js
91408   var panes_exports = {};
91409   __export(panes_exports, {
91410     uiPaneBackground: () => uiPaneBackground,
91411     uiPaneHelp: () => uiPaneHelp,
91412     uiPaneIssues: () => uiPaneIssues,
91413     uiPaneMapData: () => uiPaneMapData,
91414     uiPanePreferences: () => uiPanePreferences
91415   });
91416   var init_panes = __esm({
91417     "modules/ui/panes/index.js"() {
91418       "use strict";
91419       init_background3();
91420       init_help();
91421       init_issues();
91422       init_map_data();
91423       init_preferences2();
91424     }
91425   });
91426
91427   // modules/ui/sections/index.js
91428   var sections_exports = {};
91429   __export(sections_exports, {
91430     uiSectionBackgroundDisplayOptions: () => uiSectionBackgroundDisplayOptions,
91431     uiSectionBackgroundList: () => uiSectionBackgroundList,
91432     uiSectionBackgroundOffset: () => uiSectionBackgroundOffset,
91433     uiSectionChanges: () => uiSectionChanges,
91434     uiSectionDataLayers: () => uiSectionDataLayers,
91435     uiSectionEntityIssues: () => uiSectionEntityIssues,
91436     uiSectionFeatureType: () => uiSectionFeatureType,
91437     uiSectionMapFeatures: () => uiSectionMapFeatures,
91438     uiSectionMapStyleOptions: () => uiSectionMapStyleOptions,
91439     uiSectionOverlayList: () => uiSectionOverlayList,
91440     uiSectionPhotoOverlays: () => uiSectionPhotoOverlays,
91441     uiSectionPresetFields: () => uiSectionPresetFields,
91442     uiSectionPrivacy: () => uiSectionPrivacy,
91443     uiSectionRawMemberEditor: () => uiSectionRawMemberEditor,
91444     uiSectionRawMembershipEditor: () => uiSectionRawMembershipEditor,
91445     uiSectionRawTagEditor: () => uiSectionRawTagEditor,
91446     uiSectionSelectionList: () => uiSectionSelectionList,
91447     uiSectionValidationIssues: () => uiSectionValidationIssues,
91448     uiSectionValidationOptions: () => uiSectionValidationOptions,
91449     uiSectionValidationRules: () => uiSectionValidationRules,
91450     uiSectionValidationStatus: () => uiSectionValidationStatus
91451   });
91452   var init_sections = __esm({
91453     "modules/ui/sections/index.js"() {
91454       "use strict";
91455       init_background_display_options();
91456       init_background_list();
91457       init_background_offset();
91458       init_changes();
91459       init_data_layers();
91460       init_entity_issues();
91461       init_feature_type();
91462       init_map_features();
91463       init_map_style_options();
91464       init_overlay_list();
91465       init_photo_overlays();
91466       init_preset_fields();
91467       init_privacy();
91468       init_raw_member_editor();
91469       init_raw_membership_editor();
91470       init_raw_tag_editor();
91471       init_selection_list();
91472       init_validation_issues();
91473       init_validation_options();
91474       init_validation_rules();
91475       init_validation_status();
91476     }
91477   });
91478
91479   // modules/ui/settings/index.js
91480   var settings_exports = {};
91481   __export(settings_exports, {
91482     uiSettingsCustomBackground: () => uiSettingsCustomBackground,
91483     uiSettingsCustomData: () => uiSettingsCustomData
91484   });
91485   var init_settings = __esm({
91486     "modules/ui/settings/index.js"() {
91487       "use strict";
91488       init_custom_background();
91489       init_custom_data();
91490     }
91491   });
91492
91493   // import("../**/*") in modules/core/file_fetcher.js
91494   var globImport;
91495   var init_ = __esm({
91496     'import("../**/*") in modules/core/file_fetcher.js'() {
91497       globImport = __glob({
91498         "../actions/add_entity.js": () => Promise.resolve().then(() => (init_add_entity(), add_entity_exports)),
91499         "../actions/add_member.js": () => Promise.resolve().then(() => (init_add_member(), add_member_exports)),
91500         "../actions/add_midpoint.js": () => Promise.resolve().then(() => (init_add_midpoint(), add_midpoint_exports)),
91501         "../actions/add_vertex.js": () => Promise.resolve().then(() => (init_add_vertex(), add_vertex_exports)),
91502         "../actions/change_member.js": () => Promise.resolve().then(() => (init_change_member(), change_member_exports)),
91503         "../actions/change_preset.js": () => Promise.resolve().then(() => (init_change_preset(), change_preset_exports)),
91504         "../actions/change_tags.js": () => Promise.resolve().then(() => (init_change_tags(), change_tags_exports)),
91505         "../actions/circularize.js": () => Promise.resolve().then(() => (init_circularize(), circularize_exports)),
91506         "../actions/connect.js": () => Promise.resolve().then(() => (init_connect(), connect_exports)),
91507         "../actions/copy_entities.js": () => Promise.resolve().then(() => (init_copy_entities(), copy_entities_exports)),
91508         "../actions/delete_member.js": () => Promise.resolve().then(() => (init_delete_member(), delete_member_exports)),
91509         "../actions/delete_members.js": () => Promise.resolve().then(() => (init_delete_members(), delete_members_exports)),
91510         "../actions/delete_multiple.js": () => Promise.resolve().then(() => (init_delete_multiple(), delete_multiple_exports)),
91511         "../actions/delete_node.js": () => Promise.resolve().then(() => (init_delete_node(), delete_node_exports)),
91512         "../actions/delete_relation.js": () => Promise.resolve().then(() => (init_delete_relation(), delete_relation_exports)),
91513         "../actions/delete_way.js": () => Promise.resolve().then(() => (init_delete_way(), delete_way_exports)),
91514         "../actions/discard_tags.js": () => Promise.resolve().then(() => (init_discard_tags(), discard_tags_exports)),
91515         "../actions/disconnect.js": () => Promise.resolve().then(() => (init_disconnect(), disconnect_exports)),
91516         "../actions/extract.js": () => Promise.resolve().then(() => (init_extract(), extract_exports)),
91517         "../actions/index.js": () => Promise.resolve().then(() => (init_actions(), actions_exports)),
91518         "../actions/join.js": () => Promise.resolve().then(() => (init_join2(), join_exports)),
91519         "../actions/merge.js": () => Promise.resolve().then(() => (init_merge5(), merge_exports)),
91520         "../actions/merge_nodes.js": () => Promise.resolve().then(() => (init_merge_nodes(), merge_nodes_exports)),
91521         "../actions/merge_polygon.js": () => Promise.resolve().then(() => (init_merge_polygon(), merge_polygon_exports)),
91522         "../actions/merge_remote_changes.js": () => Promise.resolve().then(() => (init_merge_remote_changes(), merge_remote_changes_exports)),
91523         "../actions/move.js": () => Promise.resolve().then(() => (init_move(), move_exports)),
91524         "../actions/move_member.js": () => Promise.resolve().then(() => (init_move_member(), move_member_exports)),
91525         "../actions/move_node.js": () => Promise.resolve().then(() => (init_move_node(), move_node_exports)),
91526         "../actions/noop.js": () => Promise.resolve().then(() => (init_noop2(), noop_exports)),
91527         "../actions/orthogonalize.js": () => Promise.resolve().then(() => (init_orthogonalize(), orthogonalize_exports)),
91528         "../actions/reflect.js": () => Promise.resolve().then(() => (init_reflect(), reflect_exports)),
91529         "../actions/restrict_turn.js": () => Promise.resolve().then(() => (init_restrict_turn(), restrict_turn_exports)),
91530         "../actions/reverse.js": () => Promise.resolve().then(() => (init_reverse(), reverse_exports)),
91531         "../actions/revert.js": () => Promise.resolve().then(() => (init_revert(), revert_exports)),
91532         "../actions/rotate.js": () => Promise.resolve().then(() => (init_rotate(), rotate_exports)),
91533         "../actions/scale.js": () => Promise.resolve().then(() => (init_scale(), scale_exports)),
91534         "../actions/split.js": () => Promise.resolve().then(() => (init_split(), split_exports)),
91535         "../actions/straighten_nodes.js": () => Promise.resolve().then(() => (init_straighten_nodes(), straighten_nodes_exports)),
91536         "../actions/straighten_way.js": () => Promise.resolve().then(() => (init_straighten_way(), straighten_way_exports)),
91537         "../actions/unrestrict_turn.js": () => Promise.resolve().then(() => (init_unrestrict_turn(), unrestrict_turn_exports)),
91538         "../actions/upgrade_tags.js": () => Promise.resolve().then(() => (init_upgrade_tags(), upgrade_tags_exports)),
91539         "../behavior/add_way.js": () => Promise.resolve().then(() => (init_add_way(), add_way_exports)),
91540         "../behavior/breathe.js": () => Promise.resolve().then(() => (init_breathe(), breathe_exports)),
91541         "../behavior/drag.js": () => Promise.resolve().then(() => (init_drag2(), drag_exports)),
91542         "../behavior/draw.js": () => Promise.resolve().then(() => (init_draw(), draw_exports)),
91543         "../behavior/draw_way.js": () => Promise.resolve().then(() => (init_draw_way(), draw_way_exports)),
91544         "../behavior/edit.js": () => Promise.resolve().then(() => (init_edit(), edit_exports)),
91545         "../behavior/hash.js": () => Promise.resolve().then(() => (init_hash(), hash_exports)),
91546         "../behavior/hover.js": () => Promise.resolve().then(() => (init_hover(), hover_exports)),
91547         "../behavior/index.js": () => Promise.resolve().then(() => (init_behavior(), behavior_exports)),
91548         "../behavior/lasso.js": () => Promise.resolve().then(() => (init_lasso2(), lasso_exports2)),
91549         "../behavior/operation.js": () => Promise.resolve().then(() => (init_operation(), operation_exports)),
91550         "../behavior/paste.js": () => Promise.resolve().then(() => (init_paste(), paste_exports)),
91551         "../behavior/select.js": () => Promise.resolve().then(() => (init_select4(), select_exports)),
91552         "../core/LocationManager.js": () => Promise.resolve().then(() => (init_LocationManager(), LocationManager_exports)),
91553         "../core/context.js": () => Promise.resolve().then(() => (init_context2(), context_exports)),
91554         "../core/difference.js": () => Promise.resolve().then(() => (init_difference(), difference_exports)),
91555         "../core/file_fetcher.js": () => Promise.resolve().then(() => (init_file_fetcher(), file_fetcher_exports)),
91556         "../core/graph.js": () => Promise.resolve().then(() => (init_graph(), graph_exports)),
91557         "../core/history.js": () => Promise.resolve().then(() => (init_history(), history_exports)),
91558         "../core/index.js": () => Promise.resolve().then(() => (init_core(), core_exports)),
91559         "../core/localizer.js": () => Promise.resolve().then(() => (init_localizer(), localizer_exports)),
91560         "../core/preferences.js": () => Promise.resolve().then(() => (init_preferences(), preferences_exports)),
91561         "../core/tree.js": () => Promise.resolve().then(() => (init_tree(), tree_exports)),
91562         "../core/uploader.js": () => Promise.resolve().then(() => (init_uploader(), uploader_exports)),
91563         "../core/validation/index.js": () => Promise.resolve().then(() => (init_validation(), validation_exports)),
91564         "../core/validation/models.js": () => Promise.resolve().then(() => (init_models(), models_exports)),
91565         "../core/validator.js": () => Promise.resolve().then(() => (init_validator(), validator_exports)),
91566         "../geo/extent.js": () => Promise.resolve().then(() => (init_extent(), extent_exports)),
91567         "../geo/geo.js": () => Promise.resolve().then(() => (init_geo(), geo_exports)),
91568         "../geo/geom.js": () => Promise.resolve().then(() => (init_geom(), geom_exports)),
91569         "../geo/index.js": () => Promise.resolve().then(() => (init_geo2(), geo_exports2)),
91570         "../geo/ortho.js": () => Promise.resolve().then(() => (init_ortho(), ortho_exports)),
91571         "../geo/raw_mercator.js": () => Promise.resolve().then(() => (init_raw_mercator(), raw_mercator_exports)),
91572         "../geo/vector.js": () => Promise.resolve().then(() => (init_vector(), vector_exports)),
91573         "../globals.d.ts": () => Promise.resolve().then(() => (init_globals_d(), globals_d_exports)),
91574         "../id.js": () => Promise.resolve().then(() => (init_id2(), id_exports)),
91575         "../index.js": () => Promise.resolve().then(() => (init_index(), index_exports)),
91576         "../modes/add_area.js": () => Promise.resolve().then(() => (init_add_area(), add_area_exports)),
91577         "../modes/add_line.js": () => Promise.resolve().then(() => (init_add_line(), add_line_exports)),
91578         "../modes/add_note.js": () => Promise.resolve().then(() => (init_add_note(), add_note_exports)),
91579         "../modes/add_point.js": () => Promise.resolve().then(() => (init_add_point(), add_point_exports)),
91580         "../modes/browse.js": () => Promise.resolve().then(() => (init_browse(), browse_exports)),
91581         "../modes/drag_node.js": () => Promise.resolve().then(() => (init_drag_node(), drag_node_exports)),
91582         "../modes/drag_note.js": () => Promise.resolve().then(() => (init_drag_note(), drag_note_exports)),
91583         "../modes/draw_area.js": () => Promise.resolve().then(() => (init_draw_area(), draw_area_exports)),
91584         "../modes/draw_line.js": () => Promise.resolve().then(() => (init_draw_line(), draw_line_exports)),
91585         "../modes/index.js": () => Promise.resolve().then(() => (init_modes2(), modes_exports2)),
91586         "../modes/move.js": () => Promise.resolve().then(() => (init_move3(), move_exports3)),
91587         "../modes/rotate.js": () => Promise.resolve().then(() => (init_rotate2(), rotate_exports2)),
91588         "../modes/save.js": () => Promise.resolve().then(() => (init_save2(), save_exports2)),
91589         "../modes/select.js": () => Promise.resolve().then(() => (init_select5(), select_exports2)),
91590         "../modes/select_data.js": () => Promise.resolve().then(() => (init_select_data(), select_data_exports)),
91591         "../modes/select_error.js": () => Promise.resolve().then(() => (init_select_error(), select_error_exports)),
91592         "../modes/select_note.js": () => Promise.resolve().then(() => (init_select_note(), select_note_exports)),
91593         "../operations/circularize.js": () => Promise.resolve().then(() => (init_circularize2(), circularize_exports2)),
91594         "../operations/continue.js": () => Promise.resolve().then(() => (init_continue(), continue_exports)),
91595         "../operations/copy.js": () => Promise.resolve().then(() => (init_copy(), copy_exports)),
91596         "../operations/delete.js": () => Promise.resolve().then(() => (init_delete(), delete_exports)),
91597         "../operations/disconnect.js": () => Promise.resolve().then(() => (init_disconnect2(), disconnect_exports2)),
91598         "../operations/downgrade.js": () => Promise.resolve().then(() => (init_downgrade(), downgrade_exports)),
91599         "../operations/extract.js": () => Promise.resolve().then(() => (init_extract2(), extract_exports2)),
91600         "../operations/index.js": () => Promise.resolve().then(() => (init_operations(), operations_exports)),
91601         "../operations/merge.js": () => Promise.resolve().then(() => (init_merge6(), merge_exports2)),
91602         "../operations/move.js": () => Promise.resolve().then(() => (init_move2(), move_exports2)),
91603         "../operations/orthogonalize.js": () => Promise.resolve().then(() => (init_orthogonalize2(), orthogonalize_exports2)),
91604         "../operations/paste.js": () => Promise.resolve().then(() => (init_paste2(), paste_exports2)),
91605         "../operations/reflect.js": () => Promise.resolve().then(() => (init_reflect2(), reflect_exports2)),
91606         "../operations/reverse.js": () => Promise.resolve().then(() => (init_reverse2(), reverse_exports2)),
91607         "../operations/rotate.js": () => Promise.resolve().then(() => (init_rotate3(), rotate_exports3)),
91608         "../operations/split.js": () => Promise.resolve().then(() => (init_split2(), split_exports2)),
91609         "../operations/straighten.js": () => Promise.resolve().then(() => (init_straighten(), straighten_exports)),
91610         "../osm/changeset.js": () => Promise.resolve().then(() => (init_changeset(), changeset_exports)),
91611         "../osm/deprecated.js": () => Promise.resolve().then(() => (init_deprecated(), deprecated_exports)),
91612         "../osm/entity.js": () => Promise.resolve().then(() => (init_entity(), entity_exports)),
91613         "../osm/index.js": () => Promise.resolve().then(() => (init_osm(), osm_exports)),
91614         "../osm/intersection.js": () => Promise.resolve().then(() => (init_intersection(), intersection_exports)),
91615         "../osm/lanes.js": () => Promise.resolve().then(() => (init_lanes(), lanes_exports)),
91616         "../osm/multipolygon.js": () => Promise.resolve().then(() => (init_multipolygon(), multipolygon_exports)),
91617         "../osm/node.js": () => Promise.resolve().then(() => (init_node2(), node_exports)),
91618         "../osm/note.js": () => Promise.resolve().then(() => (init_note(), note_exports)),
91619         "../osm/qa_item.js": () => Promise.resolve().then(() => (init_qa_item(), qa_item_exports)),
91620         "../osm/relation.js": () => Promise.resolve().then(() => (init_relation(), relation_exports)),
91621         "../osm/tags.js": () => Promise.resolve().then(() => (init_tags(), tags_exports)),
91622         "../osm/way.js": () => Promise.resolve().then(() => (init_way(), way_exports)),
91623         "../presets/category.js": () => Promise.resolve().then(() => (init_category(), category_exports)),
91624         "../presets/collection.js": () => Promise.resolve().then(() => (init_collection(), collection_exports)),
91625         "../presets/field.js": () => Promise.resolve().then(() => (init_field(), field_exports)),
91626         "../presets/index.js": () => Promise.resolve().then(() => (init_presets(), presets_exports)),
91627         "../presets/preset.js": () => Promise.resolve().then(() => (init_preset(), preset_exports)),
91628         "../renderer/background.js": () => Promise.resolve().then(() => (init_background2(), background_exports2)),
91629         "../renderer/background_source.js": () => Promise.resolve().then(() => (init_background_source(), background_source_exports)),
91630         "../renderer/features.js": () => Promise.resolve().then(() => (init_features(), features_exports)),
91631         "../renderer/index.js": () => Promise.resolve().then(() => (init_renderer(), renderer_exports)),
91632         "../renderer/map.js": () => Promise.resolve().then(() => (init_map(), map_exports)),
91633         "../renderer/photos.js": () => Promise.resolve().then(() => (init_photos(), photos_exports)),
91634         "../renderer/tile_layer.js": () => Promise.resolve().then(() => (init_tile_layer(), tile_layer_exports)),
91635         "../services/index.js": () => Promise.resolve().then(() => (init_services(), services_exports)),
91636         "../services/kartaview.js": () => Promise.resolve().then(() => (init_kartaview(), kartaview_exports)),
91637         "../services/keepRight.js": () => Promise.resolve().then(() => (init_keepRight(), keepRight_exports)),
91638         "../services/mapilio.js": () => Promise.resolve().then(() => (init_mapilio(), mapilio_exports)),
91639         "../services/mapillary.js": () => Promise.resolve().then(() => (init_mapillary(), mapillary_exports)),
91640         "../services/maprules.js": () => Promise.resolve().then(() => (init_maprules(), maprules_exports)),
91641         "../services/nominatim.js": () => Promise.resolve().then(() => (init_nominatim(), nominatim_exports)),
91642         "../services/nsi.js": () => Promise.resolve().then(() => (init_nsi(), nsi_exports)),
91643         "../services/osm.js": () => Promise.resolve().then(() => (init_osm3(), osm_exports3)),
91644         "../services/osm_wikibase.js": () => Promise.resolve().then(() => (init_osm_wikibase(), osm_wikibase_exports)),
91645         "../services/osmose.js": () => Promise.resolve().then(() => (init_osmose(), osmose_exports)),
91646         "../services/pannellum_photo.js": () => Promise.resolve().then(() => (init_pannellum_photo(), pannellum_photo_exports)),
91647         "../services/panoramax.js": () => Promise.resolve().then(() => (init_panoramax(), panoramax_exports)),
91648         "../services/plane_photo.js": () => Promise.resolve().then(() => (init_plane_photo(), plane_photo_exports)),
91649         "../services/streetside.js": () => Promise.resolve().then(() => (init_streetside2(), streetside_exports2)),
91650         "../services/taginfo.js": () => Promise.resolve().then(() => (init_taginfo(), taginfo_exports)),
91651         "../services/vector_tile.js": () => Promise.resolve().then(() => (init_vector_tile2(), vector_tile_exports)),
91652         "../services/vegbilder.js": () => Promise.resolve().then(() => (init_vegbilder2(), vegbilder_exports2)),
91653         "../services/wikidata.js": () => Promise.resolve().then(() => (init_wikidata2(), wikidata_exports2)),
91654         "../services/wikipedia.js": () => Promise.resolve().then(() => (init_wikipedia2(), wikipedia_exports2)),
91655         "../svg/areas.js": () => Promise.resolve().then(() => (init_areas(), areas_exports)),
91656         "../svg/data.js": () => Promise.resolve().then(() => (init_data2(), data_exports)),
91657         "../svg/debug.js": () => Promise.resolve().then(() => (init_debug(), debug_exports)),
91658         "../svg/defs.js": () => Promise.resolve().then(() => (init_defs(), defs_exports)),
91659         "../svg/geolocate.js": () => Promise.resolve().then(() => (init_geolocate(), geolocate_exports)),
91660         "../svg/helpers.js": () => Promise.resolve().then(() => (init_helpers(), helpers_exports)),
91661         "../svg/icon.js": () => Promise.resolve().then(() => (init_icon(), icon_exports)),
91662         "../svg/index.js": () => Promise.resolve().then(() => (init_svg(), svg_exports)),
91663         "../svg/kartaview_images.js": () => Promise.resolve().then(() => (init_kartaview_images(), kartaview_images_exports)),
91664         "../svg/keepRight.js": () => Promise.resolve().then(() => (init_keepRight2(), keepRight_exports2)),
91665         "../svg/labels.js": () => Promise.resolve().then(() => (init_labels(), labels_exports)),
91666         "../svg/layers.js": () => Promise.resolve().then(() => (init_layers(), layers_exports)),
91667         "../svg/lines.js": () => Promise.resolve().then(() => (init_lines(), lines_exports)),
91668         "../svg/local_photos.js": () => Promise.resolve().then(() => (init_local_photos(), local_photos_exports)),
91669         "../svg/mapilio_images.js": () => Promise.resolve().then(() => (init_mapilio_images(), mapilio_images_exports)),
91670         "../svg/mapillary_images.js": () => Promise.resolve().then(() => (init_mapillary_images(), mapillary_images_exports)),
91671         "../svg/mapillary_map_features.js": () => Promise.resolve().then(() => (init_mapillary_map_features(), mapillary_map_features_exports)),
91672         "../svg/mapillary_position.js": () => Promise.resolve().then(() => (init_mapillary_position(), mapillary_position_exports)),
91673         "../svg/mapillary_signs.js": () => Promise.resolve().then(() => (init_mapillary_signs(), mapillary_signs_exports)),
91674         "../svg/midpoints.js": () => Promise.resolve().then(() => (init_midpoints(), midpoints_exports)),
91675         "../svg/notes.js": () => Promise.resolve().then(() => (init_notes(), notes_exports)),
91676         "../svg/osm.js": () => Promise.resolve().then(() => (init_osm2(), osm_exports2)),
91677         "../svg/osmose.js": () => Promise.resolve().then(() => (init_osmose2(), osmose_exports2)),
91678         "../svg/panoramax_images.js": () => Promise.resolve().then(() => (init_panoramax_images(), panoramax_images_exports)),
91679         "../svg/points.js": () => Promise.resolve().then(() => (init_points(), points_exports)),
91680         "../svg/streetside.js": () => Promise.resolve().then(() => (init_streetside(), streetside_exports)),
91681         "../svg/tag_classes.js": () => Promise.resolve().then(() => (init_tag_classes(), tag_classes_exports)),
91682         "../svg/tag_pattern.js": () => Promise.resolve().then(() => (init_tag_pattern(), tag_pattern_exports)),
91683         "../svg/touch.js": () => Promise.resolve().then(() => (init_touch(), touch_exports)),
91684         "../svg/turns.js": () => Promise.resolve().then(() => (init_turns(), turns_exports)),
91685         "../svg/vegbilder.js": () => Promise.resolve().then(() => (init_vegbilder(), vegbilder_exports)),
91686         "../svg/vertices.js": () => Promise.resolve().then(() => (init_vertices(), vertices_exports)),
91687         "../ui/account.js": () => Promise.resolve().then(() => (init_account(), account_exports)),
91688         "../ui/attribution.js": () => Promise.resolve().then(() => (init_attribution(), attribution_exports)),
91689         "../ui/changeset_editor.js": () => Promise.resolve().then(() => (init_changeset_editor(), changeset_editor_exports)),
91690         "../ui/cmd.js": () => Promise.resolve().then(() => (init_cmd(), cmd_exports)),
91691         "../ui/combobox.js": () => Promise.resolve().then(() => (init_combobox(), combobox_exports)),
91692         "../ui/commit.js": () => Promise.resolve().then(() => (init_commit(), commit_exports)),
91693         "../ui/commit_warnings.js": () => Promise.resolve().then(() => (init_commit_warnings(), commit_warnings_exports)),
91694         "../ui/confirm.js": () => Promise.resolve().then(() => (init_confirm(), confirm_exports)),
91695         "../ui/conflicts.js": () => Promise.resolve().then(() => (init_conflicts(), conflicts_exports)),
91696         "../ui/contributors.js": () => Promise.resolve().then(() => (init_contributors(), contributors_exports)),
91697         "../ui/curtain.js": () => Promise.resolve().then(() => (init_curtain(), curtain_exports)),
91698         "../ui/data_editor.js": () => Promise.resolve().then(() => (init_data_editor(), data_editor_exports)),
91699         "../ui/data_header.js": () => Promise.resolve().then(() => (init_data_header(), data_header_exports)),
91700         "../ui/disclosure.js": () => Promise.resolve().then(() => (init_disclosure(), disclosure_exports)),
91701         "../ui/edit_menu.js": () => Promise.resolve().then(() => (init_edit_menu(), edit_menu_exports)),
91702         "../ui/entity_editor.js": () => Promise.resolve().then(() => (init_entity_editor(), entity_editor_exports)),
91703         "../ui/feature_info.js": () => Promise.resolve().then(() => (init_feature_info(), feature_info_exports)),
91704         "../ui/feature_list.js": () => Promise.resolve().then(() => (init_feature_list(), feature_list_exports)),
91705         "../ui/field.js": () => Promise.resolve().then(() => (init_field2(), field_exports2)),
91706         "../ui/field_help.js": () => Promise.resolve().then(() => (init_field_help(), field_help_exports)),
91707         "../ui/fields/access.js": () => Promise.resolve().then(() => (init_access(), access_exports)),
91708         "../ui/fields/address.js": () => Promise.resolve().then(() => (init_address(), address_exports)),
91709         "../ui/fields/check.js": () => Promise.resolve().then(() => (init_check(), check_exports)),
91710         "../ui/fields/combo.js": () => Promise.resolve().then(() => (init_combo(), combo_exports)),
91711         "../ui/fields/directional_combo.js": () => Promise.resolve().then(() => (init_directional_combo(), directional_combo_exports)),
91712         "../ui/fields/index.js": () => Promise.resolve().then(() => (init_fields(), fields_exports)),
91713         "../ui/fields/input.js": () => Promise.resolve().then(() => (init_input(), input_exports)),
91714         "../ui/fields/lanes.js": () => Promise.resolve().then(() => (init_lanes2(), lanes_exports2)),
91715         "../ui/fields/localized.js": () => Promise.resolve().then(() => (init_localized(), localized_exports)),
91716         "../ui/fields/radio.js": () => Promise.resolve().then(() => (init_radio(), radio_exports)),
91717         "../ui/fields/restrictions.js": () => Promise.resolve().then(() => (init_restrictions(), restrictions_exports)),
91718         "../ui/fields/roadheight.js": () => Promise.resolve().then(() => (init_roadheight(), roadheight_exports)),
91719         "../ui/fields/roadspeed.js": () => Promise.resolve().then(() => (init_roadspeed(), roadspeed_exports)),
91720         "../ui/fields/textarea.js": () => Promise.resolve().then(() => (init_textarea(), textarea_exports)),
91721         "../ui/fields/wikidata.js": () => Promise.resolve().then(() => (init_wikidata(), wikidata_exports)),
91722         "../ui/fields/wikipedia.js": () => Promise.resolve().then(() => (init_wikipedia(), wikipedia_exports)),
91723         "../ui/flash.js": () => Promise.resolve().then(() => (init_flash(), flash_exports)),
91724         "../ui/form_fields.js": () => Promise.resolve().then(() => (init_form_fields(), form_fields_exports)),
91725         "../ui/full_screen.js": () => Promise.resolve().then(() => (init_full_screen(), full_screen_exports)),
91726         "../ui/geolocate.js": () => Promise.resolve().then(() => (init_geolocate2(), geolocate_exports2)),
91727         "../ui/index.js": () => Promise.resolve().then(() => (init_ui(), ui_exports)),
91728         "../ui/info.js": () => Promise.resolve().then(() => (init_info(), info_exports)),
91729         "../ui/init.js": () => Promise.resolve().then(() => (init_init2(), init_exports)),
91730         "../ui/inspector.js": () => Promise.resolve().then(() => (init_inspector(), inspector_exports)),
91731         "../ui/intro/area.js": () => Promise.resolve().then(() => (init_area4(), area_exports)),
91732         "../ui/intro/building.js": () => Promise.resolve().then(() => (init_building(), building_exports)),
91733         "../ui/intro/helper.js": () => Promise.resolve().then(() => (init_helper(), helper_exports)),
91734         "../ui/intro/index.js": () => Promise.resolve().then(() => (init_intro2(), intro_exports2)),
91735         "../ui/intro/intro.js": () => Promise.resolve().then(() => (init_intro(), intro_exports)),
91736         "../ui/intro/line.js": () => Promise.resolve().then(() => (init_line2(), line_exports)),
91737         "../ui/intro/navigation.js": () => Promise.resolve().then(() => (init_navigation(), navigation_exports)),
91738         "../ui/intro/point.js": () => Promise.resolve().then(() => (init_point(), point_exports)),
91739         "../ui/intro/start_editing.js": () => Promise.resolve().then(() => (init_start_editing(), start_editing_exports)),
91740         "../ui/intro/welcome.js": () => Promise.resolve().then(() => (init_welcome(), welcome_exports)),
91741         "../ui/issues_info.js": () => Promise.resolve().then(() => (init_issues_info(), issues_info_exports)),
91742         "../ui/keepRight_details.js": () => Promise.resolve().then(() => (init_keepRight_details(), keepRight_details_exports)),
91743         "../ui/keepRight_editor.js": () => Promise.resolve().then(() => (init_keepRight_editor(), keepRight_editor_exports)),
91744         "../ui/keepRight_header.js": () => Promise.resolve().then(() => (init_keepRight_header(), keepRight_header_exports)),
91745         "../ui/lasso.js": () => Promise.resolve().then(() => (init_lasso(), lasso_exports)),
91746         "../ui/length_indicator.js": () => Promise.resolve().then(() => (init_length_indicator(), length_indicator_exports)),
91747         "../ui/loading.js": () => Promise.resolve().then(() => (init_loading(), loading_exports)),
91748         "../ui/map_in_map.js": () => Promise.resolve().then(() => (init_map_in_map(), map_in_map_exports)),
91749         "../ui/modal.js": () => Promise.resolve().then(() => (init_modal(), modal_exports)),
91750         "../ui/note_comments.js": () => Promise.resolve().then(() => (init_note_comments(), note_comments_exports)),
91751         "../ui/note_editor.js": () => Promise.resolve().then(() => (init_note_editor(), note_editor_exports)),
91752         "../ui/note_header.js": () => Promise.resolve().then(() => (init_note_header(), note_header_exports)),
91753         "../ui/note_report.js": () => Promise.resolve().then(() => (init_note_report(), note_report_exports)),
91754         "../ui/notice.js": () => Promise.resolve().then(() => (init_notice(), notice_exports)),
91755         "../ui/osmose_details.js": () => Promise.resolve().then(() => (init_osmose_details(), osmose_details_exports)),
91756         "../ui/osmose_editor.js": () => Promise.resolve().then(() => (init_osmose_editor(), osmose_editor_exports)),
91757         "../ui/osmose_header.js": () => Promise.resolve().then(() => (init_osmose_header(), osmose_header_exports)),
91758         "../ui/pane.js": () => Promise.resolve().then(() => (init_pane(), pane_exports)),
91759         "../ui/panels/background.js": () => Promise.resolve().then(() => (init_background(), background_exports)),
91760         "../ui/panels/history.js": () => Promise.resolve().then(() => (init_history2(), history_exports2)),
91761         "../ui/panels/index.js": () => Promise.resolve().then(() => (init_panels(), panels_exports)),
91762         "../ui/panels/location.js": () => Promise.resolve().then(() => (init_location(), location_exports)),
91763         "../ui/panels/measurement.js": () => Promise.resolve().then(() => (init_measurement(), measurement_exports)),
91764         "../ui/panes/background.js": () => Promise.resolve().then(() => (init_background3(), background_exports3)),
91765         "../ui/panes/help.js": () => Promise.resolve().then(() => (init_help(), help_exports)),
91766         "../ui/panes/index.js": () => Promise.resolve().then(() => (init_panes(), panes_exports)),
91767         "../ui/panes/issues.js": () => Promise.resolve().then(() => (init_issues(), issues_exports)),
91768         "../ui/panes/map_data.js": () => Promise.resolve().then(() => (init_map_data(), map_data_exports)),
91769         "../ui/panes/preferences.js": () => Promise.resolve().then(() => (init_preferences2(), preferences_exports2)),
91770         "../ui/photoviewer.js": () => Promise.resolve().then(() => (init_photoviewer(), photoviewer_exports)),
91771         "../ui/popover.js": () => Promise.resolve().then(() => (init_popover(), popover_exports)),
91772         "../ui/preset_icon.js": () => Promise.resolve().then(() => (init_preset_icon(), preset_icon_exports)),
91773         "../ui/preset_list.js": () => Promise.resolve().then(() => (init_preset_list(), preset_list_exports)),
91774         "../ui/restore.js": () => Promise.resolve().then(() => (init_restore(), restore_exports)),
91775         "../ui/scale.js": () => Promise.resolve().then(() => (init_scale2(), scale_exports2)),
91776         "../ui/section.js": () => Promise.resolve().then(() => (init_section(), section_exports)),
91777         "../ui/sections/background_display_options.js": () => Promise.resolve().then(() => (init_background_display_options(), background_display_options_exports)),
91778         "../ui/sections/background_list.js": () => Promise.resolve().then(() => (init_background_list(), background_list_exports)),
91779         "../ui/sections/background_offset.js": () => Promise.resolve().then(() => (init_background_offset(), background_offset_exports)),
91780         "../ui/sections/changes.js": () => Promise.resolve().then(() => (init_changes(), changes_exports)),
91781         "../ui/sections/data_layers.js": () => Promise.resolve().then(() => (init_data_layers(), data_layers_exports)),
91782         "../ui/sections/entity_issues.js": () => Promise.resolve().then(() => (init_entity_issues(), entity_issues_exports)),
91783         "../ui/sections/feature_type.js": () => Promise.resolve().then(() => (init_feature_type(), feature_type_exports)),
91784         "../ui/sections/index.js": () => Promise.resolve().then(() => (init_sections(), sections_exports)),
91785         "../ui/sections/map_features.js": () => Promise.resolve().then(() => (init_map_features(), map_features_exports)),
91786         "../ui/sections/map_style_options.js": () => Promise.resolve().then(() => (init_map_style_options(), map_style_options_exports)),
91787         "../ui/sections/overlay_list.js": () => Promise.resolve().then(() => (init_overlay_list(), overlay_list_exports)),
91788         "../ui/sections/photo_overlays.js": () => Promise.resolve().then(() => (init_photo_overlays(), photo_overlays_exports)),
91789         "../ui/sections/preset_fields.js": () => Promise.resolve().then(() => (init_preset_fields(), preset_fields_exports)),
91790         "../ui/sections/privacy.js": () => Promise.resolve().then(() => (init_privacy(), privacy_exports)),
91791         "../ui/sections/raw_member_editor.js": () => Promise.resolve().then(() => (init_raw_member_editor(), raw_member_editor_exports)),
91792         "../ui/sections/raw_membership_editor.js": () => Promise.resolve().then(() => (init_raw_membership_editor(), raw_membership_editor_exports)),
91793         "../ui/sections/raw_tag_editor.js": () => Promise.resolve().then(() => (init_raw_tag_editor(), raw_tag_editor_exports)),
91794         "../ui/sections/selection_list.js": () => Promise.resolve().then(() => (init_selection_list(), selection_list_exports)),
91795         "../ui/sections/validation_issues.js": () => Promise.resolve().then(() => (init_validation_issues(), validation_issues_exports)),
91796         "../ui/sections/validation_options.js": () => Promise.resolve().then(() => (init_validation_options(), validation_options_exports)),
91797         "../ui/sections/validation_rules.js": () => Promise.resolve().then(() => (init_validation_rules(), validation_rules_exports)),
91798         "../ui/sections/validation_status.js": () => Promise.resolve().then(() => (init_validation_status(), validation_status_exports)),
91799         "../ui/settings/custom_background.js": () => Promise.resolve().then(() => (init_custom_background(), custom_background_exports)),
91800         "../ui/settings/custom_data.js": () => Promise.resolve().then(() => (init_custom_data(), custom_data_exports)),
91801         "../ui/settings/index.js": () => Promise.resolve().then(() => (init_settings(), settings_exports)),
91802         "../ui/settings/local_photos.js": () => Promise.resolve().then(() => (init_local_photos2(), local_photos_exports2)),
91803         "../ui/shortcuts.js": () => Promise.resolve().then(() => (init_shortcuts(), shortcuts_exports)),
91804         "../ui/sidebar.js": () => Promise.resolve().then(() => (init_sidebar(), sidebar_exports)),
91805         "../ui/source_switch.js": () => Promise.resolve().then(() => (init_source_switch(), source_switch_exports)),
91806         "../ui/spinner.js": () => Promise.resolve().then(() => (init_spinner(), spinner_exports)),
91807         "../ui/splash.js": () => Promise.resolve().then(() => (init_splash(), splash_exports)),
91808         "../ui/status.js": () => Promise.resolve().then(() => (init_status(), status_exports)),
91809         "../ui/success.js": () => Promise.resolve().then(() => (init_success(), success_exports)),
91810         "../ui/tag_reference.js": () => Promise.resolve().then(() => (init_tag_reference(), tag_reference_exports)),
91811         "../ui/toggle.js": () => Promise.resolve().then(() => (init_toggle(), toggle_exports)),
91812         "../ui/tools/index.js": () => Promise.resolve().then(() => (init_tools(), tools_exports)),
91813         "../ui/tools/modes.js": () => Promise.resolve().then(() => (init_modes(), modes_exports)),
91814         "../ui/tools/notes.js": () => Promise.resolve().then(() => (init_notes2(), notes_exports2)),
91815         "../ui/tools/save.js": () => Promise.resolve().then(() => (init_save(), save_exports)),
91816         "../ui/tools/sidebar_toggle.js": () => Promise.resolve().then(() => (init_sidebar_toggle(), sidebar_toggle_exports)),
91817         "../ui/tools/undo_redo.js": () => Promise.resolve().then(() => (init_undo_redo(), undo_redo_exports)),
91818         "../ui/tooltip.js": () => Promise.resolve().then(() => (init_tooltip(), tooltip_exports)),
91819         "../ui/top_toolbar.js": () => Promise.resolve().then(() => (init_top_toolbar(), top_toolbar_exports)),
91820         "../ui/version.js": () => Promise.resolve().then(() => (init_version(), version_exports)),
91821         "../ui/view_on_keepRight.js": () => Promise.resolve().then(() => (init_view_on_keepRight(), view_on_keepRight_exports)),
91822         "../ui/view_on_osm.js": () => Promise.resolve().then(() => (init_view_on_osm(), view_on_osm_exports)),
91823         "../ui/view_on_osmose.js": () => Promise.resolve().then(() => (init_view_on_osmose(), view_on_osmose_exports)),
91824         "../ui/zoom.js": () => Promise.resolve().then(() => (init_zoom3(), zoom_exports)),
91825         "../ui/zoom_to_selection.js": () => Promise.resolve().then(() => (init_zoom_to_selection(), zoom_to_selection_exports)),
91826         "../util/IntervalTasksQueue.js": () => Promise.resolve().then(() => (init_IntervalTasksQueue(), IntervalTasksQueue_exports)),
91827         "../util/aes.js": () => Promise.resolve().then(() => (init_aes(), aes_exports)),
91828         "../util/array.js": () => Promise.resolve().then(() => (init_array3(), array_exports)),
91829         "../util/bind_once.js": () => Promise.resolve().then(() => (init_bind_once(), bind_once_exports)),
91830         "../util/clean_tags.js": () => Promise.resolve().then(() => (init_clean_tags(), clean_tags_exports)),
91831         "../util/detect.js": () => Promise.resolve().then(() => (init_detect(), detect_exports)),
91832         "../util/dimensions.js": () => Promise.resolve().then(() => (init_dimensions(), dimensions_exports)),
91833         "../util/double_up.js": () => Promise.resolve().then(() => (init_double_up(), double_up_exports)),
91834         "../util/get_set_value.js": () => Promise.resolve().then(() => (init_get_set_value(), get_set_value_exports)),
91835         "../util/index.js": () => Promise.resolve().then(() => (init_util(), util_exports)),
91836         "../util/jxon.js": () => Promise.resolve().then(() => (init_jxon(), jxon_exports)),
91837         "../util/keybinding.js": () => Promise.resolve().then(() => (init_keybinding(), keybinding_exports)),
91838         "../util/object.js": () => Promise.resolve().then(() => (init_object2(), object_exports)),
91839         "../util/rebind.js": () => Promise.resolve().then(() => (init_rebind(), rebind_exports)),
91840         "../util/session_mutex.js": () => Promise.resolve().then(() => (init_session_mutex(), session_mutex_exports)),
91841         "../util/svg_paths_rtl_fix.js": () => Promise.resolve().then(() => (init_svg_paths_rtl_fix(), svg_paths_rtl_fix_exports)),
91842         "../util/tiler.js": () => Promise.resolve().then(() => (init_tiler(), tiler_exports)),
91843         "../util/trigger_event.js": () => Promise.resolve().then(() => (init_trigger_event(), trigger_event_exports)),
91844         "../util/units.js": () => Promise.resolve().then(() => (init_units(), units_exports)),
91845         "../util/util.js": () => Promise.resolve().then(() => (init_util2(), util_exports2)),
91846         "../util/utilDisplayLabel.js": () => Promise.resolve().then(() => (init_utilDisplayLabel(), utilDisplayLabel_exports)),
91847         "../util/zoom_pan.js": () => Promise.resolve().then(() => (init_zoom_pan(), zoom_pan_exports)),
91848         "../validations/almost_junction.js": () => Promise.resolve().then(() => (init_almost_junction(), almost_junction_exports)),
91849         "../validations/close_nodes.js": () => Promise.resolve().then(() => (init_close_nodes(), close_nodes_exports)),
91850         "../validations/crossing_ways.js": () => Promise.resolve().then(() => (init_crossing_ways(), crossing_ways_exports)),
91851         "../validations/disconnected_way.js": () => Promise.resolve().then(() => (init_disconnected_way(), disconnected_way_exports)),
91852         "../validations/help_request.js": () => Promise.resolve().then(() => (init_help_request(), help_request_exports)),
91853         "../validations/impossible_oneway.js": () => Promise.resolve().then(() => (init_impossible_oneway(), impossible_oneway_exports)),
91854         "../validations/incompatible_source.js": () => Promise.resolve().then(() => (init_incompatible_source(), incompatible_source_exports)),
91855         "../validations/index.js": () => Promise.resolve().then(() => (init_validations(), validations_exports)),
91856         "../validations/invalid_format.js": () => Promise.resolve().then(() => (init_invalid_format(), invalid_format_exports)),
91857         "../validations/maprules.js": () => Promise.resolve().then(() => (init_maprules2(), maprules_exports2)),
91858         "../validations/mismatched_geometry.js": () => Promise.resolve().then(() => (init_mismatched_geometry(), mismatched_geometry_exports)),
91859         "../validations/missing_role.js": () => Promise.resolve().then(() => (init_missing_role(), missing_role_exports)),
91860         "../validations/missing_tag.js": () => Promise.resolve().then(() => (init_missing_tag(), missing_tag_exports)),
91861         "../validations/mutually_exclusive_tags.js": () => Promise.resolve().then(() => (init_mutually_exclusive_tags(), mutually_exclusive_tags_exports)),
91862         "../validations/osm_api_limits.js": () => Promise.resolve().then(() => (init_osm_api_limits(), osm_api_limits_exports)),
91863         "../validations/outdated_tags.js": () => Promise.resolve().then(() => (init_outdated_tags(), outdated_tags_exports)),
91864         "../validations/private_data.js": () => Promise.resolve().then(() => (init_private_data(), private_data_exports)),
91865         "../validations/suspicious_name.js": () => Promise.resolve().then(() => (init_suspicious_name(), suspicious_name_exports)),
91866         "../validations/unsquare_way.js": () => Promise.resolve().then(() => (init_unsquare_way(), unsquare_way_exports))
91867       });
91868     }
91869   });
91870
91871   // modules/core/file_fetcher.js
91872   var file_fetcher_exports = {};
91873   __export(file_fetcher_exports, {
91874     coreFileFetcher: () => coreFileFetcher,
91875     fileFetcher: () => _mainFileFetcher
91876   });
91877   function coreFileFetcher() {
91878     const ociVersion = package_default.dependencies["osm-community-index"] || package_default.devDependencies["osm-community-index"];
91879     const v2 = (0, import_vparse2.default)(ociVersion);
91880     const ociVersionMinor = `${v2.major}.${v2.minor}`;
91881     const presetsVersion = package_default.devDependencies["@openstreetmap/id-tagging-schema"];
91882     let _this = {};
91883     let _inflight4 = {};
91884     let _fileMap = {
91885       "address_formats": "data/address_formats.min.json",
91886       "imagery": "data/imagery.min.json",
91887       "intro_graph": "data/intro_graph.min.json",
91888       "keepRight": "data/keepRight.min.json",
91889       "languages": "data/languages.min.json",
91890       "locales": "locales/index.min.json",
91891       "phone_formats": "data/phone_formats.min.json",
91892       "qa_data": "data/qa_data.min.json",
91893       "shortcuts": "data/shortcuts.min.json",
91894       "territory_languages": "data/territory_languages.min.json",
91895       "oci_defaults": ociCdnUrl.replace("{version}", ociVersionMinor) + "dist/defaults.min.json",
91896       "oci_features": ociCdnUrl.replace("{version}", ociVersionMinor) + "dist/featureCollection.min.json",
91897       "oci_resources": ociCdnUrl.replace("{version}", ociVersionMinor) + "dist/resources.min.json",
91898       "presets_package": presetsCdnUrl.replace("{presets_version}", presetsVersion) + "package.json",
91899       "deprecated": presetsCdnUrl + "dist/deprecated.min.json",
91900       "discarded": presetsCdnUrl + "dist/discarded.min.json",
91901       "preset_categories": presetsCdnUrl + "dist/preset_categories.min.json",
91902       "preset_defaults": presetsCdnUrl + "dist/preset_defaults.min.json",
91903       "preset_fields": presetsCdnUrl + "dist/fields.min.json",
91904       "preset_presets": presetsCdnUrl + "dist/presets.min.json",
91905       "wmf_sitematrix": wmfSitematrixCdnUrl.replace("{version}", "0.2") + "data/wikipedia.min.json"
91906     };
91907     let _cachedData = {};
91908     _this.cache = () => _cachedData;
91909     _this.get = (which) => {
91910       if (_cachedData[which]) {
91911         return Promise.resolve(_cachedData[which]);
91912       }
91913       const file = _fileMap[which];
91914       const url = file && _this.asset(file);
91915       if (!url) {
91916         return Promise.reject(`Unknown data file for "${which}"`);
91917       }
91918       if (url.includes("{presets_version}")) {
91919         return _this.get("presets_package").then((result) => {
91920           const presetsVersion2 = result.version;
91921           return getUrl(url.replace("{presets_version}", presetsVersion2), which);
91922         });
91923       } else {
91924         return getUrl(url, which);
91925       }
91926     };
91927     function getUrl(url, which) {
91928       let prom = _inflight4[url];
91929       if (!prom) {
91930         _inflight4[url] = prom = (window.VITEST ? globImport(`../${url}`) : fetch(url)).then((response) => {
91931           if (window.VITEST) return response.default;
91932           if (!response.ok || !response.json) {
91933             throw new Error(response.status + " " + response.statusText);
91934           }
91935           if (response.status === 204 || response.status === 205) return;
91936           return response.json();
91937         }).then((result) => {
91938           delete _inflight4[url];
91939           if (!result) {
91940             throw new Error(`No data loaded for "${which}"`);
91941           }
91942           _cachedData[which] = result;
91943           return result;
91944         }).catch((err) => {
91945           delete _inflight4[url];
91946           throw err;
91947         });
91948       }
91949       return prom;
91950     }
91951     _this.fileMap = function(val) {
91952       if (!arguments.length) return _fileMap;
91953       _fileMap = val;
91954       return _this;
91955     };
91956     let _assetPath = "";
91957     _this.assetPath = function(val) {
91958       if (!arguments.length) return _assetPath;
91959       _assetPath = val;
91960       return _this;
91961     };
91962     let _assetMap = {};
91963     _this.assetMap = function(val) {
91964       if (!arguments.length) return _assetMap;
91965       _assetMap = val;
91966       return _this;
91967     };
91968     _this.asset = (val) => {
91969       if (/^http(s)?:\/\//i.test(val)) return val;
91970       const filename = _assetPath + val;
91971       return _assetMap[filename] || filename;
91972     };
91973     return _this;
91974   }
91975   var import_vparse2, _mainFileFetcher;
91976   var init_file_fetcher = __esm({
91977     "modules/core/file_fetcher.js"() {
91978       "use strict";
91979       import_vparse2 = __toESM(require_vparse());
91980       init_id();
91981       init_package();
91982       init_();
91983       _mainFileFetcher = coreFileFetcher();
91984     }
91985   });
91986
91987   // modules/core/localizer.js
91988   var localizer_exports = {};
91989   __export(localizer_exports, {
91990     coreLocalizer: () => coreLocalizer,
91991     localizer: () => _mainLocalizer,
91992     t: () => _t
91993   });
91994   function coreLocalizer() {
91995     let localizer = {};
91996     let _dataLanguages = {};
91997     let _dataLocales = {};
91998     let _localeStrings = {};
91999     let _localeCode = "en-US";
92000     let _localeCodes = ["en-US", "en"];
92001     let _languageCode = "en";
92002     let _textDirection = "ltr";
92003     let _usesMetric = false;
92004     let _languageNames = {};
92005     let _scriptNames = {};
92006     localizer.localeCode = () => _localeCode;
92007     localizer.localeCodes = () => _localeCodes;
92008     localizer.languageCode = () => _languageCode;
92009     localizer.textDirection = () => _textDirection;
92010     localizer.usesMetric = () => _usesMetric;
92011     localizer.languageNames = () => _languageNames;
92012     localizer.scriptNames = () => _scriptNames;
92013     let _preferredLocaleCodes = [];
92014     localizer.preferredLocaleCodes = function(codes) {
92015       if (!arguments.length) return _preferredLocaleCodes;
92016       if (typeof codes === "string") {
92017         _preferredLocaleCodes = codes.split(/,|;| /gi).filter(Boolean);
92018       } else {
92019         _preferredLocaleCodes = codes;
92020       }
92021       return localizer;
92022     };
92023     var _loadPromise;
92024     localizer.ensureLoaded = () => {
92025       if (_loadPromise) return _loadPromise;
92026       let filesToFetch = [
92027         "languages",
92028         // load the list of languages
92029         "locales"
92030         // load the list of supported locales
92031       ];
92032       const localeDirs = {
92033         general: "locales",
92034         tagging: presetsCdnUrl + "dist/translations"
92035       };
92036       let fileMap = _mainFileFetcher.fileMap();
92037       for (let scopeId in localeDirs) {
92038         const key = `locales_index_${scopeId}`;
92039         if (!fileMap[key]) {
92040           fileMap[key] = localeDirs[scopeId] + "/index.min.json";
92041         }
92042         filesToFetch.push(key);
92043       }
92044       return _loadPromise = Promise.all(filesToFetch.map((key) => _mainFileFetcher.get(key))).then((results) => {
92045         _dataLanguages = results[0];
92046         _dataLocales = results[1];
92047         let indexes = results.slice(2);
92048         _localeCodes = localizer.localesToUseFrom(_dataLocales);
92049         _localeCode = _localeCodes[0];
92050         let loadStringsPromises = [];
92051         indexes.forEach((index, i3) => {
92052           const fullCoverageIndex = _localeCodes.findIndex(function(locale3) {
92053             return index[locale3] && index[locale3].pct === 1;
92054           });
92055           _localeCodes.slice(0, fullCoverageIndex + 1).forEach(function(code) {
92056             let scopeId = Object.keys(localeDirs)[i3];
92057             let directory = Object.values(localeDirs)[i3];
92058             if (index[code]) loadStringsPromises.push(localizer.loadLocale(code, scopeId, directory));
92059           });
92060         });
92061         return Promise.all(loadStringsPromises);
92062       }).then(() => {
92063         updateForCurrentLocale();
92064       }).catch((err) => console.error(err));
92065     };
92066     localizer.localesToUseFrom = (supportedLocales) => {
92067       const requestedLocales = [
92068         ..._preferredLocaleCodes || [],
92069         ...utilDetect().browserLocales,
92070         // List of locales preferred by the browser in priority order.
92071         "en"
92072         // fallback to English since it's the only guaranteed complete language
92073       ];
92074       let toUse = [];
92075       for (const locale3 of requestedLocales) {
92076         if (supportedLocales[locale3]) toUse.push(locale3);
92077         if ("Intl" in window && "Locale" in window.Intl) {
92078           const localeObj = new Intl.Locale(locale3);
92079           const withoutScript = `${localeObj.language}-${localeObj.region}`;
92080           const base = localeObj.language;
92081           if (supportedLocales[withoutScript]) toUse.push(withoutScript);
92082           if (supportedLocales[base]) toUse.push(base);
92083         } else if (locale3.includes("-")) {
92084           let langPart = locale3.split("-")[0];
92085           if (supportedLocales[langPart]) toUse.push(langPart);
92086         }
92087       }
92088       return utilArrayUniq(toUse);
92089     };
92090     function updateForCurrentLocale() {
92091       if (!_localeCode) return;
92092       _languageCode = _localeCode.split("-")[0];
92093       const currentData = _dataLocales[_localeCode] || _dataLocales[_languageCode];
92094       const hash2 = utilStringQs(window.location.hash);
92095       if (hash2.rtl === "true") {
92096         _textDirection = "rtl";
92097       } else if (hash2.rtl === "false") {
92098         _textDirection = "ltr";
92099       } else {
92100         _textDirection = currentData && currentData.rtl ? "rtl" : "ltr";
92101       }
92102       let locale3 = _localeCode;
92103       if (locale3.toLowerCase() === "en-us") locale3 = "en";
92104       _languageNames = _localeStrings.general[locale3].languageNames || _localeStrings.general[_languageCode].languageNames;
92105       _scriptNames = _localeStrings.general[locale3].scriptNames || _localeStrings.general[_languageCode].scriptNames;
92106       _usesMetric = _localeCode.slice(-3).toLowerCase() !== "-us";
92107     }
92108     localizer.loadLocale = (locale3, scopeId, directory) => {
92109       if (locale3.toLowerCase() === "en-us") locale3 = "en";
92110       if (_localeStrings[scopeId] && _localeStrings[scopeId][locale3]) {
92111         return Promise.resolve(locale3);
92112       }
92113       let fileMap = _mainFileFetcher.fileMap();
92114       const key = `locale_${scopeId}_${locale3}`;
92115       if (!fileMap[key]) {
92116         fileMap[key] = `${directory}/${locale3}.min.json`;
92117       }
92118       return _mainFileFetcher.get(key).then((d2) => {
92119         if (!_localeStrings[scopeId]) _localeStrings[scopeId] = {};
92120         _localeStrings[scopeId][locale3] = d2[locale3];
92121         return locale3;
92122       });
92123     };
92124     localizer.pluralRule = function(number3) {
92125       return pluralRule(number3, _localeCode);
92126     };
92127     function pluralRule(number3, localeCode) {
92128       const rules = "Intl" in window && Intl.PluralRules && new Intl.PluralRules(localeCode);
92129       if (rules) {
92130         return rules.select(number3);
92131       }
92132       if (number3 === 1) return "one";
92133       return "other";
92134     }
92135     localizer.tInfo = function(origStringId, replacements, locale3) {
92136       let stringId = origStringId.trim();
92137       let scopeId = "general";
92138       if (stringId[0] === "_") {
92139         let split = stringId.split(".");
92140         scopeId = split[0].slice(1);
92141         stringId = split.slice(1).join(".");
92142       }
92143       locale3 = locale3 || _localeCode;
92144       let path = stringId.split(".").map((s2) => s2.replace(/<TX_DOT>/g, ".")).reverse();
92145       let stringsKey = locale3;
92146       if (stringsKey.toLowerCase() === "en-us") stringsKey = "en";
92147       let result = _localeStrings && _localeStrings[scopeId] && _localeStrings[scopeId][stringsKey];
92148       while (result !== void 0 && path.length) {
92149         result = result[path.pop()];
92150       }
92151       if (result !== void 0) {
92152         if (replacements) {
92153           if (typeof result === "object" && Object.keys(result).length) {
92154             const number3 = Object.values(replacements).find(function(value) {
92155               return typeof value === "number";
92156             });
92157             if (number3 !== void 0) {
92158               const rule = pluralRule(number3, locale3);
92159               if (result[rule]) {
92160                 result = result[rule];
92161               } else {
92162                 result = Object.values(result)[0];
92163               }
92164             }
92165           }
92166           if (typeof result === "string") {
92167             for (let key in replacements) {
92168               let value = replacements[key];
92169               if (typeof value === "number") {
92170                 if (value.toLocaleString) {
92171                   value = value.toLocaleString(locale3, {
92172                     style: "decimal",
92173                     useGrouping: true,
92174                     minimumFractionDigits: 0
92175                   });
92176                 } else {
92177                   value = value.toString();
92178                 }
92179               }
92180               const token = `{${key}}`;
92181               const regex = new RegExp(token, "g");
92182               result = result.replace(regex, value);
92183             }
92184           }
92185         }
92186         if (typeof result === "string") {
92187           return {
92188             text: result,
92189             locale: locale3
92190           };
92191         }
92192       }
92193       let index = _localeCodes.indexOf(locale3);
92194       if (index >= 0 && index < _localeCodes.length - 1) {
92195         let fallback = _localeCodes[index + 1];
92196         return localizer.tInfo(origStringId, replacements, fallback);
92197       }
92198       if (replacements && "default" in replacements) {
92199         return {
92200           text: replacements.default,
92201           locale: null
92202         };
92203       }
92204       const missing = `Missing ${locale3} translation: ${origStringId}`;
92205       if (typeof console !== "undefined") console.error(missing);
92206       return {
92207         text: missing,
92208         locale: "en"
92209       };
92210     };
92211     localizer.hasTextForStringId = function(stringId) {
92212       return !!localizer.tInfo(stringId, { default: "nothing found" }).locale;
92213     };
92214     localizer.t = function(stringId, replacements, locale3) {
92215       return localizer.tInfo(stringId, replacements, locale3).text;
92216     };
92217     localizer.t.html = function(stringId, replacements, locale3) {
92218       replacements = Object.assign({}, replacements);
92219       for (var k2 in replacements) {
92220         if (typeof replacements[k2] === "string") {
92221           replacements[k2] = escape_default(replacements[k2]);
92222         }
92223         if (typeof replacements[k2] === "object" && typeof replacements[k2].html === "string") {
92224           replacements[k2] = replacements[k2].html;
92225         }
92226       }
92227       const info = localizer.tInfo(stringId, replacements, locale3);
92228       if (info.text) {
92229         return `<span class="localized-text" lang="${info.locale || "und"}">${info.text}</span>`;
92230       } else {
92231         return "";
92232       }
92233     };
92234     localizer.t.append = function(stringId, replacements, locale3) {
92235       const ret = function(selection2) {
92236         const info = localizer.tInfo(stringId, replacements, locale3);
92237         return selection2.append("span").attr("class", "localized-text").attr("lang", info.locale || "und").text((replacements && replacements.prefix || "") + info.text + (replacements && replacements.suffix || ""));
92238       };
92239       ret.stringId = stringId;
92240       return ret;
92241     };
92242     localizer.t.addOrUpdate = function(stringId, replacements, locale3) {
92243       const ret = function(selection2) {
92244         const info = localizer.tInfo(stringId, replacements, locale3);
92245         const span = selection2.selectAll("span.localized-text").data([info]);
92246         const enter = span.enter().append("span").classed("localized-text", true);
92247         span.merge(enter).attr("lang", info.locale || "und").text((replacements && replacements.prefix || "") + info.text + (replacements && replacements.suffix || ""));
92248       };
92249       ret.stringId = stringId;
92250       return ret;
92251     };
92252     localizer.languageName = (code, options2) => {
92253       if (_languageNames && _languageNames[code]) {
92254         return _languageNames[code];
92255       }
92256       if (options2 && options2.localOnly) return null;
92257       const langInfo = _dataLanguages[code];
92258       if (langInfo) {
92259         if (langInfo.nativeName) {
92260           return localizer.t("translate.language_and_code", { language: langInfo.nativeName, code });
92261         } else if (langInfo.base && langInfo.script) {
92262           const base = langInfo.base;
92263           if (_languageNames && _languageNames[base]) {
92264             const scriptCode = langInfo.script;
92265             const script = _scriptNames && _scriptNames[scriptCode] || scriptCode;
92266             return localizer.t("translate.language_and_code", { language: _languageNames[base], code: script });
92267           } else if (_dataLanguages[base] && _dataLanguages[base].nativeName) {
92268             return localizer.t("translate.language_and_code", { language: _dataLanguages[base].nativeName, code });
92269           }
92270         }
92271       }
92272       return code;
92273     };
92274     localizer.floatFormatter = (locale3) => {
92275       if (!("Intl" in window && "NumberFormat" in Intl && "formatToParts" in Intl.NumberFormat.prototype)) {
92276         return (number3, fractionDigits) => {
92277           return fractionDigits === void 0 ? number3.toString() : number3.toFixed(fractionDigits);
92278         };
92279       } else {
92280         return (number3, fractionDigits) => number3.toLocaleString(locale3, {
92281           minimumFractionDigits: fractionDigits,
92282           maximumFractionDigits: fractionDigits === void 0 ? 20 : fractionDigits
92283         });
92284       }
92285     };
92286     localizer.floatParser = (locale3) => {
92287       const polyfill = (string) => +string.trim();
92288       if (!("Intl" in window && "NumberFormat" in Intl)) return polyfill;
92289       const format2 = new Intl.NumberFormat(locale3, { maximumFractionDigits: 20 });
92290       if (!("formatToParts" in format2)) return polyfill;
92291       const parts = format2.formatToParts(-12345.6);
92292       const numerals = Array.from({ length: 10 }).map((_2, i3) => format2.format(i3));
92293       const index = new Map(numerals.map((d2, i3) => [d2, i3]));
92294       const literalPart = parts.find((d2) => d2.type === "literal");
92295       const literal = literalPart && new RegExp(`[${literalPart.value}]`, "g");
92296       const groupPart = parts.find((d2) => d2.type === "group");
92297       const group = groupPart && new RegExp(`[${groupPart.value}]`, "g");
92298       const decimalPart = parts.find((d2) => d2.type === "decimal");
92299       const decimal = decimalPart && new RegExp(`[${decimalPart.value}]`);
92300       const numeral = new RegExp(`[${numerals.join("")}]`, "g");
92301       const getIndex = (d2) => index.get(d2);
92302       return (string) => {
92303         string = string.trim();
92304         if (literal) string = string.replace(literal, "");
92305         if (group) string = string.replace(group, "");
92306         if (decimal) string = string.replace(decimal, ".");
92307         string = string.replace(numeral, getIndex);
92308         return string ? +string : NaN;
92309       };
92310     };
92311     localizer.decimalPlaceCounter = (locale3) => {
92312       var literal, group, decimal;
92313       if ("Intl" in window && "NumberFormat" in Intl) {
92314         const format2 = new Intl.NumberFormat(locale3, { maximumFractionDigits: 20 });
92315         if ("formatToParts" in format2) {
92316           const parts = format2.formatToParts(-12345.6);
92317           const literalPart = parts.find((d2) => d2.type === "literal");
92318           literal = literalPart && new RegExp(`[${literalPart.value}]`, "g");
92319           const groupPart = parts.find((d2) => d2.type === "group");
92320           group = groupPart && new RegExp(`[${groupPart.value}]`, "g");
92321           const decimalPart = parts.find((d2) => d2.type === "decimal");
92322           decimal = decimalPart && new RegExp(`[${decimalPart.value}]`);
92323         }
92324       }
92325       return (string) => {
92326         string = string.trim();
92327         if (literal) string = string.replace(literal, "");
92328         if (group) string = string.replace(group, "");
92329         const parts = string.split(decimal || ".");
92330         return parts && parts[1] && parts[1].length || 0;
92331       };
92332     };
92333     return localizer;
92334   }
92335   var _mainLocalizer, _t;
92336   var init_localizer = __esm({
92337     "modules/core/localizer.js"() {
92338       "use strict";
92339       init_lodash();
92340       init_file_fetcher();
92341       init_detect();
92342       init_util();
92343       init_array3();
92344       init_id();
92345       _mainLocalizer = coreLocalizer();
92346       _t = _mainLocalizer.t;
92347     }
92348   });
92349
92350   // modules/util/util.js
92351   var util_exports2 = {};
92352   __export(util_exports2, {
92353     utilAsyncMap: () => utilAsyncMap,
92354     utilCleanOsmString: () => utilCleanOsmString,
92355     utilCombinedTags: () => utilCombinedTags,
92356     utilCompareIDs: () => utilCompareIDs,
92357     utilDeepMemberSelector: () => utilDeepMemberSelector,
92358     utilDisplayName: () => utilDisplayName,
92359     utilDisplayNameForPath: () => utilDisplayNameForPath,
92360     utilDisplayType: () => utilDisplayType,
92361     utilEditDistance: () => utilEditDistance,
92362     utilEntityAndDeepMemberIDs: () => utilEntityAndDeepMemberIDs,
92363     utilEntityOrDeepMemberSelector: () => utilEntityOrDeepMemberSelector,
92364     utilEntityOrMemberSelector: () => utilEntityOrMemberSelector,
92365     utilEntityRoot: () => utilEntityRoot,
92366     utilEntitySelector: () => utilEntitySelector,
92367     utilFastMouse: () => utilFastMouse,
92368     utilFunctor: () => utilFunctor,
92369     utilGetAllNodes: () => utilGetAllNodes,
92370     utilHashcode: () => utilHashcode,
92371     utilHighlightEntities: () => utilHighlightEntities,
92372     utilNoAuto: () => utilNoAuto,
92373     utilOldestID: () => utilOldestID,
92374     utilPrefixCSSProperty: () => utilPrefixCSSProperty,
92375     utilPrefixDOMProperty: () => utilPrefixDOMProperty,
92376     utilQsString: () => utilQsString,
92377     utilSafeClassName: () => utilSafeClassName,
92378     utilSetTransform: () => utilSetTransform,
92379     utilStringQs: () => utilStringQs,
92380     utilTagDiff: () => utilTagDiff,
92381     utilTagText: () => utilTagText,
92382     utilTotalExtent: () => utilTotalExtent,
92383     utilUnicodeCharsCount: () => utilUnicodeCharsCount,
92384     utilUnicodeCharsTruncated: () => utilUnicodeCharsTruncated,
92385     utilUniqueDomId: () => utilUniqueDomId,
92386     utilWrap: () => utilWrap
92387   });
92388   function utilTagText(entity) {
92389     var obj = entity && entity.tags || {};
92390     return Object.keys(obj).map(function(k2) {
92391       return k2 + "=" + obj[k2];
92392     }).join(", ");
92393   }
92394   function utilTotalExtent(array2, graph) {
92395     var extent = geoExtent();
92396     var val, entity;
92397     for (var i3 = 0; i3 < array2.length; i3++) {
92398       val = array2[i3];
92399       entity = typeof val === "string" ? graph.hasEntity(val) : val;
92400       if (entity) {
92401         extent._extend(entity.extent(graph));
92402       }
92403     }
92404     return extent;
92405   }
92406   function utilTagDiff(oldTags, newTags) {
92407     var tagDiff = [];
92408     var keys2 = utilArrayUnion(Object.keys(oldTags), Object.keys(newTags)).sort();
92409     keys2.forEach(function(k2) {
92410       var oldVal = oldTags[k2];
92411       var newVal = newTags[k2];
92412       if ((oldVal || oldVal === "") && (newVal === void 0 || newVal !== oldVal)) {
92413         tagDiff.push({
92414           type: "-",
92415           key: k2,
92416           oldVal,
92417           newVal,
92418           display: "- " + k2 + "=" + oldVal
92419         });
92420       }
92421       if ((newVal || newVal === "") && (oldVal === void 0 || newVal !== oldVal)) {
92422         tagDiff.push({
92423           type: "+",
92424           key: k2,
92425           oldVal,
92426           newVal,
92427           display: "+ " + k2 + "=" + newVal
92428         });
92429       }
92430     });
92431     return tagDiff;
92432   }
92433   function utilEntitySelector(ids) {
92434     return ids.length ? "." + ids.join(",.") : "nothing";
92435   }
92436   function utilEntityOrMemberSelector(ids, graph) {
92437     var seen = new Set(ids);
92438     ids.forEach(collectShallowDescendants);
92439     return utilEntitySelector(Array.from(seen));
92440     function collectShallowDescendants(id2) {
92441       var entity = graph.hasEntity(id2);
92442       if (!entity || entity.type !== "relation") return;
92443       entity.members.map(function(member) {
92444         return member.id;
92445       }).forEach(function(id3) {
92446         seen.add(id3);
92447       });
92448     }
92449   }
92450   function utilEntityOrDeepMemberSelector(ids, graph) {
92451     return utilEntitySelector(utilEntityAndDeepMemberIDs(ids, graph));
92452   }
92453   function utilEntityAndDeepMemberIDs(ids, graph) {
92454     var seen = /* @__PURE__ */ new Set();
92455     ids.forEach(collectDeepDescendants);
92456     return Array.from(seen);
92457     function collectDeepDescendants(id2) {
92458       if (seen.has(id2)) return;
92459       seen.add(id2);
92460       var entity = graph.hasEntity(id2);
92461       if (!entity || entity.type !== "relation") return;
92462       entity.members.map(function(member) {
92463         return member.id;
92464       }).forEach(collectDeepDescendants);
92465     }
92466   }
92467   function utilDeepMemberSelector(ids, graph, skipMultipolgonMembers) {
92468     var idsSet = new Set(ids);
92469     var seen = /* @__PURE__ */ new Set();
92470     var returners = /* @__PURE__ */ new Set();
92471     ids.forEach(collectDeepDescendants);
92472     return utilEntitySelector(Array.from(returners));
92473     function collectDeepDescendants(id2) {
92474       if (seen.has(id2)) return;
92475       seen.add(id2);
92476       if (!idsSet.has(id2)) {
92477         returners.add(id2);
92478       }
92479       var entity = graph.hasEntity(id2);
92480       if (!entity || entity.type !== "relation") return;
92481       if (skipMultipolgonMembers && entity.isMultipolygon()) return;
92482       entity.members.map(function(member) {
92483         return member.id;
92484       }).forEach(collectDeepDescendants);
92485     }
92486   }
92487   function utilHighlightEntities(ids, highlighted, context) {
92488     context.surface().selectAll(utilEntityOrDeepMemberSelector(ids, context.graph())).classed("highlighted", highlighted);
92489   }
92490   function utilGetAllNodes(ids, graph) {
92491     var seen = /* @__PURE__ */ new Set();
92492     var nodes = /* @__PURE__ */ new Set();
92493     ids.forEach(collectNodes);
92494     return Array.from(nodes);
92495     function collectNodes(id2) {
92496       if (seen.has(id2)) return;
92497       seen.add(id2);
92498       var entity = graph.hasEntity(id2);
92499       if (!entity) return;
92500       if (entity.type === "node") {
92501         nodes.add(entity);
92502       } else if (entity.type === "way") {
92503         entity.nodes.forEach(collectNodes);
92504       } else {
92505         entity.members.map(function(member) {
92506           return member.id;
92507         }).forEach(collectNodes);
92508       }
92509     }
92510   }
92511   function utilDisplayName(entity, hideNetwork) {
92512     var localizedNameKey = "name:" + _mainLocalizer.languageCode().toLowerCase();
92513     var name = entity.tags[localizedNameKey] || entity.tags.name || "";
92514     var tags = {
92515       direction: entity.tags.direction,
92516       from: entity.tags.from,
92517       name,
92518       network: hideNetwork ? void 0 : entity.tags.cycle_network || entity.tags.network,
92519       ref: entity.tags.ref,
92520       to: entity.tags.to,
92521       via: entity.tags.via
92522     };
92523     if (entity.tags.route && entity.tags.name && entity.tags.name.match(/[→⇒↔⇔]|[-=]>/)) {
92524       return entity.tags.name;
92525     }
92526     if (!entity.tags.route && name) {
92527       return name;
92528     }
92529     var keyComponents = [];
92530     if (tags.network) {
92531       keyComponents.push("network");
92532     }
92533     if (tags.ref) {
92534       keyComponents.push("ref");
92535     }
92536     if (tags.name) {
92537       keyComponents.push("name");
92538     }
92539     if (entity.tags.route) {
92540       if (tags.direction) {
92541         keyComponents.push("direction");
92542       } else if (tags.from && tags.to) {
92543         keyComponents.push("from");
92544         keyComponents.push("to");
92545         if (tags.via) {
92546           keyComponents.push("via");
92547         }
92548       }
92549     }
92550     if (keyComponents.length) {
92551       name = _t("inspector.display_name." + keyComponents.join("_"), tags);
92552     }
92553     return name;
92554   }
92555   function utilDisplayNameForPath(entity) {
92556     var name = utilDisplayName(entity);
92557     var isFirefox = utilDetect().browser.toLowerCase().indexOf("firefox") > -1;
92558     var isNewChromium = Number(utilDetect().version.split(".")[0]) >= 96;
92559     if (!isFirefox && !isNewChromium && name && rtlRegex.test(name)) {
92560       name = fixRTLTextForSvg(name);
92561     }
92562     return name;
92563   }
92564   function utilDisplayType(id2) {
92565     return {
92566       n: _t("inspector.node"),
92567       w: _t("inspector.way"),
92568       r: _t("inspector.relation")
92569     }[id2.charAt(0)];
92570   }
92571   function utilEntityRoot(entityType) {
92572     return {
92573       node: "n",
92574       way: "w",
92575       relation: "r"
92576     }[entityType];
92577   }
92578   function utilCombinedTags(entityIDs, graph) {
92579     var tags = {};
92580     var tagCounts = {};
92581     var allKeys = /* @__PURE__ */ new Set();
92582     var allTags = [];
92583     var entities = entityIDs.map(function(entityID) {
92584       return graph.hasEntity(entityID);
92585     }).filter(Boolean);
92586     entities.forEach(function(entity) {
92587       var keys2 = Object.keys(entity.tags).filter(Boolean);
92588       keys2.forEach(function(key2) {
92589         allKeys.add(key2);
92590       });
92591     });
92592     entities.forEach(function(entity) {
92593       allTags.push(entity.tags);
92594       allKeys.forEach(function(key2) {
92595         var value = entity.tags[key2];
92596         if (!tags.hasOwnProperty(key2)) {
92597           tags[key2] = value;
92598         } else {
92599           if (!Array.isArray(tags[key2])) {
92600             if (tags[key2] !== value) {
92601               tags[key2] = [tags[key2], value];
92602             }
92603           } else {
92604             if (tags[key2].indexOf(value) === -1) {
92605               tags[key2].push(value);
92606             }
92607           }
92608         }
92609         var tagHash = key2 + "=" + value;
92610         if (!tagCounts[tagHash]) tagCounts[tagHash] = 0;
92611         tagCounts[tagHash] += 1;
92612       });
92613     });
92614     for (var key in tags) {
92615       if (!Array.isArray(tags[key])) continue;
92616       tags[key] = tags[key].sort(function(val12, val2) {
92617         var key2 = key2;
92618         var count2 = tagCounts[key2 + "=" + val2];
92619         var count1 = tagCounts[key2 + "=" + val12];
92620         if (count2 !== count1) {
92621           return count2 - count1;
92622         }
92623         if (val2 && val12) {
92624           return val12.localeCompare(val2);
92625         }
92626         return val12 ? 1 : -1;
92627       });
92628     }
92629     tags = Object.defineProperty(tags, Symbol.for("allTags"), { enumerable: false, value: allTags });
92630     return tags;
92631   }
92632   function utilStringQs(str) {
92633     str = str.replace(/^[#?]{0,2}/, "");
92634     return Object.fromEntries(new URLSearchParams(str));
92635   }
92636   function utilQsString(obj, softEncode) {
92637     let str = new URLSearchParams(obj).toString();
92638     if (softEncode) {
92639       str = str.replace(/(%2F|%3A|%2C|%7B|%7D)/g, decodeURIComponent);
92640     }
92641     return str;
92642   }
92643   function utilPrefixDOMProperty(property) {
92644     var prefixes2 = ["webkit", "ms", "moz", "o"];
92645     var i3 = -1;
92646     var n3 = prefixes2.length;
92647     var s2 = document.body;
92648     if (property in s2) return property;
92649     property = property.slice(0, 1).toUpperCase() + property.slice(1);
92650     while (++i3 < n3) {
92651       if (prefixes2[i3] + property in s2) {
92652         return prefixes2[i3] + property;
92653       }
92654     }
92655     return false;
92656   }
92657   function utilPrefixCSSProperty(property) {
92658     var prefixes2 = ["webkit", "ms", "Moz", "O"];
92659     var i3 = -1;
92660     var n3 = prefixes2.length;
92661     var s2 = document.body.style;
92662     if (property.toLowerCase() in s2) {
92663       return property.toLowerCase();
92664     }
92665     while (++i3 < n3) {
92666       if (prefixes2[i3] + property in s2) {
92667         return "-" + prefixes2[i3].toLowerCase() + property.replace(/([A-Z])/g, "-$1").toLowerCase();
92668       }
92669     }
92670     return false;
92671   }
92672   function utilSetTransform(el, x2, y2, scale) {
92673     var prop = transformProperty = transformProperty || utilPrefixCSSProperty("Transform");
92674     var translate = utilDetect().opera ? "translate(" + x2 + "px," + y2 + "px)" : "translate3d(" + x2 + "px," + y2 + "px,0)";
92675     return el.style(prop, translate + (scale ? " scale(" + scale + ")" : ""));
92676   }
92677   function utilEditDistance(a2, b2) {
92678     a2 = (0, import_diacritics3.remove)(a2.toLowerCase());
92679     b2 = (0, import_diacritics3.remove)(b2.toLowerCase());
92680     if (a2.length === 0) return b2.length;
92681     if (b2.length === 0) return a2.length;
92682     var matrix = [];
92683     var i3, j2;
92684     for (i3 = 0; i3 <= b2.length; i3++) {
92685       matrix[i3] = [i3];
92686     }
92687     for (j2 = 0; j2 <= a2.length; j2++) {
92688       matrix[0][j2] = j2;
92689     }
92690     for (i3 = 1; i3 <= b2.length; i3++) {
92691       for (j2 = 1; j2 <= a2.length; j2++) {
92692         if (b2.charAt(i3 - 1) === a2.charAt(j2 - 1)) {
92693           matrix[i3][j2] = matrix[i3 - 1][j2 - 1];
92694         } else {
92695           matrix[i3][j2] = Math.min(
92696             matrix[i3 - 1][j2 - 1] + 1,
92697             // substitution
92698             Math.min(
92699               matrix[i3][j2 - 1] + 1,
92700               // insertion
92701               matrix[i3 - 1][j2] + 1
92702             )
92703           );
92704         }
92705       }
92706     }
92707     return matrix[b2.length][a2.length];
92708   }
92709   function utilFastMouse(container) {
92710     var rect = container.getBoundingClientRect();
92711     var rectLeft = rect.left;
92712     var rectTop = rect.top;
92713     var clientLeft = +container.clientLeft;
92714     var clientTop = +container.clientTop;
92715     return function(e3) {
92716       return [
92717         e3.clientX - rectLeft - clientLeft,
92718         e3.clientY - rectTop - clientTop
92719       ];
92720     };
92721   }
92722   function utilAsyncMap(inputs, func, callback) {
92723     var remaining = inputs.length;
92724     var results = [];
92725     var errors = [];
92726     inputs.forEach(function(d2, i3) {
92727       func(d2, function done(err, data) {
92728         errors[i3] = err;
92729         results[i3] = data;
92730         remaining--;
92731         if (!remaining) callback(errors, results);
92732       });
92733     });
92734   }
92735   function utilWrap(index, length2) {
92736     if (index < 0) {
92737       index += Math.ceil(-index / length2) * length2;
92738     }
92739     return index % length2;
92740   }
92741   function utilFunctor(value) {
92742     if (typeof value === "function") return value;
92743     return function() {
92744       return value;
92745     };
92746   }
92747   function utilNoAuto(selection2) {
92748     var isText = selection2.size() && selection2.node().tagName.toLowerCase() === "textarea";
92749     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");
92750   }
92751   function utilHashcode(str) {
92752     var hash2 = 0;
92753     if (str.length === 0) {
92754       return hash2;
92755     }
92756     for (var i3 = 0; i3 < str.length; i3++) {
92757       var char = str.charCodeAt(i3);
92758       hash2 = (hash2 << 5) - hash2 + char;
92759       hash2 = hash2 & hash2;
92760     }
92761     return hash2;
92762   }
92763   function utilSafeClassName(str) {
92764     return str.toLowerCase().replace(/[^a-z0-9]+/g, "_");
92765   }
92766   function utilUniqueDomId(val) {
92767     return "ideditor-" + utilSafeClassName(val.toString()) + "-" + (/* @__PURE__ */ new Date()).getTime().toString();
92768   }
92769   function utilUnicodeCharsCount(str) {
92770     return Array.from(str).length;
92771   }
92772   function utilUnicodeCharsTruncated(str, limit) {
92773     return Array.from(str).slice(0, limit).join("");
92774   }
92775   function toNumericID(id2) {
92776     var match = id2.match(/^[cnwr](-?\d+)$/);
92777     if (match) {
92778       return parseInt(match[1], 10);
92779     }
92780     return NaN;
92781   }
92782   function compareNumericIDs(left, right) {
92783     if (isNaN(left) && isNaN(right)) return -1;
92784     if (isNaN(left)) return 1;
92785     if (isNaN(right)) return -1;
92786     if (Math.sign(left) !== Math.sign(right)) return -Math.sign(left);
92787     if (Math.sign(left) < 0) return Math.sign(right - left);
92788     return Math.sign(left - right);
92789   }
92790   function utilCompareIDs(left, right) {
92791     return compareNumericIDs(toNumericID(left), toNumericID(right));
92792   }
92793   function utilOldestID(ids) {
92794     if (ids.length === 0) {
92795       return void 0;
92796     }
92797     var oldestIDIndex = 0;
92798     var oldestID = toNumericID(ids[0]);
92799     for (var i3 = 1; i3 < ids.length; i3++) {
92800       var num = toNumericID(ids[i3]);
92801       if (compareNumericIDs(oldestID, num) === 1) {
92802         oldestIDIndex = i3;
92803         oldestID = num;
92804       }
92805     }
92806     return ids[oldestIDIndex];
92807   }
92808   function utilCleanOsmString(val, maxChars) {
92809     if (val === void 0 || val === null) {
92810       val = "";
92811     } else {
92812       val = val.toString();
92813     }
92814     val = val.trim();
92815     if (val.normalize) val = val.normalize("NFC");
92816     return utilUnicodeCharsTruncated(val, maxChars);
92817   }
92818   var import_diacritics3, transformProperty;
92819   var init_util2 = __esm({
92820     "modules/util/util.js"() {
92821       "use strict";
92822       import_diacritics3 = __toESM(require_diacritics());
92823       init_svg_paths_rtl_fix();
92824       init_localizer();
92825       init_array3();
92826       init_detect();
92827       init_extent();
92828     }
92829   });
92830
92831   // modules/osm/entity.js
92832   var entity_exports = {};
92833   __export(entity_exports, {
92834     osmEntity: () => osmEntity
92835   });
92836   function osmEntity(attrs) {
92837     if (this instanceof osmEntity) return;
92838     if (attrs && attrs.type) {
92839       return osmEntity[attrs.type].apply(this, arguments);
92840     } else if (attrs && attrs.id) {
92841       return osmEntity[osmEntity.id.type(attrs.id)].apply(this, arguments);
92842     }
92843     return new osmEntity().initialize(arguments);
92844   }
92845   var init_entity = __esm({
92846     "modules/osm/entity.js"() {
92847       "use strict";
92848       init_index();
92849       init_tags();
92850       init_array3();
92851       init_util2();
92852       osmEntity.id = function(type2) {
92853         return osmEntity.id.fromOSM(type2, osmEntity.id.next[type2]--);
92854       };
92855       osmEntity.id.next = {
92856         changeset: -1,
92857         node: -1,
92858         way: -1,
92859         relation: -1
92860       };
92861       osmEntity.id.fromOSM = function(type2, id2) {
92862         return type2[0] + id2;
92863       };
92864       osmEntity.id.toOSM = function(id2) {
92865         var match = id2.match(/^[cnwr](-?\d+)$/);
92866         if (match) {
92867           return match[1];
92868         }
92869         return "";
92870       };
92871       osmEntity.id.type = function(id2) {
92872         return { "c": "changeset", "n": "node", "w": "way", "r": "relation" }[id2[0]];
92873       };
92874       osmEntity.key = function(entity) {
92875         return entity.id + "v" + (entity.v || 0);
92876       };
92877       osmEntity.prototype = {
92878         /** @type {Tags} */
92879         tags: {},
92880         /** @type {String} */
92881         id: void 0,
92882         initialize: function(sources) {
92883           for (var i3 = 0; i3 < sources.length; ++i3) {
92884             var source = sources[i3];
92885             for (var prop in source) {
92886               if (Object.prototype.hasOwnProperty.call(source, prop)) {
92887                 if (source[prop] === void 0) {
92888                   delete this[prop];
92889                 } else {
92890                   this[prop] = source[prop];
92891                 }
92892               }
92893             }
92894           }
92895           if (!this.id && this.type) {
92896             this.id = osmEntity.id(this.type);
92897           }
92898           if (!this.hasOwnProperty("visible")) {
92899             this.visible = true;
92900           }
92901           if (debug) {
92902             Object.freeze(this);
92903             Object.freeze(this.tags);
92904             if (this.loc) Object.freeze(this.loc);
92905             if (this.nodes) Object.freeze(this.nodes);
92906             if (this.members) Object.freeze(this.members);
92907           }
92908           return this;
92909         },
92910         copy: function(resolver, copies) {
92911           if (copies[this.id]) return copies[this.id];
92912           var copy2 = osmEntity(this, { id: void 0, user: void 0, version: void 0 });
92913           copies[this.id] = copy2;
92914           return copy2;
92915         },
92916         osmId: function() {
92917           return osmEntity.id.toOSM(this.id);
92918         },
92919         isNew: function() {
92920           var osmId = osmEntity.id.toOSM(this.id);
92921           return osmId.length === 0 || osmId[0] === "-";
92922         },
92923         update: function(attrs) {
92924           return osmEntity(this, attrs, { v: 1 + (this.v || 0) });
92925         },
92926         mergeTags: function(tags) {
92927           var merged = Object.assign({}, this.tags);
92928           var changed = false;
92929           for (var k2 in tags) {
92930             var t12 = merged[k2];
92931             var t2 = tags[k2];
92932             if (!t12) {
92933               changed = true;
92934               merged[k2] = t2;
92935             } else if (t12 !== t2) {
92936               changed = true;
92937               merged[k2] = utilUnicodeCharsTruncated(
92938                 utilArrayUnion(t12.split(/;\s*/), t2.split(/;\s*/)).join(";"),
92939                 255
92940                 // avoid exceeding character limit; see also context.maxCharsForTagValue()
92941               );
92942             }
92943           }
92944           return changed ? this.update({ tags: merged }) : this;
92945         },
92946         intersects: function(extent, resolver) {
92947           return this.extent(resolver).intersects(extent);
92948         },
92949         hasNonGeometryTags: function() {
92950           return Object.keys(this.tags).some(function(k2) {
92951             return k2 !== "area";
92952           });
92953         },
92954         hasParentRelations: function(resolver) {
92955           return resolver.parentRelations(this).length > 0;
92956         },
92957         hasInterestingTags: function() {
92958           return Object.keys(this.tags).some(osmIsInterestingTag);
92959         },
92960         isDegenerate: function() {
92961           return true;
92962         }
92963       };
92964     }
92965   });
92966
92967   // modules/osm/way.js
92968   var way_exports = {};
92969   __export(way_exports, {
92970     osmWay: () => osmWay
92971   });
92972   function osmWay() {
92973     if (!(this instanceof osmWay)) {
92974       return new osmWay().initialize(arguments);
92975     } else if (arguments.length) {
92976       this.initialize(arguments);
92977     }
92978   }
92979   function noRepeatNodes(node, i3, arr) {
92980     return i3 === 0 || node !== arr[i3 - 1];
92981   }
92982   var prototype3;
92983   var init_way = __esm({
92984     "modules/osm/way.js"() {
92985       "use strict";
92986       init_src2();
92987       init_geo2();
92988       init_entity();
92989       init_lanes();
92990       init_tags();
92991       init_util();
92992       osmEntity.way = osmWay;
92993       osmWay.prototype = Object.create(osmEntity.prototype);
92994       prototype3 = {
92995         type: "way",
92996         nodes: [],
92997         copy: function(resolver, copies) {
92998           if (copies[this.id]) return copies[this.id];
92999           var copy2 = osmEntity.prototype.copy.call(this, resolver, copies);
93000           var nodes = this.nodes.map(function(id2) {
93001             return resolver.entity(id2).copy(resolver, copies).id;
93002           });
93003           copy2 = copy2.update({ nodes });
93004           copies[this.id] = copy2;
93005           return copy2;
93006         },
93007         extent: function(resolver) {
93008           return resolver.transient(this, "extent", function() {
93009             var extent = geoExtent();
93010             for (var i3 = 0; i3 < this.nodes.length; i3++) {
93011               var node = resolver.hasEntity(this.nodes[i3]);
93012               if (node) {
93013                 extent._extend(node.extent());
93014               }
93015             }
93016             return extent;
93017           });
93018         },
93019         first: function() {
93020           return this.nodes[0];
93021         },
93022         last: function() {
93023           return this.nodes[this.nodes.length - 1];
93024         },
93025         contains: function(node) {
93026           return this.nodes.indexOf(node) >= 0;
93027         },
93028         affix: function(node) {
93029           if (this.nodes[0] === node) return "prefix";
93030           if (this.nodes[this.nodes.length - 1] === node) return "suffix";
93031         },
93032         layer: function() {
93033           if (isFinite(this.tags.layer)) {
93034             return Math.max(-10, Math.min(+this.tags.layer, 10));
93035           }
93036           if (this.tags.covered === "yes") return -1;
93037           if (this.tags.location === "overground") return 1;
93038           if (this.tags.location === "underground") return -1;
93039           if (this.tags.location === "underwater") return -10;
93040           if (this.tags.power === "line") return 10;
93041           if (this.tags.power === "minor_line") return 10;
93042           if (this.tags.aerialway) return 10;
93043           if (this.tags.bridge) return 1;
93044           if (this.tags.cutting) return -1;
93045           if (this.tags.tunnel) return -1;
93046           if (this.tags.waterway) return -1;
93047           if (this.tags.man_made === "pipeline") return -10;
93048           if (this.tags.boundary) return -10;
93049           return 0;
93050         },
93051         // the approximate width of the line based on its tags except its `width` tag
93052         impliedLineWidthMeters: function() {
93053           var averageWidths = {
93054             highway: {
93055               // width is for single lane
93056               motorway: 5,
93057               motorway_link: 5,
93058               trunk: 4.5,
93059               trunk_link: 4.5,
93060               primary: 4,
93061               secondary: 4,
93062               tertiary: 4,
93063               primary_link: 4,
93064               secondary_link: 4,
93065               tertiary_link: 4,
93066               unclassified: 4,
93067               road: 4,
93068               living_street: 4,
93069               bus_guideway: 4,
93070               busway: 4,
93071               pedestrian: 4,
93072               residential: 3.5,
93073               service: 3.5,
93074               track: 3,
93075               cycleway: 2.5,
93076               bridleway: 2,
93077               corridor: 2,
93078               steps: 2,
93079               path: 1.5,
93080               footway: 1.5,
93081               ladder: 0.5
93082             },
93083             railway: {
93084               // width includes ties and rail bed, not just track gauge
93085               rail: 2.5,
93086               light_rail: 2.5,
93087               tram: 2.5,
93088               subway: 2.5,
93089               monorail: 2.5,
93090               funicular: 2.5,
93091               disused: 2.5,
93092               preserved: 2.5,
93093               miniature: 1.5,
93094               narrow_gauge: 1.5
93095             },
93096             waterway: {
93097               river: 50,
93098               canal: 25,
93099               stream: 5,
93100               tidal_channel: 5,
93101               fish_pass: 2.5,
93102               drain: 2.5,
93103               ditch: 1.5
93104             }
93105           };
93106           for (var key in averageWidths) {
93107             if (this.tags[key] && averageWidths[key][this.tags[key]]) {
93108               var width = averageWidths[key][this.tags[key]];
93109               if (key === "highway") {
93110                 var laneCount = this.tags.lanes && parseInt(this.tags.lanes, 10);
93111                 if (!laneCount) laneCount = this.isOneWay() ? 1 : 2;
93112                 return width * laneCount;
93113               }
93114               return width;
93115             }
93116           }
93117           return null;
93118         },
93119         /** @returns {boolean} for example, if `oneway=yes` */
93120         isOneWayForwards() {
93121           if (this.tags.oneway === "no") return false;
93122           return !!utilCheckTagDictionary(this.tags, osmOneWayForwardTags);
93123         },
93124         /** @returns {boolean} for example, if `oneway=-1` */
93125         isOneWayBackwards() {
93126           if (this.tags.oneway === "no") return false;
93127           return !!utilCheckTagDictionary(this.tags, osmOneWayBackwardTags);
93128         },
93129         /** @returns {boolean} for example, if `oneway=alternating` */
93130         isBiDirectional() {
93131           if (this.tags.oneway === "no") return false;
93132           return !!utilCheckTagDictionary(this.tags, osmOneWayBiDirectionalTags);
93133         },
93134         /** @returns {boolean} */
93135         isOneWay() {
93136           if (this.tags.oneway === "no") return false;
93137           return !!utilCheckTagDictionary(this.tags, osmOneWayTags);
93138         },
93139         // Some identifier for tag that implies that this way is "sided",
93140         // i.e. the right side is the 'inside' (e.g. the right side of a
93141         // natural=cliff is lower).
93142         sidednessIdentifier: function() {
93143           for (const realKey in this.tags) {
93144             const value = this.tags[realKey];
93145             const key = osmRemoveLifecyclePrefix(realKey);
93146             if (key in osmRightSideIsInsideTags && value in osmRightSideIsInsideTags[key]) {
93147               if (osmRightSideIsInsideTags[key][value] === true) {
93148                 return key;
93149               } else {
93150                 return osmRightSideIsInsideTags[key][value];
93151               }
93152             }
93153           }
93154           return null;
93155         },
93156         isSided: function() {
93157           if (this.tags.two_sided === "yes") {
93158             return false;
93159           }
93160           return this.sidednessIdentifier() !== null;
93161         },
93162         lanes: function() {
93163           return osmLanes(this);
93164         },
93165         isClosed: function() {
93166           return this.nodes.length > 1 && this.first() === this.last();
93167         },
93168         isConvex: function(resolver) {
93169           if (!this.isClosed() || this.isDegenerate()) return null;
93170           var nodes = utilArrayUniq(resolver.childNodes(this));
93171           var coords = nodes.map(function(n3) {
93172             return n3.loc;
93173           });
93174           var curr = 0;
93175           var prev = 0;
93176           for (var i3 = 0; i3 < coords.length; i3++) {
93177             var o2 = coords[(i3 + 1) % coords.length];
93178             var a2 = coords[i3];
93179             var b2 = coords[(i3 + 2) % coords.length];
93180             var res = geoVecCross(a2, b2, o2);
93181             curr = res > 0 ? 1 : res < 0 ? -1 : 0;
93182             if (curr === 0) {
93183               continue;
93184             } else if (prev && curr !== prev) {
93185               return false;
93186             }
93187             prev = curr;
93188           }
93189           return true;
93190         },
93191         // returns an object with the tag that implies this is an area, if any
93192         tagSuggestingArea: function() {
93193           return osmTagSuggestingArea(this.tags);
93194         },
93195         isArea: function() {
93196           if (this.tags.area === "yes") return true;
93197           if (!this.isClosed() || this.tags.area === "no") return false;
93198           return this.tagSuggestingArea() !== null;
93199         },
93200         isDegenerate: function() {
93201           return new Set(this.nodes).size < (this.isClosed() ? 3 : 2);
93202         },
93203         areAdjacent: function(n1, n22) {
93204           for (var i3 = 0; i3 < this.nodes.length; i3++) {
93205             if (this.nodes[i3] === n1) {
93206               if (this.nodes[i3 - 1] === n22) return true;
93207               if (this.nodes[i3 + 1] === n22) return true;
93208             }
93209           }
93210           return false;
93211         },
93212         geometry: function(graph) {
93213           return graph.transient(this, "geometry", function() {
93214             return this.isArea() ? "area" : "line";
93215           });
93216         },
93217         // returns an array of objects representing the segments between the nodes in this way
93218         segments: function(graph) {
93219           function segmentExtent(graph2) {
93220             var n1 = graph2.hasEntity(this.nodes[0]);
93221             var n22 = graph2.hasEntity(this.nodes[1]);
93222             return n1 && n22 && geoExtent([
93223               [
93224                 Math.min(n1.loc[0], n22.loc[0]),
93225                 Math.min(n1.loc[1], n22.loc[1])
93226               ],
93227               [
93228                 Math.max(n1.loc[0], n22.loc[0]),
93229                 Math.max(n1.loc[1], n22.loc[1])
93230               ]
93231             ]);
93232           }
93233           return graph.transient(this, "segments", function() {
93234             var segments = [];
93235             for (var i3 = 0; i3 < this.nodes.length - 1; i3++) {
93236               segments.push({
93237                 id: this.id + "-" + i3,
93238                 wayId: this.id,
93239                 index: i3,
93240                 nodes: [this.nodes[i3], this.nodes[i3 + 1]],
93241                 extent: segmentExtent
93242               });
93243             }
93244             return segments;
93245           });
93246         },
93247         // If this way is not closed, append the beginning node to the end of the nodelist to close it.
93248         close: function() {
93249           if (this.isClosed() || !this.nodes.length) return this;
93250           var nodes = this.nodes.slice();
93251           nodes = nodes.filter(noRepeatNodes);
93252           nodes.push(nodes[0]);
93253           return this.update({ nodes });
93254         },
93255         // If this way is closed, remove any connector nodes from the end of the nodelist to unclose it.
93256         unclose: function() {
93257           if (!this.isClosed()) return this;
93258           var nodes = this.nodes.slice();
93259           var connector = this.first();
93260           var i3 = nodes.length - 1;
93261           while (i3 > 0 && nodes.length > 1 && nodes[i3] === connector) {
93262             nodes.splice(i3, 1);
93263             i3 = nodes.length - 1;
93264           }
93265           nodes = nodes.filter(noRepeatNodes);
93266           return this.update({ nodes });
93267         },
93268         // Adds a node (id) in front of the node which is currently at position index.
93269         // If index is undefined, the node will be added to the end of the way for linear ways,
93270         //   or just before the final connecting node for circular ways.
93271         // Consecutive duplicates are eliminated including existing ones.
93272         // Circularity is always preserved when adding a node.
93273         addNode: function(id2, index) {
93274           var nodes = this.nodes.slice();
93275           var isClosed = this.isClosed();
93276           var max3 = isClosed ? nodes.length - 1 : nodes.length;
93277           if (index === void 0) {
93278             index = max3;
93279           }
93280           if (index < 0 || index > max3) {
93281             throw new RangeError("index " + index + " out of range 0.." + max3);
93282           }
93283           if (isClosed) {
93284             var connector = this.first();
93285             var i3 = 1;
93286             while (i3 < nodes.length && nodes.length > 2 && nodes[i3] === connector) {
93287               nodes.splice(i3, 1);
93288               if (index > i3) index--;
93289             }
93290             i3 = nodes.length - 1;
93291             while (i3 > 0 && nodes.length > 1 && nodes[i3] === connector) {
93292               nodes.splice(i3, 1);
93293               if (index > i3) index--;
93294               i3 = nodes.length - 1;
93295             }
93296           }
93297           nodes.splice(index, 0, id2);
93298           nodes = nodes.filter(noRepeatNodes);
93299           if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
93300             nodes.push(nodes[0]);
93301           }
93302           return this.update({ nodes });
93303         },
93304         // Replaces the node which is currently at position index with the given node (id).
93305         // Consecutive duplicates are eliminated including existing ones.
93306         // Circularity is preserved when updating a node.
93307         updateNode: function(id2, index) {
93308           var nodes = this.nodes.slice();
93309           var isClosed = this.isClosed();
93310           var max3 = nodes.length - 1;
93311           if (index === void 0 || index < 0 || index > max3) {
93312             throw new RangeError("index " + index + " out of range 0.." + max3);
93313           }
93314           if (isClosed) {
93315             var connector = this.first();
93316             var i3 = 1;
93317             while (i3 < nodes.length && nodes.length > 2 && nodes[i3] === connector) {
93318               nodes.splice(i3, 1);
93319               if (index > i3) index--;
93320             }
93321             i3 = nodes.length - 1;
93322             while (i3 > 0 && nodes.length > 1 && nodes[i3] === connector) {
93323               nodes.splice(i3, 1);
93324               if (index === i3) index = 0;
93325               i3 = nodes.length - 1;
93326             }
93327           }
93328           nodes.splice(index, 1, id2);
93329           nodes = nodes.filter(noRepeatNodes);
93330           if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
93331             nodes.push(nodes[0]);
93332           }
93333           return this.update({ nodes });
93334         },
93335         // Replaces each occurrence of node id needle with replacement.
93336         // Consecutive duplicates are eliminated including existing ones.
93337         // Circularity is preserved.
93338         replaceNode: function(needleID, replacementID) {
93339           var nodes = this.nodes.slice();
93340           var isClosed = this.isClosed();
93341           for (var i3 = 0; i3 < nodes.length; i3++) {
93342             if (nodes[i3] === needleID) {
93343               nodes[i3] = replacementID;
93344             }
93345           }
93346           nodes = nodes.filter(noRepeatNodes);
93347           if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
93348             nodes.push(nodes[0]);
93349           }
93350           return this.update({ nodes });
93351         },
93352         // Removes each occurrence of node id.
93353         // Consecutive duplicates are eliminated including existing ones.
93354         // Circularity is preserved.
93355         removeNode: function(id2) {
93356           var nodes = this.nodes.slice();
93357           var isClosed = this.isClosed();
93358           nodes = nodes.filter(function(node) {
93359             return node !== id2;
93360           }).filter(noRepeatNodes);
93361           if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
93362             nodes.push(nodes[0]);
93363           }
93364           return this.update({ nodes });
93365         },
93366         asJXON: function(changeset_id) {
93367           var r2 = {
93368             way: {
93369               "@id": this.osmId(),
93370               "@version": this.version || 0,
93371               nd: this.nodes.map(function(id2) {
93372                 return { keyAttributes: { ref: osmEntity.id.toOSM(id2) } };
93373               }, this),
93374               tag: Object.keys(this.tags).map(function(k2) {
93375                 return { keyAttributes: { k: k2, v: this.tags[k2] } };
93376               }, this)
93377             }
93378           };
93379           if (changeset_id) {
93380             r2.way["@changeset"] = changeset_id;
93381           }
93382           return r2;
93383         },
93384         asGeoJSON: function(resolver) {
93385           return resolver.transient(this, "GeoJSON", function() {
93386             var coordinates = resolver.childNodes(this).map(function(n3) {
93387               return n3.loc;
93388             });
93389             if (this.isArea() && this.isClosed()) {
93390               return {
93391                 type: "Polygon",
93392                 coordinates: [coordinates]
93393               };
93394             } else {
93395               return {
93396                 type: "LineString",
93397                 coordinates
93398               };
93399             }
93400           });
93401         },
93402         area: function(resolver) {
93403           return resolver.transient(this, "area", function() {
93404             var nodes = resolver.childNodes(this);
93405             var json = {
93406               type: "Polygon",
93407               coordinates: [nodes.map(function(n3) {
93408                 return n3.loc;
93409               })]
93410             };
93411             if (!this.isClosed() && nodes.length) {
93412               json.coordinates[0].push(nodes[0].loc);
93413             }
93414             var area = area_default(json);
93415             if (area > 2 * Math.PI) {
93416               json.coordinates[0] = json.coordinates[0].reverse();
93417               area = area_default(json);
93418             }
93419             return isNaN(area) ? 0 : area;
93420           });
93421         }
93422       };
93423       Object.assign(osmWay.prototype, prototype3);
93424     }
93425   });
93426
93427   // modules/osm/multipolygon.js
93428   var multipolygon_exports = {};
93429   __export(multipolygon_exports, {
93430     osmJoinWays: () => osmJoinWays
93431   });
93432   function osmJoinWays(toJoin, graph) {
93433     function resolve(member) {
93434       return graph.childNodes(graph.entity(member.id));
93435     }
93436     function reverse(item2) {
93437       var action = actionReverse(item2.id, { reverseOneway: true });
93438       sequences.actions.push(action);
93439       return item2 instanceof osmWay ? action(graph).entity(item2.id) : item2;
93440     }
93441     toJoin = toJoin.filter(function(member) {
93442       return member.type === "way" && graph.hasEntity(member.id);
93443     });
93444     var i3;
93445     var joinAsMembers = true;
93446     for (i3 = 0; i3 < toJoin.length; i3++) {
93447       if (toJoin[i3] instanceof osmWay) {
93448         joinAsMembers = false;
93449         break;
93450       }
93451     }
93452     var sequences = [];
93453     sequences.actions = [];
93454     while (toJoin.length) {
93455       var item = toJoin.shift();
93456       var currWays = [item];
93457       var currNodes = resolve(item).slice();
93458       while (toJoin.length) {
93459         var start2 = currNodes[0];
93460         var end = currNodes[currNodes.length - 1];
93461         var fn = null;
93462         var nodes = null;
93463         for (i3 = 0; i3 < toJoin.length; i3++) {
93464           item = toJoin[i3];
93465           nodes = resolve(item);
93466           if (joinAsMembers && currWays.length === 1 && nodes[0] !== end && nodes[nodes.length - 1] !== end && (nodes[nodes.length - 1] === start2 || nodes[0] === start2)) {
93467             currWays[0] = reverse(currWays[0]);
93468             currNodes.reverse();
93469             start2 = currNodes[0];
93470             end = currNodes[currNodes.length - 1];
93471           }
93472           if (nodes[0] === end) {
93473             fn = currNodes.push;
93474             nodes = nodes.slice(1);
93475             break;
93476           } else if (nodes[nodes.length - 1] === end) {
93477             fn = currNodes.push;
93478             nodes = nodes.slice(0, -1).reverse();
93479             item = reverse(item);
93480             break;
93481           } else if (nodes[nodes.length - 1] === start2) {
93482             fn = currNodes.unshift;
93483             nodes = nodes.slice(0, -1);
93484             break;
93485           } else if (nodes[0] === start2) {
93486             fn = currNodes.unshift;
93487             nodes = nodes.slice(1).reverse();
93488             item = reverse(item);
93489             break;
93490           } else {
93491             fn = nodes = null;
93492           }
93493         }
93494         if (!nodes) {
93495           break;
93496         }
93497         fn.apply(currWays, [item]);
93498         fn.apply(currNodes, nodes);
93499         toJoin.splice(i3, 1);
93500       }
93501       currWays.nodes = currNodes;
93502       sequences.push(currWays);
93503     }
93504     return sequences;
93505   }
93506   var init_multipolygon = __esm({
93507     "modules/osm/multipolygon.js"() {
93508       "use strict";
93509       init_reverse();
93510       init_way();
93511     }
93512   });
93513
93514   // modules/actions/add_member.js
93515   var add_member_exports = {};
93516   __export(add_member_exports, {
93517     actionAddMember: () => actionAddMember
93518   });
93519   function actionAddMember(relationId, member, memberIndex) {
93520     return function action(graph) {
93521       var relation = graph.entity(relationId);
93522       var isPTv2 = /stop|platform/.test(member.role);
93523       if (member.type === "way" && !isPTv2) {
93524         graph = addWayMember(relation, graph);
93525       } else {
93526         if (isPTv2 && isNaN(memberIndex)) {
93527           memberIndex = 0;
93528         }
93529         graph = graph.replace(relation.addMember(member, memberIndex));
93530       }
93531       return graph;
93532     };
93533     function addWayMember(relation, graph) {
93534       var groups, item, i3, j2, k2;
93535       var PTv2members = [];
93536       var members = [];
93537       for (i3 = 0; i3 < relation.members.length; i3++) {
93538         var m2 = relation.members[i3];
93539         if (/stop|platform/.test(m2.role)) {
93540           PTv2members.push(m2);
93541         } else {
93542           members.push(m2);
93543         }
93544       }
93545       relation = relation.update({ members });
93546       groups = utilArrayGroupBy(relation.members, "type");
93547       groups.way = groups.way || [];
93548       groups.way.push(member);
93549       members = withIndex(groups.way);
93550       var joined = osmJoinWays(members, graph);
93551       for (i3 = 0; i3 < joined.length; i3++) {
93552         var segment = joined[i3];
93553         var nodes = segment.nodes.slice();
93554         var startIndex = segment[0].index;
93555         for (j2 = 0; j2 < members.length; j2++) {
93556           if (members[j2].index === startIndex) {
93557             break;
93558           }
93559         }
93560         for (k2 = 0; k2 < segment.length; k2++) {
93561           item = segment[k2];
93562           var way = graph.entity(item.id);
93563           if (k2 > 0) {
93564             if (j2 + k2 >= members.length || item.index !== members[j2 + k2].index) {
93565               moveMember(members, item.index, j2 + k2);
93566             }
93567           }
93568           nodes.splice(0, way.nodes.length - 1);
93569         }
93570       }
93571       var wayMembers = [];
93572       for (i3 = 0; i3 < members.length; i3++) {
93573         item = members[i3];
93574         if (item.index === -1) continue;
93575         wayMembers.push(utilObjectOmit(item, ["index"]));
93576       }
93577       var newMembers = PTv2members.concat(groups.node || [], wayMembers, groups.relation || []);
93578       return graph.replace(relation.update({ members: newMembers }));
93579       function moveMember(arr, findIndex, toIndex) {
93580         var i4;
93581         for (i4 = 0; i4 < arr.length; i4++) {
93582           if (arr[i4].index === findIndex) {
93583             break;
93584           }
93585         }
93586         var item2 = Object.assign({}, arr[i4]);
93587         arr[i4].index = -1;
93588         delete item2.index;
93589         arr.splice(toIndex, 0, item2);
93590       }
93591       function withIndex(arr) {
93592         var result = new Array(arr.length);
93593         for (var i4 = 0; i4 < arr.length; i4++) {
93594           result[i4] = Object.assign({}, arr[i4]);
93595           result[i4].index = i4;
93596         }
93597         return result;
93598       }
93599     }
93600   }
93601   var init_add_member = __esm({
93602     "modules/actions/add_member.js"() {
93603       "use strict";
93604       init_multipolygon();
93605       init_util();
93606     }
93607   });
93608
93609   // modules/actions/index.js
93610   var actions_exports = {};
93611   __export(actions_exports, {
93612     actionAddEntity: () => actionAddEntity,
93613     actionAddMember: () => actionAddMember,
93614     actionAddMidpoint: () => actionAddMidpoint,
93615     actionAddVertex: () => actionAddVertex,
93616     actionChangeMember: () => actionChangeMember,
93617     actionChangePreset: () => actionChangePreset,
93618     actionChangeTags: () => actionChangeTags,
93619     actionCircularize: () => actionCircularize,
93620     actionConnect: () => actionConnect,
93621     actionCopyEntities: () => actionCopyEntities,
93622     actionDeleteMember: () => actionDeleteMember,
93623     actionDeleteMultiple: () => actionDeleteMultiple,
93624     actionDeleteNode: () => actionDeleteNode,
93625     actionDeleteRelation: () => actionDeleteRelation,
93626     actionDeleteWay: () => actionDeleteWay,
93627     actionDiscardTags: () => actionDiscardTags,
93628     actionDisconnect: () => actionDisconnect,
93629     actionExtract: () => actionExtract,
93630     actionJoin: () => actionJoin,
93631     actionMerge: () => actionMerge,
93632     actionMergeNodes: () => actionMergeNodes,
93633     actionMergePolygon: () => actionMergePolygon,
93634     actionMergeRemoteChanges: () => actionMergeRemoteChanges,
93635     actionMove: () => actionMove,
93636     actionMoveMember: () => actionMoveMember,
93637     actionMoveNode: () => actionMoveNode,
93638     actionNoop: () => actionNoop,
93639     actionOrthogonalize: () => actionOrthogonalize,
93640     actionReflect: () => actionReflect,
93641     actionRestrictTurn: () => actionRestrictTurn,
93642     actionReverse: () => actionReverse,
93643     actionRevert: () => actionRevert,
93644     actionRotate: () => actionRotate,
93645     actionScale: () => actionScale,
93646     actionSplit: () => actionSplit,
93647     actionStraightenNodes: () => actionStraightenNodes,
93648     actionStraightenWay: () => actionStraightenWay,
93649     actionUnrestrictTurn: () => actionUnrestrictTurn,
93650     actionUpgradeTags: () => actionUpgradeTags
93651   });
93652   var init_actions = __esm({
93653     "modules/actions/index.js"() {
93654       "use strict";
93655       init_add_entity();
93656       init_add_member();
93657       init_add_midpoint();
93658       init_add_vertex();
93659       init_change_member();
93660       init_change_preset();
93661       init_change_tags();
93662       init_circularize();
93663       init_connect();
93664       init_copy_entities();
93665       init_delete_member();
93666       init_delete_multiple();
93667       init_delete_node();
93668       init_delete_relation();
93669       init_delete_way();
93670       init_discard_tags();
93671       init_disconnect();
93672       init_extract();
93673       init_join2();
93674       init_merge5();
93675       init_merge_nodes();
93676       init_merge_polygon();
93677       init_merge_remote_changes();
93678       init_move();
93679       init_move_member();
93680       init_move_node();
93681       init_noop2();
93682       init_orthogonalize();
93683       init_restrict_turn();
93684       init_reverse();
93685       init_revert();
93686       init_rotate();
93687       init_scale();
93688       init_split();
93689       init_straighten_nodes();
93690       init_straighten_way();
93691       init_unrestrict_turn();
93692       init_reflect();
93693       init_upgrade_tags();
93694     }
93695   });
93696
93697   // node_modules/d3-axis/src/index.js
93698   var init_src19 = __esm({
93699     "node_modules/d3-axis/src/index.js"() {
93700     }
93701   });
93702
93703   // node_modules/d3-brush/src/constant.js
93704   var init_constant7 = __esm({
93705     "node_modules/d3-brush/src/constant.js"() {
93706     }
93707   });
93708
93709   // node_modules/d3-brush/src/event.js
93710   var init_event3 = __esm({
93711     "node_modules/d3-brush/src/event.js"() {
93712     }
93713   });
93714
93715   // node_modules/d3-brush/src/noevent.js
93716   var init_noevent3 = __esm({
93717     "node_modules/d3-brush/src/noevent.js"() {
93718     }
93719   });
93720
93721   // node_modules/d3-brush/src/brush.js
93722   function number1(e3) {
93723     return [+e3[0], +e3[1]];
93724   }
93725   function number22(e3) {
93726     return [number1(e3[0]), number1(e3[1])];
93727   }
93728   function type(t2) {
93729     return { type: t2 };
93730   }
93731   var abs2, max2, min2, X3, Y3, XY;
93732   var init_brush = __esm({
93733     "node_modules/d3-brush/src/brush.js"() {
93734       init_src11();
93735       init_constant7();
93736       init_event3();
93737       init_noevent3();
93738       ({ abs: abs2, max: max2, min: min2 } = Math);
93739       X3 = {
93740         name: "x",
93741         handles: ["w", "e"].map(type),
93742         input: function(x2, e3) {
93743           return x2 == null ? null : [[+x2[0], e3[0][1]], [+x2[1], e3[1][1]]];
93744         },
93745         output: function(xy) {
93746           return xy && [xy[0][0], xy[1][0]];
93747         }
93748       };
93749       Y3 = {
93750         name: "y",
93751         handles: ["n", "s"].map(type),
93752         input: function(y2, e3) {
93753           return y2 == null ? null : [[e3[0][0], +y2[0]], [e3[1][0], +y2[1]]];
93754         },
93755         output: function(xy) {
93756           return xy && [xy[0][1], xy[1][1]];
93757         }
93758       };
93759       XY = {
93760         name: "xy",
93761         handles: ["n", "w", "e", "s", "nw", "ne", "sw", "se"].map(type),
93762         input: function(xy) {
93763           return xy == null ? null : number22(xy);
93764         },
93765         output: function(xy) {
93766           return xy;
93767         }
93768       };
93769     }
93770   });
93771
93772   // node_modules/d3-brush/src/index.js
93773   var init_src20 = __esm({
93774     "node_modules/d3-brush/src/index.js"() {
93775       init_brush();
93776     }
93777   });
93778
93779   // node_modules/d3-path/src/index.js
93780   var init_src21 = __esm({
93781     "node_modules/d3-path/src/index.js"() {
93782     }
93783   });
93784
93785   // node_modules/d3-chord/src/index.js
93786   var init_src22 = __esm({
93787     "node_modules/d3-chord/src/index.js"() {
93788     }
93789   });
93790
93791   // node_modules/d3-contour/src/index.js
93792   var init_src23 = __esm({
93793     "node_modules/d3-contour/src/index.js"() {
93794     }
93795   });
93796
93797   // node_modules/d3-delaunay/src/index.js
93798   var init_src24 = __esm({
93799     "node_modules/d3-delaunay/src/index.js"() {
93800     }
93801   });
93802
93803   // node_modules/d3-quadtree/src/index.js
93804   var init_src25 = __esm({
93805     "node_modules/d3-quadtree/src/index.js"() {
93806     }
93807   });
93808
93809   // node_modules/d3-force/src/index.js
93810   var init_src26 = __esm({
93811     "node_modules/d3-force/src/index.js"() {
93812     }
93813   });
93814
93815   // node_modules/d3-hierarchy/src/index.js
93816   var init_src27 = __esm({
93817     "node_modules/d3-hierarchy/src/index.js"() {
93818     }
93819   });
93820
93821   // node_modules/d3-random/src/index.js
93822   var init_src28 = __esm({
93823     "node_modules/d3-random/src/index.js"() {
93824     }
93825   });
93826
93827   // node_modules/d3-scale-chromatic/src/index.js
93828   var init_src29 = __esm({
93829     "node_modules/d3-scale-chromatic/src/index.js"() {
93830     }
93831   });
93832
93833   // node_modules/d3-shape/src/index.js
93834   var init_src30 = __esm({
93835     "node_modules/d3-shape/src/index.js"() {
93836     }
93837   });
93838
93839   // node_modules/d3/src/index.js
93840   var init_src31 = __esm({
93841     "node_modules/d3/src/index.js"() {
93842       init_src();
93843       init_src19();
93844       init_src20();
93845       init_src22();
93846       init_src7();
93847       init_src23();
93848       init_src24();
93849       init_src4();
93850       init_src6();
93851       init_src17();
93852       init_src10();
93853       init_src18();
93854       init_src26();
93855       init_src13();
93856       init_src2();
93857       init_src27();
93858       init_src8();
93859       init_src21();
93860       init_src3();
93861       init_src25();
93862       init_src28();
93863       init_src16();
93864       init_src29();
93865       init_src5();
93866       init_src30();
93867       init_src14();
93868       init_src15();
93869       init_src9();
93870       init_src11();
93871       init_src12();
93872     }
93873   });
93874
93875   // modules/index.js
93876   var index_exports = {};
93877   __export(index_exports, {
93878     LANGUAGE_SUFFIX_REGEX: () => LANGUAGE_SUFFIX_REGEX,
93879     LocationManager: () => LocationManager,
93880     QAItem: () => QAItem,
93881     actionAddEntity: () => actionAddEntity,
93882     actionAddMember: () => actionAddMember,
93883     actionAddMidpoint: () => actionAddMidpoint,
93884     actionAddVertex: () => actionAddVertex,
93885     actionChangeMember: () => actionChangeMember,
93886     actionChangePreset: () => actionChangePreset,
93887     actionChangeTags: () => actionChangeTags,
93888     actionCircularize: () => actionCircularize,
93889     actionConnect: () => actionConnect,
93890     actionCopyEntities: () => actionCopyEntities,
93891     actionDeleteMember: () => actionDeleteMember,
93892     actionDeleteMultiple: () => actionDeleteMultiple,
93893     actionDeleteNode: () => actionDeleteNode,
93894     actionDeleteRelation: () => actionDeleteRelation,
93895     actionDeleteWay: () => actionDeleteWay,
93896     actionDiscardTags: () => actionDiscardTags,
93897     actionDisconnect: () => actionDisconnect,
93898     actionExtract: () => actionExtract,
93899     actionJoin: () => actionJoin,
93900     actionMerge: () => actionMerge,
93901     actionMergeNodes: () => actionMergeNodes,
93902     actionMergePolygon: () => actionMergePolygon,
93903     actionMergeRemoteChanges: () => actionMergeRemoteChanges,
93904     actionMove: () => actionMove,
93905     actionMoveMember: () => actionMoveMember,
93906     actionMoveNode: () => actionMoveNode,
93907     actionNoop: () => actionNoop,
93908     actionOrthogonalize: () => actionOrthogonalize,
93909     actionReflect: () => actionReflect,
93910     actionRestrictTurn: () => actionRestrictTurn,
93911     actionReverse: () => actionReverse,
93912     actionRevert: () => actionRevert,
93913     actionRotate: () => actionRotate,
93914     actionScale: () => actionScale,
93915     actionSplit: () => actionSplit,
93916     actionStraightenNodes: () => actionStraightenNodes,
93917     actionStraightenWay: () => actionStraightenWay,
93918     actionUnrestrictTurn: () => actionUnrestrictTurn,
93919     actionUpgradeTags: () => actionUpgradeTags,
93920     behaviorAddWay: () => behaviorAddWay,
93921     behaviorBreathe: () => behaviorBreathe,
93922     behaviorDrag: () => behaviorDrag,
93923     behaviorDraw: () => behaviorDraw,
93924     behaviorDrawWay: () => behaviorDrawWay,
93925     behaviorEdit: () => behaviorEdit,
93926     behaviorHash: () => behaviorHash,
93927     behaviorHover: () => behaviorHover,
93928     behaviorLasso: () => behaviorLasso,
93929     behaviorOperation: () => behaviorOperation,
93930     behaviorPaste: () => behaviorPaste,
93931     behaviorSelect: () => behaviorSelect,
93932     coreContext: () => coreContext,
93933     coreDifference: () => coreDifference,
93934     coreFileFetcher: () => coreFileFetcher,
93935     coreGraph: () => coreGraph,
93936     coreHistory: () => coreHistory,
93937     coreLocalizer: () => coreLocalizer,
93938     coreTree: () => coreTree,
93939     coreUploader: () => coreUploader,
93940     coreValidator: () => coreValidator,
93941     d3: () => d3,
93942     debug: () => debug,
93943     dmsCoordinatePair: () => dmsCoordinatePair,
93944     dmsMatcher: () => dmsMatcher,
93945     fileFetcher: () => _mainFileFetcher,
93946     geoAngle: () => geoAngle,
93947     geoChooseEdge: () => geoChooseEdge,
93948     geoEdgeEqual: () => geoEdgeEqual,
93949     geoExtent: () => geoExtent,
93950     geoGetSmallestSurroundingRectangle: () => geoGetSmallestSurroundingRectangle,
93951     geoHasLineIntersections: () => geoHasLineIntersections,
93952     geoHasSelfIntersections: () => geoHasSelfIntersections,
93953     geoLatToMeters: () => geoLatToMeters,
93954     geoLineIntersection: () => geoLineIntersection,
93955     geoLonToMeters: () => geoLonToMeters,
93956     geoMetersToLat: () => geoMetersToLat,
93957     geoMetersToLon: () => geoMetersToLon,
93958     geoMetersToOffset: () => geoMetersToOffset,
93959     geoOffsetToMeters: () => geoOffsetToMeters,
93960     geoOrthoCalcScore: () => geoOrthoCalcScore,
93961     geoOrthoCanOrthogonalize: () => geoOrthoCanOrthogonalize,
93962     geoOrthoMaxOffsetAngle: () => geoOrthoMaxOffsetAngle,
93963     geoOrthoNormalizedDotProduct: () => geoOrthoNormalizedDotProduct,
93964     geoPathHasIntersections: () => geoPathHasIntersections,
93965     geoPathIntersections: () => geoPathIntersections,
93966     geoPathLength: () => geoPathLength,
93967     geoPointInPolygon: () => geoPointInPolygon,
93968     geoPolygonContainsPolygon: () => geoPolygonContainsPolygon,
93969     geoPolygonIntersectsPolygon: () => geoPolygonIntersectsPolygon,
93970     geoRawMercator: () => geoRawMercator,
93971     geoRotate: () => geoRotate,
93972     geoScaleToZoom: () => geoScaleToZoom,
93973     geoSphericalClosestNode: () => geoSphericalClosestNode,
93974     geoSphericalDistance: () => geoSphericalDistance,
93975     geoVecAdd: () => geoVecAdd,
93976     geoVecAngle: () => geoVecAngle,
93977     geoVecCross: () => geoVecCross,
93978     geoVecDot: () => geoVecDot,
93979     geoVecEqual: () => geoVecEqual,
93980     geoVecFloor: () => geoVecFloor,
93981     geoVecInterp: () => geoVecInterp,
93982     geoVecLength: () => geoVecLength,
93983     geoVecLengthSquare: () => geoVecLengthSquare,
93984     geoVecNormalize: () => geoVecNormalize,
93985     geoVecNormalizedDot: () => geoVecNormalizedDot,
93986     geoVecProject: () => geoVecProject,
93987     geoVecScale: () => geoVecScale,
93988     geoVecSubtract: () => geoVecSubtract,
93989     geoViewportEdge: () => geoViewportEdge,
93990     geoZoomToScale: () => geoZoomToScale,
93991     likelyRawNumberFormat: () => likelyRawNumberFormat,
93992     localizer: () => _mainLocalizer,
93993     locationManager: () => _sharedLocationManager,
93994     modeAddArea: () => modeAddArea,
93995     modeAddLine: () => modeAddLine,
93996     modeAddNote: () => modeAddNote,
93997     modeAddPoint: () => modeAddPoint,
93998     modeBrowse: () => modeBrowse,
93999     modeDragNode: () => modeDragNode,
94000     modeDragNote: () => modeDragNote,
94001     modeDrawArea: () => modeDrawArea,
94002     modeDrawLine: () => modeDrawLine,
94003     modeMove: () => modeMove,
94004     modeRotate: () => modeRotate,
94005     modeSave: () => modeSave,
94006     modeSelect: () => modeSelect,
94007     modeSelectData: () => modeSelectData,
94008     modeSelectError: () => modeSelectError,
94009     modeSelectNote: () => modeSelectNote,
94010     operationCircularize: () => operationCircularize,
94011     operationContinue: () => operationContinue,
94012     operationCopy: () => operationCopy,
94013     operationDelete: () => operationDelete,
94014     operationDisconnect: () => operationDisconnect,
94015     operationDowngrade: () => operationDowngrade,
94016     operationExtract: () => operationExtract,
94017     operationMerge: () => operationMerge,
94018     operationMove: () => operationMove,
94019     operationOrthogonalize: () => operationOrthogonalize,
94020     operationPaste: () => operationPaste,
94021     operationReflectLong: () => operationReflectLong,
94022     operationReflectShort: () => operationReflectShort,
94023     operationReverse: () => operationReverse,
94024     operationRotate: () => operationRotate,
94025     operationSplit: () => operationSplit,
94026     operationStraighten: () => operationStraighten,
94027     osmAreaKeys: () => osmAreaKeys,
94028     osmChangeset: () => osmChangeset,
94029     osmEntity: () => osmEntity,
94030     osmFlowingWaterwayTagValues: () => osmFlowingWaterwayTagValues,
94031     osmInferRestriction: () => osmInferRestriction,
94032     osmIntersection: () => osmIntersection,
94033     osmIsInterestingTag: () => osmIsInterestingTag,
94034     osmJoinWays: () => osmJoinWays,
94035     osmLanes: () => osmLanes,
94036     osmLifecyclePrefixes: () => osmLifecyclePrefixes,
94037     osmNode: () => osmNode,
94038     osmNodeGeometriesForTags: () => osmNodeGeometriesForTags,
94039     osmNote: () => osmNote,
94040     osmPavedTags: () => osmPavedTags,
94041     osmPointTags: () => osmPointTags,
94042     osmRailwayTrackTagValues: () => osmRailwayTrackTagValues,
94043     osmRelation: () => osmRelation,
94044     osmRemoveLifecyclePrefix: () => osmRemoveLifecyclePrefix,
94045     osmRoutableHighwayTagValues: () => osmRoutableHighwayTagValues,
94046     osmSetAreaKeys: () => osmSetAreaKeys,
94047     osmSetPointTags: () => osmSetPointTags,
94048     osmSetVertexTags: () => osmSetVertexTags,
94049     osmTagSuggestingArea: () => osmTagSuggestingArea,
94050     osmTurn: () => osmTurn,
94051     osmVertexTags: () => osmVertexTags,
94052     osmWay: () => osmWay,
94053     prefs: () => corePreferences,
94054     presetCategory: () => presetCategory,
94055     presetCollection: () => presetCollection,
94056     presetField: () => presetField,
94057     presetIndex: () => presetIndex,
94058     presetManager: () => _mainPresetIndex,
94059     presetPreset: () => presetPreset,
94060     rendererBackground: () => rendererBackground,
94061     rendererBackgroundSource: () => rendererBackgroundSource,
94062     rendererFeatures: () => rendererFeatures,
94063     rendererMap: () => rendererMap,
94064     rendererPhotos: () => rendererPhotos,
94065     rendererTileLayer: () => rendererTileLayer,
94066     serviceKartaview: () => kartaview_default,
94067     serviceKeepRight: () => keepRight_default,
94068     serviceMapRules: () => maprules_default,
94069     serviceMapilio: () => mapilio_default,
94070     serviceMapillary: () => mapillary_default,
94071     serviceNominatim: () => nominatim_default,
94072     serviceNsi: () => nsi_default,
94073     serviceOsm: () => osm_default,
94074     serviceOsmWikibase: () => osm_wikibase_default,
94075     serviceOsmose: () => osmose_default,
94076     servicePanoramax: () => panoramax_default,
94077     serviceStreetside: () => streetside_default,
94078     serviceTaginfo: () => taginfo_default,
94079     serviceVectorTile: () => vector_tile_default,
94080     serviceVegbilder: () => vegbilder_default,
94081     serviceWikidata: () => wikidata_default,
94082     serviceWikipedia: () => wikipedia_default,
94083     services: () => services,
94084     setDebug: () => setDebug,
94085     svgAreas: () => svgAreas,
94086     svgData: () => svgData,
94087     svgDebug: () => svgDebug,
94088     svgDefs: () => svgDefs,
94089     svgGeolocate: () => svgGeolocate,
94090     svgIcon: () => svgIcon,
94091     svgKartaviewImages: () => svgKartaviewImages,
94092     svgKeepRight: () => svgKeepRight,
94093     svgLabels: () => svgLabels,
94094     svgLayers: () => svgLayers,
94095     svgLines: () => svgLines,
94096     svgMapilioImages: () => svgMapilioImages,
94097     svgMapillaryImages: () => svgMapillaryImages,
94098     svgMapillarySigns: () => svgMapillarySigns,
94099     svgMarkerSegments: () => svgMarkerSegments,
94100     svgMidpoints: () => svgMidpoints,
94101     svgNotes: () => svgNotes,
94102     svgOsm: () => svgOsm,
94103     svgPanoramaxImages: () => svgPanoramaxImages,
94104     svgPassiveVertex: () => svgPassiveVertex,
94105     svgPath: () => svgPath,
94106     svgPointTransform: () => svgPointTransform,
94107     svgPoints: () => svgPoints,
94108     svgRelationMemberTags: () => svgRelationMemberTags,
94109     svgSegmentWay: () => svgSegmentWay,
94110     svgStreetside: () => svgStreetside,
94111     svgTagClasses: () => svgTagClasses,
94112     svgTagPattern: () => svgTagPattern,
94113     svgTouch: () => svgTouch,
94114     svgTurns: () => svgTurns,
94115     svgVegbilder: () => svgVegbilder,
94116     svgVertices: () => svgVertices,
94117     t: () => _t,
94118     uiAccount: () => uiAccount,
94119     uiAttribution: () => uiAttribution,
94120     uiChangesetEditor: () => uiChangesetEditor,
94121     uiCmd: () => uiCmd,
94122     uiCombobox: () => uiCombobox,
94123     uiCommit: () => uiCommit,
94124     uiCommitWarnings: () => uiCommitWarnings,
94125     uiConfirm: () => uiConfirm,
94126     uiConflicts: () => uiConflicts,
94127     uiContributors: () => uiContributors,
94128     uiCurtain: () => uiCurtain,
94129     uiDataEditor: () => uiDataEditor,
94130     uiDataHeader: () => uiDataHeader,
94131     uiDisclosure: () => uiDisclosure,
94132     uiEditMenu: () => uiEditMenu,
94133     uiEntityEditor: () => uiEntityEditor,
94134     uiFeatureInfo: () => uiFeatureInfo,
94135     uiFeatureList: () => uiFeatureList,
94136     uiField: () => uiField,
94137     uiFieldAccess: () => uiFieldAccess,
94138     uiFieldAddress: () => uiFieldAddress,
94139     uiFieldCheck: () => uiFieldCheck,
94140     uiFieldColour: () => uiFieldText,
94141     uiFieldCombo: () => uiFieldCombo,
94142     uiFieldDefaultCheck: () => uiFieldCheck,
94143     uiFieldDirectionalCombo: () => uiFieldDirectionalCombo,
94144     uiFieldEmail: () => uiFieldText,
94145     uiFieldHelp: () => uiFieldHelp,
94146     uiFieldIdentifier: () => uiFieldText,
94147     uiFieldLanes: () => uiFieldLanes,
94148     uiFieldLocalized: () => uiFieldLocalized,
94149     uiFieldManyCombo: () => uiFieldCombo,
94150     uiFieldMultiCombo: () => uiFieldCombo,
94151     uiFieldNetworkCombo: () => uiFieldCombo,
94152     uiFieldNumber: () => uiFieldText,
94153     uiFieldOnewayCheck: () => uiFieldCheck,
94154     uiFieldRadio: () => uiFieldRadio,
94155     uiFieldRestrictions: () => uiFieldRestrictions,
94156     uiFieldRoadheight: () => uiFieldRoadheight,
94157     uiFieldRoadspeed: () => uiFieldRoadspeed,
94158     uiFieldSemiCombo: () => uiFieldCombo,
94159     uiFieldStructureRadio: () => uiFieldRadio,
94160     uiFieldTel: () => uiFieldText,
94161     uiFieldText: () => uiFieldText,
94162     uiFieldTextarea: () => uiFieldTextarea,
94163     uiFieldTypeCombo: () => uiFieldCombo,
94164     uiFieldUrl: () => uiFieldText,
94165     uiFieldWikidata: () => uiFieldWikidata,
94166     uiFieldWikipedia: () => uiFieldWikipedia,
94167     uiFields: () => uiFields,
94168     uiFlash: () => uiFlash,
94169     uiFormFields: () => uiFormFields,
94170     uiFullScreen: () => uiFullScreen,
94171     uiGeolocate: () => uiGeolocate,
94172     uiInfo: () => uiInfo,
94173     uiInfoPanels: () => uiInfoPanels,
94174     uiInit: () => uiInit,
94175     uiInspector: () => uiInspector,
94176     uiIntro: () => uiIntro,
94177     uiIssuesInfo: () => uiIssuesInfo,
94178     uiKeepRightDetails: () => uiKeepRightDetails,
94179     uiKeepRightEditor: () => uiKeepRightEditor,
94180     uiKeepRightHeader: () => uiKeepRightHeader,
94181     uiLasso: () => uiLasso,
94182     uiLengthIndicator: () => uiLengthIndicator,
94183     uiLoading: () => uiLoading,
94184     uiMapInMap: () => uiMapInMap,
94185     uiModal: () => uiModal,
94186     uiNoteComments: () => uiNoteComments,
94187     uiNoteEditor: () => uiNoteEditor,
94188     uiNoteHeader: () => uiNoteHeader,
94189     uiNoteReport: () => uiNoteReport,
94190     uiNotice: () => uiNotice,
94191     uiPaneBackground: () => uiPaneBackground,
94192     uiPaneHelp: () => uiPaneHelp,
94193     uiPaneIssues: () => uiPaneIssues,
94194     uiPaneMapData: () => uiPaneMapData,
94195     uiPanePreferences: () => uiPanePreferences,
94196     uiPanelBackground: () => uiPanelBackground,
94197     uiPanelHistory: () => uiPanelHistory,
94198     uiPanelLocation: () => uiPanelLocation,
94199     uiPanelMeasurement: () => uiPanelMeasurement,
94200     uiPopover: () => uiPopover,
94201     uiPresetIcon: () => uiPresetIcon,
94202     uiPresetList: () => uiPresetList,
94203     uiRestore: () => uiRestore,
94204     uiScale: () => uiScale,
94205     uiSectionBackgroundDisplayOptions: () => uiSectionBackgroundDisplayOptions,
94206     uiSectionBackgroundList: () => uiSectionBackgroundList,
94207     uiSectionBackgroundOffset: () => uiSectionBackgroundOffset,
94208     uiSectionChanges: () => uiSectionChanges,
94209     uiSectionDataLayers: () => uiSectionDataLayers,
94210     uiSectionEntityIssues: () => uiSectionEntityIssues,
94211     uiSectionFeatureType: () => uiSectionFeatureType,
94212     uiSectionMapFeatures: () => uiSectionMapFeatures,
94213     uiSectionMapStyleOptions: () => uiSectionMapStyleOptions,
94214     uiSectionOverlayList: () => uiSectionOverlayList,
94215     uiSectionPhotoOverlays: () => uiSectionPhotoOverlays,
94216     uiSectionPresetFields: () => uiSectionPresetFields,
94217     uiSectionPrivacy: () => uiSectionPrivacy,
94218     uiSectionRawMemberEditor: () => uiSectionRawMemberEditor,
94219     uiSectionRawMembershipEditor: () => uiSectionRawMembershipEditor,
94220     uiSectionRawTagEditor: () => uiSectionRawTagEditor,
94221     uiSectionSelectionList: () => uiSectionSelectionList,
94222     uiSectionValidationIssues: () => uiSectionValidationIssues,
94223     uiSectionValidationOptions: () => uiSectionValidationOptions,
94224     uiSectionValidationRules: () => uiSectionValidationRules,
94225     uiSectionValidationStatus: () => uiSectionValidationStatus,
94226     uiSettingsCustomBackground: () => uiSettingsCustomBackground,
94227     uiSettingsCustomData: () => uiSettingsCustomData,
94228     uiSidebar: () => uiSidebar,
94229     uiSourceSwitch: () => uiSourceSwitch,
94230     uiSpinner: () => uiSpinner,
94231     uiSplash: () => uiSplash,
94232     uiStatus: () => uiStatus,
94233     uiSuccess: () => uiSuccess,
94234     uiTagReference: () => uiTagReference,
94235     uiToggle: () => uiToggle,
94236     uiTooltip: () => uiTooltip,
94237     uiVersion: () => uiVersion,
94238     uiViewOnKeepRight: () => uiViewOnKeepRight,
94239     uiViewOnOSM: () => uiViewOnOSM,
94240     uiZoom: () => uiZoom,
94241     utilAesDecrypt: () => utilAesDecrypt,
94242     utilAesEncrypt: () => utilAesEncrypt,
94243     utilArrayChunk: () => utilArrayChunk,
94244     utilArrayDifference: () => utilArrayDifference,
94245     utilArrayFlatten: () => utilArrayFlatten,
94246     utilArrayGroupBy: () => utilArrayGroupBy,
94247     utilArrayIdentical: () => utilArrayIdentical,
94248     utilArrayIntersection: () => utilArrayIntersection,
94249     utilArrayUnion: () => utilArrayUnion,
94250     utilArrayUniq: () => utilArrayUniq,
94251     utilArrayUniqBy: () => utilArrayUniqBy,
94252     utilAsyncMap: () => utilAsyncMap,
94253     utilCheckTagDictionary: () => utilCheckTagDictionary,
94254     utilCleanOsmString: () => utilCleanOsmString,
94255     utilCleanTags: () => utilCleanTags,
94256     utilCombinedTags: () => utilCombinedTags,
94257     utilCompareIDs: () => utilCompareIDs,
94258     utilDeepMemberSelector: () => utilDeepMemberSelector,
94259     utilDetect: () => utilDetect,
94260     utilDisplayName: () => utilDisplayName,
94261     utilDisplayNameForPath: () => utilDisplayNameForPath,
94262     utilDisplayType: () => utilDisplayType,
94263     utilEditDistance: () => utilEditDistance,
94264     utilEntityAndDeepMemberIDs: () => utilEntityAndDeepMemberIDs,
94265     utilEntityOrDeepMemberSelector: () => utilEntityOrDeepMemberSelector,
94266     utilEntityOrMemberSelector: () => utilEntityOrMemberSelector,
94267     utilEntityRoot: () => utilEntityRoot,
94268     utilEntitySelector: () => utilEntitySelector,
94269     utilFastMouse: () => utilFastMouse,
94270     utilFunctor: () => utilFunctor,
94271     utilGetAllNodes: () => utilGetAllNodes,
94272     utilGetSetValue: () => utilGetSetValue,
94273     utilHashcode: () => utilHashcode,
94274     utilHighlightEntities: () => utilHighlightEntities,
94275     utilKeybinding: () => utilKeybinding,
94276     utilNoAuto: () => utilNoAuto,
94277     utilObjectOmit: () => utilObjectOmit,
94278     utilOldestID: () => utilOldestID,
94279     utilPrefixCSSProperty: () => utilPrefixCSSProperty,
94280     utilPrefixDOMProperty: () => utilPrefixDOMProperty,
94281     utilQsString: () => utilQsString,
94282     utilRebind: () => utilRebind,
94283     utilSafeClassName: () => utilSafeClassName,
94284     utilSessionMutex: () => utilSessionMutex,
94285     utilSetTransform: () => utilSetTransform,
94286     utilStringQs: () => utilStringQs,
94287     utilTagDiff: () => utilTagDiff,
94288     utilTagText: () => utilTagText,
94289     utilTiler: () => utilTiler,
94290     utilTotalExtent: () => utilTotalExtent,
94291     utilTriggerEvent: () => utilTriggerEvent,
94292     utilUnicodeCharsCount: () => utilUnicodeCharsCount,
94293     utilUnicodeCharsTruncated: () => utilUnicodeCharsTruncated,
94294     utilUniqueDomId: () => utilUniqueDomId,
94295     utilWrap: () => utilWrap,
94296     validationAlmostJunction: () => validationAlmostJunction,
94297     validationCloseNodes: () => validationCloseNodes,
94298     validationCrossingWays: () => validationCrossingWays,
94299     validationDisconnectedWay: () => validationDisconnectedWay,
94300     validationFormatting: () => validationFormatting,
94301     validationHelpRequest: () => validationHelpRequest,
94302     validationImpossibleOneway: () => validationImpossibleOneway,
94303     validationIncompatibleSource: () => validationIncompatibleSource,
94304     validationMaprules: () => validationMaprules,
94305     validationMismatchedGeometry: () => validationMismatchedGeometry,
94306     validationMissingRole: () => validationMissingRole,
94307     validationMissingTag: () => validationMissingTag,
94308     validationMutuallyExclusiveTags: () => validationMutuallyExclusiveTags,
94309     validationOsmApiLimits: () => validationOsmApiLimits,
94310     validationOutdatedTags: () => validationOutdatedTags,
94311     validationPrivateData: () => validationPrivateData,
94312     validationSuspiciousName: () => validationSuspiciousName,
94313     validationUnsquareWay: () => validationUnsquareWay
94314   });
94315   var debug, setDebug, d3;
94316   var init_index = __esm({
94317     "modules/index.js"() {
94318       "use strict";
94319       init_actions();
94320       init_behavior();
94321       init_core();
94322       init_geo2();
94323       init_modes2();
94324       init_operations();
94325       init_osm();
94326       init_presets();
94327       init_renderer();
94328       init_services();
94329       init_svg();
94330       init_fields();
94331       init_intro2();
94332       init_panels();
94333       init_panes();
94334       init_sections();
94335       init_settings();
94336       init_ui();
94337       init_util();
94338       init_validations();
94339       init_src31();
94340       debug = false;
94341       setDebug = (newValue) => {
94342         debug = newValue;
94343       };
94344       d3 = {
94345         dispatch: dispatch_default,
94346         geoMercator: mercator_default,
94347         geoProjection: projection,
94348         polygonArea: area_default3,
94349         polygonCentroid: centroid_default2,
94350         select: select_default2,
94351         selectAll: selectAll_default2,
94352         timerFlush
94353       };
94354     }
94355   });
94356
94357   // modules/id.js
94358   var id_exports = {};
94359   var init_id2 = __esm({
94360     "modules/id.js"() {
94361       init_fetch();
94362       init_polyfill_patch_fetch();
94363       init_index();
94364       window.requestIdleCallback = window.requestIdleCallback || function(cb) {
94365         var start2 = Date.now();
94366         return window.requestAnimationFrame(function() {
94367           cb({
94368             didTimeout: false,
94369             timeRemaining: function() {
94370               return Math.max(0, 50 - (Date.now() - start2));
94371             }
94372           });
94373         });
94374       };
94375       window.cancelIdleCallback = window.cancelIdleCallback || function(id2) {
94376         window.cancelAnimationFrame(id2);
94377       };
94378       window.iD = index_exports;
94379     }
94380   });
94381   init_id2();
94382 })();
94383 //# sourceMappingURL=iD.js.map