@covet-pics/covet-pics-widget 0.134.4 → 0.134.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (259) hide show
  1. package/dist/cjs/covet-pics-direct-buy_6.cjs.entry.js +3896 -0
  2. package/dist/cjs/covet-pics-direct-buy_6.cjs.entry.js.map +1 -0
  3. package/dist/cjs/covet-pics-gallery-grid_3.cjs.entry.js +37 -38
  4. package/dist/cjs/covet-pics-gallery-grid_3.cjs.entry.js.map +1 -1
  5. package/dist/cjs/{covet-pics-direct-buy_8.cjs.entry.js → covet-pics-gallery-header_5.cjs.entry.js} +620 -3891
  6. package/dist/cjs/covet-pics-gallery-header_5.cjs.entry.js.map +1 -0
  7. package/dist/cjs/covet-pics-gallery-item-caption.cjs.entry.js +1 -1
  8. package/dist/cjs/covet-pics-highlighted-hotspots_2.cjs.entry.js +4 -3
  9. package/dist/cjs/covet-pics-highlighted-hotspots_2.cjs.entry.js.map +1 -1
  10. package/dist/cjs/covet-pics-star-rating.cjs.entry.js +1 -1
  11. package/dist/cjs/covet-pics-widget.cjs.entry.js +56 -20
  12. package/dist/cjs/covet-pics-widget.cjs.entry.js.map +1 -1
  13. package/dist/cjs/covet-pics-widget.cjs.js +1 -1
  14. package/dist/cjs/fragment-eca2afda.js +10 -0
  15. package/dist/cjs/fragment-eca2afda.js.map +1 -0
  16. package/dist/cjs/{fragment-29c21ac8.js → index-1dd17838.js} +1 -4
  17. package/dist/cjs/index-1dd17838.js.map +1 -0
  18. package/dist/cjs/loader.cjs.js +1 -1
  19. package/dist/cjs/modals-fbb030c6.js +53 -0
  20. package/dist/cjs/modals-fbb030c6.js.map +1 -0
  21. package/dist/cjs/{redux-toolkit.esm-6245a408.js → popup-360b40ea.js} +78 -2
  22. package/dist/cjs/popup-360b40ea.js.map +1 -0
  23. package/dist/cjs/{funcComponents-1f9cd305.js → popupFuncComponents-6bf630fe.js} +31 -24
  24. package/dist/cjs/popupFuncComponents-6bf630fe.js.map +1 -0
  25. package/dist/cjs/{slider-ccd13483.js → slider-ccbd22be.js} +3 -3
  26. package/dist/cjs/{slider-ccd13483.js.map → slider-ccbd22be.js.map} +1 -1
  27. package/dist/cjs/{utils-07dcda6f.js → utils-43150e49.js} +1 -80
  28. package/dist/cjs/utils-43150e49.js.map +1 -0
  29. package/dist/collection/components/covet-pics-gallery-grid/covet-pics-gallery-grid.js +19 -23
  30. package/dist/collection/components/covet-pics-gallery-grid/covet-pics-gallery-grid.js.map +1 -1
  31. package/dist/collection/components/covet-pics-gallery-item/covet-pics-gallery-item.js +35 -331
  32. package/dist/collection/components/covet-pics-gallery-item/covet-pics-gallery-item.js.map +1 -1
  33. package/dist/collection/components/covet-pics-gallery-item-detail/covet-pics-gallery-item-detail.js +9 -139
  34. package/dist/collection/components/covet-pics-gallery-item-detail/covet-pics-gallery-item-detail.js.map +1 -1
  35. package/dist/collection/components/covet-pics-gallery-slider/covet-pics-gallery-slider.js +17 -13
  36. package/dist/collection/components/covet-pics-gallery-slider/covet-pics-gallery-slider.js.map +1 -1
  37. package/dist/collection/components/covet-pics-upload/covet-pics-upload.js +14 -449
  38. package/dist/collection/components/covet-pics-upload/covet-pics-upload.js.map +1 -1
  39. package/dist/collection/components/covet-pics-widget/covet-pics-widget.js +8 -4
  40. package/dist/collection/components/covet-pics-widget/covet-pics-widget.js.map +1 -1
  41. package/dist/collection/store/preview.js +1 -1
  42. package/dist/collection/store/preview.js.map +1 -1
  43. package/dist/collection/store/settings.js +35 -1
  44. package/dist/collection/store/settings.js.map +1 -1
  45. package/dist/collection/utils/types.js.map +1 -1
  46. package/dist/collection/utils/utils.js +0 -77
  47. package/dist/collection/utils/utils.js.map +1 -1
  48. package/dist/covet-pics-widget/covet-pics-widget.esm.js +1 -1
  49. package/dist/covet-pics-widget/covet-pics-widget.esm.js.map +1 -1
  50. package/dist/covet-pics-widget/p-01f6a4f7.entry.js +5 -0
  51. package/dist/covet-pics-widget/{p-74a2a735.entry.js.map → p-01f6a4f7.entry.js.map} +1 -1
  52. package/dist/covet-pics-widget/{p-78012f35.js → p-0a457909.js} +2 -2
  53. package/dist/covet-pics-widget/p-0a457909.js.map +1 -0
  54. package/dist/covet-pics-widget/p-0b12ef8c.system.js +5 -0
  55. package/dist/covet-pics-widget/p-0b12ef8c.system.js.map +1 -0
  56. package/dist/covet-pics-widget/p-14f87941.entry.js +10 -0
  57. package/dist/covet-pics-widget/p-14f87941.entry.js.map +1 -0
  58. package/dist/covet-pics-widget/{p-31c7baa6.system.js → p-2219daf3.system.js} +2 -2
  59. package/dist/covet-pics-widget/{p-2b1a4414.system.entry.js → p-24946c8d.system.entry.js} +2 -2
  60. package/dist/covet-pics-widget/{p-ef7fe5c8.entry.js → p-2ae9d0ec.entry.js} +2 -2
  61. package/dist/covet-pics-widget/p-3dc0fe4e.system.entry.js +10 -0
  62. package/dist/covet-pics-widget/p-3dc0fe4e.system.entry.js.map +1 -0
  63. package/dist/covet-pics-widget/p-4944f71d.js +5 -0
  64. package/dist/covet-pics-widget/p-4944f71d.js.map +1 -0
  65. package/dist/covet-pics-widget/p-50123328.js +5 -0
  66. package/dist/{esm-es5/redux-toolkit.esm-dcdcec70.js.map → covet-pics-widget/p-50123328.js.map} +1 -1
  67. package/dist/covet-pics-widget/{p-411b89eb.system.js → p-532a736c.system.js} +2 -2
  68. package/dist/covet-pics-widget/p-532a736c.system.js.map +1 -0
  69. package/dist/covet-pics-widget/{p-89bbb6f5.js → p-650731c9.js} +2 -2
  70. package/dist/covet-pics-widget/p-664d172e.system.entry.js +41 -0
  71. package/dist/covet-pics-widget/p-664d172e.system.entry.js.map +1 -0
  72. package/dist/covet-pics-widget/p-6699fbb1.system.entry.js +24 -0
  73. package/dist/covet-pics-widget/p-6699fbb1.system.entry.js.map +1 -0
  74. package/dist/covet-pics-widget/p-6d26756d.entry.js +24 -0
  75. package/dist/covet-pics-widget/p-6d26756d.entry.js.map +1 -0
  76. package/dist/covet-pics-widget/p-762bf31f.entry.js +41 -0
  77. package/dist/covet-pics-widget/p-762bf31f.entry.js.map +1 -0
  78. package/dist/covet-pics-widget/p-77b244ad.system.js +5 -0
  79. package/dist/covet-pics-widget/p-77b244ad.system.js.map +1 -0
  80. package/dist/covet-pics-widget/p-8e2f5a57.system.js +1 -1
  81. package/dist/covet-pics-widget/p-8e2f5a57.system.js.map +1 -1
  82. package/dist/covet-pics-widget/p-a317f2e9.system.js +5 -0
  83. package/dist/covet-pics-widget/p-a317f2e9.system.js.map +1 -0
  84. package/dist/covet-pics-widget/p-adedb038.system.entry.js +5 -0
  85. package/dist/covet-pics-widget/p-adedb038.system.entry.js.map +1 -0
  86. package/dist/covet-pics-widget/p-b7eec80f.js +5 -0
  87. package/dist/covet-pics-widget/p-b7eec80f.js.map +1 -0
  88. package/dist/covet-pics-widget/{p-2909b6f3.js → p-c0cbcde1.js} +2 -2
  89. package/dist/covet-pics-widget/p-c0cbcde1.js.map +1 -0
  90. package/dist/covet-pics-widget/p-d8bb4b02.js +5 -0
  91. package/dist/covet-pics-widget/p-d8bb4b02.js.map +1 -0
  92. package/dist/covet-pics-widget/p-dbdbc83a.system.js +5 -0
  93. package/dist/covet-pics-widget/p-dbdbc83a.system.js.map +1 -0
  94. package/dist/covet-pics-widget/p-df88eb5b.system.js +5 -0
  95. package/dist/covet-pics-widget/p-df88eb5b.system.js.map +1 -0
  96. package/dist/covet-pics-widget/{p-075502b8.system.entry.js → p-dfaa2395.system.entry.js} +2 -2
  97. package/dist/covet-pics-widget/p-f0175ff1.system.entry.js +5 -0
  98. package/dist/covet-pics-widget/{p-f9ee3cd6.system.entry.js.map → p-f0175ff1.system.entry.js.map} +1 -1
  99. package/dist/covet-pics-widget/p-f74e9091.entry.js +5 -0
  100. package/dist/covet-pics-widget/p-f74e9091.entry.js.map +1 -0
  101. package/dist/covet-pics-widget/{p-adbf9b20.entry.js → p-f7eafaec.entry.js} +2 -2
  102. package/dist/esm/covet-pics-direct-buy_6.entry.js +3887 -0
  103. package/dist/esm/covet-pics-direct-buy_6.entry.js.map +1 -0
  104. package/dist/esm/covet-pics-gallery-grid_3.entry.js +37 -38
  105. package/dist/esm/covet-pics-gallery-grid_3.entry.js.map +1 -1
  106. package/dist/esm/{covet-pics-direct-buy_8.entry.js → covet-pics-gallery-header_5.entry.js} +611 -3879
  107. package/dist/esm/covet-pics-gallery-header_5.entry.js.map +1 -0
  108. package/dist/esm/covet-pics-gallery-item-caption.entry.js +1 -1
  109. package/dist/esm/covet-pics-highlighted-hotspots_2.entry.js +3 -2
  110. package/dist/esm/covet-pics-highlighted-hotspots_2.entry.js.map +1 -1
  111. package/dist/esm/covet-pics-star-rating.entry.js +1 -1
  112. package/dist/esm/covet-pics-widget.entry.js +47 -11
  113. package/dist/esm/covet-pics-widget.entry.js.map +1 -1
  114. package/dist/esm/covet-pics-widget.js +1 -1
  115. package/dist/esm/fragment-4a91c0c7.js +8 -0
  116. package/dist/esm/fragment-4a91c0c7.js.map +1 -0
  117. package/dist/esm/{fragment-f9995d04.js → index-7c90d3e1.js} +2 -4
  118. package/dist/esm/index-7c90d3e1.js.map +1 -0
  119. package/dist/esm/loader.js +1 -1
  120. package/dist/esm/modals-4e59e125.js +47 -0
  121. package/dist/esm/modals-4e59e125.js.map +1 -0
  122. package/dist/esm/{redux-toolkit.esm-dcdcec70.js → popup-cd2a29d1.js} +66 -2
  123. package/dist/esm/popup-cd2a29d1.js.map +1 -0
  124. package/dist/esm/{funcComponents-6b01da09.js → popupFuncComponents-48aad560.js} +31 -2
  125. package/dist/esm/popupFuncComponents-48aad560.js.map +1 -0
  126. package/dist/esm/{slider-453004ae.js → slider-beacb319.js} +2 -2
  127. package/dist/esm/{slider-453004ae.js.map → slider-beacb319.js.map} +1 -1
  128. package/dist/esm/{utils-15c56a4b.js → utils-4f568062.js} +2 -78
  129. package/dist/esm/utils-4f568062.js.map +1 -0
  130. package/dist/esm-es5/covet-pics-direct-buy_6.entry.js +10 -0
  131. package/dist/esm-es5/covet-pics-direct-buy_6.entry.js.map +1 -0
  132. package/dist/esm-es5/covet-pics-gallery-grid_3.entry.js +3 -3
  133. package/dist/esm-es5/covet-pics-gallery-grid_3.entry.js.map +1 -1
  134. package/dist/esm-es5/covet-pics-gallery-header_5.entry.js +24 -0
  135. package/dist/esm-es5/covet-pics-gallery-header_5.entry.js.map +1 -0
  136. package/dist/esm-es5/covet-pics-gallery-item-caption.entry.js +1 -1
  137. package/dist/esm-es5/covet-pics-highlighted-hotspots_2.entry.js +1 -1
  138. package/dist/esm-es5/covet-pics-highlighted-hotspots_2.entry.js.map +1 -1
  139. package/dist/esm-es5/covet-pics-star-rating.entry.js +1 -1
  140. package/dist/esm-es5/covet-pics-widget.entry.js +1 -1
  141. package/dist/esm-es5/covet-pics-widget.entry.js.map +1 -1
  142. package/dist/esm-es5/covet-pics-widget.js +1 -1
  143. package/dist/esm-es5/covet-pics-widget.js.map +1 -1
  144. package/dist/esm-es5/fragment-4a91c0c7.js +5 -0
  145. package/dist/esm-es5/fragment-4a91c0c7.js.map +1 -0
  146. package/dist/esm-es5/index-7c90d3e1.js +5 -0
  147. package/dist/esm-es5/index-7c90d3e1.js.map +1 -0
  148. package/dist/esm-es5/loader.js +1 -1
  149. package/dist/esm-es5/loader.js.map +1 -1
  150. package/dist/esm-es5/modals-4e59e125.js +5 -0
  151. package/dist/esm-es5/modals-4e59e125.js.map +1 -0
  152. package/dist/esm-es5/popup-cd2a29d1.js +5 -0
  153. package/dist/esm-es5/popup-cd2a29d1.js.map +1 -0
  154. package/dist/esm-es5/{funcComponents-6b01da09.js → popupFuncComponents-48aad560.js} +2 -2
  155. package/dist/esm-es5/popupFuncComponents-48aad560.js.map +1 -0
  156. package/dist/esm-es5/slider-beacb319.js +5 -0
  157. package/dist/esm-es5/{slider-453004ae.js.map → slider-beacb319.js.map} +1 -1
  158. package/dist/esm-es5/utils-4f568062.js +5 -0
  159. package/dist/esm-es5/utils-4f568062.js.map +1 -0
  160. package/dist/types/components/covet-pics-gallery-item/covet-pics-gallery-item.d.ts +3 -65
  161. package/dist/types/components/covet-pics-gallery-item-detail/covet-pics-gallery-item-detail.d.ts +1 -28
  162. package/dist/types/components/covet-pics-upload/covet-pics-upload.d.ts +4 -60
  163. package/dist/types/components.d.ts +0 -296
  164. package/dist/types/store/preview.d.ts +0 -1
  165. package/dist/types/utils/types.d.ts +34 -0
  166. package/dist/types/utils/utils.d.ts +0 -14
  167. package/package.json +1 -1
  168. package/dist/cjs/covet-pics-direct-buy_8.cjs.entry.js.map +0 -1
  169. package/dist/cjs/covet-pics-gallery-header_3.cjs.entry.js +0 -694
  170. package/dist/cjs/covet-pics-gallery-header_3.cjs.entry.js.map +0 -1
  171. package/dist/cjs/fragment-29c21ac8.js.map +0 -1
  172. package/dist/cjs/funcComponents-1f9cd305.js.map +0 -1
  173. package/dist/cjs/modals-43cf32e7.js +0 -30
  174. package/dist/cjs/modals-43cf32e7.js.map +0 -1
  175. package/dist/cjs/popup-73ac7fd8.js +0 -85
  176. package/dist/cjs/popup-73ac7fd8.js.map +0 -1
  177. package/dist/cjs/redux-toolkit.esm-6245a408.js.map +0 -1
  178. package/dist/cjs/sort-9f03ff24.js +0 -32
  179. package/dist/cjs/sort-9f03ff24.js.map +0 -1
  180. package/dist/cjs/utils-07dcda6f.js.map +0 -1
  181. package/dist/covet-pics-widget/p-02e02e66.system.js +0 -5
  182. package/dist/covet-pics-widget/p-02e02e66.system.js.map +0 -1
  183. package/dist/covet-pics-widget/p-07929539.entry.js +0 -29
  184. package/dist/covet-pics-widget/p-07929539.entry.js.map +0 -1
  185. package/dist/covet-pics-widget/p-0ccc3016.entry.js +0 -5
  186. package/dist/covet-pics-widget/p-0ccc3016.entry.js.map +0 -1
  187. package/dist/covet-pics-widget/p-19e460fb.js +0 -5
  188. package/dist/covet-pics-widget/p-19e460fb.js.map +0 -1
  189. package/dist/covet-pics-widget/p-1cf7bea5.system.entry.js +0 -41
  190. package/dist/covet-pics-widget/p-1cf7bea5.system.entry.js.map +0 -1
  191. package/dist/covet-pics-widget/p-22b1675a.system.js +0 -5
  192. package/dist/covet-pics-widget/p-22b1675a.system.js.map +0 -1
  193. package/dist/covet-pics-widget/p-2909b6f3.js.map +0 -1
  194. package/dist/covet-pics-widget/p-411b89eb.system.js.map +0 -1
  195. package/dist/covet-pics-widget/p-5631a10e.system.entry.js +0 -29
  196. package/dist/covet-pics-widget/p-5631a10e.system.entry.js.map +0 -1
  197. package/dist/covet-pics-widget/p-5b31e99a.system.js +0 -5
  198. package/dist/covet-pics-widget/p-5b31e99a.system.js.map +0 -1
  199. package/dist/covet-pics-widget/p-6bcbcb0d.entry.js +0 -5
  200. package/dist/covet-pics-widget/p-6bcbcb0d.entry.js.map +0 -1
  201. package/dist/covet-pics-widget/p-6eee4403.js +0 -5
  202. package/dist/covet-pics-widget/p-6eee4403.js.map +0 -1
  203. package/dist/covet-pics-widget/p-72939567.system.js +0 -5
  204. package/dist/covet-pics-widget/p-72939567.system.js.map +0 -1
  205. package/dist/covet-pics-widget/p-74a2a735.entry.js +0 -5
  206. package/dist/covet-pics-widget/p-78012f35.js.map +0 -1
  207. package/dist/covet-pics-widget/p-7b102580.system.js +0 -5
  208. package/dist/covet-pics-widget/p-7b102580.system.js.map +0 -1
  209. package/dist/covet-pics-widget/p-823e1b45.system.entry.js +0 -5
  210. package/dist/covet-pics-widget/p-823e1b45.system.entry.js.map +0 -1
  211. package/dist/covet-pics-widget/p-a3af4d75.js +0 -5
  212. package/dist/covet-pics-widget/p-a3af4d75.js.map +0 -1
  213. package/dist/covet-pics-widget/p-d539c1d1.js +0 -5
  214. package/dist/covet-pics-widget/p-d539c1d1.js.map +0 -1
  215. package/dist/covet-pics-widget/p-d6b3befd.entry.js +0 -41
  216. package/dist/covet-pics-widget/p-d6b3befd.entry.js.map +0 -1
  217. package/dist/covet-pics-widget/p-e3c65e63.system.js +0 -5
  218. package/dist/covet-pics-widget/p-e3c65e63.system.js.map +0 -1
  219. package/dist/covet-pics-widget/p-e514ffad.js +0 -5
  220. package/dist/covet-pics-widget/p-e514ffad.js.map +0 -1
  221. package/dist/covet-pics-widget/p-f9ee3cd6.system.entry.js +0 -5
  222. package/dist/covet-pics-widget/p-fe9f2e45.system.entry.js +0 -5
  223. package/dist/covet-pics-widget/p-fe9f2e45.system.entry.js.map +0 -1
  224. package/dist/esm/covet-pics-direct-buy_8.entry.js.map +0 -1
  225. package/dist/esm/covet-pics-gallery-header_3.entry.js +0 -688
  226. package/dist/esm/covet-pics-gallery-header_3.entry.js.map +0 -1
  227. package/dist/esm/fragment-f9995d04.js.map +0 -1
  228. package/dist/esm/funcComponents-6b01da09.js.map +0 -1
  229. package/dist/esm/modals-8a9d64aa.js +0 -26
  230. package/dist/esm/modals-8a9d64aa.js.map +0 -1
  231. package/dist/esm/popup-482c942e.js +0 -72
  232. package/dist/esm/popup-482c942e.js.map +0 -1
  233. package/dist/esm/redux-toolkit.esm-dcdcec70.js.map +0 -1
  234. package/dist/esm/sort-f8d1e4c0.js +0 -29
  235. package/dist/esm/sort-f8d1e4c0.js.map +0 -1
  236. package/dist/esm/utils-15c56a4b.js.map +0 -1
  237. package/dist/esm-es5/covet-pics-direct-buy_8.entry.js +0 -29
  238. package/dist/esm-es5/covet-pics-direct-buy_8.entry.js.map +0 -1
  239. package/dist/esm-es5/covet-pics-gallery-header_3.entry.js +0 -5
  240. package/dist/esm-es5/covet-pics-gallery-header_3.entry.js.map +0 -1
  241. package/dist/esm-es5/fragment-f9995d04.js +0 -5
  242. package/dist/esm-es5/fragment-f9995d04.js.map +0 -1
  243. package/dist/esm-es5/funcComponents-6b01da09.js.map +0 -1
  244. package/dist/esm-es5/modals-8a9d64aa.js +0 -5
  245. package/dist/esm-es5/modals-8a9d64aa.js.map +0 -1
  246. package/dist/esm-es5/popup-482c942e.js +0 -5
  247. package/dist/esm-es5/popup-482c942e.js.map +0 -1
  248. package/dist/esm-es5/redux-toolkit.esm-dcdcec70.js +0 -5
  249. package/dist/esm-es5/slider-453004ae.js +0 -5
  250. package/dist/esm-es5/sort-f8d1e4c0.js +0 -5
  251. package/dist/esm-es5/sort-f8d1e4c0.js.map +0 -1
  252. package/dist/esm-es5/utils-15c56a4b.js +0 -5
  253. package/dist/esm-es5/utils-15c56a4b.js.map +0 -1
  254. /package/dist/covet-pics-widget/{p-31c7baa6.system.js.map → p-2219daf3.system.js.map} +0 -0
  255. /package/dist/covet-pics-widget/{p-2b1a4414.system.entry.js.map → p-24946c8d.system.entry.js.map} +0 -0
  256. /package/dist/covet-pics-widget/{p-ef7fe5c8.entry.js.map → p-2ae9d0ec.entry.js.map} +0 -0
  257. /package/dist/covet-pics-widget/{p-89bbb6f5.js.map → p-650731c9.js.map} +0 -0
  258. /package/dist/covet-pics-widget/{p-075502b8.system.entry.js.map → p-dfaa2395.system.entry.js.map} +0 -0
  259. /package/dist/covet-pics-widget/{p-adbf9b20.entry.js.map → p-f7eafaec.entry.js.map} +0 -0
