1import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{n as t,t as n}from"./jsx-runtime-B2Ixnf4W.js";import{G as r,K as i,U as a,W as o,c as s,l as c,x as l}from"./dist-y5akttHa.js";var u=n(),d=e(t(),1);function f(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function p(...e){return t=>{let n=!1,r=e.map(e=>{let r=f(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():f(e[t],null)}}}}function m(...e){return d.useCallback(p(...e),e)}var h=class extends d.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(t&&e.isPresent&&!this.props.isPresent){let e=t.offsetParent,n=l(e)&&e.offsetWidth||0,r=l(e)&&e.offsetHeight||0,i=this.props.sizeRef.current;i.height=t.offsetHeight||0,i.width=t.offsetWidth||0,i.top=t.offsetTop,i.left=t.offsetLeft,i.right=n-i.width-i.left,i.bottom=r-i.height-i.top}return null}componentDidUpdate(){}render(){return this.props.children}};function g({children:e,isPresent:t,anchorX:n,anchorY:r,root:i}){let a=(0,d.useId)(),o=(0,d.useRef)(null),s=(0,d.useRef)({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:l}=(0,d.useContext)(c),f=m(o,e.props?.ref??e?.ref);return(0,d.useInsertionEffect)(()=>{let{width:e,height:c,top:u,left:d,right:f,bottom:p}=s.current;if(t||!o.current||!e||!c)return;let m=n===`left`?`left: ${d}`:`right: ${f}`,h=r===`bottom`?`bottom: ${p}`:`top: ${u}`;o.current.dataset.motionPopId=a;let g=document.createElement(`style`);l&&(g.nonce=l);let _=i??document.head;return _.appendChild(g),g.sheet&&g.sheet.insertRule(` 2 [data-motion-pop-id="${a}"] { 3 position: absolute !important; 4 width: ${e}px !important; 5 height: ${c}px !important; 6 ${m}px !important; 7 ${h}px !important; 8 } 9 `),()=>{_.contains(g)&&_.removeChild(g)}},[t]),(0,u.jsx)(h,{isPresent:t,childRef:o,sizeRef:s,children:d.cloneElement(e,{ref:f})})}var _=({children:e,initial:t,isPresent:n,onExitComplete:i,custom:o,presenceAffectsLayout:s,mode:c,anchorX:l,anchorY:f,root:p})=>{let m=r(v),h=(0,d.useId)(),_=!0,y=(0,d.useMemo)(()=>(_=!1,{id:h,initial:t,isPresent:n,custom:o,onExitComplete:e=>{m.set(e,!0);for(let e of m.values())if(!e)return;i&&i()},register:e=>(m.set(e,!1),()=>m.delete(e))}),[n,m,i]);return s&&_&&(y={...y}),(0,d.useMemo)(()=>{m.forEach((e,t)=>m.set(t,!1))},[n]),d.useEffect(()=>{!n&&!m.size&&i&&i()},[n]),c===`popLayout`&&(e=(0,u.jsx)(g,{isPresent:n,anchorX:l,anchorY:f,root:p,children:e})),(0,u.jsx)(a.Provider,{value:y,children:e})};function v(){return new Map}var y=e=>e.key||``;function b(e){let t=[];return d.Children.forEach(e,e=>{(0,d.isValidElement)(e)&&t.push(e)}),t}var x=({children:e,custom:t,initial:n=!0,onExitComplete:a,presenceAffectsLayout:c=!0,mode:l=`sync`,propagate:f=!1,anchorX:p=`left`,anchorY:m=`top`,root:h})=>{let[g,v]=s(f),x=(0,d.useMemo)(()=>b(e),[e]),S=f&&!g?[]:x.map(y),C=(0,d.useRef)(!0),w=(0,d.useRef)(x),T=r(()=>new Map),E=(0,d.useRef)(new Set),[D,O]=(0,d.useState)(x),[k,A]=(0,d.useState)(x);o(()=>{C.current=!1,w.current=x;for(let e=0;e<k.length;e++){let t=y(k[e]);S.includes(t)?(T.delete(t),E.current.delete(t)):T.get(t)!==!0&&T.set(t,!1)}},[k,S.length,S.join(`-`)]);let j=[];if(x!==D){let e=[...x];for(let t=0;t<k.length;t++){let n=k[t],r=y(n);S.includes(r)||(e.splice(t,0,n),j.push(n))}return l===`wait`&&j.length&&(e=j),A(b(e)),O(x),null}let{forceRender:M}=(0,d.useContext)(i);return(0,u.jsx)(u.Fragment,{children:k.map(e=>{let r=y(e),i=f&&!g?!1:x===k||S.includes(r);return(0,u.jsx)(_,{isPresent:i,initial:!C.current||n?void 0:!1,custom:t,presenceAffectsLayout:c,mode:l,root:h,onExitComplete:i?void 0:()=>{if(E.current.has(r))return;if(E.current.add(r),T.has(r))T.set(r,!0);else return;let e=!0;T.forEach(t=>{t||(e=!1)}),e&&(M?.(),A(w.current),f&&v?.(),a&&a())},anchorX:p,anchorY:m,children:e},r)})})};export{x as t};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.