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