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