"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require('./../../../ext-esm/tslib/tslib.es6.js'),s=require("react/jsx-runtime"),o=require("react"),i=require("@material-ui/core"),c=require("classnames"),n=require("../../IconButton/index.js"),r=require("../../Tooltip/Tooltip.js");require("../../Tooltip/ScrollableTooltip.js");var t=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 a=l(c),u=i.makeStyles((function(e){return{stickyCell:{position:"sticky",left:0,zIndex:2,background:e.palette.background.b4},stickyEmptyCell:{position:"sticky",right:0,zIndex:2},collapseHeader:{width:function(e){var s=e.isExpanded,o=e.maxCellWidth,i=e.cellWidth;return s?o:i}},tableCellWrapper:{display:"flex",alignItems:"center",justifyContent:"space-between",width:function(e){var s=e.isExpanded,o=e.maxCellWidth,i=e.cellWidth;return s?o:i}},iconButton:{padding:0,fontSize:16,"&:hover":{backgroundColor:"transparent"}}}}));exports.TableCell=function(c){var l,d=c.isExpanded,m=c.setIsExpanded,p=c.tooltipTitle,j=c.collapsibleHeader,h=c.collapsibleBody,C=c.maxCellWidth,x=c.cellWidth,q=c.maxCharsNumberFromStart,I=c.maxCharsNumberFromEnd,b=c.children,y=c.stickyCell,k=c.emptyCell,f=c.className,E=e.__rest(c,["isExpanded","setIsExpanded","tooltipTitle","collapsibleHeader","collapsibleBody","maxCellWidth","cellWidth","maxCharsNumberFromStart","maxCharsNumberFromEnd","children","stickyCell","emptyCell","className"]),g=y&&!k,W=u({isExpanded:d,cellWidth:x,maxCellWidth:C}),_=o.useState(!1),v=_[0],F=_[1];return s.jsxs(i.TableCell,e.__assign({},E,{className:a.default(j&&W.collapseHeader,g&&W.stickyCell,k&&W.stickyEmptyCell,g&&"stickyCell",k&&"stickyEmptyCell",f)},{children:[j&&s.jsxs("div",e.__assign({className:W.tableCellWrapper},{children:[b,s.jsx(n,e.__assign({className:W.iconButton,size:"small",onClick:function(){F(!1),m(!d)},tooltipProps:{title:d?"Collapse":"Expand",open:v,disableHoverListener:!0,onMouseEnter:function(){return F(!0)},onMouseLeave:function(){return F(!1)}}},{children:d?s.jsx(t.LeftIcon,{size:16}):s.jsx(t.RightIcon,{size:16})}))]})),h&&s.jsx(r.Tooltip,e.__assign({title:d?"":p},{children:s.jsx("div",{children:d?b:(l=p,l.length>q+I?"".concat(l.substring(0,q)," ... ").concat(l.substring(l.length-I)):l)})})),!j&&!h&&b]}))};
