import e from"@babel/runtime/helpers/slicedToArray";import{useMemo as t}from"react";import r from"lodash/get";import l from"lodash/isEmpty";import n from"lodash/sortBy";import{getAssetKey as i,getDefaultPadModeSetting as o}from"../utils/completion.js";import{COMPLETION_APP_TYPES as d}from"../constants/completion.js";function f(f){var s=f.padId,u=f.well,a=f.wells,c=f.fracFleet,m=f.settingsByAsset,p=function(e,t,n,f){var s=i(n,t,e);return l(r(f,[s]))?o(n,t,d.fracMultiWellApp):r(f,[s])}(s,u,c,m);return t((function(){var t,r;if(u)return[u];var l=(null==c||null===(t=c.pad_frac_fleets)||void 0===t?void 0:t.find((function(e){return e.pad.id.toString()===s.toString()||e.current})))||(null===(r=n(null==c?void 0:c.pad_frac_fleets,"last_current_at"))||void 0===r?void 0:r[0]),i=(null==l?void 0:l.frac_fleet_lines)||[];if(!i.length)return null!=a&&a.length?a:[];var o=p.selectedLine;if("custom"===p.mode){var d,f=null!==(d=p.selectedAssets)&&void 0!==d?d:[],m=e(f,1)[0],v=i.find((function(e){var t=e.frac_fleet_line_wells;return(void 0===t?[]:t).find((function(e){return+e.id===m}))}));o=null==v?void 0:v.id}var _=i.find((function(e){return e.id===o}))||i[0];return(null==_?void 0:_.frac_fleet_line_wells)||[]}),[p.mode,p.selectedLine,p.selectedAssets,null==c?void 0:c.pad_frac_fleets,s,u,a])}export{f as default};
//# sourceMappingURL=usePadSelectorSelectedWells.js.map
