@salla.sa/twilight-components 2.14.602 → 2.14.603

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 (326) hide show
  1. package/dist/cjs/{filepond-BK4nhdz7.js → filepond-BdnuOx4F.js} +1 -1
  2. package/dist/cjs/{filepond-plugin-file-poster-4fVYpLZW.js → filepond-plugin-file-poster-BWYzr6My.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-validate-size-DD9PE5ii.js → filepond-plugin-file-validate-size-DhAUcECh.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-type-Cu_qPxNI.js → filepond-plugin-file-validate-type-DoNn9iGj.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-image-edit-DyMzowg7.js → filepond-plugin-image-edit-CNnXvpn8.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-exif-orientation-CWPAUAU8.js → filepond-plugin-image-exif-orientation-C8nakD3j.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-preview-B4owEvvd.js → filepond-plugin-image-preview-B3F5bMA_.js} +1 -1
  8. package/dist/cjs/{index-B6jjt620.js → index-BxbaPm5U.js} +2 -2
  9. package/dist/cjs/{intlTelInput-DDKMbp8H.js → intlTelInput-DNLLW1NL.js} +1 -1
  10. package/dist/cjs/loader.cjs.js +1 -1
  11. package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
  12. package/dist/cjs/salla-accordion_6.cjs.entry.js +1 -1
  13. package/dist/cjs/salla-add-product-button_5.cjs.entry.js +3 -2
  14. package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
  15. package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
  16. package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
  17. package/dist/cjs/salla-applied-filters.cjs.entry.js +1 -1
  18. package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
  19. package/dist/cjs/salla-attachment-view_9.cjs.entry.js +10 -10
  20. package/dist/cjs/salla-badge.cjs.entry.js +1 -1
  21. package/dist/cjs/salla-basket-gap.cjs.entry.js +1 -1
  22. package/dist/cjs/salla-bullet-delivery_3.cjs.entry.js +1 -1
  23. package/dist/cjs/salla-cart-coupons.cjs.entry.js +1 -1
  24. package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
  25. package/dist/cjs/salla-cart-summary-card.cjs.entry.js +1 -1
  26. package/dist/cjs/salla-cashback-banner.cjs.entry.js +1 -1
  27. package/dist/cjs/salla-comment-factors.cjs.entry.js +1 -1
  28. package/dist/cjs/salla-comment-form_9.cjs.entry.js +1 -1
  29. package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
  30. package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
  31. package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
  32. package/dist/cjs/salla-count-down.cjs.entry.js +1 -1
  33. package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
  34. package/dist/cjs/salla-delivery-promise.cjs.entry.js +1 -1
  35. package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
  36. package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
  37. package/dist/cjs/salla-filters.cjs.entry.js +1 -1
  38. package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
  39. package/dist/cjs/salla-gift-card-redeem_2.cjs.entry.js +1 -1
  40. package/dist/cjs/salla-gifting.cjs.entry.js +1 -1
  41. package/dist/cjs/salla-hook.cjs.entry.js +1 -1
  42. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +1 -1
  43. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  44. package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
  45. package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
  46. package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
  47. package/dist/cjs/salla-loyalty-banner_10.cjs.entry.js +1 -1
  48. package/dist/cjs/salla-loyalty-exchange-product-card.cjs.entry.js +1 -1
  49. package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
  50. package/dist/cjs/salla-loyalty-points-history.cjs.entry.js +1 -1
  51. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
  52. package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
  53. package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
  54. package/dist/cjs/salla-map_3.cjs.entry.js +1 -1
  55. package/dist/cjs/salla-menu.cjs.entry.js +1 -1
  56. package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
  57. package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
  58. package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
  59. package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
  60. package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
  61. package/dist/cjs/salla-notification-item_2.cjs.entry.js +1 -1
  62. package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
  63. package/dist/cjs/salla-offer.cjs.entry.js +1 -1
  64. package/dist/cjs/salla-order-branch.cjs.entry.js +1 -1
  65. package/dist/cjs/salla-order-cancel.cjs.entry.js +1 -1
  66. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
  67. package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
  68. package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
  69. package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
  70. package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
  71. package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
  72. package/dist/cjs/salla-order-options-modal.cjs.entry.js +1 -1
  73. package/dist/cjs/salla-order-shipments.cjs.entry.js +1 -1
  74. package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
  75. package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
  76. package/dist/cjs/salla-orders.cjs.entry.js +1 -1
  77. package/dist/cjs/salla-payments.cjs.entry.js +1 -1
  78. package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
  79. package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
  80. package/dist/cjs/salla-product-card-embed.cjs.entry.js +1 -1
  81. package/dist/cjs/salla-product-card.cjs.entry.js +1 -1
  82. package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
  83. package/dist/cjs/salla-products-list.cjs.entry.js +1 -1
  84. package/dist/cjs/salla-products-slider.cjs.entry.js +1 -1
  85. package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
  86. package/dist/cjs/salla-rating-modal-v2.cjs.entry.js +1 -1
  87. package/dist/cjs/salla-rating-modal.cjs.entry.js +1 -1
  88. package/dist/cjs/salla-review-factors-tags.cjs.entry.js +1 -1
  89. package/dist/cjs/salla-review-order-item.cjs.entry.js +1 -1
  90. package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
  91. package/dist/cjs/salla-search-product-card.cjs.entry.js +1 -1
  92. package/dist/cjs/salla-search.cjs.entry.js +1 -1
  93. package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
  94. package/dist/cjs/salla-social-share.cjs.entry.js +1 -1
  95. package/dist/cjs/salla-social.cjs.entry.js +1 -1
  96. package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
  97. package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
  98. package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
  99. package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
  100. package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
  101. package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
  102. package/dist/cjs/salla-verify.cjs.entry.js +1 -1
  103. package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
  104. package/dist/cjs/salla-wishlist-actions.cjs.entry.js +1 -1
  105. package/dist/cjs/salla-wishlist-summary.cjs.entry.js +1 -1
  106. package/dist/cjs/twilight.cjs.js +1 -1
  107. package/dist/cjs/{vanilla-picker-B1VZNdgU.js → vanilla-picker-CH_Iyxix.js} +1 -1
  108. package/dist/collection/components/salla-product-options/salla-product-options.js +2 -1
  109. package/dist/components/index.js +2 -2
  110. package/dist/components/salla-product-options2.js +2 -1
  111. package/dist/docs.json +1 -1
  112. package/dist/esm/{filepond-plugin-file-poster-jGgGDPBM.js → filepond-plugin-file-poster--16HTX86.js} +1 -1
  113. package/dist/esm/{filepond-plugin-file-validate-size-CMRY86Hb.js → filepond-plugin-file-validate-size-B5mzqY24.js} +1 -1
  114. package/dist/esm/{filepond-plugin-file-validate-type-BJT5d0-6.js → filepond-plugin-file-validate-type-I07woW17.js} +1 -1
  115. package/dist/esm/{filepond-plugin-image-edit-CUgUFKuf.js → filepond-plugin-image-edit-DXu1jmsW.js} +1 -1
  116. package/dist/esm/{filepond-plugin-image-exif-orientation-Cpgh0C9U.js → filepond-plugin-image-exif-orientation-Bc1VQAhJ.js} +1 -1
  117. package/dist/esm/{filepond-plugin-image-preview-Cdldbg2V.js → filepond-plugin-image-preview-BzP3T1zn.js} +1 -1
  118. package/dist/esm/{filepond-JvmG37vk.js → filepond-xXe4bB-l.js} +1 -1
  119. package/dist/esm/{index-DSmjBlMI.js → index-Z_0e-eaG.js} +2 -2
  120. package/dist/esm/{intlTelInput-rTSCUyZk.js → intlTelInput-BWfs2527.js} +1 -1
  121. package/dist/esm/loader.js +2 -2
  122. package/dist/esm/salla-accordion-body_2.entry.js +1 -1
  123. package/dist/esm/salla-accordion_6.entry.js +1 -1
  124. package/dist/esm/salla-add-product-button_5.entry.js +3 -2
  125. package/dist/esm/salla-advertisement.entry.js +1 -1
  126. package/dist/esm/salla-alert_2.entry.js +1 -1
  127. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  128. package/dist/esm/salla-applied-filters.entry.js +1 -1
  129. package/dist/esm/salla-apps-icons.entry.js +1 -1
  130. package/dist/esm/salla-attachment-view_9.entry.js +10 -10
  131. package/dist/esm/salla-badge.entry.js +1 -1
  132. package/dist/esm/salla-basket-gap.entry.js +1 -1
  133. package/dist/esm/salla-bullet-delivery_3.entry.js +1 -1
  134. package/dist/esm/salla-cart-coupons.entry.js +1 -1
  135. package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
  136. package/dist/esm/salla-cart-summary-card.entry.js +1 -1
  137. package/dist/esm/salla-cashback-banner.entry.js +1 -1
  138. package/dist/esm/salla-comment-factors.entry.js +1 -1
  139. package/dist/esm/salla-comment-form_9.entry.js +1 -1
  140. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  141. package/dist/esm/salla-contacts.entry.js +1 -1
  142. package/dist/esm/salla-cookies-bar.entry.js +1 -1
  143. package/dist/esm/salla-count-down.entry.js +1 -1
  144. package/dist/esm/salla-custom-fields.entry.js +1 -1
  145. package/dist/esm/salla-delivery-promise.entry.js +1 -1
  146. package/dist/esm/salla-edit-order-button.entry.js +1 -1
  147. package/dist/esm/salla-filters-widget.entry.js +1 -1
  148. package/dist/esm/salla-filters.entry.js +1 -1
  149. package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
  150. package/dist/esm/salla-gift-card-redeem_2.entry.js +1 -1
  151. package/dist/esm/salla-gifting.entry.js +1 -1
  152. package/dist/esm/salla-hook.entry.js +1 -1
  153. package/dist/esm/salla-infinite-scroll.entry.js +1 -1
  154. package/dist/esm/salla-installment.entry.js +1 -1
  155. package/dist/esm/salla-list-tile.entry.js +1 -1
  156. package/dist/esm/salla-localization-modal.entry.js +1 -1
  157. package/dist/esm/salla-login-modal.entry.js +1 -1
  158. package/dist/esm/salla-loyalty-banner_10.entry.js +1 -1
  159. package/dist/esm/salla-loyalty-exchange-product-card.entry.js +1 -1
  160. package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
  161. package/dist/esm/salla-loyalty-points-history.entry.js +1 -1
  162. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  163. package/dist/esm/salla-loyalty.entry.js +1 -1
  164. package/dist/esm/salla-maintenance-alert.entry.js +1 -1
  165. package/dist/esm/salla-map_3.entry.js +1 -1
  166. package/dist/esm/salla-menu.entry.js +1 -1
  167. package/dist/esm/salla-metadata.entry.js +1 -1
  168. package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
  169. package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
  170. package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
  171. package/dist/esm/salla-next-order-coupon.entry.js +1 -1
  172. package/dist/esm/salla-notification-item_2.entry.js +1 -1
  173. package/dist/esm/salla-offer-modal.entry.js +1 -1
  174. package/dist/esm/salla-offer.entry.js +1 -1
  175. package/dist/esm/salla-order-branch.entry.js +1 -1
  176. package/dist/esm/salla-order-cancel.entry.js +1 -1
  177. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
  178. package/dist/esm/salla-order-details-options.entry.js +1 -1
  179. package/dist/esm/salla-order-details.entry.js +1 -1
  180. package/dist/esm/salla-order-edit-item.entry.js +1 -1
  181. package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
  182. package/dist/esm/salla-order-edit.entry.js +1 -1
  183. package/dist/esm/salla-order-options-modal.entry.js +1 -1
  184. package/dist/esm/salla-order-shipments.entry.js +1 -1
  185. package/dist/esm/salla-order-summary.entry.js +1 -1
  186. package/dist/esm/salla-order-totals-card.entry.js +1 -1
  187. package/dist/esm/salla-orders.entry.js +1 -1
  188. package/dist/esm/salla-payments.entry.js +1 -1
  189. package/dist/esm/salla-placeholder.entry.js +1 -1
  190. package/dist/esm/salla-price-range.entry.js +1 -1
  191. package/dist/esm/salla-product-card-embed.entry.js +1 -1
  192. package/dist/esm/salla-product-card.entry.js +1 -1
  193. package/dist/esm/salla-product-size-guide.entry.js +1 -1
  194. package/dist/esm/salla-products-list.entry.js +1 -1
  195. package/dist/esm/salla-products-slider.entry.js +1 -1
  196. package/dist/esm/salla-quick-order.entry.js +1 -1
  197. package/dist/esm/salla-rating-modal-v2.entry.js +1 -1
  198. package/dist/esm/salla-rating-modal.entry.js +1 -1
  199. package/dist/esm/salla-review-factors-tags.entry.js +1 -1
  200. package/dist/esm/salla-review-order-item.entry.js +1 -1
  201. package/dist/esm/salla-scopes.entry.js +1 -1
  202. package/dist/esm/salla-search-product-card.entry.js +1 -1
  203. package/dist/esm/salla-search.entry.js +1 -1
  204. package/dist/esm/salla-skeleton.entry.js +1 -1
  205. package/dist/esm/salla-social-share.entry.js +1 -1
  206. package/dist/esm/salla-social.entry.js +1 -1
  207. package/dist/esm/salla-tab-content_3.entry.js +1 -1
  208. package/dist/esm/salla-tiered-offer.entry.js +1 -1
  209. package/dist/esm/salla-trust-badges.entry.js +1 -1
  210. package/dist/esm/salla-user-menu.entry.js +1 -1
  211. package/dist/esm/salla-user-profile.entry.js +1 -1
  212. package/dist/esm/salla-user-settings.entry.js +1 -1
  213. package/dist/esm/salla-verify.entry.js +1 -1
  214. package/dist/esm/salla-wallet.entry.js +1 -1
  215. package/dist/esm/salla-wishlist-actions.entry.js +1 -1
  216. package/dist/esm/salla-wishlist-summary.entry.js +1 -1
  217. package/dist/esm/twilight.js +2 -2
  218. package/dist/esm/{vanilla-picker-iVAMFnQg.js → vanilla-picker-J18A-voz.js} +1 -1
  219. package/dist/twilight/{p-35c24f9b.entry.js → p-0b1e0a8d.entry.js} +1 -1
  220. package/dist/twilight/{p-5d6f3385.entry.js → p-0d4e0fb5.entry.js} +1 -1
  221. package/dist/twilight/{p-9bc7224c.entry.js → p-0fdf8008.entry.js} +1 -1
  222. package/dist/twilight/{p-b0fee4fb.entry.js → p-105f55a2.entry.js} +1 -1
  223. package/dist/twilight/{p-74adaa0a.entry.js → p-12e07c6c.entry.js} +1 -1
  224. package/dist/twilight/{p-abb407ae.entry.js → p-15319e31.entry.js} +1 -1
  225. package/dist/twilight/{p-eee8f72b.entry.js → p-1545c99f.entry.js} +1 -1
  226. package/dist/twilight/{p-f5b6fa9b.entry.js → p-19e9233d.entry.js} +1 -1
  227. package/dist/twilight/{p-ed565db7.entry.js → p-1acc6f56.entry.js} +1 -1
  228. package/dist/twilight/{p-755531d0.entry.js → p-1c5d0944.entry.js} +1 -1
  229. package/dist/twilight/{p-ee8320af.entry.js → p-225695d4.entry.js} +1 -1
  230. package/dist/twilight/{p-2f54b8ca.entry.js → p-238fb194.entry.js} +1 -1
  231. package/dist/twilight/{p-8ef1dc8b.entry.js → p-2aaa79f0.entry.js} +1 -1
  232. package/dist/twilight/{p-5350007d.entry.js → p-2b10a3ab.entry.js} +1 -1
  233. package/dist/twilight/{p-f0deaa3e.entry.js → p-2cf6fb59.entry.js} +1 -1
  234. package/dist/twilight/{p-f77eb8de.entry.js → p-2eb4c7be.entry.js} +1 -1
  235. package/dist/twilight/{p-b0c853b7.entry.js → p-377ba8f8.entry.js} +1 -1
  236. package/dist/twilight/{p-ae44240d.entry.js → p-3c5142ca.entry.js} +1 -1
  237. package/dist/twilight/{p-553c0419.entry.js → p-3d2a0139.entry.js} +1 -1
  238. package/dist/twilight/{p-41f562d9.entry.js → p-3d515755.entry.js} +1 -1
  239. package/dist/twilight/{p-92465380.entry.js → p-43d646ab.entry.js} +1 -1
  240. package/dist/twilight/{p-c4e8176e.entry.js → p-4c10d596.entry.js} +1 -1
  241. package/dist/twilight/{p-7907b963.entry.js → p-4c93fe19.entry.js} +1 -1
  242. package/dist/twilight/{p-2b7369bc.entry.js → p-4d734cab.entry.js} +1 -1
  243. package/dist/twilight/{p-31e7a0e2.entry.js → p-4eefd6ce.entry.js} +1 -1
  244. package/dist/twilight/{p-6a575b79.entry.js → p-51e83443.entry.js} +1 -1
  245. package/dist/twilight/{p-16e37ff7.entry.js → p-5304544d.entry.js} +1 -1
  246. package/dist/twilight/{p-62385bca.entry.js → p-53da81e4.entry.js} +1 -1
  247. package/dist/twilight/{p-13cdee67.entry.js → p-54e43cb7.entry.js} +1 -1
  248. package/dist/twilight/{p-bcdcd436.entry.js → p-5765a016.entry.js} +1 -1
  249. package/dist/twilight/{p-deea89b5.entry.js → p-5ba22cda.entry.js} +1 -1
  250. package/dist/twilight/{p-8980ba07.entry.js → p-5db3ccda.entry.js} +1 -1
  251. package/dist/twilight/{p-b76f6fc0.entry.js → p-60c4fcd8.entry.js} +1 -1
  252. package/dist/twilight/{p-13f398a0.entry.js → p-66a54ce6.entry.js} +1 -1
  253. package/dist/twilight/{p-f8dab034.entry.js → p-670a6d5d.entry.js} +1 -1
  254. package/dist/twilight/{p-5b34d547.entry.js → p-67c14cd2.entry.js} +1 -1
  255. package/dist/twilight/{p-198cb6fe.entry.js → p-6a4c670e.entry.js} +1 -1
  256. package/dist/twilight/{p-454937a1.entry.js → p-6a5cac73.entry.js} +1 -1
  257. package/dist/twilight/{p-1705a030.entry.js → p-6b0aacca.entry.js} +1 -1
  258. package/dist/twilight/{p-816f0d62.entry.js → p-74145595.entry.js} +1 -1
  259. package/dist/twilight/{p-9cfeb373.entry.js → p-7573f352.entry.js} +1 -1
  260. package/dist/twilight/{p-1f694f35.entry.js → p-75f4a9ef.entry.js} +1 -1
  261. package/dist/twilight/p-766fa83f.entry.js +4 -0
  262. package/dist/twilight/{p-dc2ec98d.entry.js → p-7849b724.entry.js} +1 -1
  263. package/dist/twilight/{p-f94f0b87.entry.js → p-795066f7.entry.js} +1 -1
  264. package/dist/twilight/{p-3efbe99f.entry.js → p-7aa443f6.entry.js} +1 -1
  265. package/dist/twilight/{p-7171284c.entry.js → p-7eaf3217.entry.js} +1 -1
  266. package/dist/twilight/{p-ae6681e4.entry.js → p-82887781.entry.js} +1 -1
  267. package/dist/twilight/{p-c0990882.entry.js → p-845fc00b.entry.js} +1 -1
  268. package/dist/twilight/{p-d960fb5d.entry.js → p-85bf3602.entry.js} +1 -1
  269. package/dist/twilight/{p-fc601cb7.entry.js → p-88838f90.entry.js} +1 -1
  270. package/dist/twilight/{p-49f793f5.entry.js → p-8fd45966.entry.js} +1 -1
  271. package/dist/twilight/{p-79d531c1.entry.js → p-8fdb99e3.entry.js} +1 -1
  272. package/dist/twilight/{p-10173408.entry.js → p-9439a31c.entry.js} +1 -1
  273. package/dist/twilight/{p-49f9674d.entry.js → p-95b9f420.entry.js} +1 -1
  274. package/dist/twilight/{p-d385497e.entry.js → p-9be52d88.entry.js} +1 -1
  275. package/dist/twilight/{p-91d886a4.entry.js → p-9c9cfc5b.entry.js} +1 -1
  276. package/dist/twilight/{p-BZAgJW8r.js → p-ARTVPDpi.js} +1 -1
  277. package/dist/twilight/{p-Cwn0juZl.js → p-C7e4koVc.js} +2 -2
  278. package/dist/twilight/{p-kJZlJJjc.js → p-CJQ21QXm.js} +1 -1
  279. package/dist/twilight/{p-DKq36Aat.js → p-CVAB0Gy1.js} +1 -1
  280. package/dist/twilight/{p-lcuQmP0A.js → p-CZ7D9I3L.js} +1 -1
  281. package/dist/twilight/{p-H48_b2OW.js → p-DBG3-uK6.js} +1 -1
  282. package/dist/twilight/{p-BdfIR_j4.js → p-DnaxNcAS.js} +1 -1
  283. package/dist/twilight/{p-CiToackV.js → p-DskB2ZaU.js} +1 -1
  284. package/dist/twilight/{p-DSmjBlMI.js → p-Z_0e-eaG.js} +1 -1
  285. package/dist/twilight/{p-bdc6aaf3.entry.js → p-a250d588.entry.js} +1 -1
  286. package/dist/twilight/{p-4b398039.entry.js → p-a2523582.entry.js} +1 -1
  287. package/dist/twilight/{p-e345dcc6.entry.js → p-a40faf66.entry.js} +1 -1
  288. package/dist/twilight/{p-f17570e7.entry.js → p-ae2df76a.entry.js} +1 -1
  289. package/dist/twilight/{p-3ab4a96c.entry.js → p-b5d49886.entry.js} +1 -1
  290. package/dist/twilight/{p-b996fb98.entry.js → p-b9eea7b7.entry.js} +1 -1
  291. package/dist/twilight/{p-1bca57e0.entry.js → p-ba33e7d0.entry.js} +1 -1
  292. package/dist/twilight/{p-f0812a46.entry.js → p-baa27a89.entry.js} +1 -1
  293. package/dist/twilight/{p-8db01cb9.entry.js → p-bda08bda.entry.js} +1 -1
  294. package/dist/twilight/{p-b8dcc622.entry.js → p-be4d41b6.entry.js} +1 -1
  295. package/dist/twilight/{p-3337976e.entry.js → p-c082649d.entry.js} +1 -1
  296. package/dist/twilight/{p-94f05c52.entry.js → p-c0c24914.entry.js} +1 -1
  297. package/dist/twilight/{p-9d458fdc.entry.js → p-c4b8d829.entry.js} +1 -1
  298. package/dist/twilight/{p-f7d7ffa2.entry.js → p-c6f8e7b2.entry.js} +1 -1
  299. package/dist/twilight/{p-754b773f.entry.js → p-c7680554.entry.js} +1 -1
  300. package/dist/twilight/{p-de8ff550.entry.js → p-cbdd7190.entry.js} +1 -1
  301. package/dist/twilight/{p-3af02a2e.entry.js → p-cc325559.entry.js} +1 -1
  302. package/dist/twilight/{p-106e4c00.entry.js → p-cd8c3792.entry.js} +1 -1
  303. package/dist/twilight/{p-269aaae6.entry.js → p-d08d194a.entry.js} +1 -1
  304. package/dist/twilight/{p-f220b5b5.entry.js → p-d11cd0e5.entry.js} +1 -1
  305. package/dist/twilight/{p-819ecf01.entry.js → p-d249e166.entry.js} +1 -1
  306. package/dist/twilight/{p-b90cc416.entry.js → p-d53bdb65.entry.js} +1 -1
  307. package/dist/twilight/{p-22d7efce.entry.js → p-d65485cf.entry.js} +1 -1
  308. package/dist/twilight/{p-7a3de00e.entry.js → p-d7d9bcf1.entry.js} +1 -1
  309. package/dist/twilight/{p-1e48420f.entry.js → p-d8dd3737.entry.js} +1 -1
  310. package/dist/twilight/{p-d9eb567c.entry.js → p-da6f9fcf.entry.js} +1 -1
  311. package/dist/twilight/{p-3deaae96.entry.js → p-de3548d9.entry.js} +1 -1
  312. package/dist/twilight/{p-2291b12c.entry.js → p-dffa5133.entry.js} +1 -1
  313. package/dist/twilight/{p-2b82b2e7.entry.js → p-e29a5e11.entry.js} +1 -1
  314. package/dist/twilight/{p-2f7cced2.entry.js → p-e83c621c.entry.js} +1 -1
  315. package/dist/twilight/{p-4deebc34.entry.js → p-e8ba21c3.entry.js} +1 -1
  316. package/dist/twilight/{p-b753bcde.entry.js → p-f1c0631e.entry.js} +1 -1
  317. package/dist/twilight/{p-5541311c.entry.js → p-f3400329.entry.js} +1 -1
  318. package/dist/twilight/{p-b3b5b350.entry.js → p-f9f758e6.entry.js} +1 -1
  319. package/dist/twilight/{p-c884d66b.entry.js → p-f9f89c27.entry.js} +1 -1
  320. package/dist/twilight/{p-DAZtN2b7.js → p-fYZlWuHl.js} +1 -1
  321. package/dist/twilight/{p-285e3792.entry.js → p-fb505973.entry.js} +1 -1
  322. package/dist/twilight/{p-b9c70014.entry.js → p-fd020871.entry.js} +1 -1
  323. package/dist/twilight/{p-7e65d967.entry.js → p-fded2f48.entry.js} +1 -1
  324. package/dist/twilight/twilight.esm.js +1 -1
  325. package/package.json +5 -5
  326. package/dist/twilight/p-3204cc50.entry.js +0 -4
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as e,H as r,a as i}from"./p-DSmjBlMI.js";import{A as s}from"./p-DCZbpt2a.js";import{B as o}from"./p-D3mWkc-3.js";import{C as a}from"./p-gFG8By9O.js";import{H as n}from"./p-00vBRoH3.js";import{C as l}from"./p-BsLF_HK7.js";import{S as d}from"./p-D4oPi1Ov.js";import{l as c}from"./p-BChI23pG.js";var h='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>user-circle</title>\n<path d="M16 22.964c-4.525 0-8.447 1.713-9.993 4.365-0.371 0.636-0.156 1.452 0.48 1.823s1.453 0.156 1.823-0.48c0.855-1.465 3.624-3.041 7.689-3.041s6.835 1.576 7.689 3.041c0.249 0.424 0.696 0.661 1.155 0.661 0.228 0 0.459-0.059 0.669-0.181 0.637-0.371 0.852-1.187 0.48-1.823-1.545-2.652-5.467-4.365-9.992-4.365zM22.667 13.631c0-3.676-2.991-6.667-6.667-6.667s-6.667 2.991-6.667 6.667 2.991 6.667 6.667 6.667 6.667-2.992 6.667-6.667zM12 13.631c0-2.205 1.795-4 4-4s4 1.795 4 4-1.795 4-4 4-4-1.795-4-4zM16 0.297c-8.823 0-16 7.177-16 16 0 2.941 0.821 5.831 2.373 8.357 0.252 0.411 0.689 0.636 1.137 0.636 0.239 0 0.479-0.064 0.696-0.197 0.628-0.385 0.824-1.207 0.439-1.833-1.295-2.108-1.979-4.516-1.979-6.963 0-7.352 5.981-13.333 13.333-13.333s13.333 5.981 13.333 13.333c0 2.448-0.684 4.856-1.979 6.961-0.385 0.628-0.189 1.448 0.437 1.835 0.627 0.384 1.448 0.189 1.835-0.437 1.553-2.527 2.373-5.416 2.373-8.359 0-8.823-7.177-16-16-16z"></path>\n</svg>\n';const m=class{constructor(e){t(this,e),this.accountLoading=!1,this.opened=!1,this.notifications=salla.lang.get("common.titles.notifications"),this.orders=salla.lang.get("common.titles.orders"),this.pending_orders=salla.lang.get("common.titles.pending_orders"),this.wishlist=salla.lang.get("common.titles.wishlist"),this.profile=salla.lang.get("common.titles.profile"),this.rating=salla.lang.get("common.titles.rating"),this.wallet=salla.lang.get("common.titles.wallet"),this.settings=salla.lang.get("common.titles.settings"),this.loyalty_points=salla.lang.get("pages.loyalty_program.loyalty_points"),this.logout=salla.lang.get("blocks.header.logout"),this.hello=salla.lang.get("pages.checkout.hello"),this.first_name=salla.storage.get("user.first_name")||"",this.last_name=salla.storage.get("user.last_name")||"",this.avatar=salla.storage.get("user.avatar")||salla.url.cdn("images/avatar.png",40,40),this.badges={notifications:salla.helpers.number(salla.storage.get("user.notifications")||0),pending_orders:salla.helpers.number(salla.storage.get("user.pending_orders")||0)},this.sallaAccountEnabled=!1,this.walletBalance="",this.walletBalanceLoading=!1,this.walletBalanceLoaded=!1,this.hasBadges=Number(salla.storage.get("user.pending_orders"))>0||Number(salla.storage.get("user.notifications"))>0,this.inline=!1,this.avatarOnly=!1,this.showHeader=!1,this.relativeDropdown=!1,this.showTrigger=!1,this.onClickOutside=()=>{this.opened=!1},this.OrderUpdate=0,this.accountPrefixedKeys=["orders","pending_orders","wallet","notifications","rating","profile","wishlist","settings"],this.items={notifications:o,orders:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>box-bankers</title>\n<path d="M28 1.333h-24c-2.205 0-4 1.795-4 4v5.333c0 0.736 0.597 1.333 1.333 1.333v14.667c0 2.205 1.795 4 4 4h21.333c2.205 0 4-1.795 4-4v-14.667c0.736 0 1.333-0.597 1.333-1.333v-5.333c0-2.205-1.795-4-4-4zM28 26.667c0 0.735-0.599 1.333-1.333 1.333h-21.333c-0.735 0-1.333-0.599-1.333-1.333v-14.667h5.333v2.667c0 1.471 1.196 2.667 2.667 2.667h8c1.471 0 2.667-1.196 2.667-2.667v-2.667h5.333zM12 14.667v-2.667h8v2.667zM29.333 9.333h-26.667v-4c0-0.735 0.599-1.333 1.333-1.333h24c0.735 0 1.333 0.599 1.333 1.333z"></path>\n</svg>\n',pending_orders:a,wishlist:n,wallet:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>wallet</title>\n<path d="M28 6.667h-24c-0.736 0-1.333-0.597-1.333-1.333s0.597-1.333 1.333-1.333h24c0.737 0 1.333-0.596 1.333-1.333s-0.596-1.333-1.333-1.333h-24c-2.204 0-3.999 1.793-4 3.997v18.669c0 3.676 2.991 6.667 6.667 6.667h21.333c2.205 0 4-1.795 4-4v-16c0-2.205-1.795-4-4-4zM29.333 26.667c0 0.736-0.597 1.333-1.333 1.333h-21.333c-2.205 0-4-1.795-4-4v-14.895c0.416 0.147 0.865 0.228 1.333 0.228h24c0.736 0 1.333 0.597 1.333 1.333zM22.667 14.667c-2.205 0-4 1.795-4 4s1.795 4 4 4 4-1.795 4-4-1.795-4-4-4zM22.667 20c-0.736 0-1.333-0.597-1.333-1.333s0.597-1.333 1.333-1.333 1.333 0.597 1.333 1.333-0.597 1.333-1.333 1.333z"></path>\n</svg>\n',loyalty_points:c,profile:h}}connectedCallback(){this.langUnsubscribe=salla.lang.subscribe((()=>this.loadTranslations()))}disconnectedCallback(){this.langUnsubscribe?.()}async componentWillLoad(){await salla.onReady(),await salla.lang.onLoaded(),this.loadTranslations(),this.initiate(),Salla.event.on("api::token.injected",(t=>this.profileUrl=this.buildProfileUrl(t))),this.sallaAccountEnabled=Salla.config.get("store.features")?.includes("salla-account"),this.items=this.sallaAccountEnabled?{...this.items,settings:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>settings</title>\n<path d="M29.717 19.037l-1.817-1.499c0.067-0.512 0.1-1.028 0.1-1.539s-0.033-1.027-0.1-1.54l1.817-1.499c1.177-0.969 1.479-2.633 0.716-3.956l-1.159-2.009c-0.761-1.324-2.349-1.895-3.784-1.359l-2.212 0.829c-0.817-0.627-1.704-1.139-2.649-1.535l-0.388-2.332c-0.251-1.507-1.54-2.6-3.067-2.6h-2.319c-1.525 0-2.815 1.093-3.065 2.6l-0.388 2.332c-0.945 0.396-1.833 0.909-2.649 1.535l-2.212-0.829c-1.428-0.533-3.021 0.036-3.783 1.359l-1.16 2.011c-0.763 1.323-0.46 2.985 0.716 3.955l1.817 1.499c-0.067 0.513-0.1 1.029-0.1 1.54s0.033 1.027 0.1 1.539l-1.819 1.5c-1.176 0.971-1.476 2.635-0.715 3.955l1.159 2.011c0.763 1.324 2.356 1.899 3.784 1.36l2.212-0.831c0.816 0.625 1.703 1.139 2.649 1.535l0.388 2.332c0.251 1.507 1.54 2.6 3.067 2.6h2.319c1.527 0 2.816-1.093 3.065-2.6l0.389-2.332c0.947-0.396 1.833-0.909 2.649-1.535l2.212 0.831c1.432 0.539 3.023-0.035 3.783-1.36l1.16-2.011c0.76-1.32 0.459-2.984-0.717-3.956zM28.123 21.663l-1.16 2.011c-0.108 0.188-0.336 0.267-0.536 0.193l-2.931-1.1c-0.459-0.173-0.979-0.079-1.349 0.248-0.923 0.811-1.979 1.423-3.139 1.819-0.464 0.157-0.804 0.559-0.885 1.043l-0.515 3.087c-0.033 0.215-0.216 0.371-0.433 0.371h-2.319c-0.217 0-0.4-0.156-0.436-0.371l-0.513-3.087c-0.080-0.484-0.42-0.884-0.885-1.043-1.16-0.396-2.216-1.008-3.139-1.819-0.248-0.217-0.561-0.332-0.88-0.332-0.157 0-0.316 0.028-0.469 0.084l-2.931 1.1c-0.199 0.079-0.428-0.004-0.537-0.193l-1.159-2.011c-0.109-0.191-0.067-0.428 0.101-0.568l2.409-1.985c0.379-0.312 0.555-0.807 0.46-1.288-0.119-0.605-0.179-1.219-0.179-1.821 0-0.604 0.060-1.217 0.181-1.823 0.095-0.481-0.081-0.976-0.46-1.288l-2.409-1.985c-0.168-0.139-0.211-0.376-0.101-0.567l1.16-2.011c0.107-0.188 0.332-0.268 0.536-0.193l2.931 1.1c0.459 0.172 0.979 0.079 1.348-0.247 0.924-0.812 1.98-1.424 3.139-1.817 0.465-0.159 0.805-0.559 0.885-1.044l0.513-3.088c0.036-0.215 0.219-0.371 0.436-0.371h2.319c0.217 0 0.4 0.156 0.436 0.371l0.515 3.088c0.081 0.484 0.42 0.885 0.885 1.044 1.157 0.393 2.213 1.005 3.139 1.817 0.371 0.325 0.889 0.42 1.349 0.247l2.929-1.099c0.203-0.076 0.428 0.005 0.537 0.193l1.159 2.009c0.109 0.191 0.067 0.428-0.101 0.567l-2.409 1.985c-0.379 0.312-0.555 0.807-0.46 1.288 0.119 0.605 0.179 1.219 0.179 1.823 0 0.603-0.060 1.216-0.181 1.821-0.095 0.48 0.081 0.975 0.46 1.288l2.408 1.984c0.169 0.141 0.212 0.379 0.103 0.569zM16.016 10.667c-2.941 0-5.333 2.392-5.333 5.333s2.392 5.333 5.333 5.333 5.333-2.392 5.333-5.333-2.392-5.333-5.333-5.333zM16.016 18.667c-1.471 0-2.667-1.196-2.667-2.667s1.196-2.667 2.667-2.667 2.667 1.196 2.667 2.667-1.196 2.667-2.667 2.667z"></path>\n</svg>\n'}:this.items,this.host.hasAttribute("with-rating")&&(this.items.rating=d),this.items.logout='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>send-out</title>\n<path d="M16 26.667h-9.333c-0.736 0-1.333-0.597-1.333-1.333v-18.667c0-0.736 0.597-1.333 1.333-1.333h9.333c0.737 0 1.333-0.596 1.333-1.333s-0.596-1.333-1.333-1.333h-9.333c-2.205 0-4 1.795-4 4v18.667c0 2.205 1.795 4 4 4h9.333c0.737 0 1.333-0.596 1.333-1.333s-0.596-1.333-1.333-1.333zM29.231 15.491c-0.068-0.164-0.167-0.312-0.289-0.436l-5.332-5.332c-0.521-0.521-1.364-0.521-1.885 0s-0.521 1.364 0 1.885l3.057 3.059h-12.781c-0.737 0-1.333 0.596-1.333 1.333s0.596 1.333 1.333 1.333h12.781l-3.057 3.057c-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391l5.332-5.332c0.124-0.123 0.221-0.271 0.289-0.435 0.135-0.325 0.135-0.693 0-1.019z"></path>\n</svg>\n';let t=Salla.storage.get("token");t||(t=""),this.profileUrl=this.buildProfileUrl(t);const e=this.host.querySelector('[slot="trigger"]');this.triggerSlot='<div class="s-user-menu-trigger"><div class="s-user-menu-avatar-wrap"><img class="s-user-menu-trigger-avatar" src="{avatar}" alt="{first_name}{last_name}" /></div><div class="s-user-menu-trigger-content"><span class="s-user-menu-trigger-hello">{hello}</span><p class="s-user-menu-trigger-name">{first_name} {last_name}</p></div> <i class="s-user-menu-trigger-icon">{icon}</i></div>',e&&(this.triggerSlot=e.innerHTML,e.innerHTML=this.replaceParams(e.innerHTML))}loadTranslations(){this.notifications=Salla.lang.get("common.titles.notifications"),this.orders=Salla.lang.get("common.titles.orders"),this.pending_orders=Salla.lang.get("common.titles.pending_orders"),this.wishlist=Salla.lang.get("common.titles.wishlist"),this.profile=Salla.lang.get("common.titles.profile"),this.hello=Salla.lang.get("pages.checkout.hello"),this.rating=Salla.lang.get("common.titles.rating"),this.wallet=Salla.lang.get("common.titles.wallet"),this.settings=Salla.lang.get("common.titles.settings"),this.loyalty_points=Salla.lang.get("pages.loyalty_program.loyalty_points"),this.logout=Salla.lang.get("blocks.header.logout")}async loadWalletBalance(){if(!Salla.config.isGuest()){this.walletBalanceLoading=!0;try{const t=await salla.api.withoutNotifier((()=>salla.api.request("/balance/wallet?light=1"))),e=Number(t?.data?.balance)||0;this.walletBalance=e?Salla.money({amount:Number(e.toFixed(2)),currency:Salla.config.get("user.currency_code")}):"",this.walletBalanceLoaded=!0}catch{}finally{this.walletBalanceLoading=!1}}}initiate(){return Salla.config.isGuest()?this.autoMountLoginModal():(this.is_loggedIn=!0,!this.inline&&(salla.url.is_page("customer.notifications")||salla.url.is_page("customer.orders.index.pending")||salla.url.is_page("customer.profile")||(Date.now()-(salla.storage.get("user.fetched_at")||0))/1e3/60>30)?this.fetchFreshProfile():void salla.event.on("profile::info.fetched",(t=>{this.updateProfileState(t)})))}autoMountLoginModal(){this.showTrigger&&(document.querySelector("salla-login-modal")||Salla.hooks.mount("body:end",document.createElement("salla-login-modal")))}fetchFreshProfile(){salla.api.token?salla.profile.api.info().then((t=>{this.updateProfileState(t)})):salla.log("trying to fetchFreshProfile before injected the token!!")}updateProfileState(t){this.badges={notifications:salla.helpers.number(t.data.notifications||0),pending_orders:salla.helpers.number(t.data.pending_orders||0)},this.hasBadges=Number(t.data.pending_orders)>0||Number(t.data.notifications)>0,this.first_name=t.data.first_name,this.last_name=t.data.last_name,this.avatar=t.data.avatar||salla.url.cdn("images/avatar.png",40,40)}async open(t){this.opened=!this.opened,t.stopPropagation(),this.opened&&(!window.can_access_wallet||this.walletBalanceLoaded||this.walletBalanceLoading||this.loadWalletBalance(),window.addEventListener("click",this.onClickOutside))}prepareProfileLink(t,e){"profile"===e&&this.profileUrl&&this.sallaAccountEnabled&&(t.currentTarget.href=this.withAnonymousId(this.profileUrl))}menuItemClicked(t,e){this.prepareProfileLink(t,e),"logout"===e&&(t.preventDefault(),salla.auth.logout("sall-user-menu"))}replaceParams(t){return t.replace(/\{hello\}/g,this.hello).replace(/\{first_name\}/g,this.first_name).replace(/\{last_name\}/g,this.last_name).replace(/\{avatar\}/g,this.avatar).replace(/\{icon\}/g,s)}getTheHeader(){return e("div",{class:{"s-user-menu-trigger-slot":!0,"s-user-menu-red-dot":this.hasBadges,"s-user-menu-trigger-avatar-only":this.avatarOnly},id:"trigger-slot",onClick:t=>this.open(t),onKeyUp:t=>this.open(t),innerHTML:this.replaceParams(this.triggerSlot)})}getItemAnchorLinkAttrs(t){if("profile"===t&&this.profileUrl&&this.sallaAccountEnabled)return{href:this.profileUrl,target:"_blank",rel:"noopener noreferrer"};const e="loyalty_points"===t?"loyalty":t,r=this.accountPrefixedKeys.includes(e)?`account/${e}`:e;return{href:Salla.url.get(r)}}getMenuItem([t,r],i){if(("wallet"!==t||window.can_access_wallet)&&("loyalty_points"!==t||Salla.config.get("store.features").includes("loyalty-system")))return e("li",{class:{"s-user-menu-dropdown-item":!0,"s-user-menu-dropdown-item-logout":i+1===Object.entries(this.items).length}},e("a",{...this.getItemAnchorLinkAttrs(t),class:"s-user-menu-dropdown-item-link",onClick:e=>this.menuItemClicked(e,t),onMouseDown:e=>this.prepareProfileLink(e,t),onFocus:e=>this.prepareProfileLink(e,t),onContextMenu:e=>this.prepareProfileLink(e,t)},e("i",{class:"s-user-menu-dropdown-item-prefix",innerHTML:r}),e("span",{class:"s-user-menu-dropdown-item-title"},this[t]),"wallet"!==t||this.inline||!this.walletBalance&&!this.walletBalanceLoading?"":e("span",{class:"s-user-menu-dropdown-item-balance",style:{display:"inline-flex",alignItems:"center",gap:"4px"}},this.walletBalance?e("span",{innerHTML:this.walletBalance}):"",this.walletBalanceLoading?e("salla-loading",{size:"14"}):""),["٠","0",void 0].includes(this.badges[t])?"":e("span",{class:"s-user-menu-dropdown-item-badge"},this.badges[t])))}componentShouldUpdate(){this.opened||window.removeEventListener("click",this.onClickOutside)}render(){return e(r,null,this.is_loggedIn?this.inline?e("ul",{class:"s-user-menu-inline"},Object.entries(this.items).map(((t,e)=>this.getMenuItem(t,e)))):e("div",{class:{"s-user-menu-wrapper":!0,"s-user-menu-relative-dropdown":this.relativeDropdown}},this.getTheHeader(),e("div",{class:{"s-user-menu-toggler":!0,opened:this.opened}},e("div",{class:"s-user-menu-dropdown",onClick:t=>t.stopPropagation(),onKeyUp:t=>t.stopPropagation()},this.showHeader?e("div",{class:"s-user-menu-dropdown-header"},e("img",{src:this.avatar,alt:`${this.first_name} ${this.last_name}`}),e("div",{class:"s-user-menu-dropdown-header-content"},e("span",null,this.hello),e("p",null,this.first_name," ",this.last_name)),e("button",{type:"button",class:"s-user-menu-dropdown-header-close",innerHTML:l,onClick:()=>{this.opened=!1}})):"",e("ul",{class:"s-user-menu-dropdown-list"},Object.entries(this.items).map(((t,e)=>this.getMenuItem(t,e))))))):e("slot",{name:"login-btn"},e("button",{type:"button",class:"s-user-menu-login-btn",onClick:()=>salla.event.dispatch("login::open"),innerHTML:h})))}async componentDidLoad(){await Salla.hooks.registerComponent("salla-user-menu",this),document.lazyLoadInstance?.update(this.host.querySelectorAll(".lazy"))}buildProfileUrl(t){return`${Salla.config.get("account.url","https://accounts.salla.com")}/${salla.config.get("user.language_code")}/user?store=${Salla.config.get("store.id")}&info=${encodeURIComponent(t)}`}withAnonymousId(t){const e=this.getAnalyticsAnonymousId();return e?`${t}&aid=${encodeURIComponent(e)}`:t}getAnalyticsAnonymousId(){try{return"accepted"!==Salla.storage.get("cookies-consent")?null:Salla.analytics?.getAnonymousId?.()||null}catch(t){return null}}get host(){return i(this)}};m.style='/*!twlt*/.relative{position:relative}.inline{display:inline}.inline-flex{display:inline-flex}salla-user-menu div[slot=\'trigger\']{display:none}.s-user-menu-wrapper{display:block;min-width:max-content;flex-shrink:0}.s-user-menu-relative-dropdown{position:relative}.s-user-menu-trigger{display:flex;width:fit-content;cursor:pointer;align-items:center;border-top-right-radius:0.375rem;border-top-left-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding-left:0.625rem;padding-right:0.625rem;padding-top:0.875rem;padding-bottom:0.875rem;font-size:0.875rem;line-height:1.25rem}.s-user-menu-trigger-icon svg{height:1.25rem;width:1.25rem;transition-property:transform;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:200ms}.s-user-menu-toggler::before{pointer-events:none;visibility:hidden;position:fixed;left:0px;top:0px;z-index:10;height:100vh;width:100vw;background-color:#71717abf;opacity:0;transition-duration:300ms;--tw-content:\'\';content:var(--tw-content)}.s-user-menu-toggler.opened::before{pointer-events:auto;visibility:visible;content:var(--tw-content);opacity:1}@media (min-width: 768px){.s-user-menu-toggler.opened::before{pointer-events:none;visibility:hidden;content:var(--tw-content);opacity:0}}.s-user-menu-toggler.opened .s-user-menu-trigger svg{--tw-rotate:180deg;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.s-user-menu-toggler.opened .s-user-menu-dropdown{visibility:visible;--tw-translate-y:0px;--tw-scale-x:1;--tw-scale-y:1;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));opacity:1}.s-user-menu-trigger-avatar{display:inline-block;height:2.5rem;width:2.5rem;border-radius:9999px;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));object-fit:cover}.s-user-menu-trigger-content{margin-left:0.5rem;margin-right:0.25rem}.s-user-menu-trigger-content:where([dir="rtl"],[dir="rtl"] *){margin-right:0.5rem;margin-left:0.25rem}.s-user-menu-trigger-avatar-only .s-user-menu-trigger-content{display:none}.s-user-menu-trigger-avatar-only .s-user-menu-trigger-icon{display:none}.s-user-menu-trigger-avatar-only .s-user-menu-trigger-avatar{border-width:0px}.s-user-menu-trigger-hello{font-size:14px;--tw-text-opacity:1;color:rgb(153 153 153 / var(--tw-text-opacity, 1))}.s-user-menu-trigger-name{margin-top:0.125rem;font-size:15px;line-height:1;--tw-text-opacity:1;color:rgb(68 68 68 / var(--tw-text-opacity, 1))}.s-user-menu-trigger-icon{margin-left:10px}.s-user-menu-trigger-icon:where([dir="rtl"],[dir="rtl"] *){margin-left:0px;margin-right:10px}.s-user-menu-trigger-text-value{font-size:0.875rem;line-height:1.25rem;font-weight:500;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-user-menu-dropdown{visibility:hidden;position:fixed;bottom:0px;top:auto;right:0px;z-index:30;width:100%;transform-origin:center;--tw-translate-y:2.5rem;--tw-scale-y:.9;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));border-top-left-radius:0.375rem;border-top-right-radius:0.375rem;border-bottom-right-radius:0px;border-bottom-left-radius:0px;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));opacity:0;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}@media (min-width: 768px){.s-user-menu-dropdown{position:absolute;bottom:unset;top:100%;width:15rem;transform-origin:top right;--tw-translate-y:-1rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));border-top-left-radius:0px;border-top-right-radius:0px;border-bottom-right-radius:0.375rem;border-bottom-left-radius:0.375rem;--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);transition-duration:200ms}}@media (min-width: 1024px){.s-user-menu-dropdown{border-top-width:1px;border-color:rgb(209 213 219 / 0.3)}}.s-user-menu-dropdown:where([dir="rtl"],[dir="rtl"] *){left:0px;right:unset}.s-user-menu-dropdown-list>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1px * var(--tw-space-y-reverse))}.s-user-menu-dropdown-list{padding-top:0.5rem;padding-left:0.5rem;padding-right:0.5rem;padding-bottom:1rem}@media (min-width: 1024px){.s-user-menu-dropdown-list{padding-left:0px;padding-right:0px;padding-bottom:0.5rem}}.s-user-menu-dropdown-item a{display:flex;align-items:center;padding-left:1.5rem;padding-right:1.5rem;padding-top:0.625rem;padding-bottom:0.625rem;--tw-text-opacity:1;color:rgb(68 68 68 / var(--tw-text-opacity, 1));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-user-menu-dropdown-item a:hover{background-color:rgb(229 231 235 / 0.3)}@media (min-width: 640px){.s-user-menu-dropdown-item a{font-size:0.875rem;line-height:1.25rem}}.s-user-menu-dropdown-item-logout a{--tw-text-opacity:1 !important;color:rgb(255 68 58 / var(--tw-text-opacity, 1)) !important}.s-user-menu-dropdown-item-logout a svg{fill:#FF443A !important}.s-user-menu-dropdown-item-prefix svg{margin-right:0.75rem;height:1rem;width:1rem;fill:#9ca3af}.s-user-menu-dropdown-item-prefix svg:where([dir="rtl"],[dir="rtl"] *){margin-right:0px;margin-left:0.75rem}.s-user-menu-dropdown-header{position:relative;margin-bottom:0.25rem;display:flex;align-items:center;border-bottom-width:1px;padding:1rem}@media (min-width: 768px){.s-user-menu-dropdown-header{display:none}}.s-user-menu-dropdown-header img{pointer-events:none;margin-right:0.75rem;height:3rem;width:3rem;border-radius:9999px;object-fit:cover}.s-user-menu-dropdown-header img:where([dir="rtl"],[dir="rtl"] *){margin-right:0px;margin-left:0.75rem}.s-user-menu-dropdown-header-content span{font-size:14px;--tw-text-opacity:1;color:rgb(153 153 153 / var(--tw-text-opacity, 1))}.s-user-menu-dropdown-header-content p{font-size:1rem;line-height:1.5rem;font-weight:700;line-height:1;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-user-menu-dropdown-header-close{position:absolute;top:1.25rem;right:1rem;z-index:50;border-radius:9999px}.s-user-menu-dropdown-header-close:where([dir="rtl"],[dir="rtl"] *){right:unset;left:1rem}.s-user-menu-dropdown-header-close svg{height:1.25rem;width:1.25rem;fill:#ef4444}.s-user-menu-dropdown-item-badge{position:absolute;right:0.625rem;display:flex;height:1.25rem;width:1.25rem;flex-direction:column;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1));font-size:0.75rem;line-height:1rem;line-height:inherit;--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.s-user-menu-dropdown-item-badge:where([dir="rtl"],[dir="rtl"] *){right:unset;left:0.625rem}.s-user-menu-dropdown-item-balance{margin-left:0.5rem;margin-right:0.5rem}.s-user-menu-red-dot .s-user-menu-avatar-wrap{position:relative}.s-user-menu-red-dot .s-user-menu-avatar-wrap:after{position:absolute;top:0px;height:0.75rem;width:0.75rem;border-radius:9999px;border-width:2px;--tw-border-opacity:1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(248 113 113 / var(--tw-bg-opacity, 1));--tw-content:\'\';content:var(--tw-content)}.s-user-menu-red-dot .s-user-menu-avatar-wrap:where([dir="ltr"],[dir="ltr"] *):after{left:0px}.s-user-menu-red-dot .s-user-menu-avatar-wrap:where([dir="rtl"],[dir="rtl"] *):after{right:0px}.header-is-dark .s-user-menu-red-dot .s-user-menu-avatar-wrap:after{--tw-border-opacity:1;border-color:rgb(14 15 15 / var(--tw-border-opacity, 1))}.s-user-menu-login-btn{display:flex;height:2.5rem;width:2.5rem;align-items:center;justify-content:center;border-radius:9999px;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));outline:2px solid transparent;outline-offset:2px;transition-property:opacity;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-user-menu-login-btn:hover{opacity:0.8}.s-user-menu-login-btn svg{height:1.25rem;width:1.25rem;fill:#374151}.s-user-menu-dropdown-item-suffix:where([dir="ltr"],[dir="ltr"] *){margin-left:auto}.s-user-menu-dropdown-item-suffix:where([dir="rtl"],[dir="rtl"] *){margin-right:auto}.s-user-menu-dropdown-item-suffix svg{height:1rem;width:1rem;fill:#9ca3af}.s-user-menu-dropdown-item-suffix-link{display:flex;align-items:center}';export{m as salla_user_menu}
4
+ import{r as t,h as e,H as r,a as i}from"./p-Z_0e-eaG.js";import{A as s}from"./p-DCZbpt2a.js";import{B as a}from"./p-D3mWkc-3.js";import{C as o}from"./p-gFG8By9O.js";import{H as n}from"./p-00vBRoH3.js";import{C as l}from"./p-BsLF_HK7.js";import{S as d}from"./p-D4oPi1Ov.js";import{l as c}from"./p-BChI23pG.js";var h='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>user-circle</title>\n<path d="M16 22.964c-4.525 0-8.447 1.713-9.993 4.365-0.371 0.636-0.156 1.452 0.48 1.823s1.453 0.156 1.823-0.48c0.855-1.465 3.624-3.041 7.689-3.041s6.835 1.576 7.689 3.041c0.249 0.424 0.696 0.661 1.155 0.661 0.228 0 0.459-0.059 0.669-0.181 0.637-0.371 0.852-1.187 0.48-1.823-1.545-2.652-5.467-4.365-9.992-4.365zM22.667 13.631c0-3.676-2.991-6.667-6.667-6.667s-6.667 2.991-6.667 6.667 2.991 6.667 6.667 6.667 6.667-2.992 6.667-6.667zM12 13.631c0-2.205 1.795-4 4-4s4 1.795 4 4-1.795 4-4 4-4-1.795-4-4zM16 0.297c-8.823 0-16 7.177-16 16 0 2.941 0.821 5.831 2.373 8.357 0.252 0.411 0.689 0.636 1.137 0.636 0.239 0 0.479-0.064 0.696-0.197 0.628-0.385 0.824-1.207 0.439-1.833-1.295-2.108-1.979-4.516-1.979-6.963 0-7.352 5.981-13.333 13.333-13.333s13.333 5.981 13.333 13.333c0 2.448-0.684 4.856-1.979 6.961-0.385 0.628-0.189 1.448 0.437 1.835 0.627 0.384 1.448 0.189 1.835-0.437 1.553-2.527 2.373-5.416 2.373-8.359 0-8.823-7.177-16-16-16z"></path>\n</svg>\n';const m=class{constructor(e){t(this,e),this.accountLoading=!1,this.opened=!1,this.notifications=salla.lang.get("common.titles.notifications"),this.orders=salla.lang.get("common.titles.orders"),this.pending_orders=salla.lang.get("common.titles.pending_orders"),this.wishlist=salla.lang.get("common.titles.wishlist"),this.profile=salla.lang.get("common.titles.profile"),this.rating=salla.lang.get("common.titles.rating"),this.wallet=salla.lang.get("common.titles.wallet"),this.settings=salla.lang.get("common.titles.settings"),this.loyalty_points=salla.lang.get("pages.loyalty_program.loyalty_points"),this.logout=salla.lang.get("blocks.header.logout"),this.hello=salla.lang.get("pages.checkout.hello"),this.first_name=salla.storage.get("user.first_name")||"",this.last_name=salla.storage.get("user.last_name")||"",this.avatar=salla.storage.get("user.avatar")||salla.url.cdn("images/avatar.png",40,40),this.badges={notifications:salla.helpers.number(salla.storage.get("user.notifications")||0),pending_orders:salla.helpers.number(salla.storage.get("user.pending_orders")||0)},this.sallaAccountEnabled=!1,this.walletBalance="",this.walletBalanceLoading=!1,this.walletBalanceLoaded=!1,this.hasBadges=Number(salla.storage.get("user.pending_orders"))>0||Number(salla.storage.get("user.notifications"))>0,this.inline=!1,this.avatarOnly=!1,this.showHeader=!1,this.relativeDropdown=!1,this.showTrigger=!1,this.onClickOutside=()=>{this.opened=!1},this.OrderUpdate=0,this.accountPrefixedKeys=["orders","pending_orders","wallet","notifications","rating","profile","wishlist","settings"],this.items={notifications:a,orders:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>box-bankers</title>\n<path d="M28 1.333h-24c-2.205 0-4 1.795-4 4v5.333c0 0.736 0.597 1.333 1.333 1.333v14.667c0 2.205 1.795 4 4 4h21.333c2.205 0 4-1.795 4-4v-14.667c0.736 0 1.333-0.597 1.333-1.333v-5.333c0-2.205-1.795-4-4-4zM28 26.667c0 0.735-0.599 1.333-1.333 1.333h-21.333c-0.735 0-1.333-0.599-1.333-1.333v-14.667h5.333v2.667c0 1.471 1.196 2.667 2.667 2.667h8c1.471 0 2.667-1.196 2.667-2.667v-2.667h5.333zM12 14.667v-2.667h8v2.667zM29.333 9.333h-26.667v-4c0-0.735 0.599-1.333 1.333-1.333h24c0.735 0 1.333 0.599 1.333 1.333z"></path>\n</svg>\n',pending_orders:o,wishlist:n,wallet:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>wallet</title>\n<path d="M28 6.667h-24c-0.736 0-1.333-0.597-1.333-1.333s0.597-1.333 1.333-1.333h24c0.737 0 1.333-0.596 1.333-1.333s-0.596-1.333-1.333-1.333h-24c-2.204 0-3.999 1.793-4 3.997v18.669c0 3.676 2.991 6.667 6.667 6.667h21.333c2.205 0 4-1.795 4-4v-16c0-2.205-1.795-4-4-4zM29.333 26.667c0 0.736-0.597 1.333-1.333 1.333h-21.333c-2.205 0-4-1.795-4-4v-14.895c0.416 0.147 0.865 0.228 1.333 0.228h24c0.736 0 1.333 0.597 1.333 1.333zM22.667 14.667c-2.205 0-4 1.795-4 4s1.795 4 4 4 4-1.795 4-4-1.795-4-4-4zM22.667 20c-0.736 0-1.333-0.597-1.333-1.333s0.597-1.333 1.333-1.333 1.333 0.597 1.333 1.333-0.597 1.333-1.333 1.333z"></path>\n</svg>\n',loyalty_points:c,profile:h}}connectedCallback(){this.langUnsubscribe=salla.lang.subscribe((()=>this.loadTranslations()))}disconnectedCallback(){this.langUnsubscribe?.()}async componentWillLoad(){await salla.onReady(),await salla.lang.onLoaded(),this.loadTranslations(),this.initiate(),Salla.event.on("api::token.injected",(t=>this.profileUrl=this.buildProfileUrl(t))),this.sallaAccountEnabled=Salla.config.get("store.features")?.includes("salla-account"),this.items=this.sallaAccountEnabled?{...this.items,settings:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>settings</title>\n<path d="M29.717 19.037l-1.817-1.499c0.067-0.512 0.1-1.028 0.1-1.539s-0.033-1.027-0.1-1.54l1.817-1.499c1.177-0.969 1.479-2.633 0.716-3.956l-1.159-2.009c-0.761-1.324-2.349-1.895-3.784-1.359l-2.212 0.829c-0.817-0.627-1.704-1.139-2.649-1.535l-0.388-2.332c-0.251-1.507-1.54-2.6-3.067-2.6h-2.319c-1.525 0-2.815 1.093-3.065 2.6l-0.388 2.332c-0.945 0.396-1.833 0.909-2.649 1.535l-2.212-0.829c-1.428-0.533-3.021 0.036-3.783 1.359l-1.16 2.011c-0.763 1.323-0.46 2.985 0.716 3.955l1.817 1.499c-0.067 0.513-0.1 1.029-0.1 1.54s0.033 1.027 0.1 1.539l-1.819 1.5c-1.176 0.971-1.476 2.635-0.715 3.955l1.159 2.011c0.763 1.324 2.356 1.899 3.784 1.36l2.212-0.831c0.816 0.625 1.703 1.139 2.649 1.535l0.388 2.332c0.251 1.507 1.54 2.6 3.067 2.6h2.319c1.527 0 2.816-1.093 3.065-2.6l0.389-2.332c0.947-0.396 1.833-0.909 2.649-1.535l2.212 0.831c1.432 0.539 3.023-0.035 3.783-1.36l1.16-2.011c0.76-1.32 0.459-2.984-0.717-3.956zM28.123 21.663l-1.16 2.011c-0.108 0.188-0.336 0.267-0.536 0.193l-2.931-1.1c-0.459-0.173-0.979-0.079-1.349 0.248-0.923 0.811-1.979 1.423-3.139 1.819-0.464 0.157-0.804 0.559-0.885 1.043l-0.515 3.087c-0.033 0.215-0.216 0.371-0.433 0.371h-2.319c-0.217 0-0.4-0.156-0.436-0.371l-0.513-3.087c-0.080-0.484-0.42-0.884-0.885-1.043-1.16-0.396-2.216-1.008-3.139-1.819-0.248-0.217-0.561-0.332-0.88-0.332-0.157 0-0.316 0.028-0.469 0.084l-2.931 1.1c-0.199 0.079-0.428-0.004-0.537-0.193l-1.159-2.011c-0.109-0.191-0.067-0.428 0.101-0.568l2.409-1.985c0.379-0.312 0.555-0.807 0.46-1.288-0.119-0.605-0.179-1.219-0.179-1.821 0-0.604 0.060-1.217 0.181-1.823 0.095-0.481-0.081-0.976-0.46-1.288l-2.409-1.985c-0.168-0.139-0.211-0.376-0.101-0.567l1.16-2.011c0.107-0.188 0.332-0.268 0.536-0.193l2.931 1.1c0.459 0.172 0.979 0.079 1.348-0.247 0.924-0.812 1.98-1.424 3.139-1.817 0.465-0.159 0.805-0.559 0.885-1.044l0.513-3.088c0.036-0.215 0.219-0.371 0.436-0.371h2.319c0.217 0 0.4 0.156 0.436 0.371l0.515 3.088c0.081 0.484 0.42 0.885 0.885 1.044 1.157 0.393 2.213 1.005 3.139 1.817 0.371 0.325 0.889 0.42 1.349 0.247l2.929-1.099c0.203-0.076 0.428 0.005 0.537 0.193l1.159 2.009c0.109 0.191 0.067 0.428-0.101 0.567l-2.409 1.985c-0.379 0.312-0.555 0.807-0.46 1.288 0.119 0.605 0.179 1.219 0.179 1.823 0 0.603-0.060 1.216-0.181 1.821-0.095 0.48 0.081 0.975 0.46 1.288l2.408 1.984c0.169 0.141 0.212 0.379 0.103 0.569zM16.016 10.667c-2.941 0-5.333 2.392-5.333 5.333s2.392 5.333 5.333 5.333 5.333-2.392 5.333-5.333-2.392-5.333-5.333-5.333zM16.016 18.667c-1.471 0-2.667-1.196-2.667-2.667s1.196-2.667 2.667-2.667 2.667 1.196 2.667 2.667-1.196 2.667-2.667 2.667z"></path>\n</svg>\n'}:this.items,this.host.hasAttribute("with-rating")&&(this.items.rating=d),this.items.logout='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>send-out</title>\n<path d="M16 26.667h-9.333c-0.736 0-1.333-0.597-1.333-1.333v-18.667c0-0.736 0.597-1.333 1.333-1.333h9.333c0.737 0 1.333-0.596 1.333-1.333s-0.596-1.333-1.333-1.333h-9.333c-2.205 0-4 1.795-4 4v18.667c0 2.205 1.795 4 4 4h9.333c0.737 0 1.333-0.596 1.333-1.333s-0.596-1.333-1.333-1.333zM29.231 15.491c-0.068-0.164-0.167-0.312-0.289-0.436l-5.332-5.332c-0.521-0.521-1.364-0.521-1.885 0s-0.521 1.364 0 1.885l3.057 3.059h-12.781c-0.737 0-1.333 0.596-1.333 1.333s0.596 1.333 1.333 1.333h12.781l-3.057 3.057c-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391l5.332-5.332c0.124-0.123 0.221-0.271 0.289-0.435 0.135-0.325 0.135-0.693 0-1.019z"></path>\n</svg>\n';let t=Salla.storage.get("token");t||(t=""),this.profileUrl=this.buildProfileUrl(t);const e=this.host.querySelector('[slot="trigger"]');this.triggerSlot='<div class="s-user-menu-trigger"><div class="s-user-menu-avatar-wrap"><img class="s-user-menu-trigger-avatar" src="{avatar}" alt="{first_name}{last_name}" /></div><div class="s-user-menu-trigger-content"><span class="s-user-menu-trigger-hello">{hello}</span><p class="s-user-menu-trigger-name">{first_name} {last_name}</p></div> <i class="s-user-menu-trigger-icon">{icon}</i></div>',e&&(this.triggerSlot=e.innerHTML,e.innerHTML=this.replaceParams(e.innerHTML))}loadTranslations(){this.notifications=Salla.lang.get("common.titles.notifications"),this.orders=Salla.lang.get("common.titles.orders"),this.pending_orders=Salla.lang.get("common.titles.pending_orders"),this.wishlist=Salla.lang.get("common.titles.wishlist"),this.profile=Salla.lang.get("common.titles.profile"),this.hello=Salla.lang.get("pages.checkout.hello"),this.rating=Salla.lang.get("common.titles.rating"),this.wallet=Salla.lang.get("common.titles.wallet"),this.settings=Salla.lang.get("common.titles.settings"),this.loyalty_points=Salla.lang.get("pages.loyalty_program.loyalty_points"),this.logout=Salla.lang.get("blocks.header.logout")}async loadWalletBalance(){if(!Salla.config.isGuest()){this.walletBalanceLoading=!0;try{const t=await salla.api.withoutNotifier((()=>salla.api.request("/balance/wallet?light=1"))),e=Number(t?.data?.balance)||0;this.walletBalance=e?Salla.money({amount:Number(e.toFixed(2)),currency:Salla.config.get("user.currency_code")}):"",this.walletBalanceLoaded=!0}catch{}finally{this.walletBalanceLoading=!1}}}initiate(){return Salla.config.isGuest()?this.autoMountLoginModal():(this.is_loggedIn=!0,!this.inline&&(salla.url.is_page("customer.notifications")||salla.url.is_page("customer.orders.index.pending")||salla.url.is_page("customer.profile")||(Date.now()-(salla.storage.get("user.fetched_at")||0))/1e3/60>30)?this.fetchFreshProfile():void salla.event.on("profile::info.fetched",(t=>{this.updateProfileState(t)})))}autoMountLoginModal(){this.showTrigger&&(document.querySelector("salla-login-modal")||Salla.hooks.mount("body:end",document.createElement("salla-login-modal")))}fetchFreshProfile(){salla.api.token?salla.profile.api.info().then((t=>{this.updateProfileState(t)})):salla.log("trying to fetchFreshProfile before injected the token!!")}updateProfileState(t){this.badges={notifications:salla.helpers.number(t.data.notifications||0),pending_orders:salla.helpers.number(t.data.pending_orders||0)},this.hasBadges=Number(t.data.pending_orders)>0||Number(t.data.notifications)>0,this.first_name=t.data.first_name,this.last_name=t.data.last_name,this.avatar=t.data.avatar||salla.url.cdn("images/avatar.png",40,40)}async open(t){this.opened=!this.opened,t.stopPropagation(),this.opened&&(!window.can_access_wallet||this.walletBalanceLoaded||this.walletBalanceLoading||this.loadWalletBalance(),window.addEventListener("click",this.onClickOutside))}prepareProfileLink(t,e){"profile"===e&&this.profileUrl&&this.sallaAccountEnabled&&(t.currentTarget.href=this.withAnonymousId(this.profileUrl))}menuItemClicked(t,e){this.prepareProfileLink(t,e),"logout"===e&&(t.preventDefault(),salla.auth.logout("sall-user-menu"))}replaceParams(t){return t.replace(/\{hello\}/g,this.hello).replace(/\{first_name\}/g,this.first_name).replace(/\{last_name\}/g,this.last_name).replace(/\{avatar\}/g,this.avatar).replace(/\{icon\}/g,s)}getTheHeader(){return e("div",{class:{"s-user-menu-trigger-slot":!0,"s-user-menu-red-dot":this.hasBadges,"s-user-menu-trigger-avatar-only":this.avatarOnly},id:"trigger-slot",onClick:t=>this.open(t),onKeyUp:t=>this.open(t),innerHTML:this.replaceParams(this.triggerSlot)})}getItemAnchorLinkAttrs(t){if("profile"===t&&this.profileUrl&&this.sallaAccountEnabled)return{href:this.profileUrl,target:"_blank",rel:"noopener noreferrer"};const e="loyalty_points"===t?"loyalty":t,r=this.accountPrefixedKeys.includes(e)?`account/${e}`:e;return{href:Salla.url.get(r)}}getMenuItem([t,r],i){if(("wallet"!==t||window.can_access_wallet)&&("loyalty_points"!==t||Salla.config.get("store.features").includes("loyalty-system")))return e("li",{class:{"s-user-menu-dropdown-item":!0,"s-user-menu-dropdown-item-logout":i+1===Object.entries(this.items).length}},e("a",{...this.getItemAnchorLinkAttrs(t),class:"s-user-menu-dropdown-item-link",onClick:e=>this.menuItemClicked(e,t),onMouseDown:e=>this.prepareProfileLink(e,t),onFocus:e=>this.prepareProfileLink(e,t),onContextMenu:e=>this.prepareProfileLink(e,t)},e("i",{class:"s-user-menu-dropdown-item-prefix",innerHTML:r}),e("span",{class:"s-user-menu-dropdown-item-title"},this[t]),"wallet"!==t||this.inline||!this.walletBalance&&!this.walletBalanceLoading?"":e("span",{class:"s-user-menu-dropdown-item-balance",style:{display:"inline-flex",alignItems:"center",gap:"4px"}},this.walletBalance?e("span",{innerHTML:this.walletBalance}):"",this.walletBalanceLoading?e("salla-loading",{size:"14"}):""),["٠","0",void 0].includes(this.badges[t])?"":e("span",{class:"s-user-menu-dropdown-item-badge"},this.badges[t])))}componentShouldUpdate(){this.opened||window.removeEventListener("click",this.onClickOutside)}render(){return e(r,null,this.is_loggedIn?this.inline?e("ul",{class:"s-user-menu-inline"},Object.entries(this.items).map(((t,e)=>this.getMenuItem(t,e)))):e("div",{class:{"s-user-menu-wrapper":!0,"s-user-menu-relative-dropdown":this.relativeDropdown}},this.getTheHeader(),e("div",{class:{"s-user-menu-toggler":!0,opened:this.opened}},e("div",{class:"s-user-menu-dropdown",onClick:t=>t.stopPropagation(),onKeyUp:t=>t.stopPropagation()},this.showHeader?e("div",{class:"s-user-menu-dropdown-header"},e("img",{src:this.avatar,alt:`${this.first_name} ${this.last_name}`}),e("div",{class:"s-user-menu-dropdown-header-content"},e("span",null,this.hello),e("p",null,this.first_name," ",this.last_name)),e("button",{type:"button",class:"s-user-menu-dropdown-header-close",innerHTML:l,onClick:()=>{this.opened=!1}})):"",e("ul",{class:"s-user-menu-dropdown-list"},Object.entries(this.items).map(((t,e)=>this.getMenuItem(t,e))))))):e("slot",{name:"login-btn"},e("button",{type:"button",class:"s-user-menu-login-btn",onClick:()=>salla.event.dispatch("login::open"),innerHTML:h})))}async componentDidLoad(){await Salla.hooks.registerComponent("salla-user-menu",this),document.lazyLoadInstance?.update(this.host.querySelectorAll(".lazy"))}buildProfileUrl(t){return`${Salla.config.get("account.url","https://accounts.salla.com")}/${salla.config.get("user.language_code")}/user?store=${Salla.config.get("store.id")}&info=${encodeURIComponent(t)}`}withAnonymousId(t){const e=this.getAnalyticsAnonymousId();return e?`${t}&aid=${encodeURIComponent(e)}`:t}getAnalyticsAnonymousId(){try{return"accepted"!==Salla.storage.get("cookies-consent")?null:Salla.analytics?.getAnonymousId?.()||null}catch(t){return null}}get host(){return i(this)}};m.style='/*!twlt*/.relative{position:relative}.inline{display:inline}.inline-flex{display:inline-flex}salla-user-menu div[slot=\'trigger\']{display:none}.s-user-menu-wrapper{display:block;min-width:max-content;flex-shrink:0}.s-user-menu-relative-dropdown{position:relative}.s-user-menu-trigger{display:flex;width:fit-content;cursor:pointer;align-items:center;border-top-right-radius:0.375rem;border-top-left-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding-left:0.625rem;padding-right:0.625rem;padding-top:0.875rem;padding-bottom:0.875rem;font-size:0.875rem;line-height:1.25rem}.s-user-menu-trigger-icon svg{height:1.25rem;width:1.25rem;transition-property:transform;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:200ms}.s-user-menu-toggler::before{pointer-events:none;visibility:hidden;position:fixed;left:0px;top:0px;z-index:10;height:100vh;width:100vw;background-color:#71717abf;opacity:0;transition-duration:300ms;--tw-content:\'\';content:var(--tw-content)}.s-user-menu-toggler.opened::before{pointer-events:auto;visibility:visible;content:var(--tw-content);opacity:1}@media (min-width: 768px){.s-user-menu-toggler.opened::before{pointer-events:none;visibility:hidden;content:var(--tw-content);opacity:0}}.s-user-menu-toggler.opened .s-user-menu-trigger svg{--tw-rotate:180deg;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.s-user-menu-toggler.opened .s-user-menu-dropdown{visibility:visible;--tw-translate-y:0px;--tw-scale-x:1;--tw-scale-y:1;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));opacity:1}.s-user-menu-trigger-avatar{display:inline-block;height:2.5rem;width:2.5rem;border-radius:9999px;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));object-fit:cover}.s-user-menu-trigger-content{margin-left:0.5rem;margin-right:0.25rem}.s-user-menu-trigger-content:where([dir="rtl"],[dir="rtl"] *){margin-right:0.5rem;margin-left:0.25rem}.s-user-menu-trigger-avatar-only .s-user-menu-trigger-content{display:none}.s-user-menu-trigger-avatar-only .s-user-menu-trigger-icon{display:none}.s-user-menu-trigger-avatar-only .s-user-menu-trigger-avatar{border-width:0px}.s-user-menu-trigger-hello{font-size:14px;--tw-text-opacity:1;color:rgb(153 153 153 / var(--tw-text-opacity, 1))}.s-user-menu-trigger-name{margin-top:0.125rem;font-size:15px;line-height:1;--tw-text-opacity:1;color:rgb(68 68 68 / var(--tw-text-opacity, 1))}.s-user-menu-trigger-icon{margin-left:10px}.s-user-menu-trigger-icon:where([dir="rtl"],[dir="rtl"] *){margin-left:0px;margin-right:10px}.s-user-menu-trigger-text-value{font-size:0.875rem;line-height:1.25rem;font-weight:500;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-user-menu-dropdown{visibility:hidden;position:fixed;bottom:0px;top:auto;right:0px;z-index:30;width:100%;transform-origin:center;--tw-translate-y:2.5rem;--tw-scale-y:.9;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));border-top-left-radius:0.375rem;border-top-right-radius:0.375rem;border-bottom-right-radius:0px;border-bottom-left-radius:0px;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));opacity:0;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}@media (min-width: 768px){.s-user-menu-dropdown{position:absolute;bottom:unset;top:100%;width:15rem;transform-origin:top right;--tw-translate-y:-1rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));border-top-left-radius:0px;border-top-right-radius:0px;border-bottom-right-radius:0.375rem;border-bottom-left-radius:0.375rem;--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);transition-duration:200ms}}@media (min-width: 1024px){.s-user-menu-dropdown{border-top-width:1px;border-color:rgb(209 213 219 / 0.3)}}.s-user-menu-dropdown:where([dir="rtl"],[dir="rtl"] *){left:0px;right:unset}.s-user-menu-dropdown-list>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1px * var(--tw-space-y-reverse))}.s-user-menu-dropdown-list{padding-top:0.5rem;padding-left:0.5rem;padding-right:0.5rem;padding-bottom:1rem}@media (min-width: 1024px){.s-user-menu-dropdown-list{padding-left:0px;padding-right:0px;padding-bottom:0.5rem}}.s-user-menu-dropdown-item a{display:flex;align-items:center;padding-left:1.5rem;padding-right:1.5rem;padding-top:0.625rem;padding-bottom:0.625rem;--tw-text-opacity:1;color:rgb(68 68 68 / var(--tw-text-opacity, 1));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-user-menu-dropdown-item a:hover{background-color:rgb(229 231 235 / 0.3)}@media (min-width: 640px){.s-user-menu-dropdown-item a{font-size:0.875rem;line-height:1.25rem}}.s-user-menu-dropdown-item-logout a{--tw-text-opacity:1 !important;color:rgb(255 68 58 / var(--tw-text-opacity, 1)) !important}.s-user-menu-dropdown-item-logout a svg{fill:#FF443A !important}.s-user-menu-dropdown-item-prefix svg{margin-right:0.75rem;height:1rem;width:1rem;fill:#9ca3af}.s-user-menu-dropdown-item-prefix svg:where([dir="rtl"],[dir="rtl"] *){margin-right:0px;margin-left:0.75rem}.s-user-menu-dropdown-header{position:relative;margin-bottom:0.25rem;display:flex;align-items:center;border-bottom-width:1px;padding:1rem}@media (min-width: 768px){.s-user-menu-dropdown-header{display:none}}.s-user-menu-dropdown-header img{pointer-events:none;margin-right:0.75rem;height:3rem;width:3rem;border-radius:9999px;object-fit:cover}.s-user-menu-dropdown-header img:where([dir="rtl"],[dir="rtl"] *){margin-right:0px;margin-left:0.75rem}.s-user-menu-dropdown-header-content span{font-size:14px;--tw-text-opacity:1;color:rgb(153 153 153 / var(--tw-text-opacity, 1))}.s-user-menu-dropdown-header-content p{font-size:1rem;line-height:1.5rem;font-weight:700;line-height:1;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-user-menu-dropdown-header-close{position:absolute;top:1.25rem;right:1rem;z-index:50;border-radius:9999px}.s-user-menu-dropdown-header-close:where([dir="rtl"],[dir="rtl"] *){right:unset;left:1rem}.s-user-menu-dropdown-header-close svg{height:1.25rem;width:1.25rem;fill:#ef4444}.s-user-menu-dropdown-item-badge{position:absolute;right:0.625rem;display:flex;height:1.25rem;width:1.25rem;flex-direction:column;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1));font-size:0.75rem;line-height:1rem;line-height:inherit;--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.s-user-menu-dropdown-item-badge:where([dir="rtl"],[dir="rtl"] *){right:unset;left:0.625rem}.s-user-menu-dropdown-item-balance{margin-left:0.5rem;margin-right:0.5rem}.s-user-menu-red-dot .s-user-menu-avatar-wrap{position:relative}.s-user-menu-red-dot .s-user-menu-avatar-wrap:after{position:absolute;top:0px;height:0.75rem;width:0.75rem;border-radius:9999px;border-width:2px;--tw-border-opacity:1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(248 113 113 / var(--tw-bg-opacity, 1));--tw-content:\'\';content:var(--tw-content)}.s-user-menu-red-dot .s-user-menu-avatar-wrap:where([dir="ltr"],[dir="ltr"] *):after{left:0px}.s-user-menu-red-dot .s-user-menu-avatar-wrap:where([dir="rtl"],[dir="rtl"] *):after{right:0px}.header-is-dark .s-user-menu-red-dot .s-user-menu-avatar-wrap:after{--tw-border-opacity:1;border-color:rgb(14 15 15 / var(--tw-border-opacity, 1))}.s-user-menu-login-btn{display:flex;height:2.5rem;width:2.5rem;align-items:center;justify-content:center;border-radius:9999px;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));outline:2px solid transparent;outline-offset:2px;transition-property:opacity;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-user-menu-login-btn:hover{opacity:0.8}.s-user-menu-login-btn svg{height:1.25rem;width:1.25rem;fill:#374151}.s-user-menu-dropdown-item-suffix:where([dir="ltr"],[dir="ltr"] *){margin-left:auto}.s-user-menu-dropdown-item-suffix:where([dir="rtl"],[dir="rtl"] *){margin-right:auto}.s-user-menu-dropdown-item-suffix svg{height:1rem;width:1rem;fill:#9ca3af}.s-user-menu-dropdown-item-suffix-link{display:flex;align-items:center}';export{m as salla_user_menu}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as e,h as t,a}from"./p-DSmjBlMI.js";const i=class{constructor(t){e(this,t),this.hasError=!1,salla.event.on("size-guide::open",(e=>this.open(e)))}connectedCallback(){this.langUnsubscribe=salla.lang.subscribe((()=>{this.placeholder_title=salla.lang.get("pages.products.size_guide_placeholder"),this.placeholder_description=salla.lang.get("pages.products.size_guide_placeholder_info"),this.modal_title=salla.lang.get("pages.products.size_guides")}))}disconnectedCallback(){this.langUnsubscribe?.()}async open(e){return this.modal.setTitle(this.modal_title),this.modal.open(),await salla.api.withoutNotifier((()=>salla.product.getSizeGuides(e))).then((e=>{this.guides=e.data})).catch((e=>{console.log(e),this.hasError=!0,this.placeholder_description=e.response?.data?.error?.message||e.response?.data})).finally((()=>this.modal.stopLoading()))}async close(){return this.modal.close()}showPlaceholder(){return t("salla-placeholder",{alignment:"center",iconSize:"xl"},t("div",{slot:"title"},this.placeholder_title),t("div",{slot:"description"},this.placeholder_description))}render(){return t("salla-modal",{key:"587dbc28fa828df2a47a4db1c124df032fe719fa",class:"s-product-size-guide-wrapper",id:"salla-product-size-guide-modal",isLoading:!0,"has-skeleton":!0,width:"md",ref:e=>this.modal=e},t("span",{key:"822224aa89fb065c7262abf2f24914ed1fa3d8bb",slot:"icon",class:"s-product-size-guide-header-icon",innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>pencil-ruler</title>\n<path d="M3.057 11.609c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391l6.667-6.667c0.521-0.521 0.521-1.364 0-1.885l-1.285-1.285c-1.143-1.143-2.661-1.772-4.276-1.772-1.616 0-3.135 0.629-4.276 1.772-1.143 1.141-1.772 2.66-1.772 4.276 0 1.615 0.629 3.135 1.772 4.276zM3.657 3.657c1.277-1.277 3.504-1.277 4.781 0l0.343 0.343-4.781 4.781-0.343-0.343c-0.639-0.639-0.991-1.488-0.991-2.391s0.352-1.752 0.991-2.391zM29.317 20.972c-0.2-0.707-0.932-1.119-1.645-0.921-0.709 0.2-1.121 0.937-0.921 1.645l1.987 7.041-7.041-1.987c-0.707-0.195-1.444 0.213-1.645 0.921-0.2 0.708 0.212 1.445 0.921 1.645l9.333 2.633c0.119 0.032 0.24 0.049 0.361 0.049 0.349 0 0.689-0.137 0.943-0.391 0.341-0.341 0.472-0.84 0.34-1.305zM31.609 8.772l-8.381-8.381c-0.5-0.5-1.385-0.5-1.885 0l-8.171 8.171s-0.001 0-0.001 0.001 0 0.001-0.001 0.001l-4.607 4.607s0 0-0.001 0 0 0 0 0.001l-8.171 8.171c-0.251 0.249-0.391 0.588-0.391 0.943 0 0.353 0.14 0.693 0.391 0.943l8.381 8.381c0.249 0.251 0.589 0.391 0.943 0.391s0.693-0.14 0.943-0.391l20.952-20.952c0.521-0.521 0.521-1.365 0-1.885zM9.715 28.781l-6.495-6.496 1.676-1.676 1.851 1.851c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.521 0.521-1.364 0-1.885l-1.851-1.851 2.724-2.724 3.008 3.008c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.521 0.521-1.364 0-1.885l-3.008-3.008 2.724-2.724 1.851 1.851c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.52 0.521-1.364 0-1.885l-1.851-1.851 2.724-2.724 3.008 3.008c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.521 0.521-1.365 0-1.885l-3.008-3.008 1.677-1.677 6.496 6.496z"></path>\n</svg>\n'}),t("div",{key:"84e14a400f9417aa9be851a07f0203348a560aec",slot:"loading"},t("div",{key:"5cbdbcf560f08279543c4d25fd21416ce2da1314",class:"s-product-size-guide-skeleton"},t("salla-skeleton",{key:"e3139f2898256adc2c20fbb86e96a9f5d008a677",height:"15px",width:"25%"}),t("div",{key:"961f482bf358c5a4ca0d980561bafdcd7489fa68",class:"s-product-size-guide-skeleton-header"},t("salla-skeleton",{key:"1754361211a771952be69eeda9a4c9788aaff0e6",height:"40px"}),t("salla-skeleton",{key:"2ea3578f8751a2526947d5c067392ef95e3bcf44",height:"40px"}),t("salla-skeleton",{key:"32bba195c5f6a60ce9837b4d4cbfa302d6ddfb07",height:"40px"}),t("salla-skeleton",{key:"9888b01cd47c5acdc0a159ad49db228efd630d75",height:"40px"})),t("div",{key:"d86e706b2393b17301f9f28b4b303f00bf743363",class:"s-product-size-guide-skeleton-content"},t("salla-skeleton",{key:"02e0330958fd73288d5c654fce7169470cdf47cd",height:"15px",width:"25%"}),t("salla-skeleton",{key:"cccb8bc372c6ccfdf707621190bba4bc38aecb99",height:"10px",width:"75%"}),t("salla-skeleton",{key:"95f8e83b3b1a54a52da1ff2e61a866239575cf7b",height:"10px",width:"50%"}),t("salla-skeleton",{key:"4880b1d82cea617cae837ad2d6dd4d627fe8d9e3",height:"10px",width:"75%"}),t("salla-skeleton",{key:"38980cc41e7388b41e35015ceed72d025bd82980",height:"10px",width:"100%"}),t("salla-skeleton",{key:"bb1ad6a995e9e27b851007cae2c1f7204f3c2d91",height:"10px",width:"25%"}),t("salla-skeleton",{key:"fc5cd1e7adafca96e00b9284123bb3eb9f892c9c",height:"10px",width:"60%"}),t("salla-skeleton",{key:"89bbd77ec6da0c8e03dd2fb9f60c929f49415c83",height:"10px",width:"45%"}),t("salla-skeleton",{key:"0666ce266b9411913ae4db64c61d3cfa44cf4245",height:"10px",width:"30%"})))),t("slot",{key:"31a338bdc12e2a4ea1f80ea4bd700e293020b840",name:"header"}),!this.hasError&&this.guides?[t("salla-tabs",null,this.guides.map((e=>t("salla-tab-header",{slot:"header",name:e.name},t("span",null,e.name)))),this.guides.map((e=>t("salla-tab-content",{slot:"content",name:e.name},t("div",{innerHTML:e.description})))))]:this.showPlaceholder(),t("slot",{key:"887b97cd58b442db20dad02db8ace42847bcef75",name:"footer"}))}get host(){return a(this)}};i.style='/*!twlt*/.s-product-size-guide-wrapper .s-modal-title{margin-bottom:0px !important}.s-product-size-guide-wrapper .s-tabs-content{max-height:60vh;overflow:auto}@media (min-width: 768px){.s-product-size-guide-wrapper .s-tabs-content{max-height:70vh}}.s-product-size-guide-placeholder{display:flex;align-items:center;justify-content:center}.s-product-size-guide-skeleton-table{margin-top:1.25rem;width:100%;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));line-height:1.25rem}.s-product-size-guide-skeleton-table td{border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));padding:0.5rem;line-height:1.25rem}.s-product-size-guide-header-icon{display:inline-flex;height:3rem;width:3rem;align-items:center;justify-content:center;border-radius:9999px;border-width:1px;border-style:solid;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}@media (min-width: 640px){.s-product-size-guide-header-icon{margin-left:auto;margin-right:auto;margin-bottom:1rem;height:5rem;width:5rem}}.s-product-size-guide-header-icon:where([dir="ltr"],[dir="ltr"] *){margin-right:0.5rem}@media (min-width: 640px){.s-product-size-guide-header-icon:where([dir="ltr"],[dir="ltr"] *){margin-right:0px}}.s-product-size-guide-header-icon:where([dir="rtl"],[dir="rtl"] *){margin-left:0.5rem}@media (min-width: 640px){.s-product-size-guide-header-icon:where([dir="rtl"],[dir="rtl"] *){margin-left:0px}}.s-product-size-guide-header-icon svg{height:1.25rem;width:1.25rem;flex-shrink:0;fill:#9ca3af}.s-product-size-guide-skeleton-content{margin-top:1.25rem;display:flex;flex-direction:column}.s-product-size-guide-skeleton-content>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(0.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0.75rem * var(--tw-space-y-reverse))}.s-product-size-guide-skeleton-header{margin-top:2rem;margin-bottom:2rem;display:flex;align-items:center;justify-content:space-between}.s-product-size-guide-skeleton-header>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(1.25rem * var(--tw-space-x-reverse));margin-left:calc(1.25rem * calc(1 - var(--tw-space-x-reverse)))}.s-product-size-guide-skeleton-header:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-product-size-guide-skeleton-header>salla-skeleton{flex:1 1 0%}';export{i as salla_product_size_guide}
4
+ import{r as e,h as t,a}from"./p-Z_0e-eaG.js";const i=class{constructor(t){e(this,t),this.hasError=!1,salla.event.on("size-guide::open",(e=>this.open(e)))}connectedCallback(){this.langUnsubscribe=salla.lang.subscribe((()=>{this.placeholder_title=salla.lang.get("pages.products.size_guide_placeholder"),this.placeholder_description=salla.lang.get("pages.products.size_guide_placeholder_info"),this.modal_title=salla.lang.get("pages.products.size_guides")}))}disconnectedCallback(){this.langUnsubscribe?.()}async open(e){return this.modal.setTitle(this.modal_title),this.modal.open(),await salla.api.withoutNotifier((()=>salla.product.getSizeGuides(e))).then((e=>{this.guides=e.data})).catch((e=>{console.log(e),this.hasError=!0,this.placeholder_description=e.response?.data?.error?.message||e.response?.data})).finally((()=>this.modal.stopLoading()))}async close(){return this.modal.close()}showPlaceholder(){return t("salla-placeholder",{alignment:"center",iconSize:"xl"},t("div",{slot:"title"},this.placeholder_title),t("div",{slot:"description"},this.placeholder_description))}render(){return t("salla-modal",{key:"587dbc28fa828df2a47a4db1c124df032fe719fa",class:"s-product-size-guide-wrapper",id:"salla-product-size-guide-modal",isLoading:!0,"has-skeleton":!0,width:"md",ref:e=>this.modal=e},t("span",{key:"822224aa89fb065c7262abf2f24914ed1fa3d8bb",slot:"icon",class:"s-product-size-guide-header-icon",innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>pencil-ruler</title>\n<path d="M3.057 11.609c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391l6.667-6.667c0.521-0.521 0.521-1.364 0-1.885l-1.285-1.285c-1.143-1.143-2.661-1.772-4.276-1.772-1.616 0-3.135 0.629-4.276 1.772-1.143 1.141-1.772 2.66-1.772 4.276 0 1.615 0.629 3.135 1.772 4.276zM3.657 3.657c1.277-1.277 3.504-1.277 4.781 0l0.343 0.343-4.781 4.781-0.343-0.343c-0.639-0.639-0.991-1.488-0.991-2.391s0.352-1.752 0.991-2.391zM29.317 20.972c-0.2-0.707-0.932-1.119-1.645-0.921-0.709 0.2-1.121 0.937-0.921 1.645l1.987 7.041-7.041-1.987c-0.707-0.195-1.444 0.213-1.645 0.921-0.2 0.708 0.212 1.445 0.921 1.645l9.333 2.633c0.119 0.032 0.24 0.049 0.361 0.049 0.349 0 0.689-0.137 0.943-0.391 0.341-0.341 0.472-0.84 0.34-1.305zM31.609 8.772l-8.381-8.381c-0.5-0.5-1.385-0.5-1.885 0l-8.171 8.171s-0.001 0-0.001 0.001 0 0.001-0.001 0.001l-4.607 4.607s0 0-0.001 0 0 0 0 0.001l-8.171 8.171c-0.251 0.249-0.391 0.588-0.391 0.943 0 0.353 0.14 0.693 0.391 0.943l8.381 8.381c0.249 0.251 0.589 0.391 0.943 0.391s0.693-0.14 0.943-0.391l20.952-20.952c0.521-0.521 0.521-1.365 0-1.885zM9.715 28.781l-6.495-6.496 1.676-1.676 1.851 1.851c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.521 0.521-1.364 0-1.885l-1.851-1.851 2.724-2.724 3.008 3.008c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.521 0.521-1.364 0-1.885l-3.008-3.008 2.724-2.724 1.851 1.851c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.52 0.521-1.364 0-1.885l-1.851-1.851 2.724-2.724 3.008 3.008c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.521 0.521-1.365 0-1.885l-3.008-3.008 1.677-1.677 6.496 6.496z"></path>\n</svg>\n'}),t("div",{key:"84e14a400f9417aa9be851a07f0203348a560aec",slot:"loading"},t("div",{key:"5cbdbcf560f08279543c4d25fd21416ce2da1314",class:"s-product-size-guide-skeleton"},t("salla-skeleton",{key:"e3139f2898256adc2c20fbb86e96a9f5d008a677",height:"15px",width:"25%"}),t("div",{key:"961f482bf358c5a4ca0d980561bafdcd7489fa68",class:"s-product-size-guide-skeleton-header"},t("salla-skeleton",{key:"1754361211a771952be69eeda9a4c9788aaff0e6",height:"40px"}),t("salla-skeleton",{key:"2ea3578f8751a2526947d5c067392ef95e3bcf44",height:"40px"}),t("salla-skeleton",{key:"32bba195c5f6a60ce9837b4d4cbfa302d6ddfb07",height:"40px"}),t("salla-skeleton",{key:"9888b01cd47c5acdc0a159ad49db228efd630d75",height:"40px"})),t("div",{key:"d86e706b2393b17301f9f28b4b303f00bf743363",class:"s-product-size-guide-skeleton-content"},t("salla-skeleton",{key:"02e0330958fd73288d5c654fce7169470cdf47cd",height:"15px",width:"25%"}),t("salla-skeleton",{key:"cccb8bc372c6ccfdf707621190bba4bc38aecb99",height:"10px",width:"75%"}),t("salla-skeleton",{key:"95f8e83b3b1a54a52da1ff2e61a866239575cf7b",height:"10px",width:"50%"}),t("salla-skeleton",{key:"4880b1d82cea617cae837ad2d6dd4d627fe8d9e3",height:"10px",width:"75%"}),t("salla-skeleton",{key:"38980cc41e7388b41e35015ceed72d025bd82980",height:"10px",width:"100%"}),t("salla-skeleton",{key:"bb1ad6a995e9e27b851007cae2c1f7204f3c2d91",height:"10px",width:"25%"}),t("salla-skeleton",{key:"fc5cd1e7adafca96e00b9284123bb3eb9f892c9c",height:"10px",width:"60%"}),t("salla-skeleton",{key:"89bbd77ec6da0c8e03dd2fb9f60c929f49415c83",height:"10px",width:"45%"}),t("salla-skeleton",{key:"0666ce266b9411913ae4db64c61d3cfa44cf4245",height:"10px",width:"30%"})))),t("slot",{key:"31a338bdc12e2a4ea1f80ea4bd700e293020b840",name:"header"}),!this.hasError&&this.guides?[t("salla-tabs",null,this.guides.map((e=>t("salla-tab-header",{slot:"header",name:e.name},t("span",null,e.name)))),this.guides.map((e=>t("salla-tab-content",{slot:"content",name:e.name},t("div",{innerHTML:e.description})))))]:this.showPlaceholder(),t("slot",{key:"887b97cd58b442db20dad02db8ace42847bcef75",name:"footer"}))}get host(){return a(this)}};i.style='/*!twlt*/.s-product-size-guide-wrapper .s-modal-title{margin-bottom:0px !important}.s-product-size-guide-wrapper .s-tabs-content{max-height:60vh;overflow:auto}@media (min-width: 768px){.s-product-size-guide-wrapper .s-tabs-content{max-height:70vh}}.s-product-size-guide-placeholder{display:flex;align-items:center;justify-content:center}.s-product-size-guide-skeleton-table{margin-top:1.25rem;width:100%;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));line-height:1.25rem}.s-product-size-guide-skeleton-table td{border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));padding:0.5rem;line-height:1.25rem}.s-product-size-guide-header-icon{display:inline-flex;height:3rem;width:3rem;align-items:center;justify-content:center;border-radius:9999px;border-width:1px;border-style:solid;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}@media (min-width: 640px){.s-product-size-guide-header-icon{margin-left:auto;margin-right:auto;margin-bottom:1rem;height:5rem;width:5rem}}.s-product-size-guide-header-icon:where([dir="ltr"],[dir="ltr"] *){margin-right:0.5rem}@media (min-width: 640px){.s-product-size-guide-header-icon:where([dir="ltr"],[dir="ltr"] *){margin-right:0px}}.s-product-size-guide-header-icon:where([dir="rtl"],[dir="rtl"] *){margin-left:0.5rem}@media (min-width: 640px){.s-product-size-guide-header-icon:where([dir="rtl"],[dir="rtl"] *){margin-left:0px}}.s-product-size-guide-header-icon svg{height:1.25rem;width:1.25rem;flex-shrink:0;fill:#9ca3af}.s-product-size-guide-skeleton-content{margin-top:1.25rem;display:flex;flex-direction:column}.s-product-size-guide-skeleton-content>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(0.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0.75rem * var(--tw-space-y-reverse))}.s-product-size-guide-skeleton-header{margin-top:2rem;margin-bottom:2rem;display:flex;align-items:center;justify-content:space-between}.s-product-size-guide-skeleton-header>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(1.25rem * var(--tw-space-x-reverse));margin-left:calc(1.25rem * calc(1 - var(--tw-space-x-reverse)))}.s-product-size-guide-skeleton-header:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-product-size-guide-skeleton-header>salla-skeleton{flex:1 1 0%}';export{i as salla_product_size_guide}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as s,h as t,H as o}from"./p-DSmjBlMI.js";const e=class{constructor(t){s(this,t),this.bordered=!0,this.placeholderImage="images/placeholder.png",this.optionsData=[]}componentWillLoad(){this.parseOptionsData()}componentWillUpdate(){this.parseOptionsData()}parseOptionsData(){if(this.options)if("string"==typeof this.options)try{this.optionsData=JSON.parse(this.options)}catch(s){this.optionsData=[]}else this.optionsData=Array.isArray(this.options)?this.options:[];else this.optionsData=[]}renderOptionValue(s){return s.is_image?t("div",{class:"s-order-details-option-image-container"},t("a",{href:s.value,target:"_blank"},t("img",{class:"s-order-details-option-image",src:s.value||this.placeholderImage,alt:s.name}))):s.color?t("span",{title:s.value,class:"s-order-details-option-color-swatch",style:{backgroundColor:s.color}}):s.is_file?t("a",{href:s.value,target:"_blank",class:"s-order-details-option-file-link"},salla.lang.get("common.elements.attachments")):s.is_color_picker?t("div",{class:"s-order-details-option-color-picker"},t("div",{class:"s-order-details-option-color-picker-content"},t("span",{class:"s-order-details-option-color-picker-text"},s.value),t("span",{class:"s-order-details-option-color-picker-swatch",style:{backgroundColor:s.value,width:"1rem"}})),t("salla-button",{onClick:t=>this.copyToClipboard(t,s.value),shape:"link",class:"s-order-details-option-color-picker-button"},t("span",{class:"s-order-details-option-color-copy-icon",innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>swap-fill</title>\n<path d="M28 10.667h-2.667c-0.736 0-1.333 0.596-1.333 1.333s0.597 1.333 1.333 1.333h2.667c0.735 0 1.333 0.597 1.333 1.333v13.333c0 0.736-0.599 1.333-1.333 1.333h-13.333c-0.735 0-1.333-0.597-1.333-1.333v-2.667c0-0.737-0.597-1.333-1.333-1.333s-1.333 0.596-1.333 1.333v2.667c0 2.205 1.795 4 4 4h13.333c2.205 0 4-1.795 4-4v-13.333c0-2.205-1.795-4-4-4zM21.333 17.333v-13.333c0-2.205-1.795-4-4-4h-13.333c-2.205 0-4 1.795-4 4v13.333c0 2.205 1.795 4 4 4h13.333c2.205 0 4-1.795 4-4zM2.667 17.333v-13.333c0-0.736 0.599-1.333 1.333-1.333h13.333c0.735 0 1.333 0.597 1.333 1.333v13.333c0 0.736-0.599 1.333-1.333 1.333h-13.333c-0.735 0-1.333-0.597-1.333-1.333z"></path>\n</svg>\n'}))):s.is_map&&s.latitude&&s.longitude?t("salla-map",{id:`location_map_${s.id}`,class:`map_${s.id}`,zoom:15,readonly:!0,lat:s.latitude,lng:s.longitude},t("div",{slot:"button"},t("button",{type:"button",class:"s-order-details-option-map-button",onClick:()=>this.openMap(s.id)},salla.lang.get("common.elements.show_location")))):t("span",{class:"s-order-details-option-default-text"},s.display_value||s.value)}copyToClipboard(s,t){s.preventDefault(),navigator.clipboard&&navigator.clipboard.writeText(t)}openMap(s){const t=document.querySelector(`salla-map.map_${s}`);t&&t.open&&t.open()}render(){if(!this.optionsData.length)return null;const s=this.bordered?"s-order-details-options-container":"s-order-details-options-container-borderless";return t(o,{class:"s-order-details-options-wrapper"},t("h2",{class:"s-order-details-options-title"},salla.lang.get("pages.cart.item_options")),t("div",{class:s},t("dl",{class:"s-order-details-options-list"},this.optionsData.map((s=>t("div",{key:s.id,class:"s-order-details-options-item"},t("dt",{class:"s-order-details-options-item-name"},s.name,":"),t("dd",{class:s.is_image?"s-order-details-options-item-value-image":"s-order-details-options-item-value-text"},this.renderOptionValue(s))))))))}};e.style="";export{e as salla_order_details_options}
4
+ import{r as s,h as t,H as o}from"./p-Z_0e-eaG.js";const e=class{constructor(t){s(this,t),this.bordered=!0,this.placeholderImage="images/placeholder.png",this.optionsData=[]}componentWillLoad(){this.parseOptionsData()}componentWillUpdate(){this.parseOptionsData()}parseOptionsData(){if(this.options)if("string"==typeof this.options)try{this.optionsData=JSON.parse(this.options)}catch(s){this.optionsData=[]}else this.optionsData=Array.isArray(this.options)?this.options:[];else this.optionsData=[]}renderOptionValue(s){return s.is_image?t("div",{class:"s-order-details-option-image-container"},t("a",{href:s.value,target:"_blank"},t("img",{class:"s-order-details-option-image",src:s.value||this.placeholderImage,alt:s.name}))):s.color?t("span",{title:s.value,class:"s-order-details-option-color-swatch",style:{backgroundColor:s.color}}):s.is_file?t("a",{href:s.value,target:"_blank",class:"s-order-details-option-file-link"},salla.lang.get("common.elements.attachments")):s.is_color_picker?t("div",{class:"s-order-details-option-color-picker"},t("div",{class:"s-order-details-option-color-picker-content"},t("span",{class:"s-order-details-option-color-picker-text"},s.value),t("span",{class:"s-order-details-option-color-picker-swatch",style:{backgroundColor:s.value,width:"1rem"}})),t("salla-button",{onClick:t=>this.copyToClipboard(t,s.value),shape:"link",class:"s-order-details-option-color-picker-button"},t("span",{class:"s-order-details-option-color-copy-icon",innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>swap-fill</title>\n<path d="M28 10.667h-2.667c-0.736 0-1.333 0.596-1.333 1.333s0.597 1.333 1.333 1.333h2.667c0.735 0 1.333 0.597 1.333 1.333v13.333c0 0.736-0.599 1.333-1.333 1.333h-13.333c-0.735 0-1.333-0.597-1.333-1.333v-2.667c0-0.737-0.597-1.333-1.333-1.333s-1.333 0.596-1.333 1.333v2.667c0 2.205 1.795 4 4 4h13.333c2.205 0 4-1.795 4-4v-13.333c0-2.205-1.795-4-4-4zM21.333 17.333v-13.333c0-2.205-1.795-4-4-4h-13.333c-2.205 0-4 1.795-4 4v13.333c0 2.205 1.795 4 4 4h13.333c2.205 0 4-1.795 4-4zM2.667 17.333v-13.333c0-0.736 0.599-1.333 1.333-1.333h13.333c0.735 0 1.333 0.597 1.333 1.333v13.333c0 0.736-0.599 1.333-1.333 1.333h-13.333c-0.735 0-1.333-0.597-1.333-1.333z"></path>\n</svg>\n'}))):s.is_map&&s.latitude&&s.longitude?t("salla-map",{id:`location_map_${s.id}`,class:`map_${s.id}`,zoom:15,readonly:!0,lat:s.latitude,lng:s.longitude},t("div",{slot:"button"},t("button",{type:"button",class:"s-order-details-option-map-button",onClick:()=>this.openMap(s.id)},salla.lang.get("common.elements.show_location")))):t("span",{class:"s-order-details-option-default-text"},s.display_value||s.value)}copyToClipboard(s,t){s.preventDefault(),navigator.clipboard&&navigator.clipboard.writeText(t)}openMap(s){const t=document.querySelector(`salla-map.map_${s}`);t&&t.open&&t.open()}render(){if(!this.optionsData.length)return null;const s=this.bordered?"s-order-details-options-container":"s-order-details-options-container-borderless";return t(o,{class:"s-order-details-options-wrapper"},t("h2",{class:"s-order-details-options-title"},salla.lang.get("pages.cart.item_options")),t("div",{class:s},t("dl",{class:"s-order-details-options-list"},this.optionsData.map((s=>t("div",{key:s.id,class:"s-order-details-options-item"},t("dt",{class:"s-order-details-options-item-name"},s.name,":"),t("dd",{class:s.is_image?"s-order-details-options-item-value-image":"s-order-details-options-item-value-text"},this.renderOptionValue(s))))))))}};e.style="";export{e as salla_order_details_options}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as a,H as l,a as r}from"./p-DSmjBlMI.js";const i=class{constructor(a){t(this,a),this.alertDelay=null,this.data=salla.config.get("store.app_install_prompt"),this.open=!1,this.closing=!1}connectedCallback(){salla.onReady((()=>{if(this.data=salla.config.get("store.app_install_prompt"),this.isMobileOrTabletDevice()){if(!this.data)return salla.logger.error("Failed to retrieve salla-app-install-alert config");this.ctaLink=salla.url.get("app"),this.alertDelay=setTimeout((()=>this.open=!0),3e3)}}))}disconnectedCallback(){clearTimeout(this.alertDelay)}isMobileOrTabletDevice(t=1024){if("undefined"==typeof window||"undefined"==typeof navigator||"undefined"==typeof document)return!1;const a=window.matchMedia(`(max-width: ${t}px)`).matches,l=/Macintosh|Android|iPhone|iPad|iPod/i.test(navigator.userAgent),r="ontouchstart"in window||"ontouchend"in document||navigator.maxTouchPoints>0;return l&&a&&r}closeAlert(){salla.storage.set("app_install_prompt_disabled",!0),this.closing=!0,this.host.addEventListener("animationend",(()=>{this.closing=!1,this.open=!1}),{once:!0})}shouldShowAlert(){return!salla.config.isMobileApp()}render(){return this.data&&this.shouldShowAlert()?a(l,{class:`s-app-install-alert-wrapper ${this.open?"open":""} ${this.closing?"closing":""}`,position:this.data.position},a("div",null,a("img",{src:this.data.icon,width:"58",height:"58",alt:`${salla.config.get("store.name")}`})),a("div",{class:"s-app-install-alert-content"},a("h2",{class:"s-app-install-alert-title"},this.data.title),a("p",{class:"s-app-install-alert-sub-title"},this.data.sub_title," "," ",a("a",{href:this.ctaLink,target:"_blank","aria-label":"download app",class:"s-app-install-alert-cta"},salla.lang.getWithDefault("blocks.footer.download_app_now","حمله الآن")))),a("button",{class:"s-app-install-alert-cancel-button","aria-label":"close alert",onClick:()=>this.closeAlert()},a("i",{class:"sicon-cancel"}))):null}get host(){return r(this)}};i.style='/*!twlt*/:host{display:block}.s-app-install-alert-wrapper{display:none;flex-direction:row;align-items:center;position:fixed;left:0;right:0;width:95%;margin-top:1rem;margin-bottom:1rem;margin-left:auto;margin-right:auto;z-index:999;border-radius:0.375rem;padding:0.75rem;gap:0.5rem;background-color:color-mix(in srgb, var(--color-primary) 15%, white);filter:drop-shadow(0 4px 3px rgba(0, 0, 0, 0.07)) drop-shadow(0 2px 2px rgba(0, 0, 0, 0.06))}.s-app-install-alert-wrapper.open[position=top]{display:flex;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes slideDownFromTop{0%{transform:translateY(-100%);opacity:0}100%{transform:translateY(-0%);opacity:1}}.s-app-install-alert-wrapper.open[position=top]{animation:slideDownFromTop .6s linear;transition-duration:500ms}.s-app-install-alert-wrapper:not(.open){display:none}.s-app-install-alert-content{width:100%}.s-app-install-alert-wrapper[position=top]{top:0px}.s-app-install-alert-wrapper.open[position=bottom]{display:flex}@keyframes slideUpFromBottom{0%{transform:translateY(100%);opacity:0}100%{transform:translateY(0%);opacity:1}}.s-app-install-alert-wrapper.open[position=bottom]{animation:slideUpFromBottom .6s linear}.s-app-install-alert-wrapper[position=bottom]{bottom:0px}@keyframes slideUPFromTop{0%{transform:translateY(-0%);opacity:1}100%{transform:translateY(-100%);opacity:0}}.s-app-install-alert-wrapper[position=top].closing{animation:slideUPFromTop .6s linear}@keyframes slideDownFromBottom{0%{transform:translateY(0%);opacity:1}100%{transform:translateY(100%);opacity:0}}.s-app-install-alert-wrapper[position=bottom].closing{animation:slideDownFromBottom .6s linear}.s-app-install-alert-wrapper.closing{animation-fill-mode:forwards}.s-app-install-alert-title{max-width:95%;font-size:1rem;line-height:1.5rem;font-weight:700;color:var(--color-primary)}.s-app-install-alert-sub-title{max-width:95%;font-size:0.875rem;line-height:1.25rem;font-weight:400}.s-app-install-alert-cta{color:var(--color-primary);text-decoration-line:underline}.s-app-install-alert-cancel-button{position:absolute;top:0.5rem}.s-app-install-alert-cancel-button:where([dir="ltr"],[dir="ltr"] *){right:0.75rem}.s-app-install-alert-cancel-button:where([dir="rtl"],[dir="rtl"] *){left:0.75rem}';export{i as salla_app_install_alert}
4
+ import{r as t,h as a,H as l,a as r}from"./p-Z_0e-eaG.js";const i=class{constructor(a){t(this,a),this.alertDelay=null,this.data=salla.config.get("store.app_install_prompt"),this.open=!1,this.closing=!1}connectedCallback(){salla.onReady((()=>{if(this.data=salla.config.get("store.app_install_prompt"),this.isMobileOrTabletDevice()){if(!this.data)return salla.logger.error("Failed to retrieve salla-app-install-alert config");this.ctaLink=salla.url.get("app"),this.alertDelay=setTimeout((()=>this.open=!0),3e3)}}))}disconnectedCallback(){clearTimeout(this.alertDelay)}isMobileOrTabletDevice(t=1024){if("undefined"==typeof window||"undefined"==typeof navigator||"undefined"==typeof document)return!1;const a=window.matchMedia(`(max-width: ${t}px)`).matches,l=/Macintosh|Android|iPhone|iPad|iPod/i.test(navigator.userAgent),r="ontouchstart"in window||"ontouchend"in document||navigator.maxTouchPoints>0;return l&&a&&r}closeAlert(){salla.storage.set("app_install_prompt_disabled",!0),this.closing=!0,this.host.addEventListener("animationend",(()=>{this.closing=!1,this.open=!1}),{once:!0})}shouldShowAlert(){return!salla.config.isMobileApp()}render(){return this.data&&this.shouldShowAlert()?a(l,{class:`s-app-install-alert-wrapper ${this.open?"open":""} ${this.closing?"closing":""}`,position:this.data.position},a("div",null,a("img",{src:this.data.icon,width:"58",height:"58",alt:`${salla.config.get("store.name")}`})),a("div",{class:"s-app-install-alert-content"},a("h2",{class:"s-app-install-alert-title"},this.data.title),a("p",{class:"s-app-install-alert-sub-title"},this.data.sub_title," "," ",a("a",{href:this.ctaLink,target:"_blank","aria-label":"download app",class:"s-app-install-alert-cta"},salla.lang.getWithDefault("blocks.footer.download_app_now","حمله الآن")))),a("button",{class:"s-app-install-alert-cancel-button","aria-label":"close alert",onClick:()=>this.closeAlert()},a("i",{class:"sicon-cancel"}))):null}get host(){return r(this)}};i.style='/*!twlt*/:host{display:block}.s-app-install-alert-wrapper{display:none;flex-direction:row;align-items:center;position:fixed;left:0;right:0;width:95%;margin-top:1rem;margin-bottom:1rem;margin-left:auto;margin-right:auto;z-index:999;border-radius:0.375rem;padding:0.75rem;gap:0.5rem;background-color:color-mix(in srgb, var(--color-primary) 15%, white);filter:drop-shadow(0 4px 3px rgba(0, 0, 0, 0.07)) drop-shadow(0 2px 2px rgba(0, 0, 0, 0.06))}.s-app-install-alert-wrapper.open[position=top]{display:flex;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes slideDownFromTop{0%{transform:translateY(-100%);opacity:0}100%{transform:translateY(-0%);opacity:1}}.s-app-install-alert-wrapper.open[position=top]{animation:slideDownFromTop .6s linear;transition-duration:500ms}.s-app-install-alert-wrapper:not(.open){display:none}.s-app-install-alert-content{width:100%}.s-app-install-alert-wrapper[position=top]{top:0px}.s-app-install-alert-wrapper.open[position=bottom]{display:flex}@keyframes slideUpFromBottom{0%{transform:translateY(100%);opacity:0}100%{transform:translateY(0%);opacity:1}}.s-app-install-alert-wrapper.open[position=bottom]{animation:slideUpFromBottom .6s linear}.s-app-install-alert-wrapper[position=bottom]{bottom:0px}@keyframes slideUPFromTop{0%{transform:translateY(-0%);opacity:1}100%{transform:translateY(-100%);opacity:0}}.s-app-install-alert-wrapper[position=top].closing{animation:slideUPFromTop .6s linear}@keyframes slideDownFromBottom{0%{transform:translateY(0%);opacity:1}100%{transform:translateY(100%);opacity:0}}.s-app-install-alert-wrapper[position=bottom].closing{animation:slideDownFromBottom .6s linear}.s-app-install-alert-wrapper.closing{animation-fill-mode:forwards}.s-app-install-alert-title{max-width:95%;font-size:1rem;line-height:1.5rem;font-weight:700;color:var(--color-primary)}.s-app-install-alert-sub-title{max-width:95%;font-size:0.875rem;line-height:1.25rem;font-weight:400}.s-app-install-alert-cta{color:var(--color-primary);text-decoration-line:underline}.s-app-install-alert-cancel-button{position:absolute;top:0.5rem}.s-app-install-alert-cancel-button:where([dir="ltr"],[dir="ltr"] *){right:0.75rem}.s-app-install-alert-cancel-button:where([dir="rtl"],[dir="rtl"] *){left:0.75rem}';export{i as salla_app_install_alert}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as i,H as e}from"./p-DSmjBlMI.js";import{f as s,g as l}from"./p-DqXpn47Z.js";const a=class{constructor(i){t(this,i),this.productRatings=[],this.allowUpdate=!1}async componentWillLoad(){await salla.onReady(),await this.loadOrderItem()}async onProductIdChange(){this.orderItem=void 0,this.productRatings=[],await this.loadOrderItem()}resolveFetchOrderId(){return salla.config.get("page.id")}sameId(t,i){return null!=t&&null!=i&&String(t)===String(i)}label(t,i){return"function"==typeof salla?.lang?.getWithDefault?salla.lang.getWithDefault(t,i):salla?.lang?.get?.(t)||i}toOrderItemRating(t){return{id:t.id??t.feedback_id,stars:t.stars??t.rating,content:t.content||"",is_pending:t.is_pending,can_update:t.can_update,images:t.images||[],videos:t.videos||[],product:t.product}}resolveOrderItem(t,i){const e=Array.isArray(t?.items)?t.items:[],s=i.find((t=>this.sameId(t.product?.id,this.productId)));if(!s)return;const l=e.find((t=>this.sameId(t.product?.id,this.productId)))||{product:s.product||{id:this.productId}};return{...l,product:l.product||s.product||{id:this.productId},rating:this.toOrderItemRating(s)}}async loadOrderItem(){const t=this.resolveFetchOrderId();if(t&&null!=this.productId&&""!==this.productId){this.fetchOrderId=t,this.allowUpdate=!!salla.config.get("store.settings.rating.allow_update");try{const i=await s(t);this.productRatings=l(i?.rating),this.orderItem=this.resolveOrderItem(i,this.productRatings)}catch(t){console.error("[salla-review-order-item] failed to load order item review",t)}}}renderActions(t){const e=t.rating;return e&&this.allowUpdate?i("div",{class:"rating-actions"},i("div",{class:"tooltip-toggle tooltip-toggle--hover icon-trigger mobile-shifted"},e.can_update?null:i("div",{class:"tooltip-content shadow-md rounded"},i("small",null,this.label("pages.order.edit_period_ended","انتهت مدة التعديل"),".")),i("salla-button",{"loader-position":"center",disabled:!e.can_update,shape:"icon",fill:"outline",color:"dark",size:"medium",onClick:()=>e.can_update?salla.event.dispatch("rating::edit",{type:"product",feedback_id:e.id}):void 0},i("i",{class:"sicon-format-border-color text-xl"}))),i("div",{class:"tooltip-toggle tooltip-toggle--hover icon-trigger mobile-shifted"},e.can_update?null:i("div",{class:"tooltip-content shadow-md rounded"},i("small",null,this.label("pages.order.delete_period_ended","انتهت مدة الحذف"),".")),i("salla-button",{"loader-position":"center",disabled:!e.can_update,shape:"icon",color:"danger",fill:"outline",size:"medium",onClick:()=>e.can_update?salla.event.dispatch("rating::delete",{feedback_id:e.id}):void 0},i("i",{class:"sicon-trash-2 text-xl"})))):null}serializeRatingMedia(t){return JSON.stringify({images:t.images||[],videos:t.videos||[],product:t.product})}serializeProductRatings(){return JSON.stringify(this.productRatings)}render(){const t=this.orderItem,s=t?.rating;return t&&s&&this.fetchOrderId?i(e,null,i("section",{class:"flex justify-between items-start border-t mt-10 pt-8"},i("div",null,i("p",{innerHTML:s.content||""}),s.is_pending?i("span",null,this.label("pages.rating.pending","قيد المراجعة")):null,i("div",{class:"flex flex-row flex-wrap gap-2"},i("salla-rating-stars",{size:"large",value:s.stars}),i("salla-review-factors-tags",{"order-id":this.fetchOrderId,"rating-id":s.id,"product-id":t.product?.id})),i("div",{class:"mt-2"},i("salla-attachments",{rating:this.serializeRatingMedia(s),"product-ratings":this.serializeProductRatings(),"product-id":t.product?.id??null,"max-visible":8,clickable:!0}))),this.renderActions(t))):i(e,null)}static get watchers(){return{productId:["onProductIdChange"]}}};export{a as salla_review_order_item}
4
+ import{r as t,h as i,H as e}from"./p-Z_0e-eaG.js";import{f as s,g as a}from"./p-DqXpn47Z.js";const l=class{constructor(i){t(this,i),this.productRatings=[],this.allowUpdate=!1}async componentWillLoad(){await salla.onReady(),await this.loadOrderItem()}async onProductIdChange(){this.orderItem=void 0,this.productRatings=[],await this.loadOrderItem()}resolveFetchOrderId(){return salla.config.get("page.id")}sameId(t,i){return null!=t&&null!=i&&String(t)===String(i)}label(t,i){return"function"==typeof salla?.lang?.getWithDefault?salla.lang.getWithDefault(t,i):salla?.lang?.get?.(t)||i}toOrderItemRating(t){return{id:t.id??t.feedback_id,stars:t.stars??t.rating,content:t.content||"",is_pending:t.is_pending,can_update:t.can_update,images:t.images||[],videos:t.videos||[],product:t.product}}resolveOrderItem(t,i){const e=Array.isArray(t?.items)?t.items:[],s=i.find((t=>this.sameId(t.product?.id,this.productId)));if(!s)return;const a=e.find((t=>this.sameId(t.product?.id,this.productId)))||{product:s.product||{id:this.productId}};return{...a,product:a.product||s.product||{id:this.productId},rating:this.toOrderItemRating(s)}}async loadOrderItem(){const t=this.resolveFetchOrderId();if(t&&null!=this.productId&&""!==this.productId){this.fetchOrderId=t,this.allowUpdate=!!salla.config.get("store.settings.rating.allow_update");try{const i=await s(t);this.productRatings=a(i?.rating),this.orderItem=this.resolveOrderItem(i,this.productRatings)}catch(t){console.error("[salla-review-order-item] failed to load order item review",t)}}}renderActions(t){const e=t.rating;return e&&this.allowUpdate?i("div",{class:"rating-actions"},i("div",{class:"tooltip-toggle tooltip-toggle--hover icon-trigger mobile-shifted"},e.can_update?null:i("div",{class:"tooltip-content shadow-md rounded"},i("small",null,this.label("pages.order.edit_period_ended","انتهت مدة التعديل"),".")),i("salla-button",{"loader-position":"center",disabled:!e.can_update,shape:"icon",fill:"outline",color:"dark",size:"medium",onClick:()=>e.can_update?salla.event.dispatch("rating::edit",{type:"product",feedback_id:e.id}):void 0},i("i",{class:"sicon-format-border-color text-xl"}))),i("div",{class:"tooltip-toggle tooltip-toggle--hover icon-trigger mobile-shifted"},e.can_update?null:i("div",{class:"tooltip-content shadow-md rounded"},i("small",null,this.label("pages.order.delete_period_ended","انتهت مدة الحذف"),".")),i("salla-button",{"loader-position":"center",disabled:!e.can_update,shape:"icon",color:"danger",fill:"outline",size:"medium",onClick:()=>e.can_update?salla.event.dispatch("rating::delete",{feedback_id:e.id}):void 0},i("i",{class:"sicon-trash-2 text-xl"})))):null}serializeRatingMedia(t){return JSON.stringify({images:t.images||[],videos:t.videos||[],product:t.product})}serializeProductRatings(){return JSON.stringify(this.productRatings)}render(){const t=this.orderItem,s=t?.rating;return t&&s&&this.fetchOrderId?i(e,null,i("section",{class:"flex justify-between items-start border-t mt-10 pt-8"},i("div",null,i("p",{innerHTML:s.content||""}),s.is_pending?i("span",null,this.label("pages.rating.pending","قيد المراجعة")):null,i("div",{class:"flex flex-row flex-wrap gap-2"},i("salla-rating-stars",{size:"large",value:s.stars}),i("salla-review-factors-tags",{"order-id":this.fetchOrderId,"rating-id":s.id,"product-id":t.product?.id})),i("div",{class:"mt-2"},i("salla-attachments",{rating:this.serializeRatingMedia(s),"product-ratings":this.serializeProductRatings(),"product-id":t.product?.id??null,"max-visible":8,clickable:!0}))),this.renderActions(t))):i(e,null)}static get watchers(){return{productId:["onProductIdChange"]}}};export{l as salla_review_order_item}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as s,H as i,a as e}from"./p-DSmjBlMI.js";const a=class{constructor(s){t(this,s),this.menuOpen=!1,this.hasProducts=!1,this.specificMode=!1,this.selectedIds=[],this.loadedProductCount=0,this.isSharing=!1,this.shareUrl="",this.isListSyncPaused=!1,this.translationDefaults={"pages.wishlist.share":{ar:"شارك",en:"Share"},"pages.wishlist.share_all":{ar:"مشاركة القائمة",en:"Share the list"},"pages.wishlist.share_specific":{ar:"مشاركة منتجات محددة",en:"Share specific items"},"pages.wishlist.share_list_title":{ar:"مشاركة قائمة الأمنيات",en:"Share wishlist"},"pages.wishlist.select_all":{ar:"تحديد الكل",en:"Select all"},"common.elements.cancel":{ar:"إلغاء",en:"Cancel"}},this.onSelectionChanged=t=>{this.selectedIds=t?.ids||[],this.shareUrl="",this.socialShare?.close(),this.syncLoadedProductCount()},this.onDocumentClick=t=>{this.menuOpen&&!this.host.contains(t.target)&&(this.menuOpen=!1)},this.onProductsFetched=t=>{"wishlist"===t?.source&&(this.isListSyncPaused=!1,this.syncHasProducts(!!t?.data?.length),this.syncLoadedProductCount())}}async componentWillLoad(){await Salla.onReady(),await Salla.lang.onLoaded(),this.registerTranslationDefaults(),this.loadTranslations(),Salla.event.on("salla-products-list::selection.changed",this.onSelectionChanged),Salla.event.on("salla-products-list::products.fetched",this.onProductsFetched),document.addEventListener("click",this.onDocumentClick)}componentDidLoad(){this.initPageTitleAlignment(),this.productsList=this.host.parentElement?.querySelector("salla-products-list"),this.productsList?(this.syncHasProducts(),this.productsObserver=new MutationObserver((()=>{this.syncHasProducts()})),this.productsObserver.observe(this.productsList,{childList:!0,subtree:!0})):Salla.logger?.warn?.("[salla-wishlist-actions] no sibling salla-products-list found")}disconnectedCallback(){Salla.event.off("salla-products-list::selection.changed",this.onSelectionChanged),Salla.event.off("salla-products-list::products.fetched",this.onProductsFetched),document.removeEventListener("click",this.onDocumentClick),this.productsObserver?.disconnect(),this.pageTitleObserver?.disconnect(),this.pageTitleRetryTimeout&&window.clearTimeout(this.pageTitleRetryTimeout),this.resetPageTitleAlignment()}initPageTitleAlignment(){if(this.syncPageTitleAlignment(),this.pageTitle)return;requestAnimationFrame((()=>this.syncPageTitleAlignment())),this.pageTitleRetryTimeout=window.setTimeout((()=>this.syncPageTitleAlignment()),300);const t=this.host.closest(".main-content")??this.host.parentElement;t&&!this.pageTitle&&(this.pageTitleObserver=new MutationObserver((()=>{this.pageTitle?this.pageTitleObserver?.disconnect():(this.syncPageTitleAlignment(),this.pageTitle&&this.pageTitleObserver?.disconnect())})),this.pageTitleObserver.observe(t,{childList:!0,subtree:!0}))}findPageTitle(){const t=this.host.parentElement;if(t)for(const s of Array.from(t.children)){if(s===this.host)break;if("H1"===s.tagName)return s;const t=s.querySelector("h1");if(t)return t}const s=this.host.closest(".main-content");if(s){const t=s.querySelector("h1");if(t&&!this.host.contains(t))return t}return document.querySelector(".main-content h1, main h1")}syncPageTitleAlignment(){if(this.pageTitle)return;const t=this.findPageTitle();t&&(this.pageTitle=t,t.classList.add(a.pageTitleClass))}resetPageTitleAlignment(){this.pageTitle?.classList.remove(a.pageTitleClass),this.pageTitle=void 0}registerTranslationDefaults(){const t=Object.entries(this.translationDefaults).reduce(((t,[s,i])=>(Salla.lang.get(s)===s&&(t[s]=i),t)),{});Object.keys(t).length&&Salla.lang.addBulk(t)}loadTranslations(){this.shareLabel=Salla.lang.get("pages.wishlist.share"),this.shareAllLabel=Salla.lang.get("pages.wishlist.share_all"),this.shareSpecificLabel=Salla.lang.get("pages.wishlist.share_specific"),this.selectAllLabel=Salla.lang.get("pages.wishlist.select_all"),this.cancelLabel=Salla.lang.get("common.elements.cancel"),this.shareModalTitle=Salla.lang.get("pages.wishlist.share_list_title")}get selectedCount(){return this.selectedIds.length}get isAllSelected(){return this.loadedProductCount>0&&this.selectedCount===this.loadedProductCount}get isPartiallySelected(){return this.selectedCount>0&&this.selectedCount<this.loadedProductCount}async syncLoadedProductCount(){if(!this.productsList)return void(this.loadedProductCount=0);if(this.isListSyncPaused&&this.specificMode)return;const t=await this.productsList.getLoadedProducts();this.loadedProductCount=t.length}syncSelectAllCheckboxState(){this.selectAllCheckbox&&(this.selectAllCheckbox.checked=this.isAllSelected,this.selectAllCheckbox.indeterminate=this.isPartiallySelected)}componentDidRender(){this.syncSelectAllCheckboxState()}pauseListSync(){this.isListSyncPaused=!0,window.setTimeout((()=>{this.isListSyncPaused&&(this.isListSyncPaused=!1,this.syncHasProducts())}),3e3)}async syncHasProducts(t){if(!this.isListSyncPaused||"boolean"==typeof t){if("boolean"==typeof t)this.hasProducts=t;else if(this.productsList){const t=await this.productsList.getLoadedProducts();if(0===t.length&&this.specificMode)return;this.hasProducts=t.length>0,this.loadedProductCount=t.length}else this.hasProducts=!1,this.loadedProductCount=0;this.hasProducts||(this.menuOpen=!1,this.specificMode&&await this.cancelSpecific())}}toggleMenu(){this.hasProducts&&(this.menuOpen=!this.menuOpen)}async toggleSelectAll(){this.productsList&&(this.isAllSelected?await this.productsList.clearSelection():await this.productsList.selectAll())}async shareSpecific(){this.menuOpen=!1,this.specificMode=!0,this.pauseListSync(),this.productsList&&(this.productsList.selectable=!0)}async cancelSpecific(){this.specificMode=!1,this.selectedIds=[],this.pauseListSync(),this.productsList&&(await this.productsList.clearSelection(),this.productsList.selectable=!1)}async shareAll(){this.menuOpen=!1,await this.processShare([],!0)}async shareSelected(){this.selectedCount&&await this.processShare(this.selectedIds,!1)}async processShare(t,s=!1){if((s||t?.length)&&!this.isSharing){this.isSharing=!0;try{const i=await salla.wishlist.share(t,s),e=i?.data?.url||i?.url||"";if(!e||!this.socialShare)return;this.shareUrl=e,this.socialShare.url=e,await this.socialShare.refresh(),await this.socialShare.open()}catch(t){Salla.logger?.warn?.("[salla-wishlist-actions] share failed",t)}finally{this.isSharing=!1}}}render(){return s(i,{key:"555b93b058b7d1e02d850b4d6ab318be5cb6b69f"},s("div",{key:"b9110b59c759b08113ad876c21210f84ff1634cf",class:"s-wishlist-actions"},s("div",{key:"7017fcaa2c202322476bb57a92aa0f67990b2366",class:"s-wishlist-actions-bar flex items-center justify-end gap-3 mb-3"},s("div",{key:"2f2074ac227e33de8880339c64b8ac4db9936c33",class:"s-wishlist-actions-dropdown relative"},s("salla-button",{key:"65197f13ea06c1f6ef41c5b229005160f1ce6fb6",color:"primary",fill:"outline",type:"button",disabled:!this.hasProducts,"aria-haspopup":"true","aria-expanded":this.menuOpen?"true":"false",onClick:()=>this.toggleMenu()},s("div",{key:"dc98a952df9bd96f98aa755529332929609f6238",class:"flex flex-row justify-center items-center gap-2"},s("svg",{key:"165a00da1a16ebda3ca67a312e2e818e90e50b59",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 32 32",style:{width:"16px",height:"16px"}},s("path",{key:"b8d5e91620b46af1e583e1c729a62fc575ac6f79",d:"M26.667 21.333c-1.699 0-3.196 0.812-4.173 2.052l-11.912-5.211c0.044-0.276 0.085-0.553 0.085-0.841 0-0.472-0.081-0.923-0.197-1.359l12.361-6.952c0.971 1.009 2.328 1.644 3.836 1.644 2.941 0 5.333-2.392 5.333-5.333s-2.392-5.333-5.333-5.333-5.333 2.392-5.333 5.333c0 0.472 0.081 0.923 0.197 1.359l-12.361 6.952c-0.971-1.009-2.328-1.644-3.836-1.644-2.941 0-5.333 2.392-5.333 5.333s2.392 5.333 5.333 5.333c1.699 0 3.196-0.812 4.173-2.052l11.912 5.211c-0.044 0.276-0.085 0.553-0.085 0.841 0 2.941 2.392 5.333 5.333 5.333s5.333-2.392 5.333-5.333-2.392-5.333-5.333-5.333zM26.667 2.667c1.471 0 2.667 1.196 2.667 2.667s-1.196 2.667-2.667 2.667-2.667-1.196-2.667-2.667 1.196-2.667 2.667-2.667zM5.333 20c-1.471 0-2.667-1.196-2.667-2.667s1.196-2.667 2.667-2.667 2.667 1.196 2.667 2.667-1.196 2.667-2.667 2.667zM26.667 29.333c-1.471 0-2.667-1.196-2.667-2.667s1.196-2.667 2.667-2.667 2.667 1.196 2.667 2.667-1.196 2.667-2.667 2.667z"})),this.shareLabel,s("svg",{key:"804d7e2251bec8e7e224aff212c56038b6e578a4",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 32 32",style:{width:"16px",height:"16px"}},s("path",{key:"a72392c9ed7ed88a6bddb52ad521ea299b3521db",d:"M26.212 10.996c-0.556-0.484-1.396-0.428-1.881 0.127l-8.331 9.519-8.331-9.52c-0.485-0.555-1.327-0.611-1.881-0.125s-0.609 1.328-0.124 1.881l9.333 10.667c0.253 0.291 0.617 0.456 1.003 0.456s0.749-0.165 1.003-0.456l9.333-10.667c0.485-0.553 0.429-1.396-0.124-1.881z"})))),this.menuOpen&&s("ul",{key:"f92af33b6f93b242bb5e31ca7493cbe98da954bf",class:"s-wishlist-actions-menu absolute z-20 mt-1 bg-white rounded-lg shadow overflow-hidden"},s("li",{key:"1a890bceb2b1f818714aa8588f3cbac8dcd58bb1"},s("button",{key:"dea5ebfbbb21a915218495ba4c753058daa8673e",type:"button",class:"s-wishlist-actions-menu-item",onClick:()=>this.shareAll()},this.shareAllLabel)),s("li",{key:"bef2909444be2d83245e684c24647939d6efb0a6"},s("button",{key:"f3acc3228c9056c4a65df2c7461444a2cf5105bc",type:"button",class:"s-wishlist-actions-menu-item",onClick:()=>this.shareSpecific()},this.shareSpecificLabel)))),s("salla-social-share",{key:"aef87f10208a46d1bbe5cb09c4ed23175d0c8e05",class:"s-wishlist-actions-social",ref:t=>this.socialShare=t,url:this.shareUrl,mode:"modal",modalTitle:this.shareModalTitle},s("span",{key:"bc89fba2ab1178515ddd557dda51bf1bcb41a1e8",slot:"widget",class:"s-wishlist-actions-social-anchor","aria-hidden":"true"}))),this.specificMode&&s("div",{key:"a46e2c665a46fe2d9fc7bc1084223d24cdfe9706",class:"s-wishlist-actions-panel flex items-center justify-between gap-4 flex-wrap p-4 mt-3 mb-3 bg-white rounded-lg"},s("label",{key:"28eada8514684c55699bb22f390f48d129c9d1c6",class:"s-wishlist-actions-panel-select-all flex items-center gap-2 cursor-pointer"},s("input",{key:"9db31a9fcec824cfde62545fa402c5a7a97c6f81",type:"checkbox",class:"s-products-list-select-checkbox s-wishlist-actions-select-all",checked:this.isAllSelected,ref:t=>this.selectAllCheckbox=t,"aria-label":this.selectAllLabel,onChange:()=>this.toggleSelectAll()}),s("span",{key:"38b2e97d3185cf1483d49c26ff9b2746b4b08aaa",class:"s-wishlist-actions-panel-title text-sm font-bold text-gray-700"},this.shareSpecificLabel," (",this.selectedCount,")")),s("div",{key:"3f4d117cf6745fd3490c1196c1ae6f42e3185ae6",class:"s-wishlist-actions-panel-buttons flex items-center gap-2"},s("salla-button",{key:"daf79a258a9bca9eda2a1f103daec21e8cbb0609",class:"s-wishlist-actions-cancel",color:"light",fill:"outline",type:"button",onClick:()=>this.cancelSpecific()},this.cancelLabel),s("salla-button",{key:"34ee6ad51826802310a4f8a055211914da55747c",class:"s-wishlist-actions-share",color:"primary",fill:"outline",type:"button",disabled:!this.selectedCount,loading:this.isSharing,onClick:()=>this.shareSelected()},this.shareLabel)))))}get host(){return e(this)}};a.pageTitleClass="s-wishlist-actions-page-title",a.style='/*!twlt*/:host{display:block}.s-wishlist-actions-menu{min-width:200px;inset-inline-end:0;inset-inline-start:auto;list-style:none;margin:0;padding:4px 0;box-shadow:0 4px 16px rgba(0, 0, 0, 0.12)}.s-wishlist-actions-menu-item{display:block;width:100%;padding:10px 16px;text-align:start;font-size:0.875rem;color:#374151;background:transparent;cursor:pointer;white-space:nowrap}.s-wishlist-actions-menu-item:hover{background-color:#f3f4f6;color:var(--color-primary)}.s-wishlist-actions-panel{box-shadow:0 1px 3px rgba(0, 0, 0, 0.08)}.s-wishlist-actions-panel-select-all{user-select:none}.s-wishlist-actions-select-all:indeterminate,.s-wishlist-actions-select-all:indeterminate:hover,.s-wishlist-actions-select-all:indeterminate:focus{background-color:var(--color-primary);border-color:var(--color-primary)}.s-wishlist-actions-select-all:indeterminate::after{content:"";position:absolute;top:50%;left:50%;width:10px;height:2px;background:#fff;border:none;transform:translate(-50%, -50%)}.s-wishlist-actions-social-anchor{display:none}h1.s-wishlist-actions-page-title{text-align:start !important}.static{position:static}.absolute{position:absolute}.relative{position:relative}.z-20{z-index:20}.mb-3{margin-bottom:0.75rem}.mt-1{margin-top:0.25rem}.mt-3{margin-top:0.75rem}.flex{display:flex}.cursor-pointer{cursor:pointer}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-2{gap:0.5rem}.gap-3{gap:0.75rem}.gap-4{gap:1rem}.overflow-hidden{overflow:hidden}.rounded-lg{border-radius:0.5rem}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.p-4{padding:1rem}.text-sm{font-size:0.875rem;line-height:1.25rem}.font-bold{font-weight:700}.text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.outline{outline-style:solid}';export{a as salla_wishlist_actions}
4
+ import{r as t,h as s,H as i,a as e}from"./p-Z_0e-eaG.js";const a=class{constructor(s){t(this,s),this.menuOpen=!1,this.hasProducts=!1,this.specificMode=!1,this.selectedIds=[],this.loadedProductCount=0,this.isSharing=!1,this.shareUrl="",this.isListSyncPaused=!1,this.translationDefaults={"pages.wishlist.share":{ar:"شارك",en:"Share"},"pages.wishlist.share_all":{ar:"مشاركة القائمة",en:"Share the list"},"pages.wishlist.share_specific":{ar:"مشاركة منتجات محددة",en:"Share specific items"},"pages.wishlist.share_list_title":{ar:"مشاركة قائمة الأمنيات",en:"Share wishlist"},"pages.wishlist.select_all":{ar:"تحديد الكل",en:"Select all"},"common.elements.cancel":{ar:"إلغاء",en:"Cancel"}},this.onSelectionChanged=t=>{this.selectedIds=t?.ids||[],this.shareUrl="",this.socialShare?.close(),this.syncLoadedProductCount()},this.onDocumentClick=t=>{this.menuOpen&&!this.host.contains(t.target)&&(this.menuOpen=!1)},this.onProductsFetched=t=>{"wishlist"===t?.source&&(this.isListSyncPaused=!1,this.syncHasProducts(!!t?.data?.length),this.syncLoadedProductCount())}}async componentWillLoad(){await Salla.onReady(),await Salla.lang.onLoaded(),this.registerTranslationDefaults(),this.loadTranslations(),Salla.event.on("salla-products-list::selection.changed",this.onSelectionChanged),Salla.event.on("salla-products-list::products.fetched",this.onProductsFetched),document.addEventListener("click",this.onDocumentClick)}componentDidLoad(){this.initPageTitleAlignment(),this.productsList=this.host.parentElement?.querySelector("salla-products-list"),this.productsList?(this.syncHasProducts(),this.productsObserver=new MutationObserver((()=>{this.syncHasProducts()})),this.productsObserver.observe(this.productsList,{childList:!0,subtree:!0})):Salla.logger?.warn?.("[salla-wishlist-actions] no sibling salla-products-list found")}disconnectedCallback(){Salla.event.off("salla-products-list::selection.changed",this.onSelectionChanged),Salla.event.off("salla-products-list::products.fetched",this.onProductsFetched),document.removeEventListener("click",this.onDocumentClick),this.productsObserver?.disconnect(),this.pageTitleObserver?.disconnect(),this.pageTitleRetryTimeout&&window.clearTimeout(this.pageTitleRetryTimeout),this.resetPageTitleAlignment()}initPageTitleAlignment(){if(this.syncPageTitleAlignment(),this.pageTitle)return;requestAnimationFrame((()=>this.syncPageTitleAlignment())),this.pageTitleRetryTimeout=window.setTimeout((()=>this.syncPageTitleAlignment()),300);const t=this.host.closest(".main-content")??this.host.parentElement;t&&!this.pageTitle&&(this.pageTitleObserver=new MutationObserver((()=>{this.pageTitle?this.pageTitleObserver?.disconnect():(this.syncPageTitleAlignment(),this.pageTitle&&this.pageTitleObserver?.disconnect())})),this.pageTitleObserver.observe(t,{childList:!0,subtree:!0}))}findPageTitle(){const t=this.host.parentElement;if(t)for(const s of Array.from(t.children)){if(s===this.host)break;if("H1"===s.tagName)return s;const t=s.querySelector("h1");if(t)return t}const s=this.host.closest(".main-content");if(s){const t=s.querySelector("h1");if(t&&!this.host.contains(t))return t}return document.querySelector(".main-content h1, main h1")}syncPageTitleAlignment(){if(this.pageTitle)return;const t=this.findPageTitle();t&&(this.pageTitle=t,t.classList.add(a.pageTitleClass))}resetPageTitleAlignment(){this.pageTitle?.classList.remove(a.pageTitleClass),this.pageTitle=void 0}registerTranslationDefaults(){const t=Object.entries(this.translationDefaults).reduce(((t,[s,i])=>(Salla.lang.get(s)===s&&(t[s]=i),t)),{});Object.keys(t).length&&Salla.lang.addBulk(t)}loadTranslations(){this.shareLabel=Salla.lang.get("pages.wishlist.share"),this.shareAllLabel=Salla.lang.get("pages.wishlist.share_all"),this.shareSpecificLabel=Salla.lang.get("pages.wishlist.share_specific"),this.selectAllLabel=Salla.lang.get("pages.wishlist.select_all"),this.cancelLabel=Salla.lang.get("common.elements.cancel"),this.shareModalTitle=Salla.lang.get("pages.wishlist.share_list_title")}get selectedCount(){return this.selectedIds.length}get isAllSelected(){return this.loadedProductCount>0&&this.selectedCount===this.loadedProductCount}get isPartiallySelected(){return this.selectedCount>0&&this.selectedCount<this.loadedProductCount}async syncLoadedProductCount(){if(!this.productsList)return void(this.loadedProductCount=0);if(this.isListSyncPaused&&this.specificMode)return;const t=await this.productsList.getLoadedProducts();this.loadedProductCount=t.length}syncSelectAllCheckboxState(){this.selectAllCheckbox&&(this.selectAllCheckbox.checked=this.isAllSelected,this.selectAllCheckbox.indeterminate=this.isPartiallySelected)}componentDidRender(){this.syncSelectAllCheckboxState()}pauseListSync(){this.isListSyncPaused=!0,window.setTimeout((()=>{this.isListSyncPaused&&(this.isListSyncPaused=!1,this.syncHasProducts())}),3e3)}async syncHasProducts(t){if(!this.isListSyncPaused||"boolean"==typeof t){if("boolean"==typeof t)this.hasProducts=t;else if(this.productsList){const t=await this.productsList.getLoadedProducts();if(0===t.length&&this.specificMode)return;this.hasProducts=t.length>0,this.loadedProductCount=t.length}else this.hasProducts=!1,this.loadedProductCount=0;this.hasProducts||(this.menuOpen=!1,this.specificMode&&await this.cancelSpecific())}}toggleMenu(){this.hasProducts&&(this.menuOpen=!this.menuOpen)}async toggleSelectAll(){this.productsList&&(this.isAllSelected?await this.productsList.clearSelection():await this.productsList.selectAll())}async shareSpecific(){this.menuOpen=!1,this.specificMode=!0,this.pauseListSync(),this.productsList&&(this.productsList.selectable=!0)}async cancelSpecific(){this.specificMode=!1,this.selectedIds=[],this.pauseListSync(),this.productsList&&(await this.productsList.clearSelection(),this.productsList.selectable=!1)}async shareAll(){this.menuOpen=!1,await this.processShare([],!0)}async shareSelected(){this.selectedCount&&await this.processShare(this.selectedIds,!1)}async processShare(t,s=!1){if((s||t?.length)&&!this.isSharing){this.isSharing=!0;try{const i=await salla.wishlist.share(t,s),e=i?.data?.url||i?.url||"";if(!e||!this.socialShare)return;this.shareUrl=e,this.socialShare.url=e,await this.socialShare.refresh(),await this.socialShare.open()}catch(t){Salla.logger?.warn?.("[salla-wishlist-actions] share failed",t)}finally{this.isSharing=!1}}}render(){return s(i,{key:"555b93b058b7d1e02d850b4d6ab318be5cb6b69f"},s("div",{key:"b9110b59c759b08113ad876c21210f84ff1634cf",class:"s-wishlist-actions"},s("div",{key:"7017fcaa2c202322476bb57a92aa0f67990b2366",class:"s-wishlist-actions-bar flex items-center justify-end gap-3 mb-3"},s("div",{key:"2f2074ac227e33de8880339c64b8ac4db9936c33",class:"s-wishlist-actions-dropdown relative"},s("salla-button",{key:"65197f13ea06c1f6ef41c5b229005160f1ce6fb6",color:"primary",fill:"outline",type:"button",disabled:!this.hasProducts,"aria-haspopup":"true","aria-expanded":this.menuOpen?"true":"false",onClick:()=>this.toggleMenu()},s("div",{key:"dc98a952df9bd96f98aa755529332929609f6238",class:"flex flex-row justify-center items-center gap-2"},s("svg",{key:"165a00da1a16ebda3ca67a312e2e818e90e50b59",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 32 32",style:{width:"16px",height:"16px"}},s("path",{key:"b8d5e91620b46af1e583e1c729a62fc575ac6f79",d:"M26.667 21.333c-1.699 0-3.196 0.812-4.173 2.052l-11.912-5.211c0.044-0.276 0.085-0.553 0.085-0.841 0-0.472-0.081-0.923-0.197-1.359l12.361-6.952c0.971 1.009 2.328 1.644 3.836 1.644 2.941 0 5.333-2.392 5.333-5.333s-2.392-5.333-5.333-5.333-5.333 2.392-5.333 5.333c0 0.472 0.081 0.923 0.197 1.359l-12.361 6.952c-0.971-1.009-2.328-1.644-3.836-1.644-2.941 0-5.333 2.392-5.333 5.333s2.392 5.333 5.333 5.333c1.699 0 3.196-0.812 4.173-2.052l11.912 5.211c-0.044 0.276-0.085 0.553-0.085 0.841 0 2.941 2.392 5.333 5.333 5.333s5.333-2.392 5.333-5.333-2.392-5.333-5.333-5.333zM26.667 2.667c1.471 0 2.667 1.196 2.667 2.667s-1.196 2.667-2.667 2.667-2.667-1.196-2.667-2.667 1.196-2.667 2.667-2.667zM5.333 20c-1.471 0-2.667-1.196-2.667-2.667s1.196-2.667 2.667-2.667 2.667 1.196 2.667 2.667-1.196 2.667-2.667 2.667zM26.667 29.333c-1.471 0-2.667-1.196-2.667-2.667s1.196-2.667 2.667-2.667 2.667 1.196 2.667 2.667-1.196 2.667-2.667 2.667z"})),this.shareLabel,s("svg",{key:"804d7e2251bec8e7e224aff212c56038b6e578a4",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 32 32",style:{width:"16px",height:"16px"}},s("path",{key:"a72392c9ed7ed88a6bddb52ad521ea299b3521db",d:"M26.212 10.996c-0.556-0.484-1.396-0.428-1.881 0.127l-8.331 9.519-8.331-9.52c-0.485-0.555-1.327-0.611-1.881-0.125s-0.609 1.328-0.124 1.881l9.333 10.667c0.253 0.291 0.617 0.456 1.003 0.456s0.749-0.165 1.003-0.456l9.333-10.667c0.485-0.553 0.429-1.396-0.124-1.881z"})))),this.menuOpen&&s("ul",{key:"f92af33b6f93b242bb5e31ca7493cbe98da954bf",class:"s-wishlist-actions-menu absolute z-20 mt-1 bg-white rounded-lg shadow overflow-hidden"},s("li",{key:"1a890bceb2b1f818714aa8588f3cbac8dcd58bb1"},s("button",{key:"dea5ebfbbb21a915218495ba4c753058daa8673e",type:"button",class:"s-wishlist-actions-menu-item",onClick:()=>this.shareAll()},this.shareAllLabel)),s("li",{key:"bef2909444be2d83245e684c24647939d6efb0a6"},s("button",{key:"f3acc3228c9056c4a65df2c7461444a2cf5105bc",type:"button",class:"s-wishlist-actions-menu-item",onClick:()=>this.shareSpecific()},this.shareSpecificLabel)))),s("salla-social-share",{key:"aef87f10208a46d1bbe5cb09c4ed23175d0c8e05",class:"s-wishlist-actions-social",ref:t=>this.socialShare=t,url:this.shareUrl,mode:"modal",modalTitle:this.shareModalTitle},s("span",{key:"bc89fba2ab1178515ddd557dda51bf1bcb41a1e8",slot:"widget",class:"s-wishlist-actions-social-anchor","aria-hidden":"true"}))),this.specificMode&&s("div",{key:"a46e2c665a46fe2d9fc7bc1084223d24cdfe9706",class:"s-wishlist-actions-panel flex items-center justify-between gap-4 flex-wrap p-4 mt-3 mb-3 bg-white rounded-lg"},s("label",{key:"28eada8514684c55699bb22f390f48d129c9d1c6",class:"s-wishlist-actions-panel-select-all flex items-center gap-2 cursor-pointer"},s("input",{key:"9db31a9fcec824cfde62545fa402c5a7a97c6f81",type:"checkbox",class:"s-products-list-select-checkbox s-wishlist-actions-select-all",checked:this.isAllSelected,ref:t=>this.selectAllCheckbox=t,"aria-label":this.selectAllLabel,onChange:()=>this.toggleSelectAll()}),s("span",{key:"38b2e97d3185cf1483d49c26ff9b2746b4b08aaa",class:"s-wishlist-actions-panel-title text-sm font-bold text-gray-700"},this.shareSpecificLabel," (",this.selectedCount,")")),s("div",{key:"3f4d117cf6745fd3490c1196c1ae6f42e3185ae6",class:"s-wishlist-actions-panel-buttons flex items-center gap-2"},s("salla-button",{key:"daf79a258a9bca9eda2a1f103daec21e8cbb0609",class:"s-wishlist-actions-cancel",color:"light",fill:"outline",type:"button",onClick:()=>this.cancelSpecific()},this.cancelLabel),s("salla-button",{key:"34ee6ad51826802310a4f8a055211914da55747c",class:"s-wishlist-actions-share",color:"primary",fill:"outline",type:"button",disabled:!this.selectedCount,loading:this.isSharing,onClick:()=>this.shareSelected()},this.shareLabel)))))}get host(){return e(this)}};a.pageTitleClass="s-wishlist-actions-page-title",a.style='/*!twlt*/:host{display:block}.s-wishlist-actions-menu{min-width:200px;inset-inline-end:0;inset-inline-start:auto;list-style:none;margin:0;padding:4px 0;box-shadow:0 4px 16px rgba(0, 0, 0, 0.12)}.s-wishlist-actions-menu-item{display:block;width:100%;padding:10px 16px;text-align:start;font-size:0.875rem;color:#374151;background:transparent;cursor:pointer;white-space:nowrap}.s-wishlist-actions-menu-item:hover{background-color:#f3f4f6;color:var(--color-primary)}.s-wishlist-actions-panel{box-shadow:0 1px 3px rgba(0, 0, 0, 0.08)}.s-wishlist-actions-panel-select-all{user-select:none}.s-wishlist-actions-select-all:indeterminate,.s-wishlist-actions-select-all:indeterminate:hover,.s-wishlist-actions-select-all:indeterminate:focus{background-color:var(--color-primary);border-color:var(--color-primary)}.s-wishlist-actions-select-all:indeterminate::after{content:"";position:absolute;top:50%;left:50%;width:10px;height:2px;background:#fff;border:none;transform:translate(-50%, -50%)}.s-wishlist-actions-social-anchor{display:none}h1.s-wishlist-actions-page-title{text-align:start !important}.static{position:static}.absolute{position:absolute}.relative{position:relative}.z-20{z-index:20}.mb-3{margin-bottom:0.75rem}.mt-1{margin-top:0.25rem}.mt-3{margin-top:0.75rem}.flex{display:flex}.cursor-pointer{cursor:pointer}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-2{gap:0.5rem}.gap-3{gap:0.75rem}.gap-4{gap:1rem}.overflow-hidden{overflow:hidden}.rounded-lg{border-radius:0.5rem}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.p-4{padding:1rem}.text-sm{font-size:0.875rem;line-height:1.25rem}.font-bold{font-weight:700}.text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.outline{outline-style:solid}';export{a as salla_wishlist_actions}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as a,H as s,a as r}from"./p-DSmjBlMI.js";const i=[{label:"100px",value:"56px"},{label:"72px",value:"64px"},{label:"96px",value:"48px"}],e=class{constructor(a){t(this,a),this.validateForms=!0,this.cartCount=0,this.cartTotal=0,this.cartTotalDiscount=0,this.cartCashbackAmount=0,this.cartSubTotal=0,this.cartOptionsTotal=0,this.cartShippingCost=0,this.cartTaxAmount=0,this.cartHasShipping=!1,this.isOpen=!1,this.isDesktop=!1,this.isLoading=!0,this.originalParent=null,this.originalNextSibling=null,this.bodyObserver=null,this.mediaQueryList=null,this.submitObserver=null,this.isSubmitting=!1,this.mqlChangeHandler=t=>{this.isDesktop=t.matches,this.applyMode()},this.cartEventNames=["cart::details.fetched","cart::updated","cart::latest.fetched","cart::coupon.added","cart::coupon.deleted"],this.cartEventHandler=t=>this.applyCartData(this.extractCart(t)),this.releaseSubmitLoading=()=>{this.submitObserver?.disconnect(),this.submitObserver=null,this.submitObserverTimeout&&(clearTimeout(this.submitObserverTimeout),this.submitObserverTimeout=void 0),this.host.querySelector("#s-cart-summary-card-submit")?.removeAttribute?.("loading")},this.toggleSheet=()=>{this.isDesktop||(this.isOpen=!this.isOpen)},this.handleSubmit=async t=>{if(this.isSubmitting)return void t.preventDefault();if(this.isSubmitting=!0,this.validateForms&&!await this.validateCartForms())return t.preventDefault(),salla.notify?.error?.(salla.lang?.get?.("common.messages.required_fields")),void(this.isSubmitting=!1);const a=this.host.querySelector("#s-cart-summary-card-submit");a&&(a.load?.(),this.submitObserver?.disconnect(),this.submitObserverTimeout&&clearTimeout(this.submitObserverTimeout),this.submitObserver=new MutationObserver((()=>{a.hasAttribute("loading")||a.setAttribute("loading","")})),this.submitObserver.observe(a,{attributes:!0,attributeFilter:["loading"]}),this.submitObserverTimeout=window.setTimeout((()=>{this.submitObserver?.disconnect(),this.submitObserver=null,a.removeAttribute?.("loading")}),1e4)),salla.cart?.submit?.(),window.setTimeout((()=>{this.isSubmitting=!1}),1500)}}componentWillLoad(){this.mediaQueryList=window.matchMedia(this.desktopMediaQuery()),this.isDesktop=this.mediaQueryList.matches,this.isDesktop&&(this.isOpen=!0),this.init()}async init(){await salla.onReady(),await salla.lang.onLoaded(),this.loadTranslations(),this.cartEventNames.forEach((t=>salla.event.on(t,this.cartEventHandler))),salla.event.on("cart::submit.failed",this.releaseSubmitLoading),this.fetchCart()}loadTranslations(){this.summaryLabel=salla.lang.get("pages.cart.summary"),this.itemsTotalLabel=salla.lang.get("pages.cart.items_total"),this.itemsTotalNoTaxLabel=salla.lang.get("pages.cart.items_total_without_tax"),this.optionsTotalLabel=salla.lang.get("pages.cart.order_options_total"),this.shippingCostLabel=salla.lang.get("pages.cart.shipping_cost"),this.vatTaxLabel=salla.lang.get("pages.cart.VAT_tax_amount"),this.savedLabel=salla.lang.get("pages.cart.discount"),this.discountBadge=salla.lang.get("pages.cart.saved"),this.cashbackLabel=salla.lang.get("pages.checkout.cashback"),this.finalTotalLabel=salla.lang.get("pages.cart.final_total"),this.pricesTaxedLabel=salla.lang.get("pages.cart.prices_taxed"),this.completeOrderLabel=salla.lang.get("pages.cart.complete_order"),this.openSummaryLabel=salla.lang.get("pages.cart.open_summary"),this.closeSummaryLabel=salla.lang.get("pages.cart.close_summary"),this.itemsCountTemplate=salla.lang.get("pages.cart.items_with_count")}num(t){if(null==t)return 0;if("number"==typeof t)return isFinite(t)?t:0;if("string"==typeof t)return parseFloat(t)||0;if("object"==typeof t){if("amount"in t)return this.num(t.amount);if("value"in t)return this.num(t.value);if("formatted"in t)return this.num(t.formatted)}return 0}breakpointPx(){return 1024}desktopMediaQuery(){return`(min-width: ${this.breakpointPx()}px)`}componentDidLoad(){this.originalParent=this.host.parentElement,this.originalNextSibling=this.host.nextSibling,this.mediaQueryList||(this.mediaQueryList=window.matchMedia(this.desktopMediaQuery()),this.isDesktop=this.mediaQueryList.matches),this.applyMode(),this.mediaQueryList.addEventListener?this.mediaQueryList.addEventListener("change",this.mqlChangeHandler):this.mediaQueryList.addListener(this.mqlChangeHandler)}applyMode(){this.isDesktop?(this.isOpen=!0,this.bodyObserver?.disconnect(),this.bodyObserver=null,this.originalParent&&this.host.parentElement!==this.originalParent&&this.originalParent.insertBefore(this.host,this.originalNextSibling?.parentNode===this.originalParent?this.originalNextSibling:null)):this.pinToBodyEnd()}pinToBodyEnd(){this.host.parentElement===document.body&&document.body.lastElementChild===this.host||document.body.appendChild(this.host),this.bodyObserver||(this.bodyObserver=new MutationObserver((()=>{this.isDesktop||document.body.lastElementChild===this.host||document.body.appendChild(this.host)})),this.bodyObserver.observe(document.body,{childList:!0}))}disconnectedCallback(){Promise.resolve().then((()=>{this.host.isConnected||(this.bodyObserver?.disconnect(),this.submitObserver?.disconnect(),this.submitObserverTimeout&&(clearTimeout(this.submitObserverTimeout),this.submitObserverTimeout=void 0),this.mediaQueryList?.removeEventListener?this.mediaQueryList.removeEventListener("change",this.mqlChangeHandler):this.mediaQueryList?.removeListener(this.mqlChangeHandler),this.mediaQueryList=null,this.cartEventNames.forEach((t=>salla.event.off(t,this.cartEventHandler))),salla.event.off("cart::submit.failed",this.releaseSubmitLoading))}))}fetchCart(){const t=salla.config?.get?.("page.id"),a=salla.cart?.api?.details?.(t);a&&"function"==typeof a.then?a.then((t=>this.applyCartData(this.extractCart(t)))).catch((()=>this.applyCachedSummary())):this.applyCachedSummary()}applyCachedSummary(){const t=salla.storage?.get?.("cart.summary");t&&"object"==typeof t&&this.applyCartData(t,!1),this.isLoading=!1}extractCart(t){return t?t.data?.cart?t.data.cart:t.cart?t.cart:t:null}applyCartData(t,a){if(!t)return;this.isLoading=!1,void 0!==t.count&&(this.cartCount=this.num(t.count)),void 0!==t.total&&(this.cartTotal=this.num(t.total));const s=t.total_discount??t.discount;void 0!==s&&(this.cartTotalDiscount=this.num(s));const r=a??(void 0!==t.sub_total&&void 0!==t.total);void 0!==t.cashback_amount?this.cartCashbackAmount=this.num(t.cashback_amount):r&&(this.cartCashbackAmount=0),void 0!==t.sub_total&&(this.cartSubTotal=this.num(t.sub_total)),void 0!==t.options_total&&(this.cartOptionsTotal=this.num(t.options_total)),void 0!==t.tax_amount&&(this.cartTaxAmount=this.num(t.tax_amount));const i=!!t.free_shipping_bar?.has_free_shipping;void 0!==t.shipping_cost?this.cartShippingCost=this.num(t.shipping_cost):void 0!==t.real_shipping_cost&&(this.cartShippingCost=i?0:this.num(t.real_shipping_cost)),this.cartHasShipping=this.cartShippingCost>0||!!t.has_shipping}async validateCartForms(){let t=!0;document.querySelectorAll('form[id^="item-"]').forEach((a=>{a.reportValidity()||(t=!1)}));const a=Array.from(document.querySelectorAll('form[id^="item-"] salla-product-options'));for(const s of a)"function"!=typeof s.reportValidity||await s.reportValidity()||(t=!1);return t}decimalPlaces(t){const a=String(t),s=a.indexOf(".");return-1===s||a.includes("e")?0:a.length-s-1}roundToCurrency(t){const a=Math.min(Math.max(2,this.decimalPlaces(this.cartTotal),this.decimalPlaces(this.cartTotalDiscount)),4),s=Math.pow(10,a);return Math.round(t*s)/s}money(t){try{if("undefined"!=typeof salla&&"function"==typeof salla.money)return salla.money(t)}catch(t){}return String(t??0)}getItemsLabel(){return this.itemsCountTemplate?.replace(":count",String(this.cartCount))??""}renderSkeleton(){return a(s,{class:{"s-cart-summary-card":!0,"s-cart-summary-card--loading":!0,"s-cart-summary-card--desktop":this.isDesktop,"s-cart-summary-card--mobile":!this.isDesktop}},this.isDesktop&&a("div",{class:"s-cart-summary-card-sheet-wrap s-cart-summary-card-sheet-wrap--open"},a("div",{class:"s-cart-summary-card-sheet"},a("header",{class:"s-cart-summary-card-sheet-header"},a("h3",{class:"s-cart-summary-card-sheet-title"},a("salla-skeleton",{width:"140px",height:"16px"}))),i.map((({label:t,value:s},r)=>a("div",{class:"s-cart-summary-card-line",key:r},a("salla-skeleton",{width:t,height:"16px"}),a("salla-skeleton",{width:s,height:"16px"})))))),a("div",{class:"s-cart-summary-card-bar"},a("div",{class:"s-cart-summary-card-bar-label"},a("div",{class:"s-cart-summary-card-bar-label-main"},a("salla-skeleton",{width:"90px",height:"16px"}),a("salla-skeleton",{width:"48px",height:"12px"}))),a("div",{class:"s-cart-summary-card-bar-totals"},a("div",{class:"s-cart-summary-card-bar-totals-row"},a("salla-skeleton",{width:"80px",height:"20px"})))),a("div",{class:"s-cart-summary-card-action"},a("salla-skeleton",{width:"100%",height:"44px"})))}render(){if(this.isLoading)return this.renderSkeleton();const t=this.cartTotalDiscount>0,r=this.cartCashbackAmount>0,i=this.cartTaxAmount?this.itemsTotalNoTaxLabel:this.itemsTotalLabel;return a(s,{class:{"s-cart-summary-card":!0,"s-cart-summary-card--open":this.isOpen,"s-cart-summary-card--desktop":this.isDesktop,"s-cart-summary-card--mobile":!this.isDesktop}},a("div",{class:{"s-cart-summary-card-sheet-wrap":!0,"s-cart-summary-card-sheet-wrap--open":this.isOpen},"aria-hidden":this.isOpen?"false":"true"},a("div",{class:"s-cart-summary-card-sheet",style:this.isDesktop?{}:{transform:this.isOpen?"translateY(0)":"translateY(100%)",transition:"transform 0.4s cubic-bezier(0.32, 0.72, 0, 1)"}},a("header",{class:"s-cart-summary-card-sheet-header"},a("h3",{class:"s-cart-summary-card-sheet-title"},this.summaryLabel)),a("div",{class:"s-cart-summary-card-line"},a("span",null,i),a("b",{innerHTML:this.money(this.cartSubTotal)})),this.cartOptionsTotal>0&&a("div",{class:"s-cart-summary-card-line"},a("span",null,this.optionsTotalLabel),a("b",{innerHTML:this.money(this.cartOptionsTotal)})),this.cartHasShipping&&a("div",{class:"s-cart-summary-card-line"},a("span",null,this.shippingCostLabel),a("b",{innerHTML:this.money(this.cartShippingCost)})),this.cartTaxAmount>0&&a("div",{class:"s-cart-summary-card-line"},a("span",null,this.vatTaxLabel),a("b",{innerHTML:this.money(this.cartTaxAmount)})),t&&a("div",{class:"s-cart-summary-card-line s-cart-summary-card-line--discount"},a("span",null,this.savedLabel),a("b",null,"− ",a("span",{innerHTML:this.money(this.cartTotalDiscount)}))))),a("div",{class:"s-cart-summary-card-bar"},a("div",{class:"s-cart-summary-card-bar-label"},a("div",{class:"s-cart-summary-card-bar-label-main"},a("span",{class:"s-cart-summary-card-bar-label-text"},this.finalTotalLabel),a("span",{class:"s-cart-summary-card-bar-count"},this.getItemsLabel())),this.cartTaxAmount>0&&a("div",{class:"s-cart-summary-card-bar-label-sub"},this.pricesTaxedLabel)),a("div",{class:"s-cart-summary-card-bar-totals"},a("div",{class:"s-cart-summary-card-bar-totals-row"},t&&a("s",{class:"s-cart-summary-card-bar-original"},salla.helpers.number(this.roundToCurrency(this.cartTotal+this.cartTotalDiscount))),a("b",{class:"s-cart-summary-card-bar-total",innerHTML:this.money(this.cartTotal)}),!this.isDesktop&&a("button",{type:"button",class:"s-cart-summary-card-chevron","aria-label":this.isOpen?this.closeSummaryLabel:this.openSummaryLabel,"aria-expanded":this.isOpen?"true":"false",onClick:this.toggleSheet},a("i",{class:"sicon-keyboard_arrow_up s-cart-summary-card-chevron-icon"}))),(t||r)&&a("div",{class:"s-cart-summary-card-bar-savings-badge"},a("span",{"aria-hidden":"true"},"🎉"),a("span",null,t&&a("span",null,this.discountBadge," ",a("span",{innerHTML:this.money(this.cartTotalDiscount)})),t&&r&&" + ",r&&a("span",null,a("span",{innerHTML:this.money(this.cartCashbackAmount)})," ",this.cashbackLabel))))),a("div",{class:"s-cart-summary-card-action"},a("salla-button",{id:"s-cart-summary-card-submit",width:"wide","loader-position":"center",onClick:this.handleSubmit},this.completeOrderLabel)))}get host(){return r(this)}};e.style="/*!twlt*/:host{display:block}.sticky{position:sticky}.block{display:block}.transform{transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transition{transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.\\!btn{display:inline-flex;flex:1 1 0%;align-items:center;justify-content:center;white-space:nowrap;border-radius:0.375rem;padding-left:1.5rem;padding-right:1.5rem;padding-bottom:0.625rem;padding-top:0.5rem;font-size:0.875rem;line-height:1.25rem;font-weight:700;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.\\!btn:hover{opacity:0.8}.btn{display:inline-flex;flex:1 1 0%;align-items:center;justify-content:center;white-space:nowrap;border-radius:0.375rem;padding-left:1.5rem;padding-right:1.5rem;padding-bottom:0.625rem;padding-top:0.5rem;font-size:0.875rem;line-height:1.25rem;font-weight:700;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.btn:hover{opacity:0.8}.s-cart-summary-card-sheet-title{margin-bottom:0.5rem;flex:1 1 0%;font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-cart-summary-card-line{margin-bottom:0.5rem;display:flex;align-items:center;justify-content:space-between;font-size:0.875rem;line-height:1.25rem}.s-cart-summary-card-line span{--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.s-cart-summary-card-line b{font-size:1rem;line-height:1.5rem;font-weight:600;--tw-text-opacity:1;color:rgb(51 51 51 / var(--tw-text-opacity, 1))}.s-cart-summary-card-line--discount b{--tw-text-opacity:1 !important;color:rgb(220 38 38 / var(--tw-text-opacity, 1)) !important}.s-cart-summary-card-line--discount b *{--tw-text-opacity:1 !important;color:rgb(220 38 38 / var(--tw-text-opacity, 1)) !important}.s-cart-summary-card-bar-label{display:flex;flex-direction:column;gap:0.125rem}.s-cart-summary-card-bar-label-main{display:flex;align-items:baseline;gap:0.375rem}.s-cart-summary-card-bar-label-text{white-space:nowrap;font-size:1rem;line-height:1.5rem;font-weight:700;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-cart-summary-card-bar-count{white-space:nowrap;font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(115 115 115 / var(--tw-text-opacity, 1))}.s-cart-summary-card-bar-label-sub{font-size:11px;--tw-text-opacity:1;color:rgb(115 115 115 / var(--tw-text-opacity, 1))}.s-cart-summary-card-bar-totals{display:flex;flex-direction:column;align-items:flex-end;gap:0.375rem}.s-cart-summary-card-bar-totals-row{display:flex;align-items:center;gap:0.375rem}.s-cart-summary-card-bar-total{font-size:1rem;line-height:1.5rem;font-weight:700;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-cart-summary-card-bar-original{font-size:1rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1));text-decoration-line:line-through}.s-cart-summary-card-bar-savings-badge{display:inline-flex;width:max-content;align-items:center;gap:0.25rem;border-radius:var(--s-radius, 0.25rem);--tw-bg-opacity:1;background-color:rgb(239 251 246 / var(--tw-bg-opacity, 1));padding-left:0.5rem;padding-right:0.5rem;padding-top:0.125rem;padding-bottom:0.125rem;font-size:11px;font-weight:600;--tw-text-opacity:1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.s-cart-summary-card-chevron{display:inline-flex;height:1.5rem;width:1.5rem;cursor:pointer;align-items:center;justify-content:center;border-width:0px;background-color:transparent;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1));outline:2px solid transparent;outline-offset:2px}.s-cart-summary-card-chevron-icon{display:inline-flex;transition-property:transform;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-cart-summary-card{display:block;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}@media (max-width: 1023px){.s-cart-summary-card{position:fixed;inset-inline:0;bottom:0;z-index:1;border-radius:24px 24px 0 0;box-shadow:0 -12px 24px -12px rgba(0, 0, 0, 0.12);transition:box-shadow 0.3s ease;padding-bottom:calc(env(safe-area-inset-bottom) + 0.5rem)}}@media (min-width: 1024px){.s-cart-summary-card{position:relative;border-radius:0.5rem;box-shadow:0 2px 6px rgba(0, 0, 0, 0.05);padding:1.25rem 1.5rem;margin-bottom:1.25rem}}@media (max-width: 1023px){.s-cart-summary-card--open{border-radius:0;box-shadow:none}}.s-cart-summary-card-sheet-wrap{display:grid;grid-template-rows:0fr;transition:grid-template-rows 0.4s cubic-bezier(0.32, 0.72, 0, 1), box-shadow 0.3s ease}@media (max-width: 1023px){.s-cart-summary-card-sheet-wrap{position:absolute;inset-inline:0;bottom:calc(100% - 1px);background:#fff;border-radius:24px 24px 0 0;overflow:hidden;box-shadow:0 -12px 24px -12px rgba(0, 0, 0, 0)}}@media (min-width: 1024px){.s-cart-summary-card-sheet-wrap{grid-template-rows:1fr}}@media (max-width: 1023px){.s-cart-summary-card-sheet-wrap--open{grid-template-rows:1fr;box-shadow:0 -12px 24px -12px rgba(0, 0, 0, 0.12)}}.s-cart-summary-card-sheet{min-height:0;overflow:hidden}@media (max-width: 1023px){.s-cart-summary-card-sheet-wrap--open .s-cart-summary-card-sheet{overflow-y:auto;max-height:70vh;-webkit-overflow-scrolling:touch;padding:0.75rem 1rem 0}}.s-cart-summary-card-sheet-header{display:flex;align-items:center;justify-content:space-between;gap:0.5rem}@media (max-width: 1023px){.s-cart-summary-card-sheet-header{padding-bottom:0.5rem}}.s-cart-summary-card-bar{display:flex;align-items:flex-start;justify-content:space-between;gap:0.75rem;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}@media (min-width: 1024px){.s-cart-summary-card-bar{margin-top:1rem}}@media (max-width: 1023px){.s-cart-summary-card-bar{padding:0.875rem 1rem 0.5rem;border-radius:24px 24px 0 0}.s-cart-summary-card--open .s-cart-summary-card-bar{padding-top:0;border-radius:0}}@media (min-width: 1024px){.s-cart-summary-card-action{padding-top:1rem}}@media (max-width: 1023px){.s-cart-summary-card-action{padding:0 1rem 0.75rem}}.s-cart-summary-card--open .s-cart-summary-card-chevron-icon{transform:rotate(180deg)}.s-cart-summary-card-action *:focus{outline:none}";export{e as salla_cart_summary_card}
4
+ import{r as t,h as a,H as s,a as r}from"./p-Z_0e-eaG.js";const i=[{label:"100px",value:"56px"},{label:"72px",value:"64px"},{label:"96px",value:"48px"}],e=class{constructor(a){t(this,a),this.validateForms=!0,this.cartCount=0,this.cartTotal=0,this.cartTotalDiscount=0,this.cartCashbackAmount=0,this.cartSubTotal=0,this.cartOptionsTotal=0,this.cartShippingCost=0,this.cartTaxAmount=0,this.cartHasShipping=!1,this.isOpen=!1,this.isDesktop=!1,this.isLoading=!0,this.originalParent=null,this.originalNextSibling=null,this.bodyObserver=null,this.mediaQueryList=null,this.submitObserver=null,this.isSubmitting=!1,this.mqlChangeHandler=t=>{this.isDesktop=t.matches,this.applyMode()},this.cartEventNames=["cart::details.fetched","cart::updated","cart::latest.fetched","cart::coupon.added","cart::coupon.deleted"],this.cartEventHandler=t=>this.applyCartData(this.extractCart(t)),this.releaseSubmitLoading=()=>{this.submitObserver?.disconnect(),this.submitObserver=null,this.submitObserverTimeout&&(clearTimeout(this.submitObserverTimeout),this.submitObserverTimeout=void 0),this.host.querySelector("#s-cart-summary-card-submit")?.removeAttribute?.("loading")},this.toggleSheet=()=>{this.isDesktop||(this.isOpen=!this.isOpen)},this.handleSubmit=async t=>{if(this.isSubmitting)return void t.preventDefault();if(this.isSubmitting=!0,this.validateForms&&!await this.validateCartForms())return t.preventDefault(),salla.notify?.error?.(salla.lang?.get?.("common.messages.required_fields")),void(this.isSubmitting=!1);const a=this.host.querySelector("#s-cart-summary-card-submit");a&&(a.load?.(),this.submitObserver?.disconnect(),this.submitObserverTimeout&&clearTimeout(this.submitObserverTimeout),this.submitObserver=new MutationObserver((()=>{a.hasAttribute("loading")||a.setAttribute("loading","")})),this.submitObserver.observe(a,{attributes:!0,attributeFilter:["loading"]}),this.submitObserverTimeout=window.setTimeout((()=>{this.submitObserver?.disconnect(),this.submitObserver=null,a.removeAttribute?.("loading")}),1e4)),salla.cart?.submit?.(),window.setTimeout((()=>{this.isSubmitting=!1}),1500)}}componentWillLoad(){this.mediaQueryList=window.matchMedia(this.desktopMediaQuery()),this.isDesktop=this.mediaQueryList.matches,this.isDesktop&&(this.isOpen=!0),this.init()}async init(){await salla.onReady(),await salla.lang.onLoaded(),this.loadTranslations(),this.cartEventNames.forEach((t=>salla.event.on(t,this.cartEventHandler))),salla.event.on("cart::submit.failed",this.releaseSubmitLoading),this.fetchCart()}loadTranslations(){this.summaryLabel=salla.lang.get("pages.cart.summary"),this.itemsTotalLabel=salla.lang.get("pages.cart.items_total"),this.itemsTotalNoTaxLabel=salla.lang.get("pages.cart.items_total_without_tax"),this.optionsTotalLabel=salla.lang.get("pages.cart.order_options_total"),this.shippingCostLabel=salla.lang.get("pages.cart.shipping_cost"),this.vatTaxLabel=salla.lang.get("pages.cart.VAT_tax_amount"),this.savedLabel=salla.lang.get("pages.cart.discount"),this.discountBadge=salla.lang.get("pages.cart.saved"),this.cashbackLabel=salla.lang.get("pages.checkout.cashback"),this.finalTotalLabel=salla.lang.get("pages.cart.final_total"),this.pricesTaxedLabel=salla.lang.get("pages.cart.prices_taxed"),this.completeOrderLabel=salla.lang.get("pages.cart.complete_order"),this.openSummaryLabel=salla.lang.get("pages.cart.open_summary"),this.closeSummaryLabel=salla.lang.get("pages.cart.close_summary"),this.itemsCountTemplate=salla.lang.get("pages.cart.items_with_count")}num(t){if(null==t)return 0;if("number"==typeof t)return isFinite(t)?t:0;if("string"==typeof t)return parseFloat(t)||0;if("object"==typeof t){if("amount"in t)return this.num(t.amount);if("value"in t)return this.num(t.value);if("formatted"in t)return this.num(t.formatted)}return 0}breakpointPx(){return 1024}desktopMediaQuery(){return`(min-width: ${this.breakpointPx()}px)`}componentDidLoad(){this.originalParent=this.host.parentElement,this.originalNextSibling=this.host.nextSibling,this.mediaQueryList||(this.mediaQueryList=window.matchMedia(this.desktopMediaQuery()),this.isDesktop=this.mediaQueryList.matches),this.applyMode(),this.mediaQueryList.addEventListener?this.mediaQueryList.addEventListener("change",this.mqlChangeHandler):this.mediaQueryList.addListener(this.mqlChangeHandler)}applyMode(){this.isDesktop?(this.isOpen=!0,this.bodyObserver?.disconnect(),this.bodyObserver=null,this.originalParent&&this.host.parentElement!==this.originalParent&&this.originalParent.insertBefore(this.host,this.originalNextSibling?.parentNode===this.originalParent?this.originalNextSibling:null)):this.pinToBodyEnd()}pinToBodyEnd(){this.host.parentElement===document.body&&document.body.lastElementChild===this.host||document.body.appendChild(this.host),this.bodyObserver||(this.bodyObserver=new MutationObserver((()=>{this.isDesktop||document.body.lastElementChild===this.host||document.body.appendChild(this.host)})),this.bodyObserver.observe(document.body,{childList:!0}))}disconnectedCallback(){Promise.resolve().then((()=>{this.host.isConnected||(this.bodyObserver?.disconnect(),this.submitObserver?.disconnect(),this.submitObserverTimeout&&(clearTimeout(this.submitObserverTimeout),this.submitObserverTimeout=void 0),this.mediaQueryList?.removeEventListener?this.mediaQueryList.removeEventListener("change",this.mqlChangeHandler):this.mediaQueryList?.removeListener(this.mqlChangeHandler),this.mediaQueryList=null,this.cartEventNames.forEach((t=>salla.event.off(t,this.cartEventHandler))),salla.event.off("cart::submit.failed",this.releaseSubmitLoading))}))}fetchCart(){const t=salla.config?.get?.("page.id"),a=salla.cart?.api?.details?.(t);a&&"function"==typeof a.then?a.then((t=>this.applyCartData(this.extractCart(t)))).catch((()=>this.applyCachedSummary())):this.applyCachedSummary()}applyCachedSummary(){const t=salla.storage?.get?.("cart.summary");t&&"object"==typeof t&&this.applyCartData(t,!1),this.isLoading=!1}extractCart(t){return t?t.data?.cart?t.data.cart:t.cart?t.cart:t:null}applyCartData(t,a){if(!t)return;this.isLoading=!1,void 0!==t.count&&(this.cartCount=this.num(t.count)),void 0!==t.total&&(this.cartTotal=this.num(t.total));const s=t.total_discount??t.discount;void 0!==s&&(this.cartTotalDiscount=this.num(s));const r=a??(void 0!==t.sub_total&&void 0!==t.total);void 0!==t.cashback_amount?this.cartCashbackAmount=this.num(t.cashback_amount):r&&(this.cartCashbackAmount=0),void 0!==t.sub_total&&(this.cartSubTotal=this.num(t.sub_total)),void 0!==t.options_total&&(this.cartOptionsTotal=this.num(t.options_total)),void 0!==t.tax_amount&&(this.cartTaxAmount=this.num(t.tax_amount));const i=!!t.free_shipping_bar?.has_free_shipping;void 0!==t.shipping_cost?this.cartShippingCost=this.num(t.shipping_cost):void 0!==t.real_shipping_cost&&(this.cartShippingCost=i?0:this.num(t.real_shipping_cost)),this.cartHasShipping=this.cartShippingCost>0||!!t.has_shipping}async validateCartForms(){let t=!0;document.querySelectorAll('form[id^="item-"]').forEach((a=>{a.reportValidity()||(t=!1)}));const a=Array.from(document.querySelectorAll('form[id^="item-"] salla-product-options'));for(const s of a)"function"!=typeof s.reportValidity||await s.reportValidity()||(t=!1);return t}decimalPlaces(t){const a=String(t),s=a.indexOf(".");return-1===s||a.includes("e")?0:a.length-s-1}roundToCurrency(t){const a=Math.min(Math.max(2,this.decimalPlaces(this.cartTotal),this.decimalPlaces(this.cartTotalDiscount)),4),s=Math.pow(10,a);return Math.round(t*s)/s}money(t){try{if("undefined"!=typeof salla&&"function"==typeof salla.money)return salla.money(t)}catch(t){}return String(t??0)}getItemsLabel(){return this.itemsCountTemplate?.replace(":count",String(this.cartCount))??""}renderSkeleton(){return a(s,{class:{"s-cart-summary-card":!0,"s-cart-summary-card--loading":!0,"s-cart-summary-card--desktop":this.isDesktop,"s-cart-summary-card--mobile":!this.isDesktop}},this.isDesktop&&a("div",{class:"s-cart-summary-card-sheet-wrap s-cart-summary-card-sheet-wrap--open"},a("div",{class:"s-cart-summary-card-sheet"},a("header",{class:"s-cart-summary-card-sheet-header"},a("h3",{class:"s-cart-summary-card-sheet-title"},a("salla-skeleton",{width:"140px",height:"16px"}))),i.map((({label:t,value:s},r)=>a("div",{class:"s-cart-summary-card-line",key:r},a("salla-skeleton",{width:t,height:"16px"}),a("salla-skeleton",{width:s,height:"16px"})))))),a("div",{class:"s-cart-summary-card-bar"},a("div",{class:"s-cart-summary-card-bar-label"},a("div",{class:"s-cart-summary-card-bar-label-main"},a("salla-skeleton",{width:"90px",height:"16px"}),a("salla-skeleton",{width:"48px",height:"12px"}))),a("div",{class:"s-cart-summary-card-bar-totals"},a("div",{class:"s-cart-summary-card-bar-totals-row"},a("salla-skeleton",{width:"80px",height:"20px"})))),a("div",{class:"s-cart-summary-card-action"},a("salla-skeleton",{width:"100%",height:"44px"})))}render(){if(this.isLoading)return this.renderSkeleton();const t=this.cartTotalDiscount>0,r=this.cartCashbackAmount>0,i=this.cartTaxAmount?this.itemsTotalNoTaxLabel:this.itemsTotalLabel;return a(s,{class:{"s-cart-summary-card":!0,"s-cart-summary-card--open":this.isOpen,"s-cart-summary-card--desktop":this.isDesktop,"s-cart-summary-card--mobile":!this.isDesktop}},a("div",{class:{"s-cart-summary-card-sheet-wrap":!0,"s-cart-summary-card-sheet-wrap--open":this.isOpen},"aria-hidden":this.isOpen?"false":"true"},a("div",{class:"s-cart-summary-card-sheet",style:this.isDesktop?{}:{transform:this.isOpen?"translateY(0)":"translateY(100%)",transition:"transform 0.4s cubic-bezier(0.32, 0.72, 0, 1)"}},a("header",{class:"s-cart-summary-card-sheet-header"},a("h3",{class:"s-cart-summary-card-sheet-title"},this.summaryLabel)),a("div",{class:"s-cart-summary-card-line"},a("span",null,i),a("b",{innerHTML:this.money(this.cartSubTotal)})),this.cartOptionsTotal>0&&a("div",{class:"s-cart-summary-card-line"},a("span",null,this.optionsTotalLabel),a("b",{innerHTML:this.money(this.cartOptionsTotal)})),this.cartHasShipping&&a("div",{class:"s-cart-summary-card-line"},a("span",null,this.shippingCostLabel),a("b",{innerHTML:this.money(this.cartShippingCost)})),this.cartTaxAmount>0&&a("div",{class:"s-cart-summary-card-line"},a("span",null,this.vatTaxLabel),a("b",{innerHTML:this.money(this.cartTaxAmount)})),t&&a("div",{class:"s-cart-summary-card-line s-cart-summary-card-line--discount"},a("span",null,this.savedLabel),a("b",null,"− ",a("span",{innerHTML:this.money(this.cartTotalDiscount)}))))),a("div",{class:"s-cart-summary-card-bar"},a("div",{class:"s-cart-summary-card-bar-label"},a("div",{class:"s-cart-summary-card-bar-label-main"},a("span",{class:"s-cart-summary-card-bar-label-text"},this.finalTotalLabel),a("span",{class:"s-cart-summary-card-bar-count"},this.getItemsLabel())),this.cartTaxAmount>0&&a("div",{class:"s-cart-summary-card-bar-label-sub"},this.pricesTaxedLabel)),a("div",{class:"s-cart-summary-card-bar-totals"},a("div",{class:"s-cart-summary-card-bar-totals-row"},t&&a("s",{class:"s-cart-summary-card-bar-original"},salla.helpers.number(this.roundToCurrency(this.cartTotal+this.cartTotalDiscount))),a("b",{class:"s-cart-summary-card-bar-total",innerHTML:this.money(this.cartTotal)}),!this.isDesktop&&a("button",{type:"button",class:"s-cart-summary-card-chevron","aria-label":this.isOpen?this.closeSummaryLabel:this.openSummaryLabel,"aria-expanded":this.isOpen?"true":"false",onClick:this.toggleSheet},a("i",{class:"sicon-keyboard_arrow_up s-cart-summary-card-chevron-icon"}))),(t||r)&&a("div",{class:"s-cart-summary-card-bar-savings-badge"},a("span",{"aria-hidden":"true"},"🎉"),a("span",null,t&&a("span",null,this.discountBadge," ",a("span",{innerHTML:this.money(this.cartTotalDiscount)})),t&&r&&" + ",r&&a("span",null,a("span",{innerHTML:this.money(this.cartCashbackAmount)})," ",this.cashbackLabel))))),a("div",{class:"s-cart-summary-card-action"},a("salla-button",{id:"s-cart-summary-card-submit",width:"wide","loader-position":"center",onClick:this.handleSubmit},this.completeOrderLabel)))}get host(){return r(this)}};e.style="/*!twlt*/:host{display:block}.sticky{position:sticky}.block{display:block}.transform{transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transition{transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.\\!btn{display:inline-flex;flex:1 1 0%;align-items:center;justify-content:center;white-space:nowrap;border-radius:0.375rem;padding-left:1.5rem;padding-right:1.5rem;padding-bottom:0.625rem;padding-top:0.5rem;font-size:0.875rem;line-height:1.25rem;font-weight:700;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.\\!btn:hover{opacity:0.8}.btn{display:inline-flex;flex:1 1 0%;align-items:center;justify-content:center;white-space:nowrap;border-radius:0.375rem;padding-left:1.5rem;padding-right:1.5rem;padding-bottom:0.625rem;padding-top:0.5rem;font-size:0.875rem;line-height:1.25rem;font-weight:700;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.btn:hover{opacity:0.8}.s-cart-summary-card-sheet-title{margin-bottom:0.5rem;flex:1 1 0%;font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-cart-summary-card-line{margin-bottom:0.5rem;display:flex;align-items:center;justify-content:space-between;font-size:0.875rem;line-height:1.25rem}.s-cart-summary-card-line span{--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.s-cart-summary-card-line b{font-size:1rem;line-height:1.5rem;font-weight:600;--tw-text-opacity:1;color:rgb(51 51 51 / var(--tw-text-opacity, 1))}.s-cart-summary-card-line--discount b{--tw-text-opacity:1 !important;color:rgb(220 38 38 / var(--tw-text-opacity, 1)) !important}.s-cart-summary-card-line--discount b *{--tw-text-opacity:1 !important;color:rgb(220 38 38 / var(--tw-text-opacity, 1)) !important}.s-cart-summary-card-bar-label{display:flex;flex-direction:column;gap:0.125rem}.s-cart-summary-card-bar-label-main{display:flex;align-items:baseline;gap:0.375rem}.s-cart-summary-card-bar-label-text{white-space:nowrap;font-size:1rem;line-height:1.5rem;font-weight:700;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-cart-summary-card-bar-count{white-space:nowrap;font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(115 115 115 / var(--tw-text-opacity, 1))}.s-cart-summary-card-bar-label-sub{font-size:11px;--tw-text-opacity:1;color:rgb(115 115 115 / var(--tw-text-opacity, 1))}.s-cart-summary-card-bar-totals{display:flex;flex-direction:column;align-items:flex-end;gap:0.375rem}.s-cart-summary-card-bar-totals-row{display:flex;align-items:center;gap:0.375rem}.s-cart-summary-card-bar-total{font-size:1rem;line-height:1.5rem;font-weight:700;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-cart-summary-card-bar-original{font-size:1rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1));text-decoration-line:line-through}.s-cart-summary-card-bar-savings-badge{display:inline-flex;width:max-content;align-items:center;gap:0.25rem;border-radius:var(--s-radius, 0.25rem);--tw-bg-opacity:1;background-color:rgb(239 251 246 / var(--tw-bg-opacity, 1));padding-left:0.5rem;padding-right:0.5rem;padding-top:0.125rem;padding-bottom:0.125rem;font-size:11px;font-weight:600;--tw-text-opacity:1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.s-cart-summary-card-chevron{display:inline-flex;height:1.5rem;width:1.5rem;cursor:pointer;align-items:center;justify-content:center;border-width:0px;background-color:transparent;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1));outline:2px solid transparent;outline-offset:2px}.s-cart-summary-card-chevron-icon{display:inline-flex;transition-property:transform;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-cart-summary-card{display:block;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}@media (max-width: 1023px){.s-cart-summary-card{position:fixed;inset-inline:0;bottom:0;z-index:1;border-radius:24px 24px 0 0;box-shadow:0 -12px 24px -12px rgba(0, 0, 0, 0.12);transition:box-shadow 0.3s ease;padding-bottom:calc(env(safe-area-inset-bottom) + 0.5rem)}}@media (min-width: 1024px){.s-cart-summary-card{position:relative;border-radius:0.5rem;box-shadow:0 2px 6px rgba(0, 0, 0, 0.05);padding:1.25rem 1.5rem;margin-bottom:1.25rem}}@media (max-width: 1023px){.s-cart-summary-card--open{border-radius:0;box-shadow:none}}.s-cart-summary-card-sheet-wrap{display:grid;grid-template-rows:0fr;transition:grid-template-rows 0.4s cubic-bezier(0.32, 0.72, 0, 1), box-shadow 0.3s ease}@media (max-width: 1023px){.s-cart-summary-card-sheet-wrap{position:absolute;inset-inline:0;bottom:calc(100% - 1px);background:#fff;border-radius:24px 24px 0 0;overflow:hidden;box-shadow:0 -12px 24px -12px rgba(0, 0, 0, 0)}}@media (min-width: 1024px){.s-cart-summary-card-sheet-wrap{grid-template-rows:1fr}}@media (max-width: 1023px){.s-cart-summary-card-sheet-wrap--open{grid-template-rows:1fr;box-shadow:0 -12px 24px -12px rgba(0, 0, 0, 0.12)}}.s-cart-summary-card-sheet{min-height:0;overflow:hidden}@media (max-width: 1023px){.s-cart-summary-card-sheet-wrap--open .s-cart-summary-card-sheet{overflow-y:auto;max-height:70vh;-webkit-overflow-scrolling:touch;padding:0.75rem 1rem 0}}.s-cart-summary-card-sheet-header{display:flex;align-items:center;justify-content:space-between;gap:0.5rem}@media (max-width: 1023px){.s-cart-summary-card-sheet-header{padding-bottom:0.5rem}}.s-cart-summary-card-bar{display:flex;align-items:flex-start;justify-content:space-between;gap:0.75rem;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}@media (min-width: 1024px){.s-cart-summary-card-bar{margin-top:1rem}}@media (max-width: 1023px){.s-cart-summary-card-bar{padding:0.875rem 1rem 0.5rem;border-radius:24px 24px 0 0}.s-cart-summary-card--open .s-cart-summary-card-bar{padding-top:0;border-radius:0}}@media (min-width: 1024px){.s-cart-summary-card-action{padding-top:1rem}}@media (max-width: 1023px){.s-cart-summary-card-action{padding:0 1rem 0.75rem}}.s-cart-summary-card--open .s-cart-summary-card-chevron-icon{transform:rotate(180deg)}.s-cart-summary-card-action *:focus{outline:none}";export{e as salla_cart_summary_card}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as a,H as e,a as r}from"./p-DSmjBlMI.js";import{f as i}from"./p-DIAyA5MP.js";const s=class{constructor(a){t(this,a),this.limit=10,this.products=[],this.isLoading=!0,this.canRender=!0,this.title="",this.addToCartLabel="",this.weightLabel="",this.discountLabel="",this.placeholder="",this.fetchGeneration=0,this.isSyncingCart=!1,this.requestId=null,this.listViewTracked=!1,this.lastListViewedKey="",this.cartItemChangedHandler=t=>{const a=t?.data?.cart?.items??[],e=a.map((t=>String(t.product_id))).filter(Boolean);this.syncCartItemsDom(a),this.fetchRecommendations(e)},this.beforeAddItemHandler=t=>{const a=String(t?.id??"");a&&this.products.some((t=>String(t.id)===a))&&salla.cart?.api&&(salla.cart.api.addToCartSource="basket_gap")},this.addButtonSuccessHandler=t=>{const a=t?.target?.getAttribute?.("product-id");if(!a)return;const e=this.products.find((t=>String(t.id)===String(a)));if(!e)return;const r=t?.detail?.data?.items??[],i=r.find((t=>String(t.product_id)===String(e.id)))??r.slice(-1)[0];salla.event.emit("salla-basket-gap::product.added",[{product:e,position:this.products.indexOf(e)+1,cartItem:i,cartId:t?.detail?.data?.id,source:"basket_gap",request_id:this.requestId}])},salla.lang.onLoaded((()=>{this.title=salla.lang.get("pages.cart.basket_gap_title"),this.addToCartLabel=salla.lang.get("pages.cart.add_to_cart"),this.weightLabel=salla.lang.get("pages.products.weight"),this.discountLabel=salla.lang.get("pages.products.discount")}))}componentWillLoad(){salla.onReady().then((()=>{if(!salla.config.get("store.settings.cart.basket_gap"))return this.canRender=!1,void(this.isLoading=!1);this.title=salla.lang.get("pages.cart.basket_gap_title"),this.addToCartLabel=salla.lang.get("pages.cart.add_to_cart"),this.weightLabel=salla.lang.get("pages.products.weight"),this.discountLabel=salla.lang.get("pages.products.discount"),this.placeholder=salla.url.asset(salla.config.get("theme.settings.placeholder"));const t=salla.storage.get("cart"),a=(t?.items??[]).map((t=>String(t.product_id))).filter(Boolean);return a.length?this.fetchRecommendations(a):salla.api.cart.details().then((({data:{cart:t}})=>{const a=(t?.items??[]).map((t=>String(t.product_id))).filter(Boolean);return this.fetchRecommendations(a)})).catch((()=>{this.canRender=!1,this.isLoading=!1}))}))}componentDidLoad(){this.positionUnderCartItems()}componentDidUpdate(){document.lazyLoadInstance?.update(this.host.querySelectorAll(".lazy")),this.positionUnderCartItems()}componentDidRender(){if(!this.products.length||this.listViewTracked||this.intersectionObserver)return;const t=new IntersectionObserver((a=>{this.intersectionObserver===t&&a.some((t=>t.isIntersecting))&&(this.listViewTracked=!0,t.disconnect(),this.intersectionObserver=void 0,this.emitListViewed())}),{threshold:.1});this.intersectionObserver=t,t.observe(this.host)}emitListViewed(){const t=this.products.map((t=>t.id)).join(",");t!==this.lastListViewedKey&&(this.lastListViewedKey=t,salla.event.emit("salla-basket-gap::list.viewed",{products:this.products,source:"basket_gap",request_id:this.requestId}))}handleCardClick(t,a){const e=t.target;"function"==typeof e?.closest&&e.closest("a[href]")&&this.emitProductClicked(a)}emitProductClicked(t){salla.event.emit("salla-basket-gap::product.clicked",[{product:t,position:this.products.indexOf(t)+1,source:"basket_gap",request_id:this.requestId}])}getCartItemForms(t=document){return Array.from(t.querySelectorAll('form[id^="item-"]')).filter((t=>!t.closest(".cart-options")))}positionUnderCartItems(){const t=this.getCartItemForms(),a=t[t.length-1];a&&a.nextElementSibling!==this.host&&a.after(this.host)}syncCartItemsDom(t){t?.length&&!this.isSyncingCart&&t.filter((t=>!document.getElementById("item-"+t.id))).length&&(this.isSyncingCart=!0,fetch(window.location.href,{headers:{"X-Requested-With":"XMLHttpRequest"},credentials:"same-origin"}).then((t=>t.text())).then((t=>{const a=(new DOMParser).parseFromString(t,"text/html"),e=this.getCartItemForms(a),r=this.getCartItemForms();if(!e.length||!r.length)return;const i=r[0],s=i.parentElement;s&&(e.forEach((t=>{s.insertBefore(document.importNode(t,!0),i)})),r.forEach((t=>t.remove())),document.lazyLoadInstance?.update?.(),this.positionUnderCartItems())})).catch((()=>{})).finally((()=>{this.isSyncingCart=!1})))}connectedCallback(){salla.event.on("cart::item.added",this.cartItemChangedHandler),salla.event.on("cart::item.deleted",this.cartItemChangedHandler),salla.event.on("cart::before.add.item",this.beforeAddItemHandler),this.host.addEventListener("success",this.addButtonSuccessHandler)}disconnectedCallback(){this.intersectionObserver?.disconnect(),this.intersectionObserver=void 0,salla.event.off("cart::item.added",this.cartItemChangedHandler),salla.event.off("cart::item.deleted",this.cartItemChangedHandler),salla.event.off("cart::before.add.item",this.beforeAddItemHandler),this.host.removeEventListener("success",this.addButtonSuccessHandler)}getCartProductIds(t){if(t?.length)return new Set(t);const a=salla.storage.get("cart");return new Set((a?.items??[]).map((t=>String(t.product_id))).filter(Boolean))}fetchRecommendations(t){if(!t.length)return this.canRender=!1,this.isLoading=!1,Promise.resolve();const a=++this.fetchGeneration;return i(t).then((e=>{if(a!==this.fetchGeneration)return;const r=e._requestId||null,i=this.getCartProductIds(t),s=e.filter((t=>!i.has(t)));if(s.length)return this.fetchProducts(s.slice(0,this.limit),a,r);this.canRender=!1})).catch((()=>{a===this.fetchGeneration&&(this.canRender=!1)})).finally((()=>{a===this.fetchGeneration&&(this.isLoading=!1)}))}fetchProducts(t,a,e=null){return salla.api.withoutNotifier((()=>salla.product.api.fetch({source:"selected",source_value:t,limit:this.limit}))).then((t=>{a===this.fetchGeneration&&(this.products=t?.data??[],this.requestId=e,this.listViewTracked=!1,this.intersectionObserver?.disconnect(),this.intersectionObserver=void 0,this.canRender=this.products.length>0)})).catch((()=>{a===this.fetchGeneration&&(this.canRender=!1)}))}getDiscountLabel(t){if(t.promotion_title)return t.promotion_title;if(t.is_on_sale&&t.regular_price>0&&t.sale_price>0){const a=Math.round(100*(1-t.sale_price/t.regular_price));return a>0?`${this.discountLabel} ${a}%`:null}return null}formatDate(t){const a=new Date(1e3*t),e=String(a.getMonth()+1).padStart(2,"0"),r=String(a.getDate()).padStart(2,"0");return`${a.getFullYear()}-${e}-${r}`}getSkeletonView(){return a(e,{class:"s-basket-gap-entry"},a("div",{class:"s-basket-gap-skeleton"},a("salla-skeleton",{height:"16px",width:"40%",style:{marginBottom:"16px"}}),Array(3).fill(null).map(((t,e)=>a("div",{key:e,class:"s-basket-gap-skeleton-card"},a("salla-skeleton",{height:"64px",width:"64px",style:{borderRadius:"8px",flexShrink:"0"}}),a("div",{class:"s-basket-gap-skeleton-info"},a("salla-skeleton",{height:"14px",width:"50%"}),a("salla-skeleton",{height:"12px",width:"25%",style:{marginTop:"6px"}}),a("salla-skeleton",{height:"10px",width:"35%",style:{marginTop:"4px"}})),a("salla-skeleton",{height:"36px",width:"100px",style:{borderRadius:"6px",flexShrink:"0",marginInlineStart:"auto"}}))))))}getProductCard(t){const e=this.getDiscountLabel(t);return a("div",{key:t.id,class:"s-basket-gap-card",onClick:a=>this.handleCardClick(a,t)},a("a",{href:t.url,class:"s-basket-gap-card-image"},a("img",{class:"lazy",src:this.placeholder,"data-src":t.image?.url,alt:t.image?.alt||t.name})),a("div",{class:"s-basket-gap-card-info"},a("h3",{class:"s-basket-gap-card-name"},a("a",{href:t.url},t.name)),t.is_on_sale?a("div",{class:"s-basket-gap-card-sale-price"},a("span",{innerHTML:salla.money(t.sale_price)}),a("del",{innerHTML:salla.money(t.regular_price)})):a("span",{class:"s-basket-gap-card-price",innerHTML:salla.money(t.price)}),t.weight_label&&a("span",{class:"s-basket-gap-card-weight"},this.weightLabel," ",t.weight_label)),a("div",{class:"s-basket-gap-card-actions"},(t.promotion_title||t.discount_ends||t.is_on_sale)&&a("div",{class:"s-basket-gap-card-offer"},a("i",{class:"sicon-gift"}),e&&a("span",null,e),t.discount_ends&&[a("salla-count-down",{date:this.formatDate(t.discount_ends),"end-of-day":!0,digits:"en","auto-segments":!0}),a("i",{class:"sicon-alarm"})]),a("salla-add-product-button",{class:"s-basket-gap-card-btn","product-id":t.id,"product-status":t.status,"product-type":t.type},this.addToCartLabel)))}render(){return this.canRender?this.isLoading?this.getSkeletonView():this.products.length?a(e,{class:"s-basket-gap-entry"},this.title&&a("h2",{class:"s-basket-gap-title"},this.title),a("div",{class:"s-basket-gap-list"},this.products.map((t=>this.getProductCard(t))))):null:null}get host(){return r(this)}};s.style='/*!twlt*/:host{display:block}.block{display:block}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-basket-gap-entry{margin-top:1.25rem;margin-bottom:1.25rem;display:block;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:1.25rem}.s-basket-gap-title{margin-bottom:1rem;font-size:1.125rem;line-height:1.75rem;font-weight:700}.s-basket-gap-list{display:flex;flex-direction:column}.s-basket-gap-list>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse));--tw-divide-opacity:1;border-color:rgb(243 244 246 / var(--tw-divide-opacity, 1))}.s-basket-gap-card{display:flex;flex-wrap:wrap;align-items:center;column-gap:0.75rem;row-gap:0.625rem;padding-top:1rem;padding-bottom:1rem}.s-basket-gap-card-image{height:4rem;width:4rem;flex-shrink:0;overflow:hidden;border-radius:0.375rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.s-basket-gap-card-image img{height:100%;width:100%;object-fit:cover}.s-basket-gap-card-info{display:flex;min-width:0px;flex:1 1 0%;flex-direction:column;gap:0.25rem}.s-basket-gap-card-actions{display:flex;width:100%;align-items:center;justify-content:flex-end;gap:0.5rem}@media (min-width: 640px){.s-basket-gap-card-actions{width:auto}}.s-basket-gap-card-name{font-size:0.875rem;line-height:1.25rem;font-weight:600;line-height:1.25;--tw-text-opacity:1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.s-basket-gap-card-name a:hover{color:var(--color-primary)}.s-basket-gap-card-price{font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-basket-gap-card-sale-price{display:flex;align-items:center;gap:0.5rem}.s-basket-gap-card-sale-price span{font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.s-basket-gap-card-sale-price del{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1));text-decoration-line:line-through}.s-basket-gap-card-weight{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-basket-gap-card-offer{display:flex;flex-shrink:0;align-items:center;gap:0.25rem;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1));padding-left:9px;padding-right:9px;padding-top:3px;padding-bottom:3px;font-size:11px;font-weight:500;--tw-text-opacity:1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.s-basket-gap-card-offer i{font-size:0.75rem;line-height:1rem}.s-basket-gap-card-offer span{font-weight:700;--tw-text-opacity:1 !important;color:rgb(31 41 55 / var(--tw-text-opacity, 1)) !important}.s-basket-gap-card-offer salla-count-down{flex-shrink:0}.s-basket-gap-card-offer salla-count-down:where([dir="ltr"],[dir="ltr"] *){margin-inline-start:0.25rem}.s-basket-gap-card-offer salla-count-down:where([dir="rtl"],[dir="rtl"] *){margin-inline-end:0.25rem}.s-basket-gap-card-offer .s-count-down-list{margin-left:-0px !important;margin-right:-0px !important;margin-bottom:0px !important;margin-top:0px !important;display:inline-flex;flex-wrap:nowrap;align-items:center;justify-content:flex-start !important;column-gap:0px;--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.s-basket-gap-card-offer .s-count-down-list:where([dir="ltr"],[dir="ltr"] *){flex-direction:row-reverse !important}.s-basket-gap-card-offer .s-count-down-list:where([dir="rtl"],[dir="rtl"] *){flex-direction:row !important}.s-basket-gap-card-offer .s-count-down-item{position:relative !important;margin-left:0px !important;margin-right:0px !important;display:inline-flex !important;width:auto !important;flex:none !important;flex-grow:0 !important;flex-direction:row !important;align-items:center !important;justify-content:center !important;padding-top:0px !important;padding-bottom:0px !important;padding-left:0px !important;padding-right:0px !important;font-size:12px !important;font-weight:700 !important;line-height:1 !important;--tw-text-opacity:1 !important;color:rgb(21 128 61 / var(--tw-text-opacity, 1)) !important}.s-basket-gap-card-offer .s-count-down-item-value{display:inline-block !important;width:2ch !important;min-width:2ch !important;text-align:center;--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction);line-height:1}.s-basket-gap-card-offer .s-count-down-item-label{display:none}.s-basket-gap-entry .s-basket-gap-card-offer.s-basket-gap-card-offer .s-count-down-item::before{content:none !important}.s-basket-gap-entry .s-basket-gap-card-offer.s-basket-gap-card-offer .s-count-down-item::after{content:none !important;position:static;left:auto;right:auto;transform:none}[dir=\'rtl\'] .s-basket-gap-entry .s-basket-gap-card-offer.s-basket-gap-card-offer .s-count-down-item:not(:last-child)::after{content:\':\' !important;position:static;left:auto;right:auto;transform:none;margin-left:0.15rem;margin-right:0.15rem;color:#15803d;font-size:12px;font-weight:700;line-height:1}[dir=\'ltr\'] .s-basket-gap-entry .s-basket-gap-card-offer.s-basket-gap-card-offer .s-count-down-item:not(:first-child)::after{content:\':\' !important;position:static;left:auto;right:auto;transform:none;margin-left:0.15rem;margin-right:0.15rem;color:#15803d;font-size:12px;font-weight:700;line-height:1}.s-basket-gap-card-btn{flex-shrink:0}.s-basket-gap-card-btn salla-button .s-button-btn{border-radius:var(--s-radius, 0.25rem);border-width:1px !important;border-color:var(--color-primary) !important;background-color:transparent !important;color:var(--color-primary) !important}.s-basket-gap-card-btn salla-button .s-button-btn:hover{background-color:var(--color-primary) !important;--tw-text-opacity:1 !important;color:rgb(255 255 255 / var(--tw-text-opacity, 1)) !important}.s-basket-gap-card-btn salla-button .s-button-loader:before{border-top-color:var(--color-primary) !important;border-left-color:var(--color-primary) !important;border-bottom-color:rgb(243 244 246 / var(--tw-border-opacity, 1)) !important;--tw-border-opacity:1 !important;border-right-color:rgb(243 244 246 / var(--tw-border-opacity, 1)) !important}.s-basket-gap-skeleton{display:flex;flex-direction:column;gap:0.75rem}.s-basket-gap-skeleton-card{display:flex;align-items:center;gap:0.75rem;padding-top:0.75rem;padding-bottom:0.75rem}.s-basket-gap-skeleton-info{display:flex;flex:1 1 0%;flex-direction:column;gap:0.5rem}';export{s as salla_basket_gap}
4
+ import{r as t,h as a,H as e,a as r}from"./p-Z_0e-eaG.js";import{f as i}from"./p-DIAyA5MP.js";const s=class{constructor(a){t(this,a),this.limit=10,this.products=[],this.isLoading=!0,this.canRender=!0,this.title="",this.addToCartLabel="",this.weightLabel="",this.discountLabel="",this.placeholder="",this.fetchGeneration=0,this.isSyncingCart=!1,this.requestId=null,this.listViewTracked=!1,this.lastListViewedKey="",this.cartItemChangedHandler=t=>{const a=t?.data?.cart?.items??[],e=a.map((t=>String(t.product_id))).filter(Boolean);this.syncCartItemsDom(a),this.fetchRecommendations(e)},this.beforeAddItemHandler=t=>{const a=String(t?.id??"");a&&this.products.some((t=>String(t.id)===a))&&salla.cart?.api&&(salla.cart.api.addToCartSource="basket_gap")},this.addButtonSuccessHandler=t=>{const a=t?.target?.getAttribute?.("product-id");if(!a)return;const e=this.products.find((t=>String(t.id)===String(a)));if(!e)return;const r=t?.detail?.data?.items??[],i=r.find((t=>String(t.product_id)===String(e.id)))??r.slice(-1)[0];salla.event.emit("salla-basket-gap::product.added",[{product:e,position:this.products.indexOf(e)+1,cartItem:i,cartId:t?.detail?.data?.id,source:"basket_gap",request_id:this.requestId}])},salla.lang.onLoaded((()=>{this.title=salla.lang.get("pages.cart.basket_gap_title"),this.addToCartLabel=salla.lang.get("pages.cart.add_to_cart"),this.weightLabel=salla.lang.get("pages.products.weight"),this.discountLabel=salla.lang.get("pages.products.discount")}))}componentWillLoad(){salla.onReady().then((()=>{if(!salla.config.get("store.settings.cart.basket_gap"))return this.canRender=!1,void(this.isLoading=!1);this.title=salla.lang.get("pages.cart.basket_gap_title"),this.addToCartLabel=salla.lang.get("pages.cart.add_to_cart"),this.weightLabel=salla.lang.get("pages.products.weight"),this.discountLabel=salla.lang.get("pages.products.discount"),this.placeholder=salla.url.asset(salla.config.get("theme.settings.placeholder"));const t=salla.storage.get("cart"),a=(t?.items??[]).map((t=>String(t.product_id))).filter(Boolean);return a.length?this.fetchRecommendations(a):salla.api.cart.details().then((({data:{cart:t}})=>{const a=(t?.items??[]).map((t=>String(t.product_id))).filter(Boolean);return this.fetchRecommendations(a)})).catch((()=>{this.canRender=!1,this.isLoading=!1}))}))}componentDidLoad(){this.positionUnderCartItems()}componentDidUpdate(){document.lazyLoadInstance?.update(this.host.querySelectorAll(".lazy")),this.positionUnderCartItems()}componentDidRender(){if(!this.products.length||this.listViewTracked||this.intersectionObserver)return;const t=new IntersectionObserver((a=>{this.intersectionObserver===t&&a.some((t=>t.isIntersecting))&&(this.listViewTracked=!0,t.disconnect(),this.intersectionObserver=void 0,this.emitListViewed())}),{threshold:.1});this.intersectionObserver=t,t.observe(this.host)}emitListViewed(){const t=this.products.map((t=>t.id)).join(",");t!==this.lastListViewedKey&&(this.lastListViewedKey=t,salla.event.emit("salla-basket-gap::list.viewed",{products:this.products,source:"basket_gap",request_id:this.requestId}))}handleCardClick(t,a){const e=t.target;"function"==typeof e?.closest&&e.closest("a[href]")&&this.emitProductClicked(a)}emitProductClicked(t){salla.event.emit("salla-basket-gap::product.clicked",[{product:t,position:this.products.indexOf(t)+1,source:"basket_gap",request_id:this.requestId}])}getCartItemForms(t=document){return Array.from(t.querySelectorAll('form[id^="item-"]')).filter((t=>!t.closest(".cart-options")))}positionUnderCartItems(){const t=this.getCartItemForms(),a=t[t.length-1];a&&a.nextElementSibling!==this.host&&a.after(this.host)}syncCartItemsDom(t){t?.length&&!this.isSyncingCart&&t.filter((t=>!document.getElementById("item-"+t.id))).length&&(this.isSyncingCart=!0,fetch(window.location.href,{headers:{"X-Requested-With":"XMLHttpRequest"},credentials:"same-origin"}).then((t=>t.text())).then((t=>{const a=(new DOMParser).parseFromString(t,"text/html"),e=this.getCartItemForms(a),r=this.getCartItemForms();if(!e.length||!r.length)return;const i=r[0],s=i.parentElement;s&&(e.forEach((t=>{s.insertBefore(document.importNode(t,!0),i)})),r.forEach((t=>t.remove())),document.lazyLoadInstance?.update?.(),this.positionUnderCartItems())})).catch((()=>{})).finally((()=>{this.isSyncingCart=!1})))}connectedCallback(){salla.event.on("cart::item.added",this.cartItemChangedHandler),salla.event.on("cart::item.deleted",this.cartItemChangedHandler),salla.event.on("cart::before.add.item",this.beforeAddItemHandler),this.host.addEventListener("success",this.addButtonSuccessHandler)}disconnectedCallback(){this.intersectionObserver?.disconnect(),this.intersectionObserver=void 0,salla.event.off("cart::item.added",this.cartItemChangedHandler),salla.event.off("cart::item.deleted",this.cartItemChangedHandler),salla.event.off("cart::before.add.item",this.beforeAddItemHandler),this.host.removeEventListener("success",this.addButtonSuccessHandler)}getCartProductIds(t){if(t?.length)return new Set(t);const a=salla.storage.get("cart");return new Set((a?.items??[]).map((t=>String(t.product_id))).filter(Boolean))}fetchRecommendations(t){if(!t.length)return this.canRender=!1,this.isLoading=!1,Promise.resolve();const a=++this.fetchGeneration;return i(t).then((e=>{if(a!==this.fetchGeneration)return;const r=e._requestId||null,i=this.getCartProductIds(t),s=e.filter((t=>!i.has(t)));if(s.length)return this.fetchProducts(s.slice(0,this.limit),a,r);this.canRender=!1})).catch((()=>{a===this.fetchGeneration&&(this.canRender=!1)})).finally((()=>{a===this.fetchGeneration&&(this.isLoading=!1)}))}fetchProducts(t,a,e=null){return salla.api.withoutNotifier((()=>salla.product.api.fetch({source:"selected",source_value:t,limit:this.limit}))).then((t=>{a===this.fetchGeneration&&(this.products=t?.data??[],this.requestId=e,this.listViewTracked=!1,this.intersectionObserver?.disconnect(),this.intersectionObserver=void 0,this.canRender=this.products.length>0)})).catch((()=>{a===this.fetchGeneration&&(this.canRender=!1)}))}getDiscountLabel(t){if(t.promotion_title)return t.promotion_title;if(t.is_on_sale&&t.regular_price>0&&t.sale_price>0){const a=Math.round(100*(1-t.sale_price/t.regular_price));return a>0?`${this.discountLabel} ${a}%`:null}return null}formatDate(t){const a=new Date(1e3*t),e=String(a.getMonth()+1).padStart(2,"0"),r=String(a.getDate()).padStart(2,"0");return`${a.getFullYear()}-${e}-${r}`}getSkeletonView(){return a(e,{class:"s-basket-gap-entry"},a("div",{class:"s-basket-gap-skeleton"},a("salla-skeleton",{height:"16px",width:"40%",style:{marginBottom:"16px"}}),Array(3).fill(null).map(((t,e)=>a("div",{key:e,class:"s-basket-gap-skeleton-card"},a("salla-skeleton",{height:"64px",width:"64px",style:{borderRadius:"8px",flexShrink:"0"}}),a("div",{class:"s-basket-gap-skeleton-info"},a("salla-skeleton",{height:"14px",width:"50%"}),a("salla-skeleton",{height:"12px",width:"25%",style:{marginTop:"6px"}}),a("salla-skeleton",{height:"10px",width:"35%",style:{marginTop:"4px"}})),a("salla-skeleton",{height:"36px",width:"100px",style:{borderRadius:"6px",flexShrink:"0",marginInlineStart:"auto"}}))))))}getProductCard(t){const e=this.getDiscountLabel(t);return a("div",{key:t.id,class:"s-basket-gap-card",onClick:a=>this.handleCardClick(a,t)},a("a",{href:t.url,class:"s-basket-gap-card-image"},a("img",{class:"lazy",src:this.placeholder,"data-src":t.image?.url,alt:t.image?.alt||t.name})),a("div",{class:"s-basket-gap-card-info"},a("h3",{class:"s-basket-gap-card-name"},a("a",{href:t.url},t.name)),t.is_on_sale?a("div",{class:"s-basket-gap-card-sale-price"},a("span",{innerHTML:salla.money(t.sale_price)}),a("del",{innerHTML:salla.money(t.regular_price)})):a("span",{class:"s-basket-gap-card-price",innerHTML:salla.money(t.price)}),t.weight_label&&a("span",{class:"s-basket-gap-card-weight"},this.weightLabel," ",t.weight_label)),a("div",{class:"s-basket-gap-card-actions"},(t.promotion_title||t.discount_ends||t.is_on_sale)&&a("div",{class:"s-basket-gap-card-offer"},a("i",{class:"sicon-gift"}),e&&a("span",null,e),t.discount_ends&&[a("salla-count-down",{date:this.formatDate(t.discount_ends),"end-of-day":!0,digits:"en","auto-segments":!0}),a("i",{class:"sicon-alarm"})]),a("salla-add-product-button",{class:"s-basket-gap-card-btn","product-id":t.id,"product-status":t.status,"product-type":t.type},this.addToCartLabel)))}render(){return this.canRender?this.isLoading?this.getSkeletonView():this.products.length?a(e,{class:"s-basket-gap-entry"},this.title&&a("h2",{class:"s-basket-gap-title"},this.title),a("div",{class:"s-basket-gap-list"},this.products.map((t=>this.getProductCard(t))))):null:null}get host(){return r(this)}};s.style='/*!twlt*/:host{display:block}.block{display:block}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-basket-gap-entry{margin-top:1.25rem;margin-bottom:1.25rem;display:block;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:1.25rem}.s-basket-gap-title{margin-bottom:1rem;font-size:1.125rem;line-height:1.75rem;font-weight:700}.s-basket-gap-list{display:flex;flex-direction:column}.s-basket-gap-list>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse));--tw-divide-opacity:1;border-color:rgb(243 244 246 / var(--tw-divide-opacity, 1))}.s-basket-gap-card{display:flex;flex-wrap:wrap;align-items:center;column-gap:0.75rem;row-gap:0.625rem;padding-top:1rem;padding-bottom:1rem}.s-basket-gap-card-image{height:4rem;width:4rem;flex-shrink:0;overflow:hidden;border-radius:0.375rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.s-basket-gap-card-image img{height:100%;width:100%;object-fit:cover}.s-basket-gap-card-info{display:flex;min-width:0px;flex:1 1 0%;flex-direction:column;gap:0.25rem}.s-basket-gap-card-actions{display:flex;width:100%;align-items:center;justify-content:flex-end;gap:0.5rem}@media (min-width: 640px){.s-basket-gap-card-actions{width:auto}}.s-basket-gap-card-name{font-size:0.875rem;line-height:1.25rem;font-weight:600;line-height:1.25;--tw-text-opacity:1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.s-basket-gap-card-name a:hover{color:var(--color-primary)}.s-basket-gap-card-price{font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-basket-gap-card-sale-price{display:flex;align-items:center;gap:0.5rem}.s-basket-gap-card-sale-price span{font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.s-basket-gap-card-sale-price del{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1));text-decoration-line:line-through}.s-basket-gap-card-weight{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-basket-gap-card-offer{display:flex;flex-shrink:0;align-items:center;gap:0.25rem;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1));padding-left:9px;padding-right:9px;padding-top:3px;padding-bottom:3px;font-size:11px;font-weight:500;--tw-text-opacity:1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.s-basket-gap-card-offer i{font-size:0.75rem;line-height:1rem}.s-basket-gap-card-offer span{font-weight:700;--tw-text-opacity:1 !important;color:rgb(31 41 55 / var(--tw-text-opacity, 1)) !important}.s-basket-gap-card-offer salla-count-down{flex-shrink:0}.s-basket-gap-card-offer salla-count-down:where([dir="ltr"],[dir="ltr"] *){margin-inline-start:0.25rem}.s-basket-gap-card-offer salla-count-down:where([dir="rtl"],[dir="rtl"] *){margin-inline-end:0.25rem}.s-basket-gap-card-offer .s-count-down-list{margin-left:-0px !important;margin-right:-0px !important;margin-bottom:0px !important;margin-top:0px !important;display:inline-flex;flex-wrap:nowrap;align-items:center;justify-content:flex-start !important;column-gap:0px;--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.s-basket-gap-card-offer .s-count-down-list:where([dir="ltr"],[dir="ltr"] *){flex-direction:row-reverse !important}.s-basket-gap-card-offer .s-count-down-list:where([dir="rtl"],[dir="rtl"] *){flex-direction:row !important}.s-basket-gap-card-offer .s-count-down-item{position:relative !important;margin-left:0px !important;margin-right:0px !important;display:inline-flex !important;width:auto !important;flex:none !important;flex-grow:0 !important;flex-direction:row !important;align-items:center !important;justify-content:center !important;padding-top:0px !important;padding-bottom:0px !important;padding-left:0px !important;padding-right:0px !important;font-size:12px !important;font-weight:700 !important;line-height:1 !important;--tw-text-opacity:1 !important;color:rgb(21 128 61 / var(--tw-text-opacity, 1)) !important}.s-basket-gap-card-offer .s-count-down-item-value{display:inline-block !important;width:2ch !important;min-width:2ch !important;text-align:center;--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction);line-height:1}.s-basket-gap-card-offer .s-count-down-item-label{display:none}.s-basket-gap-entry .s-basket-gap-card-offer.s-basket-gap-card-offer .s-count-down-item::before{content:none !important}.s-basket-gap-entry .s-basket-gap-card-offer.s-basket-gap-card-offer .s-count-down-item::after{content:none !important;position:static;left:auto;right:auto;transform:none}[dir=\'rtl\'] .s-basket-gap-entry .s-basket-gap-card-offer.s-basket-gap-card-offer .s-count-down-item:not(:last-child)::after{content:\':\' !important;position:static;left:auto;right:auto;transform:none;margin-left:0.15rem;margin-right:0.15rem;color:#15803d;font-size:12px;font-weight:700;line-height:1}[dir=\'ltr\'] .s-basket-gap-entry .s-basket-gap-card-offer.s-basket-gap-card-offer .s-count-down-item:not(:first-child)::after{content:\':\' !important;position:static;left:auto;right:auto;transform:none;margin-left:0.15rem;margin-right:0.15rem;color:#15803d;font-size:12px;font-weight:700;line-height:1}.s-basket-gap-card-btn{flex-shrink:0}.s-basket-gap-card-btn salla-button .s-button-btn{border-radius:var(--s-radius, 0.25rem);border-width:1px !important;border-color:var(--color-primary) !important;background-color:transparent !important;color:var(--color-primary) !important}.s-basket-gap-card-btn salla-button .s-button-btn:hover{background-color:var(--color-primary) !important;--tw-text-opacity:1 !important;color:rgb(255 255 255 / var(--tw-text-opacity, 1)) !important}.s-basket-gap-card-btn salla-button .s-button-loader:before{border-top-color:var(--color-primary) !important;border-left-color:var(--color-primary) !important;border-bottom-color:rgb(243 244 246 / var(--tw-border-opacity, 1)) !important;--tw-border-opacity:1 !important;border-right-color:rgb(243 244 246 / var(--tw-border-opacity, 1)) !important}.s-basket-gap-skeleton{display:flex;flex-direction:column;gap:0.75rem}.s-basket-gap-skeleton-card{display:flex;align-items:center;gap:0.75rem;padding-top:0.75rem;padding-bottom:0.75rem}.s-basket-gap-skeleton-info{display:flex;flex:1 1 0%;flex-direction:column;gap:0.5rem}';export{s as salla_basket_gap}