"use strict";var e=require('./../../ext-esm/tslib/tslib.es6.js'),o=require("react/jsx-runtime"),s=require("react"),i=require("prop-types"),n=require("classnames"),t=require("@material-ui/core"),c=require("@material-ui/icons"),r=require("../IconButton/index.js"),a=require("../../icons/iconParkIcons.js");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("../../icons/customIcons/icons/AddMessage.js"),require("../../icons/customIcons/icons/Attention.js"),require("../../icons/customIcons/icons/Collapse.js"),require("../../icons/customIcons/icons/Dashboard.js"),require("../../icons/customIcons/icons/Expand.js"),require("../../icons/customIcons/icons/FolderClosed.js"),require("../../icons/customIcons/icons/FolderClosedFilled.js"),require("../../icons/customIcons/icons/FolderOpened.js"),require("../../icons/customIcons/icons/GreaterOrEqual.js"),require("../../icons/customIcons/icons/LessOrEqual.js"),require("../../icons/customIcons/icons/Search.js"),require("../../icons/customIcons/icons/Wellhub.js"),require("../../icons/customIcons/icons/MultiRuler.js"),require("../../icons/customIcons/icons/Checkbox.js"),require("../../icons/customIcons/icons/CheckboxChecked.js"),require("../../icons/customIcons/icons/CheckboxIndeterminate.js"),require("../../icons/customIcons/icons/Radio.js"),require("../../icons/customIcons/icons/RadioChecked.js"),require("../../icons/customIcons/icons/SimulFrac.js"),require("../../icons/customIcons/icons/ZipperFrac.js"),require("../../icons/customIcons/icons/CautionFilled.js"),require("../../icons/customIcons/icons/MoreApp.js");var u=l(i),d=l(n),p=t.makeStyles((function(e){var o=e.palette;return{disabled:{opacity:.4,pointerEvents:"none"},offsetContainer:{cursor:"pointer",display:"flex",whiteSpace:"nowrap",flexWrap:"nowrap",alignItems:"center",width:"fit-content"},hoveredContainer:{backgroundColor:"rgba(255, 255, 255, 0.16)",color:o.primary.light},offsetText:{color:o.primary.text6,fontSize:12,paddingRight:4,"&:hover":{color:o.primary.contrastText}},buttons:{display:"flex",alignItems:"center"},isActive:{color:o.primary.contrastText},primaryIcon:{"&:hover":{backgroundColor:"rgba(255, 255, 255, 0.16)"}},infoIcon:{marginRight:"8px",fontSize:"20px",color:o.info.light},infoTooltip:{maxWidth:"264px"}}})),f=function(i){var n=i.onClick,l=i.wells,u=i.label,f=i.disabled,m=i.expanded,x=i.onExpand,j=i.offsetWellsLimited,I=i.isTooltipDisabled,b=i.iconElement,q=s.useState(!1),h=q[0],g=q[1],C=p(),y=l.length,v=!(!y||!x),_=o.jsxs("div",e.__assign({"data-testid":"offsetWellsButton",className:d.default(C.offsetContainer,f&&C.disabled),onClick:n,onMouseMove:function(e){var o=e.target,s=o.parentNode;o.getAttribute("data-icon")||s.getAttribute("data-icon")?g(!1):g(!0)},onMouseLeave:function(){g(!1)}},{children:[o.jsxs(t.Typography,e.__assign({className:d.default(C.offsetText,h&&C.isActive)},{children:[u," (",y,")"]})),o.jsx(r,e.__assign({className:d.default(C.primaryIcon,h&&C.hoveredContainer),color:"primary",size:"medium"},{children:b||o.jsx(a.WriteIcon,{size:24})}))]}));return o.jsxs("div",e.__assign({className:C.buttons},{children:[j&&o.jsx(t.Tooltip,e.__assign({title:"".concat(u," list wasn't populated completely due to technical limitations of the app."),classes:{tooltip:C.infoTooltip}},{children:o.jsx(c.Info,{className:C.infoIcon})})),o.jsx(t.Tooltip,e.__assign({title:"Edit ".concat(u),placement:"bottom"},{children:_})),v&&o.jsx(r,e.__assign({"data-testid":"expandOffsetWellChipsTabButton",tooltipProps:!I&&{title:m?"Collapse ".concat(u):"Expand ".concat(u)},onClick:function(e){e.stopPropagation(),x()},color:"default",size:"medium","data-icon":"expandIcon"},{children:m?o.jsx(a.UpIcon,{"data-icon":"expandIcon"}):o.jsx(a.DownIcon,{"data-icon":"expandIcon"})}))]}))},m={onClick:u.default.func.isRequired,wells:u.default.arrayOf(u.default.shape({id:u.default.number,title:u.default.string})),label:u.default.string,disabled:u.default.bool,onExpand:u.default.func,expanded:u.default.bool,offsetWellsLimited:u.default.bool,isTooltipDisabled:u.default.bool,iconElement:u.default.node};f.propTypes=m,f.defaultProps={onExpand:null,expanded:!1,wells:[],disabled:!1,offsetWellsLimited:!1,isTooltipDisabled:!1,label:"Offset Wells",iconElement:null},module.exports=f;
