PageSourceSearch

https://www.draytek.co.uk/media/vendor/bootstrap/js/popper.js?5.3.2

js draytek.co.uk collected 2026-10-02 04:32:13 UTC 59,818 bytes, 1,666 lines download raw bytes

vendor: 30,844 bytes, lines 1-888
1var top = 'top';
2var bottom = 'bottom';
3var right = 'right';
4var left = 'left';
5var auto = 'auto';
6var basePlacements = [top, bottom, right, left];
7var start = 'start';
8var end = 'end';
9var clippingParents = 'clippingParents';
10var viewport = 'viewport';
11var popper = 'popper';
12var reference = 'reference';
13var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
14  return acc.concat([placement + "-" + start, placement + "-" + end]);
15}, []);
16var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
17  return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
18}, []); // modifiers that need to read the DOM
19
20var beforeRead = 'beforeRead';
21var read = 'read';
22var afterRead = 'afterRead'; // pure-logic modifiers
23
24var beforeMain = 'beforeMain';
25var main = 'main';
26var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
27
28var beforeWrite = 'beforeWrite';
29var write = 'write';
30var afterWrite = 'afterWrite';
31var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
32
33function getNodeName(element) {
34  return element ? (element.nodeName || '').toLowerCase() : null;
35}
36
37function getWindow(node) {
38  if (node == null) {
39    return window;
40  }
41  if (node.toString() !== '[object Window]') {
42    var ownerDocument = node.ownerDocument;
43    return ownerDocument ? ownerDocument.defaultView || window : window;
44  }
45  return node;
46}
47
48function isElement(node) {
49  var OwnElement = getWindow(node).Element;
50  return node instanceof OwnElement || node instanceof Element;
51}
52function isHTMLElement(node) {
53  var OwnElement = getWindow(node).HTMLElement;
54  return node instanceof OwnElement || node instanceof HTMLElement;
55}
56function isShadowRoot(node) {
57  // IE 11 has no ShadowRoot
58  if (typeof ShadowRoot === 'undefined') {
59    return false;
60  }
61  var OwnElement = getWindow(node).ShadowRoot;
62  return node instanceof OwnElement || node instanceof ShadowRoot;
63}
64
65// and applies them to the HTMLElements such as popper and arrow
66
67function applyStyles(_ref) {
68  var state = _ref.state;
69  Object.keys(state.elements).forEach(function (name) {
70    var style = state.styles[name] || {};
71    var attributes = state.attributes[name] || {};
72    var element = state.elements[name]; // arrow is optional + virtual elements
73
74    if (!isHTMLElement(element) || !getNodeName(element)) {
75      return;
76    } // Flow doesn't support to extend this property, but it's the most
77    // effective way to apply styles to an HTMLElement
78    // $FlowFixMe[cannot-write]
79
80    Object.assign(element.style, style);
81    Object.keys(attributes).forEach(function (name) {
82      var value = attributes[name];
83      if (value === false) {
84        element.removeAttribute(name);
85      } else {
86        element.setAttribute(name, value === true ? '' : value);
87      }
88    });
89  });
90}
91function effect$2(_ref2) {
92  var state = _ref2.state;
93  var initialStyles = {
94    popper: {
95      position: state.options.strategy,
96      left: '0',
97      top: '0',
98      margin: '0'
99    },
100    arrow: {
101      position: 'absolute'
102    },
103    reference: {}
104  };
105  Object.assign(state.elements.popper.style, initialStyles.popper);
106  state.styles = initialStyles;
107  if (state.elements.arrow) {
108    Object.assign(state.elements.arrow.style, initialStyles.arrow);
109  }
110  return function () {
111    Object.keys(state.elements).forEach(function (name) {
112      var element = state.elements[name];
113      var attributes = state.attributes[name] || {};
114      var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them
115
116      var style = styleProperties.reduce(function (style, property) {
117        style[property] = '';
118        return style;
119      }, {}); // arrow is optional + virtual elements
120
121      if (!isHTMLElement(element) || !getNodeName(element)) {
122        return;
123      }
124      Object.assign(element.style, style);
125      Object.keys(attributes).forEach(function (attribute) {
126        element.removeAttribute(attribute);
127      });
128    });
129  };
130} // eslint-disable-next-line import/no-unused-modules
131
132var applyStyles$1 = {
133  name: 'applyStyles',
134  enabled: true,
135  phase: 'write',
136  fn: applyStyles,
137  effect: effect$2,
138  requires: ['computeStyles']
139};
140
141function getBasePlacement(placement) {
142  return placement.split('-')[0];
143}
144
145var max = Math.max;
146var min = Math.min;
147var round = Math.round;
148
149function getUAString() {
150  var uaData = navigator.userAgentData;
151  if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
152    return uaData.brands.map(function (item) {
153      return item.brand + "/" + item.version;
154    }).join(' ');
155  }
156  return navigator.userAgent;
157}
158
159function isLayoutViewport() {
160  return !/^((?!chrome|android).)*safari/i.test(getUAString());
161}
162
163function getBoundingClientRect(element, includeScale, isFixedStrategy) {
164  if (includeScale === void 0) {
165    includeScale = false;
166  }
167  if (isFixedStrategy === void 0) {
168    isFixedStrategy = false;
169  }
170  var clientRect = element.getBoundingClientRect();
171  var scaleX = 1;
172  var scaleY = 1;
173  if (includeScale && isHTMLElement(element)) {
174    scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
175    scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
176  }
177  var _ref = isElement(element) ? getWindow(element) : window,
178    visualViewport = _ref.visualViewport;
179  var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
180  var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
181  var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
182  var width = clientRect.width / scaleX;
183  var height = clientRect.height / scaleY;
184  return {
185    width: width,
186    height: height,
187    top: y,
188    right: x + width,
189    bottom: y + height,
190    left: x,
191    x: x,
192    y: y
193  };
194}
195
196// means it doesn't take into account transforms.
197
198function getLayoutRect(element) {
199  var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
200  // Fixes https://github.com/popperjs/popper-core/issues/1223
201
202  var width = element.offsetWidth;
203  var height = element.offsetHeight;
204  if (Math.abs(clientRect.width - width) <= 1) {
205    width = clientRect.width;
206  }
207  if (Math.abs(clientRect.height - height) <= 1) {
208    height = clientRect.height;
209  }
210  return {
211    x: element.offsetLeft,
212    y: element.offsetTop,
213    width: width,
214    height: height
215  };
216}
217
218function contains(parent, child) {
219  var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
220
221  if (parent.contains(child)) {
222    return true;
223  } // then fallback to custom implementation with Shadow DOM support
224  else if (rootNode && isShadowRoot(rootNode)) {
225    var next = child;
226    do {
227      if (next && parent.isSameNode(next)) {
228        return true;
229      } // $FlowFixMe[prop-missing]: need a better way to handle this...
230
231      next = next.parentNode || next.host;
232    } while (next);
233  } // Give up, the result is false
234
235  return false;
236}
237
238function getComputedStyle(element) {
239  return getWindow(element).getComputedStyle(element);
240}
241
242function isTableElement(element) {
243  return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
244}
245
246function getDocumentElement(element) {
247  // $FlowFixMe[incompatible-return]: assume body is always available
248  return ((isElement(element) ? element.ownerDocument :
249  // $FlowFixMe[prop-missing]
250  element.document) || window.document).documentElement;
251}
252
253function getParentNode(element) {
254  if (getNodeName(element) === 'html') {
255    return element;
256  }
257  return (
258    // this is a quicker (but less type safe) way to save quite some bytes from the bundle
259    // $FlowFixMe[incompatible-return]
260    // $FlowFixMe[prop-missing]
261    element.assignedSlot ||
262    // step into the shadow DOM of the parent of a slotted node
263    element.parentNode || (
264    // DOM Element detected
265    isShadowRoot(element) ? element.host : null) ||
266    // ShadowRoot detected
267    // $FlowFixMe[incompatible-call]: HTMLElement is a Node
268    getDocumentElement(element) // fallback
269  );
270}
271
272function getTrueOffsetParent(element) {
273  if (!isHTMLElement(element) ||
274  // https://github.com/popperjs/popper-core/issues/837
275  getComputedStyle(element).position === 'fixed') {
276    return null;
277  }
278  return element.offsetParent;
279} // `.offsetParent` reports `null` for fixed elements, while absolute elements
280// return the containing block
281
282function getContainingBlock(element) {
283  var isFirefox = /firefox/i.test(getUAString());
284  var isIE = /Trident/i.test(getUAString());
285  if (isIE && isHTMLElement(element)) {
286    // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
287    var elementCss = getComputedStyle(element);
288    if (elementCss.position === 'fixed') {
289      return null;
290    }
291  }
292  var currentNode = getParentNode(element);
293  if (isShadowRoot(currentNode)) {
294    currentNode = currentNode.host;
295  }
296  while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
297    var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
298    // create a containing block.
299    // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
300
301    if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {
302      return currentNode;
303    } else {
304      currentNode = currentNode.parentNode;
305    }
306  }
307  return null;
308} // Gets the closest ancestor positioned element. Handles some edge cases,
309// such as table ancestors and cross browser bugs.
310
311function getOffsetParent(element) {
312  var window = getWindow(element);
313  var offsetParent = getTrueOffsetParent(element);
314  while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
315    offsetParent = getTrueOffsetParent(offsetParent);
316  }
317  if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {
318    return window;
319  }
320  return offsetParent || getContainingBlock(element) || window;
321}
322
323function getMainAxisFromPlacement(placement) {
324  return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
325}
326
327function within(min$1, value, max$1) {
328  return max(min$1, min(value, max$1));
329}
330function withinMaxClamp(min, value, max) {
331  var v = within(min, value, max);
332  return v > max ? max : v;
333}
334
335function getFreshSideObject() {
336  return {
337    top: 0,
338    right: 0,
339    bottom: 0,
340    left: 0
341  };
342}
343
344function mergePaddingObject(paddingObject) {
345  return Object.assign({}, getFreshSideObject(), paddingObject);
346}
347
348function expandToHashMap(value, keys) {
349  return keys.reduce(function (hashMap, key) {
350    hashMap[key] = value;
351    return hashMap;
352  }, {});
353}
354
355var toPaddingObject = function toPaddingObject(padding, state) {
356  padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {
357    placement: state.placement
358  })) : padding;
359  return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
360};
361function arrow(_ref) {
362  var _state$modifiersData$;
363  var state = _ref.state,
364    name = _ref.name,
365    options = _ref.options;
366  var arrowElement = state.elements.arrow;
367  var popperOffsets = state.modifiersData.popperOffsets;
368  var basePlacement = getBasePlacement(state.placement);
369  var axis = getMainAxisFromPlacement(basePlacement);
370  var isVertical = [left, right].indexOf(basePlacement) >= 0;
371  var len = isVertical ? 'height' : 'width';
372  if (!arrowElement || !popperOffsets) {
373    return;
374  }
375  var paddingObject = toPaddingObject(options.padding, state);
376  var arrowRect = getLayoutRect(arrowElement);
377  var minProp = axis === 'y' ? top : left;
378  var maxProp = axis === 'y' ? bottom : right;
379  var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];
380  var startDiff = popperOffsets[axis] - state.rects.reference[axis];
381  var arrowOffsetParent = getOffsetParent(arrowElement);
382  var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
383  var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is
384  // outside of the popper bounds
385
386  var min = paddingObject[minProp];
387  var max = clientSize - arrowRect[len] - paddingObject[maxProp];
388  var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
389  var offset = within(min, center, max); // Prevents breaking syntax highlighting...
390
391  var axisProp = axis;
392  state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);
393}
394function effect$1(_ref2) {
395  var state = _ref2.state,
396    options = _ref2.options;
397  var _options$element = options.element,
398    arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;
399  if (arrowElement == null) {
400    return;
401  } // CSS selector
402
403  if (typeof arrowElement === 'string') {
404    arrowElement = state.elements.popper.querySelector(arrowElement);
405    if (!arrowElement) {
406      return;
407    }
408  }
409  if (!contains(state.elements.popper, arrowElement)) {
410    return;
411  }
412  state.elements.arrow = arrowElement;
413} // eslint-disable-next-line import/no-unused-modules
414
415var arrow$1 = {
416  name: 'arrow',
417  enabled: true,
418  phase: 'main',
419  fn: arrow,
420  effect: effect$1,
421  requires: ['popperOffsets'],
422  requiresIfExists: ['preventOverflow']
423};
424
425function getVariation(placement) {
426  return placement.split('-')[1];
427}
428
429var unsetSides = {
430  top: 'auto',
431  right: 'auto',
432  bottom: 'auto',
433  left: 'auto'
434}; // Round the offsets to the nearest suitable subpixel based on the DPR.
435// Zooming can change the DPR, but it seems to report a value that will
436// cleanly divide the values into the appropriate subpixels.
437
438function roundOffsetsByDPR(_ref, win) {
439  var x = _ref.x,
440    y = _ref.y;
441  var dpr = win.devicePixelRatio || 1;
442  return {
443    x: round(x * dpr) / dpr || 0,
444    y: round(y * dpr) / dpr || 0
445  };
446}
447function mapToStyles(_ref2) {
448  var _Object$assign2;
449  var popper = _ref2.popper,
450    popperRect = _ref2.popperRect,
451    placement = _ref2.placement,
452    variation = _ref2.variation,
453    offsets = _ref2.offsets,
454    position = _ref2.position,
455    gpuAcceleration = _ref2.gpuAcceleration,
456    adaptive = _ref2.adaptive,
457    roundOffsets = _ref2.roundOffsets,
458    isFixed = _ref2.isFixed;
459  var _offsets$x = offsets.x,
460    x = _offsets$x === void 0 ? 0 : _offsets$x,
461    _offsets$y = offsets.y,
462    y = _offsets$y === void 0 ? 0 : _offsets$y;
463  var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({
464    x: x,
465    y: y
466  }) : {
467    x: x,
468    y: y
469  };
470  x = _ref3.x;
471  y = _ref3.y;
472  var hasX = offsets.hasOwnProperty('x');
473  var hasY = offsets.hasOwnProperty('y');
474  var sideX = left;
475  var sideY = top;
476  var win = window;
477  if (adaptive) {
478    var offsetParent = getOffsetParent(popper);
479    var heightProp = 'clientHeight';
480    var widthProp = 'clientWidth';
481    if (offsetParent === getWindow(popper)) {
482      offsetParent = getDocumentElement(popper);
483      if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {
484        heightProp = 'scrollHeight';
485        widthProp = 'scrollWidth';
486      }
487    } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
488
489    offsetParent = offsetParent;
490    if (placement === top || (placement === left || placement === right) && variation === end) {
491      sideY = bottom;
492      var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height :
493      // $FlowFixMe[prop-missing]
494      offsetParent[heightProp];
495      y -= offsetY - popperRect.height;
496      y *= gpuAcceleration ? 1 : -1;
497    }
498    if (placement === left || (placement === top || placement === bottom) && variation === end) {
499      sideX = right;
500      var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width :
501      // $FlowFixMe[prop-missing]
502      offsetParent[widthProp];
503      x -= offsetX - popperRect.width;
504      x *= gpuAcceleration ? 1 : -1;
505    }
506  }
507  var commonStyles = Object.assign({
508    position: position
509  }, adaptive && unsetSides);
510  var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
511    x: x,
512    y: y
513  }, getWindow(popper)) : {
514    x: x,
515    y: y
516  };
517  x = _ref4.x;
518  y = _ref4.y;
519  if (gpuAcceleration) {
520    var _Object$assign;
521    return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
522  }
523  return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
524}
525function computeStyles(_ref5) {
526  var state = _ref5.state,
527    options = _ref5.options;
528  var _options$gpuAccelerat = options.gpuAcceleration,
529    gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
530    _options$adaptive = options.adaptive,
531    adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
532    _options$roundOffsets = options.roundOffsets,
533    roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
534  var commonStyles = {
535    placement: getBasePlacement(state.placement),
536    variation: getVariation(state.placement),
537    popper: state.elements.popper,
538    popperRect: state.rects.popper,
539    gpuAcceleration: gpuAcceleration,
540    isFixed: state.options.strategy === 'fixed'
541  };
542  if (state.modifiersData.popperOffsets != null) {
543    state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
544      offsets: state.modifiersData.popperOffsets,
545      position: state.options.strategy,
546      adaptive: adaptive,
547      roundOffsets: roundOffsets
548    })));
549  }
550  if (state.modifiersData.arrow != null) {
551    state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
552      offsets: state.modifiersData.arrow,
553      position: 'absolute',
554      adaptive: false,
555      roundOffsets: roundOffsets
556    })));
557  }
558  state.attributes.popper = Object.assign({}, state.attributes.popper, {
559    'data-popper-placement': state.placement
560  });
561} // eslint-disable-next-line import/no-unused-modules
562
563var computeStyles$1 = {
564  name: 'computeStyles',
565  enabled: true,
566  phase: 'beforeWrite',
567  fn: computeStyles,
568  data: {}
569};
570
571var passive = {
572  passive: true
573};
574function effect(_ref) {
575  var state = _ref.state,
576    instance = _ref.instance,
577    options = _ref.options;
578  var _options$scroll = options.scroll,
579    scroll = _options$scroll === void 0 ? true : _options$scroll,
580    _options$resize = options.resize,
581    resize = _options$resize === void 0 ? true : _options$resize;
582  var window = getWindow(state.elements.popper);
583  var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
584  if (scroll) {
585    scrollParents.forEach(function (scrollParent) {
586      scrollParent.addEventListener('scroll', instance.update, passive);
587    });
588  }
589  if (resize) {
590    window.addEventListener('resize', instance.update, passive);
591  }
592  return function () {
593    if (scroll) {
594      scrollParents.forEach(function (scrollParent) {
595        scrollParent.removeEventListener('scroll', instance.update, passive);
596      });
597    }
598    if (resize) {
599      window.removeEventListener('resize', instance.update, passive);
600    }
601  };
602} // eslint-disable-next-line import/no-unused-modules
603
604var eventListeners = {
605  name: 'eventListeners',
606  enabled: true,
607  phase: 'write',
608  fn: function fn() {},
609  effect: effect,
610  data: {}
611};
612
613var hash$1 = {
614  left: 'right',
615  right: 'left',
616  bottom: 'top',
617  top: 'bottom'
618};
619function getOppositePlacement(placement) {
620  return placement.replace(/left|right|bottom|top/g, function (matched) {
621    return hash$1[matched];
622  });
623}
624
625var hash = {
626  start: 'end',
627  end: 'start'
628};
629function getOppositeVariationPlacement(placement) {
630  return placement.replace(/start|end/g, function (matched) {
631    return hash[matched];
632  });
633}
634
635function getWindowScroll(node) {
636  var win = getWindow(node);
637  var scrollLeft = win.pageXOffset;
638  var scrollTop = win.pageYOffset;
639  return {
640    scrollLeft: scrollLeft,
641    scrollTop: scrollTop
642  };
643}
644
645function getWindowScrollBarX(element) {
646  // If <html> has a CSS width greater than the viewport, then this will be
647  // incorrect for RTL.
648  // Popper 1 is broken in this case and never had a bug report so let's assume
649  // it's not an issue. I don't think anyone ever specifies width on <html>
650  // anyway.
651  // Browsers where the left scrollbar doesn't cause an issue report `0` for
652  // this (e.g. Edge 2019, IE11, Safari)
653  return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
654}
655
656function getViewportRect(element, strategy) {
657  var win = getWindow(element);
658  var html = getDocumentElement(element);
659  var visualViewport = win.visualViewport;
660  var width = html.clientWidth;
661  var height = html.clientHeight;
662  var x = 0;
663  var y = 0;
664  if (visualViewport) {
665    width = visualViewport.width;
666    height = visualViewport.height;
667    var layoutViewport = isLayoutViewport();
668    if (layoutViewport || !layoutViewport && strategy === 'fixed') {
669      x = visualViewport.offsetLeft;
670      y = visualViewport.offsetTop;
671    }
672  }
673  return {
674    width: width,
675    height: height,
676    x: x + getWindowScrollBarX(element),
677    y: y
678  };
679}
680
681// of the `<html>` and `<body>` rect bounds if horizontally scrollable
682
683function getDocumentRect(element) {
684  var _element$ownerDocumen;
685  var html = getDocumentElement(element);
686  var winScroll = getWindowScroll(element);
687  var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
688  var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
689  var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
690  var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
691  var y = -winScroll.scrollTop;
692  if (getComputedStyle(body || html).direction === 'rtl') {
693    x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
694  }
695  return {
696    width: width,
697    height: height,
698    x: x,
699    y: y
700  };
701}
702
703function isScrollParent(element) {
704  // Firefox wants us to check `-x` and `-y` variations as well
705  var _getComputedStyle = getComputedStyle(element),
706    overflow = _getComputedStyle.overflow,
707    overflowX = _getComputedStyle.overflowX,
708    overflowY = _getComputedStyle.overflowY;
709  return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
710}
711
712function getScrollParent(node) {
713  if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
714    // $FlowFixMe[incompatible-return]: assume body is always available
715    return node.ownerDocument.body;
716  }
717  if (isHTMLElement(node) && isScrollParent(node)) {
718    return node;
719  }
720  return getScrollParent(getParentNode(node));
721}
722
723/*
724given a DOM element, return the list of all scroll parents, up the list of ancesors
725until we get to the top window object. This list is what we attach scroll listeners
726to, because if any of these parent elements scroll, we'll need to re-calculate the
727reference element's position.
728*/
729
730function listScrollParents(element, list) {
731  var _element$ownerDocumen;
732  if (list === void 0) {
733    list = [];
734  }
735  var scrollParent = getScrollParent(element);
736  var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
737  var win = getWindow(scrollParent);
738  var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
739  var updatedList = list.concat(target);
740  return isBody ? updatedList :
741  // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
742  updatedList.concat(listScrollParents(getParentNode(target)));
743}
744
745function rectToClientRect(rect) {
746  return Object.assign({}, rect, {
747    left: rect.x,
748    top: rect.y,
749    right: rect.x + rect.width,
750    bottom: rect.y + rect.height
751  });
752}
753
754function getInnerBoundingClientRect(element, strategy) {
755  var rect = getBoundingClientRect(element, false, strategy === 'fixed');
756  rect.top = rect.top + element.clientTop;
757  rect.left = rect.left + element.clientLeft;
758  rect.bottom = rect.top + element.clientHeight;
759  rect.right = rect.left + element.clientWidth;
760  rect.width = element.clientWidth;
761  rect.height = element.clientHeight;
762  rect.x = rect.left;
763  rect.y = rect.top;
764  return rect;
765}
766function getClientRectFromMixedType(element, clippingParent, strategy) {
767  return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
768} // A "clipping parent" is an overflowable container with the characteristic of
769// clipping (or hiding) overflowing elements with a position different from
770// `initial`
771
772function getClippingParents(element) {
773  var clippingParents = listScrollParents(getParentNode(element));
774  var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;
775  var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
776  if (!isElement(clipperElement)) {
777    return [];
778  } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
779
780  return clippingParents.filter(function (clippingParent) {
781    return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
782  });
783} // Gets the maximum area that the element is visible in due to any number of
784// clipping parents
785
786function getClippingRect(element, boundary, rootBoundary, strategy) {
787  var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
788  var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
789  var firstClippingParent = clippingParents[0];
790  var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
791    var rect = getClientRectFromMixedType(element, clippingParent, strategy);
792    accRect.top = max(rect.top, accRect.top);
793    accRect.right = min(rect.right, accRect.right);
794    accRect.bottom = min(rect.bottom, accRect.bottom);
795    accRect.left = max(rect.left, accRect.left);
796    return accRect;
797  }, getClientRectFromMixedType(element, firstClippingParent, strategy));
798  clippingRect.width = clippingRect.right - clippingRect.left;
799  clippingRect.height = clippingRect.bottom - clippingRect.top;
800  clippingRect.x = clippingRect.left;
801  clippingRect.y = clippingRect.top;
802  return clippingRect;
803}
804
805function computeOffsets(_ref) {
806  var reference = _ref.reference,
807    element = _ref.element,
808    placement = _ref.placement;
809  var basePlacement = placement ? getBasePlacement(placement) : null;
810  var variation = placement ? getVariation(placement) : null;
811  var commonX = reference.x + reference.width / 2 - element.width / 2;
812  var commonY = reference.y + reference.height / 2 - element.height / 2;
813  var offsets;
814  switch (basePlacement) {
815    case top:
816      offsets = {
817        x: commonX,
818        y: reference.y - element.height
819      };
820      break;
821    case bottom:
822      offsets = {
823        x: commonX,
824        y: reference.y + reference.height
825      };
826      break;
827    case right:
828      offsets = {
829        x: reference.x + reference.width,
830        y: commonY
831      };
832      break;
833    case left:
834      offsets = {
835        x: reference.x - element.width,
836        y: commonY
837      };
838      break;
839    default:
840      offsets = {
841        x: reference.x,
842        y: reference.y
843      };
844  }
845  var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
846  if (mainAxis != null) {
847    var len = mainAxis === 'y' ? 'height' : 'width';
848    switch (variation) {
849      case start:
850        offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
851        break;
852      case end:
853        offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
854        break;
855    }
856  }
857  return offsets;
858}
859
860function detectOverflow(state, options) {
861  if (options === void 0) {
862    options = {};
863  }
864  var _options = options,
865    _options$placement = _options.placement,
866    placement = _options$placement === void 0 ? state.placement : _options$placement,
867    _options$strategy = _options.strategy,
868    strategy = _options$strategy === void 0 ? state.strategy : _options$strategy,
869    _options$boundary = _options.boundary,
870    boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
871    _options$rootBoundary = _options.rootBoundary,
872    rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,
873    _options$elementConte = _options.elementContext,
874    elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,
875    _options$altBoundary = _options.altBoundary,
876    altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,
877    _options$padding = _options.padding,
878    padding = _options$padding === void 0 ? 0 : _options$padding;
879  var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
880  var altContext = elementContext === popper ? reference : popper;
881  var popperRect = state.rects.popper;
882  var element = state.elements[altBoundary ? altContext : elementContext];
883  var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
884  var referenceClientRect = getBoundingClientRect(state.elements.reference);
885  var popperOffsets = computeOffsets({
886    reference: referenceClientRect,
887    element: popperRect,
888    
888strategy: 'absolute'
vendor: 10,563 bytes, lines 888-1181
888,
889    placement: placement
890  });
891  var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
892  var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
893  // 0 or negative = within the clipping rect
894
895  var overflowOffsets = {
896    top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
897    bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
898    left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
899    right: elementClientRect.right - clippingClientRect.right + paddingObject.right
900  };
901  var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element
902
903  if (elementContext === popper && offsetData) {
904    var offset = offsetData[placement];
905    Object.keys(overflowOffsets).forEach(function (key) {
906      var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
907      var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';
908      overflowOffsets[key] += offset[axis] * multiply;
909    });
910  }
911  return overflowOffsets;
912}
913
914function computeAutoPlacement(state, options) {
915  if (options === void 0) {
916    options = {};
917  }
918  var _options = options,
919    placement = _options.placement,
920    boundary = _options.boundary,
921    rootBoundary = _options.rootBoundary,
922    padding = _options.padding,
923    flipVariations = _options.flipVariations,
924    _options$allowedAutoP = _options.allowedAutoPlacements,
925    allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
926  var variation = getVariation(placement);
927  var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {
928    return getVariation(placement) === variation;
929  }) : basePlacements;
930  var allowedPlacements = placements$1.filter(function (placement) {
931    return allowedAutoPlacements.indexOf(placement) >= 0;
932  });
933  if (allowedPlacements.length === 0) {
934    allowedPlacements = placements$1;
935  } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...
936
937  var overflows = allowedPlacements.reduce(function (acc, placement) {
938    acc[placement] = detectOverflow(state, {
939      placement: placement,
940      boundary: boundary,
941      rootBoundary: rootBoundary,
942      padding: padding
943    })[getBasePlacement(placement)];
944    return acc;
945  }, {});
946  return Object.keys(overflows).sort(function (a, b) {
947    return overflows[a] - overflows[b];
948  });
949}
950
951function getExpandedFallbackPlacements(placement) {
952  if (getBasePlacement(placement) === auto) {
953    return [];
954  }
955  var oppositePlacement = getOppositePlacement(placement);
956  return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
957}
958function flip(_ref) {
959  var state = _ref.state,
960    options = _ref.options,
961    name = _ref.name;
962  if (state.modifiersData[name]._skip) {
963    return;
964  }
965  var _options$mainAxis = options.mainAxis,
966    checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
967    _options$altAxis = options.altAxis,
968    checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,
969    specifiedFallbackPlacements = options.fallbackPlacements,
970    padding = options.padding,
971    boundary = options.boundary,
972    rootBoundary = options.rootBoundary,
973    altBoundary = options.altBoundary,
974    _options$flipVariatio = options.flipVariations,
975    flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,
976    allowedAutoPlacements = options.allowedAutoPlacements;
977  var preferredPlacement = state.options.placement;
978  var basePlacement = getBasePlacement(preferredPlacement);
979  var isBasePlacement = basePlacement === preferredPlacement;
980  var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
981  var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {
982    return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {
983      placement: placement,
984      boundary: boundary,
985      rootBoundary: rootBoundary,
986      padding: padding,
987      flipVariations: flipVariations,
988      allowedAutoPlacements: allowedAutoPlacements
989    }) : placement);
990  }, []);
991  var referenceRect = state.rects.reference;
992  var popperRect = state.rects.popper;
993  var checksMap = new Map();
994  var makeFallbackChecks = true;
995  var firstFittingPlacement = placements[0];
996  for (var i = 0; i < placements.length; i++) {
997    var placement = placements[i];
998    var _basePlacement = getBasePlacement(placement);
999    var isStartVariation = getVariation(placement) === start;
1000    var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
1001    var len = isVertical ? 'width' : 'height';
1002    var overflow = detectOverflow(state, {
1003      placement: placement,
1004      boundary: boundary,
1005      rootBoundary: rootBoundary,
1006      altBoundary: altBoundary,
1007      padding: padding
1008    });
1009    var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
1010    if (referenceRect[len] > popperRect[len]) {
1011      mainVariationSide = getOppositePlacement(mainVariationSide);
1012    }
1013    var altVariationSide = getOppositePlacement(mainVariationSide);
1014    var checks = [];
1015    if (checkMainAxis) {
1016      checks.push(overflow[_basePlacement] <= 0);
1017    }
1018    if (checkAltAxis) {
1019      checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
1020    }
1021    if (checks.every(function (check) {
1022      return check;
1023    })) {
1024      firstFittingPlacement = placement;
1025      makeFallbackChecks = false;
1026      break;
1027    }
1028    checksMap.set(placement, checks);
1029  }
1030  if (makeFallbackChecks) {
1031    // `2` may be desired in some cases – research later
1032    var numberOfChecks = flipVariations ? 3 : 1;
1033    var _loop = function _loop(_i) {
1034      var fittingPlacement = placements.find(function (placement) {
1035        var checks = checksMap.get(placement);
1036        if (checks) {
1037          return checks.slice(0, _i).every(function (check) {
1038            return check;
1039          });
1040        }
1041      });
1042      if (fittingPlacement) {
1043        firstFittingPlacement = fittingPlacement;
1044        return "break";
1045      }
1046    };
1047    for (var _i = numberOfChecks; _i > 0; _i--) {
1048      var _ret = _loop(_i);
1049      if (_ret === "break") break;
1050    }
1051  }
1052  if (state.placement !== firstFittingPlacement) {
1053    state.modifiersData[name]._skip = true;
1054    state.placement = firstFittingPlacement;
1055    state.reset = true;
1056  }
1057} // eslint-disable-next-line import/no-unused-modules
1058
1059var flip$1 = {
1060  name: 'flip',
1061  enabled: true,
1062  phase: 'main',
1063  fn: flip,
1064  requiresIfExists: ['offset'],
1065  data: {
1066    _skip: false
1067  }
1068};
1069
1070function getSideOffsets(overflow, rect, preventedOffsets) {
1071  if (preventedOffsets === void 0) {
1072    preventedOffsets = {
1073      x: 0,
1074      y: 0
1075    };
1076  }
1077  return {
1078    top: overflow.top - rect.height - preventedOffsets.y,
1079    right: overflow.right - rect.width + preventedOffsets.x,
1080    bottom: overflow.bottom - rect.height + preventedOffsets.y,
1081    left: overflow.left - rect.width - preventedOffsets.x
1082  };
1083}
1084function isAnySideFullyClipped(overflow) {
1085  return [top, right, bottom, left].some(function (side) {
1086    return overflow[side] >= 0;
1087  });
1088}
1089function hide(_ref) {
1090  var state = _ref.state,
1091    name = _ref.name;
1092  var referenceRect = state.rects.reference;
1093  var popperRect = state.rects.popper;
1094  var preventedOffsets = state.modifiersData.preventOverflow;
1095  var referenceOverflow = detectOverflow(state, {
1096    elementContext: 'reference'
1097  });
1098  var popperAltOverflow = detectOverflow(state, {
1099    altBoundary: true
1100  });
1101  var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
1102  var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
1103  var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
1104  var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
1105  state.modifiersData[name] = {
1106    referenceClippingOffsets: referenceClippingOffsets,
1107    popperEscapeOffsets: popperEscapeOffsets,
1108    isReferenceHidden: isReferenceHidden,
1109    hasPopperEscaped: hasPopperEscaped
1110  };
1111  state.attributes.popper = Object.assign({}, state.attributes.popper, {
1112    'data-popper-reference-hidden': isReferenceHidden,
1113    'data-popper-escaped': hasPopperEscaped
1114  });
1115} // eslint-disable-next-line import/no-unused-modules
1116
1117var hide$1 = {
1118  name: 'hide',
1119  enabled: true,
1120  phase: 'main',
1121  requiresIfExists: ['preventOverflow'],
1122  fn: hide
1123};
1124
1125function distanceAndSkiddingToXY(placement, rects, offset) {
1126  var basePlacement = getBasePlacement(placement);
1127  var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
1128  var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {
1129      placement: placement
1130    })) : offset,
1131    skidding = _ref[0],
1132    distance = _ref[1];
1133  skidding = skidding || 0;
1134  distance = (distance || 0) * invertDistance;
1135  return [left, right].indexOf(basePlacement) >= 0 ? {
1136    x: distance,
1137    y: skidding
1138  } : {
1139    x: skidding,
1140    y: distance
1141  };
1142}
1143function offset(_ref2) {
1144  var state = _ref2.state,
1145    options = _ref2.options,
1146    name = _ref2.name;
1147  var _options$offset = options.offset,
1148    offset = _options$offset === void 0 ? [0, 0] : _options$offset;
1149  var data = placements.reduce(function (acc, placement) {
1150    acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);
1151    return acc;
1152  }, {});
1153  var _data$state$placement = data[state.placement],
1154    x = _data$state$placement.x,
1155    y = _data$state$placement.y;
1156  if (state.modifiersData.popperOffsets != null) {
1157    state.modifiersData.popperOffsets.x += x;
1158    state.modifiersData.popperOffsets.y += y;
1159  }
1160  state.modifiersData[name] = data;
1161} // eslint-disable-next-line import/no-unused-modules
1162
1163var offset$1 = {
1164  name: 'offset',
1165  enabled: true,
1166  phase: 'main',
1167  requires: ['popperOffsets'],
1168  fn: offset
1169};
1170
1171function popperOffsets(_ref) {
1172  var state = _ref.state,
1173    name = _ref.name;
1174  // Offsets are the actual position the popper needs to have to be
1175  // properly positioned near its reference element
1176  // This is the most basic placement, and will be adjusted by
1177  // the modifiers in the next step
1178  state.modifiersData[name] = computeOffsets({
1179    reference: state.rects.reference,
1180    element: state.rects.popper,
1181    
1181strategy: 'absolute'
vendor: 16,676 bytes, lines 1181-1611
1181,
1182    placement: state.placement
1183  });
1184} // eslint-disable-next-line import/no-unused-modules
1185
1186var popperOffsets$1 = {
1187  name: 'popperOffsets',
1188  enabled: true,
1189  phase: 'read',
1190  fn: popperOffsets,
1191  data: {}
1192};
1193
1194function getAltAxis(axis) {
1195  return axis === 'x' ? 'y' : 'x';
1196}
1197
1198function preventOverflow(_ref) {
1199  var state = _ref.state,
1200    options = _ref.options,
1201    name = _ref.name;
1202  var _options$mainAxis = options.mainAxis,
1203    checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
1204    _options$altAxis = options.altAxis,
1205    checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,
1206    boundary = options.boundary,
1207    rootBoundary = options.rootBoundary,
1208    altBoundary = options.altBoundary,
1209    padding = options.padding,
1210    _options$tether = options.tether,
1211    tether = _options$tether === void 0 ? true : _options$tether,
1212    _options$tetherOffset = options.tetherOffset,
1213    tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
1214  var overflow = detectOverflow(state, {
1215    boundary: boundary,
1216    rootBoundary: rootBoundary,
1217    padding: padding,
1218    altBoundary: altBoundary
1219  });
1220  var basePlacement = getBasePlacement(state.placement);
1221  var variation = getVariation(state.placement);
1222  var isBasePlacement = !variation;
1223  var mainAxis = getMainAxisFromPlacement(basePlacement);
1224  var altAxis = getAltAxis(mainAxis);
1225  var popperOffsets = state.modifiersData.popperOffsets;
1226  var referenceRect = state.rects.reference;
1227  var popperRect = state.rects.popper;
1228  var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
1229    placement: state.placement
1230  })) : tetherOffset;
1231  var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {
1232    mainAxis: tetherOffsetValue,
1233    altAxis: tetherOffsetValue
1234  } : Object.assign({
1235    mainAxis: 0,
1236    altAxis: 0
1237  }, tetherOffsetValue);
1238  var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
1239  var data = {
1240    x: 0,
1241    y: 0
1242  };
1243  if (!popperOffsets) {
1244    return;
1245  }
1246  if (checkMainAxis) {
1247    var _offsetModifierState$;
1248    var mainSide = mainAxis === 'y' ? top : left;
1249    var altSide = mainAxis === 'y' ? bottom : right;
1250    var len = mainAxis === 'y' ? 'height' : 'width';
1251    var offset = popperOffsets[mainAxis];
1252    var min$1 = offset + overflow[mainSide];
1253    var max$1 = offset - overflow[altSide];
1254    var additive = tether ? -popperRect[len] / 2 : 0;
1255    var minLen = variation === start ? referenceRect[len] : popperRect[len];
1256    var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
1257    // outside the reference bounds
1258
1259    var arrowElement = state.elements.arrow;
1260    var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
1261      width: 0,
1262      height: 0
1263    };
1264    var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();
1265    var arrowPaddingMin = arrowPaddingObject[mainSide];
1266    var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want
1267    // to include its full size in the calculation. If the reference is small
1268    // and near the edge of a boundary, the popper can overflow even if the
1269    // reference is not overflowing as well (e.g. virtual elements with no
1270    // width or height)
1271
1272    var arrowLen = within(0, referenceRect[len], arrowRect[len]);
1273    var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
1274    var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
1275    var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
1276    var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
1277    var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
1278    var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;
1279    var tetherMax = offset + maxOffset - offsetModifierValue;
1280    var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
1281    popperOffsets[mainAxis] = preventedOffset;
1282    data[mainAxis] = preventedOffset - offset;
1283  }
1284  if (checkAltAxis) {
1285    var _offsetModifierState$2;
1286    var _mainSide = mainAxis === 'x' ? top : left;
1287    var _altSide = mainAxis === 'x' ? bottom : right;
1288    var _offset = popperOffsets[altAxis];
1289    var _len = altAxis === 'y' ? 'height' : 'width';
1290    var _min = _offset + overflow[_mainSide];
1291    var _max = _offset - overflow[_altSide];
1292    var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
1293    var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
1294    var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
1295    var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
1296    var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
1297    popperOffsets[altAxis] = _preventedOffset;
1298    data[altAxis] = _preventedOffset - _offset;
1299  }
1300  state.modifiersData[name] = data;
1301} // eslint-disable-next-line import/no-unused-modules
1302
1303var preventOverflow$1 = {
1304  name: 'preventOverflow',
1305  enabled: true,
1306  phase: 'main',
1307  fn: preventOverflow,
1308  requiresIfExists: ['offset']
1309};
1310
1311function getHTMLElementScroll(element) {
1312  return {
1313    scrollLeft: element.scrollLeft,
1314    scrollTop: element.scrollTop
1315  };
1316}
1317
1318function getNodeScroll(node) {
1319  if (node === getWindow(node) || !isHTMLElement(node)) {
1320    return getWindowScroll(node);
1321  } else {
1322    return getHTMLElementScroll(node);
1323  }
1324}
1325
1326function isElementScaled(element) {
1327  var rect = element.getBoundingClientRect();
1328  var scaleX = round(rect.width) / element.offsetWidth || 1;
1329  var scaleY = round(rect.height) / element.offsetHeight || 1;
1330  return scaleX !== 1 || scaleY !== 1;
1331} // Returns the composite rect of an element relative to its offsetParent.
1332// Composite means it takes into account transforms as well as layout.
1333
1334function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
1335  if (isFixed === void 0) {
1336    isFixed = false;
1337  }
1338  var isOffsetParentAnElement = isHTMLElement(offsetParent);
1339  var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
1340  var documentElement = getDocumentElement(offsetParent);
1341  var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
1342  var scroll = {
1343    scrollLeft: 0,
1344    scrollTop: 0
1345  };
1346  var offsets = {
1347    x: 0,
1348    y: 0
1349  };
1350  if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1351    if (getNodeName(offsetParent) !== 'body' ||
1352    // https://github.com/popperjs/popper-core/issues/1078
1353    isScrollParent(documentElement)) {
1354      scroll = getNodeScroll(offsetParent);
1355    }
1356    if (isHTMLElement(offsetParent)) {
1357      offsets = getBoundingClientRect(offsetParent, true);
1358      offsets.x += offsetParent.clientLeft;
1359      offsets.y += offsetParent.clientTop;
1360    } else if (documentElement) {
1361      offsets.x = getWindowScrollBarX(documentElement);
1362    }
1363  }
1364  return {
1365    x: rect.left + scroll.scrollLeft - offsets.x,
1366    y: rect.top + scroll.scrollTop - offsets.y,
1367    width: rect.width,
1368    height: rect.height
1369  };
1370}
1371
1372function order(modifiers) {
1373  var map = new Map();
1374  var visited = new Set();
1375  var result = [];
1376  modifiers.forEach(function (modifier) {
1377    map.set(modifier.name, modifier);
1378  }); // On visiting object, check for its dependencies and visit them recursively
1379
1380  function sort(modifier) {
1381    visited.add(modifier.name);
1382    var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
1383    requires.forEach(function (dep) {
1384      if (!visited.has(dep)) {
1385        var depModifier = map.get(dep);
1386        if (depModifier) {
1387          sort(depModifier);
1388        }
1389      }
1390    });
1391    result.push(modifier);
1392  }
1393  modifiers.forEach(function (modifier) {
1394    if (!visited.has(modifier.name)) {
1395      // check for visited object
1396      sort(modifier);
1397    }
1398  });
1399  return result;
1400}
1401function orderModifiers(modifiers) {
1402  // order based on dependencies
1403  var orderedModifiers = order(modifiers); // order based on phase
1404
1405  return modifierPhases.reduce(function (acc, phase) {
1406    return acc.concat(orderedModifiers.filter(function (modifier) {
1407      return modifier.phase === phase;
1408    }));
1409  }, []);
1410}
1411
1412function debounce(fn) {
1413  var pending;
1414  return function () {
1415    if (!pending) {
1416      pending = new Promise(function (resolve) {
1417        Promise.resolve().then(function () {
1418          pending = undefined;
1419          resolve(fn());
1420        });
1421      });
1422    }
1423    return pending;
1424  };
1425}
1426
1427function mergeByName(modifiers) {
1428  var merged = modifiers.reduce(function (merged, current) {
1429    var existing = merged[current.name];
1430    merged[current.name] = existing ? Object.assign({}, existing, current, {
1431      options: Object.assign({}, existing.options, current.options),
1432      data: Object.assign({}, existing.data, current.data)
1433    }) : current;
1434    return merged;
1435  }, {}); // IE11 does not support Object.values
1436
1437  return Object.keys(merged).map(function (key) {
1438    return merged[key];
1439  });
1440}
1441
1442var DEFAULT_OPTIONS = {
1443  placement: 'bottom',
1444  modifiers: [],
1445  strategy: 'absolute'
1446};
1447function areValidElements() {
1448  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1449    args[_key] = arguments[_key];
1450  }
1451  return !args.some(function (element) {
1452    return !(element && typeof element.getBoundingClientRect === 'function');
1453  });
1454}
1455function popperGenerator(generatorOptions) {
1456  if (generatorOptions === void 0) {
1457    generatorOptions = {};
1458  }
1459  var _generatorOptions = generatorOptions,
1460    _generatorOptions$def = _generatorOptions.defaultModifiers,
1461    defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,
1462    _generatorOptions$def2 = _generatorOptions.defaultOptions,
1463    defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
1464  return function createPopper(reference, popper, options) {
1465    if (options === void 0) {
1466      options = defaultOptions;
1467    }
1468    var state = {
1469      placement: 'bottom',
1470      orderedModifiers: [],
1471      options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
1472      modifiersData: {},
1473      elements: {
1474        reference: reference,
1475        popper: popper
1476      },
1477      attributes: {},
1478      styles: {}
1479    };
1480    var effectCleanupFns = [];
1481    var isDestroyed = false;
1482    var instance = {
1483      state: state,
1484      setOptions: function setOptions(setOptionsAction) {
1485        var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
1486        cleanupModifierEffects();
1487        state.options = Object.assign({}, defaultOptions, state.options, options);
1488        state.scrollParents = {
1489          reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
1490          popper: listScrollParents(popper)
1491        }; // Orders the modifiers based on their dependencies and `phase`
1492        // properties
1493
1494        var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers
1495
1496        state.orderedModifiers = orderedModifiers.filter(function (m) {
1497          return m.enabled;
1498        });
1499        runModifierEffects();
1500        return instance.update();
1501      },
1502      // Sync update – it will always be executed, even if not necessary. This
1503      // is useful for low frequency updates where sync behavior simplifies the
1504      // logic.
1505      // For high frequency updates (e.g. `resize` and `scroll` events), always
1506      // prefer the async Popper#update method
1507      forceUpdate: function forceUpdate() {
1508        if (isDestroyed) {
1509          return;
1510        }
1511        var _state$elements = state.elements,
1512          reference = _state$elements.reference,
1513          popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements
1514        // anymore
1515
1516        if (!areValidElements(reference, popper)) {
1517          return;
1518        } // Store the reference and popper rects to be read by modifiers
1519
1520        state.rects = {
1521          reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
1522          popper: getLayoutRect(popper)
1523        }; // Modifiers have the ability to reset the current update cycle. The
1524        // most common use case for this is the `flip` modifier changing the
1525        // placement, which then needs to re-run all the modifiers, because the
1526        // logic was previously ran for the previous placement and is therefore
1527        // stale/incorrect
1528
1529        state.reset = false;
1530        state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier
1531        // is filled with the initial data specified by the modifier. This means
1532        // it doesn't persist and is fresh on each update.
1533        // To ensure persistent data, use `${name}#persistent`
1534
1535        state.orderedModifiers.forEach(function (modifier) {
1536          return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
1537        });
1538        for (var index = 0; index < state.orderedModifiers.length; index++) {
1539          if (state.reset === true) {
1540            state.reset = false;
1541            index = -1;
1542            continue;
1543          }
1544          var _state$orderedModifie = state.orderedModifiers[index],
1545            fn = _state$orderedModifie.fn,
1546            _state$orderedModifie2 = _state$orderedModifie.options,
1547            _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
1548            name = _state$orderedModifie.name;
1549          if (typeof fn === 'function') {
1550            state = fn({
1551              state: state,
1552              options: _options,
1553              name: name,
1554              instance: instance
1555            }) || state;
1556          }
1557        }
1558      },
1559      // Async and optimistically optimized update – it will not be executed if
1560      // not necessary (debounced to run at most once-per-tick)
1561      update: debounce(function () {
1562        return new Promise(function (resolve) {
1563          instance.forceUpdate();
1564          resolve(state);
1565        });
1566      }),
1567      destroy: function destroy() {
1568        cleanupModifierEffects();
1569        isDestroyed = true;
1570      }
1571    };
1572    if (!areValidElements(reference, popper)) {
1573      return instance;
1574    }
1575    instance.setOptions(options).then(function (state) {
1576      if (!isDestroyed && options.onFirstUpdate) {
1577        options.onFirstUpdate(state);
1578      }
1579    }); // Modifiers have the ability to execute arbitrary code before the first
1580    // update cycle runs. They will be executed in the same order as the update
1581    // cycle. This is useful when a modifier adds some persistent data that
1582    // other modifiers need to use, but the modifier is run after the dependent
1583    // one.
1584
1585    function runModifierEffects() {
1586      state.orderedModifiers.forEach(function (_ref) {
1587        var name = _ref.name,
1588          _ref$options = _ref.options,
1589          options = _ref$options === void 0 ? {} : _ref$options,
1590          effect = _ref.effect;
1591        if (typeof effect === 'function') {
1592          var cleanupFn = effect({
1593            state: state,
1594            name: name,
1595            instance: instance,
1596            options: options
1597          });
1598          var noopFn = function noopFn() {};
1599          effectCleanupFns.push(cleanupFn || noopFn);
1600        }
1601      });
1602    }
1603    function cleanupModifierEffects() {
1604      effectCleanupFns.forEach(function (fn) {
1605        return fn();
1606      });
1607      effectCleanupFns = [];
1608    }
1609    return instance;
1610  };
1611}
1612var createPopper$2 = /*#__PURE__*/popperGenerator(); // eslint-disable-next-line import/no-unused-modules
1613
1614var defaultModifiers$1 = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1];
1615var createPopper$1 = /*#__PURE__*/popperGenerator({
1616  defaultModifiers: defaultModifiers$1
1617}); // eslint-disable-next-line import/no-unused-modules
1618
1619var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
1620var createPopper = /*#__PURE__*/popperGenerator({
1621  defaultModifiers: defaultModifiers
1622}); // eslint-disable-next-line import/no-unused-modules
1623
1624var Popper = /*#__PURE__*/Object.freeze({
1625  __proto__: null,
1626  popperGenerator: popperGenerator,
1627  detectOverflow: detectOverflow,
1628  createPopperBase: createPopper$2,
1629  createPopper: createPopper,
1630  createPopperLite: createPopper$1,
1631  top: top,
1632  bottom: bottom,
1633  right: right,
1634  left: left,
1635  auto: auto,
1636  basePlacements: basePlacements,
1637  start: start,
1638  end: end,
1639  clippingParents: clippingParents,
1640  viewport: viewport,
1641  popper: popper,
1642  reference: reference,
1643  variationPlacements: variationPlacements,
1644  placements: placements,
1645  beforeRead: beforeRead,
1646  read: read,
1647  afterRead: afterRead,
1648  beforeMain: beforeMain,
1649  main: main,
1650  afterMain: afterMain,
1651  beforeWrite: beforeWrite,
1652  write: write,
1653  afterWrite: afterWrite,
1654  modifierPhases: modifierPhases,
1655  applyStyles: applyStyles$1,
1656  arrow: arrow$1,
1657  computeStyles: computeStyles$1,
1658  eventListeners: eventListeners,
1659  flip: flip$1,
1660  hide: hide$1,
1661  offset: offset$1,
1662  popperOffsets: popperOffsets$1,
1663  preventOverflow: preventOverflow$1
1664});
1665
1666export { Popper as P, createPopper as c };

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.