"use strict";var e=require("react/jsx-runtime"),t=require("react"),i=require("@material-ui/core"),o=require("@material-ui/icons"),r=require("../MiddleTruncate/MiddleTruncate.js"),l=require("../../utils/main.js"),a=require("./icons/SubjectIcon.js"),s=i.makeStyles((function(e){return{chipRoot:{position:"relative",height:30,padding:"7px 12px",fontSize:12,color:e.palette.primary.text6,margin:"2px 4px","&:hover":{cursor:"pointer",backgroundColor:"rgba(255, 255, 255, 0.1)",color:e.palette.primary.contrastText}},root:{width:"100%",display:"flex",alignItems:"center"},label:{padding:0},mark:{marginRight:4,width:8,height:8,borderRadius:8},subject:{display:"flex",marginRight:4},closeIcon:{fontSize:"1rem",marginLeft:"4px"},closeArea:{position:"absolute",top:0,right:0,width:32,height:30},tooltip:{marginTop:"8px"},titleContainer:{display:"flex",alignItems:"center"}}})),n=function(n){var c=n.title,u=n.onClick,p=n.markColor,d=n.isSubject,m=n.rigName,h=n.maxWidth,x=n.wellId,g=n.onRemoveOffsetWell,j=n.isShowMark,f=t.useState(null),k=f[0],C=f[1],b=s({isShowMark:j}),v=!!k,S=m?"".concat(c," | ").concat(m):c,y=p||"#".concat(l.getColorFromString(c)),N=e.jsxs("div",{className:b.root,children:[e.jsx(i.Tooltip,{title:v?S:m,classes:{popper:b.tooltip},children:e.jsxs("div",{className:b.titleContainer,children:[d?e.jsx("span",{className:b.subject,children:e.jsx(a,{})}):e.jsx("span",{style:{backgroundColor:y,display:j?"block":"none"},className:b.mark}),e.jsx(r,{onTruncate:function(e){C(e)},truncatedText:k,maxWidth:h,children:c})]})}),!d&&!!g&&e.jsxs(e.Fragment,{children:[e.jsx(o.Close,{className:b.closeIcon}),e.jsx(i.Tooltip,{title:"Remove",classes:{popper:b.tooltip},children:e.jsx("div",{className:b.closeArea,onClick:function(e){e.stopPropagation(),g&&g(x)}})})]})]});return e.jsx(i.Chip,{"data-not-migrated-MuiChip":!0,variant:"outlined",size:"medium",label:N,classes:{root:b.chipRoot,label:b.label},onClick:function(e){return u&&u(e,x)},"data-testid":"".concat(c,"_offsetWellChip")})};n.defaultProps={onClick:null,markColor:null,maxWidth:200,rigName:null,isShowMark:!0,onRemoveOffsetWell:null},module.exports=n;
