vue-tippy 4.14.0 → 4.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/src/components/Tippy.d.ts +421 -0
  2. package/dist/src/components/Tippy.d.ts.map +1 -0
  3. package/dist/src/components/TippySingleton.d.ts +266 -0
  4. package/dist/src/components/TippySingleton.d.ts.map +1 -0
  5. package/dist/src/composables/index.d.ts +4 -0
  6. package/dist/src/composables/index.d.ts.map +1 -0
  7. package/dist/src/composables/useSingleton.d.ts +6 -0
  8. package/dist/src/composables/useSingleton.d.ts.map +1 -0
  9. package/dist/src/composables/useTippy.d.ts +27 -0
  10. package/dist/src/composables/useTippy.d.ts.map +1 -0
  11. package/dist/src/composables/useTippyComponent.d.ts +8 -0
  12. package/dist/src/composables/useTippyComponent.d.ts.map +1 -0
  13. package/dist/src/directive/index.d.ts +4 -0
  14. package/dist/src/directive/index.d.ts.map +1 -0
  15. package/dist/src/index.d.ts +13 -0
  16. package/dist/src/index.d.ts.map +1 -0
  17. package/dist/src/plugin/index.d.ts +4 -0
  18. package/dist/src/plugin/index.d.ts.map +1 -0
  19. package/dist/src/types/index.d.ts +21 -0
  20. package/dist/src/types/index.d.ts.map +1 -0
  21. package/dist/vue-tippy.cjs +4789 -0
  22. package/dist/vue-tippy.d.ts +750 -0
  23. package/dist/vue-tippy.esm-browser.js +4460 -0
  24. package/dist/vue-tippy.esm.js +13 -3
  25. package/dist/vue-tippy.iife.js +4792 -0
  26. package/dist/vue-tippy.iife.prod.js +6 -0
  27. package/dist/vue-tippy.min.js +1 -1
  28. package/dist/vue-tippy.mjs +4460 -0
  29. package/dist/vue-tippy.prod.cjs +4473 -0
  30. package/dist/vue-tippy.umd.js +13 -3
  31. package/package.json +1 -1
  32. package/src/components/Tippy.vue +3 -3
  33. package/src/components/TippyNoStyles.vue +1 -1
  34. package/src/index.js +2 -0
