import e from"@babel/runtime/helpers/defineProperty";import{jsx as t}from"react/jsx-runtime";import{AppMessageWrapper as o}from"../../../../../componentsV2/AppInfoMessage/AppMessageWrapper.js";import{EmptyState as r}from"../../../../../componentsV2/EmptyState/EmptyState.js";import{LoaderLogo as i}from"../../../../../componentsV2/LoaderLogo/LoaderLogo.js";import{ChooseAssetButton as n}from"./components/ChooseAssetButton.js";import s from"./DevCenterAppView.scss.js";import a from"../../../../ErrorBoundary/ErrorBoundary.js";import"../../../../ErrorBoundary/DevCenterAppErrorView/DevCenterAppErrorView.js";import{SEGMENTS as p}from"../../../../../constants/segment.js";import"../../../../../componentsV2/AppCommonsProvider/AppCommonsProvider.js";import{useAppCommonsInternal as l}from"../../../../../componentsV2/AppCommonsProvider/AppCommonsContext.js";function c(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,r)}return o}function d(t){for(var o=1;o<arguments.length;o++){var r=null!=arguments[o]?arguments[o]:{};o%2?c(Object(r),!0).forEach((function(o){e(t,o,r[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var u=function(e){return"".concat(e," has no active well")};function g(e){var c,g=e.AppComponent,m=e.app,f=e.appData,h=e.appProps,b=e.availability,v=e.isCLIApp,A=e.isLoading,y=e.isMultiRig,j=e.layoutEnvironment,w=e.openIntercom,P=e.segment,O=e.toggleAppSettingsDialog,C=e.onError,E="DevCenterAppView_EmptyState",L=l(),I=null!==(c=null==L?void 0:L.appSettings)&&void 0!==c?c:m.settings;if(!m.package)return t(o,{logo:m.headerLogo,children:t(r,{testId:E,title:"App package was not found",subTitle:"Please choose another version in the app settings menu or delete and add app again on your dashboard",image:"appLoadingError"})});if(A)return t(o,{showHeader:!1,children:t(i,{className:s.loader,testId:"DevCenterAppView_Loader"})});if(!b.hasProductSubscription||!b.isAppSubscribedForAsset){var S=b.hasProductSubscription?{title:"No Subscription exists for this asset.",subtitle:"Contact your Corva Account rep to get access to this asset."}:{title:"No Subscription exists for this app.",subtitle:"Contact your Corva Account rep to get access to this app."},D=S.title,T=S.subtitle;return t(o,{logo:m.headerLogo,children:t(r,{testId:E,title:D,subTitle:T,image:"noSubscription"})})}if(!g)return t(o,{logo:m.headerLogo,children:t(r,{testId:E,title:"App component was not found",image:"appLoadingError"})});if(!y){var V=v&&t(n,{toggleAppSettingsDialog:O}),N=P===p.INTERVENTION?f.interventionUnit:f.rig;if(N&&!f.well)return t(o,{logo:m.headerLogo,children:t(r,{testId:E,title:u(null==N?void 0:N.name),image:"noActiveWell",subTitle:V})});var F="general"===(null==j?void 0:j.type),x=P===p.COMPLETION;if(F&&x&&!f.fracFleet)return t(o,{logo:m.headerLogo,children:t(r,{testId:E,title:"Frac fleet was not found",subTitle:V,image:"fleetHasNoPad"})});if(x&&f.fracFleet&&!f.fracFleet.current_pad_id&&!m.settings.padId)return t(o,{logo:m.headerLogo,children:t(r,{testId:E,image:"fleetHasNoPad",subTitle:V,title:"Frac fleet has no active pad"})});if(x&&F&&(!f.wells||f.wells.length<1))return t(o,{logo:m.headerLogo,children:t(r,{testId:E,image:"noWellsSelected",subTitle:V,title:"This pad has no wells"})});if(!(f.rig||f.well||f.settings||f.wells))return t(o,{logo:m.headerLogo,children:t(r,{testId:E,image:"assetHasNoData",subTitle:V,title:"Asset unavailable"})})}return t(a,{openIntercom:w,onError:C,children:t(g,d(d(d(d({app:m},m.settings),I),f),h))})}g.defaultProps={availability:{hasProductSubscription:!0,isAppSubscribedForAsset:!0}};export{g as default,u as getNoActiveWellMessage};
//# sourceMappingURL=DevCenterAppView.js.map
