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