import t from"../dom-utils/getClippingRect.js";import e from"../dom-utils/getDocumentElement.js";import o from"../dom-utils/getBoundingClientRect.js";import r from"./computeOffsets.js";import m from"./rectToClientRect.js";import{basePlacements as i,popper as n,clippingParents as s,reference as p,right as f,bottom as a,top as d,viewport as l}from"../enums.js";import{isElement as c}from"../dom-utils/instanceOf.js";import u from"./mergePaddingObject.js";import g from"./expandToHashMap.js";function j(j,v){void 0===v&&(v={});var b=v,y=b.placement,x=void 0===y?j.placement:y,O=b.strategy,h=void 0===O?j.strategy:O,C=b.boundary,B=void 0===C?s:C,E=b.rootBoundary,R=void 0===E?l:E,D=b.elementContext,T=void 0===D?n:D,k=b.altBoundary,H=void 0!==k&&k,M=b.padding,P=void 0===M?0:M,q=u("number"!=typeof P?P:g(P,i)),w=T===n?p:n,z=j.rects.popper,A=j.elements[H?w:T],F=t(c(A)?A:A.contextElement||e(j.elements.popper),B,R,h),G=o(j.elements.reference),I=r({reference:G,element:z,strategy:"absolute",placement:x}),J=m(Object.assign({},z,I)),K=T===n?J:G,L={top:F.top-K.top+q.top,bottom:K.bottom-F.bottom+q.bottom,left:F.left-K.left+q.left,right:K.right-F.right+q.right},N=j.modifiersData.offset;if(T===n&&N){var Q=N[x];Object.keys(L).forEach((function(t){var e=[f,a].indexOf(t)>=0?1:-1,o=[d,a].indexOf(t)>=0?"y":"x";L[t]+=Q[o]*e}))}return L}export{j as default};
//# sourceMappingURL=detectOverflow.js.map
