{"version":3,"sources":["jsdelivr-header.js","/npm/get-haversine-distance@1.0.0/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,SAAS,MAAO,GACd,OAAQ,EAAI,KAAK,GAAM,GACzB,CAEA,SAAS,aAAc,GACrB,IAAK,IAAI,EAAI,EAAG,EAAI,EAAK,OAAQ,IAC/B,GAAuB,iBAAZ,EAAK,GACd,OAAO,EAIX,OAAO,CACT,CAEA,MAAM,EAAI,KAGV,SAAS,qBAAsB,EAAS,GAAS,QAAC,GAAU,EAAK,QAAE,EAAU,MAAK,QAAE,EAAU,OAAS,CAAC,GACtG,MAAO,CAAC,GAAU,EAAM,CAAC,GAAU,GAAQ,GACpC,CAAC,GAAU,EAAM,CAAC,GAAU,GAAQ,EAE3C,IAAK,UAAU,EAAM,EAAM,EAAM,GAC/B,MAAM,IAAI,MAAM,yCAGlB,MACM,EAAO,MADF,EAAO,GAGZ,EAAO,MADF,EAAO,GAEZ,EAAI,KAAK,IAAI,EAAO,GAAK,KAAK,IAAI,EAAO,GAC7C,KAAK,IAAI,MAAM,IAAS,KAAK,IAAI,MAAM,IACvC,KAAK,IAAI,EAAO,GAAK,KAAK,IAAI,EAAO,GACjC,EAAI,EAAI,KAAK,MAAM,KAAK,KAAK,GAAI,KAAK,KAAK,EAAI,IACrD,IAAI,EAAI,EAAI,EAIZ,OAFI,IAAS,GAAK,SAEX,CACT,CAEA,OAAO,QAAU","file":"/npm/get-haversine-distance@1.0.0/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/get-haversine-distance@1.0.0/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","function toRad (x) {\n  return (x * Math.PI) / 180\n}\n\nfunction isNumbers (...args) {\n  for (let i = 0; i < args.length; i++) {\n    if (typeof args[i] !== 'number') {\n      return false\n    }\n  }\n\n  return true\n}\n\nconst R = 6371 // km\n\n// Based on: https://stackoverflow.com/a/30316500/7027045\nfunction getHaversineDistance (coords1, coords2, {inMiles = false, latName = 'lat', lngName = 'lng'} = {}) {\n  const {[lngName]: lng1, [latName]: lat1} = coords1\n  const {[lngName]: lng2, [latName]: lat2} = coords2\n\n  if (!isNumbers(lng1, lng2, lat1, lat2)) {\n    throw new Error('Valid numbers not provided for points')\n  }\n\n  const x1 = lat2 - lat1\n  const dLat = toRad(x1)\n  const x2 = lng2 - lng1\n  const dLon = toRad(x2)\n  const a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +\n    Math.cos(toRad(lat1)) * Math.cos(toRad(lat2)) *\n    Math.sin(dLon / 2) * Math.sin(dLon / 2)\n  const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a))\n  let d = R * c\n\n  if (inMiles) d /= 1.60934\n\n  return d\n}\n\nmodule.exports = getHaversineDistance\n"]}