6 lines
9.1 KiB
JavaScript
6 lines
9.1 KiB
JavaScript
|
/*
|
||
|
Copyright (C) Federico Zivolo 2017
|
||
|
Distributed under the MIT License (license terms are at http://opensource.org/licenses/MIT).
|
||
|
*/function a(a,b){if(1!==a.nodeType)return[];const c=getComputedStyle(a,null);return b?c[b]:c}function b(a){return'HTML'===a.nodeName?a:a.parentNode||a.host}function c(d){if(!d)return document.body;switch(d.nodeName){case'HTML':case'BODY':return d.ownerDocument.body;case'#document':return d.body;}const{overflow:e,overflowX:f,overflowY:g}=a(d);return /(auto|scroll)/.test(e+g+f)?d:c(b(d))}function d(b){const c=b&&b.offsetParent,e=c&&c.nodeName;return e&&'BODY'!==e&&'HTML'!==e?-1!==['TD','TABLE'].indexOf(c.nodeName)&&'static'===a(c,'position')?d(c):c:b?b.ownerDocument.documentElement:document.documentElement}function e(a){const{nodeName:b}=a;return'BODY'!==b&&('HTML'===b||d(a.firstElementChild)===a)}function f(a){return null===a.parentNode?a:f(a.parentNode)}function g(a,b){if(!a||!a.nodeType||!b||!b.nodeType)return document.documentElement;const c=a.compareDocumentPosition(b)&Node.DOCUMENT_POSITION_FOLLOWING,h=c?a:b,i=c?b:a,j=document.createRange();j.setStart(h,0),j.setEnd(i,0);const{commonAncestorContainer:k}=j;if(a!==k&&b!==k||h.contains(i))return e(k)?k:d(k);const l=f(a);return l.host?g(l.host,b):g(a,f(b).host)}function h(a,b='top'){const c='top'===b?'scrollTop':'scrollLeft',d=a.nodeName;if('BODY'===d||'HTML'===d){const b=a.ownerDocument.documentElement,d=a.ownerDocument.scrollingElement||b;return d[c]}return a[c]}function i(a,b,c=!1){const d=h(b,'top'),e=h(b,'left'),f=c?-1:1;return a.top+=d*f,a.bottom+=d*f,a.left+=e*f,a.right+=e*f,a}function j(a,b){const c='x'===b?'Left':'Top',d='Left'==c?'Right':'Bottom';return parseFloat(a[`border${c}Width`],10)+parseFloat(a[`border${d}Width`],10)}let k;var l=function(){return void 0==k&&(k=-1!==navigator.appVersion.indexOf('MSIE 10')),k};function m(a,b,c,d){return Math.max(b[`offset${a}`],b[`scroll${a}`],c[`client${a}`],c[`offset${a}`],c[`scroll${a}`],l()?c[`offset${a}`]+d[`margin${'Height'===a?'Top':'Left'}`]+d[`margin${'Height'===a?'Bottom':'Right'}`]:0)}function n(){const a=document.body,b=document.documentElement,c=l()&&getComputedStyle(b);return{height:m('Height',a,b,c),width:m('Width',a,b,c)}}var o=Object.assign||function(a){for(var b,c=1;c<arguments.length;c++)for(var d in b=arguments[c],b)Object.prototype.hasOwnProperty.call(b,d)&&(a[d]=b[d]);return a};function p(a){return o({},a,{right:a.left+a.width,bottom:a.top+a.height})}function q(b){let c={};if(l())try{c=b.getBoundingClientRect();const a=h(b,'top'),d=h(b,'left');c.top+=a,c.left+=d,c.bottom+=a,c.right+=d}catch(a){}else c=b.getBoundingClientRect();const d={left:c.left,top:c.top,width:c.right-c.left,height:c.bottom-c.top},e='HTML'===b.nodeName?n():{},f=e.width||b.clientWidth||d.right-d.left,g=e.height||b.clientHeight||d.bottom-d.top;let i=b.offsetWidth-f,k=b.offsetHeight-g;if(i||k){const c=a(b);i-=j(c,'x'),k-=j(c,'y'),d.width-=i,d.height-=k}return p(d)}function r(b,d){const e=l(),f='HTML'===d.nodeName,g=q(b),h=q(d),j=c(b),k=a(d),m=parseFloat(k.borderTopWidth,10),n=parseFloat(k.borderLeftWidth,10);let o=p({top:g.top-h.top-m,left:g.left-h.left-n,width:g.width,height:g.height});if(o.marginTop=0,o.marginLeft=0,!e&&f){const a=parseFloat(k.marginTop,10),b=parseFloat(k.marginLeft,10);o.top-=m-a,o.bottom-=m-a,o.left-=n-b,o.right-=n-b,o.marginTop=a,o.marginLeft=b}return(e?d.contains(j):d===j&&'BODY'!==j.nodeName)&&(o=i(o,d)),o}function s(a){var b=Math.max;const c=a.ownerDocument.documentElement,d=r(a,c),e=b(c.clientWidth,window.innerWidth||0),f=b(c.clientHeight,window.innerHeight||0),g=h(c),i=h(c,'left'),j={top:g-d.top+d.marginTop,left:i-d.left+d.marginLeft,width:e,height:f};return p(j)}function t(c){const d=c.nodeName;return'BODY'===d||'HTML'===d?!1:!('fixed'!==a(c,'position'))||t(b(c))}function u(a,d,e,f){let h={top:0,left:0};const i=g(a,d);if('viewport'===f)h=s(i);else{let e;'scrollParent'===f?(e=c(b(d)),'BODY'===e.nodeName&&(e=a.ownerDocument.documentElement)):'window'===f?e=a.ownerDocument.documentElement:e=f;const g=r(e,i);if('HTML'===e.nodeName&&!t(i)){const{height:a,width:b}=n();h.top+=g.top-g.marginTop,h.bottom=a+g.top,h.left+=g.left-g.marginLeft,h.right=b+g.left}else h=g}return h.left+=e,h.top+=e,h.right-=e,h.bottom-=e,
|
||
|
//# sourceMappingURL=popper-utils.min.js.map
|