/* 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=window.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||-1!==['html','body','#document'].indexof(e.nodename))return window.document.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:window.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 window.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=v(p[o],i[e]-('right'===e?p.width:p.height))),se({},o,n)}};return n.foreach(function(e){var t=-1===['left','top'].indexof(e)?'secondary':'primary';p=de({},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=_,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){if(!f(e.instance.modifiers,'arrow','keeptogether'))return e;var i=o.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),a=d?'height':'width',l=d?'top':'left',f=l.tolowercase(),m=d?'left':'top',c=d?'bottom':'right',g=o(i)[a];s[c]-gp[c]&&(e.offsets.popper[f]+=s[f]+g-p[c]);var u=s[f]+s[a]/2-g/2,b=t(e.instance.popper,'margin'+l).replace('px',''),y=u-h(e.offsets.popper)[f]-b;return y=x(v(p[a]-g,y),0),e.arrowelement=i,e.offsets.arrow={},e.offsets.arrow[f]=math.round(y),e.offsets.arrow[m]='',e},element:'[x-arrow]'},flip:{order:600,enabled:!0,fn:function(e,t){if(w(e.instance.modifiers,'inner'))return e;if(e.flipped&&e.placement===e.originalplacement)return e;var o=w(e.instance.popper,e.instance.reference,t.padding,t.boundarieselement),i=e.placement.split('-')[0],n=l(i),r=e.placement.split('-')[1]||'',p=[];switch(t.behavior){case fe.flip:p=[i,n];break;case fe.clockwise:p=k(i);break;case fe.counterclockwise:p=k(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=l(i);var a=e.offsets.popper,l=e.offsets.reference,f=_,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&&c||'right'===i&&h||'top'===i&&g||'bottom'===i&&u,y=-1!==['top','bottom'].indexof(i),w=!!t.flipvariations&&(y&&'start'===r&&c||y&&'end'===r&&h||!y&&'start'===r&&g||!y&&'end'===r&&u);(m||b||w)&&(e.flipped=!0,(m||b)&&(i=p[d+1]),w&&(r=j(r)),e.placement=i+(r?'-'+r:''),e.offsets.popper=de({},e.offsets.popper,s(e.instance.popper,e.offsets.reference,e.placement)),e=n(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=l(t),e.offsets.popper=h(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