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