"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),r=require("@babel/runtime/helpers/slicedToArray"),t=require("react"),i=require("react-dom"),u=require("lodash"),n=require("@material-ui/core/styles"),s=require("../components/FiltersToggler.js"),o=require("../utils.js"),l=require("../constants.js"),a=require("../../../config/theme/index.js");require("@babel/runtime/helpers/asyncToGenerator"),require("@babel/runtime/helpers/typeof"),require("@babel/runtime/regenerator"),require("highcharts-v8"),require("highcharts-v8/highcharts-more"),require("highcharts-v8/modules/solid-gauge"),require("highcharts-v8/modules/heatmap"),require("highcharts-v8/modules/boost"),require("highcharts-v8/modules/exporting"),require("highcharts-v8/modules/xrange"),require("highcharts-v8/modules/dumbbell"),require("highcharts-v8/modules/pattern-fill"),require("highcharts-multicolor-series-v8"),require("highcharts"),require("highcharts/highcharts-more"),require("highcharts/modules/solid-gauge"),require("highcharts/modules/heatmap"),require("highcharts/modules/boost"),require("highcharts/modules/exporting"),require("highcharts/modules/xrange"),require("highcharts/modules/dumbbell"),require("highcharts/modules/pattern-fill"),require("highcharts-multicolor-series"),require("dompurify"),require("../../../config/mapbox/index.js"),require("../../../clients/subscriptions/constants.js"),require("../../../clients/subscriptions.v1.js"),require("../../../clients/subscriptions/subscriptions-client.factory.js"),require("../../../config/extendNative.js");var c=require("react/jsx-runtime");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=h(e),f=h(r),g=h(i);function v(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,i)}return t}function m(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?v(Object(t),!0).forEach((function(r){d.default(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):v(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}exports.useAppFilterTogglerWidth=function(){var e=t.useState(null),r=f.default(e,2),i=r[0],u=r[1];return t.useEffect((function(){var e=document.createElement("div");e.style.position="absolute",e.style.visibility="hidden",document.body.appendChild(e),g.default.render(c.jsx(n.MuiThemeProvider,{theme:a.darkTheme,children:c.jsx(s,{})}),e,(function(){var r=e.getBoundingClientRect();e.remove(),u(r.width)}))}),[]),i},exports.useComonentsWidth=function(e){var r=t.useRef(),i=t.useState(null),n=f.default(i,2),s=n[0],o=n[1],l=t.useRef({}),a=e.filter((function(e){return!!e})),h=c.jsx("div",{ref:r,style:{position:"absolute",width:0,height:0,overflow:"hidden"},children:a.map((function(e,r){return c.jsx("div",{"data-key":null==e?void 0:e.key,style:{position:"absolute"},children:e},r)}))});return t.useEffect((function(){var e;if(!u.isEqual(a,l.current)){var t=Array.from(null===(e=r.current)||void 0===e?void 0:e.childNodes).reduce((function(e,r){var t,i=null==r||null===(t=r.getAttribute)||void 0===t?void 0:t.call(r,"data-key"),u=null==r?void 0:r.getBoundingClientRect().width;return m(m({},e),{},d.default({},i,u))}),{});Object.values(t).length===a.length&&(u.isEqual(s,t)||o(t)),l.current=a}})),{componentsWidth:s,hiddenElements:h}},exports.useFilterLayout=function(e,r,i,u){var n=t.useState(null),s=f.default(n,2),a=s[0],c=s[1];return t.useEffect((function(){if(u&&r){var t=o.getStartComponent(e),n=o.getMiddleComponent(e),s=o.getEndComponents(e),a=t&&n&&!s,h=t&&!n&&s,d=t&&n&&s;if(t&&!n&&!s){var f=r[t.key];if(f<=u)return void c(l.LARGE_SIZE_LAYOUT);if(f<=u/2)return void c(l.MEDIUM_SIZE_LAYOUT)}else if(a||h){var g=r[t.key],v=a?r[n.key]:r[s.key];if(g+v<=u)return void c(l.LARGE_SIZE_LAYOUT);if(i+v<=u)return void c(l.MEDIUM_SIZE_LAYOUT)}else if(d){var m=r[t.key],p=r[n.key],b=r[s.key];if(m+p+b<=u)return void c(l.LARGE_SIZE_LAYOUT);if(i+p+b<=u)return void c(l.MEDIUM_SIZE_LAYOUT);if(i+b<=u)return void c(l.SMALL_SIZE_LAYOUT)}c(l.SMALL_SIZE_LAYOUT)}}),[r,u]),a};
//# sourceMappingURL=index.js.map
