/* copyright (c) federico zivolo 2017 distributed under the mit license (license terms are at http://opensource.org/licenses/mit). */(function(e,t){'object'==typeof exports&&'undefined'!=typeof module?module.exports=t():'function'==typeof define&&define.amd?define(t):e.popper=t()})(this,function(){'use strict';function e(e){return e&&'[object function]'==={}.tostring.call(e)}function t(e,t){if(1!==e.nodetype)return[];var o=getcomputedstyle(e,null);return t?o[t]:o}function o(e){return'html'===e.nodename?e:e.parentnode||e.host}function n(e){if(!e)return document.body;switch(e.nodename){case'html':case'body':return e.ownerdocument.body;case'#document':return e.body;}var i=t(e),r=i.overflow,p=i.overflowx,s=i.overflowy;return /(auto|scroll)/.test(r+s+p)?e:n(o(e))}function r(e){var o=e&&e.offsetparent,i=o&&o.nodename;return i&&'body'!==i&&'html'!==i?-1!==['td','table'].indexof(o.nodename)&&'static'===t(o,'position')?r(o):o:e?e.ownerdocument.documentelement:document.documentelement}function p(e){var t=e.nodename;return'body'!==t&&('html'===t||r(e.firstelementchild)===e)}function s(e){return null===e.parentnode?e:s(e.parentnode)}function d(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,a=document.createrange();a.setstart(i,0),a.setend(n,0);var l=a.commonancestorcontainer;if(e!==l&&t!==l||i.contains(n))return p(l)?l:r(l);var f=s(e);return f.host?d(f.host,t):d(e,s(t).host)}function a(e){var t=1=o.clientwidth&&i>=o.clientheight}),l=0i[e]&&!t.escapewithreference&&(n=_(p[o],i[e]-('right'===e?p.width:p.height))),pe({},o,n)}};return n.foreach(function(e){var t=-1===['left','top'].indexof(e)?'secondary':'primary';p=se({},p,s[t](e))}),e.offsets.popper=p,e},priority:['left','right','top','bottom'],padding:5,boundarieselement:'scrollparent'},keeptogether:{order:400,enabled:!0,fn:function(e){var t=e.offsets,o=t.popper,i=t.reference,n=e.placement.split('-')[0],r=x,p=-1!==['top','bottom'].indexof(n),s=p?'right':'bottom',d=p?'left':'top',a=p?'width':'height';return o[s]r(i[s])&&(e.offsets.popper[d]=r(i[s])),e}},arrow:{order:500,enabled:!0,fn:function(e,o){var i;if(!f(e.instance.modifiers,'arrow','keeptogether'))return e;var n=o.element;if('string'==typeof n){if(n=e.instance.popper.queryselector(n),!n)return e;}else if(!e.instance.popper.contains(n))return console.warn('warning: `arrow.element` must be child of its popper element!'),e;var r=e.placement.split('-')[0],p=e.offsets,s=p.popper,d=p.reference,a=-1!==['left','right'].indexof(r),l=a?'height':'width',f=a?'top':'left',m=f.tolowercase(),h=a?'left':'top',g=a?'bottom':'right',u=l(n)[l];d[g]-us[g]&&(e.offsets.popper[m]+=d[m]+u-s[g]),e.offsets.popper=c(e.offsets.popper);var b=d[m]+d[l]/2-u/2,w=t(e.instance.popper),y=parsefloat(w['margin'+f],10),e=parsefloat(w['border'+f+'width'],10),v=b-e.offsets.popper[m]-y-e;return v=j(_(s[l]-u,v),0),e.arrowelement=n,e.offsets.arrow=(i={},pe(i,m,math.round(v)),pe(i,h,''),i),e},element:'[x-arrow]'},flip:{order:600,enabled:!0,fn:function(e,t){if(k(e.instance.modifiers,'inner'))return e;if(e.flipped&&e.placement===e.originalplacement)return e;var o=y(e.instance.popper,e.instance.reference,t.padding,t.boundarieselement),i=e.placement.split('-')[0],n=x(i),r=e.placement.split('-')[1]||'',p=[];switch(t.behavior){case le.flip:p=[i,n];break;case le.clockwise:p=q(i);break;case le.counterclockwise:p=q(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=x(i);var a=e.offsets.popper,l=e.offsets.reference,f=x,m='left'===i&&f(a.right)>f(l.left)||'right'===i&&f(a.left)f(l.top)||'bottom'===i&&f(a.top)f(o.right),g=f(a.top)f(o.bottom),b='left'===i&&h||'right'===i&&c||'top'===i&&g||'bottom'===i&&u,w=-1!==['top','bottom'].indexof(i),y=!!t.flipvariations&&(w&&'start'===r&&h||w&&'end'===r&&c||!w&&'start'===r&&g||!w&&'end'===r&&u);(m||b||y)&&(e.flipped=!0,(m||b)&&(i=p[d+1]),y&&(r=k(r)),e.placement=i+(r?'-'+r:''),e.offsets.popper=se({},e.offsets.popper,s(e.instance.popper,e.offsets.reference,e.placement)),e=c(e.instance.modifiers,e,'flip'))}),e},behavior:'flip',padding:5,boundarieselement:'viewport'},inner:{order:700,enabled:!1,fn:function(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=x(t),e.offsets.popper=c(n),e}},hide:{order:800,enabled:!0,fn:function(e){if(!f(e.instance.modifiers,'hide','preventoverflow'))return e;var t=e.offsets.reference,o=t(e.instance.modifiers,function(e){return'preventoverflow'===e.name}).boundaries;if(t.bottomo.right||t.top>o.bottom||t.right