import{a as e,n as t}from"./chunk-BneVvdWh.js";import{t as n}from"./react-C7IZe2D1.js";import{t as r}from"./client-o3HipSzo.js";function i(){return globalThis.IS_REACT_ACT_ENVIRONMENT}var a,o,s,c,l,u,d;t((()=>{a=e(n(),1),o=e(r(),1),s=new Map,c=({callback:e,children:t})=>{let n=a.useRef();return a.useLayoutEffect(()=>{n.current!==e&&(n.current=e,e())},[e]),t},typeof Promise.withResolvers>`u`&&(Promise.withResolvers=()=>{let e=null,t=null;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}),l=async(e,t,n)=>{let r=await d(t,n);if(i()){r.render(e);return}let{promise:o,resolve:s}=Promise.withResolvers();return r.render(a.createElement(c,{callback:s},e)),o},u=(e,t)=>{let n=s.get(e);n&&(n.unmount(),s.delete(e))},d=async(e,t)=>{let n=s.get(e);return n||(n=o.createRoot(e,t),s.set(e,n)),n}}))();export{l as renderElement,u as unmountElement};