"use strict";var w=Object.create;var c=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames,f=Object.getOwnPropertySymbols,D=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty,h=Object.prototype.propertyIsEnumerable;var i=(e,t,r)=>t in e?c(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,m=(e,t)=>{for(var r in t||(t={}))d.call(t,r)&&i(e,r,t[r]);if(f)for(var r of f(t))h.call(t,r)&&i(e,r,t[r]);return e};var R=(e,t)=>{var r={};for(var o in e)d.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(e!=null&&f)for(var o of f(e))t.indexOf(o)<0&&h.call(e,o)&&(r[o]=e[o]);return r};var v=(e,t)=>{for(var r in t)c(e,r,{get:t[r],enumerable:!0})},P=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of _(t))!d.call(e,a)&&a!==r&&c(e,a,{get:()=>t[a],enumerable:!(o=E(t,a))||o.enumerable});return e};var M=(e,t,r)=>(r=e!=null?w(D(e)):{},P(t||!e||!e.__esModule?c(r,"default",{value:e,enumerable:!0}):r,e)),N=e=>P(c({},"__esModule",{value:!0}),e);var j={};v(j,{Portal:()=>b});module.exports=N(j);var n=M(require("react")),s=require("@reach/utils"),y=require("react-dom"),g=({children:e,type:t="reach-portal",containerRef:r})=>{let o=n.useRef(null),a=n.useRef(null),l=(0,s.useForceUpdate)();return(0,s.useIsomorphicLayoutEffect)(()=>{if(!o.current)return;let u=o.current.ownerDocument,p=(r==null?void 0:r.current)||u.body;return a.current=u==null?void 0:u.createElement(t),p.appendChild(a.current),l(),()=>{a.current&&p&&p.removeChild(a.current)}},[t,l,r]),a.current?(0,y.createPortal)(e,a.current):n.createElement("span",{ref:o})},b=r=>{var o=r,{unstable_skipInitialRender:e}=o,t=R(o,["unstable_skipInitialRender"]);let[a,l]=n.useState(!1);return n.useEffect(()=>{e&&l(!0)},[e]),e&&!a?null:n.createElement(g,m({},t))};b.displayName="Portal";0&&(module.exports={Portal});
