import r from"@babel/runtime/helpers/slicedToArray";import{isArray as t,get as n}from"lodash";function a(t){if(!t||"string"!=typeof t||t.length<1)return[];if(-1===t.indexOf("N")&&-1===t.indexOf("S")&&-1===t.indexOf("W")&&-1===t.indexOf("E")){var n=t.split(",");return n[0]&&n[1]?(n[0]=parseFloat(n[0]),n[1]=parseFloat(n[1]),n):[]}var a=t.split(/[°'"]+/).join(" ").split(/[^\w\S]+/),e=[],i=[],o=0,u=0;for(var f in a)if(isNaN(a[f])){var l=parseFloat(a[f]),s=a[f];Number.isNaN(l)||(o+=l/Math.pow(60,u),u+=1,s=a[f].replace(l,"")),"S"!==(s=r(s,1)[0])&&"W"!==s||(o*=-1),e[e.length]=s,i[i.length]=o,o=0,u=0}else o+=parseFloat(a[f])/Math.pow(60,u),u+=1;if("W"===e[0]||"E"===e[0]){var h=i[0];i[0]=i[1],i[1]=h}return i}function e(r){return r*Math.PI/180}function i(r,t){var n=e(r[0]),a=e(t[0]),i=e(t[0]-r[0]),o=e(t[1]-r[1]),u=Math.sin(i/2)*Math.sin(i/2)+Math.cos(n)*Math.cos(a)*Math.sin(o/2)*Math.sin(o/2);return 6371e3*(2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u)))/1609.34}function o(r){var n=!0;return t(r)&&2===r.length?r.forEach((function(r){Number.isFinite(r)||(n=!1)})):n=!1,n}var u=function(t){var n=r(t,2),a=n[0],e=n[1];return Math.abs(a)<=90&&Math.abs(e)<=180};function f(r){if(!r)return null;var t=n(r,["top_hole","coordinates"]),e=n(r,["top_hole","raw"]);if(t)return t;if(e){var i=a(e);if(o(i))return i}return null}function l(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"attributes.top_hole";if(!r)return null;var e=n(r,t)||{},i=e.coordinates,u=e.raw;if(i)return i;if(u){var f=a(u);if(o(f))return f}return null}export{f as getAssetCoordinates,l as getAssetV2Coordinates,i as getDistanceByCoordinates,u as isValidCoordinates,o as isValidLatLng,a as parseLatLng};
//# sourceMappingURL=mapbox.js.map
