"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var o=require("react/jsx-runtime"),i=require("classnames"),n=require("react"),e=require("@material-ui/core"),s=require("../../../../icons/iconParkIcons.js");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 t=require("./ToolboxButton.js");function l(o){return o&&"object"==typeof o&&"default"in o?o:{default:o}}var c=l(i),u=e.makeStyles((function(o){var i=o.palette;return{toolboxContainer:{position:"absolute",zIndex:1,right:function(o){var i=o.right;return i+7},bottom:function(o){var i=o.bottom;return i+8},width:30,height:"fit-content",display:"flex",flexDirection:"column",alignItems:"flex-end",gap:"4px 0"},activeIcon:{color:"".concat(i.primary.main," !important")},tooltipButton:{width:30,height:30,backgroundColor:i.background.b6,minWidth:0},disabledButton:{cursor:"not-allowed",color:"".concat(i.primary.text6," !important"),backgroundColor:"".concat(i.background.b6," !important")}}}));exports.Toolbox=function(i){var e,l,r,d,a,m,b,v,I,j,h,x,p,q,f,g=i.isPaneEnabled,C=i.handleTogglePane,B=i.handleToggleBrush,k=i.isBrushEnabled,T=i.isZoomed,Z=i.chart,z=i.customToolboxContainerClass,O=i.handleZoomReset,F=i.handleZoomOut,N=i.handleZoomIn,y=i.controls,E=n.useState({bottom:0,right:0}),M=E[0],P=E[1],R=u({bottom:M.bottom,right:M.right}),S=n.useCallback((function(){var o,i,n,e,s,t,l=null===(n=null===(i=null===(o=null==Z?void 0:Z.getOption())||void 0===o?void 0:o.grid)||void 0===i?void 0:i[0])||void 0===n?void 0:n.bottom,c=null===(t=null===(s=null===(e=null==Z?void 0:Z.getOption())||void 0===e?void 0:e.grid)||void 0===s?void 0:s[0])||void 0===t?void 0:t.right;l===M.bottom&&c===M.right||P({bottom:+l,right:+c})}),[M,Z]);n.useEffect((function(){!Z||M.bottom||M.right||Z.on("rendered",S)}),[Z]);return o.jsxs("div",{className:c.default(R.toolboxContainer,z),children:[T&&o.jsx(t.ToolboxButton,{icon:o.jsx(s.UndoIcon,{size:"small"}),title:"Reset Zoom",onClick:O,disabled:null===(m=null==y?void 0:y.resetZoom)||void 0===m?void 0:m.disabled,className:c.default(R.tooltipButton,(e={},e[R.disabledButton]=null===(b=null==y?void 0:y.resetZoom)||void 0===b?void 0:b.disabled,e))}),o.jsx(t.ToolboxButton,{icon:o.jsx(s.FiveIcon,{className:c.default(g&&R.activeIcon),size:"small"}),onClick:function(){C(!g),B(!1)},title:"Pan",disabled:!T||(null===(v=null==y?void 0:y.pane)||void 0===v?void 0:v.disabled),className:c.default(R.tooltipButton,(l={},l[R.disabledButton]=!T||(null===(I=null==y?void 0:y.pane)||void 0===I?void 0:I.disabled),l))}),o.jsx(t.ToolboxButton,{icon:o.jsx(s.MoveInIcon,{className:c.default(k&&R.activeIcon),size:"small"}),onClick:function(){B(!k),C(!1)},title:"Drag To Zoom",disabled:null===(j=null==y?void 0:y.brush)||void 0===j?void 0:j.disabled,className:c.default(R.tooltipButton,(r={},r[R.disabledButton]=null===(h=null==y?void 0:y.brush)||void 0===h?void 0:h.disabled,r))}),o.jsx(t.ToolboxButton,{icon:o.jsx(s.PlusIcon,{size:"small"}),onClick:N,title:"Zoom In",disabled:null===(x=null==y?void 0:y.zoomIn)||void 0===x?void 0:x.disabled,className:c.default(R.tooltipButton,(d={},d[R.disabledButton]=null===(p=null==y?void 0:y.zoomIn)||void 0===p?void 0:p.disabled,d))}),o.jsx(t.ToolboxButton,{icon:o.jsx(s.MinusIcon,{size:"small"}),onClick:F,title:"Zoom Out",disabled:!T||(null===(q=null==y?void 0:y.zoomOut)||void 0===q?void 0:q.disabled),className:c.default(R.tooltipButton,(a={},a[R.disabledButton]=!T||(null===(f=null==y?void 0:y.zoomOut)||void 0===f?void 0:f.disabled),a))})]})};
