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