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