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