import{viewport as t}from"../enums.js";import o from"./getViewportRect.js";import e from"./getDocumentRect.js";import r from"./listScrollParents.js";import i from"./getOffsetParent.js";import n from"./getDocumentElement.js";import m from"./getComputedStyle.js";import{isElement as f,isHTMLElement as p}from"./instanceOf.js";import c from"./getBoundingClientRect.js";import l from"./getParentNode.js";import s from"./contains.js";import u from"./getNodeName.js";import g from"../utils/rectToClientRect.js";import{max as a,min as h}from"../utils/math.js";function d(r,i,m){return i===t?g(o(r,m)):f(i)?function(t,o){var e=c(t,!1,"fixed"===o);return e.top=e.top+t.clientTop,e.left=e.left+t.clientLeft,e.bottom=e.top+t.clientHeight,e.right=e.left+t.clientWidth,e.width=t.clientWidth,e.height=t.clientHeight,e.x=e.left,e.y=e.top,e}(i,m):g(e(n(r)))}function j(t,o,e,n){var c="clippingParents"===o?function(t){var o=r(l(t)),e=["absolute","fixed"].indexOf(m(t).position)>=0&&p(t)?i(t):t;return f(e)?o.filter((function(t){return f(t)&&s(t,e)&&"body"!==u(t)})):[]}(t):[].concat(o),g=[].concat(c,[e]),j=g[0],b=g.reduce((function(o,e){var r=d(t,e,n);return o.top=a(r.top,o.top),o.right=h(r.right,o.right),o.bottom=h(r.bottom,o.bottom),o.left=a(r.left,o.left),o}),d(t,j,n));return b.width=b.right-b.left,b.height=b.bottom-b.top,b.x=b.left,b.y=b.top,b}export{j as default};
//# sourceMappingURL=getClippingRect.js.map
