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