PageSourceSearch

https://aaranyak.org/wp-content/plugins/topper-pack/assets/vendor/tippy/tippy.js?ver=3.12.5

js aaranyak.org collected 2026-10-02 08:37:31 UTC 93,132 bytes, 2,517 lines download raw bytes

vendor: 4,325 bytes, lines 1-86
1/**!
2* tippy.js v6.3.7
3* (c) 2017-2021 atomiks
4* MIT License
5*/
6(function (global, factory) {
7    typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@popperjs/core')) :
8        typeof define === 'function' && define.amd ? define(['@popperjs/core'], factory) :
9            (global = global || self, global.tippy = factory(global.Popper));
10}(this, (function (core) {
11    'use strict';
12
13    var css = ".tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{position:relative;background-color:#333;color:#fff;border-radius:4px;font-size:14px;line-height:1.4;white-space:normal;outline:0;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{bottom:-7px;left:0;border-width:8px 8px 0;border-top-color:initial;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{top:-7px;left:0;border-width:0 8px 8px;border-bottom-color:initial;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-width:8px 0 8px 8px;border-left-color:initial;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{left:-7px;border-width:8px 8px 8px 0;border-right-color:initial;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{width:16px;height:16px;color:#333}.tippy-arrow:before{content:\"\";position:absolute;border-color:transparent;border-style:solid}.tippy-content{position:relative;padding:5px 9px;z-index:1}";
14
15    function injectCSS(css) {
16        var style = document.createElement('style');
17        style.textContent = css;
18        style.setAttribute('data-tippy-stylesheet', '');
19        var head = document.head;
20        var firstStyleOrLinkTag = document.querySelector('head>style,head>link');
21
22        if (firstStyleOrLinkTag) {
23            head.insertBefore(style, firstStyleOrLinkTag);
24        } else {
25            head.appendChild(style);
26        }
27    }
28
29    var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
30    var isIE11 = isBrowser ? // @ts-ignore
31        !!window.msCrypto : false;
32
33    var ROUND_ARROW = '<svg width="16" height="6" xmlns="http://www.w3.org/2000/svg"><path d="M0 6s1.796-.013 4.67-3.615C5.851.9 6.93.006 8 0c1.07-.006 2.148.887 3.343 2.385C14.233 6.005 16 6 16 6H0z"></svg>';
34    var BOX_CLASS = "tippy-box";
35    var CONTENT_CLASS = "tippy-content";
36    var BACKDROP_CLASS = "tippy-backdrop";
37    var ARROW_CLASS = "tippy-arrow";
38    var SVG_ARROW_CLASS = "tippy-svg-arrow";
39    var TOUCH_OPTIONS = {
40        passive: true,
41        capture: true
42    };
43    var TIPPY_DEFAULT_APPEND_TO = function TIPPY_DEFAULT_APPEND_TO() {
44        return document.body;
45    };
46
47    function hasOwnProperty(obj, key) {
48        return {}.hasOwnProperty.call(obj, key);
49    }
50    function getValueAtIndexOrReturn(value, index, defaultValue) {
51        if (Array.isArray(value)) {
52            var v = value[index];
53            return v == null ? Array.isArray(defaultValue) ? defaultValue[index] : defaultValue : v;
54        }
55
56        return value;
57    }
58    function isType(value, type) {
59        var str = {}.toString.call(value);
60        return str.indexOf('[object') === 0 && str.indexOf(type + "]") > -1;
61    }
62    function invokeWithArgsOrReturn(value, args) {
63        return typeof value === 'function' ? value.apply(void 0, args) : value;
64    }
65    function debounce(fn, ms) {
66        // Avoid wrapping in `setTimeout` if ms is 0 anyway
67        if (ms === 0) {
68            return fn;
69        }
70
71        var timeout;
72        return function (arg) {
73            clearTimeout(timeout);
74            timeout = setTimeout(function () {
75                fn(arg);
76            }, ms);
77        };
78    }
79    function removeProperties(obj, keys) {
80        var clone = Object.assign({}, obj);
81        keys.forEach(function (key) {
82            delete clone[key];
83        });
84        return clone;
85    }
86    function splitBySpaces(value) {
vendor: 4,785 bytes, lines 87-225
87        return value.split(/\s+/).filter(Boolean);
88    }
89    function normalizeToArray(value) {
90        return [].concat(value);
91    }
92    function pushIfUnique(arr, value) {
93        if (arr.indexOf(value) === -1) {
94            arr.push(value);
95        }
96    }
97    function unique(arr) {
98        return arr.filter(function (item, index) {
99            return arr.indexOf(item) === index;
100        });
101    }
102    function getBasePlacement(placement) {
103        return placement.split('-')[0];
104    }
105    function arrayFrom(value) {
106        return [].slice.call(value);
107    }
108    function removeUndefinedProps(obj) {
109        return Object.keys(obj).reduce(function (acc, key) {
110            if (obj[key] !== undefined) {
111                acc[key] = obj[key];
112            }
113
114            return acc;
115        }, {});
116    }
117
118    function div() {
119        return document.createElement('div');
120    }
121    function isElement(value) {
122        return ['Element', 'Fragment'].some(function (type) {
123            return isType(value, type);
124        });
125    }
126    function isNodeList(value) {
127        return isType(value, 'NodeList');
128    }
129    function isMouseEvent(value) {
130        return isType(value, 'MouseEvent');
131    }
132    function isReferenceElement(value) {
133        return !!(value && value._tippy && value._tippy.reference === value);
134    }
135    function getArrayOfElements(value) {
136        if (isElement(value)) {
137            return [value];
138        }
139
140        if (isNodeList(value)) {
141            return arrayFrom(value);
142        }
143
144        if (Array.isArray(value)) {
145            return value;
146        }
147
148        return arrayFrom(document.querySelectorAll(value));
149    }
150    function setTransitionDuration(els, value) {
151        els.forEach(function (el) {
152            if (el) {
153                el.style.transitionDuration = value + "ms";
154            }
155        });
156    }
157    function setVisibilityState(els, state) {
158        els.forEach(function (el) {
159            if (el) {
160                el.setAttribute('data-state', state);
161            }
162        });
163    }
164    function getOwnerDocument(elementOrElements) {
165        var _element$ownerDocumen;
166
167        var _normalizeToArray = normalizeToArray(elementOrElements),
168            element = _normalizeToArray[0]; // Elements created via a <template> have an ownerDocument with no reference to the body
169
170
171        return element != null && (_element$ownerDocumen = element.ownerDocument) != null && _element$ownerDocumen.body ? element.ownerDocument : document;
172    }
173    function isCursorOutsideInteractiveBorder(popperTreeData, event) {
174        var clientX = event.clientX,
175            clientY = event.clientY;
176        return popperTreeData.every(function (_ref) {
177            var popperRect = _ref.popperRect,
178                popperState = _ref.popperState,
179                props = _ref.props;
180            var interactiveBorder = props.interactiveBorder;
181            var basePlacement = getBasePlacement(popperState.placement);
182            var offsetData = popperState.modifiersData.offset;
183
184            if (!offsetData) {
185                return true;
186            }
187
188            var topDistance = basePlacement === 'bottom' ? offsetData.top.y : 0;
189            var bottomDistance = basePlacement === 'top' ? offsetData.bottom.y : 0;
190            var leftDistance = basePlacement === 'right' ? offsetData.left.x : 0;
191            var rightDistance = basePlacement === 'left' ? offsetData.right.x : 0;
192            var exceedsTop = popperRect.top - clientY + topDistance > interactiveBorder;
193            var exceedsBottom = clientY - popperRect.bottom - bottomDistance > interactiveBorder;
194            var exceedsLeft = popperRect.left - clientX + leftDistance > interactiveBorder;
195            var exceedsRight = clientX - popperRect.right - rightDistance > interactiveBorder;
196            return exceedsTop || exceedsBottom || exceedsLeft || exceedsRight;
197        });
198    }
199    function updateTransitionEndListener(box, action, listener) {
200        var method = action + "EventListener"; // some browsers apparently support `transition` (unprefixed) but only fire
201        // `webkitTransitionEnd`...
202
203        ['transitionend', 'webkitTransitionEnd'].forEach(function (event) {
204            box[method](event, listener);
205        });
206    }
207    /**
208     * Compared to xxx.contains, this function works for dom structures with shadow
209     * dom
210     */
211
212    function actualContains(parent, child) {
213        var target = child;
214
215        while (target) {
216            var _target$getRootNode;
217
218            if (parent.contains(target)) {
219                return true;
220            }
221
222            target = target.getRootNode == null ? void 0 : (_target$getRootNode = target.getRootNode()) == null ? void 0 : _target$getRootNode.host;
223        }
224
225        return false;
vendor: 19,507 bytes, lines 226-767
226    }
227
228    var currentInput = {
229        isTouch: false
230    };
231    var lastMouseMoveTime = 0;
232    /**
233     * When a `touchstart` event is fired, it's assumed the user is using touch
234     * input. We'll bind a `mousemove` event listener to listen for mouse input in
235     * the future. This way, the `isTouch` property is fully dynamic and will handle
236     * hybrid devices that use a mix of touch + mouse input.
237     */
238
239    function onDocumentTouchStart() {
240        if (currentInput.isTouch) {
241            return;
242        }
243
244        currentInput.isTouch = true;
245
246        if (window.performance) {
247            document.addEventListener('mousemove', onDocumentMouseMove);
248        }
249    }
250    /**
251     * When two `mousemove` event are fired consecutively within 20ms, it's assumed
252     * the user is using mouse input again. `mousemove` can fire on touch devices as
253     * well, but very rarely that quickly.
254     */
255
256    function onDocumentMouseMove() {
257        var now = performance.now();
258
259        if (now - lastMouseMoveTime < 20) {
260            currentInput.isTouch = false;
261            document.removeEventListener('mousemove', onDocumentMouseMove);
262        }
263
264        lastMouseMoveTime = now;
265    }
266    /**
267     * When an element is in focus and has a tippy, leaving the tab/window and
268     * returning causes it to show again. For mouse users this is unexpected, but
269     * for keyboard use it makes sense.
270     * TODO: find a better technique to solve this problem
271     */
272
273    function onWindowBlur() {
274        var activeElement = document.activeElement;
275
276        if (isReferenceElement(activeElement)) {
277            var instance = activeElement._tippy;
278
279            if (activeElement.blur && !instance.state.isVisible) {
280                activeElement.blur();
281            }
282        }
283    }
284    function bindGlobalEventListeners() {
285        document.addEventListener('touchstart', onDocumentTouchStart, TOUCH_OPTIONS);
286        window.addEventListener('blur', onWindowBlur);
287    }
288
289    function createMemoryLeakWarning(method) {
290        var txt = method === 'destroy' ? 'n already-' : ' ';
291        return [method + "() was called on a" + txt + "destroyed instance. This is a no-op but", 'indicates a potential memory leak.'].join(' ');
292    }
293    function clean(value) {
294        var spacesAndTabs = /[ \t]{2,}/g;
295        var lineStartWithSpaces = /^[ \t]*/gm;
296        return value.replace(spacesAndTabs, ' ').replace(lineStartWithSpaces, '').trim();
297    }
298
299    function getDevMessage(message) {
300        return clean("\n  %ctippy.js\n\n  %c" + clean(message) + "\n\n  %c\uD83D\uDC77\u200D This is a development-only message. It will be removed in production.\n  ");
301    }
302
303    function getFormattedMessage(message) {
304        return [getDevMessage(message), // title
305            'color: #00C584; font-size: 1.3em; font-weight: bold;', // message
306            'line-height: 1.5', // footer
307            'color: #a6a095;'];
308    } // Assume warnings and errors never have the same message
309
310    var visitedMessages;
311
312    {
313        resetVisitedMessages();
314    }
315
316    function resetVisitedMessages() {
317        visitedMessages = new Set();
318    }
319    function warnWhen(condition, message) {
320        if (condition && !visitedMessages.has(message)) {
321            var _console;
322
323            visitedMessages.add(message);
324
325            (_console = console).warn.apply(_console, getFormattedMessage(message));
326        }
327    }
328    function errorWhen(condition, message) {
329        if (condition && !visitedMessages.has(message)) {
330            var _console2;
331
332            visitedMessages.add(message);
333
334            (_console2 = console).error.apply(_console2, getFormattedMessage(message));
335        }
336    }
337    function validateTargets(targets) {
338        var didPassFalsyValue = !targets;
339        var didPassPlainObject = Object.prototype.toString.call(targets) === '[object Object]' && !targets.addEventListener;
340        errorWhen(didPassFalsyValue, ['tippy() was passed', '`' + String(targets) + '`', 'as its targets (first) argument. Valid types are: String, Element,', 'Element[], or NodeList.'].join(' '));
341        errorWhen(didPassPlainObject, ['tippy() was passed a plain object which is not supported as an argument', 'for virtual positioning. Use props.getReferenceClientRect instead.'].join(' '));
342    }
343
344    var pluginProps = {
345        animateFill: false,
346        followCursor: false,
347        inlinePositioning: false,
348        sticky: false
349    };
350    var renderProps = {
351        allowHTML: false,
352        animation: 'fade',
353        arrow: true,
354        content: '',
355        inertia: false,
356        maxWidth: 350,
357        role: 'tooltip',
358        theme: '',
359        zIndex: 9999
360    };
361    var defaultProps = Object.assign({
362        appendTo: TIPPY_DEFAULT_APPEND_TO,
363        aria: {
364            content: 'auto',
365            expanded: 'auto'
366        },
367        delay: 0,
368        duration: [300, 250],
369        getReferenceClientRect: null,
370        hideOnClick: true,
371        ignoreAttributes: false,
372        interactive: false,
373        interactiveBorder: 2,
374        interactiveDebounce: 0,
375        moveTransition: '',
376        offset: [0, 10],
377        onAfterUpdate: function onAfterUpdate() { },
378        onBeforeUpdate: function onBeforeUpdate() { },
379        onCreate: function onCreate() { },
380        onDestroy: function onDestroy() { },
381        onHidden: function onHidden() { },
382        onHide: function onHide() { },
383        onMount: function onMount() { },
384        onShow: function onShow() { },
385        onShown: function onShown() { },
386        onTrigger: function onTrigger() { },
387        onUntrigger: function onUntrigger() { },
388        onClickOutside: function onClickOutside() { },
389        placement: 'top',
390        plugins: [],
391        popperOptions: {},
392        render: null,
393        showOnCreate: false,
394        touch: true,
395        trigger: 'mouseenter focus',
396        triggerTarget: null
397    }, pluginProps, renderProps);
398    var defaultKeys = Object.keys(defaultProps);
399    var setDefaultProps = function setDefaultProps(partialProps) {
400        /* istanbul ignore else */
401        {
402            validateProps(partialProps, []);
403        }
404
405        var keys = Object.keys(partialProps);
406        keys.forEach(function (key) {
407            defaultProps[key] = partialProps[key];
408        });
409    };
410    function getExtendedPassedProps(passedProps) {
411        var plugins = passedProps.plugins || [];
412        var pluginProps = plugins.reduce(function (acc, plugin) {
413            var name = plugin.name,
414                defaultValue = plugin.defaultValue;
415
416            if (name) {
417                var _name;
418
419                acc[name] = passedProps[name] !== undefined ? passedProps[name] : (_name = defaultProps[name]) != null ? _name : defaultValue;
420            }
421
422            return acc;
423        }, {});
424        return Object.assign({}, passedProps, pluginProps);
425    }
426    function getDataAttributeProps(reference, plugins) {
427        var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps, {
428            plugins: plugins
429        }))) : defaultKeys;
430        var props = propKeys.reduce(function (acc, key) {
431            var valueAsString = (reference.getAttribute("data-tippy-" + key) || '').trim();
432
433            if (!valueAsString) {
434                return acc;
435            }
436
437            if (key === 'content') {
438                acc[key] = valueAsString;
439            } else {
440                try {
441                    acc[key] = JSON.parse(valueAsString);
442                } catch (e) {
443                    acc[key] = valueAsString;
444                }
445            }
446
447            return acc;
448        }, {});
449        return props;
450    }
451    function evaluateProps(reference, props) {
452        var out = Object.assign({}, props, {
453            content: invokeWithArgsOrReturn(props.content, [reference])
454        }, props.ignoreAttributes ? {} : getDataAttributeProps(reference, props.plugins));
455        out.aria = Object.assign({}, defaultProps.aria, out.aria);
456        out.aria = {
457            expanded: out.aria.expanded === 'auto' ? props.interactive : out.aria.expanded,
458            content: out.aria.content === 'auto' ? props.interactive ? null : 'describedby' : out.aria.content
459        };
460        return out;
461    }
462    function validateProps(partialProps, plugins) {
463        if (partialProps === void 0) {
464            partialProps = {};
465        }
466
467        if (plugins === void 0) {
468            plugins = [];
469        }
470
471        var keys = Object.keys(partialProps);
472        keys.forEach(function (prop) {
473            var nonPluginProps = removeProperties(defaultProps, Object.keys(pluginProps));
474            var didPassUnknownProp = !hasOwnProperty(nonPluginProps, prop); // Check if the prop exists in `plugins`
475
476            if (didPassUnknownProp) {
477                didPassUnknownProp = plugins.filter(function (plugin) {
478                    return plugin.name === prop;
479                }).length === 0;
480            }
481
482            warnWhen(didPassUnknownProp, ["`" + prop + "`", "is not a valid prop. You may have spelled it incorrectly, or if it's", 'a plugin, forgot to pass it in an array as props.plugins.', '\n\n', 'All props: https://atomiks.github.io/tippyjs/v6/all-props/\n', 'Plugins: https://atomiks.github.io/tippyjs/v6/plugins/'].join(' '));
483        });
484    }
485
486    var innerHTML = function innerHTML() {
487        return 'innerHTML';
488    };
489
490    function dangerouslySetInnerHTML(element, html) {
491        element[innerHTML()] = html;
492    }
493
494    function createArrowElement(value) {
495        var arrow = div();
496
497        if (value === true) {
498            arrow.className = ARROW_CLASS;
499        } else {
500            arrow.className = SVG_ARROW_CLASS;
501
502            if (isElement(value)) {
503                arrow.appendChild(value);
504            } else {
505                dangerouslySetInnerHTML(arrow, value);
506            }
507        }
508
509        return arrow;
510    }
511
512    function setContent(content, props) {
513        if (isElement(props.content)) {
514            dangerouslySetInnerHTML(content, '');
515            content.appendChild(props.content);
516        } else if (typeof props.content !== 'function') {
517            if (props.allowHTML) {
518                dangerouslySetInnerHTML(content, props.content);
519            } else {
520                content.textContent = props.content;
521            }
522        }
523    }
524    function getChildren(popper) {
525        var box = popper.firstElementChild;
526        var boxChildren = arrayFrom(box.children);
527        return {
528            box: box,
529            content: boxChildren.find(function (node) {
530                return node.classList.contains(CONTENT_CLASS);
531            }),
532            arrow: boxChildren.find(function (node) {
533                return node.classList.contains(ARROW_CLASS) || node.classList.contains(SVG_ARROW_CLASS);
534            }),
535            backdrop: boxChildren.find(function (node) {
536                return node.classList.contains(BACKDROP_CLASS);
537            })
538        };
539    }
540    function render(instance) {
541        var popper = div();
542        var box = div();
543        box.className = BOX_CLASS;
544        box.setAttribute('data-state', 'hidden');
545        box.setAttribute('tabindex', '-1');
546        var content = div();
547        content.className = CONTENT_CLASS;
548        content.setAttribute('data-state', 'hidden');
549        setContent(content, instance.props);
550        popper.appendChild(box);
551        box.appendChild(content);
552        onUpdate(instance.props, instance.props);
553
554        function onUpdate(prevProps, nextProps) {
555            var _getChildren = getChildren(popper),
556                box = _getChildren.box,
557                content = _getChildren.content,
558                arrow = _getChildren.arrow;
559
560            if (nextProps.theme) {
561                box.setAttribute('data-theme', nextProps.theme);
562            } else {
563                box.removeAttribute('data-theme');
564            }
565
566            if (typeof nextProps.animation === 'string') {
567                box.setAttribute('data-animation', nextProps.animation);
568            } else {
569                box.removeAttribute('data-animation');
570            }
571
572            if (nextProps.inertia) {
573                box.setAttribute('data-inertia', '');
574            } else {
575                box.removeAttribute('data-inertia');
576            }
577
578            box.style.maxWidth = typeof nextProps.maxWidth === 'number' ? nextProps.maxWidth + "px" : nextProps.maxWidth;
579
580            if (nextProps.role) {
581                box.setAttribute('role', nextProps.role);
582            } else {
583                box.removeAttribute('role');
584            }
585
586            if (prevProps.content !== nextProps.content || prevProps.allowHTML !== nextProps.allowHTML) {
587                setContent(content, instance.props);
588            }
589
590            if (nextProps.arrow) {
591                if (!arrow) {
592                    box.appendChild(createArrowElement(nextProps.arrow));
593                } else if (prevProps.arrow !== nextProps.arrow) {
594                    box.removeChild(arrow);
595                    box.appendChild(createArrowElement(nextProps.arrow));
596                }
597            } else if (arrow) {
598                box.removeChild(arrow);
599            }
600        }
601
602        return {
603            popper: popper,
604            onUpdate: onUpdate
605        };
606    } // Runtime check to identify if the render function is the default one; this
607    // way we can apply default CSS transitions logic and it can be tree-shaken away
608
609    render.$$tippy = true;
610
611    var idCounter = 1;
612    var mouseMoveListeners = []; // Used by `hideAll()`
613
614    var mountedInstances = [];
615    function createTippy(reference, passedProps) {
616        var props = evaluateProps(reference, Object.assign({}, defaultProps, getExtendedPassedProps(removeUndefinedProps(passedProps)))); // ===========================================================================
617        // 🔒 Private members
618        // ===========================================================================
619
620        var showTimeout;
621        var hideTimeout;
622        var scheduleHideAnimationFrame;
623        var isVisibleFromClick = false;
624        var didHideDueToDocumentMouseDown = false;
625        var didTouchMove = false;
626        var ignoreOnFirstUpdate = false;
627        var lastTriggerEvent;
628        var currentTransitionEndListener;
629        var onFirstUpdate;
630        var listeners = [];
631        var debouncedOnMouseMove = debounce(onMouseMove, props.interactiveDebounce);
632        var currentTarget; // ===========================================================================
633        // 🔑 Public members
634        // ===========================================================================
635
636        var id = idCounter++;
637        var popperInstance = null;
638        var plugins = unique(props.plugins);
639        var state = {
640            // Is the instance currently enabled?
641            isEnabled: true,
642            // Is the tippy currently showing and not transitioning out?
643            isVisible: false,
644            // Has the instance been destroyed?
645            isDestroyed: false,
646            // Is the tippy currently mounted to the DOM?
647            isMounted: false,
648            // Has the tippy finished transitioning in?
649            isShown: false
650        };
651        var instance = {
652            // properties
653            id: id,
654            reference: reference,
655            popper: div(),
656            popperInstance: popperInstance,
657            props: props,
658            state: state,
659            plugins: plugins,
660            // methods
661            clearDelayTimeouts: clearDelayTimeouts,
662            setProps: setProps,
663            setContent: setContent,
664            show: show,
665            hide: hide,
666            hideWithInteractivity: hideWithInteractivity,
667            enable: enable,
668            disable: disable,
669            unmount: unmount,
670            destroy: destroy
671        }; // TODO: Investigate why this early return causes a TDZ error in the tests —
672        // it doesn't seem to happen in the browser
673
674        /* istanbul ignore if */
675
676        if (!props.render) {
677            {
678                errorWhen(true, 'render() function has not been supplied.');
679            }
680
681            return instance;
682        } // ===========================================================================
683        // Initial mutations
684        // ===========================================================================
685
686
687        var _props$render = props.render(instance),
688            popper = _props$render.popper,
689            onUpdate = _props$render.onUpdate;
690
691        popper.setAttribute('data-tippy-root', '');
692        popper.id = "tippy-" + instance.id;
693        instance.popper = popper;
694        reference._tippy = instance;
695        popper._tippy = instance;
696        var pluginsHooks = plugins.map(function (plugin) {
697            return plugin.fn(instance);
698        });
699        var hasAriaExpanded = reference.hasAttribute('aria-expanded');
700        addListeners();
701        handleAriaExpandedAttribute();
702        handleStyles();
703        invokeHook('onCreate', [instance]);
704
705        if (props.showOnCreate) {
706            scheduleShow();
707        } // Prevent a tippy with a delay from hiding if the cursor left then returned
708        // before it started hiding
709
710
711        popper.addEventListener('mouseenter', function () {
712            if (instance.props.interactive && instance.state.isVisible) {
713                instance.clearDelayTimeouts();
714            }
715        });
716        popper.addEventListener('mouseleave', function () {
717            if (instance.props.interactive && instance.props.trigger.indexOf('mouseenter') >= 0) {
718                getDocument().addEventListener('mousemove', debouncedOnMouseMove);
719            }
720        });
721        return instance; // ===========================================================================
722        // 🔒 Private methods
723        // ===========================================================================
724
725        function getNormalizedTouchSettings() {
726            var touch = instance.props.touch;
727            return Array.isArray(touch) ? touch : [touch, 0];
728        }
729
730        function getIsCustomTouchBehavior() {
731            return getNormalizedTouchSettings()[0] === 'hold';
732        }
733
734        function getIsDefaultRenderFn() {
735            var _instance$props$rende;
736
737            // @ts-ignore
738            return !!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy);
739        }
740
741        function getCurrentTarget() {
742            return currentTarget || reference;
743        }
744
745        function getDocument() {
746            var parent = getCurrentTarget().parentNode;
747            return parent ? getOwnerDocument(parent) : document;
748        }
749
750        function getDefaultTemplateChildren() {
751            return getChildren(popper);
752        }
753
754        function getDelay(isShow) {
755            // For touch or keyboard input, force `0` delay for UX reasons
756            // Also if the instance is mounted but not visible (transitioning out),
757            // ignore delay
758            if (instance.state.isMounted && !instance.state.isVisible || currentInput.isTouch || lastTriggerEvent && lastTriggerEvent.type === 'focus') {
759                return 0;
760            }
761
762            return getValueAtIndexOrReturn(instance.props.delay, isShow ? 0 : 1, defaultProps.delay);
763        }
764
765        function handleStyles(fromHide) {
766            if (fromHide === void 0) {
767                fromHide = false;
vendor: 13,866 bytes, lines 768-1139
768            }
769
770            popper.style.pointerEvents = instance.props.interactive && !fromHide ? '' : 'none';
771            popper.style.zIndex = "" + instance.props.zIndex;
772        }
773
774        function invokeHook(hook, args, shouldInvokePropsHook) {
775            if (shouldInvokePropsHook === void 0) {
776                shouldInvokePropsHook = true;
777            }
778
779            pluginsHooks.forEach(function (pluginHooks) {
780                if (pluginHooks[hook]) {
781                    pluginHooks[hook].apply(pluginHooks, args);
782                }
783            });
784
785            if (shouldInvokePropsHook) {
786                var _instance$props;
787
788                (_instance$props = instance.props)[hook].apply(_instance$props, args);
789            }
790        }
791
792        function handleAriaContentAttribute() {
793            var aria = instance.props.aria;
794
795            if (!aria.content) {
796                return;
797            }
798
799            var attr = "aria-" + aria.content;
800            var id = popper.id;
801            var nodes = normalizeToArray(instance.props.triggerTarget || reference);
802            nodes.forEach(function (node) {
803                var currentValue = node.getAttribute(attr);
804
805                if (instance.state.isVisible) {
806                    node.setAttribute(attr, currentValue ? currentValue + " " + id : id);
807                } else {
808                    var nextValue = currentValue && currentValue.replace(id, '').trim();
809
810                    if (nextValue) {
811                        node.setAttribute(attr, nextValue);
812                    } else {
813                        node.removeAttribute(attr);
814                    }
815                }
816            });
817        }
818
819        function handleAriaExpandedAttribute() {
820            if (hasAriaExpanded || !instance.props.aria.expanded) {
821                return;
822            }
823
824            var nodes = normalizeToArray(instance.props.triggerTarget || reference);
825            nodes.forEach(function (node) {
826                if (instance.props.interactive) {
827                    node.setAttribute('aria-expanded', instance.state.isVisible && node === getCurrentTarget() ? 'true' : 'false');
828                } else {
829                    node.removeAttribute('aria-expanded');
830                }
831            });
832        }
833
834        function cleanupInteractiveMouseListeners() {
835            getDocument().removeEventListener('mousemove', debouncedOnMouseMove);
836            mouseMoveListeners = mouseMoveListeners.filter(function (listener) {
837                return listener !== debouncedOnMouseMove;
838            });
839        }
840
841        function onDocumentPress(event) {
842            // Moved finger to scroll instead of an intentional tap outside
843            if (currentInput.isTouch) {
844                if (didTouchMove || event.type === 'mousedown') {
845                    return;
846                }
847            }
848
849            var actualTarget = event.composedPath && event.composedPath()[0] || event.target; // Clicked on interactive popper
850
851            if (instance.props.interactive && actualContains(popper, actualTarget)) {
852                return;
853            } // Clicked on the event listeners target
854
855
856            if (normalizeToArray(instance.props.triggerTarget || reference).some(function (el) {
857                return actualContains(el, actualTarget);
858            })) {
859                if (currentInput.isTouch) {
860                    return;
861                }
862
863                if (instance.state.isVisible && instance.props.trigger.indexOf('click') >= 0) {
864                    return;
865                }
866            } else {
867                invokeHook('onClickOutside', [instance, event]);
868            }
869
870            if (instance.props.hideOnClick === true) {
871                instance.clearDelayTimeouts();
872                instance.hide(); // `mousedown` event is fired right before `focus` if pressing the
873                // currentTarget. This lets a tippy with `focus` trigger know that it
874                // should not show
875
876                didHideDueToDocumentMouseDown = true;
877                setTimeout(function () {
878                    didHideDueToDocumentMouseDown = false;
879                }); // The listener gets added in `scheduleShow()`, but this may be hiding it
880                // before it shows, and hide()'s early bail-out behavior can prevent it
881                // from being cleaned up
882
883                if (!instance.state.isMounted) {
884                    removeDocumentPress();
885                }
886            }
887        }
888
889        function onTouchMove() {
890            didTouchMove = true;
891        }
892
893        function onTouchStart() {
894            didTouchMove = false;
895        }
896
897        function addDocumentPress() {
898            var doc = getDocument();
899            doc.addEventListener('mousedown', onDocumentPress, true);
900            doc.addEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
901            doc.addEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
902            doc.addEventListener('touchmove', onTouchMove, TOUCH_OPTIONS);
903        }
904
905        function removeDocumentPress() {
906            var doc = getDocument();
907            doc.removeEventListener('mousedown', onDocumentPress, true);
908            doc.removeEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
909            doc.removeEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
910            doc.removeEventListener('touchmove', onTouchMove, TOUCH_OPTIONS);
911        }
912
913        function onTransitionedOut(duration, callback) {
914            onTransitionEnd(duration, function () {
915                if (!instance.state.isVisible && popper.parentNode && popper.parentNode.contains(popper)) {
916                    callback();
917                }
918            });
919        }
920
921        function onTransitionedIn(duration, callback) {
922            onTransitionEnd(duration, callback);
923        }
924
925        function onTransitionEnd(duration, callback) {
926            var box = getDefaultTemplateChildren().box;
927
928            function listener(event) {
929                if (event.target === box) {
930                    updateTransitionEndListener(box, 'remove', listener);
931                    callback();
932                }
933            } // Make callback synchronous if duration is 0
934            // `transitionend` won't fire otherwise
935
936
937            if (duration === 0) {
938                return callback();
939            }
940
941            updateTransitionEndListener(box, 'remove', currentTransitionEndListener);
942            updateTransitionEndListener(box, 'add', listener);
943            currentTransitionEndListener = listener;
944        }
945
946        function on(eventType, handler, options) {
947            if (options === void 0) {
948                options = false;
949            }
950
951            var nodes = normalizeToArray(instance.props.triggerTarget || reference);
952            nodes.forEach(function (node) {
953                node.addEventListener(eventType, handler, options);
954                listeners.push({
955                    node: node,
956                    eventType: eventType,
957                    handler: handler,
958                    options: options
959                });
960            });
961        }
962
963        function addListeners() {
964            if (getIsCustomTouchBehavior()) {
965                on('touchstart', onTrigger, {
966                    passive: true
967                });
968                on('touchend', onMouseLeave, {
969                    passive: true
970                });
971            }
972
973            splitBySpaces(instance.props.trigger).forEach(function (eventType) {
974                if (eventType === 'manual') {
975                    return;
976                }
977
978                on(eventType, onTrigger);
979
980                switch (eventType) {
981                    case 'mouseenter':
982                        on('mouseleave', onMouseLeave);
983                        break;
984
985                    case 'focus':
986                        on(isIE11 ? 'focusout' : 'blur', onBlurOrFocusOut);
987                        break;
988
989                    case 'focusin':
990                        on('focusout', onBlurOrFocusOut);
991                        break;
992                }
993            });
994        }
995
996        function removeListeners() {
997            listeners.forEach(function (_ref) {
998                var node = _ref.node,
999                    eventType = _ref.eventType,
1000                    handler = _ref.handler,
1001                    options = _ref.options;
1002                node.removeEventListener(eventType, handler, options);
1003            });
1004            listeners = [];
1005        }
1006
1007        function onTrigger(event) {
1008            var _lastTriggerEvent;
1009
1010            var shouldScheduleClickHide = false;
1011
1012            if (!instance.state.isEnabled || isEventListenerStopped(event) || didHideDueToDocumentMouseDown) {
1013                return;
1014            }
1015
1016            var wasFocused = ((_lastTriggerEvent = lastTriggerEvent) == null ? void 0 : _lastTriggerEvent.type) === 'focus';
1017            lastTriggerEvent = event;
1018            currentTarget = event.currentTarget;
1019            handleAriaExpandedAttribute();
1020
1021            if (!instance.state.isVisible && isMouseEvent(event)) {
1022                // If scrolling, `mouseenter` events can be fired if the cursor lands
1023                // over a new target, but `mousemove` events don't get fired. This
1024                // causes interactive tooltips to get stuck open until the cursor is
1025                // moved
1026                mouseMoveListeners.forEach(function (listener) {
1027                    return listener(event);
1028                });
1029            } // Toggle show/hide when clicking click-triggered tooltips
1030
1031
1032            if (event.type === 'click' && (instance.props.trigger.indexOf('mouseenter') < 0 || isVisibleFromClick) && instance.props.hideOnClick !== false && instance.state.isVisible) {
1033                shouldScheduleClickHide = true;
1034            } else {
1035                scheduleShow(event);
1036            }
1037
1038            if (event.type === 'click') {
1039                isVisibleFromClick = !shouldScheduleClickHide;
1040            }
1041
1042            if (shouldScheduleClickHide && !wasFocused) {
1043                scheduleHide(event);
1044            }
1045        }
1046
1047        function onMouseMove(event) {
1048            var target = event.target;
1049            var isCursorOverReferenceOrPopper = getCurrentTarget().contains(target) || popper.contains(target);
1050
1051            if (event.type === 'mousemove' && isCursorOverReferenceOrPopper) {
1052                return;
1053            }
1054
1055            var popperTreeData = getNestedPopperTree().concat(popper).map(function (popper) {
1056                var _instance$popperInsta;
1057
1058                var instance = popper._tippy;
1059                var state = (_instance$popperInsta = instance.popperInstance) == null ? void 0 : _instance$popperInsta.state;
1060
1061                if (state) {
1062                    return {
1063                        popperRect: popper.getBoundingClientRect(),
1064                        popperState: state,
1065                        props: props
1066                    };
1067                }
1068
1069                return null;
1070            }).filter(Boolean);
1071
1072            if (isCursorOutsideInteractiveBorder(popperTreeData, event)) {
1073                cleanupInteractiveMouseListeners();
1074                scheduleHide(event);
1075            }
1076        }
1077
1078        function onMouseLeave(event) {
1079            var shouldBail = isEventListenerStopped(event) || instance.props.trigger.indexOf('click') >= 0 && isVisibleFromClick;
1080
1081            if (shouldBail) {
1082                return;
1083            }
1084
1085            if (instance.props.interactive) {
1086                instance.hideWithInteractivity(event);
1087                return;
1088            }
1089
1090            scheduleHide(event);
1091        }
1092
1093        function onBlurOrFocusOut(event) {
1094            if (instance.props.trigger.indexOf('focusin') < 0 && event.target !== getCurrentTarget()) {
1095                return;
1096            } // If focus was moved to within the popper
1097
1098
1099            if (instance.props.interactive && event.relatedTarget && popper.contains(event.relatedTarget)) {
1100                return;
1101            }
1102
1103            scheduleHide(event);
1104        }
1105
1106        function isEventListenerStopped(event) {
1107            return currentInput.isTouch ? getIsCustomTouchBehavior() !== event.type.indexOf('touch') >= 0 : false;
1108        }
1109
1110        function createPopperInstance() {
1111            destroyPopperInstance();
1112            var _instance$props2 = instance.props,
1113                popperOptions = _instance$props2.popperOptions,
1114                placement = _instance$props2.placement,
1115                offset = _instance$props2.offset,
1116                getReferenceClientRect = _instance$props2.getReferenceClientRect,
1117                moveTransition = _instance$props2.moveTransition;
1118            var arrow = getIsDefaultRenderFn() ? getChildren(popper).arrow : null;
1119            var computedReference = getReferenceClientRect ? {
1120                getBoundingClientRect: getReferenceClientRect,
1121                contextElement: getReferenceClientRect.contextElement || getCurrentTarget()
1122            } : reference;
1123            var tippyModifier = {
1124                name: '$$tippy',
1125                enabled: true,
1126                phase: 'beforeWrite',
1127                requires: ['computeStyles'],
1128                fn: function fn(_ref2) {
1129                    var state = _ref2.state;
1130
1131                    if (getIsDefaultRenderFn()) {
1132                        var _getDefaultTemplateCh = getDefaultTemplateChildren(),
1133                            box = _getDefaultTemplateCh.box;
1134
1135                        ['placement', 'reference-hidden', 'escaped'].forEach(function (attr) {
1136                            if (attr === 'placement') {
1137                                box.setAttribute('data-placement', state.placement);
1138                            } else {
1139                                if (state.attributes.popper["data-
vendor: 50,649 bytes, lines 1139-2517
1139popper-" + attr]) {
1140                                    box.setAttribute("data-" + attr, '');
1141                                } else {
1142                                    box.removeAttribute("data-" + attr);
1143                                }
1144                            }
1145                        });
1146                        state.attributes.popper = {};
1147                    }
1148                }
1149            };
1150            var modifiers = [{
1151                name: 'offset',
1152                options: {
1153                    offset: offset
1154                }
1155            }, {
1156                name: 'preventOverflow',
1157                options: {
1158                    padding: {
1159                        top: 2,
1160                        bottom: 2,
1161                        left: 5,
1162                        right: 5
1163                    }
1164                }
1165            }, {
1166                name: 'flip',
1167                options: {
1168                    padding: 5
1169                }
1170            }, {
1171                name: 'computeStyles',
1172                options: {
1173                    adaptive: !moveTransition
1174                }
1175            }, tippyModifier];
1176
1177            if (getIsDefaultRenderFn() && arrow) {
1178                modifiers.push({
1179                    name: 'arrow',
1180                    options: {
1181                        element: arrow,
1182                        padding: 3
1183                    }
1184                });
1185            }
1186
1187            modifiers.push.apply(modifiers, (popperOptions == null ? void 0 : popperOptions.modifiers) || []);
1188            instance.popperInstance = core.createPopper(computedReference, popper, Object.assign({}, popperOptions, {
1189                placement: placement,
1190                onFirstUpdate: onFirstUpdate,
1191                modifiers: modifiers
1192            }));
1193        }
1194
1195        function destroyPopperInstance() {
1196            if (instance.popperInstance) {
1197                instance.popperInstance.destroy();
1198                instance.popperInstance = null;
1199            }
1200        }
1201
1202        function mount() {
1203            var appendTo = instance.props.appendTo;
1204            var parentNode; // By default, we'll append the popper to the triggerTargets's parentNode so
1205            // it's directly after the reference element so the elements inside the
1206            // tippy can be tabbed to
1207            // If there are clipping issues, the user can specify a different appendTo
1208            // and ensure focus management is handled correctly manually
1209
1210            var node = getCurrentTarget();
1211
1212            if (instance.props.interactive && appendTo === TIPPY_DEFAULT_APPEND_TO || appendTo === 'parent') {
1213                parentNode = node.parentNode;
1214            } else {
1215                parentNode = invokeWithArgsOrReturn(appendTo, [node]);
1216            } // The popper element needs to exist on the DOM before its position can be
1217            // updated as Popper needs to read its dimensions
1218
1219
1220            if (!parentNode.contains(popper)) {
1221                parentNode.appendChild(popper);
1222            }
1223
1224            instance.state.isMounted = true;
1225            createPopperInstance();
1226            /* istanbul ignore else */
1227
1228            {
1229                // Accessibility check
1230                warnWhen(instance.props.interactive && appendTo === defaultProps.appendTo && node.nextElementSibling !== popper, ['Interactive tippy element may not be accessible via keyboard', 'navigation because it is not directly after the reference element', 'in the DOM source order.', '\n\n', 'Using a wrapper <div> or <span> tag around the reference element', 'solves this by creating a new parentNode context.', '\n\n', 'Specifying `appendTo: document.body` silences this warning, but it', 'assumes you are using a focus management solution to handle', 'keyboard navigation.', '\n\n', 'See: https://atomiks.github.io/tippyjs/v6/accessibility/#interactivity'].join(' '));
1231            }
1232        }
1233
1234        function getNestedPopperTree() {
1235            return arrayFrom(popper.querySelectorAll('[data-tippy-root]'));
1236        }
1237
1238        function scheduleShow(event) {
1239            instance.clearDelayTimeouts();
1240
1241            if (event) {
1242                invokeHook('onTrigger', [instance, event]);
1243            }
1244
1245            addDocumentPress();
1246            var delay = getDelay(true);
1247
1248            var _getNormalizedTouchSe = getNormalizedTouchSettings(),
1249                touchValue = _getNormalizedTouchSe[0],
1250                touchDelay = _getNormalizedTouchSe[1];
1251
1252            if (currentInput.isTouch && touchValue === 'hold' && touchDelay) {
1253                delay = touchDelay;
1254            }
1255
1256            if (delay) {
1257                showTimeout = setTimeout(function () {
1258                    instance.show();
1259                }, delay);
1260            } else {
1261                instance.show();
1262            }
1263        }
1264
1265        function scheduleHide(event) {
1266            instance.clearDelayTimeouts();
1267            invokeHook('onUntrigger', [instance, event]);
1268
1269            if (!instance.state.isVisible) {
1270                removeDocumentPress();
1271                return;
1272            } // For interactive tippies, scheduleHide is added to a document.body handler
1273            // from onMouseLeave so must intercept scheduled hides from mousemove/leave
1274            // events when trigger contains mouseenter and click, and the tip is
1275            // currently shown as a result of a click.
1276
1277
1278            if (instance.props.trigger.indexOf('mouseenter') >= 0 && instance.props.trigger.indexOf('click') >= 0 && ['mouseleave', 'mousemove'].indexOf(event.type) >= 0 && isVisibleFromClick) {
1279                return;
1280            }
1281
1282            var delay = getDelay(false);
1283
1284            if (delay) {
1285                hideTimeout = setTimeout(function () {
1286                    if (instance.state.isVisible) {
1287                        instance.hide();
1288                    }
1289                }, delay);
1290            } else {
1291                // Fixes a `transitionend` problem when it fires 1 frame too
1292                // late sometimes, we don't want hide() to be called.
1293                scheduleHideAnimationFrame = requestAnimationFrame(function () {
1294                    instance.hide();
1295                });
1296            }
1297        } // ===========================================================================
1298        // 🔑 Public methods
1299        // ===========================================================================
1300
1301
1302        function enable() {
1303            instance.state.isEnabled = true;
1304        }
1305
1306        function disable() {
1307            // Disabling the instance should also hide it
1308            // https://github.com/atomiks/tippy.js-react/issues/106
1309            instance.hide();
1310            instance.state.isEnabled = false;
1311        }
1312
1313        function clearDelayTimeouts() {
1314            clearTimeout(showTimeout);
1315            clearTimeout(hideTimeout);
1316            cancelAnimationFrame(scheduleHideAnimationFrame);
1317        }
1318
1319        function setProps(partialProps) {
1320            /* istanbul ignore else */
1321            {
1322                warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('setProps'));
1323            }
1324
1325            if (instance.state.isDestroyed) {
1326                return;
1327            }
1328
1329            invokeHook('onBeforeUpdate', [instance, partialProps]);
1330            removeListeners();
1331            var prevProps = instance.props;
1332            var nextProps = evaluateProps(reference, Object.assign({}, prevProps, removeUndefinedProps(partialProps), {
1333                ignoreAttributes: true
1334            }));
1335            instance.props = nextProps;
1336            addListeners();
1337
1338            if (prevProps.interactiveDebounce !== nextProps.interactiveDebounce) {
1339                cleanupInteractiveMouseListeners();
1340                debouncedOnMouseMove = debounce(onMouseMove, nextProps.interactiveDebounce);
1341            } // Ensure stale aria-expanded attributes are removed
1342
1343
1344            if (prevProps.triggerTarget && !nextProps.triggerTarget) {
1345                normalizeToArray(prevProps.triggerTarget).forEach(function (node) {
1346                    node.removeAttribute('aria-expanded');
1347                });
1348            } else if (nextProps.triggerTarget) {
1349                reference.removeAttribute('aria-expanded');
1350            }
1351
1352            handleAriaExpandedAttribute();
1353            handleStyles();
1354
1355            if (onUpdate) {
1356                onUpdate(prevProps, nextProps);
1357            }
1358
1359            if (instance.popperInstance) {
1360                createPopperInstance(); // Fixes an issue with nested tippies if they are all getting re-rendered,
1361                // and the nested ones get re-rendered first.
1362                // https://github.com/atomiks/tippyjs-react/issues/177
1363                // TODO: find a cleaner / more efficient solution(!)
1364
1365                getNestedPopperTree().forEach(function (nestedPopper) {
1366                    // React (and other UI libs likely) requires a rAF wrapper as it flushes
1367                    // its work in one
1368                    requestAnimationFrame(nestedPopper._tippy.popperInstance.forceUpdate);
1369                });
1370            }
1371
1372            invokeHook('onAfterUpdate', [instance, partialProps]);
1373        }
1374
1375        function setContent(content) {
1376            instance.setProps({
1377                content: content
1378            });
1379        }
1380
1381        function show() {
1382            /* istanbul ignore else */
1383            {
1384                warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('show'));
1385            } // Early bail-out
1386
1387
1388            var isAlreadyVisible = instance.state.isVisible;
1389            var isDestroyed = instance.state.isDestroyed;
1390            var isDisabled = !instance.state.isEnabled;
1391            var isTouchAndTouchDisabled = currentInput.isTouch && !instance.props.touch;
1392            var duration = getValueAtIndexOrReturn(instance.props.duration, 0, defaultProps.duration);
1393
1394            if (isAlreadyVisible || isDestroyed || isDisabled || isTouchAndTouchDisabled) {
1395                return;
1396            } // Normalize `disabled` behavior across browsers.
1397            // Firefox allows events on disabled elements, but Chrome doesn't.
1398            // Using a wrapper element (i.e. <span>) is recommended.
1399
1400
1401            if (getCurrentTarget().hasAttribute('disabled')) {
1402                return;
1403            }
1404
1405            invokeHook('onShow', [instance], false);
1406
1407            if (instance.props.onShow(instance) === false) {
1408                return;
1409            }
1410
1411            instance.state.isVisible = true;
1412
1413            if (getIsDefaultRenderFn()) {
1414                popper.style.visibility = 'visible';
1415            }
1416
1417            handleStyles();
1418            addDocumentPress();
1419
1420            if (!instance.state.isMounted) {
1421                popper.style.transition = 'none';
1422            } // If flipping to the opposite side after hiding at least once, the
1423            // animation will use the wrong placement without resetting the duration
1424
1425
1426            if (getIsDefaultRenderFn()) {
1427                var _getDefaultTemplateCh2 = getDefaultTemplateChildren(),
1428                    box = _getDefaultTemplateCh2.box,
1429                    content = _getDefaultTemplateCh2.content;
1430
1431                setTransitionDuration([box, content], 0);
1432            }
1433
1434            onFirstUpdate = function onFirstUpdate() {
1435                var _instance$popperInsta2;
1436
1437                if (!instance.state.isVisible || ignoreOnFirstUpdate) {
1438                    return;
1439                }
1440
1441                ignoreOnFirstUpdate = true; // reflow
1442
1443                void popper.offsetHeight;
1444                popper.style.transition = instance.props.moveTransition;
1445
1446                if (getIsDefaultRenderFn() && instance.props.animation) {
1447                    var _getDefaultTemplateCh3 = getDefaultTemplateChildren(),
1448                        _box = _getDefaultTemplateCh3.box,
1449                        _content = _getDefaultTemplateCh3.content;
1450
1451                    setTransitionDuration([_box, _content], duration);
1452                    setVisibilityState([_box, _content], 'visible');
1453                }
1454
1455                handleAriaContentAttribute();
1456                handleAriaExpandedAttribute();
1457                pushIfUnique(mountedInstances, instance); // certain modifiers (e.g. `maxSize`) require a second update after the
1458                // popper has been positioned for the first time
1459
1460                (_instance$popperInsta2 = instance.popperInstance) == null ? void 0 : _instance$popperInsta2.forceUpdate();
1461                invokeHook('onMount', [instance]);
1462
1463                if (instance.props.animation && getIsDefaultRenderFn()) {
1464                    onTransitionedIn(duration, function () {
1465                        instance.state.isShown = true;
1466                        invokeHook('onShown', [instance]);
1467                    });
1468                }
1469            };
1470
1471            mount();
1472        }
1473
1474        function hide() {
1475            /* istanbul ignore else */
1476            {
1477                warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('hide'));
1478            } // Early bail-out
1479
1480
1481            var isAlreadyHidden = !instance.state.isVisible;
1482            var isDestroyed = instance.state.isDestroyed;
1483            var isDisabled = !instance.state.isEnabled;
1484            var duration = getValueAtIndexOrReturn(instance.props.duration, 1, defaultProps.duration);
1485
1486            if (isAlreadyHidden || isDestroyed || isDisabled) {
1487                return;
1488            }
1489
1490            invokeHook('onHide', [instance], false);
1491
1492            if (instance.props.onHide(instance) === false) {
1493                return;
1494            }
1495
1496            instance.state.isVisible = false;
1497            instance.state.isShown = false;
1498            ignoreOnFirstUpdate = false;
1499            isVisibleFromClick = false;
1500
1501            if (getIsDefaultRenderFn()) {
1502                popper.style.visibility = 'hidden';
1503            }
1504
1505            cleanupInteractiveMouseListeners();
1506            removeDocumentPress();
1507            handleStyles(true);
1508
1509            if (getIsDefaultRenderFn()) {
1510                var _getDefaultTemplateCh4 = getDefaultTemplateChildren(),
1511                    box = _getDefaultTemplateCh4.box,
1512                    content = _getDefaultTemplateCh4.content;
1513
1514                if (instance.props.animation) {
1515                    setTransitionDuration([box, content], duration);
1516                    setVisibilityState([box, content], 'hidden');
1517                }
1518            }
1519
1520            handleAriaContentAttribute();
1521            handleAriaExpandedAttribute();
1522
1523            if (instance.props.animation) {
1524                if (getIsDefaultRenderFn()) {
1525                    onTransitionedOut(duration, instance.unmount);
1526                }
1527            } else {
1528                instance.unmount();
1529            }
1530        }
1531
1532        function hideWithInteractivity(event) {
1533            /* istanbul ignore else */
1534            {
1535                warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('hideWithInteractivity'));
1536            }
1537
1538            getDocument().addEventListener('mousemove', debouncedOnMouseMove);
1539            pushIfUnique(mouseMoveListeners, debouncedOnMouseMove);
1540            debouncedOnMouseMove(event);
1541        }
1542
1543        function unmount() {
1544            /* istanbul ignore else */
1545            {
1546                warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('unmount'));
1547            }
1548
1549            if (instance.state.isVisible) {
1550                instance.hide();
1551            }
1552
1553            if (!instance.state.isMounted) {
1554                return;
1555            }
1556
1557            destroyPopperInstance(); // If a popper is not interactive, it will be appended outside the popper
1558            // tree by default. This seems mainly for interactive tippies, but we should
1559            // find a workaround if possible
1560
1561            getNestedPopperTree().forEach(function (nestedPopper) {
1562                nestedPopper._tippy.unmount();
1563            });
1564
1565            if (popper.parentNode) {
1566                popper.parentNode.removeChild(popper);
1567            }
1568
1569            mountedInstances = mountedInstances.filter(function (i) {
1570                return i !== instance;
1571            });
1572            instance.state.isMounted = false;
1573            invokeHook('onHidden', [instance]);
1574        }
1575
1576        function destroy() {
1577            /* istanbul ignore else */
1578            {
1579                warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('destroy'));
1580            }
1581
1582            if (instance.state.isDestroyed) {
1583                return;
1584            }
1585
1586            instance.clearDelayTimeouts();
1587            instance.unmount();
1588            removeListeners();
1589            delete reference._tippy;
1590            instance.state.isDestroyed = true;
1591            invokeHook('onDestroy', [instance]);
1592        }
1593    }
1594
1595    function tippy(targets, optionalProps) {
1596        if (optionalProps === void 0) {
1597            optionalProps = {};
1598        }
1599
1600        var plugins = defaultProps.plugins.concat(optionalProps.plugins || []);
1601        /* istanbul ignore else */
1602
1603        {
1604            validateTargets(targets);
1605            validateProps(optionalProps, plugins);
1606        }
1607
1608        bindGlobalEventListeners();
1609        var passedProps = Object.assign({}, optionalProps, {
1610            plugins: plugins
1611        });
1612        var elements = getArrayOfElements(targets);
1613        /* istanbul ignore else */
1614
1615        {
1616            var isSingleContentElement = isElement(passedProps.content);
1617            var isMoreThanOneReferenceElement = elements.length > 1;
1618            warnWhen(isSingleContentElement && isMoreThanOneReferenceElement, ['tippy() was passed an Element as the `content` prop, but more than', 'one tippy instance was created by this invocation. This means the', 'content element will only be appended to the last tippy instance.', '\n\n', 'Instead, pass the .innerHTML of the element, or use a function that', 'returns a cloned version of the element instead.', '\n\n', '1) content: element.innerHTML\n', '2) content: () => element.cloneNode(true)'].join(' '));
1619        }
1620
1621        var instances = elements.reduce(function (acc, reference) {
1622            var instance = reference && createTippy(reference, passedProps);
1623
1624            if (instance) {
1625                acc.push(instance);
1626            }
1627
1628            return acc;
1629        }, []);
1630        return isElement(targets) ? instances[0] : instances;
1631    }
1632
1633    tippy.defaultProps = defaultProps;
1634    tippy.setDefaultProps = setDefaultProps;
1635    tippy.currentInput = currentInput;
1636    var hideAll = function hideAll(_temp) {
1637        var _ref = _temp === void 0 ? {} : _temp,
1638            excludedReferenceOrInstance = _ref.exclude,
1639            duration = _ref.duration;
1640
1641        mountedInstances.forEach(function (instance) {
1642            var isExcluded = false;
1643
1644            if (excludedReferenceOrInstance) {
1645                isExcluded = isReferenceElement(excludedReferenceOrInstance) ? instance.reference === excludedReferenceOrInstance : instance.popper === excludedReferenceOrInstance.popper;
1646            }
1647
1648            if (!isExcluded) {
1649                var originalDuration = instance.props.duration;
1650                instance.setProps({
1651                    duration: duration
1652                });
1653                instance.hide();
1654
1655                if (!instance.state.isDestroyed) {
1656                    instance.setProps({
1657                        duration: originalDuration
1658                    });
1659                }
1660            }
1661        });
1662    };
1663
1664    // every time the popper is destroyed (i.e. a new target), removing the styles
1665    // and causing transitions to break for singletons when the console is open, but
1666    // most notably for non-transform styles being used, `gpuAcceleration: false`.
1667
1668    var applyStylesModifier = Object.assign({}, core.applyStyles, {
1669        effect: function effect(_ref) {
1670            var state = _ref.state;
1671            var initialStyles = {
1672                popper: {
1673                    position: state.options.strategy,
1674                    left: '0',
1675                    top: '0',
1676                    margin: '0'
1677                },
1678                arrow: {
1679                    position: 'absolute'
1680                },
1681                reference: {}
1682            };
1683            Object.assign(state.elements.popper.style, initialStyles.popper);
1684            state.styles = initialStyles;
1685
1686            if (state.elements.arrow) {
1687                Object.assign(state.elements.arrow.style, initialStyles.arrow);
1688            } // intentionally return no cleanup function
1689            // return () => { ... }
1690
1691        }
1692    });
1693
1694    var createSingleton = function createSingleton(tippyInstances, optionalProps) {
1695        var _optionalProps$popper;
1696
1697        if (optionalProps === void 0) {
1698            optionalProps = {};
1699        }
1700
1701        /* istanbul ignore else */
1702        {
1703            errorWhen(!Array.isArray(tippyInstances), ['The first argument passed to createSingleton() must be an array of', 'tippy instances. The passed value was', String(tippyInstances)].join(' '));
1704        }
1705
1706        var individualInstances = tippyInstances;
1707        var references = [];
1708        var triggerTargets = [];
1709        var currentTarget;
1710        var overrides = optionalProps.overrides;
1711        var interceptSetPropsCleanups = [];
1712        var shownOnCreate = false;
1713
1714        function setTriggerTargets() {
1715            triggerTargets = individualInstances.map(function (instance) {
1716                return normalizeToArray(instance.props.triggerTarget || instance.reference);
1717            }).reduce(function (acc, item) {
1718                return acc.concat(item);
1719            }, []);
1720        }
1721
1722        function setReferences() {
1723            references = individualInstances.map(function (instance) {
1724                return instance.reference;
1725            });
1726        }
1727
1728        function enableInstances(isEnabled) {
1729            individualInstances.forEach(function (instance) {
1730                if (isEnabled) {
1731                    instance.enable();
1732                } else {
1733                    instance.disable();
1734                }
1735            });
1736        }
1737
1738        function interceptSetProps(singleton) {
1739            return individualInstances.map(function (instance) {
1740                var originalSetProps = instance.setProps;
1741
1742                instance.setProps = function (props) {
1743                    originalSetProps(props);
1744
1745                    if (instance.reference === currentTarget) {
1746                        singleton.setProps(props);
1747                    }
1748                };
1749
1750                return function () {
1751                    instance.setProps = originalSetProps;
1752                };
1753            });
1754        } // have to pass singleton, as it maybe undefined on first call
1755
1756
1757        function prepareInstance(singleton, target) {
1758            var index = triggerTargets.indexOf(target); // bail-out
1759
1760            if (target === currentTarget) {
1761                return;
1762            }
1763
1764            currentTarget = target;
1765            var overrideProps = (overrides || []).concat('content').reduce(function (acc, prop) {
1766                acc[prop] = individualInstances[index].props[prop];
1767                return acc;
1768            }, {});
1769            singleton.setProps(Object.assign({}, overrideProps, {
1770                getReferenceClientRect: typeof overrideProps.getReferenceClientRect === 'function' ? overrideProps.getReferenceClientRect : function () {
1771                    var _references$index;
1772
1773                    return (_references$index = references[index]) == null ? void 0 : _references$index.getBoundingClientRect();
1774                }
1775            }));
1776        }
1777
1778        enableInstances(false);
1779        setReferences();
1780        setTriggerTargets();
1781        var plugin = {
1782            fn: function fn() {
1783                return {
1784                    onDestroy: function onDestroy() {
1785                        enableInstances(true);
1786                    },
1787                    onHidden: function onHidden() {
1788                        currentTarget = null;
1789                    },
1790                    onClickOutside: function onClickOutside(instance) {
1791                        if (instance.props.showOnCreate && !shownOnCreate) {
1792                            shownOnCreate = true;
1793                            currentTarget = null;
1794                        }
1795                    },
1796                    onShow: function onShow(instance) {
1797                        if (instance.props.showOnCreate && !shownOnCreate) {
1798                            shownOnCreate = true;
1799                            prepareInstance(instance, references[0]);
1800                        }
1801                    },
1802                    onTrigger: function onTrigger(instance, event) {
1803                        prepareInstance(instance, event.currentTarget);
1804                    }
1805                };
1806            }
1807        };
1808        var singleton = tippy(div(), Object.assign({}, removeProperties(optionalProps, ['overrides']), {
1809            plugins: [plugin].concat(optionalProps.plugins || []),
1810            triggerTarget: triggerTargets,
1811            popperOptions: Object.assign({}, optionalProps.popperOptions, {
1812                modifiers: [].concat(((_optionalProps$popper = optionalProps.popperOptions) == null ? void 0 : _optionalProps$popper.modifiers) || [], [applyStylesModifier])
1813            })
1814        }));
1815        var originalShow = singleton.show;
1816
1817        singleton.show = function (target) {
1818            originalShow(); // first time, showOnCreate or programmatic call with no params
1819            // default to showing first instance
1820
1821            if (!currentTarget && target == null) {
1822                return prepareInstance(singleton, references[0]);
1823            } // triggered from event (do nothing as prepareInstance already called by onTrigger)
1824            // programmatic call with no params when already visible (do nothing again)
1825
1826
1827            if (currentTarget && target == null) {
1828                return;
1829            } // target is index of instance
1830
1831
1832            if (typeof target === 'number') {
1833                return references[target] && prepareInstance(singleton, references[target]);
1834            } // target is a child tippy instance
1835
1836
1837            if (individualInstances.indexOf(target) >= 0) {
1838                var ref = target.reference;
1839                return prepareInstance(singleton, ref);
1840            } // target is a ReferenceElement
1841
1842
1843            if (references.indexOf(target) >= 0) {
1844                return prepareInstance(singleton, target);
1845            }
1846        };
1847
1848        singleton.showNext = function () {
1849            var first = references[0];
1850
1851            if (!currentTarget) {
1852                return singleton.show(0);
1853            }
1854
1855            var index = references.indexOf(currentTarget);
1856            singleton.show(references[index + 1] || first);
1857        };
1858
1859        singleton.showPrevious = function () {
1860            var last = references[references.length - 1];
1861
1862            if (!currentTarget) {
1863                return singleton.show(last);
1864            }
1865
1866            var index = references.indexOf(currentTarget);
1867            var target = references[index - 1] || last;
1868            singleton.show(target);
1869        };
1870
1871        var originalSetProps = singleton.setProps;
1872
1873        singleton.setProps = function (props) {
1874            overrides = props.overrides || overrides;
1875            originalSetProps(props);
1876        };
1877
1878        singleton.setInstances = function (nextInstances) {
1879            enableInstances(true);
1880            interceptSetPropsCleanups.forEach(function (fn) {
1881                return fn();
1882            });
1883            individualInstances = nextInstances;
1884            enableInstances(false);
1885            setReferences();
1886            setTriggerTargets();
1887            interceptSetPropsCleanups = interceptSetProps(singleton);
1888            singleton.setProps({
1889                triggerTarget: triggerTargets
1890            });
1891        };
1892
1893        interceptSetPropsCleanups = interceptSetProps(singleton);
1894        return singleton;
1895    };
1896
1897    var BUBBLING_EVENTS_MAP = {
1898        mouseover: 'mouseenter',
1899        focusin: 'focus',
1900        click: 'click'
1901    };
1902    /**
1903     * Creates a delegate instance that controls the creation of tippy instances
1904     * for child elements (`target` CSS selector).
1905     */
1906
1907    function delegate(targets, props) {
1908        /* istanbul ignore else */
1909        {
1910            errorWhen(!(props && props.target), ['You must specity a `target` prop indicating a CSS selector string matching', 'the target elements that should receive a tippy.'].join(' '));
1911        }
1912
1913        var listeners = [];
1914        var childTippyInstances = [];
1915        var disabled = false;
1916        var target = props.target;
1917        var nativeProps = removeProperties(props, ['target']);
1918        var parentProps = Object.assign({}, nativeProps, {
1919            trigger: 'manual',
1920            touch: false
1921        });
1922        var childProps = Object.assign({
1923            touch: defaultProps.touch
1924        }, nativeProps, {
1925            showOnCreate: true
1926        });
1927        var returnValue = tippy(targets, parentProps);
1928        var normalizedReturnValue = normalizeToArray(returnValue);
1929
1930        function onTrigger(event) {
1931            if (!event.target || disabled) {
1932                return;
1933            }
1934
1935            var targetNode = event.target.closest(target);
1936
1937            if (!targetNode) {
1938                return;
1939            } // Get relevant trigger with fallbacks:
1940            // 1. Check `data-tippy-trigger` attribute on target node
1941            // 2. Fallback to `trigger` passed to `delegate()`
1942            // 3. Fallback to `defaultProps.trigger`
1943
1944
1945            var trigger = targetNode.getAttribute('data-tippy-trigger') || props.trigger || defaultProps.trigger; // @ts-ignore
1946
1947            if (targetNode._tippy) {
1948                return;
1949            }
1950
1951            if (event.type === 'touchstart' && typeof childProps.touch === 'boolean') {
1952                return;
1953            }
1954
1955            if (event.type !== 'touchstart' && trigger.indexOf(BUBBLING_EVENTS_MAP[event.type]) < 0) {
1956                return;
1957            }
1958
1959            var instance = tippy(targetNode, childProps);
1960
1961            if (instance) {
1962                childTippyInstances = childTippyInstances.concat(instance);
1963            }
1964        }
1965
1966        function on(node, eventType, handler, options) {
1967            if (options === void 0) {
1968                options = false;
1969            }
1970
1971            node.addEventListener(eventType, handler, options);
1972            listeners.push({
1973                node: node,
1974                eventType: eventType,
1975                handler: handler,
1976                options: options
1977            });
1978        }
1979
1980        function addEventListeners(instance) {
1981            var reference = instance.reference;
1982            on(reference, 'touchstart', onTrigger, TOUCH_OPTIONS);
1983            on(reference, 'mouseover', onTrigger);
1984            on(reference, 'focusin', onTrigger);
1985            on(reference, 'click', onTrigger);
1986        }
1987
1988        function removeEventListeners() {
1989            listeners.forEach(function (_ref) {
1990                var node = _ref.node,
1991                    eventType = _ref.eventType,
1992                    handler = _ref.handler,
1993                    options = _ref.options;
1994                node.removeEventListener(eventType, handler, options);
1995            });
1996            listeners = [];
1997        }
1998
1999        function applyMutations(instance) {
2000            var originalDestroy = instance.destroy;
2001            var originalEnable = instance.enable;
2002            var originalDisable = instance.disable;
2003
2004            instance.destroy = function (shouldDestroyChildInstances) {
2005                if (shouldDestroyChildInstances === void 0) {
2006                    shouldDestroyChildInstances = true;
2007                }
2008
2009                if (shouldDestroyChildInstances) {
2010                    childTippyInstances.forEach(function (instance) {
2011                        instance.destroy();
2012                    });
2013                }
2014
2015                childTippyInstances = [];
2016                removeEventListeners();
2017                originalDestroy();
2018            };
2019
2020            instance.enable = function () {
2021                originalEnable();
2022                childTippyInstances.forEach(function (instance) {
2023                    return instance.enable();
2024                });
2025                disabled = false;
2026            };
2027
2028            instance.disable = function () {
2029                originalDisable();
2030                childTippyInstances.forEach(function (instance) {
2031                    return instance.disable();
2032                });
2033                disabled = true;
2034            };
2035
2036            addEventListeners(instance);
2037        }
2038
2039        normalizedReturnValue.forEach(applyMutations);
2040        return returnValue;
2041    }
2042
2043    var animateFill = {
2044        name: 'animateFill',
2045        defaultValue: false,
2046        fn: function fn(instance) {
2047            var _instance$props$rende;
2048
2049            // @ts-ignore
2050            if (!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy)) {
2051                {
2052                    errorWhen(instance.props.animateFill, 'The `animateFill` plugin requires the default render function.');
2053                }
2054
2055                return {};
2056            }
2057
2058            var _getChildren = getChildren(instance.popper),
2059                box = _getChildren.box,
2060                content = _getChildren.content;
2061
2062            var backdrop = instance.props.animateFill ? createBackdropElement() : null;
2063            return {
2064                onCreate: function onCreate() {
2065                    if (backdrop) {
2066                        box.insertBefore(backdrop, box.firstElementChild);
2067                        box.setAttribute('data-animatefill', '');
2068                        box.style.overflow = 'hidden';
2069                        instance.setProps({
2070                            arrow: false,
2071                            animation: 'shift-away'
2072                        });
2073                    }
2074                },
2075                onMount: function onMount() {
2076                    if (backdrop) {
2077                        var transitionDuration = box.style.transitionDuration;
2078                        var duration = Number(transitionDuration.replace('ms', '')); // The content should fade in after the backdrop has mostly filled the
2079                        // tooltip element. `clip-path` is the other alternative but is not
2080                        // well-supported and is buggy on some devices.
2081
2082                        content.style.transitionDelay = Math.round(duration / 10) + "ms";
2083                        backdrop.style.transitionDuration = transitionDuration;
2084                        setVisibilityState([backdrop], 'visible');
2085                    }
2086                },
2087                onShow: function onShow() {
2088                    if (backdrop) {
2089                        backdrop.style.transitionDuration = '0ms';
2090                    }
2091                },
2092                onHide: function onHide() {
2093                    if (backdrop) {
2094                        setVisibilityState([backdrop], 'hidden');
2095                    }
2096                }
2097            };
2098        }
2099    };
2100
2101    function createBackdropElement() {
2102        var backdrop = div();
2103        backdrop.className = BACKDROP_CLASS;
2104        setVisibilityState([backdrop], 'hidden');
2105        return backdrop;
2106    }
2107
2108    var mouseCoords = {
2109        clientX: 0,
2110        clientY: 0
2111    };
2112    var activeInstances = [];
2113
2114    function storeMouseCoords(_ref) {
2115        var clientX = _ref.clientX,
2116            clientY = _ref.clientY;
2117        mouseCoords = {
2118            clientX: clientX,
2119            clientY: clientY
2120        };
2121    }
2122
2123    function addMouseCoordsListener(doc) {
2124        doc.addEventListener('mousemove', storeMouseCoords);
2125    }
2126
2127    function removeMouseCoordsListener(doc) {
2128        doc.removeEventListener('mousemove', storeMouseCoords);
2129    }
2130
2131    var followCursor = {
2132        name: 'followCursor',
2133        defaultValue: false,
2134        fn: function fn(instance) {
2135            var reference = instance.reference;
2136            var doc = getOwnerDocument(instance.props.triggerTarget || reference);
2137            var isInternalUpdate = false;
2138            var wasFocusEvent = false;
2139            var isUnmounted = true;
2140            var prevProps = instance.props;
2141
2142            function getIsInitialBehavior() {
2143                return instance.props.followCursor === 'initial' && instance.state.isVisible;
2144            }
2145
2146            function addListener() {
2147                doc.addEventListener('mousemove', onMouseMove);
2148            }
2149
2150            function removeListener() {
2151                doc.removeEventListener('mousemove', onMouseMove);
2152            }
2153
2154            function unsetGetReferenceClientRect() {
2155                isInternalUpdate = true;
2156                instance.setProps({
2157                    getReferenceClientRect: null
2158                });
2159                isInternalUpdate = false;
2160            }
2161
2162            function onMouseMove(event) {
2163                // If the instance is interactive, avoid updating the position unless it's
2164                // over the reference element
2165                var isCursorOverReference = event.target ? reference.contains(event.target) : true;
2166                var followCursor = instance.props.followCursor;
2167                var clientX = event.clientX,
2168                    clientY = event.clientY;
2169                var rect = reference.getBoundingClientRect();
2170                var relativeX = clientX - rect.left;
2171                var relativeY = clientY - rect.top;
2172
2173                if (isCursorOverReference || !instance.props.interactive) {
2174                    instance.setProps({
2175                        // @ts-ignore - unneeded DOMRect properties
2176                        getReferenceClientRect: function getReferenceClientRect() {
2177                            var rect = reference.getBoundingClientRect();
2178                            var x = clientX;
2179                            var y = clientY;
2180
2181                            if (followCursor === 'initial') {
2182                                x = rect.left + relativeX;
2183                                y = rect.top + relativeY;
2184                            }
2185
2186                            var top = followCursor === 'horizontal' ? rect.top : y;
2187                            var right = followCursor === 'vertical' ? rect.right : x;
2188                            var bottom = followCursor === 'horizontal' ? rect.bottom : y;
2189                            var left = followCursor === 'vertical' ? rect.left : x;
2190                            return {
2191                                width: right - left,
2192                                height: bottom - top,
2193                                top: top,
2194                                right: right,
2195                                bottom: bottom,
2196                                left: left
2197                            };
2198                        }
2199                    });
2200                }
2201            }
2202
2203            function create() {
2204                if (instance.props.followCursor) {
2205                    activeInstances.push({
2206                        instance: instance,
2207                        doc: doc
2208                    });
2209                    addMouseCoordsListener(doc);
2210                }
2211            }
2212
2213            function destroy() {
2214                activeInstances = activeInstances.filter(function (data) {
2215                    return data.instance !== instance;
2216                });
2217
2218                if (activeInstances.filter(function (data) {
2219                    return data.doc === doc;
2220                }).length === 0) {
2221                    removeMouseCoordsListener(doc);
2222                }
2223            }
2224
2225            return {
2226                onCreate: create,
2227                onDestroy: destroy,
2228                onBeforeUpdate: function onBeforeUpdate() {
2229                    prevProps = instance.props;
2230                },
2231                onAfterUpdate: function onAfterUpdate(_, _ref2) {
2232                    var followCursor = _ref2.followCursor;
2233
2234                    if (isInternalUpdate) {
2235                        return;
2236                    }
2237
2238                    if (followCursor !== undefined && prevProps.followCursor !== followCursor) {
2239                        destroy();
2240
2241                        if (followCursor) {
2242                            create();
2243
2244                            if (instance.state.isMounted && !wasFocusEvent && !getIsInitialBehavior()) {
2245                                addListener();
2246                            }
2247                        } else {
2248                            removeListener();
2249                            unsetGetReferenceClientRect();
2250                        }
2251                    }
2252                },
2253                onMount: function onMount() {
2254                    if (instance.props.followCursor && !wasFocusEvent) {
2255                        if (isUnmounted) {
2256                            onMouseMove(mouseCoords);
2257                            isUnmounted = false;
2258                        }
2259
2260                        if (!getIsInitialBehavior()) {
2261                            addListener();
2262                        }
2263                    }
2264                },
2265                onTrigger: function onTrigger(_, event) {
2266                    if (isMouseEvent(event)) {
2267                        mouseCoords = {
2268                            clientX: event.clientX,
2269                            clientY: event.clientY
2270                        };
2271                    }
2272
2273                    wasFocusEvent = event.type === 'focus';
2274                },
2275                onHidden: function onHidden() {
2276                    if (instance.props.followCursor) {
2277                        unsetGetReferenceClientRect();
2278                        removeListener();
2279                        isUnmounted = true;
2280                    }
2281                }
2282            };
2283        }
2284    };
2285
2286    function getProps(props, modifier) {
2287        var _props$popperOptions;
2288
2289        return {
2290            popperOptions: Object.assign({}, props.popperOptions, {
2291                modifiers: [].concat((((_props$popperOptions = props.popperOptions) == null ? void 0 : _props$popperOptions.modifiers) || []).filter(function (_ref) {
2292                    var name = _ref.name;
2293                    return name !== modifier.name;
2294                }), [modifier])
2295            })
2296        };
2297    }
2298
2299    var inlinePositioning = {
2300        name: 'inlinePositioning',
2301        defaultValue: false,
2302        fn: function fn(instance) {
2303            var reference = instance.reference;
2304
2305            function isEnabled() {
2306                return !!instance.props.inlinePositioning;
2307            }
2308
2309            var placement;
2310            var cursorRectIndex = -1;
2311            var isInternalUpdate = false;
2312            var triedPlacements = [];
2313            var modifier = {
2314                name: 'tippyInlinePositioning',
2315                enabled: true,
2316                phase: 'afterWrite',
2317                fn: function fn(_ref2) {
2318                    var state = _ref2.state;
2319
2320                    if (isEnabled()) {
2321                        if (triedPlacements.indexOf(state.placement) !== -1) {
2322                            triedPlacements = [];
2323                        }
2324
2325                        if (placement !== state.placement && triedPlacements.indexOf(state.placement) === -1) {
2326                            triedPlacements.push(state.placement);
2327                            instance.setProps({
2328                                // @ts-ignore - unneeded DOMRect properties
2329                                getReferenceClientRect: function getReferenceClientRect() {
2330                                    return _getReferenceClientRect(state.placement);
2331                                }
2332                            });
2333                        }
2334
2335                        placement = state.placement;
2336                    }
2337                }
2338            };
2339
2340            function _getReferenceClientRect(placement) {
2341                return getInlineBoundingClientRect(getBasePlacement(placement), reference.getBoundingClientRect(), arrayFrom(reference.getClientRects()), cursorRectIndex);
2342            }
2343
2344            function setInternalProps(partialProps) {
2345                isInternalUpdate = true;
2346                instance.setProps(partialProps);
2347                isInternalUpdate = false;
2348            }
2349
2350            function addModifier() {
2351                if (!isInternalUpdate) {
2352                    setInternalProps(getProps(instance.props, modifier));
2353                }
2354            }
2355
2356            return {
2357                onCreate: addModifier,
2358                onAfterUpdate: addModifier,
2359                onTrigger: function onTrigger(_, event) {
2360                    if (isMouseEvent(event)) {
2361                        var rects = arrayFrom(instance.reference.getClientRects());
2362                        var cursorRect = rects.find(function (rect) {
2363                            return rect.left - 2 <= event.clientX && rect.right + 2 >= event.clientX && rect.top - 2 <= event.clientY && rect.bottom + 2 >= event.clientY;
2364                        });
2365                        var index = rects.indexOf(cursorRect);
2366                        cursorRectIndex = index > -1 ? index : cursorRectIndex;
2367                    }
2368                },
2369                onHidden: function onHidden() {
2370                    cursorRectIndex = -1;
2371                }
2372            };
2373        }
2374    };
2375    function getInlineBoundingClientRect(currentBasePlacement, boundingRect, clientRects, cursorRectIndex) {
2376        // Not an inline element, or placement is not yet known
2377        if (clientRects.length < 2 || currentBasePlacement === null) {
2378            return boundingRect;
2379        } // There are two rects and they are disjoined
2380
2381
2382        if (clientRects.length === 2 && cursorRectIndex >= 0 && clientRects[0].left > clientRects[1].right) {
2383            return clientRects[cursorRectIndex] || boundingRect;
2384        }
2385
2386        switch (currentBasePlacement) {
2387            case 'top':
2388            case 'bottom':
2389                {
2390                    var firstRect = clientRects[0];
2391                    var lastRect = clientRects[clientRects.length - 1];
2392                    var isTop = currentBasePlacement === 'top';
2393                    var top = firstRect.top;
2394                    var bottom = lastRect.bottom;
2395                    var left = isTop ? firstRect.left : lastRect.left;
2396                    var right = isTop ? firstRect.right : lastRect.right;
2397                    var width = right - left;
2398                    var height = bottom - top;
2399                    return {
2400                        top: top,
2401                        bottom: bottom,
2402                        left: left,
2403                        right: right,
2404                        width: width,
2405                        height: height
2406                    };
2407                }
2408
2409            case 'left':
2410            case 'right':
2411                {
2412                    var minLeft = Math.min.apply(Math, clientRects.map(function (rects) {
2413                        return rects.left;
2414                    }));
2415                    var maxRight = Math.max.apply(Math, clientRects.map(function (rects) {
2416                        return rects.right;
2417                    }));
2418                    var measureRects = clientRects.filter(function (rect) {
2419                        return currentBasePlacement === 'left' ? rect.left === minLeft : rect.right === maxRight;
2420                    });
2421                    var _top = measureRects[0].top;
2422                    var _bottom = measureRects[measureRects.length - 1].bottom;
2423                    var _left = minLeft;
2424                    var _right = maxRight;
2425
2426                    var _width = _right - _left;
2427
2428                    var _height = _bottom - _top;
2429
2430                    return {
2431                        top: _top,
2432                        bottom: _bottom,
2433                        left: _left,
2434                        right: _right,
2435                        width: _width,
2436                        height: _height
2437                    };
2438                }
2439
2440            default:
2441                {
2442                    return boundingRect;
2443                }
2444        }
2445    }
2446
2447    var sticky = {
2448        name: 'sticky',
2449        defaultValue: false,
2450        fn: function fn(instance) {
2451            var reference = instance.reference,
2452                popper = instance.popper;
2453
2454            function getReference() {
2455                return instance.popperInstance ? instance.popperInstance.state.elements.reference : reference;
2456            }
2457
2458            function shouldCheck(value) {
2459                return instance.props.sticky === true || instance.props.sticky === value;
2460            }
2461
2462            var prevRefRect = null;
2463            var prevPopRect = null;
2464
2465            function updatePosition() {
2466                var currentRefRect = shouldCheck('reference') ? getReference().getBoundingClientRect() : null;
2467                var currentPopRect = shouldCheck('popper') ? popper.getBoundingClientRect() : null;
2468
2469                if (currentRefRect && areRectsDifferent(prevRefRect, currentRefRect) || currentPopRect && areRectsDifferent(prevPopRect, currentPopRect)) {
2470                    if (instance.popperInstance) {
2471                        instance.popperInstance.update();
2472                    }
2473                }
2474
2475                prevRefRect = currentRefRect;
2476                prevPopRect = currentPopRect;
2477
2478                if (instance.state.isMounted) {
2479                    requestAnimationFrame(updatePosition);
2480                }
2481            }
2482
2483            return {
2484                onMount: function onMount() {
2485                    if (instance.props.sticky) {
2486                        updatePosition();
2487                    }
2488                }
2489            };
2490        }
2491    };
2492
2493    function areRectsDifferent(rectA, rectB) {
2494        if (rectA && rectB) {
2495            return rectA.top !== rectB.top || rectA.right !== rectB.right || rectA.bottom !== rectB.bottom || rectA.left !== rectB.left;
2496        }
2497
2498        return true;
2499    }
2500
2501    if (isBrowser) {
2502        injectCSS(css);
2503    }
2504
2505    tippy.setDefaultProps({
2506        plugins: [animateFill, followCursor, inlinePositioning, sticky],
2507        render: render
2508    });
2509    tippy.createSingleton = createSingleton;
2510    tippy.delegate = delegate;
2511    tippy.hideAll = hideAll;
2512    tippy.roundArrow = ROUND_ARROW;
2513
2514    return tippy;
2515
2516})));
2517//# sourceMappingURL=tippy-bundle.umd.js.map

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.