From f73f2356820468344757dbb9d7f3ec73ece7bf66 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 13 Feb 2023 20:43:51 +0100 Subject: Updating. Signed-off-by: Daniel Baumann --- web/_static/popperjs/popper.js | 2062 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 2062 insertions(+) create mode 100644 web/_static/popperjs/popper.js (limited to 'web/_static/popperjs/popper.js') diff --git a/web/_static/popperjs/popper.js b/web/_static/popperjs/popper.js new file mode 100644 index 0000000..b9ca1e8 --- /dev/null +++ b/web/_static/popperjs/popper.js @@ -0,0 +1,2062 @@ +UNPKG - @popperjs/core

UNPKG

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

Build: a7ebffa

© 2022 UNPKG

\ No newline at end of file -- cgit v1.2.3