Helper that checks whether an array consists of objects
with lat and lng properties
@param {object} elem the element to check
@returns {boolean} whether or not it's valid
162844
function isValidLatLng(elem) {
    return elem !== null && (typeof elem === 'undefined' ? 'undefined' : _typeof(elem)) === 'object' && elem.hasOwnProperty('lat') && elem.hasOwnProperty('lng');
  }
989108
function (arrArg) {
    return arrArg.filter(function (elem, pos, arr) {
        return arr.indexOf(elem) === pos;
    });
}
210088
static boolean isItemInArray(Object item, Object[] arrayOfValues) {
        if (arrayOfValues == null) {
            return false;
        }

        for (Object value : arrayOfValues) {
            if (Objects.equals(value, item)) {
                return true;
            }
        }
        return false;
    }
504735
function( elems, callback, arg ) {
		var value,
			i = 0,
			length = elems.length,
			isArray = isArraylike( elems ),
			ret = [];

		// Go through the array, translating each of the items to their
		if ( isArray ) {
			for ( ; i < length; i++ ) {
				value = callback( elems[ i ], i, arg );

				if ( value != null ) {
					ret[ ret.length ] = value;
				}
			}

		// Go through every key on the object,
		} else {
			for ( i in elems ) {
				value = callback( elems[ i ], i, arg );

				if ( value != null ) {
					ret[ ret.length ] = value;
				}
			}
		}

		// Flatten any nested arrays
		return core_concat.apply( [], ret );
	}
504185
function locationOf(element, array, start, end) {
  start = start || 0;
  end = end || array.length;
  var pivot = parseInt(start + (end - start) / 2, 10);
  if (end-start <= 1 || array[pivot] === element) return pivot;
  if (array[pivot] < element) {
    return locationOf(element, array, pivot, end);
  } else {
    return locationOf(element, array, start, pivot);
  }
}
996847
function isVisible(elem) {
  return elem && (elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length);
}
1370001
function(elem) {
    var that = this, nodeAW = elem._angularWidth, sumAW = 0;
    elem.eachSubnode(function(child) {
      that.setSubtreeAngularWidth(child);
      sumAW += child._treeAngularWidth;
    }, "ignore");
    elem._treeAngularWidth = Math.max(nodeAW, sumAW);
  }
923445
public static boolean containsAllTrueElements(boolean[] arra,
            boolean[] arrb) {

        for (int i = 0; i < arra.length; i++) {
            if (arrb[i] && !arra[i]) {
                return false;
            }
        }

        return true;
    }
597500
function arrayIncludesAll(arr, searchElms, fromIndex) {
	if (!Array.isArray(arr)) {
		throw new TypeError('Expected the first argument of array-includes-all to be an array, but got ' + appendType(arr) + '.');
	}

	if (!Array.isArray(searchElms)) {
		throw new TypeError('Expected the second argument of array-includes-all to be an array, but got ' + appendType(searchElms) + '.');
	}

	if (searchElms.length === 0) {
		throw new RangeError('Expected the second argument of array-includes-all to include at least one value, but recieved an empty array.');
	}

	if (arr.length === 0) {
		return false;
	}

	return searchElms.every(function checkIfArrIncludesElm(elm) {
		return arr.includes(elm, fromIndex);
	});
}
877494
function( elem ) {
		if ( !elem || typeof elem === "string" ) {
			return jQuery.inArray( this[0],
				// If it receives a string, the selector is used
				// If it receives nothing, the siblings are used
				elem ? jQuery( elem ) : this.parent().children() );
		}
		// Locate the position of the desired element
		return jQuery.inArray(
			// If it receives a jQuery object, the first element is used
			elem.jquery ? elem[0] : elem, this );
	}
