import{r as e,ak as E,aV as p,ao as l,gy as c,j as u,ca as P}from"./index-7722cded.js";function g(a){return typeof a=="function"?a():a}const x=e.forwardRef(function(i,o){const{children:t,container:s,disablePortal:r=!1}=i,[n,f]=e.useState(null),m=E(e.isValidElement(t)?p(t):null,o);if(l(()=>{r||f(g(s)||document.body)},[s,r]),l(()=>{if(n&&!r)return c(o,n),()=>{c(o,null)}},[o,n,r]),r){if(e.isValidElement(t)){const d={ref:m};return e.cloneElement(t,d)}return u(e.Fragment,{children:t})}return u(e.Fragment,{children:n&&P.createPortal(t,n)})});export{x as P};
