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