@@ -0,0 +1,4473 @@
1
+ /*!
2
+ * vue-tippy v6.0.0-alpha.63
3
+ * (c) 2022
4
+ * @license MIT
5
+ */
6
+ 'use strict';
7
+
8
+ Object.defineProperty(exports, '__esModule', { value: true });
9
+
10
+ var vue = require('vue');
11
+
12
+ var top = 'top';
13
+ var bottom = 'bottom';
14
+ var right = 'right';
15
+ var left = 'left';
16
+ var auto = 'auto';
17
+ var basePlacements = [top, bottom, right, left];
18
+ var start = 'start';
19
+ var end = 'end';
20
+ var clippingParents = 'clippingParents';
21
+ var viewport = 'viewport';
22
+ var popper = 'popper';
23
+ var reference = 'reference';
24
+ var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
25
+ return acc.concat([placement + "-" + start, placement + "-" + end]);
26
+ }, []);
27
+ var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
28
+ return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
29
+ }, []); // modifiers that need to read the DOM
30
+
31
+ var beforeRead = 'beforeRead';
32
+ var read = 'read';
33
+ var afterRead = 'afterRead'; // pure-logic modifiers
34
+
35
+ var beforeMain = 'beforeMain';
36
+ var main = 'main';
37
+ var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
38
+
39
+ var beforeWrite = 'beforeWrite';
40
+ var write = 'write';
41
+ var afterWrite = 'afterWrite';
42
+ var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
43
+
44
+ function getNodeName(element) {
45
+ return element ? (element.nodeName || '').toLowerCase() : null;
46
+ }
47
+
48
+ function getWindow(node) {
49
+ if (node == null) {
50
+ return window;
51
+ }
52
+
53
+ if (node.toString() !== '[object Window]') {
54
+ var ownerDocument = node.ownerDocument;
55
+ return ownerDocument ? ownerDocument.defaultView || window : window;
56
+ }
57
+
58
+ return node;
59
+ }
60
+
61
+ function isElement(node) {
62
+ var OwnElement = getWindow(node).Element;
63
+ return node instanceof OwnElement || node instanceof Element;
64
+ }
65
+
66
+ function isHTMLElement(node) {
67
+ var OwnElement = getWindow(node).HTMLElement;
68
+ return node instanceof OwnElement || node instanceof HTMLElement;
69
+ }
70
+
71
+ function isShadowRoot(node) {
72
+ // IE 11 has no ShadowRoot
73
+ if (typeof ShadowRoot === 'undefined') {
74
+ return false;
75
+ }
76
+
77
+ var OwnElement = getWindow(node).ShadowRoot;
78
+ return node instanceof OwnElement || node instanceof ShadowRoot;
79
+ }
80
+
81
+ // and applies them to the HTMLElements such as popper and arrow
82
+
83
+ function applyStyles(_ref) {
84
+ var state = _ref.state;
85
+ Object.keys(state.elements).forEach(function (name) {
86
+ var style = state.styles[name] || {};
87
+ var attributes = state.attributes[name] || {};
88
+ var element = state.elements[name]; // arrow is optional + virtual elements
89
+
90
+ if (!isHTMLElement(element) || !getNodeName(element)) {
91
+ return;
92
+ } // Flow doesn't support to extend this property, but it's the most
93
+ // effective way to apply styles to an HTMLElement
94
+ // $FlowFixMe[cannot-write]
95
+
96
+
97
+ Object.assign(element.style, style);
98
+ Object.keys(attributes).forEach(function (name) {
99
+ var value = attributes[name];
100
+
101
+ if (value === false) {
102
+ element.removeAttribute(name);
103
+ } else {
104
+ element.setAttribute(name, value === true ? '' : value);
105
+ }
106
+ });
107
+ });
108
+ }
109
+
110
+ function effect(_ref2) {
111
+ var state = _ref2.state;
112
+ var initialStyles = {
113
+ popper: {
114
+ position: state.options.strategy,
115
+ left: '0',
116
+ top: '0',
117
+ margin: '0'
118
+ },
119
+ arrow: {
120
+ position: 'absolute'
121
+ },
122
+ reference: {}
123
+ };
124
+ Object.assign(state.elements.popper.style, initialStyles.popper);
125
+ state.styles = initialStyles;
126
+
127
+ if (state.elements.arrow) {
128
+ Object.assign(state.elements.arrow.style, initialStyles.arrow);
129
+ }
130
+
131
+ return function () {
132
+ Object.keys(state.elements).forEach(function (name) {
133
+ var element = state.elements[name];
134
+ var attributes = state.attributes[name] || {};
135
+ var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them
136
+
137
+ var style = styleProperties.reduce(function (style, property) {
138
+ style[property] = '';
139
+ return style;
140
+ }, {}); // arrow is optional + virtual elements
141
+
142
+ if (!isHTMLElement(element) || !getNodeName(element)) {
143
+ return;
144
+ }
145
+
146
+ Object.assign(element.style, style);
147
+ Object.keys(attributes).forEach(function (attribute) {
148
+ element.removeAttribute(attribute);
149
+ });
150
+ });
151
+ };
152
+ } // eslint-disable-next-line import/no-unused-modules
153
+
154
+
155
+ var applyStyles$1 = {
156
+ name: 'applyStyles',
157
+ enabled: true,
158
+ phase: 'write',
159
+ fn: applyStyles,
160
+ effect: effect,
161
+ requires: ['computeStyles']
162
+ };
163
+
164
+ function getBasePlacement(placement) {
165
+ return placement.split('-')[0];
166
+ }
167
+
168
+ var max = Math.max;
169
+ var min = Math.min;
170
+ var round = Math.round;
171
+
172
+ function getBoundingClientRect(element, includeScale) {
173
+ if (includeScale === void 0) {
174
+ includeScale = false;
175
+ }
176
+
177
+ var rect = element.getBoundingClientRect();
178
+ var scaleX = 1;
179
+ var scaleY = 1;
180
+
181
+ if (isHTMLElement(element) && includeScale) {
182
+ var offsetHeight = element.offsetHeight;
183
+ var offsetWidth = element.offsetWidth; // Do not attempt to divide by 0, otherwise we get `Infinity` as scale
184
+ // Fallback to 1 in case both values are `0`
185
+
186
+ if (offsetWidth > 0) {
187
+ scaleX = round(rect.width) / offsetWidth || 1;
188
+ }
189
+
190
+ if (offsetHeight > 0) {
191
+ scaleY = round(rect.height) / offsetHeight || 1;
192
+ }
193
+ }
194
+
195
+ return {
196
+ width: rect.width / scaleX,
197
+ height: rect.height / scaleY,
198
+ top: rect.top / scaleY,
199
+ right: rect.right / scaleX,
200
+ bottom: rect.bottom / scaleY,
201
+ left: rect.left / scaleX,
202
+ x: rect.left / scaleX,
203
+ y: rect.top / scaleY
204
+ };
205
+ }
206
+
207
+ // means it doesn't take into account transforms.
208
+
209
+ function getLayoutRect(element) {
210
+ var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
211
+ // Fixes https://github.com/popperjs/popper-core/issues/1223
212
+
213
+ var width = element.offsetWidth;
214
+ var height = element.offsetHeight;
215
+
216
+ if (Math.abs(clientRect.width - width) <= 1) {
217
+ width = clientRect.width;
218
+ }
219
+
220
+ if (Math.abs(clientRect.height - height) <= 1) {
221
+ height = clientRect.height;
222
+ }
223
+
224
+ return {
225
+ x: element.offsetLeft,
226
+ y: element.offsetTop,
227
+ width: width,
228
+ height: height
229
+ };
230
+ }
231
+
232
+ function contains(parent, child) {
233
+ var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
234
+
235
+ if (parent.contains(child)) {
236
+ return true;
237
+ } // then fallback to custom implementation with Shadow DOM support
238
+ else if (rootNode && isShadowRoot(rootNode)) {
239
+ var next = child;
240
+
241
+ do {
242
+ if (next && parent.isSameNode(next)) {
243
+ return true;
244
+ } // $FlowFixMe[prop-missing]: need a better way to handle this...
245
+
246
+
247
+ next = next.parentNode || next.host;
248
+ } while (next);
249
+ } // Give up, the result is false
250
+
251
+
252
+ return false;
253
+ }
254
+
255
+ function getComputedStyle(element) {
256
+ return getWindow(element).getComputedStyle(element);
257
+ }
258
+
259
+ function isTableElement(element) {
260
+ return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
261
+ }
262
+
263
+ function getDocumentElement(element) {
264
+ // $FlowFixMe[incompatible-return]: assume body is always available
265
+ return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
266
+ element.document) || window.document).documentElement;
267
+ }
268
+
269
+ function getParentNode(element) {
270
+ if (getNodeName(element) === 'html') {
271
+ return element;
272
+ }
273
+
274
+ return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
275
+ // $FlowFixMe[incompatible-return]
276
+ // $FlowFixMe[prop-missing]
277
+ element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
278
+ element.parentNode || ( // DOM Element detected
279
+ isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
280
+ // $FlowFixMe[incompatible-call]: HTMLElement is a Node
281
+ getDocumentElement(element) // fallback
282
+
283
+ );
284
+ }
285
+
286
+ function getTrueOffsetParent(element) {
287
+ if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
288
+ getComputedStyle(element).position === 'fixed') {
289
+ return null;
290
+ }
291
+
292
+ return element.offsetParent;
293
+ } // `.offsetParent` reports `null` for fixed elements, while absolute elements
294
+ // return the containing block
295
+
296
+
297
+ function getContainingBlock(element) {
298
+ var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1;
299
+ var isIE = navigator.userAgent.indexOf('Trident') !== -1;
300
+
301
+ if (isIE && isHTMLElement(element)) {
302
+ // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
303
+ var elementCss = getComputedStyle(element);
304
+
305
+ if (elementCss.position === 'fixed') {
306
+ return null;
307
+ }
308
+ }
309
+
310
+ var currentNode = getParentNode(element);
311
+
312
+ while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
313
+ var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
314
+ // create a containing block.
315
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
316
+
317
+ if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {
318
+ return currentNode;
319
+ } else {
320
+ currentNode = currentNode.parentNode;
321
+ }
322
+ }
323
+
324
+ return null;
325
+ } // Gets the closest ancestor positioned element. Handles some edge cases,
326
+ // such as table ancestors and cross browser bugs.
327
+
328
+
329
+ function getOffsetParent(element) {
330
+ var window = getWindow(element);
331
+ var offsetParent = getTrueOffsetParent(element);
332
+
333
+ while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
334
+ offsetParent = getTrueOffsetParent(offsetParent);
335
+ }
336
+
337
+ if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {
338
+ return window;
339
+ }
340
+
341
+ return offsetParent || getContainingBlock(element) || window;
342
+ }
343
+
344
+ function getMainAxisFromPlacement(placement) {
345
+ return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
346
+ }
347
+
348
+ function within(min$1, value, max$1) {
349
+ return max(min$1, min(value, max$1));
350
+ }
351
+ function withinMaxClamp(min, value, max) {
352
+ var v = within(min, value, max);
353
+ return v > max ? max : v;
354
+ }
355
+
356
+ function getFreshSideObject() {
357
+ return {
358
+ top: 0,
359
+ right: 0,
360
+ bottom: 0,
361
+ left: 0
362
+ };
363
+ }
364
+
365
+ function mergePaddingObject(paddingObject) {
366
+ return Object.assign({}, getFreshSideObject(), paddingObject);
367
+ }
368
+
369
+ function expandToHashMap(value, keys) {
370
+ return keys.reduce(function (hashMap, key) {
371
+ hashMap[key] = value;
372
+ return hashMap;
373
+ }, {});
374
+ }
375
+
376
+ var toPaddingObject = function toPaddingObject(padding, state) {
377
+ padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {
378
+ placement: state.placement
379
+ })) : padding;
380
+ return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
381
+ };
382
+
383
+ function arrow(_ref) {
384
+ var _state$modifiersData$;
385
+
386
+ var state = _ref.state,
387
+ name = _ref.name,
388
+ options = _ref.options;
389
+ var arrowElement = state.elements.arrow;
390
+ var popperOffsets = state.modifiersData.popperOffsets;
391
+ var basePlacement = getBasePlacement(state.placement);
392
+ var axis = getMainAxisFromPlacement(basePlacement);
393
+ var isVertical = [left, right].indexOf(basePlacement) >= 0;
394
+ var len = isVertical ? 'height' : 'width';
395
+
396
+ if (!arrowElement || !popperOffsets) {
397
+ return;
398
+ }
399
+
400
+ var paddingObject = toPaddingObject(options.padding, state);
401
+ var arrowRect = getLayoutRect(arrowElement);
402
+ var minProp = axis === 'y' ? top : left;
403
+ var maxProp = axis === 'y' ? bottom : right;
404
+ var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];
405
+ var startDiff = popperOffsets[axis] - state.rects.reference[axis];
406
+ var arrowOffsetParent = getOffsetParent(arrowElement);
407
+ var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
408
+ var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is
409
+ // outside of the popper bounds
410
+
411
+ var min = paddingObject[minProp];
412
+ var max = clientSize - arrowRect[len] - paddingObject[maxProp];
413
+ var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
414
+ var offset = within(min, center, max); // Prevents breaking syntax highlighting...
415
+
416
+ var axisProp = axis;
417
+ state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);
418
+ }
419
+
420
+ function effect$1(_ref2) {
421
+ var state = _ref2.state,
422
+ options = _ref2.options;
423
+ var _options$element = options.element,
424
+ arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;
425
+
426
+ if (arrowElement == null) {
427
+ return;
428
+ } // CSS selector
429
+
430
+
431
+ if (typeof arrowElement === 'string') {
432
+ arrowElement = state.elements.popper.querySelector(arrowElement);
433
+
434
+ if (!arrowElement) {
435
+ return;
436
+ }
437
+ }
438
+
439
+ if (!contains(state.elements.popper, arrowElement)) {
440
+
441
+ return;
442
+ }
443
+
444
+ state.elements.arrow = arrowElement;
445
+ } // eslint-disable-next-line import/no-unused-modules
446
+
447
+
448
+ var arrow$1 = {
449
+ name: 'arrow',
450
+ enabled: true,
451
+ phase: 'main',
452
+ fn: arrow,
453
+ effect: effect$1,
454
+ requires: ['popperOffsets'],
455
+ requiresIfExists: ['preventOverflow']
456
+ };
457
+
458
+ function getVariation(placement) {
459
+ return placement.split('-')[1];
460
+ }
461
+
462
+ var unsetSides = {
463
+ top: 'auto',
464
+ right: 'auto',
465
+ bottom: 'auto',
466
+ left: 'auto'
467
+ }; // Round the offsets to the nearest suitable subpixel based on the DPR.
468
+ // Zooming can change the DPR, but it seems to report a value that will
469
+ // cleanly divide the values into the appropriate subpixels.
470
+
471
+ function roundOffsetsByDPR(_ref) {
472
+ var x = _ref.x,
473
+ y = _ref.y;
474
+ var win = window;
475
+ var dpr = win.devicePixelRatio || 1;
476
+ return {
477
+ x: round(x * dpr) / dpr || 0,
478
+ y: round(y * dpr) / dpr || 0
479
+ };
480
+ }
481
+
482
+ function mapToStyles(_ref2) {
483
+ var _Object$assign2;
484
+
485
+ var popper = _ref2.popper,
486
+ popperRect = _ref2.popperRect,
487
+ placement = _ref2.placement,
488
+ variation = _ref2.variation,
489
+ offsets = _ref2.offsets,
490
+ position = _ref2.position,
491
+ gpuAcceleration = _ref2.gpuAcceleration,
492
+ adaptive = _ref2.adaptive,
493
+ roundOffsets = _ref2.roundOffsets,
494
+ isFixed = _ref2.isFixed;
495
+
496
+ var _ref3 = roundOffsets === true ? roundOffsetsByDPR(offsets) : typeof roundOffsets === 'function' ? roundOffsets(offsets) : offsets,
497
+ _ref3$x = _ref3.x,
498
+ x = _ref3$x === void 0 ? 0 : _ref3$x,
499
+ _ref3$y = _ref3.y,
500
+ y = _ref3$y === void 0 ? 0 : _ref3$y;
501
+
502
+ var hasX = offsets.hasOwnProperty('x');
503
+ var hasY = offsets.hasOwnProperty('y');
504
+ var sideX = left;
505
+ var sideY = top;
506
+ var win = window;
507
+
508
+ if (adaptive) {
509
+ var offsetParent = getOffsetParent(popper);
510
+ var heightProp = 'clientHeight';
511
+ var widthProp = 'clientWidth';
512
+
513
+ if (offsetParent === getWindow(popper)) {
514
+ offsetParent = getDocumentElement(popper);
515
+
516
+ if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {
517
+ heightProp = 'scrollHeight';
518
+ widthProp = 'scrollWidth';
519
+ }
520
+ } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
521
+
522
+
523
+ offsetParent = offsetParent;
524
+
525
+ if (placement === top || (placement === left || placement === right) && variation === end) {
526
+ sideY = bottom;
527
+ var offsetY = isFixed && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
528
+ offsetParent[heightProp];
529
+ y -= offsetY - popperRect.height;
530
+ y *= gpuAcceleration ? 1 : -1;
531
+ }
532
+
533
+ if (placement === left || (placement === top || placement === bottom) && variation === end) {
534
+ sideX = right;
535
+ var offsetX = isFixed && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
536
+ offsetParent[widthProp];
537
+ x -= offsetX - popperRect.width;
538
+ x *= gpuAcceleration ? 1 : -1;
539
+ }
540
+ }
541
+
542
+ var commonStyles = Object.assign({
543
+ position: position
544
+ }, adaptive && unsetSides);
545
+
546
+ if (gpuAcceleration) {
547
+ var _Object$assign;
548
+
549
+ return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
550
+ }
551
+
552
+ return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
553
+ }
554
+
555
+ function computeStyles(_ref4) {
556
+ var state = _ref4.state,
557
+ options = _ref4.options;
558
+ var _options$gpuAccelerat = options.gpuAcceleration,
559
+ gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
560
+ _options$adaptive = options.adaptive,
561
+ adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
562
+ _options$roundOffsets = options.roundOffsets,
563
+ roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
564
+
565
+ var commonStyles = {
566
+ placement: getBasePlacement(state.placement),
567
+ variation: getVariation(state.placement),
568
+ popper: state.elements.popper,
569
+ popperRect: state.rects.popper,
570
+ gpuAcceleration: gpuAcceleration,
571
+ isFixed: state.options.strategy === 'fixed'
572
+ };
573
+
574
+ if (state.modifiersData.popperOffsets != null) {
575
+ state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
576
+ offsets: state.modifiersData.popperOffsets,
577
+ position: state.options.strategy,
578
+ adaptive: adaptive,
579
+ roundOffsets: roundOffsets
580
+ })));
581
+ }
582
+
583
+ if (state.modifiersData.arrow != null) {
584
+ state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
585
+ offsets: state.modifiersData.arrow,
586
+ position: 'absolute',
587
+ adaptive: false,
588
+ roundOffsets: roundOffsets
589
+ })));
590
+ }
591
+
592
+ state.attributes.popper = Object.assign({}, state.attributes.popper, {
593
+ 'data-popper-placement': state.placement
594
+ });
595
+ } // eslint-disable-next-line import/no-unused-modules
596
+
597
+
598
+ var computeStyles$1 = {
599
+ name: 'computeStyles',
600
+ enabled: true,
601
+ phase: 'beforeWrite',
602
+ fn: computeStyles,
603
+ data: {}
604
+ };
605
+
606
+ var passive = {
607
+ passive: true
608
+ };
609
+
610
+ function effect$2(_ref) {
611
+ var state = _ref.state,
612
+ instance = _ref.instance,
613
+ options = _ref.options;
614
+ var _options$scroll = options.scroll,
615
+ scroll = _options$scroll === void 0 ? true : _options$scroll,
616
+ _options$resize = options.resize,
617
+ resize = _options$resize === void 0 ? true : _options$resize;
618
+ var window = getWindow(state.elements.popper);
619
+ var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
620
+
621
+ if (scroll) {
622
+ scrollParents.forEach(function (scrollParent) {
623
+ scrollParent.addEventListener('scroll', instance.update, passive);
624
+ });
625
+ }
626
+
627
+ if (resize) {
628
+ window.addEventListener('resize', instance.update, passive);
629
+ }
630
+
631
+ return function () {
632
+ if (scroll) {
633
+ scrollParents.forEach(function (scrollParent) {
634
+ scrollParent.removeEventListener('scroll', instance.update, passive);
635
+ });
636
+ }
637
+
638
+ if (resize) {
639
+ window.removeEventListener('resize', instance.update, passive);
640
+ }
641
+ };
642
+ } // eslint-disable-next-line import/no-unused-modules
643
+
644
+
645
+ var eventListeners = {
646
+ name: 'eventListeners',
647
+ enabled: true,
648
+ phase: 'write',
649
+ fn: function fn() {},
650
+ effect: effect$2,
651
+ data: {}
652
+ };
653
+
654
+ var hash = {
655
+ left: 'right',
656
+ right: 'left',
657
+ bottom: 'top',
658
+ top: 'bottom'
659
+ };
660
+ function getOppositePlacement(placement) {
661
+ return placement.replace(/left|right|bottom|top/g, function (matched) {
662
+ return hash[matched];
663
+ });
664
+ }
665
+
666
+ var hash$1 = {
667
+ start: 'end',
668
+ end: 'start'
669
+ };
670
+ function getOppositeVariationPlacement(placement) {
671
+ return placement.replace(/start|end/g, function (matched) {
672
+ return hash$1[matched];
673
+ });
674
+ }
675
+
676
+ function getWindowScroll(node) {
677
+ var win = getWindow(node);
678
+ var scrollLeft = win.pageXOffset;
679
+ var scrollTop = win.pageYOffset;
680
+ return {
681
+ scrollLeft: scrollLeft,
682
+ scrollTop: scrollTop
683
+ };
684
+ }
685
+
686
+ function getWindowScrollBarX(element) {
687
+ // If <html> has a CSS width greater than the viewport, then this will be
688
+ // incorrect for RTL.
689
+ // Popper 1 is broken in this case and never had a bug report so let's assume
690
+ // it's not an issue. I don't think anyone ever specifies width on <html>
691
+ // anyway.
692
+ // Browsers where the left scrollbar doesn't cause an issue report `0` for
693
+ // this (e.g. Edge 2019, IE11, Safari)
694
+ return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
695
+ }
696
+
697
+ function getViewportRect(element) {
698
+ var win = getWindow(element);
699
+ var html = getDocumentElement(element);
700
+ var visualViewport = win.visualViewport;
701
+ var width = html.clientWidth;
702
+ var height = html.clientHeight;
703
+ var x = 0;
704
+ var y = 0; // NB: This isn't supported on iOS <= 12. If the keyboard is open, the popper
705
+ // can be obscured underneath it.
706
+ // Also, `html.clientHeight` adds the bottom bar height in Safari iOS, even
707
+ // if it isn't open, so if this isn't available, the popper will be detected
708
+ // to overflow the bottom of the screen too early.
709
+
710
+ if (visualViewport) {
711
+ width = visualViewport.width;
712
+ height = visualViewport.height; // Uses Layout Viewport (like Chrome; Safari does not currently)
713
+ // In Chrome, it returns a value very close to 0 (+/-) but contains rounding
714
+ // errors due to floating point numbers, so we need to check precision.
715
+ // Safari returns a number <= 0, usually < -1 when pinch-zoomed
716
+ // Feature detection fails in mobile emulation mode in Chrome.
717
+ // Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) <
718
+ // 0.001
719
+ // Fallback here: "Not Safari" userAgent
720
+
721
+ if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
722
+ x = visualViewport.offsetLeft;
723
+ y = visualViewport.offsetTop;
724
+ }
725
+ }
726
+
727
+ return {
728
+ width: width,
729
+ height: height,
730
+ x: x + getWindowScrollBarX(element),
731
+ y: y
732
+ };
733
+ }
734
+
735
+ // of the `<html>` and `<body>` rect bounds if horizontally scrollable
736
+
737
+ function getDocumentRect(element) {
738
+ var _element$ownerDocumen;
739
+
740
+ var html = getDocumentElement(element);
741
+ var winScroll = getWindowScroll(element);
742
+ var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
743
+ var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
744
+ var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
745
+ var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
746
+ var y = -winScroll.scrollTop;
747
+
748
+ if (getComputedStyle(body || html).direction === 'rtl') {
749
+ x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
750
+ }
751
+
752
+ return {
753
+ width: width,
754
+ height: height,
755
+ x: x,
756
+ y: y
757
+ };
758
+ }
759
+
760
+ function isScrollParent(element) {
761
+ // Firefox wants us to check `-x` and `-y` variations as well
762
+ var _getComputedStyle = getComputedStyle(element),
763
+ overflow = _getComputedStyle.overflow,
764
+ overflowX = _getComputedStyle.overflowX,
765
+ overflowY = _getComputedStyle.overflowY;
766
+
767
+ return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
768
+ }
769
+
770
+ function getScrollParent(node) {
771
+ if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
772
+ // $FlowFixMe[incompatible-return]: assume body is always available
773
+ return node.ownerDocument.body;
774
+ }
775
+
776
+ if (isHTMLElement(node) && isScrollParent(node)) {
777
+ return node;
778
+ }
779
+
780
+ return getScrollParent(getParentNode(node));
781
+ }
782
+
783
+ /*
784
+ given a DOM element, return the list of all scroll parents, up the list of ancesors
785
+ until we get to the top window object. This list is what we attach scroll listeners
786
+ to, because if any of these parent elements scroll, we'll need to re-calculate the
787
+ reference element's position.
788
+ */
789
+
790
+ function listScrollParents(element, list) {
791
+ var _element$ownerDocumen;
792
+
793
+ if (list === void 0) {
794
+ list = [];
795
+ }
796
+
797
+ var scrollParent = getScrollParent(element);
798
+ var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
799
+ var win = getWindow(scrollParent);
800
+ var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
801
+ var updatedList = list.concat(target);
802
+ return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
803
+ updatedList.concat(listScrollParents(getParentNode(target)));
804
+ }
805
+
806
+ function rectToClientRect(rect) {
807
+ return Object.assign({}, rect, {
808
+ left: rect.x,
809
+ top: rect.y,
810
+ right: rect.x + rect.width,
811
+ bottom: rect.y + rect.height
812
+ });
813
+ }
814
+
815
+ function getInnerBoundingClientRect(element) {
816
+ var rect = getBoundingClientRect(element);
817
+ rect.top = rect.top + element.clientTop;
818
+ rect.left = rect.left + element.clientLeft;
819
+ rect.bottom = rect.top + element.clientHeight;
820
+ rect.right = rect.left + element.clientWidth;
821
+ rect.width = element.clientWidth;
822
+ rect.height = element.clientHeight;
823
+ rect.x = rect.left;
824
+ rect.y = rect.top;
825
+ return rect;
826
+ }
827
+
828
+ function getClientRectFromMixedType(element, clippingParent) {
829
+ return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
830
+ } // A "clipping parent" is an overflowable container with the characteristic of
831
+ // clipping (or hiding) overflowing elements with a position different from
832
+ // `initial`
833
+
834
+
835
+ function getClippingParents(element) {
836
+ var clippingParents = listScrollParents(getParentNode(element));
837
+ var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;
838
+ var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
839
+
840
+ if (!isElement(clipperElement)) {
841
+ return [];
842
+ } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
843
+
844
+
845
+ return clippingParents.filter(function (clippingParent) {
846
+ return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body' && (canEscapeClipping ? getComputedStyle(clippingParent).position !== 'static' : true);
847
+ });
848
+ } // Gets the maximum area that the element is visible in due to any number of
849
+ // clipping parents
850
+
851
+
852
+ function getClippingRect(element, boundary, rootBoundary) {
853
+ var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
854
+ var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
855
+ var firstClippingParent = clippingParents[0];
856
+ var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
857
+ var rect = getClientRectFromMixedType(element, clippingParent);
858
+ accRect.top = max(rect.top, accRect.top);
859
+ accRect.right = min(rect.right, accRect.right);
860
+ accRect.bottom = min(rect.bottom, accRect.bottom);
861
+ accRect.left = max(rect.left, accRect.left);
862
+ return accRect;
863
+ }, getClientRectFromMixedType(element, firstClippingParent));
864
+ clippingRect.width = clippingRect.right - clippingRect.left;
865
+ clippingRect.height = clippingRect.bottom - clippingRect.top;
866
+ clippingRect.x = clippingRect.left;
867
+ clippingRect.y = clippingRect.top;
868
+ return clippingRect;
869
+ }
870
+
871
+ function computeOffsets(_ref) {
872
+ var reference = _ref.reference,
873
+ element = _ref.element,
874
+ placement = _ref.placement;
875
+ var basePlacement = placement ? getBasePlacement(placement) : null;
876
+ var variation = placement ? getVariation(placement) : null;
877
+ var commonX = reference.x + reference.width / 2 - element.width / 2;
878
+ var commonY = reference.y + reference.height / 2 - element.height / 2;
879
+ var offsets;
880
+
881
+ switch (basePlacement) {
882
+ case top:
883
+ offsets = {
884
+ x: commonX,
885
+ y: reference.y - element.height
886
+ };
887
+ break;
888
+
889
+ case bottom:
890
+ offsets = {
891
+ x: commonX,
892
+ y: reference.y + reference.height
893
+ };
894
+ break;
895
+
896
+ case right:
897
+ offsets = {
898
+ x: reference.x + reference.width,
899
+ y: commonY
900
+ };
901
+ break;
902
+
903
+ case left:
904
+ offsets = {
905
+ x: reference.x - element.width,
906
+ y: commonY
907
+ };
908
+ break;
909
+
910
+ default:
911
+ offsets = {
912
+ x: reference.x,
913
+ y: reference.y
914
+ };
915
+ }
916
+
917
+ var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
918
+
919
+ if (mainAxis != null) {
920
+ var len = mainAxis === 'y' ? 'height' : 'width';
921
+
922
+ switch (variation) {
923
+ case start:
924
+ offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
925
+ break;
926
+
927
+ case end:
928
+ offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
929
+ break;
930
+ }
931
+ }
932
+
933
+ return offsets;
934
+ }
935
+
936
+ function detectOverflow(state, options) {
937
+ if (options === void 0) {
938
+ options = {};
939
+ }
940
+
941
+ var _options = options,
942
+ _options$placement = _options.placement,
943
+ placement = _options$placement === void 0 ? state.placement : _options$placement,
944
+ _options$boundary = _options.boundary,
945
+ boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
946
+ _options$rootBoundary = _options.rootBoundary,
947
+ rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,
948
+ _options$elementConte = _options.elementContext,
949
+ elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,
950
+ _options$altBoundary = _options.altBoundary,
951
+ altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,
952
+ _options$padding = _options.padding,
953
+ padding = _options$padding === void 0 ? 0 : _options$padding;
954
+ var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
955
+ var altContext = elementContext === popper ? reference : popper;
956
+ var popperRect = state.rects.popper;
957
+ var element = state.elements[altBoundary ? altContext : elementContext];
958
+ var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
959
+ var referenceClientRect = getBoundingClientRect(state.elements.reference);
960
+ var popperOffsets = computeOffsets({
961
+ reference: referenceClientRect,
962
+ element: popperRect,
963
+ strategy: 'absolute',
964
+ placement: placement
965
+ });
966
+ var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
967
+ var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
968
+ // 0 or negative = within the clipping rect
969
+
970
+ var overflowOffsets = {
971
+ top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
972
+ bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
973
+ left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
974
+ right: elementClientRect.right - clippingClientRect.right + paddingObject.right
975
+ };
976
+ var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element
977
+
978
+ if (elementContext === popper && offsetData) {
979
+ var offset = offsetData[placement];
980
+ Object.keys(overflowOffsets).forEach(function (key) {
981
+ var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
982
+ var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';
983
+ overflowOffsets[key] += offset[axis] * multiply;
984
+ });
985
+ }
986
+
987
+ return overflowOffsets;
988
+ }
989
+
990
+ function computeAutoPlacement(state, options) {
991
+ if (options === void 0) {
992
+ options = {};
993
+ }
994
+
995
+ var _options = options,
996
+ placement = _options.placement,
997
+ boundary = _options.boundary,
998
+ rootBoundary = _options.rootBoundary,
999
+ padding = _options.padding,
1000
+ flipVariations = _options.flipVariations,
1001
+ _options$allowedAutoP = _options.allowedAutoPlacements,
1002
+ allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
1003
+ var variation = getVariation(placement);
1004
+ var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {
1005
+ return getVariation(placement) === variation;
1006
+ }) : basePlacements;
1007
+ var allowedPlacements = placements$1.filter(function (placement) {
1008
+ return allowedAutoPlacements.indexOf(placement) >= 0;
1009
+ });
1010
+
1011
+ if (allowedPlacements.length === 0) {
1012
+ allowedPlacements = placements$1;
1013
+ } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...
1014
+
1015
+
1016
+ var overflows = allowedPlacements.reduce(function (acc, placement) {
1017
+ acc[placement] = detectOverflow(state, {
1018
+ placement: placement,
1019
+ boundary: boundary,
1020
+ rootBoundary: rootBoundary,
1021
+ padding: padding
1022
+ })[getBasePlacement(placement)];
1023
+ return acc;
1024
+ }, {});
1025
+ return Object.keys(overflows).sort(function (a, b) {
1026
+ return overflows[a] - overflows[b];
1027
+ });
1028
+ }
1029
+
1030
+ function getExpandedFallbackPlacements(placement) {
1031
+ if (getBasePlacement(placement) === auto) {
1032
+ return [];
1033
+ }
1034
+
1035
+ var oppositePlacement = getOppositePlacement(placement);
1036
+ return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
1037
+ }
1038
+
1039
+ function flip(_ref) {
1040
+ var state = _ref.state,
1041
+ options = _ref.options,
1042
+ name = _ref.name;
1043
+
1044
+ if (state.modifiersData[name]._skip) {
1045
+ return;
1046
+ }
1047
+
1048
+ var _options$mainAxis = options.mainAxis,
1049
+ checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
1050
+ _options$altAxis = options.altAxis,
1051
+ checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,
1052
+ specifiedFallbackPlacements = options.fallbackPlacements,
1053
+ padding = options.padding,
1054
+ boundary = options.boundary,
1055
+ rootBoundary = options.rootBoundary,
1056
+ altBoundary = options.altBoundary,
1057
+ _options$flipVariatio = options.flipVariations,
1058
+ flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,
1059
+ allowedAutoPlacements = options.allowedAutoPlacements;
1060
+ var preferredPlacement = state.options.placement;
1061
+ var basePlacement = getBasePlacement(preferredPlacement);
1062
+ var isBasePlacement = basePlacement === preferredPlacement;
1063
+ var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
1064
+ var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {
1065
+ return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {
1066
+ placement: placement,
1067
+ boundary: boundary,
1068
+ rootBoundary: rootBoundary,
1069
+ padding: padding,
1070
+ flipVariations: flipVariations,
1071
+ allowedAutoPlacements: allowedAutoPlacements
1072
+ }) : placement);
1073
+ }, []);
1074
+ var referenceRect = state.rects.reference;
1075
+ var popperRect = state.rects.popper;
1076
+ var checksMap = new Map();
1077
+ var makeFallbackChecks = true;
1078
+ var firstFittingPlacement = placements[0];
1079
+
1080
+ for (var i = 0; i < placements.length; i++) {
1081
+ var placement = placements[i];
1082
+
1083
+ var _basePlacement = getBasePlacement(placement);
1084
+
1085
+ var isStartVariation = getVariation(placement) === start;
1086
+ var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
1087
+ var len = isVertical ? 'width' : 'height';
1088
+ var overflow = detectOverflow(state, {
1089
+ placement: placement,
1090
+ boundary: boundary,
1091
+ rootBoundary: rootBoundary,
1092
+ altBoundary: altBoundary,
1093
+ padding: padding
1094
+ });
1095
+ var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
1096
+
1097
+ if (referenceRect[len] > popperRect[len]) {
1098
+ mainVariationSide = getOppositePlacement(mainVariationSide);
1099
+ }
1100
+
1101
+ var altVariationSide = getOppositePlacement(mainVariationSide);
1102
+ var checks = [];
1103
+
1104
+ if (checkMainAxis) {
1105
+ checks.push(overflow[_basePlacement] <= 0);
1106
+ }
1107
+
1108
+ if (checkAltAxis) {
1109
+ checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
1110
+ }
1111
+
1112
+ if (checks.every(function (check) {
1113
+ return check;
1114
+ })) {
1115
+ firstFittingPlacement = placement;
1116
+ makeFallbackChecks = false;
1117
+ break;
1118
+ }
1119
+
1120
+ checksMap.set(placement, checks);
1121
+ }
1122
+
1123
+ if (makeFallbackChecks) {
1124
+ // `2` may be desired in some cases – research later
1125
+ var numberOfChecks = flipVariations ? 3 : 1;
1126
+
1127
+ var _loop = function _loop(_i) {
1128
+ var fittingPlacement = placements.find(function (placement) {
1129
+ var checks = checksMap.get(placement);
1130
+
1131
+ if (checks) {
1132
+ return checks.slice(0, _i).every(function (check) {
1133
+ return check;
1134
+ });
1135
+ }
1136
+ });
1137
+
1138
+ if (fittingPlacement) {
1139
+ firstFittingPlacement = fittingPlacement;
1140
+ return "break";
1141
+ }
1142
+ };
1143
+
1144
+ for (var _i = numberOfChecks; _i > 0; _i--) {
1145
+ var _ret = _loop(_i);
1146
+
1147
+ if (_ret === "break") break;
1148
+ }
1149
+ }
1150
+
1151
+ if (state.placement !== firstFittingPlacement) {
1152
+ state.modifiersData[name]._skip = true;
1153
+ state.placement = firstFittingPlacement;
1154
+ state.reset = true;
1155
+ }
1156
+ } // eslint-disable-next-line import/no-unused-modules
1157
+
1158
+
1159
+ var flip$1 = {
1160
+ name: 'flip',
1161
+ enabled: true,
1162
+ phase: 'main',
1163
+ fn: flip,
1164
+ requiresIfExists: ['offset'],
1165
+ data: {
1166
+ _skip: false
1167
+ }
1168
+ };
1169
+
1170
+ function getSideOffsets(overflow, rect, preventedOffsets) {
1171
+ if (preventedOffsets === void 0) {
1172
+ preventedOffsets = {
1173
+ x: 0,
1174
+ y: 0
1175
+ };
1176
+ }
1177
+
1178
+ return {
1179
+ top: overflow.top - rect.height - preventedOffsets.y,
1180
+ right: overflow.right - rect.width + preventedOffsets.x,
1181
+ bottom: overflow.bottom - rect.height + preventedOffsets.y,
1182
+ left: overflow.left - rect.width - preventedOffsets.x
1183
+ };
1184
+ }
1185
+
1186
+ function isAnySideFullyClipped(overflow) {
1187
+ return [top, right, bottom, left].some(function (side) {
1188
+ return overflow[side] >= 0;
1189
+ });
1190
+ }
1191
+
1192
+ function hide(_ref) {
1193
+ var state = _ref.state,
1194
+ name = _ref.name;
1195
+ var referenceRect = state.rects.reference;
1196
+ var popperRect = state.rects.popper;
1197
+ var preventedOffsets = state.modifiersData.preventOverflow;
1198
+ var referenceOverflow = detectOverflow(state, {
1199
+ elementContext: 'reference'
1200
+ });
1201
+ var popperAltOverflow = detectOverflow(state, {
1202
+ altBoundary: true
1203
+ });
1204
+ var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
1205
+ var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
1206
+ var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
1207
+ var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
1208
+ state.modifiersData[name] = {
1209
+ referenceClippingOffsets: referenceClippingOffsets,
1210
+ popperEscapeOffsets: popperEscapeOffsets,
1211
+ isReferenceHidden: isReferenceHidden,
1212
+ hasPopperEscaped: hasPopperEscaped
1213
+ };
1214
+ state.attributes.popper = Object.assign({}, state.attributes.popper, {
1215
+ 'data-popper-reference-hidden': isReferenceHidden,
1216
+ 'data-popper-escaped': hasPopperEscaped
1217
+ });
1218
+ } // eslint-disable-next-line import/no-unused-modules
1219
+
1220
+
1221
+ var hide$1 = {
1222
+ name: 'hide',
1223
+ enabled: true,
1224
+ phase: 'main',
1225
+ requiresIfExists: ['preventOverflow'],
1226
+ fn: hide
1227
+ };
1228
+
1229
+ function distanceAndSkiddingToXY(placement, rects, offset) {
1230
+ var basePlacement = getBasePlacement(placement);
1231
+ var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
1232
+
1233
+ var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {
1234
+ placement: placement
1235
+ })) : offset,
1236
+ skidding = _ref[0],
1237
+ distance = _ref[1];
1238
+
1239
+ skidding = skidding || 0;
1240
+ distance = (distance || 0) * invertDistance;
1241
+ return [left, right].indexOf(basePlacement) >= 0 ? {
1242
+ x: distance,
1243
+ y: skidding
1244
+ } : {
1245
+ x: skidding,
1246
+ y: distance
1247
+ };
1248
+ }
1249
+
1250
+ function offset(_ref2) {
1251
+ var state = _ref2.state,
1252
+ options = _ref2.options,
1253
+ name = _ref2.name;
1254
+ var _options$offset = options.offset,
1255
+ offset = _options$offset === void 0 ? [0, 0] : _options$offset;
1256
+ var data = placements.reduce(function (acc, placement) {
1257
+ acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);
1258
+ return acc;
1259
+ }, {});
1260
+ var _data$state$placement = data[state.placement],
1261
+ x = _data$state$placement.x,
1262
+ y = _data$state$placement.y;
1263
+
1264
+ if (state.modifiersData.popperOffsets != null) {
1265
+ state.modifiersData.popperOffsets.x += x;
1266
+ state.modifiersData.popperOffsets.y += y;
1267
+ }
1268
+
1269
+ state.modifiersData[name] = data;
1270
+ } // eslint-disable-next-line import/no-unused-modules
1271
+
1272
+
1273
+ var offset$1 = {
1274
+ name: 'offset',
1275
+ enabled: true,
1276
+ phase: 'main',
1277
+ requires: ['popperOffsets'],
1278
+ fn: offset
1279
+ };
1280
+
1281
+ function popperOffsets(_ref) {
1282
+ var state = _ref.state,
1283
+ name = _ref.name;
1284
+ // Offsets are the actual position the popper needs to have to be
1285
+ // properly positioned near its reference element
1286
+ // This is the most basic placement, and will be adjusted by
1287
+ // the modifiers in the next step
1288
+ state.modifiersData[name] = computeOffsets({
1289
+ reference: state.rects.reference,
1290
+ element: state.rects.popper,
1291
+ strategy: 'absolute',
1292
+ placement: state.placement
1293
+ });
1294
+ } // eslint-disable-next-line import/no-unused-modules
1295
+
1296
+
1297
+ var popperOffsets$1 = {
1298
+ name: 'popperOffsets',
1299
+ enabled: true,
1300
+ phase: 'read',
1301
+ fn: popperOffsets,
1302
+ data: {}
1303
+ };
1304
+
1305
+ function getAltAxis(axis) {
1306
+ return axis === 'x' ? 'y' : 'x';
1307
+ }
1308
+
1309
+ function preventOverflow(_ref) {
1310
+ var state = _ref.state,
1311
+ options = _ref.options,
1312
+ name = _ref.name;
1313
+ var _options$mainAxis = options.mainAxis,
1314
+ checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
1315
+ _options$altAxis = options.altAxis,
1316
+ checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,
1317
+ boundary = options.boundary,
1318
+ rootBoundary = options.rootBoundary,
1319
+ altBoundary = options.altBoundary,
1320
+ padding = options.padding,
1321
+ _options$tether = options.tether,
1322
+ tether = _options$tether === void 0 ? true : _options$tether,
1323
+ _options$tetherOffset = options.tetherOffset,
1324
+ tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
1325
+ var overflow = detectOverflow(state, {
1326
+ boundary: boundary,
1327
+ rootBoundary: rootBoundary,
1328
+ padding: padding,
1329
+ altBoundary: altBoundary
1330
+ });
1331
+ var basePlacement = getBasePlacement(state.placement);
1332
+ var variation = getVariation(state.placement);
1333
+ var isBasePlacement = !variation;
1334
+ var mainAxis = getMainAxisFromPlacement(basePlacement);
1335
+ var altAxis = getAltAxis(mainAxis);
1336
+ var popperOffsets = state.modifiersData.popperOffsets;
1337
+ var referenceRect = state.rects.reference;
1338
+ var popperRect = state.rects.popper;
1339
+ var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
1340
+ placement: state.placement
1341
+ })) : tetherOffset;
1342
+ var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {
1343
+ mainAxis: tetherOffsetValue,
1344
+ altAxis: tetherOffsetValue
1345
+ } : Object.assign({
1346
+ mainAxis: 0,
1347
+ altAxis: 0
1348
+ }, tetherOffsetValue);
1349
+ var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
1350
+ var data = {
1351
+ x: 0,
1352
+ y: 0
1353
+ };
1354
+
1355
+ if (!popperOffsets) {
1356
+ return;
1357
+ }
1358
+
1359
+ if (checkMainAxis) {
1360
+ var _offsetModifierState$;
1361
+
1362
+ var mainSide = mainAxis === 'y' ? top : left;
1363
+ var altSide = mainAxis === 'y' ? bottom : right;
1364
+ var len = mainAxis === 'y' ? 'height' : 'width';
1365
+ var offset = popperOffsets[mainAxis];
1366
+ var min$1 = offset + overflow[mainSide];
1367
+ var max$1 = offset - overflow[altSide];
1368
+ var additive = tether ? -popperRect[len] / 2 : 0;
1369
+ var minLen = variation === start ? referenceRect[len] : popperRect[len];
1370
+ var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
1371
+ // outside the reference bounds
1372
+
1373
+ var arrowElement = state.elements.arrow;
1374
+ var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
1375
+ width: 0,
1376
+ height: 0
1377
+ };
1378
+ var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();
1379
+ var arrowPaddingMin = arrowPaddingObject[mainSide];
1380
+ var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want
1381
+ // to include its full size in the calculation. If the reference is small
1382
+ // and near the edge of a boundary, the popper can overflow even if the
1383
+ // reference is not overflowing as well (e.g. virtual elements with no
1384
+ // width or height)
1385
+
1386
+ var arrowLen = within(0, referenceRect[len], arrowRect[len]);
1387
+ var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
1388
+ var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
1389
+ var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
1390
+ var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
1391
+ var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
1392
+ var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;
1393
+ var tetherMax = offset + maxOffset - offsetModifierValue;
1394
+ var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
1395
+ popperOffsets[mainAxis] = preventedOffset;
1396
+ data[mainAxis] = preventedOffset - offset;
1397
+ }
1398
+
1399
+ if (checkAltAxis) {
1400
+ var _offsetModifierState$2;
1401
+
1402
+ var _mainSide = mainAxis === 'x' ? top : left;
1403
+
1404
+ var _altSide = mainAxis === 'x' ? bottom : right;
1405
+
1406
+ var _offset = popperOffsets[altAxis];
1407
+
1408
+ var _len = altAxis === 'y' ? 'height' : 'width';
1409
+
1410
+ var _min = _offset + overflow[_mainSide];
1411
+
1412
+ var _max = _offset - overflow[_altSide];
1413
+
1414
+ var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
1415
+
1416
+ var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
1417
+
1418
+ var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
1419
+
1420
+ var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
1421
+
1422
+ var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
1423
+
1424
+ popperOffsets[altAxis] = _preventedOffset;
1425
+ data[altAxis] = _preventedOffset - _offset;
1426
+ }
1427
+
1428
+ state.modifiersData[name] = data;
1429
+ } // eslint-disable-next-line import/no-unused-modules
1430
+
1431
+
1432
+ var preventOverflow$1 = {
1433
+ name: 'preventOverflow',
1434
+ enabled: true,
1435
+ phase: 'main',
1436
+ fn: preventOverflow,
1437
+ requiresIfExists: ['offset']
1438
+ };
1439
+
1440
+ function getHTMLElementScroll(element) {
1441
+ return {
1442
+ scrollLeft: element.scrollLeft,
1443
+ scrollTop: element.scrollTop
1444
+ };
1445
+ }
1446
+
1447
+ function getNodeScroll(node) {
1448
+ if (node === getWindow(node) || !isHTMLElement(node)) {
1449
+ return getWindowScroll(node);
1450
+ } else {
1451
+ return getHTMLElementScroll(node);
1452
+ }
1453
+ }
1454
+
1455
+ function isElementScaled(element) {
1456
+ var rect = element.getBoundingClientRect();
1457
+ var scaleX = round(rect.width) / element.offsetWidth || 1;
1458
+ var scaleY = round(rect.height) / element.offsetHeight || 1;
1459
+ return scaleX !== 1 || scaleY !== 1;
1460
+ } // Returns the composite rect of an element relative to its offsetParent.
1461
+ // Composite means it takes into account transforms as well as layout.
1462
+
1463
+
1464
+ function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
1465
+ if (isFixed === void 0) {
1466
+ isFixed = false;
1467
+ }
1468
+
1469
+ var isOffsetParentAnElement = isHTMLElement(offsetParent);
1470
+ var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
1471
+ var documentElement = getDocumentElement(offsetParent);
1472
+ var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
1473
+ var scroll = {
1474
+ scrollLeft: 0,
1475
+ scrollTop: 0
1476
+ };
1477
+ var offsets = {
1478
+ x: 0,
1479
+ y: 0
1480
+ };
1481
+
1482
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1483
+ if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
1484
+ isScrollParent(documentElement)) {
1485
+ scroll = getNodeScroll(offsetParent);
1486
+ }
1487
+
1488
+ if (isHTMLElement(offsetParent)) {
1489
+ offsets = getBoundingClientRect(offsetParent, true);
1490
+ offsets.x += offsetParent.clientLeft;
1491
+ offsets.y += offsetParent.clientTop;
1492
+ } else if (documentElement) {
1493
+ offsets.x = getWindowScrollBarX(documentElement);
1494
+ }
1495
+ }
1496
+
1497
+ return {
1498
+ x: rect.left + scroll.scrollLeft - offsets.x,
1499
+ y: rect.top + scroll.scrollTop - offsets.y,
1500
+ width: rect.width,
1501
+ height: rect.height
1502
+ };
1503
+ }
1504
+
1505
+ function order(modifiers) {
1506
+ var map = new Map();
1507
+ var visited = new Set();
1508
+ var result = [];
1509
+ modifiers.forEach(function (modifier) {
1510
+ map.set(modifier.name, modifier);
1511
+ }); // On visiting object, check for its dependencies and visit them recursively
1512
+
1513
+ function sort(modifier) {
1514
+ visited.add(modifier.name);
1515
+ var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
1516
+ requires.forEach(function (dep) {
1517
+ if (!visited.has(dep)) {
1518
+ var depModifier = map.get(dep);
1519
+
1520
+ if (depModifier) {
1521
+ sort(depModifier);
1522
+ }
1523
+ }
1524
+ });
1525
+ result.push(modifier);
1526
+ }
1527
+
1528
+ modifiers.forEach(function (modifier) {
1529
+ if (!visited.has(modifier.name)) {
1530
+ // check for visited object
1531
+ sort(modifier);
1532
+ }
1533
+ });
1534
+ return result;
1535
+ }
1536
+
1537
+ function orderModifiers(modifiers) {
1538
+ // order based on dependencies
1539
+ var orderedModifiers = order(modifiers); // order based on phase
1540
+
1541
+ return modifierPhases.reduce(function (acc, phase) {
1542
+ return acc.concat(orderedModifiers.filter(function (modifier) {
1543
+ return modifier.phase === phase;
1544
+ }));
1545
+ }, []);
1546
+ }
1547
+
1548
+ function debounce(fn) {
1549
+ var pending;
1550
+ return function () {
1551
+ if (!pending) {
1552
+ pending = new Promise(function (resolve) {
1553
+ Promise.resolve().then(function () {
1554
+ pending = undefined;
1555
+ resolve(fn());
1556
+ });
1557
+ });
1558
+ }
1559
+
1560
+ return pending;
1561
+ };
1562
+ }
1563
+
1564
+ function mergeByName(modifiers) {
1565
+ var merged = modifiers.reduce(function (merged, current) {
1566
+ var existing = merged[current.name];
1567
+ merged[current.name] = existing ? Object.assign({}, existing, current, {
1568
+ options: Object.assign({}, existing.options, current.options),
1569
+ data: Object.assign({}, existing.data, current.data)
1570
+ }) : current;
1571
+ return merged;
1572
+ }, {}); // IE11 does not support Object.values
1573
+
1574
+ return Object.keys(merged).map(function (key) {
1575
+ return merged[key];
1576
+ });
1577
+ }
1578
+
1579
+ var DEFAULT_OPTIONS = {
1580
+ placement: 'bottom',
1581
+ modifiers: [],
1582
+ strategy: 'absolute'
1583
+ };
1584
+
1585
+ function areValidElements() {
1586
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1587
+ args[_key] = arguments[_key];
1588
+ }
1589
+
1590
+ return !args.some(function (element) {
1591
+ return !(element && typeof element.getBoundingClientRect === 'function');
1592
+ });
1593
+ }
1594
+
1595
+ function popperGenerator(generatorOptions) {
1596
+ if (generatorOptions === void 0) {
1597
+ generatorOptions = {};
1598
+ }
1599
+
1600
+ var _generatorOptions = generatorOptions,
1601
+ _generatorOptions$def = _generatorOptions.defaultModifiers,
1602
+ defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,
1603
+ _generatorOptions$def2 = _generatorOptions.defaultOptions,
1604
+ defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
1605
+ return function createPopper(reference, popper, options) {
1606
+ if (options === void 0) {
1607
+ options = defaultOptions;
1608
+ }
1609
+
1610
+ var state = {
1611
+ placement: 'bottom',
1612
+ orderedModifiers: [],
1613
+ options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
1614
+ modifiersData: {},
1615
+ elements: {
1616
+ reference: reference,
1617
+ popper: popper
1618
+ },
1619
+ attributes: {},
1620
+ styles: {}
1621
+ };
1622
+ var effectCleanupFns = [];
1623
+ var isDestroyed = false;
1624
+ var instance = {
1625
+ state: state,
1626
+ setOptions: function setOptions(setOptionsAction) {
1627
+ var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
1628
+ cleanupModifierEffects();
1629
+ state.options = Object.assign({}, defaultOptions, state.options, options);
1630
+ state.scrollParents = {
1631
+ reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
1632
+ popper: listScrollParents(popper)
1633
+ }; // Orders the modifiers based on their dependencies and `phase`
1634
+ // properties
1635
+
1636
+ var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers
1637
+
1638
+ state.orderedModifiers = orderedModifiers.filter(function (m) {
1639
+ return m.enabled;
1640
+ }); // Validate the provided modifiers so that the consumer will get warned
1641
+
1642
+ runModifierEffects();
1643
+ return instance.update();
1644
+ },
1645
+ // Sync update – it will always be executed, even if not necessary. This
1646
+ // is useful for low frequency updates where sync behavior simplifies the
1647
+ // logic.
1648
+ // For high frequency updates (e.g. `resize` and `scroll` events), always
1649
+ // prefer the async Popper#update method
1650
+ forceUpdate: function forceUpdate() {
1651
+ if (isDestroyed) {
1652
+ return;
1653
+ }
1654
+
1655
+ var _state$elements = state.elements,
1656
+ reference = _state$elements.reference,
1657
+ popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements
1658
+ // anymore
1659
+
1660
+ if (!areValidElements(reference, popper)) {
1661
+
1662
+ return;
1663
+ } // Store the reference and popper rects to be read by modifiers
1664
+
1665
+
1666
+ state.rects = {
1667
+ reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
1668
+ popper: getLayoutRect(popper)
1669
+ }; // Modifiers have the ability to reset the current update cycle. The
1670
+ // most common use case for this is the `flip` modifier changing the
1671
+ // placement, which then needs to re-run all the modifiers, because the
1672
+ // logic was previously ran for the previous placement and is therefore
1673
+ // stale/incorrect
1674
+
1675
+ state.reset = false;
1676
+ state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier
1677
+ // is filled with the initial data specified by the modifier. This means
1678
+ // it doesn't persist and is fresh on each update.
1679
+ // To ensure persistent data, use `${name}#persistent`
1680
+
1681
+ state.orderedModifiers.forEach(function (modifier) {
1682
+ return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
1683
+ });
1684
+
1685
+ for (var index = 0; index < state.orderedModifiers.length; index++) {
1686
+
1687
+ if (state.reset === true) {
1688
+ state.reset = false;
1689
+ index = -1;
1690
+ continue;
1691
+ }
1692
+
1693
+ var _state$orderedModifie = state.orderedModifiers[index],
1694
+ fn = _state$orderedModifie.fn,
1695
+ _state$orderedModifie2 = _state$orderedModifie.options,
1696
+ _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
1697
+ name = _state$orderedModifie.name;
1698
+
1699
+ if (typeof fn === 'function') {
1700
+ state = fn({
1701
+ state: state,
1702
+ options: _options,
1703
+ name: name,
1704
+ instance: instance
1705
+ }) || state;
1706
+ }
1707
+ }
1708
+ },
1709
+ // Async and optimistically optimized update – it will not be executed if
1710
+ // not necessary (debounced to run at most once-per-tick)
1711
+ update: debounce(function () {
1712
+ return new Promise(function (resolve) {
1713
+ instance.forceUpdate();
1714
+ resolve(state);
1715
+ });
1716
+ }),
1717
+ destroy: function destroy() {
1718
+ cleanupModifierEffects();
1719
+ isDestroyed = true;
1720
+ }
1721
+ };
1722
+
1723
+ if (!areValidElements(reference, popper)) {
1724
+
1725
+ return instance;
1726
+ }
1727
+
1728
+ instance.setOptions(options).then(function (state) {
1729
+ if (!isDestroyed && options.onFirstUpdate) {
1730
+ options.onFirstUpdate(state);
1731
+ }
1732
+ }); // Modifiers have the ability to execute arbitrary code before the first
1733
+ // update cycle runs. They will be executed in the same order as the update
1734
+ // cycle. This is useful when a modifier adds some persistent data that
1735
+ // other modifiers need to use, but the modifier is run after the dependent
1736
+ // one.
1737
+
1738
+ function runModifierEffects() {
1739
+ state.orderedModifiers.forEach(function (_ref3) {
1740
+ var name = _ref3.name,
1741
+ _ref3$options = _ref3.options,
1742
+ options = _ref3$options === void 0 ? {} : _ref3$options,
1743
+ effect = _ref3.effect;
1744
+
1745
+ if (typeof effect === 'function') {
1746
+ var cleanupFn = effect({
1747
+ state: state,
1748
+ name: name,
1749
+ instance: instance,
1750
+ options: options
1751
+ });
1752
+
1753
+ var noopFn = function noopFn() {};
1754
+
1755
+ effectCleanupFns.push(cleanupFn || noopFn);
1756
+ }
1757
+ });
1758
+ }
1759
+
1760
+ function cleanupModifierEffects() {
1761
+ effectCleanupFns.forEach(function (fn) {
1762
+ return fn();
1763
+ });
1764
+ effectCleanupFns = [];
1765
+ }
1766
+
1767
+ return instance;
1768
+ };
1769
+ }
1770
+
1771
+ var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
1772
+ var createPopper = /*#__PURE__*/popperGenerator({
1773
+ defaultModifiers: defaultModifiers
1774
+ }); // eslint-disable-next-line import/no-unused-modules
1775
+
1776
+ /**!
1777
+ * tippy.js v6.3.7
1778
+ * (c) 2017-2021 atomiks
1779
+ * MIT License
1780
+ */
1781
+
1782
+ 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>';
1783
+ var BOX_CLASS = "tippy-box";
1784
+ var CONTENT_CLASS = "tippy-content";
1785
+ var BACKDROP_CLASS = "tippy-backdrop";
1786
+ var ARROW_CLASS = "tippy-arrow";
1787
+ var SVG_ARROW_CLASS = "tippy-svg-arrow";
1788
+ var TOUCH_OPTIONS = {
1789
+ passive: true,
1790
+ capture: true
1791
+ };
1792
+ var TIPPY_DEFAULT_APPEND_TO = function TIPPY_DEFAULT_APPEND_TO() {
1793
+ return document.body;
1794
+ };
1795
+ function getValueAtIndexOrReturn(value, index, defaultValue) {
1796
+ if (Array.isArray(value)) {
1797
+ var v = value[index];
1798
+ return v == null ? Array.isArray(defaultValue) ? defaultValue[index] : defaultValue : v;
1799
+ }
1800
+
1801
+ return value;
1802
+ }
1803
+ function isType(value, type) {
1804
+ var str = {}.toString.call(value);
1805
+ return str.indexOf('[object') === 0 && str.indexOf(type + "]") > -1;
1806
+ }
1807
+ function invokeWithArgsOrReturn(value, args) {
1808
+ return typeof value === 'function' ? value.apply(void 0, args) : value;
1809
+ }
1810
+ function debounce$1(fn, ms) {
1811
+ // Avoid wrapping in `setTimeout` if ms is 0 anyway
1812
+ if (ms === 0) {
1813
+ return fn;
1814
+ }
1815
+
1816
+ var timeout;
1817
+ return function (arg) {
1818
+ clearTimeout(timeout);
1819
+ timeout = setTimeout(function () {
1820
+ fn(arg);
1821
+ }, ms);
1822
+ };
1823
+ }
1824
+ function removeProperties(obj, keys) {
1825
+ var clone = Object.assign({}, obj);
1826
+ keys.forEach(function (key) {
1827
+ delete clone[key];
1828
+ });
1829
+ return clone;
1830
+ }
1831
+ function splitBySpaces(value) {
1832
+ return value.split(/\s+/).filter(Boolean);
1833
+ }
1834
+ function normalizeToArray(value) {
1835
+ return [].concat(value);
1836
+ }
1837
+ function pushIfUnique(arr, value) {
1838
+ if (arr.indexOf(value) === -1) {
1839
+ arr.push(value);
1840
+ }
1841
+ }
1842
+ function unique(arr) {
1843
+ return arr.filter(function (item, index) {
1844
+ return arr.indexOf(item) === index;
1845
+ });
1846
+ }
1847
+ function getBasePlacement$1(placement) {
1848
+ return placement.split('-')[0];
1849
+ }
1850
+ function arrayFrom(value) {
1851
+ return [].slice.call(value);
1852
+ }
1853
+ function removeUndefinedProps(obj) {
1854
+ return Object.keys(obj).reduce(function (acc, key) {
1855
+ if (obj[key] !== undefined) {
1856
+ acc[key] = obj[key];
1857
+ }
1858
+
1859
+ return acc;
1860
+ }, {});
1861
+ }
1862
+
1863
+ function div() {
1864
+ return document.createElement('div');
1865
+ }
1866
+ function isElement$1(value) {
1867
+ return ['Element', 'Fragment'].some(function (type) {
1868
+ return isType(value, type);
1869
+ });
1870
+ }
1871
+ function isNodeList(value) {
1872
+ return isType(value, 'NodeList');
1873
+ }
1874
+ function isMouseEvent(value) {
1875
+ return isType(value, 'MouseEvent');
1876
+ }
1877
+ function isReferenceElement(value) {
1878
+ return !!(value && value._tippy && value._tippy.reference === value);
1879
+ }
1880
+ function getArrayOfElements(value) {
1881
+ if (isElement$1(value)) {
1882
+ return [value];
1883
+ }
1884
+
1885
+ if (isNodeList(value)) {
1886
+ return arrayFrom(value);
1887
+ }
1888
+
1889
+ if (Array.isArray(value)) {
1890
+ return value;
1891
+ }
1892
+
1893
+ return arrayFrom(document.querySelectorAll(value));
1894
+ }
1895
+ function setTransitionDuration(els, value) {
1896
+ els.forEach(function (el) {
1897
+ if (el) {
1898
+ el.style.transitionDuration = value + "ms";
1899
+ }
1900
+ });
1901
+ }
1902
+ function setVisibilityState(els, state) {
1903
+ els.forEach(function (el) {
1904
+ if (el) {
1905
+ el.setAttribute('data-state', state);
1906
+ }
1907
+ });
1908
+ }
1909
+ function getOwnerDocument(elementOrElements) {
1910
+ var _element$ownerDocumen;
1911
+
1912
+ var _normalizeToArray = normalizeToArray(elementOrElements),
1913
+ element = _normalizeToArray[0]; // Elements created via a <template> have an ownerDocument with no reference to the body
1914
+
1915
+
1916
+ return element != null && (_element$ownerDocumen = element.ownerDocument) != null && _element$ownerDocumen.body ? element.ownerDocument : document;
1917
+ }
1918
+ function isCursorOutsideInteractiveBorder(popperTreeData, event) {
1919
+ var clientX = event.clientX,
1920
+ clientY = event.clientY;
1921
+ return popperTreeData.every(function (_ref) {
1922
+ var popperRect = _ref.popperRect,
1923
+ popperState = _ref.popperState,
1924
+ props = _ref.props;
1925
+ var interactiveBorder = props.interactiveBorder;
1926
+ var basePlacement = getBasePlacement$1(popperState.placement);
1927
+ var offsetData = popperState.modifiersData.offset;
1928
+
1929
+ if (!offsetData) {
1930
+ return true;
1931
+ }
1932
+
1933
+ var topDistance = basePlacement === 'bottom' ? offsetData.top.y : 0;
1934
+ var bottomDistance = basePlacement === 'top' ? offsetData.bottom.y : 0;
1935
+ var leftDistance = basePlacement === 'right' ? offsetData.left.x : 0;
1936
+ var rightDistance = basePlacement === 'left' ? offsetData.right.x : 0;
1937
+ var exceedsTop = popperRect.top - clientY + topDistance > interactiveBorder;
1938
+ var exceedsBottom = clientY - popperRect.bottom - bottomDistance > interactiveBorder;
1939
+ var exceedsLeft = popperRect.left - clientX + leftDistance > interactiveBorder;
1940
+ var exceedsRight = clientX - popperRect.right - rightDistance > interactiveBorder;
1941
+ return exceedsTop || exceedsBottom || exceedsLeft || exceedsRight;
1942
+ });
1943
+ }
1944
+ function updateTransitionEndListener(box, action, listener) {
1945
+ var method = action + "EventListener"; // some browsers apparently support `transition` (unprefixed) but only fire
1946
+ // `webkitTransitionEnd`...
1947
+
1948
+ ['transitionend', 'webkitTransitionEnd'].forEach(function (event) {
1949
+ box[method](event, listener);
1950
+ });
1951
+ }
1952
+ /**
1953
+ * Compared to xxx.contains, this function works for dom structures with shadow
1954
+ * dom
1955
+ */
1956
+
1957
+ function actualContains(parent, child) {
1958
+ var target = child;
1959
+
1960
+ while (target) {
1961
+ var _target$getRootNode;
1962
+
1963
+ if (parent.contains(target)) {
1964
+ return true;
1965
+ }
1966
+
1967
+ target = target.getRootNode == null ? void 0 : (_target$getRootNode = target.getRootNode()) == null ? void 0 : _target$getRootNode.host;
1968
+ }
1969
+
1970
+ return false;
1971
+ }
1972
+
1973
+ var currentInput = {
1974
+ isTouch: false
1975
+ };
1976
+ var lastMouseMoveTime = 0;
1977
+ /**
1978
+ * When a `touchstart` event is fired, it's assumed the user is using touch
1979
+ * input. We'll bind a `mousemove` event listener to listen for mouse input in
1980
+ * the future. This way, the `isTouch` property is fully dynamic and will handle
1981
+ * hybrid devices that use a mix of touch + mouse input.
1982
+ */
1983
+
1984
+ function onDocumentTouchStart() {
1985
+ if (currentInput.isTouch) {
1986
+ return;
1987
+ }
1988
+
1989
+ currentInput.isTouch = true;
1990
+
1991
+ if (window.performance) {
1992
+ document.addEventListener('mousemove', onDocumentMouseMove);
1993
+ }
1994
+ }
1995
+ /**
1996
+ * When two `mousemove` event are fired consecutively within 20ms, it's assumed
1997
+ * the user is using mouse input again. `mousemove` can fire on touch devices as
1998
+ * well, but very rarely that quickly.
1999
+ */
2000
+
2001
+ function onDocumentMouseMove() {
2002
+ var now = performance.now();
2003
+
2004
+ if (now - lastMouseMoveTime < 20) {
2005
+ currentInput.isTouch = false;
2006
+ document.removeEventListener('mousemove', onDocumentMouseMove);
2007
+ }
2008
+
2009
+ lastMouseMoveTime = now;
2010
+ }
2011
+ /**
2012
+ * When an element is in focus and has a tippy, leaving the tab/window and
2013
+ * returning causes it to show again. For mouse users this is unexpected, but
2014
+ * for keyboard use it makes sense.
2015
+ * TODO: find a better technique to solve this problem
2016
+ */
2017
+
2018
+ function onWindowBlur() {
2019
+ var activeElement = document.activeElement;
2020
+
2021
+ if (isReferenceElement(activeElement)) {
2022
+ var instance = activeElement._tippy;
2023
+
2024
+ if (activeElement.blur && !instance.state.isVisible) {
2025
+ activeElement.blur();
2026
+ }
2027
+ }
2028
+ }
2029
+ function bindGlobalEventListeners() {
2030
+ document.addEventListener('touchstart', onDocumentTouchStart, TOUCH_OPTIONS);
2031
+ window.addEventListener('blur', onWindowBlur);
2032
+ }
2033
+
2034
+ var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
2035
+ var isIE11 = isBrowser ? // @ts-ignore
2036
+ !!window.msCrypto : false;
2037
+
2038
+ var pluginProps = {
2039
+ animateFill: false,
2040
+ followCursor: false,
2041
+ inlinePositioning: false,
2042
+ sticky: false
2043
+ };
2044
+ var renderProps = {
2045
+ allowHTML: false,
2046
+ animation: 'fade',
2047
+ arrow: true,
2048
+ content: '',
2049
+ inertia: false,
2050
+ maxWidth: 350,
2051
+ role: 'tooltip',
2052
+ theme: '',
2053
+ zIndex: 9999
2054
+ };
2055
+ var defaultProps = Object.assign({
2056
+ appendTo: TIPPY_DEFAULT_APPEND_TO,
2057
+ aria: {
2058
+ content: 'auto',
2059
+ expanded: 'auto'
2060
+ },
2061
+ delay: 0,
2062
+ duration: [300, 250],
2063
+ getReferenceClientRect: null,
2064
+ hideOnClick: true,
2065
+ ignoreAttributes: false,
2066
+ interactive: false,
2067
+ interactiveBorder: 2,
2068
+ interactiveDebounce: 0,
2069
+ moveTransition: '',
2070
+ offset: [0, 10],
2071
+ onAfterUpdate: function onAfterUpdate() {},
2072
+ onBeforeUpdate: function onBeforeUpdate() {},
2073
+ onCreate: function onCreate() {},
2074
+ onDestroy: function onDestroy() {},
2075
+ onHidden: function onHidden() {},
2076
+ onHide: function onHide() {},
2077
+ onMount: function onMount() {},
2078
+ onShow: function onShow() {},
2079
+ onShown: function onShown() {},
2080
+ onTrigger: function onTrigger() {},
2081
+ onUntrigger: function onUntrigger() {},
2082
+ onClickOutside: function onClickOutside() {},
2083
+ placement: 'top',
2084
+ plugins: [],
2085
+ popperOptions: {},
2086
+ render: null,
2087
+ showOnCreate: false,
2088
+ touch: true,
2089
+ trigger: 'mouseenter focus',
2090
+ triggerTarget: null
2091
+ }, pluginProps, renderProps);
2092
+ var defaultKeys = Object.keys(defaultProps);
2093
+ var setDefaultProps = function setDefaultProps(partialProps) {
2094
+
2095
+ var keys = Object.keys(partialProps);
2096
+ keys.forEach(function (key) {
2097
+ defaultProps[key] = partialProps[key];
2098
+ });
2099
+ };
2100
+ function getExtendedPassedProps(passedProps) {
2101
+ var plugins = passedProps.plugins || [];
2102
+ var pluginProps = plugins.reduce(function (acc, plugin) {
2103
+ var name = plugin.name,
2104
+ defaultValue = plugin.defaultValue;
2105
+
2106
+ if (name) {
2107
+ var _name;
2108
+
2109
+ acc[name] = passedProps[name] !== undefined ? passedProps[name] : (_name = defaultProps[name]) != null ? _name : defaultValue;
2110
+ }
2111
+
2112
+ return acc;
2113
+ }, {});
2114
+ return Object.assign({}, passedProps, pluginProps);
2115
+ }
2116
+ function getDataAttributeProps(reference, plugins) {
2117
+ var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps, {
2118
+ plugins: plugins
2119
+ }))) : defaultKeys;
2120
+ var props = propKeys.reduce(function (acc, key) {
2121
+ var valueAsString = (reference.getAttribute("data-tippy-" + key) || '').trim();
2122
+
2123
+ if (!valueAsString) {
2124
+ return acc;
2125
+ }
2126
+
2127
+ if (key === 'content') {
2128
+ acc[key] = valueAsString;
2129
+ } else {
2130
+ try {
2131
+ acc[key] = JSON.parse(valueAsString);
2132
+ } catch (e) {
2133
+ acc[key] = valueAsString;
2134
+ }
2135
+ }
2136
+
2137
+ return acc;
2138
+ }, {});
2139
+ return props;
2140
+ }
2141
+ function evaluateProps(reference, props) {
2142
+ var out = Object.assign({}, props, {
2143
+ content: invokeWithArgsOrReturn(props.content, [reference])
2144
+ }, props.ignoreAttributes ? {} : getDataAttributeProps(reference, props.plugins));
2145
+ out.aria = Object.assign({}, defaultProps.aria, out.aria);
2146
+ out.aria = {
2147
+ expanded: out.aria.expanded === 'auto' ? props.interactive : out.aria.expanded,
2148
+ content: out.aria.content === 'auto' ? props.interactive ? null : 'describedby' : out.aria.content
2149
+ };
2150
+ return out;
2151
+ }
2152
+
2153
+ var innerHTML = function innerHTML() {
2154
+ return 'innerHTML';
2155
+ };
2156
+
2157
+ function dangerouslySetInnerHTML(element, html) {
2158
+ element[innerHTML()] = html;
2159
+ }
2160
+
2161
+ function createArrowElement(value) {
2162
+ var arrow = div();
2163
+
2164
+ if (value === true) {
2165
+ arrow.className = ARROW_CLASS;
2166
+ } else {
2167
+ arrow.className = SVG_ARROW_CLASS;
2168
+
2169
+ if (isElement$1(value)) {
2170
+ arrow.appendChild(value);
2171
+ } else {
2172
+ dangerouslySetInnerHTML(arrow, value);
2173
+ }
2174
+ }
2175
+
2176
+ return arrow;
2177
+ }
2178
+
2179
+ function setContent(content, props) {
2180
+ if (isElement$1(props.content)) {
2181
+ dangerouslySetInnerHTML(content, '');
2182
+ content.appendChild(props.content);
2183
+ } else if (typeof props.content !== 'function') {
2184
+ if (props.allowHTML) {
2185
+ dangerouslySetInnerHTML(content, props.content);
2186
+ } else {
2187
+ content.textContent = props.content;
2188
+ }
2189
+ }
2190
+ }
2191
+ function getChildren(popper) {
2192
+ var box = popper.firstElementChild;
2193
+ var boxChildren = arrayFrom(box.children);
2194
+ return {
2195
+ box: box,
2196
+ content: boxChildren.find(function (node) {
2197
+ return node.classList.contains(CONTENT_CLASS);
2198
+ }),
2199
+ arrow: boxChildren.find(function (node) {
2200
+ return node.classList.contains(ARROW_CLASS) || node.classList.contains(SVG_ARROW_CLASS);
2201
+ }),
2202
+ backdrop: boxChildren.find(function (node) {
2203
+ return node.classList.contains(BACKDROP_CLASS);
2204
+ })
2205
+ };
2206
+ }
2207
+ function render(instance) {
2208
+ var popper = div();
2209
+ var box = div();
2210
+ box.className = BOX_CLASS;
2211
+ box.setAttribute('data-state', 'hidden');
2212
+ box.setAttribute('tabindex', '-1');
2213
+ var content = div();
2214
+ content.className = CONTENT_CLASS;
2215
+ content.setAttribute('data-state', 'hidden');
2216
+ setContent(content, instance.props);
2217
+ popper.appendChild(box);
2218
+ box.appendChild(content);
2219
+ onUpdate(instance.props, instance.props);
2220
+
2221
+ function onUpdate(prevProps, nextProps) {
2222
+ var _getChildren = getChildren(popper),
2223
+ box = _getChildren.box,
2224
+ content = _getChildren.content,
2225
+ arrow = _getChildren.arrow;
2226
+
2227
+ if (nextProps.theme) {
2228
+ box.setAttribute('data-theme', nextProps.theme);
2229
+ } else {
2230
+ box.removeAttribute('data-theme');
2231
+ }
2232
+
2233
+ if (typeof nextProps.animation === 'string') {
2234
+ box.setAttribute('data-animation', nextProps.animation);
2235
+ } else {
2236
+ box.removeAttribute('data-animation');
2237
+ }
2238
+
2239
+ if (nextProps.inertia) {
2240
+ box.setAttribute('data-inertia', '');
2241
+ } else {
2242
+ box.removeAttribute('data-inertia');
2243
+ }
2244
+
2245
+ box.style.maxWidth = typeof nextProps.maxWidth === 'number' ? nextProps.maxWidth + "px" : nextProps.maxWidth;
2246
+
2247
+ if (nextProps.role) {
2248
+ box.setAttribute('role', nextProps.role);
2249
+ } else {
2250
+ box.removeAttribute('role');
2251
+ }
2252
+
2253
+ if (prevProps.content !== nextProps.content || prevProps.allowHTML !== nextProps.allowHTML) {
2254
+ setContent(content, instance.props);
2255
+ }
2256
+
2257
+ if (nextProps.arrow) {
2258
+ if (!arrow) {
2259
+ box.appendChild(createArrowElement(nextProps.arrow));
2260
+ } else if (prevProps.arrow !== nextProps.arrow) {
2261
+ box.removeChild(arrow);
2262
+ box.appendChild(createArrowElement(nextProps.arrow));
2263
+ }
2264
+ } else if (arrow) {
2265
+ box.removeChild(arrow);
2266
+ }
2267
+ }
2268
+
2269
+ return {
2270
+ popper: popper,
2271
+ onUpdate: onUpdate
2272
+ };
2273
+ } // Runtime check to identify if the render function is the default one; this
2274
+ // way we can apply default CSS transitions logic and it can be tree-shaken away
2275
+
2276
+ render.$$tippy = true;
2277
+
2278
+ var idCounter = 1;
2279
+ var mouseMoveListeners = []; // Used by `hideAll()`
2280
+
2281
+ var mountedInstances = [];
2282
+ function createTippy(reference, passedProps) {
2283
+ var props = evaluateProps(reference, Object.assign({}, defaultProps, getExtendedPassedProps(removeUndefinedProps(passedProps)))); // ===========================================================================
2284
+ // 🔒 Private members
2285
+ // ===========================================================================
2286
+
2287
+ var showTimeout;
2288
+ var hideTimeout;
2289
+ var scheduleHideAnimationFrame;
2290
+ var isVisibleFromClick = false;
2291
+ var didHideDueToDocumentMouseDown = false;
2292
+ var didTouchMove = false;
2293
+ var ignoreOnFirstUpdate = false;
2294
+ var lastTriggerEvent;
2295
+ var currentTransitionEndListener;
2296
+ var onFirstUpdate;
2297
+ var listeners = [];
2298
+ var debouncedOnMouseMove = debounce$1(onMouseMove, props.interactiveDebounce);
2299
+ var currentTarget; // ===========================================================================
2300
+ // 🔑 Public members
2301
+ // ===========================================================================
2302
+
2303
+ var id = idCounter++;
2304
+ var popperInstance = null;
2305
+ var plugins = unique(props.plugins);
2306
+ var state = {
2307
+ // Is the instance currently enabled?
2308
+ isEnabled: true,
2309
+ // Is the tippy currently showing and not transitioning out?
2310
+ isVisible: false,
2311
+ // Has the instance been destroyed?
2312
+ isDestroyed: false,
2313
+ // Is the tippy currently mounted to the DOM?
2314
+ isMounted: false,
2315
+ // Has the tippy finished transitioning in?
2316
+ isShown: false
2317
+ };
2318
+ var instance = {
2319
+ // properties
2320
+ id: id,
2321
+ reference: reference,
2322
+ popper: div(),
2323
+ popperInstance: popperInstance,
2324
+ props: props,
2325
+ state: state,
2326
+ plugins: plugins,
2327
+ // methods
2328
+ clearDelayTimeouts: clearDelayTimeouts,
2329
+ setProps: setProps,
2330
+ setContent: setContent,
2331
+ show: show,
2332
+ hide: hide,
2333
+ hideWithInteractivity: hideWithInteractivity,
2334
+ enable: enable,
2335
+ disable: disable,
2336
+ unmount: unmount,
2337
+ destroy: destroy
2338
+ }; // TODO: Investigate why this early return causes a TDZ error in the tests —
2339
+ // it doesn't seem to happen in the browser
2340
+
2341
+ /* istanbul ignore if */
2342
+
2343
+ if (!props.render) {
2344
+
2345
+ return instance;
2346
+ } // ===========================================================================
2347
+ // Initial mutations
2348
+ // ===========================================================================
2349
+
2350
+
2351
+ var _props$render = props.render(instance),
2352
+ popper = _props$render.popper,
2353
+ onUpdate = _props$render.onUpdate;
2354
+
2355
+ popper.setAttribute('data-tippy-root', '');
2356
+ popper.id = "tippy-" + instance.id;
2357
+ instance.popper = popper;
2358
+ reference._tippy = instance;
2359
+ popper._tippy = instance;
2360
+ var pluginsHooks = plugins.map(function (plugin) {
2361
+ return plugin.fn(instance);
2362
+ });
2363
+ var hasAriaExpanded = reference.hasAttribute('aria-expanded');
2364
+ addListeners();
2365
+ handleAriaExpandedAttribute();
2366
+ handleStyles();
2367
+ invokeHook('onCreate', [instance]);
2368
+
2369
+ if (props.showOnCreate) {
2370
+ scheduleShow();
2371
+ } // Prevent a tippy with a delay from hiding if the cursor left then returned
2372
+ // before it started hiding
2373
+
2374
+
2375
+ popper.addEventListener('mouseenter', function () {
2376
+ if (instance.props.interactive && instance.state.isVisible) {
2377
+ instance.clearDelayTimeouts();
2378
+ }
2379
+ });
2380
+ popper.addEventListener('mouseleave', function () {
2381
+ if (instance.props.interactive && instance.props.trigger.indexOf('mouseenter') >= 0) {
2382
+ getDocument().addEventListener('mousemove', debouncedOnMouseMove);
2383
+ }
2384
+ });
2385
+ return instance; // ===========================================================================
2386
+ // 🔒 Private methods
2387
+ // ===========================================================================
2388
+
2389
+ function getNormalizedTouchSettings() {
2390
+ var touch = instance.props.touch;
2391
+ return Array.isArray(touch) ? touch : [touch, 0];
2392
+ }
2393
+
2394
+ function getIsCustomTouchBehavior() {
2395
+ return getNormalizedTouchSettings()[0] === 'hold';
2396
+ }
2397
+
2398
+ function getIsDefaultRenderFn() {
2399
+ var _instance$props$rende;
2400
+
2401
+ // @ts-ignore
2402
+ return !!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy);
2403
+ }
2404
+
2405
+ function getCurrentTarget() {
2406
+ return currentTarget || reference;
2407
+ }
2408
+
2409
+ function getDocument() {
2410
+ var parent = getCurrentTarget().parentNode;
2411
+ return parent ? getOwnerDocument(parent) : document;
2412
+ }
2413
+
2414
+ function getDefaultTemplateChildren() {
2415
+ return getChildren(popper);
2416
+ }
2417
+
2418
+ function getDelay(isShow) {
2419
+ // For touch or keyboard input, force `0` delay for UX reasons
2420
+ // Also if the instance is mounted but not visible (transitioning out),
2421
+ // ignore delay
2422
+ if (instance.state.isMounted && !instance.state.isVisible || currentInput.isTouch || lastTriggerEvent && lastTriggerEvent.type === 'focus') {
2423
+ return 0;
2424
+ }
2425
+
2426
+ return getValueAtIndexOrReturn(instance.props.delay, isShow ? 0 : 1, defaultProps.delay);
2427
+ }
2428
+
2429
+ function handleStyles(fromHide) {
2430
+ if (fromHide === void 0) {
2431
+ fromHide = false;
2432
+ }
2433
+
2434
+ popper.style.pointerEvents = instance.props.interactive && !fromHide ? '' : 'none';
2435
+ popper.style.zIndex = "" + instance.props.zIndex;
2436
+ }
2437
+
2438
+ function invokeHook(hook, args, shouldInvokePropsHook) {
2439
+ if (shouldInvokePropsHook === void 0) {
2440
+ shouldInvokePropsHook = true;
2441
+ }
2442
+
2443
+ pluginsHooks.forEach(function (pluginHooks) {
2444
+ if (pluginHooks[hook]) {
2445
+ pluginHooks[hook].apply(pluginHooks, args);
2446
+ }
2447
+ });
2448
+
2449
+ if (shouldInvokePropsHook) {
2450
+ var _instance$props;
2451
+
2452
+ (_instance$props = instance.props)[hook].apply(_instance$props, args);
2453
+ }
2454
+ }
2455
+
2456
+ function handleAriaContentAttribute() {
2457
+ var aria = instance.props.aria;
2458
+
2459
+ if (!aria.content) {
2460
+ return;
2461
+ }
2462
+
2463
+ var attr = "aria-" + aria.content;
2464
+ var id = popper.id;
2465
+ var nodes = normalizeToArray(instance.props.triggerTarget || reference);
2466
+ nodes.forEach(function (node) {
2467
+ var currentValue = node.getAttribute(attr);
2468
+
2469
+ if (instance.state.isVisible) {
2470
+ node.setAttribute(attr, currentValue ? currentValue + " " + id : id);
2471
+ } else {
2472
+ var nextValue = currentValue && currentValue.replace(id, '').trim();
2473
+
2474
+ if (nextValue) {
2475
+ node.setAttribute(attr, nextValue);
2476
+ } else {
2477
+ node.removeAttribute(attr);
2478
+ }
2479
+ }
2480
+ });
2481
+ }
2482
+
2483
+ function handleAriaExpandedAttribute() {
2484
+ if (hasAriaExpanded || !instance.props.aria.expanded) {
2485
+ return;
2486
+ }
2487
+
2488
+ var nodes = normalizeToArray(instance.props.triggerTarget || reference);
2489
+ nodes.forEach(function (node) {
2490
+ if (instance.props.interactive) {
2491
+ node.setAttribute('aria-expanded', instance.state.isVisible && node === getCurrentTarget() ? 'true' : 'false');
2492
+ } else {
2493
+ node.removeAttribute('aria-expanded');
2494
+ }
2495
+ });
2496
+ }
2497
+
2498
+ function cleanupInteractiveMouseListeners() {
2499
+ getDocument().removeEventListener('mousemove', debouncedOnMouseMove);
2500
+ mouseMoveListeners = mouseMoveListeners.filter(function (listener) {
2501
+ return listener !== debouncedOnMouseMove;
2502
+ });
2503
+ }
2504
+
2505
+ function onDocumentPress(event) {
2506
+ // Moved finger to scroll instead of an intentional tap outside
2507
+ if (currentInput.isTouch) {
2508
+ if (didTouchMove || event.type === 'mousedown') {
2509
+ return;
2510
+ }
2511
+ }
2512
+
2513
+ var actualTarget = event.composedPath && event.composedPath()[0] || event.target; // Clicked on interactive popper
2514
+
2515
+ if (instance.props.interactive && actualContains(popper, actualTarget)) {
2516
+ return;
2517
+ } // Clicked on the event listeners target
2518
+
2519
+
2520
+ if (normalizeToArray(instance.props.triggerTarget || reference).some(function (el) {
2521
+ return actualContains(el, actualTarget);
2522
+ })) {
2523
+ if (currentInput.isTouch) {
2524
+ return;
2525
+ }
2526
+
2527
+ if (instance.state.isVisible && instance.props.trigger.indexOf('click') >= 0) {
2528
+ return;
2529
+ }
2530
+ } else {
2531
+ invokeHook('onClickOutside', [instance, event]);
2532
+ }
2533
+
2534
+ if (instance.props.hideOnClick === true) {
2535
+ instance.clearDelayTimeouts();
2536
+ instance.hide(); // `mousedown` event is fired right before `focus` if pressing the
2537
+ // currentTarget. This lets a tippy with `focus` trigger know that it
2538
+ // should not show
2539
+
2540
+ didHideDueToDocumentMouseDown = true;
2541
+ setTimeout(function () {
2542
+ didHideDueToDocumentMouseDown = false;
2543
+ }); // The listener gets added in `scheduleShow()`, but this may be hiding it
2544
+ // before it shows, and hide()'s early bail-out behavior can prevent it
2545
+ // from being cleaned up
2546
+
2547
+ if (!instance.state.isMounted) {
2548
+ removeDocumentPress();
2549
+ }
2550
+ }
2551
+ }
2552
+
2553
+ function onTouchMove() {
2554
+ didTouchMove = true;
2555
+ }
2556
+
2557
+ function onTouchStart() {
2558
+ didTouchMove = false;
2559
+ }
2560
+
2561
+ function addDocumentPress() {
2562
+ var doc = getDocument();
2563
+ doc.addEventListener('mousedown', onDocumentPress, true);
2564
+ doc.addEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
2565
+ doc.addEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
2566
+ doc.addEventListener('touchmove', onTouchMove, TOUCH_OPTIONS);
2567
+ }
2568
+
2569
+ function removeDocumentPress() {
2570
+ var doc = getDocument();
2571
+ doc.removeEventListener('mousedown', onDocumentPress, true);
2572
+ doc.removeEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
2573
+ doc.removeEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
2574
+ doc.removeEventListener('touchmove', onTouchMove, TOUCH_OPTIONS);
2575
+ }
2576
+
2577
+ function onTransitionedOut(duration, callback) {
2578
+ onTransitionEnd(duration, function () {
2579
+ if (!instance.state.isVisible && popper.parentNode && popper.parentNode.contains(popper)) {
2580
+ callback();
2581
+ }
2582
+ });
2583
+ }
2584
+
2585
+ function onTransitionedIn(duration, callback) {
2586
+ onTransitionEnd(duration, callback);
2587
+ }
2588
+
2589
+ function onTransitionEnd(duration, callback) {
2590
+ var box = getDefaultTemplateChildren().box;
2591
+
2592
+ function listener(event) {
2593
+ if (event.target === box) {
2594
+ updateTransitionEndListener(box, 'remove', listener);
2595
+ callback();
2596
+ }
2597
+ } // Make callback synchronous if duration is 0
2598
+ // `transitionend` won't fire otherwise
2599
+
2600
+
2601
+ if (duration === 0) {
2602
+ return callback();
2603
+ }
2604
+
2605
+ updateTransitionEndListener(box, 'remove', currentTransitionEndListener);
2606
+ updateTransitionEndListener(box, 'add', listener);
2607
+ currentTransitionEndListener = listener;
2608
+ }
2609
+
2610
+ function on(eventType, handler, options) {
2611
+ if (options === void 0) {
2612
+ options = false;
2613
+ }
2614
+
2615
+ var nodes = normalizeToArray(instance.props.triggerTarget || reference);
2616
+ nodes.forEach(function (node) {
2617
+ node.addEventListener(eventType, handler, options);
2618
+ listeners.push({
2619
+ node: node,
2620
+ eventType: eventType,
2621
+ handler: handler,
2622
+ options: options
2623
+ });
2624
+ });
2625
+ }
2626
+
2627
+ function addListeners() {
2628
+ if (getIsCustomTouchBehavior()) {
2629
+ on('touchstart', onTrigger, {
2630
+ passive: true
2631
+ });
2632
+ on('touchend', onMouseLeave, {
2633
+ passive: true
2634
+ });
2635
+ }
2636
+
2637
+ splitBySpaces(instance.props.trigger).forEach(function (eventType) {
2638
+ if (eventType === 'manual') {
2639
+ return;
2640
+ }
2641
+
2642
+ on(eventType, onTrigger);
2643
+
2644
+ switch (eventType) {
2645
+ case 'mouseenter':
2646
+ on('mouseleave', onMouseLeave);
2647
+ break;
2648
+
2649
+ case 'focus':
2650
+ on(isIE11 ? 'focusout' : 'blur', onBlurOrFocusOut);
2651
+ break;
2652
+
2653
+ case 'focusin':
2654
+ on('focusout', onBlurOrFocusOut);
2655
+ break;
2656
+ }
2657
+ });
2658
+ }
2659
+
2660
+ function removeListeners() {
2661
+ listeners.forEach(function (_ref) {
2662
+ var node = _ref.node,
2663
+ eventType = _ref.eventType,
2664
+ handler = _ref.handler,
2665
+ options = _ref.options;
2666
+ node.removeEventListener(eventType, handler, options);
2667
+ });
2668
+ listeners = [];
2669
+ }
2670
+
2671
+ function onTrigger(event) {
2672
+ var _lastTriggerEvent;
2673
+
2674
+ var shouldScheduleClickHide = false;
2675
+
2676
+ if (!instance.state.isEnabled || isEventListenerStopped(event) || didHideDueToDocumentMouseDown) {
2677
+ return;
2678
+ }
2679
+
2680
+ var wasFocused = ((_lastTriggerEvent = lastTriggerEvent) == null ? void 0 : _lastTriggerEvent.type) === 'focus';
2681
+ lastTriggerEvent = event;
2682
+ currentTarget = event.currentTarget;
2683
+ handleAriaExpandedAttribute();
2684
+
2685
+ if (!instance.state.isVisible && isMouseEvent(event)) {
2686
+ // If scrolling, `mouseenter` events can be fired if the cursor lands
2687
+ // over a new target, but `mousemove` events don't get fired. This
2688
+ // causes interactive tooltips to get stuck open until the cursor is
2689
+ // moved
2690
+ mouseMoveListeners.forEach(function (listener) {
2691
+ return listener(event);
2692
+ });
2693
+ } // Toggle show/hide when clicking click-triggered tooltips
2694
+
2695
+
2696
+ if (event.type === 'click' && (instance.props.trigger.indexOf('mouseenter') < 0 || isVisibleFromClick) && instance.props.hideOnClick !== false && instance.state.isVisible) {
2697
+ shouldScheduleClickHide = true;
2698
+ } else {
2699
+ scheduleShow(event);
2700
+ }
2701
+
2702
+ if (event.type === 'click') {
2703
+ isVisibleFromClick = !shouldScheduleClickHide;
2704
+ }
2705
+
2706
+ if (shouldScheduleClickHide && !wasFocused) {
2707
+ scheduleHide(event);
2708
+ }
2709
+ }
2710
+
2711
+ function onMouseMove(event) {
2712
+ var target = event.target;
2713
+ var isCursorOverReferenceOrPopper = getCurrentTarget().contains(target) || popper.contains(target);
2714
+
2715
+ if (event.type === 'mousemove' && isCursorOverReferenceOrPopper) {
2716
+ return;
2717
+ }
2718
+
2719
+ var popperTreeData = getNestedPopperTree().concat(popper).map(function (popper) {
2720
+ var _instance$popperInsta;
2721
+
2722
+ var instance = popper._tippy;
2723
+ var state = (_instance$popperInsta = instance.popperInstance) == null ? void 0 : _instance$popperInsta.state;
2724
+
2725
+ if (state) {
2726
+ return {
2727
+ popperRect: popper.getBoundingClientRect(),
2728
+ popperState: state,
2729
+ props: props
2730
+ };
2731
+ }
2732
+
2733
+ return null;
2734
+ }).filter(Boolean);
2735
+
2736
+ if (isCursorOutsideInteractiveBorder(popperTreeData, event)) {
2737
+ cleanupInteractiveMouseListeners();
2738
+ scheduleHide(event);
2739
+ }
2740
+ }
2741
+
2742
+ function onMouseLeave(event) {
2743
+ var shouldBail = isEventListenerStopped(event) || instance.props.trigger.indexOf('click') >= 0 && isVisibleFromClick;
2744
+
2745
+ if (shouldBail) {
2746
+ return;
2747
+ }
2748
+
2749
+ if (instance.props.interactive) {
2750
+ instance.hideWithInteractivity(event);
2751
+ return;
2752
+ }
2753
+
2754
+ scheduleHide(event);
2755
+ }
2756
+
2757
+ function onBlurOrFocusOut(event) {
2758
+ if (instance.props.trigger.indexOf('focusin') < 0 && event.target !== getCurrentTarget()) {
2759
+ return;
2760
+ } // If focus was moved to within the popper
2761
+
2762
+
2763
+ if (instance.props.interactive && event.relatedTarget && popper.contains(event.relatedTarget)) {
2764
+ return;
2765
+ }
2766
+
2767
+ scheduleHide(event);
2768
+ }
2769
+
2770
+ function isEventListenerStopped(event) {
2771
+ return currentInput.isTouch ? getIsCustomTouchBehavior() !== event.type.indexOf('touch') >= 0 : false;
2772
+ }
2773
+
2774
+ function createPopperInstance() {
2775
+ destroyPopperInstance();
2776
+ var _instance$props2 = instance.props,
2777
+ popperOptions = _instance$props2.popperOptions,
2778
+ placement = _instance$props2.placement,
2779
+ offset = _instance$props2.offset,
2780
+ getReferenceClientRect = _instance$props2.getReferenceClientRect,
2781
+ moveTransition = _instance$props2.moveTransition;
2782
+ var arrow = getIsDefaultRenderFn() ? getChildren(popper).arrow : null;
2783
+ var computedReference = getReferenceClientRect ? {
2784
+ getBoundingClientRect: getReferenceClientRect,
2785
+ contextElement: getReferenceClientRect.contextElement || getCurrentTarget()
2786
+ } : reference;
2787
+ var tippyModifier = {
2788
+ name: '$$tippy',
2789
+ enabled: true,
2790
+ phase: 'beforeWrite',
2791
+ requires: ['computeStyles'],
2792
+ fn: function fn(_ref2) {
2793
+ var state = _ref2.state;
2794
+
2795
+ if (getIsDefaultRenderFn()) {
2796
+ var _getDefaultTemplateCh = getDefaultTemplateChildren(),
2797
+ box = _getDefaultTemplateCh.box;
2798
+
2799
+ ['placement', 'reference-hidden', 'escaped'].forEach(function (attr) {
2800
+ if (attr === 'placement') {
2801
+ box.setAttribute('data-placement', state.placement);
2802
+ } else {
2803
+ if (state.attributes.popper["data-popper-" + attr]) {
2804
+ box.setAttribute("data-" + attr, '');
2805
+ } else {
2806
+ box.removeAttribute("data-" + attr);
2807
+ }
2808
+ }
2809
+ });
2810
+ state.attributes.popper = {};
2811
+ }
2812
+ }
2813
+ };
2814
+ var modifiers = [{
2815
+ name: 'offset',
2816
+ options: {
2817
+ offset: offset
2818
+ }
2819
+ }, {
2820
+ name: 'preventOverflow',
2821
+ options: {
2822
+ padding: {
2823
+ top: 2,
2824
+ bottom: 2,
2825
+ left: 5,
2826
+ right: 5
2827
+ }
2828
+ }
2829
+ }, {
2830
+ name: 'flip',
2831
+ options: {
2832
+ padding: 5
2833
+ }
2834
+ }, {
2835
+ name: 'computeStyles',
2836
+ options: {
2837
+ adaptive: !moveTransition
2838
+ }
2839
+ }, tippyModifier];
2840
+
2841
+ if (getIsDefaultRenderFn() && arrow) {
2842
+ modifiers.push({
2843
+ name: 'arrow',
2844
+ options: {
2845
+ element: arrow,
2846
+ padding: 3
2847
+ }
2848
+ });
2849
+ }
2850
+
2851
+ modifiers.push.apply(modifiers, (popperOptions == null ? void 0 : popperOptions.modifiers) || []);
2852
+ instance.popperInstance = createPopper(computedReference, popper, Object.assign({}, popperOptions, {
2853
+ placement: placement,
2854
+ onFirstUpdate: onFirstUpdate,
2855
+ modifiers: modifiers
2856
+ }));
2857
+ }
2858
+
2859
+ function destroyPopperInstance() {
2860
+ if (instance.popperInstance) {
2861
+ instance.popperInstance.destroy();
2862
+ instance.popperInstance = null;
2863
+ }
2864
+ }
2865
+
2866
+ function mount() {
2867
+ var appendTo = instance.props.appendTo;
2868
+ var parentNode; // By default, we'll append the popper to the triggerTargets's parentNode so
2869
+ // it's directly after the reference element so the elements inside the
2870
+ // tippy can be tabbed to
2871
+ // If there are clipping issues, the user can specify a different appendTo
2872
+ // and ensure focus management is handled correctly manually
2873
+
2874
+ var node = getCurrentTarget();
2875
+
2876
+ if (instance.props.interactive && appendTo === TIPPY_DEFAULT_APPEND_TO || appendTo === 'parent') {
2877
+ parentNode = node.parentNode;
2878
+ } else {
2879
+ parentNode = invokeWithArgsOrReturn(appendTo, [node]);
2880
+ } // The popper element needs to exist on the DOM before its position can be
2881
+ // updated as Popper needs to read its dimensions
2882
+
2883
+
2884
+ if (!parentNode.contains(popper)) {
2885
+ parentNode.appendChild(popper);
2886
+ }
2887
+
2888
+ instance.state.isMounted = true;
2889
+ createPopperInstance();
2890
+ }
2891
+
2892
+ function getNestedPopperTree() {
2893
+ return arrayFrom(popper.querySelectorAll('[data-tippy-root]'));
2894
+ }
2895
+
2896
+ function scheduleShow(event) {
2897
+ instance.clearDelayTimeouts();
2898
+
2899
+ if (event) {
2900
+ invokeHook('onTrigger', [instance, event]);
2901
+ }
2902
+
2903
+ addDocumentPress();
2904
+ var delay = getDelay(true);
2905
+
2906
+ var _getNormalizedTouchSe = getNormalizedTouchSettings(),
2907
+ touchValue = _getNormalizedTouchSe[0],
2908
+ touchDelay = _getNormalizedTouchSe[1];
2909
+
2910
+ if (currentInput.isTouch && touchValue === 'hold' && touchDelay) {
2911
+ delay = touchDelay;
2912
+ }
2913
+
2914
+ if (delay) {
2915
+ showTimeout = setTimeout(function () {
2916
+ instance.show();
2917
+ }, delay);
2918
+ } else {
2919
+ instance.show();
2920
+ }
2921
+ }
2922
+
2923
+ function scheduleHide(event) {
2924
+ instance.clearDelayTimeouts();
2925
+ invokeHook('onUntrigger', [instance, event]);
2926
+
2927
+ if (!instance.state.isVisible) {
2928
+ removeDocumentPress();
2929
+ return;
2930
+ } // For interactive tippies, scheduleHide is added to a document.body handler
2931
+ // from onMouseLeave so must intercept scheduled hides from mousemove/leave
2932
+ // events when trigger contains mouseenter and click, and the tip is
2933
+ // currently shown as a result of a click.
2934
+
2935
+
2936
+ if (instance.props.trigger.indexOf('mouseenter') >= 0 && instance.props.trigger.indexOf('click') >= 0 && ['mouseleave', 'mousemove'].indexOf(event.type) >= 0 && isVisibleFromClick) {
2937
+ return;
2938
+ }
2939
+
2940
+ var delay = getDelay(false);
2941
+
2942
+ if (delay) {
2943
+ hideTimeout = setTimeout(function () {
2944
+ if (instance.state.isVisible) {
2945
+ instance.hide();
2946
+ }
2947
+ }, delay);
2948
+ } else {
2949
+ // Fixes a `transitionend` problem when it fires 1 frame too
2950
+ // late sometimes, we don't want hide() to be called.
2951
+ scheduleHideAnimationFrame = requestAnimationFrame(function () {
2952
+ instance.hide();
2953
+ });
2954
+ }
2955
+ } // ===========================================================================
2956
+ // 🔑 Public methods
2957
+ // ===========================================================================
2958
+
2959
+
2960
+ function enable() {
2961
+ instance.state.isEnabled = true;
2962
+ }
2963
+
2964
+ function disable() {
2965
+ // Disabling the instance should also hide it
2966
+ // https://github.com/atomiks/tippy.js-react/issues/106
2967
+ instance.hide();
2968
+ instance.state.isEnabled = false;
2969
+ }
2970
+
2971
+ function clearDelayTimeouts() {
2972
+ clearTimeout(showTimeout);
2973
+ clearTimeout(hideTimeout);
2974
+ cancelAnimationFrame(scheduleHideAnimationFrame);
2975
+ }
2976
+
2977
+ function setProps(partialProps) {
2978
+
2979
+ if (instance.state.isDestroyed) {
2980
+ return;
2981
+ }
2982
+
2983
+ invokeHook('onBeforeUpdate', [instance, partialProps]);
2984
+ removeListeners();
2985
+ var prevProps = instance.props;
2986
+ var nextProps = evaluateProps(reference, Object.assign({}, prevProps, removeUndefinedProps(partialProps), {
2987
+ ignoreAttributes: true
2988
+ }));
2989
+ instance.props = nextProps;
2990
+ addListeners();
2991
+
2992
+ if (prevProps.interactiveDebounce !== nextProps.interactiveDebounce) {
2993
+ cleanupInteractiveMouseListeners();
2994
+ debouncedOnMouseMove = debounce$1(onMouseMove, nextProps.interactiveDebounce);
2995
+ } // Ensure stale aria-expanded attributes are removed
2996
+
2997
+
2998
+ if (prevProps.triggerTarget && !nextProps.triggerTarget) {
2999
+ normalizeToArray(prevProps.triggerTarget).forEach(function (node) {
3000
+ node.removeAttribute('aria-expanded');
3001
+ });
3002
+ } else if (nextProps.triggerTarget) {
3003
+ reference.removeAttribute('aria-expanded');
3004
+ }
3005
+
3006
+ handleAriaExpandedAttribute();
3007
+ handleStyles();
3008
+
3009
+ if (onUpdate) {
3010
+ onUpdate(prevProps, nextProps);
3011
+ }
3012
+
3013
+ if (instance.popperInstance) {
3014
+ createPopperInstance(); // Fixes an issue with nested tippies if they are all getting re-rendered,
3015
+ // and the nested ones get re-rendered first.
3016
+ // https://github.com/atomiks/tippyjs-react/issues/177
3017
+ // TODO: find a cleaner / more efficient solution(!)
3018
+
3019
+ getNestedPopperTree().forEach(function (nestedPopper) {
3020
+ // React (and other UI libs likely) requires a rAF wrapper as it flushes
3021
+ // its work in one
3022
+ requestAnimationFrame(nestedPopper._tippy.popperInstance.forceUpdate);
3023
+ });
3024
+ }
3025
+
3026
+ invokeHook('onAfterUpdate', [instance, partialProps]);
3027
+ }
3028
+
3029
+ function setContent(content) {
3030
+ instance.setProps({
3031
+ content: content
3032
+ });
3033
+ }
3034
+
3035
+ function show() {
3036
+
3037
+
3038
+ var isAlreadyVisible = instance.state.isVisible;
3039
+ var isDestroyed = instance.state.isDestroyed;
3040
+ var isDisabled = !instance.state.isEnabled;
3041
+ var isTouchAndTouchDisabled = currentInput.isTouch && !instance.props.touch;
3042
+ var duration = getValueAtIndexOrReturn(instance.props.duration, 0, defaultProps.duration);
3043
+
3044
+ if (isAlreadyVisible || isDestroyed || isDisabled || isTouchAndTouchDisabled) {
3045
+ return;
3046
+ } // Normalize `disabled` behavior across browsers.
3047
+ // Firefox allows events on disabled elements, but Chrome doesn't.
3048
+ // Using a wrapper element (i.e. <span>) is recommended.
3049
+
3050
+
3051
+ if (getCurrentTarget().hasAttribute('disabled')) {
3052
+ return;
3053
+ }
3054
+
3055
+ invokeHook('onShow', [instance], false);
3056
+
3057
+ if (instance.props.onShow(instance) === false) {
3058
+ return;
3059
+ }
3060
+
3061
+ instance.state.isVisible = true;
3062
+
3063
+ if (getIsDefaultRenderFn()) {
3064
+ popper.style.visibility = 'visible';
3065
+ }
3066
+
3067
+ handleStyles();
3068
+ addDocumentPress();
3069
+
3070
+ if (!instance.state.isMounted) {
3071
+ popper.style.transition = 'none';
3072
+ } // If flipping to the opposite side after hiding at least once, the
3073
+ // animation will use the wrong placement without resetting the duration
3074
+
3075
+
3076
+ if (getIsDefaultRenderFn()) {
3077
+ var _getDefaultTemplateCh2 = getDefaultTemplateChildren(),
3078
+ box = _getDefaultTemplateCh2.box,
3079
+ content = _getDefaultTemplateCh2.content;
3080
+
3081
+ setTransitionDuration([box, content], 0);
3082
+ }
3083
+
3084
+ onFirstUpdate = function onFirstUpdate() {
3085
+ var _instance$popperInsta2;
3086
+
3087
+ if (!instance.state.isVisible || ignoreOnFirstUpdate) {
3088
+ return;
3089
+ }
3090
+
3091
+ ignoreOnFirstUpdate = true; // reflow
3092
+
3093
+ void popper.offsetHeight;
3094
+ popper.style.transition = instance.props.moveTransition;
3095
+
3096
+ if (getIsDefaultRenderFn() && instance.props.animation) {
3097
+ var _getDefaultTemplateCh3 = getDefaultTemplateChildren(),
3098
+ _box = _getDefaultTemplateCh3.box,
3099
+ _content = _getDefaultTemplateCh3.content;
3100
+
3101
+ setTransitionDuration([_box, _content], duration);
3102
+ setVisibilityState([_box, _content], 'visible');
3103
+ }
3104
+
3105
+ handleAriaContentAttribute();
3106
+ handleAriaExpandedAttribute();
3107
+ pushIfUnique(mountedInstances, instance); // certain modifiers (e.g. `maxSize`) require a second update after the
3108
+ // popper has been positioned for the first time
3109
+
3110
+ (_instance$popperInsta2 = instance.popperInstance) == null ? void 0 : _instance$popperInsta2.forceUpdate();
3111
+ invokeHook('onMount', [instance]);
3112
+
3113
+ if (instance.props.animation && getIsDefaultRenderFn()) {
3114
+ onTransitionedIn(duration, function () {
3115
+ instance.state.isShown = true;
3116
+ invokeHook('onShown', [instance]);
3117
+ });
3118
+ }
3119
+ };
3120
+
3121
+ mount();
3122
+ }
3123
+
3124
+ function hide() {
3125
+
3126
+
3127
+ var isAlreadyHidden = !instance.state.isVisible;
3128
+ var isDestroyed = instance.state.isDestroyed;
3129
+ var isDisabled = !instance.state.isEnabled;
3130
+ var duration = getValueAtIndexOrReturn(instance.props.duration, 1, defaultProps.duration);
3131
+
3132
+ if (isAlreadyHidden || isDestroyed || isDisabled) {
3133
+ return;
3134
+ }
3135
+
3136
+ invokeHook('onHide', [instance], false);
3137
+
3138
+ if (instance.props.onHide(instance) === false) {
3139
+ return;
3140
+ }
3141
+
3142
+ instance.state.isVisible = false;
3143
+ instance.state.isShown = false;
3144
+ ignoreOnFirstUpdate = false;
3145
+ isVisibleFromClick = false;
3146
+
3147
+ if (getIsDefaultRenderFn()) {
3148
+ popper.style.visibility = 'hidden';
3149
+ }
3150
+
3151
+ cleanupInteractiveMouseListeners();
3152
+ removeDocumentPress();
3153
+ handleStyles(true);
3154
+
3155
+ if (getIsDefaultRenderFn()) {
3156
+ var _getDefaultTemplateCh4 = getDefaultTemplateChildren(),
3157
+ box = _getDefaultTemplateCh4.box,
3158
+ content = _getDefaultTemplateCh4.content;
3159
+
3160
+ if (instance.props.animation) {
3161
+ setTransitionDuration([box, content], duration);
3162
+ setVisibilityState([box, content], 'hidden');
3163
+ }
3164
+ }
3165
+
3166
+ handleAriaContentAttribute();
3167
+ handleAriaExpandedAttribute();
3168
+
3169
+ if (instance.props.animation) {
3170
+ if (getIsDefaultRenderFn()) {
3171
+ onTransitionedOut(duration, instance.unmount);
3172
+ }
3173
+ } else {
3174
+ instance.unmount();
3175
+ }
3176
+ }
3177
+
3178
+ function hideWithInteractivity(event) {
3179
+
3180
+ getDocument().addEventListener('mousemove', debouncedOnMouseMove);
3181
+ pushIfUnique(mouseMoveListeners, debouncedOnMouseMove);
3182
+ debouncedOnMouseMove(event);
3183
+ }
3184
+
3185
+ function unmount() {
3186
+
3187
+ if (instance.state.isVisible) {
3188
+ instance.hide();
3189
+ }
3190
+
3191
+ if (!instance.state.isMounted) {
3192
+ return;
3193
+ }
3194
+
3195
+ destroyPopperInstance(); // If a popper is not interactive, it will be appended outside the popper
3196
+ // tree by default. This seems mainly for interactive tippies, but we should
3197
+ // find a workaround if possible
3198
+
3199
+ getNestedPopperTree().forEach(function (nestedPopper) {
3200
+ nestedPopper._tippy.unmount();
3201
+ });
3202
+
3203
+ if (popper.parentNode) {
3204
+ popper.parentNode.removeChild(popper);
3205
+ }
3206
+
3207
+ mountedInstances = mountedInstances.filter(function (i) {
3208
+ return i !== instance;
3209
+ });
3210
+ instance.state.isMounted = false;
3211
+ invokeHook('onHidden', [instance]);
3212
+ }
3213
+
3214
+ function destroy() {
3215
+
3216
+ if (instance.state.isDestroyed) {
3217
+ return;
3218
+ }
3219
+
3220
+ instance.clearDelayTimeouts();
3221
+ instance.unmount();
3222
+ removeListeners();
3223
+ delete reference._tippy;
3224
+ instance.state.isDestroyed = true;
3225
+ invokeHook('onDestroy', [instance]);
3226
+ }
3227
+ }
3228
+
3229
+ function tippy(targets, optionalProps) {
3230
+ if (optionalProps === void 0) {
3231
+ optionalProps = {};
3232
+ }
3233
+
3234
+ var plugins = defaultProps.plugins.concat(optionalProps.plugins || []);
3235
+
3236
+ bindGlobalEventListeners();
3237
+ var passedProps = Object.assign({}, optionalProps, {
3238
+ plugins: plugins
3239
+ });
3240
+ var elements = getArrayOfElements(targets);
3241
+
3242
+ var instances = elements.reduce(function (acc, reference) {
3243
+ var instance = reference && createTippy(reference, passedProps);
3244
+
3245
+ if (instance) {
3246
+ acc.push(instance);
3247
+ }
3248
+
3249
+ return acc;
3250
+ }, []);
3251
+ return isElement$1(targets) ? instances[0] : instances;
3252
+ }
3253
+
3254
+ tippy.defaultProps = defaultProps;
3255
+ tippy.setDefaultProps = setDefaultProps;
3256
+ tippy.currentInput = currentInput;
3257
+
3258
+ // every time the popper is destroyed (i.e. a new target), removing the styles
3259
+ // and causing transitions to break for singletons when the console is open, but
3260
+ // most notably for non-transform styles being used, `gpuAcceleration: false`.
3261
+
3262
+ var applyStylesModifier = Object.assign({}, applyStyles$1, {
3263
+ effect: function effect(_ref) {
3264
+ var state = _ref.state;
3265
+ var initialStyles = {
3266
+ popper: {
3267
+ position: state.options.strategy,
3268
+ left: '0',
3269
+ top: '0',
3270
+ margin: '0'
3271
+ },
3272
+ arrow: {
3273
+ position: 'absolute'
3274
+ },
3275
+ reference: {}
3276
+ };
3277
+ Object.assign(state.elements.popper.style, initialStyles.popper);
3278
+ state.styles = initialStyles;
3279
+
3280
+ if (state.elements.arrow) {
3281
+ Object.assign(state.elements.arrow.style, initialStyles.arrow);
3282
+ } // intentionally return no cleanup function
3283
+ // return () => { ... }
3284
+
3285
+ }
3286
+ });
3287
+
3288
+ var createSingleton = function createSingleton(tippyInstances, optionalProps) {
3289
+ var _optionalProps$popper;
3290
+
3291
+ if (optionalProps === void 0) {
3292
+ optionalProps = {};
3293
+ }
3294
+
3295
+ var individualInstances = tippyInstances;
3296
+ var references = [];
3297
+ var triggerTargets = [];
3298
+ var currentTarget;
3299
+ var overrides = optionalProps.overrides;
3300
+ var interceptSetPropsCleanups = [];
3301
+ var shownOnCreate = false;
3302
+
3303
+ function setTriggerTargets() {
3304
+ triggerTargets = individualInstances.map(function (instance) {
3305
+ return normalizeToArray(instance.props.triggerTarget || instance.reference);
3306
+ }).reduce(function (acc, item) {
3307
+ return acc.concat(item);
3308
+ }, []);
3309
+ }
3310
+
3311
+ function setReferences() {
3312
+ references = individualInstances.map(function (instance) {
3313
+ return instance.reference;
3314
+ });
3315
+ }
3316
+
3317
+ function enableInstances(isEnabled) {
3318
+ individualInstances.forEach(function (instance) {
3319
+ if (isEnabled) {
3320
+ instance.enable();
3321
+ } else {
3322
+ instance.disable();
3323
+ }
3324
+ });
3325
+ }
3326
+
3327
+ function interceptSetProps(singleton) {
3328
+ return individualInstances.map(function (instance) {
3329
+ var originalSetProps = instance.setProps;
3330
+
3331
+ instance.setProps = function (props) {
3332
+ originalSetProps(props);
3333
+
3334
+ if (instance.reference === currentTarget) {
3335
+ singleton.setProps(props);
3336
+ }
3337
+ };
3338
+
3339
+ return function () {
3340
+ instance.setProps = originalSetProps;
3341
+ };
3342
+ });
3343
+ } // have to pass singleton, as it maybe undefined on first call
3344
+
3345
+
3346
+ function prepareInstance(singleton, target) {
3347
+ var index = triggerTargets.indexOf(target); // bail-out
3348
+
3349
+ if (target === currentTarget) {
3350
+ return;
3351
+ }
3352
+
3353
+ currentTarget = target;
3354
+ var overrideProps = (overrides || []).concat('content').reduce(function (acc, prop) {
3355
+ acc[prop] = individualInstances[index].props[prop];
3356
+ return acc;
3357
+ }, {});
3358
+ singleton.setProps(Object.assign({}, overrideProps, {
3359
+ getReferenceClientRect: typeof overrideProps.getReferenceClientRect === 'function' ? overrideProps.getReferenceClientRect : function () {
3360
+ var _references$index;
3361
+
3362
+ return (_references$index = references[index]) == null ? void 0 : _references$index.getBoundingClientRect();
3363
+ }
3364
+ }));
3365
+ }
3366
+
3367
+ enableInstances(false);
3368
+ setReferences();
3369
+ setTriggerTargets();
3370
+ var plugin = {
3371
+ fn: function fn() {
3372
+ return {
3373
+ onDestroy: function onDestroy() {
3374
+ enableInstances(true);
3375
+ },
3376
+ onHidden: function onHidden() {
3377
+ currentTarget = null;
3378
+ },
3379
+ onClickOutside: function onClickOutside(instance) {
3380
+ if (instance.props.showOnCreate && !shownOnCreate) {
3381
+ shownOnCreate = true;
3382
+ currentTarget = null;
3383
+ }
3384
+ },
3385
+ onShow: function onShow(instance) {
3386
+ if (instance.props.showOnCreate && !shownOnCreate) {
3387
+ shownOnCreate = true;
3388
+ prepareInstance(instance, references[0]);
3389
+ }
3390
+ },
3391
+ onTrigger: function onTrigger(instance, event) {
3392
+ prepareInstance(instance, event.currentTarget);
3393
+ }
3394
+ };
3395
+ }
3396
+ };
3397
+ var singleton = tippy(div(), Object.assign({}, removeProperties(optionalProps, ['overrides']), {
3398
+ plugins: [plugin].concat(optionalProps.plugins || []),
3399
+ triggerTarget: triggerTargets,
3400
+ popperOptions: Object.assign({}, optionalProps.popperOptions, {
3401
+ modifiers: [].concat(((_optionalProps$popper = optionalProps.popperOptions) == null ? void 0 : _optionalProps$popper.modifiers) || [], [applyStylesModifier])
3402
+ })
3403
+ }));
3404
+ var originalShow = singleton.show;
3405
+
3406
+ singleton.show = function (target) {
3407
+ originalShow(); // first time, showOnCreate or programmatic call with no params
3408
+ // default to showing first instance
3409
+
3410
+ if (!currentTarget && target == null) {
3411
+ return prepareInstance(singleton, references[0]);
3412
+ } // triggered from event (do nothing as prepareInstance already called by onTrigger)
3413
+ // programmatic call with no params when already visible (do nothing again)
3414
+
3415
+
3416
+ if (currentTarget && target == null) {
3417
+ return;
3418
+ } // target is index of instance
3419
+
3420
+
3421
+ if (typeof target === 'number') {
3422
+ return references[target] && prepareInstance(singleton, references[target]);
3423
+ } // target is a child tippy instance
3424
+
3425
+
3426
+ if (individualInstances.indexOf(target) >= 0) {
3427
+ var ref = target.reference;
3428
+ return prepareInstance(singleton, ref);
3429
+ } // target is a ReferenceElement
3430
+
3431
+
3432
+ if (references.indexOf(target) >= 0) {
3433
+ return prepareInstance(singleton, target);
3434
+ }
3435
+ };
3436
+
3437
+ singleton.showNext = function () {
3438
+ var first = references[0];
3439
+
3440
+ if (!currentTarget) {
3441
+ return singleton.show(0);
3442
+ }
3443
+
3444
+ var index = references.indexOf(currentTarget);
3445
+ singleton.show(references[index + 1] || first);
3446
+ };
3447
+
3448
+ singleton.showPrevious = function () {
3449
+ var last = references[references.length - 1];
3450
+
3451
+ if (!currentTarget) {
3452
+ return singleton.show(last);
3453
+ }
3454
+
3455
+ var index = references.indexOf(currentTarget);
3456
+ var target = references[index - 1] || last;
3457
+ singleton.show(target);
3458
+ };
3459
+
3460
+ var originalSetProps = singleton.setProps;
3461
+
3462
+ singleton.setProps = function (props) {
3463
+ overrides = props.overrides || overrides;
3464
+ originalSetProps(props);
3465
+ };
3466
+
3467
+ singleton.setInstances = function (nextInstances) {
3468
+ enableInstances(true);
3469
+ interceptSetPropsCleanups.forEach(function (fn) {
3470
+ return fn();
3471
+ });
3472
+ individualInstances = nextInstances;
3473
+ enableInstances(false);
3474
+ setReferences();
3475
+ setTriggerTargets();
3476
+ interceptSetPropsCleanups = interceptSetProps(singleton);
3477
+ singleton.setProps({
3478
+ triggerTarget: triggerTargets
3479
+ });
3480
+ };
3481
+
3482
+ interceptSetPropsCleanups = interceptSetProps(singleton);
3483
+ return singleton;
3484
+ };
3485
+
3486
+ var animateFill = {
3487
+ name: 'animateFill',
3488
+ defaultValue: false,
3489
+ fn: function fn(instance) {
3490
+ var _instance$props$rende;
3491
+
3492
+ // @ts-ignore
3493
+ if (!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy)) {
3494
+
3495
+ return {};
3496
+ }
3497
+
3498
+ var _getChildren = getChildren(instance.popper),
3499
+ box = _getChildren.box,
3500
+ content = _getChildren.content;
3501
+
3502
+ var backdrop = instance.props.animateFill ? createBackdropElement() : null;
3503
+ return {
3504
+ onCreate: function onCreate() {
3505
+ if (backdrop) {
3506
+ box.insertBefore(backdrop, box.firstElementChild);
3507
+ box.setAttribute('data-animatefill', '');
3508
+ box.style.overflow = 'hidden';
3509
+ instance.setProps({
3510
+ arrow: false,
3511
+ animation: 'shift-away'
3512
+ });
3513
+ }
3514
+ },
3515
+ onMount: function onMount() {
3516
+ if (backdrop) {
3517
+ var transitionDuration = box.style.transitionDuration;
3518
+ var duration = Number(transitionDuration.replace('ms', '')); // The content should fade in after the backdrop has mostly filled the
3519
+ // tooltip element. `clip-path` is the other alternative but is not
3520
+ // well-supported and is buggy on some devices.
3521
+
3522
+ content.style.transitionDelay = Math.round(duration / 10) + "ms";
3523
+ backdrop.style.transitionDuration = transitionDuration;
3524
+ setVisibilityState([backdrop], 'visible');
3525
+ }
3526
+ },
3527
+ onShow: function onShow() {
3528
+ if (backdrop) {
3529
+ backdrop.style.transitionDuration = '0ms';
3530
+ }
3531
+ },
3532
+ onHide: function onHide() {
3533
+ if (backdrop) {
3534
+ setVisibilityState([backdrop], 'hidden');
3535
+ }
3536
+ }
3537
+ };
3538
+ }
3539
+ };
3540
+
3541
+ function createBackdropElement() {
3542
+ var backdrop = div();
3543
+ backdrop.className = BACKDROP_CLASS;
3544
+ setVisibilityState([backdrop], 'hidden');
3545
+ return backdrop;
3546
+ }
3547
+
3548
+ var mouseCoords = {
3549
+ clientX: 0,
3550
+ clientY: 0
3551
+ };
3552
+ var activeInstances = [];
3553
+
3554
+ function storeMouseCoords(_ref) {
3555
+ var clientX = _ref.clientX,
3556
+ clientY = _ref.clientY;
3557
+ mouseCoords = {
3558
+ clientX: clientX,
3559
+ clientY: clientY
3560
+ };
3561
+ }
3562
+
3563
+ function addMouseCoordsListener(doc) {
3564
+ doc.addEventListener('mousemove', storeMouseCoords);
3565
+ }
3566
+
3567
+ function removeMouseCoordsListener(doc) {
3568
+ doc.removeEventListener('mousemove', storeMouseCoords);
3569
+ }
3570
+
3571
+ var followCursor = {
3572
+ name: 'followCursor',
3573
+ defaultValue: false,
3574
+ fn: function fn(instance) {
3575
+ var reference = instance.reference;
3576
+ var doc = getOwnerDocument(instance.props.triggerTarget || reference);
3577
+ var isInternalUpdate = false;
3578
+ var wasFocusEvent = false;
3579
+ var isUnmounted = true;
3580
+ var prevProps = instance.props;
3581
+
3582
+ function getIsInitialBehavior() {
3583
+ return instance.props.followCursor === 'initial' && instance.state.isVisible;
3584
+ }
3585
+
3586
+ function addListener() {
3587
+ doc.addEventListener('mousemove', onMouseMove);
3588
+ }
3589
+
3590
+ function removeListener() {
3591
+ doc.removeEventListener('mousemove', onMouseMove);
3592
+ }
3593
+
3594
+ function unsetGetReferenceClientRect() {
3595
+ isInternalUpdate = true;
3596
+ instance.setProps({
3597
+ getReferenceClientRect: null
3598
+ });
3599
+ isInternalUpdate = false;
3600
+ }
3601
+
3602
+ function onMouseMove(event) {
3603
+ // If the instance is interactive, avoid updating the position unless it's
3604
+ // over the reference element
3605
+ var isCursorOverReference = event.target ? reference.contains(event.target) : true;
3606
+ var followCursor = instance.props.followCursor;
3607
+ var clientX = event.clientX,
3608
+ clientY = event.clientY;
3609
+ var rect = reference.getBoundingClientRect();
3610
+ var relativeX = clientX - rect.left;
3611
+ var relativeY = clientY - rect.top;
3612
+
3613
+ if (isCursorOverReference || !instance.props.interactive) {
3614
+ instance.setProps({
3615
+ // @ts-ignore - unneeded DOMRect properties
3616
+ getReferenceClientRect: function getReferenceClientRect() {
3617
+ var rect = reference.getBoundingClientRect();
3618
+ var x = clientX;
3619
+ var y = clientY;
3620
+
3621
+ if (followCursor === 'initial') {
3622
+ x = rect.left + relativeX;
3623
+ y = rect.top + relativeY;
3624
+ }
3625
+
3626
+ var top = followCursor === 'horizontal' ? rect.top : y;
3627
+ var right = followCursor === 'vertical' ? rect.right : x;
3628
+ var bottom = followCursor === 'horizontal' ? rect.bottom : y;
3629
+ var left = followCursor === 'vertical' ? rect.left : x;
3630
+ return {
3631
+ width: right - left,
3632
+ height: bottom - top,
3633
+ top: top,
3634
+ right: right,
3635
+ bottom: bottom,
3636
+ left: left
3637
+ };
3638
+ }
3639
+ });
3640
+ }
3641
+ }
3642
+
3643
+ function create() {
3644
+ if (instance.props.followCursor) {
3645
+ activeInstances.push({
3646
+ instance: instance,
3647
+ doc: doc
3648
+ });
3649
+ addMouseCoordsListener(doc);
3650
+ }
3651
+ }
3652
+
3653
+ function destroy() {
3654
+ activeInstances = activeInstances.filter(function (data) {
3655
+ return data.instance !== instance;
3656
+ });
3657
+
3658
+ if (activeInstances.filter(function (data) {
3659
+ return data.doc === doc;
3660
+ }).length === 0) {
3661
+ removeMouseCoordsListener(doc);
3662
+ }
3663
+ }
3664
+
3665
+ return {
3666
+ onCreate: create,
3667
+ onDestroy: destroy,
3668
+ onBeforeUpdate: function onBeforeUpdate() {
3669
+ prevProps = instance.props;
3670
+ },
3671
+ onAfterUpdate: function onAfterUpdate(_, _ref2) {
3672
+ var followCursor = _ref2.followCursor;
3673
+
3674
+ if (isInternalUpdate) {
3675
+ return;
3676
+ }
3677
+
3678
+ if (followCursor !== undefined && prevProps.followCursor !== followCursor) {
3679
+ destroy();
3680
+
3681
+ if (followCursor) {
3682
+ create();
3683
+
3684
+ if (instance.state.isMounted && !wasFocusEvent && !getIsInitialBehavior()) {
3685
+ addListener();
3686
+ }
3687
+ } else {
3688
+ removeListener();
3689
+ unsetGetReferenceClientRect();
3690
+ }
3691
+ }
3692
+ },
3693
+ onMount: function onMount() {
3694
+ if (instance.props.followCursor && !wasFocusEvent) {
3695
+ if (isUnmounted) {
3696
+ onMouseMove(mouseCoords);
3697
+ isUnmounted = false;
3698
+ }
3699
+
3700
+ if (!getIsInitialBehavior()) {
3701
+ addListener();
3702
+ }
3703
+ }
3704
+ },
3705
+ onTrigger: function onTrigger(_, event) {
3706
+ if (isMouseEvent(event)) {
3707
+ mouseCoords = {
3708
+ clientX: event.clientX,
3709
+ clientY: event.clientY
3710
+ };
3711
+ }
3712
+
3713
+ wasFocusEvent = event.type === 'focus';
3714
+ },
3715
+ onHidden: function onHidden() {
3716
+ if (instance.props.followCursor) {
3717
+ unsetGetReferenceClientRect();
3718
+ removeListener();
3719
+ isUnmounted = true;
3720
+ }
3721
+ }
3722
+ };
3723
+ }
3724
+ };
3725
+
3726
+ function getProps(props, modifier) {
3727
+ var _props$popperOptions;
3728
+
3729
+ return {
3730
+ popperOptions: Object.assign({}, props.popperOptions, {
3731
+ modifiers: [].concat((((_props$popperOptions = props.popperOptions) == null ? void 0 : _props$popperOptions.modifiers) || []).filter(function (_ref) {
3732
+ var name = _ref.name;
3733
+ return name !== modifier.name;
3734
+ }), [modifier])
3735
+ })
3736
+ };
3737
+ }
3738
+
3739
+ var inlinePositioning = {
3740
+ name: 'inlinePositioning',
3741
+ defaultValue: false,
3742
+ fn: function fn(instance) {
3743
+ var reference = instance.reference;
3744
+
3745
+ function isEnabled() {
3746
+ return !!instance.props.inlinePositioning;
3747
+ }
3748
+
3749
+ var placement;
3750
+ var cursorRectIndex = -1;
3751
+ var isInternalUpdate = false;
3752
+ var triedPlacements = [];
3753
+ var modifier = {
3754
+ name: 'tippyInlinePositioning',
3755
+ enabled: true,
3756
+ phase: 'afterWrite',
3757
+ fn: function fn(_ref2) {
3758
+ var state = _ref2.state;
3759
+
3760
+ if (isEnabled()) {
3761
+ if (triedPlacements.indexOf(state.placement) !== -1) {
3762
+ triedPlacements = [];
3763
+ }
3764
+
3765
+ if (placement !== state.placement && triedPlacements.indexOf(state.placement) === -1) {
3766
+ triedPlacements.push(state.placement);
3767
+ instance.setProps({
3768
+ // @ts-ignore - unneeded DOMRect properties
3769
+ getReferenceClientRect: function getReferenceClientRect() {
3770
+ return _getReferenceClientRect(state.placement);
3771
+ }
3772
+ });
3773
+ }
3774
+
3775
+ placement = state.placement;
3776
+ }
3777
+ }
3778
+ };
3779
+
3780
+ function _getReferenceClientRect(placement) {
3781
+ return getInlineBoundingClientRect(getBasePlacement$1(placement), reference.getBoundingClientRect(), arrayFrom(reference.getClientRects()), cursorRectIndex);
3782
+ }
3783
+
3784
+ function setInternalProps(partialProps) {
3785
+ isInternalUpdate = true;
3786
+ instance.setProps(partialProps);
3787
+ isInternalUpdate = false;
3788
+ }
3789
+
3790
+ function addModifier() {
3791
+ if (!isInternalUpdate) {
3792
+ setInternalProps(getProps(instance.props, modifier));
3793
+ }
3794
+ }
3795
+
3796
+ return {
3797
+ onCreate: addModifier,
3798
+ onAfterUpdate: addModifier,
3799
+ onTrigger: function onTrigger(_, event) {
3800
+ if (isMouseEvent(event)) {
3801
+ var rects = arrayFrom(instance.reference.getClientRects());
3802
+ var cursorRect = rects.find(function (rect) {
3803
+ return rect.left - 2 <= event.clientX && rect.right + 2 >= event.clientX && rect.top - 2 <= event.clientY && rect.bottom + 2 >= event.clientY;
3804
+ });
3805
+ var index = rects.indexOf(cursorRect);
3806
+ cursorRectIndex = index > -1 ? index : cursorRectIndex;
3807
+ }
3808
+ },
3809
+ onHidden: function onHidden() {
3810
+ cursorRectIndex = -1;
3811
+ }
3812
+ };
3813
+ }
3814
+ };
3815
+ function getInlineBoundingClientRect(currentBasePlacement, boundingRect, clientRects, cursorRectIndex) {
3816
+ // Not an inline element, or placement is not yet known
3817
+ if (clientRects.length < 2 || currentBasePlacement === null) {
3818
+ return boundingRect;
3819
+ } // There are two rects and they are disjoined
3820
+
3821
+
3822
+ if (clientRects.length === 2 && cursorRectIndex >= 0 && clientRects[0].left > clientRects[1].right) {
3823
+ return clientRects[cursorRectIndex] || boundingRect;
3824
+ }
3825
+
3826
+ switch (currentBasePlacement) {
3827
+ case 'top':
3828
+ case 'bottom':
3829
+ {
3830
+ var firstRect = clientRects[0];
3831
+ var lastRect = clientRects[clientRects.length - 1];
3832
+ var isTop = currentBasePlacement === 'top';
3833
+ var top = firstRect.top;
3834
+ var bottom = lastRect.bottom;
3835
+ var left = isTop ? firstRect.left : lastRect.left;
3836
+ var right = isTop ? firstRect.right : lastRect.right;
3837
+ var width = right - left;
3838
+ var height = bottom - top;
3839
+ return {
3840
+ top: top,
3841
+ bottom: bottom,
3842
+ left: left,
3843
+ right: right,
3844
+ width: width,
3845
+ height: height
3846
+ };
3847
+ }
3848
+
3849
+ case 'left':
3850
+ case 'right':
3851
+ {
3852
+ var minLeft = Math.min.apply(Math, clientRects.map(function (rects) {
3853
+ return rects.left;
3854
+ }));
3855
+ var maxRight = Math.max.apply(Math, clientRects.map(function (rects) {
3856
+ return rects.right;
3857
+ }));
3858
+ var measureRects = clientRects.filter(function (rect) {
3859
+ return currentBasePlacement === 'left' ? rect.left === minLeft : rect.right === maxRight;
3860
+ });
3861
+ var _top = measureRects[0].top;
3862
+ var _bottom = measureRects[measureRects.length - 1].bottom;
3863
+ var _left = minLeft;
3864
+ var _right = maxRight;
3865
+
3866
+ var _width = _right - _left;
3867
+
3868
+ var _height = _bottom - _top;
3869
+
3870
+ return {
3871
+ top: _top,
3872
+ bottom: _bottom,
3873
+ left: _left,
3874
+ right: _right,
3875
+ width: _width,
3876
+ height: _height
3877
+ };
3878
+ }
3879
+
3880
+ default:
3881
+ {
3882
+ return boundingRect;
3883
+ }
3884
+ }
3885
+ }
3886
+
3887
+ var sticky = {
3888
+ name: 'sticky',
3889
+ defaultValue: false,
3890
+ fn: function fn(instance) {
3891
+ var reference = instance.reference,
3892
+ popper = instance.popper;
3893
+
3894
+ function getReference() {
3895
+ return instance.popperInstance ? instance.popperInstance.state.elements.reference : reference;
3896
+ }
3897
+
3898
+ function shouldCheck(value) {
3899
+ return instance.props.sticky === true || instance.props.sticky === value;
3900
+ }
3901
+
3902
+ var prevRefRect = null;
3903
+ var prevPopRect = null;
3904
+
3905
+ function updatePosition() {
3906
+ var currentRefRect = shouldCheck('reference') ? getReference().getBoundingClientRect() : null;
3907
+ var currentPopRect = shouldCheck('popper') ? popper.getBoundingClientRect() : null;
3908
+
3909
+ if (currentRefRect && areRectsDifferent(prevRefRect, currentRefRect) || currentPopRect && areRectsDifferent(prevPopRect, currentPopRect)) {
3910
+ if (instance.popperInstance) {
3911
+ instance.popperInstance.update();
3912
+ }
3913
+ }
3914
+
3915
+ prevRefRect = currentRefRect;
3916
+ prevPopRect = currentPopRect;
3917
+
3918
+ if (instance.state.isMounted) {
3919
+ requestAnimationFrame(updatePosition);
3920
+ }
3921
+ }
3922
+
3923
+ return {
3924
+ onMount: function onMount() {
3925
+ if (instance.props.sticky) {
3926
+ updatePosition();
3927
+ }
3928
+ }
3929
+ };
3930
+ }
3931
+ };
3932
+
3933
+ function areRectsDifferent(rectA, rectB) {
3934
+ if (rectA && rectB) {
3935
+ return rectA.top !== rectB.top || rectA.right !== rectB.right || rectA.bottom !== rectB.bottom || rectA.left !== rectB.left;
3936
+ }
3937
+
3938
+ return true;
3939
+ }
3940
+
3941
+ tippy.setDefaultProps({
3942
+ render: render
3943
+ });
3944
+
3945
+ tippy.setDefaultProps({
3946
+ //@ts-ignore
3947
+ onShow: instance => {
3948
+ if (!instance.props.content)
3949
+ return false;
3950
+ },
3951
+ });
3952
+ function useTippy(el, opts = {}, settings = { mount: true }) {
3953
+ const vm = vue.getCurrentInstance();
3954
+ const instance = vue.ref();
3955
+ const state = vue.ref({
3956
+ isEnabled: false,
3957
+ isVisible: false,
3958
+ isDestroyed: false,
3959
+ isMounted: false,
3960
+ isShown: false,
3961
+ });
3962
+ let container = null;
3963
+ const getContainer = () => {
3964
+ if (container)
3965
+ return container;
3966
+ container = document.createDocumentFragment();
3967
+ return container;
3968
+ };
3969
+ const getContent = (content) => {
3970
+ let newContent;
3971
+ let unwrappedContent = vue.isRef(content)
3972
+ ? content.value
3973
+ : content;
3974
+ if (vue.isVNode(unwrappedContent)) {
3975
+ if (vm) {
3976
+ unwrappedContent.appContext = vm.appContext;
3977
+ }
3978
+ vue.render(unwrappedContent, getContainer());
3979
+ newContent = () => getContainer();
3980
+ }
3981
+ else if (typeof unwrappedContent === 'object') {
3982
+ let comp = vue.h(unwrappedContent);
3983
+ if (vm) {
3984
+ comp.appContext = vm.appContext;
3985
+ }
3986
+ vue.render(comp, getContainer());
3987
+ newContent = () => getContainer();
3988
+ }
3989
+ else {
3990
+ newContent = unwrappedContent;
3991
+ }
3992
+ return newContent;
3993
+ };
3994
+ const getProps = (opts) => {
3995
+ let options = {};
3996
+ if (vue.isRef(opts)) {
3997
+ options = opts.value || {};
3998
+ }
3999
+ else if (vue.isReactive(opts)) {
4000
+ options = { ...opts };
4001
+ }
4002
+ else {
4003
+ options = { ...opts };
4004
+ }
4005
+ if (options.content) {
4006
+ options.content = getContent(options.content);
4007
+ }
4008
+ if (options.triggerTarget) {
4009
+ options.triggerTarget = vue.isRef(options.triggerTarget)
4010
+ ? options.triggerTarget.value
4011
+ : options.triggerTarget;
4012
+ }
4013
+ if (!options.plugins || !Array.isArray(options.plugins)) {
4014
+ options.plugins = [];
4015
+ }
4016
+ options.plugins = options.plugins.filter((plugin) => plugin.name !== 'vueTippyReactiveState');
4017
+ options.plugins.push({
4018
+ name: 'vueTippyReactiveState',
4019
+ fn: () => {
4020
+ return {
4021
+ onCreate() {
4022
+ state.value.isEnabled = true;
4023
+ },
4024
+ onMount() {
4025
+ state.value.isMounted = true;
4026
+ },
4027
+ onShow() {
4028
+ state.value.isMounted = true;
4029
+ state.value.isVisible = true;
4030
+ },
4031
+ onShown() {
4032
+ state.value.isShown = true;
4033
+ },
4034
+ onHide() {
4035
+ state.value.isMounted = false;
4036
+ state.value.isVisible = false;
4037
+ },
4038
+ onHidden() {
4039
+ state.value.isShown = false;
4040
+ },
4041
+ onUnmounted() {
4042
+ state.value.isMounted = false;
4043
+ },
4044
+ onDestroy() {
4045
+ state.value.isDestroyed = true;
4046
+ },
4047
+ };
4048
+ }
4049
+ });
4050
+ return options;
4051
+ };
4052
+ const refresh = () => {
4053
+ if (!instance.value)
4054
+ return;
4055
+ instance.value.setProps(getProps(opts));
4056
+ };
4057
+ const refreshContent = () => {
4058
+ if (!instance.value || !opts.content)
4059
+ return;
4060
+ instance.value.setContent(getContent(opts.content));
4061
+ };
4062
+ const setContent = (value) => {
4063
+ var _a;
4064
+ (_a = instance.value) === null || _a === void 0 ? void 0 : _a.setContent(getContent(value));
4065
+ };
4066
+ const setProps = (value) => {
4067
+ var _a;
4068
+ (_a = instance.value) === null || _a === void 0 ? void 0 : _a.setProps(getProps(value));
4069
+ };
4070
+ const destroy = () => {
4071
+ if (instance.value) {
4072
+ instance.value.destroy();
4073
+ instance.value = undefined;
4074
+ }
4075
+ container = null;
4076
+ };
4077
+ const show = () => {
4078
+ var _a;
4079
+ (_a = instance.value) === null || _a === void 0 ? void 0 : _a.show();
4080
+ };
4081
+ const hide = () => {
4082
+ var _a;
4083
+ (_a = instance.value) === null || _a === void 0 ? void 0 : _a.hide();
4084
+ };
4085
+ const disable = () => {
4086
+ var _a;
4087
+ (_a = instance.value) === null || _a === void 0 ? void 0 : _a.disable();
4088
+ state.value.isEnabled = false;
4089
+ };
4090
+ const enable = () => {
4091
+ var _a;
4092
+ (_a = instance.value) === null || _a === void 0 ? void 0 : _a.enable();
4093
+ state.value.isEnabled = true;
4094
+ };
4095
+ const unmount = () => {
4096
+ var _a;
4097
+ (_a = instance.value) === null || _a === void 0 ? void 0 : _a.unmount();
4098
+ };
4099
+ const mount = () => {
4100
+ if (!el)
4101
+ return;
4102
+ let target = vue.isRef(el) ? el.value : el;
4103
+ if (typeof target === 'function')
4104
+ target = target();
4105
+ if (target) {
4106
+ instance.value = tippy(target, getProps(opts));
4107
+ //@ts-ignore
4108
+ target.$tippy = response;
4109
+ }
4110
+ };
4111
+ const response = {
4112
+ tippy: instance,
4113
+ refresh,
4114
+ refreshContent,
4115
+ setContent,
4116
+ setProps,
4117
+ destroy,
4118
+ hide,
4119
+ show,
4120
+ disable,
4121
+ enable,
4122
+ unmount,
4123
+ mount,
4124
+ state,
4125
+ };
4126
+ if (settings.mount) {
4127
+ if (vm) {
4128
+ if (vm.isMounted) {
4129
+ mount();
4130
+ }
4131
+ else {
4132
+ vue.onMounted(mount);
4133
+ }
4134
+ vue.onUnmounted(() => {
4135
+ destroy();
4136
+ });
4137
+ }
4138
+ else {
4139
+ mount();
4140
+ }
4141
+ }
4142
+ if (vue.isRef(opts) || vue.isReactive(opts)) {
4143
+ vue.watch(opts, refresh, { immediate: false });
4144
+ }
4145
+ else if (vue.isRef(opts.content)) {
4146
+ vue.watch(opts.content, refreshContent, { immediate: false });
4147
+ }
4148
+ return response;
4149
+ }
4150
+
4151
+ function useTippyComponent(opts = {}, children) {
4152
+ const instance = vue.ref();
4153
+ return {
4154
+ instance,
4155
+ TippyComponent: vue.h(TippyComponent, {
4156
+ ...opts,
4157
+ onVnodeMounted: (vnode) => {
4158
+ //@ts-ignore
4159
+ instance.value = vnode.component.ctx;
4160
+ },
4161
+ }, children),
4162
+ };
4163
+ }
4164
+
4165
+ function useSingleton(instances, optionalProps) {
4166
+ const singleton = vue.ref();
4167
+ vue.onMounted(() => {
4168
+ const pendingTippyInstances = Array.isArray(instances)
4169
+ ? instances.map(i => i.value)
4170
+ : typeof instances === 'function'
4171
+ ? instances()
4172
+ : instances.value;
4173
+ const tippyInstances = pendingTippyInstances
4174
+ .map((instance) => {
4175
+ if (instance instanceof Element) {
4176
+ //@ts-ignore
4177
+ return instance._tippy;
4178
+ }
4179
+ return instance;
4180
+ })
4181
+ .filter(Boolean);
4182
+ singleton.value = createSingleton(tippyInstances, optionalProps
4183
+ ? { allowHTML: true, ...optionalProps }
4184
+ : { allowHTML: true });
4185
+ });
4186
+ return {
4187
+ singleton,
4188
+ };
4189
+ }
4190
+
4191
+ const TippyComponent = vue.defineComponent({
4192
+ props: {
4193
+ to: {
4194
+ type: [String, Function],
4195
+ },
4196
+ tag: {
4197
+ type: String,
4198
+ default: 'span'
4199
+ },
4200
+ contentTag: {
4201
+ type: String,
4202
+ default: 'span'
4203
+ },
4204
+ contentClass: {
4205
+ type: String,
4206
+ default: null
4207
+ },
4208
+ appendTo: { default: () => tippy.defaultProps['appendTo'] },
4209
+ aria: { default: () => tippy.defaultProps['aria'] },
4210
+ delay: { default: () => tippy.defaultProps['delay'] },
4211
+ duration: { default: () => tippy.defaultProps['duration'] },
4212
+ getReferenceClientRect: { default: () => tippy.defaultProps['getReferenceClientRect'] },
4213
+ hideOnClick: { type: [Boolean, String], default: () => tippy.defaultProps['hideOnClick'] },
4214
+ ignoreAttributes: { type: Boolean, default: () => tippy.defaultProps['ignoreAttributes'] },
4215
+ interactive: { type: Boolean, default: () => tippy.defaultProps['interactive'] },
4216
+ interactiveBorder: { default: () => tippy.defaultProps['interactiveBorder'] },
4217
+ interactiveDebounce: { default: () => tippy.defaultProps['interactiveDebounce'] },
4218
+ moveTransition: { default: () => tippy.defaultProps['moveTransition'] },
4219
+ offset: { default: () => tippy.defaultProps['offset'] },
4220
+ onAfterUpdate: { default: () => tippy.defaultProps['onAfterUpdate'] },
4221
+ onBeforeUpdate: { default: () => tippy.defaultProps['onBeforeUpdate'] },
4222
+ onCreate: { default: () => tippy.defaultProps['onCreate'] },
4223
+ onDestroy: { default: () => tippy.defaultProps['onDestroy'] },
4224
+ onHidden: { default: () => tippy.defaultProps['onHidden'] },
4225
+ onHide: { default: () => tippy.defaultProps['onHide'] },
4226
+ onMount: { default: () => tippy.defaultProps['onMount'] },
4227
+ onShow: { default: () => tippy.defaultProps['onShow'] },
4228
+ onShown: { default: () => tippy.defaultProps['onShown'] },
4229
+ onTrigger: { default: () => tippy.defaultProps['onTrigger'] },
4230
+ onUntrigger: { default: () => tippy.defaultProps['onUntrigger'] },
4231
+ onClickOutside: { default: () => tippy.defaultProps['onClickOutside'] },
4232
+ placement: { default: () => tippy.defaultProps['placement'] },
4233
+ plugins: { default: () => tippy.defaultProps['plugins'] },
4234
+ popperOptions: { default: () => tippy.defaultProps['popperOptions'] },
4235
+ render: { default: () => tippy.defaultProps['render'] },
4236
+ showOnCreate: { type: Boolean, default: () => tippy.defaultProps['showOnCreate'] },
4237
+ touch: { type: [Boolean, String, Array], default: () => tippy.defaultProps['touch'] },
4238
+ trigger: { default: () => tippy.defaultProps['trigger'] },
4239
+ triggerTarget: { default: () => tippy.defaultProps['triggerTarget'] },
4240
+ animateFill: { type: Boolean, default: () => tippy.defaultProps['animateFill'] },
4241
+ followCursor: { type: [Boolean, String], default: () => tippy.defaultProps['followCursor'] },
4242
+ inlinePositioning: { type: Boolean, default: () => tippy.defaultProps['inlinePositioning'] },
4243
+ sticky: { type: [Boolean, String], default: () => tippy.defaultProps['sticky'] },
4244
+ allowHTML: { type: Boolean, default: () => tippy.defaultProps['allowHTML'] },
4245
+ animation: { default: () => tippy.defaultProps['animation'] },
4246
+ arrow: { default: () => tippy.defaultProps['arrow'] },
4247
+ content: { default: () => tippy.defaultProps['content'] },
4248
+ inertia: { default: () => tippy.defaultProps['inertia'] },
4249
+ maxWidth: { default: () => tippy.defaultProps['maxWidth'] },
4250
+ role: { default: () => tippy.defaultProps['role'] },
4251
+ theme: { default: () => tippy.defaultProps['theme'] },
4252
+ zIndex: { default: () => tippy.defaultProps['zIndex'] }
4253
+ },
4254
+ emits: ['state'],
4255
+ setup(props, { slots, emit, expose }) {
4256
+ const elem = vue.ref();
4257
+ const contentElem = vue.ref();
4258
+ const mounted = vue.ref(false);
4259
+ const getOptions = () => {
4260
+ let options = { ...props };
4261
+ for (const prop of ['to', 'tag', 'contentTag', 'contentClass']) {
4262
+ if (options.hasOwnProperty(prop)) {
4263
+ // @ts-ignore
4264
+ delete options[prop];
4265
+ }
4266
+ }
4267
+ return options;
4268
+ };
4269
+ let target = elem;
4270
+ if (props.to) {
4271
+ if (typeof Element !== 'undefined' && props.to instanceof Element) {
4272
+ target = () => props.to;
4273
+ }
4274
+ else if (typeof props.to === 'string' || props.to instanceof String) {
4275
+ target = () => document.querySelector(props.to);
4276
+ }
4277
+ }
4278
+ const tippy = useTippy(target, getOptions());
4279
+ vue.onMounted(() => {
4280
+ mounted.value = true;
4281
+ vue.nextTick(() => {
4282
+ if (slots.content)
4283
+ tippy.setContent(() => contentElem.value);
4284
+ });
4285
+ });
4286
+ vue.watch(tippy.state, () => {
4287
+ emit('state', vue.unref(tippy.state));
4288
+ }, { immediate: true, deep: true });
4289
+ vue.watch(() => props, () => {
4290
+ tippy.setProps(getOptions());
4291
+ if (slots.content)
4292
+ tippy.setContent(() => contentElem.value);
4293
+ });
4294
+ let exposed = vue.reactive({
4295
+ elem,
4296
+ contentElem,
4297
+ mounted,
4298
+ ...tippy
4299
+ });
4300
+ expose(exposed);
4301
+ return () => {
4302
+ const slot = slots.default ? slots.default(exposed) : [];
4303
+ return vue.h(props.tag, { ref: elem, 'data-v-tippy': '' }, slots.content ? [
4304
+ slot,
4305
+ vue.h(props.contentTag, {
4306
+ ref: contentElem,
4307
+ style: { display: mounted.value ? 'inherit' : 'none' },
4308
+ class: props.contentClass
4309
+ }, slots.content(exposed)),
4310
+ ] : slot);
4311
+ };
4312
+ },
4313
+ });
4314
+
4315
+ const booleanProps = [
4316
+ 'a11y',
4317
+ 'allowHTML',
4318
+ 'arrow',
4319
+ 'flip',
4320
+ 'flipOnUpdate',
4321
+ 'hideOnClick',
4322
+ 'ignoreAttributes',
4323
+ 'inertia',
4324
+ 'interactive',
4325
+ 'lazy',
4326
+ 'multiple',
4327
+ 'showOnInit',
4328
+ 'touch',
4329
+ 'touchHold',
4330
+ ];
4331
+ let props = {};
4332
+ Object.keys(tippy.defaultProps).forEach((prop) => {
4333
+ if (booleanProps.includes(prop)) {
4334
+ props[prop] = {
4335
+ type: Boolean,
4336
+ default: function () {
4337
+ return tippy.defaultProps[prop];
4338
+ },
4339
+ };
4340
+ }
4341
+ else {
4342
+ props[prop] = {
4343
+ default: function () {
4344
+ return tippy.defaultProps[prop];
4345
+ },
4346
+ };
4347
+ }
4348
+ });
4349
+ const TippySingleton = vue.defineComponent({
4350
+ props,
4351
+ setup(props) {
4352
+ const instances = vue.ref([]);
4353
+ const { singleton } = useSingleton(instances, props);
4354
+ return { instances, singleton };
4355
+ },
4356
+ mounted() {
4357
+ var _a;
4358
+ const parent = this.$el.parentElement;
4359
+ const elements = parent.querySelectorAll('[data-v-tippy]');
4360
+ this.instances = Array.from(elements)
4361
+ .map((el) => el._tippy)
4362
+ .filter(Boolean);
4363
+ (_a = this.singleton) === null || _a === void 0 ? void 0 : _a.setInstances(this.instances);
4364
+ },
4365
+ render() {
4366
+ let slot = this.$slots.default ? this.$slots.default() : [];
4367
+ return vue.h(() => slot);
4368
+ },
4369
+ });
4370
+
4371
+ const directive = {
4372
+ mounted(el, binding, vnode) {
4373
+ const opts = typeof binding.value === "string" ? { content: binding.value } : binding.value || {};
4374
+ const modifiers = Object.keys(binding.modifiers || {});
4375
+ const placement = modifiers.find(modifier => modifier !== 'arrow');
4376
+ const withArrow = modifiers.findIndex(modifier => modifier === 'arrow') !== -1;
4377
+ if (placement) {
4378
+ opts.placement = opts.placement || placement;
4379
+ }
4380
+ if (withArrow) {
4381
+ opts.arrow = opts.arrow !== undefined ? opts.arrow : true;
4382
+ }
4383
+ if (vnode.props && vnode.props.onTippyShow) {
4384
+ opts.onShow = function (...args) {
4385
+ var _a;
4386
+ return (_a = vnode.props) === null || _a === void 0 ? void 0 : _a.onTippyShow(...args);
4387
+ };
4388
+ }
4389
+ if (vnode.props && vnode.props.onTippyShown) {
4390
+ opts.onShown = function (...args) {
4391
+ var _a;
4392
+ return (_a = vnode.props) === null || _a === void 0 ? void 0 : _a.onTippyShown(...args);
4393
+ };
4394
+ }
4395
+ if (vnode.props && vnode.props.onTippyHidden) {
4396
+ opts.onHidden = function (...args) {
4397
+ var _a;
4398
+ return (_a = vnode.props) === null || _a === void 0 ? void 0 : _a.onTippyHidden(...args);
4399
+ };
4400
+ }
4401
+ if (vnode.props && vnode.props.onTippyHide) {
4402
+ opts.onHide = function (...args) {
4403
+ var _a;
4404
+ return (_a = vnode.props) === null || _a === void 0 ? void 0 : _a.onTippyHide(...args);
4405
+ };
4406
+ }
4407
+ if (vnode.props && vnode.props.onTippyMount) {
4408
+ opts.onMount = function (...args) {
4409
+ var _a;
4410
+ return (_a = vnode.props) === null || _a === void 0 ? void 0 : _a.onTippyMount(...args);
4411
+ };
4412
+ }
4413
+ if (el.getAttribute('title') && !opts.content) {
4414
+ opts.content = el.getAttribute('title');
4415
+ el.removeAttribute('title');
4416
+ }
4417
+ if (el.getAttribute('content') && !opts.content) {
4418
+ opts.content = el.getAttribute('content');
4419
+ }
4420
+ useTippy(el, opts);
4421
+ },
4422
+ unmounted(el) {
4423
+ if (el.$tippy) {
4424
+ el.$tippy.destroy();
4425
+ }
4426
+ else if (el._tippy) {
4427
+ el._tippy.destroy();
4428
+ }
4429
+ },
4430
+ updated(el, binding) {
4431
+ const opts = typeof binding.value === "string" ? { content: binding.value } : binding.value || {};
4432
+ if (el.getAttribute('title') && !opts.content) {
4433
+ opts.content = el.getAttribute('title');
4434
+ el.removeAttribute('title');
4435
+ }
4436
+ if (el.getAttribute('content') && !opts.content) {
4437
+ opts.content = el.getAttribute('content');
4438
+ }
4439
+ if (el.$tippy) {
4440
+ el.$tippy.setProps(opts || {});
4441
+ }
4442
+ else if (el._tippy) {
4443
+ el._tippy.setProps(opts || {});
4444
+ }
4445
+ },
4446
+ };
4447
+
4448
+ const plugin = {
4449
+ install(app, options = {}) {
4450
+ tippy.setDefaultProps(options.defaultProps || {});
4451
+ app.directive(options.directive || 'tippy', directive);
4452
+ app.component(options.component || 'tippy', TippyComponent);
4453
+ app.component(options.componentSingleton || 'tippy-singleton', TippySingleton);
4454
+ },
4455
+ };
4456
+
4457
+ const setDefaultProps$1 = tippy.setDefaultProps;
4458
+ setDefaultProps$1({
4459
+ ignoreAttributes: true,
4460
+ plugins: [sticky, inlinePositioning, followCursor, animateFill],
4461
+ });
4462
+
4463
+ exports.Tippy = TippyComponent;
4464
+ exports.TippySingleton = TippySingleton;
4465
+ exports.default = plugin;
4466
+ exports.directive = directive;
4467
+ exports.plugin = plugin;
4468
+ exports.roundArrow = ROUND_ARROW;
4469
+ exports.setDefaultProps = setDefaultProps$1;
4470
+ exports.tippy = tippy;
4471
+ exports.useSingleton = useSingleton;
4472
+ exports.useTippy = useTippy;
4473
+ exports.useTippyComponent = useTippyComponent;