"use strict";var e=require("@babel/runtime/helpers/defineProperty"),t=require("react"),r=require("prop-types"),s=require("immutable"),a=require("./components/TargetChanges.js"),i=require("./components/VerticalSectionAzimuth.js"),p=require("./constants.js"),n=require("./styles.css.js"),u=require("../../../../constants/subscriptions.js");require("../../../EmbeddedApp/DevCenterEmbeddedApp.js");var o=require("../../../EmbeddedApp/EmbeddedApp.js"),c=require("react/jsx-runtime");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var b=d(e);function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,s)}return r}function m(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?l(Object(r),!0).forEach((function(t){b.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var g=function(e){var r=e.feedItem,d=r.id,b=r.well,l=r.context.well_plan,g=l.data,y=g.vertical_section_azimuth,f=g.target_changes,q=l.timestamp,h=e.subscribeAppForAsset,j=e.unsubscribeAppFromAsset,A=e.appContext,S=e.isSubDataLoading,D=e.getSubErrors,R=e.isSubDataEmpty,O=e.appRegistry,C=e.appData,v=p.SUBSCRIPTIONS.map((function(e){return m(m({},e),{},{meta:m(m({},u.DEFAULT_SUBSCRIPTION_META),{},{subscribeOnlyForInitialData:!0})})}));return t.useEffect((function(){b&&q&&h(d,v,b.id,{query:"{timestamp#lte#".concat(q,"}")})}),[]),b?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:n.wellPlanFeedItemInfo,children:[c.jsx(i,{vsa:y}),f&&c.jsx(a,{targetChanges:f})]}),c.jsx(o,{asset:s.Map(b),appContainerClassName:n.wellPlanFeedItemApp,appId:d,assetId:b.id,appComponentKey:"directional-wellPlan",appComponentCategory:"directional",subscriptions:v,requiresSubscription:!1,appContext:s.Map(A),assetDashboards:s.List(),graphType:1,internalSelectors:{isSubDataLoading:S,getSubErrors:D,isSubDataEmpty:R},appRegistry:O,appData:C,subscribeAppForAsset:h,unsubscribeAppFromAsset:j}),c.jsx(o,{asset:s.Map(b),appContainerClassName:n.wellPlanFeedItemApp,appId:d,assetId:b.id,appComponentKey:"directional-wellPlan",appComponentCategory:"directional",subscriptions:v,requiresSubscription:!1,appContext:s.Map(A),assetDashboards:s.List(),graphType:2,internalSelectors:{isSubDataLoading:S,getSubErrors:D,isSubDataEmpty:R},appRegistry:O,appData:C,subscribeAppForAsset:h,unsubscribeAppFromAsset:j})]}):"No Well in data"};g.propTypes={feedItem:r.shape({id:r.number,context:r.shape({well_plan:r.shape({timestamp:r.number.isRequired,data:r.shape({vertical_section_azimuth:r.number,target_changes:r.shape({measured_depth:r.number,tvd_change:r.number,vertical_section:r.number})})}).isRequired}).isRequired,well:r.shape({id:r.number.isRequired}).isRequired}).isRequired,subscribeAppForAsset:r.func.isRequired,unsubscribeAppFromAsset:r.func.isRequired,appContext:r.shape({view:r.string.isRequired}).isRequired,appData:r.shape().isRequired,appRegistry:r.shape().isRequired,isSubDataLoading:r.func.isRequired,getSubErrors:r.func.isRequired,isSubDataEmpty:r.func.isRequired},module.exports=g;
