"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),r=require("@babel/runtime/helpers/slicedToArray"),t=require("react/jsx-runtime"),n=require("react"),i=require("classnames"),s=require("lodash"),o=require("../AppCommonsProvider/AppCommonsContext.js"),a=require("../AppSizeProvider/AppSizeProvider.js"),d=require("../AppSettings/AppSettingsPinningContext.js"),c=require("../utils.js"),l=require("./AppContainer.constants.js"),u=require("./Content.js"),p=require("./AppContainer.scss.js");function f(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var j=f(e),b=f(r),m=f(i);function v(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function h(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){j.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}var P=n.forwardRef((function(e,r){var i=e.footer,f=e.testId,j=e.className,v=e.header,P=e.children,g=e.elementsClassNames,O=e.settingsInitiallyPinned,y=e.settingsPinningEnabled,A=e.settingsHeaderControls,C=n.useState(),q=b.default(C,2),x=q[0],w=q[1],S=n.useRef(null);n.useEffect((function(){var e=s.debounce((function(){requestAnimationFrame((function(){if(S.current){var e=S.current,r=e.clientWidth,t=e.clientHeight;w({width:r,height:t})}}))}),200,{leading:!0}),r=new ResizeObserver(e);return S.current&&r.observe(S.current),function(){r.disconnect(),e.cancel()}}),[]);var z=o.useAppCommons(),E=z.maximized,I=z.appHeadersV3Enabled;return t.jsx("div",h(h({className:m.default(p.root,j),"data-testid":f,ref:r},c.AppContainerFinderProps),{},{children:t.jsx(a.AppSizeContext.Provider,{value:x,children:t.jsxs(d.AppSettingsPinningProvider,{initiallyPinned:O,pinningEnabled:y,additionalControls:A,children:[v&&t.jsx("div",{className:m.default(p.header,E&&!I&&p.headerMaximized,null==g?void 0:g.header),"data-testid":l.AppContainerTestIds.HeaderTestId,children:v}),t.jsx(u.Content,{dimensions:x,className:null==g?void 0:g.content,ref:S,children:P}),i&&!I&&t.jsx("div",{className:m.default(p.footer,null==g?void 0:g.footer),"data-testid":l.AppContainerTestIds.FooterTestId,children:i})]})})}))}));exports.AppContainer=P;
//# sourceMappingURL=AppContainer.js.map
