!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 n=e.ownerDocument.defaultView.getComputedStyle(e,null);return t?n[t]:n}function n(e){return"HTML"===e.nodeName?e:e.parentNode||e.host}function o(e){if(!e)return document.body;switch(e.nodeName){case"HTML":case"BODY":return e.ownerDocument.body;case"#document":return e.body}var r=t(e),i=r.overflow,a=r.overflowX,s=r.overflowY;return/(auto|scroll|overlay)/.test(i+s+a)?e:o(n(e))}function r(e){return 11===e?U:10===e?Y:U||Y}function i(e){if(!e)return document.documentElement;for(var n=r(10)?document.body:null,o=e.offsetParent||null;o===n&&e.nextElementSibling;)o=(e=e.nextElementSibling).offsetParent;var a=o&&o.nodeName;return a&&"BODY"!==a&&"HTML"!==a?-1!==["TH","TD","TABLE"].indexOf(o.nodeName)&&"static"===t(o,"position")?i(o):o:e?e.ownerDocument.documentElement:document.documentElement}function a(e){return null!==e.parentNode?a(e.parentNode):e}function s(e,t){if(!(e&&e.nodeType&&t&&t.nodeType))return document.documentElement;var n=e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING,o=n?e:t,r=n?t:e,f=document.createRange();f.setStart(o,0),f.setEnd(r,0);var p=f.commonAncestorContainer;if(e!==p&&t!==p||o.contains(r))return function(e){var t=e.nodeName;return"BODY"!==t&&("HTML"===t||i(e.firstElementChild)===e)}(p)?p:i(p);var l=a(e);return l.host?s(l.host,t):s(e,a(t).host)}function f(e){var t="top"===(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"top")?"scrollTop":"scrollLeft",n=e.nodeName;if("BODY"===n||"HTML"===n){var o=e.ownerDocument.documentElement;return(e.ownerDocument.scrollingElement||o)[t]}return e[t]}function p(e,t){var n="x"===t?"Left":"Top",o="Left"===n?"Right":"Bottom";return parseFloat(e["border"+n+"Width"],10)+parseFloat(e["border"+o+"Width"],10)}function l(e,t,n,o){return Math.max(t["offset"+e],t["scroll"+e],n["client"+e],n["offset"+e],n["scroll"+e],r(10)?parseInt(n["offset"+e])+parseInt(o["margin"+("Height"===e?"Top":"Left")])+parseInt(o["margin"+("Height"===e?"Bottom":"Right")]):0)}function u(e){var t=e.body,n=e.documentElement,o=r(10)&&getComputedStyle(n);return{height:l("Height",t,n,o),width:l("Width",t,n,o)}}function d(e){return z({},e,{right:e.left+e.width,bottom:e.top+e.height})}function c(e){var n={};try{if(r(10)){n=e.getBoundingClientRect();var o=f(e,"top"),i=f(e,"left");n.top+=o,n.left+=i,n.bottom+=o,n.right+=i}else n=e.getBoundingClientRect()}catch(e){}var a={left:n.left,top:n.top,width:n.right-n.left,height:n.bottom-n.top},s="HTML"===e.nodeName?u(e.ownerDocument):{},l=s.width||e.clientWidth||a.right-a.left,c=s.height||e.clientHeight||a.bottom-a.top,h=e.offsetWidth-l,m=e.offsetHeight-c;if(h||m){var g=t(e);h-=p(g,"x"),m-=p(g,"y"),a.width-=h,a.height-=m}return d(a)}function h(e,n){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=r(10),s="HTML"===n.nodeName,p=c(e),l=c(n),u=o(e),h=t(n),m=parseFloat(h.borderTopWidth,10),g=parseFloat(h.borderLeftWidth,10);i&&s&&(l.top=Math.max(l.top,0),l.left=Math.max(l.left,0));var v=d({top:p.top-l.top-m,left:p.left-l.left-g,width:p.width,height:p.height});if(v.marginTop=0,v.marginLeft=0,!a&&s){var b=parseFloat(h.marginTop,10),w=parseFloat(h.marginLeft,10);v.top-=m-b,v.bottom-=m-b,v.left-=g-w,v.right-=g-w,v.marginTop=b,v.marginLeft=w}return(a&&!i?n.contains(u):n===u&&"BODY"!==u.nodeName)&&(v=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=f(t,"top"),r=f(t,"left"),i=n?-1:1;return e.top+=o*i,e.bottom+=o*i,e.left+=r*i,e.right+=r*i,e}(v,n)),v}function m(e){var o=e.nodeName;if("BODY"===o||"HTML"===o)return!1;if("fixed"===t(e,"position"))return!0;var r=n(e);return!!r&&m(r)}function g(e){if(!e||!e.parentElement||r())return document.documentElement;for(var n=e.parentElement;n&&"none"===t(n,"transform");)n=n.parentElement;return n||document.documentElement}function v(e,t,r,i){var a=arguments.length>4&&void 0!==arguments[4]&&arguments[4],p={top:0,left:0},l=a?g(e):s(e,t);if("viewport"===i)p=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e.ownerDocument.documentElement,o=h(e,n),r=Math.max(n.clientWidth,window.innerWidth||0),i=Math.max(n.clientHeight,window.innerHeight||0),a=t?0:f(n),s=t?0:f(n,"left");return d({top:a-o.top+o.marginTop,left:s-o.left+o.marginLeft,width:r,height:i})}(l,a);else{var c=void 0;"scrollParent"===i?"BODY"===(c=o(n(t))).nodeName&&(c=e.ownerDocument.documentElement):c="window"===i?e.ownerDocument.documentElement:i;var v=h(c,l,a);if("HTML"!==c.nodeName||m(l))p=v;else{var b=u(e.ownerDocument),w=b.height,y=b.width;p.top+=v.top-v.marginTop,p.bottom=w+v.top,p.left+=v.left-v.marginLeft,p.right=y+v.left}}var E="number"==typeof(r=r||0);return p.left+=E?r:r.left||0,p.top+=E?r:r.top||0,p.right-=E?r:r.right||0,p.bottom-=E?r:r.bottom||0,p}function b(e,t,n,o,r){var i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(-1===e.indexOf("auto"))return e;var a=v(n,o,i,r),s={top:{width:a.width,height:t.top-a.top},right:{width:a.right-t.right,height:a.height},bottom:{width:a.width,height:a.bottom-t.bottom},left:{width:t.left-a.left,height:a.height}},f=Object.keys(s).map(function(e){return z({key:e},s[e],{area:function(e){return e.width*e.height}(s[e])})}).sort(function(e,t){return t.area-e.area}),p=f.filter(function(e){var t=e.width,o=e.height;return t>=n.clientWidth&&o>=n.clientHeight}),l=p.length>0?p[0].key:f[0].key,u=e.split("-")[1];return l+(u?"-"+u:"")}function w(e,t,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return h(n,o?g(t):s(t,n),o)}function y(e){var t=e.ownerDocument.defaultView.getComputedStyle(e),n=parseFloat(t.marginTop||0)+parseFloat(t.marginBottom||0),o=parseFloat(t.marginLeft||0)+parseFloat(t.marginRight||0);return{width:e.offsetWidth+o,height:e.offsetHeight+n}}function E(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 x(e,t,n){n=n.split("-")[0];var o=y(e),r={width:o.width,height:o.height},i=-1!==["right","left"].indexOf(n),a=i?"top":"left",s=i?"left":"top",f=i?"height":"width",p=i?"width":"height";return r[a]=t[a]+t[f]/2-o[f]/2,r[s]=n===s?t[s]-o[p]:t[E(s)],r}function O(e,t){return Array.prototype.find?e.find(t):e.filter(t)[0]}function L(t,n,o){return(void 0===o?t:t.slice(0,function(e,t,n){if(Array.prototype.findIndex)return e.findIndex(function(e){return e[t]===n});var o=O(e,function(e){return e[t]===n});return e.indexOf(o)}(t,"name",o))).forEach(function(t){t.function&&console.warn("`modifier.function` is deprecated, use `modifier.fn`!");var o=t.function||t.fn;t.enabled&&e(o)&&(n.offsets.popper=d(n.offsets.popper),n.offsets.reference=d(n.offsets.reference),n=o(n,t))}),n}function T(e,t){return e.some(function(e){var n=e.name;return e.enabled&&n===t})}function C(e){for(var t=[!1,"ms","Webkit","Moz","O"],n=e.charAt(0).toUpperCase()+e.slice(1),o=0;o1&&void 0!==arguments[1]&&arguments[1],n=X.indexOf(e),o=X.slice(n+1).concat(X.slice(0,n));return t?o.reverse():o}function P(e,t,n,o){var r=[0,0],i=-1!==["right","left"].indexOf(o),a=e.split(/(\+|\-)/).map(function(e){return e.trim()}),s=a.indexOf(O(a,function(e){return-1!==e.search(/,|\s/)}));a[s]&&-1===a[s].indexOf(",")&&console.warn("Offsets separated by white space(s) are deprecated, use a comma (,) instead.");var f=/\s*,\s*|\s+/,p=-1!==s?[a.slice(0,s).concat([a[s].split(f)[0]]),[a[s].split(f)[1]].concat(a.slice(s+1))]:[a];return(p=p.map(function(e,o){var r=(1===o?!i:i)?"height":"width",a=!1;return e.reduce(function(e,t){return""===e[e.length-1]&&-1!==["+","-"].indexOf(t)?(e[e.length-1]=t,a=!0,e):a?(e[e.length-1]+=t,a=!1,e):e.concat(t)},[]).map(function(e){return function(e,t,n,o){var r=e.match(/((?:\-|\+)?\d*\.?\d*)(.*)/),i=+r[1],a=r[2];if(!i)return e;if(0===a.indexOf("%")){var s=void 0;switch(a){case"%p":s=n;break;case"%":case"%r":default:s=o}return d(s)[t]/100*i}if("vh"===a||"vw"===a)return("vh"===a?Math.max(document.documentElement.clientHeight,window.innerHeight||0):Math.max(document.documentElement.clientWidth,window.innerWidth||0))/100*i;return i}(e,r,t,n)})})).forEach(function(e,t){e.forEach(function(n,o){k(n)&&(r[t]+=n*("-"===e[o-1]?-1:1))})}),r}for(var B="undefined"!=typeof window&&"undefined"!=typeof document,A=["Edge","Trident","Firefox"],I=0,j=0;j=0){I=1;break}var R=B&&window.Promise?function(e){var t=!1;return function(){t||(t=!0,window.Promise.resolve().then(function(){t=!1,e()}))}}:function(e){var t=!1;return function(){t||(t=!0,setTimeout(function(){t=!1,e()},I))}},U=B&&!(!window.MSInputMethodContext||!document.documentMode),Y=B&&/MSIE 10/.test(navigator.userAgent),V=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},q=function(){function e(e,t){for(var n=0;np[e]&&!t.escapeWithReference&&(o=Math.min(u[n],p[e]-("right"===e?u.width:u.height))),K({},n,o)}};return l.forEach(function(e){var t=-1!==["left","top"].indexOf(e)?"primary":"secondary";u=z({},u,d[t](e))}),e.offsets.popper=u,e},priority:["left","right","top","bottom"],padding:5,boundariesElement:"scrollParent"},keepTogether:{order:400,enabled:!0,fn:function(e){var t=e.offsets,n=t.popper,o=t.reference,r=e.placement.split("-")[0],i=Math.floor,a=-1!==["top","bottom"].indexOf(r),s=a?"right":"bottom",f=a?"left":"top",p=a?"width":"height";return n[s]i(o[s])&&(e.offsets.popper[f]=i(o[s])),e}},arrow:{order:500,enabled:!0,fn:function(e,n){var o;if(!W(e.instance.modifiers,"arrow","keepTogether"))return e;var r=n.element;if("string"==typeof r){if(!(r=e.instance.popper.querySelector(r)))return e}else if(!e.instance.popper.contains(r))return console.warn("WARNING: `arrow.element` must be child of its popper element!"),e;var i=e.placement.split("-")[0],a=e.offsets,s=a.popper,f=a.reference,p=-1!==["left","right"].indexOf(i),l=p?"height":"width",u=p?"Top":"Left",c=u.toLowerCase(),h=p?"left":"top",m=p?"bottom":"right",g=y(r)[l];f[m]-gs[m]&&(e.offsets.popper[c]+=f[c]+g-s[m]),e.offsets.popper=d(e.offsets.popper);var v=f[c]+f[l]/2-g/2,b=t(e.instance.popper),w=parseFloat(b["margin"+u],10),E=parseFloat(b["border"+u+"Width"],10),x=v-e.offsets.popper[c]-w-E;return x=Math.max(Math.min(s[l]-g,x),0),e.arrowElement=r,e.offsets.arrow=(o={},K(o,c,Math.round(x)),K(o,h,""),o),e},element:"[x-arrow]"},flip:{order:600,enabled:!0,fn:function(e,t){if(T(e.instance.modifiers,"inner"))return e;if(e.flipped&&e.placement===e.originalPlacement)return e;var n=v(e.instance.popper,e.instance.reference,t.padding,t.boundariesElement,e.positionFixed),o=e.placement.split("-")[0],r=E(o),i=e.placement.split("-")[1]||"",a=[];switch(t.behavior){case J.FLIP:a=[o,r];break;case J.CLOCKWISE:a=H(o);break;case J.COUNTERCLOCKWISE:a=H(o,!0);break;default:a=t.behavior}return a.forEach(function(s,f){if(o!==s||a.length===f+1)return e;o=e.placement.split("-")[0],r=E(o);var p=e.offsets.popper,l=e.offsets.reference,u=Math.floor,d="left"===o&&u(p.right)>u(l.left)||"right"===o&&u(p.left)u(l.top)||"bottom"===o&&u(p.top)u(n.right),m=u(p.top)u(n.bottom),v="left"===o&&c||"right"===o&&h||"top"===o&&m||"bottom"===o&&g,b=-1!==["top","bottom"].indexOf(o),w=!!t.flipVariations&&(b&&"start"===i&&c||b&&"end"===i&&h||!b&&"start"===i&&m||!b&&"end"===i&&g),y=!!t.flipVariationsByContent&&(b&&"start"===i&&h||b&&"end"===i&&c||!b&&"start"===i&&g||!b&&"end"===i&&m),O=w||y;(d||v||O)&&(e.flipped=!0,(d||v)&&(o=a[f+1]),O&&(i=function(e){return"end"===e?"start":"start"===e?"end":e}(i)),e.placement=o+(i?"-"+i:""),e.offsets.popper=z({},e.offsets.popper,x(e.instance.popper,e.offsets.reference,e.placement)),e=L(e.instance.modifiers,e,"flip"))}),e},behavior:"flip",padding:5,boundariesElement:"viewport",flipVariations:!1,flipVariationsByContent:!1},inner:{order:700,enabled:!1,fn:function(e){var t=e.placement,n=t.split("-")[0],o=e.offsets,r=o.popper,i=o.reference,a=-1!==["left","right"].indexOf(n),s=-1===["top","left"].indexOf(n);return r[a?"left":"top"]=i[n]-(s?r[a?"width":"height"]:0),e.placement=E(t),e.offsets.popper=d(r),e}},hide:{order:800,enabled:!0,fn:function(e){if(!W(e.instance.modifiers,"hide","preventOverflow"))return e;var t=e.offsets.reference,n=O(e.instance.modifiers,function(e){return"preventOverflow"===e.name}).boundaries;if(t.bottomn.right||t.top>n.bottom||t.right2&&void 0!==arguments[2]?arguments[2]:{};V(this,t),this.scheduleUpdate=function(){return requestAnimationFrame(r.update)},this.update=R(this.update.bind(this)),this.options=z({},t.Defaults,i),this.state={isDestroyed:!1,isCreated:!1,scrollParents:[]},this.reference=n&&n.jquery?n[0]:n,this.popper=o&&o.jquery?o[0]:o,this.options.modifiers={},Object.keys(z({},t.Defaults.modifiers,i.modifiers)).forEach(function(e){r.options.modifiers[e]=z({},t.Defaults.modifiers[e]||{},i.modifiers?i.modifiers[e]:{})}),this.modifiers=Object.keys(this.options.modifiers).map(function(e){return z({name:e},r.options.modifiers[e])}).sort(function(e,t){return e.order-t.order}),this.modifiers.forEach(function(t){t.enabled&&e(t.onLoad)&&t.onLoad(r.reference,r.popper,r.options,t,r.state)}),this.update();var a=this.options.eventsEnabled;a&&this.enableEventListeners(),this.state.eventsEnabled=a}return q(t,[{key:"update",value:function(){return function(){if(!this.state.isDestroyed){var e={instance:this,styles:{},arrowStyles:{},attributes:{},flipped:!1,offsets:{}};e.offsets.reference=w(this.state,this.popper,this.reference,this.options.positionFixed),e.placement=b(this.options.placement,e.offsets.reference,this.popper,this.reference,this.options.modifiers.flip.boundariesElement,this.options.modifiers.flip.padding),e.originalPlacement=e.placement,e.positionFixed=this.options.positionFixed,e.offsets.popper=x(this.popper,e.offsets.reference,e.placement),e.offsets.popper.position=this.options.positionFixed?"fixed":"absolute",e=L(this.modifiers,e),this.state.isCreated?this.options.onUpdate(e):(this.state.isCreated=!0,this.options.onCreate(e))}}.call(this)}},{key:"destroy",value:function(){return function(){return this.state.isDestroyed=!0,T(this.modifiers,"applyStyle")&&(this.popper.removeAttribute("x-placement"),this.popper.style.position="",this.popper.style.top="",this.popper.style.left="",this.popper.style.right="",this.popper.style.bottom="",this.popper.style.willChange="",this.popper.style[C("transform")]=""),this.disableEventListeners(),this.options.removeOnDestroy&&this.popper.parentNode.removeChild(this.popper),this}.call(this)}},{key:"enableEventListeners",value:function(){return N.call(this)}},{key:"disableEventListeners",value:function(){return F.call(this)}}]),t}();return Z.Utils=("undefined"!=typeof window?window:global).PopperUtils,Z.placements=_,Z.Defaults=Q,Z});