import r from"@babel/runtime/helpers/defineProperty";import e from"@babel/runtime/helpers/slicedToArray";import{useState as t,useEffect as i,useRef as o}from"react";import n from"react-dom";import{isEqual as m}from"lodash";import{MuiThemeProvider as c}from"@material-ui/core/styles";import{MuiPickersUtilsProvider as u}from"@material-ui/pickers";import l from"@date-io/moment";import s from"moment";import p from"../components/FiltersToggler.js";import{getStartComponent as a,getMiddleComponent as h,getEndComponents as f}from"../utils.js";import{LARGE_SIZE_LAYOUT as d,MEDIUM_SIZE_LAYOUT as b,SMALL_SIZE_LAYOUT as g}from"../constants.js";import{darkTheme as y}from"../../../config/theme/index.js";import"@babel/runtime/helpers/typeof";import"highcharts";import"highcharts/highcharts-more";import"highcharts-multicolor-series";import"highcharts/modules/solid-gauge";import"highcharts/modules/heatmap";import"highcharts/modules/boost";import"highcharts/modules/exporting";import"highcharts/modules/xrange";import"highcharts/modules/dumbbell";import"highcharts/modules/pattern-fill";import"dompurify";import"../../../config/mapbox/index.js";import{jsx as v}from"react/jsx-runtime";function j(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(r);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),t.push.apply(t,i)}return t}function O(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?j(Object(i),!0).forEach((function(t){r(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):j(Object(i)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))}))}return e}function k(r,o,n,m){var c=t(null),u=e(c,2),l=u[0],s=u[1];return i((function(){if(m&&o){var e=a(r),t=h(r),i=f(r),c=e&&t&&!i,u=e&&!t&&i,l=e&&t&&i;if(e&&!t&&!i){var p=o[e.key];if(p<=m)return void s(d);if(p<=m/2)return void s(b)}else if(c||u){var y=o[e.key],v=c?o[t.key]:o[i.key];if(y+v<=m)return void s(d);if(n+v<=m)return void s(b)}else if(l){var j=o[e.key],O=o[t.key],k=o[i.key];if(j+O+k<=m)return void s(d);if(n+O+k<=m)return void s(b);if(n+k<=m)return void s(g)}s(g)}}),[o,m]),l}function P(p){var a=o({}),h=t(null),f=e(h,2),d=f[0],b=f[1],g=o({});return i((function(){var e=p.filter((function(r){return!!r}));m(e,g.current)||(a.current={},e.forEach((function(t){var i=document.createElement("div");i.style.position="absolute",i.style.visibility="hidden",document.body.appendChild(i),t&&n.render(v(c,{theme:y,children:v(u,{libInstance:s,utils:l,children:t})}),i,(function(){var o=i.getBoundingClientRect();i.remove(),a.current=O(O({},a.current),{},r({},t.key,o.width)),Object.values(a.current).length===e.length&&(m(d,a.current)||b(a.current))}))})),g.current=e)})),d}function w(){var r=t(null),o=e(r,2),m=o[0],u=o[1];return i((function(){var r=document.createElement("div");r.style.position="absolute",r.style.visibility="hidden",document.body.appendChild(r),n.render(v(c,{theme:y,children:v(p,{})}),r,(function(){var e=r.getBoundingClientRect();r.remove(),u(e.width)}))}),[]),m}export{w as useAppFilterTogglerWidth,P as useComonentsWidth,k as useFilterLayout};