@@ -0,0 +1,3896 @@
1
+ /*!
2
+ * Copyright (c) 2020 by Space Squirrel Ltd.
3
+ */
4
+ 'use strict';
5
+
6
+ Object.defineProperty(exports, '__esModule', { value: true });
7
+
8
+ const index = require('./index-5415b8fd.js');
9
+ const utils = require('./utils-43150e49.js');
10
+ const a11y = require('./a11y-c38c0cb2.js');
11
+ const slider = require('./slider-c7104397.js');
12
+ const popup = require('./popup-360b40ea.js');
13
+ const index$1 = require('./index-1dd17838.js');
14
+ const popupFuncComponents = require('./popupFuncComponents-6bf630fe.js');
15
+
16
+ const covetPicsDirectBuyCss = "@font-face{font-family:\"swiper-icons\";src:url(\"data:application/font-woff;charset=utf-8;base64, d09GRgABAAAAAAZgABAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAAGRAAAABoAAAAci6qHkUdERUYAAAWgAAAAIwAAACQAYABXR1BPUwAABhQAAAAuAAAANuAY7+xHU1VCAAAFxAAAAFAAAABm2fPczU9TLzIAAAHcAAAASgAAAGBP9V5RY21hcAAAAkQAAACIAAABYt6F0cBjdnQgAAACzAAAAAQAAAAEABEBRGdhc3AAAAWYAAAACAAAAAj//wADZ2x5ZgAAAywAAADMAAAD2MHtryVoZWFkAAABbAAAADAAAAA2E2+eoWhoZWEAAAGcAAAAHwAAACQC9gDzaG10eAAAAigAAAAZAAAArgJkABFsb2NhAAAC0AAAAFoAAABaFQAUGG1heHAAAAG8AAAAHwAAACAAcABAbmFtZQAAA/gAAAE5AAACXvFdBwlwb3N0AAAFNAAAAGIAAACE5s74hXjaY2BkYGAAYpf5Hu/j+W2+MnAzMYDAzaX6QjD6/4//Bxj5GA8AuRwMYGkAPywL13jaY2BkYGA88P8Agx4j+/8fQDYfA1AEBWgDAIB2BOoAeNpjYGRgYNBh4GdgYgABEMnIABJzYNADCQAACWgAsQB42mNgYfzCOIGBlYGB0YcxjYGBwR1Kf2WQZGhhYGBiYGVmgAFGBiQQkOaawtDAoMBQxXjg/wEGPcYDDA4wNUA2CCgwsAAAO4EL6gAAeNpj2M0gyAACqxgGNWBkZ2D4/wMA+xkDdgAAAHjaY2BgYGaAYBkGRgYQiAHyGMF8FgYHIM3DwMHABGQrMOgyWDLEM1T9/w8UBfEMgLzE////P/5//f/V/xv+r4eaAAeMbAxwIUYmIMHEgKYAYjUcsDAwsLKxc3BycfPw8jEQA/gZBASFhEVExcQlJKWkZWTl5BUUlZRVVNXUNTQZBgMAAMR+E+gAEQFEAAAAKgAqACoANAA+AEgAUgBcAGYAcAB6AIQAjgCYAKIArAC2AMAAygDUAN4A6ADyAPwBBgEQARoBJAEuATgBQgFMAVYBYAFqAXQBfgGIAZIBnAGmAbIBzgHsAAB42u2NMQ6CUAyGW568x9AneYYgm4MJbhKFaExIOAVX8ApewSt4Bic4AfeAid3VOBixDxfPYEza5O+Xfi04YADggiUIULCuEJK8VhO4bSvpdnktHI5QCYtdi2sl8ZnXaHlqUrNKzdKcT8cjlq+rwZSvIVczNiezsfnP/uznmfPFBNODM2K7MTQ45YEAZqGP81AmGGcF3iPqOop0r1SPTaTbVkfUe4HXj97wYE+yNwWYxwWu4v1ugWHgo3S1XdZEVqWM7ET0cfnLGxWfkgR42o2PvWrDMBSFj/IHLaF0zKjRgdiVMwScNRAoWUoH78Y2icB/yIY09An6AH2Bdu/UB+yxopYshQiEvnvu0dURgDt8QeC8PDw7Fpji3fEA4z/PEJ6YOB5hKh4dj3EvXhxPqH/SKUY3rJ7srZ4FZnh1PMAtPhwP6fl2PMJMPDgeQ4rY8YT6Gzao0eAEA409DuggmTnFnOcSCiEiLMgxCiTI6Cq5DZUd3Qmp10vO0LaLTd2cjN4fOumlc7lUYbSQcZFkutRG7g6JKZKy0RmdLY680CDnEJ+UMkpFFe1RN7nxdVpXrC4aTtnaurOnYercZg2YVmLN/d/gczfEimrE/fs/bOuq29Zmn8tloORaXgZgGa78yO9/cnXm2BpaGvq25Dv9S4E9+5SIc9PqupJKhYFSSl47+Qcr1mYNAAAAeNptw0cKwkAAAMDZJA8Q7OUJvkLsPfZ6zFVERPy8qHh2YER+3i/BP83vIBLLySsoKimrqKqpa2hp6+jq6RsYGhmbmJqZSy0sraxtbO3sHRydnEMU4uR6yx7JJXveP7WrDycAAAAAAAH//wACeNpjYGRgYOABYhkgZgJCZgZNBkYGLQZtIJsFLMYAAAw3ALgAeNolizEKgDAQBCchRbC2sFER0YD6qVQiBCv/H9ezGI6Z5XBAw8CBK/m5iQQVauVbXLnOrMZv2oLdKFa8Pjuru2hJzGabmOSLzNMzvutpB3N42mNgZGBg4GKQYzBhYMxJLMlj4GBgAYow/P/PAJJhLM6sSoWKfWCAAwDAjgbRAAB42mNgYGBkAIIbCZo5IPrmUn0hGA0AO8EFTQAA\") format(\"woff\");font-weight:400;font-style:normal}:root{--swiper-theme-color:#007aff;}.swiper,swiper-container{margin-left:auto;margin-right:auto;position:relative;overflow:hidden;list-style:none;padding:0;z-index:1;display:block}.swiper-vertical>.swiper-wrapper{-ms-flex-direction:column;flex-direction:column}.swiper-wrapper{position:relative;width:100%;height:100%;z-index:1;display:-ms-flexbox;display:flex;-webkit-transition-property:-webkit-transform;transition-property:-webkit-transform;transition-property:transform;transition-property:transform, -webkit-transform;-webkit-transition-timing-function:var(--swiper-wrapper-transition-timing-function, initial);transition-timing-function:var(--swiper-wrapper-transition-timing-function, initial);-webkit-box-sizing:content-box;box-sizing:content-box}.swiper-android .swiper-slide,.swiper-wrapper{-webkit-transform:translate3d(0px, 0, 0);transform:translate3d(0px, 0, 0)}.swiper-horizontal{-ms-touch-action:pan-y;touch-action:pan-y}.swiper-vertical{-ms-touch-action:pan-x;touch-action:pan-x}.swiper-slide,swiper-slide{-ms-flex-negative:0;flex-shrink:0;width:100%;height:100%;position:relative;-webkit-transition-property:-webkit-transform;transition-property:-webkit-transform;transition-property:transform;transition-property:transform, -webkit-transform;display:block}.swiper-slide-invisible-blank{visibility:hidden}.swiper-autoheight,.swiper-autoheight .swiper-slide{height:auto}.swiper-autoheight .swiper-wrapper{-ms-flex-align:start;align-items:flex-start;-webkit-transition-property:height, -webkit-transform;transition-property:height, -webkit-transform;transition-property:transform, height;transition-property:transform, height, -webkit-transform}.swiper-backface-hidden .swiper-slide{-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-backface-visibility:hidden;backface-visibility:hidden}.swiper-3d.swiper-css-mode .swiper-wrapper{-webkit-perspective:1200px;perspective:1200px}.swiper-3d .swiper-wrapper{-webkit-transform-style:preserve-3d;transform-style:preserve-3d}.swiper-3d{-webkit-perspective:1200px;perspective:1200px}.swiper-3d .swiper-slide,.swiper-3d .swiper-slide-shadow,.swiper-3d .swiper-slide-shadow-left,.swiper-3d .swiper-slide-shadow-right,.swiper-3d .swiper-slide-shadow-top,.swiper-3d .swiper-slide-shadow-bottom,.swiper-3d .swiper-cube-shadow{-webkit-transform-style:preserve-3d;transform-style:preserve-3d}.swiper-3d .swiper-slide-shadow,.swiper-3d .swiper-slide-shadow-left,.swiper-3d .swiper-slide-shadow-right,.swiper-3d .swiper-slide-shadow-top,.swiper-3d .swiper-slide-shadow-bottom{position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none;z-index:10}.swiper-3d .swiper-slide-shadow{background:rgba(0, 0, 0, 0.15)}.swiper-3d .swiper-slide-shadow-left{background-image:-webkit-gradient(linear, right top, left top, from(rgba(0, 0, 0, 0.5)), to(rgba(0, 0, 0, 0)));background-image:linear-gradient(to left, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0))}.swiper-3d .swiper-slide-shadow-right{background-image:-webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, 0.5)), to(rgba(0, 0, 0, 0)));background-image:linear-gradient(to right, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0))}.swiper-3d .swiper-slide-shadow-top{background-image:-webkit-gradient(linear, left bottom, left top, from(rgba(0, 0, 0, 0.5)), to(rgba(0, 0, 0, 0)));background-image:linear-gradient(to top, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0))}.swiper-3d .swiper-slide-shadow-bottom{background-image:-webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, 0.5)), to(rgba(0, 0, 0, 0)));background-image:linear-gradient(to bottom, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0))}.swiper-css-mode>.swiper-wrapper{overflow:auto;scrollbar-width:none;-ms-overflow-style:none;}.swiper-css-mode>.swiper-wrapper::-webkit-scrollbar{display:none}.swiper-css-mode>.swiper-wrapper>.swiper-slide{scroll-snap-align:start start}.swiper-horizontal.swiper-css-mode>.swiper-wrapper{-webkit-scroll-snap-type:x mandatory;-ms-scroll-snap-type:x mandatory;scroll-snap-type:x mandatory}.swiper-vertical.swiper-css-mode>.swiper-wrapper{-webkit-scroll-snap-type:y mandatory;-ms-scroll-snap-type:y mandatory;scroll-snap-type:y mandatory}.swiper-centered>.swiper-wrapper::before{content:\"\";-ms-flex-negative:0;flex-shrink:0;-ms-flex-order:9999;order:9999}.swiper-centered>.swiper-wrapper>.swiper-slide{scroll-snap-align:center center;scroll-snap-stop:always}.swiper-centered.swiper-horizontal>.swiper-wrapper>.swiper-slide:first-child{-webkit-margin-start:var(--swiper-centered-offset-before);margin-inline-start:var(--swiper-centered-offset-before)}.swiper-centered.swiper-horizontal>.swiper-wrapper::before{height:100%;min-height:1px;width:var(--swiper-centered-offset-after)}.swiper-centered.swiper-vertical>.swiper-wrapper>.swiper-slide:first-child{-webkit-margin-before:var(--swiper-centered-offset-before);margin-block-start:var(--swiper-centered-offset-before)}.swiper-centered.swiper-vertical>.swiper-wrapper::before{width:100%;min-width:1px;height:var(--swiper-centered-offset-after)}.swiper-lazy-preloader{width:42px;height:42px;position:absolute;left:50%;top:50%;margin-left:-21px;margin-top:-21px;z-index:10;-webkit-transform-origin:50%;transform-origin:50%;-webkit-box-sizing:border-box;box-sizing:border-box;border:4px solid var(--swiper-preloader-color, var(--swiper-theme-color));border-radius:50%;border-top-color:transparent}.swiper:not(.swiper-watch-progress) .swiper-lazy-preloader,swiper-container:not(.swiper-watch-progress) .swiper-lazy-preloader,.swiper-watch-progress .swiper-slide-visible .swiper-lazy-preloader{-webkit-animation:swiper-preloader-spin 1s infinite linear;animation:swiper-preloader-spin 1s infinite linear}.swiper-lazy-preloader-white{--swiper-preloader-color:#fff}.swiper-lazy-preloader-black{--swiper-preloader-color:#000}@-webkit-keyframes swiper-preloader-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes swiper-preloader-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}:host{z-index:1;background-color:#ffffff;--covet-pics-button-size:40px;--covet-pics-padding-size:40px;--covet-pics-font-color:#101010;--covet-pics-background-color:#fcfbfc}:host{position:fixed;bottom:0;overflow:scroll;width:100%;max-height:100%;-webkit-box-shadow:0 -8px 16px 0 rgba(0, 0, 0, 0.05);box-shadow:0 -8px 16px 0 rgba(0, 0, 0, 0.05);-webkit-transition:max-height 0.35s ease-in-out;transition:max-height 0.35s ease-in-out;min-width:auto}.main{margin:0 var(--covet-pics-padding-size);padding-bottom:150px;position:relative}.close{background:none;border:none;position:absolute;top:0;right:0;padding:0;margin:0;cursor:pointer;-webkit-transform:rotate(270deg);transform:rotate(270deg);outline:none !important}.close:hover svg .icon-arrow-path,.close:active svg .icon-arrow-path,.close:focus svg .icon-arrow-path{stroke:#000000}.close svg{width:var(--covet-pics-button-size);height:var(--covet-pics-button-size)}.close svg .icon-arrow-path{-webkit-transition:all 0.25s ease;transition:all 0.25s ease}.title{font-size:14px;font-weight:400;line-height:var(--covet-pics-button-size);width:calc(100% - var(--covet-pics-button-size));overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:center;-webkit-box-sizing:border-box;box-sizing:border-box;margin:10px 0 0 0}.title a{text-decoration:none;color:var(--covet-pics-font-color)}.price-wrap{display:-ms-flexbox;display:flex;height:32px;background:var(--covet-pics-background-color);-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;text-transform:uppercase}.price-wrap label{color:var(--covet-pics-font-color);font-weight:300;max-width:80px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.price-wrap .price{font-weight:600}.btn-buy{border:none;background-color:var(--covet-pics-button-color);color:var(--covet-pics-button-text-color);font-family:inherit;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:100%;text-transform:uppercase;text-align:center;cursor:pointer;font-size:14px;line-height:1;padding:17px 17px max(17px, env(safe-area-inset-bottom, 25px)) 17px;margin-bottom:0}.btn-buy:hover,.btn-buy:active,.btn-buy:focus{background-color:var(--covet-pics-button-hover-color)}.btn-buy.style-1:hover,.btn-buy.style-1:active,.btn-buy.style-1:focus{background-color:var(--covet-pics-button-text-hover-color)}.btn-buy.style-2:hover,.btn-buy.style-2:active,.btn-buy.style-2:focus{background-color:var(--covet-pics-button-color);color:var(--covet-pics-button-text-hover-color)}.btn-buy:disabled{background:#EEEEEE;color:#808080;pointer-events:none}.options{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;border:1px solid transparent;border-bottom-color:#EEE;height:48px;padding:0 8px 0 12px;-moz-text-align-last:right;text-align-last:right;font-weight:300;color:var(--covet-pics-font-color);position:relative;cursor:pointer;outline:none !important;-webkit-transition:border 0.25s ease;transition:border 0.25s ease}.options.opened{border-left:1px solid #EEE;border-right:1px solid #EEE}.options.opened .options-container{display:block}.options:hover,.options:active,.options:focus,.options:focus-within{border-bottom-color:#000000}.options label{width:100%;height:100%;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;outline:none !important}.options label .option-name{margin:auto 0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer}.options label .selected-option{margin:auto 0;border:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cpath d='M0 0h24v24H0z'%3E%3C/path%3E%3Cpath stroke='%23A0A0A0' d='M16.95 10.25L12 15.2l-4.95-4.95'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");background-repeat:no-repeat;background-position:right 50%;background-size:24px;padding-right:26px;text-transform:uppercase;text-align:right;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:50%;font-family:inherit;cursor:pointer;font-weight:bold}.options label .selected-option.empty{height:16px;line-height:1rem;width:20%}.options .options-container{display:none;position:absolute;top:48px;left:-1px;background:#FFF;z-index:2;width:100%;border:1px solid #eee;border-top:0;max-height:114px;overflow:auto;cursor:pointer}.options .options-container .option-value{min-height:32px;font-size:12px;color:#101010;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;outline:none !important}.options .options-container .option-value.selected .selected-indic{height:24px;border-left:2px solid #101010}.options .options-container .option-value .value-text{margin-left:4px;margin-right:4px;padding:0 10px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;width:100%;font-size:12px;min-height:32px}.options .options-container .option-value:hover .value-text,.options .options-container .option-value:active .value-text,.options .options-container .option-value:focus .value-text{background:#F7F7F7}.main-gallery{overflow:hidden;width:100%}.main-gallery .swiper-slide{width:200px;height:200px;-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}.main-gallery .swiper-slide img{max-width:100%;max-height:100%}.main-gallery .swiper-wrapper{max-height:200px}.footer{background-color:var(--covet-pics-background-color);position:absolute;width:100%;bottom:0;z-index:1}.footer .price-wrap{padding:0 var(--covet-pics-padding-size);width:calc(100% - var(--covet-pics-padding-size) * 2)}.swiper-pagination-bullets{padding:10px 0;border-bottom:1px solid var(--covet-pics-font-color);display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}.swiper-pagination-bullet{width:8px;height:8px;display:inline-block;-ms-flex:none;flex:none;border-radius:100%;background:var(--covet-pics-font-color);opacity:0.2;margin:0 4px;padding:0;-webkit-transition:all 0.3;transition:all 0.3}.swiper-pagination-bullet:hover,.swiper-pagination-bullet:active,.swiper-pagination-bullet:focus{opacity:0.4;cursor:pointer}.swiper-pagination-bullet.swiper-pagination-bullet-active{opacity:1;background:var(--covet-pics-font-color)}@media only screen and (min-width: 800px){:host{display:block;height:100%;z-index:1;position:absolute;left:0;top:0;right:0;bottom:0;overflow:hidden}.title{width:100%;padding-left:10px}.close{left:calc(var(--covet-pics-button-size) / -2);right:unset;-webkit-transform:unset;transform:unset}.wrap{height:100%;overflow:auto}.footer{position:absolute}}";
17
+
18
+ const CovetPicsDirectBuy = class {
19
+ constructor(hostRef) {
20
+ index.registerInstance(this, hostRef);
21
+ this.hostClickHandler = () => {
22
+ this.el.shadowRoot.querySelectorAll(".options.opened").forEach(option => option.classList.remove("opened"));
23
+ };
24
+ this.optionLabelClickHandler = (event) => {
25
+ if (event.type === "keydown" && event.keyCode !== 13 && event.keyCode !== 32)
26
+ return false;
27
+ const clickedOption = event.target.closest(".options");
28
+ if (clickedOption.classList.contains("opened")) {
29
+ return;
30
+ }
31
+ setTimeout(() => { clickedOption.classList.add("opened"); }, 50);
32
+ };
33
+ this.selectVariantHandler = (event) => {
34
+ if (event.type === "keydown" && event.keyCode !== 13 && event.keyCode !== 32)
35
+ return false;
36
+ const option = event.target.closest(".options");
37
+ const selectedOptionValue = event.target.closest(".option-value");
38
+ this.updateSelectedOptions(option.id, selectedOptionValue.dataset.value);
39
+ option.querySelector("label .selected-option").innerHTML = selectedOptionValue.dataset.value;
40
+ // graphically select the option
41
+ option.querySelectorAll(".option-value.selected").forEach(value => value.classList.remove("selected"));
42
+ selectedOptionValue.classList.add("selected");
43
+ if (event.type === "keydown" && (event.keyCode === 13 || event.keyCode === 32))
44
+ this.hostClickHandler();
45
+ this.selectFeaturedImage();
46
+ };
47
+ this.closeClickHandler = (event) => {
48
+ event.preventDefault();
49
+ event.stopPropagation();
50
+ this.appStore.dispatch(popup.setPopupProductId(-1));
51
+ };
52
+ this.addToCartClickHandler = (event) => {
53
+ event.preventDefault();
54
+ event.stopPropagation();
55
+ if (this.appState.preview.mode) {
56
+ alert("Adding to cart is disabled in preview mode"); // eslint-disable-line no-alert
57
+ return false;
58
+ }
59
+ const cartData = {
60
+ items: [
61
+ {
62
+ quantity: 1,
63
+ id: this.selectedVariant.id,
64
+ }
65
+ ]
66
+ };
67
+ fetch("/cart/add", {
68
+ method: "POST",
69
+ credentials: "same-origin",
70
+ headers: {
71
+ "Content-Type": "application/json",
72
+ "Accept": "application/json"
73
+ },
74
+ body: JSON.stringify(cartData)
75
+ }).then(data => {
76
+ if (data.status >= 200 && data.status < 400) {
77
+ // TODO add this logic need await response fetch
78
+ this.appStore.dispatch(popup.setPopupProductId(-1));
79
+ this.emitAddToCartEvent();
80
+ }
81
+ });
82
+ };
83
+ this.product = undefined;
84
+ this.moneyFormat = "{{amount}}";
85
+ this.appStore = undefined;
86
+ this.selectedOptions = { option1: null, option2: null, option3: null };
87
+ this.settings = undefined;
88
+ }
89
+ componentWillLoad() {
90
+ this.initStore();
91
+ this.setSingleSelectedValues();
92
+ }
93
+ componentDidLoad() {
94
+ this.initSwiper();
95
+ const closeBtn = this.el.shadowRoot.querySelector(".close");
96
+ closeBtn.focus();
97
+ }
98
+ componentDidUpdate() {
99
+ // TODO check do we need this update in componentDidUpdate
100
+ if (this.mainGallery) {
101
+ this.mainGallery.update();
102
+ }
103
+ }
104
+ disconnectedCallback() {
105
+ this.unsubscribe();
106
+ }
107
+ initStore() {
108
+ this.appState = this.appStore.getState();
109
+ this.settings = this.appState.settings;
110
+ this.unsubscribe = this.appStore.subscribe(() => {
111
+ this.appState = this.appStore.getState();
112
+ this.settings = this.appState.settings;
113
+ });
114
+ }
115
+ setSingleSelectedValues() {
116
+ if (this.product.options && this.product.options.length > 0) {
117
+ this.product.options.forEach((option, index) => this.updateSelectedOptions(`option${index + 1}`, option.values[0]));
118
+ }
119
+ }
120
+ get productId() {
121
+ if (typeof this.product !== "undefined") {
122
+ return this.product.id.toString();
123
+ }
124
+ }
125
+ get selectedVariant() {
126
+ return this.product.variants.find(variant => {
127
+ return Object.keys(this.selectedOptions).every(key => this.selectedOptions[key] === variant[key]);
128
+ });
129
+ }
130
+ get price() {
131
+ if (typeof this.selectedVariant !== "undefined") {
132
+ return utils.formatMoney(this.selectedVariant.price, this.moneyFormat, false);
133
+ }
134
+ else {
135
+ return utils.formatMoney(this.product.price, this.moneyFormat, false);
136
+ }
137
+ }
138
+ get itemCSSVariables() {
139
+ return {
140
+ "--covet-pics-button-color": this.settings.popup_buy_button_background_color,
141
+ "--covet-pics-button-hover-color": this.settings.popup_buy_button_background_hover_color,
142
+ "--covet-pics-button-text-color": this.settings.popup_buy_button_text_color,
143
+ "--covet-pics-button-text-hover-color": this.settings.popup_buy_button_text_hover_color
144
+ };
145
+ }
146
+ initSwiper() {
147
+ // TODO add exception for slides length == 1
148
+ const galleryMainEl = this.el.shadowRoot.querySelector(".main-gallery");
149
+ const paginationEl = this.el.shadowRoot.querySelector(".swiper-pagination");
150
+ return this.mainGallery = new a11y.Swiper(galleryMainEl, {
151
+ modules: [a11y.Pagination, a11y.A11y],
152
+ on: {
153
+ init: (e) => slider.swiperUpdateTabIndex(e),
154
+ update: (e) => slider.swiperUpdateTabIndex(e),
155
+ realIndexChange: (e) => slider.swiperUpdateTabIndex(e)
156
+ },
157
+ pagination: {
158
+ el: paginationEl,
159
+ modifierClass: "swiper-pagination-",
160
+ clickable: true,
161
+ },
162
+ a11y: {
163
+ enabled: true,
164
+ containerMessage: "Product images slider",
165
+ containerRoleDescriptionMessage: "Product images slider inside popup",
166
+ paginationBulletMessage: "Go to product image #{{index}}",
167
+ slideRole: "group",
168
+ slideLabelMessage: "Product image {{index}}/{{slidesLength}}"
169
+ },
170
+ });
171
+ }
172
+ renderOptions(optionData, optionNumber) {
173
+ if (optionData && optionData.values.length > 1) {
174
+ return (
175
+ // TODO switch to native html select
176
+ index.h("div", { class: "options", id: `option${optionNumber}` }, index.h("label", { onClick: this.optionLabelClickHandler, onKeyDown: this.optionLabelClickHandler, tabindex: "0" }, index.h("span", { class: "option-name", title: optionData["name"] }, optionData["name"]), index.h("span", { class: { "selected-option": true, "empty": this.settings.select_label_caption === "" } }, this.settings.select_label_caption)), index.h("div", { class: "options-container" }, optionData.values.map((option) => index.h("div", { class: "option-value", "data-value": option, onClick: this.selectVariantHandler, onKeyDown: this.selectVariantHandler, tabindex: "0" }, index.h("div", { class: "selected-indic" }), index.h("div", { class: "value-text", innerHTML: option, title: option }))))));
177
+ }
178
+ }
179
+ updateSelectedOptions(key, value) {
180
+ const updated = {};
181
+ updated[key] = value;
182
+ this.selectedOptions = Object.assign(Object.assign({}, this.selectedOptions), updated);
183
+ }
184
+ emitAddToCartEvent() {
185
+ const customEvent = utils.buildEvent("addToCart:covetPics", {
186
+ productId: this.productId,
187
+ variantId: this.selectedVariant.id,
188
+ });
189
+ document.dispatchEvent(customEvent);
190
+ }
191
+ selectFeaturedImage() {
192
+ if (this.selectedVariant && this.selectedVariant.featured_image) {
193
+ this.mainGallery.slides.forEach((slide, index) => {
194
+ if (slide.querySelector("img").src === this.selectedVariant.featured_image.src) {
195
+ this.mainGallery.slideTo(index);
196
+ }
197
+ });
198
+ }
199
+ }
200
+ imgAltTag(caption, idx, itemsLength) {
201
+ return caption && caption.length > 0
202
+ ? `${caption} product slide ${idx} of ${itemsLength}`
203
+ : `product slide ${idx} of ${itemsLength}`;
204
+ }
205
+ render() {
206
+ return (index.h(index.Host, { style: this.itemCSSVariables, onclick: this.hostClickHandler }, index.h("div", { class: "wrap" }, index.h("div", { class: "main" }, index.h("button", { class: "close", onClick: this.closeClickHandler, tabindex: "0", "aria-label": "Direct buy close", type: "button" }, index.h("svg", { viewBox: "0 0 40 40", role: "img" }, index.h("title", null, "close"), index.h("g", { fill: "none", "fill-rule": "evenodd" }, index.h("path", { d: "M40 0v40H0V0z" }), index.h("path", { class: "icon-arrow-path", stroke: "#A0A0A0", d: "M22.917 28.25L14.667 20l8.25-8.25" })))), index.h("h2", { class: "title" }, index.h("a", { href: this.product.link, target: "_blank", "aria-label": `Link to '${this.product.title}'` }, this.product.title)), index.h("section", { class: "main-gallery", role: "region", "aria-label": "direct buy slider" }, index.h("div", { class: "swiper-wrapper" }, this.product.media && this.product.media.map(image => index.h("div", { class: "swiper-slide" }, index.h("img", { alt: this.imgAltTag(image.alt, image.position, this.product.media.length), src: image.src })))), index.h("div", { class: "swiper-pagination" })), this.renderOptions(this.product.options[0], 1), this.renderOptions(this.product.options[1], 2), this.renderOptions(this.product.options[2], 3)), index.h("div", { class: "footer" }, index.h("div", { class: "price-wrap" }, index.h("label", null, this.settings.price_label_caption), index.h("span", { class: "price", innerHTML: this.price })), index.h("button", { class: `btn-buy ${this.settings._buyButtonStyle}`, disabled: typeof this.selectedVariant === "undefined" || this.selectedVariant["available"] === false, onClick: this.addToCartClickHandler, innerHTML: this.settings.add_to_cart_button_caption, "aria-label": "Add to cart", type: "button" })))));
207
+ }
208
+ get el() { return index.getElement(this); }
209
+ };
210
+ CovetPicsDirectBuy.style = covetPicsDirectBuyCss;
211
+
212
+ var top = 'top';
213
+ var bottom = 'bottom';
214
+ var right = 'right';
215
+ var left = 'left';
216
+ var auto = 'auto';
217
+ var basePlacements = [top, bottom, right, left];
218
+ var start = 'start';
219
+ var end = 'end';
220
+ var clippingParents = 'clippingParents';
221
+ var viewport = 'viewport';
222
+ var popper = 'popper';
223
+ var reference = 'reference';
224
+ var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
225
+ return acc.concat([placement + "-" + start, placement + "-" + end]);
226
+ }, []);
227
+ var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
228
+ return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
229
+ }, []); // modifiers that need to read the DOM
230
+
231
+ var beforeRead = 'beforeRead';
232
+ var read = 'read';
233
+ var afterRead = 'afterRead'; // pure-logic modifiers
234
+
235
+ var beforeMain = 'beforeMain';
236
+ var main = 'main';
237
+ var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
238
+
239
+ var beforeWrite = 'beforeWrite';
240
+ var write = 'write';
241
+ var afterWrite = 'afterWrite';
242
+ var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
243
+
244
+ function getNodeName(element) {
245
+ return element ? (element.nodeName || '').toLowerCase() : null;
246
+ }
247
+
248
+ function getWindow(node) {
249
+ if (node == null) {
250
+ return window;
251
+ }
252
+
253
+ if (node.toString() !== '[object Window]') {
254
+ var ownerDocument = node.ownerDocument;
255
+ return ownerDocument ? ownerDocument.defaultView || window : window;
256
+ }
257
+
258
+ return node;
259
+ }
260
+
261
+ function isElement$1(node) {
262
+ var OwnElement = getWindow(node).Element;
263
+ return node instanceof OwnElement || node instanceof Element;
264
+ }
265
+
266
+ function isHTMLElement(node) {
267
+ var OwnElement = getWindow(node).HTMLElement;
268
+ return node instanceof OwnElement || node instanceof HTMLElement;
269
+ }
270
+
271
+ function isShadowRoot(node) {
272
+ // IE 11 has no ShadowRoot
273
+ if (typeof ShadowRoot === 'undefined') {
274
+ return false;
275
+ }
276
+
277
+ var OwnElement = getWindow(node).ShadowRoot;
278
+ return node instanceof OwnElement || node instanceof ShadowRoot;
279
+ }
280
+
281
+ // and applies them to the HTMLElements such as popper and arrow
282
+
283
+ function applyStyles(_ref) {
284
+ var state = _ref.state;
285
+ Object.keys(state.elements).forEach(function (name) {
286
+ var style = state.styles[name] || {};
287
+ var attributes = state.attributes[name] || {};
288
+ var element = state.elements[name]; // arrow is optional + virtual elements
289
+
290
+ if (!isHTMLElement(element) || !getNodeName(element)) {
291
+ return;
292
+ } // Flow doesn't support to extend this property, but it's the most
293
+ // effective way to apply styles to an HTMLElement
294
+ // $FlowFixMe[cannot-write]
295
+
296
+
297
+ Object.assign(element.style, style);
298
+ Object.keys(attributes).forEach(function (name) {
299
+ var value = attributes[name];
300
+
301
+ if (value === false) {
302
+ element.removeAttribute(name);
303
+ } else {
304
+ element.setAttribute(name, value === true ? '' : value);
305
+ }
306
+ });
307
+ });
308
+ }
309
+
310
+ function effect$2(_ref2) {
311
+ var state = _ref2.state;
312
+ var initialStyles = {
313
+ popper: {
314
+ position: state.options.strategy,
315
+ left: '0',
316
+ top: '0',
317
+ margin: '0'
318
+ },
319
+ arrow: {
320
+ position: 'absolute'
321
+ },
322
+ reference: {}
323
+ };
324
+ Object.assign(state.elements.popper.style, initialStyles.popper);
325
+ state.styles = initialStyles;
326
+
327
+ if (state.elements.arrow) {
328
+ Object.assign(state.elements.arrow.style, initialStyles.arrow);
329
+ }
330
+
331
+ return function () {
332
+ Object.keys(state.elements).forEach(function (name) {
333
+ var element = state.elements[name];
334
+ var attributes = state.attributes[name] || {};
335
+ var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them
336
+
337
+ var style = styleProperties.reduce(function (style, property) {
338
+ style[property] = '';
339
+ return style;
340
+ }, {}); // arrow is optional + virtual elements
341
+
342
+ if (!isHTMLElement(element) || !getNodeName(element)) {
343
+ return;
344
+ }
345
+
346
+ Object.assign(element.style, style);
347
+ Object.keys(attributes).forEach(function (attribute) {
348
+ element.removeAttribute(attribute);
349
+ });
350
+ });
351
+ };
352
+ } // eslint-disable-next-line import/no-unused-modules
353
+
354
+
355
+ const applyStyles$1 = {
356
+ name: 'applyStyles',
357
+ enabled: true,
358
+ phase: 'write',
359
+ fn: applyStyles,
360
+ effect: effect$2,
361
+ requires: ['computeStyles']
362
+ };
363
+
364
+ function getBasePlacement$1(placement) {
365
+ return placement.split('-')[0];
366
+ }
367
+
368
+ var max = Math.max;
369
+ var min = Math.min;
370
+ var round = Math.round;
371
+
372
+ function getBoundingClientRect(element, includeScale) {
373
+ if (includeScale === void 0) {
374
+ includeScale = false;
375
+ }
376
+
377
+ var rect = element.getBoundingClientRect();
378
+ var scaleX = 1;
379
+ var scaleY = 1;
380
+
381
+ if (isHTMLElement(element) && includeScale) {
382
+ var offsetHeight = element.offsetHeight;
383
+ var offsetWidth = element.offsetWidth; // Do not attempt to divide by 0, otherwise we get `Infinity` as scale
384
+ // Fallback to 1 in case both values are `0`
385
+
386
+ if (offsetWidth > 0) {
387
+ scaleX = round(rect.width) / offsetWidth || 1;
388
+ }
389
+
390
+ if (offsetHeight > 0) {
391
+ scaleY = round(rect.height) / offsetHeight || 1;
392
+ }
393
+ }
394
+
395
+ return {
396
+ width: rect.width / scaleX,
397
+ height: rect.height / scaleY,
398
+ top: rect.top / scaleY,
399
+ right: rect.right / scaleX,
400
+ bottom: rect.bottom / scaleY,
401
+ left: rect.left / scaleX,
402
+ x: rect.left / scaleX,
403
+ y: rect.top / scaleY
404
+ };
405
+ }
406
+
407
+ // means it doesn't take into account transforms.
408
+
409
+ function getLayoutRect(element) {
410
+ var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
411
+ // Fixes https://github.com/popperjs/popper-core/issues/1223
412
+
413
+ var width = element.offsetWidth;
414
+ var height = element.offsetHeight;
415
+
416
+ if (Math.abs(clientRect.width - width) <= 1) {
417
+ width = clientRect.width;
418
+ }
419
+
420
+ if (Math.abs(clientRect.height - height) <= 1) {
421
+ height = clientRect.height;
422
+ }
423
+
424
+ return {
425
+ x: element.offsetLeft,
426
+ y: element.offsetTop,
427
+ width: width,
428
+ height: height
429
+ };
430
+ }
431
+
432
+ function contains(parent, child) {
433
+ var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
434
+
435
+ if (parent.contains(child)) {
436
+ return true;
437
+ } // then fallback to custom implementation with Shadow DOM support
438
+ else if (rootNode && isShadowRoot(rootNode)) {
439
+ var next = child;
440
+
441
+ do {
442
+ if (next && parent.isSameNode(next)) {
443
+ return true;
444
+ } // $FlowFixMe[prop-missing]: need a better way to handle this...
445
+
446
+
447
+ next = next.parentNode || next.host;
448
+ } while (next);
449
+ } // Give up, the result is false
450
+
451
+
452
+ return false;
453
+ }
454
+
455
+ function getComputedStyle(element) {
456
+ return getWindow(element).getComputedStyle(element);
457
+ }
458
+
459
+ function isTableElement(element) {
460
+ return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
461
+ }
462
+
463
+ function getDocumentElement(element) {
464
+ // $FlowFixMe[incompatible-return]: assume body is always available
465
+ return ((isElement$1(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
466
+ element.document) || window.document).documentElement;
467
+ }
468
+
469
+ function getParentNode(element) {
470
+ if (getNodeName(element) === 'html') {
471
+ return element;
472
+ }
473
+
474
+ return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
475
+ // $FlowFixMe[incompatible-return]
476
+ // $FlowFixMe[prop-missing]
477
+ element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
478
+ element.parentNode || ( // DOM Element detected
479
+ isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
480
+ // $FlowFixMe[incompatible-call]: HTMLElement is a Node
481
+ getDocumentElement(element) // fallback
482
+
483
+ );
484
+ }
485
+
486
+ function getTrueOffsetParent(element) {
487
+ if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
488
+ getComputedStyle(element).position === 'fixed') {
489
+ return null;
490
+ }
491
+
492
+ return element.offsetParent;
493
+ } // `.offsetParent` reports `null` for fixed elements, while absolute elements
494
+ // return the containing block
495
+
496
+
497
+ function getContainingBlock(element) {
498
+ var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1;
499
+ var isIE = navigator.userAgent.indexOf('Trident') !== -1;
500
+
501
+ if (isIE && isHTMLElement(element)) {
502
+ // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
503
+ var elementCss = getComputedStyle(element);
504
+
505
+ if (elementCss.position === 'fixed') {
506
+ return null;
507
+ }
508
+ }
509
+
510
+ var currentNode = getParentNode(element);
511
+
512
+ while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
513
+ var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
514
+ // create a containing block.
515
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
516
+
517
+ 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') {
518
+ return currentNode;
519
+ } else {
520
+ currentNode = currentNode.parentNode;
521
+ }
522
+ }
523
+
524
+ return null;
525
+ } // Gets the closest ancestor positioned element. Handles some edge cases,
526
+ // such as table ancestors and cross browser bugs.
527
+
528
+
529
+ function getOffsetParent(element) {
530
+ var window = getWindow(element);
531
+ var offsetParent = getTrueOffsetParent(element);
532
+
533
+ while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
534
+ offsetParent = getTrueOffsetParent(offsetParent);
535
+ }
536
+
537
+ if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {
538
+ return window;
539
+ }
540
+
541
+ return offsetParent || getContainingBlock(element) || window;
542
+ }
543
+
544
+ function getMainAxisFromPlacement(placement) {
545
+ return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
546
+ }
547
+
548
+ function within(min$1, value, max$1) {
549
+ return max(min$1, min(value, max$1));
550
+ }
551
+ function withinMaxClamp(min, value, max) {
552
+ var v = within(min, value, max);
553
+ return v > max ? max : v;
554
+ }
555
+
556
+ function getFreshSideObject() {
557
+ return {
558
+ top: 0,
559
+ right: 0,
560
+ bottom: 0,
561
+ left: 0
562
+ };
563
+ }
564
+
565
+ function mergePaddingObject(paddingObject) {
566
+ return Object.assign({}, getFreshSideObject(), paddingObject);
567
+ }
568
+
569
+ function expandToHashMap(value, keys) {
570
+ return keys.reduce(function (hashMap, key) {
571
+ hashMap[key] = value;
572
+ return hashMap;
573
+ }, {});
574
+ }
575
+
576
+ var toPaddingObject = function toPaddingObject(padding, state) {
577
+ padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {
578
+ placement: state.placement
579
+ })) : padding;
580
+ return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
581
+ };
582
+
583
+ function arrow(_ref) {
584
+ var _state$modifiersData$;
585
+
586
+ var state = _ref.state,
587
+ name = _ref.name,
588
+ options = _ref.options;
589
+ var arrowElement = state.elements.arrow;
590
+ var popperOffsets = state.modifiersData.popperOffsets;
591
+ var basePlacement = getBasePlacement$1(state.placement);
592
+ var axis = getMainAxisFromPlacement(basePlacement);
593
+ var isVertical = [left, right].indexOf(basePlacement) >= 0;
594
+ var len = isVertical ? 'height' : 'width';
595
+
596
+ if (!arrowElement || !popperOffsets) {
597
+ return;
598
+ }
599
+
600
+ var paddingObject = toPaddingObject(options.padding, state);
601
+ var arrowRect = getLayoutRect(arrowElement);
602
+ var minProp = axis === 'y' ? top : left;
603
+ var maxProp = axis === 'y' ? bottom : right;
604
+ var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];
605
+ var startDiff = popperOffsets[axis] - state.rects.reference[axis];
606
+ var arrowOffsetParent = getOffsetParent(arrowElement);
607
+ var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
608
+ var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is
609
+ // outside of the popper bounds
610
+
611
+ var min = paddingObject[minProp];
612
+ var max = clientSize - arrowRect[len] - paddingObject[maxProp];
613
+ var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
614
+ var offset = within(min, center, max); // Prevents breaking syntax highlighting...
615
+
616
+ var axisProp = axis;
617
+ state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);
618
+ }
619
+
620
+ function effect$1(_ref2) {
621
+ var state = _ref2.state,
622
+ options = _ref2.options;
623
+ var _options$element = options.element,
624
+ arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;
625
+
626
+ if (arrowElement == null) {
627
+ return;
628
+ } // CSS selector
629
+
630
+
631
+ if (typeof arrowElement === 'string') {
632
+ arrowElement = state.elements.popper.querySelector(arrowElement);
633
+
634
+ if (!arrowElement) {
635
+ return;
636
+ }
637
+ }
638
+
639
+ if (!contains(state.elements.popper, arrowElement)) {
640
+
641
+ return;
642
+ }
643
+
644
+ state.elements.arrow = arrowElement;
645
+ } // eslint-disable-next-line import/no-unused-modules
646
+
647
+
648
+ const arrow$1 = {
649
+ name: 'arrow',
650
+ enabled: true,
651
+ phase: 'main',
652
+ fn: arrow,
653
+ effect: effect$1,
654
+ requires: ['popperOffsets'],
655
+ requiresIfExists: ['preventOverflow']
656
+ };
657
+
658
+ function getVariation(placement) {
659
+ return placement.split('-')[1];
660
+ }
661
+
662
+ var unsetSides = {
663
+ top: 'auto',
664
+ right: 'auto',
665
+ bottom: 'auto',
666
+ left: 'auto'
667
+ }; // Round the offsets to the nearest suitable subpixel based on the DPR.
668
+ // Zooming can change the DPR, but it seems to report a value that will
669
+ // cleanly divide the values into the appropriate subpixels.
670
+
671
+ function roundOffsetsByDPR(_ref) {
672
+ var x = _ref.x,
673
+ y = _ref.y;
674
+ var win = window;
675
+ var dpr = win.devicePixelRatio || 1;
676
+ return {
677
+ x: round(x * dpr) / dpr || 0,
678
+ y: round(y * dpr) / dpr || 0
679
+ };
680
+ }
681
+
682
+ function mapToStyles(_ref2) {
683
+ var _Object$assign2;
684
+
685
+ var popper = _ref2.popper,
686
+ popperRect = _ref2.popperRect,
687
+ placement = _ref2.placement,
688
+ variation = _ref2.variation,
689
+ offsets = _ref2.offsets,
690
+ position = _ref2.position,
691
+ gpuAcceleration = _ref2.gpuAcceleration,
692
+ adaptive = _ref2.adaptive,
693
+ roundOffsets = _ref2.roundOffsets,
694
+ isFixed = _ref2.isFixed;
695
+ var _offsets$x = offsets.x,
696
+ x = _offsets$x === void 0 ? 0 : _offsets$x,
697
+ _offsets$y = offsets.y,
698
+ y = _offsets$y === void 0 ? 0 : _offsets$y;
699
+
700
+ var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({
701
+ x: x,
702
+ y: y
703
+ }) : {
704
+ x: x,
705
+ y: y
706
+ };
707
+
708
+ x = _ref3.x;
709
+ y = _ref3.y;
710
+ var hasX = offsets.hasOwnProperty('x');
711
+ var hasY = offsets.hasOwnProperty('y');
712
+ var sideX = left;
713
+ var sideY = top;
714
+ var win = window;
715
+
716
+ if (adaptive) {
717
+ var offsetParent = getOffsetParent(popper);
718
+ var heightProp = 'clientHeight';
719
+ var widthProp = 'clientWidth';
720
+
721
+ if (offsetParent === getWindow(popper)) {
722
+ offsetParent = getDocumentElement(popper);
723
+
724
+ if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {
725
+ heightProp = 'scrollHeight';
726
+ widthProp = 'scrollWidth';
727
+ }
728
+ } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
729
+
730
+
731
+ offsetParent = offsetParent;
732
+
733
+ if (placement === top || (placement === left || placement === right) && variation === end) {
734
+ sideY = bottom;
735
+ var offsetY = isFixed && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
736
+ offsetParent[heightProp];
737
+ y -= offsetY - popperRect.height;
738
+ y *= gpuAcceleration ? 1 : -1;
739
+ }
740
+
741
+ if (placement === left || (placement === top || placement === bottom) && variation === end) {
742
+ sideX = right;
743
+ var offsetX = isFixed && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
744
+ offsetParent[widthProp];
745
+ x -= offsetX - popperRect.width;
746
+ x *= gpuAcceleration ? 1 : -1;
747
+ }
748
+ }
749
+
750
+ var commonStyles = Object.assign({
751
+ position: position
752
+ }, adaptive && unsetSides);
753
+
754
+ var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
755
+ x: x,
756
+ y: y
757
+ }) : {
758
+ x: x,
759
+ y: y
760
+ };
761
+
762
+ x = _ref4.x;
763
+ y = _ref4.y;
764
+
765
+ if (gpuAcceleration) {
766
+ var _Object$assign;
767
+
768
+ 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));
769
+ }
770
+
771
+ return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
772
+ }
773
+
774
+ function computeStyles(_ref5) {
775
+ var state = _ref5.state,
776
+ options = _ref5.options;
777
+ var _options$gpuAccelerat = options.gpuAcceleration,
778
+ gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
779
+ _options$adaptive = options.adaptive,
780
+ adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
781
+ _options$roundOffsets = options.roundOffsets,
782
+ roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
783
+
784
+ var commonStyles = {
785
+ placement: getBasePlacement$1(state.placement),
786
+ variation: getVariation(state.placement),
787
+ popper: state.elements.popper,
788
+ popperRect: state.rects.popper,
789
+ gpuAcceleration: gpuAcceleration,
790
+ isFixed: state.options.strategy === 'fixed'
791
+ };
792
+
793
+ if (state.modifiersData.popperOffsets != null) {
794
+ state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
795
+ offsets: state.modifiersData.popperOffsets,
796
+ position: state.options.strategy,
797
+ adaptive: adaptive,
798
+ roundOffsets: roundOffsets
799
+ })));
800
+ }
801
+
802
+ if (state.modifiersData.arrow != null) {
803
+ state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
804
+ offsets: state.modifiersData.arrow,
805
+ position: 'absolute',
806
+ adaptive: false,
807
+ roundOffsets: roundOffsets
808
+ })));
809
+ }
810
+
811
+ state.attributes.popper = Object.assign({}, state.attributes.popper, {
812
+ 'data-popper-placement': state.placement
813
+ });
814
+ } // eslint-disable-next-line import/no-unused-modules
815
+
816
+
817
+ const computeStyles$1 = {
818
+ name: 'computeStyles',
819
+ enabled: true,
820
+ phase: 'beforeWrite',
821
+ fn: computeStyles,
822
+ data: {}
823
+ };
824
+
825
+ var passive = {
826
+ passive: true
827
+ };
828
+
829
+ function effect(_ref) {
830
+ var state = _ref.state,
831
+ instance = _ref.instance,
832
+ options = _ref.options;
833
+ var _options$scroll = options.scroll,
834
+ scroll = _options$scroll === void 0 ? true : _options$scroll,
835
+ _options$resize = options.resize,
836
+ resize = _options$resize === void 0 ? true : _options$resize;
837
+ var window = getWindow(state.elements.popper);
838
+ var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
839
+
840
+ if (scroll) {
841
+ scrollParents.forEach(function (scrollParent) {
842
+ scrollParent.addEventListener('scroll', instance.update, passive);
843
+ });
844
+ }
845
+
846
+ if (resize) {
847
+ window.addEventListener('resize', instance.update, passive);
848
+ }
849
+
850
+ return function () {
851
+ if (scroll) {
852
+ scrollParents.forEach(function (scrollParent) {
853
+ scrollParent.removeEventListener('scroll', instance.update, passive);
854
+ });
855
+ }
856
+
857
+ if (resize) {
858
+ window.removeEventListener('resize', instance.update, passive);
859
+ }
860
+ };
861
+ } // eslint-disable-next-line import/no-unused-modules
862
+
863
+
864
+ const eventListeners = {
865
+ name: 'eventListeners',
866
+ enabled: true,
867
+ phase: 'write',
868
+ fn: function fn() {},
869
+ effect: effect,
870
+ data: {}
871
+ };
872
+
873
+ var hash$1 = {
874
+ left: 'right',
875
+ right: 'left',
876
+ bottom: 'top',
877
+ top: 'bottom'
878
+ };
879
+ function getOppositePlacement(placement) {
880
+ return placement.replace(/left|right|bottom|top/g, function (matched) {
881
+ return hash$1[matched];
882
+ });
883
+ }
884
+
885
+ var hash = {
886
+ start: 'end',
887
+ end: 'start'
888
+ };
889
+ function getOppositeVariationPlacement(placement) {
890
+ return placement.replace(/start|end/g, function (matched) {
891
+ return hash[matched];
892
+ });
893
+ }
894
+
895
+ function getWindowScroll(node) {
896
+ var win = getWindow(node);
897
+ var scrollLeft = win.pageXOffset;
898
+ var scrollTop = win.pageYOffset;
899
+ return {
900
+ scrollLeft: scrollLeft,
901
+ scrollTop: scrollTop
902
+ };
903
+ }
904
+
905
+ function getWindowScrollBarX(element) {
906
+ // If <html> has a CSS width greater than the viewport, then this will be
907
+ // incorrect for RTL.
908
+ // Popper 1 is broken in this case and never had a bug report so let's assume
909
+ // it's not an issue. I don't think anyone ever specifies width on <html>
910
+ // anyway.
911
+ // Browsers where the left scrollbar doesn't cause an issue report `0` for
912
+ // this (e.g. Edge 2019, IE11, Safari)
913
+ return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
914
+ }
915
+
916
+ function getViewportRect(element) {
917
+ var win = getWindow(element);
918
+ var html = getDocumentElement(element);
919
+ var visualViewport = win.visualViewport;
920
+ var width = html.clientWidth;
921
+ var height = html.clientHeight;
922
+ var x = 0;
923
+ var y = 0; // NB: This isn't supported on iOS <= 12. If the keyboard is open, the popper
924
+ // can be obscured underneath it.
925
+ // Also, `html.clientHeight` adds the bottom bar height in Safari iOS, even
926
+ // if it isn't open, so if this isn't available, the popper will be detected
927
+ // to overflow the bottom of the screen too early.
928
+
929
+ if (visualViewport) {
930
+ width = visualViewport.width;
931
+ height = visualViewport.height; // Uses Layout Viewport (like Chrome; Safari does not currently)
932
+ // In Chrome, it returns a value very close to 0 (+/-) but contains rounding
933
+ // errors due to floating point numbers, so we need to check precision.
934
+ // Safari returns a number <= 0, usually < -1 when pinch-zoomed
935
+ // Feature detection fails in mobile emulation mode in Chrome.
936
+ // Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) <
937
+ // 0.001
938
+ // Fallback here: "Not Safari" userAgent
939
+
940
+ if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
941
+ x = visualViewport.offsetLeft;
942
+ y = visualViewport.offsetTop;
943
+ }
944
+ }
945
+
946
+ return {
947
+ width: width,
948
+ height: height,
949
+ x: x + getWindowScrollBarX(element),
950
+ y: y
951
+ };
952
+ }
953
+
954
+ // of the `<html>` and `<body>` rect bounds if horizontally scrollable
955
+
956
+ function getDocumentRect(element) {
957
+ var _element$ownerDocumen;
958
+
959
+ var html = getDocumentElement(element);
960
+ var winScroll = getWindowScroll(element);
961
+ var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
962
+ var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
963
+ var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
964
+ var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
965
+ var y = -winScroll.scrollTop;
966
+
967
+ if (getComputedStyle(body || html).direction === 'rtl') {
968
+ x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
969
+ }
970
+
971
+ return {
972
+ width: width,
973
+ height: height,
974
+ x: x,
975
+ y: y
976
+ };
977
+ }
978
+
979
+ function isScrollParent(element) {
980
+ // Firefox wants us to check `-x` and `-y` variations as well
981
+ var _getComputedStyle = getComputedStyle(element),
982
+ overflow = _getComputedStyle.overflow,
983
+ overflowX = _getComputedStyle.overflowX,
984
+ overflowY = _getComputedStyle.overflowY;
985
+
986
+ return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
987
+ }
988
+
989
+ function getScrollParent(node) {
990
+ if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
991
+ // $FlowFixMe[incompatible-return]: assume body is always available
992
+ return node.ownerDocument.body;
993
+ }
994
+
995
+ if (isHTMLElement(node) && isScrollParent(node)) {
996
+ return node;
997
+ }
998
+
999
+ return getScrollParent(getParentNode(node));
1000
+ }
1001
+
1002
+ /*
1003
+ given a DOM element, return the list of all scroll parents, up the list of ancesors
1004
+ until we get to the top window object. This list is what we attach scroll listeners
1005
+ to, because if any of these parent elements scroll, we'll need to re-calculate the
1006
+ reference element's position.
1007
+ */
1008
+
1009
+ function listScrollParents(element, list) {
1010
+ var _element$ownerDocumen;
1011
+
1012
+ if (list === void 0) {
1013
+ list = [];
1014
+ }
1015
+
1016
+ var scrollParent = getScrollParent(element);
1017
+ var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
1018
+ var win = getWindow(scrollParent);
1019
+ var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
1020
+ var updatedList = list.concat(target);
1021
+ return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
1022
+ updatedList.concat(listScrollParents(getParentNode(target)));
1023
+ }
1024
+
1025
+ function rectToClientRect(rect) {
1026
+ return Object.assign({}, rect, {
1027
+ left: rect.x,
1028
+ top: rect.y,
1029
+ right: rect.x + rect.width,
1030
+ bottom: rect.y + rect.height
1031
+ });
1032
+ }
1033
+
1034
+ function getInnerBoundingClientRect(element) {
1035
+ var rect = getBoundingClientRect(element);
1036
+ rect.top = rect.top + element.clientTop;
1037
+ rect.left = rect.left + element.clientLeft;
1038
+ rect.bottom = rect.top + element.clientHeight;
1039
+ rect.right = rect.left + element.clientWidth;
1040
+ rect.width = element.clientWidth;
1041
+ rect.height = element.clientHeight;
1042
+ rect.x = rect.left;
1043
+ rect.y = rect.top;
1044
+ return rect;
1045
+ }
1046
+
1047
+ function getClientRectFromMixedType(element, clippingParent) {
1048
+ return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isElement$1(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
1049
+ } // A "clipping parent" is an overflowable container with the characteristic of
1050
+ // clipping (or hiding) overflowing elements with a position different from
1051
+ // `initial`
1052
+
1053
+
1054
+ function getClippingParents(element) {
1055
+ var clippingParents = listScrollParents(getParentNode(element));
1056
+ var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;
1057
+ var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
1058
+
1059
+ if (!isElement$1(clipperElement)) {
1060
+ return [];
1061
+ } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
1062
+
1063
+
1064
+ return clippingParents.filter(function (clippingParent) {
1065
+ return isElement$1(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
1066
+ });
1067
+ } // Gets the maximum area that the element is visible in due to any number of
1068
+ // clipping parents
1069
+
1070
+
1071
+ function getClippingRect(element, boundary, rootBoundary) {
1072
+ var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
1073
+ var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
1074
+ var firstClippingParent = clippingParents[0];
1075
+ var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
1076
+ var rect = getClientRectFromMixedType(element, clippingParent);
1077
+ accRect.top = max(rect.top, accRect.top);
1078
+ accRect.right = min(rect.right, accRect.right);
1079
+ accRect.bottom = min(rect.bottom, accRect.bottom);
1080
+ accRect.left = max(rect.left, accRect.left);
1081
+ return accRect;
1082
+ }, getClientRectFromMixedType(element, firstClippingParent));
1083
+ clippingRect.width = clippingRect.right - clippingRect.left;
1084
+ clippingRect.height = clippingRect.bottom - clippingRect.top;
1085
+ clippingRect.x = clippingRect.left;
1086
+ clippingRect.y = clippingRect.top;
1087
+ return clippingRect;
1088
+ }
1089
+
1090
+ function computeOffsets(_ref) {
1091
+ var reference = _ref.reference,
1092
+ element = _ref.element,
1093
+ placement = _ref.placement;
1094
+ var basePlacement = placement ? getBasePlacement$1(placement) : null;
1095
+ var variation = placement ? getVariation(placement) : null;
1096
+ var commonX = reference.x + reference.width / 2 - element.width / 2;
1097
+ var commonY = reference.y + reference.height / 2 - element.height / 2;
1098
+ var offsets;
1099
+
1100
+ switch (basePlacement) {
1101
+ case top:
1102
+ offsets = {
1103
+ x: commonX,
1104
+ y: reference.y - element.height
1105
+ };
1106
+ break;
1107
+
1108
+ case bottom:
1109
+ offsets = {
1110
+ x: commonX,
1111
+ y: reference.y + reference.height
1112
+ };
1113
+ break;
1114
+
1115
+ case right:
1116
+ offsets = {
1117
+ x: reference.x + reference.width,
1118
+ y: commonY
1119
+ };
1120
+ break;
1121
+
1122
+ case left:
1123
+ offsets = {
1124
+ x: reference.x - element.width,
1125
+ y: commonY
1126
+ };
1127
+ break;
1128
+
1129
+ default:
1130
+ offsets = {
1131
+ x: reference.x,
1132
+ y: reference.y
1133
+ };
1134
+ }
1135
+
1136
+ var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
1137
+
1138
+ if (mainAxis != null) {
1139
+ var len = mainAxis === 'y' ? 'height' : 'width';
1140
+
1141
+ switch (variation) {
1142
+ case start:
1143
+ offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
1144
+ break;
1145
+
1146
+ case end:
1147
+ offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
1148
+ break;
1149
+ }
1150
+ }
1151
+
1152
+ return offsets;
1153
+ }
1154
+
1155
+ function detectOverflow(state, options) {
1156
+ if (options === void 0) {
1157
+ options = {};
1158
+ }
1159
+
1160
+ var _options = options,
1161
+ _options$placement = _options.placement,
1162
+ placement = _options$placement === void 0 ? state.placement : _options$placement,
1163
+ _options$boundary = _options.boundary,
1164
+ boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
1165
+ _options$rootBoundary = _options.rootBoundary,
1166
+ rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,
1167
+ _options$elementConte = _options.elementContext,
1168
+ elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,
1169
+ _options$altBoundary = _options.altBoundary,
1170
+ altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,
1171
+ _options$padding = _options.padding,
1172
+ padding = _options$padding === void 0 ? 0 : _options$padding;
1173
+ var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
1174
+ var altContext = elementContext === popper ? reference : popper;
1175
+ var popperRect = state.rects.popper;
1176
+ var element = state.elements[altBoundary ? altContext : elementContext];
1177
+ var clippingClientRect = getClippingRect(isElement$1(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
1178
+ var referenceClientRect = getBoundingClientRect(state.elements.reference);
1179
+ var popperOffsets = computeOffsets({
1180
+ reference: referenceClientRect,
1181
+ element: popperRect,
1182
+ strategy: 'absolute',
1183
+ placement: placement
1184
+ });
1185
+ var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
1186
+ var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
1187
+ // 0 or negative = within the clipping rect
1188
+
1189
+ var overflowOffsets = {
1190
+ top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
1191
+ bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
1192
+ left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
1193
+ right: elementClientRect.right - clippingClientRect.right + paddingObject.right
1194
+ };
1195
+ var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element
1196
+
1197
+ if (elementContext === popper && offsetData) {
1198
+ var offset = offsetData[placement];
1199
+ Object.keys(overflowOffsets).forEach(function (key) {
1200
+ var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
1201
+ var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';
1202
+ overflowOffsets[key] += offset[axis] * multiply;
1203
+ });
1204
+ }
1205
+
1206
+ return overflowOffsets;
1207
+ }
1208
+
1209
+ function computeAutoPlacement(state, options) {
1210
+ if (options === void 0) {
1211
+ options = {};
1212
+ }
1213
+
1214
+ var _options = options,
1215
+ placement = _options.placement,
1216
+ boundary = _options.boundary,
1217
+ rootBoundary = _options.rootBoundary,
1218
+ padding = _options.padding,
1219
+ flipVariations = _options.flipVariations,
1220
+ _options$allowedAutoP = _options.allowedAutoPlacements,
1221
+ allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
1222
+ var variation = getVariation(placement);
1223
+ var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {
1224
+ return getVariation(placement) === variation;
1225
+ }) : basePlacements;
1226
+ var allowedPlacements = placements$1.filter(function (placement) {
1227
+ return allowedAutoPlacements.indexOf(placement) >= 0;
1228
+ });
1229
+
1230
+ if (allowedPlacements.length === 0) {
1231
+ allowedPlacements = placements$1;
1232
+ } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...
1233
+
1234
+
1235
+ var overflows = allowedPlacements.reduce(function (acc, placement) {
1236
+ acc[placement] = detectOverflow(state, {
1237
+ placement: placement,
1238
+ boundary: boundary,
1239
+ rootBoundary: rootBoundary,
1240
+ padding: padding
1241
+ })[getBasePlacement$1(placement)];
1242
+ return acc;
1243
+ }, {});
1244
+ return Object.keys(overflows).sort(function (a, b) {
1245
+ return overflows[a] - overflows[b];
1246
+ });
1247
+ }
1248
+
1249
+ function getExpandedFallbackPlacements(placement) {
1250
+ if (getBasePlacement$1(placement) === auto) {
1251
+ return [];
1252
+ }
1253
+
1254
+ var oppositePlacement = getOppositePlacement(placement);
1255
+ return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
1256
+ }
1257
+
1258
+ function flip(_ref) {
1259
+ var state = _ref.state,
1260
+ options = _ref.options,
1261
+ name = _ref.name;
1262
+
1263
+ if (state.modifiersData[name]._skip) {
1264
+ return;
1265
+ }
1266
+
1267
+ var _options$mainAxis = options.mainAxis,
1268
+ checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
1269
+ _options$altAxis = options.altAxis,
1270
+ checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,
1271
+ specifiedFallbackPlacements = options.fallbackPlacements,
1272
+ padding = options.padding,
1273
+ boundary = options.boundary,
1274
+ rootBoundary = options.rootBoundary,
1275
+ altBoundary = options.altBoundary,
1276
+ _options$flipVariatio = options.flipVariations,
1277
+ flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,
1278
+ allowedAutoPlacements = options.allowedAutoPlacements;
1279
+ var preferredPlacement = state.options.placement;
1280
+ var basePlacement = getBasePlacement$1(preferredPlacement);
1281
+ var isBasePlacement = basePlacement === preferredPlacement;
1282
+ var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
1283
+ var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {
1284
+ return acc.concat(getBasePlacement$1(placement) === auto ? computeAutoPlacement(state, {
1285
+ placement: placement,
1286
+ boundary: boundary,
1287
+ rootBoundary: rootBoundary,
1288
+ padding: padding,
1289
+ flipVariations: flipVariations,
1290
+ allowedAutoPlacements: allowedAutoPlacements
1291
+ }) : placement);
1292
+ }, []);
1293
+ var referenceRect = state.rects.reference;
1294
+ var popperRect = state.rects.popper;
1295
+ var checksMap = new Map();
1296
+ var makeFallbackChecks = true;
1297
+ var firstFittingPlacement = placements[0];
1298
+
1299
+ for (var i = 0; i < placements.length; i++) {
1300
+ var placement = placements[i];
1301
+
1302
+ var _basePlacement = getBasePlacement$1(placement);
1303
+
1304
+ var isStartVariation = getVariation(placement) === start;
1305
+ var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
1306
+ var len = isVertical ? 'width' : 'height';
1307
+ var overflow = detectOverflow(state, {
1308
+ placement: placement,
1309
+ boundary: boundary,
1310
+ rootBoundary: rootBoundary,
1311
+ altBoundary: altBoundary,
1312
+ padding: padding
1313
+ });
1314
+ var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
1315
+
1316
+ if (referenceRect[len] > popperRect[len]) {
1317
+ mainVariationSide = getOppositePlacement(mainVariationSide);
1318
+ }
1319
+
1320
+ var altVariationSide = getOppositePlacement(mainVariationSide);
1321
+ var checks = [];
1322
+
1323
+ if (checkMainAxis) {
1324
+ checks.push(overflow[_basePlacement] <= 0);
1325
+ }
1326
+
1327
+ if (checkAltAxis) {
1328
+ checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
1329
+ }
1330
+
1331
+ if (checks.every(function (check) {
1332
+ return check;
1333
+ })) {
1334
+ firstFittingPlacement = placement;
1335
+ makeFallbackChecks = false;
1336
+ break;
1337
+ }
1338
+
1339
+ checksMap.set(placement, checks);
1340
+ }
1341
+
1342
+ if (makeFallbackChecks) {
1343
+ // `2` may be desired in some cases – research later
1344
+ var numberOfChecks = flipVariations ? 3 : 1;
1345
+
1346
+ var _loop = function _loop(_i) {
1347
+ var fittingPlacement = placements.find(function (placement) {
1348
+ var checks = checksMap.get(placement);
1349
+
1350
+ if (checks) {
1351
+ return checks.slice(0, _i).every(function (check) {
1352
+ return check;
1353
+ });
1354
+ }
1355
+ });
1356
+
1357
+ if (fittingPlacement) {
1358
+ firstFittingPlacement = fittingPlacement;
1359
+ return "break";
1360
+ }
1361
+ };
1362
+
1363
+ for (var _i = numberOfChecks; _i > 0; _i--) {
1364
+ var _ret = _loop(_i);
1365
+
1366
+ if (_ret === "break") break;
1367
+ }
1368
+ }
1369
+
1370
+ if (state.placement !== firstFittingPlacement) {
1371
+ state.modifiersData[name]._skip = true;
1372
+ state.placement = firstFittingPlacement;
1373
+ state.reset = true;
1374
+ }
1375
+ } // eslint-disable-next-line import/no-unused-modules
1376
+
1377
+
1378
+ const flip$1 = {
1379
+ name: 'flip',
1380
+ enabled: true,
1381
+ phase: 'main',
1382
+ fn: flip,
1383
+ requiresIfExists: ['offset'],
1384
+ data: {
1385
+ _skip: false
1386
+ }
1387
+ };
1388
+
1389
+ function getSideOffsets(overflow, rect, preventedOffsets) {
1390
+ if (preventedOffsets === void 0) {
1391
+ preventedOffsets = {
1392
+ x: 0,
1393
+ y: 0
1394
+ };
1395
+ }
1396
+
1397
+ return {
1398
+ top: overflow.top - rect.height - preventedOffsets.y,
1399
+ right: overflow.right - rect.width + preventedOffsets.x,
1400
+ bottom: overflow.bottom - rect.height + preventedOffsets.y,
1401
+ left: overflow.left - rect.width - preventedOffsets.x
1402
+ };
1403
+ }
1404
+
1405
+ function isAnySideFullyClipped(overflow) {
1406
+ return [top, right, bottom, left].some(function (side) {
1407
+ return overflow[side] >= 0;
1408
+ });
1409
+ }
1410
+
1411
+ function hide(_ref) {
1412
+ var state = _ref.state,
1413
+ name = _ref.name;
1414
+ var referenceRect = state.rects.reference;
1415
+ var popperRect = state.rects.popper;
1416
+ var preventedOffsets = state.modifiersData.preventOverflow;
1417
+ var referenceOverflow = detectOverflow(state, {
1418
+ elementContext: 'reference'
1419
+ });
1420
+ var popperAltOverflow = detectOverflow(state, {
1421
+ altBoundary: true
1422
+ });
1423
+ var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
1424
+ var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
1425
+ var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
1426
+ var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
1427
+ state.modifiersData[name] = {
1428
+ referenceClippingOffsets: referenceClippingOffsets,
1429
+ popperEscapeOffsets: popperEscapeOffsets,
1430
+ isReferenceHidden: isReferenceHidden,
1431
+ hasPopperEscaped: hasPopperEscaped
1432
+ };
1433
+ state.attributes.popper = Object.assign({}, state.attributes.popper, {
1434
+ 'data-popper-reference-hidden': isReferenceHidden,
1435
+ 'data-popper-escaped': hasPopperEscaped
1436
+ });
1437
+ } // eslint-disable-next-line import/no-unused-modules
1438
+
1439
+
1440
+ const hide$1 = {
1441
+ name: 'hide',
1442
+ enabled: true,
1443
+ phase: 'main',
1444
+ requiresIfExists: ['preventOverflow'],
1445
+ fn: hide
1446
+ };
1447
+
1448
+ function distanceAndSkiddingToXY(placement, rects, offset) {
1449
+ var basePlacement = getBasePlacement$1(placement);
1450
+ var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
1451
+
1452
+ var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {
1453
+ placement: placement
1454
+ })) : offset,
1455
+ skidding = _ref[0],
1456
+ distance = _ref[1];
1457
+
1458
+ skidding = skidding || 0;
1459
+ distance = (distance || 0) * invertDistance;
1460
+ return [left, right].indexOf(basePlacement) >= 0 ? {
1461
+ x: distance,
1462
+ y: skidding
1463
+ } : {
1464
+ x: skidding,
1465
+ y: distance
1466
+ };
1467
+ }
1468
+
1469
+ function offset(_ref2) {
1470
+ var state = _ref2.state,
1471
+ options = _ref2.options,
1472
+ name = _ref2.name;
1473
+ var _options$offset = options.offset,
1474
+ offset = _options$offset === void 0 ? [0, 0] : _options$offset;
1475
+ var data = placements.reduce(function (acc, placement) {
1476
+ acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);
1477
+ return acc;
1478
+ }, {});
1479
+ var _data$state$placement = data[state.placement],
1480
+ x = _data$state$placement.x,
1481
+ y = _data$state$placement.y;
1482
+
1483
+ if (state.modifiersData.popperOffsets != null) {
1484
+ state.modifiersData.popperOffsets.x += x;
1485
+ state.modifiersData.popperOffsets.y += y;
1486
+ }
1487
+
1488
+ state.modifiersData[name] = data;
1489
+ } // eslint-disable-next-line import/no-unused-modules
1490
+
1491
+
1492
+ const offset$1 = {
1493
+ name: 'offset',
1494
+ enabled: true,
1495
+ phase: 'main',
1496
+ requires: ['popperOffsets'],
1497
+ fn: offset
1498
+ };
1499
+
1500
+ function popperOffsets(_ref) {
1501
+ var state = _ref.state,
1502
+ name = _ref.name;
1503
+ // Offsets are the actual position the popper needs to have to be
1504
+ // properly positioned near its reference element
1505
+ // This is the most basic placement, and will be adjusted by
1506
+ // the modifiers in the next step
1507
+ state.modifiersData[name] = computeOffsets({
1508
+ reference: state.rects.reference,
1509
+ element: state.rects.popper,
1510
+ strategy: 'absolute',
1511
+ placement: state.placement
1512
+ });
1513
+ } // eslint-disable-next-line import/no-unused-modules
1514
+
1515
+
1516
+ const popperOffsets$1 = {
1517
+ name: 'popperOffsets',
1518
+ enabled: true,
1519
+ phase: 'read',
1520
+ fn: popperOffsets,
1521
+ data: {}
1522
+ };
1523
+
1524
+ function getAltAxis(axis) {
1525
+ return axis === 'x' ? 'y' : 'x';
1526
+ }
1527
+
1528
+ function preventOverflow(_ref) {
1529
+ var state = _ref.state,
1530
+ options = _ref.options,
1531
+ name = _ref.name;
1532
+ var _options$mainAxis = options.mainAxis,
1533
+ checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
1534
+ _options$altAxis = options.altAxis,
1535
+ checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,
1536
+ boundary = options.boundary,
1537
+ rootBoundary = options.rootBoundary,
1538
+ altBoundary = options.altBoundary,
1539
+ padding = options.padding,
1540
+ _options$tether = options.tether,
1541
+ tether = _options$tether === void 0 ? true : _options$tether,
1542
+ _options$tetherOffset = options.tetherOffset,
1543
+ tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
1544
+ var overflow = detectOverflow(state, {
1545
+ boundary: boundary,
1546
+ rootBoundary: rootBoundary,
1547
+ padding: padding,
1548
+ altBoundary: altBoundary
1549
+ });
1550
+ var basePlacement = getBasePlacement$1(state.placement);
1551
+ var variation = getVariation(state.placement);
1552
+ var isBasePlacement = !variation;
1553
+ var mainAxis = getMainAxisFromPlacement(basePlacement);
1554
+ var altAxis = getAltAxis(mainAxis);
1555
+ var popperOffsets = state.modifiersData.popperOffsets;
1556
+ var referenceRect = state.rects.reference;
1557
+ var popperRect = state.rects.popper;
1558
+ var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
1559
+ placement: state.placement
1560
+ })) : tetherOffset;
1561
+ var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {
1562
+ mainAxis: tetherOffsetValue,
1563
+ altAxis: tetherOffsetValue
1564
+ } : Object.assign({
1565
+ mainAxis: 0,
1566
+ altAxis: 0
1567
+ }, tetherOffsetValue);
1568
+ var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
1569
+ var data = {
1570
+ x: 0,
1571
+ y: 0
1572
+ };
1573
+
1574
+ if (!popperOffsets) {
1575
+ return;
1576
+ }
1577
+
1578
+ if (checkMainAxis) {
1579
+ var _offsetModifierState$;
1580
+
1581
+ var mainSide = mainAxis === 'y' ? top : left;
1582
+ var altSide = mainAxis === 'y' ? bottom : right;
1583
+ var len = mainAxis === 'y' ? 'height' : 'width';
1584
+ var offset = popperOffsets[mainAxis];
1585
+ var min$1 = offset + overflow[mainSide];
1586
+ var max$1 = offset - overflow[altSide];
1587
+ var additive = tether ? -popperRect[len] / 2 : 0;
1588
+ var minLen = variation === start ? referenceRect[len] : popperRect[len];
1589
+ var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
1590
+ // outside the reference bounds
1591
+
1592
+ var arrowElement = state.elements.arrow;
1593
+ var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
1594
+ width: 0,
1595
+ height: 0
1596
+ };
1597
+ var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();
1598
+ var arrowPaddingMin = arrowPaddingObject[mainSide];
1599
+ var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want
1600
+ // to include its full size in the calculation. If the reference is small
1601
+ // and near the edge of a boundary, the popper can overflow even if the
1602
+ // reference is not overflowing as well (e.g. virtual elements with no
1603
+ // width or height)
1604
+
1605
+ var arrowLen = within(0, referenceRect[len], arrowRect[len]);
1606
+ var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
1607
+ var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
1608
+ var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
1609
+ var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
1610
+ var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
1611
+ var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;
1612
+ var tetherMax = offset + maxOffset - offsetModifierValue;
1613
+ var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
1614
+ popperOffsets[mainAxis] = preventedOffset;
1615
+ data[mainAxis] = preventedOffset - offset;
1616
+ }
1617
+
1618
+ if (checkAltAxis) {
1619
+ var _offsetModifierState$2;
1620
+
1621
+ var _mainSide = mainAxis === 'x' ? top : left;
1622
+
1623
+ var _altSide = mainAxis === 'x' ? bottom : right;
1624
+
1625
+ var _offset = popperOffsets[altAxis];
1626
+
1627
+ var _len = altAxis === 'y' ? 'height' : 'width';
1628
+
1629
+ var _min = _offset + overflow[_mainSide];
1630
+
1631
+ var _max = _offset - overflow[_altSide];
1632
+
1633
+ var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
1634
+
1635
+ var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
1636
+
1637
+ var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
1638
+
1639
+ var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
1640
+
1641
+ var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
1642
+
1643
+ popperOffsets[altAxis] = _preventedOffset;
1644
+ data[altAxis] = _preventedOffset - _offset;
1645
+ }
1646
+
1647
+ state.modifiersData[name] = data;
1648
+ } // eslint-disable-next-line import/no-unused-modules
1649
+
1650
+
1651
+ const preventOverflow$1 = {
1652
+ name: 'preventOverflow',
1653
+ enabled: true,
1654
+ phase: 'main',
1655
+ fn: preventOverflow,
1656
+ requiresIfExists: ['offset']
1657
+ };
1658
+
1659
+ function getHTMLElementScroll(element) {
1660
+ return {
1661
+ scrollLeft: element.scrollLeft,
1662
+ scrollTop: element.scrollTop
1663
+ };
1664
+ }
1665
+
1666
+ function getNodeScroll(node) {
1667
+ if (node === getWindow(node) || !isHTMLElement(node)) {
1668
+ return getWindowScroll(node);
1669
+ } else {
1670
+ return getHTMLElementScroll(node);
1671
+ }
1672
+ }
1673
+
1674
+ function isElementScaled(element) {
1675
+ var rect = element.getBoundingClientRect();
1676
+ var scaleX = round(rect.width) / element.offsetWidth || 1;
1677
+ var scaleY = round(rect.height) / element.offsetHeight || 1;
1678
+ return scaleX !== 1 || scaleY !== 1;
1679
+ } // Returns the composite rect of an element relative to its offsetParent.
1680
+ // Composite means it takes into account transforms as well as layout.
1681
+
1682
+
1683
+ function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
1684
+ if (isFixed === void 0) {
1685
+ isFixed = false;
1686
+ }
1687
+
1688
+ var isOffsetParentAnElement = isHTMLElement(offsetParent);
1689
+ var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
1690
+ var documentElement = getDocumentElement(offsetParent);
1691
+ var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
1692
+ var scroll = {
1693
+ scrollLeft: 0,
1694
+ scrollTop: 0
1695
+ };
1696
+ var offsets = {
1697
+ x: 0,
1698
+ y: 0
1699
+ };
1700
+
1701
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1702
+ if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
1703
+ isScrollParent(documentElement)) {
1704
+ scroll = getNodeScroll(offsetParent);
1705
+ }
1706
+
1707
+ if (isHTMLElement(offsetParent)) {
1708
+ offsets = getBoundingClientRect(offsetParent, true);
1709
+ offsets.x += offsetParent.clientLeft;
1710
+ offsets.y += offsetParent.clientTop;
1711
+ } else if (documentElement) {
1712
+ offsets.x = getWindowScrollBarX(documentElement);
1713
+ }
1714
+ }
1715
+
1716
+ return {
1717
+ x: rect.left + scroll.scrollLeft - offsets.x,
1718
+ y: rect.top + scroll.scrollTop - offsets.y,
1719
+ width: rect.width,
1720
+ height: rect.height
1721
+ };
1722
+ }
1723
+
1724
+ function order(modifiers) {
1725
+ var map = new Map();
1726
+ var visited = new Set();
1727
+ var result = [];
1728
+ modifiers.forEach(function (modifier) {
1729
+ map.set(modifier.name, modifier);
1730
+ }); // On visiting object, check for its dependencies and visit them recursively
1731
+
1732
+ function sort(modifier) {
1733
+ visited.add(modifier.name);
1734
+ var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
1735
+ requires.forEach(function (dep) {
1736
+ if (!visited.has(dep)) {
1737
+ var depModifier = map.get(dep);
1738
+
1739
+ if (depModifier) {
1740
+ sort(depModifier);
1741
+ }
1742
+ }
1743
+ });
1744
+ result.push(modifier);
1745
+ }
1746
+
1747
+ modifiers.forEach(function (modifier) {
1748
+ if (!visited.has(modifier.name)) {
1749
+ // check for visited object
1750
+ sort(modifier);
1751
+ }
1752
+ });
1753
+ return result;
1754
+ }
1755
+
1756
+ function orderModifiers(modifiers) {
1757
+ // order based on dependencies
1758
+ var orderedModifiers = order(modifiers); // order based on phase
1759
+
1760
+ return modifierPhases.reduce(function (acc, phase) {
1761
+ return acc.concat(orderedModifiers.filter(function (modifier) {
1762
+ return modifier.phase === phase;
1763
+ }));
1764
+ }, []);
1765
+ }
1766
+
1767
+ function debounce$1(fn) {
1768
+ var pending;
1769
+ return function () {
1770
+ if (!pending) {
1771
+ pending = new Promise(function (resolve) {
1772
+ Promise.resolve().then(function () {
1773
+ pending = undefined;
1774
+ resolve(fn());
1775
+ });
1776
+ });
1777
+ }
1778
+
1779
+ return pending;
1780
+ };
1781
+ }
1782
+
1783
+ function mergeByName(modifiers) {
1784
+ var merged = modifiers.reduce(function (merged, current) {
1785
+ var existing = merged[current.name];
1786
+ merged[current.name] = existing ? Object.assign({}, existing, current, {
1787
+ options: Object.assign({}, existing.options, current.options),
1788
+ data: Object.assign({}, existing.data, current.data)
1789
+ }) : current;
1790
+ return merged;
1791
+ }, {}); // IE11 does not support Object.values
1792
+
1793
+ return Object.keys(merged).map(function (key) {
1794
+ return merged[key];
1795
+ });
1796
+ }
1797
+
1798
+ var DEFAULT_OPTIONS = {
1799
+ placement: 'bottom',
1800
+ modifiers: [],
1801
+ strategy: 'absolute'
1802
+ };
1803
+
1804
+ function areValidElements() {
1805
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1806
+ args[_key] = arguments[_key];
1807
+ }
1808
+
1809
+ return !args.some(function (element) {
1810
+ return !(element && typeof element.getBoundingClientRect === 'function');
1811
+ });
1812
+ }
1813
+
1814
+ function popperGenerator(generatorOptions) {
1815
+ if (generatorOptions === void 0) {
1816
+ generatorOptions = {};
1817
+ }
1818
+
1819
+ var _generatorOptions = generatorOptions,
1820
+ _generatorOptions$def = _generatorOptions.defaultModifiers,
1821
+ defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,
1822
+ _generatorOptions$def2 = _generatorOptions.defaultOptions,
1823
+ defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
1824
+ return function createPopper(reference, popper, options) {
1825
+ if (options === void 0) {
1826
+ options = defaultOptions;
1827
+ }
1828
+
1829
+ var state = {
1830
+ placement: 'bottom',
1831
+ orderedModifiers: [],
1832
+ options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
1833
+ modifiersData: {},
1834
+ elements: {
1835
+ reference: reference,
1836
+ popper: popper
1837
+ },
1838
+ attributes: {},
1839
+ styles: {}
1840
+ };
1841
+ var effectCleanupFns = [];
1842
+ var isDestroyed = false;
1843
+ var instance = {
1844
+ state: state,
1845
+ setOptions: function setOptions(setOptionsAction) {
1846
+ var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
1847
+ cleanupModifierEffects();
1848
+ state.options = Object.assign({}, defaultOptions, state.options, options);
1849
+ state.scrollParents = {
1850
+ reference: isElement$1(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
1851
+ popper: listScrollParents(popper)
1852
+ }; // Orders the modifiers based on their dependencies and `phase`
1853
+ // properties
1854
+
1855
+ var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers
1856
+
1857
+ state.orderedModifiers = orderedModifiers.filter(function (m) {
1858
+ return m.enabled;
1859
+ }); // Validate the provided modifiers so that the consumer will get warned
1860
+
1861
+ runModifierEffects();
1862
+ return instance.update();
1863
+ },
1864
+ // Sync update – it will always be executed, even if not necessary. This
1865
+ // is useful for low frequency updates where sync behavior simplifies the
1866
+ // logic.
1867
+ // For high frequency updates (e.g. `resize` and `scroll` events), always
1868
+ // prefer the async Popper#update method
1869
+ forceUpdate: function forceUpdate() {
1870
+ if (isDestroyed) {
1871
+ return;
1872
+ }
1873
+
1874
+ var _state$elements = state.elements,
1875
+ reference = _state$elements.reference,
1876
+ popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements
1877
+ // anymore
1878
+
1879
+ if (!areValidElements(reference, popper)) {
1880
+
1881
+ return;
1882
+ } // Store the reference and popper rects to be read by modifiers
1883
+
1884
+
1885
+ state.rects = {
1886
+ reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
1887
+ popper: getLayoutRect(popper)
1888
+ }; // Modifiers have the ability to reset the current update cycle. The
1889
+ // most common use case for this is the `flip` modifier changing the
1890
+ // placement, which then needs to re-run all the modifiers, because the
1891
+ // logic was previously ran for the previous placement and is therefore
1892
+ // stale/incorrect
1893
+
1894
+ state.reset = false;
1895
+ state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier
1896
+ // is filled with the initial data specified by the modifier. This means
1897
+ // it doesn't persist and is fresh on each update.
1898
+ // To ensure persistent data, use `${name}#persistent`
1899
+
1900
+ state.orderedModifiers.forEach(function (modifier) {
1901
+ return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
1902
+ });
1903
+
1904
+ for (var index = 0; index < state.orderedModifiers.length; index++) {
1905
+
1906
+ if (state.reset === true) {
1907
+ state.reset = false;
1908
+ index = -1;
1909
+ continue;
1910
+ }
1911
+
1912
+ var _state$orderedModifie = state.orderedModifiers[index],
1913
+ fn = _state$orderedModifie.fn,
1914
+ _state$orderedModifie2 = _state$orderedModifie.options,
1915
+ _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
1916
+ name = _state$orderedModifie.name;
1917
+
1918
+ if (typeof fn === 'function') {
1919
+ state = fn({
1920
+ state: state,
1921
+ options: _options,
1922
+ name: name,
1923
+ instance: instance
1924
+ }) || state;
1925
+ }
1926
+ }
1927
+ },
1928
+ // Async and optimistically optimized update – it will not be executed if
1929
+ // not necessary (debounced to run at most once-per-tick)
1930
+ update: debounce$1(function () {
1931
+ return new Promise(function (resolve) {
1932
+ instance.forceUpdate();
1933
+ resolve(state);
1934
+ });
1935
+ }),
1936
+ destroy: function destroy() {
1937
+ cleanupModifierEffects();
1938
+ isDestroyed = true;
1939
+ }
1940
+ };
1941
+
1942
+ if (!areValidElements(reference, popper)) {
1943
+
1944
+ return instance;
1945
+ }
1946
+
1947
+ instance.setOptions(options).then(function (state) {
1948
+ if (!isDestroyed && options.onFirstUpdate) {
1949
+ options.onFirstUpdate(state);
1950
+ }
1951
+ }); // Modifiers have the ability to execute arbitrary code before the first
1952
+ // update cycle runs. They will be executed in the same order as the update
1953
+ // cycle. This is useful when a modifier adds some persistent data that
1954
+ // other modifiers need to use, but the modifier is run after the dependent
1955
+ // one.
1956
+
1957
+ function runModifierEffects() {
1958
+ state.orderedModifiers.forEach(function (_ref3) {
1959
+ var name = _ref3.name,
1960
+ _ref3$options = _ref3.options,
1961
+ options = _ref3$options === void 0 ? {} : _ref3$options,
1962
+ effect = _ref3.effect;
1963
+
1964
+ if (typeof effect === 'function') {
1965
+ var cleanupFn = effect({
1966
+ state: state,
1967
+ name: name,
1968
+ instance: instance,
1969
+ options: options
1970
+ });
1971
+
1972
+ var noopFn = function noopFn() {};
1973
+
1974
+ effectCleanupFns.push(cleanupFn || noopFn);
1975
+ }
1976
+ });
1977
+ }
1978
+
1979
+ function cleanupModifierEffects() {
1980
+ effectCleanupFns.forEach(function (fn) {
1981
+ return fn();
1982
+ });
1983
+ effectCleanupFns = [];
1984
+ }
1985
+
1986
+ return instance;
1987
+ };
1988
+ }
1989
+
1990
+ var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
1991
+ var createPopper = /*#__PURE__*/popperGenerator({
1992
+ defaultModifiers: defaultModifiers
1993
+ }); // eslint-disable-next-line import/no-unused-modules
1994
+
1995
+ /**!
1996
+ * tippy.js v6.3.7
1997
+ * (c) 2017-2021 atomiks
1998
+ * MIT License
1999
+ */
2000
+ var BOX_CLASS = "tippy-box";
2001
+ var CONTENT_CLASS = "tippy-content";
2002
+ var BACKDROP_CLASS = "tippy-backdrop";
2003
+ var ARROW_CLASS = "tippy-arrow";
2004
+ var SVG_ARROW_CLASS = "tippy-svg-arrow";
2005
+ var TOUCH_OPTIONS = {
2006
+ passive: true,
2007
+ capture: true
2008
+ };
2009
+ var TIPPY_DEFAULT_APPEND_TO = function TIPPY_DEFAULT_APPEND_TO() {
2010
+ return document.body;
2011
+ };
2012
+ function getValueAtIndexOrReturn(value, index, defaultValue) {
2013
+ if (Array.isArray(value)) {
2014
+ var v = value[index];
2015
+ return v == null ? Array.isArray(defaultValue) ? defaultValue[index] : defaultValue : v;
2016
+ }
2017
+
2018
+ return value;
2019
+ }
2020
+ function isType(value, type) {
2021
+ var str = {}.toString.call(value);
2022
+ return str.indexOf('[object') === 0 && str.indexOf(type + "]") > -1;
2023
+ }
2024
+ function invokeWithArgsOrReturn(value, args) {
2025
+ return typeof value === 'function' ? value.apply(void 0, args) : value;
2026
+ }
2027
+ function debounce(fn, ms) {
2028
+ // Avoid wrapping in `setTimeout` if ms is 0 anyway
2029
+ if (ms === 0) {
2030
+ return fn;
2031
+ }
2032
+
2033
+ var timeout;
2034
+ return function (arg) {
2035
+ clearTimeout(timeout);
2036
+ timeout = setTimeout(function () {
2037
+ fn(arg);
2038
+ }, ms);
2039
+ };
2040
+ }
2041
+ function splitBySpaces(value) {
2042
+ return value.split(/\s+/).filter(Boolean);
2043
+ }
2044
+ function normalizeToArray(value) {
2045
+ return [].concat(value);
2046
+ }
2047
+ function pushIfUnique(arr, value) {
2048
+ if (arr.indexOf(value) === -1) {
2049
+ arr.push(value);
2050
+ }
2051
+ }
2052
+ function unique(arr) {
2053
+ return arr.filter(function (item, index) {
2054
+ return arr.indexOf(item) === index;
2055
+ });
2056
+ }
2057
+ function getBasePlacement(placement) {
2058
+ return placement.split('-')[0];
2059
+ }
2060
+ function arrayFrom(value) {
2061
+ return [].slice.call(value);
2062
+ }
2063
+ function removeUndefinedProps(obj) {
2064
+ return Object.keys(obj).reduce(function (acc, key) {
2065
+ if (obj[key] !== undefined) {
2066
+ acc[key] = obj[key];
2067
+ }
2068
+
2069
+ return acc;
2070
+ }, {});
2071
+ }
2072
+
2073
+ function div() {
2074
+ return document.createElement('div');
2075
+ }
2076
+ function isElement(value) {
2077
+ return ['Element', 'Fragment'].some(function (type) {
2078
+ return isType(value, type);
2079
+ });
2080
+ }
2081
+ function isNodeList(value) {
2082
+ return isType(value, 'NodeList');
2083
+ }
2084
+ function isMouseEvent(value) {
2085
+ return isType(value, 'MouseEvent');
2086
+ }
2087
+ function isReferenceElement(value) {
2088
+ return !!(value && value._tippy && value._tippy.reference === value);
2089
+ }
2090
+ function getArrayOfElements(value) {
2091
+ if (isElement(value)) {
2092
+ return [value];
2093
+ }
2094
+
2095
+ if (isNodeList(value)) {
2096
+ return arrayFrom(value);
2097
+ }
2098
+
2099
+ if (Array.isArray(value)) {
2100
+ return value;
2101
+ }
2102
+
2103
+ return arrayFrom(document.querySelectorAll(value));
2104
+ }
2105
+ function setTransitionDuration(els, value) {
2106
+ els.forEach(function (el) {
2107
+ if (el) {
2108
+ el.style.transitionDuration = value + "ms";
2109
+ }
2110
+ });
2111
+ }
2112
+ function setVisibilityState(els, state) {
2113
+ els.forEach(function (el) {
2114
+ if (el) {
2115
+ el.setAttribute('data-state', state);
2116
+ }
2117
+ });
2118
+ }
2119
+ function getOwnerDocument(elementOrElements) {
2120
+ var _element$ownerDocumen;
2121
+
2122
+ var _normalizeToArray = normalizeToArray(elementOrElements),
2123
+ element = _normalizeToArray[0]; // Elements created via a <template> have an ownerDocument with no reference to the body
2124
+
2125
+
2126
+ return element != null && (_element$ownerDocumen = element.ownerDocument) != null && _element$ownerDocumen.body ? element.ownerDocument : document;
2127
+ }
2128
+ function isCursorOutsideInteractiveBorder(popperTreeData, event) {
2129
+ var clientX = event.clientX,
2130
+ clientY = event.clientY;
2131
+ return popperTreeData.every(function (_ref) {
2132
+ var popperRect = _ref.popperRect,
2133
+ popperState = _ref.popperState,
2134
+ props = _ref.props;
2135
+ var interactiveBorder = props.interactiveBorder;
2136
+ var basePlacement = getBasePlacement(popperState.placement);
2137
+ var offsetData = popperState.modifiersData.offset;
2138
+
2139
+ if (!offsetData) {
2140
+ return true;
2141
+ }
2142
+
2143
+ var topDistance = basePlacement === 'bottom' ? offsetData.top.y : 0;
2144
+ var bottomDistance = basePlacement === 'top' ? offsetData.bottom.y : 0;
2145
+ var leftDistance = basePlacement === 'right' ? offsetData.left.x : 0;
2146
+ var rightDistance = basePlacement === 'left' ? offsetData.right.x : 0;
2147
+ var exceedsTop = popperRect.top - clientY + topDistance > interactiveBorder;
2148
+ var exceedsBottom = clientY - popperRect.bottom - bottomDistance > interactiveBorder;
2149
+ var exceedsLeft = popperRect.left - clientX + leftDistance > interactiveBorder;
2150
+ var exceedsRight = clientX - popperRect.right - rightDistance > interactiveBorder;
2151
+ return exceedsTop || exceedsBottom || exceedsLeft || exceedsRight;
2152
+ });
2153
+ }
2154
+ function updateTransitionEndListener(box, action, listener) {
2155
+ var method = action + "EventListener"; // some browsers apparently support `transition` (unprefixed) but only fire
2156
+ // `webkitTransitionEnd`...
2157
+
2158
+ ['transitionend', 'webkitTransitionEnd'].forEach(function (event) {
2159
+ box[method](event, listener);
2160
+ });
2161
+ }
2162
+ /**
2163
+ * Compared to xxx.contains, this function works for dom structures with shadow
2164
+ * dom
2165
+ */
2166
+
2167
+ function actualContains(parent, child) {
2168
+ var target = child;
2169
+
2170
+ while (target) {
2171
+ var _target$getRootNode;
2172
+
2173
+ if (parent.contains(target)) {
2174
+ return true;
2175
+ }
2176
+
2177
+ target = target.getRootNode == null ? void 0 : (_target$getRootNode = target.getRootNode()) == null ? void 0 : _target$getRootNode.host;
2178
+ }
2179
+
2180
+ return false;
2181
+ }
2182
+
2183
+ var currentInput = {
2184
+ isTouch: false
2185
+ };
2186
+ var lastMouseMoveTime = 0;
2187
+ /**
2188
+ * When a `touchstart` event is fired, it's assumed the user is using touch
2189
+ * input. We'll bind a `mousemove` event listener to listen for mouse input in
2190
+ * the future. This way, the `isTouch` property is fully dynamic and will handle
2191
+ * hybrid devices that use a mix of touch + mouse input.
2192
+ */
2193
+
2194
+ function onDocumentTouchStart() {
2195
+ if (currentInput.isTouch) {
2196
+ return;
2197
+ }
2198
+
2199
+ currentInput.isTouch = true;
2200
+
2201
+ if (window.performance) {
2202
+ document.addEventListener('mousemove', onDocumentMouseMove);
2203
+ }
2204
+ }
2205
+ /**
2206
+ * When two `mousemove` event are fired consecutively within 20ms, it's assumed
2207
+ * the user is using mouse input again. `mousemove` can fire on touch devices as
2208
+ * well, but very rarely that quickly.
2209
+ */
2210
+
2211
+ function onDocumentMouseMove() {
2212
+ var now = performance.now();
2213
+
2214
+ if (now - lastMouseMoveTime < 20) {
2215
+ currentInput.isTouch = false;
2216
+ document.removeEventListener('mousemove', onDocumentMouseMove);
2217
+ }
2218
+
2219
+ lastMouseMoveTime = now;
2220
+ }
2221
+ /**
2222
+ * When an element is in focus and has a tippy, leaving the tab/window and
2223
+ * returning causes it to show again. For mouse users this is unexpected, but
2224
+ * for keyboard use it makes sense.
2225
+ * TODO: find a better technique to solve this problem
2226
+ */
2227
+
2228
+ function onWindowBlur() {
2229
+ var activeElement = document.activeElement;
2230
+
2231
+ if (isReferenceElement(activeElement)) {
2232
+ var instance = activeElement._tippy;
2233
+
2234
+ if (activeElement.blur && !instance.state.isVisible) {
2235
+ activeElement.blur();
2236
+ }
2237
+ }
2238
+ }
2239
+ function bindGlobalEventListeners() {
2240
+ document.addEventListener('touchstart', onDocumentTouchStart, TOUCH_OPTIONS);
2241
+ window.addEventListener('blur', onWindowBlur);
2242
+ }
2243
+
2244
+ var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
2245
+ var isIE11 = isBrowser ? // @ts-ignore
2246
+ !!window.msCrypto : false;
2247
+
2248
+ var pluginProps = {
2249
+ animateFill: false,
2250
+ followCursor: false,
2251
+ inlinePositioning: false,
2252
+ sticky: false
2253
+ };
2254
+ var renderProps = {
2255
+ allowHTML: false,
2256
+ animation: 'fade',
2257
+ arrow: true,
2258
+ content: '',
2259
+ inertia: false,
2260
+ maxWidth: 350,
2261
+ role: 'tooltip',
2262
+ theme: '',
2263
+ zIndex: 9999
2264
+ };
2265
+ var defaultProps = Object.assign({
2266
+ appendTo: TIPPY_DEFAULT_APPEND_TO,
2267
+ aria: {
2268
+ content: 'auto',
2269
+ expanded: 'auto'
2270
+ },
2271
+ delay: 0,
2272
+ duration: [300, 250],
2273
+ getReferenceClientRect: null,
2274
+ hideOnClick: true,
2275
+ ignoreAttributes: false,
2276
+ interactive: false,
2277
+ interactiveBorder: 2,
2278
+ interactiveDebounce: 0,
2279
+ moveTransition: '',
2280
+ offset: [0, 10],
2281
+ onAfterUpdate: function onAfterUpdate() {},
2282
+ onBeforeUpdate: function onBeforeUpdate() {},
2283
+ onCreate: function onCreate() {},
2284
+ onDestroy: function onDestroy() {},
2285
+ onHidden: function onHidden() {},
2286
+ onHide: function onHide() {},
2287
+ onMount: function onMount() {},
2288
+ onShow: function onShow() {},
2289
+ onShown: function onShown() {},
2290
+ onTrigger: function onTrigger() {},
2291
+ onUntrigger: function onUntrigger() {},
2292
+ onClickOutside: function onClickOutside() {},
2293
+ placement: 'top',
2294
+ plugins: [],
2295
+ popperOptions: {},
2296
+ render: null,
2297
+ showOnCreate: false,
2298
+ touch: true,
2299
+ trigger: 'mouseenter focus',
2300
+ triggerTarget: null
2301
+ }, pluginProps, renderProps);
2302
+ var defaultKeys = Object.keys(defaultProps);
2303
+ var setDefaultProps = function setDefaultProps(partialProps) {
2304
+
2305
+ var keys = Object.keys(partialProps);
2306
+ keys.forEach(function (key) {
2307
+ defaultProps[key] = partialProps[key];
2308
+ });
2309
+ };
2310
+ function getExtendedPassedProps(passedProps) {
2311
+ var plugins = passedProps.plugins || [];
2312
+ var pluginProps = plugins.reduce(function (acc, plugin) {
2313
+ var name = plugin.name,
2314
+ defaultValue = plugin.defaultValue;
2315
+
2316
+ if (name) {
2317
+ var _name;
2318
+
2319
+ acc[name] = passedProps[name] !== undefined ? passedProps[name] : (_name = defaultProps[name]) != null ? _name : defaultValue;
2320
+ }
2321
+
2322
+ return acc;
2323
+ }, {});
2324
+ return Object.assign({}, passedProps, pluginProps);
2325
+ }
2326
+ function getDataAttributeProps(reference, plugins) {
2327
+ var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps, {
2328
+ plugins: plugins
2329
+ }))) : defaultKeys;
2330
+ var props = propKeys.reduce(function (acc, key) {
2331
+ var valueAsString = (reference.getAttribute("data-tippy-" + key) || '').trim();
2332
+
2333
+ if (!valueAsString) {
2334
+ return acc;
2335
+ }
2336
+
2337
+ if (key === 'content') {
2338
+ acc[key] = valueAsString;
2339
+ } else {
2340
+ try {
2341
+ acc[key] = JSON.parse(valueAsString);
2342
+ } catch (e) {
2343
+ acc[key] = valueAsString;
2344
+ }
2345
+ }
2346
+
2347
+ return acc;
2348
+ }, {});
2349
+ return props;
2350
+ }
2351
+ function evaluateProps(reference, props) {
2352
+ var out = Object.assign({}, props, {
2353
+ content: invokeWithArgsOrReturn(props.content, [reference])
2354
+ }, props.ignoreAttributes ? {} : getDataAttributeProps(reference, props.plugins));
2355
+ out.aria = Object.assign({}, defaultProps.aria, out.aria);
2356
+ out.aria = {
2357
+ expanded: out.aria.expanded === 'auto' ? props.interactive : out.aria.expanded,
2358
+ content: out.aria.content === 'auto' ? props.interactive ? null : 'describedby' : out.aria.content
2359
+ };
2360
+ return out;
2361
+ }
2362
+
2363
+ var innerHTML = function innerHTML() {
2364
+ return 'innerHTML';
2365
+ };
2366
+
2367
+ function dangerouslySetInnerHTML(element, html) {
2368
+ element[innerHTML()] = html;
2369
+ }
2370
+
2371
+ function createArrowElement(value) {
2372
+ var arrow = div();
2373
+
2374
+ if (value === true) {
2375
+ arrow.className = ARROW_CLASS;
2376
+ } else {
2377
+ arrow.className = SVG_ARROW_CLASS;
2378
+
2379
+ if (isElement(value)) {
2380
+ arrow.appendChild(value);
2381
+ } else {
2382
+ dangerouslySetInnerHTML(arrow, value);
2383
+ }
2384
+ }
2385
+
2386
+ return arrow;
2387
+ }
2388
+
2389
+ function setContent(content, props) {
2390
+ if (isElement(props.content)) {
2391
+ dangerouslySetInnerHTML(content, '');
2392
+ content.appendChild(props.content);
2393
+ } else if (typeof props.content !== 'function') {
2394
+ if (props.allowHTML) {
2395
+ dangerouslySetInnerHTML(content, props.content);
2396
+ } else {
2397
+ content.textContent = props.content;
2398
+ }
2399
+ }
2400
+ }
2401
+ function getChildren(popper) {
2402
+ var box = popper.firstElementChild;
2403
+ var boxChildren = arrayFrom(box.children);
2404
+ return {
2405
+ box: box,
2406
+ content: boxChildren.find(function (node) {
2407
+ return node.classList.contains(CONTENT_CLASS);
2408
+ }),
2409
+ arrow: boxChildren.find(function (node) {
2410
+ return node.classList.contains(ARROW_CLASS) || node.classList.contains(SVG_ARROW_CLASS);
2411
+ }),
2412
+ backdrop: boxChildren.find(function (node) {
2413
+ return node.classList.contains(BACKDROP_CLASS);
2414
+ })
2415
+ };
2416
+ }
2417
+ function render(instance) {
2418
+ var popper = div();
2419
+ var box = div();
2420
+ box.className = BOX_CLASS;
2421
+ box.setAttribute('data-state', 'hidden');
2422
+ box.setAttribute('tabindex', '-1');
2423
+ var content = div();
2424
+ content.className = CONTENT_CLASS;
2425
+ content.setAttribute('data-state', 'hidden');
2426
+ setContent(content, instance.props);
2427
+ popper.appendChild(box);
2428
+ box.appendChild(content);
2429
+ onUpdate(instance.props, instance.props);
2430
+
2431
+ function onUpdate(prevProps, nextProps) {
2432
+ var _getChildren = getChildren(popper),
2433
+ box = _getChildren.box,
2434
+ content = _getChildren.content,
2435
+ arrow = _getChildren.arrow;
2436
+
2437
+ if (nextProps.theme) {
2438
+ box.setAttribute('data-theme', nextProps.theme);
2439
+ } else {
2440
+ box.removeAttribute('data-theme');
2441
+ }
2442
+
2443
+ if (typeof nextProps.animation === 'string') {
2444
+ box.setAttribute('data-animation', nextProps.animation);
2445
+ } else {
2446
+ box.removeAttribute('data-animation');
2447
+ }
2448
+
2449
+ if (nextProps.inertia) {
2450
+ box.setAttribute('data-inertia', '');
2451
+ } else {
2452
+ box.removeAttribute('data-inertia');
2453
+ }
2454
+
2455
+ box.style.maxWidth = typeof nextProps.maxWidth === 'number' ? nextProps.maxWidth + "px" : nextProps.maxWidth;
2456
+
2457
+ if (nextProps.role) {
2458
+ box.setAttribute('role', nextProps.role);
2459
+ } else {
2460
+ box.removeAttribute('role');
2461
+ }
2462
+
2463
+ if (prevProps.content !== nextProps.content || prevProps.allowHTML !== nextProps.allowHTML) {
2464
+ setContent(content, instance.props);
2465
+ }
2466
+
2467
+ if (nextProps.arrow) {
2468
+ if (!arrow) {
2469
+ box.appendChild(createArrowElement(nextProps.arrow));
2470
+ } else if (prevProps.arrow !== nextProps.arrow) {
2471
+ box.removeChild(arrow);
2472
+ box.appendChild(createArrowElement(nextProps.arrow));
2473
+ }
2474
+ } else if (arrow) {
2475
+ box.removeChild(arrow);
2476
+ }
2477
+ }
2478
+
2479
+ return {
2480
+ popper: popper,
2481
+ onUpdate: onUpdate
2482
+ };
2483
+ } // Runtime check to identify if the render function is the default one; this
2484
+ // way we can apply default CSS transitions logic and it can be tree-shaken away
2485
+
2486
+ render.$$tippy = true;
2487
+
2488
+ var idCounter = 1;
2489
+ var mouseMoveListeners = []; // Used by `hideAll()`
2490
+
2491
+ var mountedInstances = [];
2492
+ function createTippy(reference, passedProps) {
2493
+ var props = evaluateProps(reference, Object.assign({}, defaultProps, getExtendedPassedProps(removeUndefinedProps(passedProps)))); // ===========================================================================
2494
+ // 🔒 Private members
2495
+ // ===========================================================================
2496
+
2497
+ var showTimeout;
2498
+ var hideTimeout;
2499
+ var scheduleHideAnimationFrame;
2500
+ var isVisibleFromClick = false;
2501
+ var didHideDueToDocumentMouseDown = false;
2502
+ var didTouchMove = false;
2503
+ var ignoreOnFirstUpdate = false;
2504
+ var lastTriggerEvent;
2505
+ var currentTransitionEndListener;
2506
+ var onFirstUpdate;
2507
+ var listeners = [];
2508
+ var debouncedOnMouseMove = debounce(onMouseMove, props.interactiveDebounce);
2509
+ var currentTarget; // ===========================================================================
2510
+ // 🔑 Public members
2511
+ // ===========================================================================
2512
+
2513
+ var id = idCounter++;
2514
+ var popperInstance = null;
2515
+ var plugins = unique(props.plugins);
2516
+ var state = {
2517
+ // Is the instance currently enabled?
2518
+ isEnabled: true,
2519
+ // Is the tippy currently showing and not transitioning out?
2520
+ isVisible: false,
2521
+ // Has the instance been destroyed?
2522
+ isDestroyed: false,
2523
+ // Is the tippy currently mounted to the DOM?
2524
+ isMounted: false,
2525
+ // Has the tippy finished transitioning in?
2526
+ isShown: false
2527
+ };
2528
+ var instance = {
2529
+ // properties
2530
+ id: id,
2531
+ reference: reference,
2532
+ popper: div(),
2533
+ popperInstance: popperInstance,
2534
+ props: props,
2535
+ state: state,
2536
+ plugins: plugins,
2537
+ // methods
2538
+ clearDelayTimeouts: clearDelayTimeouts,
2539
+ setProps: setProps,
2540
+ setContent: setContent,
2541
+ show: show,
2542
+ hide: hide,
2543
+ hideWithInteractivity: hideWithInteractivity,
2544
+ enable: enable,
2545
+ disable: disable,
2546
+ unmount: unmount,
2547
+ destroy: destroy
2548
+ }; // TODO: Investigate why this early return causes a TDZ error in the tests —
2549
+ // it doesn't seem to happen in the browser
2550
+
2551
+ /* istanbul ignore if */
2552
+
2553
+ if (!props.render) {
2554
+
2555
+ return instance;
2556
+ } // ===========================================================================
2557
+ // Initial mutations
2558
+ // ===========================================================================
2559
+
2560
+
2561
+ var _props$render = props.render(instance),
2562
+ popper = _props$render.popper,
2563
+ onUpdate = _props$render.onUpdate;
2564
+
2565
+ popper.setAttribute('data-tippy-root', '');
2566
+ popper.id = "tippy-" + instance.id;
2567
+ instance.popper = popper;
2568
+ reference._tippy = instance;
2569
+ popper._tippy = instance;
2570
+ var pluginsHooks = plugins.map(function (plugin) {
2571
+ return plugin.fn(instance);
2572
+ });
2573
+ var hasAriaExpanded = reference.hasAttribute('aria-expanded');
2574
+ addListeners();
2575
+ handleAriaExpandedAttribute();
2576
+ handleStyles();
2577
+ invokeHook('onCreate', [instance]);
2578
+
2579
+ if (props.showOnCreate) {
2580
+ scheduleShow();
2581
+ } // Prevent a tippy with a delay from hiding if the cursor left then returned
2582
+ // before it started hiding
2583
+
2584
+
2585
+ popper.addEventListener('mouseenter', function () {
2586
+ if (instance.props.interactive && instance.state.isVisible) {
2587
+ instance.clearDelayTimeouts();
2588
+ }
2589
+ });
2590
+ popper.addEventListener('mouseleave', function () {
2591
+ if (instance.props.interactive && instance.props.trigger.indexOf('mouseenter') >= 0) {
2592
+ getDocument().addEventListener('mousemove', debouncedOnMouseMove);
2593
+ }
2594
+ });
2595
+ return instance; // ===========================================================================
2596
+ // 🔒 Private methods
2597
+ // ===========================================================================
2598
+
2599
+ function getNormalizedTouchSettings() {
2600
+ var touch = instance.props.touch;
2601
+ return Array.isArray(touch) ? touch : [touch, 0];
2602
+ }
2603
+
2604
+ function getIsCustomTouchBehavior() {
2605
+ return getNormalizedTouchSettings()[0] === 'hold';
2606
+ }
2607
+
2608
+ function getIsDefaultRenderFn() {
2609
+ var _instance$props$rende;
2610
+
2611
+ // @ts-ignore
2612
+ return !!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy);
2613
+ }
2614
+
2615
+ function getCurrentTarget() {
2616
+ return currentTarget || reference;
2617
+ }
2618
+
2619
+ function getDocument() {
2620
+ var parent = getCurrentTarget().parentNode;
2621
+ return parent ? getOwnerDocument(parent) : document;
2622
+ }
2623
+
2624
+ function getDefaultTemplateChildren() {
2625
+ return getChildren(popper);
2626
+ }
2627
+
2628
+ function getDelay(isShow) {
2629
+ // For touch or keyboard input, force `0` delay for UX reasons
2630
+ // Also if the instance is mounted but not visible (transitioning out),
2631
+ // ignore delay
2632
+ if (instance.state.isMounted && !instance.state.isVisible || currentInput.isTouch || lastTriggerEvent && lastTriggerEvent.type === 'focus') {
2633
+ return 0;
2634
+ }
2635
+
2636
+ return getValueAtIndexOrReturn(instance.props.delay, isShow ? 0 : 1, defaultProps.delay);
2637
+ }
2638
+
2639
+ function handleStyles(fromHide) {
2640
+ if (fromHide === void 0) {
2641
+ fromHide = false;
2642
+ }
2643
+
2644
+ popper.style.pointerEvents = instance.props.interactive && !fromHide ? '' : 'none';
2645
+ popper.style.zIndex = "" + instance.props.zIndex;
2646
+ }
2647
+
2648
+ function invokeHook(hook, args, shouldInvokePropsHook) {
2649
+ if (shouldInvokePropsHook === void 0) {
2650
+ shouldInvokePropsHook = true;
2651
+ }
2652
+
2653
+ pluginsHooks.forEach(function (pluginHooks) {
2654
+ if (pluginHooks[hook]) {
2655
+ pluginHooks[hook].apply(pluginHooks, args);
2656
+ }
2657
+ });
2658
+
2659
+ if (shouldInvokePropsHook) {
2660
+ var _instance$props;
2661
+
2662
+ (_instance$props = instance.props)[hook].apply(_instance$props, args);
2663
+ }
2664
+ }
2665
+
2666
+ function handleAriaContentAttribute() {
2667
+ var aria = instance.props.aria;
2668
+
2669
+ if (!aria.content) {
2670
+ return;
2671
+ }
2672
+
2673
+ var attr = "aria-" + aria.content;
2674
+ var id = popper.id;
2675
+ var nodes = normalizeToArray(instance.props.triggerTarget || reference);
2676
+ nodes.forEach(function (node) {
2677
+ var currentValue = node.getAttribute(attr);
2678
+
2679
+ if (instance.state.isVisible) {
2680
+ node.setAttribute(attr, currentValue ? currentValue + " " + id : id);
2681
+ } else {
2682
+ var nextValue = currentValue && currentValue.replace(id, '').trim();
2683
+
2684
+ if (nextValue) {
2685
+ node.setAttribute(attr, nextValue);
2686
+ } else {
2687
+ node.removeAttribute(attr);
2688
+ }
2689
+ }
2690
+ });
2691
+ }
2692
+
2693
+ function handleAriaExpandedAttribute() {
2694
+ if (hasAriaExpanded || !instance.props.aria.expanded) {
2695
+ return;
2696
+ }
2697
+
2698
+ var nodes = normalizeToArray(instance.props.triggerTarget || reference);
2699
+ nodes.forEach(function (node) {
2700
+ if (instance.props.interactive) {
2701
+ node.setAttribute('aria-expanded', instance.state.isVisible && node === getCurrentTarget() ? 'true' : 'false');
2702
+ } else {
2703
+ node.removeAttribute('aria-expanded');
2704
+ }
2705
+ });
2706
+ }
2707
+
2708
+ function cleanupInteractiveMouseListeners() {
2709
+ getDocument().removeEventListener('mousemove', debouncedOnMouseMove);
2710
+ mouseMoveListeners = mouseMoveListeners.filter(function (listener) {
2711
+ return listener !== debouncedOnMouseMove;
2712
+ });
2713
+ }
2714
+
2715
+ function onDocumentPress(event) {
2716
+ // Moved finger to scroll instead of an intentional tap outside
2717
+ if (currentInput.isTouch) {
2718
+ if (didTouchMove || event.type === 'mousedown') {
2719
+ return;
2720
+ }
2721
+ }
2722
+
2723
+ var actualTarget = event.composedPath && event.composedPath()[0] || event.target; // Clicked on interactive popper
2724
+
2725
+ if (instance.props.interactive && actualContains(popper, actualTarget)) {
2726
+ return;
2727
+ } // Clicked on the event listeners target
2728
+
2729
+
2730
+ if (normalizeToArray(instance.props.triggerTarget || reference).some(function (el) {
2731
+ return actualContains(el, actualTarget);
2732
+ })) {
2733
+ if (currentInput.isTouch) {
2734
+ return;
2735
+ }
2736
+
2737
+ if (instance.state.isVisible && instance.props.trigger.indexOf('click') >= 0) {
2738
+ return;
2739
+ }
2740
+ } else {
2741
+ invokeHook('onClickOutside', [instance, event]);
2742
+ }
2743
+
2744
+ if (instance.props.hideOnClick === true) {
2745
+ instance.clearDelayTimeouts();
2746
+ instance.hide(); // `mousedown` event is fired right before `focus` if pressing the
2747
+ // currentTarget. This lets a tippy with `focus` trigger know that it
2748
+ // should not show
2749
+
2750
+ didHideDueToDocumentMouseDown = true;
2751
+ setTimeout(function () {
2752
+ didHideDueToDocumentMouseDown = false;
2753
+ }); // The listener gets added in `scheduleShow()`, but this may be hiding it
2754
+ // before it shows, and hide()'s early bail-out behavior can prevent it
2755
+ // from being cleaned up
2756
+
2757
+ if (!instance.state.isMounted) {
2758
+ removeDocumentPress();
2759
+ }
2760
+ }
2761
+ }
2762
+
2763
+ function onTouchMove() {
2764
+ didTouchMove = true;
2765
+ }
2766
+
2767
+ function onTouchStart() {
2768
+ didTouchMove = false;
2769
+ }
2770
+
2771
+ function addDocumentPress() {
2772
+ var doc = getDocument();
2773
+ doc.addEventListener('mousedown', onDocumentPress, true);
2774
+ doc.addEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
2775
+ doc.addEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
2776
+ doc.addEventListener('touchmove', onTouchMove, TOUCH_OPTIONS);
2777
+ }
2778
+
2779
+ function removeDocumentPress() {
2780
+ var doc = getDocument();
2781
+ doc.removeEventListener('mousedown', onDocumentPress, true);
2782
+ doc.removeEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
2783
+ doc.removeEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
2784
+ doc.removeEventListener('touchmove', onTouchMove, TOUCH_OPTIONS);
2785
+ }
2786
+
2787
+ function onTransitionedOut(duration, callback) {
2788
+ onTransitionEnd(duration, function () {
2789
+ if (!instance.state.isVisible && popper.parentNode && popper.parentNode.contains(popper)) {
2790
+ callback();
2791
+ }
2792
+ });
2793
+ }
2794
+
2795
+ function onTransitionedIn(duration, callback) {
2796
+ onTransitionEnd(duration, callback);
2797
+ }
2798
+
2799
+ function onTransitionEnd(duration, callback) {
2800
+ var box = getDefaultTemplateChildren().box;
2801
+
2802
+ function listener(event) {
2803
+ if (event.target === box) {
2804
+ updateTransitionEndListener(box, 'remove', listener);
2805
+ callback();
2806
+ }
2807
+ } // Make callback synchronous if duration is 0
2808
+ // `transitionend` won't fire otherwise
2809
+
2810
+
2811
+ if (duration === 0) {
2812
+ return callback();
2813
+ }
2814
+
2815
+ updateTransitionEndListener(box, 'remove', currentTransitionEndListener);
2816
+ updateTransitionEndListener(box, 'add', listener);
2817
+ currentTransitionEndListener = listener;
2818
+ }
2819
+
2820
+ function on(eventType, handler, options) {
2821
+ if (options === void 0) {
2822
+ options = false;
2823
+ }
2824
+
2825
+ var nodes = normalizeToArray(instance.props.triggerTarget || reference);
2826
+ nodes.forEach(function (node) {
2827
+ node.addEventListener(eventType, handler, options);
2828
+ listeners.push({
2829
+ node: node,
2830
+ eventType: eventType,
2831
+ handler: handler,
2832
+ options: options
2833
+ });
2834
+ });
2835
+ }
2836
+
2837
+ function addListeners() {
2838
+ if (getIsCustomTouchBehavior()) {
2839
+ on('touchstart', onTrigger, {
2840
+ passive: true
2841
+ });
2842
+ on('touchend', onMouseLeave, {
2843
+ passive: true
2844
+ });
2845
+ }
2846
+
2847
+ splitBySpaces(instance.props.trigger).forEach(function (eventType) {
2848
+ if (eventType === 'manual') {
2849
+ return;
2850
+ }
2851
+
2852
+ on(eventType, onTrigger);
2853
+
2854
+ switch (eventType) {
2855
+ case 'mouseenter':
2856
+ on('mouseleave', onMouseLeave);
2857
+ break;
2858
+
2859
+ case 'focus':
2860
+ on(isIE11 ? 'focusout' : 'blur', onBlurOrFocusOut);
2861
+ break;
2862
+
2863
+ case 'focusin':
2864
+ on('focusout', onBlurOrFocusOut);
2865
+ break;
2866
+ }
2867
+ });
2868
+ }
2869
+
2870
+ function removeListeners() {
2871
+ listeners.forEach(function (_ref) {
2872
+ var node = _ref.node,
2873
+ eventType = _ref.eventType,
2874
+ handler = _ref.handler,
2875
+ options = _ref.options;
2876
+ node.removeEventListener(eventType, handler, options);
2877
+ });
2878
+ listeners = [];
2879
+ }
2880
+
2881
+ function onTrigger(event) {
2882
+ var _lastTriggerEvent;
2883
+
2884
+ var shouldScheduleClickHide = false;
2885
+
2886
+ if (!instance.state.isEnabled || isEventListenerStopped(event) || didHideDueToDocumentMouseDown) {
2887
+ return;
2888
+ }
2889
+
2890
+ var wasFocused = ((_lastTriggerEvent = lastTriggerEvent) == null ? void 0 : _lastTriggerEvent.type) === 'focus';
2891
+ lastTriggerEvent = event;
2892
+ currentTarget = event.currentTarget;
2893
+ handleAriaExpandedAttribute();
2894
+
2895
+ if (!instance.state.isVisible && isMouseEvent(event)) {
2896
+ // If scrolling, `mouseenter` events can be fired if the cursor lands
2897
+ // over a new target, but `mousemove` events don't get fired. This
2898
+ // causes interactive tooltips to get stuck open until the cursor is
2899
+ // moved
2900
+ mouseMoveListeners.forEach(function (listener) {
2901
+ return listener(event);
2902
+ });
2903
+ } // Toggle show/hide when clicking click-triggered tooltips
2904
+
2905
+
2906
+ if (event.type === 'click' && (instance.props.trigger.indexOf('mouseenter') < 0 || isVisibleFromClick) && instance.props.hideOnClick !== false && instance.state.isVisible) {
2907
+ shouldScheduleClickHide = true;
2908
+ } else {
2909
+ scheduleShow(event);
2910
+ }
2911
+
2912
+ if (event.type === 'click') {
2913
+ isVisibleFromClick = !shouldScheduleClickHide;
2914
+ }
2915
+
2916
+ if (shouldScheduleClickHide && !wasFocused) {
2917
+ scheduleHide(event);
2918
+ }
2919
+ }
2920
+
2921
+ function onMouseMove(event) {
2922
+ var target = event.target;
2923
+ var isCursorOverReferenceOrPopper = getCurrentTarget().contains(target) || popper.contains(target);
2924
+
2925
+ if (event.type === 'mousemove' && isCursorOverReferenceOrPopper) {
2926
+ return;
2927
+ }
2928
+
2929
+ var popperTreeData = getNestedPopperTree().concat(popper).map(function (popper) {
2930
+ var _instance$popperInsta;
2931
+
2932
+ var instance = popper._tippy;
2933
+ var state = (_instance$popperInsta = instance.popperInstance) == null ? void 0 : _instance$popperInsta.state;
2934
+
2935
+ if (state) {
2936
+ return {
2937
+ popperRect: popper.getBoundingClientRect(),
2938
+ popperState: state,
2939
+ props: props
2940
+ };
2941
+ }
2942
+
2943
+ return null;
2944
+ }).filter(Boolean);
2945
+
2946
+ if (isCursorOutsideInteractiveBorder(popperTreeData, event)) {
2947
+ cleanupInteractiveMouseListeners();
2948
+ scheduleHide(event);
2949
+ }
2950
+ }
2951
+
2952
+ function onMouseLeave(event) {
2953
+ var shouldBail = isEventListenerStopped(event) || instance.props.trigger.indexOf('click') >= 0 && isVisibleFromClick;
2954
+
2955
+ if (shouldBail) {
2956
+ return;
2957
+ }
2958
+
2959
+ if (instance.props.interactive) {
2960
+ instance.hideWithInteractivity(event);
2961
+ return;
2962
+ }
2963
+
2964
+ scheduleHide(event);
2965
+ }
2966
+
2967
+ function onBlurOrFocusOut(event) {
2968
+ if (instance.props.trigger.indexOf('focusin') < 0 && event.target !== getCurrentTarget()) {
2969
+ return;
2970
+ } // If focus was moved to within the popper
2971
+
2972
+
2973
+ if (instance.props.interactive && event.relatedTarget && popper.contains(event.relatedTarget)) {
2974
+ return;
2975
+ }
2976
+
2977
+ scheduleHide(event);
2978
+ }
2979
+
2980
+ function isEventListenerStopped(event) {
2981
+ return currentInput.isTouch ? getIsCustomTouchBehavior() !== event.type.indexOf('touch') >= 0 : false;
2982
+ }
2983
+
2984
+ function createPopperInstance() {
2985
+ destroyPopperInstance();
2986
+ var _instance$props2 = instance.props,
2987
+ popperOptions = _instance$props2.popperOptions,
2988
+ placement = _instance$props2.placement,
2989
+ offset = _instance$props2.offset,
2990
+ getReferenceClientRect = _instance$props2.getReferenceClientRect,
2991
+ moveTransition = _instance$props2.moveTransition;
2992
+ var arrow = getIsDefaultRenderFn() ? getChildren(popper).arrow : null;
2993
+ var computedReference = getReferenceClientRect ? {
2994
+ getBoundingClientRect: getReferenceClientRect,
2995
+ contextElement: getReferenceClientRect.contextElement || getCurrentTarget()
2996
+ } : reference;
2997
+ var tippyModifier = {
2998
+ name: '$$tippy',
2999
+ enabled: true,
3000
+ phase: 'beforeWrite',
3001
+ requires: ['computeStyles'],
3002
+ fn: function fn(_ref2) {
3003
+ var state = _ref2.state;
3004
+
3005
+ if (getIsDefaultRenderFn()) {
3006
+ var _getDefaultTemplateCh = getDefaultTemplateChildren(),
3007
+ box = _getDefaultTemplateCh.box;
3008
+
3009
+ ['placement', 'reference-hidden', 'escaped'].forEach(function (attr) {
3010
+ if (attr === 'placement') {
3011
+ box.setAttribute('data-placement', state.placement);
3012
+ } else {
3013
+ if (state.attributes.popper["data-popper-" + attr]) {
3014
+ box.setAttribute("data-" + attr, '');
3015
+ } else {
3016
+ box.removeAttribute("data-" + attr);
3017
+ }
3018
+ }
3019
+ });
3020
+ state.attributes.popper = {};
3021
+ }
3022
+ }
3023
+ };
3024
+ var modifiers = [{
3025
+ name: 'offset',
3026
+ options: {
3027
+ offset: offset
3028
+ }
3029
+ }, {
3030
+ name: 'preventOverflow',
3031
+ options: {
3032
+ padding: {
3033
+ top: 2,
3034
+ bottom: 2,
3035
+ left: 5,
3036
+ right: 5
3037
+ }
3038
+ }
3039
+ }, {
3040
+ name: 'flip',
3041
+ options: {
3042
+ padding: 5
3043
+ }
3044
+ }, {
3045
+ name: 'computeStyles',
3046
+ options: {
3047
+ adaptive: !moveTransition
3048
+ }
3049
+ }, tippyModifier];
3050
+
3051
+ if (getIsDefaultRenderFn() && arrow) {
3052
+ modifiers.push({
3053
+ name: 'arrow',
3054
+ options: {
3055
+ element: arrow,
3056
+ padding: 3
3057
+ }
3058
+ });
3059
+ }
3060
+
3061
+ modifiers.push.apply(modifiers, (popperOptions == null ? void 0 : popperOptions.modifiers) || []);
3062
+ instance.popperInstance = createPopper(computedReference, popper, Object.assign({}, popperOptions, {
3063
+ placement: placement,
3064
+ onFirstUpdate: onFirstUpdate,
3065
+ modifiers: modifiers
3066
+ }));
3067
+ }
3068
+
3069
+ function destroyPopperInstance() {
3070
+ if (instance.popperInstance) {
3071
+ instance.popperInstance.destroy();
3072
+ instance.popperInstance = null;
3073
+ }
3074
+ }
3075
+
3076
+ function mount() {
3077
+ var appendTo = instance.props.appendTo;
3078
+ var parentNode; // By default, we'll append the popper to the triggerTargets's parentNode so
3079
+ // it's directly after the reference element so the elements inside the
3080
+ // tippy can be tabbed to
3081
+ // If there are clipping issues, the user can specify a different appendTo
3082
+ // and ensure focus management is handled correctly manually
3083
+
3084
+ var node = getCurrentTarget();
3085
+
3086
+ if (instance.props.interactive && appendTo === TIPPY_DEFAULT_APPEND_TO || appendTo === 'parent') {
3087
+ parentNode = node.parentNode;
3088
+ } else {
3089
+ parentNode = invokeWithArgsOrReturn(appendTo, [node]);
3090
+ } // The popper element needs to exist on the DOM before its position can be
3091
+ // updated as Popper needs to read its dimensions
3092
+
3093
+
3094
+ if (!parentNode.contains(popper)) {
3095
+ parentNode.appendChild(popper);
3096
+ }
3097
+
3098
+ instance.state.isMounted = true;
3099
+ createPopperInstance();
3100
+ }
3101
+
3102
+ function getNestedPopperTree() {
3103
+ return arrayFrom(popper.querySelectorAll('[data-tippy-root]'));
3104
+ }
3105
+
3106
+ function scheduleShow(event) {
3107
+ instance.clearDelayTimeouts();
3108
+
3109
+ if (event) {
3110
+ invokeHook('onTrigger', [instance, event]);
3111
+ }
3112
+
3113
+ addDocumentPress();
3114
+ var delay = getDelay(true);
3115
+
3116
+ var _getNormalizedTouchSe = getNormalizedTouchSettings(),
3117
+ touchValue = _getNormalizedTouchSe[0],
3118
+ touchDelay = _getNormalizedTouchSe[1];
3119
+
3120
+ if (currentInput.isTouch && touchValue === 'hold' && touchDelay) {
3121
+ delay = touchDelay;
3122
+ }
3123
+
3124
+ if (delay) {
3125
+ showTimeout = setTimeout(function () {
3126
+ instance.show();
3127
+ }, delay);
3128
+ } else {
3129
+ instance.show();
3130
+ }
3131
+ }
3132
+
3133
+ function scheduleHide(event) {
3134
+ instance.clearDelayTimeouts();
3135
+ invokeHook('onUntrigger', [instance, event]);
3136
+
3137
+ if (!instance.state.isVisible) {
3138
+ removeDocumentPress();
3139
+ return;
3140
+ } // For interactive tippies, scheduleHide is added to a document.body handler
3141
+ // from onMouseLeave so must intercept scheduled hides from mousemove/leave
3142
+ // events when trigger contains mouseenter and click, and the tip is
3143
+ // currently shown as a result of a click.
3144
+
3145
+
3146
+ if (instance.props.trigger.indexOf('mouseenter') >= 0 && instance.props.trigger.indexOf('click') >= 0 && ['mouseleave', 'mousemove'].indexOf(event.type) >= 0 && isVisibleFromClick) {
3147
+ return;
3148
+ }
3149
+
3150
+ var delay = getDelay(false);
3151
+
3152
+ if (delay) {
3153
+ hideTimeout = setTimeout(function () {
3154
+ if (instance.state.isVisible) {
3155
+ instance.hide();
3156
+ }
3157
+ }, delay);
3158
+ } else {
3159
+ // Fixes a `transitionend` problem when it fires 1 frame too
3160
+ // late sometimes, we don't want hide() to be called.
3161
+ scheduleHideAnimationFrame = requestAnimationFrame(function () {
3162
+ instance.hide();
3163
+ });
3164
+ }
3165
+ } // ===========================================================================
3166
+ // 🔑 Public methods
3167
+ // ===========================================================================
3168
+
3169
+
3170
+ function enable() {
3171
+ instance.state.isEnabled = true;
3172
+ }
3173
+
3174
+ function disable() {
3175
+ // Disabling the instance should also hide it
3176
+ // https://github.com/atomiks/tippy.js-react/issues/106
3177
+ instance.hide();
3178
+ instance.state.isEnabled = false;
3179
+ }
3180
+
3181
+ function clearDelayTimeouts() {
3182
+ clearTimeout(showTimeout);
3183
+ clearTimeout(hideTimeout);
3184
+ cancelAnimationFrame(scheduleHideAnimationFrame);
3185
+ }
3186
+
3187
+ function setProps(partialProps) {
3188
+
3189
+ if (instance.state.isDestroyed) {
3190
+ return;
3191
+ }
3192
+
3193
+ invokeHook('onBeforeUpdate', [instance, partialProps]);
3194
+ removeListeners();
3195
+ var prevProps = instance.props;
3196
+ var nextProps = evaluateProps(reference, Object.assign({}, prevProps, removeUndefinedProps(partialProps), {
3197
+ ignoreAttributes: true
3198
+ }));
3199
+ instance.props = nextProps;
3200
+ addListeners();
3201
+
3202
+ if (prevProps.interactiveDebounce !== nextProps.interactiveDebounce) {
3203
+ cleanupInteractiveMouseListeners();
3204
+ debouncedOnMouseMove = debounce(onMouseMove, nextProps.interactiveDebounce);
3205
+ } // Ensure stale aria-expanded attributes are removed
3206
+
3207
+
3208
+ if (prevProps.triggerTarget && !nextProps.triggerTarget) {
3209
+ normalizeToArray(prevProps.triggerTarget).forEach(function (node) {
3210
+ node.removeAttribute('aria-expanded');
3211
+ });
3212
+ } else if (nextProps.triggerTarget) {
3213
+ reference.removeAttribute('aria-expanded');
3214
+ }
3215
+
3216
+ handleAriaExpandedAttribute();
3217
+ handleStyles();
3218
+
3219
+ if (onUpdate) {
3220
+ onUpdate(prevProps, nextProps);
3221
+ }
3222
+
3223
+ if (instance.popperInstance) {
3224
+ createPopperInstance(); // Fixes an issue with nested tippies if they are all getting re-rendered,
3225
+ // and the nested ones get re-rendered first.
3226
+ // https://github.com/atomiks/tippyjs-react/issues/177
3227
+ // TODO: find a cleaner / more efficient solution(!)
3228
+
3229
+ getNestedPopperTree().forEach(function (nestedPopper) {
3230
+ // React (and other UI libs likely) requires a rAF wrapper as it flushes
3231
+ // its work in one
3232
+ requestAnimationFrame(nestedPopper._tippy.popperInstance.forceUpdate);
3233
+ });
3234
+ }
3235
+
3236
+ invokeHook('onAfterUpdate', [instance, partialProps]);
3237
+ }
3238
+
3239
+ function setContent(content) {
3240
+ instance.setProps({
3241
+ content: content
3242
+ });
3243
+ }
3244
+
3245
+ function show() {
3246
+
3247
+
3248
+ var isAlreadyVisible = instance.state.isVisible;
3249
+ var isDestroyed = instance.state.isDestroyed;
3250
+ var isDisabled = !instance.state.isEnabled;
3251
+ var isTouchAndTouchDisabled = currentInput.isTouch && !instance.props.touch;
3252
+ var duration = getValueAtIndexOrReturn(instance.props.duration, 0, defaultProps.duration);
3253
+
3254
+ if (isAlreadyVisible || isDestroyed || isDisabled || isTouchAndTouchDisabled) {
3255
+ return;
3256
+ } // Normalize `disabled` behavior across browsers.
3257
+ // Firefox allows events on disabled elements, but Chrome doesn't.
3258
+ // Using a wrapper element (i.e. <span>) is recommended.
3259
+
3260
+
3261
+ if (getCurrentTarget().hasAttribute('disabled')) {
3262
+ return;
3263
+ }
3264
+
3265
+ invokeHook('onShow', [instance], false);
3266
+
3267
+ if (instance.props.onShow(instance) === false) {
3268
+ return;
3269
+ }
3270
+
3271
+ instance.state.isVisible = true;
3272
+
3273
+ if (getIsDefaultRenderFn()) {
3274
+ popper.style.visibility = 'visible';
3275
+ }
3276
+
3277
+ handleStyles();
3278
+ addDocumentPress();
3279
+
3280
+ if (!instance.state.isMounted) {
3281
+ popper.style.transition = 'none';
3282
+ } // If flipping to the opposite side after hiding at least once, the
3283
+ // animation will use the wrong placement without resetting the duration
3284
+
3285
+
3286
+ if (getIsDefaultRenderFn()) {
3287
+ var _getDefaultTemplateCh2 = getDefaultTemplateChildren(),
3288
+ box = _getDefaultTemplateCh2.box,
3289
+ content = _getDefaultTemplateCh2.content;
3290
+
3291
+ setTransitionDuration([box, content], 0);
3292
+ }
3293
+
3294
+ onFirstUpdate = function onFirstUpdate() {
3295
+ var _instance$popperInsta2;
3296
+
3297
+ if (!instance.state.isVisible || ignoreOnFirstUpdate) {
3298
+ return;
3299
+ }
3300
+
3301
+ ignoreOnFirstUpdate = true; // reflow
3302
+ popper.style.transition = instance.props.moveTransition;
3303
+
3304
+ if (getIsDefaultRenderFn() && instance.props.animation) {
3305
+ var _getDefaultTemplateCh3 = getDefaultTemplateChildren(),
3306
+ _box = _getDefaultTemplateCh3.box,
3307
+ _content = _getDefaultTemplateCh3.content;
3308
+
3309
+ setTransitionDuration([_box, _content], duration);
3310
+ setVisibilityState([_box, _content], 'visible');
3311
+ }
3312
+
3313
+ handleAriaContentAttribute();
3314
+ handleAriaExpandedAttribute();
3315
+ pushIfUnique(mountedInstances, instance); // certain modifiers (e.g. `maxSize`) require a second update after the
3316
+ // popper has been positioned for the first time
3317
+
3318
+ (_instance$popperInsta2 = instance.popperInstance) == null ? void 0 : _instance$popperInsta2.forceUpdate();
3319
+ invokeHook('onMount', [instance]);
3320
+
3321
+ if (instance.props.animation && getIsDefaultRenderFn()) {
3322
+ onTransitionedIn(duration, function () {
3323
+ instance.state.isShown = true;
3324
+ invokeHook('onShown', [instance]);
3325
+ });
3326
+ }
3327
+ };
3328
+
3329
+ mount();
3330
+ }
3331
+
3332
+ function hide() {
3333
+
3334
+
3335
+ var isAlreadyHidden = !instance.state.isVisible;
3336
+ var isDestroyed = instance.state.isDestroyed;
3337
+ var isDisabled = !instance.state.isEnabled;
3338
+ var duration = getValueAtIndexOrReturn(instance.props.duration, 1, defaultProps.duration);
3339
+
3340
+ if (isAlreadyHidden || isDestroyed || isDisabled) {
3341
+ return;
3342
+ }
3343
+
3344
+ invokeHook('onHide', [instance], false);
3345
+
3346
+ if (instance.props.onHide(instance) === false) {
3347
+ return;
3348
+ }
3349
+
3350
+ instance.state.isVisible = false;
3351
+ instance.state.isShown = false;
3352
+ ignoreOnFirstUpdate = false;
3353
+ isVisibleFromClick = false;
3354
+
3355
+ if (getIsDefaultRenderFn()) {
3356
+ popper.style.visibility = 'hidden';
3357
+ }
3358
+
3359
+ cleanupInteractiveMouseListeners();
3360
+ removeDocumentPress();
3361
+ handleStyles(true);
3362
+
3363
+ if (getIsDefaultRenderFn()) {
3364
+ var _getDefaultTemplateCh4 = getDefaultTemplateChildren(),
3365
+ box = _getDefaultTemplateCh4.box,
3366
+ content = _getDefaultTemplateCh4.content;
3367
+
3368
+ if (instance.props.animation) {
3369
+ setTransitionDuration([box, content], duration);
3370
+ setVisibilityState([box, content], 'hidden');
3371
+ }
3372
+ }
3373
+
3374
+ handleAriaContentAttribute();
3375
+ handleAriaExpandedAttribute();
3376
+
3377
+ if (instance.props.animation) {
3378
+ if (getIsDefaultRenderFn()) {
3379
+ onTransitionedOut(duration, instance.unmount);
3380
+ }
3381
+ } else {
3382
+ instance.unmount();
3383
+ }
3384
+ }
3385
+
3386
+ function hideWithInteractivity(event) {
3387
+
3388
+ getDocument().addEventListener('mousemove', debouncedOnMouseMove);
3389
+ pushIfUnique(mouseMoveListeners, debouncedOnMouseMove);
3390
+ debouncedOnMouseMove(event);
3391
+ }
3392
+
3393
+ function unmount() {
3394
+
3395
+ if (instance.state.isVisible) {
3396
+ instance.hide();
3397
+ }
3398
+
3399
+ if (!instance.state.isMounted) {
3400
+ return;
3401
+ }
3402
+
3403
+ destroyPopperInstance(); // If a popper is not interactive, it will be appended outside the popper
3404
+ // tree by default. This seems mainly for interactive tippies, but we should
3405
+ // find a workaround if possible
3406
+
3407
+ getNestedPopperTree().forEach(function (nestedPopper) {
3408
+ nestedPopper._tippy.unmount();
3409
+ });
3410
+
3411
+ if (popper.parentNode) {
3412
+ popper.parentNode.removeChild(popper);
3413
+ }
3414
+
3415
+ mountedInstances = mountedInstances.filter(function (i) {
3416
+ return i !== instance;
3417
+ });
3418
+ instance.state.isMounted = false;
3419
+ invokeHook('onHidden', [instance]);
3420
+ }
3421
+
3422
+ function destroy() {
3423
+
3424
+ if (instance.state.isDestroyed) {
3425
+ return;
3426
+ }
3427
+
3428
+ instance.clearDelayTimeouts();
3429
+ instance.unmount();
3430
+ removeListeners();
3431
+ delete reference._tippy;
3432
+ instance.state.isDestroyed = true;
3433
+ invokeHook('onDestroy', [instance]);
3434
+ }
3435
+ }
3436
+
3437
+ function tippy(targets, optionalProps) {
3438
+ if (optionalProps === void 0) {
3439
+ optionalProps = {};
3440
+ }
3441
+
3442
+ var plugins = defaultProps.plugins.concat(optionalProps.plugins || []);
3443
+
3444
+ bindGlobalEventListeners();
3445
+ var passedProps = Object.assign({}, optionalProps, {
3446
+ plugins: plugins
3447
+ });
3448
+ var elements = getArrayOfElements(targets);
3449
+
3450
+ var instances = elements.reduce(function (acc, reference) {
3451
+ var instance = reference && createTippy(reference, passedProps);
3452
+
3453
+ if (instance) {
3454
+ acc.push(instance);
3455
+ }
3456
+
3457
+ return acc;
3458
+ }, []);
3459
+ return isElement(targets) ? instances[0] : instances;
3460
+ }
3461
+
3462
+ tippy.defaultProps = defaultProps;
3463
+ tippy.setDefaultProps = setDefaultProps;
3464
+ tippy.currentInput = currentInput;
3465
+
3466
+ // every time the popper is destroyed (i.e. a new target), removing the styles
3467
+ // and causing transitions to break for singletons when the console is open, but
3468
+ // most notably for non-transform styles being used, `gpuAcceleration: false`.
3469
+
3470
+ Object.assign({}, applyStyles$1, {
3471
+ effect: function effect(_ref) {
3472
+ var state = _ref.state;
3473
+ var initialStyles = {
3474
+ popper: {
3475
+ position: state.options.strategy,
3476
+ left: '0',
3477
+ top: '0',
3478
+ margin: '0'
3479
+ },
3480
+ arrow: {
3481
+ position: 'absolute'
3482
+ },
3483
+ reference: {}
3484
+ };
3485
+ Object.assign(state.elements.popper.style, initialStyles.popper);
3486
+ state.styles = initialStyles;
3487
+
3488
+ if (state.elements.arrow) {
3489
+ Object.assign(state.elements.arrow.style, initialStyles.arrow);
3490
+ } // intentionally return no cleanup function
3491
+ // return () => { ... }
3492
+
3493
+ }
3494
+ });
3495
+
3496
+ tippy.setDefaultProps({
3497
+ render: render
3498
+ });
3499
+
3500
+ const covetPicsHotspotsCss = ".tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{position:relative;background-color:#333;color:#fff;border-radius:4px;font-size:14px;line-height:1.4;white-space:normal;outline:0;-webkit-transition-property:visibility, opacity, -webkit-transform;transition-property:visibility, opacity, -webkit-transform;transition-property:transform, visibility, opacity;transition-property:transform, visibility, opacity, -webkit-transform}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{bottom:-7px;left:0;border-width:8px 8px 0;border-top-color:initial;-webkit-transform-origin:center top;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{top:-7px;left:0;border-width:0 8px 8px;border-bottom-color:initial;-webkit-transform-origin:center bottom;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-width:8px 0 8px 8px;border-left-color:initial;right:-7px;-webkit-transform-origin:center left;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{left:-7px;border-width:8px 8px 8px 0;border-right-color:initial;-webkit-transform-origin:center right;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{-webkit-transition-timing-function:cubic-bezier(0.54, 1.5, 0.38, 1.11);transition-timing-function:cubic-bezier(0.54, 1.5, 0.38, 1.11)}.tippy-arrow{width:16px;height:16px;color:#333}.tippy-arrow:before{content:\"\";position:absolute;border-color:transparent;border-style:solid}.tippy-content{position:relative;padding:5px 9px;z-index:1}.tippy-box[data-animation=shift-toward-extreme][data-state=hidden]{opacity:0}.tippy-box[data-animation=shift-toward-extreme][data-state=hidden][data-placement^=top]{-webkit-transform:translateY(-20px);transform:translateY(-20px)}.tippy-box[data-animation=shift-toward-extreme][data-state=hidden][data-placement^=bottom]{-webkit-transform:translateY(20px);transform:translateY(20px)}.tippy-box[data-animation=shift-toward-extreme][data-state=hidden][data-placement^=left]{-webkit-transform:translateX(-20px);transform:translateX(-20px)}.tippy-box[data-animation=shift-toward-extreme][data-state=hidden][data-placement^=right]{-webkit-transform:translateX(20px);transform:translateX(20px)}covet-pics-hotspots{position:absolute;left:0;top:0;right:0;bottom:0}.hotspot{position:absolute;width:15px;height:15px;background-color:var(--covet-pics-hotspot-color);border-radius:50%;visibility:hidden;z-index:1;outline:none !important}.hotspot.active{visibility:visible}.pulse{width:calc(100% - 10px);height:calc(100% - 10px);display:block;position:absolute;-webkit-transform:scale(1);transform:scale(1);border:5px solid var(--covet-pics-hotspot-color);border-radius:50%;opacity:0.5;visibility:hidden}.hotspot:hover .pulse,.hotspot:active .pulse,.hotspot:focus .pulse,.hotspot.active .pulse{visibility:visible;-webkit-animation:hotspot-pulse 1.5s ease-out;animation:hotspot-pulse 1.5s ease-out;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite}.show-hotspot-numbers .hotspot{width:24px;height:24px;line-height:25px;counter-increment:imgtag;font-size:13px;font-weight:bold;text-align:center;text-decoration:none;text-shadow:0 1px 1px rgba(0, 0, 0, 0.15)}.show-hotspot-numbers .hotspot:after{display:block;text-align:center;content:counter(imgtag);color:var(--covet-pics-hotspots-text-color)}@-webkit-keyframes hotspot-pulse{0%{opacity:0.5;-webkit-transform:scale(1);transform:scale(1)}100%{opacity:0;-webkit-transform:scale(2);transform:scale(2)}}@keyframes hotspot-pulse{0%{opacity:0.5;-webkit-transform:scale(1);transform:scale(1)}100%{opacity:0;-webkit-transform:scale(2);transform:scale(2)}}@media (any-hover: hover){.post-image{outline:none !important}.post-image:hover .hotspot,.post-image:active .hotspot,.post-image:focus .hotspot{visibility:visible}}@media (any-hover: none){.post-image .hotspot{visibility:visible}}.tippy-box{padding:0;font-family:unset;border-radius:0;margin:0;border:none;background-color:transparent}.tippy-box .tippy-content{background-color:#000;padding:6px 12px;text-transform:uppercase;max-width:250px;-webkit-transition:opacity 0.3s, margin 0.3s;transition:opacity 0.3s, margin 0.3s;border-radius:1px;font-size:12px}.tippy-box .tippy-content .product-title{color:#fff;display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tippy-box .tippy-content .price{color:#a0a0a0;font-size:11px}";
3501
+
3502
+ const CovetPicsHotspots = class {
3503
+ constructor(hostRef) {
3504
+ index.registerInstance(this, hostRef);
3505
+ this.tooltips = [];
3506
+ this.links = [];
3507
+ this.backgroundColor = "#000000";
3508
+ this.textColor = "#FFFFFF";
3509
+ this.showNumbers = false;
3510
+ }
3511
+ linkInactivateHandler() {
3512
+ this.el.querySelectorAll(".hotspot").forEach(hotspot => hotspot.classList.remove("active"));
3513
+ this.tooltips.forEach(tooltip => tooltip.hide());
3514
+ }
3515
+ linkActivateHandler(event) {
3516
+ const id = event.detail;
3517
+ const tooltip = this.tooltips.find(t => t.reference.getAttribute("data-link-id") === id.toString());
3518
+ if (typeof tooltip !== "undefined") {
3519
+ tooltip.show();
3520
+ }
3521
+ this.el.querySelectorAll(`.hotspot[data-link-id="${id}"]`).forEach(hotspot => hotspot.classList.add("active"));
3522
+ }
3523
+ componentDidLoad() {
3524
+ this.initTooltips();
3525
+ }
3526
+ componentDidUpdate() {
3527
+ this.tooltips.forEach(instance => instance.destroy());
3528
+ this.tooltips = [];
3529
+ this.initTooltips();
3530
+ }
3531
+ getItemCSSVariables() {
3532
+ return {
3533
+ "--covet-pics-hotspot-color": this.backgroundColor,
3534
+ "--covet-pics-hotspots-text-color": this.textColor,
3535
+ };
3536
+ }
3537
+ getPositionForLink(link) {
3538
+ return {
3539
+ "left": (link.position_x * 100).toString() + "%",
3540
+ "top": (link.position_y * 100).toString() + "%"
3541
+ };
3542
+ }
3543
+ initTooltips() {
3544
+ this.tooltips = tippy(this.el.querySelectorAll("[data-tippy-content]"), {
3545
+ appendTo: "parent",
3546
+ allowHTML: true,
3547
+ arrow: false,
3548
+ animation: "shift-toward-extreme",
3549
+ });
3550
+ }
3551
+ render() {
3552
+ return (index.h(index.Host, { class: { "show-hotspot-numbers": this.showNumbers }, style: this.getItemCSSVariables() }, this.links.map(link => index.h("a", { class: "hotspot", tabindex: "0", href: link.link, target: "_top", style: this.getPositionForLink(link), "data-link-id": link.id, "data-tippy-content": `<span class="product-title">${link.title}</span><span class="price">${link.prices ? link.prices.price_label : ""} &gt;</span>`, "aria-label": `Hotspot link to '${link.title}'` }, index.h("span", { class: "pulse" })))));
3553
+ }
3554
+ get el() { return index.getElement(this); }
3555
+ };
3556
+ CovetPicsHotspots.style = covetPicsHotspotsCss;
3557
+
3558
+ const covetGalleryPopupLinksCss = ".links{overflow:hidden;list-style:none;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-pack:justify;justify-content:space-between;padding:0 20px}.links.grid .product:nth-last-child(2),.links.grid .product:last-child{margin-bottom:0}.links.links-1{-ms-flex-pack:distribute;justify-content:space-around}.links.grey-border{position:relative;padding-bottom:40px;margin-bottom:40px}.links.grey-border:after{content:\"\";position:absolute;bottom:0;left:50%;height:1px;width:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%);background-color:#F0F0F0}.links .product{width:50%;margin-bottom:40px;text-align:center}.links .product-link{display:block;text-decoration:none;height:176px;-webkit-box-sizing:border-box;box-sizing:border-box;padding-bottom:12px;outline:none !important;margin-bottom:4px}.links .product-link:hover .product-title,.links .product-link:hover .product-price,.links .product-link:active .product-title,.links .product-link:active .product-price,.links .product-link:focus .product-title,.links .product-link:focus .product-price{color:rgba(0, 0, 0, 0.7)}.links .product-link:hover .product-img,.links .product-link:hover .product-svg,.links .product-link:active .product-img,.links .product-link:active .product-svg,.links .product-link:focus .product-img,.links .product-link:focus .product-svg{-webkit-transform:scale(1.03);transform:scale(1.03)}.links .img-wrap{width:120px;height:120px;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;margin:0 auto 12px auto;-ms-flex-align:center;align-items:center;overflow:hidden}.links .product-img,.links .product-svg{display:block;height:100%;width:100%;margin-left:auto;margin-right:auto;-webkit-transform-origin:center center;transform-origin:center center;-webkit-transition:-webkit-transform 0.25s ease;transition:-webkit-transform 0.25s ease;transition:transform 0.25s ease;transition:transform 0.25s ease, -webkit-transform 0.25s ease;-o-object-fit:contain;object-fit:contain}.links .product-details{display:block}.links .product-title{font-family:var(--covet-pics-font-family);display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-transform:uppercase;font-size:11px;line-height:11px;font-weight:300;color:#101010;text-align:center;padding:0 8px;margin-bottom:6px;-webkit-transition:color 0.25s ease;transition:color 0.25s ease}.links .product-price{font-family:var(--covet-pics-font-family);display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-transform:uppercase;font-size:11px;line-height:11px;font-weight:600;color:#101010;text-align:center;padding:0 8px;margin-bottom:4px;-webkit-transition:color 0.25s ease;transition:color 0.25s ease}.links .product-sale{text-decoration:line-through;color:#5d5d5d}.links .btn-buy{display:block;color:var(--covet-pics-button-text-color);background-color:var(--covet-pics-button-color);font-size:11px;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;text-transform:uppercase;min-height:28px;min-width:86px;font-weight:normal;text-decoration:none;outline:none !important;margin-left:auto;margin-right:auto;-webkit-transition:all 0.25s ease;transition:all 0.25s ease}.links .btn-buy:hover,.links .btn-buy:focus,.links .btn-buy:active{background-color:var(--covet-pics-button-hover-color)}.links .btn-buy.style-1{background-color:#FFFFFF;border:0;color:var(--covet-pics-button-color);padding:0}.links .btn-buy.style-1 .btn-title{font-weight:600;padding-bottom:4px;border-bottom:1px solid var(--covet-pics-button-color)}.links .btn-buy.style-1:hover,.links .btn-buy.style-1:focus,.links .btn-buy.style-1:active{color:var(--covet-pics-button-text-hover-color)}.links .btn-buy.style-1:hover .btn-title,.links .btn-buy.style-1:focus .btn-title,.links .btn-buy.style-1:active .btn-title{border-bottom-color:var(--covet-pics-button-text-hover-color)}.links .btn-buy.style-2{background-color:#FFFFFF;color:var(--covet-pics-button-color);border:1px solid var(--covet-pics-button-color)}.links .btn-buy.style-2:hover,.links .btn-buy.style-2:focus,.links .btn-buy.style-2:active{color:var(--covet-pics-button-text-hover-color);background-color:var(--covet-pics-button-color)}.links .btn-buy.style-5.visit .btn-title{margin-right:4px}.links .icon-buy{margin-right:4px;width:14px;height:14px}.links .icon-buy .dynamic-fill{fill:var(--covet-pics-button-text-color)}.links.list{padding:0 30px}.links.list .product{width:100%;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;border-bottom:1px solid #F4F6F8;margin-bottom:0;height:64px}.links.list .product-link{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;height:auto;-webkit-box-sizing:border-box;box-sizing:border-box;padding-bottom:0;margin-bottom:0;-ms-flex:1 0 110px;flex:1 0 110px;overflow:hidden;padding-right:16px}@media only screen and (max-width: 799.98px){.links.list .product-link:hover .product-img,.links.list .product-link:hover .product-svg,.links.list .product-link:active .product-img,.links.list .product-link:active .product-svg,.links.list .product-link:focus .product-img,.links.list .product-link:focus .product-svg{-webkit-transform:scale(1.1);transform:scale(1.1)}}.links.list .product-details{-ms-flex-positive:1;flex-grow:1;overflow:hidden}.links.list .product-title{text-align:left;line-height:15px;margin-bottom:0;padding:0;width:100%}.links.list .product-price{text-align:left;line-height:12px;margin-bottom:0;padding:0}.links.list .product-sale{text-align:left;line-height:15px;margin-bottom:0}.links.list .img-wrap{height:32px;width:auto;margin-bottom:0;margin-right:9px}";
3559
+
3560
+ const CovetPicsPopupLinks = class {
3561
+ constructor(hostRef) {
3562
+ index.registerInstance(this, hostRef);
3563
+ this.buyButtonClickHandler = (event) => {
3564
+ const productId = event.currentTarget.getAttribute("data-product-id");
3565
+ const linkElement = event.target.closest(".product");
3566
+ const linkId = linkElement.getAttribute("data-link-id");
3567
+ const gaCampaign = event.currentTarget.getAttribute("data-ga-campaign");
3568
+ const productLinkClickedEvent = utils.buildEvent("productLinkClicked", { id: linkId, gaCampaign: gaCampaign });
3569
+ document.body.dispatchEvent(productLinkClickedEvent);
3570
+ if (this.settings.direct_add_to_cart && productId !== null) {
3571
+ event.preventDefault();
3572
+ event.stopPropagation();
3573
+ const openDirectBuyEvent = utils.buildEvent("openDirectBuy", productId);
3574
+ document.body.dispatchEvent(openDirectBuyEvent);
3575
+ this.appStore.dispatch(popup.setPopupProductId(parseInt(productId)));
3576
+ }
3577
+ };
3578
+ this.mouseEnterHandler = (event) => {
3579
+ event.preventDefault();
3580
+ event.stopPropagation();
3581
+ const linkActivateEvent = utils.buildEvent("linkActivate", event.target.dataset.linkId);
3582
+ const hotspotsComponent = this.el.closest(".popup").querySelector("covet-pics-hotspots");
3583
+ hotspotsComponent && hotspotsComponent.dispatchEvent(linkActivateEvent);
3584
+ };
3585
+ this.mouseLeaveHandler = (event) => {
3586
+ event.preventDefault();
3587
+ event.stopPropagation();
3588
+ const linkInactivateEvent = utils.buildEvent("linkInactivate", event.target.dataset.linkId);
3589
+ const hotspotsComponent = this.el.closest(".popup").querySelector("covet-pics-hotspots");
3590
+ hotspotsComponent && hotspotsComponent.dispatchEvent(linkInactivateEvent);
3591
+ };
3592
+ this.links = undefined;
3593
+ this.greyBorderClass = undefined;
3594
+ this.itemCreatedTime = undefined;
3595
+ this.appStore = undefined;
3596
+ this.settings = undefined;
3597
+ }
3598
+ componentWillLoad() {
3599
+ this.initStore();
3600
+ }
3601
+ disconnectedCallback() {
3602
+ this.unsubscribe();
3603
+ }
3604
+ initStore() {
3605
+ this.appState = this.appStore.getState();
3606
+ this.settings = this.appState.settings;
3607
+ this.unsubscribe = this.appStore.subscribe(() => {
3608
+ this.appState = this.appStore.getState();
3609
+ this.settings = this.appState.settings;
3610
+ });
3611
+ }
3612
+ getItemCSSVariables() {
3613
+ return {
3614
+ "--covet-pics-button-color": this.settings.popup_buy_button_background_color,
3615
+ "--covet-pics-button-hover-color": this.settings.popup_buy_button_background_hover_color,
3616
+ "--covet-pics-button-text-color": this.settings.popup_buy_button_text_color,
3617
+ "--covet-pics-button-text-hover-color": this.settings.popup_buy_button_text_hover_color
3618
+ };
3619
+ }
3620
+ imgAltTag(title, idx, itemsLength, createdTime) {
3621
+ return title && title.length > 0
3622
+ ? `${title}, product-link ${idx + 1}/${itemsLength}, created ${utils.getDateFromTimestamp(createdTime)}`
3623
+ : `product-link ${idx + 1}/${itemsLength}, created ${utils.getDateFromTimestamp(createdTime)}`;
3624
+ }
3625
+ renderLinkImage(link, idx, linksLength) {
3626
+ return (link.image !== null && link.image !== "")
3627
+ ? index.h("img", { class: "product-img", "data-src": link.image, alt: this.imgAltTag(link.title, idx, linksLength, this.itemCreatedTime), src: link.image })
3628
+ : index.h("svg", { class: "product-svg", viewBox: "0 0 48 48", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { d: "M14.101 42.314a6.955 6.955 0 01-4.95-2.051L7.736 38.85c-2.729-2.729-2.729-7.171 0-9.899l9.192-9.192c1.322-1.322 3.08-2.051 4.95-2.051s3.628.729 4.949 2.051l1.414 1.414a.999.999 0 11-1.414 1.414l-1.414-1.414a4.968 4.968 0 00-3.535-1.465 4.969 4.969 0 00-3.536 1.465L9.15 30.364a5.006 5.006 0 000 7.071l1.414 1.414a4.969 4.969 0 003.536 1.465 4.968 4.968 0 003.535-1.465L24 32.485a.999.999 0 111.414 1.414l-6.364 6.364a6.947 6.947 0 01-4.949 2.051z" }), index.h("path", { d: "M26.121 30.293a6.953 6.953 0 01-4.949-2.051.999.999 0 111.414-1.414 4.968 4.968 0 003.535 1.465 4.969 4.969 0 003.536-1.465l9.192-9.192a5.005 5.005 0 000-7.07L37.436 9.15a5.006 5.006 0 00-7.071 0L24 15.515a.999.999 0 11-1.414-1.414l6.364-6.364a7.008 7.008 0 019.899 0l1.414 1.415c2.729 2.729 2.729 7.17 0 9.898l-9.192 9.192a6.954 6.954 0 01-4.95 2.051z" }));
3629
+ }
3630
+ getLinkLabel(link) {
3631
+ if (link.shopify_product_id) {
3632
+ return this.settings.popup_products_button_caption;
3633
+ }
3634
+ else {
3635
+ return this.settings.popup_custom_link_label;
3636
+ }
3637
+ }
3638
+ getProductLinkLabel(link) {
3639
+ let priceText = "";
3640
+ if (link.prices && link.prices.price_label) {
3641
+ const removeHtmlTag = (el) => typeof el === "string" ? el.replace(/(<([^>]+)>)/gi, "") : el;
3642
+ const salePriceLabel = link.prices.is_on_sale && link.prices.sale_price && link.prices.sale_price !== ""
3643
+ ? `, sale price: ${link.prices.sale_price}`
3644
+ : "";
3645
+ priceText = `, price: ${removeHtmlTag(link.prices.price_label)} ${removeHtmlTag(salePriceLabel)}`;
3646
+ }
3647
+ return `Link to ${link.title}${priceText}`;
3648
+ }
3649
+ render() {
3650
+ // TODO: check buttonStyle this old todo (style-3 -> not implanted yet)
3651
+ const buttonStyle = this.settings.popup_buy_button_style.replace("buy_btn_", "").replace("_", "-");
3652
+ const linkStyle = this.settings.popup_products_view_type.replace("_view", "");
3653
+ return (index.h("ul", { class: `links ${linkStyle} ${this.greyBorderClass} links-${this.links.length.toString()}`, style: this.getItemCSSVariables(), role: "list" }, this.links.map((link, idx) => index.h("li", { class: "product", "data-link-id": link.id, onMouseEnter: this.mouseEnterHandler, onMouseLeave: this.mouseLeaveHandler, role: "listitem" }, index.h("a", { class: "product-link", target: link.new_tab ? "_blank" : "_top", "data-ga-campaign": link.title, href: link.link, "aria-label": this.getProductLinkLabel(link), role: "link" }, index.h("div", { class: "img-wrap" }, this.renderLinkImage(link, idx, this.links.length)), index.h("div", { class: "product-details" }, index.h("span", { class: "product-title" }, link.title), this.settings.show_price_in_popup && link.prices &&
3654
+ index.h("span", { class: "product-price", innerHTML: link.prices.price_label }), this.settings.show_price_in_popup && link.prices && link.prices.is_on_sale &&
3655
+ index.h("span", { class: "product-price product-sale", innerHTML: link.prices.sale_price }))), index.h("a", { class: `btn-buy ${buttonStyle}`, href: link.link, target: link.new_tab ? "_blank" : "_top", "data-ga-campaign": link.title, onClick: this.buyButtonClickHandler, "data-product-id": link.shopify_product_id, "aria-label": "Link to direct buy", role: "link" }, buttonStyle === "style-5" &&
3656
+ index.h("svg", { class: "icon-buy", viewBox: "0 0 14 14", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true" }, index.h("g", { fill: "none", "fill-rule": "evenodd" }, index.h("path", { d: "M0 0h14v14H0z" }), index.h("path", { class: "dynamic-fill", d: "M6.855 1.575c1.323 0 2.405 1.03 2.405 2.315v.352h1.57l.95 8.24H1.896l.95-8.24H4.45V3.89c0-1.23.994-2.229 2.241-2.31zM9.94 5.242h-.68l.001.262a.5.5 0 01-.41.492l-.09.008a.5.5 0 01-.5-.5v-.262H5.45v.262a.5.5 0 01-.41.492l-.09.008a.5.5 0 01-.5-.5v-.262h-.714l-.72 6.24h7.643l-.72-6.24zM6.855 2.575c-.781 0-1.405.594-1.405 1.315v.352h2.81V3.89c0-.679-.552-1.245-1.269-1.31z", fill: "#FFF", "fill-rule": "nonzero" }))), index.h("span", { class: "btn-title" }, this.getLinkLabel(link)))))));
3657
+ }
3658
+ get el() { return index.getElement(this); }
3659
+ };
3660
+ CovetPicsPopupLinks.style = covetGalleryPopupLinksCss;
3661
+
3662
+ const covetPicsPopupReviewCss = ".popup-review{-webkit-box-sizing:border-box;box-sizing:border-box;z-index:1;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:end;align-items:flex-end;-ms-flex-pack:justify;justify-content:space-between;overflow:hidden;position:relative;width:580px;height:580px;border-right:1px solid rgba(0, 0, 0, 0.1);padding-left:100px;padding-right:100px}@media only screen and (max-width: 1023.98px){.popup-review{padding-left:20px;padding-right:20px;width:100%;height:calc(100vh - 80px)}}@media only screen and (max-width: 799.98px){.popup-review{border-right:none;border-bottom:1px solid rgba(0, 0, 0, 0.1);min-height:380px;height:auto}}@media only screen and (max-width: 1023.98px){.popup-review.star-only{width:360px}}.review-top{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;padding:32px 0;position:relative;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box}.review-top:after{content:\"\";display:block;position:absolute;width:100%;height:1px;left:0;bottom:0;background-color:rgba(0, 0, 0, 0.1)}@media only screen and (max-width: 1023.98px){.review-top{padding:24px 0}}.review-top.star-only{-ms-flex-order:2;order:2}.review-top.star-only:after{display:none}.review-star{width:18px;height:18px;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;margin-right:10px;-ms-flex:none;flex:none}.review-star:last-child{margin-right:0}.review-star.active .svg-star path{fill:#000000}.svg-star{width:100%;height:100%}.svg-star path{fill:rgba(0, 0, 0, 0.1)}.review-caption{line-height:1.4;color:black;text-align:center;overflow:auto;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box;padding-right:10px;font-size:var(--covet-pics-item-detail-caption-font-size);margin-top:0;margin-bottom:0}@media only screen and (max-width: 1023.98px){.review-caption{margin-top:32px;margin-bottom:32px}}.review-caption.star-only{-ms-flex-order:1;order:1;margin-top:86px;min-height:1px;position:relative}.review-caption.star-only:after{content:\"\";display:block;position:absolute;width:100%;height:1px;left:0;bottom:0;background-color:rgba(0, 0, 0, 0.1)}@media only screen and (max-width: 1023.98px){.review-caption.star-only{margin-top:70px;margin-bottom:0}}@media only screen and (max-width: 799.98px){.review-caption.star-only{margin-top:10px;margin-bottom:0}}.review-caption.star-only.verified{padding:32px 0px;margin-top:0}.review-bottom{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;padding:32px 0;margin-left:auto;margin-right:auto;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box;position:relative}.review-bottom:after{content:\"\";position:absolute;width:100%;height:1px;top:0;left:0;background-color:rgba(0, 0, 0, 0.1)}@media only screen and (max-width: 1023.98px){.review-bottom{padding:24px 0}}.review-bottom.star-only{-ms-flex-order:3;order:3}.username,.slash,.created-time{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:1.4;font-size:16px;font-weight:500;color:#777777;margin-top:0;margin-bottom:0}.slash{margin-left:6px;margin-right:6px}";
3663
+
3664
+ const CovetPicsPopupReviewElement = class {
3665
+ constructor(hostRef) {
3666
+ index.registerInstance(this, hostRef);
3667
+ this.rating = undefined;
3668
+ this.caption = undefined;
3669
+ this.username = undefined;
3670
+ this.itemType = undefined;
3671
+ this.verified = false;
3672
+ this.createdTime = undefined;
3673
+ this.reviewCSS = {};
3674
+ }
3675
+ watchPropHandler() {
3676
+ this.getReviewCSS();
3677
+ }
3678
+ componentWillLoad() {
3679
+ this.getReviewCSS();
3680
+ }
3681
+ getReviewCSS() {
3682
+ const lineHeight = 1.4;
3683
+ let fontSize = 16;
3684
+ let maxLines = 6;
3685
+ let textHeight = lineHeight * fontSize * maxLines;
3686
+ if (this.caption && this.caption.length < 180) {
3687
+ fontSize = 26;
3688
+ maxLines = 5;
3689
+ textHeight = lineHeight * fontSize * maxLines;
3690
+ }
3691
+ if (this.caption && this.caption.length < 80) {
3692
+ fontSize = 48;
3693
+ maxLines = 4;
3694
+ textHeight = lineHeight * fontSize * maxLines;
3695
+ }
3696
+ return this.reviewCSS = {
3697
+ "--covet-pics-item-detail-caption-max-height": `${textHeight}px`,
3698
+ "--covet-pics-item-detail-caption-max-lines": `${maxLines}`,
3699
+ "--covet-pics-item-detail-caption-font-size": `${fontSize}px`,
3700
+ };
3701
+ }
3702
+ renderVerified() {
3703
+ return (index.h("div", { class: "badge" }, index.h(popupFuncComponents.VerificationIcon, { iconClass: "badge-icon" }), index.h("p", { class: "badge-text" }, "Verified review")));
3704
+ }
3705
+ render() {
3706
+ const starOnlyClass = this.caption === null ? "star-only" : "";
3707
+ const starOnly = this.caption === null && this.itemType === "text";
3708
+ const verifiedClass = this.verified ? "verified" : "";
3709
+ return (index.h(index.Host, { class: `popup-review ${starOnlyClass}`, style: this.reviewCSS }, index.h(popupFuncComponents.StarRatingPopupRewiw, { rating: this.rating, starOnlyClass: starOnlyClass }), index.h("p", { class: `review-caption ${starOnlyClass} ${verifiedClass}`, innerHTML: this.caption }, this.verified && starOnly && this.renderVerified()), index.h("div", { class: `review-bottom ${starOnlyClass}` }, index.h("p", { class: "username" }, this.username), this.createdTime && index.h("span", { class: "slash" }, "/"), index.h("span", { class: "created-time" }, index$1.format(this.createdTime)), this.verified && !starOnly && this.renderVerified())));
3710
+ }
3711
+ get el() { return index.getElement(this); }
3712
+ static get watchers() { return {
3713
+ "caption": ["watchPropHandler"]
3714
+ }; }
3715
+ };
3716
+ CovetPicsPopupReviewElement.style = covetPicsPopupReviewCss;
3717
+
3718
+ const CovetPicsPopupSharedLinks = class {
3719
+ constructor(hostRef) {
3720
+ index.registerInstance(this, hostRef);
3721
+ this.showShareLinkHandler = (event) => {
3722
+ event.preventDefault();
3723
+ event.stopPropagation();
3724
+ this.showShareLink = true;
3725
+ };
3726
+ this.copyLinkClickHandler = (event) => {
3727
+ event.preventDefault();
3728
+ event.stopPropagation();
3729
+ const htmlInput = this.el.querySelector(".direct-link-input");
3730
+ htmlInput.select();
3731
+ document.execCommand("Copy");
3732
+ this.copyLinkCopied = true;
3733
+ };
3734
+ this.item = undefined;
3735
+ this.galleryEmbedId = undefined;
3736
+ this.showShareLink = false;
3737
+ this.copyLinkCopied = false;
3738
+ }
3739
+ disconnectedCallback() {
3740
+ this.showShareLink = false;
3741
+ this.copyLinkCopied = false;
3742
+ }
3743
+ get imageForSocialShare() {
3744
+ return this.item.cover_images.medium_resolution ? this.item.cover_images.medium_resolution : this.item.images.medium_resolution;
3745
+ }
3746
+ get postLink() {
3747
+ let currentUrl = window.location.toString();
3748
+ let newQuery = `/?covet-pics-photo-id=${this.item.id}`;
3749
+ if (typeof this.galleryEmbedId !== "undefined") {
3750
+ newQuery = `${newQuery}&covet-pics-embed-id=${this.galleryEmbedId}`;
3751
+ }
3752
+ return currentUrl.replace(/(\/)?(\?.*)?$/, newQuery);
3753
+ }
3754
+ render() {
3755
+ return (index.h("div", { class: "share links-built" }, index.h("hr", null), this.showShareLink &&
3756
+ index.h("div", { class: "direct-link-wrapper" }, index.h("input", { class: "direct-link-input", type: "text", value: this.postLink, "aria-label": "Share link" }), index.h("button", { onClick: this.copyLinkClickHandler, class: "btn btn-light", title: !this.copyLinkCopied ? "Copy share link" : "Link has been copied", disabled: this.copyLinkCopied, type: "button" }, this.copyLinkCopied ? index.h(popupFuncComponents.Icon, { iconName: "checked" }) : index.h(popupFuncComponents.Icon, { iconName: "copy" }))), index.h("ul", null, index.h("li", { class: "fb" }, index.h("a", { href: `http://www.facebook.com/sharer/sharer.php?picture=${encodeURIComponent(this.imageForSocialShare)}&u=${encodeURIComponent(this.postLink)}`, target: "_blank", title: "Share on Facebook" }, index.h(popupFuncComponents.Icon, { iconName: "facebook" }))), index.h("li", { class: "tw" }, index.h("a", { href: `http://www.twitter.com/share?text=${this.item.caption}&url=${encodeURIComponent(this.postLink)}`, target: "_blank", title: "Share on Twitter" }, index.h(popupFuncComponents.Icon, { iconName: "twitter" }))), index.h("li", { class: "pin" }, index.h("a", { href: `http://www.pinterest.com/pin/create/button/?media=${encodeURIComponent(this.imageForSocialShare)}&description=${this.item.caption}&url=${encodeURIComponent(this.postLink)}`, target: "_blank", title: "Share on Pinterest" }, index.h(popupFuncComponents.Icon, { iconName: "pinterest" }))), index.h("li", { class: "eml" }, index.h("a", { href: `mailto:?subject=Check%20this%20out&body=${encodeURIComponent(this.postLink)}`, target: "_blank", title: "Share via E-mail" }, index.h(popupFuncComponents.Icon, { iconName: "email" }))), index.h("li", { class: "lnk" }, index.h("button", { title: "Share Link", onClick: this.showShareLinkHandler, type: "button" }, index.h(popupFuncComponents.Icon, { iconName: "shareLink" }))))));
3757
+ }
3758
+ get el() { return index.getElement(this); }
3759
+ };
3760
+
3761
+ const CovetPicsPopupSlider = class {
3762
+ constructor(hostRef) {
3763
+ index.registerInstance(this, hostRef);
3764
+ // TODO temp solution to fix swiper update real index before transition end
3765
+ this.sliderRealIndex = 0;
3766
+ this.playPauseVideoClickHandler = (event) => {
3767
+ event.preventDefault();
3768
+ event.stopPropagation();
3769
+ const button = event.currentTarget;
3770
+ const videoWrapper = button.parentElement;
3771
+ if (videoWrapper.classList.contains("playing")) {
3772
+ this.pauseVideo(videoWrapper);
3773
+ }
3774
+ else {
3775
+ this.playVideo(videoWrapper);
3776
+ }
3777
+ };
3778
+ this.item = null;
3779
+ }
3780
+ /** get state is slider is on first slide */
3781
+ async getSwiperState(state) {
3782
+ if (state === "begin") {
3783
+ return this.swiper.isBeginning && this.sliderRealIndex === 0;
3784
+ }
3785
+ else {
3786
+ return this.swiper.isEnd && (this.sliderRealIndex + 1 === this.swiper.slides.length);
3787
+ }
3788
+ }
3789
+ componentDidLoad() {
3790
+ this.initSwiper();
3791
+ }
3792
+ componentDidUpdate() {
3793
+ this.initSwiper();
3794
+ }
3795
+ initSwiper() {
3796
+ const carouselMediaEl = this.el.querySelector(".swiper");
3797
+ const nextEl = carouselMediaEl.querySelector(".swiper-button-next");
3798
+ const prevEl = carouselMediaEl.querySelector(".swiper-button-prev");
3799
+ const paginationEl = carouselMediaEl.querySelector(".swiper-pagination");
3800
+ const skipUpdate = (this.item && this.item.id && this.swiper && this.swiper.covetId && this.swiper.covetId === this.item.id);
3801
+ if (skipUpdate)
3802
+ return;
3803
+ // if swiper exists then first destroy it
3804
+ if (typeof this.swiper !== "undefined")
3805
+ this.clearSwiper();
3806
+ this.swiper = new a11y.Swiper(carouselMediaEl, {
3807
+ slidesPerView: 1,
3808
+ loop: true,
3809
+ modules: [a11y.Navigation, a11y.Pagination, a11y.A11y],
3810
+ on: {
3811
+ init: (e) => slider.swiperUpdateTabIndex(e),
3812
+ update: (e) => slider.swiperUpdateTabIndex(e),
3813
+ realIndexChange: (e) => slider.swiperUpdateTabIndex(e),
3814
+ transitionEnd: (e) => (this.sliderRealIndex = e.realIndex),
3815
+ },
3816
+ pagination: {
3817
+ el: paginationEl,
3818
+ clickable: true,
3819
+ },
3820
+ navigation: {
3821
+ nextEl: nextEl,
3822
+ prevEl: prevEl,
3823
+ },
3824
+ a11y: {
3825
+ enabled: true,
3826
+ prevSlideMessage: "Previous image inside popup carousel item",
3827
+ nextSlideMessage: "Next image inside popup carousel item",
3828
+ containerMessage: "Popup thumbnail image slider",
3829
+ containerRoleDescriptionMessage: "Popup thumbnail image slider",
3830
+ paginationBulletMessage: "Goto image #{{index}} inside popup carousel item",
3831
+ slideRole: "group",
3832
+ slideLabelMessage: `Popup carousel item ${this.item.caption !== null ? this.item.caption : ""} {{index}}/{{slidesLength}}`
3833
+ }
3834
+ });
3835
+ if (this.item && this.item.id)
3836
+ this.swiper.covetId = this.item.id;
3837
+ this.swiper.on("slideChange", () => {
3838
+ // TODO return this opiton
3839
+ // this.swiper.realIndex === 0
3840
+ // ? this.hideHotspots = false
3841
+ // : this.hideHotspots = true;
3842
+ this.pauseVideosInOpenPopup();
3843
+ const videoWrapperEl = this.swiper.slides[this.swiper.activeIndex].querySelector(".post-video-element");
3844
+ if (videoWrapperEl) {
3845
+ this.playVideo(videoWrapperEl);
3846
+ }
3847
+ });
3848
+ }
3849
+ clearSwiper() {
3850
+ this.swiper.destroy();
3851
+ this.swiper.covetId = 0;
3852
+ // this.hideHotspots = false;
3853
+ // TODO return this opiton
3854
+ return true;
3855
+ }
3856
+ pauseVideosInOpenPopup() {
3857
+ const popupVideos = this.el.querySelectorAll(".post-video-element");
3858
+ popupVideos.forEach(videoWrapper => this.pauseVideo(videoWrapper));
3859
+ }
3860
+ pauseVideo(videoWrapperEl) {
3861
+ const videoEl = videoWrapperEl.querySelector("video");
3862
+ videoEl.pause();
3863
+ videoWrapperEl.classList.remove("playing");
3864
+ }
3865
+ playVideo(videoWrapperEl) {
3866
+ const videoEl = videoWrapperEl.querySelector("video");
3867
+ let playPromise = videoEl.play();
3868
+ if (playPromise !== null) {
3869
+ playPromise.catch(() => { videoEl.play(); });
3870
+ }
3871
+ videoWrapperEl.classList.add("playing");
3872
+ }
3873
+ imgAltTag(caption, idx, itemsLength, createdTime) {
3874
+ const carouselAlt = idx !== -1
3875
+ ? `, slide ${idx + 1}/${itemsLength}`
3876
+ : "";
3877
+ return caption && caption.length > 0
3878
+ ? `${caption}, created ${utils.getDateFromTimestamp(createdTime)}${carouselAlt}`
3879
+ : `post image, created ${utils.getDateFromTimestamp(createdTime)}${carouselAlt}`;
3880
+ }
3881
+ render() {
3882
+ return (index.h("div", { id: "covet-popup-content-image-carousel", class: "carousel-media swiper" }, index.h("section", { class: "swiper-wrapper" }, this.item.carousel_media.map((media_item, idx) => index.h("div", { class: "carousel-cell swiper-slide" }, media_item.type === "image" &&
3883
+ index.h("img", { src: media_item.standard_resolution, alt: this.imgAltTag(this.item.caption, idx, this.item.carousel_media.length, this.item.created_time) }), media_item.type === "video" &&
3884
+ index.h("div", { class: "post-video-element" }, index.h("video", { playsinline: true, loop: true, poster: (idx === 0) ? this.item.cover_images.high_resolution : null, key: media_item.standard_resolution }, index.h("source", { src: media_item.standard_resolution, type: "video/mp4" })), index.h("button", { type: "button", class: "post-video-play", "aria-label": "Play video", onClick: this.playPauseVideoClickHandler }), index.h("button", { type: "button", class: "post-video-pause", "aria-label": "Pause video", onClick: this.playPauseVideoClickHandler }))))), index.h("div", { class: "swiper-pagination swiper-pagination-white" }), index.h("button", { class: "swiper-button-next", type: "button" }, index.h(popupFuncComponents.IconArrowPrev, null)), index.h("button", { class: "swiper-button-prev", type: "button" }, index.h(popupFuncComponents.IconArrowNext, null))));
3885
+ }
3886
+ get el() { return index.getElement(this); }
3887
+ };
3888
+
3889
+ exports.covet_pics_direct_buy = CovetPicsDirectBuy;
3890
+ exports.covet_pics_hotspots = CovetPicsHotspots;
3891
+ exports.covet_pics_popup_links = CovetPicsPopupLinks;
3892
+ exports.covet_pics_popup_review = CovetPicsPopupReviewElement;
3893
+ exports.covet_pics_popup_shared_links = CovetPicsPopupSharedLinks;
3894
+ exports.covet_pics_popup_slider = CovetPicsPopupSlider;
3895
+
3896
+ //# sourceMappingURL=covet-pics-direct-buy_6.cjs.entry.js.map