| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151 | /**! * @fileOverview Kickass library to create and place poppers near their reference elements. * @version 1.16.1 * @license * Copyright (c) 2016 Federico Zivolo and contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */(function (global, factory) {	typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :	typeof define === 'function' && define.amd ? define(['exports'], factory) :	(factory((global.PopperUtils = {})));}(this, (function (exports) { 'use strict';/** * Get CSS computed property of the given element * @method * @memberof Popper.Utils * @argument {Eement} element * @argument {String} property */function getStyleComputedProperty(element, property) {  if (element.nodeType !== 1) {    return [];  }  // NOTE: 1 DOM access here  var window = element.ownerDocument.defaultView;  var css = window.getComputedStyle(element, null);  return property ? css[property] : css;}/** * Returns the parentNode or the host of the element * @method * @memberof Popper.Utils * @argument {Element} element * @returns {Element} parent */function getParentNode(element) {  if (element.nodeName === 'HTML') {    return element;  }  return element.parentNode || element.host;}/** * Returns the scrolling parent of the given element * @method * @memberof Popper.Utils * @argument {Element} element * @returns {Element} scroll parent */function getScrollParent(element) {  // Return body, `getScroll` will take care to get the correct `scrollTop` from it  if (!element) {    return document.body;  }  switch (element.nodeName) {    case 'HTML':    case 'BODY':      return element.ownerDocument.body;    case '#document':      return element.body;  }  // Firefox want us to check `-x` and `-y` variations as well  var _getStyleComputedProp = getStyleComputedProperty(element),      overflow = _getStyleComputedProp.overflow,      overflowX = _getStyleComputedProp.overflowX,      overflowY = _getStyleComputedProp.overflowY;  if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {    return element;  }  return getScrollParent(getParentNode(element));}/** * Returns the reference node of the reference object, or the reference object itself. * @method * @memberof Popper.Utils * @param {Element|Object} reference - the reference element (the popper will be relative to this) * @returns {Element} parent */function getReferenceNode(reference) {  return reference && reference.referenceNode ? reference.referenceNode : reference;}var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);/** * Determines if the browser is Internet Explorer * @method * @memberof Popper.Utils * @param {Number} version to check * @returns {Boolean} isIE */function isIE(version) {  if (version === 11) {    return isIE11;  }  if (version === 10) {    return isIE10;  }  return isIE11 || isIE10;}/** * Returns the offset parent of the given element * @method * @memberof Popper.Utils * @argument {Element} element * @returns {Element} offset parent */function getOffsetParent(element) {  if (!element) {    return document.documentElement;  }  var noOffsetParent = isIE(10) ? document.body : null;  // NOTE: 1 DOM access here  var offsetParent = element.offsetParent || null;  // Skip hidden elements which don't have an offsetParent  while (offsetParent === noOffsetParent && element.nextElementSibling) {    offsetParent = (element = element.nextElementSibling).offsetParent;  }  var nodeName = offsetParent && offsetParent.nodeName;  if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {    return element ? element.ownerDocument.documentElement : document.documentElement;  }  // .offsetParent will return the closest TH, TD or TABLE in case  // no offsetParent is present, I hate this job...  if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {    return getOffsetParent(offsetParent);  }  return offsetParent;}function isOffsetContainer(element) {  var nodeName = element.nodeName;  if (nodeName === 'BODY') {    return false;  }  return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;}/** * Finds the root node (document, shadowDOM root) of the given element * @method * @memberof Popper.Utils * @argument {Element} node * @returns {Element} root node */function getRoot(node) {  if (node.parentNode !== null) {    return getRoot(node.parentNode);  }  return node;}/** * Finds the offset parent common to the two provided nodes * @method * @memberof Popper.Utils * @argument {Element} element1 * @argument {Element} element2 * @returns {Element} common offset parent */function findCommonOffsetParent(element1, element2) {  // This check is needed to avoid errors in case one of the elements isn't defined for any reason  if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {    return document.documentElement;  }  // Here we make sure to give as "start" the element that comes first in the DOM  var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;  var start = order ? element1 : element2;  var end = order ? element2 : element1;  // Get common ancestor container  var range = document.createRange();  range.setStart(start, 0);  range.setEnd(end, 0);  var commonAncestorContainer = range.commonAncestorContainer;  // Both nodes are inside #document  if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {    if (isOffsetContainer(commonAncestorContainer)) {      return commonAncestorContainer;    }    return getOffsetParent(commonAncestorContainer);  }  // one of the nodes is inside shadowDOM, find which one  var element1root = getRoot(element1);  if (element1root.host) {    return findCommonOffsetParent(element1root.host, element2);  } else {    return findCommonOffsetParent(element1, getRoot(element2).host);  }}/** * Gets the scroll value of the given element in the given side (top and left) * @method * @memberof Popper.Utils * @argument {Element} element * @argument {String} side `top` or `left` * @returns {number} amount of scrolled pixels */function getScroll(element) {  var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';  var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';  var nodeName = element.nodeName;  if (nodeName === 'BODY' || nodeName === 'HTML') {    var html = element.ownerDocument.documentElement;    var scrollingElement = element.ownerDocument.scrollingElement || html;    return scrollingElement[upperSide];  }  return element[upperSide];}/* * Sum or subtract the element scroll values (left and top) from a given rect object * @method * @memberof Popper.Utils * @param {Object} rect - Rect object you want to change * @param {HTMLElement} element - The element from the function reads the scroll values * @param {Boolean} subtract - set to true if you want to subtract the scroll values * @return {Object} rect - The modifier rect object */function includeScroll(rect, element) {  var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;  var scrollTop = getScroll(element, 'top');  var scrollLeft = getScroll(element, 'left');  var modifier = subtract ? -1 : 1;  rect.top += scrollTop * modifier;  rect.bottom += scrollTop * modifier;  rect.left += scrollLeft * modifier;  rect.right += scrollLeft * modifier;  return rect;}/* * Helper to detect borders of a given element * @method * @memberof Popper.Utils * @param {CSSStyleDeclaration} styles * Result of `getStyleComputedProperty` on the given element * @param {String} axis - `x` or `y` * @return {number} borders - The borders size of the given axis */function getBordersSize(styles, axis) {  var sideA = axis === 'x' ? 'Left' : 'Top';  var sideB = sideA === 'Left' ? 'Right' : 'Bottom';  return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);}function getSize(axis, body, html, computedStyle) {  return Math.max(body['offset' + axis], body['scroll' + axis], html['client' + axis], html['offset' + axis], html['scroll' + axis], isIE(10) ? parseInt(html['offset' + axis]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')]) : 0);}function getWindowSizes(document) {  var body = document.body;  var html = document.documentElement;  var computedStyle = isIE(10) && getComputedStyle(html);  return {    height: getSize('Height', body, html, computedStyle),    width: getSize('Width', body, html, computedStyle)  };}var _extends = Object.assign || function (target) {  for (var i = 1; i < arguments.length; i++) {    var source = arguments[i];    for (var key in source) {      if (Object.prototype.hasOwnProperty.call(source, key)) {        target[key] = source[key];      }    }  }  return target;};/** * Given element offsets, generate an output similar to getBoundingClientRect * @method * @memberof Popper.Utils * @argument {Object} offsets * @returns {Object} ClientRect like output */function getClientRect(offsets) {  return _extends({}, offsets, {    right: offsets.left + offsets.width,    bottom: offsets.top + offsets.height  });}/** * Get bounding client rect of given element * @method * @memberof Popper.Utils * @param {HTMLElement} element * @return {Object} client rect */function getBoundingClientRect(element) {  var rect = {};  // IE10 10 FIX: Please, don't ask, the element isn't  // considered in DOM in some circumstances...  // This isn't reproducible in IE10 compatibility mode of IE11  try {    if (isIE(10)) {      rect = element.getBoundingClientRect();      var scrollTop = getScroll(element, 'top');      var scrollLeft = getScroll(element, 'left');      rect.top += scrollTop;      rect.left += scrollLeft;      rect.bottom += scrollTop;      rect.right += scrollLeft;    } else {      rect = element.getBoundingClientRect();    }  } catch (e) {}  var result = {    left: rect.left,    top: rect.top,    width: rect.right - rect.left,    height: rect.bottom - rect.top  };  // subtract scrollbar size from sizes  var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};  var width = sizes.width || element.clientWidth || result.width;  var height = sizes.height || element.clientHeight || result.height;  var horizScrollbar = element.offsetWidth - width;  var vertScrollbar = element.offsetHeight - height;  // if an hypothetical scrollbar is detected, we must be sure it's not a `border`  // we make this check conditional for performance reasons  if (horizScrollbar || vertScrollbar) {    var styles = getStyleComputedProperty(element);    horizScrollbar -= getBordersSize(styles, 'x');    vertScrollbar -= getBordersSize(styles, 'y');    result.width -= horizScrollbar;    result.height -= vertScrollbar;  }  return getClientRect(result);}function getOffsetRectRelativeToArbitraryNode(children, parent) {  var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;  var isIE10 = isIE(10);  var isHTML = parent.nodeName === 'HTML';  var childrenRect = getBoundingClientRect(children);  var parentRect = getBoundingClientRect(parent);  var scrollParent = getScrollParent(children);  var styles = getStyleComputedProperty(parent);  var borderTopWidth = parseFloat(styles.borderTopWidth);  var borderLeftWidth = parseFloat(styles.borderLeftWidth);  // In cases where the parent is fixed, we must ignore negative scroll in offset calc  if (fixedPosition && isHTML) {    parentRect.top = Math.max(parentRect.top, 0);    parentRect.left = Math.max(parentRect.left, 0);  }  var offsets = getClientRect({    top: childrenRect.top - parentRect.top - borderTopWidth,    left: childrenRect.left - parentRect.left - borderLeftWidth,    width: childrenRect.width,    height: childrenRect.height  });  offsets.marginTop = 0;  offsets.marginLeft = 0;  // Subtract margins of documentElement in case it's being used as parent  // we do this only on HTML because it's the only element that behaves  // differently when margins are applied to it. The margins are included in  // the box of the documentElement, in the other cases not.  if (!isIE10 && isHTML) {    var marginTop = parseFloat(styles.marginTop);    var marginLeft = parseFloat(styles.marginLeft);    offsets.top -= borderTopWidth - marginTop;    offsets.bottom -= borderTopWidth - marginTop;    offsets.left -= borderLeftWidth - marginLeft;    offsets.right -= borderLeftWidth - marginLeft;    // Attach marginTop and marginLeft because in some circumstances we may need them    offsets.marginTop = marginTop;    offsets.marginLeft = marginLeft;  }  if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {    offsets = includeScroll(offsets, parent);  }  return offsets;}function getViewportOffsetRectRelativeToArtbitraryNode(element) {  var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;  var html = element.ownerDocument.documentElement;  var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);  var width = Math.max(html.clientWidth, window.innerWidth || 0);  var height = Math.max(html.clientHeight, window.innerHeight || 0);  var scrollTop = !excludeScroll ? getScroll(html) : 0;  var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;  var offset = {    top: scrollTop - relativeOffset.top + relativeOffset.marginTop,    left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,    width: width,    height: height  };  return getClientRect(offset);}/** * Check if the given element is fixed or is inside a fixed parent * @method * @memberof Popper.Utils * @argument {Element} element * @argument {Element} customContainer * @returns {Boolean} answer to "isFixed?" */function isFixed(element) {  var nodeName = element.nodeName;  if (nodeName === 'BODY' || nodeName === 'HTML') {    return false;  }  if (getStyleComputedProperty(element, 'position') === 'fixed') {    return true;  }  var parentNode = getParentNode(element);  if (!parentNode) {    return false;  }  return isFixed(parentNode);}/** * Finds the first parent of an element that has a transformed property defined * @method * @memberof Popper.Utils * @argument {Element} element * @returns {Element} first transformed parent or documentElement */function getFixedPositionOffsetParent(element) {  // This check is needed to avoid errors in case one of the elements isn't defined for any reason  if (!element || !element.parentElement || isIE()) {    return document.documentElement;  }  var el = element.parentElement;  while (el && getStyleComputedProperty(el, 'transform') === 'none') {    el = el.parentElement;  }  return el || document.documentElement;}/** * Computed the boundaries limits and return them * @method * @memberof Popper.Utils * @param {HTMLElement} popper * @param {HTMLElement} reference * @param {number} padding * @param {HTMLElement} boundariesElement - Element used to define the boundaries * @param {Boolean} fixedPosition - Is in fixed position mode * @returns {Object} Coordinates of the boundaries */function getBoundaries(popper, reference, padding, boundariesElement) {  var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;  // NOTE: 1 DOM access here  var boundaries = { top: 0, left: 0 };  var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));  // Handle viewport case  if (boundariesElement === 'viewport') {    boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);  } else {    // Handle other cases based on DOM element used as boundaries    var boundariesNode = void 0;    if (boundariesElement === 'scrollParent') {      boundariesNode = getScrollParent(getParentNode(reference));      if (boundariesNode.nodeName === 'BODY') {        boundariesNode = popper.ownerDocument.documentElement;      }    } else if (boundariesElement === 'window') {      boundariesNode = popper.ownerDocument.documentElement;    } else {      boundariesNode = boundariesElement;    }    var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);    // In case of HTML, we need a different computation    if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {      var _getWindowSizes = getWindowSizes(popper.ownerDocument),          height = _getWindowSizes.height,          width = _getWindowSizes.width;      boundaries.top += offsets.top - offsets.marginTop;      boundaries.bottom = height + offsets.top;      boundaries.left += offsets.left - offsets.marginLeft;      boundaries.right = width + offsets.left;    } else {      // for all the other DOM elements, this one is good      boundaries = offsets;    }  }  // Add paddings  padding = padding || 0;  var isPaddingNumber = typeof padding === 'number';  boundaries.left += isPaddingNumber ? padding : padding.left || 0;  boundaries.top += isPaddingNumber ? padding : padding.top || 0;  boundaries.right -= isPaddingNumber ? padding : padding.right || 0;  boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;  return boundaries;}function getArea(_ref) {  var width = _ref.width,      height = _ref.height;  return width * height;}/** * Utility used to transform the `auto` placement to the placement with more * available space. * @method * @memberof Popper.Utils * @argument {Object} data - The data object generated by update method * @argument {Object} options - Modifiers configuration and options * @returns {Object} The data object, properly modified */function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {  var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;  if (placement.indexOf('auto') === -1) {    return placement;  }  var boundaries = getBoundaries(popper, reference, padding, boundariesElement);  var rects = {    top: {      width: boundaries.width,      height: refRect.top - boundaries.top    },    right: {      width: boundaries.right - refRect.right,      height: boundaries.height    },    bottom: {      width: boundaries.width,      height: boundaries.bottom - refRect.bottom    },    left: {      width: refRect.left - boundaries.left,      height: boundaries.height    }  };  var sortedAreas = Object.keys(rects).map(function (key) {    return _extends({      key: key    }, rects[key], {      area: getArea(rects[key])    });  }).sort(function (a, b) {    return b.area - a.area;  });  var filteredAreas = sortedAreas.filter(function (_ref2) {    var width = _ref2.width,        height = _ref2.height;    return width >= popper.clientWidth && height >= popper.clientHeight;  });  var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;  var variation = placement.split('-')[1];  return computedPlacement + (variation ? '-' + variation : '');}var timeoutDuration = function () {  var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];  for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {    if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {      return 1;    }  }  return 0;}();function microtaskDebounce(fn) {  var called = false;  return function () {    if (called) {      return;    }    called = true;    window.Promise.resolve().then(function () {      called = false;      fn();    });  };}function taskDebounce(fn) {  var scheduled = false;  return function () {    if (!scheduled) {      scheduled = true;      setTimeout(function () {        scheduled = false;        fn();      }, timeoutDuration);    }  };}var supportsMicroTasks = isBrowser && window.Promise;/*** Create a debounced version of a method, that's asynchronously deferred* but called in the minimum time possible.** @method* @memberof Popper.Utils* @argument {Function} fn* @returns {Function}*/var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;/** * Mimics the `find` method of Array * @method * @memberof Popper.Utils * @argument {Array} arr * @argument prop * @argument value * @returns index or -1 */function find(arr, check) {  // use native find if supported  if (Array.prototype.find) {    return arr.find(check);  }  // use `filter` to obtain the same behavior of `find`  return arr.filter(check)[0];}/** * Return the index of the matching object * @method * @memberof Popper.Utils * @argument {Array} arr * @argument prop * @argument value * @returns index or -1 */function findIndex(arr, prop, value) {  // use native findIndex if supported  if (Array.prototype.findIndex) {    return arr.findIndex(function (cur) {      return cur[prop] === value;    });  }  // use `find` + `indexOf` if `findIndex` isn't supported  var match = find(arr, function (obj) {    return obj[prop] === value;  });  return arr.indexOf(match);}/** * Get the position of the given element, relative to its offset parent * @method * @memberof Popper.Utils * @param {Element} element * @return {Object} position - Coordinates of the element and its `scrollTop` */function getOffsetRect(element) {  var elementRect = void 0;  if (element.nodeName === 'HTML') {    var _getWindowSizes = getWindowSizes(element.ownerDocument),        width = _getWindowSizes.width,        height = _getWindowSizes.height;    elementRect = {      width: width,      height: height,      left: 0,      top: 0    };  } else {    elementRect = {      width: element.offsetWidth,      height: element.offsetHeight,      left: element.offsetLeft,      top: element.offsetTop    };  }  // position  return getClientRect(elementRect);}/** * Get the outer sizes of the given element (offset size + margins) * @method * @memberof Popper.Utils * @argument {Element} element * @returns {Object} object containing width and height properties */function getOuterSizes(element) {  var window = element.ownerDocument.defaultView;  var styles = window.getComputedStyle(element);  var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);  var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);  var result = {    width: element.offsetWidth + y,    height: element.offsetHeight + x  };  return result;}/** * Get the opposite placement of the given one * @method * @memberof Popper.Utils * @argument {String} placement * @returns {String} flipped placement */function getOppositePlacement(placement) {  var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };  return placement.replace(/left|right|bottom|top/g, function (matched) {    return hash[matched];  });}/** * Get offsets to the popper * @method * @memberof Popper.Utils * @param {Object} position - CSS position the Popper will get applied * @param {HTMLElement} popper - the popper element * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this) * @param {String} placement - one of the valid placement options * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper */function getPopperOffsets(popper, referenceOffsets, placement) {  placement = placement.split('-')[0];  // Get popper node sizes  var popperRect = getOuterSizes(popper);  // Add position, width and height to our offsets object  var popperOffsets = {    width: popperRect.width,    height: popperRect.height  };  // depending by the popper placement we have to compute its offsets slightly differently  var isHoriz = ['right', 'left'].indexOf(placement) !== -1;  var mainSide = isHoriz ? 'top' : 'left';  var secondarySide = isHoriz ? 'left' : 'top';  var measurement = isHoriz ? 'height' : 'width';  var secondaryMeasurement = !isHoriz ? 'height' : 'width';  popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;  if (placement === secondarySide) {    popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];  } else {    popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];  }  return popperOffsets;}/** * Get offsets to the reference element * @method * @memberof Popper.Utils * @param {Object} state * @param {Element} popper - the popper element * @param {Element} reference - the reference element (the popper will be relative to this) * @param {Element} fixedPosition - is in fixed position mode * @returns {Object} An object containing the offsets which will be applied to the popper */function getReferenceOffsets(state, popper, reference) {  var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;  var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));  return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);}/** * Get the prefixed supported property name * @method * @memberof Popper.Utils * @argument {String} property (camelCase) * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix) */function getSupportedPropertyName(property) {  var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];  var upperProp = property.charAt(0).toUpperCase() + property.slice(1);  for (var i = 0; i < prefixes.length; i++) {    var prefix = prefixes[i];    var toCheck = prefix ? '' + prefix + upperProp : property;    if (typeof document.body.style[toCheck] !== 'undefined') {      return toCheck;    }  }  return null;}/** * Check if the given variable is a function * @method * @memberof Popper.Utils * @argument {Any} functionToCheck - variable to check * @returns {Boolean} answer to: is a function? */function isFunction(functionToCheck) {  var getType = {};  return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';}/** * Helper used to know if the given modifier is enabled. * @method * @memberof Popper.Utils * @returns {Boolean} */function isModifierEnabled(modifiers, modifierName) {  return modifiers.some(function (_ref) {    var name = _ref.name,        enabled = _ref.enabled;    return enabled && name === modifierName;  });}/** * Helper used to know if the given modifier depends from another one.<br /> * It checks if the needed modifier is listed and enabled. * @method * @memberof Popper.Utils * @param {Array} modifiers - list of modifiers * @param {String} requestingName - name of requesting modifier * @param {String} requestedName - name of requested modifier * @returns {Boolean} */function isModifierRequired(modifiers, requestingName, requestedName) {  var requesting = find(modifiers, function (_ref) {    var name = _ref.name;    return name === requestingName;  });  var isRequired = !!requesting && modifiers.some(function (modifier) {    return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;  });  if (!isRequired) {    var _requesting = '`' + requestingName + '`';    var requested = '`' + requestedName + '`';    console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');  }  return isRequired;}/** * Tells if a given input is a number * @method * @memberof Popper.Utils * @param {*} input to check * @return {Boolean} */function isNumeric(n) {  return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);}/** * Get the window associated with the element * @argument {Element} element * @returns {Window} */function getWindow(element) {  var ownerDocument = element.ownerDocument;  return ownerDocument ? ownerDocument.defaultView : window;}/** * Remove event listeners used to update the popper position * @method * @memberof Popper.Utils * @private */function removeEventListeners(reference, state) {  // Remove resize event listener on window  getWindow(reference).removeEventListener('resize', state.updateBound);  // Remove scroll event listener on scroll parents  state.scrollParents.forEach(function (target) {    target.removeEventListener('scroll', state.updateBound);  });  // Reset state  state.updateBound = null;  state.scrollParents = [];  state.scrollElement = null;  state.eventsEnabled = false;  return state;}/** * Loop trough the list of modifiers and run them in order, * each of them will then edit the data object. * @method * @memberof Popper.Utils * @param {dataObject} data * @param {Array} modifiers * @param {String} ends - Optional modifier name used as stopper * @returns {dataObject} */function runModifiers(modifiers, data, ends) {  var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));  modifiersToRun.forEach(function (modifier) {    if (modifier['function']) {      // eslint-disable-line dot-notation      console.warn('`modifier.function` is deprecated, use `modifier.fn`!');    }    var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation    if (modifier.enabled && isFunction(fn)) {      // Add properties to offsets to make them a complete clientRect object      // we do this before each modifier to make sure the previous one doesn't      // mess with these values      data.offsets.popper = getClientRect(data.offsets.popper);      data.offsets.reference = getClientRect(data.offsets.reference);      data = fn(data, modifier);    }  });  return data;}/** * Set the attributes to the given popper * @method * @memberof Popper.Utils * @argument {Element} element - Element to apply the attributes to * @argument {Object} styles * Object with a list of properties and values which will be applied to the element */function setAttributes(element, attributes) {  Object.keys(attributes).forEach(function (prop) {    var value = attributes[prop];    if (value !== false) {      element.setAttribute(prop, attributes[prop]);    } else {      element.removeAttribute(prop);    }  });}/** * Set the style to the given popper * @method * @memberof Popper.Utils * @argument {Element} element - Element to apply the style to * @argument {Object} styles * Object with a list of properties and values which will be applied to the element */function setStyles(element, styles) {  Object.keys(styles).forEach(function (prop) {    var unit = '';    // add unit if the value is numeric and is one of the following    if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {      unit = 'px';    }    element.style[prop] = styles[prop] + unit;  });}function attachToScrollParents(scrollParent, event, callback, scrollParents) {  var isBody = scrollParent.nodeName === 'BODY';  var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;  target.addEventListener(event, callback, { passive: true });  if (!isBody) {    attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);  }  scrollParents.push(target);}/** * Setup needed event listeners used to update the popper position * @method * @memberof Popper.Utils * @private */function setupEventListeners(reference, options, state, updateBound) {  // Resize event listener on window  state.updateBound = updateBound;  getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });  // Scroll event listener on scroll parents  var scrollElement = getScrollParent(reference);  attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);  state.scrollElement = scrollElement;  state.eventsEnabled = true;  return state;}// This is here just for backward compatibility with versions lower than v1.10.3// you should import the utilities using named exports, if you want them all use:// ```// import * as PopperUtils from 'popper-utils';// ```// The default export will be removed in the next major version.var index = {  computeAutoPlacement: computeAutoPlacement,  debounce: debounce,  findIndex: findIndex,  getBordersSize: getBordersSize,  getBoundaries: getBoundaries,  getBoundingClientRect: getBoundingClientRect,  getClientRect: getClientRect,  getOffsetParent: getOffsetParent,  getOffsetRect: getOffsetRect,  getOffsetRectRelativeToArbitraryNode: getOffsetRectRelativeToArbitraryNode,  getOuterSizes: getOuterSizes,  getParentNode: getParentNode,  getPopperOffsets: getPopperOffsets,  getReferenceOffsets: getReferenceOffsets,  getScroll: getScroll,  getScrollParent: getScrollParent,  getStyleComputedProperty: getStyleComputedProperty,  getSupportedPropertyName: getSupportedPropertyName,  getWindowSizes: getWindowSizes,  isFixed: isFixed,  isFunction: isFunction,  isModifierEnabled: isModifierEnabled,  isModifierRequired: isModifierRequired,  isNumeric: isNumeric,  removeEventListeners: removeEventListeners,  runModifiers: runModifiers,  setAttributes: setAttributes,  setStyles: setStyles,  setupEventListeners: setupEventListeners};exports.computeAutoPlacement = computeAutoPlacement;exports.debounce = debounce;exports.findIndex = findIndex;exports.getBordersSize = getBordersSize;exports.getBoundaries = getBoundaries;exports.getBoundingClientRect = getBoundingClientRect;exports.getClientRect = getClientRect;exports.getOffsetParent = getOffsetParent;exports.getOffsetRect = getOffsetRect;exports.getOffsetRectRelativeToArbitraryNode = getOffsetRectRelativeToArbitraryNode;exports.getOuterSizes = getOuterSizes;exports.getParentNode = getParentNode;exports.getPopperOffsets = getPopperOffsets;exports.getReferenceOffsets = getReferenceOffsets;exports.getScroll = getScroll;exports.getScrollParent = getScrollParent;exports.getStyleComputedProperty = getStyleComputedProperty;exports.getSupportedPropertyName = getSupportedPropertyName;exports.getWindowSizes = getWindowSizes;exports.isFixed = isFixed;exports.isFunction = isFunction;exports.isModifierEnabled = isModifierEnabled;exports.isModifierRequired = isModifierRequired;exports.isNumeric = isNumeric;exports.removeEventListeners = removeEventListeners;exports.runModifiers = runModifiers;exports.setAttributes = setAttributes;exports.setStyles = setStyles;exports.setupEventListeners = setupEventListeners;exports['default'] = index;Object.defineProperty(exports, '__esModule', { value: true });})));//# sourceMappingURL=popper-utils.js.map
 |