1351098
function (elem)
    {
        var result;

        if (!elem) { return null; }

        if (typeof(elem.tree) === "function") {
            elem = elem.tree();
        }

        var nodeName = elem.nodeName;
        var i, child;

        if (elem.getAttribute("_realname")) {
            nodeName = elem.getAttribute("_realname");
        }

        result = "<" + nodeName;
        for (i = 0; i < elem.attributes.length; i++) {
               if(elem.attributes[i].nodeName != "_realname") {
                 result += " " + elem.attributes[i].nodeName +
                "='" + elem.attributes[i].value
                    .replace(/&/g, "&amp;")
                       .replace(/\'/g, "&apos;")
                       .replace(/>/g, "&gt;")
                       .replace(/</g, "&lt;") + "'";
               }
        }

        if (elem.childNodes.length > 0) {
            result += ">";
            for (i = 0; i < elem.childNodes.length; i++) {
                child = elem.childNodes[i];
                switch( child.nodeType ){
                  case Strophe.ElementType.NORMAL:
                    // normal element, so recurse
                    result += Strophe.serialize(child);
                    break;
                  case Strophe.ElementType.TEXT:
                    // text element to escape values
                    result += Strophe.xmlescape(child.nodeValue);
                    break;
                  case Strophe.ElementType.CDATA:
                    // cdata section so don't escape values
                    result += "<![CDATA["+child.nodeValue+"]]>";
                }
            }
            result += "</" + nodeName + ">";
        } else {
            result += "/>";
        }

        return result;
    }
1336221
function Array_includes(searchElement, // @arg Any
                        position) {    // @arg Integer = 0
                                       // @ret Boolean
    position = position || 0;
    var iz = this.length;

    if (iz === 0) {
        return false;
    }

    var i = 0;

    if (position >= 0) {
        i = position;
    } else {
        i = position + iz;
        if (i < 0) {
            i = 0;
        }
    }

    if (searchElement === searchElement) {
        for (; i < iz; ++i) {
            if (this[i] === searchElement) {
                return true;
            }
        }
    } else if (isNaN(searchElement)) {
        for (; i < iz; ++i) {
            if (isNaN(this[i])) {
                return true;
            }
        }
    } else { // maybe Symble, ... etc
        throw TypeError("Unsupported type");
    }
    return false;
}
233626
function contains( element ) {
    for( var i = 0, len = lists.length; i < len; i++ ) {
      if( lists[i].element == element ) {
        return true;
      }
    }
    return false;
  }
631889
function isSea(lat, lng) {
  if (landLookup === null) {
    const map = getMap();
    landLookup = new GeoJsonLookup(map);
  }

  return landLookup.hasContainers({type: 'Point', coordinates: [lng, lat]});
}
1170813
function checkParentsProperty(elem, property, value) {
    while (elem = elem.offsetParent) {
        if (getCss(elem, property) === value) {
            return true;
        }
    }
    return false;
}
767598
function(elem) {

		try {
			// TODO: Fix issue with rotated groups. Currently they work
			// fine in FF, but not in other browsers (same problem mentioned
			// in Issue 339 comment #2).

			var bb = svgedit.utilities.getBBox(elem);
			var angle = svgedit.utilities.getRotationAngle(elem);

			if ((angle && angle % 90) ||
				svgedit.math.hasMatrixTransform(svgedit.transformlist.getTransformList(elem))) {
				// Accurate way to get BBox of rotated element in Firefox:
				// Put element in group and get its BBox
				var good_bb = false;
				// Get the BBox from the raw path for these elements
				var elemNames = ['ellipse', 'path', 'line', 'polyline', 'polygon'];
				if (elemNames.indexOf(elem.tagName) >= 0) {
					bb = good_bb = canvas.convertToPath(elem, true);
				} else if (elem.tagName == 'rect') {
					// Look for radius
					var rx = elem.getAttribute('rx');
					var ry = elem.getAttribute('ry');
					if (rx || ry) {
						bb = good_bb = canvas.convertToPath(elem, true);
					}
				}

				if (!good_bb) {
					// Must use clone else FF freaks out
					var clone = elem.cloneNode(true);
					var g = document.createElementNS(NS.SVG, "g");
					var parent = elem.parentNode;
					parent.appendChild(g);
					g.appendChild(clone);
					bb = svgedit.utilities.bboxToObj(g.getBBox());
					parent.removeChild(g);
				}

				// Old method: Works by giving the rotated BBox,
				// this is (unfortunately) what Opera and Safari do
				// natively when getting the BBox of the parent group
//						var angle = angle * Math.PI / 180.0;
//						var rminx = Number.MAX_VALUE, rminy = Number.MAX_VALUE, 
//							rmaxx = Number.MIN_VALUE, rmaxy = Number.MIN_VALUE;
//						var cx = round(bb.x + bb.width/2),
//							cy = round(bb.y + bb.height/2);
//						var pts = [ [bb.x - cx, bb.y - cy], 
//									[bb.x + bb.width - cx, bb.y - cy],
//									[bb.x + bb.width - cx, bb.y + bb.height - cy],
//									[bb.x - cx, bb.y + bb.height - cy] ];
//						var j = 4;
//						while (j--) {
//							var x = pts[j][0],
//								y = pts[j][1],
//								r = Math.sqrt( x*x + y*y );
//							var theta = Math.atan2(y,x) + angle;
//							x = round(r * Math.cos(theta) + cx);
//							y = round(r * Math.sin(theta) + cy);
//		
//							// now set the bbox for the shape after it's been rotated
//							if (x < rminx) rminx = x;
//							if (y < rminy) rminy = y;
//							if (x > rmaxx) rmaxx = x;
//							if (y > rmaxy) rmaxy = y;
//						}
//						
//						bb.x = rminx;
//						bb.y = rminy;
//						bb.width = rmaxx - rminx;
//						bb.height = rmaxy - rminy;
			}
			return bb;
		} catch(e) {
			console.log(elem, e);
			return null;
		}
	}
166339
function( elems, callback, arg ) {
		var value, key, ret = [],
			i = 0,
			length = elems.length,
			// jquery objects are treated as arrays
			isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ;

		// Go through the array, translating each of the items to their
		if ( isArray ) {
			for ( ; i < length; i++ ) {
				value = callback( elems[ i ], i, arg );

				if ( value != null ) {
					ret[ ret.length ] = value;
				}
			}

		// Go through every key on the object,
		} else {
			for ( key in elems ) {
				value = callback( elems[ key ], key, arg );

				if ( value != null ) {
					ret[ ret.length ] = value;
				}
			}
		}

		// Flatten any nested arrays
		return ret.concat.apply( [], ret );
	}