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