rails_admin 3.0.0.beta2 → 3.0.0.rc

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