import r from"@babel/runtime/helpers/defineProperty";import{ALL_SECTION_KEY as t,ColumnType as e}from"../../constants.js";import{mapbox as n}from"../../../../utils/index.js";function o(r,t){var e=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),e.push.apply(e,n)}return e}function i(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?o(Object(n),!0).forEach((function(e){r(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))}))}return t}var c=n.getAssetV2Coordinates,u=n.getDistanceByCoordinates,a=function(r,t){if(!r||!t)return r;var e=r.find((function(r){return r.id===t})),n=e&&c(e,"topHole");return n?r.map((function(r){try{var t=c(r,"topHole");if(t){var e=parseFloat(u(n,t));return i(i({},r),{},{distance:parseFloat(e.toFixed(2))})}return r}catch(t){return r}})):r},f=function(n,o,c){if(!n||!o||!c)return n;var u=o.filter((function(r){return r.value!==t})),a=new Map;return u.forEach((function(r){(c[r.value]||[]).forEach((function(t){var e=a.get(t);e?e.push(r.label):a.set(t,[r.label])}))})),n.map((function(t){var n=a.get(t.id);return n&&n.length>0?i(i({},t),{},r({},e.wellSection,n)):t}))},l=function(r,t,e,n){if(!r)return null;var o=a(r,null!=t?t:void 0);return f(o,e,n)};export{a as addCoordinatesToWells,f as addSectionsToWells,l as transformWells};
//# sourceMappingURL=wellTransformations.js.map
