import{o as e}from"./rolldown-runtime.C0FnF6B9.js";import{r as t}from"./emotion-is-prop-valid.esm.CuYlOKOk.js";import{_ as n,i as r,t as i}from"./emotion-styled.browser.esm.BYv_Qzcq.js";import{t as a}from"./useEmotionTheme.Dmt_qJ4x.js";import{t as o}from"./useCalculatedDimensions.DmyA6xJn.js";import{t as s}from"./ViewStateContext.BWrgx8uF.js";import{t as c}from"./useWindowDimensionsContext.Bq7b7Xl1.js";var l=e(n(),1),u=e(t(),1),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:n,fullHeight:i,fullWidth:s,zoomIn:c,zoomOut:l}=p(),{width:m,elementRef:h}=o(),g=(0,u.useMemo)(()=>({width:n?s:m,height:n?i:void 0,expanded:n,expand:c,collapse:l}),[n,i,s,m,c,l]);return r(d.Provider,{value:g,children:r(f,{ref:h,isExpanded:n,"data-testid":`stFullScreenFrame`,theme:t,children:e})})};function h(e){let t=t=>r(m,{children:r(e,{...t})});return t.displayName=`withFullScreenWrapper(${e.displayName||e.name})`,(0,l.default)(t,e)}export{d as n,h as t};