import{aE as f,j as c,r as n,m as p,f as h,c as x,L as g,aF as y}from"./index-D3uELfdo.js";const m=n.createContext(null);m.displayName="ElementFullscreenContext";const C=x("div",{target:"elp1w7k0"})(({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"}:{}}),""),v=()=>{const{setFullScreen:e}=n.useContext(g),[t,s]=n.useState(!1),{fullHeight:d,fullWidth:i}=y(),o=n.useCallback(l=>{s(l),e(l)},[e]),r=n.useCallback(()=>{document.body.style.overflow="hidden",o(!0)},[o]),a=n.useCallback(()=>{document.body.style.overflow="unset",o(!1)},[o]),u=n.useCallback(l=>{l.keyCode===27&&t&&a()},[a,t]);return n.useEffect(()=>(document.addEventListener("keydown",u,!1),()=>{document.removeEventListener("keydown",u,!1)}),[u]),n.useMemo(()=>({expanded:t,zoomIn:r,zoomOut:a,fullHeight:d,fullWidth:i}),[t,r,a,d,i])},w=({children:e})=>{const t=p(),{expanded:s,fullHeight:d,fullWidth:i,zoomIn:o,zoomOut:r}=v(),{width:a,elementRef:u}=h(),l=n.useMemo(()=>({width:s?i:a,height:s?d:void 0,expanded:s,expand:o,collapse:r}),[s,d,i,a,o,r]);return c.jsx(m.Provider,{value:l,children:c.jsx(C,{ref:u,isExpanded:s,"data-testid":"stFullScreenFrame",theme:t,children:e})})};function E(e){const t=s=>c.jsx(w,{children:c.jsx(e,{...s})});return t.displayName=`withFullScreenWrapper(${e.displayName||e.name})`,f(t,e)}export{m as d,E as v};
