UNPKG

@bodia_uz/popper.js

Version:

A kickass library to manage your poppers (lite version)

6 lines (5 loc) 20.8 kB
/* Copyright (C) Federico Zivolo 2018 Distributed under the MIT License (license terms are at http://opensource.org/licenses/MIT). */for(var e='undefined'!=typeof window&&'undefined'!=typeof document,t=['Edge','Trident','Firefox'],o=0,n=0;n<t.length;n+=1)if(e&&0<=navigator.userAgent.indexOf(t[n])){o=1;break}function i(e){var t=!1;return function(){t||(t=!0,window.Promise.resolve().then(function(){t=!1,e()}))}}function r(e){var t=!1;return function(){t||(t=!0,setTimeout(function(){t=!1,e()},o))}}var p=e&&window.Promise,s=p?i:r;function d(e){return e&&'[object Function]'==={}.toString.call(e)}function a(e,t){if(1!==e.nodeType)return[];var o=getComputedStyle(e,null);return t?o[t]:o}function l(e){return'HTML'===e.nodeName?e:e.parentNode||e.host}function f(e){if(!e)return document.body;switch(e.nodeName){case'HTML':case'BODY':return e.ownerDocument.body;case'#document':return e.body;}var t=a(e),o=t.overflow,i=t.overflowX,n=t.overflowY;return /(auto|scroll)/.test(o+n+i)?e:f(l(e))}function m(e){var t=e&&e.offsetParent,o=t&&t.nodeName;return o&&'BODY'!==o&&'HTML'!==o?-1!==['TD','TABLE'].indexOf(t.nodeName)&&'static'===a(t,'position')?m(t):t:e?e.ownerDocument.documentElement:document.documentElement}function c(e){var t=e.nodeName;return'BODY'!==t&&('HTML'===t||m(e.firstElementChild)===e)}function h(e){return null===e.parentNode?e:h(e.parentNode)}function u(e,t){if(!e||!e.nodeType||!t||!t.nodeType)return document.documentElement;var o=e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING,i=o?e:t,n=o?t:e,r=document.createRange();r.setStart(i,0),r.setEnd(n,0);var p=r.commonAncestorContainer;if(e!==p&&t!==p||i.contains(n))return c(p)?p:m(p);var s=h(e);return s.host?u(s.host,t):u(e,h(t).host)}function g(e){var t=1<arguments.length&&arguments[1]!==void 0?arguments[1]:'top',o='top'===t?'scrollTop':'scrollLeft',i=e.nodeName;if('BODY'===i||'HTML'===i){var n=e.ownerDocument.documentElement,r=e.ownerDocument.scrollingElement||n;return r[o]}return e[o]}function b(e,t){var o=2<arguments.length&&void 0!==arguments[2]&&arguments[2],i=g(t,'top'),n=g(t,'left'),r=o?-1:1;return e.top+=i*r,e.bottom+=i*r,e.left+=n*r,e.right+=n*r,e}function y(e,t){var o='x'===t?'Left':'Top',i='Left'==o?'Right':'Bottom';return parseFloat(e['border'+o+'Width'],10)+parseFloat(e['border'+i+'Width'],10)}var w,E=function(){return void 0==w&&(w=-1!==navigator.appVersion.indexOf('MSIE 10')),w};function v(e,t,o,i){return Math.max(t['offset'+e],t['scroll'+e],o['client'+e],o['offset'+e],o['scroll'+e],E()?o['offset'+e]+i['margin'+('Height'===e?'Top':'Left')]+i['margin'+('Height'===e?'Bottom':'Right')]:0)}function O(){var e=document.body,t=document.documentElement,o=E()&&getComputedStyle(t);return{height:v('Height',e,t,o),width:v('Width',e,t,o)}}var x=function(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')},L=function(){function e(e,t){for(var o,n=0;n<t.length;n++)o=t[n],o.enumerable=o.enumerable||!1,o.configurable=!0,'value'in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}return function(t,o,i){return o&&e(t.prototype,o),i&&e(t,i),t}}(),S=function(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e},T=Object.assign||function(e){for(var t,o=1;o<arguments.length;o++)for(var i in t=arguments[o],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},D=function e(t,o,i){null===t&&(t=Function.prototype);var n=Object.getOwnPropertyDescriptor(t,o);if(n===void 0){var r=Object.getPrototypeOf(t);return null===r?void 0:e(r,o,i)}if('value'in n)return n.value;var p=n.get;return void 0===p?void 0:p.call(i)},P=function(e,t){if('function'!=typeof t&&null!==t)throw new TypeError('Super expression must either be null or a function, not '+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},C=function(e,t){if(!e)throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');return t&&('object'==typeof t||'function'==typeof t)?t:e};function N(e){return T({},e,{right:e.left+e.width,bottom:e.top+e.height})}function k(e){var t={};try{if(E()){t=e.getBoundingClientRect();var o=g(e,'top'),i=g(e,'left');t.top+=o,t.left+=i,t.bottom+=o,t.right+=i}else t=e.getBoundingClientRect()}catch(t){}var n={left:t.left,top:t.top,width:t.right-t.left,height:t.bottom-t.top},r='HTML'===e.nodeName?O():{},p=r.width||e.clientWidth||n.right-n.left,s=r.height||e.clientHeight||n.bottom-n.top,d=e.offsetWidth-p,l=e.offsetHeight-s;if(d||l){var f=a(e);d-=y(f,'x'),l-=y(f,'y'),n.width-=d,n.height-=l}return N(n)}function W(e,t){var o=E(),i='HTML'===t.nodeName,n=k(e),r=k(t),p=f(e),s=a(t),d=parseFloat(s.borderTopWidth,10),l=parseFloat(s.borderLeftWidth,10),m=N({top:n.top-r.top-d,left:n.left-r.left-l,width:n.width,height:n.height});if(m.marginTop=0,m.marginLeft=0,!o&&i){var c=parseFloat(s.marginTop,10),h=parseFloat(s.marginLeft,10);m.top-=d-c,m.bottom-=d-c,m.left-=l-h,m.right-=l-h,m.marginTop=c,m.marginLeft=h}return(o?t.contains(p):t===p&&'BODY'!==p.nodeName)&&(m=b(m,t)),m}function B(e){var t=Math.max,o=e.ownerDocument.documentElement,i=W(e,o),n=t(o.clientWidth,window.innerWidth||0),r=t(o.clientHeight,window.innerHeight||0),p=g(o),s=g(o,'left'),d={top:p-i.top+i.marginTop,left:s-i.left+i.marginLeft,width:n,height:r};return N(d)}function H(e){var t=e.nodeName;return'BODY'===t||'HTML'===t?!1:!('fixed'!==a(e,'position'))||H(l(e))}function A(e,t,o,i){var n=4<arguments.length&&void 0!==arguments[4]?arguments[4]:null,r={top:0,left:0},p=n||u(e,t);if('viewport'===i)r=B(p);else{var s;'scrollParent'===i?(s=f(l(t)),'BODY'===s.nodeName&&(s=e.ownerDocument.documentElement)):'window'===i?s=e.ownerDocument.documentElement:s=i;var d=W(s,p);if('HTML'===s.nodeName&&!H(p)){var a=O(),m=a.height,c=a.width;r.top+=d.top-d.marginTop,r.bottom=m+d.top,r.left+=d.left-d.marginLeft,r.right=c+d.left}else r=d}return r.left+=o,r.top+=o,r.right-=o,r.bottom-=o,r}function I(e){var t=e.width,o=e.height;return t*o}function _(e,t,o,i,n){var r=5<arguments.length&&arguments[5]!==void 0?arguments[5]:0;if(-1===e.indexOf('auto'))return e;var p=A(o,i,r,n,null),s={top:{width:p.width,height:t.top-p.top},right:{width:p.right-t.right,height:p.height},bottom:{width:p.width,height:p.bottom-t.bottom},left:{width:t.left-p.left,height:p.height}},d=Object.keys(s).map(function(e){return T({key:e},s[e],{area:I(s[e])})}).sort(function(e,t){return t.area-e.area}),a=d.filter(function(e){var t=e.width,i=e.height;return t>=o.clientWidth&&i>=o.clientHeight}),l=0<a.length?a[0].key:d[0].key,f=e.split('-')[1];return l+(f?'-'+f:'')}function U(e,t,o,i){var n=i||u(t,o);return W(o,n)}function F(e){var t=getComputedStyle(e),o=parseFloat(t.marginTop)+parseFloat(t.marginBottom),i=parseFloat(t.marginLeft)+parseFloat(t.marginRight),n={width:e.offsetWidth+i,height:e.offsetHeight+o};return n}function M(e){var t={left:'right',right:'left',bottom:'top',top:'bottom'};return e.replace(/left|right|bottom|top/g,function(e){return t[e]})}function R(e,t,o){o=o.split('-')[0];var i=F(e),n={width:i.width,height:i.height},r=-1!==['right','left'].indexOf(o),p=r?'top':'left',s=r?'left':'top',d=r?'height':'width',a=r?'width':'height';return n[p]=t[p]+t[d]/2-i[d]/2,n[s]=o===s?t[s]-i[a]:t[M(s)],n}function Y(e,t){return Array.prototype.find?e.find(t):e.filter(t)[0]}function j(e,t,o){if(Array.prototype.findIndex)return e.findIndex(function(e){return e[t]===o});var i=Y(e,function(e){return e[t]===o});return e.indexOf(i)}function V(e,t,o){var i=void 0===o?e:e.slice(0,j(e,'name',o));return i.forEach(function(e){e['function']&&console.warn('`modifier.function` is deprecated, use `modifier.fn`!');var o=e['function']||e.fn;e.enabled&&d(o)&&(t.offsets.popper=N(t.offsets.popper),t.offsets.reference=N(t.offsets.reference),t=o(t,e))}),t}function q(e){if(this.state.isDestroyed)return void(e&&e(void 0));var t={instance:this,styles:{},arrowStyles:{},attributes:{},flipped:!1,offsets:{}};t.offsets.reference=U(this.state,this.popper,this.reference,this.options.positionFixed?window.document.documentElement:void 0),t.placement=_(this.options.placement,t.offsets.reference,this.popper,this.reference,this.options.modifiers.flip.boundariesElement,this.options.modifiers.flip.padding),t.originalPlacement=t.placement,t.positionFixed=this.options.positionFixed,t.offsets.popper=R(this.popper,t.offsets.reference,t.placement),t.offsets.popper.position=this.options.positionFixed?'fixed':'absolute',t=V(this.modifiers,t),this.state.isCreated?this.options.onUpdate(t):(this.state.isCreated=!0,this.options.onCreate(t)),e&&e(t)}function K(e,t){return e.some(function(e){var o=e.name,i=e.enabled;return i&&o===t})}function G(e){for(var t=[!1,'ms','Webkit','Moz','O'],o=e.charAt(0).toUpperCase()+e.slice(1),n=0;n<t.length-1;n++){var i=t[n],r=i?''+i+o:e;if('undefined'!=typeof document.body.style[r])return r}return null}function z(){return this.state.isDestroyed=!0,K(this.modifiers,'applyStyle')&&(this.popper.removeAttribute('data-popper-placement'),this.popper.style.left='',this.popper.style.position='',this.popper.style.top='',this.popper.style[G('transform')]=''),this.options.removeOnDestroy&&this.popper.parentNode.removeChild(this.popper),this}function X(e){var t=e.placement,o=t.split('-')[0],i=t.split('-')[1];if(i){var n=e.offsets,r=n.reference,p=n.popper,s=-1!==['bottom','top'].indexOf(o),d=s?'left':'top',a=s?'width':'height',l={start:S({},d,r[d]),end:S({},d,r[d]+r[a]-p[a])};e.offsets.popper=T({},p,l[i])}return e}function J(e,t){var o=e.positionFixed?window.document.documentElement:void 0,i=t.boundariesElement||o||m(e.instance.popper);e.instance.reference===i&&(i=m(i));var n=A(e.instance.popper,e.instance.reference,t.padding,i,o);t.boundaries=n;var r=t.priority,p=e.offsets.popper,s={primary:function(e){var o=p[e];return p[e]<n[e]&&!t.escapeWithReference&&(o=Math.max(p[e],n[e])),S({},e,o)},secondary:function(e){var o='right'===e?'left':'top',i=p[o];return p[e]>n[e]&&!t.escapeWithReference&&(i=Math.min(p[o],n[e]-('right'===e?p.width:p.height))),S({},o,i)}};return r.forEach(function(e){var t=-1===['left','top'].indexOf(e)?'secondary':'primary';p=T({},p,s[t](e))}),e.offsets.popper=p,e}function Q(e){if('end'===e)return'start';return'start'===e?'end':e}var Z=['auto-start','auto','auto-end','top-start','top','top-end','right-start','right','right-end','bottom-end','bottom','bottom-start','left-end','left','left-start'],$=Z.slice(3);function ee(e){var t=1<arguments.length&&arguments[1]!==void 0&&arguments[1],o=$.indexOf(e),i=$.slice(o+1).concat($.slice(0,o));return t?i.reverse():i}var te={FLIP:'flip',CLOCKWISE:'clockwise',COUNTERCLOCKWISE:'counterclockwise'};function oe(e,t){if(K(e.instance.modifiers,'inner'))return e;if(e.flipped&&e.placement===e.originalPlacement)return e;var o=A(e.instance.popper,e.instance.reference,t.padding,t.boundariesElement,t.positionFixed?window.document.documentElement:void 0),i=e.placement.split('-')[0],n=M(i),r=e.placement.split('-')[1]||'',p=[];switch(t.behavior){case te.FLIP:p=[i,n];break;case te.CLOCKWISE:p=ee(i);break;case te.COUNTERCLOCKWISE:p=ee(i,!0);break;default:p=t.behavior;}return p.forEach(function(s,d){if(i!==s||p.length===d+1)return e;i=e.placement.split('-')[0],n=M(i);var a=e.offsets.popper,l=e.offsets.reference,f=Math.floor,m='left'===i&&f(a.right)>f(l.left)||'right'===i&&f(a.left)<f(l.right)||'top'===i&&f(a.bottom)>f(l.top)||'bottom'===i&&f(a.top)<f(l.bottom),c=f(a.left)<f(o.left),h=f(a.right)>f(o.right),u=f(a.top)<f(o.top),g=f(a.bottom)>f(o.bottom),b='left'===i&&c||'right'===i&&h||'top'===i&&u||'bottom'===i&&g,y=-1!==['top','bottom'].indexOf(i),w=!!t.flipVariations&&(y&&'start'===r&&c||y&&'end'===r&&h||!y&&'start'===r&&u||!y&&'end'===r&&g);(m||b||w)&&(e.flipped=!0,(m||b)&&(i=p[d+1]),w&&(r=Q(r)),e.placement=i+(r?'-'+r:''),e.offsets.popper=T({},e.offsets.popper,R(e.instance.popper,e.offsets.reference,e.placement)),e=V(e.instance.modifiers,e,'flip'))}),e}function ie(e,t){var o=Math.floor,i=t.x,n=t.y,r=e.offsets.popper,p=Y(e.instance.modifiers,function(e){return'applyStyle'===e.name}).gpuAcceleration;void 0!==p&&console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');var s,d,a=void 0===p?t.gpuAcceleration:p,l=m(e.instance.popper),f=k(l),c={position:r.position},h={left:o(r.left),top:o(r.top),bottom:o(r.bottom),right:o(r.right)},u='bottom'===i?'top':'bottom',g='right'===n?'left':'right',b=G('transform');if(d='bottom'==u?-f.height+h.bottom:h.top,s='right'==g?-f.width+h.right:h.left,a&&b)c[b]='translate3d('+s+'px, '+d+'px, 0)',c[u]=0,c[g]=0,c.willChange='transform';else{var y='bottom'==u?-1:1,w='right'==g?-1:1;c[u]=d*y,c[g]=s*w,c.willChange=u+', '+g}var E={"data-popper-placement":e.placement};return e.attributes=T({},E,e.attributes),e.styles=T({},c,e.styles),e.arrowStyles=T({},e.offsets.arrow,e.arrowStyles),e}function ne(e){return''!==e&&!isNaN(parseFloat(e))&&isFinite(e)}function re(e,t){Object.keys(t).forEach(function(o){var i='';-1!==['width','height','top','right','bottom','left'].indexOf(o)&&ne(t[o])&&(i='px'),e.style[o]=t[o]+i})}function pe(e,t){Object.keys(t).forEach(function(o){var i=t[o];!1===i?e.removeAttribute(o):e.setAttribute(o,t[o])})}function se(e){return re(e.instance.popper,e.styles),pe(e.instance.popper,e.attributes),e.arrowElement&&Object.keys(e.arrowStyles).length&&re(e.arrowElement,e.arrowStyles),e}function de(e,t,o,i,n){var r=U(n,t,e,o.positionFixed?window.document.documentElement:void 0),p=_(o.placement,r,t,e,o.modifiers.flip.boundariesElement,o.modifiers.flip.padding);return t.setAttribute('data-popper-placement',p),re(t,{position:o.positionFixed?'fixed':'absolute'}),o}var ae={shift:{order:100,enabled:!0,fn:X},preventOverflow:{order:300,enabled:!0,fn:J,priority:['left','right','top','bottom'],padding:5,boundariesElement:'scrollParent'},flip:{order:600,enabled:!0,fn:oe,behavior:'flip',padding:5,boundariesElement:'viewport'},computeStyle:{order:850,enabled:!0,fn:ie,gpuAcceleration:!0,x:'bottom',y:'right'},applyStyle:{order:900,enabled:!0,fn:se,onLoad:de,gpuAcceleration:void 0}},le={placement:'bottom',positionFixed:!1,eventsEnabled:!0,removeOnDestroy:!1,onCreate:function(){},onUpdate:function(){},modifiers:ae},fe=function(){function e(t,o){var i=this,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};x(this,e),this.scheduleUpdate=function(){return new Promise(function(e){return requestAnimationFrame(function(){return i.debouncedUpdate(e)})})};var r=this.constructor.Defaults;this.debouncedUpdate=s(this.update.bind(this)),this.options=T({},r,n),this.state={isDestroyed:!1,isCreated:!1,scrollParents:[]},this.reference=t,this.popper=o,this.options.modifiers={},Object.keys(T({},r.modifiers,n.modifiers)).forEach(function(e){i.options.modifiers[e]=T({},r.modifiers[e]||{},n.modifiers?n.modifiers[e]:{})}),this.modifiers=Object.keys(this.options.modifiers).map(function(e){return T({name:e},i.options.modifiers[e])}).sort(function(e,t){return e.order-t.order}),this.modifiers.forEach(function(e){e.enabled&&d(e.onLoad)&&e.onLoad(i.reference,i.popper,i.options,e,i.state)}),this.debouncedUpdate()}return L(e,[{key:'update',value:function(e){return q.call(this,e)}},{key:'destroy',value:function(){return z.call(this)}}]),e}();fe.Defaults=le;function me(e){var t=e.ownerDocument;return t?t.defaultView:window}function ce(e,t,o,i){var n='BODY'===e.nodeName,r=n?e.ownerDocument.defaultView:e;r.addEventListener(t,o,{passive:!0}),n||ce(f(r.parentNode),t,o,i),i.push(r)}function he(e,t,o,i){o.updateBound=i,me(e).addEventListener('resize',o.updateBound,{passive:!0});var n=f(e);return ce(n,'scroll',o.updateBound,o.scrollParents),o.scrollElement=n,o.eventsEnabled=!0,o}function ue(){this.state.eventsEnabled||(this.state=he(this.reference,this.options,this.state,this.scheduleUpdate))}function ge(e,t){return me(e).removeEventListener('resize',t.updateBound),t.scrollParents.forEach(function(e){e.removeEventListener('scroll',t.updateBound)}),t.updateBound=null,t.scrollParents=[],t.scrollElement=null,t.eventsEnabled=!1,t}function be(){this.state.eventsEnabled&&(cancelAnimationFrame(this.scheduleUpdate),this.state=ge(this.reference,this.state))}function ye(e,t,o,i){var n=Math.max,r=e.match(/((?:\-|\+)?\d*\.?\d*)(.*)/),p=+r[1],s=r[2];if(!p)return e;if(0===s.indexOf('%')){var d;switch(s){case'%p':d=o;break;case'%':case'%r':default:d=i;}var a=N(d);return a[t]/100*p}if('vh'===s||'vw'===s){var l;return l='vh'===s?n(document.documentElement.clientHeight,window.innerHeight||0):n(document.documentElement.clientWidth,window.innerWidth||0),l/100*p}return p}function we(e,t,o,i){var n=[0,0],r=-1!==['right','left'].indexOf(i),p=e.split(/(\+|\-)/).map(function(e){return e.trim()}),s=p.indexOf(Y(p,function(e){return-1!==e.search(/,|\s/)}));p[s]&&-1===p[s].indexOf(',')&&console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');var d=/\s*,\s*|\s+/,a=-1===s?[p]:[p.slice(0,s).concat([p[s].split(d)[0]]),[p[s].split(d)[1]].concat(p.slice(s+1))];return a=a.map(function(e,i){var n=(1===i?!r:r)?'height':'width',p=!1;return e.reduce(function(e,t){return''===e[e.length-1]&&-1!==['+','-'].indexOf(t)?(e[e.length-1]=t,p=!0,e):p?(e[e.length-1]+=t,p=!1,e):e.concat(t)},[]).map(function(e){return ye(e,n,t,o)})}),a.forEach(function(e,t){e.forEach(function(o,i){ne(o)&&(n[t]+=o*('-'===e[i-1]?-1:1))})}),n}function Ee(e,t){var o,i=t.offset,n=e.placement,r=e.offsets,p=r.popper,s=r.reference,d=n.split('-')[0];return o=ne(+i)?[+i,0]:we(i,p,s,d),'left'===d?(p.top+=o[0],p.left-=o[1]):'right'===d?(p.top+=o[0],p.left+=o[1]):'top'===d?(p.left+=o[0],p.top-=o[1]):'bottom'===d&&(p.left+=o[0],p.top+=o[1]),e.popper=p,e}function ve(e){var t=e.offsets,o=t.popper,i=t.reference,n=e.placement.split('-')[0],r=Math.floor,p=-1!==['top','bottom'].indexOf(n),s=p?'right':'bottom',d=p?'left':'top',a=p?'width':'height';return o[s]<r(i[d])&&(e.offsets.popper[d]=r(i[d])-o[a]),o[d]>r(i[s])&&(e.offsets.popper[d]=r(i[s])),e}function Oe(e,t,o){var i=Y(e,function(e){var o=e.name;return o===t}),n=!!i&&e.some(function(e){return e.name===o&&e.enabled&&e.order<i.order});if(!n){var r='`'+t+'`';console.warn('`'+o+'`'+' modifier is required by '+r+' modifier in order to work, be sure to include it before '+r+'!')}return n}function xe(e,t){var o;if(!Oe(e.instance.modifiers,'arrow','keepTogether'))return e;var i=t.element;if('string'==typeof i){if(i=e.instance.popper.querySelector(i),!i)return e;}else if(!e.instance.popper.contains(i))return console.warn('WARNING: `arrow.element` must be child of its popper element!'),e;var n=e.placement.split('-')[0],r=e.offsets,p=r.popper,s=r.reference,d=-1!==['left','right'].indexOf(n),l=d?'height':'width',f=d?'Top':'Left',m=f.toLowerCase(),c=d?'left':'top',h=d?'bottom':'right',u=F(i)[l];s[h]-u<p[m]&&(e.offsets.popper[m]-=p[m]-(s[h]-u)),s[m]+u>p[h]&&(e.offsets.popper[m]+=s[m]+u-p[h]),e.offsets.popper=N(e.offsets.popper);var g=s[m]+s[l]/2-u/2,b=a(e.instance.popper),y=parseFloat(b['margin'+f],10),w=parseFloat(b['border'+f+'Width'],10),E=g-e.offsets.popper[m]-y-w;return E=Math.max(Math.min(p[l]-u,E),0),e.arrowElement=i,e.offsets.arrow=(o={},S(o,m,Math.round(E)),S(o,c,''),o),e}function Le(e){var t=e.placement,o=t.split('-')[0],i=e.offsets,n=i.popper,r=i.reference,p=-1!==['left','right'].indexOf(o),s=-1===['top','left'].indexOf(o);return n[p?'left':'top']=r[o]-(s?n[p?'width':'height']:0),e.placement=M(t),e.offsets.popper=N(n),e}function Se(e){if(!Oe(e.instance.modifiers,'hide','preventOverflow'))return e;var t=e.offsets.reference,o=Y(e.instance.modifiers,function(e){return'preventOverflow'===e.name}).boundaries;if(t.bottom<o.top||t.left>o.right||t.top>o.bottom||t.right<o.left){if(!0===e.hide)return e;e.hide=!0,e.attributes['data-popper-out-of-boundaries']=''}else{if(!1===e.hide)return e;e.hide=!1,e.attributes['data-popper-out-of-boundaries']=!1}return e}var Te={offset:{order:200,enabled:!0,fn:Ee,offset:0},keepTogether:{order:400,enabled:!0,fn:ve},arrow:{order:500,enabled:!0,fn:xe,element:'[data-popper-arrow]'},inner:{order:700,enabled:!1,fn:Le},hide:{order:800,enabled:!0,fn:Se}},De=function(e){function t(e,o,i){x(this,t),e=e&&e.jquery?e[0]:e,o=o&&o.jquery?o[0]:o;var n=C(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,o,i)),r=n.options.eventsEnabled;return r&&n.enableEventListeners(),n.state.eventsEnabled=r,n}return P(t,e),L(t,[{key:'enableEventListeners',value:function(){return ue.call(this)}},{key:'disableEventListeners',value:function(){return be.call(this)}},{key:'destroy',value:function(){D(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),'destroy',this).call(this),this.disableEventListeners()}}]),t}(fe);De.Utils=('undefined'==typeof window?global:window).PopperUtils,De.placements=Z,De.Defaults=T({},le,{modifiers:T({},le.modifiers,Te)});export default De; //# sourceMappingURL=popper.min.js.map