const e=require(`./chunk-BcutgqC9.cjs`),t=require(`./dist-B9QvvA-B.cjs`),n=require(`./dist-C1zbYA0G.cjs`);let r=require(`react`);r=e.n(r,1);function i(e,t){return r.useReducer((e,n)=>t[e][n]??e,e)}var a=e=>{let{present:t,children:i}=e,a=o(t),s=typeof i==`function`?i({present:a.isPresent}):r.Children.only(i),l=n.o(a.ref,c(s));return typeof i==`function`||a.isPresent?r.cloneElement(s,{ref:l}):null};a.displayName=`Presence`;function o(e){let[n,a]=r.useState(),o=r.useRef(null),c=r.useRef(e),l=r.useRef(`none`),[u,d]=i(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return r.useEffect(()=>{let e=s(o.current);l.current=u===`mounted`?e:`none`},[u]),t.n(()=>{let t=o.current,n=c.current;if(n!==e){let r=l.current,i=s(t);e?d(`MOUNT`):i===`none`||t?.display===`none`?d(`UNMOUNT`):d(n&&r!==i?`ANIMATION_OUT`:`UNMOUNT`),c.current=e}},[e,d]),t.n(()=>{if(n){let e,t=n.ownerDocument.defaultView??window,r=r=>{let i=s(o.current).includes(CSS.escape(r.animationName));if(r.target===n&&i&&(d(`ANIMATION_END`),!c.current)){let r=n.style.animationFillMode;n.style.animationFillMode=`forwards`,e=t.setTimeout(()=>{n.style.animationFillMode===`forwards`&&(n.style.animationFillMode=r)})}},i=e=>{e.target===n&&(l.current=s(o.current))};return n.addEventListener(`animationstart`,i),n.addEventListener(`animationcancel`,r),n.addEventListener(`animationend`,r),()=>{t.clearTimeout(e),n.removeEventListener(`animationstart`,i),n.removeEventListener(`animationcancel`,r),n.removeEventListener(`animationend`,r)}}else d(`ANIMATION_END`)},[n,d]),{isPresent:[`mounted`,`unmountSuspended`].includes(u),ref:r.useCallback(e=>{o.current=e?getComputedStyle(e):null,a(e)},[])}}function s(e){return e?.animationName||`none`}function c(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return a}});
//# sourceMappingURL=dist-_OzWLRpv.cjs.map