@ukic/canary-web-components 2.0.0-canary.7 → 2.0.0-canary.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (361) hide show
  1. package/dist/cjs/core.cjs.js +1 -1
  2. package/dist/cjs/helpers-93c5fc92.js +198 -0
  3. package/dist/cjs/helpers-93c5fc92.js.map +1 -0
  4. package/dist/cjs/{helpers-00b08718.js → helpers-b525d45a.js} +2 -2
  5. package/dist/cjs/helpers-b525d45a.js.map +1 -0
  6. package/dist/cjs/ic-accordion-group.cjs.entry.js +6 -2
  7. package/dist/cjs/ic-accordion-group.cjs.entry.js.map +1 -1
  8. package/dist/cjs/ic-accordion.cjs.entry.js +1 -1
  9. package/dist/cjs/ic-alert.cjs.entry.js +1 -1
  10. package/dist/cjs/ic-back-to-top.cjs.entry.js +1 -1
  11. package/dist/cjs/ic-badge.cjs.entry.js +4 -3
  12. package/dist/cjs/ic-badge.cjs.entry.js.map +1 -1
  13. package/dist/cjs/ic-breadcrumb-group.cjs.entry.js +1 -1
  14. package/dist/cjs/ic-breadcrumb.cjs.entry.js +1 -1
  15. package/dist/cjs/ic-button_3.cjs.entry.js +23 -12
  16. package/dist/cjs/ic-button_3.cjs.entry.js.map +1 -1
  17. package/dist/cjs/ic-card.cjs.entry.js +5 -6
  18. package/dist/cjs/ic-card.cjs.entry.js.map +1 -1
  19. package/dist/cjs/ic-checkbox-group.cjs.entry.js +1 -1
  20. package/dist/cjs/ic-checkbox.cjs.entry.js +1 -1
  21. package/dist/cjs/ic-chip.cjs.entry.js +1 -1
  22. package/dist/cjs/ic-data-entity.cjs.entry.js +3 -6
  23. package/dist/cjs/ic-data-entity.cjs.entry.js.map +1 -1
  24. package/dist/cjs/ic-data-row.cjs.entry.js +21 -35
  25. package/dist/cjs/ic-data-row.cjs.entry.js.map +1 -1
  26. package/dist/cjs/ic-dialog.cjs.entry.js +1 -1
  27. package/dist/cjs/ic-divider.cjs.entry.js +1 -1
  28. package/dist/cjs/ic-empty-state.cjs.entry.js +1 -1
  29. package/dist/cjs/ic-footer-link-group.cjs.entry.js +1 -1
  30. package/dist/cjs/ic-footer-link.cjs.entry.js +1 -1
  31. package/dist/cjs/ic-footer.cjs.entry.js +1 -1
  32. package/dist/cjs/ic-hero.cjs.entry.js +1 -1
  33. package/dist/cjs/ic-horizontal-scroll.cjs.entry.js +1 -1
  34. package/dist/cjs/ic-input-component-container_3.cjs.entry.js +12 -10
  35. package/dist/cjs/ic-input-component-container_3.cjs.entry.js.map +1 -1
  36. package/dist/cjs/ic-input-label_2.cjs.entry.js +1 -1
  37. package/dist/cjs/ic-link.cjs.entry.js +1 -1
  38. package/dist/cjs/ic-menu-group.cjs.entry.js +1 -1
  39. package/dist/cjs/ic-menu-item.cjs.entry.js +1 -1
  40. package/dist/cjs/ic-menu-with-multi.cjs.entry.js +2599 -0
  41. package/dist/cjs/ic-menu-with-multi.cjs.entry.js.map +1 -0
  42. package/dist/cjs/ic-navigation-button.cjs.entry.js +1 -1
  43. package/dist/cjs/ic-navigation-group.cjs.entry.js +1 -1
  44. package/dist/cjs/ic-navigation-item.cjs.entry.js +1 -1
  45. package/dist/cjs/ic-navigation-menu.cjs.entry.js +1 -1
  46. package/dist/cjs/ic-page-header.cjs.entry.js +1 -1
  47. package/dist/cjs/ic-pagination-bar.cjs.entry.js +2 -18
  48. package/dist/cjs/ic-pagination-bar.cjs.entry.js.map +1 -1
  49. package/dist/cjs/ic-pagination_4.cjs.entry.js +21 -13
  50. package/dist/cjs/ic-pagination_4.cjs.entry.js.map +1 -1
  51. package/dist/cjs/ic-popover-menu.cjs.entry.js +1 -1
  52. package/dist/cjs/ic-popover-menu.cjs.entry.js.map +1 -1
  53. package/dist/cjs/ic-radio-group.cjs.entry.js +1 -1
  54. package/dist/cjs/ic-radio-option.cjs.entry.js +1 -1
  55. package/dist/cjs/ic-search-bar.cjs.entry.js +1 -1
  56. package/dist/cjs/ic-search-bar.cjs.entry.js.map +1 -1
  57. package/dist/cjs/ic-select-with-multi.cjs.entry.js +837 -0
  58. package/dist/cjs/ic-select-with-multi.cjs.entry.js.map +1 -0
  59. package/dist/cjs/ic-side-navigation.cjs.entry.js +1 -1
  60. package/dist/cjs/ic-status-tag.cjs.entry.js +1 -1
  61. package/dist/cjs/ic-step.cjs.entry.js +1 -1
  62. package/dist/cjs/ic-stepper.cjs.entry.js +1 -1
  63. package/dist/cjs/ic-switch.cjs.entry.js +1 -1
  64. package/dist/cjs/ic-tab-group.cjs.entry.js +1 -1
  65. package/dist/cjs/ic-tab-panel.cjs.entry.js +1 -1
  66. package/dist/cjs/ic-tab.cjs.entry.js +1 -1
  67. package/dist/cjs/ic-theme.cjs.entry.js +1 -1
  68. package/dist/cjs/ic-toast.cjs.entry.js +1 -1
  69. package/dist/cjs/ic-toggle-button-group.cjs.entry.js +184 -0
  70. package/dist/cjs/ic-toggle-button-group.cjs.entry.js.map +1 -0
  71. package/dist/cjs/ic-toggle-button.cjs.entry.js +6 -3
  72. package/dist/cjs/ic-toggle-button.cjs.entry.js.map +1 -1
  73. package/dist/cjs/ic-top-navigation.cjs.entry.js +1 -1
  74. package/dist/cjs/ic-typography.cjs.entry.js +1 -1
  75. package/dist/cjs/index-4cf27b16.js +12 -0
  76. package/dist/cjs/loader.cjs.js +1 -1
  77. package/dist/collection/collection-manifest.json +4 -1
  78. package/dist/collection/components/ic-menu-with-multi/ic-menu.css +701 -0
  79. package/dist/collection/components/ic-menu-with-multi/ic-menu.js +1458 -0
  80. package/dist/collection/components/ic-menu-with-multi/ic-menu.js.map +1 -0
  81. package/dist/collection/components/ic-menu-with-multi/test/basic/ic-menu.spec.js +880 -0
  82. package/dist/collection/components/ic-menu-with-multi/test/basic/ic-menu.spec.js.map +1 -0
  83. package/dist/collection/components/ic-select-with-multi/assets/Check.svg +3 -0
  84. package/dist/collection/components/ic-select-with-multi/assets/Clear.svg +3 -0
  85. package/dist/collection/components/ic-select-with-multi/assets/Expand.svg +3 -0
  86. package/dist/collection/components/ic-select-with-multi/ic-select.css +693 -0
  87. package/dist/collection/components/ic-select-with-multi/ic-select.js +1649 -0
  88. package/dist/collection/components/ic-select-with-multi/ic-select.js.map +1 -0
  89. package/dist/collection/components/ic-select-with-multi/story-data.js +216 -0
  90. package/dist/collection/components/ic-select-with-multi/story-data.js.map +1 -0
  91. package/dist/collection/components/ic-select-with-multi/test/a11y/ic-select.test.a11y.js +146 -0
  92. package/dist/collection/components/ic-select-with-multi/test/a11y/ic-select.test.a11y.js.map +1 -0
  93. package/dist/collection/components/ic-select-with-multi/test/basic/ic-select.e2e.js +2040 -0
  94. package/dist/collection/components/ic-select-with-multi/test/basic/ic-select.e2e.js.map +1 -0
  95. package/dist/collection/components/ic-select-with-multi/test/basic/ic-select.spec.js +1518 -0
  96. package/dist/collection/components/ic-select-with-multi/test/basic/ic-select.spec.js.map +1 -0
  97. package/dist/collection/utils/constants.js +28 -0
  98. package/dist/collection/utils/constants.js.map +1 -0
  99. package/dist/collection/utils/helpers.js +168 -5
  100. package/dist/collection/utils/helpers.js.map +1 -1
  101. package/dist/collection/utils/types.js +13 -0
  102. package/dist/collection/utils/types.js.map +1 -0
  103. package/dist/components/helpers.js +1 -1
  104. package/dist/components/helpers.js.map +1 -1
  105. package/dist/components/helpers2.js +183 -0
  106. package/dist/components/helpers2.js.map +1 -0
  107. package/dist/components/ic-accordion-group.js +7 -2
  108. package/dist/components/ic-accordion-group.js.map +1 -1
  109. package/dist/components/ic-badge.js +3 -2
  110. package/dist/components/ic-badge.js.map +1 -1
  111. package/dist/components/ic-button2.js +22 -11
  112. package/dist/components/ic-button2.js.map +1 -1
  113. package/dist/components/ic-card.js +5 -18
  114. package/dist/components/ic-card.js.map +1 -1
  115. package/dist/components/ic-data-entity.js +3 -6
  116. package/dist/components/ic-data-entity.js.map +1 -1
  117. package/dist/components/ic-data-row.js +20 -34
  118. package/dist/components/ic-data-row.js.map +1 -1
  119. package/dist/components/ic-input-component-container2.js +6 -5
  120. package/dist/components/ic-input-component-container2.js.map +1 -1
  121. package/dist/components/ic-menu-with-multi.d.ts +11 -0
  122. package/dist/components/ic-menu-with-multi.js +8 -0
  123. package/dist/components/ic-menu-with-multi.js.map +1 -0
  124. package/dist/components/ic-menu2.js +5 -4
  125. package/dist/components/ic-menu2.js.map +1 -1
  126. package/dist/components/ic-menu3.js +2665 -0
  127. package/dist/components/ic-menu3.js.map +1 -0
  128. package/dist/components/ic-pagination-bar2.js +1 -17
  129. package/dist/components/ic-pagination-bar2.js.map +1 -1
  130. package/dist/components/ic-popover-menu.js +1 -1
  131. package/dist/components/ic-popover-menu.js.map +1 -1
  132. package/dist/components/ic-search-bar.js.map +1 -1
  133. package/dist/components/ic-select-with-multi.d.ts +11 -0
  134. package/dist/components/ic-select-with-multi.js +962 -0
  135. package/dist/components/ic-select-with-multi.js.map +1 -0
  136. package/dist/components/ic-select2.js +22 -13
  137. package/dist/components/ic-select2.js.map +1 -1
  138. package/dist/components/ic-toggle-button-group.js +210 -0
  139. package/dist/components/ic-toggle-button-group.js.map +1 -0
  140. package/dist/components/ic-toggle-button.js +5 -2
  141. package/dist/components/ic-toggle-button.js.map +1 -1
  142. package/dist/core/core.css +8 -5
  143. package/dist/core/core.esm.js +1 -1
  144. package/dist/core/core.esm.js.map +1 -1
  145. package/dist/core/{p-9ce5f082.entry.js → p-045359e1.entry.js} +2 -2
  146. package/dist/core/{p-7276339a.entry.js → p-10fb4c46.entry.js} +2 -2
  147. package/dist/core/{p-d9342548.entry.js → p-169bfa51.entry.js} +2 -2
  148. package/dist/core/{p-5746577f.entry.js → p-1ca332ca.entry.js} +2 -2
  149. package/dist/core/{p-c345a874.entry.js → p-204ace96.entry.js} +2 -2
  150. package/dist/core/p-21150122.entry.js +2 -0
  151. package/dist/core/p-21150122.entry.js.map +1 -0
  152. package/dist/core/{p-f436630b.entry.js → p-2eac7dcc.entry.js} +2 -2
  153. package/dist/core/{p-b43bd4f3.entry.js → p-3803a5b5.entry.js} +2 -2
  154. package/dist/core/{p-24945ee5.entry.js → p-452985d9.entry.js} +2 -2
  155. package/dist/core/p-452985d9.entry.js.map +1 -0
  156. package/dist/core/{p-ca262cdc.entry.js → p-4753bac8.entry.js} +2 -2
  157. package/dist/core/{p-3d2fcf84.entry.js → p-4baa0916.entry.js} +2 -2
  158. package/dist/core/{p-79b71c18.entry.js → p-4f413fc0.entry.js} +2 -2
  159. package/dist/core/{p-051b8266.entry.js → p-595be57d.entry.js} +2 -2
  160. package/dist/core/{p-434780c8.entry.js → p-5ae93c16.entry.js} +2 -2
  161. package/dist/core/{p-ff1d23cd.entry.js → p-5e0c830b.entry.js} +2 -2
  162. package/dist/core/p-624d4f5f.entry.js +2 -0
  163. package/dist/core/p-624d4f5f.entry.js.map +1 -0
  164. package/dist/core/{p-c263542a.entry.js → p-6933f8e9.entry.js} +2 -2
  165. package/dist/core/{p-32f18701.entry.js → p-6c3044b6.entry.js} +2 -2
  166. package/dist/core/{p-da4f0a58.entry.js → p-73be1251.entry.js} +2 -2
  167. package/dist/core/{p-d49660e0.entry.js → p-75dac3d1.entry.js} +2 -2
  168. package/dist/core/{p-a3ab9f4c.entry.js → p-76915584.entry.js} +2 -2
  169. package/dist/core/p-76915584.entry.js.map +1 -0
  170. package/dist/core/{p-88971cea.entry.js → p-7ef8d616.entry.js} +2 -2
  171. package/dist/core/{p-9fd84c69.entry.js → p-81ddc39d.entry.js} +2 -2
  172. package/dist/core/{p-fbb1fba0.entry.js → p-869954a2.entry.js} +2 -2
  173. package/dist/core/{p-3c859b9e.entry.js → p-88d54b72.entry.js} +2 -2
  174. package/dist/core/{p-5e94fae8.entry.js → p-8b08d8fe.entry.js} +2 -2
  175. package/dist/core/p-8b08d8fe.entry.js.map +1 -0
  176. package/dist/core/{p-d78fd9f3.entry.js → p-917c5721.entry.js} +2 -2
  177. package/dist/core/{p-2094c844.entry.js → p-942282cd.entry.js} +2 -2
  178. package/dist/core/p-99cad6c2.js +2 -0
  179. package/dist/core/p-99cad6c2.js.map +1 -0
  180. package/dist/core/p-9caf19eb.js +2 -0
  181. package/dist/core/p-9caf19eb.js.map +1 -0
  182. package/dist/core/{p-966ab920.entry.js → p-a0f8efb2.entry.js} +2 -2
  183. package/dist/core/{p-7632acc6.entry.js → p-a31031a5.entry.js} +2 -2
  184. package/dist/core/{p-a7d52bd1.entry.js → p-a434c3d4.entry.js} +2 -2
  185. package/dist/core/{p-95d3cd52.entry.js → p-a43c12cd.entry.js} +2 -2
  186. package/dist/core/{p-aafb2c79.entry.js → p-a50c3b9e.entry.js} +2 -2
  187. package/dist/core/{p-28fb7cca.entry.js → p-ab09986c.entry.js} +2 -2
  188. package/dist/core/p-ab09986c.entry.js.map +1 -0
  189. package/dist/core/p-ac4e40a7.entry.js +2 -0
  190. package/dist/core/p-ac4e40a7.entry.js.map +1 -0
  191. package/dist/core/{p-7dfd61bb.entry.js → p-b82dcc29.entry.js} +2 -2
  192. package/dist/core/{p-337b6e05.entry.js → p-ba86928c.entry.js} +2 -2
  193. package/dist/core/{p-f827e4c0.entry.js → p-c125b65a.entry.js} +2 -2
  194. package/dist/core/{p-27aa95e7.entry.js → p-c34848da.entry.js} +2 -2
  195. package/dist/core/{p-3b9f3a07.entry.js → p-d8469ac0.entry.js} +2 -2
  196. package/dist/core/{p-a2f366c7.entry.js → p-db9c03c0.entry.js} +2 -2
  197. package/dist/core/{p-6de46cb7.entry.js → p-e0462b23.entry.js} +2 -2
  198. package/dist/core/p-e0462b23.entry.js.map +1 -0
  199. package/dist/core/p-e0a94f2d.entry.js +2 -0
  200. package/dist/core/p-e0a94f2d.entry.js.map +1 -0
  201. package/dist/core/{p-116b18fe.entry.js → p-e3997d60.entry.js} +2 -2
  202. package/dist/core/p-e79e0292.entry.js +2 -0
  203. package/dist/core/p-e79e0292.entry.js.map +1 -0
  204. package/dist/core/{p-0d181ac8.entry.js → p-e834344e.entry.js} +2 -2
  205. package/dist/core/p-f14454b1.entry.js +2 -0
  206. package/dist/core/{p-93c5b849.entry.js.map → p-f14454b1.entry.js.map} +1 -1
  207. package/dist/core/{p-a162744e.entry.js → p-f3c840cd.entry.js} +2 -2
  208. package/dist/core/{p-a162744e.entry.js.map → p-f3c840cd.entry.js.map} +1 -1
  209. package/dist/core/{p-7b849cb5.entry.js → p-f6888309.entry.js} +2 -2
  210. package/dist/core/p-f74a8752.entry.js +2 -0
  211. package/dist/core/p-f74a8752.entry.js.map +1 -0
  212. package/dist/core/{p-4df42c76.entry.js → p-f7a14c01.entry.js} +2 -2
  213. package/dist/core/{p-d5cc084b.entry.js → p-f843da01.entry.js} +2 -2
  214. package/dist/core/{p-d5cc084b.entry.js.map → p-f843da01.entry.js.map} +1 -1
  215. package/dist/core/{p-0f0509ee.entry.js → p-fc5611e2.entry.js} +2 -2
  216. package/dist/core/p-fc5611e2.entry.js.map +1 -0
  217. package/dist/core/p-fde45b29.entry.js +2 -0
  218. package/dist/core/p-fde45b29.entry.js.map +1 -0
  219. package/dist/esm/core.js +1 -1
  220. package/dist/esm/{helpers-d06dc4ed.js → helpers-12b4266a.js} +2 -2
  221. package/dist/esm/helpers-12b4266a.js.map +1 -0
  222. package/dist/esm/helpers-5271897c.js +183 -0
  223. package/dist/esm/helpers-5271897c.js.map +1 -0
  224. package/dist/esm/ic-accordion-group.entry.js +6 -2
  225. package/dist/esm/ic-accordion-group.entry.js.map +1 -1
  226. package/dist/esm/ic-accordion.entry.js +1 -1
  227. package/dist/esm/ic-alert.entry.js +1 -1
  228. package/dist/esm/ic-back-to-top.entry.js +1 -1
  229. package/dist/esm/ic-badge.entry.js +4 -3
  230. package/dist/esm/ic-badge.entry.js.map +1 -1
  231. package/dist/esm/ic-breadcrumb-group.entry.js +1 -1
  232. package/dist/esm/ic-breadcrumb.entry.js +1 -1
  233. package/dist/esm/ic-button_3.entry.js +23 -12
  234. package/dist/esm/ic-button_3.entry.js.map +1 -1
  235. package/dist/esm/ic-card.entry.js +5 -6
  236. package/dist/esm/ic-card.entry.js.map +1 -1
  237. package/dist/esm/ic-checkbox-group.entry.js +1 -1
  238. package/dist/esm/ic-checkbox.entry.js +1 -1
  239. package/dist/esm/ic-chip.entry.js +1 -1
  240. package/dist/esm/ic-data-entity.entry.js +3 -6
  241. package/dist/esm/ic-data-entity.entry.js.map +1 -1
  242. package/dist/esm/ic-data-row.entry.js +21 -35
  243. package/dist/esm/ic-data-row.entry.js.map +1 -1
  244. package/dist/esm/ic-dialog.entry.js +1 -1
  245. package/dist/esm/ic-divider.entry.js +1 -1
  246. package/dist/esm/ic-empty-state.entry.js +1 -1
  247. package/dist/esm/ic-footer-link-group.entry.js +1 -1
  248. package/dist/esm/ic-footer-link.entry.js +1 -1
  249. package/dist/esm/ic-footer.entry.js +1 -1
  250. package/dist/esm/ic-hero.entry.js +1 -1
  251. package/dist/esm/ic-horizontal-scroll.entry.js +1 -1
  252. package/dist/esm/ic-input-component-container_3.entry.js +12 -10
  253. package/dist/esm/ic-input-component-container_3.entry.js.map +1 -1
  254. package/dist/esm/ic-input-label_2.entry.js +1 -1
  255. package/dist/esm/ic-link.entry.js +1 -1
  256. package/dist/esm/ic-menu-group.entry.js +1 -1
  257. package/dist/esm/ic-menu-item.entry.js +1 -1
  258. package/dist/esm/ic-menu-with-multi.entry.js +2595 -0
  259. package/dist/esm/ic-menu-with-multi.entry.js.map +1 -0
  260. package/dist/esm/ic-navigation-button.entry.js +1 -1
  261. package/dist/esm/ic-navigation-group.entry.js +1 -1
  262. package/dist/esm/ic-navigation-item.entry.js +1 -1
  263. package/dist/esm/ic-navigation-menu.entry.js +1 -1
  264. package/dist/esm/ic-page-header.entry.js +1 -1
  265. package/dist/esm/ic-pagination-bar.entry.js +1 -17
  266. package/dist/esm/ic-pagination-bar.entry.js.map +1 -1
  267. package/dist/esm/ic-pagination_4.entry.js +21 -13
  268. package/dist/esm/ic-pagination_4.entry.js.map +1 -1
  269. package/dist/esm/ic-popover-menu.entry.js +1 -1
  270. package/dist/esm/ic-popover-menu.entry.js.map +1 -1
  271. package/dist/esm/ic-radio-group.entry.js +1 -1
  272. package/dist/esm/ic-radio-option.entry.js +1 -1
  273. package/dist/esm/ic-search-bar.entry.js +1 -1
  274. package/dist/esm/ic-search-bar.entry.js.map +1 -1
  275. package/dist/esm/ic-select-with-multi.entry.js +833 -0
  276. package/dist/esm/ic-select-with-multi.entry.js.map +1 -0
  277. package/dist/esm/ic-side-navigation.entry.js +1 -1
  278. package/dist/esm/ic-status-tag.entry.js +1 -1
  279. package/dist/esm/ic-step.entry.js +1 -1
  280. package/dist/esm/ic-stepper.entry.js +1 -1
  281. package/dist/esm/ic-switch.entry.js +1 -1
  282. package/dist/esm/ic-tab-group.entry.js +1 -1
  283. package/dist/esm/ic-tab-panel.entry.js +1 -1
  284. package/dist/esm/ic-tab.entry.js +1 -1
  285. package/dist/esm/ic-theme.entry.js +1 -1
  286. package/dist/esm/ic-toast.entry.js +1 -1
  287. package/dist/esm/ic-toggle-button-group.entry.js +180 -0
  288. package/dist/esm/ic-toggle-button-group.entry.js.map +1 -0
  289. package/dist/esm/ic-toggle-button.entry.js +6 -3
  290. package/dist/esm/ic-toggle-button.entry.js.map +1 -1
  291. package/dist/esm/ic-top-navigation.entry.js +1 -1
  292. package/dist/esm/ic-typography.entry.js +1 -1
  293. package/dist/esm/index-93509377.js +12 -0
  294. package/dist/esm/loader.js +1 -1
  295. package/dist/types/components/ic-menu-with-multi/ic-menu.d.ts +208 -0
  296. package/dist/types/components/ic-select-with-multi/ic-select.d.ts +289 -0
  297. package/dist/types/components/ic-select-with-multi/story-data.d.ts +32 -0
  298. package/dist/types/components/ic-select-with-multi/test/a11y/ic-select.test.a11y.d.ts +1 -0
  299. package/dist/types/components.d.ts +531 -0
  300. package/dist/types/utils/constants.d.ts +1 -0
  301. package/dist/types/utils/helpers.d.ts +61 -2
  302. package/dist/types/utils/types.d.ts +16 -0
  303. package/hydrate/index.js +6795 -2907
  304. package/package.json +3 -3
  305. package/dist/cjs/helpers-00b08718.js.map +0 -1
  306. package/dist/core/p-0f0509ee.entry.js.map +0 -1
  307. package/dist/core/p-24945ee5.entry.js.map +0 -1
  308. package/dist/core/p-28fb7cca.entry.js.map +0 -1
  309. package/dist/core/p-2aad58b6.js +0 -2
  310. package/dist/core/p-2aad58b6.js.map +0 -1
  311. package/dist/core/p-38314d45.entry.js +0 -2
  312. package/dist/core/p-38314d45.entry.js.map +0 -1
  313. package/dist/core/p-5e94fae8.entry.js.map +0 -1
  314. package/dist/core/p-6de46cb7.entry.js.map +0 -1
  315. package/dist/core/p-93c5b849.entry.js +0 -2
  316. package/dist/core/p-9fdd7d73.entry.js +0 -2
  317. package/dist/core/p-9fdd7d73.entry.js.map +0 -1
  318. package/dist/core/p-a3ab9f4c.entry.js.map +0 -1
  319. package/dist/core/p-c9b11488.entry.js +0 -2
  320. package/dist/core/p-c9b11488.entry.js.map +0 -1
  321. package/dist/core/p-f163a406.entry.js +0 -2
  322. package/dist/core/p-f163a406.entry.js.map +0 -1
  323. package/dist/esm/helpers-d06dc4ed.js.map +0 -1
  324. /package/dist/core/{p-9ce5f082.entry.js.map → p-045359e1.entry.js.map} +0 -0
  325. /package/dist/core/{p-7276339a.entry.js.map → p-10fb4c46.entry.js.map} +0 -0
  326. /package/dist/core/{p-d9342548.entry.js.map → p-169bfa51.entry.js.map} +0 -0
  327. /package/dist/core/{p-5746577f.entry.js.map → p-1ca332ca.entry.js.map} +0 -0
  328. /package/dist/core/{p-c345a874.entry.js.map → p-204ace96.entry.js.map} +0 -0
  329. /package/dist/core/{p-f436630b.entry.js.map → p-2eac7dcc.entry.js.map} +0 -0
  330. /package/dist/core/{p-b43bd4f3.entry.js.map → p-3803a5b5.entry.js.map} +0 -0
  331. /package/dist/core/{p-ca262cdc.entry.js.map → p-4753bac8.entry.js.map} +0 -0
  332. /package/dist/core/{p-3d2fcf84.entry.js.map → p-4baa0916.entry.js.map} +0 -0
  333. /package/dist/core/{p-79b71c18.entry.js.map → p-4f413fc0.entry.js.map} +0 -0
  334. /package/dist/core/{p-051b8266.entry.js.map → p-595be57d.entry.js.map} +0 -0
  335. /package/dist/core/{p-434780c8.entry.js.map → p-5ae93c16.entry.js.map} +0 -0
  336. /package/dist/core/{p-ff1d23cd.entry.js.map → p-5e0c830b.entry.js.map} +0 -0
  337. /package/dist/core/{p-c263542a.entry.js.map → p-6933f8e9.entry.js.map} +0 -0
  338. /package/dist/core/{p-32f18701.entry.js.map → p-6c3044b6.entry.js.map} +0 -0
  339. /package/dist/core/{p-da4f0a58.entry.js.map → p-73be1251.entry.js.map} +0 -0
  340. /package/dist/core/{p-d49660e0.entry.js.map → p-75dac3d1.entry.js.map} +0 -0
  341. /package/dist/core/{p-88971cea.entry.js.map → p-7ef8d616.entry.js.map} +0 -0
  342. /package/dist/core/{p-9fd84c69.entry.js.map → p-81ddc39d.entry.js.map} +0 -0
  343. /package/dist/core/{p-fbb1fba0.entry.js.map → p-869954a2.entry.js.map} +0 -0
  344. /package/dist/core/{p-3c859b9e.entry.js.map → p-88d54b72.entry.js.map} +0 -0
  345. /package/dist/core/{p-d78fd9f3.entry.js.map → p-917c5721.entry.js.map} +0 -0
  346. /package/dist/core/{p-2094c844.entry.js.map → p-942282cd.entry.js.map} +0 -0
  347. /package/dist/core/{p-966ab920.entry.js.map → p-a0f8efb2.entry.js.map} +0 -0
  348. /package/dist/core/{p-7632acc6.entry.js.map → p-a31031a5.entry.js.map} +0 -0
  349. /package/dist/core/{p-a7d52bd1.entry.js.map → p-a434c3d4.entry.js.map} +0 -0
  350. /package/dist/core/{p-95d3cd52.entry.js.map → p-a43c12cd.entry.js.map} +0 -0
  351. /package/dist/core/{p-aafb2c79.entry.js.map → p-a50c3b9e.entry.js.map} +0 -0
  352. /package/dist/core/{p-7dfd61bb.entry.js.map → p-b82dcc29.entry.js.map} +0 -0
  353. /package/dist/core/{p-337b6e05.entry.js.map → p-ba86928c.entry.js.map} +0 -0
  354. /package/dist/core/{p-f827e4c0.entry.js.map → p-c125b65a.entry.js.map} +0 -0
  355. /package/dist/core/{p-27aa95e7.entry.js.map → p-c34848da.entry.js.map} +0 -0
  356. /package/dist/core/{p-3b9f3a07.entry.js.map → p-d8469ac0.entry.js.map} +0 -0
  357. /package/dist/core/{p-a2f366c7.entry.js.map → p-db9c03c0.entry.js.map} +0 -0
  358. /package/dist/core/{p-116b18fe.entry.js.map → p-e3997d60.entry.js.map} +0 -0
  359. /package/dist/core/{p-0d181ac8.entry.js.map → p-e834344e.entry.js.map} +0 -0
  360. /package/dist/core/{p-7b849cb5.entry.js.map → p-f6888309.entry.js.map} +0 -0
  361. /package/dist/core/{p-4df42c76.entry.js.map → p-f7a14c01.entry.js.map} +0 -0
