"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),t=require("@babel/runtime/helpers/slicedToArray"),r=require("react"),n=require("lodash"),i=require("../utils.js"),u=require("../constants.js"),o=require("react/jsx-runtime");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=l(e),c=l(t);function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function f(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){s.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}exports.useComonentsWidth=function(e){var t=r.useRef(),u=r.useState(null),l=c.default(u,2),a=l[0],d=l[1],y=r.useRef({}),p=e.filter((function(e){return!!e})),g=o.jsx("div",{ref:t,style:{position:"absolute",width:0,height:0,overflow:"hidden"},children:p.map((function(e,t){return o.jsx("div",{"data-key":null==e?void 0:e.key,style:{position:"absolute"},children:e},t)}))});return r.useEffect((function(){var r;if(!n.isEqual(p,y.current)){var u=i.getOffsetPicker(e),o=n.get(u,"key"),l=Array.from(null===(r=t.current)||void 0===r?void 0:r.childNodes).reduce((function(e,t){var r,n=null==t||null===(r=t.getAttribute)||void 0===r?void 0:r.call(t,"data-key"),i=n===o?36:null==t?void 0:t.getBoundingClientRect().width;return f(f({},e),{},s.default({},n,i))}),{});Object.values(l).length===p.length&&(n.isEqual(a,l)||d(l)),y.current=p}})),{componentsWidth:a,hiddenElements:g}},exports.useFilterLayout=function(e,t,o){var l=r.useState(null),s=c.default(l,2),a=s[0],f=s[1];return r.useEffect((function(){if(o&&t){var r=i.getAppTitle(e),l=i.getExpander(e),s=i.getOffsetPicker(e),c=i.getSecondaryAsset(e),a=i.getModeSelect(e),d=i.getPrimaryAsset(e),y=t[n.get(r,"key")]||0,p=t[n.get(l,"key")]||0,g=t[n.get(s,"key")]||0,b=t[n.get(c,"key")]||0,O=t[n.get(a,"key")]||0,v=t[n.get(d,"key")]||0;f(y+(p+g+b+O+v)<=o?u.LARGE_SIZE_LAYOUT:y+v<=o?u.MEDIUM_SIZE_LAYOUT:u.SMALL_SIZE_LAYOUT)}}),[t,o]),a};
//# sourceMappingURL=index.js.map
