"use strict";var e=require("@babel/runtime/helpers/defineProperty"),r=require("@babel/runtime/helpers/slicedToArray"),t=require("react"),i=require("prop-types"),n=require("classnames"),s=require("lodash"),l=require("@material-ui/core"),o=require("@material-ui/icons/ExpandMore"),a=require("../BHATile/BHATile.js"),c=require("./styles.css.js"),d=require("../../Counter/index.js"),u=require("react/jsx-runtime");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var m=p(e),b=p(r),f=p(n),h=p(o);function j(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,i)}return t}function g(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?j(Object(t),!0).forEach((function(r){m.default(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):j(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function y(e){var r=e.isMobile,i=e.drillstringsBySection,n=e.selectedBha,o=e.isMetricsHidden,p=e.onSelectBha,j=e.contentClassName,y=t.useState({}),v=b.default(y,2),O=v[0],x=v[1];return u.jsxs("div",{className:c.bhaListContainer,children:[u.jsx("div",{className:f.default(c.bhaList,j),children:i.map((function(e){var t,i;return u.jsx(l.Tooltip,{title:0===(null==e||null===(t=e.drillstrings)||void 0===t?void 0:t.length)?"No BHA in section":"",placement:"bottom-start",children:u.jsxs(l.Accordion,{expanded:!O[e.name],disabled:0===(null==e||null===(i=e.drillstrings)||void 0===i?void 0:i.length),classes:{root:c.accordionRoot},onChange:function(){return r=e,void x((function(e){return g(g({},e),{},m.default({},r.name,!e[r.name]))}));var r},children:[u.jsxs(l.AccordionSummary,{expandIcon:u.jsx(h.default,{}),classes:{root:c.accordionSummaryRoot,content:c.accordionSummaryContent},children:[e.name,u.jsx(d,{size:"medium",label:null==e?void 0:e.drillstrings.length,className:c.counter})]}),u.jsx(l.AccordionDetails,{children:u.jsx("div",{className:c.sectionContent,children:e.drillstrings.map((function(e){return u.jsx("div",{className:c.tileWrapper,children:u.jsx(a,{drillstring:e,isSelected:s.get(n,"_id")===s.get(e,"_id"),isMetricsHidden:o,onSelect:p,isMobile:r})},s.get(e,"_id"))}))})})]})},e.name)}))}),u.jsx("div",{className:f.default(c.bottomGradient,m.default({},c.bottomGradientMobile,r))})]})}y.propTypes={isMobile:i.bool,drillstringsBySection:i.arrayOf(i.shape({name:i.string,drillstrings:i.arrayOf(i.shape({_id:i.string,data:i.shape({})}))})),selectedBha:i.shape({_id:i.string}),isMetricsHidden:i.bool,onSelectBha:i.func.isRequired,contentClassName:i.string},y.defaultProps={isMobile:!1,drillstringsBySection:[],selectedBha:null,isMetricsHidden:!0,contentClassName:null},module.exports=y;
//# sourceMappingURL=BHAList.js.map
