import r from"@babel/runtime/helpers/defineProperty";import e from"@babel/runtime/helpers/slicedToArray";import{useState as t,useEffect as o,useRef as i}from"react";import n from"react-dom";import{get as c,isEqual as m}from"lodash";import{MuiThemeProvider as s}from"@material-ui/core/styles";import{getAppTitle as u,getExpander as p,getOffsetPicker as h,getSecondaryAsset as l,getModeSelect as a,getPrimaryAsset as f}from"../utils.js";import{LARGE_SIZE_LAYOUT as d,MEDIUM_SIZE_LAYOUT as y,SMALL_SIZE_LAYOUT as b}from"../constants.js";import{darkTheme as g}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 O}from"react/jsx-runtime";function j(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 v(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?j(Object(o),!0).forEach((function(t){r(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):j(Object(o)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))}))}return e}function k(r,i,n){var m=t(null),s=e(m,2),g=s[0],O=s[1];return o((function(){if(n&&i){var e=u(r),t=p(r),o=h(r),m=l(r),s=a(r),g=f(r),j=i[c(e,"key")]||0,v=i[c(t,"key")]||0,k=i[c(o,"key")]||0,P=i[c(m,"key")]||0,w=i[c(s,"key")]||0,x=i[c(g,"key")]||0;O(j+(v+k+P+w+x)<=n?d:j+x<=n?y:b)}}),[i,n]),g}function P(u){var p=i({}),l=t(null),a=e(l,2),f=a[0],d=a[1],y=i({});return o((function(){var e=u.filter((function(r){return!!r}));if(!m(e,y.current)){var t=h(u),o=c(t,"key");p.current=o?r({},o,36):{},e.forEach((function(t){var i=document.createElement("div");i.style.position="absolute",i.style.visibility="hidden",document.body.appendChild(i),t&&t.key!==o&&n.render(O(s,{theme:g,children:t}),i,(function(){var o=i.getBoundingClientRect();i.remove(),p.current=v(v({},p.current),{},r({},t.key,o.width)),Object.values(p.current).length===e.length&&(m(f,p.current)||d(p.current))}))})),y.current=e}})),f}export{P as useComonentsWidth,k as useFilterLayout};