@@ -0,0 +1,2599 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-4cf27b16.js');
6
+ const helpers = require('./helpers-93c5fc92.js');
7
+
8
+ var top = 'top';
9
+ var bottom = 'bottom';
10
+ var right = 'right';
11
+ var left = 'left';
12
+ var auto = 'auto';
13
+ var basePlacements = [top, bottom, right, left];
14
+ var start = 'start';
15
+ var end = 'end';
16
+ var clippingParents = 'clippingParents';
17
+ var viewport = 'viewport';
18
+ var popper = 'popper';
19
+ var reference = 'reference';
20
+ var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
21
+ return acc.concat([placement + "-" + start, placement + "-" + end]);
22
+ }, []);
23
+ var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
24
+ return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
25
+ }, []); // modifiers that need to read the DOM
26
+
27
+ var beforeRead = 'beforeRead';
28
+ var read = 'read';
29
+ var afterRead = 'afterRead'; // pure-logic modifiers
30
+
31
+ var beforeMain = 'beforeMain';
32
+ var main = 'main';
33
+ var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
34
+
35
+ var beforeWrite = 'beforeWrite';
36
+ var write = 'write';
37
+ var afterWrite = 'afterWrite';
38
+ var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
39
+
40
+ function getNodeName(element) {
41
+ return element ? (element.nodeName || '').toLowerCase() : null;
42
+ }
43
+
44
+ function getWindow(node) {
45
+ if (node == null) {
46
+ return window;
47
+ }
48
+
49
+ if (node.toString() !== '[object Window]') {
50
+ var ownerDocument = node.ownerDocument;
51
+ return ownerDocument ? ownerDocument.defaultView || window : window;
52
+ }
53
+
54
+ return node;
55
+ }
56
+
57
+ function isElement(node) {
58
+ var OwnElement = getWindow(node).Element;
59
+ return node instanceof OwnElement || node instanceof Element;
60
+ }
61
+
62
+ function isHTMLElement(node) {
63
+ var OwnElement = getWindow(node).HTMLElement;
64
+ return node instanceof OwnElement || node instanceof HTMLElement;
65
+ }
66
+
67
+ function isShadowRoot(node) {
68
+ // IE 11 has no ShadowRoot
69
+ if (typeof ShadowRoot === 'undefined') {
70
+ return false;
71
+ }
72
+
73
+ var OwnElement = getWindow(node).ShadowRoot;
74
+ return node instanceof OwnElement || node instanceof ShadowRoot;
75
+ }
76
+
77
+ // and applies them to the HTMLElements such as popper and arrow
78
+
79
+ function applyStyles(_ref) {
80
+ var state = _ref.state;
81
+ Object.keys(state.elements).forEach(function (name) {
82
+ var style = state.styles[name] || {};
83
+ var attributes = state.attributes[name] || {};
84
+ var element = state.elements[name]; // arrow is optional + virtual elements
85
+
86
+ if (!isHTMLElement(element) || !getNodeName(element)) {
87
+ return;
88
+ } // Flow doesn't support to extend this property, but it's the most
89
+ // effective way to apply styles to an HTMLElement
90
+ // $FlowFixMe[cannot-write]
91
+
92
+
93
+ Object.assign(element.style, style);
94
+ Object.keys(attributes).forEach(function (name) {
95
+ var value = attributes[name];
96
+
97
+ if (value === false) {
98
+ element.removeAttribute(name);
99
+ } else {
100
+ element.setAttribute(name, value === true ? '' : value);
101
+ }
102
+ });
103
+ });
104
+ }
105
+
106
+ function effect$2(_ref2) {
107
+ var state = _ref2.state;
108
+ var initialStyles = {
109
+ popper: {
110
+ position: state.options.strategy,
111
+ left: '0',
112
+ top: '0',
113
+ margin: '0'
114
+ },
115
+ arrow: {
116
+ position: 'absolute'
117
+ },
118
+ reference: {}
119
+ };
120
+ Object.assign(state.elements.popper.style, initialStyles.popper);
121
+ state.styles = initialStyles;
122
+
123
+ if (state.elements.arrow) {
124
+ Object.assign(state.elements.arrow.style, initialStyles.arrow);
125
+ }
126
+
127
+ return function () {
128
+ Object.keys(state.elements).forEach(function (name) {
129
+ var element = state.elements[name];
130
+ var attributes = state.attributes[name] || {};
131
+ var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them
132
+
133
+ var style = styleProperties.reduce(function (style, property) {
134
+ style[property] = '';
135
+ return style;
136
+ }, {}); // arrow is optional + virtual elements
137
+
138
+ if (!isHTMLElement(element) || !getNodeName(element)) {
139
+ return;
140
+ }
141
+
142
+ Object.assign(element.style, style);
143
+ Object.keys(attributes).forEach(function (attribute) {
144
+ element.removeAttribute(attribute);
145
+ });
146
+ });
147
+ };
148
+ } // eslint-disable-next-line import/no-unused-modules
149
+
150
+
151
+ const applyStyles$1 = {
152
+ name: 'applyStyles',
153
+ enabled: true,
154
+ phase: 'write',
155
+ fn: applyStyles,
156
+ effect: effect$2,
157
+ requires: ['computeStyles']
158
+ };
159
+
160
+ function getBasePlacement(placement) {
161
+ return placement.split('-')[0];
162
+ }
163
+
164
+ var max = Math.max;
165
+ var min = Math.min;
166
+ var round = Math.round;
167
+
168
+ function getUAString() {
169
+ var uaData = navigator.userAgentData;
170
+
171
+ if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
172
+ return uaData.brands.map(function (item) {
173
+ return item.brand + "/" + item.version;
174
+ }).join(' ');
175
+ }
176
+
177
+ return navigator.userAgent;
178
+ }
179
+
180
+ function isLayoutViewport() {
181
+ return !/^((?!chrome|android).)*safari/i.test(getUAString());
182
+ }
183
+
184
+ function getBoundingClientRect(element, includeScale, isFixedStrategy) {
185
+ if (includeScale === void 0) {
186
+ includeScale = false;
187
+ }
188
+
189
+ if (isFixedStrategy === void 0) {
190
+ isFixedStrategy = false;
191
+ }
192
+
193
+ var clientRect = element.getBoundingClientRect();
194
+ var scaleX = 1;
195
+ var scaleY = 1;
196
+
197
+ if (includeScale && isHTMLElement(element)) {
198
+ scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
199
+ scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
200
+ }
201
+
202
+ var _ref = isElement(element) ? getWindow(element) : window,
203
+ visualViewport = _ref.visualViewport;
204
+
205
+ var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
206
+ var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
207
+ var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
208
+ var width = clientRect.width / scaleX;
209
+ var height = clientRect.height / scaleY;
210
+ return {
211
+ width: width,
212
+ height: height,
213
+ top: y,
214
+ right: x + width,
215
+ bottom: y + height,
216
+ left: x,
217
+ x: x,
218
+ y: y
219
+ };
220
+ }
221
+
222
+ // means it doesn't take into account transforms.
223
+
224
+ function getLayoutRect(element) {
225
+ var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
226
+ // Fixes https://github.com/popperjs/popper-core/issues/1223
227
+
228
+ var width = element.offsetWidth;
229
+ var height = element.offsetHeight;
230
+
231
+ if (Math.abs(clientRect.width - width) <= 1) {
232
+ width = clientRect.width;
233
+ }
234
+
235
+ if (Math.abs(clientRect.height - height) <= 1) {
236
+ height = clientRect.height;
237
+ }
238
+
239
+ return {
240
+ x: element.offsetLeft,
241
+ y: element.offsetTop,
242
+ width: width,
243
+ height: height
244
+ };
245
+ }
246
+
247
+ function contains(parent, child) {
248
+ var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
249
+
250
+ if (parent.contains(child)) {
251
+ return true;
252
+ } // then fallback to custom implementation with Shadow DOM support
253
+ else if (rootNode && isShadowRoot(rootNode)) {
254
+ var next = child;
255
+
256
+ do {
257
+ if (next && parent.isSameNode(next)) {
258
+ return true;
259
+ } // $FlowFixMe[prop-missing]: need a better way to handle this...
260
+
261
+
262
+ next = next.parentNode || next.host;
263
+ } while (next);
264
+ } // Give up, the result is false
265
+
266
+
267
+ return false;
268
+ }
269
+
270
+ function getComputedStyle(element) {
271
+ return getWindow(element).getComputedStyle(element);
272
+ }
273
+
274
+ function isTableElement(element) {
275
+ return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
276
+ }
277
+
278
+ function getDocumentElement(element) {
279
+ // $FlowFixMe[incompatible-return]: assume body is always available
280
+ return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
281
+ element.document) || window.document).documentElement;
282
+ }
283
+
284
+ function getParentNode(element) {
285
+ if (getNodeName(element) === 'html') {
286
+ return element;
287
+ }
288
+
289
+ return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
290
+ // $FlowFixMe[incompatible-return]
291
+ // $FlowFixMe[prop-missing]
292
+ element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
293
+ element.parentNode || ( // DOM Element detected
294
+ isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
295
+ // $FlowFixMe[incompatible-call]: HTMLElement is a Node
296
+ getDocumentElement(element) // fallback
297
+
298
+ );
299
+ }
300
+
301
+ function getTrueOffsetParent(element) {
302
+ if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
303
+ getComputedStyle(element).position === 'fixed') {
304
+ return null;
305
+ }
306
+
307
+ return element.offsetParent;
308
+ } // `.offsetParent` reports `null` for fixed elements, while absolute elements
309
+ // return the containing block
310
+
311
+
312
+ function getContainingBlock(element) {
313
+ var isFirefox = /firefox/i.test(getUAString());
314
+ var isIE = /Trident/i.test(getUAString());
315
+
316
+ if (isIE && isHTMLElement(element)) {
317
+ // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
318
+ var elementCss = getComputedStyle(element);
319
+
320
+ if (elementCss.position === 'fixed') {
321
+ return null;
322
+ }
323
+ }
324
+
325
+ var currentNode = getParentNode(element);
326
+
327
+ if (isShadowRoot(currentNode)) {
328
+ currentNode = currentNode.host;
329
+ }
330
+
331
+ while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
332
+ var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
333
+ // create a containing block.
334
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
335
+
336
+ 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') {
337
+ return currentNode;
338
+ } else {
339
+ currentNode = currentNode.parentNode;
340
+ }
341
+ }
342
+
343
+ return null;
344
+ } // Gets the closest ancestor positioned element. Handles some edge cases,
345
+ // such as table ancestors and cross browser bugs.
346
+
347
+
348
+ function getOffsetParent(element) {
349
+ var window = getWindow(element);
350
+ var offsetParent = getTrueOffsetParent(element);
351
+
352
+ while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
353
+ offsetParent = getTrueOffsetParent(offsetParent);
354
+ }
355
+
356
+ if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {
357
+ return window;
358
+ }
359
+
360
+ return offsetParent || getContainingBlock(element) || window;
361
+ }
362
+
363
+ function getMainAxisFromPlacement(placement) {
364
+ return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
365
+ }
366
+
367
+ function within(min$1, value, max$1) {
368
+ return max(min$1, min(value, max$1));
369
+ }
370
+ function withinMaxClamp(min, value, max) {
371
+ var v = within(min, value, max);
372
+ return v > max ? max : v;
373
+ }
374
+
375
+ function getFreshSideObject() {
376
+ return {
377
+ top: 0,
378
+ right: 0,
379
+ bottom: 0,
380
+ left: 0
381
+ };
382
+ }
383
+
384
+ function mergePaddingObject(paddingObject) {
385
+ return Object.assign({}, getFreshSideObject(), paddingObject);
386
+ }
387
+
388
+ function expandToHashMap(value, keys) {
389
+ return keys.reduce(function (hashMap, key) {
390
+ hashMap[key] = value;
391
+ return hashMap;
392
+ }, {});
393
+ }
394
+
395
+ var toPaddingObject = function toPaddingObject(padding, state) {
396
+ padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {
397
+ placement: state.placement
398
+ })) : padding;
399
+ return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
400
+ };
401
+
402
+ function arrow(_ref) {
403
+ var _state$modifiersData$;
404
+
405
+ var state = _ref.state,
406
+ name = _ref.name,
407
+ options = _ref.options;
408
+ var arrowElement = state.elements.arrow;
409
+ var popperOffsets = state.modifiersData.popperOffsets;
410
+ var basePlacement = getBasePlacement(state.placement);
411
+ var axis = getMainAxisFromPlacement(basePlacement);
412
+ var isVertical = [left, right].indexOf(basePlacement) >= 0;
413
+ var len = isVertical ? 'height' : 'width';
414
+
415
+ if (!arrowElement || !popperOffsets) {
416
+ return;
417
+ }
418
+
419
+ var paddingObject = toPaddingObject(options.padding, state);
420
+ var arrowRect = getLayoutRect(arrowElement);
421
+ var minProp = axis === 'y' ? top : left;
422
+ var maxProp = axis === 'y' ? bottom : right;
423
+ var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];
424
+ var startDiff = popperOffsets[axis] - state.rects.reference[axis];
425
+ var arrowOffsetParent = getOffsetParent(arrowElement);
426
+ var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
427
+ var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is
428
+ // outside of the popper bounds
429
+
430
+ var min = paddingObject[minProp];
431
+ var max = clientSize - arrowRect[len] - paddingObject[maxProp];
432
+ var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
433
+ var offset = within(min, center, max); // Prevents breaking syntax highlighting...
434
+
435
+ var axisProp = axis;
436
+ state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);
437
+ }
438
+
439
+ function effect$1(_ref2) {
440
+ var state = _ref2.state,
441
+ options = _ref2.options;
442
+ var _options$element = options.element,
443
+ arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;
444
+
445
+ if (arrowElement == null) {
446
+ return;
447
+ } // CSS selector
448
+
449
+
450
+ if (typeof arrowElement === 'string') {
451
+ arrowElement = state.elements.popper.querySelector(arrowElement);
452
+
453
+ if (!arrowElement) {
454
+ return;
455
+ }
456
+ }
457
+
458
+ if (!contains(state.elements.popper, arrowElement)) {
459
+ return;
460
+ }
461
+
462
+ state.elements.arrow = arrowElement;
463
+ } // eslint-disable-next-line import/no-unused-modules
464
+
465
+
466
+ const arrow$1 = {
467
+ name: 'arrow',
468
+ enabled: true,
469
+ phase: 'main',
470
+ fn: arrow,
471
+ effect: effect$1,
472
+ requires: ['popperOffsets'],
473
+ requiresIfExists: ['preventOverflow']
474
+ };
475
+
476
+ function getVariation(placement) {
477
+ return placement.split('-')[1];
478
+ }
479
+
480
+ var unsetSides = {
481
+ top: 'auto',
482
+ right: 'auto',
483
+ bottom: 'auto',
484
+ left: 'auto'
485
+ }; // Round the offsets to the nearest suitable subpixel based on the DPR.
486
+ // Zooming can change the DPR, but it seems to report a value that will
487
+ // cleanly divide the values into the appropriate subpixels.
488
+
489
+ function roundOffsetsByDPR(_ref, win) {
490
+ var x = _ref.x,
491
+ y = _ref.y;
492
+ var dpr = win.devicePixelRatio || 1;
493
+ return {
494
+ x: round(x * dpr) / dpr || 0,
495
+ y: round(y * dpr) / dpr || 0
496
+ };
497
+ }
498
+
499
+ function mapToStyles(_ref2) {
500
+ var _Object$assign2;
501
+
502
+ var popper = _ref2.popper,
503
+ popperRect = _ref2.popperRect,
504
+ placement = _ref2.placement,
505
+ variation = _ref2.variation,
506
+ offsets = _ref2.offsets,
507
+ position = _ref2.position,
508
+ gpuAcceleration = _ref2.gpuAcceleration,
509
+ adaptive = _ref2.adaptive,
510
+ roundOffsets = _ref2.roundOffsets,
511
+ isFixed = _ref2.isFixed;
512
+ var _offsets$x = offsets.x,
513
+ x = _offsets$x === void 0 ? 0 : _offsets$x,
514
+ _offsets$y = offsets.y,
515
+ y = _offsets$y === void 0 ? 0 : _offsets$y;
516
+
517
+ var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({
518
+ x: x,
519
+ y: y
520
+ }) : {
521
+ x: x,
522
+ y: y
523
+ };
524
+
525
+ x = _ref3.x;
526
+ y = _ref3.y;
527
+ var hasX = offsets.hasOwnProperty('x');
528
+ var hasY = offsets.hasOwnProperty('y');
529
+ var sideX = left;
530
+ var sideY = top;
531
+ var win = window;
532
+
533
+ if (adaptive) {
534
+ var offsetParent = getOffsetParent(popper);
535
+ var heightProp = 'clientHeight';
536
+ var widthProp = 'clientWidth';
537
+
538
+ if (offsetParent === getWindow(popper)) {
539
+ offsetParent = getDocumentElement(popper);
540
+
541
+ if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {
542
+ heightProp = 'scrollHeight';
543
+ widthProp = 'scrollWidth';
544
+ }
545
+ } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
546
+
547
+
548
+ offsetParent = offsetParent;
549
+
550
+ if (placement === top || (placement === left || placement === right) && variation === end) {
551
+ sideY = bottom;
552
+ var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
553
+ offsetParent[heightProp];
554
+ y -= offsetY - popperRect.height;
555
+ y *= gpuAcceleration ? 1 : -1;
556
+ }
557
+
558
+ if (placement === left || (placement === top || placement === bottom) && variation === end) {
559
+ sideX = right;
560
+ var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
561
+ offsetParent[widthProp];
562
+ x -= offsetX - popperRect.width;
563
+ x *= gpuAcceleration ? 1 : -1;
564
+ }
565
+ }
566
+
567
+ var commonStyles = Object.assign({
568
+ position: position
569
+ }, adaptive && unsetSides);
570
+
571
+ var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
572
+ x: x,
573
+ y: y
574
+ }, getWindow(popper)) : {
575
+ x: x,
576
+ y: y
577
+ };
578
+
579
+ x = _ref4.x;
580
+ y = _ref4.y;
581
+
582
+ if (gpuAcceleration) {
583
+ var _Object$assign;
584
+
585
+ 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));
586
+ }
587
+
588
+ return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
589
+ }
590
+
591
+ function computeStyles(_ref5) {
592
+ var state = _ref5.state,
593
+ options = _ref5.options;
594
+ var _options$gpuAccelerat = options.gpuAcceleration,
595
+ gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
596
+ _options$adaptive = options.adaptive,
597
+ adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
598
+ _options$roundOffsets = options.roundOffsets,
599
+ roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
600
+ var commonStyles = {
601
+ placement: getBasePlacement(state.placement),
602
+ variation: getVariation(state.placement),
603
+ popper: state.elements.popper,
604
+ popperRect: state.rects.popper,
605
+ gpuAcceleration: gpuAcceleration,
606
+ isFixed: state.options.strategy === 'fixed'
607
+ };
608
+
609
+ if (state.modifiersData.popperOffsets != null) {
610
+ state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
611
+ offsets: state.modifiersData.popperOffsets,
612
+ position: state.options.strategy,
613
+ adaptive: adaptive,
614
+ roundOffsets: roundOffsets
615
+ })));
616
+ }
617
+
618
+ if (state.modifiersData.arrow != null) {
619
+ state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
620
+ offsets: state.modifiersData.arrow,
621
+ position: 'absolute',
622
+ adaptive: false,
623
+ roundOffsets: roundOffsets
624
+ })));
625
+ }
626
+
627
+ state.attributes.popper = Object.assign({}, state.attributes.popper, {
628
+ 'data-popper-placement': state.placement
629
+ });
630
+ } // eslint-disable-next-line import/no-unused-modules
631
+
632
+
633
+ const computeStyles$1 = {
634
+ name: 'computeStyles',
635
+ enabled: true,
636
+ phase: 'beforeWrite',
637
+ fn: computeStyles,
638
+ data: {}
639
+ };
640
+
641
+ var passive = {
642
+ passive: true
643
+ };
644
+
645
+ function effect(_ref) {
646
+ var state = _ref.state,
647
+ instance = _ref.instance,
648
+ options = _ref.options;
649
+ var _options$scroll = options.scroll,
650
+ scroll = _options$scroll === void 0 ? true : _options$scroll,
651
+ _options$resize = options.resize,
652
+ resize = _options$resize === void 0 ? true : _options$resize;
653
+ var window = getWindow(state.elements.popper);
654
+ var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
655
+
656
+ if (scroll) {
657
+ scrollParents.forEach(function (scrollParent) {
658
+ scrollParent.addEventListener('scroll', instance.update, passive);
659
+ });
660
+ }
661
+
662
+ if (resize) {
663
+ window.addEventListener('resize', instance.update, passive);
664
+ }
665
+
666
+ return function () {
667
+ if (scroll) {
668
+ scrollParents.forEach(function (scrollParent) {
669
+ scrollParent.removeEventListener('scroll', instance.update, passive);
670
+ });
671
+ }
672
+
673
+ if (resize) {
674
+ window.removeEventListener('resize', instance.update, passive);
675
+ }
676
+ };
677
+ } // eslint-disable-next-line import/no-unused-modules
678
+
679
+
680
+ const eventListeners = {
681
+ name: 'eventListeners',
682
+ enabled: true,
683
+ phase: 'write',
684
+ fn: function fn() {},
685
+ effect: effect,
686
+ data: {}
687
+ };
688
+
689
+ var hash$1 = {
690
+ left: 'right',
691
+ right: 'left',
692
+ bottom: 'top',
693
+ top: 'bottom'
694
+ };
695
+ function getOppositePlacement(placement) {
696
+ return placement.replace(/left|right|bottom|top/g, function (matched) {
697
+ return hash$1[matched];
698
+ });
699
+ }
700
+
701
+ var hash = {
702
+ start: 'end',
703
+ end: 'start'
704
+ };
705
+ function getOppositeVariationPlacement(placement) {
706
+ return placement.replace(/start|end/g, function (matched) {
707
+ return hash[matched];
708
+ });
709
+ }
710
+
711
+ function getWindowScroll(node) {
712
+ var win = getWindow(node);
713
+ var scrollLeft = win.pageXOffset;
714
+ var scrollTop = win.pageYOffset;
715
+ return {
716
+ scrollLeft: scrollLeft,
717
+ scrollTop: scrollTop
718
+ };
719
+ }
720
+
721
+ function getWindowScrollBarX(element) {
722
+ // If <html> has a CSS width greater than the viewport, then this will be
723
+ // incorrect for RTL.
724
+ // Popper 1 is broken in this case and never had a bug report so let's assume
725
+ // it's not an issue. I don't think anyone ever specifies width on <html>
726
+ // anyway.
727
+ // Browsers where the left scrollbar doesn't cause an issue report `0` for
728
+ // this (e.g. Edge 2019, IE11, Safari)
729
+ return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
730
+ }
731
+
732
+ function getViewportRect(element, strategy) {
733
+ var win = getWindow(element);
734
+ var html = getDocumentElement(element);
735
+ var visualViewport = win.visualViewport;
736
+ var width = html.clientWidth;
737
+ var height = html.clientHeight;
738
+ var x = 0;
739
+ var y = 0;
740
+
741
+ if (visualViewport) {
742
+ width = visualViewport.width;
743
+ height = visualViewport.height;
744
+ var layoutViewport = isLayoutViewport();
745
+
746
+ if (layoutViewport || !layoutViewport && strategy === 'fixed') {
747
+ x = visualViewport.offsetLeft;
748
+ y = visualViewport.offsetTop;
749
+ }
750
+ }
751
+
752
+ return {
753
+ width: width,
754
+ height: height,
755
+ x: x + getWindowScrollBarX(element),
756
+ y: y
757
+ };
758
+ }
759
+
760
+ // of the `<html>` and `<body>` rect bounds if horizontally scrollable
761
+
762
+ function getDocumentRect(element) {
763
+ var _element$ownerDocumen;
764
+
765
+ var html = getDocumentElement(element);
766
+ var winScroll = getWindowScroll(element);
767
+ var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
768
+ var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
769
+ var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
770
+ var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
771
+ var y = -winScroll.scrollTop;
772
+
773
+ if (getComputedStyle(body || html).direction === 'rtl') {
774
+ x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
775
+ }
776
+
777
+ return {
778
+ width: width,
779
+ height: height,
780
+ x: x,
781
+ y: y
782
+ };
783
+ }
784
+
785
+ function isScrollParent(element) {
786
+ // Firefox wants us to check `-x` and `-y` variations as well
787
+ var _getComputedStyle = getComputedStyle(element),
788
+ overflow = _getComputedStyle.overflow,
789
+ overflowX = _getComputedStyle.overflowX,
790
+ overflowY = _getComputedStyle.overflowY;
791
+
792
+ return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
793
+ }
794
+
795
+ function getScrollParent(node) {
796
+ if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
797
+ // $FlowFixMe[incompatible-return]: assume body is always available
798
+ return node.ownerDocument.body;
799
+ }
800
+
801
+ if (isHTMLElement(node) && isScrollParent(node)) {
802
+ return node;
803
+ }
804
+
805
+ return getScrollParent(getParentNode(node));
806
+ }
807
+
808
+ /*
809
+ given a DOM element, return the list of all scroll parents, up the list of ancesors
810
+ until we get to the top window object. This list is what we attach scroll listeners
811
+ to, because if any of these parent elements scroll, we'll need to re-calculate the
812
+ reference element's position.
813
+ */
814
+
815
+ function listScrollParents(element, list) {
816
+ var _element$ownerDocumen;
817
+
818
+ if (list === void 0) {
819
+ list = [];
820
+ }
821
+
822
+ var scrollParent = getScrollParent(element);
823
+ var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
824
+ var win = getWindow(scrollParent);
825
+ var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
826
+ var updatedList = list.concat(target);
827
+ return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
828
+ updatedList.concat(listScrollParents(getParentNode(target)));
829
+ }
830
+
831
+ function rectToClientRect(rect) {
832
+ return Object.assign({}, rect, {
833
+ left: rect.x,
834
+ top: rect.y,
835
+ right: rect.x + rect.width,
836
+ bottom: rect.y + rect.height
837
+ });
838
+ }
839
+
840
+ function getInnerBoundingClientRect(element, strategy) {
841
+ var rect = getBoundingClientRect(element, false, strategy === 'fixed');
842
+ rect.top = rect.top + element.clientTop;
843
+ rect.left = rect.left + element.clientLeft;
844
+ rect.bottom = rect.top + element.clientHeight;
845
+ rect.right = rect.left + element.clientWidth;
846
+ rect.width = element.clientWidth;
847
+ rect.height = element.clientHeight;
848
+ rect.x = rect.left;
849
+ rect.y = rect.top;
850
+ return rect;
851
+ }
852
+
853
+ function getClientRectFromMixedType(element, clippingParent, strategy) {
854
+ return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
855
+ } // A "clipping parent" is an overflowable container with the characteristic of
856
+ // clipping (or hiding) overflowing elements with a position different from
857
+ // `initial`
858
+
859
+
860
+ function getClippingParents(element) {
861
+ var clippingParents = listScrollParents(getParentNode(element));
862
+ var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;
863
+ var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
864
+
865
+ if (!isElement(clipperElement)) {
866
+ return [];
867
+ } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
868
+
869
+
870
+ return clippingParents.filter(function (clippingParent) {
871
+ return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
872
+ });
873
+ } // Gets the maximum area that the element is visible in due to any number of
874
+ // clipping parents
875
+
876
+
877
+ function getClippingRect(element, boundary, rootBoundary, strategy) {
878
+ var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
879
+ var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
880
+ var firstClippingParent = clippingParents[0];
881
+ var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
882
+ var rect = getClientRectFromMixedType(element, clippingParent, strategy);
883
+ accRect.top = max(rect.top, accRect.top);
884
+ accRect.right = min(rect.right, accRect.right);
885
+ accRect.bottom = min(rect.bottom, accRect.bottom);
886
+ accRect.left = max(rect.left, accRect.left);
887
+ return accRect;
888
+ }, getClientRectFromMixedType(element, firstClippingParent, strategy));
889
+ clippingRect.width = clippingRect.right - clippingRect.left;
890
+ clippingRect.height = clippingRect.bottom - clippingRect.top;
891
+ clippingRect.x = clippingRect.left;
892
+ clippingRect.y = clippingRect.top;
893
+ return clippingRect;
894
+ }
895
+
896
+ function computeOffsets(_ref) {
897
+ var reference = _ref.reference,
898
+ element = _ref.element,
899
+ placement = _ref.placement;
900
+ var basePlacement = placement ? getBasePlacement(placement) : null;
901
+ var variation = placement ? getVariation(placement) : null;
902
+ var commonX = reference.x + reference.width / 2 - element.width / 2;
903
+ var commonY = reference.y + reference.height / 2 - element.height / 2;
904
+ var offsets;
905
+
906
+ switch (basePlacement) {
907
+ case top:
908
+ offsets = {
909
+ x: commonX,
910
+ y: reference.y - element.height
911
+ };
912
+ break;
913
+
914
+ case bottom:
915
+ offsets = {
916
+ x: commonX,
917
+ y: reference.y + reference.height
918
+ };
919
+ break;
920
+
921
+ case right:
922
+ offsets = {
923
+ x: reference.x + reference.width,
924
+ y: commonY
925
+ };
926
+ break;
927
+
928
+ case left:
929
+ offsets = {
930
+ x: reference.x - element.width,
931
+ y: commonY
932
+ };
933
+ break;
934
+
935
+ default:
936
+ offsets = {
937
+ x: reference.x,
938
+ y: reference.y
939
+ };
940
+ }
941
+
942
+ var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
943
+
944
+ if (mainAxis != null) {
945
+ var len = mainAxis === 'y' ? 'height' : 'width';
946
+
947
+ switch (variation) {
948
+ case start:
949
+ offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
950
+ break;
951
+
952
+ case end:
953
+ offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
954
+ break;
955
+ }
956
+ }
957
+
958
+ return offsets;
959
+ }
960
+
961
+ function detectOverflow(state, options) {
962
+ if (options === void 0) {
963
+ options = {};
964
+ }
965
+
966
+ var _options = options,
967
+ _options$placement = _options.placement,
968
+ placement = _options$placement === void 0 ? state.placement : _options$placement,
969
+ _options$strategy = _options.strategy,
970
+ strategy = _options$strategy === void 0 ? state.strategy : _options$strategy,
971
+ _options$boundary = _options.boundary,
972
+ boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
973
+ _options$rootBoundary = _options.rootBoundary,
974
+ rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,
975
+ _options$elementConte = _options.elementContext,
976
+ elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,
977
+ _options$altBoundary = _options.altBoundary,
978
+ altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,
979
+ _options$padding = _options.padding,
980
+ padding = _options$padding === void 0 ? 0 : _options$padding;
981
+ var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
982
+ var altContext = elementContext === popper ? reference : popper;
983
+ var popperRect = state.rects.popper;
984
+ var element = state.elements[altBoundary ? altContext : elementContext];
985
+ var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
986
+ var referenceClientRect = getBoundingClientRect(state.elements.reference);
987
+ var popperOffsets = computeOffsets({
988
+ reference: referenceClientRect,
989
+ element: popperRect,
990
+ strategy: 'absolute',
991
+ placement: placement
992
+ });
993
+ var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
994
+ var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
995
+ // 0 or negative = within the clipping rect
996
+
997
+ var overflowOffsets = {
998
+ top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
999
+ bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
1000
+ left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
1001
+ right: elementClientRect.right - clippingClientRect.right + paddingObject.right
1002
+ };
1003
+ var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element
1004
+
1005
+ if (elementContext === popper && offsetData) {
1006
+ var offset = offsetData[placement];
1007
+ Object.keys(overflowOffsets).forEach(function (key) {
1008
+ var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
1009
+ var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';
1010
+ overflowOffsets[key] += offset[axis] * multiply;
1011
+ });
1012
+ }
1013
+
1014
+ return overflowOffsets;
1015
+ }
1016
+
1017
+ function computeAutoPlacement(state, options) {
1018
+ if (options === void 0) {
1019
+ options = {};
1020
+ }
1021
+
1022
+ var _options = options,
1023
+ placement = _options.placement,
1024
+ boundary = _options.boundary,
1025
+ rootBoundary = _options.rootBoundary,
1026
+ padding = _options.padding,
1027
+ flipVariations = _options.flipVariations,
1028
+ _options$allowedAutoP = _options.allowedAutoPlacements,
1029
+ allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
1030
+ var variation = getVariation(placement);
1031
+ var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {
1032
+ return getVariation(placement) === variation;
1033
+ }) : basePlacements;
1034
+ var allowedPlacements = placements$1.filter(function (placement) {
1035
+ return allowedAutoPlacements.indexOf(placement) >= 0;
1036
+ });
1037
+
1038
+ if (allowedPlacements.length === 0) {
1039
+ allowedPlacements = placements$1;
1040
+ } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...
1041
+
1042
+
1043
+ var overflows = allowedPlacements.reduce(function (acc, placement) {
1044
+ acc[placement] = detectOverflow(state, {
1045
+ placement: placement,
1046
+ boundary: boundary,
1047
+ rootBoundary: rootBoundary,
1048
+ padding: padding
1049
+ })[getBasePlacement(placement)];
1050
+ return acc;
1051
+ }, {});
1052
+ return Object.keys(overflows).sort(function (a, b) {
1053
+ return overflows[a] - overflows[b];
1054
+ });
1055
+ }
1056
+
1057
+ function getExpandedFallbackPlacements(placement) {
1058
+ if (getBasePlacement(placement) === auto) {
1059
+ return [];
1060
+ }
1061
+
1062
+ var oppositePlacement = getOppositePlacement(placement);
1063
+ return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
1064
+ }
1065
+
1066
+ function flip(_ref) {
1067
+ var state = _ref.state,
1068
+ options = _ref.options,
1069
+ name = _ref.name;
1070
+
1071
+ if (state.modifiersData[name]._skip) {
1072
+ return;
1073
+ }
1074
+
1075
+ var _options$mainAxis = options.mainAxis,
1076
+ checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
1077
+ _options$altAxis = options.altAxis,
1078
+ checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,
1079
+ specifiedFallbackPlacements = options.fallbackPlacements,
1080
+ padding = options.padding,
1081
+ boundary = options.boundary,
1082
+ rootBoundary = options.rootBoundary,
1083
+ altBoundary = options.altBoundary,
1084
+ _options$flipVariatio = options.flipVariations,
1085
+ flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,
1086
+ allowedAutoPlacements = options.allowedAutoPlacements;
1087
+ var preferredPlacement = state.options.placement;
1088
+ var basePlacement = getBasePlacement(preferredPlacement);
1089
+ var isBasePlacement = basePlacement === preferredPlacement;
1090
+ var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
1091
+ var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {
1092
+ return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {
1093
+ placement: placement,
1094
+ boundary: boundary,
1095
+ rootBoundary: rootBoundary,
1096
+ padding: padding,
1097
+ flipVariations: flipVariations,
1098
+ allowedAutoPlacements: allowedAutoPlacements
1099
+ }) : placement);
1100
+ }, []);
1101
+ var referenceRect = state.rects.reference;
1102
+ var popperRect = state.rects.popper;
1103
+ var checksMap = new Map();
1104
+ var makeFallbackChecks = true;
1105
+ var firstFittingPlacement = placements[0];
1106
+
1107
+ for (var i = 0; i < placements.length; i++) {
1108
+ var placement = placements[i];
1109
+
1110
+ var _basePlacement = getBasePlacement(placement);
1111
+
1112
+ var isStartVariation = getVariation(placement) === start;
1113
+ var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
1114
+ var len = isVertical ? 'width' : 'height';
1115
+ var overflow = detectOverflow(state, {
1116
+ placement: placement,
1117
+ boundary: boundary,
1118
+ rootBoundary: rootBoundary,
1119
+ altBoundary: altBoundary,
1120
+ padding: padding
1121
+ });
1122
+ var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
1123
+
1124
+ if (referenceRect[len] > popperRect[len]) {
1125
+ mainVariationSide = getOppositePlacement(mainVariationSide);
1126
+ }
1127
+
1128
+ var altVariationSide = getOppositePlacement(mainVariationSide);
1129
+ var checks = [];
1130
+
1131
+ if (checkMainAxis) {
1132
+ checks.push(overflow[_basePlacement] <= 0);
1133
+ }
1134
+
1135
+ if (checkAltAxis) {
1136
+ checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
1137
+ }
1138
+
1139
+ if (checks.every(function (check) {
1140
+ return check;
1141
+ })) {
1142
+ firstFittingPlacement = placement;
1143
+ makeFallbackChecks = false;
1144
+ break;
1145
+ }
1146
+
1147
+ checksMap.set(placement, checks);
1148
+ }
1149
+
1150
+ if (makeFallbackChecks) {
1151
+ // `2` may be desired in some cases – research later
1152
+ var numberOfChecks = flipVariations ? 3 : 1;
1153
+
1154
+ var _loop = function _loop(_i) {
1155
+ var fittingPlacement = placements.find(function (placement) {
1156
+ var checks = checksMap.get(placement);
1157
+
1158
+ if (checks) {
1159
+ return checks.slice(0, _i).every(function (check) {
1160
+ return check;
1161
+ });
1162
+ }
1163
+ });
1164
+
1165
+ if (fittingPlacement) {
1166
+ firstFittingPlacement = fittingPlacement;
1167
+ return "break";
1168
+ }
1169
+ };
1170
+
1171
+ for (var _i = numberOfChecks; _i > 0; _i--) {
1172
+ var _ret = _loop(_i);
1173
+
1174
+ if (_ret === "break") break;
1175
+ }
1176
+ }
1177
+
1178
+ if (state.placement !== firstFittingPlacement) {
1179
+ state.modifiersData[name]._skip = true;
1180
+ state.placement = firstFittingPlacement;
1181
+ state.reset = true;
1182
+ }
1183
+ } // eslint-disable-next-line import/no-unused-modules
1184
+
1185
+
1186
+ const flip$1 = {
1187
+ name: 'flip',
1188
+ enabled: true,
1189
+ phase: 'main',
1190
+ fn: flip,
1191
+ requiresIfExists: ['offset'],
1192
+ data: {
1193
+ _skip: false
1194
+ }
1195
+ };
1196
+
1197
+ function getSideOffsets(overflow, rect, preventedOffsets) {
1198
+ if (preventedOffsets === void 0) {
1199
+ preventedOffsets = {
1200
+ x: 0,
1201
+ y: 0
1202
+ };
1203
+ }
1204
+
1205
+ return {
1206
+ top: overflow.top - rect.height - preventedOffsets.y,
1207
+ right: overflow.right - rect.width + preventedOffsets.x,
1208
+ bottom: overflow.bottom - rect.height + preventedOffsets.y,
1209
+ left: overflow.left - rect.width - preventedOffsets.x
1210
+ };
1211
+ }
1212
+
1213
+ function isAnySideFullyClipped(overflow) {
1214
+ return [top, right, bottom, left].some(function (side) {
1215
+ return overflow[side] >= 0;
1216
+ });
1217
+ }
1218
+
1219
+ function hide(_ref) {
1220
+ var state = _ref.state,
1221
+ name = _ref.name;
1222
+ var referenceRect = state.rects.reference;
1223
+ var popperRect = state.rects.popper;
1224
+ var preventedOffsets = state.modifiersData.preventOverflow;
1225
+ var referenceOverflow = detectOverflow(state, {
1226
+ elementContext: 'reference'
1227
+ });
1228
+ var popperAltOverflow = detectOverflow(state, {
1229
+ altBoundary: true
1230
+ });
1231
+ var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
1232
+ var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
1233
+ var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
1234
+ var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
1235
+ state.modifiersData[name] = {
1236
+ referenceClippingOffsets: referenceClippingOffsets,
1237
+ popperEscapeOffsets: popperEscapeOffsets,
1238
+ isReferenceHidden: isReferenceHidden,
1239
+ hasPopperEscaped: hasPopperEscaped
1240
+ };
1241
+ state.attributes.popper = Object.assign({}, state.attributes.popper, {
1242
+ 'data-popper-reference-hidden': isReferenceHidden,
1243
+ 'data-popper-escaped': hasPopperEscaped
1244
+ });
1245
+ } // eslint-disable-next-line import/no-unused-modules
1246
+
1247
+
1248
+ const hide$1 = {
1249
+ name: 'hide',
1250
+ enabled: true,
1251
+ phase: 'main',
1252
+ requiresIfExists: ['preventOverflow'],
1253
+ fn: hide
1254
+ };
1255
+
1256
+ function distanceAndSkiddingToXY(placement, rects, offset) {
1257
+ var basePlacement = getBasePlacement(placement);
1258
+ var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
1259
+
1260
+ var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {
1261
+ placement: placement
1262
+ })) : offset,
1263
+ skidding = _ref[0],
1264
+ distance = _ref[1];
1265
+
1266
+ skidding = skidding || 0;
1267
+ distance = (distance || 0) * invertDistance;
1268
+ return [left, right].indexOf(basePlacement) >= 0 ? {
1269
+ x: distance,
1270
+ y: skidding
1271
+ } : {
1272
+ x: skidding,
1273
+ y: distance
1274
+ };
1275
+ }
1276
+
1277
+ function offset(_ref2) {
1278
+ var state = _ref2.state,
1279
+ options = _ref2.options,
1280
+ name = _ref2.name;
1281
+ var _options$offset = options.offset,
1282
+ offset = _options$offset === void 0 ? [0, 0] : _options$offset;
1283
+ var data = placements.reduce(function (acc, placement) {
1284
+ acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);
1285
+ return acc;
1286
+ }, {});
1287
+ var _data$state$placement = data[state.placement],
1288
+ x = _data$state$placement.x,
1289
+ y = _data$state$placement.y;
1290
+
1291
+ if (state.modifiersData.popperOffsets != null) {
1292
+ state.modifiersData.popperOffsets.x += x;
1293
+ state.modifiersData.popperOffsets.y += y;
1294
+ }
1295
+
1296
+ state.modifiersData[name] = data;
1297
+ } // eslint-disable-next-line import/no-unused-modules
1298
+
1299
+
1300
+ const offset$1 = {
1301
+ name: 'offset',
1302
+ enabled: true,
1303
+ phase: 'main',
1304
+ requires: ['popperOffsets'],
1305
+ fn: offset
1306
+ };
1307
+
1308
+ function popperOffsets(_ref) {
1309
+ var state = _ref.state,
1310
+ name = _ref.name;
1311
+ // Offsets are the actual position the popper needs to have to be
1312
+ // properly positioned near its reference element
1313
+ // This is the most basic placement, and will be adjusted by
1314
+ // the modifiers in the next step
1315
+ state.modifiersData[name] = computeOffsets({
1316
+ reference: state.rects.reference,
1317
+ element: state.rects.popper,
1318
+ strategy: 'absolute',
1319
+ placement: state.placement
1320
+ });
1321
+ } // eslint-disable-next-line import/no-unused-modules
1322
+
1323
+
1324
+ const popperOffsets$1 = {
1325
+ name: 'popperOffsets',
1326
+ enabled: true,
1327
+ phase: 'read',
1328
+ fn: popperOffsets,
1329
+ data: {}
1330
+ };
1331
+
1332
+ function getAltAxis(axis) {
1333
+ return axis === 'x' ? 'y' : 'x';
1334
+ }
1335
+
1336
+ function preventOverflow(_ref) {
1337
+ var state = _ref.state,
1338
+ options = _ref.options,
1339
+ name = _ref.name;
1340
+ var _options$mainAxis = options.mainAxis,
1341
+ checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
1342
+ _options$altAxis = options.altAxis,
1343
+ checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,
1344
+ boundary = options.boundary,
1345
+ rootBoundary = options.rootBoundary,
1346
+ altBoundary = options.altBoundary,
1347
+ padding = options.padding,
1348
+ _options$tether = options.tether,
1349
+ tether = _options$tether === void 0 ? true : _options$tether,
1350
+ _options$tetherOffset = options.tetherOffset,
1351
+ tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
1352
+ var overflow = detectOverflow(state, {
1353
+ boundary: boundary,
1354
+ rootBoundary: rootBoundary,
1355
+ padding: padding,
1356
+ altBoundary: altBoundary
1357
+ });
1358
+ var basePlacement = getBasePlacement(state.placement);
1359
+ var variation = getVariation(state.placement);
1360
+ var isBasePlacement = !variation;
1361
+ var mainAxis = getMainAxisFromPlacement(basePlacement);
1362
+ var altAxis = getAltAxis(mainAxis);
1363
+ var popperOffsets = state.modifiersData.popperOffsets;
1364
+ var referenceRect = state.rects.reference;
1365
+ var popperRect = state.rects.popper;
1366
+ var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
1367
+ placement: state.placement
1368
+ })) : tetherOffset;
1369
+ var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {
1370
+ mainAxis: tetherOffsetValue,
1371
+ altAxis: tetherOffsetValue
1372
+ } : Object.assign({
1373
+ mainAxis: 0,
1374
+ altAxis: 0
1375
+ }, tetherOffsetValue);
1376
+ var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
1377
+ var data = {
1378
+ x: 0,
1379
+ y: 0
1380
+ };
1381
+
1382
+ if (!popperOffsets) {
1383
+ return;
1384
+ }
1385
+
1386
+ if (checkMainAxis) {
1387
+ var _offsetModifierState$;
1388
+
1389
+ var mainSide = mainAxis === 'y' ? top : left;
1390
+ var altSide = mainAxis === 'y' ? bottom : right;
1391
+ var len = mainAxis === 'y' ? 'height' : 'width';
1392
+ var offset = popperOffsets[mainAxis];
1393
+ var min$1 = offset + overflow[mainSide];
1394
+ var max$1 = offset - overflow[altSide];
1395
+ var additive = tether ? -popperRect[len] / 2 : 0;
1396
+ var minLen = variation === start ? referenceRect[len] : popperRect[len];
1397
+ var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
1398
+ // outside the reference bounds
1399
+
1400
+ var arrowElement = state.elements.arrow;
1401
+ var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
1402
+ width: 0,
1403
+ height: 0
1404
+ };
1405
+ var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();
1406
+ var arrowPaddingMin = arrowPaddingObject[mainSide];
1407
+ var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want
1408
+ // to include its full size in the calculation. If the reference is small
1409
+ // and near the edge of a boundary, the popper can overflow even if the
1410
+ // reference is not overflowing as well (e.g. virtual elements with no
1411
+ // width or height)
1412
+
1413
+ var arrowLen = within(0, referenceRect[len], arrowRect[len]);
1414
+ var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
1415
+ var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
1416
+ var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
1417
+ var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
1418
+ var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
1419
+ var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;
1420
+ var tetherMax = offset + maxOffset - offsetModifierValue;
1421
+ var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
1422
+ popperOffsets[mainAxis] = preventedOffset;
1423
+ data[mainAxis] = preventedOffset - offset;
1424
+ }
1425
+
1426
+ if (checkAltAxis) {
1427
+ var _offsetModifierState$2;
1428
+
1429
+ var _mainSide = mainAxis === 'x' ? top : left;
1430
+
1431
+ var _altSide = mainAxis === 'x' ? bottom : right;
1432
+
1433
+ var _offset = popperOffsets[altAxis];
1434
+
1435
+ var _len = altAxis === 'y' ? 'height' : 'width';
1436
+
1437
+ var _min = _offset + overflow[_mainSide];
1438
+
1439
+ var _max = _offset - overflow[_altSide];
1440
+
1441
+ var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
1442
+
1443
+ var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
1444
+
1445
+ var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
1446
+
1447
+ var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
1448
+
1449
+ var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
1450
+
1451
+ popperOffsets[altAxis] = _preventedOffset;
1452
+ data[altAxis] = _preventedOffset - _offset;
1453
+ }
1454
+
1455
+ state.modifiersData[name] = data;
1456
+ } // eslint-disable-next-line import/no-unused-modules
1457
+
1458
+
1459
+ const preventOverflow$1 = {
1460
+ name: 'preventOverflow',
1461
+ enabled: true,
1462
+ phase: 'main',
1463
+ fn: preventOverflow,
1464
+ requiresIfExists: ['offset']
1465
+ };
1466
+
1467
+ function getHTMLElementScroll(element) {
1468
+ return {
1469
+ scrollLeft: element.scrollLeft,
1470
+ scrollTop: element.scrollTop
1471
+ };
1472
+ }
1473
+
1474
+ function getNodeScroll(node) {
1475
+ if (node === getWindow(node) || !isHTMLElement(node)) {
1476
+ return getWindowScroll(node);
1477
+ } else {
1478
+ return getHTMLElementScroll(node);
1479
+ }
1480
+ }
1481
+
1482
+ function isElementScaled(element) {
1483
+ var rect = element.getBoundingClientRect();
1484
+ var scaleX = round(rect.width) / element.offsetWidth || 1;
1485
+ var scaleY = round(rect.height) / element.offsetHeight || 1;
1486
+ return scaleX !== 1 || scaleY !== 1;
1487
+ } // Returns the composite rect of an element relative to its offsetParent.
1488
+ // Composite means it takes into account transforms as well as layout.
1489
+
1490
+
1491
+ function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
1492
+ if (isFixed === void 0) {
1493
+ isFixed = false;
1494
+ }
1495
+
1496
+ var isOffsetParentAnElement = isHTMLElement(offsetParent);
1497
+ var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
1498
+ var documentElement = getDocumentElement(offsetParent);
1499
+ var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
1500
+ var scroll = {
1501
+ scrollLeft: 0,
1502
+ scrollTop: 0
1503
+ };
1504
+ var offsets = {
1505
+ x: 0,
1506
+ y: 0
1507
+ };
1508
+
1509
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1510
+ if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
1511
+ isScrollParent(documentElement)) {
1512
+ scroll = getNodeScroll(offsetParent);
1513
+ }
1514
+
1515
+ if (isHTMLElement(offsetParent)) {
1516
+ offsets = getBoundingClientRect(offsetParent, true);
1517
+ offsets.x += offsetParent.clientLeft;
1518
+ offsets.y += offsetParent.clientTop;
1519
+ } else if (documentElement) {
1520
+ offsets.x = getWindowScrollBarX(documentElement);
1521
+ }
1522
+ }
1523
+
1524
+ return {
1525
+ x: rect.left + scroll.scrollLeft - offsets.x,
1526
+ y: rect.top + scroll.scrollTop - offsets.y,
1527
+ width: rect.width,
1528
+ height: rect.height
1529
+ };
1530
+ }
1531
+
1532
+ function order(modifiers) {
1533
+ var map = new Map();
1534
+ var visited = new Set();
1535
+ var result = [];
1536
+ modifiers.forEach(function (modifier) {
1537
+ map.set(modifier.name, modifier);
1538
+ }); // On visiting object, check for its dependencies and visit them recursively
1539
+
1540
+ function sort(modifier) {
1541
+ visited.add(modifier.name);
1542
+ var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
1543
+ requires.forEach(function (dep) {
1544
+ if (!visited.has(dep)) {
1545
+ var depModifier = map.get(dep);
1546
+
1547
+ if (depModifier) {
1548
+ sort(depModifier);
1549
+ }
1550
+ }
1551
+ });
1552
+ result.push(modifier);
1553
+ }
1554
+
1555
+ modifiers.forEach(function (modifier) {
1556
+ if (!visited.has(modifier.name)) {
1557
+ // check for visited object
1558
+ sort(modifier);
1559
+ }
1560
+ });
1561
+ return result;
1562
+ }
1563
+
1564
+ function orderModifiers(modifiers) {
1565
+ // order based on dependencies
1566
+ var orderedModifiers = order(modifiers); // order based on phase
1567
+
1568
+ return modifierPhases.reduce(function (acc, phase) {
1569
+ return acc.concat(orderedModifiers.filter(function (modifier) {
1570
+ return modifier.phase === phase;
1571
+ }));
1572
+ }, []);
1573
+ }
1574
+
1575
+ function debounce(fn) {
1576
+ var pending;
1577
+ return function () {
1578
+ if (!pending) {
1579
+ pending = new Promise(function (resolve) {
1580
+ Promise.resolve().then(function () {
1581
+ pending = undefined;
1582
+ resolve(fn());
1583
+ });
1584
+ });
1585
+ }
1586
+
1587
+ return pending;
1588
+ };
1589
+ }
1590
+
1591
+ function mergeByName(modifiers) {
1592
+ var merged = modifiers.reduce(function (merged, current) {
1593
+ var existing = merged[current.name];
1594
+ merged[current.name] = existing ? Object.assign({}, existing, current, {
1595
+ options: Object.assign({}, existing.options, current.options),
1596
+ data: Object.assign({}, existing.data, current.data)
1597
+ }) : current;
1598
+ return merged;
1599
+ }, {}); // IE11 does not support Object.values
1600
+
1601
+ return Object.keys(merged).map(function (key) {
1602
+ return merged[key];
1603
+ });
1604
+ }
1605
+
1606
+ var DEFAULT_OPTIONS = {
1607
+ placement: 'bottom',
1608
+ modifiers: [],
1609
+ strategy: 'absolute'
1610
+ };
1611
+
1612
+ function areValidElements() {
1613
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1614
+ args[_key] = arguments[_key];
1615
+ }
1616
+
1617
+ return !args.some(function (element) {
1618
+ return !(element && typeof element.getBoundingClientRect === 'function');
1619
+ });
1620
+ }
1621
+
1622
+ function popperGenerator(generatorOptions) {
1623
+ if (generatorOptions === void 0) {
1624
+ generatorOptions = {};
1625
+ }
1626
+
1627
+ var _generatorOptions = generatorOptions,
1628
+ _generatorOptions$def = _generatorOptions.defaultModifiers,
1629
+ defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,
1630
+ _generatorOptions$def2 = _generatorOptions.defaultOptions,
1631
+ defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
1632
+ return function createPopper(reference, popper, options) {
1633
+ if (options === void 0) {
1634
+ options = defaultOptions;
1635
+ }
1636
+
1637
+ var state = {
1638
+ placement: 'bottom',
1639
+ orderedModifiers: [],
1640
+ options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
1641
+ modifiersData: {},
1642
+ elements: {
1643
+ reference: reference,
1644
+ popper: popper
1645
+ },
1646
+ attributes: {},
1647
+ styles: {}
1648
+ };
1649
+ var effectCleanupFns = [];
1650
+ var isDestroyed = false;
1651
+ var instance = {
1652
+ state: state,
1653
+ setOptions: function setOptions(setOptionsAction) {
1654
+ var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
1655
+ cleanupModifierEffects();
1656
+ state.options = Object.assign({}, defaultOptions, state.options, options);
1657
+ state.scrollParents = {
1658
+ reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
1659
+ popper: listScrollParents(popper)
1660
+ }; // Orders the modifiers based on their dependencies and `phase`
1661
+ // properties
1662
+
1663
+ var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers
1664
+
1665
+ state.orderedModifiers = orderedModifiers.filter(function (m) {
1666
+ return m.enabled;
1667
+ });
1668
+ runModifierEffects();
1669
+ return instance.update();
1670
+ },
1671
+ // Sync update – it will always be executed, even if not necessary. This
1672
+ // is useful for low frequency updates where sync behavior simplifies the
1673
+ // logic.
1674
+ // For high frequency updates (e.g. `resize` and `scroll` events), always
1675
+ // prefer the async Popper#update method
1676
+ forceUpdate: function forceUpdate() {
1677
+ if (isDestroyed) {
1678
+ return;
1679
+ }
1680
+
1681
+ var _state$elements = state.elements,
1682
+ reference = _state$elements.reference,
1683
+ popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements
1684
+ // anymore
1685
+
1686
+ if (!areValidElements(reference, popper)) {
1687
+ return;
1688
+ } // Store the reference and popper rects to be read by modifiers
1689
+
1690
+
1691
+ state.rects = {
1692
+ reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
1693
+ popper: getLayoutRect(popper)
1694
+ }; // Modifiers have the ability to reset the current update cycle. The
1695
+ // most common use case for this is the `flip` modifier changing the
1696
+ // placement, which then needs to re-run all the modifiers, because the
1697
+ // logic was previously ran for the previous placement and is therefore
1698
+ // stale/incorrect
1699
+
1700
+ state.reset = false;
1701
+ state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier
1702
+ // is filled with the initial data specified by the modifier. This means
1703
+ // it doesn't persist and is fresh on each update.
1704
+ // To ensure persistent data, use `${name}#persistent`
1705
+
1706
+ state.orderedModifiers.forEach(function (modifier) {
1707
+ return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
1708
+ });
1709
+
1710
+ for (var index = 0; index < state.orderedModifiers.length; index++) {
1711
+ if (state.reset === true) {
1712
+ state.reset = false;
1713
+ index = -1;
1714
+ continue;
1715
+ }
1716
+
1717
+ var _state$orderedModifie = state.orderedModifiers[index],
1718
+ fn = _state$orderedModifie.fn,
1719
+ _state$orderedModifie2 = _state$orderedModifie.options,
1720
+ _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
1721
+ name = _state$orderedModifie.name;
1722
+
1723
+ if (typeof fn === 'function') {
1724
+ state = fn({
1725
+ state: state,
1726
+ options: _options,
1727
+ name: name,
1728
+ instance: instance
1729
+ }) || state;
1730
+ }
1731
+ }
1732
+ },
1733
+ // Async and optimistically optimized update – it will not be executed if
1734
+ // not necessary (debounced to run at most once-per-tick)
1735
+ update: debounce(function () {
1736
+ return new Promise(function (resolve) {
1737
+ instance.forceUpdate();
1738
+ resolve(state);
1739
+ });
1740
+ }),
1741
+ destroy: function destroy() {
1742
+ cleanupModifierEffects();
1743
+ isDestroyed = true;
1744
+ }
1745
+ };
1746
+
1747
+ if (!areValidElements(reference, popper)) {
1748
+ return instance;
1749
+ }
1750
+
1751
+ instance.setOptions(options).then(function (state) {
1752
+ if (!isDestroyed && options.onFirstUpdate) {
1753
+ options.onFirstUpdate(state);
1754
+ }
1755
+ }); // Modifiers have the ability to execute arbitrary code before the first
1756
+ // update cycle runs. They will be executed in the same order as the update
1757
+ // cycle. This is useful when a modifier adds some persistent data that
1758
+ // other modifiers need to use, but the modifier is run after the dependent
1759
+ // one.
1760
+
1761
+ function runModifierEffects() {
1762
+ state.orderedModifiers.forEach(function (_ref) {
1763
+ var name = _ref.name,
1764
+ _ref$options = _ref.options,
1765
+ options = _ref$options === void 0 ? {} : _ref$options,
1766
+ effect = _ref.effect;
1767
+
1768
+ if (typeof effect === 'function') {
1769
+ var cleanupFn = effect({
1770
+ state: state,
1771
+ name: name,
1772
+ instance: instance,
1773
+ options: options
1774
+ });
1775
+
1776
+ var noopFn = function noopFn() {};
1777
+
1778
+ effectCleanupFns.push(cleanupFn || noopFn);
1779
+ }
1780
+ });
1781
+ }
1782
+
1783
+ function cleanupModifierEffects() {
1784
+ effectCleanupFns.forEach(function (fn) {
1785
+ return fn();
1786
+ });
1787
+ effectCleanupFns = [];
1788
+ }
1789
+
1790
+ return instance;
1791
+ };
1792
+ }
1793
+
1794
+ var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
1795
+ var createPopper = /*#__PURE__*/popperGenerator({
1796
+ defaultModifiers: defaultModifiers
1797
+ }); // eslint-disable-next-line import/no-unused-modules
1798
+
1799
+ const Check = `<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
1800
+ <path d="M8.79502 15.875L4.62502 11.705L3.20502 13.115L8.79502 18.705L20.795 6.70501L19.385 5.29501L8.79502 15.875Z" fill="currentColor"/>
1801
+ </svg>
1802
+ `;
1803
+
1804
+ const icMenuCss = "html.sc-ic-menu-with-multi{line-height:1.15;-webkit-text-size-adjust:100%}body.sc-ic-menu-with-multi{margin:0}main.sc-ic-menu-with-multi{display:block}h1.sc-ic-menu-with-multi{font-size:2em;margin:0.67em 0}hr.sc-ic-menu-with-multi{box-sizing:content-box;height:0;overflow:visible}pre.sc-ic-menu-with-multi{font-family:monospace, monospace;font-size:1em}a.sc-ic-menu-with-multi{background-color:transparent}abbr[title].sc-ic-menu-with-multi{border-bottom:none;text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}b.sc-ic-menu-with-multi,strong.sc-ic-menu-with-multi{font-weight:bolder}code.sc-ic-menu-with-multi,kbd.sc-ic-menu-with-multi,samp.sc-ic-menu-with-multi{font-family:monospace, monospace;font-size:1em}small.sc-ic-menu-with-multi{font-size:80%}sub.sc-ic-menu-with-multi,sup.sc-ic-menu-with-multi{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub.sc-ic-menu-with-multi{bottom:-0.25em}sup.sc-ic-menu-with-multi{top:-0.5em}img.sc-ic-menu-with-multi{border-style:none}button.sc-ic-menu-with-multi,input.sc-ic-menu-with-multi,optgroup.sc-ic-menu-with-multi,select.sc-ic-menu-with-multi,textarea.sc-ic-menu-with-multi{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button.sc-ic-menu-with-multi,input.sc-ic-menu-with-multi{overflow:visible}button.sc-ic-menu-with-multi,select.sc-ic-menu-with-multi{text-transform:none}button.sc-ic-menu-with-multi,[type=\"button\"].sc-ic-menu-with-multi,[type=\"reset\"].sc-ic-menu-with-multi,[type=\"submit\"].sc-ic-menu-with-multi{-webkit-appearance:button}button.sc-ic-menu-with-multi::-moz-focus-inner,[type=\"button\"].sc-ic-menu-with-multi::-moz-focus-inner,[type=\"reset\"].sc-ic-menu-with-multi::-moz-focus-inner,[type=\"submit\"].sc-ic-menu-with-multi::-moz-focus-inner{border-style:none;padding:0}button.sc-ic-menu-with-multi:-moz-focusring,[type=\"button\"].sc-ic-menu-with-multi:-moz-focusring,[type=\"reset\"].sc-ic-menu-with-multi:-moz-focusring,[type=\"submit\"].sc-ic-menu-with-multi:-moz-focusring{outline:1px dotted ButtonText}fieldset.sc-ic-menu-with-multi{padding:0.35em 0.75em 0.625em}legend.sc-ic-menu-with-multi{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress.sc-ic-menu-with-multi{vertical-align:baseline}textarea.sc-ic-menu-with-multi{overflow:auto}[type=\"checkbox\"].sc-ic-menu-with-multi,[type=\"radio\"].sc-ic-menu-with-multi{box-sizing:border-box;padding:0}[type=\"number\"].sc-ic-menu-with-multi::-webkit-inner-spin-button,[type=\"number\"].sc-ic-menu-with-multi::-webkit-outer-spin-button{height:auto}[type=\"search\"].sc-ic-menu-with-multi{-webkit-appearance:textfield;outline-offset:-2px}[type=\"search\"].sc-ic-menu-with-multi::-webkit-search-decoration{-webkit-appearance:none}.sc-ic-menu-with-multi::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details.sc-ic-menu-with-multi{display:block}summary.sc-ic-menu-with-multi{display:list-item}template.sc-ic-menu-with-multi{display:none}[hidden].sc-ic-menu-with-multi{display:none}html.sc-ic-menu-with-multi,body.sc-ic-menu-with-multi,div.sc-ic-menu-with-multi,span.sc-ic-menu-with-multi,applet.sc-ic-menu-with-multi,object.sc-ic-menu-with-multi,iframe.sc-ic-menu-with-multi,h1.sc-ic-menu-with-multi,h2.sc-ic-menu-with-multi,h3.sc-ic-menu-with-multi,h4.sc-ic-menu-with-multi,h5.sc-ic-menu-with-multi,h6.sc-ic-menu-with-multi,p.sc-ic-menu-with-multi,blockquote.sc-ic-menu-with-multi,pre.sc-ic-menu-with-multi,a.sc-ic-menu-with-multi,abbr.sc-ic-menu-with-multi,acronym.sc-ic-menu-with-multi,address.sc-ic-menu-with-multi,big.sc-ic-menu-with-multi,cite.sc-ic-menu-with-multi,code.sc-ic-menu-with-multi,del.sc-ic-menu-with-multi,dfn.sc-ic-menu-with-multi,em.sc-ic-menu-with-multi,img.sc-ic-menu-with-multi,ins.sc-ic-menu-with-multi,kbd.sc-ic-menu-with-multi,q.sc-ic-menu-with-multi,s.sc-ic-menu-with-multi,samp.sc-ic-menu-with-multi,small.sc-ic-menu-with-multi,strike.sc-ic-menu-with-multi,strong.sc-ic-menu-with-multi,sub.sc-ic-menu-with-multi,sup.sc-ic-menu-with-multi,tt.sc-ic-menu-with-multi,var.sc-ic-menu-with-multi,b.sc-ic-menu-with-multi,u.sc-ic-menu-with-multi,i.sc-ic-menu-with-multi,center.sc-ic-menu-with-multi,dl.sc-ic-menu-with-multi,dt.sc-ic-menu-with-multi,dd.sc-ic-menu-with-multi,ol.sc-ic-menu-with-multi,ul.sc-ic-menu-with-multi,li.sc-ic-menu-with-multi,fieldset.sc-ic-menu-with-multi,form.sc-ic-menu-with-multi,label.sc-ic-menu-with-multi,legend.sc-ic-menu-with-multi,table.sc-ic-menu-with-multi,caption.sc-ic-menu-with-multi,tbody.sc-ic-menu-with-multi,tfoot.sc-ic-menu-with-multi,thead.sc-ic-menu-with-multi,tr.sc-ic-menu-with-multi,th.sc-ic-menu-with-multi,td.sc-ic-menu-with-multi,article.sc-ic-menu-with-multi,aside.sc-ic-menu-with-multi,canvas.sc-ic-menu-with-multi,details.sc-ic-menu-with-multi,embed.sc-ic-menu-with-multi,figure.sc-ic-menu-with-multi,figcaption.sc-ic-menu-with-multi,footer.sc-ic-menu-with-multi,header.sc-ic-menu-with-multi,hgroup.sc-ic-menu-with-multi,menu.sc-ic-menu-with-multi,nav.sc-ic-menu-with-multi,output.sc-ic-menu-with-multi,ruby.sc-ic-menu-with-multi,section.sc-ic-menu-with-multi,summary.sc-ic-menu-with-multi,time.sc-ic-menu-with-multi,mark.sc-ic-menu-with-multi,audio.sc-ic-menu-with-multi,video.sc-ic-menu-with-multi{margin:0;padding:0;border:0;font-size:100%;font-style:inherit;vertical-align:baseline}@media (prefers-reduced-motion: no-preference){.open.sc-ic-menu-with-multi-h .menu.sc-ic-menu-with-multi{transition:max-height var(--ic-transition-duration-slow)}}.sc-ic-menu-with-multi-h{max-height:0;width:var(--menu-width, var(--input-width, 20rem));min-width:20rem;color:var(--ic-color-primary-text);background-color:var(--ic-architectural-white);position:relative;z-index:var(--ic-z-index-menu);box-sizing:border-box;box-shadow:var(--ic-elevation-overlay);border-radius:var(--ic-border-radius)}.open.sc-ic-menu-with-multi-h:not(.no-focus):focus-within{box-shadow:var(--ic-border-focus);outline:var(--ic-hc-focus-outline)}.select-all-focused.sc-ic-menu-with-multi-h{box-shadow:var(--ic-elevation-overlay) !important}#retry-button.sc-ic-menu-with-multi::part(button){height:var(--ic-space-lg)}.small.sc-ic-menu-with-multi #retry-button.sc-ic-menu-with-multi::part(button){height:var(--ic-space-md)}.on-dialog.sc-ic-menu-with-multi-h{inset:auto !important}.menu.sc-ic-menu-with-multi{text-decoration:none;list-style-type:none;border-radius:1px;background-color:var(--ic-architectural-white);visibility:hidden;max-height:0;overflow-y:hidden}.menu.sc-ic-menu-with-multi:has(+.option-bar).sc-ic-menu-with-multi{border-radius:0 0 1px 1px}.menu-scroll.sc-ic-menu-with-multi{overflow-y:auto}.menu.sc-ic-menu-with-multi:focus-visible{outline:none}.open.sc-ic-menu-with-multi-h{max-height:none;display:flex;flex-direction:column-reverse;border:var(--ic-border-width) solid var(--ic-architectural-400);transition:box-shadow var(--ic-easing-transition-fast)}.open.sc-ic-menu-with-multi-h .menu.sc-ic-menu-with-multi{visibility:visible;max-height:calc(var(--ic-space-xl) * 10 + var(--ic-space-xxxs))}.open.sc-ic-menu-with-multi-h .option-bar.sc-ic-menu-with-multi{visibility:visible}.open.sc-ic-menu-with-multi-h .select-all-button.sc-ic-menu-with-multi{display:block}.full-width.sc-ic-menu-with-multi-h{width:100%}.option.sc-ic-menu-with-multi{padding:var(--ic-space-xs) calc(var(--ic-space-xs) - var(--ic-space-1px));cursor:pointer;display:flex;align-items:center}.loading-option.sc-ic-menu-with-multi p.sc-ic-menu-with-multi{margin-bottom:0 !important}.option.sc-ic-menu-with-multi:not(.loading-option){justify-content:space-between}.small.sc-ic-menu-with-multi-h .option.sc-ic-menu-with-multi{padding:var(--ic-space-xxs) calc(var(--ic-space-xs) - var(--ic-space-1px))}.large.sc-ic-menu-with-multi-h .option.sc-ic-menu-with-multi{padding:var(--ic-space-sm) calc(var(--ic-space-xs) - var(--ic-space-1px))}.option.sc-ic-menu-with-multi:last-child{border-radius:0 0 1px 1px}.sc-ic-menu-with-multi:not(.menu:has(+.option-bar)).sc-ic-menu-with-multi .option.sc-ic-menu-with-multi:first-child{border-radius:1px 1px 0 0}.option.sc-ic-menu-with-multi:not(.disabled-option):hover{background-color:var(--ic-action-dark-bg-hover)}.option.sc-ic-menu-with-multi:not(.disabled-option):active{background-color:var(--ic-action-dark-bg-active)}.option.sc-ic-menu-with-multi:focus-visible{outline:var(--ic-hc-focus-outline)}.option.sc-ic-menu-with-multi:not(.disabled-option) .option-description.sc-ic-menu-with-multi{color:var(--ic-color-secondary-text)}.option.sc-ic-menu-with-multi .option-label.sc-ic-menu-with-multi{display:flex;flex-direction:row;align-items:top}.option.sc-ic-menu-with-multi .option-element.sc-ic-menu-with-multi{margin-top:var(--ic-space-xxs)}.option.sc-ic-menu-with-multi .option-icon.sc-ic-menu-with-multi{height:var(--ic-space-md);width:var(--ic-space-md);margin-top:var(--ic-space-xxs);margin-right:var(--ic-space-xxxs)}.option-text-container.sc-ic-menu-with-multi{pointer-events:none;max-width:calc(var(--ic-space-lg) * 10 + var(--ic-space-xl))}.option.loading-option.sc-ic-menu-with-multi .option-text-container.sc-ic-menu-with-multi{margin-left:calc(var(--ic-space-xs) + var(--ic-space-xxxs));color:var(--ic-color-secondary-text)}.error-icon-svg.sc-ic-menu-with-multi{height:var(--ic-space-md);width:var(--ic-space-md);fill:var(--ic-status-error);align-self:center;display:flex;margin-right:calc(var(--ic-space-xxs) * 1.2)}.loading-error-info.sc-ic-menu-with-multi{display:flex}.check-icon.sc-ic-menu-with-multi{height:var(--ic-space-lg);min-width:var(--ic-space-lg);width:var(--ic-space-lg);margin-left:var(--ic-space-xs);pointer-events:none}.focused-option.sc-ic-menu-with-multi .check-icon.sc-ic-menu-with-multi *.sc-ic-menu-with-multi{fill:currentcolor}.option-group-title.sc-ic-menu-with-multi{padding:var(--ic-space-lg) calc(var(--ic-space-xs) - var(--ic-space-1px))\n var(--ic-space-xs);color:var(--ic-color-tertiary-text)}.small.sc-ic-menu-with-multi-h .option-group-title.sc-ic-menu-with-multi{padding:var(--ic-space-sm) calc(var(--ic-space-xs) - var(--ic-space-1px))\n var(--ic-space-xxs)}.last-recommended-option.sc-ic-menu-with-multi{border-bottom:var(--ic-border-default)}.disabled-option.sc-ic-menu-with-multi{color:var(--ic-architectural-200);cursor:default;pointer-events:none}.focused-option.sc-ic-menu-with-multi,.focused-option.sc-ic-menu-with-multi .option-description.sc-ic-menu-with-multi{background-color:var(--ic-focus-blue) !important;color:var(--ic-color-white-text) !important}.no-results.sc-ic-menu-with-multi-h li.sc-ic-menu-with-multi{cursor:no-drop}.no-results.sc-ic-menu-with-multi-h li.sc-ic-menu-with-multi:hover{background-color:transparent}.option-bar.sc-ic-menu-with-multi{padding:var(--ic-space-xxs) var(--ic-space-xs);display:flex;align-items:center;justify-content:space-between;background-color:var(--ic-architectural-40);visibility:hidden;border-bottom:var(--ic-border-width) solid var(--ic-architectural-400);border-radius:1px 1px 0 0}.option-bar.sc-ic-menu-with-multi p.sc-ic-menu-with-multi{margin-bottom:0 !important}.large.sc-ic-menu-with-multi-h .option-bar.sc-ic-menu-with-multi{padding:var(--ic-space-xs)}.select-all-button.sc-ic-menu-with-multi{display:none}.select-all-button.sc-ic-menu-with-multi:focus{z-index:calc(var(--ic-z-index-menu) + 1)}@media (forced-colors: active){.focused-option.sc-ic-menu-with-multi:focus{outline:none;border:0.125rem solid transparent}}";
1805
+
1806
+ const Menu = class {
1807
+ constructor(hostRef) {
1808
+ index.registerInstance(this, hostRef);
1809
+ this.menuKeyPress = index.createEvent(this, "menuKeyPress", 7);
1810
+ this.menuOptionId = index.createEvent(this, "menuOptionId", 7);
1811
+ this.menuOptionSelect = index.createEvent(this, "menuOptionSelect", 7);
1812
+ this.menuOptionSelectAll = index.createEvent(this, "menuOptionSelectAll", 7);
1813
+ this.menuStateChange = index.createEvent(this, "menuStateChange", 7);
1814
+ this.retryButtonClicked = index.createEvent(this, "retryButtonClicked", 7);
1815
+ this.timeoutBlur = index.createEvent(this, "timeoutBlur", 7);
1816
+ this.ungroupedOptionsSet = index.createEvent(this, "ungroupedOptionsSet", 7);
1817
+ this.activeDescendantAttr = "aria-activedescendant"; // Prevent duplicate literal string lint error
1818
+ this.clearButtonId = "clear-button"; // Prevent duplicate literal string lint error
1819
+ this.disabledOptionSelected = false;
1820
+ this.hasPreviouslyBlurred = false;
1821
+ this.hasTimedOut = false;
1822
+ this.isLoading = false;
1823
+ this.isMultiSelect = false;
1824
+ this.isSearchBar = false;
1825
+ this.isSearchableSelect = false;
1826
+ this.multiOptionClicked = null;
1827
+ this.preventClickOpen = false; // Prevents menu re-opening immediately after it is closed on blur when clicking input.
1828
+ this.preventMenuFocus = false; // (When multiple) ensures focus moves straight to select all button from menu.
1829
+ this.ungroupedOptions = [];
1830
+ this.handleClearListener = () => {
1831
+ this.optionHighlighted = "";
1832
+ };
1833
+ this.handleSubmitSearch = () => {
1834
+ const highlightedOptionIndex = this.options.findIndex((option) => option[this.valueField] === this.optionHighlighted);
1835
+ this.setInputValue(highlightedOptionIndex);
1836
+ };
1837
+ this.handleMenuChange = (open, focusInput) => {
1838
+ this.menuStateChange.emit({ open, focusInput });
1839
+ if (!open) {
1840
+ if (focusInput !== false) {
1841
+ this.inputEl.focus();
1842
+ this.preventClickOpen = false;
1843
+ }
1844
+ // Reset optionHighlighted so previously highlighted option doesn't get reselected when Enter pressed
1845
+ if (this.isMultiSelect) {
1846
+ this.optionHighlighted = undefined;
1847
+ this.multiOptionClicked = null;
1848
+ }
1849
+ }
1850
+ };
1851
+ this.setNextOptionValue = (selectedOptionIndex) => {
1852
+ if (this.ungroupedOptions[selectedOptionIndex + 1]) {
1853
+ this.menuOptionSelect.emit({
1854
+ value: this.ungroupedOptions[selectedOptionIndex + 1][this.valueField],
1855
+ optionId: this.getOptionId(this.ungroupedOptions[selectedOptionIndex + 1][this.valueField]),
1856
+ });
1857
+ }
1858
+ else {
1859
+ this.menuOptionSelect.emit({
1860
+ value: this.ungroupedOptions[0][this.valueField],
1861
+ optionId: this.getOptionId(this.ungroupedOptions[0][this.valueField]),
1862
+ });
1863
+ }
1864
+ };
1865
+ this.setPreviousOptionValue = (selectedOptionIndex) => {
1866
+ if (this.ungroupedOptions[selectedOptionIndex - 1]) {
1867
+ this.menuOptionSelect.emit({
1868
+ value: this.ungroupedOptions[selectedOptionIndex - 1][this.valueField],
1869
+ optionId: this.getOptionId(this.ungroupedOptions[selectedOptionIndex - 1][this.valueField]),
1870
+ });
1871
+ }
1872
+ else {
1873
+ this.menuOptionSelect.emit({
1874
+ value: this.ungroupedOptions[this.ungroupedOptions.length - 1][this.valueField],
1875
+ optionId: this.getOptionId(this.ungroupedOptions[this.ungroupedOptions.length - 1][this.valueField]),
1876
+ });
1877
+ }
1878
+ };
1879
+ this.getParentEl = (parent) => {
1880
+ if (parent.tagName === "IC-SEARCH-BAR") {
1881
+ this.isSearchBar = true;
1882
+ }
1883
+ else if (parent.tagName === "IC-SELECT" ||
1884
+ parent.tagName === "IC-SELECT-WITH-MULTI") {
1885
+ if (parent.getAttribute("searchable") !== null &&
1886
+ parent.getAttribute("searchable") !== undefined) {
1887
+ this.isSearchableSelect = true;
1888
+ }
1889
+ else if (parent.getAttribute("multiple") !== null &&
1890
+ parent.getAttribute("multiple") !== undefined) {
1891
+ this.isMultiSelect = true;
1892
+ }
1893
+ }
1894
+ };
1895
+ // Open menu when up or down arrow keys are pressed
1896
+ this.arrowBehaviour = (event) => {
1897
+ event.preventDefault();
1898
+ this.handleMenuChange(true);
1899
+ };
1900
+ this.getMenuOptions = () => this.isSearchBar ? this.options : this.ungroupedOptions;
1901
+ // Set option that is focused and so should show focus state
1902
+ this.setHighlightedOption = (highlightedIndex) => {
1903
+ const menuOptions = this.getMenuOptions();
1904
+ menuOptions[highlightedIndex] &&
1905
+ !menuOptions[highlightedIndex].timedOut &&
1906
+ (this.optionHighlighted =
1907
+ menuOptions[highlightedIndex][this.valueField] || undefined);
1908
+ };
1909
+ // Determines keyboard behaviour when selection is automatic
1910
+ // (i.e. you don't have to press Enter select an option - just focus on it)
1911
+ // and menu is closed
1912
+ this.autoSetInputValueKeyboardOpen = (event) => {
1913
+ const selectedOptionIndex = this.ungroupedOptions.findIndex((option) => option[this.valueField] === this.value);
1914
+ this.keyboardNav = false;
1915
+ switch (event.key) {
1916
+ case "ArrowDown":
1917
+ this.keyboardNav = true;
1918
+ this.arrowBehaviour(event);
1919
+ this.setNextOptionValue(selectedOptionIndex);
1920
+ break;
1921
+ case "ArrowUp":
1922
+ this.keyboardNav = true;
1923
+ this.arrowBehaviour(event);
1924
+ this.setPreviousOptionValue(selectedOptionIndex);
1925
+ break;
1926
+ case " ":
1927
+ case "Enter":
1928
+ if (event.target.id !== this.clearButtonId) {
1929
+ this.handleMenuChange(true);
1930
+ }
1931
+ break;
1932
+ }
1933
+ };
1934
+ this.selectHighlightedOption = (target, options, highlightedOptionIndex) => {
1935
+ if (!this.isLoading && !this.hasTimedOut) {
1936
+ this.keyboardNav = true;
1937
+ }
1938
+ const isOpen = this.isSearchBar || this.isSearchableSelect || this.open;
1939
+ if (isOpen) {
1940
+ if (highlightedOptionIndex >= 0) {
1941
+ if (options[highlightedOptionIndex] !== undefined) {
1942
+ if (this.isSearchBar &&
1943
+ options[highlightedOptionIndex].disabled === true) {
1944
+ this.disabledOptionSelected = true;
1945
+ }
1946
+ else {
1947
+ this.setInputValue(highlightedOptionIndex);
1948
+ this.value = options[highlightedOptionIndex][this.valueField];
1949
+ }
1950
+ }
1951
+ }
1952
+ else {
1953
+ this.setInputValue(highlightedOptionIndex);
1954
+ }
1955
+ }
1956
+ else if (target.id !== this.clearButtonId &&
1957
+ this.isMultiSelect) {
1958
+ this.handleMenuChange(true);
1959
+ }
1960
+ };
1961
+ // Determines keyboard behaviour when selection is manual (i.e. when you have to press Enter to select an option)
1962
+ this.manualSetInputValueKeyboardOpen = (event) => {
1963
+ const menuOptions = this.getMenuOptions();
1964
+ this.keyboardNav = false;
1965
+ const highlightedOptionIndex = menuOptions.findIndex((option) => option[this.valueField] === this.optionHighlighted);
1966
+ const clickedMultiOptionIndex = menuOptions.findIndex((option) => option[this.valueField] === this.multiOptionClicked);
1967
+ const getOptionId = (index) => { var _a; return (_a = Array.from(this.el.querySelectorAll("li"))[index]) === null || _a === void 0 ? void 0 : _a.id; };
1968
+ // Space press should be equivalent to Enter when multi-select
1969
+ if (event.key === " " && this.isMultiSelect) {
1970
+ this.selectHighlightedOption(event.target, menuOptions, highlightedOptionIndex);
1971
+ }
1972
+ else {
1973
+ switch (event.key) {
1974
+ case "ArrowDown":
1975
+ this.keyboardNav = true;
1976
+ this.arrowBehaviour(event);
1977
+ if (this.multiOptionClicked) {
1978
+ // Set focus to option last clicked
1979
+ // Prevents it resetting to the top of the menu when user switches to using keyboard
1980
+ this.setHighlightedOption(clickedMultiOptionIndex);
1981
+ this.multiOptionClicked = null;
1982
+ }
1983
+ else if (highlightedOptionIndex < menuOptions.length - 1) {
1984
+ this.setHighlightedOption(highlightedOptionIndex + 1);
1985
+ this.menuOptionId.emit({
1986
+ optionId: getOptionId(highlightedOptionIndex + 1),
1987
+ });
1988
+ }
1989
+ else {
1990
+ this.setHighlightedOption(0);
1991
+ this.menuOptionId.emit({
1992
+ optionId: getOptionId(0),
1993
+ });
1994
+ }
1995
+ this.preventIncorrectTabOrder = false;
1996
+ this.focusFromSearchKeypress = false;
1997
+ break;
1998
+ case "ArrowUp":
1999
+ this.keyboardNav = true;
2000
+ this.arrowBehaviour(event);
2001
+ if (this.multiOptionClicked) {
2002
+ // Set focus to option last clicked
2003
+ // Prevents it resetting to the bottom of the menu when user switches to using keyboard
2004
+ this.setHighlightedOption(clickedMultiOptionIndex);
2005
+ this.multiOptionClicked = null;
2006
+ }
2007
+ else if (highlightedOptionIndex <= 0 ||
2008
+ highlightedOptionIndex > menuOptions.length + 1) {
2009
+ this.setHighlightedOption(menuOptions.length - 1);
2010
+ this.menuOptionId.emit({
2011
+ optionId: getOptionId(menuOptions.length - 1),
2012
+ });
2013
+ }
2014
+ else {
2015
+ this.setHighlightedOption(highlightedOptionIndex - 1);
2016
+ this.menuOptionId.emit({
2017
+ optionId: getOptionId(highlightedOptionIndex - 1),
2018
+ });
2019
+ }
2020
+ this.preventIncorrectTabOrder = false;
2021
+ this.focusFromSearchKeypress = false;
2022
+ break;
2023
+ case "Home":
2024
+ this.keyboardNav = true;
2025
+ event.preventDefault();
2026
+ this.arrowBehaviour(event);
2027
+ this.setHighlightedOption(0);
2028
+ this.menuOptionId.emit({
2029
+ optionId: getOptionId(0),
2030
+ });
2031
+ break;
2032
+ case "End":
2033
+ this.keyboardNav = true;
2034
+ event.preventDefault();
2035
+ this.arrowBehaviour(event);
2036
+ this.setHighlightedOption(menuOptions.length - 1);
2037
+ this.menuOptionId.emit({
2038
+ optionId: getOptionId(menuOptions.length - 1),
2039
+ });
2040
+ break;
2041
+ case " ":
2042
+ if (this.isSearchBar || this.isSearchableSelect) {
2043
+ break;
2044
+ }
2045
+ else {
2046
+ if (event.target.id !== this.clearButtonId) {
2047
+ this.handleMenuChange(true);
2048
+ }
2049
+ }
2050
+ break;
2051
+ case "Enter":
2052
+ event.preventDefault();
2053
+ this.selectHighlightedOption(event.target, menuOptions, highlightedOptionIndex);
2054
+ break;
2055
+ case "Escape":
2056
+ if (this.open) {
2057
+ event.stopImmediatePropagation();
2058
+ }
2059
+ this.handleMenuChange(false);
2060
+ this.menuOptionId.emit({ optionId: undefined });
2061
+ break;
2062
+ case "a":
2063
+ // Checks if Cmd (meta) key is pressed if Mac device (while excluding meta key on Windows)
2064
+ // Otherwise, if a different OS, checks Ctrl key
2065
+ if ((helpers.isMacDevice() && event.metaKey) ||
2066
+ (!helpers.isMacDevice() && event.ctrlKey)) {
2067
+ this.emitSelectAll();
2068
+ }
2069
+ break;
2070
+ case "Shift":
2071
+ case "Tab":
2072
+ if (this.isSearchBar) {
2073
+ this.keyboardNav = true;
2074
+ }
2075
+ if (this.isMultiSelect) {
2076
+ if (this.open && !event.shiftKey && this.selectAllButton) {
2077
+ event.preventDefault();
2078
+ this.selectAllButton.focus(); // Move focus to select all button instead of focused option
2079
+ this.preventMenuFocus = true;
2080
+ this.preventClickOpen = true;
2081
+ this.optionHighlighted = undefined; // Stop any option focus states showing when focus moved to select all button
2082
+ }
2083
+ }
2084
+ else {
2085
+ this.preventIncorrectTabOrder = true;
2086
+ }
2087
+ break;
2088
+ case "Backspace":
2089
+ if (this.isSearchBar) {
2090
+ this.parentEl.setFocus();
2091
+ if (this.searchMode === "navigation")
2092
+ this.setHighlightedOption(0);
2093
+ }
2094
+ else if (this.isSearchableSelect) {
2095
+ this.parentEl.setFocus();
2096
+ }
2097
+ this.focusFromSearchKeypress = true;
2098
+ break;
2099
+ default:
2100
+ if (event.key !== "Tab") {
2101
+ if (this.isSearchBar) {
2102
+ this.parentEl.setFocus();
2103
+ if (this.searchMode === "navigation")
2104
+ this.setHighlightedOption(0);
2105
+ }
2106
+ else if (this.isSearchableSelect) {
2107
+ this.parentEl.setFocus();
2108
+ }
2109
+ this.focusFromSearchKeypress = true;
2110
+ break;
2111
+ }
2112
+ }
2113
+ }
2114
+ };
2115
+ this.setInputValue = (highlightedOptionIndex) => {
2116
+ const menuOptions = this.getMenuOptions();
2117
+ if (menuOptions[highlightedOptionIndex] !== undefined) {
2118
+ this.menuOptionSelect.emit({
2119
+ value: menuOptions[highlightedOptionIndex][this.valueField],
2120
+ });
2121
+ if (this.closeOnSelect) {
2122
+ this.optionHighlighted = undefined;
2123
+ this.menuOptionId.emit({ optionId: undefined });
2124
+ }
2125
+ }
2126
+ if (this.closeOnSelect) {
2127
+ if (!this.hasTimedOut) {
2128
+ this.handleMenuChange(false);
2129
+ }
2130
+ else {
2131
+ this.parentEl.setFocus();
2132
+ }
2133
+ }
2134
+ };
2135
+ this.handleOptionClick = (event) => {
2136
+ const { value, label } = event.target.dataset;
2137
+ this.menuOptionSelect.emit({ value, label });
2138
+ this.optionHighlighted = undefined;
2139
+ if (this.isMultiSelect) {
2140
+ this.multiOptionClicked = value;
2141
+ }
2142
+ else {
2143
+ this.handleMenuChange(false);
2144
+ }
2145
+ };
2146
+ this.handleRetry = () => {
2147
+ this.retryButtonClicked.emit({ value: this.value });
2148
+ };
2149
+ this.handleRetryKeyDown = (ev) => {
2150
+ if (ev.key === "Enter" || ev.key === " ") {
2151
+ ev.preventDefault();
2152
+ this.retryButtonClicked.emit({ value: this.value, keyPressed: ev.key });
2153
+ }
2154
+ };
2155
+ this.handleBlur = (event) => {
2156
+ if (event.relatedTarget !== this.inputEl) {
2157
+ if (event.relatedTarget === this.selectAllButton) {
2158
+ this.menu.removeAttribute(this.activeDescendantAttr);
2159
+ }
2160
+ if (!(this.menu.contains(event.relatedTarget) ||
2161
+ event.relatedTarget === this.selectAllButton)) {
2162
+ this.handleMenuChange(false, this.hasPreviouslyBlurred);
2163
+ this.menu.removeAttribute(this.activeDescendantAttr);
2164
+ }
2165
+ }
2166
+ else {
2167
+ this.handleMenuChange(false);
2168
+ this.preventClickOpen = true;
2169
+ this.menu.removeAttribute(this.activeDescendantAttr);
2170
+ }
2171
+ if (!this.isSearchBar)
2172
+ this.hasPreviouslyBlurred = !!event.relatedTarget;
2173
+ };
2174
+ this.handleMouseDown = (event) => {
2175
+ event.preventDefault();
2176
+ };
2177
+ this.handleMenuKeyDown = (event) => {
2178
+ if (this.activationType === "automatic") {
2179
+ this.autoSetValueOnMenuKeyDown(event);
2180
+ }
2181
+ else if (this.activationType === "manual" && !this.isSearchBar) {
2182
+ this.manualSetInputValueKeyboardOpen(event);
2183
+ }
2184
+ };
2185
+ this.handleMenuKeyUp = (event) => {
2186
+ if (event.key === "Tab" && event.shiftKey) {
2187
+ this.preventClickOpen = false;
2188
+ }
2189
+ if (event.key === "Enter" && this.disabledOptionSelected) {
2190
+ this.disabledOptionSelected = false;
2191
+ event.stopImmediatePropagation();
2192
+ }
2193
+ };
2194
+ this.handleSelectAllClick = () => {
2195
+ this.keyboardNav = false;
2196
+ this.menu.focus();
2197
+ this.emitSelectAll();
2198
+ };
2199
+ this.handleSelectAllBlur = (event) => {
2200
+ this.el.classList.remove("select-all-focused");
2201
+ if (!this.menu.contains(event.relatedTarget)) {
2202
+ this.handleMenuChange(false, false);
2203
+ }
2204
+ };
2205
+ this.handleSelectAllFocus = () => {
2206
+ this.el.classList.add("select-all-focused");
2207
+ };
2208
+ // Fix for Safari - select all button click was causing menu to close
2209
+ this.handleSelectAllMouseDown = (event) => {
2210
+ event.preventDefault();
2211
+ };
2212
+ this.emitSelectAll = () => {
2213
+ var _a;
2214
+ // Select all if there is either no value or not all options are selected
2215
+ // 'true' means select all, 'false' means clear all
2216
+ this.menuOptionSelectAll.emit({
2217
+ select: !this.value || !(((_a = this.value) === null || _a === void 0 ? void 0 : _a.length) === this.ungroupedOptions.length),
2218
+ });
2219
+ };
2220
+ this.emitMenuKeyPress = (isNavKey, key) => {
2221
+ this.menuKeyPress.emit({ isNavKey: isNavKey, key: key });
2222
+ };
2223
+ // Determines keyboard behaviour when selection is automatic
2224
+ // (i.e. you don't have to press Enter select an option - just focus on it)
2225
+ // and menu is focused
2226
+ this.autoSetValueOnMenuKeyDown = (event) => {
2227
+ event.cancelBubble = true;
2228
+ const selectedOptionIndex = this.ungroupedOptions.findIndex((option) => option[this.valueField] === this.value);
2229
+ const isSearchableSelect = this.inputEl.tagName === "INPUT";
2230
+ this.keyboardNav = false;
2231
+ switch (event.key) {
2232
+ case " ":
2233
+ event.preventDefault();
2234
+ break;
2235
+ case "ArrowUp":
2236
+ if (!this.hasTimedOut) {
2237
+ event.preventDefault();
2238
+ this.setPreviousOptionValue(selectedOptionIndex);
2239
+ this.keyboardNav = true;
2240
+ }
2241
+ break;
2242
+ case "ArrowDown":
2243
+ if (!this.hasTimedOut) {
2244
+ event.preventDefault();
2245
+ this.setNextOptionValue(selectedOptionIndex);
2246
+ this.keyboardNav = true;
2247
+ }
2248
+ break;
2249
+ case "Home":
2250
+ this.menuOptionSelect.emit({
2251
+ value: this.ungroupedOptions[0][this.valueField],
2252
+ });
2253
+ this.keyboardNav = true;
2254
+ break;
2255
+ case "End":
2256
+ this.menuOptionSelect.emit({
2257
+ value: this.ungroupedOptions[this.ungroupedOptions.length - 1][this.valueField],
2258
+ });
2259
+ this.keyboardNav = true;
2260
+ break;
2261
+ case "Enter":
2262
+ !this.hasTimedOut && this.handleMenuChange(false);
2263
+ break;
2264
+ case "Escape":
2265
+ this.handleMenuChange(false);
2266
+ break;
2267
+ case "Backspace":
2268
+ if (isSearchableSelect) {
2269
+ this.inputEl.focus();
2270
+ }
2271
+ break;
2272
+ case "Shift":
2273
+ break;
2274
+ default:
2275
+ if (isSearchableSelect && event.key !== "Tab" && !this.hasTimedOut) {
2276
+ this.inputEl.focus();
2277
+ }
2278
+ if (event.key.length === 1) {
2279
+ this.keyboardNav = true;
2280
+ }
2281
+ break;
2282
+ }
2283
+ this.emitMenuKeyPress(this.keyboardNav, event.key);
2284
+ };
2285
+ this.getOptionId = (value) => {
2286
+ return `${this.menuId}-${value}`;
2287
+ };
2288
+ this.getOptionAriaLabel = (option, parentOption) => {
2289
+ let ariaLabel = option[this.labelField];
2290
+ if (option.description) {
2291
+ ariaLabel = `${ariaLabel}, ${option.description}`;
2292
+ }
2293
+ if (option.element) {
2294
+ ariaLabel = `${ariaLabel}, ${option.element.ariaLabel}`;
2295
+ }
2296
+ if (parentOption) {
2297
+ return `${ariaLabel}, ${parentOption[this.labelField]} group`;
2298
+ }
2299
+ else {
2300
+ return ariaLabel;
2301
+ }
2302
+ };
2303
+ this.getSortedOptions = (options) => {
2304
+ let sorted = [];
2305
+ if (options.sort) {
2306
+ sorted = options.sort((optionA, optionB) => optionA.recommended && !optionB.recommended ? -1 : 0);
2307
+ }
2308
+ return sorted;
2309
+ };
2310
+ this.isManualMode = this.activationType === "manual";
2311
+ this.scrollToSelected = (menu) => {
2312
+ const selectedOption = this.selectOnEnter
2313
+ ? this.el.querySelector(`li[data-value="${this.optionHighlighted}"]`)
2314
+ : menu.querySelector(".option[aria-selected='true']");
2315
+ if (selectedOption) {
2316
+ const elTop = selectedOption.offsetTop + selectedOption.offsetHeight;
2317
+ if (elTop > menu.scrollTop + menu.offsetHeight ||
2318
+ elTop < menu.scrollTop + menu.offsetHeight) {
2319
+ menu.scrollTop = selectedOption.offsetTop;
2320
+ }
2321
+ // 'aria-activedescendant' affects screen reader focus
2322
+ // https://www.w3.org/TR/2017/WD-wai-aria-practices-1.1-20170628/#kbd_focus_activedescendant
2323
+ this.menu.setAttribute(this.activeDescendantAttr, selectedOption.id);
2324
+ selectedOption.focus();
2325
+ }
2326
+ };
2327
+ // Set 'ungroupedOptions' variable and emit its value
2328
+ // - this is all the options with disabled options and group titles removed
2329
+ this.loadUngroupedOptions = () => {
2330
+ if (this.options.length > 0 && this.options.map) {
2331
+ this.options.map((option) => {
2332
+ if (option.children) {
2333
+ option.children.map((option) => !option.disabled && this.ungroupedOptions.push(option));
2334
+ }
2335
+ else if (!option.disabled) {
2336
+ this.ungroupedOptions.push(option);
2337
+ }
2338
+ });
2339
+ }
2340
+ this.ungroupedOptions = this.getSortedOptions(this.ungroupedOptions);
2341
+ this.ungroupedOptionsSet.emit({ options: this.ungroupedOptions });
2342
+ };
2343
+ this.setMenuScrollbar = () => {
2344
+ let optionsHeight = 0;
2345
+ this.el
2346
+ .querySelectorAll(".option")
2347
+ .forEach((option) => (optionsHeight += option.clientHeight));
2348
+ if (optionsHeight >= 320) {
2349
+ this.menu.classList.add("menu-scroll");
2350
+ }
2351
+ };
2352
+ this.handleTimeoutBlur = (ev) => {
2353
+ this.timeoutBlur.emit({ ev });
2354
+ };
2355
+ this.optionContent = (option, selected) => {
2356
+ return (index.h(index.Fragment, null, option.loading && index.h("ic-loading-indicator", { size: "icon" }), index.h("div", { class: "option-text-container" }, index.h("div", { class: "option-label" }, option.icon && (index.h("div", { class: "option-icon", innerHTML: option.icon, "aria-hidden": "true" })), index.h("ic-typography", { variant: "body", "aria-hidden": "true" }, index.h("p", null, option[this.labelField]))), option.description && (index.h("ic-typography", { id: `${this.getOptionId(option[this.valueField])}-description`, class: "option-description", variant: "caption", "aria-hidden": "true" }, index.h("p", null, option.description))), option.element && (index.h("div", { class: "option-element", innerHTML: option.element.component, "aria-hidden": "true" }))), !!option[this.valueField] &&
2357
+ !!this.value &&
2358
+ selected &&
2359
+ this.parentEl.tagName !== "IC-SEARCH-BAR" && (index.h("span", { class: "check-icon", innerHTML: Check }))));
2360
+ };
2361
+ this.displayOption = (option, selected, index$1, parentOption) => {
2362
+ const { open, keyboardNav, isManualMode, initialOptionsListRender, optionHighlighted, options, } = this;
2363
+ return (index.h("li", { id: this.getOptionId(option[this.valueField]), class: {
2364
+ option: true,
2365
+ "focused-option": isManualMode
2366
+ ? (keyboardNav || initialOptionsListRender) &&
2367
+ option[this.valueField] === optionHighlighted
2368
+ : keyboardNav && selected,
2369
+ "last-recommended-option": option.recommended &&
2370
+ options[index$1 + 1] &&
2371
+ !options[index$1 + 1].recommended,
2372
+ "disabled-option": option.disabled,
2373
+ "loading-option": option.loading,
2374
+ timeout: option.timedOut,
2375
+ }, role: "option", tabindex: open &&
2376
+ (selected || option[this.valueField] === optionHighlighted) &&
2377
+ keyboardNav
2378
+ ? "0"
2379
+ : "-1", "aria-label": this.getOptionAriaLabel(option, parentOption), "aria-selected": selected ? "true" : "false", "aria-disabled": option.disabled ? "true" : "false", onClick: !option.timedOut && !option.loading && this.handleOptionClick, onBlur: this.handleBlur, onMouseDown: this.handleMouseDown, "data-value": option[this.valueField], "data-label": option[this.labelField] }, option.timedOut ? (index.h(index.Fragment, null, index.h("div", { class: "loading-error-info" }, index.h("svg", { class: "error-icon-svg", "aria-labelledby": "error-title", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "#000000" }, index.h("title", { id: "error-title" }, "Error"), index.h("g", { id: "close-octagon" }, index.h("path", { id: "Vector", d: "M8.77 3L3.5 8.27V15.73L8.77 21H16.23L21.5 15.73V8.27L16.23 3M8.91 7L12.5 10.59L16.09 7L17.5 8.41L13.91 12L17.5 15.59L16.09 17L12.5 13.41L8.91 17L7.5 15.59L11.09 12L7.5 8.41" }))), index.h("ic-typography", { variant: "label" }, option[this.labelField])), index.h("ic-button", { size: "small", variant: "tertiary", onClick: this.handleRetry, onKeyDown: this.handleRetryKeyDown, onBlur: this.handleTimeoutBlur, id: "retry-button" }, "Retry"))) : (this.optionContent(option, selected))));
2380
+ };
2381
+ this.focusFromSearchKeypress = false;
2382
+ this.initialOptionsListRender = false;
2383
+ this.keyboardNav = false;
2384
+ this.optionHighlighted = undefined;
2385
+ this.preventIncorrectTabOrder = false;
2386
+ this.menuOptions = undefined;
2387
+ this.activationType = "automatic";
2388
+ this.anchorEl = undefined;
2389
+ this.autoFocusOnSelected = true;
2390
+ this.closeOnSelect = true;
2391
+ this.fullWidth = false;
2392
+ this.inputEl = undefined;
2393
+ this.inputLabel = undefined;
2394
+ this.labelField = "label";
2395
+ this.menuId = undefined;
2396
+ this.open = undefined;
2397
+ this.parentEl = undefined;
2398
+ this.searchMode = "navigation";
2399
+ this.selectOnEnter = false;
2400
+ this.size = "default";
2401
+ this.small = false;
2402
+ this.options = undefined;
2403
+ this.value = undefined;
2404
+ this.valueField = "value";
2405
+ }
2406
+ watchOpenHandler() {
2407
+ if (!this.open && this.popperInstance) {
2408
+ this.popperInstance.destroy();
2409
+ this.popperInstance = null;
2410
+ }
2411
+ }
2412
+ watchOptionsHandler(newOptions) {
2413
+ this.hasTimedOut = newOptions.some((opt) => opt.timedOut);
2414
+ this.isLoading = newOptions.some((opt) => opt.loading);
2415
+ this.ungroupedOptions = [];
2416
+ this.loadUngroupedOptions();
2417
+ }
2418
+ connectedCallback() {
2419
+ this.getParentEl(this.parentEl);
2420
+ if (this.isSearchBar) {
2421
+ if (this.searchMode === "navigation")
2422
+ this.setHighlightedOption(0);
2423
+ this.initialOptionsListRender = true;
2424
+ }
2425
+ }
2426
+ disconnectedCallback() {
2427
+ if (this.popperInstance) {
2428
+ this.popperInstance.destroy();
2429
+ }
2430
+ this.parentEl.removeEventListener("icClear", this.handleClearListener);
2431
+ this.parentEl.removeEventListener("icSubmitSearch", this.handleSubmitSearch);
2432
+ }
2433
+ componentWillLoad() {
2434
+ var _a, _b;
2435
+ this.loadUngroupedOptions();
2436
+ this.parentEl.addEventListener("icClear", this.handleClearListener);
2437
+ this.parentEl.addEventListener("icSubmitSearch", this.handleSubmitSearch);
2438
+ this.hasTimedOut = (_a = this.options) === null || _a === void 0 ? void 0 : _a.some((opt) => opt.timedOut);
2439
+ this.isLoading = (_b = this.options) === null || _b === void 0 ? void 0 : _b.some((opt) => opt.loading);
2440
+ }
2441
+ componentDidLoad() {
2442
+ if (this.isSearchBar &&
2443
+ this.parentEl.disableFilter) {
2444
+ this.focusFromSearchKeypress = true;
2445
+ }
2446
+ helpers.onComponentRequiredPropUndefined([
2447
+ { prop: this.open, propName: "open" },
2448
+ { prop: this.options, propName: "options" },
2449
+ { prop: this.menuId, propName: "menu-id" },
2450
+ { prop: this.inputLabel, propName: "input-label" },
2451
+ //NOTE: no check for value, input-el or anchor-el as otherwise get console errors on first load of select component
2452
+ ], "Menu");
2453
+ }
2454
+ componentDidUpdate() {
2455
+ const inputValueInOptions = this.options.some((option) => option[this.valueField] === this.value);
2456
+ const optionHighlightedIsSet = this.optionHighlighted !== null &&
2457
+ this.optionHighlighted !== undefined &&
2458
+ this.optionHighlighted !== "";
2459
+ if (this.open && this.options.length !== 0 && !this.preventMenuFocus) {
2460
+ if (this.value &&
2461
+ this.keyboardNav &&
2462
+ inputValueInOptions &&
2463
+ this.autoFocusOnSelected &&
2464
+ !this.isSearchableSelect) {
2465
+ this.scrollToSelected(this.menu);
2466
+ }
2467
+ else if (optionHighlightedIsSet &&
2468
+ !this.focusFromSearchKeypress &&
2469
+ !this.preventIncorrectTabOrder) {
2470
+ const highlightedEl = this.el.querySelector(`li[data-value="${this.optionHighlighted}"]`);
2471
+ if (highlightedEl) {
2472
+ this.menu.setAttribute(this.activeDescendantAttr, highlightedEl.id);
2473
+ highlightedEl.focus();
2474
+ }
2475
+ }
2476
+ else if (this.inputEl.tagName !== "IC-TEXT-FIELD" &&
2477
+ this.inputEl.tagName !== "INPUT") {
2478
+ this.menu.focus();
2479
+ }
2480
+ }
2481
+ if (this.open && !this.value && this.selectOnEnter) {
2482
+ this.scrollToSelected(this.menu);
2483
+ }
2484
+ this.preventMenuFocus = false;
2485
+ }
2486
+ componentDidRender() {
2487
+ if (this.open && !this.popperInstance && this.anchorEl) {
2488
+ this.initPopperJs(this.anchorEl);
2489
+ }
2490
+ if (this.open && !!this.options.length) {
2491
+ this.setMenuScrollbar();
2492
+ }
2493
+ }
2494
+ /**
2495
+ * @internal If menu is opened with the mouse, emit menuStateChange custom event.
2496
+ */
2497
+ async handleClickOpen() {
2498
+ if (!this.preventClickOpen) {
2499
+ this.menuStateChange.emit({ open: !this.open });
2500
+ this.keyboardNav = false;
2501
+ }
2502
+ this.preventClickOpen = false;
2503
+ }
2504
+ /**
2505
+ * Used alongside activationType
2506
+ * If menu is opened via keyboard navigation (i.e. Enter, ArrowUp or ArrowDown), emit optionSelect custom event.
2507
+ * @param {KeyboardEvent} event - keyboard event
2508
+ */
2509
+ async handleKeyboardOpen(event) {
2510
+ this.keyboardNav = false;
2511
+ if (this.activationType === "automatic") {
2512
+ this.autoSetInputValueKeyboardOpen(event);
2513
+ }
2514
+ else {
2515
+ this.manualSetInputValueKeyboardOpen(event);
2516
+ }
2517
+ }
2518
+ /**
2519
+ * @internal Used to highlight the first option in the menu.
2520
+ */
2521
+ async handleSetFirstOption() {
2522
+ this.setHighlightedOption(0);
2523
+ }
2524
+ /**
2525
+ * @internal Used to initialize popperJS with an anchor element.
2526
+ * 5/12/2023: Tested with Floating UI, however, discovered inconsistent
2527
+ * boundary behaviour so sticking with PopperJS.
2528
+ */
2529
+ async initPopperJs(anchor) {
2530
+ // Placements set to "-start" to accommodate for custom menu width - menu should always be aligned to the left
2531
+ this.popperInstance = createPopper(anchor, this.el, {
2532
+ placement: "bottom-start",
2533
+ modifiers: [
2534
+ {
2535
+ name: "offset",
2536
+ options: {
2537
+ offset: [0, 7],
2538
+ },
2539
+ },
2540
+ {
2541
+ name: "flip",
2542
+ options: {
2543
+ fallbackPlacements: ["top-start"],
2544
+ rootBoundary: "viewport",
2545
+ },
2546
+ },
2547
+ ],
2548
+ });
2549
+ }
2550
+ render() {
2551
+ const { inputLabel, options, menuId, value, fullWidth, hasTimedOut, isLoading, size, small, open, inputEl, keyboardNav, } = this;
2552
+ const selectAllButtonText = `${(value === null || value === void 0 ? void 0 : value.length) === this.ungroupedOptions.length ? "Clear" : "Select"} all`;
2553
+ const hasNoResults = this.el.classList.contains("no-results");
2554
+ return (index.h(index.Host, { class: {
2555
+ "full-width": fullWidth,
2556
+ "no-focus": (inputEl === null || inputEl === void 0 ? void 0 : inputEl.tagName) === "INPUT" ||
2557
+ hasTimedOut ||
2558
+ isLoading ||
2559
+ hasNoResults,
2560
+ small: small,
2561
+ [size]: true,
2562
+ open: open && options.length !== 0,
2563
+ multiple: this.isMultiSelect,
2564
+ } }, options.length !== 0 && (index.h("ul", { id: menuId, class: "menu", role: "listbox", "aria-label": `${inputLabel} pop-up`, "aria-multiselectable": this.isMultiSelect ? "true" : "false", tabindex: open && !keyboardNav && (inputEl === null || inputEl === void 0 ? void 0 : inputEl.tagName) !== "INPUT" ? "0" : "-1", ref: (el) => (this.menu = el), onKeyDown: this.handleMenuKeyDown, onKeyUp: this.handleMenuKeyUp, onBlur: this.handleBlur }, this.getSortedOptions(options).map((option, index$1) => {
2565
+ if (option.children) {
2566
+ if (option.children.length > 0) {
2567
+ return (index.h("div", null, index.h("ic-typography", { class: "option-group-title", role: "presentation", variant: "subtitle-small" }, index.h("p", null, option[this.labelField])), option.children.map((childOption) => childOption.label &&
2568
+ this.displayOption(childOption, this.isMultiSelect
2569
+ ? value === null || value === void 0 ? void 0 : value.includes(childOption[this.valueField])
2570
+ : childOption[this.valueField] === value, index$1, option))));
2571
+ }
2572
+ else {
2573
+ return null;
2574
+ }
2575
+ }
2576
+ else {
2577
+ // Display option only if it has a label (rather than displaying an empty space)
2578
+ return (option.label &&
2579
+ this.displayOption(option, this.isMultiSelect
2580
+ ? value === null || value === void 0 ? void 0 : value.includes(option[this.valueField])
2581
+ : option[this.valueField] === value, index$1));
2582
+ }
2583
+ }))), options.length !== 0 &&
2584
+ this.isMultiSelect &&
2585
+ !isLoading &&
2586
+ !hasTimedOut &&
2587
+ !hasNoResults && (index.h("div", { class: "option-bar" }, index.h("ic-typography", null, index.h("p", null, `${value ? value.length : 0}/${helpers.getOptionsWithoutGroupTitlesCount(this.options)} selected`)), index.h("ic-button", { class: "select-all-button", "aria-label": `${selectAllButtonText} options for ${inputLabel}`, ref: (el) => (this.selectAllButton = el), variant: "tertiary", onClick: this.handleSelectAllClick, onMouseDown: this.handleSelectAllMouseDown, onBlur: this.handleSelectAllBlur, onFocus: this.handleSelectAllFocus, size: size === "small" ? "small" : "default" }, selectAllButtonText)))));
2588
+ }
2589
+ get el() { return index.getElement(this); }
2590
+ static get watchers() { return {
2591
+ "open": ["watchOpenHandler"],
2592
+ "options": ["watchOptionsHandler"]
2593
+ }; }
2594
+ };
2595
+ Menu.style = icMenuCss;
2596
+
2597
+ exports.ic_menu_with_multi = Menu;
2598
+
2599
+ //# sourceMappingURL=ic-menu-with-multi.cjs.entry.js.map