"use strict";var t=require("@babel/runtime/helpers/slicedToArray"),e=require("@babel/runtime/helpers/objectWithoutProperties"),o=require("react"),i=require("@material-ui/core"),r=require("@material-ui/icons/Straighten"),l=require("../ChartWrapperContext.js"),n=require("react/jsx-runtime");function u(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var a=u(t),s=u(e),c=u(r),f=["left","width","top","bottom","right","labelOffset","offset","height","coll","opposite","visible","onCustomizeScaleClick"],p=i.makeStyles((function(t){return{axis:function(t){var e=t.width,o=t.height;return{position:"absolute",cursor:"pointer",width:e,left:t.left,bottom:t.bottom,height:o,right:t.right,top:t.top}},tooltip:{display:"flex",alignItems:"center",justifyContent:"space-between",minWidth:125,backgroundColor:t.palette.background.b9,color:t.palette.text.primary,fontSize:"12px",lineHeight:"16px",letterSpacing:"0.4px",borderRadius:"4px",padding:"4px",zIndex:1e4},tooltipIcon:{fontSize:16,color:t.palette.primary.text6}}}));module.exports=function(t){var e,r,u=t.left,h=t.width,d=t.top,x=t.bottom,b=t.right,g=t.labelOffset,m=t.offset,v=t.height,y=t.coll,C=t.opposite,j=t.visible,S=t.onCustomizeScaleClick,E=s.default(t,f),q=o.useContext(l).chart,w=o.useState({}),B=a.default(w,2),k=B[0],z=B[1],M=o.useRef(),O=(null==q?void 0:q.inverted)?"yAxis"===y:"xAxis"===y,W=14+Math.abs(g),I=14+Math.abs(g),R=((null==E||null===(e=E.userOptions)||void 0===e?void 0:e.title)||{}).text,A=p({width:O?h:I,height:O?I:v,top:O?C?d-I+m:"auto":d,right:O?b:C?b-I-m:"auto",left:O?u:C?"auto":u-I+m,bottom:O?C?"auto":x-I-m:x}),N=null===(r=M.current)||void 0===r?void 0:r.getBoundingClientRect(),P=n.jsxs("div",{className:A.tooltip,children:[n.jsx(c.default,{className:A.tooltipIcon})," Customize Scale"]}),H=function(){var t=q[y].find((function(t){return t.userOptions.title.text===R}));null==t||t.update({lineColor:"#03BCD4",lineWidth:2,labels:{style:{color:"#ffffff"}},title:{style:{color:"#ffffff"}}})},T=function(){var t=q[y].find((function(t){return t.userOptions.title.text===R}));null==t||t.update({lineColor:"#3B3B3B",lineWidth:1,labels:{style:{color:"#9E9E9E"}},title:{style:{color:"#9E9E9E"}}})};return o.useEffect((function(){var t=q.axisGroup;t&&(t.element.style.cursor="pointer")}),[q]),j?n.jsx(i.Tooltip,{title:P,placement:O?C?"bottom":"top":C?"left":"right",onMouseMove:function(t){var e=t.pageX,o=t.pageY;z({x:e,y:o})},PopperProps:{anchorEl:{clientHeight:0,clientWidth:0,getBoundingClientRect:function(){var t=C?W:0,e=C?0:W;return{top:O?N.y-t:k.y,left:O?k.x:N.x-e,right:O?k.x:N.x+e,bottom:O?N.y+t:k.y,width:0,height:0}}}},children:n.jsx("div",{className:A.axis,ref:M,onClick:function(){return S(E)},onMouseOver:H,onMouseLeave:T,onFocus:H,onBlur:T})}):null};
//# sourceMappingURL=AxisOverlay.js.map
