import t from"@babel/runtime/helpers/slicedToArray";import{useMemo as r}from"react";var n=function(t){return t*Math.PI/180},e=function(e){var i=e.radiusMiles,o=e.pads,a=e.selectedPadId,l=r((function(){return o.find((function(t){return t.id.toString()===a.toString()}))}),[o,a]);return r((function(){return o.filter((function(r){var e;if(!i||null==l||!l.wells.length)return!0;var o=t(l.wells[0].topHole.coordinates,2),a=o[0],s=o[1],u=(null===(e=r.wells[0])||void 0===e?void 0:e.topHole.coordinates)||[],c=t(u,2),d=c[0],f=c[1];if(!(d&&f&&a&&s))return!0;var h=n(d-a),M=n(f-s),p=Math.sin(h/2)*Math.sin(h/2)+Math.cos(n(a))*Math.cos(n(d))*Math.sin(M/2)*Math.sin(M/2);return 3958.8*(2*Math.atan2(Math.sqrt(p),Math.sqrt(1-p)))<=i}))}),[o,i,l])};export{e as usePadsByRadius};
//# sourceMappingURL=usePadsByRadius.js.map
