"use strict";var e=require('./../../ext-esm/tslib/tslib.es6.js'),i=require("react/jsx-runtime"),t=require("react"),o=require("@material-ui/core"),r=require("@material-ui/icons"),s=require("../MiddleTruncate/MiddleTruncate.js"),a=require("../../utils/main.js"),l=require("./icons/SubjectIcon.js"),n=o.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"}}})),c=function(c){var u=c.title,d=c.onClick,p=c.markColor,m=c.isSubject,g=c.rigName,h=c.maxWidth,x=c.wellId,j=c.onRemoveOffsetWell,f=c.isShowMark,b=t.useState(null),k=b[0],C=b[1],_=n({isShowMark:f}),v=!!k,S=g?"".concat(u," | ").concat(g):u,q=p||"#".concat(a.getColorFromString(u)),y=i.jsxs("div",e.__assign({className:_.root},{children:[i.jsx(o.Tooltip,e.__assign({title:v?S:g,classes:{popper:_.tooltip}},{children:i.jsxs("div",e.__assign({className:_.titleContainer},{children:[m?i.jsx("span",e.__assign({className:_.subject},{children:i.jsx(l,{})})):i.jsx("span",{style:{backgroundColor:q,display:f?"block":"none"},className:_.mark}),i.jsx(s,e.__assign({onTruncate:function(e){C(e)},truncatedText:k,maxWidth:h},{children:u}))]}))})),!m&&!!j&&i.jsxs(i.Fragment,{children:[i.jsx(r.Close,{className:_.closeIcon}),i.jsx(o.Tooltip,e.__assign({title:"Remove",classes:{popper:_.tooltip}},{children:i.jsx("div",{className:_.closeArea,onClick:function(e){e.stopPropagation(),j&&j(x)}})}))]})]}));return i.jsx(o.Chip,{"data-not-migrated-MuiChip":!0,variant:"outlined",size:"medium",label:y,classes:{root:_.chipRoot,label:_.label},onClick:function(e){return d&&d(e,x)},"data-testid":"".concat(u,"_offsetWellChip")})};c.defaultProps={onClick:null,markColor:null,maxWidth:200,rigName:null,isShowMark:!0,onRemoveOffsetWell:null},module.exports=c;
