import r from"@babel/runtime/helpers/defineProperty";import{makeStyles as e}from"@material-ui/core";import{isEmpty as o}from"lodash";import{useEffect as t}from"react";import{updateAxisStyles as s}from"../formations.js";function a(r,e){var o=Object.keys(r);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(r);e&&(t=t.filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.push.apply(o,t)}return o}function i(e){for(var o=1;o<arguments.length;o++){var t=null!=arguments[o]?arguments[o]:{};o%2?a(Object(t),!0).forEach((function(o){r(e,o,t[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}var n=e({axisGrab:{cursor:"grab"},axisCrosshair:{cursor:"crosshair"}}),c=function(r){var e=r.chart,a=r.chartOptions,c=r.isZoomEnabled,l=r.isMinHeightChart,p=r.handleChartSelection,u=r.onZoomChangeCallback,f=r.isAxesCoordinatesShown,h=n();t((function(){if(!o(e)){var r={zIndex:1,color:"#ffffff",dashStyle:"dash"};e.plotBackground.element.style.cursor=l||!c?"grab":"crosshair",e.series.forEach((function(r){var e;return null==r||null===(e=r.group)||void 0===e?void 0:e.css({cursor:l||!c?"grab":"crosshair"})})),e.update({chart:i(i({},a),{},{plotBackgroundColor:"transparent",zoomType:l||!c?"none":a.zoomType}),xAxis:{crosshair:f?r:null,className:c?h.axisCrosshair:h.axisGrab,events:{afterSetExtremes:function(r){var o,t;"zoom"!==r.trigger&&"navigator"!==r.trigger||p(),null!==(o=e.xAxis)&&void 0!==o&&null!==(t=o[0].userOptions.plotLines)&&void 0!==t&&t.length&&s({chart:e}),u(r)}}},yAxis:{crosshair:f?r:null,className:c?h.axisCrosshair:h.axisGrab,events:{afterSetExtremes:function(r){"zoom"!==r.trigger&&"navigator"!==r.trigger||p(),u(r)}}},plotOptions:{series:{cursor:l||!c?"grab":"crosshair"}}})}}),[c,p,f])};export{c as useChartModifier};
