import e from"@babel/runtime/helpers/defineProperty";import{jsx as t,jsxs as r}from"react/jsx-runtime";import{isEmpty as n}from"lodash";import o from"../../../components/PadModeSelect/PadModeSelect.js";import{TextMiddleTruncated as i}from"../../TextMiddleTruncated/TextMiddleTruncated.js";import"../../TextMiddleTruncated/TextMiddleTruncated.constants.js";import{Text as l}from"../../Text/Text.js";import s from"./PadMode.scss.js";import{COMPLETION_APP_TYPES as a}from"../../../constants/completion.js";import{getAssetKey as c,getDefaultPadModeSetting as d}from"../../../utils/completion.js";function p(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 u(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?p(Object(n),!0).forEach((function(r){e(t,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):p(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var m=function(e){var n=e.name,o=e.statusBadge;return r("div",{className:s.activeAsset,children:[t(l,{className:s.activeAssetName,size:12,children:t(i,{children:n})}),o]})},f=function(r){var i,l,p,f,v,b,j=r.fracFleet,g=r.wells,y=r.well,O=r.onSettingChange,P=r.appSettings,S=r.app,T=(null==S||null===(i=S.package)||void 0===i||null===(l=i.manifest)||void 0===l||null===(p=l.application)||void 0===p?void 0:p.ui)||{},h=T.enableSimulFracInPadSelect,A=T.completionAppType,M=T.disableActiveWellsInPadSelect;if(y||n(g)||!j)return null;var w=P.padId,x=A||a.fracMultiWellApp,C=c(j,y,w),F=null==P||null===(f=P.settingsByAsset)||void 0===f?void 0:f[C],I=n(F)?d(j,y,x):F,B=(null===(v=j.pad_frac_fleets)||void 0===v||null===(b=v.find((function(e){return w&&e.pad.id?+e.pad.id==+w:e.current})))||void 0===b?void 0:b.frac_fleet_lines)||[];return t(o,{assets:g,completionAppType:x,disableActiveWellsInPadSelect:M,enableSimulFracInPadSelect:h,padModeSetting:I,fracFleetLines:B,onChange:function(t){return O("settingsByAsset",u(u({},null==P?void 0:P.settingsByAsset),{},e({},C,t)))},formControlClassName:s.formField,activeAssetComponent:m})};export{f as PadMode};
//# sourceMappingURL=PadMode.js.map
