"use strict";var t=require("@babel/runtime/helpers/slicedToArray"),e=require("@babel/runtime/helpers/objectWithoutProperties"),i=require("react"),o=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 s=u(t),a=u(e),c=u(r),f=["left","width","top","bottom","right","labelOffset","offset","height","coll","onCustomizeScaleClick"],p=o.makeStyles((function(t){return{axis:function(t){return{position:"absolute",cursor:"pointer",width:t.width,left:t.left,bottom:t.bottom,height:t.height}},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,d=t.width,h=t.top,x=t.bottom,g=t.right,m=t.labelOffset,b=t.offset,y=t.height,v=t.coll,C=t.onCustomizeScaleClick,j=a.default(t,f),S=i.useContext(l).chart,E=i.useState({}),q=s.default(E,2),w=q[0],B=q[1],k=i.useRef(),z=(null==S?void 0:S.inverted)?"yAxis"===v:"xAxis"===v,O=14+m,W=14+m,I=((null==j||null===(e=j.userOptions)||void 0===e?void 0:e.title)||{}).text,M=z?u-5:u-W,R=z?x-W:x-5,A=p({top:h,right:g,width:z?d+W:W,height:z?W:y+W,left:z?M:M+b,bottom:z?R-b:R}),N=null===(r=k.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(){S[v].find((function(t){return t.userOptions.title.text===I})).update({lineColor:"#03BCD4",lineWidth:2,labels:{style:{color:"#ffffff"}},title:{style:{color:"#ffffff"}}})},T=function(){S[v].find((function(t){return t.userOptions.title.text===I})).update({lineColor:"#3B3B3B",lineWidth:1,labels:{style:{color:"#9E9E9E"}},title:{style:{color:"#9E9E9E"}}})};return i.useEffect((function(){var t=S.axisGroup;t&&(t.element.style.cursor="pointer")}),[S]),n.jsx(o.Tooltip,{title:P,placement:z?"top":"right",onMouseMove:function(t){var e=t.pageX,i=t.pageY;B({x:e,y:i})},PopperProps:{anchorEl:{clientHeight:0,clientWidth:0,getBoundingClientRect:function(){return{top:z?N.y:w.y,left:z?w.x:N.x-O,right:z?w.x:N.x+O,bottom:z?N.y:w.y,width:0,height:0}}}},children:n.jsx("div",{className:A.axis,ref:k,onClick:function(){return C(j)},onMouseOver:H,onMouseLeave:T,onFocus:H,onBlur:T})})};
