X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/52591c55610b656cca3ef37269a8eef713368fc6..81ce6a7de0be8ada90ebc587506d957d609babfa:/vendor/assets/iD/iD.js?ds=inline diff --git a/vendor/assets/iD/iD.js b/vendor/assets/iD/iD.js index d4d7bb70c..ad4c20493 100644 --- a/vendor/assets/iD/iD.js +++ b/vendor/assets/iD/iD.js @@ -3599,6 +3599,8 @@ var bboxes = []; for (var i2 = 0; i2 < data.features.length; i2++) { var feature3 = data.features[i2]; + if (!feature3.geometry) + continue; var coords = feature3.geometry.coordinates; if (feature3.geometry.type === "Polygon") { bboxes.push(treeItem(coords, feature3.properties)); @@ -4097,7 +4099,7 @@ right }; } - function merge3(left, right, comparator) { + function merge2(left, right, comparator) { if (right === null) return left; if (left === null) @@ -4273,12 +4275,12 @@ return this; }; Tree2.prototype.keys = function() { - var keys = []; + var keys2 = []; this.forEach(function(_a) { var key = _a.key; - return keys.push(key); + return keys2.push(key); }); - return keys; + return keys2; }; Tree2.prototype.values = function() { var values = []; @@ -4395,22 +4397,22 @@ Tree2.prototype.toList = function() { return toList(this._root); }; - Tree2.prototype.load = function(keys, values, presort) { + Tree2.prototype.load = function(keys2, values, presort) { if (values === void 0) { values = []; } if (presort === void 0) { presort = false; } - var size = keys.length; + var size = keys2.length; var comparator = this._comparator; if (presort) - sort(keys, values, 0, size - 1, comparator); + sort(keys2, values, 0, size - 1, comparator); if (this._root === null) { - this._root = loadRecursive(keys, values, 0, size); + this._root = loadRecursive(keys2, values, 0, size); this._size = size; } else { - var mergedList = mergeLists(this.toList(), createList(keys, values), comparator); + var mergedList = mergeLists(this.toList(), createList(keys2, values), comparator); size = this._size + size; this._root = sortedListToBST({ head: mergedList @@ -4455,7 +4457,7 @@ } else { left = insert(newKey, newData, left, comparator); } - this._root = merge3(left, right, comparator); + this._root = merge2(left, right, comparator); }; Tree2.prototype.split = function(key) { return split(key, this._root, this._comparator); @@ -4463,24 +4465,24 @@ return Tree2; }() ); - function loadRecursive(keys, values, start2, end) { + function loadRecursive(keys2, values, start2, end) { var size = end - start2; if (size > 0) { var middle = start2 + Math.floor(size / 2); - var key = keys[middle]; + var key = keys2[middle]; var data = values[middle]; var node = new Node(key, data); - node.left = loadRecursive(keys, values, start2, middle); - node.right = loadRecursive(keys, values, middle + 1, end); + node.left = loadRecursive(keys2, values, start2, middle); + node.right = loadRecursive(keys2, values, middle + 1, end); return node; } return null; } - function createList(keys, values) { + function createList(keys2, values) { var head = new Node(null, null); var p = head; - for (var i2 = 0; i2 < keys.length; i2++) { - p = p.next = new Node(keys[i2], values[i2]); + for (var i2 = 0; i2 < keys2.length; i2++) { + p = p.next = new Node(keys2[i2], values[i2]); } p.next = null; return head.next; @@ -4541,30 +4543,30 @@ } return head.next; } - function sort(keys, values, left, right, compare) { + function sort(keys2, values, left, right, compare) { if (left >= right) return; - var pivot = keys[left + right >> 1]; + var pivot = keys2[left + right >> 1]; var i2 = left - 1; var j2 = right + 1; while (true) { do { i2++; - } while (compare(keys[i2], pivot) < 0); + } while (compare(keys2[i2], pivot) < 0); do { j2--; - } while (compare(keys[j2], pivot) > 0); + } while (compare(keys2[j2], pivot) > 0); if (i2 >= j2) break; - var tmp = keys[i2]; - keys[i2] = keys[j2]; - keys[j2] = tmp; + var tmp = keys2[i2]; + keys2[i2] = keys2[j2]; + keys2[j2] = tmp; tmp = values[i2]; values[i2] = values[j2]; values[j2] = tmp; } - sort(keys, values, left, j2, compare); - sort(keys, values, j2 + 1, right, compare); + sort(keys2, values, left, j2, compare); + sort(keys2, values, j2 + 1, right, compare); } var isInBbox = function isInBbox2(bbox2, point2) { return bbox2.ll.x <= point2.x && point2.x <= bbox2.ur.x && bbox2.ll.y <= point2.y && point2.y <= bbox2.ur.y; @@ -6764,69 +6766,24 @@ } }); - // node_modules/fast-deep-equal/index.js - var require_fast_deep_equal = __commonJS({ - "node_modules/fast-deep-equal/index.js"(exports2, module2) { - "use strict"; - module2.exports = function equal(a, b) { - if (a === b) - return true; - if (a && b && typeof a == "object" && typeof b == "object") { - if (a.constructor !== b.constructor) - return false; - var length, i2, keys; - if (Array.isArray(a)) { - length = a.length; - if (length != b.length) - return false; - for (i2 = length; i2-- !== 0; ) - if (!equal(a[i2], b[i2])) - return false; - return true; - } - if (a.constructor === RegExp) - return a.source === b.source && a.flags === b.flags; - if (a.valueOf !== Object.prototype.valueOf) - return a.valueOf() === b.valueOf(); - if (a.toString !== Object.prototype.toString) - return a.toString() === b.toString(); - keys = Object.keys(a); - length = keys.length; - if (length !== Object.keys(b).length) - return false; - for (i2 = length; i2-- !== 0; ) - if (!Object.prototype.hasOwnProperty.call(b, keys[i2])) - return false; - for (i2 = length; i2-- !== 0; ) { - var key = keys[i2]; - if (!equal(a[key], b[key])) - return false; - } - return true; - } - return a !== a && b !== b; - }; - } - }); - // node_modules/lodash/lodash.js var require_lodash = __commonJS({ "node_modules/lodash/lodash.js"(exports2, module2) { (function() { var undefined2; var VERSION = "4.17.21"; - var LARGE_ARRAY_SIZE = 200; + var LARGE_ARRAY_SIZE2 = 200; 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`"; - var HASH_UNDEFINED = "__lodash_hash_undefined__"; + var HASH_UNDEFINED4 = "__lodash_hash_undefined__"; var MAX_MEMOIZE_SIZE = 500; var PLACEHOLDER = "__lodash_placeholder__"; var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4; - var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2; + var COMPARE_PARTIAL_FLAG5 = 1, COMPARE_UNORDERED_FLAG3 = 2; 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; var DEFAULT_TRUNC_LENGTH = 30, DEFAULT_TRUNC_OMISSION = "..."; var HOT_COUNT = 800, HOT_SPAN = 16; var LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2, LAZY_WHILE_FLAG = 3; - var INFINITY2 = 1 / 0, MAX_SAFE_INTEGER = 9007199254740991, MAX_INTEGER = 17976931348623157e292, NAN2 = 0 / 0; + var INFINITY2 = 1 / 0, MAX_SAFE_INTEGER3 = 9007199254740991, MAX_INTEGER = 17976931348623157e292, NAN2 = 0 / 0; var MAX_ARRAY_LENGTH = 4294967295, MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; var wrapFlags = [ ["ary", WRAP_ARY_FLAG], @@ -6839,13 +6796,13 @@ ["partialRight", WRAP_PARTIAL_RIGHT_FLAG], ["rearg", WRAP_REARG_FLAG] ]; - var argsTag = "[object Arguments]", arrayTag = "[object Array]", asyncTag = "[object AsyncFunction]", boolTag = "[object Boolean]", dateTag = "[object Date]", domExcTag = "[object DOMException]", errorTag = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag = "[object Map]", numberTag = "[object Number]", nullTag2 = "[object Null]", objectTag = "[object Object]", promiseTag = "[object Promise]", proxyTag = "[object Proxy]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag2 = "[object Symbol]", undefinedTag2 = "[object Undefined]", weakMapTag = "[object WeakMap]", weakSetTag = "[object WeakSet]"; - var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]"; + var argsTag4 = "[object Arguments]", arrayTag3 = "[object Array]", asyncTag2 = "[object AsyncFunction]", boolTag3 = "[object Boolean]", dateTag3 = "[object Date]", domExcTag = "[object DOMException]", errorTag3 = "[object Error]", funcTag3 = "[object Function]", genTag2 = "[object GeneratorFunction]", mapTag4 = "[object Map]", numberTag3 = "[object Number]", nullTag2 = "[object Null]", objectTag4 = "[object Object]", promiseTag2 = "[object Promise]", proxyTag2 = "[object Proxy]", regexpTag3 = "[object RegExp]", setTag4 = "[object Set]", stringTag3 = "[object String]", symbolTag3 = "[object Symbol]", undefinedTag2 = "[object Undefined]", weakMapTag3 = "[object WeakMap]", weakSetTag = "[object WeakSet]"; + 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]"; var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; var reEscapedHtml2 = /&(?:amp|lt|gt|quot|#39);/g, reUnescapedHtml2 = /[&<>"']/g, reHasEscapedHtml2 = RegExp(reEscapedHtml2.source), reHasUnescapedHtml2 = RegExp(reUnescapedHtml2.source); var reEscape = /<%-([\s\S]+?)%>/g, reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g; var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; - var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar.source); + var reRegExpChar2 = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar2.source); var reTrimStart2 = /^\s+/; var reWhitespace2 = /\s/; var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, reSplitDetails = /,? & /; @@ -6856,9 +6813,9 @@ var reFlags = /\w*$/; var reIsBadHex2 = /^[-+]0x[0-9a-f]+$/i; var reIsBinary2 = /^0b[01]+$/i; - var reIsHostCtor = /^\[object .+?Constructor\]$/; + var reIsHostCtor2 = /^\[object .+?Constructor\]$/; var reIsOctal2 = /^0o[0-7]+$/i; - var reIsUint = /^(?:0|[1-9]\d*)$/; + var reIsUint2 = /^(?:0|[1-9]\d*)$/; var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; var reNoMatch = /($^)/; var reUnescapedString = /['\n\r\u2028\u2029\\]/g; @@ -6913,12 +6870,12 @@ "setTimeout" ]; var templateCounter = -1; - var typedArrayTags = {}; - typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true; - typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; + var typedArrayTags2 = {}; + typedArrayTags2[float32Tag2] = typedArrayTags2[float64Tag2] = typedArrayTags2[int8Tag2] = typedArrayTags2[int16Tag2] = typedArrayTags2[int32Tag2] = typedArrayTags2[uint8Tag2] = typedArrayTags2[uint8ClampedTag2] = typedArrayTags2[uint16Tag2] = typedArrayTags2[uint32Tag2] = true; + typedArrayTags2[argsTag4] = typedArrayTags2[arrayTag3] = typedArrayTags2[arrayBufferTag3] = typedArrayTags2[boolTag3] = typedArrayTags2[dataViewTag4] = typedArrayTags2[dateTag3] = typedArrayTags2[errorTag3] = typedArrayTags2[funcTag3] = typedArrayTags2[mapTag4] = typedArrayTags2[numberTag3] = typedArrayTags2[objectTag4] = typedArrayTags2[regexpTag3] = typedArrayTags2[setTag4] = typedArrayTags2[stringTag3] = typedArrayTags2[weakMapTag3] = false; var cloneableTags = {}; - cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag2] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; - cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false; + cloneableTags[argsTag4] = cloneableTags[arrayTag3] = cloneableTags[arrayBufferTag3] = cloneableTags[dataViewTag4] = cloneableTags[boolTag3] = cloneableTags[dateTag3] = cloneableTags[float32Tag2] = cloneableTags[float64Tag2] = cloneableTags[int8Tag2] = cloneableTags[int16Tag2] = cloneableTags[int32Tag2] = cloneableTags[mapTag4] = cloneableTags[numberTag3] = cloneableTags[objectTag4] = cloneableTags[regexpTag3] = cloneableTags[setTag4] = cloneableTags[stringTag3] = cloneableTags[symbolTag3] = cloneableTags[uint8Tag2] = cloneableTags[uint8ClampedTag2] = cloneableTags[uint16Tag2] = cloneableTags[uint32Tag2] = true; + cloneableTags[errorTag3] = cloneableTags[funcTag3] = cloneableTags[weakMapTag3] = false; var deburredLetters = { // Latin-1 Supplement block. "\xC0": "A", @@ -7139,21 +7096,21 @@ var freeGlobal2 = typeof global == "object" && global && global.Object === Object && global; var freeSelf2 = typeof self == "object" && self && self.Object === Object && self; var root3 = freeGlobal2 || freeSelf2 || Function("return this")(); - var freeExports = typeof exports2 == "object" && exports2 && !exports2.nodeType && exports2; - var freeModule = freeExports && typeof module2 == "object" && module2 && !module2.nodeType && module2; - var moduleExports = freeModule && freeModule.exports === freeExports; - var freeProcess = moduleExports && freeGlobal2.process; - var nodeUtil = function() { + var freeExports3 = typeof exports2 == "object" && exports2 && !exports2.nodeType && exports2; + var freeModule3 = freeExports3 && typeof module2 == "object" && module2 && !module2.nodeType && module2; + var moduleExports3 = freeModule3 && freeModule3.exports === freeExports3; + var freeProcess2 = moduleExports3 && freeGlobal2.process; + var nodeUtil2 = function() { try { - var types = freeModule && freeModule.require && freeModule.require("util").types; + var types = freeModule3 && freeModule3.require && freeModule3.require("util").types; if (types) { return types; } - return freeProcess && freeProcess.binding && freeProcess.binding("util"); + return freeProcess2 && freeProcess2.binding && freeProcess2.binding("util"); } catch (e) { } }(); - var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer, nodeIsDate = nodeUtil && nodeUtil.isDate, nodeIsMap = nodeUtil && nodeUtil.isMap, nodeIsRegExp = nodeUtil && nodeUtil.isRegExp, nodeIsSet = nodeUtil && nodeUtil.isSet, nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; + 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; function apply(func, thisArg, args) { switch (args.length) { case 0: @@ -7202,7 +7159,7 @@ } return true; } - function arrayFilter(array2, predicate) { + function arrayFilter2(array2, predicate) { var index = -1, length = array2 == null ? 0 : array2.length, resIndex = 0, result = []; while (++index < length) { var value = array2[index]; @@ -7232,7 +7189,7 @@ } return result; } - function arrayPush(array2, values) { + function arrayPush2(array2, values) { var index = -1, length = values.length, offset = array2.length; while (++index < length) { array2[offset + index] = values[index]; @@ -7259,7 +7216,7 @@ } return accumulator; } - function arraySome(array2, predicate) { + function arraySome2(array2, predicate) { var index = -1, length = array2 == null ? 0 : array2.length; while (++index < length) { if (predicate(array2[index], index, array2)) { @@ -7347,7 +7304,7 @@ } return result; } - function baseTimes(n2, iteratee) { + function baseTimes2(n2, iteratee) { var index = -1, result = Array(n2); while (++index < n2) { result[index] = iteratee(index); @@ -7362,7 +7319,7 @@ function baseTrim2(string) { return string ? string.slice(0, trimmedEndIndex2(string) + 1).replace(reTrimStart2, "") : string; } - function baseUnary(func) { + function baseUnary2(func) { return function(value) { return func(value); }; @@ -7372,7 +7329,7 @@ return object[key]; }); } - function cacheHas(cache, key) { + function cacheHas2(cache, key) { return cache.has(key); } function charsStartIndex(strSymbols, chrSymbols) { @@ -7401,7 +7358,7 @@ function escapeStringChar(chr) { return "\\" + stringEscapes[chr]; } - function getValue(object, key) { + function getValue2(object, key) { return object == null ? undefined2 : object[key]; } function hasUnicode(string) { @@ -7417,14 +7374,14 @@ } return result; } - function mapToArray(map2) { + function mapToArray2(map2) { var index = -1, result = Array(map2.size); map2.forEach(function(value, key) { result[++index] = [key, value]; }); return result; } - function overArg(func, transform2) { + function overArg2(func, transform2) { return function(arg) { return func(transform2(arg)); }; @@ -7440,7 +7397,7 @@ } return result; } - function setToArray(set3) { + function setToArray2(set3) { var index = -1, result = Array(set3.size); set3.forEach(function(value) { result[++index] = value; @@ -7501,43 +7458,43 @@ var runInContext = function runInContext2(context) { context = context == null ? root3 : _.defaults(root3.Object(), context, _.pick(root3, contextProps)); 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; - var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto3 = Object2.prototype; - var coreJsData = context["__core-js_shared__"]; - var funcToString = funcProto.toString; - var hasOwnProperty2 = objectProto3.hasOwnProperty; + var arrayProto2 = Array2.prototype, funcProto3 = Function2.prototype, objectProto13 = Object2.prototype; + var coreJsData2 = context["__core-js_shared__"]; + var funcToString3 = funcProto3.toString; + var hasOwnProperty10 = objectProto13.hasOwnProperty; var idCounter = 0; - var maskSrcKey = function() { - var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ""); + var maskSrcKey2 = function() { + var uid = /[^.]+$/.exec(coreJsData2 && coreJsData2.keys && coreJsData2.keys.IE_PROTO || ""); return uid ? "Symbol(src)_1." + uid : ""; }(); - var nativeObjectToString3 = objectProto3.toString; - var objectCtorString = funcToString.call(Object2); + var nativeObjectToString3 = objectProto13.toString; + var objectCtorString = funcToString3.call(Object2); var oldDash = root3._; - var reIsNative = RegExp2( - "^" + funcToString.call(hasOwnProperty2).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" + var reIsNative2 = RegExp2( + "^" + funcToString3.call(hasOwnProperty10).replace(reRegExpChar2, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" ); - var Buffer2 = moduleExports ? context.Buffer : undefined2, Symbol3 = context.Symbol, Uint8Array2 = context.Uint8Array, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : undefined2, getPrototype = overArg(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable = objectProto3.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol3 ? Symbol3.isConcatSpreadable : undefined2, symIterator = Symbol3 ? Symbol3.iterator : undefined2, symToStringTag3 = Symbol3 ? Symbol3.toStringTag : undefined2; + var Buffer3 = moduleExports3 ? context.Buffer : undefined2, Symbol3 = context.Symbol, Uint8Array3 = context.Uint8Array, allocUnsafe = Buffer3 ? Buffer3.allocUnsafe : undefined2, getPrototype = overArg2(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable3 = objectProto13.propertyIsEnumerable, splice2 = arrayProto2.splice, spreadableSymbol = Symbol3 ? Symbol3.isConcatSpreadable : undefined2, symIterator = Symbol3 ? Symbol3.iterator : undefined2, symToStringTag3 = Symbol3 ? Symbol3.toStringTag : undefined2; var defineProperty = function() { try { - var func = getNative(Object2, "defineProperty"); + var func = getNative2(Object2, "defineProperty"); func({}, "", {}); return func; } catch (e) { } }(); var ctxClearTimeout = context.clearTimeout !== root3.clearTimeout && context.clearTimeout, ctxNow = Date2 && Date2.now !== root3.Date.now && Date2.now, ctxSetTimeout = context.setTimeout !== root3.setTimeout && context.setTimeout; - var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : undefined2, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object2.keys, Object2), nativeMax2 = Math2.max, nativeMin2 = Math2.min, nativeNow = Date2.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto.reverse; - var DataView2 = getNative(context, "DataView"), Map2 = getNative(context, "Map"), Promise2 = getNative(context, "Promise"), Set2 = getNative(context, "Set"), WeakMap = getNative(context, "WeakMap"), nativeCreate = getNative(Object2, "create"); - var metaMap = WeakMap && new WeakMap(); + var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols2 = Object2.getOwnPropertySymbols, nativeIsBuffer2 = Buffer3 ? Buffer3.isBuffer : undefined2, nativeIsFinite = context.isFinite, nativeJoin = arrayProto2.join, nativeKeys2 = overArg2(Object2.keys, Object2), nativeMax2 = Math2.max, nativeMin2 = Math2.min, nativeNow = Date2.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto2.reverse; + 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"); + var metaMap = WeakMap2 && new WeakMap2(); var realNames = {}; - var dataViewCtorString = toSource(DataView2), mapCtorString = toSource(Map2), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set2), weakMapCtorString = toSource(WeakMap); - var symbolProto2 = Symbol3 ? Symbol3.prototype : undefined2, symbolValueOf = symbolProto2 ? symbolProto2.valueOf : undefined2, symbolToString2 = symbolProto2 ? symbolProto2.toString : undefined2; + var dataViewCtorString2 = toSource2(DataView3), mapCtorString2 = toSource2(Map3), promiseCtorString2 = toSource2(Promise3), setCtorString2 = toSource2(Set3), weakMapCtorString2 = toSource2(WeakMap2); + var symbolProto3 = Symbol3 ? Symbol3.prototype : undefined2, symbolValueOf2 = symbolProto3 ? symbolProto3.valueOf : undefined2, symbolToString2 = symbolProto3 ? symbolProto3.toString : undefined2; function lodash(value) { if (isObjectLike2(value) && !isArray2(value) && !(value instanceof LazyWrapper)) { if (value instanceof LodashWrapper) { return value; } - if (hasOwnProperty2.call(value, "__wrapped__")) { + if (hasOwnProperty10.call(value, "__wrapped__")) { return wrapperClone(value); } } @@ -7675,7 +7632,7 @@ } LazyWrapper.prototype = baseCreate(baseLodash.prototype); LazyWrapper.prototype.constructor = LazyWrapper; - function Hash(entries) { + function Hash2(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { @@ -7683,39 +7640,39 @@ this.set(entry[0], entry[1]); } } - function hashClear() { - this.__data__ = nativeCreate ? nativeCreate(null) : {}; + function hashClear2() { + this.__data__ = nativeCreate2 ? nativeCreate2(null) : {}; this.size = 0; } - function hashDelete(key) { + function hashDelete2(key) { var result2 = this.has(key) && delete this.__data__[key]; this.size -= result2 ? 1 : 0; return result2; } - function hashGet(key) { + function hashGet2(key) { var data = this.__data__; - if (nativeCreate) { + if (nativeCreate2) { var result2 = data[key]; - return result2 === HASH_UNDEFINED ? undefined2 : result2; + return result2 === HASH_UNDEFINED4 ? undefined2 : result2; } - return hasOwnProperty2.call(data, key) ? data[key] : undefined2; + return hasOwnProperty10.call(data, key) ? data[key] : undefined2; } - function hashHas(key) { + function hashHas2(key) { var data = this.__data__; - return nativeCreate ? data[key] !== undefined2 : hasOwnProperty2.call(data, key); + return nativeCreate2 ? data[key] !== undefined2 : hasOwnProperty10.call(data, key); } - function hashSet(key, value) { + function hashSet2(key, value) { var data = this.__data__; this.size += this.has(key) ? 0 : 1; - data[key] = nativeCreate && value === undefined2 ? HASH_UNDEFINED : value; + data[key] = nativeCreate2 && value === undefined2 ? HASH_UNDEFINED4 : value; return this; } - Hash.prototype.clear = hashClear; - Hash.prototype["delete"] = hashDelete; - Hash.prototype.get = hashGet; - Hash.prototype.has = hashHas; - Hash.prototype.set = hashSet; - function ListCache(entries) { + Hash2.prototype.clear = hashClear2; + Hash2.prototype["delete"] = hashDelete2; + Hash2.prototype.get = hashGet2; + Hash2.prototype.has = hashHas2; + Hash2.prototype.set = hashSet2; + function ListCache2(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { @@ -7723,12 +7680,12 @@ this.set(entry[0], entry[1]); } } - function listCacheClear() { + function listCacheClear2() { this.__data__ = []; this.size = 0; } - function listCacheDelete(key) { - var data = this.__data__, index = assocIndexOf(data, key); + function listCacheDelete2(key) { + var data = this.__data__, index = assocIndexOf2(data, key); if (index < 0) { return false; } @@ -7736,20 +7693,20 @@ if (index == lastIndex) { data.pop(); } else { - splice.call(data, index, 1); + splice2.call(data, index, 1); } --this.size; return true; } - function listCacheGet(key) { - var data = this.__data__, index = assocIndexOf(data, key); + function listCacheGet2(key) { + var data = this.__data__, index = assocIndexOf2(data, key); return index < 0 ? undefined2 : data[index][1]; } - function listCacheHas(key) { - return assocIndexOf(this.__data__, key) > -1; + function listCacheHas2(key) { + return assocIndexOf2(this.__data__, key) > -1; } - function listCacheSet(key, value) { - var data = this.__data__, index = assocIndexOf(data, key); + function listCacheSet2(key, value) { + var data = this.__data__, index = assocIndexOf2(data, key); if (index < 0) { ++this.size; data.push([key, value]); @@ -7758,12 +7715,12 @@ } return this; } - ListCache.prototype.clear = listCacheClear; - ListCache.prototype["delete"] = listCacheDelete; - ListCache.prototype.get = listCacheGet; - ListCache.prototype.has = listCacheHas; - ListCache.prototype.set = listCacheSet; - function MapCache(entries) { + ListCache2.prototype.clear = listCacheClear2; + ListCache2.prototype["delete"] = listCacheDelete2; + ListCache2.prototype.get = listCacheGet2; + ListCache2.prototype.has = listCacheHas2; + ListCache2.prototype.set = listCacheSet2; + function MapCache2(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { @@ -7771,99 +7728,99 @@ this.set(entry[0], entry[1]); } } - function mapCacheClear() { + function mapCacheClear2() { this.size = 0; this.__data__ = { - "hash": new Hash(), - "map": new (Map2 || ListCache)(), - "string": new Hash() + "hash": new Hash2(), + "map": new (Map3 || ListCache2)(), + "string": new Hash2() }; } - function mapCacheDelete(key) { - var result2 = getMapData(this, key)["delete"](key); + function mapCacheDelete2(key) { + var result2 = getMapData2(this, key)["delete"](key); this.size -= result2 ? 1 : 0; return result2; } - function mapCacheGet(key) { - return getMapData(this, key).get(key); + function mapCacheGet2(key) { + return getMapData2(this, key).get(key); } - function mapCacheHas(key) { - return getMapData(this, key).has(key); + function mapCacheHas2(key) { + return getMapData2(this, key).has(key); } - function mapCacheSet(key, value) { - var data = getMapData(this, key), size2 = data.size; + function mapCacheSet2(key, value) { + var data = getMapData2(this, key), size2 = data.size; data.set(key, value); this.size += data.size == size2 ? 0 : 1; return this; } - MapCache.prototype.clear = mapCacheClear; - MapCache.prototype["delete"] = mapCacheDelete; - MapCache.prototype.get = mapCacheGet; - MapCache.prototype.has = mapCacheHas; - MapCache.prototype.set = mapCacheSet; - function SetCache(values2) { + MapCache2.prototype.clear = mapCacheClear2; + MapCache2.prototype["delete"] = mapCacheDelete2; + MapCache2.prototype.get = mapCacheGet2; + MapCache2.prototype.has = mapCacheHas2; + MapCache2.prototype.set = mapCacheSet2; + function SetCache2(values2) { var index = -1, length = values2 == null ? 0 : values2.length; - this.__data__ = new MapCache(); + this.__data__ = new MapCache2(); while (++index < length) { this.add(values2[index]); } } - function setCacheAdd(value) { - this.__data__.set(value, HASH_UNDEFINED); + function setCacheAdd2(value) { + this.__data__.set(value, HASH_UNDEFINED4); return this; } - function setCacheHas(value) { + function setCacheHas2(value) { return this.__data__.has(value); } - SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; - SetCache.prototype.has = setCacheHas; - function Stack(entries) { - var data = this.__data__ = new ListCache(entries); + SetCache2.prototype.add = SetCache2.prototype.push = setCacheAdd2; + SetCache2.prototype.has = setCacheHas2; + function Stack2(entries) { + var data = this.__data__ = new ListCache2(entries); this.size = data.size; } - function stackClear() { - this.__data__ = new ListCache(); + function stackClear2() { + this.__data__ = new ListCache2(); this.size = 0; } - function stackDelete(key) { + function stackDelete2(key) { var data = this.__data__, result2 = data["delete"](key); this.size = data.size; return result2; } - function stackGet(key) { + function stackGet2(key) { return this.__data__.get(key); } - function stackHas(key) { + function stackHas2(key) { return this.__data__.has(key); } - function stackSet(key, value) { + function stackSet2(key, value) { var data = this.__data__; - if (data instanceof ListCache) { + if (data instanceof ListCache2) { var pairs = data.__data__; - if (!Map2 || pairs.length < LARGE_ARRAY_SIZE - 1) { + if (!Map3 || pairs.length < LARGE_ARRAY_SIZE2 - 1) { pairs.push([key, value]); this.size = ++data.size; return this; } - data = this.__data__ = new MapCache(pairs); + data = this.__data__ = new MapCache2(pairs); } data.set(key, value); this.size = data.size; return this; } - Stack.prototype.clear = stackClear; - Stack.prototype["delete"] = stackDelete; - Stack.prototype.get = stackGet; - Stack.prototype.has = stackHas; - Stack.prototype.set = stackSet; - function arrayLikeKeys(value, inherited) { - var isArr = isArray2(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result2 = skipIndexes ? baseTimes(value.length, String2) : [], length = result2.length; + Stack2.prototype.clear = stackClear2; + Stack2.prototype["delete"] = stackDelete2; + Stack2.prototype.get = stackGet2; + Stack2.prototype.has = stackHas2; + Stack2.prototype.set = stackSet2; + function arrayLikeKeys2(value, inherited) { + var isArr = isArray2(value), isArg = !isArr && isArguments2(value), isBuff = !isArr && !isArg && isBuffer2(value), isType = !isArr && !isArg && !isBuff && isTypedArray2(value), skipIndexes = isArr || isArg || isBuff || isType, result2 = skipIndexes ? baseTimes2(value.length, String2) : [], length = result2.length; for (var key in value) { - if ((inherited || hasOwnProperty2.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode. + if ((inherited || hasOwnProperty10.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode. (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties. - isIndex(key, length)))) { + isIndex2(key, length)))) { result2.push(key); } } @@ -7880,20 +7837,20 @@ return shuffleSelf(copyArray(array2)); } function assignMergeValue(object, key, value) { - if (value !== undefined2 && !eq(object[key], value) || value === undefined2 && !(key in object)) { + if (value !== undefined2 && !eq2(object[key], value) || value === undefined2 && !(key in object)) { baseAssignValue(object, key, value); } } function assignValue(object, key, value) { var objValue = object[key]; - if (!(hasOwnProperty2.call(object, key) && eq(objValue, value)) || value === undefined2 && !(key in object)) { + if (!(hasOwnProperty10.call(object, key) && eq2(objValue, value)) || value === undefined2 && !(key in object)) { baseAssignValue(object, key, value); } } - function assocIndexOf(array2, key) { + function assocIndexOf2(array2, key) { var length = array2.length; while (length--) { - if (eq(array2[length][0], key)) { + if (eq2(array2[length][0], key)) { return length; } } @@ -7906,7 +7863,7 @@ return accumulator; } function baseAssign(object, source) { - return object && copyObject(source, keys(source), object); + return object && copyObject(source, keys2(source), object); } function baseAssignIn(object, source) { return object && copyObject(source, keysIn(source), object); @@ -7959,11 +7916,11 @@ return copyArray(value, result2); } } else { - var tag = getTag(value), isFunc = tag == funcTag || tag == genTag; - if (isBuffer(value)) { + var tag = getTag2(value), isFunc = tag == funcTag3 || tag == genTag2; + if (isBuffer2(value)) { return cloneBuffer(value, isDeep); } - if (tag == objectTag || tag == argsTag || isFunc && !object) { + if (tag == objectTag4 || tag == argsTag4 || isFunc && !object) { result2 = isFlat || isFunc ? {} : initCloneObject(value); if (!isDeep) { return isFlat ? copySymbolsIn(value, baseAssignIn(result2, value)) : copySymbols(value, baseAssign(result2, value)); @@ -7975,7 +7932,7 @@ result2 = initCloneByTag(value, tag, isDeep); } } - stack || (stack = new Stack()); + stack || (stack = new Stack2()); var stacked = stack.get(value); if (stacked) { return stacked; @@ -7990,7 +7947,7 @@ result2.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack)); }); } - var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys; + var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys2 : isFlat ? keysIn : keys2; var props = isArr ? undefined2 : keysFunc(value); arrayEach(props || value, function(subValue, key2) { if (props) { @@ -8002,7 +7959,7 @@ return result2; } function baseConforms(source) { - var props = keys(source); + var props = keys2(source); return function(object) { return baseConformsTo(object, source, props); }; @@ -8035,15 +7992,15 @@ return result2; } if (iteratee2) { - values2 = arrayMap2(values2, baseUnary(iteratee2)); + values2 = arrayMap2(values2, baseUnary2(iteratee2)); } if (comparator) { includes2 = arrayIncludesWith; isCommon = false; - } else if (values2.length >= LARGE_ARRAY_SIZE) { - includes2 = cacheHas; + } else if (values2.length >= LARGE_ARRAY_SIZE2) { + includes2 = cacheHas2; isCommon = false; - values2 = new SetCache(values2); + values2 = new SetCache2(values2); } outer: while (++index < length) { @@ -8118,7 +8075,7 @@ if (depth > 1) { baseFlatten(value, depth - 1, predicate, isStrict, result2); } else { - arrayPush(result2, value); + arrayPush2(result2, value); } } else if (!isStrict) { result2[result2.length] = value; @@ -8129,14 +8086,14 @@ var baseFor = createBaseFor(); var baseForRight = createBaseFor(true); function baseForOwn(object, iteratee2) { - return object && baseFor(object, iteratee2, keys); + return object && baseFor(object, iteratee2, keys2); } function baseForOwnRight(object, iteratee2) { - return object && baseForRight(object, iteratee2, keys); + return object && baseForRight(object, iteratee2, keys2); } function baseFunctions(object, props) { - return arrayFilter(props, function(key) { - return isFunction(object[key]); + return arrayFilter2(props, function(key) { + return isFunction2(object[key]); }); } function baseGet(object, path) { @@ -8147,9 +8104,9 @@ } return index && index == length ? object : undefined2; } - function baseGetAllKeys(object, keysFunc, symbolsFunc) { + function baseGetAllKeys2(object, keysFunc, symbolsFunc) { var result2 = keysFunc(object); - return isArray2(object) ? result2 : arrayPush(result2, symbolsFunc(object)); + return isArray2(object) ? result2 : arrayPush2(result2, symbolsFunc(object)); } function baseGetTag2(value) { if (value == null) { @@ -8161,7 +8118,7 @@ return value > other; } function baseHas(object, key) { - return object != null && hasOwnProperty2.call(object, key); + return object != null && hasOwnProperty10.call(object, key); } function baseHasIn(object, key) { return object != null && key in Object2(object); @@ -8174,10 +8131,10 @@ while (othIndex--) { var array2 = arrays[othIndex]; if (othIndex && iteratee2) { - array2 = arrayMap2(array2, baseUnary(iteratee2)); + array2 = arrayMap2(array2, baseUnary2(iteratee2)); } maxLength = nativeMin2(array2.length, maxLength); - caches[othIndex] = !comparator && (iteratee2 || length >= 120 && array2.length >= 120) ? new SetCache(othIndex && array2) : undefined2; + caches[othIndex] = !comparator && (iteratee2 || length >= 120 && array2.length >= 120) ? new SetCache2(othIndex && array2) : undefined2; } array2 = arrays[0]; var index = -1, seen = caches[0]; @@ -8185,11 +8142,11 @@ while (++index < length && result2.length < maxLength) { var value = array2[index], computed = iteratee2 ? iteratee2(value) : value; value = comparator || value !== 0 ? value : 0; - if (!(seen ? cacheHas(seen, computed) : includes2(result2, computed, comparator))) { + if (!(seen ? cacheHas2(seen, computed) : includes2(result2, computed, comparator))) { othIndex = othLength; while (--othIndex) { var cache = caches[othIndex]; - if (!(cache ? cacheHas(cache, computed) : includes2(arrays[othIndex], computed, comparator))) { + if (!(cache ? cacheHas2(cache, computed) : includes2(arrays[othIndex], computed, comparator))) { continue outer; } } @@ -8213,56 +8170,56 @@ var func = object == null ? object : object[toKey(last(path))]; return func == null ? undefined2 : apply(func, object, args); } - function baseIsArguments(value) { - return isObjectLike2(value) && baseGetTag2(value) == argsTag; + function baseIsArguments2(value) { + return isObjectLike2(value) && baseGetTag2(value) == argsTag4; } function baseIsArrayBuffer(value) { - return isObjectLike2(value) && baseGetTag2(value) == arrayBufferTag; + return isObjectLike2(value) && baseGetTag2(value) == arrayBufferTag3; } function baseIsDate(value) { - return isObjectLike2(value) && baseGetTag2(value) == dateTag; + return isObjectLike2(value) && baseGetTag2(value) == dateTag3; } - function baseIsEqual(value, other, bitmask, customizer, stack) { + function baseIsEqual2(value, other, bitmask, customizer, stack) { if (value === other) { return true; } if (value == null || other == null || !isObjectLike2(value) && !isObjectLike2(other)) { return value !== value && other !== other; } - return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); + return baseIsEqualDeep2(value, other, bitmask, customizer, baseIsEqual2, stack); } - function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { - var objIsArr = isArray2(object), othIsArr = isArray2(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other); - objTag = objTag == argsTag ? objectTag : objTag; - othTag = othTag == argsTag ? objectTag : othTag; - var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag; - if (isSameTag && isBuffer(object)) { - if (!isBuffer(other)) { + function baseIsEqualDeep2(object, other, bitmask, customizer, equalFunc, stack) { + var objIsArr = isArray2(object), othIsArr = isArray2(other), objTag = objIsArr ? arrayTag3 : getTag2(object), othTag = othIsArr ? arrayTag3 : getTag2(other); + objTag = objTag == argsTag4 ? objectTag4 : objTag; + othTag = othTag == argsTag4 ? objectTag4 : othTag; + var objIsObj = objTag == objectTag4, othIsObj = othTag == objectTag4, isSameTag = objTag == othTag; + if (isSameTag && isBuffer2(object)) { + if (!isBuffer2(other)) { return false; } objIsArr = true; objIsObj = false; } if (isSameTag && !objIsObj) { - stack || (stack = new Stack()); - return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); + stack || (stack = new Stack2()); + return objIsArr || isTypedArray2(object) ? equalArrays2(object, other, bitmask, customizer, equalFunc, stack) : equalByTag2(object, other, objTag, bitmask, customizer, equalFunc, stack); } - if (!(bitmask & COMPARE_PARTIAL_FLAG)) { - var objIsWrapped = objIsObj && hasOwnProperty2.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty2.call(other, "__wrapped__"); + if (!(bitmask & COMPARE_PARTIAL_FLAG5)) { + var objIsWrapped = objIsObj && hasOwnProperty10.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty10.call(other, "__wrapped__"); if (objIsWrapped || othIsWrapped) { var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other; - stack || (stack = new Stack()); + stack || (stack = new Stack2()); return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); } } if (!isSameTag) { return false; } - stack || (stack = new Stack()); - return equalObjects(object, other, bitmask, customizer, equalFunc, stack); + stack || (stack = new Stack2()); + return equalObjects2(object, other, bitmask, customizer, equalFunc, stack); } function baseIsMap(value) { - return isObjectLike2(value) && getTag(value) == mapTag; + return isObjectLike2(value) && getTag2(value) == mapTag4; } function baseIsMatch(object, source, matchData, customizer) { var index = matchData.length, length = index, noCustomizer = !customizer; @@ -8284,32 +8241,32 @@ return false; } } else { - var stack = new Stack(); + var stack = new Stack2(); if (customizer) { var result2 = customizer(objValue, srcValue, key, object, source, stack); } - if (!(result2 === undefined2 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) : result2)) { + if (!(result2 === undefined2 ? baseIsEqual2(srcValue, objValue, COMPARE_PARTIAL_FLAG5 | COMPARE_UNORDERED_FLAG3, customizer, stack) : result2)) { return false; } } } return true; } - function baseIsNative(value) { - if (!isObject3(value) || isMasked(value)) { + function baseIsNative2(value) { + if (!isObject3(value) || isMasked2(value)) { return false; } - var pattern = isFunction(value) ? reIsNative : reIsHostCtor; - return pattern.test(toSource(value)); + var pattern = isFunction2(value) ? reIsNative2 : reIsHostCtor2; + return pattern.test(toSource2(value)); } function baseIsRegExp(value) { - return isObjectLike2(value) && baseGetTag2(value) == regexpTag; + return isObjectLike2(value) && baseGetTag2(value) == regexpTag3; } function baseIsSet(value) { - return isObjectLike2(value) && getTag(value) == setTag; + return isObjectLike2(value) && getTag2(value) == setTag4; } - function baseIsTypedArray(value) { - return isObjectLike2(value) && isLength(value.length) && !!typedArrayTags[baseGetTag2(value)]; + function baseIsTypedArray2(value) { + return isObjectLike2(value) && isLength2(value.length) && !!typedArrayTags2[baseGetTag2(value)]; } function baseIteratee(value) { if (typeof value == "function") { @@ -8323,13 +8280,13 @@ } return property(value); } - function baseKeys(object) { - if (!isPrototype(object)) { - return nativeKeys(object); + function baseKeys2(object) { + if (!isPrototype2(object)) { + return nativeKeys2(object); } var result2 = []; for (var key in Object2(object)) { - if (hasOwnProperty2.call(object, key) && key != "constructor") { + if (hasOwnProperty10.call(object, key) && key != "constructor") { result2.push(key); } } @@ -8339,9 +8296,9 @@ if (!isObject3(object)) { return nativeKeysIn(object); } - var isProto = isPrototype(object), result2 = []; + var isProto = isPrototype2(object), result2 = []; for (var key in object) { - if (!(key == "constructor" && (isProto || !hasOwnProperty2.call(object, key)))) { + if (!(key == "constructor" && (isProto || !hasOwnProperty10.call(object, key)))) { result2.push(key); } } @@ -8351,7 +8308,7 @@ return value < other; } function baseMap(collection, iteratee2) { - var index = -1, result2 = isArrayLike(collection) ? Array2(collection.length) : []; + var index = -1, result2 = isArrayLike2(collection) ? Array2(collection.length) : []; baseEach(collection, function(value, key, collection2) { result2[++index] = iteratee2(value, key, collection2); }); @@ -8372,7 +8329,7 @@ } return function(object) { var objValue = get4(object, path); - return objValue === undefined2 && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); + return objValue === undefined2 && objValue === srcValue ? hasIn(object, path) : baseIsEqual2(srcValue, objValue, COMPARE_PARTIAL_FLAG5 | COMPARE_UNORDERED_FLAG3); }; } function baseMerge(object, source, srcIndex, customizer, stack) { @@ -8380,7 +8337,7 @@ return; } baseFor(source, function(srcValue, key) { - stack || (stack = new Stack()); + stack || (stack = new Stack2()); if (isObject3(srcValue)) { baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); } else { @@ -8401,7 +8358,7 @@ var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : undefined2; var isCommon = newValue === undefined2; if (isCommon) { - var isArr = isArray2(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue); + var isArr = isArray2(srcValue), isBuff = !isArr && isBuffer2(srcValue), isTyped = !isArr && !isBuff && isTypedArray2(srcValue); newValue = srcValue; if (isArr || isBuff || isTyped) { if (isArray2(objValue)) { @@ -8417,11 +8374,11 @@ } else { newValue = []; } - } else if (isPlainObject(srcValue) || isArguments(srcValue)) { + } else if (isPlainObject(srcValue) || isArguments2(srcValue)) { newValue = objValue; - if (isArguments(objValue)) { + if (isArguments2(objValue)) { newValue = toPlainObject(objValue); - } else if (!isObject3(objValue) || isFunction(objValue)) { + } else if (!isObject3(objValue) || isFunction2(objValue)) { newValue = initCloneObject(srcValue); } } else { @@ -8441,7 +8398,7 @@ return; } n2 += n2 < 0 ? length : 0; - return isIndex(n2, length) ? array2[n2] : undefined2; + return isIndex2(n2, length) ? array2[n2] : undefined2; } function baseOrderBy(collection, iteratees, orders) { if (iteratees.length) { @@ -8457,7 +8414,7 @@ iteratees = [identity4]; } var index = -1; - iteratees = arrayMap2(iteratees, baseUnary(getIteratee())); + iteratees = arrayMap2(iteratees, baseUnary2(getIteratee())); var result2 = baseMap(collection, function(value, key, collection2) { var criteria = arrayMap2(iteratees, function(iteratee2) { return iteratee2(value); @@ -8494,15 +8451,15 @@ values2 = copyArray(values2); } if (iteratee2) { - seen = arrayMap2(array2, baseUnary(iteratee2)); + seen = arrayMap2(array2, baseUnary2(iteratee2)); } while (++index < length) { var fromIndex = 0, value = values2[index], computed = iteratee2 ? iteratee2(value) : value; while ((fromIndex = indexOf2(seen, computed, fromIndex, comparator)) > -1) { if (seen !== array2) { - splice.call(seen, fromIndex, 1); + splice2.call(seen, fromIndex, 1); } - splice.call(array2, fromIndex, 1); + splice2.call(array2, fromIndex, 1); } } return array2; @@ -8513,8 +8470,8 @@ var index = indexes[length]; if (length == lastIndex || index !== previous) { var previous = index; - if (isIndex(index)) { - splice.call(array2, index, 1); + if (isIndex2(index)) { + splice2.call(array2, index, 1); } else { baseUnset(array2, index); } @@ -8535,7 +8492,7 @@ } function baseRepeat(string, n2) { var result2 = ""; - if (!string || n2 < 1 || n2 > MAX_SAFE_INTEGER) { + if (!string || n2 < 1 || n2 > MAX_SAFE_INTEGER3) { return result2; } do { @@ -8574,7 +8531,7 @@ var objValue = nested[key]; newValue = customizer ? customizer(objValue, key, nested) : undefined2; if (newValue === undefined2) { - newValue = isObject3(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {}; + newValue = isObject3(objValue) ? objValue : isIndex2(path[index + 1]) ? [] : {}; } } assignValue(nested, key, newValue); @@ -8671,7 +8628,7 @@ var index = -1, length = array2.length, resIndex = 0, result2 = []; while (++index < length) { var value = array2[index], computed = iteratee2 ? iteratee2(value) : value; - if (!index || !eq(computed, seen)) { + if (!index || !eq2(computed, seen)) { var seen = computed; result2[resIndex++] = value === 0 ? 0 : value; } @@ -8705,14 +8662,14 @@ if (comparator) { isCommon = false; includes2 = arrayIncludesWith; - } else if (length >= LARGE_ARRAY_SIZE) { + } else if (length >= LARGE_ARRAY_SIZE2) { var set4 = iteratee2 ? null : createSet(array2); if (set4) { - return setToArray(set4); + return setToArray2(set4); } isCommon = false; - includes2 = cacheHas; - seen = new SetCache(); + includes2 = cacheHas2; + seen = new SetCache2(); } else { seen = iteratee2 ? [] : result2; } @@ -8760,7 +8717,7 @@ result2 = result2.value(); } return arrayReduce(actions, function(result3, action) { - return action.func.apply(action.thisArg, arrayPush([result3], action.args)); + return action.func.apply(action.thisArg, arrayPush2([result3], action.args)); }, result2); } function baseXor(arrays, iteratee2, comparator) { @@ -8818,7 +8775,7 @@ } function cloneArrayBuffer(arrayBuffer) { var result2 = new arrayBuffer.constructor(arrayBuffer.byteLength); - new Uint8Array2(result2).set(new Uint8Array2(arrayBuffer)); + new Uint8Array3(result2).set(new Uint8Array3(arrayBuffer)); return result2; } function cloneDataView(dataView, isDeep) { @@ -8831,7 +8788,7 @@ return result2; } function cloneSymbol(symbol) { - return symbolValueOf ? Object2(symbolValueOf.call(symbol)) : {}; + return symbolValueOf2 ? Object2(symbolValueOf2.call(symbol)) : {}; } function cloneTypedArray(typedArray, isDeep) { var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; @@ -8922,7 +8879,7 @@ return object; } function copySymbols(source, object) { - return copyObject(source, getSymbols(source), object); + return copyObject(source, getSymbols2(source), object); } function copySymbolsIn(source, object) { return copyObject(source, getSymbolsIn(source), object); @@ -8956,7 +8913,7 @@ if (collection == null) { return collection; } - if (!isArrayLike(collection)) { + if (!isArrayLike2(collection)) { return eachFunc(collection, iteratee2); } var length = collection.length, index = fromRight ? length : -1, iterable = Object2(collection); @@ -9058,9 +9015,9 @@ function createFind(findIndexFunc) { return function(collection, predicate, fromIndex) { var iterable = Object2(collection); - if (!isArrayLike(collection)) { + if (!isArrayLike2(collection)) { var iteratee2 = getIteratee(predicate, 3); - collection = keys(collection); + collection = keys2(collection); predicate = function(key) { return iteratee2(iterable[key], key, iterable); }; @@ -9188,7 +9145,7 @@ } function createOver(arrayFunc) { return flatRest(function(iteratees) { - iteratees = arrayMap2(iteratees, baseUnary(getIteratee())); + iteratees = arrayMap2(iteratees, baseUnary2(getIteratee())); return baseRest(function(args) { var thisArg = this; return arrayFunc(iteratees, function(iteratee2) { @@ -9239,8 +9196,8 @@ function createRelationalOperation(operator) { return function(value, other) { if (!(typeof value == "string" && typeof other == "string")) { - value = toNumber2(value); - other = toNumber2(other); + value = toNumber3(value); + other = toNumber3(other); } return operator(value, other); }; @@ -9274,7 +9231,7 @@ function createRound(methodName) { var func = Math2[methodName]; return function(number3, precision2) { - number3 = toNumber2(number3); + number3 = toNumber3(number3); precision2 = precision2 == null ? 0 : nativeMin2(toInteger(precision2), 292); if (precision2 && nativeIsFinite(number3)) { var pair2 = (toString2(number3) + "e").split("e"), value = func(pair2[0] + "e" + (+pair2[1] + precision2)); @@ -9284,16 +9241,16 @@ return func(number3); }; } - var createSet = !(Set2 && 1 / setToArray(new Set2([, -0]))[1] == INFINITY2) ? noop3 : function(values2) { - return new Set2(values2); + var createSet = !(Set3 && 1 / setToArray2(new Set3([, -0]))[1] == INFINITY2) ? noop3 : function(values2) { + return new Set3(values2); }; function createToPairs(keysFunc) { return function(object) { - var tag = getTag(object); - if (tag == mapTag) { - return mapToArray(object); + var tag = getTag2(object); + if (tag == mapTag4) { + return mapToArray2(object); } - if (tag == setTag) { + if (tag == setTag4) { return setToPairs(object); } return baseToPairs(object, keysFunc(object)); @@ -9354,7 +9311,7 @@ return setWrapToString(setter(result2, newData), func, bitmask); } function customDefaultsAssignIn(objValue, srcValue, key, object) { - if (objValue === undefined2 || eq(objValue, objectProto3[key]) && !hasOwnProperty2.call(object, key)) { + if (objValue === undefined2 || eq2(objValue, objectProto13[key]) && !hasOwnProperty10.call(object, key)) { return srcValue; } return objValue; @@ -9370,8 +9327,8 @@ function customOmitClone(value) { return isPlainObject(value) ? undefined2 : value; } - function equalArrays(array2, other, bitmask, customizer, equalFunc, stack) { - var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array2.length, othLength = other.length; + function equalArrays2(array2, other, bitmask, customizer, equalFunc, stack) { + var isPartial = bitmask & COMPARE_PARTIAL_FLAG5, arrLength = array2.length, othLength = other.length; if (arrLength != othLength && !(isPartial && othLength > arrLength)) { return false; } @@ -9380,7 +9337,7 @@ if (arrStacked && othStacked) { return arrStacked == other && othStacked == array2; } - var index = -1, result2 = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : undefined2; + var index = -1, result2 = true, seen = bitmask & COMPARE_UNORDERED_FLAG3 ? new SetCache2() : undefined2; stack.set(array2, other); stack.set(other, array2); while (++index < arrLength) { @@ -9396,8 +9353,8 @@ break; } if (seen) { - if (!arraySome(other, function(othValue2, othIndex) { - if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) { + if (!arraySome2(other, function(othValue2, othIndex) { + if (!cacheHas2(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) { return seen.push(othIndex); } })) { @@ -9413,33 +9370,33 @@ stack["delete"](other); return result2; } - function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { + function equalByTag2(object, other, tag, bitmask, customizer, equalFunc, stack) { switch (tag) { - case dataViewTag: + case dataViewTag4: if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) { return false; } object = object.buffer; other = other.buffer; - case arrayBufferTag: - if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array2(object), new Uint8Array2(other))) { + case arrayBufferTag3: + if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array3(object), new Uint8Array3(other))) { return false; } return true; - case boolTag: - case dateTag: - case numberTag: - return eq(+object, +other); - case errorTag: + case boolTag3: + case dateTag3: + case numberTag3: + return eq2(+object, +other); + case errorTag3: return object.name == other.name && object.message == other.message; - case regexpTag: - case stringTag: + case regexpTag3: + case stringTag3: return object == other + ""; - case mapTag: - var convert = mapToArray; - case setTag: - var isPartial = bitmask & COMPARE_PARTIAL_FLAG; - convert || (convert = setToArray); + case mapTag4: + var convert = mapToArray2; + case setTag4: + var isPartial = bitmask & COMPARE_PARTIAL_FLAG5; + convert || (convert = setToArray2); if (object.size != other.size && !isPartial) { return false; } @@ -9447,27 +9404,27 @@ if (stacked) { return stacked == other; } - bitmask |= COMPARE_UNORDERED_FLAG; + bitmask |= COMPARE_UNORDERED_FLAG3; stack.set(object, other); - var result2 = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); + var result2 = equalArrays2(convert(object), convert(other), bitmask, customizer, equalFunc, stack); stack["delete"](object); return result2; - case symbolTag2: - if (symbolValueOf) { - return symbolValueOf.call(object) == symbolValueOf.call(other); + case symbolTag3: + if (symbolValueOf2) { + return symbolValueOf2.call(object) == symbolValueOf2.call(other); } } return false; } - function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { - var isPartial = bitmask & COMPARE_PARTIAL_FLAG, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length; + function equalObjects2(object, other, bitmask, customizer, equalFunc, stack) { + var isPartial = bitmask & COMPARE_PARTIAL_FLAG5, objProps = getAllKeys2(object), objLength = objProps.length, othProps = getAllKeys2(other), othLength = othProps.length; if (objLength != othLength && !isPartial) { return false; } var index = objLength; while (index--) { var key = objProps[index]; - if (!(isPartial ? key in other : hasOwnProperty2.call(other, key))) { + if (!(isPartial ? key in other : hasOwnProperty10.call(other, key))) { return false; } } @@ -9505,17 +9462,17 @@ function flatRest(func) { return setToString(overRest(func, undefined2, flatten2), func + ""); } - function getAllKeys(object) { - return baseGetAllKeys(object, keys, getSymbols); + function getAllKeys2(object) { + return baseGetAllKeys2(object, keys2, getSymbols2); } function getAllKeysIn(object) { - return baseGetAllKeys(object, keysIn, getSymbolsIn); + return baseGetAllKeys2(object, keysIn, getSymbolsIn); } var getData = !metaMap ? noop3 : function(func) { return metaMap.get(func); }; function getFuncName(func) { - var result2 = func.name + "", array2 = realNames[result2], length = hasOwnProperty2.call(realNames, result2) ? array2.length : 0; + var result2 = func.name + "", array2 = realNames[result2], length = hasOwnProperty10.call(realNames, result2) ? array2.length : 0; while (length--) { var data = array2[length], otherFunc = data.func; if (otherFunc == null || otherFunc == func) { @@ -9525,7 +9482,7 @@ return result2; } function getHolder(func) { - var object = hasOwnProperty2.call(lodash, "placeholder") ? lodash : func; + var object = hasOwnProperty10.call(lodash, "placeholder") ? lodash : func; return object.placeholder; } function getIteratee() { @@ -9533,24 +9490,24 @@ result2 = result2 === iteratee ? baseIteratee : result2; return arguments.length ? result2(arguments[0], arguments[1]) : result2; } - function getMapData(map3, key) { + function getMapData2(map3, key) { var data = map3.__data__; - return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map; + return isKeyable2(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map; } function getMatchData(object) { - var result2 = keys(object), length = result2.length; + var result2 = keys2(object), length = result2.length; while (length--) { var key = result2[length], value = object[key]; result2[length] = [key, value, isStrictComparable(value)]; } return result2; } - function getNative(object, key) { - var value = getValue(object, key); - return baseIsNative(value) ? value : undefined2; + function getNative2(object, key) { + var value = getValue2(object, key); + return baseIsNative2(value) ? value : undefined2; } function getRawTag2(value) { - var isOwn = hasOwnProperty2.call(value, symToStringTag3), tag = value[symToStringTag3]; + var isOwn = hasOwnProperty10.call(value, symToStringTag3), tag = value[symToStringTag3]; try { value[symToStringTag3] = undefined2; var unmasked = true; @@ -9566,39 +9523,39 @@ } return result2; } - var getSymbols = !nativeGetSymbols ? stubArray : function(object) { + var getSymbols2 = !nativeGetSymbols2 ? stubArray2 : function(object) { if (object == null) { return []; } object = Object2(object); - return arrayFilter(nativeGetSymbols(object), function(symbol) { - return propertyIsEnumerable.call(object, symbol); + return arrayFilter2(nativeGetSymbols2(object), function(symbol) { + return propertyIsEnumerable3.call(object, symbol); }); }; - var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) { + var getSymbolsIn = !nativeGetSymbols2 ? stubArray2 : function(object) { var result2 = []; while (object) { - arrayPush(result2, getSymbols(object)); + arrayPush2(result2, getSymbols2(object)); object = getPrototype(object); } return result2; }; - var getTag = baseGetTag2; - if (DataView2 && getTag(new DataView2(new ArrayBuffer(1))) != dataViewTag || Map2 && getTag(new Map2()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set2 && getTag(new Set2()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) { - getTag = function(value) { - var result2 = baseGetTag2(value), Ctor = result2 == objectTag ? value.constructor : undefined2, ctorString = Ctor ? toSource(Ctor) : ""; + var getTag2 = baseGetTag2; + 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) { + getTag2 = function(value) { + var result2 = baseGetTag2(value), Ctor = result2 == objectTag4 ? value.constructor : undefined2, ctorString = Ctor ? toSource2(Ctor) : ""; if (ctorString) { switch (ctorString) { - case dataViewCtorString: - return dataViewTag; - case mapCtorString: - return mapTag; - case promiseCtorString: - return promiseTag; - case setCtorString: - return setTag; - case weakMapCtorString: - return weakMapTag; + case dataViewCtorString2: + return dataViewTag4; + case mapCtorString2: + return mapTag4; + case promiseCtorString2: + return promiseTag2; + case setCtorString2: + return setTag4; + case weakMapCtorString2: + return weakMapTag3; } } return result2; @@ -9643,49 +9600,49 @@ return result2; } length = object == null ? 0 : object.length; - return !!length && isLength(length) && isIndex(key, length) && (isArray2(object) || isArguments(object)); + return !!length && isLength2(length) && isIndex2(key, length) && (isArray2(object) || isArguments2(object)); } function initCloneArray(array2) { var length = array2.length, result2 = new array2.constructor(length); - if (length && typeof array2[0] == "string" && hasOwnProperty2.call(array2, "index")) { + if (length && typeof array2[0] == "string" && hasOwnProperty10.call(array2, "index")) { result2.index = array2.index; result2.input = array2.input; } return result2; } function initCloneObject(object) { - return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {}; + return typeof object.constructor == "function" && !isPrototype2(object) ? baseCreate(getPrototype(object)) : {}; } function initCloneByTag(object, tag, isDeep) { var Ctor = object.constructor; switch (tag) { - case arrayBufferTag: + case arrayBufferTag3: return cloneArrayBuffer(object); - case boolTag: - case dateTag: + case boolTag3: + case dateTag3: return new Ctor(+object); - case dataViewTag: + case dataViewTag4: return cloneDataView(object, isDeep); - case float32Tag: - case float64Tag: - case int8Tag: - case int16Tag: - case int32Tag: - case uint8Tag: - case uint8ClampedTag: - case uint16Tag: - case uint32Tag: + case float32Tag2: + case float64Tag2: + case int8Tag2: + case int16Tag2: + case int32Tag2: + case uint8Tag2: + case uint8ClampedTag2: + case uint16Tag2: + case uint32Tag2: return cloneTypedArray(object, isDeep); - case mapTag: + case mapTag4: return new Ctor(); - case numberTag: - case stringTag: + case numberTag3: + case stringTag3: return new Ctor(object); - case regexpTag: + case regexpTag3: return cloneRegExp(object); - case setTag: + case setTag4: return new Ctor(); - case symbolTag2: + case symbolTag3: return cloneSymbol(object); } } @@ -9700,20 +9657,20 @@ return source.replace(reWrapComment, "{\n/* [wrapped with " + details + "] */\n"); } function isFlattenable(value) { - return isArray2(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]); + return isArray2(value) || isArguments2(value) || !!(spreadableSymbol && value && value[spreadableSymbol]); } - function isIndex(value, length) { + function isIndex2(value, length) { var type2 = typeof value; - length = length == null ? MAX_SAFE_INTEGER : length; - return !!length && (type2 == "number" || type2 != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length); + length = length == null ? MAX_SAFE_INTEGER3 : length; + return !!length && (type2 == "number" || type2 != "symbol" && reIsUint2.test(value)) && (value > -1 && value % 1 == 0 && value < length); } function isIterateeCall(value, index, object) { if (!isObject3(object)) { return false; } var type2 = typeof index; - if (type2 == "number" ? isArrayLike(object) && isIndex(index, object.length) : type2 == "string" && index in object) { - return eq(object[index], value); + if (type2 == "number" ? isArrayLike2(object) && isIndex2(index, object.length) : type2 == "string" && index in object) { + return eq2(object[index], value); } return false; } @@ -9727,7 +9684,7 @@ } return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object2(object); } - function isKeyable(value) { + function isKeyable2(value) { var type2 = typeof value; return type2 == "string" || type2 == "number" || type2 == "symbol" || type2 == "boolean" ? value !== "__proto__" : value === null; } @@ -9742,12 +9699,12 @@ var data = getData(other); return !!data && func === data[0]; } - function isMasked(func) { - return !!maskSrcKey && maskSrcKey in func; + function isMasked2(func) { + return !!maskSrcKey2 && maskSrcKey2 in func; } - var isMaskable = coreJsData ? isFunction : stubFalse; - function isPrototype(value) { - var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto3; + var isMaskable = coreJsData2 ? isFunction2 : stubFalse2; + function isPrototype2(value) { + var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto13; return value === proto; } function isStrictComparable(value) { @@ -9842,7 +9799,7 @@ var arrLength = array2.length, length = nativeMin2(indexes.length, arrLength), oldArray = copyArray(array2); while (length--) { var index = indexes[length]; - array2[length] = isIndex(index, arrLength) ? oldArray[index] : undefined2; + array2[length] = isIndex2(index, arrLength) ? oldArray[index] : undefined2; } return array2; } @@ -9907,10 +9864,10 @@ var result2 = value + ""; return result2 == "0" && 1 / value == -INFINITY2 ? "-0" : result2; } - function toSource(func) { + function toSource2(func) { if (func != null) { try { - return funcToString.call(func); + return funcToString3.call(func); } catch (e) { } try { @@ -9974,7 +9931,7 @@ while (index--) { args[index - 1] = arguments[index]; } - return arrayPush(isArray2(array2) ? copyArray(array2) : [array2], baseFlatten(args, 1)); + return arrayPush2(isArray2(array2) ? copyArray(array2) : [array2], baseFlatten(args, 1)); } var difference = baseRest(function(array2, values2) { return isArrayLikeObject(array2) ? baseDifference(array2, baseFlatten(values2, 1, isArrayLikeObject, true)) : []; @@ -10148,7 +10105,7 @@ var pullAt = flatRest(function(array2, indexes) { var length = array2 == null ? 0 : array2.length, result2 = baseAt(array2, indexes); basePullAt(array2, arrayMap2(indexes, function(index) { - return isIndex(index, length) ? +index : index; + return isIndex2(index, length) ? +index : index; }).sort(compareAscending)); return result2; }); @@ -10196,7 +10153,7 @@ var length = array2 == null ? 0 : array2.length; if (length) { var index = baseSortedIndex(array2, value); - if (index < length && eq(array2[index], value)) { + if (index < length && eq2(array2[index], value)) { return index; } } @@ -10212,7 +10169,7 @@ var length = array2 == null ? 0 : array2.length; if (length) { var index = baseSortedIndex(array2, value, true) - 1; - if (eq(array2[index], value)) { + if (eq2(array2[index], value)) { return index; } } @@ -10280,13 +10237,13 @@ return []; } var length = 0; - array2 = arrayFilter(array2, function(group) { + array2 = arrayFilter2(array2, function(group) { if (isArrayLikeObject(group)) { length = nativeMax2(group.length, length); return true; } }); - return baseTimes(length, function(index) { + return baseTimes2(length, function(index) { return arrayMap2(array2, baseProperty(index)); }); } @@ -10306,19 +10263,19 @@ return isArrayLikeObject(array2) ? baseDifference(array2, values2) : []; }); var xor = baseRest(function(arrays) { - return baseXor(arrayFilter(arrays, isArrayLikeObject)); + return baseXor(arrayFilter2(arrays, isArrayLikeObject)); }); var xorBy = baseRest(function(arrays) { var iteratee2 = last(arrays); if (isArrayLikeObject(iteratee2)) { iteratee2 = undefined2; } - return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee2, 2)); + return baseXor(arrayFilter2(arrays, isArrayLikeObject), getIteratee(iteratee2, 2)); }); var xorWith = baseRest(function(arrays) { var comparator = last(arrays); comparator = typeof comparator == "function" ? comparator : undefined2; - return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined2, comparator); + return baseXor(arrayFilter2(arrays, isArrayLikeObject), undefined2, comparator); }); var zip = baseRest(unzip); function zipObject(props, values2) { @@ -10348,7 +10305,7 @@ var length = paths.length, start2 = length ? paths[0] : 0, value = this.__wrapped__, interceptor = function(object) { return baseAt(object, paths); }; - if (length > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex(start2)) { + if (length > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex2(start2)) { return this.thru(interceptor); } value = value.slice(start2, +start2 + (length ? 1 : 0)); @@ -10418,7 +10375,7 @@ return baseWrapperValue(this.__wrapped__, this.__actions__); } var countBy = createAggregator(function(result2, value, key) { - if (hasOwnProperty2.call(result2, key)) { + if (hasOwnProperty10.call(result2, key)) { ++result2[key]; } else { baseAssignValue(result2, key, 1); @@ -10432,7 +10389,7 @@ return func(collection, getIteratee(predicate, 3)); } function filter2(collection, predicate) { - var func = isArray2(collection) ? arrayFilter : baseFilter; + var func = isArray2(collection) ? arrayFilter2 : baseFilter; return func(collection, getIteratee(predicate, 3)); } var find2 = createFind(findIndex); @@ -10456,14 +10413,14 @@ return func(collection, getIteratee(iteratee2, 3)); } var groupBy = createAggregator(function(result2, value, key) { - if (hasOwnProperty2.call(result2, key)) { + if (hasOwnProperty10.call(result2, key)) { result2[key].push(value); } else { baseAssignValue(result2, key, [value]); } }); function includes(collection, value, fromIndex, guard) { - collection = isArrayLike(collection) ? collection : values(collection); + collection = isArrayLike2(collection) ? collection : values(collection); fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0; var length = collection.length; if (fromIndex < 0) { @@ -10472,7 +10429,7 @@ return isString(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1; } var invokeMap = baseRest(function(collection, path, args) { - var index = -1, isFunc = typeof path == "function", result2 = isArrayLike(collection) ? Array2(collection.length) : []; + var index = -1, isFunc = typeof path == "function", result2 = isArrayLike2(collection) ? Array2(collection.length) : []; baseEach(collection, function(value) { result2[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args); }); @@ -10512,7 +10469,7 @@ return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEachRight); } function reject(collection, predicate) { - var func = isArray2(collection) ? arrayFilter : baseFilter; + var func = isArray2(collection) ? arrayFilter2 : baseFilter; return func(collection, negate(getIteratee(predicate, 3))); } function sample(collection) { @@ -10536,17 +10493,17 @@ if (collection == null) { return 0; } - if (isArrayLike(collection)) { + if (isArrayLike2(collection)) { return isString(collection) ? stringSize(collection) : collection.length; } - var tag = getTag(collection); - if (tag == mapTag || tag == setTag) { + var tag = getTag2(collection); + if (tag == mapTag4 || tag == setTag4) { return collection.size; } - return baseKeys(collection).length; + return baseKeys2(collection).length; } function some(collection, predicate, guard) { - var func = isArray2(collection) ? arraySome : baseSome; + var func = isArray2(collection) ? arraySome2 : baseSome; if (guard && isIterateeCall(collection, predicate, guard)) { predicate = undefined2; } @@ -10632,11 +10589,11 @@ if (typeof func != "function") { throw new TypeError2(FUNC_ERROR_TEXT3); } - wait = toNumber2(wait) || 0; + wait = toNumber3(wait) || 0; if (isObject3(options2)) { leading = !!options2.leading; maxing = "maxWait" in options2; - maxWait = maxing ? nativeMax2(toNumber2(options2.maxWait) || 0, wait) : maxWait; + maxWait = maxing ? nativeMax2(toNumber3(options2.maxWait) || 0, wait) : maxWait; trailing = "trailing" in options2 ? !!options2.trailing : trailing; } function invokeFunc(time) { @@ -10712,7 +10669,7 @@ return baseDelay(func, 1, args); }); var delay = baseRest(function(func, wait, args) { - return baseDelay(func, toNumber2(wait) || 0, args); + return baseDelay(func, toNumber3(wait) || 0, args); }); function flip(func) { return createWrap(func, WRAP_FLIP_FLAG); @@ -10730,10 +10687,10 @@ memoized.cache = cache.set(key, result2) || cache; return result2; }; - memoized.cache = new (memoize.Cache || MapCache)(); + memoized.cache = new (memoize.Cache || MapCache2)(); return memoized; } - memoize.Cache = MapCache; + memoize.Cache = MapCache2; function negate(predicate) { if (typeof predicate != "function") { throw new TypeError2(FUNC_ERROR_TEXT3); @@ -10757,7 +10714,7 @@ return before(2, func); } var overArgs = castRest(function(func, transforms) { - transforms = transforms.length == 1 && isArray2(transforms[0]) ? arrayMap2(transforms[0], baseUnary(getIteratee())) : arrayMap2(baseFlatten(transforms, 1), baseUnary(getIteratee())); + transforms = transforms.length == 1 && isArray2(transforms[0]) ? arrayMap2(transforms[0], baseUnary2(getIteratee())) : arrayMap2(baseFlatten(transforms, 1), baseUnary2(getIteratee())); var funcsLength = transforms.length; return baseRest(function(args) { var index = -1, length = nativeMin2(args.length, funcsLength); @@ -10793,7 +10750,7 @@ return baseRest(function(args) { var array2 = args[start2], otherArgs = castSlice(args, 0, start2); if (array2) { - arrayPush(otherArgs, array2); + arrayPush2(otherArgs, array2); } return apply(func, this, otherArgs); }); @@ -10841,33 +10798,33 @@ return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer); } function conformsTo(object, source) { - return source == null || baseConformsTo(object, source, keys(source)); + return source == null || baseConformsTo(object, source, keys2(source)); } - function eq(value, other) { + function eq2(value, other) { return value === other || value !== value && other !== other; } var gt = createRelationalOperation(baseGt); var gte = createRelationalOperation(function(value, other) { return value >= other; }); - var isArguments = baseIsArguments(function() { + var isArguments2 = baseIsArguments2(function() { return arguments; - }()) ? baseIsArguments : function(value) { - return isObjectLike2(value) && hasOwnProperty2.call(value, "callee") && !propertyIsEnumerable.call(value, "callee"); + }()) ? baseIsArguments2 : function(value) { + return isObjectLike2(value) && hasOwnProperty10.call(value, "callee") && !propertyIsEnumerable3.call(value, "callee"); }; var isArray2 = Array2.isArray; - var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer; - function isArrayLike(value) { - return value != null && isLength(value.length) && !isFunction(value); + var isArrayBuffer = nodeIsArrayBuffer ? baseUnary2(nodeIsArrayBuffer) : baseIsArrayBuffer; + function isArrayLike2(value) { + return value != null && isLength2(value.length) && !isFunction2(value); } function isArrayLikeObject(value) { - return isObjectLike2(value) && isArrayLike(value); + return isObjectLike2(value) && isArrayLike2(value); } function isBoolean(value) { - return value === true || value === false || isObjectLike2(value) && baseGetTag2(value) == boolTag; + return value === true || value === false || isObjectLike2(value) && baseGetTag2(value) == boolTag3; } - var isBuffer = nativeIsBuffer || stubFalse; - var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate; + var isBuffer2 = nativeIsBuffer2 || stubFalse2; + var isDate = nodeIsDate ? baseUnary2(nodeIsDate) : baseIsDate; function isElement2(value) { return isObjectLike2(value) && value.nodeType === 1 && !isPlainObject(value); } @@ -10875,53 +10832,53 @@ if (value == null) { return true; } - if (isArrayLike(value) && (isArray2(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer(value) || isTypedArray(value) || isArguments(value))) { + if (isArrayLike2(value) && (isArray2(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer2(value) || isTypedArray2(value) || isArguments2(value))) { return !value.length; } - var tag = getTag(value); - if (tag == mapTag || tag == setTag) { + var tag = getTag2(value); + if (tag == mapTag4 || tag == setTag4) { return !value.size; } - if (isPrototype(value)) { - return !baseKeys(value).length; + if (isPrototype2(value)) { + return !baseKeys2(value).length; } for (var key in value) { - if (hasOwnProperty2.call(value, key)) { + if (hasOwnProperty10.call(value, key)) { return false; } } return true; } - function isEqual(value, other) { - return baseIsEqual(value, other); + function isEqual4(value, other) { + return baseIsEqual2(value, other); } function isEqualWith(value, other, customizer) { customizer = typeof customizer == "function" ? customizer : undefined2; var result2 = customizer ? customizer(value, other) : undefined2; - return result2 === undefined2 ? baseIsEqual(value, other, undefined2, customizer) : !!result2; + return result2 === undefined2 ? baseIsEqual2(value, other, undefined2, customizer) : !!result2; } function isError(value) { if (!isObjectLike2(value)) { return false; } var tag = baseGetTag2(value); - return tag == errorTag || tag == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject(value); + return tag == errorTag3 || tag == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject(value); } function isFinite2(value) { return typeof value == "number" && nativeIsFinite(value); } - function isFunction(value) { + function isFunction2(value) { if (!isObject3(value)) { return false; } var tag = baseGetTag2(value); - return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; + return tag == funcTag3 || tag == genTag2 || tag == asyncTag2 || tag == proxyTag2; } function isInteger(value) { return typeof value == "number" && value == toInteger(value); } - function isLength(value) { - return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + function isLength2(value) { + return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER3; } function isObject3(value) { var type2 = typeof value; @@ -10930,7 +10887,7 @@ function isObjectLike2(value) { return value != null && typeof value == "object"; } - var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap; + var isMap = nodeIsMap ? baseUnary2(nodeIsMap) : baseIsMap; function isMatch(object, source) { return object === source || baseIsMatch(object, source, getMatchData(source)); } @@ -10945,7 +10902,7 @@ if (isMaskable(value)) { throw new Error2(CORE_ERROR_TEXT); } - return baseIsNative(value); + return baseIsNative2(value); } function isNull(value) { return value === null; @@ -10954,36 +10911,36 @@ return value == null; } function isNumber2(value) { - return typeof value == "number" || isObjectLike2(value) && baseGetTag2(value) == numberTag; + return typeof value == "number" || isObjectLike2(value) && baseGetTag2(value) == numberTag3; } function isPlainObject(value) { - if (!isObjectLike2(value) || baseGetTag2(value) != objectTag) { + if (!isObjectLike2(value) || baseGetTag2(value) != objectTag4) { return false; } var proto = getPrototype(value); if (proto === null) { return true; } - var Ctor = hasOwnProperty2.call(proto, "constructor") && proto.constructor; - return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString; + var Ctor = hasOwnProperty10.call(proto, "constructor") && proto.constructor; + return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString3.call(Ctor) == objectCtorString; } - var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp; + var isRegExp = nodeIsRegExp ? baseUnary2(nodeIsRegExp) : baseIsRegExp; function isSafeInteger(value) { - return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER; + return isInteger(value) && value >= -MAX_SAFE_INTEGER3 && value <= MAX_SAFE_INTEGER3; } - var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet; + var isSet = nodeIsSet ? baseUnary2(nodeIsSet) : baseIsSet; function isString(value) { - return typeof value == "string" || !isArray2(value) && isObjectLike2(value) && baseGetTag2(value) == stringTag; + return typeof value == "string" || !isArray2(value) && isObjectLike2(value) && baseGetTag2(value) == stringTag3; } function isSymbol2(value) { - return typeof value == "symbol" || isObjectLike2(value) && baseGetTag2(value) == symbolTag2; + return typeof value == "symbol" || isObjectLike2(value) && baseGetTag2(value) == symbolTag3; } - var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; + var isTypedArray2 = nodeIsTypedArray2 ? baseUnary2(nodeIsTypedArray2) : baseIsTypedArray2; function isUndefined(value) { return value === undefined2; } function isWeakMap(value) { - return isObjectLike2(value) && getTag(value) == weakMapTag; + return isObjectLike2(value) && getTag2(value) == weakMapTag3; } function isWeakSet(value) { return isObjectLike2(value) && baseGetTag2(value) == weakSetTag; @@ -10996,20 +10953,20 @@ if (!value) { return []; } - if (isArrayLike(value)) { + if (isArrayLike2(value)) { return isString(value) ? stringToArray(value) : copyArray(value); } if (symIterator && value[symIterator]) { return iteratorToArray(value[symIterator]()); } - var tag = getTag(value), func = tag == mapTag ? mapToArray : tag == setTag ? setToArray : values; + var tag = getTag2(value), func = tag == mapTag4 ? mapToArray2 : tag == setTag4 ? setToArray2 : values; return func(value); } function toFinite(value) { if (!value) { return value === 0 ? value : 0; } - value = toNumber2(value); + value = toNumber3(value); if (value === INFINITY2 || value === -INFINITY2) { var sign2 = value < 0 ? -1 : 1; return sign2 * MAX_INTEGER; @@ -11023,7 +10980,7 @@ function toLength(value) { return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0; } - function toNumber2(value) { + function toNumber3(value) { if (typeof value == "number") { return value; } @@ -11045,18 +11002,18 @@ return copyObject(value, keysIn(value)); } function toSafeInteger(value) { - return value ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) : value === 0 ? value : 0; + return value ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER3, MAX_SAFE_INTEGER3) : value === 0 ? value : 0; } function toString2(value) { return value == null ? "" : baseToString2(value); } var assign = createAssigner(function(object, source) { - if (isPrototype(source) || isArrayLike(source)) { - copyObject(source, keys(source), object); + if (isPrototype2(source) || isArrayLike2(source)) { + copyObject(source, keys2(source), object); return; } for (var key in source) { - if (hasOwnProperty2.call(source, key)) { + if (hasOwnProperty10.call(source, key)) { assignValue(object, key, source[key]); } } @@ -11068,7 +11025,7 @@ copyObject(source, keysIn(source), object, customizer); }); var assignWith = createAssigner(function(object, source, srcIndex, customizer) { - copyObject(source, keys(source), object, customizer); + copyObject(source, keys2(source), object, customizer); }); var at = flatRest(baseAt); function create2(prototype, properties) { @@ -11091,7 +11048,7 @@ while (++propsIndex < propsLength) { var key = props[propsIndex]; var value = object[key]; - if (value === undefined2 || eq(value, objectProto3[key]) && !hasOwnProperty2.call(object, key)) { + if (value === undefined2 || eq2(value, objectProto13[key]) && !hasOwnProperty10.call(object, key)) { object[key] = source[key]; } } @@ -11121,7 +11078,7 @@ return object && baseForOwnRight(object, getIteratee(iteratee2, 3)); } function functions(object) { - return object == null ? [] : baseFunctions(object, keys(object)); + return object == null ? [] : baseFunctions(object, keys2(object)); } function functionsIn(object) { return object == null ? [] : baseFunctions(object, keysIn(object)); @@ -11146,18 +11103,18 @@ if (value != null && typeof value.toString != "function") { value = nativeObjectToString3.call(value); } - if (hasOwnProperty2.call(result2, value)) { + if (hasOwnProperty10.call(result2, value)) { result2[value].push(key); } else { result2[value] = [key]; } }, getIteratee); var invoke = baseRest(baseInvoke); - function keys(object) { - return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); + function keys2(object) { + return isArrayLike2(object) ? arrayLikeKeys2(object) : baseKeys2(object); } function keysIn(object) { - return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); + return isArrayLike2(object) ? arrayLikeKeys2(object, true) : baseKeysIn(object); } function mapKeys(object, iteratee2) { var result2 = {}; @@ -11175,7 +11132,7 @@ }); return result2; } - var merge3 = createAssigner(function(object, source, srcIndex) { + var merge2 = createAssigner(function(object, source, srcIndex) { baseMerge(object, source, srcIndex); }); var mergeWith = createAssigner(function(object, source, srcIndex, customizer) { @@ -11233,7 +11190,7 @@ index = length; value = defaultValue; } - object = isFunction(value) ? value.call(object) : value; + object = isFunction2(value) ? value.call(object) : value; } return object; } @@ -11244,17 +11201,17 @@ customizer = typeof customizer == "function" ? customizer : undefined2; return object == null ? object : baseSet(object, path, value, customizer); } - var toPairs = createToPairs(keys); + var toPairs = createToPairs(keys2); var toPairsIn = createToPairs(keysIn); function transform2(object, iteratee2, accumulator) { - var isArr = isArray2(object), isArrLike = isArr || isBuffer(object) || isTypedArray(object); + var isArr = isArray2(object), isArrLike = isArr || isBuffer2(object) || isTypedArray2(object); iteratee2 = getIteratee(iteratee2, 4); if (accumulator == null) { var Ctor = object && object.constructor; if (isArrLike) { accumulator = isArr ? new Ctor() : []; } else if (isObject3(object)) { - accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {}; + accumulator = isFunction2(Ctor) ? baseCreate(getPrototype(object)) : {}; } else { accumulator = {}; } @@ -11275,7 +11232,7 @@ return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer); } function values(object) { - return object == null ? [] : baseValues(object, keys(object)); + return object == null ? [] : baseValues(object, keys2(object)); } function valuesIn(object) { return object == null ? [] : baseValues(object, keysIn(object)); @@ -11286,14 +11243,14 @@ lower2 = undefined2; } if (upper !== undefined2) { - upper = toNumber2(upper); + upper = toNumber3(upper); upper = upper === upper ? upper : 0; } if (lower2 !== undefined2) { - lower2 = toNumber2(lower2); + lower2 = toNumber3(lower2); lower2 = lower2 === lower2 ? lower2 : 0; } - return baseClamp(toNumber2(number3), lower2, upper); + return baseClamp(toNumber3(number3), lower2, upper); } function inRange(number3, start2, end) { start2 = toFinite(start2); @@ -11303,7 +11260,7 @@ } else { end = toFinite(end); } - number3 = toNumber2(number3); + number3 = toNumber3(number3); return baseInRange(number3, start2, end); } function random(lower2, upper, floating) { @@ -11368,7 +11325,7 @@ } function escapeRegExp(string) { string = toString2(string); - return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar, "\\$&") : string; + return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar2, "\\$&") : string; } var kebabCase = createCompounder(function(result2, word, index) { return result2 + (index ? "-" : "") + word.toLowerCase(); @@ -11455,13 +11412,13 @@ } string = toString2(string); options2 = assignInWith({}, options2, settings, customDefaultsAssignIn); - var imports = assignInWith({}, options2.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys); + var imports = assignInWith({}, options2.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys2(imports), importsValues = baseValues(imports, importsKeys); var isEscaping, isEvaluating, index = 0, interpolate = options2.interpolate || reNoMatch, source = "__p += '"; var reDelimiters = RegExp2( (options2.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options2.evaluate || reNoMatch).source + "|$", "g" ); - var sourceURL = "//# sourceURL=" + (hasOwnProperty2.call(options2, "sourceURL") ? (options2.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n"; + var sourceURL = "//# sourceURL=" + (hasOwnProperty10.call(options2, "sourceURL") ? (options2.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n"; string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) { interpolateValue || (interpolateValue = esTemplateValue); source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar); @@ -11480,7 +11437,7 @@ return match; }); source += "';\n"; - var variable = hasOwnProperty2.call(options2, "variable") && options2.variable; + var variable = hasOwnProperty10.call(options2, "variable") && options2.variable; if (!variable) { source = "with (obj) {\n" + source + "\n}\n"; } else if (reForbiddenIdentifierChars.test(variable)) { @@ -11667,14 +11624,14 @@ }; }); function mixin(object, source, options2) { - var props = keys(source), methodNames = baseFunctions(source, props); + var props = keys2(source), methodNames = baseFunctions(source, props); if (options2 == null && !(isObject3(source) && (methodNames.length || !props.length))) { options2 = source; source = object; object = this; - methodNames = baseFunctions(source, keys(source)); + methodNames = baseFunctions(source, keys2(source)); } - var chain2 = !(isObject3(options2) && "chain" in options2) || !!options2.chain, isFunc = isFunction(object); + var chain2 = !(isObject3(options2) && "chain" in options2) || !!options2.chain, isFunc = isFunction2(object); arrayEach(methodNames, function(methodName) { var func = source[methodName]; object[methodName] = func; @@ -11687,7 +11644,7 @@ result2.__chain__ = chainAll; return result2; } - return func.apply(object, arrayPush([this.value()], arguments)); + return func.apply(object, arrayPush2([this.value()], arguments)); }; } }); @@ -11709,7 +11666,7 @@ } var over = createOver(arrayMap2); var overEvery = createOver(arrayEvery); - var overSome = createOver(arraySome); + var overSome = createOver(arraySome2); function property(path) { return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path); } @@ -11720,10 +11677,10 @@ } var range3 = createRange(); var rangeRight = createRange(true); - function stubArray() { + function stubArray2() { return []; } - function stubFalse() { + function stubFalse2() { return false; } function stubObject() { @@ -11737,13 +11694,13 @@ } function times(n2, iteratee2) { n2 = toInteger(n2); - if (n2 < 1 || n2 > MAX_SAFE_INTEGER) { + if (n2 < 1 || n2 > MAX_SAFE_INTEGER3) { return []; } var index = MAX_ARRAY_LENGTH, length = nativeMin2(n2, MAX_ARRAY_LENGTH); iteratee2 = getIteratee(iteratee2); n2 -= MAX_ARRAY_LENGTH; - var result2 = baseTimes(length, iteratee2); + var result2 = baseTimes2(length, iteratee2); while (++index < n2) { iteratee2(index); } @@ -11857,7 +11814,7 @@ lodash.invokeMap = invokeMap; lodash.iteratee = iteratee; lodash.keyBy = keyBy; - lodash.keys = keys; + lodash.keys = keys2; lodash.keysIn = keysIn; lodash.map = map2; lodash.mapKeys = mapKeys; @@ -11865,7 +11822,7 @@ lodash.matches = matches; lodash.matchesProperty = matchesProperty; lodash.memoize = memoize; - lodash.merge = merge3; + lodash.merge = merge2; lodash.mergeWith = mergeWith; lodash.method = method; lodash.methodOf = methodOf; @@ -11967,7 +11924,7 @@ lodash.defaultTo = defaultTo; lodash.divide = divide; lodash.endsWith = endsWith; - lodash.eq = eq; + lodash.eq = eq2; lodash.escape = escape6; lodash.escapeRegExp = escapeRegExp; lodash.every = every; @@ -11995,23 +11952,23 @@ lodash.indexOf = indexOf; lodash.inRange = inRange; lodash.invoke = invoke; - lodash.isArguments = isArguments; + lodash.isArguments = isArguments2; lodash.isArray = isArray2; lodash.isArrayBuffer = isArrayBuffer; - lodash.isArrayLike = isArrayLike; + lodash.isArrayLike = isArrayLike2; lodash.isArrayLikeObject = isArrayLikeObject; lodash.isBoolean = isBoolean; - lodash.isBuffer = isBuffer; + lodash.isBuffer = isBuffer2; lodash.isDate = isDate; lodash.isElement = isElement2; lodash.isEmpty = isEmpty; - lodash.isEqual = isEqual; + lodash.isEqual = isEqual4; lodash.isEqualWith = isEqualWith; lodash.isError = isError; lodash.isFinite = isFinite2; - lodash.isFunction = isFunction; + lodash.isFunction = isFunction2; lodash.isInteger = isInteger; - lodash.isLength = isLength; + lodash.isLength = isLength2; lodash.isMap = isMap; lodash.isMatch = isMatch; lodash.isMatchWith = isMatchWith; @@ -12028,7 +11985,7 @@ lodash.isSet = isSet; lodash.isString = isString; lodash.isSymbol = isSymbol2; - lodash.isTypedArray = isTypedArray; + lodash.isTypedArray = isTypedArray2; lodash.isUndefined = isUndefined; lodash.isWeakMap = isWeakMap; lodash.isWeakSet = isWeakSet; @@ -12046,8 +12003,8 @@ lodash.meanBy = meanBy; lodash.min = min3; lodash.minBy = minBy; - lodash.stubArray = stubArray; - lodash.stubFalse = stubFalse; + lodash.stubArray = stubArray2; + lodash.stubFalse = stubFalse2; lodash.stubObject = stubObject; lodash.stubString = stubString; lodash.stubTrue = stubTrue; @@ -12089,7 +12046,7 @@ lodash.toInteger = toInteger; lodash.toLength = toLength; lodash.toLower = toLower; - lodash.toNumber = toNumber2; + lodash.toNumber = toNumber3; lodash.toSafeInteger = toSafeInteger; lodash.toString = toString2; lodash.toUpper = toUpper; @@ -12107,7 +12064,7 @@ mixin(lodash, function() { var source = {}; baseForOwn(lodash, function(func, methodName) { - if (!hasOwnProperty2.call(lodash.prototype, methodName)) { + if (!hasOwnProperty10.call(lodash.prototype, methodName)) { source[methodName] = func; } }); @@ -12210,7 +12167,7 @@ lodash.prototype[methodName] = function() { var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee2 = args[0], useLazy = isLazy || isArray2(value); var interceptor = function(value2) { - var result3 = lodashFunc.apply(lodash, arrayPush([value2], args)); + var result3 = lodashFunc.apply(lodash, arrayPush2([value2], args)); return isTaker && chainAll ? result3[0] : result3; }; if (useLazy && checkIteratee && typeof iteratee2 == "function" && iteratee2.length != 1) { @@ -12231,7 +12188,7 @@ }; }); arrayEach(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) { - var func = arrayProto[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName); + var func = arrayProto2[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName); lodash.prototype[methodName] = function() { var args = arguments; if (retUnwrapped && !this.__chain__) { @@ -12247,7 +12204,7 @@ var lodashFunc = lodash[methodName]; if (lodashFunc) { var key = lodashFunc.name + ""; - if (!hasOwnProperty2.call(realNames, key)) { + if (!hasOwnProperty10.call(realNames, key)) { realNames[key] = []; } realNames[key].push({ "name": methodName, "func": lodashFunc }); @@ -12279,9 +12236,9 @@ define(function() { return _; }); - } else if (freeModule) { - (freeModule.exports = _)._ = _; - freeExports._ = _; + } else if (freeModule3) { + (freeModule3.exports = _)._ = _; + freeExports3._ = _; } else { root3._ = _; } @@ -12289,6 +12246,51 @@ } }); + // node_modules/fast-deep-equal/index.js + var require_fast_deep_equal = __commonJS({ + "node_modules/fast-deep-equal/index.js"(exports2, module2) { + "use strict"; + module2.exports = function equal(a, b) { + if (a === b) + return true; + if (a && b && typeof a == "object" && typeof b == "object") { + if (a.constructor !== b.constructor) + return false; + var length, i2, keys2; + if (Array.isArray(a)) { + length = a.length; + if (length != b.length) + return false; + for (i2 = length; i2-- !== 0; ) + if (!equal(a[i2], b[i2])) + return false; + return true; + } + if (a.constructor === RegExp) + return a.source === b.source && a.flags === b.flags; + if (a.valueOf !== Object.prototype.valueOf) + return a.valueOf() === b.valueOf(); + if (a.toString !== Object.prototype.toString) + return a.toString() === b.toString(); + keys2 = Object.keys(a); + length = keys2.length; + if (length !== Object.keys(b).length) + return false; + for (i2 = length; i2-- !== 0; ) + if (!Object.prototype.hasOwnProperty.call(b, keys2[i2])) + return false; + for (i2 = length; i2-- !== 0; ) { + var key = keys2[i2]; + if (!equal(a[key], b[key])) + return false; + } + return true; + } + return a !== a && b !== b; + }; + } + }); + // node_modules/rbush/rbush.min.js var require_rbush_min = __commonJS({ "node_modules/rbush/rbush.min.js"(exports2, module2) { @@ -13547,13 +13549,13 @@ "use strict"; var Point = require_point_geometry(); module2.exports = VectorTileFeature; - function VectorTileFeature(pbf, end, extent, keys, values) { + function VectorTileFeature(pbf, end, extent, keys2, values) { this.properties = {}; this.extent = extent; this.type = 0; this._pbf = pbf; this._geometry = -1; - this._keys = keys; + this._keys = keys2; this._values = values; pbf.readFields(readFeature, this, end); } @@ -13848,10 +13850,10 @@ throw new TypeError("Converting circular structure to JSON"); } var seenIndex = seen.push(node) - 1; - var keys = Object.keys(node).sort(cmp && cmp(node)); + var keys2 = Object.keys(node).sort(cmp && cmp(node)); out = ""; - for (i2 = 0; i2 < keys.length; i2++) { - var key = keys[i2]; + for (i2 = 0; i2 < keys2.length; i2++) { + var key = keys2[i2]; var value = stringify3(node[key]); if (!value) continue; @@ -13975,7 +13977,7 @@ map: map2, pluck, isList, - isFunction, + isFunction: isFunction2, isObject: isObject3, Global }; @@ -14063,7 +14065,7 @@ function isList(val) { return val != null && typeof val != "function" && typeof val.length == "number"; } - function isFunction(val) { + function isFunction2(val) { return val && {}.toString.call(val) === "[object Function]"; } function isObject3(val) { @@ -14082,7 +14084,7 @@ var bind = util.bind; var create2 = util.create; var isList = util.isList; - var isFunction = util.isFunction; + var isFunction2 = util.isFunction; var isObject3 = util.isObject; module2.exports = { createStore @@ -14235,7 +14237,7 @@ return; } this.plugins.push(plugin); - if (!isFunction(plugin)) { + if (!isFunction2(plugin)) { throw new Error("Plugins must be function values that return objects"); } var pluginProperties = plugin.call(this); @@ -14243,7 +14245,7 @@ throw new Error("Plugins must return an object of function properties"); } each(pluginProperties, function(pluginFnProp, propName) { - if (!isFunction(pluginFnProp)) { + if (!isFunction2(pluginFnProp)) { throw new Error("Bad plugin property: " + propName + " from plugin " + plugin.name + ". Plugins should only return functions."); } self2._assignPluginFnProp(pluginFnProp, propName); @@ -14262,7 +14264,7 @@ }); store2.raw = {}; each(store2, function(prop, propName) { - if (isFunction(prop)) { + if (isFunction2(prop)) { store2.raw[propName] = bind(store2, prop); } }); @@ -15103,10 +15105,10 @@ if (options2.cache === "no-store" || options2.cache === "no-cache") { var reParamSearch = /([?&])_=[^&]*/; if (reParamSearch.test(this.url)) { - this.url = this.url.replace(reParamSearch, "$1_=" + new Date().getTime()); + this.url = this.url.replace(reParamSearch, "$1_=" + (/* @__PURE__ */ new Date()).getTime()); } else { var reQueryString = /\?/; - this.url += (reQueryString.test(this.url) ? "&" : "?") + "_=" + new Date().getTime(); + this.url += (reQueryString.test(this.url) ? "&" : "?") + "_=" + (/* @__PURE__ */ new Date()).getTime(); } } } @@ -15301,6 +15303,9 @@ _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); return Constructor; } function _inherits(subClass, superClass) { @@ -15314,17 +15319,20 @@ configurable: true } }); + Object.defineProperty(subClass, "prototype", { + writable: false + }); if (superClass) _setPrototypeOf(subClass, superClass); } function _getPrototypeOf(o) { - _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf2(o2) { + _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o2) { return o2.__proto__ || Object.getPrototypeOf(o2); }; return _getPrototypeOf(o); } function _setPrototypeOf(o, p) { - _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) { + _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) { o2.__proto__ = p2; return o2; }; @@ -15354,6 +15362,8 @@ function _possibleConstructorReturn(self2, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; + } else if (call !== void 0) { + throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self2); } @@ -15378,22 +15388,22 @@ } return object; } - function _get(target, property, receiver) { + function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { - _get = Reflect.get; + _get = Reflect.get.bind(); } else { - _get = function _get2(target2, property2, receiver2) { - var base = _superPropBase(target2, property2); + _get = function _get2(target, property, receiver) { + var base = _superPropBase(target, property); if (!base) return; - var desc = Object.getOwnPropertyDescriptor(base, property2); + var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { - return desc.get.call(receiver2); + return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } - return _get(target, property, receiver || target); + return _get.apply(this, arguments); } var Emitter = /* @__PURE__ */ function() { function Emitter2() { @@ -15475,6 +15485,11 @@ writable: true, configurable: true }); + Object.defineProperty(_assertThisInitialized(_this), "reason", { + value: void 0, + writable: true, + configurable: true + }); return _this; } _createClass(AbortSignal2, [{ @@ -15507,7 +15522,7 @@ } _createClass(AbortController3, [{ key: "abort", - value: function abort() { + value: function abort(reason) { var event; try { event = new Event("abort"); @@ -15528,6 +15543,21 @@ }; } } + var signalReason = reason; + if (signalReason === void 0) { + if (typeof document === "undefined") { + signalReason = new Error("This operation was aborted"); + signalReason.name = "AbortError"; + } else { + try { + signalReason = new DOMException("signal is aborted without reason"); + } catch (err) { + signalReason = new Error("This operation was aborted"); + signalReason.name = "AbortError"; + } + } + } + this.signal.reason = signalReason; this.signal.dispatchEvent(event); } }, { @@ -15760,6 +15790,7 @@ geoVecSubtract: () => geoVecSubtract, geoViewportEdge: () => geoViewportEdge, geoZoomToScale: () => geoZoomToScale, + likelyRawNumberFormat: () => likelyRawNumberFormat, localizer: () => _mainLocalizer, locationManager: () => _sharedLocationManager, modeAddArea: () => modeAddArea, @@ -16311,11 +16342,11 @@ var returnTags = {}; for (var realKey in tags) { const key = osmRemoveLifecyclePrefix(realKey); - if (key in osmAreaKeys && !(tags[key] in osmAreaKeys[key])) { + if (key in osmAreaKeys && !(tags[realKey] in osmAreaKeys[key])) { returnTags[realKey] = tags[realKey]; return returnTags; } - if (key in osmAreaKeysExceptions && tags[key] in osmAreaKeysExceptions[key]) { + if (key in osmAreaKeysExceptions && tags[realKey] in osmAreaKeysExceptions[key]) { returnTags[realKey] = tags[realKey]; return returnTags; } @@ -16377,6 +16408,8 @@ "yes": true }, "seamark:type": { + "two-way_route": true, + "recommended_traffic_lane": true, "separation_lane": true, "separation_roundabout": true }, @@ -16385,7 +16418,9 @@ "ditch": true, "drain": true, "fish_pass": true, + "pressurised": true, "river": true, + "spillway": true, "stream": true, "tidal_channel": true } @@ -16426,7 +16461,8 @@ "city_wall": true }, "man_made": { - "embankment": true + "embankment": true, + "quay": true }, "waterway": { "weir": true @@ -16488,6 +16524,7 @@ stream: true, tidal_channel: true }; + var allowUpperCaseTagValues = /network|taxon|genus|species|brand|grape_variety|royal_cypher|listed_status|booth|rating|stars|:output|_hours|_times|_ref|manufacturer|country|target|brewery|cai_scale|traffic_sign/; // node_modules/d3-array/src/ascending.js function ascending(a, b) { @@ -19594,9 +19631,9 @@ function merge_default(context) { var selection2 = context.selection ? context.selection() : context; for (var groups0 = this._groups, groups1 = selection2._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j2 = 0; j2 < m; ++j2) { - for (var group0 = groups0[j2], group1 = groups1[j2], n2 = group0.length, merge3 = merges[j2] = new Array(n2), node, i2 = 0; i2 < n2; ++i2) { + for (var group0 = groups0[j2], group1 = groups1[j2], n2 = group0.length, merge2 = merges[j2] = new Array(n2), node, i2 = 0; i2 < n2; ++i2) { if (node = group0[i2] || group1[i2]) { - merge3[i2] = node; + merge2[i2] = node; } } } @@ -20865,7 +20902,7 @@ // node_modules/d3-interpolate/src/date.js function date_default(a, b) { - var d = new Date(); + var d = /* @__PURE__ */ new Date(); return a = +a, b = +b, function(t) { return d.setTime(a * (1 - t) + b * t), d; }; @@ -21639,9 +21676,9 @@ if (transition2._id !== this._id) throw new Error(); for (var groups0 = this._groups, groups1 = transition2._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j2 = 0; j2 < m; ++j2) { - for (var group0 = groups0[j2], group1 = groups1[j2], n2 = group0.length, merge3 = merges[j2] = new Array(n2), node, i2 = 0; i2 < n2; ++i2) { + for (var group0 = groups0[j2], group1 = groups1[j2], n2 = group0.length, merge2 = merges[j2] = new Array(n2), node, i2 = 0; i2 < n2; ++i2) { if (node = group0[i2] || group1[i2]) { - merge3[i2] = node; + merge2[i2] = node; } } } @@ -22694,27 +22731,38 @@ var ociCdnUrl = "https://cdn.jsdelivr.net/npm/osm-community-index@{version}/"; var wmfSitematrixCdnUrl = "https://cdn.jsdelivr.net/npm/wmf-sitematrix@{version}/"; var nsiCdnUrl = "https://cdn.jsdelivr.net/npm/name-suggestion-index@{version}/"; - var osmApiConnections = [ - { - // "live" db + var defaultOsmApiConnections = { + live: { url: "https://www.openstreetmap.org", client_id: "0tmNTmd0Jo1dQp4AUmMBLtGiD9YpMuXzHefitcuVStc", client_secret: "BTlNrNxIPitHdL4sP2clHw5KLoee9aKkA7dQbc0Bj7Q" }, - { - // "dev" db + dev: { url: "https://api06.dev.openstreetmap.org", client_id: "Ee1wWJ6UlpERbF6BfTNOpwn0R8k_06mvMXdDUkeHMgw", client_secret: "OnfWFC-JkZNHyYdr_viNn_h_RTZXRslKcUxllOXqf5g" } - ]; + }; + var osmApiConnections = []; + if (false) { + osmApiConnections.push({ + url: null, + client_id: null, + client_secret: null + }); + } else if (false) { + osmApiConnections.push(defaultOsmApiConnections[null]); + } else { + osmApiConnections.push(defaultOsmApiConnections.live); + osmApiConnections.push(defaultOsmApiConnections.dev); + } var taginfoApiUrl = "https://taginfo.openstreetmap.org/api/4/"; var nominatimApiUrl = "https://nominatim.openstreetmap.org/"; // package.json var package_default = { name: "iD", - version: "2.24.1", + version: "2.26.2", description: "A friendly editor for OpenStreetMap", main: "dist/iD.min.js", repository: "github:openstreetmap/iD", @@ -22744,11 +22792,13 @@ "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', "dist:svg:mapillary:signs": "svg-sprite --symbol --symbol-dest . --symbol-sprite dist/img/mapillary-sprite.svg node_modules/mapillary_sprite_source/package_signs/*.svg", "dist:svg:mapillary:objects": "svg-sprite --symbol --symbol-dest . --symbol-sprite dist/img/mapillary-object-sprite.svg node_modules/mapillary_sprite_source/package_objects/*.svg", - "dist:svg:temaki": 'svg-sprite --symbol --symbol-dest . --shape-id-generator "temaki-%s" --symbol-sprite dist/img/temaki-sprite.svg node_modules/@ideditor/temaki/icons/*.svg', + "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', + "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', imagery: "node scripts/update_imagery.js", - lint: "eslint scripts test/spec modules", + lint: "eslint config scripts test/spec modules --ext js,mjs", "lint:fix": "eslint scripts test/spec modules --fix", - start: "run-s build:js start:server", + start: "run-s start:watch", + "start:single-build": "run-p build:js start:server", "start:watch": "run-p build:js:watch start:server", "start:server": "node scripts/server.js", test: "npm-run-all -s lint build test:spec", @@ -22756,72 +22806,73 @@ translations: "node scripts/update_locales.js" }, dependencies: { - "@ideditor/country-coder": "~5.1.0", - "@ideditor/location-conflation": "~1.1.0", + "@rapideditor/country-coder": "~5.2.0", + "@rapideditor/location-conflation": "~1.2.0", "@mapbox/geojson-area": "^0.2.2", "@mapbox/sexagesimal": "1.2.0", "@mapbox/vector-tile": "^1.3.1", - "@tmcw/togeojson": "^5.2.1", + "@tmcw/togeojson": "^5.6.2", "@turf/bbox": "^6.0.0", "@turf/bbox-clip": "^6.0.0", - "abortcontroller-polyfill": "^1.4.0", + "abortcontroller-polyfill": "^1.7.5", "aes-js": "^3.1.2", "alif-toolkit": "^1.2.9", - "core-js-bundle": "^3.19.0", + "core-js-bundle": "^3.31.1", diacritics: "1.3.0", "fast-deep-equal": "~3.1.1", "fast-json-stable-stringify": "2.1.0", "lodash-es": "~4.17.15", - marked: "~4.2.2", + marked: "~5.1.1", "node-diff3": "~3.1.0", - "osm-auth": "~2.0.0", + "osm-auth": "~2.1.0", pannellum: "2.5.6", pbf: "^3.2.1", "polygon-clipping": "~0.15.1", rbush: "3.0.1", "whatwg-fetch": "^3.4.1", - "which-polygon": "2.2.0" + "which-polygon": "2.2.1" }, devDependencies: { - "@fortawesome/fontawesome-svg-core": "~6.2.0", - "@fortawesome/free-brands-svg-icons": "~6.2.0", - "@fortawesome/free-regular-svg-icons": "~6.2.0", - "@fortawesome/free-solid-svg-icons": "~6.2.0", - "@ideditor/temaki": "~5.2.0", - "@mapbox/maki": "^8.0.0", - "@openstreetmap/id-tagging-schema": "^5.0.1", - "@transifex/api": "^5.0.1", - autoprefixer: "^10.0.1", - chai: "^4.3.4", + "@fortawesome/fontawesome-svg-core": "~6.4.0", + "@fortawesome/free-brands-svg-icons": "~6.4.0", + "@fortawesome/free-regular-svg-icons": "~6.4.0", + "@fortawesome/free-solid-svg-icons": "~6.4.0", + "@rapideditor/temaki": "~5.4.0", + "@mapbox/maki": "^8.0.1", + "@openstreetmap/id-tagging-schema": "^6.3.0", + "@transifex/api": "^5.4.0", + autoprefixer: "^10.4.14", + chai: "^4.3.7", chalk: "^4.1.2", - "cldr-core": "^41.0.0", - "cldr-localenames-full": "^41.0.0", + "cldr-core": "^43.0.0", + "cldr-localenames-full": "^43.1.0", "concat-files": "^0.1.1", - d3: "~7.8.1", + d3: "~7.8.5", + dotenv: "^16.3.1", "editor-layer-index": "github:osmlab/editor-layer-index#gh-pages", - esbuild: "^0.17.3", - "esbuild-visualizer": "^0.4.0", - eslint: "^8.8.0", + esbuild: "^0.18.11", + "esbuild-visualizer": "^0.4.1", + eslint: "^8.44.0", "fetch-mock": "^9.11.0", gaze: "^1.1.3", - glob: "^8.0.3", + glob: "^10.3.3", happen: "^0.3.2", "js-yaml": "^4.0.0", "json-stringify-pretty-compact": "^3.0.0", - karma: "^6.3.5", - "karma-chrome-launcher": "^3.1.0", + karma: "^6.4.2", + "karma-chrome-launcher": "^3.2.0", "karma-coverage": "2.1.1", "karma-mocha": "^2.0.1", "karma-remap-istanbul": "^0.6.0", mapillary_sprite_source: "^1.8.0", "mapillary-js": "4.1.1", - minimist: "^1.2.3", - mocha: "^10.0.0", + minimist: "^1.2.8", + mocha: "^10.2.0", "name-suggestion-index": "~6.0", - "node-fetch": "^2.6.1", + "node-fetch": "^2.6.11", "npm-run-all": "^4.0.0", - "osm-community-index": "~5.5.0", - postcss: "^8.1.1", + "osm-community-index": "~5.5.3", + postcss: "^8.4.25", "postcss-selector-prepend": "^0.5.0", shelljs: "^0.8.0", shx: "^0.3.0", @@ -22945,7 +22996,7 @@ return _this; } - // node_modules/@ideditor/country-coder/dist/country-coder.mjs + // node_modules/@rapideditor/country-coder/dist/country-coder.mjs var import_which_polygon = __toESM(require_which_polygon(), 1); var borders_default = { type: "FeatureCollection", features: [ { 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]]]] } }, @@ -23641,7 +23692,8 @@ const features = featuresContaining(loc); const match = features.find((feature22) => { let levelIndex = levels.indexOf(feature22.properties.level); - if (feature22.properties.level === targetLevel || levelIndex > targetLevelIndex && levelIndex <= maxLevelIndex) { + if (feature22.properties.level === targetLevel || // if no feature exists at the target level, return the first feature at the next level up + levelIndex > targetLevelIndex && levelIndex <= maxLevelIndex) { if (!withProp || feature22.properties[withProp]) { return feature22; } @@ -23755,7 +23807,7 @@ return feature22 && feature22.properties.roadHeightUnit || null; } - // node_modules/@ideditor/location-conflation/index.mjs + // node_modules/@rapideditor/location-conflation/index.mjs var import_geojson_area = __toESM(require_geojson_area(), 1); var import_circle_to_polygon = __toESM(require_circle_to_polygon(), 1); var import_polygon_clipping = __toESM(require_polygon_clipping_umd(), 1); @@ -24470,12 +24522,522 @@ } var toNumber_default = toNumber; + // node_modules/lodash-es/isFunction.js + var asyncTag = "[object AsyncFunction]"; + var funcTag = "[object Function]"; + var genTag = "[object GeneratorFunction]"; + var proxyTag = "[object Proxy]"; + function isFunction(value) { + if (!isObject_default(value)) { + return false; + } + var tag = baseGetTag_default(value); + return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; + } + var isFunction_default = isFunction; + + // node_modules/lodash-es/_coreJsData.js + var coreJsData = root_default["__core-js_shared__"]; + var coreJsData_default = coreJsData; + + // node_modules/lodash-es/_isMasked.js + var maskSrcKey = function() { + var uid = /[^.]+$/.exec(coreJsData_default && coreJsData_default.keys && coreJsData_default.keys.IE_PROTO || ""); + return uid ? "Symbol(src)_1." + uid : ""; + }(); + function isMasked(func) { + return !!maskSrcKey && maskSrcKey in func; + } + var isMasked_default = isMasked; + + // node_modules/lodash-es/_toSource.js + var funcProto = Function.prototype; + var funcToString = funcProto.toString; + function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e) { + } + try { + return func + ""; + } catch (e) { + } + } + return ""; + } + var toSource_default = toSource; + + // node_modules/lodash-es/_baseIsNative.js + var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; + var reIsHostCtor = /^\[object .+?Constructor\]$/; + var funcProto2 = Function.prototype; + var objectProto3 = Object.prototype; + var funcToString2 = funcProto2.toString; + var hasOwnProperty2 = objectProto3.hasOwnProperty; + var reIsNative = RegExp( + "^" + funcToString2.call(hasOwnProperty2).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" + ); + function baseIsNative(value) { + if (!isObject_default(value) || isMasked_default(value)) { + return false; + } + var pattern = isFunction_default(value) ? reIsNative : reIsHostCtor; + return pattern.test(toSource_default(value)); + } + var baseIsNative_default = baseIsNative; + + // node_modules/lodash-es/_getValue.js + function getValue(object, key) { + return object == null ? void 0 : object[key]; + } + var getValue_default = getValue; + + // node_modules/lodash-es/_getNative.js + function getNative(object, key) { + var value = getValue_default(object, key); + return baseIsNative_default(value) ? value : void 0; + } + var getNative_default = getNative; + + // node_modules/lodash-es/_WeakMap.js + var WeakMap = getNative_default(root_default, "WeakMap"); + var WeakMap_default = WeakMap; + + // node_modules/lodash-es/_isIndex.js + var MAX_SAFE_INTEGER = 9007199254740991; + var reIsUint = /^(?:0|[1-9]\d*)$/; + function isIndex(value, length) { + var type2 = typeof value; + length = length == null ? MAX_SAFE_INTEGER : length; + return !!length && (type2 == "number" || type2 != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length); + } + var isIndex_default = isIndex; + + // node_modules/lodash-es/eq.js + function eq(value, other) { + return value === other || value !== value && other !== other; + } + var eq_default = eq; + + // node_modules/lodash-es/isLength.js + var MAX_SAFE_INTEGER2 = 9007199254740991; + function isLength(value) { + return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER2; + } + var isLength_default = isLength; + + // node_modules/lodash-es/isArrayLike.js + function isArrayLike(value) { + return value != null && isLength_default(value.length) && !isFunction_default(value); + } + var isArrayLike_default = isArrayLike; + + // node_modules/lodash-es/_isPrototype.js + var objectProto4 = Object.prototype; + function isPrototype(value) { + var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto4; + return value === proto; + } + var isPrototype_default = isPrototype; + + // node_modules/lodash-es/_baseTimes.js + function baseTimes(n2, iteratee) { + var index = -1, result = Array(n2); + while (++index < n2) { + result[index] = iteratee(index); + } + return result; + } + var baseTimes_default = baseTimes; + + // node_modules/lodash-es/_baseIsArguments.js + var argsTag = "[object Arguments]"; + function baseIsArguments(value) { + return isObjectLike_default(value) && baseGetTag_default(value) == argsTag; + } + var baseIsArguments_default = baseIsArguments; + + // node_modules/lodash-es/isArguments.js + var objectProto5 = Object.prototype; + var hasOwnProperty3 = objectProto5.hasOwnProperty; + var propertyIsEnumerable = objectProto5.propertyIsEnumerable; + var isArguments = baseIsArguments_default(function() { + return arguments; + }()) ? baseIsArguments_default : function(value) { + return isObjectLike_default(value) && hasOwnProperty3.call(value, "callee") && !propertyIsEnumerable.call(value, "callee"); + }; + var isArguments_default = isArguments; + + // node_modules/lodash-es/stubFalse.js + function stubFalse() { + return false; + } + var stubFalse_default = stubFalse; + + // node_modules/lodash-es/isBuffer.js + var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports; + var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module; + var moduleExports = freeModule && freeModule.exports === freeExports; + var Buffer2 = moduleExports ? root_default.Buffer : void 0; + var nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : void 0; + var isBuffer = nativeIsBuffer || stubFalse_default; + var isBuffer_default = isBuffer; + + // node_modules/lodash-es/_baseIsTypedArray.js + var argsTag2 = "[object Arguments]"; + var arrayTag = "[object Array]"; + var boolTag = "[object Boolean]"; + var dateTag = "[object Date]"; + var errorTag = "[object Error]"; + var funcTag2 = "[object Function]"; + var mapTag = "[object Map]"; + var numberTag = "[object Number]"; + var objectTag = "[object Object]"; + var regexpTag = "[object RegExp]"; + var setTag = "[object Set]"; + var stringTag = "[object String]"; + var weakMapTag = "[object WeakMap]"; + var arrayBufferTag = "[object ArrayBuffer]"; + var dataViewTag = "[object DataView]"; + var float32Tag = "[object Float32Array]"; + var float64Tag = "[object Float64Array]"; + var int8Tag = "[object Int8Array]"; + var int16Tag = "[object Int16Array]"; + var int32Tag = "[object Int32Array]"; + var uint8Tag = "[object Uint8Array]"; + var uint8ClampedTag = "[object Uint8ClampedArray]"; + var uint16Tag = "[object Uint16Array]"; + var uint32Tag = "[object Uint32Array]"; + var typedArrayTags = {}; + typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true; + 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; + function baseIsTypedArray(value) { + return isObjectLike_default(value) && isLength_default(value.length) && !!typedArrayTags[baseGetTag_default(value)]; + } + var baseIsTypedArray_default = baseIsTypedArray; + + // node_modules/lodash-es/_baseUnary.js + function baseUnary(func) { + return function(value) { + return func(value); + }; + } + var baseUnary_default = baseUnary; + + // node_modules/lodash-es/_nodeUtil.js + var freeExports2 = typeof exports == "object" && exports && !exports.nodeType && exports; + var freeModule2 = freeExports2 && typeof module == "object" && module && !module.nodeType && module; + var moduleExports2 = freeModule2 && freeModule2.exports === freeExports2; + var freeProcess = moduleExports2 && freeGlobal_default.process; + var nodeUtil = function() { + try { + var types = freeModule2 && freeModule2.require && freeModule2.require("util").types; + if (types) { + return types; + } + return freeProcess && freeProcess.binding && freeProcess.binding("util"); + } catch (e) { + } + }(); + var nodeUtil_default = nodeUtil; + + // node_modules/lodash-es/isTypedArray.js + var nodeIsTypedArray = nodeUtil_default && nodeUtil_default.isTypedArray; + var isTypedArray = nodeIsTypedArray ? baseUnary_default(nodeIsTypedArray) : baseIsTypedArray_default; + var isTypedArray_default = isTypedArray; + + // node_modules/lodash-es/_arrayLikeKeys.js + var objectProto6 = Object.prototype; + var hasOwnProperty4 = objectProto6.hasOwnProperty; + function arrayLikeKeys(value, inherited) { + var isArr = isArray_default(value), isArg = !isArr && isArguments_default(value), isBuff = !isArr && !isArg && isBuffer_default(value), isType = !isArr && !isArg && !isBuff && isTypedArray_default(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes_default(value.length, String) : [], length = result.length; + for (var key in value) { + if ((inherited || hasOwnProperty4.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode. + (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. + isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. + isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties. + isIndex_default(key, length)))) { + result.push(key); + } + } + return result; + } + var arrayLikeKeys_default = arrayLikeKeys; + + // node_modules/lodash-es/_overArg.js + function overArg(func, transform2) { + return function(arg) { + return func(transform2(arg)); + }; + } + var overArg_default = overArg; + + // node_modules/lodash-es/_nativeKeys.js + var nativeKeys = overArg_default(Object.keys, Object); + var nativeKeys_default = nativeKeys; + + // node_modules/lodash-es/_baseKeys.js + var objectProto7 = Object.prototype; + var hasOwnProperty5 = objectProto7.hasOwnProperty; + function baseKeys(object) { + if (!isPrototype_default(object)) { + return nativeKeys_default(object); + } + var result = []; + for (var key in Object(object)) { + if (hasOwnProperty5.call(object, key) && key != "constructor") { + result.push(key); + } + } + return result; + } + var baseKeys_default = baseKeys; + + // node_modules/lodash-es/keys.js + function keys(object) { + return isArrayLike_default(object) ? arrayLikeKeys_default(object) : baseKeys_default(object); + } + var keys_default = keys; + + // node_modules/lodash-es/_nativeCreate.js + var nativeCreate = getNative_default(Object, "create"); + var nativeCreate_default = nativeCreate; + + // node_modules/lodash-es/_hashClear.js + function hashClear() { + this.__data__ = nativeCreate_default ? nativeCreate_default(null) : {}; + this.size = 0; + } + var hashClear_default = hashClear; + + // node_modules/lodash-es/_hashDelete.js + function hashDelete(key) { + var result = this.has(key) && delete this.__data__[key]; + this.size -= result ? 1 : 0; + return result; + } + var hashDelete_default = hashDelete; + + // node_modules/lodash-es/_hashGet.js + var HASH_UNDEFINED = "__lodash_hash_undefined__"; + var objectProto8 = Object.prototype; + var hasOwnProperty6 = objectProto8.hasOwnProperty; + function hashGet(key) { + var data = this.__data__; + if (nativeCreate_default) { + var result = data[key]; + return result === HASH_UNDEFINED ? void 0 : result; + } + return hasOwnProperty6.call(data, key) ? data[key] : void 0; + } + var hashGet_default = hashGet; + + // node_modules/lodash-es/_hashHas.js + var objectProto9 = Object.prototype; + var hasOwnProperty7 = objectProto9.hasOwnProperty; + function hashHas(key) { + var data = this.__data__; + return nativeCreate_default ? data[key] !== void 0 : hasOwnProperty7.call(data, key); + } + var hashHas_default = hashHas; + + // node_modules/lodash-es/_hashSet.js + var HASH_UNDEFINED2 = "__lodash_hash_undefined__"; + function hashSet(key, value) { + var data = this.__data__; + this.size += this.has(key) ? 0 : 1; + data[key] = nativeCreate_default && value === void 0 ? HASH_UNDEFINED2 : value; + return this; + } + var hashSet_default = hashSet; + + // node_modules/lodash-es/_Hash.js + function Hash(entries) { + var index = -1, length = entries == null ? 0 : entries.length; + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } + } + Hash.prototype.clear = hashClear_default; + Hash.prototype["delete"] = hashDelete_default; + Hash.prototype.get = hashGet_default; + Hash.prototype.has = hashHas_default; + Hash.prototype.set = hashSet_default; + var Hash_default = Hash; + + // node_modules/lodash-es/_listCacheClear.js + function listCacheClear() { + this.__data__ = []; + this.size = 0; + } + var listCacheClear_default = listCacheClear; + + // node_modules/lodash-es/_assocIndexOf.js + function assocIndexOf(array2, key) { + var length = array2.length; + while (length--) { + if (eq_default(array2[length][0], key)) { + return length; + } + } + return -1; + } + var assocIndexOf_default = assocIndexOf; + + // node_modules/lodash-es/_listCacheDelete.js + var arrayProto = Array.prototype; + var splice = arrayProto.splice; + function listCacheDelete(key) { + var data = this.__data__, index = assocIndexOf_default(data, key); + if (index < 0) { + return false; + } + var lastIndex = data.length - 1; + if (index == lastIndex) { + data.pop(); + } else { + splice.call(data, index, 1); + } + --this.size; + return true; + } + var listCacheDelete_default = listCacheDelete; + + // node_modules/lodash-es/_listCacheGet.js + function listCacheGet(key) { + var data = this.__data__, index = assocIndexOf_default(data, key); + return index < 0 ? void 0 : data[index][1]; + } + var listCacheGet_default = listCacheGet; + + // node_modules/lodash-es/_listCacheHas.js + function listCacheHas(key) { + return assocIndexOf_default(this.__data__, key) > -1; + } + var listCacheHas_default = listCacheHas; + + // node_modules/lodash-es/_listCacheSet.js + function listCacheSet(key, value) { + var data = this.__data__, index = assocIndexOf_default(data, key); + if (index < 0) { + ++this.size; + data.push([key, value]); + } else { + data[index][1] = value; + } + return this; + } + var listCacheSet_default = listCacheSet; + + // node_modules/lodash-es/_ListCache.js + function ListCache(entries) { + var index = -1, length = entries == null ? 0 : entries.length; + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } + } + ListCache.prototype.clear = listCacheClear_default; + ListCache.prototype["delete"] = listCacheDelete_default; + ListCache.prototype.get = listCacheGet_default; + ListCache.prototype.has = listCacheHas_default; + ListCache.prototype.set = listCacheSet_default; + var ListCache_default = ListCache; + + // node_modules/lodash-es/_Map.js + var Map2 = getNative_default(root_default, "Map"); + var Map_default = Map2; + + // node_modules/lodash-es/_mapCacheClear.js + function mapCacheClear() { + this.size = 0; + this.__data__ = { + "hash": new Hash_default(), + "map": new (Map_default || ListCache_default)(), + "string": new Hash_default() + }; + } + var mapCacheClear_default = mapCacheClear; + + // node_modules/lodash-es/_isKeyable.js + function isKeyable(value) { + var type2 = typeof value; + return type2 == "string" || type2 == "number" || type2 == "symbol" || type2 == "boolean" ? value !== "__proto__" : value === null; + } + var isKeyable_default = isKeyable; + + // node_modules/lodash-es/_getMapData.js + function getMapData(map2, key) { + var data = map2.__data__; + return isKeyable_default(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map; + } + var getMapData_default = getMapData; + + // node_modules/lodash-es/_mapCacheDelete.js + function mapCacheDelete(key) { + var result = getMapData_default(this, key)["delete"](key); + this.size -= result ? 1 : 0; + return result; + } + var mapCacheDelete_default = mapCacheDelete; + + // node_modules/lodash-es/_mapCacheGet.js + function mapCacheGet(key) { + return getMapData_default(this, key).get(key); + } + var mapCacheGet_default = mapCacheGet; + + // node_modules/lodash-es/_mapCacheHas.js + function mapCacheHas(key) { + return getMapData_default(this, key).has(key); + } + var mapCacheHas_default = mapCacheHas; + + // node_modules/lodash-es/_mapCacheSet.js + function mapCacheSet(key, value) { + var data = getMapData_default(this, key), size = data.size; + data.set(key, value); + this.size += data.size == size ? 0 : 1; + return this; + } + var mapCacheSet_default = mapCacheSet; + + // node_modules/lodash-es/_MapCache.js + function MapCache(entries) { + var index = -1, length = entries == null ? 0 : entries.length; + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } + } + MapCache.prototype.clear = mapCacheClear_default; + MapCache.prototype["delete"] = mapCacheDelete_default; + MapCache.prototype.get = mapCacheGet_default; + MapCache.prototype.has = mapCacheHas_default; + MapCache.prototype.set = mapCacheSet_default; + var MapCache_default = MapCache; + // node_modules/lodash-es/toString.js function toString(value) { return value == null ? "" : baseToString_default(value); } var toString_default = toString; + // node_modules/lodash-es/_arrayPush.js + function arrayPush(array2, values) { + var index = -1, length = values.length, offset = array2.length; + while (++index < length) { + array2[offset + index] = values[index]; + } + return array2; + } + var arrayPush_default = arrayPush; + // node_modules/lodash-es/_basePropertyOf.js function basePropertyOf(object) { return function(key) { @@ -24484,6 +25046,438 @@ } var basePropertyOf_default = basePropertyOf; + // node_modules/lodash-es/_stackClear.js + function stackClear() { + this.__data__ = new ListCache_default(); + this.size = 0; + } + var stackClear_default = stackClear; + + // node_modules/lodash-es/_stackDelete.js + function stackDelete(key) { + var data = this.__data__, result = data["delete"](key); + this.size = data.size; + return result; + } + var stackDelete_default = stackDelete; + + // node_modules/lodash-es/_stackGet.js + function stackGet(key) { + return this.__data__.get(key); + } + var stackGet_default = stackGet; + + // node_modules/lodash-es/_stackHas.js + function stackHas(key) { + return this.__data__.has(key); + } + var stackHas_default = stackHas; + + // node_modules/lodash-es/_stackSet.js + var LARGE_ARRAY_SIZE = 200; + function stackSet(key, value) { + var data = this.__data__; + if (data instanceof ListCache_default) { + var pairs = data.__data__; + if (!Map_default || pairs.length < LARGE_ARRAY_SIZE - 1) { + pairs.push([key, value]); + this.size = ++data.size; + return this; + } + data = this.__data__ = new MapCache_default(pairs); + } + data.set(key, value); + this.size = data.size; + return this; + } + var stackSet_default = stackSet; + + // node_modules/lodash-es/_Stack.js + function Stack(entries) { + var data = this.__data__ = new ListCache_default(entries); + this.size = data.size; + } + Stack.prototype.clear = stackClear_default; + Stack.prototype["delete"] = stackDelete_default; + Stack.prototype.get = stackGet_default; + Stack.prototype.has = stackHas_default; + Stack.prototype.set = stackSet_default; + var Stack_default = Stack; + + // node_modules/lodash-es/_arrayFilter.js + function arrayFilter(array2, predicate) { + var index = -1, length = array2 == null ? 0 : array2.length, resIndex = 0, result = []; + while (++index < length) { + var value = array2[index]; + if (predicate(value, index, array2)) { + result[resIndex++] = value; + } + } + return result; + } + var arrayFilter_default = arrayFilter; + + // node_modules/lodash-es/stubArray.js + function stubArray() { + return []; + } + var stubArray_default = stubArray; + + // node_modules/lodash-es/_getSymbols.js + var objectProto10 = Object.prototype; + var propertyIsEnumerable2 = objectProto10.propertyIsEnumerable; + var nativeGetSymbols = Object.getOwnPropertySymbols; + var getSymbols = !nativeGetSymbols ? stubArray_default : function(object) { + if (object == null) { + return []; + } + object = Object(object); + return arrayFilter_default(nativeGetSymbols(object), function(symbol) { + return propertyIsEnumerable2.call(object, symbol); + }); + }; + var getSymbols_default = getSymbols; + + // node_modules/lodash-es/_baseGetAllKeys.js + function baseGetAllKeys(object, keysFunc, symbolsFunc) { + var result = keysFunc(object); + return isArray_default(object) ? result : arrayPush_default(result, symbolsFunc(object)); + } + var baseGetAllKeys_default = baseGetAllKeys; + + // node_modules/lodash-es/_getAllKeys.js + function getAllKeys(object) { + return baseGetAllKeys_default(object, keys_default, getSymbols_default); + } + var getAllKeys_default = getAllKeys; + + // node_modules/lodash-es/_DataView.js + var DataView2 = getNative_default(root_default, "DataView"); + var DataView_default = DataView2; + + // node_modules/lodash-es/_Promise.js + var Promise2 = getNative_default(root_default, "Promise"); + var Promise_default = Promise2; + + // node_modules/lodash-es/_Set.js + var Set2 = getNative_default(root_default, "Set"); + var Set_default = Set2; + + // node_modules/lodash-es/_getTag.js + var mapTag2 = "[object Map]"; + var objectTag2 = "[object Object]"; + var promiseTag = "[object Promise]"; + var setTag2 = "[object Set]"; + var weakMapTag2 = "[object WeakMap]"; + var dataViewTag2 = "[object DataView]"; + var dataViewCtorString = toSource_default(DataView_default); + var mapCtorString = toSource_default(Map_default); + var promiseCtorString = toSource_default(Promise_default); + var setCtorString = toSource_default(Set_default); + var weakMapCtorString = toSource_default(WeakMap_default); + var getTag = baseGetTag_default; + 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) { + getTag = function(value) { + var result = baseGetTag_default(value), Ctor = result == objectTag2 ? value.constructor : void 0, ctorString = Ctor ? toSource_default(Ctor) : ""; + if (ctorString) { + switch (ctorString) { + case dataViewCtorString: + return dataViewTag2; + case mapCtorString: + return mapTag2; + case promiseCtorString: + return promiseTag; + case setCtorString: + return setTag2; + case weakMapCtorString: + return weakMapTag2; + } + } + return result; + }; + } + var getTag_default = getTag; + + // node_modules/lodash-es/_Uint8Array.js + var Uint8Array2 = root_default.Uint8Array; + var Uint8Array_default = Uint8Array2; + + // node_modules/lodash-es/_setCacheAdd.js + var HASH_UNDEFINED3 = "__lodash_hash_undefined__"; + function setCacheAdd(value) { + this.__data__.set(value, HASH_UNDEFINED3); + return this; + } + var setCacheAdd_default = setCacheAdd; + + // node_modules/lodash-es/_setCacheHas.js + function setCacheHas(value) { + return this.__data__.has(value); + } + var setCacheHas_default = setCacheHas; + + // node_modules/lodash-es/_SetCache.js + function SetCache(values) { + var index = -1, length = values == null ? 0 : values.length; + this.__data__ = new MapCache_default(); + while (++index < length) { + this.add(values[index]); + } + } + SetCache.prototype.add = SetCache.prototype.push = setCacheAdd_default; + SetCache.prototype.has = setCacheHas_default; + var SetCache_default = SetCache; + + // node_modules/lodash-es/_arraySome.js + function arraySome(array2, predicate) { + var index = -1, length = array2 == null ? 0 : array2.length; + while (++index < length) { + if (predicate(array2[index], index, array2)) { + return true; + } + } + return false; + } + var arraySome_default = arraySome; + + // node_modules/lodash-es/_cacheHas.js + function cacheHas(cache, key) { + return cache.has(key); + } + var cacheHas_default = cacheHas; + + // node_modules/lodash-es/_equalArrays.js + var COMPARE_PARTIAL_FLAG = 1; + var COMPARE_UNORDERED_FLAG = 2; + function equalArrays(array2, other, bitmask, customizer, equalFunc, stack) { + var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array2.length, othLength = other.length; + if (arrLength != othLength && !(isPartial && othLength > arrLength)) { + return false; + } + var arrStacked = stack.get(array2); + var othStacked = stack.get(other); + if (arrStacked && othStacked) { + return arrStacked == other && othStacked == array2; + } + var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache_default() : void 0; + stack.set(array2, other); + stack.set(other, array2); + while (++index < arrLength) { + var arrValue = array2[index], othValue = other[index]; + if (customizer) { + var compared = isPartial ? customizer(othValue, arrValue, index, other, array2, stack) : customizer(arrValue, othValue, index, array2, other, stack); + } + if (compared !== void 0) { + if (compared) { + continue; + } + result = false; + break; + } + if (seen) { + if (!arraySome_default(other, function(othValue2, othIndex) { + if (!cacheHas_default(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) { + return seen.push(othIndex); + } + })) { + result = false; + break; + } + } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { + result = false; + break; + } + } + stack["delete"](array2); + stack["delete"](other); + return result; + } + var equalArrays_default = equalArrays; + + // node_modules/lodash-es/_mapToArray.js + function mapToArray(map2) { + var index = -1, result = Array(map2.size); + map2.forEach(function(value, key) { + result[++index] = [key, value]; + }); + return result; + } + var mapToArray_default = mapToArray; + + // node_modules/lodash-es/_setToArray.js + function setToArray(set3) { + var index = -1, result = Array(set3.size); + set3.forEach(function(value) { + result[++index] = value; + }); + return result; + } + var setToArray_default = setToArray; + + // node_modules/lodash-es/_equalByTag.js + var COMPARE_PARTIAL_FLAG2 = 1; + var COMPARE_UNORDERED_FLAG2 = 2; + var boolTag2 = "[object Boolean]"; + var dateTag2 = "[object Date]"; + var errorTag2 = "[object Error]"; + var mapTag3 = "[object Map]"; + var numberTag2 = "[object Number]"; + var regexpTag2 = "[object RegExp]"; + var setTag3 = "[object Set]"; + var stringTag2 = "[object String]"; + var symbolTag2 = "[object Symbol]"; + var arrayBufferTag2 = "[object ArrayBuffer]"; + var dataViewTag3 = "[object DataView]"; + var symbolProto2 = Symbol_default ? Symbol_default.prototype : void 0; + var symbolValueOf = symbolProto2 ? symbolProto2.valueOf : void 0; + function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { + switch (tag) { + case dataViewTag3: + if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) { + return false; + } + object = object.buffer; + other = other.buffer; + case arrayBufferTag2: + if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array_default(object), new Uint8Array_default(other))) { + return false; + } + return true; + case boolTag2: + case dateTag2: + case numberTag2: + return eq_default(+object, +other); + case errorTag2: + return object.name == other.name && object.message == other.message; + case regexpTag2: + case stringTag2: + return object == other + ""; + case mapTag3: + var convert = mapToArray_default; + case setTag3: + var isPartial = bitmask & COMPARE_PARTIAL_FLAG2; + convert || (convert = setToArray_default); + if (object.size != other.size && !isPartial) { + return false; + } + var stacked = stack.get(object); + if (stacked) { + return stacked == other; + } + bitmask |= COMPARE_UNORDERED_FLAG2; + stack.set(object, other); + var result = equalArrays_default(convert(object), convert(other), bitmask, customizer, equalFunc, stack); + stack["delete"](object); + return result; + case symbolTag2: + if (symbolValueOf) { + return symbolValueOf.call(object) == symbolValueOf.call(other); + } + } + return false; + } + var equalByTag_default = equalByTag; + + // node_modules/lodash-es/_equalObjects.js + var COMPARE_PARTIAL_FLAG3 = 1; + var objectProto11 = Object.prototype; + var hasOwnProperty8 = objectProto11.hasOwnProperty; + function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { + var isPartial = bitmask & COMPARE_PARTIAL_FLAG3, objProps = getAllKeys_default(object), objLength = objProps.length, othProps = getAllKeys_default(other), othLength = othProps.length; + if (objLength != othLength && !isPartial) { + return false; + } + var index = objLength; + while (index--) { + var key = objProps[index]; + if (!(isPartial ? key in other : hasOwnProperty8.call(other, key))) { + return false; + } + } + var objStacked = stack.get(object); + var othStacked = stack.get(other); + if (objStacked && othStacked) { + return objStacked == other && othStacked == object; + } + var result = true; + stack.set(object, other); + stack.set(other, object); + var skipCtor = isPartial; + while (++index < objLength) { + key = objProps[index]; + var objValue = object[key], othValue = other[key]; + if (customizer) { + var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack); + } + if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) { + result = false; + break; + } + skipCtor || (skipCtor = key == "constructor"); + } + if (result && !skipCtor) { + var objCtor = object.constructor, othCtor = other.constructor; + if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) { + result = false; + } + } + stack["delete"](object); + stack["delete"](other); + return result; + } + var equalObjects_default = equalObjects; + + // node_modules/lodash-es/_baseIsEqualDeep.js + var COMPARE_PARTIAL_FLAG4 = 1; + var argsTag3 = "[object Arguments]"; + var arrayTag2 = "[object Array]"; + var objectTag3 = "[object Object]"; + var objectProto12 = Object.prototype; + var hasOwnProperty9 = objectProto12.hasOwnProperty; + function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { + var objIsArr = isArray_default(object), othIsArr = isArray_default(other), objTag = objIsArr ? arrayTag2 : getTag_default(object), othTag = othIsArr ? arrayTag2 : getTag_default(other); + objTag = objTag == argsTag3 ? objectTag3 : objTag; + othTag = othTag == argsTag3 ? objectTag3 : othTag; + var objIsObj = objTag == objectTag3, othIsObj = othTag == objectTag3, isSameTag = objTag == othTag; + if (isSameTag && isBuffer_default(object)) { + if (!isBuffer_default(other)) { + return false; + } + objIsArr = true; + objIsObj = false; + } + if (isSameTag && !objIsObj) { + stack || (stack = new Stack_default()); + return objIsArr || isTypedArray_default(object) ? equalArrays_default(object, other, bitmask, customizer, equalFunc, stack) : equalByTag_default(object, other, objTag, bitmask, customizer, equalFunc, stack); + } + if (!(bitmask & COMPARE_PARTIAL_FLAG4)) { + var objIsWrapped = objIsObj && hasOwnProperty9.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty9.call(other, "__wrapped__"); + if (objIsWrapped || othIsWrapped) { + var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other; + stack || (stack = new Stack_default()); + return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); + } + } + if (!isSameTag) { + return false; + } + stack || (stack = new Stack_default()); + return equalObjects_default(object, other, bitmask, customizer, equalFunc, stack); + } + var baseIsEqualDeep_default = baseIsEqualDeep; + + // node_modules/lodash-es/_baseIsEqual.js + function baseIsEqual(value, other, bitmask, customizer, stack) { + if (value === other) { + return true; + } + if (value == null || other == null || !isObjectLike_default(value) && !isObjectLike_default(other)) { + return value !== value && other !== other; + } + return baseIsEqualDeep_default(value, other, bitmask, customizer, baseIsEqual, stack); + } + var baseIsEqual_default = baseIsEqual; + // node_modules/lodash-es/now.js var now2 = function() { return root_default.Date.now(); @@ -24597,6 +25591,12 @@ } var escape_default = escape2; + // node_modules/lodash-es/isEqual.js + function isEqual(value, other) { + return baseIsEqual_default(value, other); + } + var isEqual_default = isEqual; + // node_modules/lodash-es/throttle.js var FUNC_ERROR_TEXT2 = "Expected a function"; function throttle(func, wait, options2) { @@ -24772,13 +25772,13 @@ } // modules/util/get_set_value.js - function utilGetSetValue(selection2, value) { - function d3_selection_value(value2) { + function utilGetSetValue(selection2, value, shouldUpdate) { + function setValue(value2, shouldUpdate2) { function valueNull() { delete this.value; } function valueConstant() { - if (this.value !== value2) { + if (shouldUpdate2(this.value, value2)) { this.value = value2; } } @@ -24786,16 +25786,30 @@ var x = value2.apply(this, arguments); if (x === null || x === void 0) { delete this.value; - } else if (this.value !== x) { + } else if (shouldUpdate2(this.value, x)) { this.value = x; } } return value2 === null || value2 === void 0 ? valueNull : typeof value2 === "function" ? valueFunction : valueConstant; } + function stickyCursor(func) { + return function() { + const cursor = { start: this.selectionStart, end: this.selectionEnd }; + func.apply(this, arguments); + this.setSelectionRange(cursor.start, cursor.end); + }; + } if (arguments.length === 1) { return selection2.property("value"); } - return selection2.each(d3_selection_value(value)); + if (shouldUpdate === void 0) { + shouldUpdate = (a, b) => a !== b; + } + const supportedTypes = ["text", "search", "url", "tel", "password"]; + if (!supportedTypes.includes(this.type)) { + return selection2.each(setValue(value, shouldUpdate)); + } + return selection2.each(stickyCursor(setValue(value, shouldUpdate))); } // modules/util/keybinding.js @@ -25294,7 +26308,7 @@ var mutex = {}; var intervalID; function renew() { - var expires = new Date(); + var expires = /* @__PURE__ */ new Date(); expires.setSeconds(expires.getSeconds() + 5); document.cookie = name + "=1; expires=" + expires.toUTCString() + "; sameSite=strict"; } @@ -25588,8 +26602,8 @@ let locale2 = _localeCode; if (locale2.toLowerCase() === "en-us") locale2 = "en"; - _languageNames = _localeStrings.general[locale2].languageNames; - _scriptNames = _localeStrings.general[locale2].scriptNames; + _languageNames = _localeStrings.general[locale2].languageNames || _localeStrings.general[_languageCode].languageNames; + _scriptNames = _localeStrings.general[locale2].scriptNames || _localeStrings.general[_languageCode].scriptNames; _usesMetric = _localeCode.slice(-3).toLowerCase() !== "-us"; } localizer.loadLocale = (locale2, scopeId, directory) => { @@ -25732,7 +26746,7 @@ return ret; }; localizer.languageName = (code, options2) => { - if (_languageNames[code]) { + if (_languageNames && _languageNames[code]) { return _languageNames[code]; } if (options2 && options2.localOnly) @@ -25743,9 +26757,9 @@ return localizer.t("translate.language_and_code", { language: langInfo.nativeName, code }); } else if (langInfo.base && langInfo.script) { const base = langInfo.base; - if (_languageNames[base]) { + if (_languageNames && _languageNames[base]) { const scriptCode = langInfo.script; - const script = _scriptNames[scriptCode] || scriptCode; + const script = _scriptNames && _scriptNames[scriptCode] || scriptCode; return localizer.t("translate.language_and_code", { language: _languageNames[base], code: script }); } else if (_dataLanguages[base] && _dataLanguages[base].nativeName) { return localizer.t("translate.language_and_code", { language: _dataLanguages[base].nativeName, code }); @@ -25754,6 +26768,72 @@ } return code; }; + localizer.floatFormatter = (locale2) => { + if (!("Intl" in window && "NumberFormat" in Intl && "formatToParts" in Intl.NumberFormat.prototype)) { + return (number3, fractionDigits) => { + return fractionDigits === void 0 ? number3.toString() : number3.toFixed(fractionDigits); + }; + } else { + return (number3, fractionDigits) => number3.toLocaleString(locale2, { + minimumFractionDigits: fractionDigits, + maximumFractionDigits: fractionDigits === void 0 ? 20 : fractionDigits + }); + } + }; + localizer.floatParser = (locale2) => { + const polyfill = (string) => +string.trim(); + if (!("Intl" in window && "NumberFormat" in Intl)) + return polyfill; + const format2 = new Intl.NumberFormat(locale2, { maximumFractionDigits: 20 }); + if (!("formatToParts" in format2)) + return polyfill; + const parts = format2.formatToParts(-12345.6); + const numerals = Array.from({ length: 10 }).map((_, i2) => format2.format(i2)); + const index = new Map(numerals.map((d, i2) => [d, i2])); + const literalPart = parts.find((d) => d.type === "literal"); + const literal = literalPart && new RegExp(`[${literalPart.value}]`, "g"); + const groupPart = parts.find((d) => d.type === "group"); + const group = groupPart && new RegExp(`[${groupPart.value}]`, "g"); + const decimalPart = parts.find((d) => d.type === "decimal"); + const decimal = decimalPart && new RegExp(`[${decimalPart.value}]`); + const numeral = new RegExp(`[${numerals.join("")}]`, "g"); + const getIndex = (d) => index.get(d); + return (string) => { + string = string.trim(); + if (literal) + string = string.replace(literal, ""); + if (group) + string = string.replace(group, ""); + if (decimal) + string = string.replace(decimal, "."); + string = string.replace(numeral, getIndex); + return string ? +string : NaN; + }; + }; + localizer.decimalPlaceCounter = (locale2) => { + var literal, group, decimal; + if ("Intl" in window && "NumberFormat" in Intl) { + const format2 = new Intl.NumberFormat(locale2, { maximumFractionDigits: 20 }); + if ("formatToParts" in format2) { + const parts = format2.formatToParts(-12345.6); + const literalPart = parts.find((d) => d.type === "literal"); + literal = literalPart && new RegExp(`[${literalPart.value}]`, "g"); + const groupPart = parts.find((d) => d.type === "group"); + group = groupPart && new RegExp(`[${groupPart.value}]`, "g"); + const decimalPart = parts.find((d) => d.type === "decimal"); + decimal = decimalPart && new RegExp(`[${decimalPart.value}]`); + } + } + return (string) => { + string = string.trim(); + if (literal) + string = string.replace(literal, ""); + if (group) + string = string.replace(group, ""); + const parts = string.split(decimal || "."); + return parts && parts[1] && parts[1].length || 0; + }; + }; return localizer; } @@ -25962,13 +27042,12 @@ } // modules/presets/preset.js + var import_lodash = __toESM(require_lodash()); function presetPreset(presetID, preset, addable, allFields, allPresets) { allFields = allFields || {}; allPresets = allPresets || {}; let _this = Object.assign({}, preset); let _addable = addable || false; - let _resolvedFields; - let _resolvedMoreFields; let _searchName; let _searchNameStripped; let _searchAliases; @@ -25983,9 +27062,8 @@ _this.originalReference = _this.reference || {}; _this.originalFields = _this.fields || []; _this.originalMoreFields = _this.moreFields || []; - _this.fields = () => _resolvedFields || (_resolvedFields = resolveFields("fields")); - _this.moreFields = () => _resolvedMoreFields || (_resolvedMoreFields = resolveFields("moreFields")); - _this.resetFields = () => _resolvedFields = _resolvedMoreFields = null; + _this.fields = (loc) => resolveFields("fields", loc); + _this.moreFields = (loc) => resolveFields("moreFields", loc); _this.tags = _this.tags || {}; _this.addTags = _this.addTags || _this.tags; _this.removeTags = _this.removeTags || _this.addTags; @@ -26112,11 +27190,11 @@ return { key, value }; } }; - _this.unsetTags = (tags, geometry, ignoringKeys, skipFieldDefaults) => { + _this.unsetTags = (tags, geometry, ignoringKeys, skipFieldDefaults, loc) => { let removeTags = ignoringKeys ? utilObjectOmit(_this.removeTags, ignoringKeys) : _this.removeTags; tags = utilObjectOmit(tags, Object.keys(removeTags)); if (geometry && !skipFieldDefaults) { - _this.fields().forEach((field) => { + _this.fields(loc).forEach((field) => { if (field.matchGeometry(geometry) && field.key && field.default === tags[field.key] && (!ignoringKeys || ignoringKeys.indexOf(field.key) === -1)) { delete tags[field.key]; } @@ -26125,7 +27203,7 @@ delete tags.area; return tags; }; - _this.setTags = (tags, geometry, skipFieldDefaults) => { + _this.setTags = (tags, geometry, skipFieldDefaults, loc) => { const addTags = _this.addTags; tags = Object.assign({}, tags); for (let k in addTags) { @@ -26153,7 +27231,7 @@ } } if (geometry && !skipFieldDefaults) { - _this.fields().forEach((field) => { + _this.fields(loc).forEach((field) => { if (field.matchGeometry(geometry) && field.key && !tags[field.key] && field.default) { tags[field.key] = field.default; } @@ -26161,13 +27239,13 @@ } return tags; }; - function resolveFields(which) { + function resolveFields(which, loc) { const fieldIDs = which === "fields" ? _this.originalFields : _this.originalMoreFields; let resolved = []; fieldIDs.forEach((fieldID) => { const match = fieldID.match(referenceRegex); if (match !== null) { - resolved = resolved.concat(inheritFields(match[1], which)); + resolved = resolved.concat(inheritFields(allPresets[match[1]], which)); } else if (allFields[fieldID]) { resolved.push(allFields[fieldID]); } else { @@ -26178,12 +27256,22 @@ const endIndex = _this.id.lastIndexOf("/"); const parentID = endIndex && _this.id.substring(0, endIndex); if (parentID) { - resolved = inheritFields(parentID, which); + let parent = allPresets[parentID]; + if (loc) { + const validHere = _sharedLocationManager.locationSetsAt(loc); + if (parent?.locationSetID && !validHere[parent.locationSetID]) { + const candidateIDs = Object.keys(allPresets).filter((k) => k.startsWith(parentID)); + parent = allPresets[candidateIDs.find((candidateID) => { + const candidate = allPresets[candidateID]; + return validHere[candidate.locationSetID] && (0, import_lodash.isEqual)(candidate.tags, parent.tags); + })]; + } + } + resolved = inheritFields(parent, which); } } return utilArrayUniq(resolved); - function inheritFields(presetID2, which2) { - const parent = allPresets[presetID2]; + function inheritFields(parent, which2) { if (!parent) return []; if (which2 === "fields") { @@ -26316,7 +27404,6 @@ }); } _universal = Object.values(_fields).filter((field) => field.universal); - Object.values(_presets).forEach((preset) => preset.resetFields()); _geometryIndex = { point: {}, vertex: {}, line: {}, area: {}, relation: {} }; _this.collection.forEach((preset) => { (preset.geometry || []).forEach((geometry) => { @@ -26430,8 +27517,8 @@ let areaKeys = {}; const presets = _this.collection.filter((p) => !p.suggestion && !p.replacement); presets.forEach((p) => { - const keys = p.tags && Object.keys(p.tags); - const key = keys && keys.length && keys[0]; + const keys2 = p.tags && Object.keys(p.tags); + const key = keys2 && keys2.length && keys2[0]; if (!key) return; if (ignore[key]) @@ -26457,8 +27544,8 @@ return _this.collection.filter((lineTags, d) => { if (d.suggestion || d.replacement || d.searchable === false) return lineTags; - const keys = d.tags && Object.keys(d.tags); - const key = keys && keys.length && keys[0]; + const keys2 = d.tags && Object.keys(d.tags); + const key = keys2 && keys2.length && keys2[0]; if (!key) return lineTags; if (d.geometry.indexOf("line") !== -1) { @@ -26472,8 +27559,8 @@ return _this.collection.reduce((pointTags, d) => { if (d.suggestion || d.replacement || d.searchable === false) return pointTags; - const keys = d.tags && Object.keys(d.tags); - const key = keys && keys.length && keys[0]; + const keys2 = d.tags && Object.keys(d.tags); + const key = keys2 && keys2.length && keys2[0]; if (!key) return pointTags; if (d.geometry.indexOf("point") !== -1) { @@ -26487,8 +27574,8 @@ return _this.collection.reduce((vertexTags, d) => { if (d.suggestion || d.replacement || d.searchable === false) return vertexTags; - const keys = d.tags && Object.keys(d.tags); - const key = keys && keys.length && keys[0]; + const keys2 = d.tags && Object.keys(d.tags); + const key = keys2 && keys2.length && keys2[0]; if (!key) return vertexTags; if (d.geometry.indexOf("vertex") !== -1) { @@ -26741,8 +27828,8 @@ } function utilTagDiff(oldTags, newTags) { var tagDiff = []; - var keys = utilArrayUnion(Object.keys(oldTags), Object.keys(newTags)).sort(); - keys.forEach(function(k) { + var keys2 = utilArrayUnion(Object.keys(oldTags), Object.keys(newTags)).sort(); + keys2.forEach(function(k) { var oldVal = oldTags[k]; var newVal = newTags[k]; if ((oldVal || oldVal === "") && (newVal === void 0 || newVal !== oldVal)) { @@ -26931,8 +28018,8 @@ return graph.hasEntity(entityID); }).filter(Boolean); entities.forEach(function(entity) { - var keys = Object.keys(entity.tags).filter(Boolean); - keys.forEach(function(key2) { + var keys2 = Object.keys(entity.tags).filter(Boolean); + keys2.forEach(function(key2) { allKeys.add(key2); }); }); @@ -27127,7 +28214,7 @@ return str2.toLowerCase().replace(/[^a-z0-9]+/g, "_"); } function utilUniqueDomId(val) { - return "ideditor-" + utilSafeClassName(val.toString()) + "-" + new Date().getTime().toString(); + return "ideditor-" + utilSafeClassName(val.toString()) + "-" + (/* @__PURE__ */ new Date()).getTime().toString(); } function utilUnicodeCharsCount(str2) { return Array.from(str2).length; @@ -27789,8 +28876,9 @@ // i.e. the right side is the 'inside' (e.g. the right side of a // natural=cliff is lower). sidednessIdentifier: function() { - for (var key in this.tags) { - var value = this.tags[key]; + for (const realKey in this.tags) { + const value = this.tags[realKey]; + const key = osmRemoveLifecyclePrefix(realKey); if (key in osmRightSideIsInsideTags && value in osmRightSideIsInsideTags[key]) { if (osmRightSideIsInsideTags[key][value] === true) { return key; @@ -28390,6 +29478,7 @@ var entity = graph.entity(entityID); var geometry = entity.geometry(graph); var tags = entity.tags; + const loc = entity.extent(graph).center(); var preserveKeys; if (newPreset) { preserveKeys = []; @@ -28397,13 +29486,13 @@ preserveKeys = preserveKeys.concat(Object.keys(newPreset.addTags)); } if (oldPreset && !oldPreset.id.startsWith(newPreset.id)) { - newPreset.fields().concat(newPreset.moreFields()).filter((f2) => f2.matchGeometry(geometry)).map((f2) => f2.key).filter(Boolean).forEach((key) => preserveKeys.push(key)); + newPreset.fields(loc).concat(newPreset.moreFields(loc)).filter((f2) => f2.matchGeometry(geometry)).map((f2) => f2.key).filter(Boolean).forEach((key) => preserveKeys.push(key)); } } if (oldPreset) - tags = oldPreset.unsetTags(tags, geometry, preserveKeys); + tags = oldPreset.unsetTags(tags, geometry, preserveKeys, false, loc); if (newPreset) - tags = newPreset.setTags(tags, geometry, skipFieldDefaults); + tags = newPreset.setTags(tags, geometry, skipFieldDefaults, loc); return graph.replace(entity.update({ tags })); }; } @@ -28486,10 +29575,10 @@ } else { val = (this.tags.direction || "").toLowerCase(); var re2 = /:direction$/i; - var keys = Object.keys(this.tags); - for (i2 = 0; i2 < keys.length; i2++) { - if (re2.test(keys[i2])) { - val = this.tags[keys[i2]].toLowerCase(); + var keys2 = Object.keys(this.tags); + for (i2 = 0; i2 < keys2.length; i2++) { + if (re2.test(keys2[i2])) { + val = this.tags[keys2[i2]].toLowerCase(); break; } } @@ -29195,11 +30284,11 @@ difference.created().forEach(checkTags); return graph; function checkTags(entity) { - const keys = Object.keys(entity.tags); + const keys2 = Object.keys(entity.tags); let didDiscard = false; let tags = {}; - for (let i2 = 0; i2 < keys.length; i2++) { - const k = keys[i2]; + for (let i2 = 0; i2 < keys2.length; i2++) { + const k = keys2[i2]; if (discardTags[k] || !entity.tags[k]) { didDiscard = true; } else { @@ -30124,12 +31213,12 @@ }); // modules/osm/qa_item.js - var QAItem = class { + var QAItem = class _QAItem { constructor(loc, service, itemType, id2, props) { this.loc = loc; this.service = service.title; this.itemType = itemType; - this.id = id2 ? id2 : `${QAItem.id()}`; + this.id = id2 ? id2 : `${_QAItem.id()}`; this.update(props); if (service && typeof service.getIcon === "function") { this.icon = service.getIcon(itemType); @@ -31494,13 +32583,13 @@ } // modules/actions/merge_remote_changes.js - var import_lodash = __toESM(require_lodash()); + var import_lodash2 = __toESM(require_lodash()); function actionMergeRemoteChanges(id2, localGraph, remoteGraph, discardTags, formatUser) { discardTags = discardTags || {}; var _option = "safe"; var _conflicts = []; function user(d) { - return typeof formatUser === "function" ? formatUser(d) : (0, import_lodash.escape)(d); + return typeof formatUser === "function" ? formatUser(d) : (0, import_lodash2.escape)(d); } function mergeLocation(remote, target) { function pointEqual(a, b) { @@ -31619,13 +32708,13 @@ var o = base.tags || {}; var a = target.tags || {}; var b = remote.tags || {}; - var keys = utilArrayUnion(utilArrayUnion(Object.keys(o), Object.keys(a)), Object.keys(b)).filter(function(k2) { + var keys2 = utilArrayUnion(utilArrayUnion(Object.keys(o), Object.keys(a)), Object.keys(b)).filter(function(k2) { return !discardTags[k2]; }); var tags = Object.assign({}, a); var changed = false; - for (var i2 = 0; i2 < keys.length; i2++) { - var k = keys[i2]; + for (var i2 = 0; i2 < keys2.length; i2++) { + var k = keys2[i2]; if (o[k] !== b[k] && a[k] !== b[k]) { if (o[k] !== a[k]) { _conflicts.push(_t.html( @@ -32775,7 +33864,7 @@ _downPointer = { id: d3_event.pointerId || "mouse", pointerLocGetter, - downTime: +new Date(), + downTime: +/* @__PURE__ */ new Date(), downLoc: pointerLocGetter(d3_event) }; dispatch10.call("down", this, d3_event, datum2(d3_event)); @@ -32788,7 +33877,7 @@ _lastPointerUpEvent = d3_event; if (downPointer.isCancelled) return; - var t2 = +new Date(); + var t2 = +/* @__PURE__ */ new Date(); var p2 = downPointer.pointerLocGetter(d3_event); var dist = geoVecLength(downPointer.downLoc, p2); if (dist < _closeTolerance || dist < _tolerance && t2 - downPointer.downTime < 500) { @@ -35661,7 +36750,7 @@ json_default(url, options2).then(() => { delete _cache2.inflightPost[d.id]; if (!d.newStatus) { - const now3 = new Date(); + const now3 = /* @__PURE__ */ new Date(); let comments = d.comments ? d.comments : []; comments.push({ username: payload.username, @@ -35742,6 +36831,7 @@ headerIds: true, headerPrefix: "", highlight: null, + hooks: null, langPrefix: "language-", mangle: true, pedantic: false, @@ -35760,9 +36850,9 @@ defaults = newDefaults; } var escapeTest = /[&<>"']/; - var escapeReplace = /[&<>"']/g; - var escapeTestNoEncode = /[<>"']|&(?!#?\w+;)/; - var escapeReplaceNoEncode = /[<>"']|&(?!#?\w+;)/g; + var escapeReplace = new RegExp(escapeTest.source, "g"); + var escapeTestNoEncode = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/; + var escapeReplaceNoEncode = new RegExp(escapeTestNoEncode.source, "g"); var escapeReplacements = { "&": "&", "<": "<", @@ -35866,18 +36956,6 @@ } var noopTest = { exec: function noopTest2() { } }; - function merge2(obj) { - let i2 = 1, target, key; - for (; i2 < arguments.length; i2++) { - target = arguments[i2]; - for (key in target) { - if (Object.prototype.hasOwnProperty.call(target, key)) { - obj[key] = target[key]; - } - } - } - return obj; - } function splitCells(tableRow, count) { const row = tableRow.replace(/\|/g, (match, offset, str2) => { let escaped = false, curr = offset; @@ -35945,24 +37023,34 @@ } return -1; } - function checkSanitizeDeprecation(opt) { - if (opt && opt.sanitize && !opt.silent) { + function checkDeprecations(opt, callback) { + if (!opt || opt.silent) { + return; + } + if (callback) { + console.warn("marked(): callback is deprecated since version 5.0.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/using_pro#async"); + } + if (opt.sanitize || opt.sanitizer) { console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options"); } - } - function repeatString(pattern, count) { - if (count < 1) { - return ""; + if (opt.highlight || opt.langPrefix !== "language-") { + console.warn("marked(): highlight and langPrefix parameters are deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-highlight."); } - let result = ""; - while (count > 1) { - if (count & 1) { - result += pattern; - } - count >>= 1; - pattern += pattern; + if (opt.mangle) { + console.warn("marked(): mangle parameter is enabled by default, but is deprecated since version 5.0.0, and will be removed in the future. To clear this warning, install https://www.npmjs.com/package/marked-mangle, or disable by setting `{mangle: false}`."); + } + if (opt.baseUrl) { + console.warn("marked(): baseUrl parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-base-url."); + } + if (opt.smartypants) { + console.warn("marked(): smartypants parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-smartypants."); + } + if (opt.xhtml) { + console.warn("marked(): xhtml parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-xhtml."); + } + if (opt.headerIds || opt.headerPrefix) { + console.warn("marked(): headerIds and headerPrefix parameters enabled by default, but are deprecated since version 5.0.0, and will be removed in the future. To clear this warning, install https://www.npmjs.com/package/marked-gfm-heading-id, or disable by setting `{headerIds: false}`."); } - return result + pattern; } function outputLink(cap, link2, raw, lexer2) { const href = link2.href; @@ -36079,10 +37167,14 @@ const cap = this.rules.block.blockquote.exec(src); if (cap) { const text2 = cap[0].replace(/^ *>[ \t]?/gm, ""); + const top = this.lexer.state.top; + this.lexer.state.top = true; + const tokens = this.lexer.blockTokens(text2); + this.lexer.state.top = top; return { type: "blockquote", raw: cap[0], - tokens: this.lexer.blockTokens(text2, []), + tokens, text: text2 }; } @@ -36116,7 +37208,7 @@ } raw = cap[0]; src = src.substring(raw.length); - line = cap[2].split("\n", 1)[0]; + line = cap[2].split("\n", 1)[0].replace(/^\t+/, (t) => " ".repeat(3 * t.length)); nextLine = src.split("\n", 1)[0]; if (this.options.pedantic) { indent2 = 2; @@ -36134,40 +37226,54 @@ endEarly = true; } if (!endEarly) { - const nextBulletRegex = new RegExp(`^ {0,${Math.min(3, indent2 - 1)}}(?:[*+-]|\\d{1,9}[.)])((?: [^\\n]*)?(?:\\n|$))`); + const nextBulletRegex = new RegExp(`^ {0,${Math.min(3, indent2 - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`); const hrRegex = new RegExp(`^ {0,${Math.min(3, indent2 - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`); const fencesBeginRegex = new RegExp(`^ {0,${Math.min(3, indent2 - 1)}}(?:\`\`\`|~~~)`); const headingBeginRegex = new RegExp(`^ {0,${Math.min(3, indent2 - 1)}}#`); while (src) { rawLine = src.split("\n", 1)[0]; - line = rawLine; + nextLine = rawLine; if (this.options.pedantic) { - line = line.replace(/^ {1,4}(?=( {4})*[^ ])/g, " "); + nextLine = nextLine.replace(/^ {1,4}(?=( {4})*[^ ])/g, " "); } - if (fencesBeginRegex.test(line)) { + if (fencesBeginRegex.test(nextLine)) { break; } - if (headingBeginRegex.test(line)) { + if (headingBeginRegex.test(nextLine)) { break; } - if (nextBulletRegex.test(line)) { + if (nextBulletRegex.test(nextLine)) { break; } if (hrRegex.test(src)) { break; } - if (line.search(/[^ ]/) >= indent2 || !line.trim()) { - itemContents += "\n" + line.slice(indent2); - } else if (!blankLine) { - itemContents += "\n" + line; + if (nextLine.search(/[^ ]/) >= indent2 || !nextLine.trim()) { + itemContents += "\n" + nextLine.slice(indent2); } else { - break; + if (blankLine) { + break; + } + if (line.search(/[^ ]/) >= 4) { + break; + } + if (fencesBeginRegex.test(line)) { + break; + } + if (headingBeginRegex.test(line)) { + break; + } + if (hrRegex.test(line)) { + break; + } + itemContents += "\n" + nextLine; } - if (!blankLine && !line.trim()) { + if (!blankLine && !nextLine.trim()) { blankLine = true; } raw += rawLine + "\n"; src = src.substring(rawLine.length + 1); + line = nextLine.slice(indent2); } } if (!list.loose) { @@ -36201,22 +37307,14 @@ for (i2 = 0; i2 < l; i2++) { this.lexer.state.top = false; list.items[i2].tokens = this.lexer.blockTokens(list.items[i2].text, []); - const spacers = list.items[i2].tokens.filter((t) => t.type === "space"); - const hasMultipleLineBreaks = spacers.every((t) => { - const chars = t.raw.split(""); - let lineBreaks = 0; - for (const char of chars) { - if (char === "\n") { - lineBreaks += 1; - } - if (lineBreaks > 1) { - return true; - } - } - return false; - }); - if (!list.loose && spacers.length && hasMultipleLineBreaks) { - list.loose = true; + if (!list.loose) { + const spacers = list.items[i2].tokens.filter((t) => t.type === "space"); + const hasMultipleLineBreaks = spacers.length > 0 && spacers.some((t) => /\n.*\n/.test(t.raw)); + list.loose = hasMultipleLineBreaks; + } + } + if (list.loose) { + for (i2 = 0; i2 < l; i2++) { list.items[i2].loose = true; } } @@ -36228,6 +37326,7 @@ if (cap) { const token = { type: "html", + block: true, raw: cap[0], pre: !this.options.sanitizer && (cap[1] === "pre" || cap[1] === "script" || cap[1] === "style"), text: cap[0] @@ -36244,15 +37343,15 @@ def(src) { const cap = this.rules.block.def.exec(src); if (cap) { - if (cap[3]) - cap[3] = cap[3].substring(1, cap[3].length - 1); const tag = cap[1].toLowerCase().replace(/\s+/g, " "); + const href = cap[2] ? cap[2].replace(/^<(.*)>$/, "$1").replace(this.rules.inline._escapes, "$1") : ""; + const title = cap[3] ? cap[3].substring(1, cap[3].length - 1).replace(this.rules.inline._escapes, "$1") : cap[3]; return { type: "def", tag, raw: cap[0], - href: cap[2] ? cap[2].replace(this.rules.inline._escapes, "$1") : cap[2], - title: cap[3] ? cap[3].replace(this.rules.inline._escapes, "$1") : cap[3] + href, + title }; } } @@ -36366,6 +37465,7 @@ raw: cap[0], inLink: this.lexer.state.inLink, inRawBlock: this.lexer.state.inRawBlock, + block: false, text: this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape4(cap[0]) : cap[0] }; } @@ -36422,7 +37522,7 @@ if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) { let link2 = (cap[2] || cap[1]).replace(/\s+/g, " "); link2 = links[link2.toLowerCase()]; - if (!link2 || !link2.href) { + if (!link2) { const text2 = cap[0].charAt(0); return { type: "text", @@ -36440,7 +37540,7 @@ if (match[3] && prevChar.match(/[\p{L}\p{N}]/u)) return; const nextChar = match[1] || match[2] || ""; - if (!nextChar || nextChar && (prevChar === "" || this.rules.inline.punctuation.exec(prevChar))) { + if (!nextChar || !prevChar || this.rules.inline.punctuation.exec(prevChar)) { const lLength = match[0].length - 1; let rDelim, rLength, delimTotal = lLength, midDelimTotal = 0; const endReg = match[0][0] === "*" ? this.rules.inline.emStrong.rDelimAst : this.rules.inline.emStrong.rDelimUnd; @@ -36464,7 +37564,7 @@ if (delimTotal > 0) continue; rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal); - const raw = src.slice(0, lLength + match.index + (match[0].length - rDelim.length) + rLength); + const raw = src.slice(0, lLength + match.index + rLength + 1); if (Math.min(lLength, rLength) % 2) { const text3 = raw.slice(1, -1); return { @@ -36562,9 +37662,9 @@ } while (prevCapZero !== cap[0]); text2 = escape4(cap[0]); if (cap[1] === "www.") { - href = "http://" + text2; + href = "http://" + cap[0]; } else { - href = text2; + href = cap[0]; } } return { @@ -36602,15 +37702,15 @@ var block = { newline: /^(?: *(?:\n|$))+/, code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/, - fences: /^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?=\n|$)|$)/, + fences: /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, hr: /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/, list: /^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/, html: "^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))", - def: /^ {0,3}\[(label)\]: *(?:\n *)?]+)>?(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/, + def: /^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/, table: noopTest, - lheading: /^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/, + lheading: /^((?:(?!^bull ).|\n(?!\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, // regex template, placeholders will be replaced according to different paragraph // interruption rules of commonmark and the original markdown spec: _paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, @@ -36625,16 +37725,19 @@ block._tag = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul"; block._comment = /|$)/; block.html = edit(block.html, "i").replace("comment", block._comment).replace("tag", block._tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(); + block.lheading = edit(block.lheading).replace(/bull/g, block.bullet).getRegex(); block.paragraph = edit(block._paragraph).replace("hr", block.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", ")|<(?:script|pre|style|textarea|!--)").replace("tag", block._tag).getRegex(); block.blockquote = edit(block.blockquote).replace("paragraph", block.paragraph).getRegex(); - block.normal = merge2({}, block); - block.gfm = merge2({}, block.normal, { + block.normal = { ...block }; + block.gfm = { + ...block.normal, table: "^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)" // Cells - }); + }; block.gfm.table = edit(block.gfm.table).replace("hr", block.hr).replace("heading", " {0,3}#{1,6} ").replace("blockquote", " {0,3}>").replace("code", " {4}[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", ")|<(?:script|pre|style|textarea|!--)").replace("tag", block._tag).getRegex(); block.gfm.paragraph = edit(block._paragraph).replace("hr", block.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("table", block.gfm.table).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", ")|<(?:script|pre|style|textarea|!--)").replace("tag", block._tag).getRegex(); - block.pedantic = merge2({}, block.normal, { + block.pedantic = { + ...block.normal, html: edit( `^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))` ).replace("comment", block._comment).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), @@ -36642,8 +37745,9 @@ heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: noopTest, // fences not supported + lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: edit(block.normal._paragraph).replace("hr", block.hr).replace("heading", " *#{1,6} *[^\n]").replace("lheading", block.lheading).replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").getRegex() - }); + }; var inline = { escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/, @@ -36655,28 +37759,30 @@ nolink: /^!?\[(ref)\](?:\[\])?/, reflinkSearch: "reflink|nolink(?!\\()", emStrong: { - lDelim: /^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/, - // (1) and (2) can only be a Right Delimiter. (3) and (4) can only be Left. (5) and (6) can be either Left or Right. - // () Skip orphan inside strong () Consume to delim (1) #*** (2) a***#, a*** (3) #***a, ***a (4) ***# (5) #***# (6) a***a - rDelimAst: /^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/, - rDelimUnd: /^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/ + lDelim: /^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/, + // (1) and (2) can only be a Right Delimiter. (3) and (4) can only be Left. (5) and (6) can be either Left or Right. + // | Skip orphan inside strong | Consume to delim | (1) #*** | (2) a***#, a*** | (3) #***a, ***a | (4) ***# | (5) #***# | (6) a***a + rDelimAst: /^[^_*]*?__[^_*]*?\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\*)[punct](\*+)(?=[\s]|$)|[^punct\s](\*+)(?!\*)(?=[punct\s]|$)|(?!\*)[punct\s](\*+)(?=[^punct\s])|[\s](\*+)(?!\*)(?=[punct])|(?!\*)[punct](\*+)(?!\*)(?=[punct])|[^punct\s](\*+)(?=[^punct\s])/, + rDelimUnd: /^[^_*]*?\*\*[^_*]*?_[^_*]*?(?=\*\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\s]|$)|[^punct\s](_+)(?!_)(?=[punct\s]|$)|(?!_)[punct\s](_+)(?=[^punct\s])|[\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])/ // ^- Not allowed for _ }, code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, br: /^( {2,}|\\)\n(?!\s*$)/, del: noopTest, text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~"; - inline.punctuation = edit(inline.punctuation).replace(/punctuation/g, inline._punctuation).getRegex(); - inline.blockSkip = /\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g; - inline.escapedEmSt = /(?:^|[^\\])(?:\\\\)*\\[*_]/g; + inline._punctuation = "\\p{P}$+<=>`^|~"; + inline.punctuation = edit(inline.punctuation, "u").replace(/punctuation/g, inline._punctuation).getRegex(); + inline.blockSkip = /\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g; + inline.anyPunctuation = /\\[punct]/g; + inline._escapes = /\\([punct])/g; inline._comment = edit(block._comment).replace("(?:-->|$)", "-->").getRegex(); - inline.emStrong.lDelim = edit(inline.emStrong.lDelim).replace(/punct/g, inline._punctuation).getRegex(); - inline.emStrong.rDelimAst = edit(inline.emStrong.rDelimAst, "g").replace(/punct/g, inline._punctuation).getRegex(); - inline.emStrong.rDelimUnd = edit(inline.emStrong.rDelimUnd, "g").replace(/punct/g, inline._punctuation).getRegex(); - inline._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g; + inline.emStrong.lDelim = edit(inline.emStrong.lDelim, "u").replace(/punct/g, inline._punctuation).getRegex(); + inline.emStrong.rDelimAst = edit(inline.emStrong.rDelimAst, "gu").replace(/punct/g, inline._punctuation).getRegex(); + inline.emStrong.rDelimUnd = edit(inline.emStrong.rDelimUnd, "gu").replace(/punct/g, inline._punctuation).getRegex(); + inline.anyPunctuation = edit(inline.anyPunctuation, "gu").replace(/punct/g, inline._punctuation).getRegex(); + inline._escapes = edit(inline._escapes, "gu").replace(/punct/g, inline._punctuation).getRegex(); inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/; inline._email = /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/; inline.autolink = edit(inline.autolink).replace("scheme", inline._scheme).replace("email", inline._email).getRegex(); @@ -36689,8 +37795,9 @@ inline.reflink = edit(inline.reflink).replace("label", inline._label).replace("ref", block._label).getRegex(); inline.nolink = edit(inline.nolink).replace("ref", block._label).getRegex(); inline.reflinkSearch = edit(inline.reflinkSearch, "g").replace("reflink", inline.reflink).replace("nolink", inline.nolink).getRegex(); - inline.normal = merge2({}, inline); - inline.pedantic = merge2({}, inline.normal, { + inline.normal = { ...inline }; + inline.pedantic = { + ...inline.normal, strong: { start: /^__|\*\*/, middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/, @@ -36705,20 +37812,22 @@ }, link: edit(/^!?\[(label)\]\((.*?)\)/).replace("label", inline._label).getRegex(), reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", inline._label).getRegex() - }); - inline.gfm = merge2({}, inline.normal, { + }; + inline.gfm = { + ...inline.normal, escape: edit(inline.escape).replace("])", "~|])").getRegex(), _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/, url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, - _backpedal: /(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/, + _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/, text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\ 0) { while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) { if (links.includes(match[0].slice(match[0].lastIndexOf("[") + 1, -1))) { - maskedSrc = maskedSrc.slice(0, match.index) + "[" + repeatString("a", match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex); + maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex); } } } } while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) { - maskedSrc = maskedSrc.slice(0, match.index) + "[" + repeatString("a", match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex); + maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex); } - while ((match = this.tokenizer.rules.inline.escapedEmSt.exec(maskedSrc)) != null) { - maskedSrc = maskedSrc.slice(0, match.index + match[0].length - 2) + "++" + maskedSrc.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex); - this.tokenizer.rules.inline.escapedEmSt.lastIndex--; + while ((match = this.tokenizer.rules.inline.anyPunctuation.exec(maskedSrc)) != null) { + maskedSrc = maskedSrc.slice(0, match.index) + "++" + maskedSrc.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex); } while (src) { if (!keepPrevChar) { @@ -37121,7 +38229,7 @@ if (!lang) { return "
" + (escaped ? code : escape4(code, true)) + "
\n"; } - return '
' + (escaped ? code : escape4(code, true)) + "
\n"; + return '
' + (escaped ? code : escape4(code, true)) + "
\n"; } /** * @param {string} quote @@ -37131,7 +38239,7 @@ ${quote2} `; } - html(html2) { + html(html2, block2) { return html2; } /** @@ -37234,7 +38342,7 @@ ${content} if (href === null) { return text2; } - let out = ' return this.getNextSafeSlug(slug, options2.dryrun); } }; - var Parser = class { + var Parser = class _Parser { constructor(options2) { this.options = options2 || defaults; this.options.renderer = this.options.renderer || new Renderer(); @@ -37347,14 +38455,14 @@ ${content} * Static Parse Method */ static parse(tokens, options2) { - const parser3 = new Parser(options2); + const parser3 = new _Parser(options2); return parser3.parse(tokens); } /** * Static Parse Inline Method */ static parseInline(tokens, options2) { - const parser3 = new Parser(options2); + const parser3 = new _Parser(options2); return parser3.parseInline(tokens); } /** @@ -37466,7 +38574,7 @@ ${content} continue; } case "html": { - out += this.renderer.html(token.text); + out += this.renderer.html(token.text, token.block); continue; } case "paragraph": { @@ -37566,259 +38674,353 @@ ${content} return out; } }; - function marked(src, opt, callback) { - if (typeof src === "undefined" || src === null) { - throw new Error("marked(): input parameter is undefined or null"); + var Hooks = class { + constructor(options2) { + this.options = options2 || defaults; } - if (typeof src !== "string") { - throw new Error("marked(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected"); + static passThroughHooks = /* @__PURE__ */ new Set([ + "preprocess", + "postprocess" + ]); + /** + * Process markdown before marked + */ + preprocess(markdown) { + return markdown; } - if (typeof opt === "function") { - callback = opt; - opt = null; + /** + * Process HTML after marked is finished + */ + postprocess(html2) { + return html2; } - opt = merge2({}, marked.defaults, opt || {}); - checkSanitizeDeprecation(opt); - if (callback) { - const highlight = opt.highlight; - let tokens; - try { - tokens = Lexer.lex(src, opt); - } catch (e) { - return callback(e); - } - const done = function(err) { - let out; - if (!err) { - try { - if (opt.walkTokens) { - marked.walkTokens(tokens, opt.walkTokens); + }; + var Marked = class { + defaults = getDefaults(); + options = this.setOptions; + parse = this.#parseMarkdown(Lexer.lex, Parser.parse); + parseInline = this.#parseMarkdown(Lexer.lexInline, Parser.parseInline); + Parser = Parser; + parser = Parser.parse; + Renderer = Renderer; + TextRenderer = TextRenderer; + Lexer = Lexer; + lexer = Lexer.lex; + Tokenizer = Tokenizer; + Slugger = Slugger; + Hooks = Hooks; + constructor(...args) { + this.use(...args); + } + walkTokens(tokens, callback) { + let values = []; + for (const token of tokens) { + values = values.concat(callback.call(this, token)); + switch (token.type) { + case "table": { + for (const cell of token.header) { + values = values.concat(this.walkTokens(cell.tokens, callback)); + } + for (const row of token.rows) { + for (const cell of row) { + values = values.concat(this.walkTokens(cell.tokens, callback)); + } + } + break; + } + case "list": { + values = values.concat(this.walkTokens(token.items, callback)); + break; + } + default: { + if (this.defaults.extensions && this.defaults.extensions.childTokens && this.defaults.extensions.childTokens[token.type]) { + this.defaults.extensions.childTokens[token.type].forEach((childTokens) => { + values = values.concat(this.walkTokens(token[childTokens], callback)); + }); + } else if (token.tokens) { + values = values.concat(this.walkTokens(token.tokens, callback)); } - out = Parser.parse(tokens, opt); - } catch (e) { - err = e; } } - opt.highlight = highlight; - return err ? callback(err) : callback(null, out); - }; - if (!highlight || highlight.length < 3) { - return done(); - } - delete opt.highlight; - if (!tokens.length) - return done(); - let pending = 0; - marked.walkTokens(tokens, function(token) { - if (token.type === "code") { - pending++; - setTimeout(() => { - highlight(token.text, token.lang, function(err, code) { - if (err) { - return done(err); + } + return values; + } + use(...args) { + const extensions = this.defaults.extensions || { renderers: {}, childTokens: {} }; + args.forEach((pack) => { + const opts = { ...pack }; + opts.async = this.defaults.async || opts.async || false; + if (pack.extensions) { + pack.extensions.forEach((ext) => { + if (!ext.name) { + throw new Error("extension name required"); + } + if (ext.renderer) { + const prevRenderer = extensions.renderers[ext.name]; + if (prevRenderer) { + extensions.renderers[ext.name] = function(...args2) { + let ret = ext.renderer.apply(this, args2); + if (ret === false) { + ret = prevRenderer.apply(this, args2); + } + return ret; + }; + } else { + extensions.renderers[ext.name] = ext.renderer; } - if (code != null && code !== token.text) { - token.text = code; - token.escaped = true; + } + if (ext.tokenizer) { + if (!ext.level || ext.level !== "block" && ext.level !== "inline") { + throw new Error("extension level must be 'block' or 'inline'"); } - pending--; - if (pending === 0) { - done(); + if (extensions[ext.level]) { + extensions[ext.level].unshift(ext.tokenizer); + } else { + extensions[ext.level] = [ext.tokenizer]; } - }); - }, 0); - } - }); - if (pending === 0) { - done(); - } - return; - } - function onError(e) { - e.message += "\nPlease report this to https://github.com/markedjs/marked."; - if (opt.silent) { - return "

An error occurred:

" + escape4(e.message + "", true) + "
"; - } - throw e; - } - try { - const tokens = Lexer.lex(src, opt); - if (opt.walkTokens) { - if (opt.async) { - return Promise.all(marked.walkTokens(tokens, opt.walkTokens)).then(() => { - return Parser.parse(tokens, opt); - }).catch(onError); + if (ext.start) { + if (ext.level === "block") { + if (extensions.startBlock) { + extensions.startBlock.push(ext.start); + } else { + extensions.startBlock = [ext.start]; + } + } else if (ext.level === "inline") { + if (extensions.startInline) { + extensions.startInline.push(ext.start); + } else { + extensions.startInline = [ext.start]; + } + } + } + } + if (ext.childTokens) { + extensions.childTokens[ext.name] = ext.childTokens; + } + }); + opts.extensions = extensions; + } + if (pack.renderer) { + const renderer = this.defaults.renderer || new Renderer(this.defaults); + for (const prop in pack.renderer) { + const prevRenderer = renderer[prop]; + renderer[prop] = (...args2) => { + let ret = pack.renderer[prop].apply(renderer, args2); + if (ret === false) { + ret = prevRenderer.apply(renderer, args2); + } + return ret; + }; + } + opts.renderer = renderer; } - marked.walkTokens(tokens, opt.walkTokens); - } - return Parser.parse(tokens, opt); - } catch (e) { - onError(e); - } - } - marked.options = marked.setOptions = function(opt) { - merge2(marked.defaults, opt); - changeDefaults(marked.defaults); - return marked; - }; - marked.getDefaults = getDefaults; - marked.defaults = defaults; - marked.use = function(...args) { - const opts = merge2({}, ...args); - const extensions = marked.defaults.extensions || { renderers: {}, childTokens: {} }; - let hasExtensions; - args.forEach((pack) => { - if (pack.extensions) { - hasExtensions = true; - pack.extensions.forEach((ext) => { - if (!ext.name) { - throw new Error("extension name required"); - } - if (ext.renderer) { - const prevRenderer = extensions.renderers ? extensions.renderers[ext.name] : null; - if (prevRenderer) { - extensions.renderers[ext.name] = function(...args2) { - let ret = ext.renderer.apply(this, args2); + if (pack.tokenizer) { + const tokenizer = this.defaults.tokenizer || new Tokenizer(this.defaults); + for (const prop in pack.tokenizer) { + const prevTokenizer = tokenizer[prop]; + tokenizer[prop] = (...args2) => { + let ret = pack.tokenizer[prop].apply(tokenizer, args2); + if (ret === false) { + ret = prevTokenizer.apply(tokenizer, args2); + } + return ret; + }; + } + opts.tokenizer = tokenizer; + } + if (pack.hooks) { + const hooks = this.defaults.hooks || new Hooks(); + for (const prop in pack.hooks) { + const prevHook = hooks[prop]; + if (Hooks.passThroughHooks.has(prop)) { + hooks[prop] = (arg) => { + if (this.defaults.async) { + return Promise.resolve(pack.hooks[prop].call(hooks, arg)).then((ret2) => { + return prevHook.call(hooks, ret2); + }); + } + const ret = pack.hooks[prop].call(hooks, arg); + return prevHook.call(hooks, ret); + }; + } else { + hooks[prop] = (...args2) => { + let ret = pack.hooks[prop].apply(hooks, args2); if (ret === false) { - ret = prevRenderer.apply(this, args2); + ret = prevHook.apply(hooks, args2); } return ret; }; - } else { - extensions.renderers[ext.name] = ext.renderer; } } - if (ext.tokenizer) { - if (!ext.level || ext.level !== "block" && ext.level !== "inline") { - throw new Error("extension level must be 'block' or 'inline'"); + opts.hooks = hooks; + } + if (pack.walkTokens) { + const walkTokens2 = this.defaults.walkTokens; + opts.walkTokens = function(token) { + let values = []; + values.push(pack.walkTokens.call(this, token)); + if (walkTokens2) { + values = values.concat(walkTokens2.call(this, token)); } - if (extensions[ext.level]) { - extensions[ext.level].unshift(ext.tokenizer); - } else { - extensions[ext.level] = [ext.tokenizer]; + return values; + }; + } + this.defaults = { ...this.defaults, ...opts }; + }); + return this; + } + setOptions(opt) { + this.defaults = { ...this.defaults, ...opt }; + return this; + } + #parseMarkdown(lexer2, parser3) { + return (src, opt, callback) => { + if (typeof opt === "function") { + callback = opt; + opt = null; + } + const origOpt = { ...opt }; + opt = { ...this.defaults, ...origOpt }; + const throwError = this.#onError(opt.silent, opt.async, callback); + if (typeof src === "undefined" || src === null) { + return throwError(new Error("marked(): input parameter is undefined or null")); + } + if (typeof src !== "string") { + return throwError(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected")); + } + checkDeprecations(opt, callback); + if (opt.hooks) { + opt.hooks.options = opt; + } + if (callback) { + const highlight = opt.highlight; + let tokens; + try { + if (opt.hooks) { + src = opt.hooks.preprocess(src); } - if (ext.start) { - if (ext.level === "block") { - if (extensions.startBlock) { - extensions.startBlock.push(ext.start); - } else { - extensions.startBlock = [ext.start]; + tokens = lexer2(src, opt); + } catch (e) { + return throwError(e); + } + const done = (err) => { + let out; + if (!err) { + try { + if (opt.walkTokens) { + this.walkTokens(tokens, opt.walkTokens); } - } else if (ext.level === "inline") { - if (extensions.startInline) { - extensions.startInline.push(ext.start); - } else { - extensions.startInline = [ext.start]; + out = parser3(tokens, opt); + if (opt.hooks) { + out = opt.hooks.postprocess(out); } + } catch (e) { + err = e; } } - } - if (ext.childTokens) { - extensions.childTokens[ext.name] = ext.childTokens; - } - }); - } - if (pack.renderer) { - const renderer = marked.defaults.renderer || new Renderer(); - for (const prop in pack.renderer) { - const prevRenderer = renderer[prop]; - renderer[prop] = (...args2) => { - let ret = pack.renderer[prop].apply(renderer, args2); - if (ret === false) { - ret = prevRenderer.apply(renderer, args2); - } - return ret; + opt.highlight = highlight; + return err ? throwError(err) : callback(null, out); }; - } - opts.renderer = renderer; - } - if (pack.tokenizer) { - const tokenizer = marked.defaults.tokenizer || new Tokenizer(); - for (const prop in pack.tokenizer) { - const prevTokenizer = tokenizer[prop]; - tokenizer[prop] = (...args2) => { - let ret = pack.tokenizer[prop].apply(tokenizer, args2); - if (ret === false) { - ret = prevTokenizer.apply(tokenizer, args2); + if (!highlight || highlight.length < 3) { + return done(); + } + delete opt.highlight; + if (!tokens.length) + return done(); + let pending = 0; + this.walkTokens(tokens, (token) => { + if (token.type === "code") { + pending++; + setTimeout(() => { + highlight(token.text, token.lang, (err, code) => { + if (err) { + return done(err); + } + if (code != null && code !== token.text) { + token.text = code; + token.escaped = true; + } + pending--; + if (pending === 0) { + done(); + } + }); + }, 0); } - return ret; - }; + }); + if (pending === 0) { + done(); + } + return; } - opts.tokenizer = tokenizer; - } - if (pack.walkTokens) { - const walkTokens2 = marked.defaults.walkTokens; - opts.walkTokens = function(token) { - let values = []; - values.push(pack.walkTokens.call(this, token)); - if (walkTokens2) { - values = values.concat(walkTokens2.call(this, token)); + if (opt.async) { + return Promise.resolve(opt.hooks ? opt.hooks.preprocess(src) : src).then((src2) => lexer2(src2, opt)).then((tokens) => opt.walkTokens ? Promise.all(this.walkTokens(tokens, opt.walkTokens)).then(() => tokens) : tokens).then((tokens) => parser3(tokens, opt)).then((html2) => opt.hooks ? opt.hooks.postprocess(html2) : html2).catch(throwError); + } + try { + if (opt.hooks) { + src = opt.hooks.preprocess(src); } - return values; - }; - } - if (hasExtensions) { - opts.extensions = extensions; - } - marked.setOptions(opts); - }); - }; - marked.walkTokens = function(tokens, callback) { - let values = []; - for (const token of tokens) { - values = values.concat(callback.call(marked, token)); - switch (token.type) { - case "table": { - for (const cell of token.header) { - values = values.concat(marked.walkTokens(cell.tokens, callback)); + const tokens = lexer2(src, opt); + if (opt.walkTokens) { + this.walkTokens(tokens, opt.walkTokens); } - for (const row of token.rows) { - for (const cell of row) { - values = values.concat(marked.walkTokens(cell.tokens, callback)); - } + let html2 = parser3(tokens, opt); + if (opt.hooks) { + html2 = opt.hooks.postprocess(html2); } - break; - } - case "list": { - values = values.concat(marked.walkTokens(token.items, callback)); - break; + return html2; + } catch (e) { + return throwError(e); } - default: { - if (marked.defaults.extensions && marked.defaults.extensions.childTokens && marked.defaults.extensions.childTokens[token.type]) { - marked.defaults.extensions.childTokens[token.type].forEach(function(childTokens) { - values = values.concat(marked.walkTokens(token[childTokens], callback)); - }); - } else if (token.tokens) { - values = values.concat(marked.walkTokens(token.tokens, callback)); + }; + } + #onError(silent, async, callback) { + return (e) => { + e.message += "\nPlease report this to https://github.com/markedjs/marked."; + if (silent) { + const msg = "

An error occurred:

" + escape4(e.message + "", true) + "
"; + if (async) { + return Promise.resolve(msg); + } + if (callback) { + callback(null, msg); + return; } + return msg; } - } + if (async) { + return Promise.reject(e); + } + if (callback) { + callback(e); + return; + } + throw e; + }; } - return values; }; - marked.parseInline = function(src, opt) { - if (typeof src === "undefined" || src === null) { - throw new Error("marked.parseInline(): input parameter is undefined or null"); - } - if (typeof src !== "string") { - throw new Error("marked.parseInline(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected"); - } - opt = merge2({}, marked.defaults, opt || {}); - checkSanitizeDeprecation(opt); - try { - const tokens = Lexer.lexInline(src, opt); - if (opt.walkTokens) { - marked.walkTokens(tokens, opt.walkTokens); - } - return Parser.parseInline(tokens, opt); - } catch (e) { - e.message += "\nPlease report this to https://github.com/markedjs/marked."; - if (opt.silent) { - return "

An error occurred:

" + escape4(e.message + "", true) + "
"; - } - throw e; - } + var markedInstance = new Marked(defaults); + function marked(src, opt, callback) { + return markedInstance.parse(src, opt, callback); + } + marked.options = marked.setOptions = function(opt) { + markedInstance.setOptions(opt); + marked.defaults = markedInstance.defaults; + changeDefaults(marked.defaults); + return marked; + }; + marked.getDefaults = getDefaults; + marked.defaults = defaults; + marked.use = function(...args) { + markedInstance.use(...args); + marked.defaults = markedInstance.defaults; + changeDefaults(marked.defaults); + return marked; + }; + marked.walkTokens = function(tokens, callback) { + return markedInstance.walkTokens(tokens, callback); }; + marked.parseInline = markedInstance.parseInline; marked.Parser = Parser; marked.parser = Parser.parse; marked.Renderer = Renderer; @@ -37827,6 +39029,7 @@ ${content} marked.lexer = Lexer.lex; marked.Tokenizer = Tokenizer; marked.Slugger = Slugger; + marked.Hooks = Hooks; marked.parse = marked; var options = marked.options; var setOptions = marked.setOptions; @@ -38849,10 +40052,10 @@ ${content} var tagMap = Object.keys(selector).reduce(function(expectedTags, key) { var values; var isRegex = /regex/gi.test(key); - var isEqual = /equals/gi.test(key); - if (isRegex || isEqual) { + var isEqual4 = /equals/gi.test(key); + if (isRegex || isEqual4) { Object.keys(selector[key]).forEach(function(selectorKey) { - values = isEqual ? [selector[key][selectorKey]] : getRegexValues(selector[key][selectorKey]); + values = isEqual4 ? [selector[key][selectorKey]] : getRegexValues(selector[key][selectorKey]); if (expectedTags.hasOwnProperty(selectorKey)) { values = values.concat(expectedTags[selectorKey]); } @@ -38950,1044 +40153,234 @@ ${content} }; // modules/services/nominatim.js - var import_rbush5 = __toESM(require_rbush_min()); - var apibase = nominatimApiUrl; - var _inflight = {}; - var _nominatimCache; - var nominatim_default = { - init: function() { - _inflight = {}; - _nominatimCache = new import_rbush5.default(); - }, - reset: function() { - Object.values(_inflight).forEach(function(controller) { - controller.abort(); - }); - _inflight = {}; - _nominatimCache = new import_rbush5.default(); - }, - countryCode: function(location, callback) { - this.reverse(location, function(err, result) { - if (err) { - return callback(err); - } else if (result.address) { - return callback(null, result.address.country_code); - } else { - return callback("Unable to geocode", null); - } - }); - }, - reverse: function(loc, callback) { - var cached = _nominatimCache.search( - { minX: loc[0], minY: loc[1], maxX: loc[0], maxY: loc[1] } - ); - if (cached.length > 0) { - if (callback) - callback(null, cached[0].data); + var import_rbush7 = __toESM(require_rbush_min()); + + // modules/core/difference.js + var import_fast_deep_equal3 = __toESM(require_fast_deep_equal()); + function coreDifference(base, head) { + var _changes = {}; + var _didChange = {}; + var _diff = {}; + function checkEntityID(id2) { + var h = head.entities[id2]; + var b = base.entities[id2]; + if (h === b) + return; + if (_changes[id2]) + return; + if (!h && b) { + _changes[id2] = { base: b, head: h }; + _didChange.deletion = true; return; } - var params = { zoom: 13, format: "json", addressdetails: 1, lat: loc[1], lon: loc[0] }; - var url = apibase + "reverse?" + utilQsString(params); - if (_inflight[url]) + if (h && !b) { + _changes[id2] = { base: b, head: h }; + _didChange.addition = true; return; - var controller = new AbortController(); - _inflight[url] = controller; - json_default(url, { signal: controller.signal }).then(function(result) { - delete _inflight[url]; - if (result && result.error) { - throw new Error(result.error); - } - var extent = geoExtent(loc).padByMeters(200); - _nominatimCache.insert(Object.assign(extent.bbox(), { data: result })); - if (callback) - callback(null, result); - }).catch(function(err) { - delete _inflight[url]; - if (err.name === "AbortError") + } + if (h && b) { + if (h.members && b.members && !(0, import_fast_deep_equal3.default)(h.members, b.members)) { + _changes[id2] = { base: b, head: h }; + _didChange.geometry = true; + _didChange.properties = true; return; - if (callback) - callback(err.message); + } + if (h.loc && b.loc && !geoVecEqual(h.loc, b.loc)) { + _changes[id2] = { base: b, head: h }; + _didChange.geometry = true; + } + if (h.nodes && b.nodes && !(0, import_fast_deep_equal3.default)(h.nodes, b.nodes)) { + _changes[id2] = { base: b, head: h }; + _didChange.geometry = true; + } + if (h.tags && b.tags && !(0, import_fast_deep_equal3.default)(h.tags, b.tags)) { + _changes[id2] = { base: b, head: h }; + _didChange.properties = true; + } + } + } + function load() { + var ids = utilArrayUniq(Object.keys(head.entities).concat(Object.keys(base.entities))); + for (var i2 = 0; i2 < ids.length; i2++) { + checkEntityID(ids[i2]); + } + } + load(); + _diff.length = function length() { + return Object.keys(_changes).length; + }; + _diff.changes = function changes() { + return _changes; + }; + _diff.didChange = _didChange; + _diff.extantIDs = function extantIDs(includeRelMembers) { + var result = /* @__PURE__ */ new Set(); + Object.keys(_changes).forEach(function(id2) { + if (_changes[id2].head) { + result.add(id2); + } + var h = _changes[id2].head; + var b = _changes[id2].base; + var entity = h || b; + if (includeRelMembers && entity.type === "relation") { + var mh = h ? h.members.map(function(m) { + return m.id; + }) : []; + var mb = b ? b.members.map(function(m) { + return m.id; + }) : []; + utilArrayUnion(mh, mb).forEach(function(memberID) { + if (head.hasEntity(memberID)) { + result.add(memberID); + } + }); + } }); - }, - search: function(val, callback) { - var searchVal = encodeURIComponent(val); - var url = apibase + "search/" + searchVal + "?limit=10&format=json"; - if (_inflight[url]) - return; - var controller = new AbortController(); - _inflight[url] = controller; - json_default(url, { signal: controller.signal }).then(function(result) { - delete _inflight[url]; - if (result && result.error) { - throw new Error(result.error); + return Array.from(result); + }; + _diff.modified = function modified() { + var result = []; + Object.values(_changes).forEach(function(change) { + if (change.base && change.head) { + result.push(change.head); } - if (callback) - callback(null, result); - }).catch(function(err) { - delete _inflight[url]; - if (err.name === "AbortError") - return; - if (callback) - callback(err.message); }); - } - }; - - // node_modules/name-suggestion-index/lib/matcher.js - var import_which_polygon3 = __toESM(require_which_polygon(), 1); - - // node_modules/name-suggestion-index/lib/simplify.js - var import_diacritics2 = __toESM(require_diacritics(), 1); - function simplify(str2) { - if (typeof str2 !== "string") - return ""; - return import_diacritics2.default.remove( - str2.replace(/&/g, "and").replace(/İ/ig, "i").replace(/[\s\-=_!"#%'*{},.\/:;?\(\)\[\]@\\$\^*+<>«»~`’\u00a1\u00a7\u00b6\u00b7\u00bf\u037e\u0387\u055a-\u055f\u0589\u05c0\u05c3\u05c6\u05f3\u05f4\u0609\u060a\u060c\u060d\u061b\u061e\u061f\u066a-\u066d\u06d4\u0700-\u070d\u07f7-\u07f9\u0830-\u083e\u085e\u0964\u0965\u0970\u0af0\u0df4\u0e4f\u0e5a\u0e5b\u0f04-\u0f12\u0f14\u0f85\u0fd0-\u0fd4\u0fd9\u0fda\u104a-\u104f\u10fb\u1360-\u1368\u166d\u166e\u16eb-\u16ed\u1735\u1736\u17d4-\u17d6\u17d8-\u17da\u1800-\u1805\u1807-\u180a\u1944\u1945\u1a1e\u1a1f\u1aa0-\u1aa6\u1aa8-\u1aad\u1b5a-\u1b60\u1bfc-\u1bff\u1c3b-\u1c3f\u1c7e\u1c7f\u1cc0-\u1cc7\u1cd3\u2000-\u206f\u2cf9-\u2cfc\u2cfe\u2cff\u2d70\u2e00-\u2e7f\u3001-\u3003\u303d\u30fb\ua4fe\ua4ff\ua60d-\ua60f\ua673\ua67e\ua6f2-\ua6f7\ua874-\ua877\ua8ce\ua8cf\ua8f8-\ua8fa\ua92e\ua92f\ua95f\ua9c1-\ua9cd\ua9de\ua9df\uaa5c-\uaa5f\uaade\uaadf\uaaf0\uaaf1\uabeb\ufe10-\ufe16\ufe19\ufe30\ufe45\ufe46\ufe49-\ufe4c\ufe50-\ufe52\ufe54-\ufe57\ufe5f-\ufe61\ufe68\ufe6a\ufe6b\ufeff\uff01-\uff03\uff05-\uff07\uff0a\uff0c\uff0e\uff0f\uff1a\uff1b\uff1f\uff20\uff3c\uff61\uff64\uff65]+/g, "").toLowerCase() - ); - } - - // node_modules/name-suggestion-index/config/matchGroups.json - var matchGroups_default = { - matchGroups: { - adult_gaming_centre: [ - "amenity/casino", - "amenity/gambling", - "leisure/adult_gaming_centre" - ], - beauty: [ - "shop/beauty", - "shop/hairdresser_supply" - ], - bed: [ - "shop/bed", - "shop/furniture" - ], - beverages: [ - "shop/alcohol", - "shop/beer", - "shop/beverages", - "shop/kiosk", - "shop/wine" - ], - camping: [ - "tourism/camp_site", - "tourism/caravan_site" - ], - car_parts: [ - "shop/car_parts", - "shop/car_repair", - "shop/tires", - "shop/tyres" - ], - clinic: [ - "amenity/clinic", - "amenity/doctors", - "healthcare/clinic", - "healthcare/laboratory", - "healthcare/physiotherapist", - "healthcare/sample_collection", - "healthcare/dialysis" - ], - convenience: [ - "shop/beauty", - "shop/chemist", - "shop/convenience", - "shop/cosmetics", - "shop/grocery", - "shop/kiosk", - "shop/newsagent", - "shop/perfumery" - ], - coworking: [ - "amenity/coworking_space", - "office/coworking", - "office/coworking_space" - ], - dentist: [ - "amenity/dentist", - "amenity/doctors", - "healthcare/dentist" - ], - electronics: [ - "office/telecommunication", - "shop/computer", - "shop/electronics", - "shop/hifi", - "shop/kiosk", - "shop/mobile", - "shop/mobile_phone", - "shop/telecommunication" - ], - fabric: [ - "shop/fabric", - "shop/haberdashery", - "shop/sewing" - ], - fashion: [ - "shop/accessories", - "shop/bag", - "shop/boutique", - "shop/clothes", - "shop/department_store", - "shop/fashion", - "shop/fashion_accessories", - "shop/sports", - "shop/shoes" - ], - financial: [ - "amenity/bank", - "office/accountant", - "office/financial", - "office/financial_advisor", - "office/tax_advisor", - "shop/tax" - ], - fitness: [ - "leisure/fitness_centre", - "leisure/fitness_center", - "leisure/sports_centre", - "leisure/sports_center" - ], - food: [ - "amenity/bar", - "amenity/cafe", - "amenity/fast_food", - "amenity/ice_cream", - "amenity/pub", - "amenity/restaurant", - "shop/bakery", - "shop/candy", - "shop/chocolate", - "shop/coffee", - "shop/confectionary", - "shop/confectionery", - "shop/food", - "shop/kiosk", - "shop/ice_cream", - "shop/pastry", - "shop/tea" - ], - fuel: [ - "amenity/fuel", - "shop/gas", - "shop/convenience;gas", - "shop/gas;convenience" - ], - gift: [ - "shop/gift", - "shop/card", - "shop/cards", - "shop/kiosk", - "shop/stationery" - ], - hardware: [ - "shop/bathroom_furnishing", - "shop/carpet", - "shop/diy", - "shop/doityourself", - "shop/doors", - "shop/electrical", - "shop/flooring", - "shop/hardware", - "shop/hardware_store", - "shop/power_tools", - "shop/tool_hire", - "shop/tools", - "shop/trade" - ], - health_food: [ - "shop/health", - "shop/health_food", - "shop/herbalist", - "shop/nutrition_supplements" - ], - hobby: [ - "shop/electronics", - "shop/hobby", - "shop/books", - "shop/games", - "shop/collector", - "shop/toys", - "shop/model", - "shop/video_games", - "shop/anime" - ], - hospital: [ - "amenity/doctors", - "amenity/hospital", - "healthcare/hospital" - ], - houseware: [ - "shop/houseware", - "shop/interior_decoration" - ], - lifeboat_station: [ - "amenity/lifeboat_station", - "emergency/lifeboat_station", - "emergency/marine_rescue" - ], - lodging: [ - "tourism/hotel", - "tourism/motel" - ], - money_transfer: [ - "amenity/money_transfer", - "shop/money_transfer" - ], - office_supplies: [ - "shop/office_supplies", - "shop/stationary", - "shop/stationery" - ], - outdoor: [ - "shop/clothes", - "shop/outdoor", - "shop/sports" - ], - parcel_locker: [ - "amenity/parcel_locker", - "amenity/vending_machine" - ], - pharmacy: [ - "amenity/doctors", - "amenity/pharmacy", - "healthcare/pharmacy" - ], - playground: [ - "amenity/theme_park", - "leisure/amusement_arcade", - "leisure/playground" - ], - rental: [ - "amenity/bicycle_rental", - "amenity/boat_rental", - "amenity/car_rental", - "amenity/truck_rental", - "amenity/vehicle_rental", - "shop/kiosk", - "shop/rental" - ], - school: [ - "amenity/childcare", - "amenity/college", - "amenity/kindergarten", - "amenity/language_school", - "amenity/prep_school", - "amenity/school", - "amenity/university" - ], - storage: [ - "shop/storage_units", - "shop/storage_rental" - ], - substation: [ - "power/station", - "power/substation", - "power/sub_station" - ], - supermarket: [ - "shop/food", - "shop/frozen_food", - "shop/greengrocer", - "shop/grocery", - "shop/supermarket", - "shop/wholesale" - ], - variety_store: [ - "shop/variety_store", - "shop/discount", - "shop/convenience" - ], - vending: [ - "amenity/vending_machine", - "shop/kiosk", - "shop/vending_machine" - ], - weight_loss: [ - "amenity/clinic", - "amenity/doctors", - "amenity/weight_clinic", - "healthcare/counselling", - "leisure/fitness_centre", - "office/therapist", - "shop/beauty", - "shop/diet", - "shop/food", - "shop/health_food", - "shop/herbalist", - "shop/nutrition", - "shop/nutrition_supplements", - "shop/weight_loss" - ], - wholesale: [ - "shop/wholesale", - "shop/supermarket", - "shop/department_store" - ] - } - }; - - // node_modules/name-suggestion-index/config/genericWords.json - var genericWords_default = { - genericWords: [ - "^(barn|bazaa?r|bench|bou?tique|building|casa|church)$", - "^(baseball|basketball|football|soccer|softball|tennis(halle)?)\\s?(field|court)?$", - "^(club|green|out|ware)\\s?house$", - "^(driveway|el \xE1rbol|fountain|generic|golf|government|graveyard)$", - "^(fixme|n\\s?\\/?\\s?a|name|no\\s?name|none|null|temporary|test|unknown)$", - "^(hofladen|librairie|magazine?|maison)$", - "^(mobile home|skate)?\\s?park$", - "^(obuwie|pond|pool|sale|shops?|sklep|stores?)$", - "^\\?+$", - "^private$", - "^tattoo( studio)?$", - "^windmill$", - "^\u0446\u0435\u0440\u043A\u043E\u0432\u043D\u0430\u044F( \u043B\u0430\u0432\u043A\u0430)?$" - ] - }; - - // node_modules/name-suggestion-index/config/trees.json - var trees_default = { - trees: { - brands: { - emoji: "\u{1F354}", - mainTag: "brand:wikidata", - sourceTags: ["brand", "name"], - nameTags: { - primary: "^(name|name:\\w+)$", - alternate: "^(brand|brand:\\w+|operator|operator:\\w+|\\w+_name|\\w+_name:\\w+)$" + return result; + }; + _diff.created = function created() { + var result = []; + Object.values(_changes).forEach(function(change) { + if (!change.base && change.head) { + result.push(change.head); } - }, - flags: { - emoji: "\u{1F6A9}", - mainTag: "flag:wikidata", - nameTags: { - primary: "^(flag:name|flag:name:\\w+)$", - alternate: "^(country|country:\\w+|flag|flag:\\w+|subject|subject:\\w+)$" + }); + return result; + }; + _diff.deleted = function deleted() { + var result = []; + Object.values(_changes).forEach(function(change) { + if (change.base && !change.head) { + result.push(change.base); } - }, - operators: { - emoji: "\u{1F4BC}", - mainTag: "operator:wikidata", - sourceTags: ["operator"], - nameTags: { - primary: "^(name|name:\\w+|operator|operator:\\w+)$", - alternate: "^(brand|brand:\\w+|\\w+_name|\\w+_name:\\w+)$" + }); + return result; + }; + _diff.summary = function summary() { + var relevant = {}; + var keys2 = Object.keys(_changes); + for (var i2 = 0; i2 < keys2.length; i2++) { + var change = _changes[keys2[i2]]; + if (change.head && change.head.geometry(head) !== "vertex") { + addEntity(change.head, head, change.base ? "modified" : "created"); + } else if (change.base && change.base.geometry(base) !== "vertex") { + addEntity(change.base, base, "deleted"); + } else if (change.base && change.head) { + var moved = !(0, import_fast_deep_equal3.default)(change.base.loc, change.head.loc); + var retagged = !(0, import_fast_deep_equal3.default)(change.base.tags, change.head.tags); + if (moved) { + addParents(change.head); + } + if (retagged || moved && change.head.hasInterestingTags()) { + addEntity(change.head, head, "modified"); + } + } else if (change.head && change.head.hasInterestingTags()) { + addEntity(change.head, head, "created"); + } else if (change.base && change.base.hasInterestingTags()) { + addEntity(change.base, base, "deleted"); } - }, - transit: { - emoji: "\u{1F687}", - mainTag: "network:wikidata", - sourceTags: ["network"], - nameTags: { - primary: "^network$", - alternate: "^(operator|operator:\\w+|network:\\w+|\\w+_name|\\w+_name:\\w+)$" + } + return Object.values(relevant); + function addEntity(entity, graph, changeType) { + relevant[entity.id] = { + entity, + graph, + changeType + }; + } + function addParents(entity) { + var parents = head.parentWays(entity); + for (var j2 = parents.length - 1; j2 >= 0; j2--) { + var parent = parents[j2]; + if (!(parent.id in relevant)) { + addEntity(parent, head, "modified"); + } } } - } - }; - - // node_modules/name-suggestion-index/lib/matcher.js - var matchGroups = matchGroups_default.matchGroups; - var trees = trees_default.trees; - var Matcher = class { - // - // `constructor` - // initialize the genericWords regexes - constructor() { - this.matchIndex = void 0; - this.genericWords = /* @__PURE__ */ new Map(); - (genericWords_default.genericWords || []).forEach((s) => this.genericWords.set(s, new RegExp(s, "i"))); - this.itemLocation = void 0; - this.locationSets = void 0; - this.locationIndex = void 0; - this.warnings = []; - } - // - // `buildMatchIndex()` - // Call this to prepare the matcher for use - // - // `data` needs to be an Object indexed on a 'tree/key/value' path. - // (e.g. cache filled by `fileTree.read` or data found in `dist/nsi.json`) - // { - // 'brands/amenity/bank': { properties: {}, items: [ {}, {}, … ] }, - // 'brands/amenity/bar': { properties: {}, items: [ {}, {}, … ] }, - // … - // } - // - buildMatchIndex(data) { - const that = this; - if (that.matchIndex) - return; - that.matchIndex = /* @__PURE__ */ new Map(); - const seenTree = /* @__PURE__ */ new Map(); - Object.keys(data).forEach((tkv) => { - const category = data[tkv]; - const parts = tkv.split("/", 3); - const t = parts[0]; - const k = parts[1]; - const v = parts[2]; - const thiskv = `${k}/${v}`; - const tree = trees[t]; - let branch = that.matchIndex.get(thiskv); - if (!branch) { - branch = { - primary: /* @__PURE__ */ new Map(), - alternate: /* @__PURE__ */ new Map(), - excludeGeneric: /* @__PURE__ */ new Map(), - excludeNamed: /* @__PURE__ */ new Map() - }; - that.matchIndex.set(thiskv, branch); + }; + _diff.complete = function complete(extent) { + var result = {}; + var id2, change; + for (id2 in _changes) { + change = _changes[id2]; + var h = change.head; + var b = change.base; + var entity = h || b; + var i2; + if (extent && (!h || !h.intersects(extent, head)) && (!b || !b.intersects(extent, base))) { + continue; } - const properties = category.properties || {}; - const exclude = properties.exclude || {}; - (exclude.generic || []).forEach((s) => branch.excludeGeneric.set(s, new RegExp(s, "i"))); - (exclude.named || []).forEach((s) => branch.excludeNamed.set(s, new RegExp(s, "i"))); - const excludeRegexes = [...branch.excludeGeneric.values(), ...branch.excludeNamed.values()]; - let items = category.items; - if (!Array.isArray(items) || !items.length) - return; - const primaryName = new RegExp(tree.nameTags.primary, "i"); - const alternateName = new RegExp(tree.nameTags.alternate, "i"); - const notName = /:(colou?r|type|forward|backward|left|right|etymology|pronunciation|wikipedia)$/i; - const skipGenericKV = skipGenericKVMatches(t, k, v); - const genericKV = /* @__PURE__ */ new Set([`${k}/yes`, `building/yes`]); - const matchGroupKV = /* @__PURE__ */ new Set(); - Object.values(matchGroups).forEach((matchGroup) => { - const inGroup = matchGroup.some((otherkv) => otherkv === thiskv); - if (!inGroup) - return; - matchGroup.forEach((otherkv) => { - if (otherkv === thiskv) - return; - matchGroupKV.add(otherkv); - const otherk = otherkv.split("/", 2)[0]; - genericKV.add(`${otherk}/yes`); - }); - }); - items.forEach((item) => { - if (!item.id) - return; - if (Array.isArray(item.matchTags) && item.matchTags.length) { - item.matchTags = item.matchTags.filter((matchTag) => !matchGroupKV.has(matchTag) && !genericKV.has(matchTag)); - if (!item.matchTags.length) - delete item.matchTags; - } - let kvTags = [`${thiskv}`].concat(item.matchTags || []); - if (!skipGenericKV) { - kvTags = kvTags.concat(Array.from(genericKV)); + result[id2] = h; + if (entity.type === "way") { + var nh = h ? h.nodes : []; + var nb = b ? b.nodes : []; + var diff; + diff = utilArrayDifference(nh, nb); + for (i2 = 0; i2 < diff.length; i2++) { + result[diff[i2]] = head.hasEntity(diff[i2]); } - Object.keys(item.tags).forEach((osmkey) => { - if (notName.test(osmkey)) - return; - const osmvalue = item.tags[osmkey]; - if (!osmvalue || excludeRegexes.some((regex) => regex.test(osmvalue))) - return; - if (primaryName.test(osmkey)) { - kvTags.forEach((kv) => insertName("primary", t, kv, simplify(osmvalue), item.id)); - } else if (alternateName.test(osmkey)) { - kvTags.forEach((kv) => insertName("alternate", t, kv, simplify(osmvalue), item.id)); - } - }); - let keepMatchNames = /* @__PURE__ */ new Set(); - (item.matchNames || []).forEach((matchName) => { - const nsimple = simplify(matchName); - kvTags.forEach((kv) => { - const branch2 = that.matchIndex.get(kv); - const primaryLeaf = branch2 && branch2.primary.get(nsimple); - const alternateLeaf = branch2 && branch2.alternate.get(nsimple); - const inPrimary = primaryLeaf && primaryLeaf.has(item.id); - const inAlternate = alternateLeaf && alternateLeaf.has(item.id); - if (!inPrimary && !inAlternate) { - insertName("alternate", t, kv, nsimple, item.id); - keepMatchNames.add(matchName); - } - }); - }); - if (keepMatchNames.size) { - item.matchNames = Array.from(keepMatchNames); - } else { - delete item.matchNames; + diff = utilArrayDifference(nb, nh); + for (i2 = 0; i2 < diff.length; i2++) { + result[diff[i2]] = head.hasEntity(diff[i2]); } - }); - }); - function insertName(which, t, kv, nsimple, itemID) { - if (!nsimple) { - that.warnings.push(`Warning: skipping empty ${which} name for item ${t}/${kv}: ${itemID}`); - return; - } - let branch = that.matchIndex.get(kv); - if (!branch) { - branch = { - primary: /* @__PURE__ */ new Map(), - alternate: /* @__PURE__ */ new Map(), - excludeGeneric: /* @__PURE__ */ new Map(), - excludeNamed: /* @__PURE__ */ new Map() - }; - that.matchIndex.set(kv, branch); } - let leaf = branch[which].get(nsimple); - if (!leaf) { - leaf = /* @__PURE__ */ new Set(); - branch[which].set(nsimple, leaf); - } - leaf.add(itemID); - if (!/yes$/.test(kv)) { - const kvnsimple = `${kv}/${nsimple}`; - const existing = seenTree.get(kvnsimple); - if (existing && existing !== t) { - const items = Array.from(leaf); - that.warnings.push(`Duplicate cache key "${kvnsimple}" in trees "${t}" and "${existing}", check items: ${items}`); - return; + if (entity.type === "relation" && entity.isMultipolygon()) { + var mh = h ? h.members.map(function(m) { + return m.id; + }) : []; + var mb = b ? b.members.map(function(m) { + return m.id; + }) : []; + var ids = utilArrayUnion(mh, mb); + for (i2 = 0; i2 < ids.length; i2++) { + var member = head.hasEntity(ids[i2]); + if (!member) + continue; + if (extent && !member.intersects(extent, head)) + continue; + result[ids[i2]] = member; } - seenTree.set(kvnsimple, t); } + addParents(head.parentWays(entity), result); + addParents(head.parentRelations(entity), result); } - function skipGenericKVMatches(t, k, v) { - return t === "flags" || t === "transit" || k === "landuse" || v === "atm" || v === "bicycle_parking" || v === "car_sharing" || v === "caravan_site" || v === "charging_station" || v === "dog_park" || v === "parking" || v === "phone" || v === "playground" || v === "post_box" || v === "public_bookcase" || v === "recycling" || v === "vending_machine"; + return result; + function addParents(parents, result2) { + for (var i3 = 0; i3 < parents.length; i3++) { + var parent = parents[i3]; + if (parent.id in result2) + continue; + result2[parent.id] = parent; + addParents(head.parentRelations(parent), result2); + } } - } - // - // `buildLocationIndex()` - // Call this to prepare a which-polygon location index. - // This *resolves* all the locationSets into GeoJSON, which takes some time. - // You can skip this step if you don't care about matching within a location. - // - // `data` needs to be an Object indexed on a 'tree/key/value' path. - // (e.g. cache filled by `fileTree.read` or data found in `dist/nsi.json`) - // { - // 'brands/amenity/bank': { properties: {}, items: [ {}, {}, … ] }, - // 'brands/amenity/bar': { properties: {}, items: [ {}, {}, … ] }, - // … - // } - // - buildLocationIndex(data, loco) { - const that = this; - if (that.locationIndex) - return; - that.itemLocation = /* @__PURE__ */ new Map(); - that.locationSets = /* @__PURE__ */ new Map(); - Object.keys(data).forEach((tkv) => { - const items = data[tkv].items; - if (!Array.isArray(items) || !items.length) - return; - items.forEach((item) => { - if (that.itemLocation.has(item.id)) - return; - let resolved; - try { - resolved = loco.resolveLocationSet(item.locationSet); - } catch (err) { - console.warn(`buildLocationIndex: ${err.message}`); - } - if (!resolved || !resolved.id) - return; - that.itemLocation.set(item.id, resolved.id); - if (that.locationSets.has(resolved.id)) - return; - let feature3 = _cloneDeep2(resolved.feature); - feature3.id = resolved.id; - feature3.properties.id = resolved.id; - if (!feature3.geometry.coordinates.length || !feature3.properties.area) { - console.warn(`buildLocationIndex: locationSet ${resolved.id} for ${item.id} resolves to an empty feature:`); - console.warn(JSON.stringify(feature3)); - return; - } - that.locationSets.set(resolved.id, feature3); - }); - }); - that.locationIndex = (0, import_which_polygon3.default)({ type: "FeatureCollection", features: [...that.locationSets.values()] }); - function _cloneDeep2(obj) { - return JSON.parse(JSON.stringify(obj)); - } - } - // - // `match()` - // Pass parts and return an Array of matches. - // `k` - key - // `v` - value - // `n` - namelike - // `loc` - optional - [lon,lat] location to search - // - // 1. If the [k,v,n] tuple matches a canonical item… - // Return an Array of match results. - // Each result will include the area in km² that the item is valid. - // - // Order of results: - // Primary ordering will be on the "match" column: - // "primary" - where the query matches the `name` tag, followed by - // "alternate" - where the query matches an alternate name tag (e.g. short_name, brand, operator, etc) - // Secondary ordering will be on the "area" column: - // "area descending" if no location was provided, (worldwide before local) - // "area ascending" if location was provided (local before worldwide) - // - // [ - // { match: 'primary', itemID: String, area: Number, kv: String, nsimple: String }, - // { match: 'primary', itemID: String, area: Number, kv: String, nsimple: String }, - // { match: 'alternate', itemID: String, area: Number, kv: String, nsimple: String }, - // { match: 'alternate', itemID: String, area: Number, kv: String, nsimple: String }, - // … - // ] - // - // -or- - // - // 2. If the [k,v,n] tuple matches an exclude pattern… - // Return an Array with a single exclude result, either - // - // [ { match: 'excludeGeneric', pattern: String, kv: String } ] // "generic" e.g. "Food Court" - // or - // [ { match: 'excludeNamed', pattern: String, kv: String } ] // "named", e.g. "Kebabai" - // - // About results - // "generic" - a generic word that is probably not really a name. - // For these, iD should warn the user "Hey don't put 'food court' in the name tag". - // "named" - a real name like "Kebabai" that is just common, but not a brand. - // 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. - // - // -or- - // - // 3. If the [k,v,n] tuple matches nothing of any kind, return `null` - // - // - match(k, v, n2, loc) { - const that = this; - if (!that.matchIndex) { - throw new Error("match: matchIndex not built."); - } - let matchLocations; - if (Array.isArray(loc) && that.locationIndex) { - matchLocations = that.locationIndex([loc[0], loc[1], loc[0], loc[1]], true); - } - const nsimple = simplify(n2); - let seen = /* @__PURE__ */ new Set(); - let results = []; - gatherResults("primary"); - gatherResults("alternate"); - if (results.length) - return results; - gatherResults("exclude"); - return results.length ? results : null; - function gatherResults(which) { - const kv = `${k}/${v}`; - let didMatch = tryMatch(which, kv); - if (didMatch) - return; - for (let mg in matchGroups) { - const matchGroup = matchGroups[mg]; - const inGroup = matchGroup.some((otherkv) => otherkv === kv); - if (!inGroup) - continue; - for (let i2 = 0; i2 < matchGroup.length; i2++) { - const otherkv = matchGroup[i2]; - if (otherkv === kv) - continue; - didMatch = tryMatch(which, otherkv); - if (didMatch) - return; - } - } - if (which === "exclude") { - const regex = [...that.genericWords.values()].find((regex2) => regex2.test(n2)); - if (regex) { - results.push({ match: "excludeGeneric", pattern: String(regex) }); - return; - } - } - } - function tryMatch(which, kv) { - const branch = that.matchIndex.get(kv); - if (!branch) - return; - if (which === "exclude") { - let regex = [...branch.excludeNamed.values()].find((regex2) => regex2.test(n2)); - if (regex) { - results.push({ match: "excludeNamed", pattern: String(regex), kv }); - return; - } - regex = [...branch.excludeGeneric.values()].find((regex2) => regex2.test(n2)); - if (regex) { - results.push({ match: "excludeGeneric", pattern: String(regex), kv }); - return; - } - return; - } - const leaf = branch[which].get(nsimple); - if (!leaf || !leaf.size) - return; - let hits = Array.from(leaf).map((itemID) => { - let area = Infinity; - if (that.itemLocation && that.locationSets) { - const location = that.locationSets.get(that.itemLocation.get(itemID)); - area = location && location.properties.area || Infinity; - } - return { match: which, itemID, area, kv, nsimple }; - }); - let sortFn = byAreaDescending; - if (matchLocations) { - hits = hits.filter(isValidLocation); - sortFn = byAreaAscending; - } - if (!hits.length) - return; - hits.sort(sortFn).forEach((hit) => { - if (seen.has(hit.itemID)) - return; - seen.add(hit.itemID); - results.push(hit); - }); - return true; - function isValidLocation(hit) { - if (!that.itemLocation) - return true; - return matchLocations.find((props) => props.id === that.itemLocation.get(hit.itemID)); - } - function byAreaAscending(hitA, hitB) { - return hitA.area - hitB.area; - } - function byAreaDescending(hitA, hitB) { - return hitB.area - hitA.area; - } - } - } - // - // `getWarnings()` - // Return any warnings discovered when buiding the index. - // (currently this does nothing) - // - getWarnings() { - return this.warnings; - } - }; - - // modules/services/nsi.js - var import_vparse2 = __toESM(require_vparse()); - - // modules/core/difference.js - var import_fast_deep_equal3 = __toESM(require_fast_deep_equal()); - function coreDifference(base, head) { - var _changes = {}; - var _didChange = {}; - var _diff = {}; - function checkEntityID(id2) { - var h = head.entities[id2]; - var b = base.entities[id2]; - if (h === b) - return; - if (_changes[id2]) - return; - if (!h && b) { - _changes[id2] = { base: b, head: h }; - _didChange.deletion = true; - return; - } - if (h && !b) { - _changes[id2] = { base: b, head: h }; - _didChange.addition = true; - return; - } - if (h && b) { - if (h.members && b.members && !(0, import_fast_deep_equal3.default)(h.members, b.members)) { - _changes[id2] = { base: b, head: h }; - _didChange.geometry = true; - _didChange.properties = true; - return; - } - if (h.loc && b.loc && !geoVecEqual(h.loc, b.loc)) { - _changes[id2] = { base: b, head: h }; - _didChange.geometry = true; - } - if (h.nodes && b.nodes && !(0, import_fast_deep_equal3.default)(h.nodes, b.nodes)) { - _changes[id2] = { base: b, head: h }; - _didChange.geometry = true; - } - if (h.tags && b.tags && !(0, import_fast_deep_equal3.default)(h.tags, b.tags)) { - _changes[id2] = { base: b, head: h }; - _didChange.properties = true; - } - } - } - function load() { - var ids = utilArrayUniq(Object.keys(head.entities).concat(Object.keys(base.entities))); - for (var i2 = 0; i2 < ids.length; i2++) { - checkEntityID(ids[i2]); - } - } - load(); - _diff.length = function length() { - return Object.keys(_changes).length; - }; - _diff.changes = function changes() { - return _changes; - }; - _diff.didChange = _didChange; - _diff.extantIDs = function extantIDs(includeRelMembers) { - var result = /* @__PURE__ */ new Set(); - Object.keys(_changes).forEach(function(id2) { - if (_changes[id2].head) { - result.add(id2); - } - var h = _changes[id2].head; - var b = _changes[id2].base; - var entity = h || b; - if (includeRelMembers && entity.type === "relation") { - var mh = h ? h.members.map(function(m) { - return m.id; - }) : []; - var mb = b ? b.members.map(function(m) { - return m.id; - }) : []; - utilArrayUnion(mh, mb).forEach(function(memberID) { - if (head.hasEntity(memberID)) { - result.add(memberID); - } - }); - } - }); - return Array.from(result); - }; - _diff.modified = function modified() { - var result = []; - Object.values(_changes).forEach(function(change) { - if (change.base && change.head) { - result.push(change.head); - } - }); - return result; - }; - _diff.created = function created() { - var result = []; - Object.values(_changes).forEach(function(change) { - if (!change.base && change.head) { - result.push(change.head); - } - }); - return result; - }; - _diff.deleted = function deleted() { - var result = []; - Object.values(_changes).forEach(function(change) { - if (change.base && !change.head) { - result.push(change.base); - } - }); - return result; - }; - _diff.summary = function summary() { - var relevant = {}; - var keys = Object.keys(_changes); - for (var i2 = 0; i2 < keys.length; i2++) { - var change = _changes[keys[i2]]; - if (change.head && change.head.geometry(head) !== "vertex") { - addEntity(change.head, head, change.base ? "modified" : "created"); - } else if (change.base && change.base.geometry(base) !== "vertex") { - addEntity(change.base, base, "deleted"); - } else if (change.base && change.head) { - var moved = !(0, import_fast_deep_equal3.default)(change.base.loc, change.head.loc); - var retagged = !(0, import_fast_deep_equal3.default)(change.base.tags, change.head.tags); - if (moved) { - addParents(change.head); - } - if (retagged || moved && change.head.hasInterestingTags()) { - addEntity(change.head, head, "modified"); - } - } else if (change.head && change.head.hasInterestingTags()) { - addEntity(change.head, head, "created"); - } else if (change.base && change.base.hasInterestingTags()) { - addEntity(change.base, base, "deleted"); - } - } - return Object.values(relevant); - function addEntity(entity, graph, changeType) { - relevant[entity.id] = { - entity, - graph, - changeType - }; - } - function addParents(entity) { - var parents = head.parentWays(entity); - for (var j2 = parents.length - 1; j2 >= 0; j2--) { - var parent = parents[j2]; - if (!(parent.id in relevant)) { - addEntity(parent, head, "modified"); - } - } - } - }; - _diff.complete = function complete(extent) { - var result = {}; - var id2, change; - for (id2 in _changes) { - change = _changes[id2]; - var h = change.head; - var b = change.base; - var entity = h || b; - var i2; - if (extent && (!h || !h.intersects(extent, head)) && (!b || !b.intersects(extent, base))) { - continue; - } - result[id2] = h; - if (entity.type === "way") { - var nh = h ? h.nodes : []; - var nb = b ? b.nodes : []; - var diff; - diff = utilArrayDifference(nh, nb); - for (i2 = 0; i2 < diff.length; i2++) { - result[diff[i2]] = head.hasEntity(diff[i2]); - } - diff = utilArrayDifference(nb, nh); - for (i2 = 0; i2 < diff.length; i2++) { - result[diff[i2]] = head.hasEntity(diff[i2]); - } - } - if (entity.type === "relation" && entity.isMultipolygon()) { - var mh = h ? h.members.map(function(m) { - return m.id; - }) : []; - var mb = b ? b.members.map(function(m) { - return m.id; - }) : []; - var ids = utilArrayUnion(mh, mb); - for (i2 = 0; i2 < ids.length; i2++) { - var member = head.hasEntity(ids[i2]); - if (!member) - continue; - if (extent && !member.intersects(extent, head)) - continue; - result[ids[i2]] = member; - } - } - addParents(head.parentWays(entity), result); - addParents(head.parentRelations(entity), result); - } - return result; - function addParents(parents, result2) { - for (var i3 = 0; i3 < parents.length; i3++) { - var parent = parents[i3]; - if (parent.id in result2) - continue; - result2[parent.id] = parent; - addParents(head.parentRelations(parent), result2); - } - } - }; - return _diff; - } - - // modules/core/tree.js - var import_rbush6 = __toESM(require_rbush_min()); - function coreTree(head) { - var _rtree = new import_rbush6.default(); - var _bboxes = {}; - var _segmentsRTree = new import_rbush6.default(); - var _segmentsBBoxes = {}; - var _segmentsByWayId = {}; - var tree = {}; - function entityBBox(entity) { - var bbox2 = entity.extent(head).bbox(); - bbox2.id = entity.id; - _bboxes[entity.id] = bbox2; - return bbox2; + }; + return _diff; + } + + // modules/core/tree.js + var import_rbush5 = __toESM(require_rbush_min()); + function coreTree(head) { + var _rtree = new import_rbush5.default(); + var _bboxes = {}; + var _segmentsRTree = new import_rbush5.default(); + var _segmentsBBoxes = {}; + var _segmentsByWayId = {}; + var tree = {}; + function entityBBox(entity) { + var bbox2 = entity.extent(head).bbox(); + bbox2.id = entity.id; + _bboxes[entity.id] = bbox2; + return bbox2; } function segmentBBox(segment) { var extent = segment.extent(head); @@ -40587,7 +40980,7 @@ ${content} nextIDs: osmEntity.id.next, index: _index, // note the time the changes were saved - timestamp: new Date().getTime() + timestamp: (/* @__PURE__ */ new Date()).getTime() }); }, fromJSON: function(json, loadChildNodes) { @@ -41244,6 +41637,7 @@ ${content} } // modules/validations/crossing_ways.js + var import_lodash3 = __toESM(require_lodash()); function validationCrossingWays(context) { var type2 = "crossing_ways"; function getFeatureWithFeatureTypeTagsForWay(way, graph) { @@ -41343,8 +41737,7 @@ ${content} secondary: true, secondary_link: true }; - var nonCrossingHighways = { track: true }; - function tagsForConnectionNodeIfAllowed(entity1, entity2, graph) { + function tagsForConnectionNodeIfAllowed(entity1, entity2, graph, lessLikelyTags) { var featureType1 = getFeatureType(entity1, graph); var featureType2 = getFeatureType(entity2, graph); var geometry1 = entity1.geometry(graph); @@ -41356,10 +41749,13 @@ ${content} var entity2IsPath = osmPathHighwayTagValues[entity2.tags.highway]; if ((entity1IsPath || entity2IsPath) && entity1IsPath !== entity2IsPath) { var roadFeature = entity1IsPath ? entity2 : entity1; - if (nonCrossingHighways[roadFeature.tags.highway]) { + var pathFeature = entity1IsPath ? entity1 : entity2; + if (roadFeature.tags.highway === "track") { + return {}; + } + if (!lessLikelyTags && roadFeature.tags.highway === "service" && pathFeature.tags.highway === "footway" && pathFeature.tags.footway === "sidewalk") { return {}; } - var pathFeature = entity1IsPath ? entity1 : entity2; if (["marked", "unmarked", "traffic_signals", "uncontrolled"].indexOf(pathFeature.tags.crossing) !== -1) { return bothLines ? { highway: "crossing", crossing: pathFeature.tags.crossing } : {}; } @@ -41591,6 +41987,10 @@ ${content} var fixes = []; if (connectionTags) { fixes.push(makeConnectWaysFix(this.data.connectionTags)); + let lessLikelyConnectionTags = tagsForConnectionNodeIfAllowed(entities[0], entities[1], graph, true); + if (lessLikelyConnectionTags && !(0, import_lodash3.isEqual)(connectionTags, lessLikelyConnectionTags)) { + fixes.push(makeConnectWaysFix(lessLikelyConnectionTags)); + } } if (isCrossingIndoors) { fixes.push(new validationIssueFix({ @@ -41769,19 +42169,24 @@ ${content} } function makeConnectWaysFix(connectionTags) { var fixTitleID = "connect_features"; + var fixIcon = "iD-icon-crossing"; + if (connectionTags.highway === "crossing") { + fixTitleID = "connect_using_crossing"; + fixIcon = "temaki-pedestrian"; + } if (connectionTags.ford) { fixTitleID = "connect_using_ford"; + fixIcon = "roentgen-ford"; } - return new validationIssueFix({ - icon: "iD-icon-crossing", + const fix = new validationIssueFix({ + icon: fixIcon, title: _t.append("issues.fix." + fixTitleID + ".title"), onClick: function(context2) { var loc = this.issue.loc; - var connectionTags2 = this.issue.data.connectionTags; var edges = this.issue.data.edges; context2.perform( function actionConnectCrossingWays(graph) { - var node = osmNode({ loc, tags: connectionTags2 }); + var node = osmNode({ loc, tags: connectionTags }); graph = graph.replace(node); var nodesToMerge = [node.id]; var mergeThresholdInMeters = 0.75; @@ -41803,6 +42208,8 @@ ${content} ); } }); + fix._connectionTags = connectionTags; + return fix; } function makeChangeLayerFix(higherOrLower) { return new validationIssueFix({ @@ -44113,9 +44520,9 @@ ${content} corePreferences("validate-disabledRules", Object.keys(_disabledRules).join(",")); validator.validate(); }; - validator.disableRules = (keys) => { + validator.disableRules = (keys2) => { _disabledRules = {}; - keys.forEach((k) => _disabledRules[k] = true); + keys2.forEach((k) => _disabledRules[k] = true); corePreferences("validate-disabledRules", Object.keys(_disabledRules).join(",")); validator.validate(); }; @@ -44559,9 +44966,9 @@ ${content} var remote = remoteGraph.entity(id2); if (sameVersions(local, remote)) return; - var merge3 = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags, formatUser); - history.replace(merge3); - var mergeConflicts = merge3.conflicts(); + var merge2 = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags, formatUser); + history.replace(merge2); + var mergeConflicts = merge2.conflicts(); if (!mergeConflicts.length) return; var forceLocal = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags).withOption("force_local"); @@ -44670,7 +45077,7 @@ ${content} } // modules/renderer/background_source.js - var import_lodash2 = __toESM(require_lodash()); + var import_lodash4 = __toESM(require_lodash()); // modules/util/IntervalTasksQueue.js var IntervalTasksQueue = class { @@ -44753,20 +45160,20 @@ ${content} }; source.name = function() { var id_safe = source.id.replace(/\./g, ""); - return _t("imagery." + id_safe + ".name", { default: (0, import_lodash2.escape)(_name) }); + return _t("imagery." + id_safe + ".name", { default: (0, import_lodash4.escape)(_name) }); }; source.label = function() { var id_safe = source.id.replace(/\./g, ""); - return _t.append("imagery." + id_safe + ".name", { default: (0, import_lodash2.escape)(_name) }); + return _t.append("imagery." + id_safe + ".name", { default: (0, import_lodash4.escape)(_name) }); }; source.hasDescription = function() { var id_safe = source.id.replace(/\./g, ""); - var descriptionText = _mainLocalizer.tInfo("imagery." + id_safe + ".description", { default: (0, import_lodash2.escape)(_description) }).text; + var descriptionText = _mainLocalizer.tInfo("imagery." + id_safe + ".description", { default: (0, import_lodash4.escape)(_description) }).text; return descriptionText !== ""; }; source.description = function() { var id_safe = source.id.replace(/\./g, ""); - return _t.append("imagery." + id_safe + ".description", { default: (0, import_lodash2.escape)(_description) }); + return _t.append("imagery." + id_safe + ".description", { default: (0, import_lodash4.escape)(_description) }); }; source.best = function() { return _best; @@ -45497,7 +45904,7 @@ ${content} var es_default = bbox; // modules/renderer/background.js - var import_which_polygon4 = __toESM(require_which_polygon()); + var import_which_polygon3 = __toESM(require_which_polygon()); // modules/renderer/tile_layer.js function rendererTileLayer(context) { @@ -45727,7 +46134,7 @@ ${content} _imageryIndex.features[source.id] = feature3; return feature3; }).filter(Boolean); - _imageryIndex.query = (0, import_which_polygon4.default)({ type: "FeatureCollection", features }); + _imageryIndex.query = (0, import_which_polygon3.default)({ type: "FeatureCollection", features }); _imageryIndex.backgrounds = sources.map((source) => { if (source.type === "bing") { return rendererBackgroundSource.Bing(source, dispatch10); @@ -46915,7 +47322,7 @@ ${content} if (qid) { classes.push("tag-wikidata"); } - return classes.join(" ").trim(); + return classes.filter((klass) => /^[-_a-z0-9]+$/.test(klass)).join(" ").trim(); }; tagClasses.tags = function(val) { if (!arguments.length) @@ -47234,7 +47641,7 @@ ${content} const val = parseFloat(nodeVal(get1(node, tagName))); if (isNaN(val)) return void 0; - if (val && callback) + if (callback) callback(val); return val; } @@ -47480,6 +47887,14 @@ ${content} function getColor(node, output) { return get3(node, "color", (elem) => fixColor(nodeVal(elem), output)); } + function extractIconHref(node) { + return get3(node, "Icon", (icon2, properties) => { + val1(icon2, "href", (href) => { + properties.icon = href; + }); + return properties; + }); + } function extractIcon(node) { return get3(node, "IconStyle", (iconStyle) => { return Object.assign(getColor(iconStyle, "icon"), numericProperty(iconStyle, "scale", "icon-scale"), numericProperty(iconStyle, "heading", "icon-heading"), get3(iconStyle, "hotSpot", (hotspot) => { @@ -47493,12 +47908,7 @@ ${content} "icon-offset-units": [xunits, yunits] }; return {}; - }), get3(iconStyle, "Icon", (icon2, properties) => { - val1(icon2, "href", (href) => { - properties.icon = href; - }); - return properties; - })); + }), extractIconHref(iconStyle)); }); } function extractLabel(node) { @@ -47525,6 +47935,68 @@ ${content} function extractStyle(node) { return Object.assign({}, extractPoly(node), extractLine(node), extractLabel(node), extractIcon(node)); } + var toNumber2 = (x) => Number(x); + var typeConverters = { + string: (x) => x, + int: toNumber2, + uint: toNumber2, + short: toNumber2, + ushort: toNumber2, + float: toNumber2, + double: toNumber2, + bool: (x) => Boolean(x) + }; + function extractExtendedData(node, schema) { + return get3(node, "ExtendedData", (extendedData, properties) => { + for (const data of $(extendedData, "Data")) { + properties[data.getAttribute("name") || ""] = nodeVal(get1(data, "value")); + } + for (const simpleData of $(extendedData, "SimpleData")) { + const name = simpleData.getAttribute("name") || ""; + const typeConverter = schema[name] || typeConverters.string; + properties[name] = typeConverter(nodeVal(simpleData)); + } + return properties; + }); + } + function getMaybeHTMLDescription(node) { + const descriptionNode = get1(node, "description"); + for (const c of Array.from(descriptionNode?.childNodes || [])) { + if (c.nodeType === 4) { + return { + description: { + "@type": "html", + value: nodeVal(c) + } + }; + } + } + return {}; + } + function extractTimeSpan(node) { + return get3(node, "TimeSpan", (timeSpan) => { + return { + timespan: { + begin: nodeVal(get1(timeSpan, "begin")), + end: nodeVal(get1(timeSpan, "end")) + } + }; + }); + } + function extractTimeStamp(node) { + return get3(node, "TimeStamp", (timeStamp) => { + return { timestamp: nodeVal(get1(timeStamp, "when")) }; + }); + } + function extractCascadedStyle(node, styleMap) { + return val1(node, "styleUrl", (styleUrl) => { + styleUrl = normalizeId(styleUrl); + if (styleMap[styleUrl]) { + return Object.assign({ styleUrl }, styleMap[styleUrl]); + } + return { styleUrl }; + }); + } var removeSpace = /\s*/g; var trimSpace = /^\s*|\s*$/g; var splitSpace = /\s+/; @@ -47575,30 +48047,26 @@ ${content} } return ring; } - var GEO_TYPES = [ - "Polygon", - "LineString", - "Point", - "Track", - "gx:Track" - ]; function getCoordinates(node) { return nodeVal(get1(node, "coordinates")); } function getGeometry(node) { - const geometries = []; - const coordTimes = []; - for (const t of ["MultiGeometry", "MultiTrack", "gx:MultiTrack"]) { - const elem = get1(node, t); - if (elem) { - return getGeometry(elem); - } - } - for (const geoType of GEO_TYPES) { - for (const geomNode of $(node, geoType)) { - switch (geoType) { + let geometries = []; + let coordTimes = []; + for (let i2 = 0; i2 < node.childNodes.length; i2++) { + const child = node.childNodes.item(i2); + if (isElement(child)) { + switch (child.tagName) { + case "MultiGeometry": + case "MultiTrack": + case "gx:MultiTrack": { + const childGeometries = getGeometry(child); + geometries = geometries.concat(childGeometries.geometries); + coordTimes = coordTimes.concat(childGeometries.coordTimes); + break; + } case "Point": { - const coordinates = coord1(getCoordinates(geomNode)); + const coordinates = coord1(getCoordinates(child)); if (coordinates.length >= 2) { geometries.push({ type: "Point", @@ -47607,8 +48075,9 @@ ${content} } break; } + case "LinearRing": case "LineString": { - const coordinates = coord(getCoordinates(geomNode)); + const coordinates = coord(getCoordinates(child)); if (coordinates.length >= 2) { geometries.push({ type: "LineString", @@ -47619,7 +48088,7 @@ ${content} } case "Polygon": { const coords = []; - for (const linearRing of $(geomNode, "LinearRing")) { + for (const linearRing of $(child, "LinearRing")) { const ring = fixRing(coord(getCoordinates(linearRing))); if (ring.length >= 4) { coords.push(ring); @@ -47635,7 +48104,7 @@ ${content} } case "Track": case "gx:Track": { - const gx = gxCoords(geomNode); + const gx = gxCoords(child); if (!gx) break; const { times, geometry } = gx; @@ -47652,62 +48121,13 @@ ${content} coordTimes }; } - function extractExtendedData(node) { - return get3(node, "ExtendedData", (extendedData, properties) => { - for (const data of $(extendedData, "Data")) { - properties[data.getAttribute("name") || ""] = nodeVal(get1(data, "value")); - } - for (const simpleData of $(extendedData, "SimpleData")) { - properties[simpleData.getAttribute("name") || ""] = nodeVal(simpleData); - } - return properties; - }); - } function geometryListToGeometry(geometries) { return geometries.length === 0 ? null : geometries.length === 1 ? geometries[0] : { type: "GeometryCollection", geometries }; } - function extractTimeSpan(node) { - return get3(node, "TimeSpan", (timeSpan) => { - return { - timespan: { - begin: nodeVal(get1(timeSpan, "begin")), - end: nodeVal(get1(timeSpan, "end")) - } - }; - }); - } - function extractTimeStamp(node) { - return get3(node, "TimeStamp", (timeStamp) => { - return { timestamp: nodeVal(get1(timeStamp, "when")) }; - }); - } - function extractCascadedStyle(node, styleMap) { - return val1(node, "styleUrl", (styleUrl) => { - styleUrl = normalizeId(styleUrl); - if (styleMap[styleUrl]) { - return Object.assign({ styleUrl }, styleMap[styleUrl]); - } - return { styleUrl }; - }); - } - function getMaybeHTMLDescription(node) { - const descriptionNode = get1(node, "description"); - for (const c of Array.from(descriptionNode?.childNodes || [])) { - if (c.nodeType === 4) { - return { - description: { - "@type": "html", - value: nodeVal(c) - } - }; - } - } - return {}; - } - function getPlacemark(node, styleMap) { + function getPlacemark(node, styleMap, schema) { const { coordTimes, geometries } = getGeometry(node); const feature3 = { type: "Feature", @@ -47719,7 +48139,7 @@ ${content} "open", "phoneNumber", "description" - ]), getMaybeHTMLDescription(node), extractCascadedStyle(node, styleMap), extractStyle(node), extractExtendedData(node), extractTimeSpan(node), extractTimeStamp(node), coordTimes.length ? { + ]), getMaybeHTMLDescription(node), extractCascadedStyle(node, styleMap), extractStyle(node), extractExtendedData(node, schema), extractTimeSpan(node), extractTimeStamp(node), coordTimes.length ? { coordinateProperties: { times: coordTimes.length === 1 ? coordTimes[0] : coordTimes } @@ -47733,6 +48153,100 @@ ${content} feature3.id = id2; return feature3; } + function getGroundOverlayBox(node) { + const latLonQuad = get1(node, "gx:LatLonQuad"); + if (latLonQuad) { + const ring = fixRing(coord(getCoordinates(node))); + return { + type: "Polygon", + coordinates: [ring] + }; + } + return getLatLonBox(node); + } + var DEGREES_TO_RADIANS = Math.PI / 180; + function rotateBox(bbox2, coordinates, rotation) { + const center = [(bbox2[0] + bbox2[2]) / 2, (bbox2[1] + bbox2[3]) / 2]; + return [ + coordinates[0].map((coordinate) => { + const dy = coordinate[1] - center[1]; + const dx = coordinate[0] - center[0]; + const distance = Math.sqrt(Math.pow(dy, 2) + Math.pow(dx, 2)); + const angle2 = Math.atan2(dy, dx) - rotation * DEGREES_TO_RADIANS; + return [ + center[0] + Math.cos(angle2) * distance, + center[1] + Math.sin(angle2) * distance + ]; + }) + ]; + } + function getLatLonBox(node) { + const latLonBox = get1(node, "LatLonBox"); + if (latLonBox) { + const north = num1(latLonBox, "north"); + const west = num1(latLonBox, "west"); + const east = num1(latLonBox, "east"); + const south = num1(latLonBox, "south"); + const rotation = num1(latLonBox, "rotation"); + if (typeof north === "number" && typeof south === "number" && typeof west === "number" && typeof east === "number") { + const bbox2 = [west, south, east, north]; + let coordinates = [ + [ + [west, north], + [east, north], + [east, south], + [west, south], + [west, north] + // top left (again) + ] + ]; + if (typeof rotation === "number") { + coordinates = rotateBox(bbox2, coordinates, rotation); + } + return { + type: "Polygon", + coordinates + }; + } + } + return null; + } + function getGroundOverlay(node, styleMap, schema) { + const geometry = getGroundOverlayBox(node); + const feature3 = { + type: "Feature", + geometry, + properties: Object.assign( + /** + * Related to + * https://gist.github.com/tmcw/037a1cb6660d74a392e9da7446540f46 + */ + { "@geometry-type": "groundoverlay" }, + getMulti(node, [ + "name", + "address", + "visibility", + "open", + "phoneNumber", + "description" + ]), + getMaybeHTMLDescription(node), + extractCascadedStyle(node, styleMap), + extractStyle(node), + extractIconHref(node), + extractExtendedData(node, schema), + extractTimeSpan(node), + extractTimeStamp(node) + ) + }; + if (feature3.properties?.visibility !== void 0) { + feature3.properties.visibility = feature3.properties.visibility !== "0"; + } + const id2 = node.getAttribute("id"); + if (id2 !== null && id2 !== "") + feature3.id = id2; + return feature3; + } function getStyleId(style) { let id2 = style.getAttribute("id"); const parentNode = style.parentNode; @@ -47757,10 +48271,23 @@ ${content} } return styleMap; } + function buildSchema(node) { + const schema = {}; + for (const field of $(node, "SimpleField")) { + schema[field.getAttribute("name") || ""] = typeConverters[field.getAttribute("type") || ""] || typeConverters["string"]; + } + return schema; + } function* kmlGen(node) { const styleMap = buildStyleMap(node); + const schema = buildSchema(node); for (const placemark of $(node, "Placemark")) { - const feature3 = getPlacemark(placemark, styleMap); + const feature3 = getPlacemark(placemark, styleMap, schema); + if (feature3) + yield feature3; + } + for (const groundOverlay of $(node, "GroundOverlay")) { + const feature3 = getGroundOverlay(groundOverlay, styleMap, schema); if (feature3) yield feature3; } @@ -48229,6 +48756,7 @@ ${content} "maki-sprite", "temaki-sprite", "fa-sprite", + "roentgen-sprite", "community-sprite" ]; function drawDefs(selection2) { @@ -48497,13 +49025,13 @@ ${content} } // modules/svg/labels.js - var import_rbush7 = __toESM(require_rbush_min()); + var import_rbush6 = __toESM(require_rbush_min()); function svgLabels(projection2, context) { var path = path_default(projection2); var detected = utilDetect(); var baselineHack = detected.ie || detected.browser.toLowerCase() === "edge" || detected.browser.toLowerCase() === "firefox" && detected.version >= 70; - var _rdrawn = new import_rbush7.default(); - var _rskipped = new import_rbush7.default(); + var _rdrawn = new import_rbush6.default(); + var _rskipped = new import_rbush6.default(); var _textWidthCache = {}; var _entitybboxes = {}; var labelStack = [ @@ -51653,7 +52181,7 @@ ${content} var _maxDistance = 20; var _pointer; function pointerIsValidFor(loc) { - return new Date().getTime() - _pointer.startTime <= _maxTimespan && // all pointer events must occur within a small distance of the first pointerdown + return (/* @__PURE__ */ new Date()).getTime() - _pointer.startTime <= _maxTimespan && // all pointer events must occur within a small distance of the first pointerdown geoVecLength(_pointer.startLoc, loc) <= _maxDistance; } function pointerdown(d3_event) { @@ -51666,7 +52194,7 @@ ${content} if (!_pointer) { _pointer = { startLoc: loc, - startTime: new Date().getTime(), + startTime: (/* @__PURE__ */ new Date()).getTime(), upCount: 0, pointerId: d3_event.pointerId }; @@ -53155,7 +53683,7 @@ ${content} tooltip.content(function() { var heading = _heading.apply(this, arguments); var text2 = _title.apply(this, arguments); - var keys = _keys.apply(this, arguments); + var keys2 = _keys.apply(this, arguments); var headingCallback = typeof heading === "function" ? heading : (s) => s.text(heading); var textCallback = typeof text2 === "function" ? text2 : (s) => s.text(text2); return function(selection2) { @@ -53165,12 +53693,12 @@ ${content} var textSelect = selection2.selectAll(".tooltip-text").data(text2 ? [text2] : []); textSelect.exit().remove(); textSelect.enter().append("div").attr("class", "tooltip-text").merge(textSelect).text("").call(textCallback); - var keyhintWrap = selection2.selectAll(".keyhint-wrap").data(keys && keys.length ? [0] : []); + var keyhintWrap = selection2.selectAll(".keyhint-wrap").data(keys2 && keys2.length ? [0] : []); keyhintWrap.exit().remove(); var keyhintWrapEnter = keyhintWrap.enter().append("div").attr("class", "keyhint-wrap"); keyhintWrapEnter.append("span").call(_t.append("tooltip_keyhint")); keyhintWrap = keyhintWrapEnter.merge(keyhintWrap); - keyhintWrap.selectAll("kbd.shortcut").data(keys && keys.length ? keys : []).enter().append("kbd").attr("class", "shortcut").text(function(d) { + keyhintWrap.selectAll("kbd.shortcut").data(keys2 && keys2.length ? keys2 : []).enter().append("kbd").attr("class", "shortcut").text(function(d) { return d; }); }; @@ -53236,8 +53764,8 @@ ${content} select_default2(this).call(tooltip).append("div").attr("class", "icon-wrap").call(svgIcon(d.icon && d.icon() || "#iD-operation-" + d.id, "operation")); }); if (showLabels) { - buttonsEnter.append("span").attr("class", "label").html(function(d) { - return d.title; + buttonsEnter.append("span").attr("class", "label").each(function(d) { + select_default2(this).call(d.title); }); } buttonsEnter.merge(buttons).classed("disabled", function(d) { @@ -53514,8 +54042,8 @@ ${content} if (!isSupported()) return; var detected = utilDetect(); - var keys = detected.os === "mac" ? [uiCmd("\u2303\u2318F"), "f11"] : ["f11"]; - context.keybinding().on(keys, fullScreen); + var keys2 = detected.os === "mac" ? [uiCmd("\u2303\u2318F"), "f11"] : ["f11"]; + context.keybinding().on(keys2, fullScreen); }; } @@ -58354,7 +58882,7 @@ ${content} return; if (input.classed("disabled")) return; - _tDown = +new Date(); + _tDown = +/* @__PURE__ */ new Date(); var start2 = input.property("selectionStart"); var end = input.property("selectionEnd"); if (start2 !== end) { @@ -59292,22 +59820,6 @@ ${content} } // modules/ui/fields/combo.js - var valueIcons = { - "crossing:markings": [ - "dashes", - "dots", - "ladder:paired", - "ladder:skewed", - "ladder", - "lines:paired", - "lines", - "surface", - "zebra:bicolour", - "zebra:double", - "zebra:paired", - "zebra" - ] - }; function uiFieldCombo(field, context) { var dispatch10 = dispatch_default("change"); var _isMulti = field.type === "multiCombo" || field.type === "manyCombo"; @@ -59345,7 +59857,7 @@ ${content} } function tagValue(dval) { dval = clean2(dval || ""); - var found = getOptions().find(function(o) { + var found = getOptions(true).find(function(o) { return o.key && clean2(o.value) === dval; }); if (found) @@ -59394,7 +59906,7 @@ ${content} function objectDifference(a, b) { return a.filter(function(d1) { return !b.some(function(d2) { - return !d2.isMixed && d1.value === d2.value; + return d1.value === d2.value; }); }); } @@ -59407,14 +59919,20 @@ ${content} setTaginfoValues("", setPlaceholder); } else { selection2.call(_combobox, attachTo); - setStaticValues(setPlaceholder); + setTimeout(() => setStaticValues(setPlaceholder), 0); } } - function getOptions() { + function getOptions(allOptions) { var stringsField = field.resolveReference("stringsCrossReference"); if (!(field.options || stringsField.options)) return []; - return (field.options || stringsField.options).map(function(v) { + let options2; + if (allOptions !== true) { + options2 = field.options || stringsField.options; + } else { + options2 = [].concat(field.options, stringsField.options).filter(Boolean); + } + return options2.map(function(v) { const labelId = getLabelId(stringsField, v); return { key: v, @@ -59495,11 +60013,12 @@ ${content} }); } function addComboboxIcons(disp, value) { - if (valueIcons[field.key]) { + const iconsField = field.resolveReference("iconsCrossReference"); + if (iconsField.icons) { return function(selection2) { var span = selection2.insert("span", ":first-child").attr("class", "tag-value-icon"); - if (valueIcons[field.key].indexOf(value) !== -1) { - span.call(svgIcon("#iD-" + field.key.replace(/:/g, "_") + "-" + value.replace(/:/g, "_"))); + if (iconsField.icons[value]) { + span.call(svgIcon(`#${iconsField.icons[value]}`)); } disp.call(this, selection2); }; @@ -59530,6 +60049,8 @@ ${content} ph = _staticPlaceholder; } _container.selectAll("input").attr("placeholder", ph); + var hideAdd = !_allowCustomValues && !values.length; + _container.selectAll(".chiplist .input-wrap").style("display", hideAdd ? "none" : null); } function change() { var t = {}; @@ -59595,6 +60116,15 @@ ${content} } dispatch10.call("change", this, t); } + function invertMultikey(d3_event, d) { + d3_event.preventDefault(); + d3_event.stopPropagation(); + var t = {}; + if (_isMulti) { + t[d.key] = _tags[d.key] === "yes" ? "no" : "yes"; + } + dispatch10.call("change", this, t); + } function combo(selection2) { _container = selection2.selectAll(".form-field-input-wrap").data([0]); var type2 = _isMulti || _isSemi ? "multicombo" : "combo"; @@ -59612,6 +60142,8 @@ ${content} }).merge(_container); _inputWrap = _container.selectAll(".input-wrap").data([0]); _inputWrap = _inputWrap.enter().append("li").attr("class", "input-wrap").merge(_inputWrap); + var hideAdd = !_allowCustomValues && !_comboData.length; + _inputWrap.style("display", hideAdd ? "none" : null); _input = _inputWrap.selectAll("input").data([0]); } else { _input = _container.selectAll("input").data([0]); @@ -59660,16 +60192,26 @@ ${content} } function updateIcon(value) { value = tagValue(value); - if (valueIcons[field.key]) { - _container.selectAll(".tag-value-icon").remove(); - if (valueIcons[field.key].indexOf(value) !== -1) { - _container.selectAll(".tag-value-icon").data([value]).enter().insert("div", "input").attr("class", "tag-value-icon").call(svgIcon("#iD-" + field.key.replace(/:/g, "_") + "-" + value.replace(/:/g, "_"))); + let container = _container; + if (field.type === "multiCombo" || field.type === "semiCombo") { + container = _container.select(".input-wrap"); + } + const iconsField = field.resolveReference("iconsCrossReference"); + if (iconsField.icons) { + container.selectAll(".tag-value-icon").remove(); + if (iconsField.icons[value]) { + container.selectAll(".tag-value-icon").data([value]).enter().insert("div", "input").attr("class", "tag-value-icon").call(svgIcon(`#${iconsField.icons[value]}`)); } } } combo.tags = function(tags) { _tags = tags; var stringsField = field.resolveReference("stringsCrossReference"); + var isMixed = Array.isArray(tags[field.key]); + var showsValue = (value) => !isMixed && value && !(field.type === "typeCombo" && value === "yes"); + var isRawValue = (value) => showsValue(value) && !stringsField.hasTextForStringId(`options.${value}`) && !stringsField.hasTextForStringId(`options.${value}.title`); + var isKnownValue = (value) => showsValue(value) && !isRawValue(value); + var isReadOnly = !_allowCustomValues; if (_isMulti || _isSemi) { _multiData = []; var maxLength; @@ -59680,13 +60222,12 @@ ${content} if (!field.key && field.keys.indexOf(k) === -1) continue; var v = tags[k]; - if (!v || typeof v === "string" && v.toLowerCase() === "no") - continue; var suffix = field.key ? k.slice(field.key.length) : k; _multiData.push({ key: k, value: displayValue(suffix), - display: renderValue(suffix), + display: addComboboxIcons(renderValue(suffix), suffix), + state: typeof v === "string" ? v.toLowerCase() : "", isMixed: Array.isArray(v) }); } @@ -59720,7 +60261,7 @@ ${content} return { key: v2, value: displayValue(v2), - display: renderValue(v2), + display: addComboboxIcons(renderValue(v2), v2), isMixed: !commonValues.includes(v2) }; }); @@ -59731,11 +60272,9 @@ ${content} } } maxLength = Math.max(0, maxLength); - var allowDragAndDrop = _isSemi && !Array.isArray(tags[field.key]); - var available = objectDifference(_comboData, _multiData); - _combobox.data(available); - var hideAdd = !_allowCustomValues && !available.length || maxLength <= 0; + var hideAdd = maxLength <= 0 || !_allowCustomValues && !_comboData.length; _container.selectAll(".chiplist .input-wrap").style("display", hideAdd ? "none" : null); + var allowDragAndDrop = _isSemi && !Array.isArray(tags[field.key]); var chips = _container.selectAll(".chip").data(_multiData); chips.exit().remove(); var enter = chips.enter().insert("li", ".input-wrap").attr("class", "chip"); @@ -59749,8 +60288,18 @@ ${content} }).classed("draggable", allowDragAndDrop).classed("mixed", function(d) { return d.isMixed; }).attr("title", function(d) { - return d.isMixed ? _t("inspector.unshared_value_tooltip") : null; - }); + if (d.isMixed) { + return _t("inspector.unshared_value_tooltip"); + } + if (!["yes", "no"].includes(d.state)) { + return d.state; + } + return null; + }).classed("negated", (d) => d.state === "no"); + if (!_isSemi) { + chips.selectAll("input[type=checkbox]").remove(); + chips.insert("input", "span").attr("type", "checkbox").property("checked", (d) => d.state === "yes").property("indeterminate", (d) => d.isMixed || !["yes", "no"].includes(d.state)).on("click", invertMultikey); + } if (allowDragAndDrop) { registerDragAndDrop(chips); } @@ -59764,17 +60313,13 @@ ${content} } }); chips.select("a").attr("href", "#").on("click", removeMultikey).attr("class", "remove").text("\xD7"); + updateIcon(""); } else { - var isMixed = Array.isArray(tags[field.key]); var mixedValues = isMixed && tags[field.key].map(function(val) { return displayValue(val); }).filter(Boolean); - var showsValue = !isMixed && tags[field.key] && !(field.type === "typeCombo" && tags[field.key] === "yes"); - var isRawValue = showsValue && !stringsField.hasTextForStringId(`options.${tags[field.key]}`) && !stringsField.hasTextForStringId(`options.${tags[field.key]}.title`); - var isKnownValue = showsValue && !isRawValue; - var isReadOnly = !_allowCustomValues || isKnownValue; - utilGetSetValue(_input, !isMixed ? displayValue(tags[field.key]) : "").classed("raw-value", isRawValue).classed("known-value", isKnownValue).attr("readonly", isReadOnly ? "readonly" : void 0).attr("title", isMixed ? mixedValues.join("\n") : void 0).attr("placeholder", isMixed ? _t("inspector.multiple_values") : _staticPlaceholder || "").classed("mixed", isMixed).on("keydown.deleteCapture", function(d3_event) { - if (isReadOnly && isKnownValue && (d3_event.keyCode === utilKeybinding.keyCodes["\u232B"] || d3_event.keyCode === utilKeybinding.keyCodes["\u2326"])) { + 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) { + if (isReadOnly && isKnownValue(tags[field.key]) && (d3_event.keyCode === utilKeybinding.keyCodes["\u232B"] || d3_event.keyCode === utilKeybinding.keyCodes["\u2326"])) { d3_event.preventDefault(); d3_event.stopPropagation(); var t = {}; @@ -59789,6 +60334,12 @@ ${content} _lengthIndicator.update(tags[field.key]); } } + const refreshStyles = () => { + _input.data([tagValue(utilGetSetValue(_input))]).classed("raw-value", isRawValue).classed("known-value", isKnownValue); + }; + _input.on("input.refreshStyles", refreshStyles); + _combobox.on("update.refreshStyles", refreshStyles); + refreshStyles(); }; function registerDragAndDrop(selection2) { var dragOrigin, targetIndex; @@ -59891,6 +60442,7 @@ ${content} } // modules/ui/fields/input.js + var likelyRawNumberFormat = /^-?(0\.\d*|\d*\.\d{0,2}(\d{4,})?|\d{4,}\.\d{3})$/; function uiFieldText(field, context) { var dispatch10 = dispatch_default("change"); var input = select_default2(null); @@ -59901,6 +60453,9 @@ ${content} var _tags; var _phoneFormats = {}; const isDirectionField = field.key.split(":").some((keyPart) => keyPart === "direction"); + const formatFloat = _mainLocalizer.floatFormatter(_mainLocalizer.languageCode()); + const parseLocaleFloat = _mainLocalizer.floatParser(_mainLocalizer.languageCode()); + const countDecimalPlaces = _mainLocalizer.decimalPlaceCounter(_mainLocalizer.languageCode()); if (field.type === "tel") { _mainFileFetcher.get("phone_formats").then(function(d) { _phoneFormats = d; @@ -59952,22 +60507,25 @@ ${content} var raw_vals = input.node().value || "0"; var vals = raw_vals.split(";"); vals = vals.map(function(v) { - var num = Number(v); + v = v.trim(); + const isRawNumber = likelyRawNumberFormat.test(v); + var num = isRawNumber ? parseFloat(v) : parseLocaleFloat(v); if (isDirectionField) { - const compassDir = cardinal[v.trim().toLowerCase()]; + const compassDir = cardinal[v.toLowerCase()]; if (compassDir !== void 0) { num = compassDir; } } - if (!isFinite(num)) { - return v.trim(); - } + if (!isFinite(num)) + return v; + num = parseFloat(num); + if (!isFinite(num)) + return v; num += d; if (isDirectionField) { num = (num % 360 + 360) % 360; } - const numDecimals = v.includes(".") ? v.split(".")[1].length : 0; - return clamped(num).toFixed(numDecimals); + return formatFloat(clamped(num), isRawNumber ? v.includes(".") ? v.split(".")[1].length : 0 : countDecimalPlaces(v)); }); input.node().value = vals.join(";"); change()(); @@ -60002,24 +60560,29 @@ ${content} } else if (field.type === "colour") { input.attr("type", "text"); updateColourPreview(); + } else if (field.type === "date") { + input.attr("type", "text"); + updateDateField(); } } - function isColourValid(colour) { - if (!colour.match(/^(#([0-9a-fA-F]{3}){1,2}|\w+)$/)) { - return false; - } else if (!CSS.supports("color", colour) || ["unset", "inherit", "initial", "revert"].includes(colour)) { - return false; - } - return true; - } function updateColourPreview() { + function isColourValid(colour2) { + if (!colour2.match(/^(#([0-9a-fA-F]{3}){1,2}|\w+)$/)) { + return false; + } else if (!CSS.supports("color", colour2) || ["unset", "inherit", "initial", "revert"].includes(colour2)) { + return false; + } + return true; + } wrap2.selectAll(".colour-preview").remove(); const colour = utilGetSetValue(input); - if (!isColourValid(colour) && colour !== "") + if (!isColourValid(colour) && colour !== "") { + wrap2.selectAll("input.colour-selector").remove(); + wrap2.selectAll(".form-field-button").remove(); return; + } var colourSelector = wrap2.selectAll(".colour-selector").data([0]); - outlinkButton = wrap2.selectAll(".colour-preview").data([colour]); - colourSelector.enter().append("input").attr("type", "color").attr("class", "form-field-button colour-selector").attr("value", colour).on("input", debounce_default(function(d3_event) { + colourSelector.enter().append("input").attr("type", "color").attr("class", "colour-selector").on("input", debounce_default(function(d3_event) { d3_event.preventDefault(); var colour2 = this.value; if (!isColourValid(colour2)) @@ -60028,11 +60591,51 @@ ${content} change()(); updateColourPreview(); }, 100)); - outlinkButton = outlinkButton.enter().append("div").attr("class", "form-field-button colour-preview").append("div").style("background-color", (d) => d).attr("class", "colour-box"); + wrap2.selectAll("input.colour-selector").attr("value", colour); + var chooserButton = wrap2.selectAll(".colour-preview").data([colour]); + chooserButton = chooserButton.enter().append("div").attr("class", "form-field-button colour-preview").append("div").style("background-color", (d) => d).attr("class", "colour-box"); if (colour === "") { - outlinkButton = outlinkButton.call(svgIcon("#iD-icon-edit")); + chooserButton = chooserButton.call(svgIcon("#iD-icon-edit")); + } + chooserButton.on("click", () => wrap2.select(".colour-selector").node().showPicker()); + } + function updateDateField() { + function isDateValid(date2) { + return date2.match(/^[0-9]{4}(-[0-9]{2}(-[0-9]{2})?)?$/); + } + const date = utilGetSetValue(input); + const now3 = /* @__PURE__ */ new Date(); + const today = new Date(now3.getTime() - now3.getTimezoneOffset() * 6e4).toISOString().split("T")[0]; + if ((field.key === "check_date" || field.key === "survey:date") && date !== today) { + 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", () => { + utilGetSetValue(input, today); + change()(); + updateDateField(); + }); + } else { + wrap2.selectAll(".date-set-today").remove(); + } + if (!isDateValid(date) && date !== "") { + wrap2.selectAll("input.date-selector").remove(); + wrap2.selectAll(".date-calendar").remove(); + return; + } + if (utilDetect().browser !== "Safari") { + var dateSelector = wrap2.selectAll(".date-selector").data([0]); + dateSelector.enter().append("input").attr("type", "date").attr("class", "date-selector").on("input", debounce_default(function(d3_event) { + d3_event.preventDefault(); + var date2 = this.value; + if (!isDateValid(date2)) + return; + utilGetSetValue(input, this.value); + change()(); + updateDateField(); + }, 100)); + wrap2.selectAll("input.date-selector").attr("value", date); + var calendarButton = wrap2.selectAll(".date-calendar").data([date]); + calendarButton = calendarButton.enter().append("button").attr("class", "form-field-button date-calendar").call(svgIcon("#fas-calendar-days")); + calendarButton.on("click", () => wrap2.select(".date-selector").node().showPicker()); } - outlinkButton.on("click", () => wrap2.select(".colour-selector").node().click()).merge(outlinkButton); } function updatePhonePlaceholder() { if (input.empty() || !Object.keys(_phoneFormats).length) @@ -60066,27 +60669,53 @@ ${content} } return num; } + function getVals(tags) { + if (field.keys) { + const multiSelection = context.selectedIDs(); + tags = multiSelection.length > 1 ? context.selectedIDs().map((id2) => context.graph().entity(id2)).map((entity) => entity.tags) : [tags]; + return tags.map((tags2) => new Set(field.keys.reduce((acc, key) => acc.concat(tags2[key]), []).filter(Boolean))).map((vals) => vals.size === 0 ? /* @__PURE__ */ new Set([void 0]) : vals).reduce((a, b) => /* @__PURE__ */ new Set([...a, ...b])); + } else { + return new Set([].concat(tags[field.key])); + } + } function change(onInput) { return function() { var t = {}; var val = utilGetSetValue(input); if (!onInput) val = context.cleanTagValue(val); - if (!val && Array.isArray(_tags[field.key])) + if (!val && getVals(_tags).size > 1) return; - if (!onInput) { - if (field.type === "number" && val) { - var vals = val.split(";"); - vals = vals.map(function(v) { - var num = Number(v); - return isFinite(num) ? clamped(num) : v.trim(); - }); - val = vals.join(";"); - } - utilGetSetValue(input, val); + var displayVal = val; + if (field.type === "number" && val) { + var numbers2 = val.split(";"); + numbers2 = numbers2.map(function(v) { + if (likelyRawNumberFormat.test(v)) { + return v; + } + var num = parseLocaleFloat(v); + const fractionDigits = countDecimalPlaces(v); + return isFinite(num) ? clamped(num).toFixed(fractionDigits) : v; + }); + val = numbers2.join(";"); } + if (!onInput) + utilGetSetValue(input, displayVal); t[field.key] = val || void 0; - dispatch10.call("change", this, t, onInput); + if (field.keys) { + dispatch10.call("change", this, (tags) => { + if (field.keys.some((key) => tags[key])) { + field.keys.filter((key) => tags[key]).forEach((key) => { + tags[key] = val || void 0; + }); + } else { + tags[field.key] = val || void 0; + } + return tags; + }, onInput); + } else { + dispatch10.call("change", this, t, onInput); + } }; } i2.entityIDs = function(val) { @@ -60097,22 +60726,49 @@ ${content} }; i2.tags = function(tags) { _tags = tags; - var isMixed = Array.isArray(tags[field.key]); - 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); + const vals = getVals(tags); + const isMixed = vals.size > 1; + var val = vals.size === 1 ? [...vals][0] : ""; + var shouldUpdate; + if (field.type === "number" && val) { + var numbers2 = val.split(";"); + var oriNumbers = utilGetSetValue(input).split(";"); + if (numbers2.length !== oriNumbers.length) + shouldUpdate = true; + numbers2 = numbers2.map(function(v) { + v = v.trim(); + var num = Number(v); + if (!isFinite(num) || v === "") + return v; + const fractionDigits = v.includes(".") ? v.split(".")[1].length : 0; + return formatFloat(num, fractionDigits); + }); + val = numbers2.join(";"); + shouldUpdate = (inputValue, setValue) => { + const inputNums = inputValue.split(";").map( + (setVal) => likelyRawNumberFormat.test(setVal) ? parseFloat(setVal) : parseLocaleFloat(setVal) + ); + const setNums = setValue.split(";").map(parseLocaleFloat); + return !isEqual_default(inputNums, setNums); + }; + } + 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); if (field.type === "number") { const buttons = wrap2.selectAll(".increment, .decrement"); if (isMixed) { buttons.attr("disabled", "disabled").classed("disabled", true); } else { var raw_vals = tags[field.key] || "0"; - const canIncDec = raw_vals.split(";").some((val) => isFinite(Number(val)) || isDirectionField && cardinal[val.trim().toLowerCase()]); + const canIncDec = raw_vals.split(";").some((val2) => isFinite(Number(val2)) || isDirectionField && cardinal[val2.trim().toLowerCase()]); buttons.attr("disabled", canIncDec ? null : "disabled").classed("disabled", !canIncDec); } } if (field.type === "tel") updatePhonePlaceholder(); - if (field.key.split(":").includes("colour")) + if (field.type === "colour") updateColourPreview(); + if (field.type === "date") + updateDateField(); if (outlinkButton && !outlinkButton.empty()) { var disabled = !validIdentifierValueForLink(); outlinkButton.classed("disabled", disabled); @@ -60421,73 +61077,82 @@ ${content} } }).catch(function() { }); - function getNearStreets() { + function getNear(isAddressable, type2, searchRadius, resultProp) { var extent = combinedEntityExtent(); var l = extent.center(); - var box = geoExtent(l).padByMeters(200); - var streets = context.history().intersects(box).filter(isAddressable).map(function(d) { - var loc = context.projection([ - (extent[0][0] + extent[1][0]) / 2, - (extent[0][1] + extent[1][1]) / 2 - ]); - var choice = geoChooseEdge(context.graph().childNodes(d), loc, context.projection); + var box = geoExtent(l).padByMeters(searchRadius); + var features = context.history().intersects(box).filter(isAddressable).map((d) => { + let dist = geoSphericalDistance(d.extent(context.graph()).center(), l); + if (d.type === "way") { + var loc = context.projection([ + (extent[0][0] + extent[1][0]) / 2, + (extent[0][1] + extent[1][1]) / 2 + ]); + var choice = geoChooseEdge(context.graph().childNodes(d), loc, context.projection); + dist = Math.min(dist, choice.distance); + } + const value = resultProp && d.tags[resultProp] ? d.tags[resultProp] : d.tags.name; + let title = value; + if (type2 === "street") { + title = `${addrField.t("placeholders.street")}: ${title}`; + } else if (type2 === "place") { + title = `${addrField.t("placeholders.place")}: ${title}`; + } return { - title: d.tags.name, - value: d.tags.name, - dist: choice.distance + title, + value, + dist, + type: type2, + klass: `address-${type2}` }; }).sort(function(a, b) { return a.dist - b.dist; }); - return utilArrayUniqBy(streets, "value"); + return utilArrayUniqBy(features, "value"); + } + function getNearStreets() { function isAddressable(d) { return d.tags.highway && d.tags.name && d.type === "way"; } + return getNear(isAddressable, "street", 200); + } + function getNearPlaces() { + function isAddressable(d) { + if (d.tags.name) { + if (d.tags.place) + return true; + if (d.tags.boundary === "administrative" && d.tags.admin_level > 8) + return true; + } + return false; + } + return getNear(isAddressable, "place", 200); } function getNearCities() { - var extent = combinedEntityExtent(); - var l = extent.center(); - var box = geoExtent(l).padByMeters(200); - var cities = context.history().intersects(box).filter(isAddressable).map(function(d) { - return { - title: d.tags["addr:city"] || d.tags.name, - value: d.tags["addr:city"] || d.tags.name, - dist: geoSphericalDistance(d.extent(context.graph()).center(), l) - }; - }).sort(function(a, b) { - return a.dist - b.dist; - }); - return utilArrayUniqBy(cities, "value"); function isAddressable(d) { if (d.tags.name) { - if (d.tags.admin_level === "8" && d.tags.boundary === "administrative") + if (d.tags.boundary === "administrative" && d.tags.admin_level === "8") return true; if (d.tags.border_type === "city") return true; if (d.tags.place === "city" || d.tags.place === "town" || d.tags.place === "village") return true; } - if (d.tags["addr:city"]) + if (d.tags[`${field.key}:city`]) return true; return false; } + return getNear(isAddressable, "city", 200, `${field.key}:city`); + } + function getNearPostcodes() { + return [...new Set([].concat(getNearValues("postcode")).concat(getNear((d) => d.tags.postal_code, "postcode", 200, "postal_code")))]; } function getNearValues(key) { - var extent = combinedEntityExtent(); - var l = extent.center(); - var box = geoExtent(l).padByMeters(200); - var results = context.history().intersects(box).filter(function hasTag(d) { - return _entityIDs.indexOf(d.id) === -1 && d.tags[key]; - }).map(function(d) { - return { - title: d.tags[key], - value: d.tags[key], - dist: geoSphericalDistance(d.extent(context.graph()).center(), l) - }; - }).sort(function(a, b) { - return a.dist - b.dist; - }); - return utilArrayUniqBy(results, "value"); + const tagKey = `${field.key}:${key}`; + function hasTag(d) { + return _entityIDs.indexOf(d.id) === -1 && d.tags[tagKey]; + } + return getNear(hasTag, key, 200, tagKey); } function updateForCountryCode() { if (!_countryCode) @@ -60515,12 +61180,15 @@ ${content} "quarter", "state", "street", + "street+place", "subdistrict", "suburb" ]; var widths = addressFormat.widths || { - housenumber: 1 / 3, - street: 2 / 3, + housenumber: 1 / 5, + unit: 1 / 5, + street: 1 / 2, + place: 1 / 2, city: 2 / 3, state: 1 / 4, postcode: 1 / 3 @@ -60548,10 +61216,36 @@ ${content} function addDropdown(d) { if (dropdowns.indexOf(d.id) === -1) return; - var nearValues = d.id === "street" ? getNearStreets : d.id === "city" ? getNearCities : getNearValues; + var nearValues; + switch (d.id) { + case "street": + nearValues = getNearStreets; + break; + case "place": + nearValues = getNearPlaces; + break; + case "street+place": + nearValues = () => [].concat(getNearStreets()).concat(getNearPlaces()); + d.isAutoStreetPlace = true; + d.id = _tags[`${field.key}:place`] ? "place" : "street"; + break; + case "city": + nearValues = getNearCities; + break; + case "postcode": + nearValues = getNearPostcodes; + break; + default: + nearValues = getNearValues; + } select_default2(this).call( - uiCombobox(context, "address-" + d.id).minItems(1).caseSensitive(true).fetcher(function(value, callback) { - callback(nearValues("addr:" + d.id)); + uiCombobox(context, `address-${d.isAutoStreetPlace ? "street-place" : d.id}`).minItems(1).caseSensitive(true).fetcher(function(typedValue, callback) { + typedValue = typedValue.toLowerCase(); + callback(nearValues(d.id).filter((v) => v.value.toLowerCase().indexOf(typedValue) !== -1)); + }).on("accept", function(selected) { + if (d.isAutoStreetPlace) { + d.id = selected ? selected.type : "street"; + } }) ); } @@ -60581,17 +61275,26 @@ ${content} } function change(onInput) { return function() { - var tags = {}; - _wrap.selectAll("input").each(function(subfield) { - var key = field.key + ":" + subfield.id; - var value = this.value; - if (!onInput) - value = context.cleanTagValue(value); - if (Array.isArray(_tags[key]) && !value) - return; - tags[key] = value || void 0; - }); - dispatch10.call("change", this, tags, onInput); + setTimeout(() => { + var tags = {}; + _wrap.selectAll("input").each(function(subfield) { + var key = field.key + ":" + subfield.id; + var value = this.value; + if (!onInput) + value = context.cleanTagValue(value); + if (Array.isArray(_tags[key]) && !value) + return; + if (subfield.isAutoStreetPlace) { + if (subfield.id === "street") { + tags[`${field.key}:place`] = void 0; + } else if (subfield.id === "place") { + tags[`${field.key}:street`] = void 0; + } + } + tags[key] = value || void 0; + }); + dispatch10.call("change", this, tags, onInput); + }, 0); }; } function updatePlaceholder(inputSelection) { @@ -60599,16 +61302,35 @@ ${content} if (_tags && Array.isArray(_tags[field.key + ":" + subfield.id])) { return _t("inspector.multiple_values"); } - if (_countryCode) { - var localkey = subfield.id + "!" + _countryCode; - var tkey = addrField.hasTextForStringId("placeholders." + localkey) ? localkey : subfield.id; - return addrField.t("placeholders." + tkey); + if (subfield.isAutoStreetPlace) { + return `${getLocalPlaceholder("street")} / ${getLocalPlaceholder("place")}`; } + return getLocalPlaceholder(subfield.id); }); } + function getLocalPlaceholder(key) { + if (_countryCode) { + var localkey = key + "!" + _countryCode; + var tkey = addrField.hasTextForStringId("placeholders." + localkey) ? localkey : key; + return addrField.t("placeholders." + tkey); + } + } function updateTags(tags) { - utilGetSetValue(_wrap.selectAll("input"), function(subfield) { - var val = tags[field.key + ":" + subfield.id]; + utilGetSetValue(_wrap.selectAll("input"), (subfield) => { + var val; + if (subfield.isAutoStreetPlace) { + const streetKey = `${field.key}:street`; + const placeKey = `${field.key}:place`; + if (tags[streetKey] !== void 0 || tags[placeKey] === void 0) { + val = tags[streetKey]; + subfield.id = "street"; + } else { + val = tags[placeKey]; + subfield.id = "place"; + } + } else { + val = tags[`${field.key}:${subfield.id}`]; + } return typeof val === "string" ? val : ""; }).attr("title", function(subfield) { var val = tags[field.key + ":" + subfield.id]; @@ -60645,6 +61367,13 @@ ${content} var wrap2 = select_default2(null); var _tags; var _combos = {}; + if (field.type === "cycleway") { + field = { + ...field, + key: field.keys[0], + keys: field.keys.slice(1) + }; + } function directionalCombo(selection2) { function stripcolon(s) { return s.replace(":", ""); @@ -60653,8 +61382,7 @@ ${content} wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2); var div = wrap2.selectAll("ul").data([0]); div = div.enter().append("ul").attr("class", "rows").merge(div); - var keys = field.keys.slice(1); - items = div.selectAll("li").data(keys); + items = div.selectAll("li").data(field.keys); var enter = items.enter().append("li").attr("class", function(d) { return "labeled-input preset-directionalcombo-" + stripcolon(d); }); @@ -60678,8 +61406,8 @@ ${content} wrap2.selectAll(".preset-input-directionalcombo").on("change", change).on("blur", change); } function change(key, newValue) { - const commonKey = field.keys[0]; - const otherKey = key === field.keys[1] ? field.keys[2] : field.keys[1]; + const commonKey = field.key; + const otherKey = key === field.keys[0] ? field.keys[1] : field.keys[0]; dispatch10.call("change", this, (tags) => { const otherValue = tags[otherKey] || tags[commonKey]; if (newValue === otherValue) { @@ -60696,7 +61424,7 @@ ${content} } directionalCombo.tags = function(tags) { _tags = tags; - const commonKey = field.keys[0]; + const commonKey = field.key; for (let key in _combos) { const uniqueValues = [...new Set([].concat(_tags[commonKey]).concat(_tags[key]).filter(Boolean))]; _combos[key].tags({ [key]: uniqueValues.length > 1 ? uniqueValues : uniqueValues[0] }); @@ -60825,7 +61553,7 @@ ${content} var preset = _mainPresetIndex.match(entity, context.graph()); if (preset) { var isSuggestion = preset.suggestion; - var fields = preset.fields(); + var fields = preset.fields(entity.extent(context.graph()).center()); var showsBrandField = fields.some(function(d) { return d.id === "brand"; }); @@ -61085,6 +61813,8 @@ ${content} var _entityIDs = []; var _tags; var _isImperial; + var formatFloat = _mainLocalizer.floatFormatter(_mainLocalizer.languageCode()); + var parseLocaleFloat = _mainLocalizer.floatParser(_mainLocalizer.languageCode()); var primaryUnits = [ { value: "m", @@ -61135,16 +61865,24 @@ ${content} return; if (!primaryValue && !secondaryValue) { tag[field.key] = void 0; - } else if (isNaN(primaryValue) || isNaN(secondaryValue) || !_isImperial) { - tag[field.key] = context.cleanTagValue(primaryValue); } else { - if (primaryValue !== "") { - primaryValue = context.cleanTagValue(primaryValue + "'"); - } - if (secondaryValue !== "") { - secondaryValue = context.cleanTagValue(secondaryValue + '"'); + var rawPrimaryValue = likelyRawNumberFormat.test(primaryValue) ? parseFloat(primaryValue) : parseLocaleFloat(primaryValue); + if (isNaN(rawPrimaryValue)) + rawPrimaryValue = primaryValue; + var rawSecondaryValue = likelyRawNumberFormat.test(secondaryValue) ? parseFloat(secondaryValue) : parseLocaleFloat(secondaryValue); + if (isNaN(rawSecondaryValue)) + rawSecondaryValue = secondaryValue; + if (isNaN(rawPrimaryValue) || isNaN(rawSecondaryValue) || !_isImperial) { + tag[field.key] = context.cleanTagValue(rawPrimaryValue); + } else { + if (rawPrimaryValue !== "") { + rawPrimaryValue = rawPrimaryValue + "'"; + } + if (rawSecondaryValue !== "") { + rawSecondaryValue = rawSecondaryValue + '"'; + } + tag[field.key] = context.cleanTagValue(rawPrimaryValue + rawSecondaryValue); } - tag[field.key] = primaryValue + secondaryValue; } dispatch10.call("change", this, tag); } @@ -61157,20 +61895,28 @@ ${content} if (primaryValue && (primaryValue.indexOf("'") >= 0 || primaryValue.indexOf('"') >= 0)) { secondaryValue = primaryValue.match(/(-?[\d.]+)"/); if (secondaryValue !== null) { - secondaryValue = secondaryValue[1]; + secondaryValue = formatFloat(parseFloat(secondaryValue[1])); } primaryValue = primaryValue.match(/(-?[\d.]+)'/); if (primaryValue !== null) { - primaryValue = primaryValue[1]; + primaryValue = formatFloat(parseFloat(primaryValue[1])); } _isImperial = true; } else if (primaryValue) { + var rawValue = primaryValue; + primaryValue = parseFloat(rawValue); + if (isNaN(primaryValue)) { + primaryValue = rawValue; + } else { + primaryValue = formatFloat(primaryValue); + } _isImperial = false; } } setUnitSuggestions(); + var inchesPlaceholder = formatFloat(0); 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); - utilGetSetValue(secondaryInput, typeof secondaryValue === "string" ? secondaryValue : "").attr("placeholder", isMixed ? _t("inspector.multiple_values") : _isImperial ? "0" : null).classed("mixed", isMixed).classed("disabled", !_isImperial).attr("readonly", _isImperial ? null : "readonly"); + 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"); secondaryUnitInput.attr("value", _isImperial ? _t("inspector.roadheight.inch") : null); }; roadheight.focus = function() { @@ -61193,6 +61939,8 @@ ${content} var _entityIDs = []; var _tags; var _isImperial; + var formatFloat = _mainLocalizer.floatFormatter(_mainLocalizer.languageCode()); + var parseLocaleFloat = _mainLocalizer.floatParser(_mainLocalizer.languageCode()); var speedCombo = uiCombobox(context, "roadspeed"); var unitCombo = uiCombobox(context, "roadspeed-unit").data(["km/h", "mph"].map(comboValues)); var metricValues = [20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120]; @@ -61226,8 +61974,8 @@ ${content} } function comboValues(d) { return { - value: d.toString(), - title: d.toString() + value: formatFloat(d), + title: formatFloat(d) }; } function change() { @@ -61237,24 +61985,35 @@ ${content} return; if (!value) { tag[field.key] = void 0; - } else if (isNaN(value) || !_isImperial) { - tag[field.key] = context.cleanTagValue(value); } else { - tag[field.key] = context.cleanTagValue(value + " mph"); + var rawValue = likelyRawNumberFormat.test(value) ? parseFloat(value) : parseLocaleFloat(value); + if (isNaN(rawValue)) + rawValue = value; + if (isNaN(rawValue) || !_isImperial) { + tag[field.key] = context.cleanTagValue(rawValue); + } else { + tag[field.key] = context.cleanTagValue(rawValue + " mph"); + } } dispatch10.call("change", this, tag); } roadspeed.tags = function(tags) { _tags = tags; - var value = tags[field.key]; + var rawValue = tags[field.key]; + var value = rawValue; var isMixed = Array.isArray(value); if (!isMixed) { - if (value && value.indexOf("mph") >= 0) { - value = parseInt(value, 10).toString(); + if (rawValue && rawValue.indexOf("mph") >= 0) { _isImperial = true; - } else if (value) { + } else if (rawValue) { _isImperial = false; } + value = parseInt(value, 10); + if (isNaN(value)) { + value = rawValue; + } else { + value = formatFloat(value); + } } setUnitSuggestions(); 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); @@ -61960,8 +62719,11 @@ ${content} } } wikidata.itemsForSearchQuery(q, function(err, data) { - if (err) + if (err) { + if (err !== "No query") + console.error(err); return; + } var result = data.map(function(item) { return { id: item.id, @@ -62337,6 +63099,7 @@ ${content} colour: uiFieldText, combo: uiFieldCombo, cycleway: uiFieldDirectionalCombo, + date: uiFieldText, defaultCheck: uiFieldCheck, directionalCombo: uiFieldDirectionalCombo, email: uiFieldText, @@ -62387,7 +63150,6 @@ ${content} } var _locked = false; var _lockedTip = uiTooltip().title(() => _t.append("inspector.lock.suggestion", { label: field.title })).placement("bottom"); - field.keys = field.keys || [field.key]; if (_show && !field.impl) { createField(); } @@ -62402,19 +63164,26 @@ ${content} } } } + function allKeys() { + let keys2 = field.keys || [field.key]; + if (field.type === "directionalCombo" && field.key) { + keys2 = keys2.concat(field.key); + } + return keys2; + } function isModified() { if (!entityIDs || !entityIDs.length) return false; return entityIDs.some(function(entityID) { var original = context.graph().base().entities[entityID]; var latest = context.graph().entity(entityID); - return field.keys.some(function(key) { + return allKeys().some(function(key) { return original ? latest.tags[key] !== original.tags[key] : latest.tags[key]; }); }); } function tagsContainFieldKey() { - return field.keys.some(function(key) { + return allKeys().some(function(key) { if (field.type === "multiCombo") { for (var tagKey in _tags) { if (tagKey.indexOf(key) === 0) { @@ -62431,7 +63200,7 @@ ${content} d3_event.preventDefault(); if (!entityIDs || _locked) return; - dispatch10.call("revert", d, d.keys); + dispatch10.call("revert", d, allKeys()); } function remove2(d3_event, d) { d3_event.stopPropagation(); @@ -62439,7 +63208,7 @@ ${content} if (_locked) return; var t = {}; - d.keys.forEach(function(key) { + allKeys().forEach(function(key) { t[key] = void 0; }); dispatch10.call("change", d, t); @@ -63697,9 +64466,9 @@ ${content} var buttons = fixesEnter.append("button").on("click", function(d3_event, d) { if (select_default2(this).attr("disabled") || !d.onClick) return; - if (d.issue.dateLastRanFix && new Date() - d.issue.dateLastRanFix < 1e3) + if (d.issue.dateLastRanFix && /* @__PURE__ */ new Date() - d.issue.dateLastRanFix < 1e3) return; - d.issue.dateLastRanFix = new Date(); + d.issue.dateLastRanFix = /* @__PURE__ */ new Date(); utilHighlightEntities(d.issue.entityIds.concat(d.entityIds), false, context); new Promise(function(resolve, reject) { d.onClick(context, resolve, reject); @@ -63886,7 +64655,8 @@ ${content} const isMaki = picon && /^maki-/.test(picon); const isTemaki = picon && /^temaki-/.test(picon); const isFa = picon && /^fa[srb]-/.test(picon); - const isiDIcon = picon && !(isMaki || isTemaki || isFa); + const isR\u00F6ntgen = picon && /^roentgen-/.test(picon); + const isiDIcon = picon && !(isMaki || isTemaki || isFa || isR\u00F6ntgen); let icon2 = container.selectAll(".preset-icon").data(picon ? [0] : []); icon2.exit().remove(); icon2 = icon2.enter().append("div").attr("class", "preset-icon").call(svgIcon("")).merge(icon2); @@ -64066,13 +64836,17 @@ ${content} geoms[graph.entity(entityID).geometry(graph)] = true; return geoms; }, {})); + const loc = _entityIDs.reduce(function(extent, entityID) { + var entity = context.graph().entity(entityID); + return extent.extend(entity.extent(context.graph())); + }, geoExtent()).center(); var presetsManager = _mainPresetIndex; var allFields = []; var allMoreFields = []; var sharedTotalFields; _presets.forEach(function(preset) { - var fields = preset.fields(); - var moreFields = preset.moreFields(); + var fields = preset.fields(loc); + var moreFields = preset.moreFields(loc); allFields = utilArrayUnion(allFields, fields); allMoreFields = utilArrayUnion(allMoreFields, moreFields); if (!sharedTotalFields) { @@ -64117,8 +64891,8 @@ ${content} _fieldsArr.forEach(function(field) { field.on("change", function(t, onInput) { dispatch10.call("change", field, _entityIDs, t, onInput); - }).on("revert", function(keys) { - dispatch10.call("revert", field, keys); + }).on("revert", function(keys2) { + dispatch10.call("revert", field, keys2); }); }); } @@ -64947,14 +65721,14 @@ ${content} context.validator().validate(); } } - function revertTags(keys) { + function revertTags(keys2) { var actions = []; for (var i2 in _entityIDs) { var entityID = _entityIDs[i2]; var original = context.graph().base().entities[entityID]; var changed = {}; - for (var j2 in keys) { - var key = keys[j2]; + for (var j2 in keys2) { + var key = keys2[j2]; changed[key] = original ? original.tags[key] : void 0; } var entity = context.entity(entityID); @@ -65118,7 +65892,7 @@ ${content} location: loc }); } - var idMatch = !locationMatch && q.match(/(?:^|\W)(node|way|relation|[nwr])\W?0*([1-9]\d*)(?:\W|$)/i); + var idMatch = !locationMatch && q.match(/(?:^|\W)(node|way|relation|[nwr])\W{0,2}0*([1-9]\d*)(?:\W|$)/i); if (idMatch) { var elemType = idMatch[1].charAt(0); var elemId = idMatch[2]; @@ -66570,7 +67344,7 @@ ${content} // modules/ui/source_switch.js function uiSourceSwitch(context) { - var keys; + var keys2; function click(d3_event) { d3_event.preventDefault(); var osm = context.connection(); @@ -66586,15 +67360,15 @@ ${content} context.history().clearSaved(); context.flush(); select_default2(this).html(isLive ? _t.html("source_switch.live") : _t.html("source_switch.dev")).classed("live", isLive).classed("chip", isLive); - osm.switch(isLive ? keys[0] : keys[1]); + osm.switch(isLive ? keys2[0] : keys2[1]); } var sourceSwitch = function(selection2) { selection2.append("a").attr("href", "#").call(_t.append("source_switch.live")).attr("class", "live chip").on("click", click); }; sourceSwitch.keys = function(_) { if (!arguments.length) - return keys; - keys = _; + return keys2; + keys2 = _; return sourceSwitch; }; return sourceSwitch; @@ -66728,12 +67502,12 @@ ${content} } // node_modules/osm-community-index/lib/simplify.js - var import_diacritics3 = __toESM(require_diacritics(), 1); - function simplify2(str2) { + var import_diacritics2 = __toESM(require_diacritics(), 1); + function simplify(str2) { if (typeof str2 !== "string") return ""; - return import_diacritics3.default.remove( - str2.replace(/&/g, "and").replace(/İ/ig, "i").replace(/[\s\-=_!"#%'*{},.\/:;?\(\)\[\]@\\$\^*+<>«»~`’\u00a1\u00a7\u00b6\u00b7\u00bf\u037e\u0387\u055a-\u055f\u0589\u05c0\u05c3\u05c6\u05f3\u05f4\u0609\u060a\u060c\u060d\u061b\u061e\u061f\u066a-\u066d\u06d4\u0700-\u070d\u07f7-\u07f9\u0830-\u083e\u085e\u0964\u0965\u0970\u0af0\u0df4\u0e4f\u0e5a\u0e5b\u0f04-\u0f12\u0f14\u0f85\u0fd0-\u0fd4\u0fd9\u0fda\u104a-\u104f\u10fb\u1360-\u1368\u166d\u166e\u16eb-\u16ed\u1735\u1736\u17d4-\u17d6\u17d8-\u17da\u1800-\u1805\u1807-\u180a\u1944\u1945\u1a1e\u1a1f\u1aa0-\u1aa6\u1aa8-\u1aad\u1b5a-\u1b60\u1bfc-\u1bff\u1c3b-\u1c3f\u1c7e\u1c7f\u1cc0-\u1cc7\u1cd3\u200b-\u200f\u2016\u2017\u2020-\u2027\u2030-\u2038\u203b-\u203e\u2041-\u2043\u2047-\u2051\u2053\u2055-\u205e\u2cf9-\u2cfc\u2cfe\u2cff\u2d70\u2e00\u2e01\u2e06-\u2e08\u2e0b\u2e0e-\u2e16\u2e18\u2e19\u2e1b\u2e1e\u2e1f\u2e2a-\u2e2e\u2e30-\u2e39\u3001-\u3003\u303d\u30fb\ua4fe\ua4ff\ua60d-\ua60f\ua673\ua67e\ua6f2-\ua6f7\ua874-\ua877\ua8ce\ua8cf\ua8f8-\ua8fa\ua92e\ua92f\ua95f\ua9c1-\ua9cd\ua9de\ua9df\uaa5c-\uaa5f\uaade\uaadf\uaaf0\uaaf1\uabeb\ufe10-\ufe16\ufe19\ufe30\ufe45\ufe46\ufe49-\ufe4c\ufe50-\ufe52\ufe54-\ufe57\ufe5f-\ufe61\ufe68\ufe6a\ufe6b\ufeff\uff01-\uff03\uff05-\uff07\uff0a\uff0c\uff0e\uff0f\uff1a\uff1b\uff1f\uff20\uff3c\uff61\uff64\uff65]+/g, "").toLowerCase() + return import_diacritics2.default.remove( + str2.replace(/&/g, "and").replace(/(İ|i̇)/ig, "i").replace(/[\s\-=_!"#%'*{},.\/:;?\(\)\[\]@\\$\^*+<>«»~`’\u00a1\u00a7\u00b6\u00b7\u00bf\u037e\u0387\u055a-\u055f\u0589\u05c0\u05c3\u05c6\u05f3\u05f4\u0609\u060a\u060c\u060d\u061b\u061e\u061f\u066a-\u066d\u06d4\u0700-\u070d\u07f7-\u07f9\u0830-\u083e\u085e\u0964\u0965\u0970\u0af0\u0df4\u0e4f\u0e5a\u0e5b\u0f04-\u0f12\u0f14\u0f85\u0fd0-\u0fd4\u0fd9\u0fda\u104a-\u104f\u10fb\u1360-\u1368\u166d\u166e\u16eb-\u16ed\u1735\u1736\u17d4-\u17d6\u17d8-\u17da\u1800-\u1805\u1807-\u180a\u1944\u1945\u1a1e\u1a1f\u1aa0-\u1aa6\u1aa8-\u1aad\u1b5a-\u1b60\u1bfc-\u1bff\u1c3b-\u1c3f\u1c7e\u1c7f\u1cc0-\u1cc7\u1cd3\u2000-\u206f\u2cf9-\u2cfc\u2cfe\u2cff\u2d70\u2e00-\u2e7f\u3001-\u3003\u303d\u30fb\ua4fe\ua4ff\ua60d-\ua60f\ua673\ua67e\ua6f2-\ua6f7\ua874-\ua877\ua8ce\ua8cf\ua8f8-\ua8fa\ua92e\ua92f\ua95f\ua9c1-\ua9cd\ua9de\ua9df\uaa5c-\uaa5f\uaade\uaadf\uaaf0\uaaf1\uabeb\ufe10-\ufe16\ufe19\ufe30\ufe45\ufe46\ufe49-\ufe4c\ufe50-\ufe52\ufe54-\ufe57\ufe5f-\ufe61\ufe68\ufe6a\ufe6b\ufeff\uff01-\uff03\uff05-\uff07\uff0a\uff0c\uff0e\uff0f\uff1a\uff1b\uff1f\uff20\uff3c\uff61\uff64\uff65]+/g, "").toLowerCase() ); } @@ -66744,7 +67518,7 @@ ${content} const anyToken = new RegExp(/(\{\w+\})/, "gi"); if (localizerFn) { if (itemStrings.community) { - const communityID = simplify2(itemStrings.community); + const communityID = simplify(itemStrings.community); itemStrings.community = localizerFn(`_communities.${communityID}`); } ["name", "description", "extendedDescription"].forEach((prop) => { @@ -66932,7 +67706,7 @@ ${content} return event; }).filter((event) => { const t = event.date.getTime(); - const now3 = new Date().setHours(0, 0, 0, 0); + const now3 = (/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0); return !isNaN(t) && t >= now3; }).sort((a, b) => { return a.date < b.date ? -1 : a.date > b.date ? 1 : 0; @@ -67364,9 +68138,7 @@ ${content} query: value2 }, function(err, data) { if (!err) { - var filtered = data.filter(function(d) { - return _tags[d.value] === void 0; - }); + const filtered = data.filter((d) => _tags[d.value] === void 0).filter((d) => d.value.toLowerCase().includes(value2.toLowerCase())); callback(sort(value2, filtered)); } }); @@ -67378,10 +68150,12 @@ ${content} geometry, query: value2 }, function(err, data) { - if (!err) - callback(sort(value2, data)); + if (!err) { + const filtered = data.filter((d) => d.value.toLowerCase().includes(value2.toLowerCase())); + callback(sort(value2, filtered)); + } }); - })); + }).caseSensitive(allowUpperCaseTagValues.test(utilGetSetValue(key)))); function sort(value2, data) { var sameletter = []; var other = []; @@ -68072,9 +68846,12 @@ ${content} function modeAddArea(context, mode) { mode.id = "add-area"; var behavior = behaviorAddWay(context).on("start", start2).on("startFromWay", startFromWay).on("startFromNode", startFromNode); - var defaultTags = { area: "yes" }; - if (mode.preset) - defaultTags = mode.preset.setTags(defaultTags, "area"); + function defaultTags(loc) { + var defaultTags2 = { area: "yes" }; + if (mode.preset) + defaultTags2 = mode.preset.setTags(defaultTags2, "area", false, loc); + return defaultTags2; + } function actionClose(wayId) { return function(graph) { return graph.replace(graph.entity(wayId).close()); @@ -68083,7 +68860,7 @@ ${content} function start2(loc) { var startGraph = context.graph(); var node = osmNode({ loc }); - var way = osmWay({ tags: defaultTags }); + var way = osmWay({ tags: defaultTags(loc) }); context.perform( actionAddEntity(node), actionAddEntity(way), @@ -68095,7 +68872,7 @@ ${content} function startFromWay(loc, edge) { var startGraph = context.graph(); var node = osmNode({ loc }); - var way = osmWay({ tags: defaultTags }); + var way = osmWay({ tags: defaultTags(loc) }); context.perform( actionAddEntity(node), actionAddEntity(way), @@ -68107,7 +68884,7 @@ ${content} } function startFromNode(node) { var startGraph = context.graph(); - var way = osmWay({ tags: defaultTags }); + var way = osmWay({ tags: defaultTags(node.loc) }); context.perform( actionAddEntity(way), actionAddVertex(way.id, node.id), @@ -68128,13 +68905,16 @@ ${content} function modeAddLine(context, mode) { mode.id = "add-line"; var behavior = behaviorAddWay(context).on("start", start2).on("startFromWay", startFromWay).on("startFromNode", startFromNode); - var defaultTags = {}; - if (mode.preset) - defaultTags = mode.preset.setTags(defaultTags, "line"); + function defaultTags(loc) { + var defaultTags2 = {}; + if (mode.preset) + defaultTags2 = mode.preset.setTags(defaultTags2, "line", false, loc); + return defaultTags2; + } function start2(loc) { var startGraph = context.graph(); var node = osmNode({ loc }); - var way = osmWay({ tags: defaultTags }); + var way = osmWay({ tags: defaultTags(loc) }); context.perform( actionAddEntity(node), actionAddEntity(way), @@ -68145,7 +68925,7 @@ ${content} function startFromWay(loc, edge) { var startGraph = context.graph(); var node = osmNode({ loc }); - var way = osmWay({ tags: defaultTags }); + var way = osmWay({ tags: defaultTags(loc) }); context.perform( actionAddEntity(node), actionAddEntity(way), @@ -68156,7 +68936,7 @@ ${content} } function startFromNode(node) { var startGraph = context.graph(); - var way = osmWay({ tags: defaultTags }); + var way = osmWay({ tags: defaultTags(node.loc) }); context.perform( actionAddEntity(way), actionAddVertex(way.id, node.id) @@ -68176,11 +68956,14 @@ ${content} function modeAddPoint(context, mode) { mode.id = "add-point"; var behavior = behaviorDraw(context).on("click", add).on("clickWay", addWay).on("clickNode", addNode).on("cancel", cancel).on("finish", cancel); - var defaultTags = {}; - if (mode.preset) - defaultTags = mode.preset.setTags(defaultTags, "point"); + function defaultTags(loc) { + var defaultTags2 = {}; + if (mode.preset) + defaultTags2 = mode.preset.setTags(defaultTags2, "point", false, loc); + return defaultTags2; + } function add(loc) { - var node = osmNode({ loc, tags: defaultTags }); + var node = osmNode({ loc, tags: defaultTags(loc) }); context.perform( actionAddEntity(node), _t("operations.add.annotation.point") @@ -68188,7 +68971,7 @@ ${content} enterSelectMode(node); } function addWay(loc, edge) { - var node = osmNode({ tags: defaultTags }); + var node = osmNode({ tags: defaultTags(loc) }); context.perform( actionAddMidpoint({ loc, edge }, node), _t("operations.add.annotation.vertex") @@ -68201,13 +68984,14 @@ ${content} ); } function addNode(node) { - if (Object.keys(defaultTags).length === 0) { + const _defaultTags = defaultTags(node.loc); + if (Object.keys(_defaultTags).length === 0) { enterSelectMode(node); return; } var tags = Object.assign({}, node.tags); - for (var key in defaultTags) { - tags[key] = defaultTags[key]; + for (var key in _defaultTags) { + tags[key] = _defaultTags[key]; } context.perform( actionChangeTags(node.id, tags), @@ -69598,6 +70382,7 @@ ${content} "before_start", "open_source_h", "open_source", + "open_source_attribution", "open_source_help" ]], ["overview", [ @@ -71234,344 +72019,1164 @@ ${content} if (typeof callback === "function") { callback(err); } - return; - } else if (_connection && _connection.getConnectionId() !== cid) { - if (typeof callback === "function") { - callback({ message: "Connection Switched", status: -1 }); + return; + } else if (_connection && _connection.getConnectionId() !== cid) { + if (typeof callback === "function") { + callback({ message: "Connection Switched", status: -1 }); + } + return; + } else { + _history.merge(result.data, result.extent); + if (typeof callback === "function") { + callback(err, result); + } + return; + } + }; + } + context.loadTiles = (projection2, callback) => { + const handle = window.requestIdleCallback(() => { + _deferred2.delete(handle); + if (_connection && context.editableDataEnabled()) { + const cid = _connection.getConnectionId(); + _connection.loadTiles(projection2, afterLoad(cid, callback)); + } + }); + _deferred2.add(handle); + }; + context.loadTileAtLoc = (loc, callback) => { + const handle = window.requestIdleCallback(() => { + _deferred2.delete(handle); + if (_connection && context.editableDataEnabled()) { + const cid = _connection.getConnectionId(); + _connection.loadTileAtLoc(loc, afterLoad(cid, callback)); + } + }); + _deferred2.add(handle); + }; + context.loadEntity = (entityID, callback) => { + if (_connection) { + const cid = _connection.getConnectionId(); + _connection.loadEntity(entityID, afterLoad(cid, callback)); + _connection.loadEntityRelations(entityID, afterLoad(cid, callback)); + } + }; + context.zoomToEntity = (entityID, zoomTo) => { + context.loadEntity(entityID, (err, result) => { + if (err) + return; + if (zoomTo !== false) { + const entity = result.data.find((e) => e.id === entityID); + if (entity) { + _map.zoomTo(entity); + } + } + }); + _map.on("drawn.zoomToEntity", () => { + if (!context.hasEntity(entityID)) + return; + _map.on("drawn.zoomToEntity", null); + context.on("enter.zoomToEntity", null); + context.enter(modeSelect(context, [entityID])); + }); + context.on("enter.zoomToEntity", () => { + if (_mode.id !== "browse") { + _map.on("drawn.zoomToEntity", null); + context.on("enter.zoomToEntity", null); + } + }); + }; + let _minEditableZoom = 16; + context.minEditableZoom = function(val) { + if (!arguments.length) + return _minEditableZoom; + _minEditableZoom = val; + if (_connection) { + _connection.tileZoom(val); + } + return context; + }; + context.maxCharsForTagKey = () => 255; + context.maxCharsForTagValue = () => 255; + context.maxCharsForRelationRole = () => 255; + context.cleanTagKey = (val) => utilCleanOsmString(val, context.maxCharsForTagKey()); + context.cleanTagValue = (val) => utilCleanOsmString(val, context.maxCharsForTagValue()); + context.cleanRelationRole = (val) => utilCleanOsmString(val, context.maxCharsForRelationRole()); + let _inIntro = false; + context.inIntro = function(val) { + if (!arguments.length) + return _inIntro; + _inIntro = val; + return context; + }; + context.save = () => { + if (_inIntro || context.container().select(".modal").size()) + return; + let canSave; + if (_mode && _mode.id === "save") { + canSave = false; + if (services.osm && services.osm.isChangesetInflight()) { + _history.clearSaved(); + return; + } + } else { + canSave = context.selectedIDs().every((id2) => { + const entity = context.hasEntity(id2); + return entity && !entity.isDegenerate(); + }); + } + if (canSave) { + _history.save(); + } + if (_history.hasChanges()) { + return _t("save.unsaved_changes"); + } + }; + context.debouncedSave = debounce_default(context.save, 350); + function withDebouncedSave(fn) { + return function() { + const result = fn.apply(_history, arguments); + context.debouncedSave(); + return result; + }; + } + context.hasEntity = (id2) => _history.graph().hasEntity(id2); + context.entity = (id2) => _history.graph().entity(id2); + let _mode; + context.mode = () => _mode; + context.enter = (newMode) => { + if (_mode) { + _mode.exit(); + dispatch10.call("exit", this, _mode); + } + _mode = newMode; + _mode.enter(); + dispatch10.call("enter", this, _mode); + }; + context.selectedIDs = () => _mode && _mode.selectedIDs && _mode.selectedIDs() || []; + context.activeID = () => _mode && _mode.activeID && _mode.activeID(); + let _selectedNoteID; + context.selectedNoteID = function(noteID) { + if (!arguments.length) + return _selectedNoteID; + _selectedNoteID = noteID; + return context; + }; + let _selectedErrorID; + context.selectedErrorID = function(errorID) { + if (!arguments.length) + return _selectedErrorID; + _selectedErrorID = errorID; + return context; + }; + context.install = (behavior) => context.surface().call(behavior); + context.uninstall = (behavior) => context.surface().call(behavior.off); + let _copyGraph; + context.copyGraph = () => _copyGraph; + let _copyIDs = []; + context.copyIDs = function(val) { + if (!arguments.length) + return _copyIDs; + _copyIDs = val; + _copyGraph = _history.graph(); + return context; + }; + let _copyLonLat; + context.copyLonLat = function(val) { + if (!arguments.length) + return _copyLonLat; + _copyLonLat = val; + return context; + }; + let _background; + context.background = () => _background; + let _features; + context.features = () => _features; + context.hasHiddenConnections = (id2) => { + const graph = _history.graph(); + const entity = graph.entity(id2); + return _features.hasHiddenConnections(entity, graph); + }; + let _photos; + context.photos = () => _photos; + let _map; + context.map = () => _map; + context.layers = () => _map.layers(); + context.surface = () => _map.surface; + context.editableDataEnabled = () => _map.editableDataEnabled(); + context.surfaceRect = () => _map.surface.node().getBoundingClientRect(); + context.editable = () => { + const mode = context.mode(); + if (!mode || mode.id === "save") + return false; + return _map.editableDataEnabled(); + }; + let _debugFlags = { + tile: false, + // tile boundaries + collision: false, + // label collision bounding boxes + imagery: false, + // imagery bounding polygons + target: false, + // touch targets + downloaded: false + // downloaded data from osm + }; + context.debugFlags = () => _debugFlags; + context.getDebug = (flag) => flag && _debugFlags[flag]; + context.setDebug = function(flag, val) { + if (arguments.length === 1) + val = true; + _debugFlags[flag] = val; + dispatch10.call("change"); + return context; + }; + let _container = select_default2(null); + context.container = function(val) { + if (!arguments.length) + return _container; + _container = val; + _container.classed("ideditor", true); + return context; + }; + context.containerNode = function(val) { + if (!arguments.length) + return context.container().node(); + context.container(select_default2(val)); + return context; + }; + let _embed; + context.embed = function(val) { + if (!arguments.length) + return _embed; + _embed = val; + return context; + }; + let _assetPath = ""; + context.assetPath = function(val) { + if (!arguments.length) + return _assetPath; + _assetPath = val; + _mainFileFetcher.assetPath(val); + return context; + }; + let _assetMap = {}; + context.assetMap = function(val) { + if (!arguments.length) + return _assetMap; + _assetMap = val; + _mainFileFetcher.assetMap(val); + return context; + }; + context.asset = (val) => { + if (/^http(s)?:\/\//i.test(val)) + return val; + const filename = _assetPath + val; + return _assetMap[filename] || filename; + }; + context.imagePath = (val) => context.asset(`img/${val}`); + context.reset = context.flush = () => { + context.debouncedSave.cancel(); + Array.from(_deferred2).forEach((handle) => { + window.cancelIdleCallback(handle); + _deferred2.delete(handle); + }); + Object.values(services).forEach((service) => { + if (service && typeof service.reset === "function") { + service.reset(context); + } + }); + context.changeset = null; + _validator.reset(); + _features.reset(); + _history.reset(); + _uploader.reset(); + context.container().select(".inspector-wrap *").remove(); + return context; + }; + context.projection = geoRawMercator(); + context.curtainProjection = geoRawMercator(); + context.init = () => { + instantiateInternal(); + initializeDependents(); + return context; + function instantiateInternal() { + _history = coreHistory(context); + context.graph = _history.graph; + context.pauseChangeDispatch = _history.pauseChangeDispatch; + context.resumeChangeDispatch = _history.resumeChangeDispatch; + context.perform = withDebouncedSave(_history.perform); + context.replace = withDebouncedSave(_history.replace); + context.pop = withDebouncedSave(_history.pop); + context.overwrite = withDebouncedSave(_history.overwrite); + context.undo = withDebouncedSave(_history.undo); + context.redo = withDebouncedSave(_history.redo); + _validator = coreValidator(context); + _uploader = coreUploader(context); + _background = rendererBackground(context); + _features = rendererFeatures(context); + _map = rendererMap(context); + _photos = rendererPhotos(context); + _ui = uiInit(context); + } + function initializeDependents() { + if (context.initialHashParams.presets) { + _mainPresetIndex.addablePresetIDs(new Set(context.initialHashParams.presets.split(","))); + } + if (context.initialHashParams.locale) { + _mainLocalizer.preferredLocaleCodes(context.initialHashParams.locale); + } + _mainLocalizer.ensureLoaded(); + _mainPresetIndex.ensureLoaded(); + _background.ensureLoaded(); + Object.values(services).forEach((service) => { + if (service && typeof service.init === "function") { + service.init(); + } + }); + _map.init(); + _validator.init(); + _features.init(); + if (services.maprules && context.initialHashParams.maprules) { + json_default(context.initialHashParams.maprules).then((mapcss) => { + services.maprules.init(); + mapcss.forEach((mapcssSelector) => services.maprules.addRule(mapcssSelector)); + }).catch(() => { + }); + } + if (!context.container().empty()) { + _ui.ensureLoaded().then(() => { + _background.init(); + _photos.init(); + }); + } + } + }; + return context; + } + + // modules/services/nominatim.js + var apibase = nominatimApiUrl; + var _inflight = {}; + var _nominatimCache; + var nominatim_default = { + init: function() { + _inflight = {}; + _nominatimCache = new import_rbush7.default(); + }, + reset: function() { + Object.values(_inflight).forEach(function(controller) { + controller.abort(); + }); + _inflight = {}; + _nominatimCache = new import_rbush7.default(); + }, + countryCode: function(location, callback) { + this.reverse(location, function(err, result) { + if (err) { + return callback(err); + } else if (result.address) { + return callback(null, result.address.country_code); + } else { + return callback("Unable to geocode", null); + } + }); + }, + reverse: function(loc, callback) { + var cached = _nominatimCache.search( + { minX: loc[0], minY: loc[1], maxX: loc[0], maxY: loc[1] } + ); + if (cached.length > 0) { + if (callback) + callback(null, cached[0].data); + return; + } + var params = { zoom: 13, format: "json", addressdetails: 1, lat: loc[1], lon: loc[0] }; + var url = apibase + "reverse?" + utilQsString(params); + if (_inflight[url]) + return; + var controller = new AbortController(); + _inflight[url] = controller; + json_default(url, { + signal: controller.signal, + headers: { + "Accept-Language": _mainLocalizer.localeCodes().join(",") + } + }).then(function(result) { + delete _inflight[url]; + if (result && result.error) { + throw new Error(result.error); + } + var extent = geoExtent(loc).padByMeters(200); + _nominatimCache.insert(Object.assign(extent.bbox(), { data: result })); + if (callback) + callback(null, result); + }).catch(function(err) { + delete _inflight[url]; + if (err.name === "AbortError") + return; + if (callback) + callback(err.message); + }); + }, + search: function(val, callback) { + var searchVal = encodeURIComponent(val); + var url = apibase + "search/" + searchVal + "?limit=10&format=json"; + if (_inflight[url]) + return; + var controller = new AbortController(); + _inflight[url] = controller; + json_default(url, { + signal: controller.signal, + headers: { + "Accept-Language": _mainLocalizer.localeCodes().join(",") + } + }).then(function(result) { + delete _inflight[url]; + if (result && result.error) { + throw new Error(result.error); + } + if (callback) + callback(null, result); + }).catch(function(err) { + delete _inflight[url]; + if (err.name === "AbortError") + return; + if (callback) + callback(err.message); + }); + } + }; + + // node_modules/name-suggestion-index/lib/matcher.js + var import_which_polygon4 = __toESM(require_which_polygon(), 1); + + // node_modules/name-suggestion-index/lib/simplify.js + var import_diacritics3 = __toESM(require_diacritics(), 1); + function simplify2(str2) { + if (typeof str2 !== "string") + return ""; + return import_diacritics3.default.remove( + str2.replace(/&/g, "and").replace(/İ/ig, "i").replace(/[\s\-=_!"#%'*{},.\/:;?\(\)\[\]@\\$\^*+<>«»~`’\u00a1\u00a7\u00b6\u00b7\u00bf\u037e\u0387\u055a-\u055f\u0589\u05c0\u05c3\u05c6\u05f3\u05f4\u0609\u060a\u060c\u060d\u061b\u061e\u061f\u066a-\u066d\u06d4\u0700-\u070d\u07f7-\u07f9\u0830-\u083e\u085e\u0964\u0965\u0970\u0af0\u0df4\u0e4f\u0e5a\u0e5b\u0f04-\u0f12\u0f14\u0f85\u0fd0-\u0fd4\u0fd9\u0fda\u104a-\u104f\u10fb\u1360-\u1368\u166d\u166e\u16eb-\u16ed\u1735\u1736\u17d4-\u17d6\u17d8-\u17da\u1800-\u1805\u1807-\u180a\u1944\u1945\u1a1e\u1a1f\u1aa0-\u1aa6\u1aa8-\u1aad\u1b5a-\u1b60\u1bfc-\u1bff\u1c3b-\u1c3f\u1c7e\u1c7f\u1cc0-\u1cc7\u1cd3\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() + ); + } + + // node_modules/name-suggestion-index/config/matchGroups.json + var matchGroups_default = { + matchGroups: { + adult_gaming_centre: [ + "amenity/casino", + "amenity/gambling", + "leisure/adult_gaming_centre" + ], + beauty: [ + "shop/beauty", + "shop/hairdresser_supply" + ], + bed: [ + "shop/bed", + "shop/furniture" + ], + beverages: [ + "shop/alcohol", + "shop/beer", + "shop/beverages", + "shop/kiosk", + "shop/wine" + ], + camping: [ + "tourism/camp_site", + "tourism/caravan_site" + ], + car_parts: [ + "shop/car_parts", + "shop/car_repair", + "shop/tires", + "shop/tyres" + ], + clinic: [ + "amenity/clinic", + "amenity/doctors", + "healthcare/clinic", + "healthcare/laboratory", + "healthcare/physiotherapist", + "healthcare/sample_collection", + "healthcare/dialysis" + ], + convenience: [ + "shop/beauty", + "shop/chemist", + "shop/convenience", + "shop/cosmetics", + "shop/grocery", + "shop/kiosk", + "shop/newsagent", + "shop/perfumery" + ], + coworking: [ + "amenity/coworking_space", + "office/coworking", + "office/coworking_space" + ], + dentist: [ + "amenity/dentist", + "amenity/doctors", + "healthcare/dentist" + ], + electronics: [ + "office/telecommunication", + "shop/computer", + "shop/electronics", + "shop/hifi", + "shop/kiosk", + "shop/mobile", + "shop/mobile_phone", + "shop/telecommunication" + ], + fabric: [ + "shop/fabric", + "shop/haberdashery", + "shop/sewing" + ], + fashion: [ + "shop/accessories", + "shop/bag", + "shop/boutique", + "shop/clothes", + "shop/department_store", + "shop/fashion", + "shop/fashion_accessories", + "shop/sports", + "shop/shoes" + ], + financial: [ + "amenity/bank", + "office/accountant", + "office/financial", + "office/financial_advisor", + "office/tax_advisor", + "shop/tax" + ], + fitness: [ + "leisure/fitness_centre", + "leisure/fitness_center", + "leisure/sports_centre", + "leisure/sports_center" + ], + food: [ + "amenity/bar", + "amenity/cafe", + "amenity/fast_food", + "amenity/ice_cream", + "amenity/pub", + "amenity/restaurant", + "shop/bakery", + "shop/candy", + "shop/chocolate", + "shop/coffee", + "shop/confectionary", + "shop/confectionery", + "shop/food", + "shop/kiosk", + "shop/ice_cream", + "shop/pastry", + "shop/tea" + ], + fuel: [ + "amenity/fuel", + "shop/gas", + "shop/convenience;gas", + "shop/gas;convenience" + ], + gift: [ + "shop/gift", + "shop/card", + "shop/cards", + "shop/kiosk", + "shop/stationery" + ], + hardware: [ + "shop/bathroom_furnishing", + "shop/carpet", + "shop/diy", + "shop/doityourself", + "shop/doors", + "shop/electrical", + "shop/flooring", + "shop/hardware", + "shop/hardware_store", + "shop/power_tools", + "shop/tool_hire", + "shop/tools", + "shop/trade" + ], + health_food: [ + "shop/health", + "shop/health_food", + "shop/herbalist", + "shop/nutrition_supplements" + ], + hobby: [ + "shop/electronics", + "shop/hobby", + "shop/books", + "shop/games", + "shop/collector", + "shop/toys", + "shop/model", + "shop/video_games", + "shop/anime" + ], + hospital: [ + "amenity/doctors", + "amenity/hospital", + "healthcare/hospital" + ], + houseware: [ + "shop/houseware", + "shop/interior_decoration" + ], + lifeboat_station: [ + "amenity/lifeboat_station", + "emergency/lifeboat_station", + "emergency/marine_rescue" + ], + lodging: [ + "tourism/hotel", + "tourism/motel" + ], + money_transfer: [ + "amenity/money_transfer", + "shop/money_transfer" + ], + office_supplies: [ + "shop/office_supplies", + "shop/stationary", + "shop/stationery" + ], + outdoor: [ + "shop/clothes", + "shop/outdoor", + "shop/sports" + ], + parcel_locker: [ + "amenity/parcel_locker", + "amenity/vending_machine" + ], + pharmacy: [ + "amenity/doctors", + "amenity/pharmacy", + "healthcare/pharmacy" + ], + playground: [ + "amenity/theme_park", + "leisure/amusement_arcade", + "leisure/playground" + ], + rental: [ + "amenity/bicycle_rental", + "amenity/boat_rental", + "amenity/car_rental", + "amenity/truck_rental", + "amenity/vehicle_rental", + "shop/kiosk", + "shop/rental" + ], + school: [ + "amenity/childcare", + "amenity/college", + "amenity/kindergarten", + "amenity/language_school", + "amenity/prep_school", + "amenity/school", + "amenity/university" + ], + storage: [ + "shop/storage_units", + "shop/storage_rental" + ], + substation: [ + "power/station", + "power/substation", + "power/sub_station" + ], + supermarket: [ + "shop/food", + "shop/frozen_food", + "shop/greengrocer", + "shop/grocery", + "shop/supermarket", + "shop/wholesale" + ], + variety_store: [ + "shop/variety_store", + "shop/discount", + "shop/convenience" + ], + vending: [ + "amenity/vending_machine", + "shop/kiosk", + "shop/vending_machine" + ], + weight_loss: [ + "amenity/clinic", + "amenity/doctors", + "amenity/weight_clinic", + "healthcare/counselling", + "leisure/fitness_centre", + "office/therapist", + "shop/beauty", + "shop/diet", + "shop/food", + "shop/health_food", + "shop/herbalist", + "shop/nutrition", + "shop/nutrition_supplements", + "shop/weight_loss" + ], + wholesale: [ + "shop/wholesale", + "shop/supermarket", + "shop/department_store" + ] + } + }; + + // node_modules/name-suggestion-index/config/genericWords.json + var genericWords_default = { + genericWords: [ + "^(barn|bazaa?r|bench|bou?tique|building|casa|church)$", + "^(baseball|basketball|football|soccer|softball|tennis(halle)?)\\s?(field|court)?$", + "^(club|green|out|ware)\\s?house$", + "^(driveway|el \xE1rbol|fountain|generic|golf|government|graveyard)$", + "^(fixme|n\\s?\\/?\\s?a|name|no\\s?name|none|null|temporary|test|unknown)$", + "^(hofladen|librairie|magazine?|maison)$", + "^(mobile home|skate)?\\s?park$", + "^(obuwie|pond|pool|sale|shops?|sklep|stores?)$", + "^\\?+$", + "^private$", + "^tattoo( studio)?$", + "^windmill$", + "^\u0446\u0435\u0440\u043A\u043E\u0432\u043D\u0430\u044F( \u043B\u0430\u0432\u043A\u0430)?$" + ] + }; + + // node_modules/name-suggestion-index/config/trees.json + var trees_default = { + trees: { + brands: { + emoji: "\u{1F354}", + mainTag: "brand:wikidata", + sourceTags: ["brand", "name"], + nameTags: { + primary: "^(name|name:\\w+)$", + alternate: "^(brand|brand:\\w+|operator|operator:\\w+|\\w+_name|\\w+_name:\\w+)$" + } + }, + flags: { + emoji: "\u{1F6A9}", + mainTag: "flag:wikidata", + nameTags: { + primary: "^(flag:name|flag:name:\\w+)$", + alternate: "^(country|country:\\w+|flag|flag:\\w+|subject|subject:\\w+)$" + } + }, + operators: { + emoji: "\u{1F4BC}", + mainTag: "operator:wikidata", + sourceTags: ["operator"], + nameTags: { + primary: "^(name|name:\\w+|operator|operator:\\w+)$", + alternate: "^(brand|brand:\\w+|\\w+_name|\\w+_name:\\w+)$" + } + }, + transit: { + emoji: "\u{1F687}", + mainTag: "network:wikidata", + sourceTags: ["network"], + nameTags: { + primary: "^network$", + alternate: "^(operator|operator:\\w+|network:\\w+|\\w+_name|\\w+_name:\\w+)$" + } + } + } + }; + + // node_modules/name-suggestion-index/lib/matcher.js + var matchGroups = matchGroups_default.matchGroups; + var trees = trees_default.trees; + var Matcher = class { + // + // `constructor` + // initialize the genericWords regexes + constructor() { + this.matchIndex = void 0; + this.genericWords = /* @__PURE__ */ new Map(); + (genericWords_default.genericWords || []).forEach((s) => this.genericWords.set(s, new RegExp(s, "i"))); + this.itemLocation = void 0; + this.locationSets = void 0; + this.locationIndex = void 0; + this.warnings = []; + } + // + // `buildMatchIndex()` + // Call this to prepare the matcher for use + // + // `data` needs to be an Object indexed on a 'tree/key/value' path. + // (e.g. cache filled by `fileTree.read` or data found in `dist/nsi.json`) + // { + // 'brands/amenity/bank': { properties: {}, items: [ {}, {}, … ] }, + // 'brands/amenity/bar': { properties: {}, items: [ {}, {}, … ] }, + // … + // } + // + buildMatchIndex(data) { + const that = this; + if (that.matchIndex) + return; + that.matchIndex = /* @__PURE__ */ new Map(); + const seenTree = /* @__PURE__ */ new Map(); + Object.keys(data).forEach((tkv) => { + const category = data[tkv]; + const parts = tkv.split("/", 3); + const t = parts[0]; + const k = parts[1]; + const v = parts[2]; + const thiskv = `${k}/${v}`; + const tree = trees[t]; + let branch = that.matchIndex.get(thiskv); + if (!branch) { + branch = { + primary: /* @__PURE__ */ new Map(), + alternate: /* @__PURE__ */ new Map(), + excludeGeneric: /* @__PURE__ */ new Map(), + excludeNamed: /* @__PURE__ */ new Map() + }; + that.matchIndex.set(thiskv, branch); + } + const properties = category.properties || {}; + const exclude = properties.exclude || {}; + (exclude.generic || []).forEach((s) => branch.excludeGeneric.set(s, new RegExp(s, "i"))); + (exclude.named || []).forEach((s) => branch.excludeNamed.set(s, new RegExp(s, "i"))); + const excludeRegexes = [...branch.excludeGeneric.values(), ...branch.excludeNamed.values()]; + let items = category.items; + if (!Array.isArray(items) || !items.length) + return; + const primaryName = new RegExp(tree.nameTags.primary, "i"); + const alternateName = new RegExp(tree.nameTags.alternate, "i"); + const notName = /:(colou?r|type|forward|backward|left|right|etymology|pronunciation|wikipedia)$/i; + const skipGenericKV = skipGenericKVMatches(t, k, v); + const genericKV = /* @__PURE__ */ new Set([`${k}/yes`, `building/yes`]); + const matchGroupKV = /* @__PURE__ */ new Set(); + Object.values(matchGroups).forEach((matchGroup) => { + const inGroup = matchGroup.some((otherkv) => otherkv === thiskv); + if (!inGroup) + return; + matchGroup.forEach((otherkv) => { + if (otherkv === thiskv) + return; + matchGroupKV.add(otherkv); + const otherk = otherkv.split("/", 2)[0]; + genericKV.add(`${otherk}/yes`); + }); + }); + items.forEach((item) => { + if (!item.id) + return; + if (Array.isArray(item.matchTags) && item.matchTags.length) { + item.matchTags = item.matchTags.filter((matchTag) => !matchGroupKV.has(matchTag) && !genericKV.has(matchTag)); + if (!item.matchTags.length) + delete item.matchTags; + } + let kvTags = [`${thiskv}`].concat(item.matchTags || []); + if (!skipGenericKV) { + kvTags = kvTags.concat(Array.from(genericKV)); + } + Object.keys(item.tags).forEach((osmkey) => { + if (notName.test(osmkey)) + return; + const osmvalue = item.tags[osmkey]; + if (!osmvalue || excludeRegexes.some((regex) => regex.test(osmvalue))) + return; + if (primaryName.test(osmkey)) { + kvTags.forEach((kv) => insertName("primary", t, kv, simplify2(osmvalue), item.id)); + } else if (alternateName.test(osmkey)) { + kvTags.forEach((kv) => insertName("alternate", t, kv, simplify2(osmvalue), item.id)); + } + }); + let keepMatchNames = /* @__PURE__ */ new Set(); + (item.matchNames || []).forEach((matchName) => { + const nsimple = simplify2(matchName); + kvTags.forEach((kv) => { + const branch2 = that.matchIndex.get(kv); + const primaryLeaf = branch2 && branch2.primary.get(nsimple); + const alternateLeaf = branch2 && branch2.alternate.get(nsimple); + const inPrimary = primaryLeaf && primaryLeaf.has(item.id); + const inAlternate = alternateLeaf && alternateLeaf.has(item.id); + if (!inPrimary && !inAlternate) { + insertName("alternate", t, kv, nsimple, item.id); + keepMatchNames.add(matchName); + } + }); + }); + if (keepMatchNames.size) { + item.matchNames = Array.from(keepMatchNames); + } else { + delete item.matchNames; + } + }); + }); + function insertName(which, t, kv, nsimple, itemID) { + if (!nsimple) { + that.warnings.push(`Warning: skipping empty ${which} name for item ${t}/${kv}: ${itemID}`); + return; + } + let branch = that.matchIndex.get(kv); + if (!branch) { + branch = { + primary: /* @__PURE__ */ new Map(), + alternate: /* @__PURE__ */ new Map(), + excludeGeneric: /* @__PURE__ */ new Map(), + excludeNamed: /* @__PURE__ */ new Map() + }; + that.matchIndex.set(kv, branch); + } + let leaf = branch[which].get(nsimple); + if (!leaf) { + leaf = /* @__PURE__ */ new Set(); + branch[which].set(nsimple, leaf); + } + leaf.add(itemID); + if (!/yes$/.test(kv)) { + const kvnsimple = `${kv}/${nsimple}`; + const existing = seenTree.get(kvnsimple); + if (existing && existing !== t) { + const items = Array.from(leaf); + that.warnings.push(`Duplicate cache key "${kvnsimple}" in trees "${t}" and "${existing}", check items: ${items}`); + return; + } + seenTree.set(kvnsimple, t); + } + } + function skipGenericKVMatches(t, k, v) { + return t === "flags" || t === "transit" || k === "landuse" || v === "atm" || v === "bicycle_parking" || v === "car_sharing" || v === "caravan_site" || v === "charging_station" || v === "dog_park" || v === "parking" || v === "phone" || v === "playground" || v === "post_box" || v === "public_bookcase" || v === "recycling" || v === "vending_machine"; + } + } + // + // `buildLocationIndex()` + // Call this to prepare a which-polygon location index. + // This *resolves* all the locationSets into GeoJSON, which takes some time. + // You can skip this step if you don't care about matching within a location. + // + // `data` needs to be an Object indexed on a 'tree/key/value' path. + // (e.g. cache filled by `fileTree.read` or data found in `dist/nsi.json`) + // { + // 'brands/amenity/bank': { properties: {}, items: [ {}, {}, … ] }, + // 'brands/amenity/bar': { properties: {}, items: [ {}, {}, … ] }, + // … + // } + // + buildLocationIndex(data, loco) { + const that = this; + if (that.locationIndex) + return; + that.itemLocation = /* @__PURE__ */ new Map(); + that.locationSets = /* @__PURE__ */ new Map(); + Object.keys(data).forEach((tkv) => { + const items = data[tkv].items; + if (!Array.isArray(items) || !items.length) + return; + items.forEach((item) => { + if (that.itemLocation.has(item.id)) + return; + let resolved; + try { + resolved = loco.resolveLocationSet(item.locationSet); + } catch (err) { + console.warn(`buildLocationIndex: ${err.message}`); + } + if (!resolved || !resolved.id) + return; + that.itemLocation.set(item.id, resolved.id); + if (that.locationSets.has(resolved.id)) + return; + let feature3 = _cloneDeep2(resolved.feature); + feature3.id = resolved.id; + feature3.properties.id = resolved.id; + if (!feature3.geometry.coordinates.length || !feature3.properties.area) { + console.warn(`buildLocationIndex: locationSet ${resolved.id} for ${item.id} resolves to an empty feature:`); + console.warn(JSON.stringify(feature3)); + return; } + that.locationSets.set(resolved.id, feature3); + }); + }); + that.locationIndex = (0, import_which_polygon4.default)({ type: "FeatureCollection", features: [...that.locationSets.values()] }); + function _cloneDeep2(obj) { + return JSON.parse(JSON.stringify(obj)); + } + } + // + // `match()` + // Pass parts and return an Array of matches. + // `k` - key + // `v` - value + // `n` - namelike + // `loc` - optional - [lon,lat] location to search + // + // 1. If the [k,v,n] tuple matches a canonical item… + // Return an Array of match results. + // Each result will include the area in km² that the item is valid. + // + // Order of results: + // Primary ordering will be on the "match" column: + // "primary" - where the query matches the `name` tag, followed by + // "alternate" - where the query matches an alternate name tag (e.g. short_name, brand, operator, etc) + // Secondary ordering will be on the "area" column: + // "area descending" if no location was provided, (worldwide before local) + // "area ascending" if location was provided (local before worldwide) + // + // [ + // { match: 'primary', itemID: String, area: Number, kv: String, nsimple: String }, + // { match: 'primary', itemID: String, area: Number, kv: String, nsimple: String }, + // { match: 'alternate', itemID: String, area: Number, kv: String, nsimple: String }, + // { match: 'alternate', itemID: String, area: Number, kv: String, nsimple: String }, + // … + // ] + // + // -or- + // + // 2. If the [k,v,n] tuple matches an exclude pattern… + // Return an Array with a single exclude result, either + // + // [ { match: 'excludeGeneric', pattern: String, kv: String } ] // "generic" e.g. "Food Court" + // or + // [ { match: 'excludeNamed', pattern: String, kv: String } ] // "named", e.g. "Kebabai" + // + // About results + // "generic" - a generic word that is probably not really a name. + // For these, iD should warn the user "Hey don't put 'food court' in the name tag". + // "named" - a real name like "Kebabai" that is just common, but not a brand. + // 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. + // + // -or- + // + // 3. If the [k,v,n] tuple matches nothing of any kind, return `null` + // + // + match(k, v, n2, loc) { + const that = this; + if (!that.matchIndex) { + throw new Error("match: matchIndex not built."); + } + let matchLocations; + if (Array.isArray(loc) && that.locationIndex) { + matchLocations = that.locationIndex([loc[0], loc[1], loc[0], loc[1]], true); + } + const nsimple = simplify2(n2); + let seen = /* @__PURE__ */ new Set(); + let results = []; + gatherResults("primary"); + gatherResults("alternate"); + if (results.length) + return results; + gatherResults("exclude"); + return results.length ? results : null; + function gatherResults(which) { + const kv = `${k}/${v}`; + let didMatch = tryMatch(which, kv); + if (didMatch) return; - } else { - _history.merge(result.data, result.extent); - if (typeof callback === "function") { - callback(err, result); + for (let mg in matchGroups) { + const matchGroup = matchGroups[mg]; + const inGroup = matchGroup.some((otherkv) => otherkv === kv); + if (!inGroup) + continue; + for (let i2 = 0; i2 < matchGroup.length; i2++) { + const otherkv = matchGroup[i2]; + if (otherkv === kv) + continue; + didMatch = tryMatch(which, otherkv); + if (didMatch) + return; } - return; - } - }; - } - context.loadTiles = (projection2, callback) => { - const handle = window.requestIdleCallback(() => { - _deferred2.delete(handle); - if (_connection && context.editableDataEnabled()) { - const cid = _connection.getConnectionId(); - _connection.loadTiles(projection2, afterLoad(cid, callback)); } - }); - _deferred2.add(handle); - }; - context.loadTileAtLoc = (loc, callback) => { - const handle = window.requestIdleCallback(() => { - _deferred2.delete(handle); - if (_connection && context.editableDataEnabled()) { - const cid = _connection.getConnectionId(); - _connection.loadTileAtLoc(loc, afterLoad(cid, callback)); + if (which === "exclude") { + const regex = [...that.genericWords.values()].find((regex2) => regex2.test(n2)); + if (regex) { + results.push({ match: "excludeGeneric", pattern: String(regex) }); + return; + } } - }); - _deferred2.add(handle); - }; - context.loadEntity = (entityID, callback) => { - if (_connection) { - const cid = _connection.getConnectionId(); - _connection.loadEntity(entityID, afterLoad(cid, callback)); - _connection.loadEntityRelations(entityID, afterLoad(cid, callback)); } - }; - context.zoomToEntity = (entityID, zoomTo) => { - context.loadEntity(entityID, (err, result) => { - if (err) + function tryMatch(which, kv) { + const branch = that.matchIndex.get(kv); + if (!branch) return; - if (zoomTo !== false) { - const entity = result.data.find((e) => e.id === entityID); - if (entity) { - _map.zoomTo(entity); + if (which === "exclude") { + let regex = [...branch.excludeNamed.values()].find((regex2) => regex2.test(n2)); + if (regex) { + results.push({ match: "excludeNamed", pattern: String(regex), kv }); + return; + } + regex = [...branch.excludeGeneric.values()].find((regex2) => regex2.test(n2)); + if (regex) { + results.push({ match: "excludeGeneric", pattern: String(regex), kv }); + return; } - } - }); - _map.on("drawn.zoomToEntity", () => { - if (!context.hasEntity(entityID)) return; - _map.on("drawn.zoomToEntity", null); - context.on("enter.zoomToEntity", null); - context.enter(modeSelect(context, [entityID])); - }); - context.on("enter.zoomToEntity", () => { - if (_mode.id !== "browse") { - _map.on("drawn.zoomToEntity", null); - context.on("enter.zoomToEntity", null); } - }); - }; - let _minEditableZoom = 16; - context.minEditableZoom = function(val) { - if (!arguments.length) - return _minEditableZoom; - _minEditableZoom = val; - if (_connection) { - _connection.tileZoom(val); - } - return context; - }; - context.maxCharsForTagKey = () => 255; - context.maxCharsForTagValue = () => 255; - context.maxCharsForRelationRole = () => 255; - context.cleanTagKey = (val) => utilCleanOsmString(val, context.maxCharsForTagKey()); - context.cleanTagValue = (val) => utilCleanOsmString(val, context.maxCharsForTagValue()); - context.cleanRelationRole = (val) => utilCleanOsmString(val, context.maxCharsForRelationRole()); - let _inIntro = false; - context.inIntro = function(val) { - if (!arguments.length) - return _inIntro; - _inIntro = val; - return context; - }; - context.save = () => { - if (_inIntro || context.container().select(".modal").size()) - return; - let canSave; - if (_mode && _mode.id === "save") { - canSave = false; - if (services.osm && services.osm.isChangesetInflight()) { - _history.clearSaved(); + const leaf = branch[which].get(nsimple); + if (!leaf || !leaf.size) return; - } - } else { - canSave = context.selectedIDs().every((id2) => { - const entity = context.hasEntity(id2); - return entity && !entity.isDegenerate(); + let hits = Array.from(leaf).map((itemID) => { + let area = Infinity; + if (that.itemLocation && that.locationSets) { + const location = that.locationSets.get(that.itemLocation.get(itemID)); + area = location && location.properties.area || Infinity; + } + return { match: which, itemID, area, kv, nsimple }; }); - } - if (canSave) { - _history.save(); - } - if (_history.hasChanges()) { - return _t("save.unsaved_changes"); - } - }; - context.debouncedSave = debounce_default(context.save, 350); - function withDebouncedSave(fn) { - return function() { - const result = fn.apply(_history, arguments); - context.debouncedSave(); - return result; - }; - } - context.hasEntity = (id2) => _history.graph().hasEntity(id2); - context.entity = (id2) => _history.graph().entity(id2); - let _mode; - context.mode = () => _mode; - context.enter = (newMode) => { - if (_mode) { - _mode.exit(); - dispatch10.call("exit", this, _mode); - } - _mode = newMode; - _mode.enter(); - dispatch10.call("enter", this, _mode); - }; - context.selectedIDs = () => _mode && _mode.selectedIDs && _mode.selectedIDs() || []; - context.activeID = () => _mode && _mode.activeID && _mode.activeID(); - let _selectedNoteID; - context.selectedNoteID = function(noteID) { - if (!arguments.length) - return _selectedNoteID; - _selectedNoteID = noteID; - return context; - }; - let _selectedErrorID; - context.selectedErrorID = function(errorID) { - if (!arguments.length) - return _selectedErrorID; - _selectedErrorID = errorID; - return context; - }; - context.install = (behavior) => context.surface().call(behavior); - context.uninstall = (behavior) => context.surface().call(behavior.off); - let _copyGraph; - context.copyGraph = () => _copyGraph; - let _copyIDs = []; - context.copyIDs = function(val) { - if (!arguments.length) - return _copyIDs; - _copyIDs = val; - _copyGraph = _history.graph(); - return context; - }; - let _copyLonLat; - context.copyLonLat = function(val) { - if (!arguments.length) - return _copyLonLat; - _copyLonLat = val; - return context; - }; - let _background; - context.background = () => _background; - let _features; - context.features = () => _features; - context.hasHiddenConnections = (id2) => { - const graph = _history.graph(); - const entity = graph.entity(id2); - return _features.hasHiddenConnections(entity, graph); - }; - let _photos; - context.photos = () => _photos; - let _map; - context.map = () => _map; - context.layers = () => _map.layers(); - context.surface = () => _map.surface; - context.editableDataEnabled = () => _map.editableDataEnabled(); - context.surfaceRect = () => _map.surface.node().getBoundingClientRect(); - context.editable = () => { - const mode = context.mode(); - if (!mode || mode.id === "save") - return false; - return _map.editableDataEnabled(); - }; - let _debugFlags = { - tile: false, - // tile boundaries - collision: false, - // label collision bounding boxes - imagery: false, - // imagery bounding polygons - target: false, - // touch targets - downloaded: false - // downloaded data from osm - }; - context.debugFlags = () => _debugFlags; - context.getDebug = (flag) => flag && _debugFlags[flag]; - context.setDebug = function(flag, val) { - if (arguments.length === 1) - val = true; - _debugFlags[flag] = val; - dispatch10.call("change"); - return context; - }; - let _container = select_default2(null); - context.container = function(val) { - if (!arguments.length) - return _container; - _container = val; - _container.classed("ideditor", true); - return context; - }; - context.containerNode = function(val) { - if (!arguments.length) - return context.container().node(); - context.container(select_default2(val)); - return context; - }; - let _embed; - context.embed = function(val) { - if (!arguments.length) - return _embed; - _embed = val; - return context; - }; - let _assetPath = ""; - context.assetPath = function(val) { - if (!arguments.length) - return _assetPath; - _assetPath = val; - _mainFileFetcher.assetPath(val); - return context; - }; - let _assetMap = {}; - context.assetMap = function(val) { - if (!arguments.length) - return _assetMap; - _assetMap = val; - _mainFileFetcher.assetMap(val); - return context; - }; - context.asset = (val) => { - if (/^http(s)?:\/\//i.test(val)) - return val; - const filename = _assetPath + val; - return _assetMap[filename] || filename; - }; - context.imagePath = (val) => context.asset(`img/${val}`); - context.reset = context.flush = () => { - context.debouncedSave.cancel(); - Array.from(_deferred2).forEach((handle) => { - window.cancelIdleCallback(handle); - _deferred2.delete(handle); - }); - Object.values(services).forEach((service) => { - if (service && typeof service.reset === "function") { - service.reset(context); - } - }); - context.changeset = null; - _validator.reset(); - _features.reset(); - _history.reset(); - _uploader.reset(); - context.container().select(".inspector-wrap *").remove(); - return context; - }; - context.projection = geoRawMercator(); - context.curtainProjection = geoRawMercator(); - context.init = () => { - instantiateInternal(); - initializeDependents(); - return context; - function instantiateInternal() { - _history = coreHistory(context); - context.graph = _history.graph; - context.pauseChangeDispatch = _history.pauseChangeDispatch; - context.resumeChangeDispatch = _history.resumeChangeDispatch; - context.perform = withDebouncedSave(_history.perform); - context.replace = withDebouncedSave(_history.replace); - context.pop = withDebouncedSave(_history.pop); - context.overwrite = withDebouncedSave(_history.overwrite); - context.undo = withDebouncedSave(_history.undo); - context.redo = withDebouncedSave(_history.redo); - _validator = coreValidator(context); - _uploader = coreUploader(context); - _background = rendererBackground(context); - _features = rendererFeatures(context); - _map = rendererMap(context); - _photos = rendererPhotos(context); - _ui = uiInit(context); - } - function initializeDependents() { - if (context.initialHashParams.presets) { - _mainPresetIndex.addablePresetIDs(new Set(context.initialHashParams.presets.split(","))); - } - if (context.initialHashParams.locale) { - _mainLocalizer.preferredLocaleCodes(context.initialHashParams.locale); + let sortFn = byAreaDescending; + if (matchLocations) { + hits = hits.filter(isValidLocation); + sortFn = byAreaAscending; } - _mainLocalizer.ensureLoaded(); - _mainPresetIndex.ensureLoaded(); - _background.ensureLoaded(); - Object.values(services).forEach((service) => { - if (service && typeof service.init === "function") { - service.init(); - } + if (!hits.length) + return; + hits.sort(sortFn).forEach((hit) => { + if (seen.has(hit.itemID)) + return; + seen.add(hit.itemID); + results.push(hit); }); - _map.init(); - _validator.init(); - _features.init(); - if (services.maprules && context.initialHashParams.maprules) { - json_default(context.initialHashParams.maprules).then((mapcss) => { - services.maprules.init(); - mapcss.forEach((mapcssSelector) => services.maprules.addRule(mapcssSelector)); - }).catch(() => { - }); + return true; + function isValidLocation(hit) { + if (!that.itemLocation) + return true; + return matchLocations.find((props) => props.id === that.itemLocation.get(hit.itemID)); } - if (!context.container().empty()) { - _ui.ensureLoaded().then(() => { - _background.init(); - _photos.init(); - }); + function byAreaAscending(hitA, hitB) { + return hitA.area - hitB.area; + } + function byAreaDescending(hitA, hitB) { + return hitB.area - hitA.area; } } - }; - return context; - } + } + // + // `getWarnings()` + // Return any warnings discovered when buiding the index. + // (currently this does nothing) + // + getWarnings() { + return this.warnings; + } + }; // modules/services/nsi.js + var import_vparse2 = __toESM(require_vparse()); var _nsiStatus = "loading"; var _nsi = {}; var buildingPreset = { @@ -72469,14 +74074,21 @@ ${content} response_type: "code", scope: o.scope }); - if (!o.singlepage) { + if (o.singlepage) { + var params = utilStringQs2(window.location.search.slice(1)); + if (params.code) { + getAccessToken(params.code); + } else { + window.location = url; + } + } else { var w = 600; var h = 550; var settings = [ ["width", w], ["height", h], - ["left", screen.width / 2 - w / 2], - ["top", screen.height / 2 - h / 2] + ["left", window.screen.width / 2 - w / 2], + ["top", window.screen.height / 2 - h / 2] ].map(function(x) { return x.join("="); }).join(","); @@ -72490,8 +74102,8 @@ ${content} } } window.authComplete = function(url2) { - var params = utilStringQs2(url2.split("?")[1]); - getAccessToken(params.code); + var params2 = utilStringQs2(url2.split("?")[1]); + getAccessToken(params2.code); delete window.authComplete; }; function getAccessToken(auth_code) { @@ -72551,6 +74163,42 @@ ${content} } getAccessToken(auth_code); }; + oauth2.fetch = function(path, options2, callback) { + if (oauth2.authenticated()) { + return run(); + } else { + if (o.auto) { + oauth2.authenticate(run); + return; + } else { + callback("not authenticated", null); + return; + } + } + function run() { + var url = options2.prefix !== false ? o.url + path : path; + var headers = options2.headers || { "Content-Type": "application/x-www-form-urlencoded" }; + headers.Authorization = "Bearer " + token("oauth2_access_token"); + return fetch(url, { + method: options2.method, + body: options2.body, + headers + }).then((resp) => { + var contentType = resp.headers.get("content-type").split(";")[0]; + switch (contentType) { + case "text/html": + case "text/xml": + return resp.text().then( + (txt) => new window.DOMParser().parseFromString(txt, contentType) + ); + case "application/html": + return resp.json(); + default: + return resp.text(); + } + }); + } + }; oauth2.xhr = function(options2, callback) { if (oauth2.authenticated()) { return run(); @@ -75037,7 +76685,7 @@ ${content} label.append("span").call(_t.append("streetside.hires")); let captureInfo = line1.append("div").attr("class", "attribution-capture-info"); if (d.captured_by) { - const yyyy = new Date().getFullYear(); + const yyyy = (/* @__PURE__ */ new Date()).getFullYear(); captureInfo.append("a").attr("class", "captured_by").attr("target", "_blank").attr("href", "https://www.microsoft.com/en-us/maps/streetside").text("\xA9" + yyyy + " Microsoft"); captureInfo.append("span").text("|"); } @@ -75053,7 +76701,7 @@ ${content} bubbleIdQuadKey = "0" + bubbleIdQuadKey; } const imgUrlPrefix = streetsideImagesApi + "hs" + bubbleIdQuadKey; - const imgUrlSuffix = ".jpg?g=6338&n=z"; + const imgUrlSuffix = ".jpg?g=13515&n=z"; const faceKeys = ["01", "02", "03", "10", "11", "12"]; let quadKeys = getQuadKeys(); let faces = faceKeys.map((faceKey) => { @@ -75382,8 +77030,7 @@ ${content} if (err) { callback(err); } else { - var re2 = /network|taxon|genus|species|brand|grape_variety|royal_cypher|listed_status|booth|rating|stars|:output|_hours|_times|_ref|manufacturer|country|target|brewery|cai_scale/; - var allowUpperCase = re2.test(params.key); + var allowUpperCase = allowUpperCaseTagValues.test(params.key); var f2 = filterValues(allowUpperCase); var result = d.data.filter(f2).map(valKeyDescription); _taginfoCache[url] = result; @@ -75619,7 +77266,7 @@ ${content} _wikidataCache = {}; }, // Search for Wikidata items matching the query - itemsForSearchQuery: function(query, callback) { + itemsForSearchQuery: function(query, callback, language) { if (!query) { if (callback) callback("No query", {}); @@ -75633,15 +77280,20 @@ ${content} search: query, type: "item", // the language to search - language: lang, + language: language || lang, // the language for the label and description in the result uselang: lang, limit: 10, origin: "*" }); - json_default(url).then(function(result) { + json_default(url).then((result) => { if (result && result.error) { - throw new Error(result.error); + if (result.error.code === "badvalue" && result.error.info.includes(lang) && !language && lang.includes("-")) { + this.itemsForSearchQuery(query, callback, lang.split("-")[0]); + return; + } else { + throw new Error(result.error); + } } if (callback) callback(null, result.search || {}); @@ -76190,7 +77842,12 @@ ${content} } } else { _lastMouseEvent = d3_event; - _lastInteractionType = "rightclick"; + if (d3_event.pointerType === "touch" || d3_event.pointerType === "pen" || d3_event.mozInputSource && // firefox doesn't give a pointerType on contextmenu events + (d3_event.mozInputSource === MouseEvent.MOZ_SOURCE_TOUCH || d3_event.mozInputSource === MouseEvent.MOZ_SOURCE_PEN)) { + _lastInteractionType = "touch"; + } else { + _lastInteractionType = "rightclick"; + } } _showMenu = true; click(d3_event, d3_event); @@ -76865,9 +78522,9 @@ ${content} var join = actionJoin(selectedIDs); if (!join.disabled(context.graph())) return join; - var merge3 = actionMerge(selectedIDs); - if (!merge3.disabled(context.graph())) - return merge3; + var merge2 = actionMerge(selectedIDs); + if (!merge2.disabled(context.graph())) + return merge2; var mergePolygon = actionMergePolygon(selectedIDs); if (!mergePolygon.disabled(context.graph())) return mergePolygon; @@ -76876,8 +78533,8 @@ ${content} return mergeNodes; if (join.disabled(context.graph()) !== "not_eligible") return join; - if (merge3.disabled(context.graph()) !== "not_eligible") - return merge3; + if (merge2.disabled(context.graph()) !== "not_eligible") + return merge2; if (mergePolygon.disabled(context.graph()) !== "not_eligible") return mergePolygon; return mergeNodes;