@limetech/lime-elements 34.1.0-next.8 → 34.1.0-next.9

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 (103) hide show
  1. package/dist/cjs/{_arrayIncludesWith-d69e30af.js → _arrayIncludesWith-36a6fafb.js} +7 -6
  2. package/dist/cjs/{_assignValue-493aac17.js → _assignValue-c9fc3712.js} +2 -2
  3. package/dist/cjs/{_defineProperty-c081d04c.js → _defineProperty-8351e789.js} +4 -3
  4. package/dist/cjs/eq-9a943b00.js +75 -0
  5. package/dist/cjs/{isArrayLike-2bebb99c.js → isArrayLike-ac53bdac.js} +1 -30
  6. package/dist/cjs/{isEqual-1ce0c121.js → isEqual-e3b9c27c.js} +21 -19
  7. package/dist/cjs/{eq-3b43a5ca.js → isObject-e28b7997.js} +0 -71
  8. package/dist/cjs/isObjectLike-3e3f0cba.js +31 -0
  9. package/dist/cjs/{isSymbol-4666002c.js → isSymbol-d22b2798.js} +3 -3
  10. package/dist/cjs/lime-elements.cjs.js +1 -1
  11. package/dist/cjs/limel-color-picker-palette_2.cjs.entry.js +188 -0
  12. package/dist/cjs/limel-color-picker.cjs.entry.js +51 -0
  13. package/dist/cjs/{limel-flatpickr-adapter_2.cjs.entry.js → limel-flatpickr-adapter.cjs.entry.js} +8 -801
  14. package/dist/cjs/limel-form.cjs.entry.js +14 -12
  15. package/dist/cjs/limel-input-field.cjs.entry.js +713 -0
  16. package/dist/cjs/{limel-list_2.cjs.entry.js → limel-list_3.cjs.entry.js} +1929 -0
  17. package/dist/cjs/limel-menu.cjs.entry.js +5 -4
  18. package/dist/cjs/limel-tab-bar.cjs.entry.js +7 -5
  19. package/dist/cjs/limel-table.cjs.entry.js +9 -7
  20. package/dist/cjs/{limel-tooltip.cjs.entry.js → limel-tooltip_2.cjs.entry.js} +16 -0
  21. package/dist/cjs/loader.cjs.js +1 -1
  22. package/dist/cjs/{pickBy-64252559.js → pickBy-88b0430a.js} +10 -10
  23. package/dist/cjs/toNumber-062ea29c.js +99 -0
  24. package/dist/cjs/{zipObject-2f430e94.js → zipObject-4050a45f.js} +1 -1
  25. package/dist/collection/collection-manifest.json +2 -0
  26. package/dist/collection/components/color-picker/color-picker-palette.css +1202 -0
  27. package/dist/collection/components/color-picker/color-picker-palette.js +135 -0
  28. package/dist/collection/components/color-picker/color-picker.css +71 -0
  29. package/dist/collection/components/color-picker/color-picker.js +189 -0
  30. package/dist/collection/components/color-picker/swatches.js +29 -0
  31. package/dist/esm/{_arrayIncludesWith-3f5ce249.js → _arrayIncludesWith-b5d3fd9e.js} +5 -4
  32. package/dist/esm/{_assignValue-94fb6adc.js → _assignValue-08fe10bc.js} +2 -2
  33. package/dist/esm/{_defineProperty-cbf98a2a.js → _defineProperty-8c869077.js} +2 -1
  34. package/dist/esm/eq-c1c7f528.js +72 -0
  35. package/dist/esm/{isArrayLike-14db8f02.js → isArrayLike-dd37ba9a.js} +2 -30
  36. package/dist/esm/{isEqual-4d982635.js → isEqual-4f22635f.js} +5 -3
  37. package/dist/esm/{eq-f40dd1d6.js → isObject-c74e273c.js} +1 -70
  38. package/dist/esm/isObjectLike-38996507.js +29 -0
  39. package/dist/esm/{isSymbol-84252d8e.js → isSymbol-5bf20921.js} +2 -2
  40. package/dist/esm/lime-elements.js +1 -1
  41. package/dist/esm/limel-color-picker-palette_2.entry.js +183 -0
  42. package/dist/esm/limel-color-picker.entry.js +47 -0
  43. package/dist/esm/{limel-flatpickr-adapter_2.entry.js → limel-flatpickr-adapter.entry.js} +8 -800
  44. package/dist/esm/limel-form.entry.js +10 -8
  45. package/dist/esm/limel-input-field.entry.js +709 -0
  46. package/dist/esm/{limel-list_2.entry.js → limel-list_3.entry.js} +1929 -1
  47. package/dist/esm/limel-menu.entry.js +5 -4
  48. package/dist/esm/limel-tab-bar.entry.js +7 -5
  49. package/dist/esm/limel-table.entry.js +9 -7
  50. package/dist/esm/{limel-tooltip.entry.js → limel-tooltip_2.entry.js} +16 -1
  51. package/dist/esm/loader.js +1 -1
  52. package/dist/esm/{pickBy-c485c1b5.js → pickBy-8a849e46.js} +5 -5
  53. package/dist/esm/toNumber-a6ed64f0.js +97 -0
  54. package/dist/esm/{zipObject-53fcafb3.js → zipObject-22e88ce9.js} +1 -1
  55. package/dist/lime-elements/lime-elements.esm.js +1 -1
  56. package/dist/lime-elements/p-090bc949.js +1 -0
  57. package/dist/lime-elements/p-13f0e4f4.entry.js +1 -0
  58. package/dist/lime-elements/p-18fe2eb1.entry.js +1 -0
  59. package/dist/lime-elements/{p-425a0596.js → p-1a64b531.js} +1 -1
  60. package/dist/lime-elements/p-365098fe.js +1 -0
  61. package/dist/lime-elements/p-379955f4.js +1 -0
  62. package/dist/lime-elements/p-426d11b4.js +1 -0
  63. package/dist/lime-elements/p-440084ea.js +1 -0
  64. package/dist/lime-elements/p-468e940e.entry.js +16 -0
  65. package/dist/lime-elements/p-4bc5d3fc.entry.js +1 -0
  66. package/dist/lime-elements/p-511d71e0.entry.js +1 -0
  67. package/dist/lime-elements/p-7f43b0c4.js +1 -0
  68. package/dist/lime-elements/p-81258617.entry.js +1 -0
  69. package/dist/lime-elements/p-858c6b82.js +1 -0
  70. package/dist/lime-elements/{p-fc691234.entry.js → p-bcafdb7a.entry.js} +2 -2
  71. package/dist/lime-elements/p-c93050d6.js +1 -0
  72. package/dist/lime-elements/p-cc154284.entry.js +1 -0
  73. package/dist/lime-elements/p-d529bb7d.js +1 -0
  74. package/dist/lime-elements/p-eda23c05.js +1 -0
  75. package/dist/lime-elements/{p-ff0217b3.entry.js → p-f2c706b8.entry.js} +1 -1
  76. package/dist/lime-elements/{p-facf936d.entry.js → p-f5a3e526.entry.js} +1 -1
  77. package/dist/lime-elements/p-f83213b8.js +1 -0
  78. package/dist/types/components/color-picker/color-picker-palette.d.ts +32 -0
  79. package/dist/types/components/color-picker/color-picker.d.ts +54 -0
  80. package/dist/types/components/color-picker/swatches.d.ts +4 -0
  81. package/dist/types/components.d.ts +114 -0
  82. package/package.json +1 -1
  83. package/dist/cjs/limel-popover.cjs.entry.js +0 -116
  84. package/dist/cjs/limel-portal.cjs.entry.js +0 -1935
  85. package/dist/cjs/limel-tooltip-content.cjs.entry.js +0 -22
  86. package/dist/esm/limel-popover.entry.js +0 -112
  87. package/dist/esm/limel-portal.entry.js +0 -1931
  88. package/dist/esm/limel-tooltip-content.entry.js +0 -18
  89. package/dist/lime-elements/p-227d2c5a.entry.js +0 -1
  90. package/dist/lime-elements/p-3ce2d46a.js +0 -1
  91. package/dist/lime-elements/p-77afe6dd.entry.js +0 -1
  92. package/dist/lime-elements/p-7c4d91f5.js +0 -1
  93. package/dist/lime-elements/p-845e645a.entry.js +0 -1
  94. package/dist/lime-elements/p-8bbe3720.js +0 -1
  95. package/dist/lime-elements/p-8e4ff107.js +0 -1
  96. package/dist/lime-elements/p-acfbf7ac.js +0 -1
  97. package/dist/lime-elements/p-bbc1bb01.entry.js +0 -1
  98. package/dist/lime-elements/p-c0765c9b.js +0 -1
  99. package/dist/lime-elements/p-e28a4246.entry.js +0 -1
  100. package/dist/lime-elements/p-ee7355e7.js +0 -1
  101. package/dist/lime-elements/p-f4495f59.entry.js +0 -1
  102. package/dist/lime-elements/p-fbe32287.entry.js +0 -16
  103. package/dist/lime-elements/p-fc610f15.js +0 -1
@@ -477,4 +477,1932 @@ let MenuSurface = class {
477
477
  };
478
478
  MenuSurface.style = menuSurfaceCss;
479
479
 
