import{o as e}from"./chunk.DuxOD-Sk.js";import{r as t}from"./emotion-is-prop-valid.esm.DV_OErv-.js";import{c as n,p as r,t as i}from"./emotion-styled.browser.esm.BPUx6WuE.js";import{t as a}from"./useEmotionTheme.61kSPILX.js";import{i as o,r as s,t as c}from"./useWindowDimensionsContext.gRLzw0wB.js";var l=e(r()),u=e(t()),d=(0,u.createContext)(null);d.displayName=`ElementFullscreenContext`;var f=i(`div`,{target:`e1xxut3m0`})(({theme:e,isExpanded:t})=>({width:`100%`,height:`100%`,...t?{position:`fixed`,top:0,left:0,bottom:0,right:0,background:e.colors.bgColor,zIndex:e.zIndices.fullscreenWrapper,padding:e.spacing.md,paddingTop:e.sizes.fullScreenHeaderHeight,overflow:`auto`,display:`flex`,alignItems:`center`,justifyContent:`center`}:{}})),p=()=>{let{setFullScreen:e}=(0,u.useContext)(s),[t,n]=(0,u.useState)(!1),{fullHeight:r,fullWidth:i}=c(),a=(0,u.useCallback)(t=>{n(t),e(t)},[e]),o=(0,u.useCallback)(()=>{document.body.style.overflow=`hidden`,a(!0)},[a]),l=(0,u.useCallback)(()=>{document.body.style.overflow=`unset`,a(!1)},[a]),d=(0,u.useCallback)(e=>{e.keyCode===27&&t&&l()},[l,t]);return(0,u.useEffect)(()=>(document.addEventListener(`keydown`,d,!1),()=>{document.removeEventListener(`keydown`,d,!1)}),[d]),(0,u.useMemo)(()=>({expanded:t,zoomIn:o,zoomOut:l,fullHeight:r,fullWidth:i}),[t,o,l,r,i])},m=({children:e})=>{let t=a(),{expanded:r,fullHeight:i,fullWidth:s,zoomIn:c,zoomOut:l}=p(),{width:m,elementRef:h}=o(),g=(0,u.useMemo)(()=>({width:r?s:m,height:r?i:void 0,expanded:r,expand:c,collapse:l}),[r,i,s,m,c,l]);return n(d.Provider,{value:g,children:n(f,{ref:h,isExpanded:r,"data-testid":`stFullScreenFrame`,theme:t,children:e})})};function h(e){let t=t=>n(m,{children:n(e,{...t})});return t.displayName=`withFullScreenWrapper(${e.displayName||e.name})`,(0,l.default)(t,e)}export{d as n,h as t};