Liferay.Loader.define("frontend-js-web@5.0.31/liferay/align",["module","exports","require"],(function(t,e,o){window;{function n(t){return t&&"object"==typeof t&&9===t.nodeType}function i(t){return t&&t===t.window}function r(t){const e=h(t,"Height");const o=function(t){return h(t,"Width")}(t);return a(e,e,0,o,0,o)}function f(t,e){return t.offsetLeft+(e?0:l(t).left)}function c(t,e){return t?n(t)||i(t)?r(t):function(t,e=!1){const o=e?function(t){if(i(t))return t.pageXOffset;if(n(t))return t.defaultView.pageXOffset;return t.scrollLeft}(document):0,r=e?function(t){if(i(t))return t.pageYOffset;if(n(t))return t.defaultView.pageYOffset;return t.scrollTop}(document):0;return a(t.bottom+r,t.height,t.left+o,t.right+o,t.top+r,t.width)}(t.getBoundingClientRect(),e):{bottom:0,height:0,left:0,right:0,top:0,width:0}}function h(t,e){if(i(t))return function(t,e){let o=t;return i(t)&&(o=t.document.documentElement),n(t)&&(o=t.documentElement),o["client".concat(e)]}(t,e);if(n(t)){const o=t.documentElement;return Math.max(t.body["scroll".concat(e)],o["scroll".concat(e)],t.body["offset".concat(e)],o["offset".concat(e)],o["client".concat(e)])}return Math.max(t["client".concat(e)],t["scroll".concat(e)],t["offset".concat(e)])}function l(t){const e=function(t){const e=getComputedStyle(t),o=e.mozTransform||e.msTransform||e.transform;if("none"!==o){const t=[],e=/([\d-.\s]+)/g;let n=e.exec(o);for(;n;)t.push(n[1]),n=e.exec(o);return t}}(t),o={left:0,top:0};return e&&(o.left=parseFloat(6===e.length?e[4]:e[13]),o.top=parseFloat(6===e.length?e[5]:e[14])),o}function u(t,e){return o=t.top,n=t.left,i=t.bottom,r=t.right,f=e.top,c=e.left,h=e.bottom,l=e.right,!(f>i||h<o||c>r||l<n);var o,n,i,r,f,c,h,l}function g(t,e){if(!u(t,e))return null;const o=Math.min(t.bottom,e.bottom),n=Math.min(t.right,e.right),i=Math.max(t.left,e.left),r=Math.max(t.top,e.top);return a(o,o-r,i,n,r,n-i)}function a(t,e,o,n,i,r){return{bottom:t,height:e,left:o,right:n,top:i,width:r}}Object.defineProperty(e,"__esModule",{value:!0}),e.align=function(t,e,o,n=!0){let i;if(n){const n=p(t,e,o);o=n.position,i=n.region}else i=s(t,e,o);if("fixed"!==window.getComputedStyle(t).getPropertyValue("position")){i.top+=window.pageYOffset,i.left+=window.pageXOffset;let e=t;for(;e=e.offsetParent;)i.top-=(c=void 0,(r=e).offsetTop+(c?0:l(r).top)),i.left-=f(e)}var r,c;return t.style.top=i.top+"px",t.style.left=i.left+"px",o},e.getAlignBestRegion=function(t,e,o){return p(t,e,o).region},e.getAlignRegion=s,e.suggestAlignBestRegion=p,e.ALIGN_POSITIONS=void 0;const t={BottomCenter:4,BottomLeft:5,BottomRight:3,LeftCenter:6,RightCenter:2,TopCenter:0,TopLeft:7,TopRight:1};function s(e,o,n){const i=c(o),r=c(e);let f=0,h=0;switch(n){case t.TopCenter:f=i.top-r.height,h=i.left+i.width/2-r.width/2;break;case t.RightCenter:f=i.top+i.height/2-r.height/2,h=i.left+i.width;break;case t.BottomCenter:f=i.bottom,h=i.left+i.width/2-r.width/2;break;case t.LeftCenter:f=i.top+i.height/2-r.height/2,h=i.left-r.width;break;case t.TopRight:f=i.top-r.height,h=i.right-r.width;break;case t.BottomRight:f=i.bottom,h=i.right-r.width;break;case t.BottomLeft:f=i.bottom,h=i.left;break;case t.TopLeft:f=i.top-r.height,h=i.left}return{bottom:f+r.height,height:r.height,left:h,right:h+r.width,top:f,width:r.width}}function p(t,e,o){let n=0,i=o,r=s(t,e,i),f=i,h=r;const l=c(window);for(let m=0;m<8;){if(u(l,h)){const t=g(l,h),e=t.width*t.height;if(e>n&&(n=e,r=h,i=f),a=h,p=void 0,d=void 0,p=c(window),(d=a).top>=p.top&&d.bottom<=p.bottom&&d.right<=p.right&&d.left>=p.left)break}f=(o+ ++m)%8,h=s(t,e,f)}var a,p,d;return{position:i,region:r}}e.ALIGN_POSITIONS=t,t.Bottom=t.BottomCenter,t.Left=t.LeftCenter,t.Right=t.RightCenter,t.Top=t.TopCenter}}));
//# sourceMappingURL=align.js.map