import e from"@babel/runtime/helpers/slicedToArray";import{jsxs as t,jsx as o,Fragment as i}from"react/jsx-runtime";import{useState as r}from"react";import{makeStyles as l,Tooltip as a,Chip as n}from"@material-ui/core";import{Close as c}from"@material-ui/icons";import s from"../MiddleTruncate/MiddleTruncate.js";import m from"../../utils/main.js";import p from"./icons/SubjectIcon.js";var d=l((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"}}})),u=function(l){var u=l.title,h=l.onClick,f=l.markColor,g=l.isSubject,x=l.rigName,b=l.maxWidth,k=l.wellId,C=l.onRemoveOffsetWell,v=l.isShowMark,j=r(null),y=e(j,2),N=y[0],R=y[1],S=d({isShowMark:v}),w=!!N,T=x?"".concat(u," | ").concat(x):u,I=f||"#".concat(m.getColorFromString(u)),M=t("div",{className:S.root,children:[o(a,{title:w?T:null!=x?x:"",classes:{popper:S.tooltip},children:t("div",{className:S.titleContainer,children:[o("span",g?{className:S.subject,children:o(p,{})}:{style:{backgroundColor:I,display:v?"block":"none"},className:S.mark}),o(s,{onTruncate:function(e){R(e)},truncatedText:N,maxWidth:b,children:u})]})}),!g&&!!C&&t(i,{children:[o(c,{className:S.closeIcon}),o(a,{title:"Remove",classes:{popper:S.tooltip},children:o("div",{className:S.closeArea,onClick:function(e){e.stopPropagation(),C&&C(k)}})})]})]});return o(n,{"data-not-migrated-MuiChip":!0,variant:"outlined",size:"medium",label:M,classes:{root:S.chipRoot,label:S.label},onClick:function(e){return h&&h(e,k)},"data-testid":"".concat(u,"_offsetWellChip")})};u.defaultProps={onClick:null,markColor:null,maxWidth:200,rigName:null,isShowMark:!0,onRemoveOffsetWell:null};export{u as default};
//# sourceMappingURL=Chip.js.map
