import e from"@babel/runtime/helpers/slicedToArray";import{shape as i,number as n,string as r,func as t}from"prop-types";import{useState as o,useMemo as l}from"react";import{Button as a,Dialog as d,DialogContent as s}from"@material-ui/core";import c from"../BHATable/index.js";import p from"../BHAComponentDetail/index.js";import m from"./styles.css.js";import{convertValue as u}from"../../../utils/index.js";import{jsxs as f,jsx as h}from"react/jsx-runtime";var v=function(i){var n,r,t,v=i.onDone,T=i.drillStringInfo,D=i.holeDepth,N=i.unit,j=o(),x=e(j,2),A=x[0],C=x[1],S=null===(n=T.data)||void 0===n?void 0:n.id,q=Math.floor(u(null===(r=T.data)||void 0===r?void 0:r.start_depth,"length","ft")),y=(null===(t=T.data)||void 0===t?void 0:t.components)||[],B=l((function(){return y.find((function(e){return e.id===A}))}),[y,A]);return f("div",{className:m.detailsPane,children:[f("header",{children:[h(a,{variant:"contained",className:m.detailDone,onClick:v,children:"Close"}),f("div",{className:m.detailTitleGroup,children:[h("span",{className:m.detailTitle,children:"BHA Details"}),h("span",{className:m.detailTitleSeparator,children:" · "}),f("span",{className:m.detailTitleMore,children:["BHA # ",S]}),h("span",{className:m.detailTitleSeparator,children:" · "}),h("span",{className:m.detailTitleMore,children:"".concat(q," - ").concat(D," ").concat(N)})]})]}),h(c,{components:y,onSelectComponent:function(e){var i=e.id;return C(i)}}),h(d,{open:!!A,onClose:function(){return C(null)},scroll:"paper",children:h(s,{children:h(p,{component:B,onDone:function(){return C(null)}})})})]})};v.propTypes={drillStringInfo:i().isRequired,holeDepth:n.isRequired,unit:r.isRequired,onDone:t.isRequired};export{v as default};
