import e from"@babel/runtime/helpers/asyncToGenerator";import i from"@babel/runtime/helpers/slicedToArray";import r from"@babel/runtime/regenerator";import{useState as t,useEffect as o}from"react";import{shape as n,number as a,string as s,arrayOf as l}from"prop-types";import m from"./components/Info.js";import d from"./components/BhaNumber.js";import p from"./components/BhaSchematic.js";import u from"./components/NoData.js";import c from"./styles.css.js";import{loadDrillStringData as f}from"../../../../utils/bha.js";import{jsxs as h,Fragment as b,jsx as v}from"react/jsx-runtime";var y=function(n){var a,s,l=n.feedItem,y=n.feedItem,g=y.well,q=y.context,D=y.company_id,R=t([]),I=i(R,2),j=I[0],x=I[1],w=t(!1),N=i(w,2),_=N[0],A=N[1],S=null==g?void 0:g.id,T=null==q||null===(a=q.bha)||void 0===a?void 0:a.data,k=[null==T?void 0:T.id],B=(null==T||null===(s=T.components)||void 0===s?void 0:s.find((function(e){return"bit"===e.family})))||{},C=(null==T?void 0:T.id)||"-";function F(){return(F=e(r.mark((function e(){var i;return r.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,f([{_id:S,bha_ids:k}],D);case 3:i=e.sent,x(i),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),console.error(e.t0);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})))).apply(this,arguments)}return o((function(){!function(){F.apply(this,arguments)}()}),[]),h(b,{children:[h("div",{className:c.bhaFeedItemInfoWrapper,children:[v(d,{bhaId:C,pageName:"bhaActivity"}),v(m,{feedItem:l,bitComponent:B,pageName:"bhaActivity"})]}),j.length>0?v(p,{feedItem:l,drillStringData:j,isShowDrillstringDetailDialog:_,handleShowDrillstringDetailDialog:function(){return A(!0)},handleHideDrillstringDetailDialog:function(){return A(!1)}}):v(u,{pageName:"bhaActivity"})]})};y.propTypes={feedItem:n({id:a.isRequired,type:s.isRequired,company_id:a.isRequired,context:n({bha:n({data:n({id:a.isRequired,components:l(n).isRequired,start_depth:a.isRequired}).isRequired})}).isRequired,created_at:s.isRequired,well:n({id:a.isRequired})}).isRequired};export{y as default};
//# sourceMappingURL=BhaFeedItem.js.map