480
- export { List as limel_list, MenuSurface as limel_menu_surface };
480
+ var top = 'top';
481
+ var bottom = 'bottom';
482
+ var right = 'right';
483
+ var left = 'left';
484
+ var auto = 'auto';
485
+ var basePlacements = [top, bottom, right, left];
486
+ var start = 'start';
487
+ var end = 'end';
488
+ var clippingParents = 'clippingParents';
489
+ var viewport = 'viewport';
490
+ var popper = 'popper';
491
+ var reference = 'reference';
492
+ var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
493
+ return acc.concat([placement + "-" + start, placement + "-" + end]);
494
+ }, []);
495
+ var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
496
+ return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
497
+ }, []); // modifiers that need to read the DOM
498
+
499
+ var beforeRead = 'beforeRead';
500
+ var read = 'read';
501
+ var afterRead = 'afterRead'; // pure-logic modifiers
502
+
503
+ var beforeMain = 'beforeMain';
504
+ var main = 'main';
505
+ var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
506
+
507
+ var beforeWrite = 'beforeWrite';
508
+ var write = 'write';
509
+ var afterWrite = 'afterWrite';
510
+ var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
511
+
512
+ function getNodeName(element) {
513
+ return element ? (element.nodeName || '').toLowerCase() : null;
514
+ }
515
+
516
+ function getWindow(node) {
517
+ if (node == null) {
518
+ return window;
519
+ }
520
+
521
+ if (node.toString() !== '[object Window]') {
522
+ var ownerDocument = node.ownerDocument;
523
+ return ownerDocument ? ownerDocument.defaultView || window : window;
524
+ }
525
+
526
+ return node;
527
+ }
528
+
529
+ function isElement(node) {
530
+ var OwnElement = getWindow(node).Element;
531
+ return node instanceof OwnElement || node instanceof Element;
532
+ }
533
+
534
+ function isHTMLElement(node) {
535
+ var OwnElement = getWindow(node).HTMLElement;
536
+ return node instanceof OwnElement || node instanceof HTMLElement;
537
+ }
538
+
539
+ function isShadowRoot(node) {
540
+ // IE 11 has no ShadowRoot
541
+ if (typeof ShadowRoot === 'undefined') {
542
+ return false;
543
+ }
544
+
545
+ var OwnElement = getWindow(node).ShadowRoot;
546
+ return node instanceof OwnElement || node instanceof ShadowRoot;
547
+ }
548
+
549
+ // and applies them to the HTMLElements such as popper and arrow
550
+
551
+ function applyStyles(_ref) {
552
+ var state = _ref.state;
553
+ Object.keys(state.elements).forEach(function (name) {
554
+ var style = state.styles[name] || {};
555
+ var attributes = state.attributes[name] || {};
556
+ var element = state.elements[name]; // arrow is optional + virtual elements
557
+
558
+ if (!isHTMLElement(element) || !getNodeName(element)) {
559
+ return;
560
+ } // Flow doesn't support to extend this property, but it's the most
561
+ // effective way to apply styles to an HTMLElement
562
+ // $FlowFixMe[cannot-write]
563
+
564
+
565
+ Object.assign(element.style, style);
566
+ Object.keys(attributes).forEach(function (name) {
567
+ var value = attributes[name];
568
+
569
+ if (value === false) {
570
+ element.removeAttribute(name);
571
+ } else {
572
+ element.setAttribute(name, value === true ? '' : value);
573
+ }
574
+ });
575
+ });
576
+ }
577
+
578
+ function effect$2(_ref2) {
579
+ var state = _ref2.state;
580
+ var initialStyles = {
581
+ popper: {
582
+ position: state.options.strategy,
583
+ left: '0',
584
+ top: '0',
585
+ margin: '0'
586
+ },
587
+ arrow: {
588
+ position: 'absolute'
589
+ },
590
+ reference: {}
591
+ };
592
+ Object.assign(state.elements.popper.style, initialStyles.popper);
593
+ state.styles = initialStyles;
594
+
595
+ if (state.elements.arrow) {
596
+ Object.assign(state.elements.arrow.style, initialStyles.arrow);
597
+ }
598
+
599
+ return function () {
600
+ Object.keys(state.elements).forEach(function (name) {
601
+ var element = state.elements[name];
602
+ var attributes = state.attributes[name] || {};
603
+ var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them
604
+
605
+ var style = styleProperties.reduce(function (style, property) {
606
+ style[property] = '';
607
+ return style;
608
+ }, {}); // arrow is optional + virtual elements
609
+
610
+ if (!isHTMLElement(element) || !getNodeName(element)) {
611
+ return;
612
+ }
613
+
614
+ Object.assign(element.style, style);
615
+ Object.keys(attributes).forEach(function (attribute) {
616
+ element.removeAttribute(attribute);
617
+ });
618
+ });
619
+ };
620
+ } // eslint-disable-next-line import/no-unused-modules
621
+
622
+
623
+ const applyStyles$1 = {
624
+ name: 'applyStyles',
625
+ enabled: true,
626
+ phase: 'write',
627
+ fn: applyStyles,
628
+ effect: effect$2,
629
+ requires: ['computeStyles']
630
+ };
631
+
632
+ function getBasePlacement(placement) {
633
+ return placement.split('-')[0];
634
+ }
635
+
636
+ var round$1 = Math.round;
637
+ function getBoundingClientRect(element, includeScale) {
638
+ if (includeScale === void 0) {
639
+ includeScale = false;
640
+ }
641
+
642
+ var rect = element.getBoundingClientRect();
643
+ var scaleX = 1;
644
+ var scaleY = 1;
645
+
646
+ if (isHTMLElement(element) && includeScale) {
647
+ // Fallback to 1 in case both values are `0`
648
+ scaleX = rect.width / element.offsetWidth || 1;
649
+ scaleY = rect.height / element.offsetHeight || 1;
650
+ }
651
+
652
+ return {
653
+ width: round$1(rect.width / scaleX),
654
+ height: round$1(rect.height / scaleY),
655
+ top: round$1(rect.top / scaleY),
656
+ right: round$1(rect.right / scaleX),
657
+ bottom: round$1(rect.bottom / scaleY),
658
+ left: round$1(rect.left / scaleX),
659
+ x: round$1(rect.left / scaleX),
660
+ y: round$1(rect.top / scaleY)
661
+ };
662
+ }
663
+
664
+ // means it doesn't take into account transforms.
665
+
666
+ function getLayoutRect(element) {
667
+ var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
668
+ // Fixes https://github.com/popperjs/popper-core/issues/1223
669
+
670
+ var width = element.offsetWidth;
671
+ var height = element.offsetHeight;
672
+
673
+ if (Math.abs(clientRect.width - width) <= 1) {
674
+ width = clientRect.width;
675
+ }
676
+
677
+ if (Math.abs(clientRect.height - height) <= 1) {
678
+ height = clientRect.height;
679
+ }
680
+
681
+ return {
682
+ x: element.offsetLeft,
683
+ y: element.offsetTop,
684
+ width: width,
685
+ height: height
686
+ };
687
+ }
688
+
689
+ function contains(parent, child) {
690
+ var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
691
+
692
+ if (parent.contains(child)) {
693
+ return true;
694
+ } // then fallback to custom implementation with Shadow DOM support
695
+ else if (rootNode && isShadowRoot(rootNode)) {
696
+ var next = child;
697
+
698
+ do {
699
+ if (next && parent.isSameNode(next)) {
700
+ return true;
701
+ } // $FlowFixMe[prop-missing]: need a better way to handle this...
702
+
703
+
704
+ next = next.parentNode || next.host;
705
+ } while (next);
706
+ } // Give up, the result is false
707
+
708
+
709
+ return false;
710
+ }
711
+
712
+ function getComputedStyle(element) {
713
+ return getWindow(element).getComputedStyle(element);
714
+ }
715
+
716
+ function isTableElement(element) {
717
+ return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
718
+ }
719
+
720
+ function getDocumentElement(element) {
721
+ // $FlowFixMe[incompatible-return]: assume body is always available
722
+ return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
723
+ element.document) || window.document).documentElement;
724
+ }
725
+
726
+ function getParentNode(element) {
727
+ if (getNodeName(element) === 'html') {
728
+ return element;
729
+ }
730
+
731
+ return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
732
+ // $FlowFixMe[incompatible-return]
733
+ // $FlowFixMe[prop-missing]
734
+ element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
735
+ element.parentNode || ( // DOM Element detected
736
+ isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
737
+ // $FlowFixMe[incompatible-call]: HTMLElement is a Node
738
+ getDocumentElement(element) // fallback
739
+
740
+ );
741
+ }
742
+
743
+ function getTrueOffsetParent(element) {
744
+ if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
745
+ getComputedStyle(element).position === 'fixed') {
746
+ return null;
747
+ }
748
+
749
+ return element.offsetParent;
750
+ } // `.offsetParent` reports `null` for fixed elements, while absolute elements
751
+ // return the containing block
752
+
753
+
754
+ function getContainingBlock(element) {
755
+ var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1;
756
+ var isIE = navigator.userAgent.indexOf('Trident') !== -1;
757
+
758
+ if (isIE && isHTMLElement(element)) {
759
+ // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
760
+ var elementCss = getComputedStyle(element);
761
+
762
+ if (elementCss.position === 'fixed') {
763
+ return null;
764
+ }
765
+ }
766
+
767
+ var currentNode = getParentNode(element);
768
+
769
+ while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
770
+ var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
771
+ // create a containing block.
772
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
773
+
774
+ 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') {
775
+ return currentNode;
776
+ } else {
777
+ currentNode = currentNode.parentNode;
778
+ }
779
+ }
780
+
781
+ return null;
782
+ } // Gets the closest ancestor positioned element. Handles some edge cases,
783
+ // such as table ancestors and cross browser bugs.
784
+
785
+
786
+ function getOffsetParent(element) {
787
+ var window = getWindow(element);
788
+ var offsetParent = getTrueOffsetParent(element);
789
+
790
+ while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
791
+ offsetParent = getTrueOffsetParent(offsetParent);
792
+ }
793
+
794
+ if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {
795
+ return window;
796
+ }
797
+
798
+ return offsetParent || getContainingBlock(element) || window;
799
+ }
800
+
801
+ function getMainAxisFromPlacement(placement) {
802
+ return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
803
+ }
804
+
805
+ var max = Math.max;
806
+ var min = Math.min;
807
+ var round = Math.round;
808
+
809
+ function within(min$1, value, max$1) {
810
+ return max(min$1, min(value, max$1));
811
+ }
812
+
813
+ function getFreshSideObject() {
814
+ return {
815
+ top: 0,
816
+ right: 0,
817
+ bottom: 0,
818
+ left: 0
819
+ };
820
+ }
821
+
822
+ function mergePaddingObject(paddingObject) {
823
+ return Object.assign({}, getFreshSideObject(), paddingObject);
824
+ }
825
+
826
+ function expandToHashMap(value, keys) {
827
+ return keys.reduce(function (hashMap, key) {
828
+ hashMap[key] = value;
829
+ return hashMap;
830
+ }, {});
831
+ }
832
+
833
+ var toPaddingObject = function toPaddingObject(padding, state) {
834
+ padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {
835
+ placement: state.placement
836
+ })) : padding;
837
+ return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
838
+ };
839
+
840
+ function arrow(_ref) {
841
+ var _state$modifiersData$;
842
+
843
+ var state = _ref.state,
844
+ name = _ref.name,
845
+ options = _ref.options;
846
+ var arrowElement = state.elements.arrow;
847
+ var popperOffsets = state.modifiersData.popperOffsets;
848
+ var basePlacement = getBasePlacement(state.placement);
849
+ var axis = getMainAxisFromPlacement(basePlacement);
850
+ var isVertical = [left, right].indexOf(basePlacement) >= 0;
851
+ var len = isVertical ? 'height' : 'width';
852
+
853
+ if (!arrowElement || !popperOffsets) {
854
+ return;
855
+ }
856
+
857
+ var paddingObject = toPaddingObject(options.padding, state);
858
+ var arrowRect = getLayoutRect(arrowElement);
859
+ var minProp = axis === 'y' ? top : left;
860
+ var maxProp = axis === 'y' ? bottom : right;
861
+ var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];
862
+ var startDiff = popperOffsets[axis] - state.rects.reference[axis];
863
+ var arrowOffsetParent = getOffsetParent(arrowElement);
864
+ var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
865
+ var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is
866
+ // outside of the popper bounds
867
+
868
+ var min = paddingObject[minProp];
869
+ var max = clientSize - arrowRect[len] - paddingObject[maxProp];
870
+ var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
871
+ var offset = within(min, center, max); // Prevents breaking syntax highlighting...
872
+
873
+ var axisProp = axis;
874
+ state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);
875
+ }
876
+
877
+ function effect$1(_ref2) {
878
+ var state = _ref2.state,
879
+ options = _ref2.options;
880
+ var _options$element = options.element,
881
+ arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;
882
+
883
+ if (arrowElement == null) {
884
+ return;
885
+ } // CSS selector
886
+
887
+
888
+ if (typeof arrowElement === 'string') {
889
+ arrowElement = state.elements.popper.querySelector(arrowElement);
890
+
891
+ if (!arrowElement) {
892
+ return;
893
+ }
894
+ }
895
+
896
+ if (!contains(state.elements.popper, arrowElement)) {
897
+
898
+ return;
899
+ }
900
+
901
+ state.elements.arrow = arrowElement;
902
+ } // eslint-disable-next-line import/no-unused-modules
903
+
904
+
905
+ const arrow$1 = {
906
+ name: 'arrow',
907
+ enabled: true,
908
+ phase: 'main',
909
+ fn: arrow,
910
+ effect: effect$1,
911
+ requires: ['popperOffsets'],
912
+ requiresIfExists: ['preventOverflow']
913
+ };
914
+
915
+ var unsetSides = {
916
+ top: 'auto',
917
+ right: 'auto',
918
+ bottom: 'auto',
919
+ left: 'auto'
920
+ }; // Round the offsets to the nearest suitable subpixel based on the DPR.
921
+ // Zooming can change the DPR, but it seems to report a value that will
922
+ // cleanly divide the values into the appropriate subpixels.
923
+
924
+ function roundOffsetsByDPR(_ref) {
925
+ var x = _ref.x,
926
+ y = _ref.y;
927
+ var win = window;
928
+ var dpr = win.devicePixelRatio || 1;
929
+ return {
930
+ x: round(round(x * dpr) / dpr) || 0,
931
+ y: round(round(y * dpr) / dpr) || 0
932
+ };
933
+ }
934
+
935
+ function mapToStyles(_ref2) {
936
+ var _Object$assign2;
937
+
938
+ var popper = _ref2.popper,
939
+ popperRect = _ref2.popperRect,
940
+ placement = _ref2.placement,
941
+ offsets = _ref2.offsets,
942
+ position = _ref2.position,
943
+ gpuAcceleration = _ref2.gpuAcceleration,
944
+ adaptive = _ref2.adaptive,
945
+ roundOffsets = _ref2.roundOffsets;
946
+
947
+ var _ref3 = roundOffsets === true ? roundOffsetsByDPR(offsets) : typeof roundOffsets === 'function' ? roundOffsets(offsets) : offsets,
948
+ _ref3$x = _ref3.x,
949
+ x = _ref3$x === void 0 ? 0 : _ref3$x,
950
+ _ref3$y = _ref3.y,
951
+ y = _ref3$y === void 0 ? 0 : _ref3$y;
952
+
953
+ var hasX = offsets.hasOwnProperty('x');
954
+ var hasY = offsets.hasOwnProperty('y');
955
+ var sideX = left;
956
+ var sideY = top;
957
+ var win = window;
958
+
959
+ if (adaptive) {
960
+ var offsetParent = getOffsetParent(popper);
961
+ var heightProp = 'clientHeight';
962
+ var widthProp = 'clientWidth';
963
+
964
+ if (offsetParent === getWindow(popper)) {
965
+ offsetParent = getDocumentElement(popper);
966
+
967
+ if (getComputedStyle(offsetParent).position !== 'static') {
968
+ heightProp = 'scrollHeight';
969
+ widthProp = 'scrollWidth';
970
+ }
971
+ } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
972
+
973
+
974
+ offsetParent = offsetParent;
975
+
976
+ if (placement === top) {
977
+ sideY = bottom; // $FlowFixMe[prop-missing]
978
+
979
+ y -= offsetParent[heightProp] - popperRect.height;
980
+ y *= gpuAcceleration ? 1 : -1;
981
+ }
982
+
983
+ if (placement === left) {
984
+ sideX = right; // $FlowFixMe[prop-missing]
985
+
986
+ x -= offsetParent[widthProp] - popperRect.width;
987
+ x *= gpuAcceleration ? 1 : -1;
988
+ }
989
+ }
990
+
991
+ var commonStyles = Object.assign({
992
+ position: position
993
+ }, adaptive && unsetSides);
994
+
995
+ if (gpuAcceleration) {
996
+ var _Object$assign;
997
+
998
+ return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) < 2 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
999
+ }
1000
+
1001
+ return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
1002
+ }
1003
+
1004
+ function computeStyles(_ref4) {
1005
+ var state = _ref4.state,
1006
+ options = _ref4.options;
1007
+ var _options$gpuAccelerat = options.gpuAcceleration,
1008
+ gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
1009
+ _options$adaptive = options.adaptive,
1010
+ adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
1011
+ _options$roundOffsets = options.roundOffsets,
1012
+ roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
1013
+
1014
+ var commonStyles = {
1015
+ placement: getBasePlacement(state.placement),
1016
+ popper: state.elements.popper,
1017
+ popperRect: state.rects.popper,
1018
+ gpuAcceleration: gpuAcceleration
1019
+ };
1020
+
1021
+ if (state.modifiersData.popperOffsets != null) {
1022
+ state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
1023
+ offsets: state.modifiersData.popperOffsets,
1024
+ position: state.options.strategy,
1025
+ adaptive: adaptive,
1026
+ roundOffsets: roundOffsets
1027
+ })));
1028
+ }
1029
+
1030
+ if (state.modifiersData.arrow != null) {
1031
+ state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
1032
+ offsets: state.modifiersData.arrow,
1033
+ position: 'absolute',
1034
+ adaptive: false,
1035
+ roundOffsets: roundOffsets
1036
+ })));
1037
+ }
1038
+
1039
+ state.attributes.popper = Object.assign({}, state.attributes.popper, {
1040
+ 'data-popper-placement': state.placement
1041
+ });
1042
+ } // eslint-disable-next-line import/no-unused-modules
1043
+
1044
+
1045
+ const computeStyles$1 = {
1046
+ name: 'computeStyles',
1047
+ enabled: true,
1048
+ phase: 'beforeWrite',
1049
+ fn: computeStyles,
1050
+ data: {}
1051
+ };
1052
+
1053
+ var passive = {
1054
+ passive: true
1055
+ };
1056
+
1057
+ function effect(_ref) {
1058
+ var state = _ref.state,
1059
+ instance = _ref.instance,
1060
+ options = _ref.options;
1061
+ var _options$scroll = options.scroll,
1062
+ scroll = _options$scroll === void 0 ? true : _options$scroll,
1063
+ _options$resize = options.resize,
1064
+ resize = _options$resize === void 0 ? true : _options$resize;
1065
+ var window = getWindow(state.elements.popper);
1066
+ var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
1067
+
1068
+ if (scroll) {
1069
+ scrollParents.forEach(function (scrollParent) {
1070
+ scrollParent.addEventListener('scroll', instance.update, passive);
1071
+ });
1072
+ }
1073
+
1074
+ if (resize) {
1075
+ window.addEventListener('resize', instance.update, passive);
1076
+ }
1077
+
1078
+ return function () {
1079
+ if (scroll) {
1080
+ scrollParents.forEach(function (scrollParent) {
1081
+ scrollParent.removeEventListener('scroll', instance.update, passive);
1082
+ });
1083
+ }
1084
+
1085
+ if (resize) {
1086
+ window.removeEventListener('resize', instance.update, passive);
1087
+ }
1088
+ };
1089
+ } // eslint-disable-next-line import/no-unused-modules
1090
+
1091
+
1092
+ const eventListeners = {
1093
+ name: 'eventListeners',
1094
+ enabled: true,
1095
+ phase: 'write',
1096
+ fn: function fn() {},
1097
+ effect: effect,
1098
+ data: {}
1099
+ };
1100
+
1101
+ var hash$1 = {
1102
+ left: 'right',
1103
+ right: 'left',
1104
+ bottom: 'top',
1105
+ top: 'bottom'
1106
+ };
1107
+ function getOppositePlacement(placement) {
1108
+ return placement.replace(/left|right|bottom|top/g, function (matched) {
1109
+ return hash$1[matched];
1110
+ });
1111
+ }
1112
+
1113
+ var hash = {
1114
+ start: 'end',
1115
+ end: 'start'
1116
+ };
1117
+ function getOppositeVariationPlacement(placement) {
1118
+ return placement.replace(/start|end/g, function (matched) {
1119
+ return hash[matched];
1120
+ });
1121
+ }
1122
+
1123
+ function getWindowScroll(node) {
1124
+ var win = getWindow(node);
1125
+ var scrollLeft = win.pageXOffset;
1126
+ var scrollTop = win.pageYOffset;
1127
+ return {
1128
+ scrollLeft: scrollLeft,
1129
+ scrollTop: scrollTop
1130
+ };
1131
+ }
1132
+
1133
+ function getWindowScrollBarX(element) {
1134
+ // If <html> has a CSS width greater than the viewport, then this will be
1135
+ // incorrect for RTL.
1136
+ // Popper 1 is broken in this case and never had a bug report so let's assume
1137
+ // it's not an issue. I don't think anyone ever specifies width on <html>
1138
+ // anyway.
1139
+ // Browsers where the left scrollbar doesn't cause an issue report `0` for
1140
+ // this (e.g. Edge 2019, IE11, Safari)
1141
+ return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
1142
+ }
1143
+
1144
+ function getViewportRect(element) {
1145
+ var win = getWindow(element);
1146
+ var html = getDocumentElement(element);
1147
+ var visualViewport = win.visualViewport;
1148
+ var width = html.clientWidth;
1149
+ var height = html.clientHeight;
1150
+ var x = 0;
1151
+ var y = 0; // NB: This isn't supported on iOS <= 12. If the keyboard is open, the popper
1152
+ // can be obscured underneath it.
1153
+ // Also, `html.clientHeight` adds the bottom bar height in Safari iOS, even
1154
+ // if it isn't open, so if this isn't available, the popper will be detected
1155
+ // to overflow the bottom of the screen too early.
1156
+
1157
+ if (visualViewport) {
1158
+ width = visualViewport.width;
1159
+ height = visualViewport.height; // Uses Layout Viewport (like Chrome; Safari does not currently)
1160
+ // In Chrome, it returns a value very close to 0 (+/-) but contains rounding
1161
+ // errors due to floating point numbers, so we need to check precision.
1162
+ // Safari returns a number <= 0, usually < -1 when pinch-zoomed
1163
+ // Feature detection fails in mobile emulation mode in Chrome.
1164
+ // Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) <
1165
+ // 0.001
1166
+ // Fallback here: "Not Safari" userAgent
1167
+
1168
+ if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
1169
+ x = visualViewport.offsetLeft;
1170
+ y = visualViewport.offsetTop;
1171
+ }
1172
+ }
1173
+
1174
+ return {
1175
+ width: width,
1176
+ height: height,
1177
+ x: x + getWindowScrollBarX(element),
1178
+ y: y
1179
+ };
1180
+ }
1181
+
1182
+ // of the `<html>` and `<body>` rect bounds if horizontally scrollable
1183
+
1184
+ function getDocumentRect(element) {
1185
+ var _element$ownerDocumen;
1186
+
1187
+ var html = getDocumentElement(element);
1188
+ var winScroll = getWindowScroll(element);
1189
+ var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
1190
+ var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
1191
+ var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
1192
+ var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
1193
+ var y = -winScroll.scrollTop;
1194
+
1195
+ if (getComputedStyle(body || html).direction === 'rtl') {
1196
+ x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
1197
+ }
1198
+
1199
+ return {
1200
+ width: width,
1201
+ height: height,
1202
+ x: x,
1203
+ y: y
1204
+ };
1205
+ }
1206
+
1207
+ function isScrollParent(element) {
1208
+ // Firefox wants us to check `-x` and `-y` variations as well
1209
+ var _getComputedStyle = getComputedStyle(element),
1210
+ overflow = _getComputedStyle.overflow,
1211
+ overflowX = _getComputedStyle.overflowX,
1212
+ overflowY = _getComputedStyle.overflowY;
1213
+
1214
+ return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
1215
+ }
1216
+
1217
+ function getScrollParent(node) {
1218
+ if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
1219
+ // $FlowFixMe[incompatible-return]: assume body is always available
1220
+ return node.ownerDocument.body;
1221
+ }
1222
+
1223
+ if (isHTMLElement(node) && isScrollParent(node)) {
1224
+ return node;
1225
+ }
1226
+
1227
+ return getScrollParent(getParentNode(node));
1228
+ }
1229
+
1230
+ /*
1231
+ given a DOM element, return the list of all scroll parents, up the list of ancesors
1232
+ until we get to the top window object. This list is what we attach scroll listeners
1233
+ to, because if any of these parent elements scroll, we'll need to re-calculate the
1234
+ reference element's position.
1235
+ */
1236
+
1237
+ function listScrollParents(element, list) {
1238
+ var _element$ownerDocumen;
1239
+
1240
+ if (list === void 0) {
1241
+ list = [];
1242
+ }
1243
+
1244
+ var scrollParent = getScrollParent(element);
1245
+ var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
1246
+ var win = getWindow(scrollParent);
1247
+ var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
1248
+ var updatedList = list.concat(target);
1249
+ return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
1250
+ updatedList.concat(listScrollParents(getParentNode(target)));
1251
+ }
1252
+
1253
+ function rectToClientRect(rect) {
1254
+ return Object.assign({}, rect, {
1255
+ left: rect.x,
1256
+ top: rect.y,
1257
+ right: rect.x + rect.width,
1258
+ bottom: rect.y + rect.height
1259
+ });
1260
+ }
1261
+
1262
+ function getInnerBoundingClientRect(element) {
1263
+ var rect = getBoundingClientRect(element);
1264
+ rect.top = rect.top + element.clientTop;
1265
+ rect.left = rect.left + element.clientLeft;
1266
+ rect.bottom = rect.top + element.clientHeight;
1267
+ rect.right = rect.left + element.clientWidth;
1268
+ rect.width = element.clientWidth;
1269
+ rect.height = element.clientHeight;
1270
+ rect.x = rect.left;
1271
+ rect.y = rect.top;
1272
+ return rect;
1273
+ }
1274
+
1275
+ function getClientRectFromMixedType(element, clippingParent) {
1276
+ return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isHTMLElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
1277
+ } // A "clipping parent" is an overflowable container with the characteristic of
1278
+ // clipping (or hiding) overflowing elements with a position different from
1279
+ // `initial`
1280
+
1281
+
1282
+ function getClippingParents(element) {
1283
+ var clippingParents = listScrollParents(getParentNode(element));
1284
+ var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;
1285
+ var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
1286
+
1287
+ if (!isElement(clipperElement)) {
1288
+ return [];
1289
+ } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
1290
+
1291
+
1292
+ return clippingParents.filter(function (clippingParent) {
1293
+ return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
1294
+ });
1295
+ } // Gets the maximum area that the element is visible in due to any number of
1296
+ // clipping parents
1297
+
1298
+
1299
+ function getClippingRect(element, boundary, rootBoundary) {
1300
+ var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
1301
+ var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
1302
+ var firstClippingParent = clippingParents[0];
1303
+ var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
1304
+ var rect = getClientRectFromMixedType(element, clippingParent);
1305
+ accRect.top = max(rect.top, accRect.top);
1306
+ accRect.right = min(rect.right, accRect.right);
1307
+ accRect.bottom = min(rect.bottom, accRect.bottom);
1308
+ accRect.left = max(rect.left, accRect.left);
1309
+ return accRect;
1310
+ }, getClientRectFromMixedType(element, firstClippingParent));
1311
+ clippingRect.width = clippingRect.right - clippingRect.left;
1312
+ clippingRect.height = clippingRect.bottom - clippingRect.top;
1313
+ clippingRect.x = clippingRect.left;
1314
+ clippingRect.y = clippingRect.top;
1315
+ return clippingRect;
1316
+ }
1317
+
1318
+ function getVariation(placement) {
1319
+ return placement.split('-')[1];
1320
+ }
1321
+
1322
+ function computeOffsets(_ref) {
1323
+ var reference = _ref.reference,
1324
+ element = _ref.element,
1325
+ placement = _ref.placement;
1326
+ var basePlacement = placement ? getBasePlacement(placement) : null;
1327
+ var variation = placement ? getVariation(placement) : null;
1328
+ var commonX = reference.x + reference.width / 2 - element.width / 2;
1329
+ var commonY = reference.y + reference.height / 2 - element.height / 2;
1330
+ var offsets;
1331
+
1332
+ switch (basePlacement) {
1333
+ case top:
1334
+ offsets = {
1335
+ x: commonX,
1336
+ y: reference.y - element.height
1337
+ };
1338
+ break;
1339
+
1340
+ case bottom:
1341
+ offsets = {
1342
+ x: commonX,
1343
+ y: reference.y + reference.height
1344
+ };
1345
+ break;
1346
+
1347
+ case right:
1348
+ offsets = {
1349
+ x: reference.x + reference.width,
1350
+ y: commonY
1351
+ };
1352
+ break;
1353
+
1354
+ case left:
1355
+ offsets = {
1356
+ x: reference.x - element.width,
1357
+ y: commonY
1358
+ };
1359
+ break;
1360
+
1361
+ default:
1362
+ offsets = {
1363
+ x: reference.x,
1364
+ y: reference.y
1365
+ };
1366
+ }
1367
+
1368
+ var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
1369
+
1370
+ if (mainAxis != null) {
1371
+ var len = mainAxis === 'y' ? 'height' : 'width';
1372
+
1373
+ switch (variation) {
1374
+ case start:
1375
+ offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
1376
+ break;
1377
+
1378
+ case end:
1379
+ offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
1380
+ break;
1381
+ }
1382
+ }
1383
+
1384
+ return offsets;
1385
+ }
1386
+
1387
+ function detectOverflow(state, options) {
1388
+ if (options === void 0) {
1389
+ options = {};
1390
+ }
1391
+
1392
+ var _options = options,
1393
+ _options$placement = _options.placement,
1394
+ placement = _options$placement === void 0 ? state.placement : _options$placement,
1395
+ _options$boundary = _options.boundary,
1396
+ boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
1397
+ _options$rootBoundary = _options.rootBoundary,
1398
+ rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,
1399
+ _options$elementConte = _options.elementContext,
1400
+ elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,
1401
+ _options$altBoundary = _options.altBoundary,
1402
+ altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,
1403
+ _options$padding = _options.padding,
1404
+ padding = _options$padding === void 0 ? 0 : _options$padding;
1405
+ var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
1406
+ var altContext = elementContext === popper ? reference : popper;
1407
+ var referenceElement = state.elements.reference;
1408
+ var popperRect = state.rects.popper;
1409
+ var element = state.elements[altBoundary ? altContext : elementContext];
1410
+ var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
1411
+ var referenceClientRect = getBoundingClientRect(referenceElement);
1412
+ var popperOffsets = computeOffsets({
1413
+ reference: referenceClientRect,
1414
+ element: popperRect,
1415
+ strategy: 'absolute',
1416
+ placement: placement
1417
+ });
1418
+ var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
1419
+ var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
1420
+ // 0 or negative = within the clipping rect
1421
+
1422
+ var overflowOffsets = {
1423
+ top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
1424
+ bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
1425
+ left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
1426
+ right: elementClientRect.right - clippingClientRect.right + paddingObject.right
1427
+ };
1428
+ var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element
1429
+
1430
+ if (elementContext === popper && offsetData) {
1431
+ var offset = offsetData[placement];
1432
+ Object.keys(overflowOffsets).forEach(function (key) {
1433
+ var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
1434
+ var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';
1435
+ overflowOffsets[key] += offset[axis] * multiply;
1436
+ });
1437
+ }
1438
+
1439
+ return overflowOffsets;
1440
+ }
1441
+
1442
+ function computeAutoPlacement(state, options) {
1443
+ if (options === void 0) {
1444
+ options = {};
1445
+ }
1446
+
1447
+ var _options = options,
1448
+ placement = _options.placement,
1449
+ boundary = _options.boundary,
1450
+ rootBoundary = _options.rootBoundary,
1451
+ padding = _options.padding,
1452
+ flipVariations = _options.flipVariations,
1453
+ _options$allowedAutoP = _options.allowedAutoPlacements,
1454
+ allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
1455
+ var variation = getVariation(placement);
1456
+ var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {
1457
+ return getVariation(placement) === variation;
1458
+ }) : basePlacements;
1459
+ var allowedPlacements = placements$1.filter(function (placement) {
1460
+ return allowedAutoPlacements.indexOf(placement) >= 0;
1461
+ });
1462
+
1463
+ if (allowedPlacements.length === 0) {
1464
+ allowedPlacements = placements$1;
1465
+ } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...
1466
+
1467
+
1468
+ var overflows = allowedPlacements.reduce(function (acc, placement) {
1469
+ acc[placement] = detectOverflow(state, {
1470
+ placement: placement,
1471
+ boundary: boundary,
1472
+ rootBoundary: rootBoundary,
1473
+ padding: padding
1474
+ })[getBasePlacement(placement)];
1475
+ return acc;
1476
+ }, {});
1477
+ return Object.keys(overflows).sort(function (a, b) {
1478
+ return overflows[a] - overflows[b];
1479
+ });
1480
+ }
1481
+
1482
+ function getExpandedFallbackPlacements(placement) {
1483
+ if (getBasePlacement(placement) === auto) {
1484
+ return [];
1485
+ }
1486
+
1487
+ var oppositePlacement = getOppositePlacement(placement);
1488
+ return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
1489
+ }
1490
+
1491
+ function flip(_ref) {
1492
+ var state = _ref.state,
1493
+ options = _ref.options,
1494
+ name = _ref.name;
1495
+
1496
+ if (state.modifiersData[name]._skip) {
1497
+ return;
1498
+ }
1499
+
1500
+ var _options$mainAxis = options.mainAxis,
1501
+ checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
1502
+ _options$altAxis = options.altAxis,
1503
+ checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,
1504
+ specifiedFallbackPlacements = options.fallbackPlacements,
1505
+ padding = options.padding,
1506
+ boundary = options.boundary,
1507
+ rootBoundary = options.rootBoundary,
1508
+ altBoundary = options.altBoundary,
1509
+ _options$flipVariatio = options.flipVariations,
1510
+ flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,
1511
+ allowedAutoPlacements = options.allowedAutoPlacements;
1512
+ var preferredPlacement = state.options.placement;
1513
+ var basePlacement = getBasePlacement(preferredPlacement);
1514
+ var isBasePlacement = basePlacement === preferredPlacement;
1515
+ var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
1516
+ var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {
1517
+ return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {
1518
+ placement: placement,
1519
+ boundary: boundary,
1520
+ rootBoundary: rootBoundary,
1521
+ padding: padding,
1522
+ flipVariations: flipVariations,
1523
+ allowedAutoPlacements: allowedAutoPlacements
1524
+ }) : placement);
1525
+ }, []);
1526
+ var referenceRect = state.rects.reference;
1527
+ var popperRect = state.rects.popper;
1528
+ var checksMap = new Map();
1529
+ var makeFallbackChecks = true;
1530
+ var firstFittingPlacement = placements[0];
1531
+
1532
+ for (var i = 0; i < placements.length; i++) {
1533
+ var placement = placements[i];
1534
+
1535
+ var _basePlacement = getBasePlacement(placement);
1536
+
1537
+ var isStartVariation = getVariation(placement) === start;
1538
+ var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
1539
+ var len = isVertical ? 'width' : 'height';
1540
+ var overflow = detectOverflow(state, {
1541
+ placement: placement,
1542
+ boundary: boundary,
1543
+ rootBoundary: rootBoundary,
1544
+ altBoundary: altBoundary,
1545
+ padding: padding
1546
+ });
1547
+ var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
1548
+
1549
+ if (referenceRect[len] > popperRect[len]) {
1550
+ mainVariationSide = getOppositePlacement(mainVariationSide);
1551
+ }
1552
+
1553
+ var altVariationSide = getOppositePlacement(mainVariationSide);
1554
+ var checks = [];
1555
+
1556
+ if (checkMainAxis) {
1557
+ checks.push(overflow[_basePlacement] <= 0);
1558
+ }
1559
+
1560
+ if (checkAltAxis) {
1561
+ checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
1562
+ }
1563
+
1564
+ if (checks.every(function (check) {
1565
+ return check;
1566
+ })) {
1567
+ firstFittingPlacement = placement;
1568
+ makeFallbackChecks = false;
1569
+ break;
1570
+ }
1571
+
1572
+ checksMap.set(placement, checks);
1573
+ }
1574
+
1575
+ if (makeFallbackChecks) {
1576
+ // `2` may be desired in some cases – research later
1577
+ var numberOfChecks = flipVariations ? 3 : 1;
1578
+
1579
+ var _loop = function _loop(_i) {
1580
+ var fittingPlacement = placements.find(function (placement) {
1581
+ var checks = checksMap.get(placement);
1582
+
1583
+ if (checks) {
1584
+ return checks.slice(0, _i).every(function (check) {
1585
+ return check;
1586
+ });
1587
+ }
1588
+ });
1589
+
1590
+ if (fittingPlacement) {
1591
+ firstFittingPlacement = fittingPlacement;
1592
+ return "break";
1593
+ }
1594
+ };
1595
+
1596
+ for (var _i = numberOfChecks; _i > 0; _i--) {
1597
+ var _ret = _loop(_i);
1598
+
1599
+ if (_ret === "break") break;
1600
+ }
1601
+ }
1602
+
1603
+ if (state.placement !== firstFittingPlacement) {
1604
+ state.modifiersData[name]._skip = true;
1605
+ state.placement = firstFittingPlacement;
1606
+ state.reset = true;
1607
+ }
1608
+ } // eslint-disable-next-line import/no-unused-modules
1609
+
1610
+
1611
+ const flip$1 = {
1612
+ name: 'flip',
1613
+ enabled: true,
1614
+ phase: 'main',
1615
+ fn: flip,
1616
+ requiresIfExists: ['offset'],
1617
+ data: {
1618
+ _skip: false
1619
+ }
1620
+ };
1621
+
1622
+ function getSideOffsets(overflow, rect, preventedOffsets) {
1623
+ if (preventedOffsets === void 0) {
1624
+ preventedOffsets = {
1625
+ x: 0,
1626
+ y: 0
1627
+ };
1628
+ }
1629
+
1630
+ return {
1631
+ top: overflow.top - rect.height - preventedOffsets.y,
1632
+ right: overflow.right - rect.width + preventedOffsets.x,
1633
+ bottom: overflow.bottom - rect.height + preventedOffsets.y,
1634
+ left: overflow.left - rect.width - preventedOffsets.x
1635
+ };
1636
+ }
1637
+
1638
+ function isAnySideFullyClipped(overflow) {
1639
+ return [top, right, bottom, left].some(function (side) {
1640
+ return overflow[side] >= 0;
1641
+ });
1642
+ }
1643
+
1644
+ function hide(_ref) {
1645
+ var state = _ref.state,
1646
+ name = _ref.name;
1647
+ var referenceRect = state.rects.reference;
1648
+ var popperRect = state.rects.popper;
1649
+ var preventedOffsets = state.modifiersData.preventOverflow;
1650
+ var referenceOverflow = detectOverflow(state, {
1651
+ elementContext: 'reference'
1652
+ });
1653
+ var popperAltOverflow = detectOverflow(state, {
1654
+ altBoundary: true
1655
+ });
1656
+ var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
1657
+ var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
1658
+ var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
1659
+ var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
1660
+ state.modifiersData[name] = {
1661
+ referenceClippingOffsets: referenceClippingOffsets,
1662
+ popperEscapeOffsets: popperEscapeOffsets,
1663
+ isReferenceHidden: isReferenceHidden,
1664
+ hasPopperEscaped: hasPopperEscaped
1665
+ };
1666
+ state.attributes.popper = Object.assign({}, state.attributes.popper, {
1667
+ 'data-popper-reference-hidden': isReferenceHidden,
1668
+ 'data-popper-escaped': hasPopperEscaped
1669
+ });
1670
+ } // eslint-disable-next-line import/no-unused-modules
1671
+
1672
+
1673
+ const hide$1 = {
1674
+ name: 'hide',
1675
+ enabled: true,
1676
+ phase: 'main',
1677
+ requiresIfExists: ['preventOverflow'],
1678
+ fn: hide
1679
+ };
1680
+
1681
+ function distanceAndSkiddingToXY(placement, rects, offset) {
1682
+ var basePlacement = getBasePlacement(placement);
1683
+ var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
1684
+
1685
+ var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {
1686
+ placement: placement
1687
+ })) : offset,
1688
+ skidding = _ref[0],
1689
+ distance = _ref[1];
1690
+
1691
+ skidding = skidding || 0;
1692
+ distance = (distance || 0) * invertDistance;
1693
+ return [left, right].indexOf(basePlacement) >= 0 ? {
1694
+ x: distance,
1695
+ y: skidding
1696
+ } : {
1697
+ x: skidding,
1698
+ y: distance
1699
+ };
1700
+ }
1701
+
1702
+ function offset(_ref2) {
1703
+ var state = _ref2.state,
1704
+ options = _ref2.options,
1705
+ name = _ref2.name;
1706
+ var _options$offset = options.offset,
1707
+ offset = _options$offset === void 0 ? [0, 0] : _options$offset;
1708
+ var data = placements.reduce(function (acc, placement) {
1709
+ acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);
1710
+ return acc;
1711
+ }, {});
1712
+ var _data$state$placement = data[state.placement],
1713
+ x = _data$state$placement.x,
1714
+ y = _data$state$placement.y;
1715
+
1716
+ if (state.modifiersData.popperOffsets != null) {
1717
+ state.modifiersData.popperOffsets.x += x;
1718
+ state.modifiersData.popperOffsets.y += y;
1719
+ }
1720
+
1721
+ state.modifiersData[name] = data;
1722
+ } // eslint-disable-next-line import/no-unused-modules
1723
+
1724
+
1725
+ const offset$1 = {
1726
+ name: 'offset',
1727
+ enabled: true,
1728
+ phase: 'main',
1729
+ requires: ['popperOffsets'],
1730
+ fn: offset
1731
+ };
1732
+
1733
+ function popperOffsets(_ref) {
1734
+ var state = _ref.state,
1735
+ name = _ref.name;
1736
+ // Offsets are the actual position the popper needs to have to be
1737
+ // properly positioned near its reference element
1738
+ // This is the most basic placement, and will be adjusted by
1739
+ // the modifiers in the next step
1740
+ state.modifiersData[name] = computeOffsets({
1741
+ reference: state.rects.reference,
1742
+ element: state.rects.popper,
1743
+ strategy: 'absolute',
1744
+ placement: state.placement
1745
+ });
1746
+ } // eslint-disable-next-line import/no-unused-modules
1747
+
1748
+
1749
+ const popperOffsets$1 = {
1750
+ name: 'popperOffsets',
1751
+ enabled: true,
1752
+ phase: 'read',
1753
+ fn: popperOffsets,
1754
+ data: {}
1755
+ };
1756
+
1757
+ function getAltAxis(axis) {
1758
+ return axis === 'x' ? 'y' : 'x';
1759
+ }
1760
+
1761
+ function preventOverflow(_ref) {
1762
+ var state = _ref.state,
1763
+ options = _ref.options,
1764
+ name = _ref.name;
1765
+ var _options$mainAxis = options.mainAxis,
1766
+ checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
1767
+ _options$altAxis = options.altAxis,
1768
+ checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,
1769
+ boundary = options.boundary,
1770
+ rootBoundary = options.rootBoundary,
1771
+ altBoundary = options.altBoundary,
1772
+ padding = options.padding,
1773
+ _options$tether = options.tether,
1774
+ tether = _options$tether === void 0 ? true : _options$tether,
1775
+ _options$tetherOffset = options.tetherOffset,
1776
+ tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
1777
+ var overflow = detectOverflow(state, {
1778
+ boundary: boundary,
1779
+ rootBoundary: rootBoundary,
1780
+ padding: padding,
1781
+ altBoundary: altBoundary
1782
+ });
1783
+ var basePlacement = getBasePlacement(state.placement);
1784
+ var variation = getVariation(state.placement);
1785
+ var isBasePlacement = !variation;
1786
+ var mainAxis = getMainAxisFromPlacement(basePlacement);
1787
+ var altAxis = getAltAxis(mainAxis);
1788
+ var popperOffsets = state.modifiersData.popperOffsets;
1789
+ var referenceRect = state.rects.reference;
1790
+ var popperRect = state.rects.popper;
1791
+ var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
1792
+ placement: state.placement
1793
+ })) : tetherOffset;
1794
+ var data = {
1795
+ x: 0,
1796
+ y: 0
1797
+ };
1798
+
1799
+ if (!popperOffsets) {
1800
+ return;
1801
+ }
1802
+
1803
+ if (checkMainAxis || checkAltAxis) {
1804
+ var mainSide = mainAxis === 'y' ? top : left;
1805
+ var altSide = mainAxis === 'y' ? bottom : right;
1806
+ var len = mainAxis === 'y' ? 'height' : 'width';
1807
+ var offset = popperOffsets[mainAxis];
1808
+ var min$1 = popperOffsets[mainAxis] + overflow[mainSide];
1809
+ var max$1 = popperOffsets[mainAxis] - overflow[altSide];
1810
+ var additive = tether ? -popperRect[len] / 2 : 0;
1811
+ var minLen = variation === start ? referenceRect[len] : popperRect[len];
1812
+ var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
1813
+ // outside the reference bounds
1814
+
1815
+ var arrowElement = state.elements.arrow;
1816
+ var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
1817
+ width: 0,
1818
+ height: 0
1819
+ };
1820
+ var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();
1821
+ var arrowPaddingMin = arrowPaddingObject[mainSide];
1822
+ var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want
1823
+ // to include its full size in the calculation. If the reference is small
1824
+ // and near the edge of a boundary, the popper can overflow even if the
1825
+ // reference is not overflowing as well (e.g. virtual elements with no
1826
+ // width or height)
1827
+
1828
+ var arrowLen = within(0, referenceRect[len], arrowRect[len]);
1829
+ var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - tetherOffsetValue : minLen - arrowLen - arrowPaddingMin - tetherOffsetValue;
1830
+ var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + tetherOffsetValue : maxLen + arrowLen + arrowPaddingMax + tetherOffsetValue;
1831
+ var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
1832
+ var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
1833
+ var offsetModifierValue = state.modifiersData.offset ? state.modifiersData.offset[state.placement][mainAxis] : 0;
1834
+ var tetherMin = popperOffsets[mainAxis] + minOffset - offsetModifierValue - clientOffset;
1835
+ var tetherMax = popperOffsets[mainAxis] + maxOffset - offsetModifierValue;
1836
+
1837
+ if (checkMainAxis) {
1838
+ var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
1839
+ popperOffsets[mainAxis] = preventedOffset;
1840
+ data[mainAxis] = preventedOffset - offset;
1841
+ }
1842
+
1843
+ if (checkAltAxis) {
1844
+ var _mainSide = mainAxis === 'x' ? top : left;
1845
+
1846
+ var _altSide = mainAxis === 'x' ? bottom : right;
1847
+
1848
+ var _offset = popperOffsets[altAxis];
1849
+
1850
+ var _min = _offset + overflow[_mainSide];
1851
+
1852
+ var _max = _offset - overflow[_altSide];
1853
+
1854
+ var _preventedOffset = within(tether ? min(_min, tetherMin) : _min, _offset, tether ? max(_max, tetherMax) : _max);
1855
+
1856
+ popperOffsets[altAxis] = _preventedOffset;
1857
+ data[altAxis] = _preventedOffset - _offset;
1858
+ }
1859
+ }
1860
+
1861
+ state.modifiersData[name] = data;
1862
+ } // eslint-disable-next-line import/no-unused-modules
1863
+
1864
+
1865
+ const preventOverflow$1 = {
1866
+ name: 'preventOverflow',
1867
+ enabled: true,
1868
+ phase: 'main',
1869
+ fn: preventOverflow,
1870
+ requiresIfExists: ['offset']
1871
+ };
1872
+
1873
+ function getHTMLElementScroll(element) {
1874
+ return {
1875
+ scrollLeft: element.scrollLeft,
1876
+ scrollTop: element.scrollTop
1877
+ };
1878
+ }
1879
+
1880
+ function getNodeScroll(node) {
1881
+ if (node === getWindow(node) || !isHTMLElement(node)) {
1882
+ return getWindowScroll(node);
1883
+ } else {
1884
+ return getHTMLElementScroll(node);
1885
+ }
1886
+ }
1887
+
1888
+ function isElementScaled(element) {
1889
+ var rect = element.getBoundingClientRect();
1890
+ var scaleX = rect.width / element.offsetWidth || 1;
1891
+ var scaleY = rect.height / element.offsetHeight || 1;
1892
+ return scaleX !== 1 || scaleY !== 1;
1893
+ } // Returns the composite rect of an element relative to its offsetParent.
1894
+ // Composite means it takes into account transforms as well as layout.
1895
+
1896
+
1897
+ function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
1898
+ if (isFixed === void 0) {
1899
+ isFixed = false;
1900
+ }
1901
+
1902
+ var isOffsetParentAnElement = isHTMLElement(offsetParent);
1903
+ var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
1904
+ var documentElement = getDocumentElement(offsetParent);
1905
+ var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
1906
+ var scroll = {
1907
+ scrollLeft: 0,
1908
+ scrollTop: 0
1909
+ };
1910
+ var offsets = {
1911
+ x: 0,
1912
+ y: 0
1913
+ };
1914
+
1915
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1916
+ if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
1917
+ isScrollParent(documentElement)) {
1918
+ scroll = getNodeScroll(offsetParent);
1919
+ }
1920
+
1921
+ if (isHTMLElement(offsetParent)) {
1922
+ offsets = getBoundingClientRect(offsetParent, true);
1923
+ offsets.x += offsetParent.clientLeft;
1924
+ offsets.y += offsetParent.clientTop;
1925
+ } else if (documentElement) {
1926
+ offsets.x = getWindowScrollBarX(documentElement);
1927
+ }
1928
+ }
1929
+
1930
+ return {
1931
+ x: rect.left + scroll.scrollLeft - offsets.x,
1932
+ y: rect.top + scroll.scrollTop - offsets.y,
1933
+ width: rect.width,
1934
+ height: rect.height
1935
+ };
1936
+ }
1937
+
1938
+ function order(modifiers) {
1939
+ var map = new Map();
1940
+ var visited = new Set();
1941
+ var result = [];
1942
+ modifiers.forEach(function (modifier) {
1943
+ map.set(modifier.name, modifier);
1944
+ }); // On visiting object, check for its dependencies and visit them recursively
1945
+
1946
+ function sort(modifier) {
1947
+ visited.add(modifier.name);
1948
+ var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
1949
+ requires.forEach(function (dep) {
1950
+ if (!visited.has(dep)) {
1951
+ var depModifier = map.get(dep);
1952
+
1953
+ if (depModifier) {
1954
+ sort(depModifier);
1955
+ }
1956
+ }
1957
+ });
1958
+ result.push(modifier);
1959
+ }
1960
+
1961
+ modifiers.forEach(function (modifier) {
1962
+ if (!visited.has(modifier.name)) {
1963
+ // check for visited object
1964
+ sort(modifier);
1965
+ }
1966
+ });
1967
+ return result;
1968
+ }
1969
+
1970
+ function orderModifiers(modifiers) {
1971
+ // order based on dependencies
1972
+ var orderedModifiers = order(modifiers); // order based on phase
1973
+
1974
+ return modifierPhases.reduce(function (acc, phase) {
1975
+ return acc.concat(orderedModifiers.filter(function (modifier) {
1976
+ return modifier.phase === phase;
1977
+ }));
1978
+ }, []);
1979
+ }
1980
+
1981
+ function debounce(fn) {
1982
+ var pending;
1983
+ return function () {
1984
+ if (!pending) {
1985
+ pending = new Promise(function (resolve) {
1986
+ Promise.resolve().then(function () {
1987
+ pending = undefined;
1988
+ resolve(fn());
1989
+ });
1990
+ });
1991
+ }
1992
+
1993
+ return pending;
1994
+ };
1995
+ }
1996
+
1997
+ function mergeByName(modifiers) {
1998
+ var merged = modifiers.reduce(function (merged, current) {
1999
+ var existing = merged[current.name];
2000
+ merged[current.name] = existing ? Object.assign({}, existing, current, {
2001
+ options: Object.assign({}, existing.options, current.options),
2002
+ data: Object.assign({}, existing.data, current.data)
2003
+ }) : current;
2004
+ return merged;
2005
+ }, {}); // IE11 does not support Object.values
2006
+
2007
+ return Object.keys(merged).map(function (key) {
2008
+ return merged[key];
2009
+ });
2010
+ }
2011
+
2012
+ var DEFAULT_OPTIONS = {
2013
+ placement: 'bottom',
2014
+ modifiers: [],
2015
+ strategy: 'absolute'
2016
+ };
2017
+
2018
+ function areValidElements() {
2019
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2020
+ args[_key] = arguments[_key];
2021
+ }
2022
+
2023
+ return !args.some(function (element) {
2024
+ return !(element && typeof element.getBoundingClientRect === 'function');
2025
+ });
2026
+ }
2027
+
2028
+ function popperGenerator(generatorOptions) {
2029
+ if (generatorOptions === void 0) {
2030
+ generatorOptions = {};
2031
+ }
2032
+
2033
+ var _generatorOptions = generatorOptions,
2034
+ _generatorOptions$def = _generatorOptions.defaultModifiers,
2035
+ defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,
2036
+ _generatorOptions$def2 = _generatorOptions.defaultOptions,
2037
+ defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
2038
+ return function createPopper(reference, popper, options) {
2039
+ if (options === void 0) {
2040
+ options = defaultOptions;
2041
+ }
2042
+
2043
+ var state = {
2044
+ placement: 'bottom',
2045
+ orderedModifiers: [],
2046
+ options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
2047
+ modifiersData: {},
2048
+ elements: {
2049
+ reference: reference,
2050
+ popper: popper
2051
+ },
2052
+ attributes: {},
2053
+ styles: {}
2054
+ };
2055
+ var effectCleanupFns = [];
2056
+ var isDestroyed = false;
2057
+ var instance = {
2058
+ state: state,
2059
+ setOptions: function setOptions(options) {
2060
+ cleanupModifierEffects();
2061
+ state.options = Object.assign({}, defaultOptions, state.options, options);
2062
+ state.scrollParents = {
2063
+ reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
2064
+ popper: listScrollParents(popper)
2065
+ }; // Orders the modifiers based on their dependencies and `phase`
2066
+ // properties
2067
+
2068
+ var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers
2069
+
2070
+ state.orderedModifiers = orderedModifiers.filter(function (m) {
2071
+ return m.enabled;
2072
+ }); // Validate the provided modifiers so that the consumer will get warned
2073
+
2074
+ runModifierEffects();
2075
+ return instance.update();
2076
+ },
2077
+ // Sync update – it will always be executed, even if not necessary. This
2078
+ // is useful for low frequency updates where sync behavior simplifies the
2079
+ // logic.
2080
+ // For high frequency updates (e.g. `resize` and `scroll` events), always
2081
+ // prefer the async Popper#update method
2082
+ forceUpdate: function forceUpdate() {
2083
+ if (isDestroyed) {
2084
+ return;
2085
+ }
2086
+
2087
+ var _state$elements = state.elements,
2088
+ reference = _state$elements.reference,
2089
+ popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements
2090
+ // anymore
2091
+
2092
+ if (!areValidElements(reference, popper)) {
2093
+
2094
+ return;
2095
+ } // Store the reference and popper rects to be read by modifiers
2096
+
2097
+
2098
+ state.rects = {
2099
+ reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
2100
+ popper: getLayoutRect(popper)
2101
+ }; // Modifiers have the ability to reset the current update cycle. The
2102
+ // most common use case for this is the `flip` modifier changing the
2103
+ // placement, which then needs to re-run all the modifiers, because the
2104
+ // logic was previously ran for the previous placement and is therefore
2105
+ // stale/incorrect
2106
+
2107
+ state.reset = false;
2108
+ state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier
2109
+ // is filled with the initial data specified by the modifier. This means
2110
+ // it doesn't persist and is fresh on each update.
2111
+ // To ensure persistent data, use `${name}#persistent`
2112
+
2113
+ state.orderedModifiers.forEach(function (modifier) {
2114
+ return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
2115
+ });
2116
+
2117
+ for (var index = 0; index < state.orderedModifiers.length; index++) {
2118
+
2119
+ if (state.reset === true) {
2120
+ state.reset = false;
2121
+ index = -1;
2122
+ continue;
2123
+ }
2124
+
2125
+ var _state$orderedModifie = state.orderedModifiers[index],
2126
+ fn = _state$orderedModifie.fn,
2127
+ _state$orderedModifie2 = _state$orderedModifie.options,
2128
+ _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
2129
+ name = _state$orderedModifie.name;
2130
+
2131
+ if (typeof fn === 'function') {
2132
+ state = fn({
2133
+ state: state,
2134
+ options: _options,
2135
+ name: name,
2136
+ instance: instance
2137
+ }) || state;
2138
+ }
2139
+ }
2140
+ },
2141
+ // Async and optimistically optimized update – it will not be executed if
2142
+ // not necessary (debounced to run at most once-per-tick)
2143
+ update: debounce(function () {
2144
+ return new Promise(function (resolve) {
2145
+ instance.forceUpdate();
2146
+ resolve(state);
2147
+ });
2148
+ }),
2149
+ destroy: function destroy() {
2150
+ cleanupModifierEffects();
2151
+ isDestroyed = true;
2152
+ }
2153
+ };
2154
+
2155
+ if (!areValidElements(reference, popper)) {
2156
+
2157
+ return instance;
2158
+ }
2159
+
2160
+ instance.setOptions(options).then(function (state) {
2161
+ if (!isDestroyed && options.onFirstUpdate) {
2162
+ options.onFirstUpdate(state);
2163
+ }
2164
+ }); // Modifiers have the ability to execute arbitrary code before the first
2165
+ // update cycle runs. They will be executed in the same order as the update
2166
+ // cycle. This is useful when a modifier adds some persistent data that
2167
+ // other modifiers need to use, but the modifier is run after the dependent
2168
+ // one.
2169
+
2170
+ function runModifierEffects() {
2171
+ state.orderedModifiers.forEach(function (_ref3) {
2172
+ var name = _ref3.name,
2173
+ _ref3$options = _ref3.options,
2174
+ options = _ref3$options === void 0 ? {} : _ref3$options,
2175
+ effect = _ref3.effect;
2176
+
2177
+ if (typeof effect === 'function') {
2178
+ var cleanupFn = effect({
2179
+ state: state,
2180
+ name: name,
2181
+ instance: instance,
2182
+ options: options
2183
+ });
2184
+
2185
+ var noopFn = function noopFn() {};
2186
+
2187
+ effectCleanupFns.push(cleanupFn || noopFn);
2188
+ }
2189
+ });
2190
+ }
2191
+
2192
+ function cleanupModifierEffects() {
2193
+ effectCleanupFns.forEach(function (fn) {
2194
+ return fn();
2195
+ });
2196
+ effectCleanupFns = [];
2197
+ }
2198
+
2199
+ return instance;
2200
+ };
2201
+ }
2202
+
2203
+ var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
2204
+ var createPopper = /*#__PURE__*/popperGenerator({
2205
+ defaultModifiers: defaultModifiers
2206
+ }); // eslint-disable-next-line import/no-unused-modules
2207
+
2208
+ const portalCss = ":host(limel-portal){display:block;position:absolute;top:0;bottom:0;width:100%;pointer-events:none}:host([hidden]){display:none}";
2209
+
2210
+ let Portal = class {
2211
+ constructor(hostRef) {
2212
+ registerInstance(this, hostRef);
2213
+ /**
2214
+ * Decides which direction the portal content should open.
2215
+ */
2216
+ this.openDirection = 'right';
2217
+ /**
2218
+ * Position of the content.
2219
+ */
2220
+ this.position = 'absolute';
2221
+ /**
2222
+ * Dynamic styling that can be applied to the container holding the content.
2223
+ */
2224
+ this.containerStyle = {};
2225
+ /**
2226
+ * Parent element to move the content to.
2227
+ */
2228
+ this.parent = document.body;
2229
+ /**
2230
+ * Used to make a dropdown have the same width as the trigger, for example
2231
+ * in `limel-picker`.
2232
+ */
2233
+ this.inheritParentWidth = false;
2234
+ /**
2235
+ * True if the content within the portal should be visible.
2236
+ *
2237
+ * If the content is from within a dialog for instance, this can be set to
2238
+ * true from false when the dialog opens to position the content properly.
2239
+ */
2240
+ this.visible = false;
2241
+ this.loaded = false;
2242
+ this.parents = new WeakMap();
2243
+ }
2244
+ onVisible() {
2245
+ if (!this.visible) {
2246
+ this.hideContainer();
2247
+ this.styleContainer();
2248
+ this.destroyPopper();
2249
+ return;
2250
+ }
2251
+ this.styleContainer();
2252
+ this.createPopper();
2253
+ requestAnimationFrame(() => {
2254
+ this.showContainer();
2255
+ });
2256
+ }
2257
+ disconnectedCallback() {
2258
+ this.removeContainer();
2259
+ this.destroyPopper();
2260
+ if (this.observer) {
2261
+ this.observer.unobserve(this.container);
2262
+ }
2263
+ }
2264
+ connectedCallback() {
2265
+ if (!this.loaded) {
2266
+ return;
2267
+ }
2268
+ this.createContainer();
2269
+ this.hideContainer();
2270
+ this.attachContainer();
2271
+ this.styleContainer();
2272
+ if (this.visible) {
2273
+ this.createPopper();
2274
+ this.showContainer();
2275
+ }
2276
+ if ('ResizeObserver' in window) {
2277
+ const observer = new ResizeObserver(() => {
2278
+ if (this.popperInstance) {
2279
+ this.styleContainer();
2280
+ this.popperInstance.update();
2281
+ }
2282
+ });
2283
+ observer.observe(this.container);
2284
+ }
2285
+ }
2286
+ componentDidLoad() {
2287
+ this.loaded = true;
2288
+ this.connectedCallback();
2289
+ }
2290
+ render() {
2291
+ return h("slot", null);
2292
+ }
2293
+ createContainer() {
2294
+ const slot = this.host.shadowRoot.querySelector('slot');
2295
+ const content = (slot.assignedElements && slot.assignedElements()) || [];
2296
+ this.container = document.createElement('div');
2297
+ this.container.setAttribute('id', this.containerId);
2298
+ this.container.setAttribute('class', 'limel-portal--container');
2299
+ Object.assign(this.container, {
2300
+ portalSource: this.host,
2301
+ });
2302
+ content.forEach((element) => {
2303
+ this.parents.set(element, element.parentElement);
2304
+ this.container.appendChild(element);
2305
+ });
2306
+ }
2307
+ attachContainer() {
2308
+ this.parent.appendChild(this.container);
2309
+ }
2310
+ removeContainer() {
2311
+ if (!this.container) {
2312
+ return;
2313
+ }
2314
+ Array.from(this.container.children).forEach((element) => {
2315
+ const parent = this.parents.get(element);
2316
+ if (!parent) {
2317
+ return;
2318
+ }
2319
+ parent.appendChild(element);
2320
+ });
2321
+ this.hideContainer();
2322
+ this.container.parentElement.removeChild(this.container);
2323
+ }
2324
+ hideContainer() {
2325
+ this.container.style.opacity = '0';
2326
+ }
2327
+ showContainer() {
2328
+ this.container.style.opacity = '1';
2329
+ }
2330
+ styleContainer() {
2331
+ const hostWidth = this.host.getBoundingClientRect().width;
2332
+ if (this.visible) {
2333
+ this.container.style.display = 'block';
2334
+ }
2335
+ else {
2336
+ this.container.style.display = 'none';
2337
+ }
2338
+ if (this.inheritParentWidth) {
2339
+ const containerWidth = this.getContentWidth(this.container);
2340
+ let width = containerWidth;
2341
+ if (hostWidth > 0) {
2342
+ width = hostWidth;
2343
+ }
2344
+ this.container.style.width = `${width}px`;
2345
+ }
2346
+ this.ensureContainerFitsInViewPort();
2347
+ Object.keys(this.containerStyle).forEach((property) => {
2348
+ this.container.style[property] = this.containerStyle[property];
2349
+ });
2350
+ }
2351
+ getContentWidth(element) {
2352
+ if (!element) {
2353
+ return null;
2354
+ }
2355
+ const width = element.getBoundingClientRect().width;
2356
+ if (width !== 0) {
2357
+ return width;
2358
+ }
2359
+ const elementContent = element.querySelector('*');
2360
+ return this.getContentWidth(elementContent);
2361
+ }
2362
+ createPopper() {
2363
+ const config = this.createPopperConfig();
2364
+ this.popperInstance = createPopper(this.host, this.container, config);
2365
+ }
2366
+ destroyPopper() {
2367
+ var _a;
2368
+ (_a = this.popperInstance) === null || _a === void 0 ? void 0 : _a.destroy();
2369
+ this.popperInstance = null;
2370
+ }
2371
+ createPopperConfig() {
2372
+ let placement = 'bottom-start';
2373
+ let flipPlacement = 'top-start';
2374
+ if (this.openDirection === 'left') {
2375
+ placement = 'bottom-end';
2376
+ flipPlacement = 'top-end';
2377
+ }
2378
+ return {
2379
+ strategy: this.position,
2380
+ placement: placement,
2381
+ modifiers: [
2382
+ {
2383
+ name: 'flip',
2384
+ options: {
2385
+ fallbackPlacements: [flipPlacement],
2386
+ },
2387
+ },
2388
+ ],
2389
+ };
2390
+ }
2391
+ ensureContainerFitsInViewPort() {
2392
+ const viewHeight = Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0);
2393
+ const { top, bottom } = this.host.getBoundingClientRect();
2394
+ const spaceAboveTopOfSurface = Math.max(top, 0);
2395
+ const spaceBelowTopOfSurface = Math.max(viewHeight - bottom, 0);
2396
+ const extraCosmeticSpace = 16;
2397
+ const maxHeight = Math.max(spaceAboveTopOfSurface, spaceBelowTopOfSurface) -
2398
+ extraCosmeticSpace;
2399
+ this.container.style.maxHeight = `${maxHeight}px`;
2400
+ }
2401
+ get host() { return getElement(this); }
2402
+ static get watchers() { return {
2403
+ "visible": ["onVisible"]
2404
+ }; }
2405
+ };
2406
+ Portal.style = portalCss;
2407
+
2408
+ export { List as limel_list, MenuSurface as limel_menu_surface, Portal as limel_portal };