import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{d as t,n,t as r}from"./jsx-runtime-UY3v_sjn.js";import{n as i}from"./createLucideIcon-BeHZXpLp.js";import{_ as a,a as o,g as s,i as c,n as l,o as u,r as d,s as f,t as p,v as m,y as h}from"./proxy-x-TfOqVD.js";var g=r(),_=e(t(),1);function v(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function y(...e){return t=>{let n=!1,r=e.map(e=>{let r=v(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t{let{width:e,height:u,top:d,left:f,right:p,bottom:m,direction:h}=c.current;if(t||a===!1||!s.current||!e||!u)return;let g=h===`rtl`,_=n===`left`?g?`right: ${p}`:`left: ${f}`:g?`left: ${f}`:`right: ${p}`,v=r===`bottom`?`bottom: ${m}`:`top: ${d}`;s.current.dataset.motionPopId=o;let y=document.createElement(`style`);l&&(y.nonce=l);let b=i??document.head;return b.appendChild(y),y.sheet&&y.sheet.insertRule(` [data-motion-pop-id="${o}"] { position: absolute !important; width: ${e}px !important; height: ${u}px !important; ${_}px !important; ${v}px !important; } `),()=>{s.current?.removeAttribute(`data-motion-pop-id`),b.contains(y)&&b.removeChild(y)}},[t]),(0,g.jsx)(x,{isPresent:t,childRef:s,sizeRef:c,pop:a,children:a===!1?e:_.cloneElement(e,{ref:u})})}var C=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:o,mode:c,anchorX:l,anchorY:u,root:d})=>{let f=m(w),p=(0,_.useId)(),h=(0,_.useRef)(n),v=(0,_.useRef)(r);a(()=>{h.current=n,v.current=r});let y=!0,b=(0,_.useMemo)(()=>(y=!1,{id:p,initial:t,isPresent:n,custom:i,onExitComplete:e=>{f.set(e,!0);for(let e of f.values())if(!e)return;r&&r()},register:e=>(f.set(e,!1),()=>{f.delete(e),!h.current&&!f.size&&v.current?.()})}),[n,f,r]);return o&&y&&(b={...b}),(0,_.useMemo)(()=>{f.forEach((e,t)=>f.set(t,!1))},[n]),_.useEffect(()=>{!n&&!f.size&&r&&r()},[n]),e=(0,g.jsx)(S,{pop:c===`popLayout`,isPresent:n,anchorX:l,anchorY:u,root:d,children:e}),(0,g.jsx)(s.Provider,{value:b,children:e})};function w(){return new Map}var T=e=>e.key||``;function E(e){let t=[];return _.Children.forEach(e,e=>{(0,_.isValidElement)(e)&&t.push(e)}),t}var D=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:o=`sync`,propagate:s=!1,anchorX:c=`left`,anchorY:u=`top`,root:d})=>{let[f,p]=l(s),v=(0,_.useMemo)(()=>E(e),[e]),y=s&&!f?[]:v.map(T),b=(0,_.useRef)(!0),x=(0,_.useRef)(v),S=m(()=>new Map),w=(0,_.useRef)(new Set),[D,O]=(0,_.useState)(v),[k,A]=(0,_.useState)(v);a(()=>{b.current=!1,x.current=v;for(let e=0;e{let a=T(e),l=s&&!f?!1:v===k||y.includes(a);return(0,g.jsx)(C,{isPresent:l,initial:!b.current||n?void 0:!1,custom:t,presenceAffectsLayout:i,mode:o,root:d,onExitComplete:l?void 0:()=>{if(w.current.has(a))return;if(S.has(a))w.current.add(a),S.set(a,!0);else return;let e=!0;S.forEach(t=>{t||(e=!1)}),e&&(M?.(),A(x.current),s&&p?.(),r&&r())},anchorX:c,anchorY:u,children:e},a)})})};function O(){!o.current&&c();let[e]=(0,_.useState)(u.current);return e}var k=n(),A=e=>{switch(e){case`up`:return{x:0,y:40};case`down`:return{x:0,y:-40};case`left`:return{x:40,y:0};case`right`:return{x:-40,y:0};default:return{x:0,y:0}}},j=[.22,1,.36,1];function M(e){let t=(0,k.c)(84),n,r,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7]):({delay:c,direction:l,staggerChildren:s,className:a,children:r,as:n,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l);let u=c===void 0?0:c,d=l===void 0?`up`:l,f=O(),m;t[8]===d?m=t[9]:(m=A(d),t[8]=d,t[9]=m);let h=m,v;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v={opacity:0},t[10]=v):v=t[10];let y=s??0,b;t[11]!==u||t[12]!==y?(b={hidden:v,show:{opacity:1,transition:{delay:u,staggerChildren:y}}},t[11]=u,t[12]=y,t[13]=b):b=t[13];let x=b,S;t[14]!==h.x||t[15]!==h.y?(S={opacity:0,x:h.x,y:h.y},t[14]=h.x,t[15]=h.y,t[16]=S):S=t[16];let C;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(C={opacity:1,x:0,y:0,transition:{duration:.5,ease:j}},t[17]=C):C=t[17];let w;t[18]===S?w=t[19]:(w={hidden:S,show:C},t[18]=S,t[19]=w);let T=w;if(f){if(n===`div`){let e=o,n;return t[20]!==r||t[21]!==a||t[22]!==e?(n=(0,g.jsx)(p.div,{className:a,...e,children:r}),t[20]=r,t[21]=a,t[22]=e,t[23]=n):n=t[23],n}let e=o,i;return t[24]!==r||t[25]!==a||t[26]!==e?(i=(0,g.jsx)(p.section,{className:a,...e,children:r}),t[24]=r,t[25]=a,t[26]=e,t[27]=i):i=t[27],i}if(s!==void 0){if(n===`div`){let e;t[28]===a?e=t[29]:(e=i(a),t[28]=a,t[29]=e);let n;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(n={once:!0,margin:`-100px`},t[30]=n):n=t[30];let s=o,c;if(t[31]!==r||t[32]!==T){let e;t[34]===T?e=t[35]:(e=(e,t)=>_.isValidElement(e)?(0,g.jsx)(p.div,{variants:T,children:e},t):e,t[34]=T,t[35]=e),c=_.Children.map(r,e),t[31]=r,t[32]=T,t[33]=c}else c=t[33];let l;return t[36]!==x||t[37]!==e||t[38]!==s||t[39]!==c?(l=(0,g.jsx)(D,{mode:`wait`,children:(0,g.jsx)(p.div,{className:e,variants:x,initial:`hidden`,whileInView:`show`,viewport:n,...s,children:c})}),t[36]=x,t[37]=e,t[38]=s,t[39]=c,t[40]=l):l=t[40],l}let e;t[41]===a?e=t[42]:(e=i(a),t[41]=a,t[42]=e);let s;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(s={once:!0,margin:`-100px`},t[43]=s):s=t[43];let c=o,l;if(t[44]!==r||t[45]!==T){let e;t[47]===T?e=t[48]:(e=(e,t)=>_.isValidElement(e)?(0,g.jsx)(p.div,{variants:T,children:e},t):e,t[47]=T,t[48]=e),l=_.Children.map(r,e),t[44]=r,t[45]=T,t[46]=l}else l=t[46];let u;return t[49]!==x||t[50]!==e||t[51]!==c||t[52]!==l?(u=(0,g.jsx)(D,{mode:`wait`,children:(0,g.jsx)(p.section,{className:e,variants:x,initial:`hidden`,whileInView:`show`,viewport:s,...c,children:l})}),t[49]=x,t[50]=e,t[51]=c,t[52]=l,t[53]=u):u=t[53],u}if(n===`div`){let e;t[54]===a?e=t[55]:(e=i(a),t[54]=a,t[55]=e);let n;t[56]!==h.x||t[57]!==h.y?(n={opacity:0,x:h.x,y:h.y},t[56]=h.x,t[57]=h.y,t[58]=n):n=t[58];let s,c;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(s={opacity:1,x:0,y:0},c={once:!0,margin:`-100px`},t[59]=s,t[60]=c):(s=t[59],c=t[60]);let l;t[61]===u?l=t[62]:(l={delay:u,duration:.6,ease:j},t[61]=u,t[62]=l);let d=o,f;return t[63]!==r||t[64]!==e||t[65]!==n||t[66]!==l||t[67]!==d?(f=(0,g.jsx)(D,{mode:`wait`,children:(0,g.jsx)(p.div,{className:e,initial:n,whileInView:s,viewport:c,transition:l,...d,children:r})}),t[63]=r,t[64]=e,t[65]=n,t[66]=l,t[67]=d,t[68]=f):f=t[68],f}let E;t[69]===a?E=t[70]:(E=i(a),t[69]=a,t[70]=E);let M;t[71]!==h.x||t[72]!==h.y?(M={opacity:0,x:h.x,y:h.y},t[71]=h.x,t[72]=h.y,t[73]=M):M=t[73];let N,P;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(N={opacity:1,x:0,y:0},P={once:!0,margin:`-100px`},t[74]=N,t[75]=P):(N=t[74],P=t[75]);let F;t[76]===u?F=t[77]:(F={delay:u,duration:.6,ease:j},t[76]=u,t[77]=F);let I=o,L;return t[78]!==r||t[79]!==E||t[80]!==M||t[81]!==F||t[82]!==I?(L=(0,g.jsx)(D,{mode:`wait`,children:(0,g.jsx)(p.section,{className:E,initial:M,whileInView:N,viewport:P,transition:F,...I,children:r})}),t[78]=r,t[79]=E,t[80]=M,t[81]=F,t[82]=I,t[83]=L):L=t[83],L}export{D as n,M as t};