"use strict";const D=require("./mergeProps-CxnHrnow.cjs.js"),z=require("react"),F=require("./platform-BDLy2vDY.cjs.js");function I(e,t){if(!e)return!1;let l=window.getComputedStyle(e),r=/(auto|scroll)/.test(l.overflow+l.overflowX+l.overflowY);return r&&t&&(r=e.scrollHeight!==e.clientHeight||e.scrollWidth!==e.clientWidth),r}function G(e,t){const l=[];for(;e&&e!==document.documentElement;)I(e,t)&&l.push(e),e=e.parentElement;return l}let J=0;const x=new Map;function K(e){let[t,l]=z.useState();return D.$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(()=>{if(!e)return;let r=x.get(e);if(r)l(r.element.id);else{let o=`react-aria-description-${J++}`;l(o);let f=document.createElement("div");f.id=o,f.style.display="none",f.textContent=e,document.body.appendChild(f),r={refCount:0,element:f},x.set(e,r)}return r.refCount++,()=>{r&&--r.refCount===0&&(r.element.remove(),x.delete(e))}},[e]),{"aria-describedby":e?t:void 0}}function C(e,t){let l=M(e,t,"left"),r=M(e,t,"top"),o=t.offsetWidth,f=t.offsetHeight,c=e.scrollLeft,d=e.scrollTop,{borderTopWidth:i,borderLeftWidth:a,scrollPaddingTop:n,scrollPaddingRight:s,scrollPaddingBottom:N,scrollPaddingLeft:R}=getComputedStyle(e),{scrollMarginTop:y,scrollMarginRight:B,scrollMarginBottom:S,scrollMarginLeft:W}=getComputedStyle(t),k=c+parseInt(a,10),L=d+parseInt(i,10),u=k+e.clientWidth,b=L+e.clientHeight,p=parseInt(n,10)||0,$=parseInt(N,10)||0,g=parseInt(s,10)||0,v=parseInt(R,10)||0,H=parseInt(y,10)||0,X=parseInt(S,10)||0,Y=parseInt(B,10)||0,q=parseInt(W,10)||0,P=l-q,h=l+o+Y,m=r-H,T=r+f+X,j=c+parseInt(a,10)+v,w=u-g,A=d+parseInt(i,10)+p,O=b-$;if((P>j||h<w)&&(P<=c+v?c=P-parseInt(a,10)-v:h>u-g&&(c+=h-u+g)),(m>A||T<O)&&(m<=L+p?d=m-parseInt(i,10)-p:T>b-$&&(d+=T-b+$)),process.env.NODE_ENV==="test"){e.scrollLeft=c,e.scrollTop=d;return}e.scrollTo({left:c,top:d})}function M(e,t,l){const r=l==="left"?"offsetLeft":"offsetTop";let o=0;for(;t.offsetParent&&(o+=t[r],t.offsetParent!==e);){if(t.offsetParent.contains(e)){o-=e[r];break}t=t.offsetParent}return o}function Q(e,t){if(e&&document.contains(e)){let c=document.scrollingElement||document.documentElement;if(!(window.getComputedStyle(c).overflow==="hidden")&&!F.$c87311424ea30a05$export$6446a186d09e379e()){var l;let{left:i,top:a}=e.getBoundingClientRect();e==null||(l=e.scrollIntoView)===null||l===void 0||l.call(e,{block:"nearest"});let{left:n,top:s}=e.getBoundingClientRect();if(Math.abs(i-n)>1||Math.abs(a-s)>1){var r,o,f;t==null||(o=t.containingElement)===null||o===void 0||(r=o.scrollIntoView)===null||r===void 0||r.call(o,{block:"center",inline:"center"}),(f=e.scrollIntoView)===null||f===void 0||f.call(e,{block:"nearest"})}}else{let i=G(e);for(let a of i)C(a,e)}}}exports.$2f04cbc44ee30ce0$export$53a0910f038337bd=C;exports.$2f04cbc44ee30ce0$export$c826860796309d1b=Q;exports.$cc38e7bd3fc7b213$export$2bb74740c4e19def=I;exports.$ef06256079686ba0$export$f8aeda7b10753fa1=K;
//# sourceMappingURL=scrollIntoView-BE5bh59O.cjs.js.map
