import{q as v,f as L,c as F,bZ as P,b_ as h,b$ as q}from"./index-6Jqoo2rk.js";function M(t){return v(()=>{const e=t.name||"s";return{enterActive:(t.enterActiveClass||e+"-enter-active").split(" "),enter:(t.enterClass||e+"-enter").split(" "),enterTo:(t.enterToClass||e+"-enter-to").split(" "),exitActive:(t.exitActiveClass||e+"-exit-active").split(" "),exit:(t.exitClass||e+"-exit").split(" "),exitTo:(t.exitToClass||e+"-exit-to").split(" "),move:(t.moveClass||e+"-move").split(" ")}})}function C(t){requestAnimationFrame(()=>requestAnimationFrame(t))}function N(t,e,n,i,s){const{onBeforeEnter:c,onEnter:u,onAfterEnter:f}=e;let m;c?.(n),n.classList.add(...t.enter),n.classList.add(...t.enterActive),queueMicrotask(()=>{if(!n.parentNode)return i?.();u?.(n,()=>r())}),C(()=>{n.classList.remove(...t.enter),n.classList.add(...t.enterTo),(!u||u.length<2)&&(n.addEventListener("transitionend",r),n.addEventListener("animationend",r),s!==void 0&&(m=window.setTimeout(()=>r(),s)))});function r(d){(!d||d.target===n)&&(clearTimeout(m),i?.(),n.removeEventListener("transitionend",r),n.removeEventListener("animationend",r),n.classList.remove(...t.enterActive),n.classList.remove(...t.enterTo),f?.(n))}}function R(t,e,n,i,s){const{onBeforeExit:c,onExit:u,onAfterExit:f}=e;if(!n.parentNode)return i?.();let m;c?.(n),n.classList.add(...t.exit),n.classList.add(...t.exitActive),u?.(n,()=>r()),C(()=>{n.classList.remove(...t.exit),n.classList.add(...t.exitTo),(!u||u.length<2)&&(n.addEventListener("transitionend",r),n.addEventListener("animationend",r),s!==void 0&&(m=window.setTimeout(()=>r(),s)))});function r(d){(!d||d.target===n)&&(clearTimeout(m),i?.(),n.removeEventListener("transitionend",r),n.removeEventListener("animationend",r),n.classList.remove(...t.exitActive),n.classList.remove(...t.exitTo),f?.(n))}}var S=()=>{},y=(t,e)=>e();function _(t,e){const n=L(t),i=n?[n]:[],{onEnter:s=y,onExit:c=y}=e,[u,f]=F(e.appear?[]:i),[m]=q();let r,d=!1;function x(o,a){if(!o)return a&&a();d=!0,c(o,()=>{h(()=>{d=!1,f(A=>A.filter(w=>w!==o)),a&&a()})})}function E(o){const a=r;if(!a)return o&&o();r=void 0,f(A=>[a,...A]),s(a,o??S)}const b=e.mode==="out-in"?(o=>d||x(o,E)):e.mode==="in-out"?(o=>E(()=>x(o))):(o=>{x(o),E()});return P(o=>{const a=t();return L(m)?(m(),o):(a!==o&&(r=a,h(()=>L(()=>b(o)))),a)},e.appear?void 0:n),u}var T=t=>t instanceof Element;function l(t,e){if(e(t))return t;if(typeof t=="function"&&!t.length)return l(t(),e);if(Array.isArray(t)){const n=[];for(const i of t){const s=l(i,e);s&&(Array.isArray(s)?n.push.apply(n,s):n.push(s))}return n.length?n:null}return null}function O(t,e=T,n=T){const i=v(t),s=v(()=>l(i(),e));return s.toArray=()=>{const c=s();return Array.isArray(c)?c:c?[c]:[]},s}function g(t,e){if(e(t))return t;if(typeof t=="function"&&!t.length)return g(t(),e);if(Array.isArray(t))for(const n of t){const i=g(n,e);if(i)return i}return null}function k(t,e=T,n=T){const i=v(t);return v(()=>g(i(),e))}const B={inout:"in-out",outin:"out-in"},D=t=>{const e=M(t);return _(k(()=>t.children),{mode:B[t.mode],appear:t.appear,onEnter(n,i){N(e(),t,n,i,t.duration)},onExit(n,i){R(e(),t,n,i,t.duration)}})};export{D as T,k as a,R as b,M as c,N as e,g,O as r};
//# sourceMappingURL=transition-DuxZkCEv.js.map
