const n=l=>null===l?null:l.classList.contains("element_scrolled")||"BODY"===(null==l?void 0:l.tagName)?l:n(l.offsetParent);function l({actionElement:n,changedElement:l,intoView:o}){const e=o||document.body,t=e.offsetParent,i=!!e.classList.contains("element_scrolled"),d=i?n.offsetTop-e.scrollTop+t.offsetTop:n.offsetTop-window.scrollY,u=i?n.offsetLeft+t.offsetLeft:n.offsetLeft,w=(null==l?void 0:l.offsetHeight)>window.innerHeight-d?d-(null==l?void 0:l.offsetHeight)-16:d+(null==n?void 0:n.offsetHeight)+16,c=(null==l?void 0:l.offsetWidth)>window.innerWidth-u?u+(null==n?void 0:n.offsetWidth)-(null==l?void 0:l.offsetWidth):u,m=window.innerHeight-(null==l?void 0:l.offsetHeight),v=window.innerWidth-(null==l?void 0:l.offsetWidth);return{top:w<8?8:w>m?m-8:w,left:c<0?0:c>v?v:c}}function o({actionElement:n,changedElement:l,intoView:o}){const e=o||document.body,t=e.offsetHeight<l.offsetHeight?window.screen.height:e.offsetHeight,i=e.offsetWidth<l.offsetWidth?window.screen.width:e.offsetWidth;return{y:t-n.offsetTop<l.offsetHeight+n.offsetHeight?"top":"bottom",x:i-n.offsetLeft<l.offsetWidth?"right":"left"}}export{l as a,n as g,o as p}