"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/toConsumableArray"),t=require("@babel/runtime/helpers/asyncToGenerator"),r=require("@babel/runtime/regenerator"),n=require("../shared/dataFormatter.js"),a=require("../../../../clients/index.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=u(e),s=u(t),l=u(r),o=["intervention_unit.name","intervention_unit.wells","intervention_unit.active_well"],c=function(){var e=s.default(l.default.mark((function e(t,r){var u,i;return l.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a.corvaAPI.get("/v2/intervention_units",{per_page:300,page:t,sort:"name",fields:o},{signal:r});case 2:return i=e.sent,e.abrupt("return",null!==(u=n.dataFormatter.deserialize(i))&&void 0!==u?u:[]);case 4:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),d=function(e){var t,r,n=null!==(t=null===(r=e.active_well)||void 0===r?void 0:r.asset_id)&&void 0!==t?t:null,a=function(e){if(null==e||!e.length)return[];var t=[];return e.forEach((function(e){null!=e.asset_id&&t.push(e.asset_id)})),t}(e.wells);return null==n||a.includes(n)||a.push(n),{id:Number(e.id),name:e.name,activeWellAssetId:n,assetIds:a}},f=function(){var e=s.default(l.default.mark((function e(t){var r,n,a,u;return l.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=[],n=1,a=!0;case 3:if(!a){e.next=13;break}return null==t||t.throwIfAborted(),e.next=7,c(n,t);case 7:u=e.sent,r.push.apply(r,i.default(u)),a=300===u.length,n+=1,e.next=3;break;case 13:return e.abrupt("return",r.map(d));case 14:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();exports.fetchInterventionUnits=f;
//# sourceMappingURL=fetchInterventionUnits.js.map
