@salla.sa/twilight-components 2.14.448 → 2.14.449

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 (305) hide show
  1. package/dist/cjs/{filepond-xdMsJQmk.js → filepond-f9KbKIYn.js} +1 -1
  2. package/dist/cjs/{filepond-plugin-file-poster-eC1dn4xl.js → filepond-plugin-file-poster-BSdUMAjs.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-validate-size-_2IuCCff.js → filepond-plugin-file-validate-size-YLL5nfmo.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-type-BL0DbAnh.js → filepond-plugin-file-validate-type-DnRb2szA.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-image-edit-CgKir2xD.js → filepond-plugin-image-edit-BDCQgpe-.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-exif-orientation-syoj1Juw.js → filepond-plugin-image-exif-orientation-CDJWoL6I.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-preview-B3kAVSrA.js → filepond-plugin-image-preview-1OlWyiTm.js} +1 -1
  8. package/dist/cjs/{functions-B2luUM6v.js → functions-BZosuGw4.js} +1 -1
  9. package/dist/cjs/{index-uoA36zqH.js → index-C7gO-zm5.js} +2 -2
  10. package/dist/cjs/{index-BMR8pPXK.js → index-Dj3X-WjA.js} +1 -1
  11. package/dist/cjs/loader.cjs.js +1 -1
  12. package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
  13. package/dist/cjs/salla-accordion_6.cjs.entry.js +51 -14
  14. package/dist/cjs/salla-add-product-button_5.cjs.entry.js +1 -1
  15. package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
  16. package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
  17. package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
  18. package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
  19. package/dist/cjs/salla-badge.cjs.entry.js +1 -1
  20. package/dist/cjs/salla-booking-field_7.cjs.entry.js +10 -10
  21. package/dist/cjs/salla-bullet-delivery_2.cjs.entry.js +1 -1
  22. package/dist/cjs/salla-cart-coupons.cjs.entry.js +1 -1
  23. package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
  24. package/dist/cjs/salla-cashback-banner.cjs.entry.js +1 -1
  25. package/dist/cjs/salla-comment-form_8.cjs.entry.js +1 -1
  26. package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
  27. package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
  28. package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
  29. package/dist/cjs/salla-count-down.cjs.entry.js +1 -1
  30. package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
  31. package/dist/cjs/salla-delivery-promise.cjs.entry.js +1 -1
  32. package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
  33. package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
  34. package/dist/cjs/salla-filters.cjs.entry.js +1 -1
  35. package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
  36. package/dist/cjs/salla-gifting.cjs.entry.js +1 -1
  37. package/dist/cjs/salla-hook.cjs.entry.js +1 -1
  38. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +1 -1
  39. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  40. package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
  41. package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
  42. package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
  43. package/dist/cjs/salla-loyalty-banner.cjs.entry.js +2 -2
  44. package/dist/cjs/salla-loyalty-hero_2.cjs.entry.js +2 -2
  45. package/dist/cjs/salla-loyalty-panel.cjs.entry.js +3 -3
  46. package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
  47. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
  48. package/dist/cjs/salla-loyalty-program.cjs.entry.js +3 -3
  49. package/dist/cjs/salla-loyalty-reward.cjs.entry.js +2 -2
  50. package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
  51. package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
  52. package/dist/cjs/salla-map.cjs.entry.js +1 -1
  53. package/dist/cjs/salla-menu.cjs.entry.js +1 -1
  54. package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
  55. package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
  56. package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
  57. package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
  58. package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
  59. package/dist/cjs/salla-notification-item.cjs.entry.js +1 -1
  60. package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
  61. package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
  62. package/dist/cjs/salla-offer.cjs.entry.js +1 -1
  63. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
  64. package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
  65. package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
  66. package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
  67. package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
  68. package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
  69. package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
  70. package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
  71. package/dist/cjs/salla-orders.cjs.entry.js +1 -1
  72. package/dist/cjs/salla-payments.cjs.entry.js +1 -1
  73. package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
  74. package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
  75. package/dist/cjs/salla-product-card-embed.cjs.entry.js +1 -1
  76. package/dist/cjs/salla-product-card_2.cjs.entry.js +1 -1
  77. package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
  78. package/dist/cjs/salla-products-list.cjs.entry.js +1 -1
  79. package/dist/cjs/salla-progress-bar.cjs.entry.js +1 -1
  80. package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
  81. package/dist/cjs/salla-rating-modal.cjs.entry.js +1 -1
  82. package/dist/cjs/salla-reward-action_4.cjs.entry.js +3 -3
  83. package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
  84. package/dist/cjs/salla-search.cjs.entry.js +1 -1
  85. package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
  86. package/dist/cjs/salla-slider.cjs.entry.js +1 -1
  87. package/dist/cjs/salla-social-share.cjs.entry.js +1 -1
  88. package/dist/cjs/salla-social.cjs.entry.js +1 -1
  89. package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
  90. package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
  91. package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
  92. package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
  93. package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
  94. package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
  95. package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
  96. package/dist/cjs/salla-verify.cjs.entry.js +1 -1
  97. package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
  98. package/dist/cjs/{tracked-promise-CVeKKQ0b.js → tracked-promise-CMALwoa6.js} +1 -1
  99. package/dist/cjs/twilight.cjs.js +1 -1
  100. package/dist/cjs/{vanilla-picker-jTWa07cO.js → vanilla-picker-BEliYBNM.js} +1 -1
  101. package/dist/collection/components/salla-breadcrumb/salla-breadcrumb.js +50 -13
  102. package/dist/components/index.js +2 -2
  103. package/dist/components/salla-breadcrumb.js +50 -13
  104. package/dist/esm/{filepond-BbuLIuP0.js → filepond-CDpPHT7z.js} +1 -1
  105. package/dist/esm/{filepond-plugin-file-poster-DlDdJpXD.js → filepond-plugin-file-poster-BOtfCgt6.js} +1 -1
  106. package/dist/esm/{filepond-plugin-file-validate-size-BYkUUSGJ.js → filepond-plugin-file-validate-size--uO_3T9g.js} +1 -1
  107. package/dist/esm/{filepond-plugin-file-validate-type-Cz9XrV5V.js → filepond-plugin-file-validate-type-DnJbL2zb.js} +1 -1
  108. package/dist/esm/{filepond-plugin-image-edit-CpEK0C8_.js → filepond-plugin-image-edit-CjUUwl1o.js} +1 -1
  109. package/dist/esm/{filepond-plugin-image-exif-orientation-D6RHOJuD.js → filepond-plugin-image-exif-orientation-DkjfYMVD.js} +1 -1
  110. package/dist/esm/{filepond-plugin-image-preview-D6ZgXCUp.js → filepond-plugin-image-preview-3LlHu8_B.js} +1 -1
  111. package/dist/esm/{functions-BwIeBNND.js → functions-BQD6jHG4.js} +1 -1
  112. package/dist/esm/{index-CETV5IHH.js → index-B5mrC7UX.js} +1 -1
  113. package/dist/esm/{index-BHYtfMwX.js → index-CFtXUFT2.js} +2 -2
  114. package/dist/esm/loader.js +2 -2
  115. package/dist/esm/salla-accordion-body_2.entry.js +1 -1
  116. package/dist/esm/salla-accordion_6.entry.js +51 -14
  117. package/dist/esm/salla-add-product-button_5.entry.js +1 -1
  118. package/dist/esm/salla-advertisement.entry.js +1 -1
  119. package/dist/esm/salla-alert_2.entry.js +1 -1
  120. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  121. package/dist/esm/salla-apps-icons.entry.js +1 -1
  122. package/dist/esm/salla-badge.entry.js +1 -1
  123. package/dist/esm/salla-booking-field_7.entry.js +10 -10
  124. package/dist/esm/salla-bullet-delivery_2.entry.js +1 -1
  125. package/dist/esm/salla-cart-coupons.entry.js +1 -1
  126. package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
  127. package/dist/esm/salla-cashback-banner.entry.js +1 -1
  128. package/dist/esm/salla-comment-form_8.entry.js +1 -1
  129. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  130. package/dist/esm/salla-contacts.entry.js +1 -1
  131. package/dist/esm/salla-cookies-bar.entry.js +1 -1
  132. package/dist/esm/salla-count-down.entry.js +1 -1
  133. package/dist/esm/salla-custom-fields.entry.js +1 -1
  134. package/dist/esm/salla-delivery-promise.entry.js +1 -1
  135. package/dist/esm/salla-edit-order-button.entry.js +1 -1
  136. package/dist/esm/salla-filters-widget.entry.js +1 -1
  137. package/dist/esm/salla-filters.entry.js +1 -1
  138. package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
  139. package/dist/esm/salla-gifting.entry.js +1 -1
  140. package/dist/esm/salla-hook.entry.js +1 -1
  141. package/dist/esm/salla-infinite-scroll.entry.js +1 -1
  142. package/dist/esm/salla-installment.entry.js +1 -1
  143. package/dist/esm/salla-list-tile.entry.js +1 -1
  144. package/dist/esm/salla-localization-modal.entry.js +1 -1
  145. package/dist/esm/salla-login-modal.entry.js +1 -1
  146. package/dist/esm/salla-loyalty-banner.entry.js +2 -2
  147. package/dist/esm/salla-loyalty-hero_2.entry.js +2 -2
  148. package/dist/esm/salla-loyalty-panel.entry.js +3 -3
  149. package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
  150. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  151. package/dist/esm/salla-loyalty-program.entry.js +3 -3
  152. package/dist/esm/salla-loyalty-reward.entry.js +2 -2
  153. package/dist/esm/salla-loyalty.entry.js +1 -1
  154. package/dist/esm/salla-maintenance-alert.entry.js +1 -1
  155. package/dist/esm/salla-map.entry.js +1 -1
  156. package/dist/esm/salla-menu.entry.js +1 -1
  157. package/dist/esm/salla-metadata.entry.js +1 -1
  158. package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
  159. package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
  160. package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
  161. package/dist/esm/salla-next-order-coupon.entry.js +1 -1
  162. package/dist/esm/salla-notification-item.entry.js +1 -1
  163. package/dist/esm/salla-notifications.entry.js +1 -1
  164. package/dist/esm/salla-offer-modal.entry.js +1 -1
  165. package/dist/esm/salla-offer.entry.js +1 -1
  166. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
  167. package/dist/esm/salla-order-details-options.entry.js +1 -1
  168. package/dist/esm/salla-order-details.entry.js +1 -1
  169. package/dist/esm/salla-order-edit-item.entry.js +1 -1
  170. package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
  171. package/dist/esm/salla-order-edit.entry.js +1 -1
  172. package/dist/esm/salla-order-summary.entry.js +1 -1
  173. package/dist/esm/salla-order-totals-card.entry.js +1 -1
  174. package/dist/esm/salla-orders.entry.js +1 -1
  175. package/dist/esm/salla-payments.entry.js +1 -1
  176. package/dist/esm/salla-placeholder.entry.js +1 -1
  177. package/dist/esm/salla-price-range.entry.js +1 -1
  178. package/dist/esm/salla-product-card-embed.entry.js +1 -1
  179. package/dist/esm/salla-product-card_2.entry.js +1 -1
  180. package/dist/esm/salla-product-size-guide.entry.js +1 -1
  181. package/dist/esm/salla-products-list.entry.js +1 -1
  182. package/dist/esm/salla-progress-bar.entry.js +1 -1
  183. package/dist/esm/salla-quick-order.entry.js +1 -1
  184. package/dist/esm/salla-rating-modal.entry.js +1 -1
  185. package/dist/esm/salla-reward-action_4.entry.js +3 -3
  186. package/dist/esm/salla-scopes.entry.js +1 -1
  187. package/dist/esm/salla-search.entry.js +1 -1
  188. package/dist/esm/salla-skeleton.entry.js +1 -1
  189. package/dist/esm/salla-slider.entry.js +1 -1
  190. package/dist/esm/salla-social-share.entry.js +1 -1
  191. package/dist/esm/salla-social.entry.js +1 -1
  192. package/dist/esm/salla-tab-content_3.entry.js +1 -1
  193. package/dist/esm/salla-tiered-offer.entry.js +1 -1
  194. package/dist/esm/salla-tooltip.entry.js +1 -1
  195. package/dist/esm/salla-trust-badges.entry.js +1 -1
  196. package/dist/esm/salla-user-menu.entry.js +1 -1
  197. package/dist/esm/salla-user-profile.entry.js +1 -1
  198. package/dist/esm/salla-user-settings.entry.js +1 -1
  199. package/dist/esm/salla-verify.entry.js +1 -1
  200. package/dist/esm/salla-wallet.entry.js +1 -1
  201. package/dist/esm/{tracked-promise-p8K_AJAQ.js → tracked-promise-7zOvv3M6.js} +1 -1
  202. package/dist/esm/twilight.js +2 -2
  203. package/dist/esm/{vanilla-picker-CwN-g5m_.js → vanilla-picker-yptjYbav.js} +1 -1
  204. package/dist/twilight/{p-6d000a1b.entry.js → p-00c80ce0.entry.js} +1 -1
  205. package/dist/twilight/{p-7c348484.entry.js → p-03aed385.entry.js} +1 -1
  206. package/dist/twilight/{p-c651f264.entry.js → p-0f7f0c9a.entry.js} +1 -1
  207. package/dist/twilight/{p-b9126729.entry.js → p-10adfec3.entry.js} +1 -1
  208. package/dist/twilight/{p-c3703ca3.entry.js → p-10f3641c.entry.js} +1 -1
  209. package/dist/twilight/{p-64cc4267.entry.js → p-121ca1bf.entry.js} +1 -1
  210. package/dist/twilight/{p-5031ae92.entry.js → p-187ddba3.entry.js} +1 -1
  211. package/dist/twilight/{p-1d5459db.entry.js → p-210b5cd5.entry.js} +1 -1
  212. package/dist/twilight/{p-ed91eae0.entry.js → p-2174a8e6.entry.js} +1 -1
  213. package/dist/twilight/{p-06642c76.entry.js → p-237ae017.entry.js} +1 -1
  214. package/dist/twilight/{p-9fc822b7.entry.js → p-26a0fdd4.entry.js} +1 -1
  215. package/dist/twilight/{p-c3466964.entry.js → p-2a3b2509.entry.js} +1 -1
  216. package/dist/twilight/{p-0ad04ca2.entry.js → p-2b3e3ca7.entry.js} +1 -1
  217. package/dist/twilight/{p-c1fa4ddb.entry.js → p-2bb0e5c5.entry.js} +1 -1
  218. package/dist/twilight/{p-56916095.entry.js → p-31d281ab.entry.js} +1 -1
  219. package/dist/twilight/{p-f06bd0b0.entry.js → p-3a067383.entry.js} +1 -1
  220. package/dist/twilight/{p-734ff28a.entry.js → p-3c328960.entry.js} +1 -1
  221. package/dist/twilight/{p-be8ac1a3.entry.js → p-3c479c07.entry.js} +1 -1
  222. package/dist/twilight/{p-3ce5738a.entry.js → p-3db06266.entry.js} +1 -1
  223. package/dist/twilight/{p-131ffbcc.entry.js → p-400ecb0a.entry.js} +1 -1
  224. package/dist/twilight/{p-788d2dea.entry.js → p-469c8350.entry.js} +1 -1
  225. package/dist/twilight/{p-BNaQSz6t.js → p-4HuZkmYv.js} +1 -1
  226. package/dist/twilight/{p-d25cd2ed.entry.js → p-52dada7c.entry.js} +1 -1
  227. package/dist/twilight/{p-cd48d7aa.entry.js → p-536d29ce.entry.js} +1 -1
  228. package/dist/twilight/{p-7cfef393.entry.js → p-54d8c2ca.entry.js} +1 -1
  229. package/dist/twilight/{p-86dd66bc.entry.js → p-564d8c45.entry.js} +1 -1
  230. package/dist/twilight/{p-1276ce95.entry.js → p-58face3f.entry.js} +1 -1
  231. package/dist/twilight/{p-2503c3ac.entry.js → p-59337a84.entry.js} +1 -1
  232. package/dist/twilight/{p-3c19f975.entry.js → p-5e1b51dd.entry.js} +1 -1
  233. package/dist/twilight/{p-96c5dcd0.entry.js → p-5e30b0bd.entry.js} +1 -1
  234. package/dist/twilight/{p-e4d102f5.entry.js → p-61269cd6.entry.js} +1 -1
  235. package/dist/twilight/{p-8ece10ce.entry.js → p-6ba1c14e.entry.js} +1 -1
  236. package/dist/twilight/{p-76cf66ad.entry.js → p-6ccdae0e.entry.js} +1 -1
  237. package/dist/twilight/{p-ba28e996.entry.js → p-764f3053.entry.js} +1 -1
  238. package/dist/twilight/{p-8eaa609b.entry.js → p-76bbabcb.entry.js} +1 -1
  239. package/dist/twilight/{p-bcab43fc.entry.js → p-7d3b048e.entry.js} +1 -1
  240. package/dist/twilight/{p-3eab400d.entry.js → p-7fcbc3ef.entry.js} +1 -1
  241. package/dist/twilight/p-8b578d2c.entry.js +4 -0
  242. package/dist/twilight/{p-10b11447.entry.js → p-918178f5.entry.js} +1 -1
  243. package/dist/twilight/{p-b678e909.entry.js → p-947aea47.entry.js} +1 -1
  244. package/dist/twilight/{p-aeaad4b5.entry.js → p-967fbc9c.entry.js} +1 -1
  245. package/dist/twilight/{p-404ac2a7.entry.js → p-97b47164.entry.js} +1 -1
  246. package/dist/twilight/{p-be186489.entry.js → p-99fa8ba6.entry.js} +1 -1
  247. package/dist/twilight/{p-DZivnLbg.js → p-B9HPqa9u.js} +1 -1
  248. package/dist/twilight/{p-2x5YwExe.js → p-BmPGKoL7.js} +1 -1
  249. package/dist/twilight/{p-BHYtfMwX.js → p-CFtXUFT2.js} +1 -1
  250. package/dist/twilight/{p-Cl7SIRPD.js → p-CUBlD0Kt.js} +1 -1
  251. package/dist/twilight/{p-BvqPxWPn.js → p-CsCwHOvQ.js} +2 -2
  252. package/dist/twilight/{p-Bvw0Axx9.js → p-CxOW9p-m.js} +1 -1
  253. package/dist/twilight/{p-lbjqzRH2.js → p-Cz2LJSD1.js} +1 -1
  254. package/dist/twilight/{p-D8Vw7Lrc.js → p-DRqWSUhZ.js} +1 -1
  255. package/dist/twilight/{p-BW6_yrjl.js → p-DVY4bWKx.js} +1 -1
  256. package/dist/twilight/{p-CTAPbMR3.js → p-DZLwjHmr.js} +1 -1
  257. package/dist/twilight/{p-Dvaa0hYf.js → p-Dw1i2i3R.js} +1 -1
  258. package/dist/twilight/{p-adebf2ac.entry.js → p-a19b9fcd.entry.js} +1 -1
  259. package/dist/twilight/{p-8581c249.entry.js → p-a22f93c7.entry.js} +1 -1
  260. package/dist/twilight/{p-2ccb281b.entry.js → p-a2b9f075.entry.js} +1 -1
  261. package/dist/twilight/{p-d03f8ab0.entry.js → p-a4de6d64.entry.js} +1 -1
  262. package/dist/twilight/{p-7b448d5b.entry.js → p-a5f6b737.entry.js} +1 -1
  263. package/dist/twilight/{p-acc76fc8.entry.js → p-a709602c.entry.js} +1 -1
  264. package/dist/twilight/{p-5c009bd1.entry.js → p-a832d2f6.entry.js} +1 -1
  265. package/dist/twilight/{p-13168745.entry.js → p-af8f9d9d.entry.js} +1 -1
  266. package/dist/twilight/{p-c6fe271a.entry.js → p-b04933fd.entry.js} +1 -1
  267. package/dist/twilight/{p-79371f48.entry.js → p-b3123f77.entry.js} +1 -1
  268. package/dist/twilight/{p-a52dd6b4.entry.js → p-b4108a9a.entry.js} +1 -1
  269. package/dist/twilight/{p-1d25ae1c.entry.js → p-b5184ea5.entry.js} +1 -1
  270. package/dist/twilight/{p-a1c7f1b1.entry.js → p-b57b8cae.entry.js} +1 -1
  271. package/dist/twilight/{p-d26e0eae.entry.js → p-b5bf31c8.entry.js} +1 -1
  272. package/dist/twilight/{p-b6f3083c.entry.js → p-b96744fc.entry.js} +1 -1
  273. package/dist/twilight/{p-47b4f13c.entry.js → p-bcbb8488.entry.js} +1 -1
  274. package/dist/twilight/{p-cc618f38.entry.js → p-bf4257bb.entry.js} +1 -1
  275. package/dist/twilight/{p-0f70ef8d.entry.js → p-bf76d88f.entry.js} +1 -1
  276. package/dist/twilight/{p-20e1f5b9.entry.js → p-c0491160.entry.js} +1 -1
  277. package/dist/twilight/{p-f67dd591.entry.js → p-c24749d7.entry.js} +1 -1
  278. package/dist/twilight/{p-0b271cf4.entry.js → p-c2fa334e.entry.js} +1 -1
  279. package/dist/twilight/{p-017e3198.entry.js → p-c4f9029a.entry.js} +1 -1
  280. package/dist/twilight/{p-202fcfc6.entry.js → p-c6ed7a7f.entry.js} +1 -1
  281. package/dist/twilight/{p-23aabd1c.entry.js → p-c79ac487.entry.js} +1 -1
  282. package/dist/twilight/{p-4bca0fab.entry.js → p-c987e5c4.entry.js} +1 -1
  283. package/dist/twilight/{p-f8369073.entry.js → p-ca38de68.entry.js} +1 -1
  284. package/dist/twilight/{p-0b8706e7.entry.js → p-cc06234d.entry.js} +1 -1
  285. package/dist/twilight/{p-cd2c961c.entry.js → p-d4db02e7.entry.js} +1 -1
  286. package/dist/twilight/{p-1786ed83.entry.js → p-d69b9a02.entry.js} +1 -1
  287. package/dist/twilight/{p-87063cf0.entry.js → p-d8cb14bd.entry.js} +1 -1
  288. package/dist/twilight/{p-d2a76aa4.entry.js → p-d8d6f688.entry.js} +1 -1
  289. package/dist/twilight/{p-a8ce09a0.entry.js → p-dad1b803.entry.js} +1 -1
  290. package/dist/twilight/{p-44215d1e.entry.js → p-dfd0bf16.entry.js} +1 -1
  291. package/dist/twilight/{p-df48debf.entry.js → p-e1b2f1cd.entry.js} +1 -1
  292. package/dist/twilight/{p-002505b9.entry.js → p-e89bfadd.entry.js} +1 -1
  293. package/dist/twilight/{p-6346f1bd.entry.js → p-eabd1eef.entry.js} +1 -1
  294. package/dist/twilight/{p-0a1a41e9.entry.js → p-eb2e5d15.entry.js} +1 -1
  295. package/dist/twilight/{p-0b3ca129.entry.js → p-effe5301.entry.js} +1 -1
  296. package/dist/twilight/{p-02af1d80.entry.js → p-f31595be.entry.js} +1 -1
  297. package/dist/twilight/{p-4cf98844.entry.js → p-f92040a1.entry.js} +1 -1
  298. package/dist/twilight/{p-02de8869.entry.js → p-fab8d485.entry.js} +1 -1
  299. package/dist/twilight/{p-fb6fea7a.entry.js → p-fbdf7bc2.entry.js} +1 -1
  300. package/dist/twilight/{p-752a8211.entry.js → p-fc49d9c6.entry.js} +1 -1
  301. package/dist/twilight/{p-6f3cce79.entry.js → p-fe8417b0.entry.js} +1 -1
  302. package/dist/twilight/twilight.esm.js +1 -1
  303. package/dist/types/components/salla-breadcrumb/salla-breadcrumb.d.ts +7 -1
  304. package/package.json +5 -5
  305. package/dist/twilight/p-727b2a97.entry.js +0 -4
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as c,h as l,H as t,a as s}from"./p-BHYtfMwX.js";import{f as i,t as e}from"./p-CO-PeZ27.js";const a=class{constructor(l){c(this,l),this.links=salla.config.get("store.social"),this.iconsList={instagram:'\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>instagram</title>\n<path d="M23 32h-14c-4.971 0-9-4.029-9-9v0-14c0-4.971 4.029-9 9-9v0h14c4.971 0 9 4.029 9 9v0 14c0 4.971-4.029 9-9 9v0zM9 2c-3.866 0-7 3.134-7 7v0 14c0 3.866 3.134 7 7 7v0h14c3.866 0 7-3.134 7-7v0-14c0-3.866-3.134-7-7-7v0zM16 24c-4.418 0-8-3.582-8-8s3.582-8 8-8c4.418 0 8 3.582 8 8v0c0 4.418-3.582 8-8 8v0zM16 10c-3.314 0-6 2.686-6 6s2.686 6 6 6c3.314 0 6-2.686 6-6v0c0-3.314-2.686-6-6-6v0zM25 9c-1.105 0-2-0.895-2-2s0.895-2 2-2c1.105 0 2 0.895 2 2v0c0 1.105-0.895 2-2 2v0zM25 7v0z"></path>\n</svg>\n',twitter:e,facebook:i,youtube:'\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>youtube</title>\n<path d="M16 28c-3.666 0-8.376-0.056-10.29-0.162-0.113 0.010-0.244 0.016-0.376 0.016-1.676 0-3.139-0.91-3.922-2.264l-0.012-0.022c-0.97-1.6-1.4-4.248-1.4-8.558s0.436-6.962 1.412-8.6c0.782-1.36 2.227-2.262 3.883-2.262 0.148 0 0.293 0.007 0.437 0.021l-0.018-0.001c1.872-0.124 6.544-0.168 10.286-0.168s8.4 0.044 10.292 0.168c0.124-0.012 0.267-0.019 0.412-0.019 1.656 0 3.101 0.905 3.866 2.247l0.012 0.022c0.982 1.624 1.418 4.27 1.418 8.582 0 4.338-0.438 6.982-1.422 8.6-0.789 1.364-2.241 2.268-3.904 2.268-0.133 0-0.265-0.006-0.395-0.017l0.017 0.001c-1.926 0.092-6.632 0.148-10.296 0.148zM16 8c-3.712 0-8.334 0.042-10.168 0.164-1.688 0.094-2.14 0.306-2.702 1.268-0.756 1.81-1.195 3.913-1.195 6.119 0 0.51 0.024 1.015 0.069 1.513l-0.005-0.064c-0.042 0.435-0.065 0.941-0.065 1.453 0 2.198 0.438 4.294 1.231 6.205l-0.039-0.107c0.566 0.968 1.022 1.184 2.708 1.296 3.29 0.184 17.022 0.184 20.34 0 1.678-0.11 2.132-0.326 2.684-1.28 0.764-1.803 1.208-3.899 1.208-6.1 0-0.513-0.024-1.020-0.071-1.52l0.005 0.064c0.042-0.436 0.065-0.943 0.065-1.455 0-2.203-0.439-4.303-1.235-6.218l0.040 0.107v-0.016c-0.554-0.958-1-1.17-2.684-1.264-1.862-0.122-6.644-0.164-10.186-0.164zM13 23c-0.552 0-1-0.448-1-1v0-10c0 0 0 0 0 0 0-0.552 0.448-1 1-1 0.196 0 0.38 0.057 0.534 0.154l-0.004-0.002 8 5c0.284 0.18 0.47 0.492 0.47 0.848s-0.186 0.668-0.466 0.846l-0.004 0.002-8 5c-0.15 0.095-0.334 0.152-0.53 0.152 0 0 0 0 0 0v0zM14 13.8v6.4l5.114-3.2z"></path>\n</svg>\n',snapchat:'\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>snapchat</title>\n<path d="M16.186 30h-0.266c-1.843-0.023-3.525-0.693-4.834-1.792l0.012 0.010c-0.476-0.405-1.043-0.72-1.665-0.909l-0.033-0.009c-0.287-0.044-0.617-0.069-0.954-0.069-0.492 0-0.972 0.053-1.434 0.155l0.044-0.008c-0.261 0.061-0.564 0.102-0.875 0.114l-0.009 0c-0.017 0.001-0.036 0.001-0.056 0.001-0.811 0-1.495-0.545-1.705-1.288l-0.003-0.012c-0.076-0.26-0.132-0.506-0.186-0.746-0.961-0.157-1.822-0.412-2.633-0.76l0.073 0.028c-0.667-0.259-1.199-0.745-1.509-1.362l-0.007-0.016c-0.082-0.189-0.135-0.409-0.146-0.64l-0-0.004c-0.002-0.031-0.003-0.067-0.003-0.103 0-0.841 0.614-1.538 1.417-1.668l0.010-0.001c0.822-0.141 1.555-0.438 2.198-0.859l-0.022 0.013c0.611-0.405 1.138-0.872 1.591-1.404l0.009-0.010c0.526-0.595 0.98-1.273 1.337-2.007l0.023-0.053c0.060-0.102 0.107-0.22 0.135-0.346l0.001-0.008c-0.092-0.020-0.73-0.222-0.972-0.298s-0.374-0.12-0.506-0.17c-0.546-0.205-1.016-0.487-1.424-0.839l0.006 0.005c-0.471-0.388-0.768-0.971-0.768-1.624 0-0.126 0.011-0.249 0.032-0.369l-0.002 0.013c0.143-0.644 0.551-1.172 1.1-1.474l0.011-0.006c0.389-0.241 0.861-0.384 1.366-0.384 0.347 0 0.678 0.067 0.982 0.19l-0.018-0.006c0.128 0.060 0.242 0.106 0.344 0.142-0.082-0.573-0.129-1.235-0.129-1.908 0-1.482 0.227-2.91 0.648-4.253l-0.027 0.101c0.512-1.142 1.207-2.114 2.056-2.925l0.004-0.003c0.7-0.664 1.516-1.214 2.413-1.616l0.055-0.022c1.128-0.5 2.444-0.794 3.828-0.8h0.592c1.386 0.007 2.701 0.301 3.893 0.825l-0.063-0.025c0.956 0.42 1.777 0.967 2.485 1.632l-0.005-0.004c0.855 0.815 1.55 1.789 2.039 2.876l0.023 0.058c0.396 1.237 0.625 2.659 0.625 4.135 0 0.658-0.045 1.304-0.133 1.938l0.008-0.073 0.172-0.076c0.303-0.16 0.661-0.253 1.042-0.253 0.374 0 0.728 0.091 1.039 0.251l-0.013-0.006c0.886 0.274 1.528 1.063 1.582 2.008l0 0.006c-0.001 0.602-0.25 1.146-0.65 1.536l-0 0c-0.429 0.408-0.945 0.73-1.516 0.935l-0.030 0.009c-0.144 0.056-0.316 0.112-0.504 0.17-0.367 0.103-0.686 0.235-0.984 0.398l0.024-0.012c0.018 0.030 0.042 0.094 0.086 0.18 0.963 2.174 2.834 3.796 5.118 4.4l0.054 0.012c0.814 0.133 1.427 0.83 1.427 1.671 0 0.036-0.001 0.072-0.003 0.108l0-0.005c-0.012 0.241-0.070 0.465-0.165 0.669l0.005-0.011c-0.319 0.624-0.847 1.103-1.489 1.352l-0.019 0.006c-0.739 0.323-1.6 0.578-2.497 0.724l-0.063 0.008c-0.056 0.264-0.112 0.496-0.186 0.742-0.215 0.747-0.893 1.284-1.696 1.284-0.011 0-0.021-0-0.032-0l0.002 0c-0.328-0.004-0.644-0.042-0.949-0.11l0.031 0.006c-0.404-0.090-0.869-0.142-1.345-0.142-0.353 0-0.7 0.029-1.038 0.083l0.037-0.005c-0.653 0.195-1.218 0.508-1.699 0.917l0.007-0.005c-1.275 1.065-2.916 1.731-4.71 1.788l-0.012 0zM8.444 25.218c0.457 0.001 0.904 0.041 1.339 0.117l-0.047-0.007c0.966 0.232 1.808 0.664 2.516 1.252l-0.010-0.008c0.96 0.829 2.199 1.357 3.56 1.427l0.014 0.001h0.37c1.373-0.070 2.61-0.597 3.576-1.43l-0.008 0.006c0.701-0.583 1.546-1.016 2.474-1.239l0.042-0.009c0.394-0.063 0.849-0.1 1.312-0.1 0.615 0 1.216 0.064 1.795 0.186l-0.057-0.010c0.105 0.023 0.238 0.045 0.372 0.059l0.016 0.001c0.042-0.162 0.076-0.314 0.11-0.47 0.059-0.339 0.156-0.641 0.287-0.924l-0.009 0.023 0.234-0.44 0.492-0.078c0.99-0.119 1.892-0.359 2.738-0.705l-0.070 0.025c0.086-0.040 0.158-0.076 0.216-0.11-2.748-0.86-4.933-2.816-6.081-5.342l-0.025-0.062c-0.184-0.31-0.294-0.684-0.294-1.083 0-0.27 0.050-0.528 0.14-0.765l-0.005 0.015c0.492-0.783 1.284-1.339 2.212-1.507l0.020-0.003c0.14-0.044 0.27-0.084 0.376-0.126 0.327-0.108 0.609-0.272 0.849-0.482l-0.003 0.002c0.074-0.106 0-0.2-0.216-0.284-0.094-0.041-0.203-0.065-0.318-0.066h-0c-0.529 0.242-1.142 0.411-1.786 0.474l-0.024 0.002c-0.313-0-0.612-0.064-0.883-0.18l0.015 0.006-0.628-0.28 0.072-1.272c0.093-0.623 0.146-1.342 0.146-2.074 0-1.269-0.16-2.501-0.46-3.677l0.022 0.103c-0.396-0.896-0.936-1.659-1.598-2.296l-0.002-0.002c-0.541-0.508-1.172-0.928-1.865-1.233l-0.043-0.017c-0.895-0.396-1.939-0.629-3.036-0.634h-0.002l-0.218-1v1h-0.348c-1.105 0.003-2.155 0.237-3.106 0.656l0.050-0.020c-0.733 0.322-1.361 0.742-1.903 1.253l0.003-0.003c-0.663 0.638-1.203 1.398-1.582 2.247l-0.018 0.045c-0.279 1.065-0.44 2.287-0.44 3.547 0 0.704 0.050 1.395 0.147 2.072l-0.009-0.078 0.080 1.372-0.618 0.284c-0.31 0.108-0.666 0.17-1.038 0.17-0.6 0-1.163-0.163-1.645-0.446l0.015 0.008c-0.019-0.001-0.041-0.002-0.064-0.002-0.154 0-0.299 0.039-0.425 0.109l0.005-0.002c-0.063 0.032-0.115 0.078-0.153 0.135l-0.001 0.001c0.258 0.244 0.567 0.435 0.91 0.556l0.018 0.006c0.094 0.036 0.2 0.070 0.32 0.108 0.971 0.167 1.784 0.732 2.282 1.516l0.008 0.014c0.087 0.225 0.137 0.486 0.137 0.758 0 0.403-0.11 0.781-0.303 1.104l0.005-0.010c-0.459 0.983-1.016 1.829-1.677 2.582l0.011-0.012c-0.588 0.687-1.26 1.279-2.004 1.768l-0.036 0.022c-0.689 0.451-1.49 0.805-2.346 1.017l-0.054 0.011c0.060 0.034 0.132 0.072 0.218 0.112 0.776 0.322 1.678 0.561 2.618 0.675l0.050 0.005 0.498 0.078 0.234 0.446c0.116 0.255 0.209 0.553 0.265 0.863l0.003 0.023c0.038 0.164 0.072 0.328 0.118 0.496 0.12-0.014 0.242-0.042 0.378-0.068 0.528-0.12 1.138-0.192 1.762-0.2l0.006-0zM30.244 22.892v0z"></path>\n</svg>\n',tiktok:'\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>tiktok</title>\n<path d="M29.046 7.029c-3.359 0-6.092-2.733-6.092-6.092 0-0.518-0.42-0.938-0.938-0.938h-5.021c-0.518 0-0.938 0.42-0.938 0.938v20.585c0 1.975-1.606 3.581-3.581 3.581s-3.581-1.606-3.581-3.581c0-1.975 1.606-3.581 3.581-3.581 0.518 0 0.938-0.42 0.938-0.938v-5.021c0-0.518-0.42-0.938-0.938-0.938-5.777 0-10.477 4.7-10.477 10.477s4.7 10.477 10.477 10.477c5.777 0 10.477-4.7 10.477-10.477v-9.112c1.866 0.995 3.942 1.514 6.092 1.514 0.518 0 0.938-0.42 0.938-0.938v-5.021c0-0.518-0.42-0.938-0.938-0.938zM28.108 12.011c-2.001-0.166-3.902-0.866-5.544-2.047-0.285-0.206-0.662-0.234-0.975-0.073s-0.51 0.482-0.51 0.834v10.798c0 4.743-3.859 8.602-8.602 8.602s-8.602-3.859-8.602-8.602c0-4.427 3.361-8.083 7.665-8.552v3.176c-2.563 0.446-4.519 2.687-4.519 5.376 0 3.009 2.447 5.456 5.456 5.456s5.456-2.448 5.456-5.456v-19.648h3.201c0.429 3.645 3.329 6.545 6.974 6.974z"></path>\n</svg>\n'},this.socialSlot=this.host.querySelector('[slot="social-item"]')?.innerHTML||'<a href={link} rel="noopener" target="_blank" title={type} aria-label={type}><span class="s-social-icon">{icon}</span></a>',salla.lang.onLoaded((()=>{this.links=salla.config.get("store.social")}))}getLinksArray(){return this.links?Object.entries(this.links).filter((([c,l])=>!!l&&"whatsapp"!==c)).map((([c,l])=>({type:c,value:l}))):[]}componentWillLoad(){return new Promise((c=>salla.onReady(c)))}render(){const c=this.getLinksArray();return l(t,{key:"a4c05f6fcf54b6d34c547d7b27a61d4afbd91f10"},l("ul",{key:"ab690b3eba0190d6830a5988510c404dafa4e450",class:"s-social-list"},c.map((c=>l("li",{class:"s-social-link"},l("div",{id:"social-slot",innerHTML:this.socialSlot.replace(/\{icon\}/g,this.iconsList[c.type]).replace(/\{type\}/g,c.type).replace(/\{link\}/g,c.value.toString())}))))))}componentDidRender(){this.host.querySelectorAll("#social-slot").forEach((c=>c.replaceWith(c.firstChild))),this.host.querySelector('[slot="social-item"]')?.remove()}get host(){return s(this)}};a.style=":host{display:block}";export{a as salla_social}
4
+ import{r as c,h as l,H as t,a as s}from"./p-CFtXUFT2.js";import{f as i,t as e}from"./p-CO-PeZ27.js";const a=class{constructor(l){c(this,l),this.links=salla.config.get("store.social"),this.iconsList={instagram:'\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>instagram</title>\n<path d="M23 32h-14c-4.971 0-9-4.029-9-9v0-14c0-4.971 4.029-9 9-9v0h14c4.971 0 9 4.029 9 9v0 14c0 4.971-4.029 9-9 9v0zM9 2c-3.866 0-7 3.134-7 7v0 14c0 3.866 3.134 7 7 7v0h14c3.866 0 7-3.134 7-7v0-14c0-3.866-3.134-7-7-7v0zM16 24c-4.418 0-8-3.582-8-8s3.582-8 8-8c4.418 0 8 3.582 8 8v0c0 4.418-3.582 8-8 8v0zM16 10c-3.314 0-6 2.686-6 6s2.686 6 6 6c3.314 0 6-2.686 6-6v0c0-3.314-2.686-6-6-6v0zM25 9c-1.105 0-2-0.895-2-2s0.895-2 2-2c1.105 0 2 0.895 2 2v0c0 1.105-0.895 2-2 2v0zM25 7v0z"></path>\n</svg>\n',twitter:e,facebook:i,youtube:'\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>youtube</title>\n<path d="M16 28c-3.666 0-8.376-0.056-10.29-0.162-0.113 0.010-0.244 0.016-0.376 0.016-1.676 0-3.139-0.91-3.922-2.264l-0.012-0.022c-0.97-1.6-1.4-4.248-1.4-8.558s0.436-6.962 1.412-8.6c0.782-1.36 2.227-2.262 3.883-2.262 0.148 0 0.293 0.007 0.437 0.021l-0.018-0.001c1.872-0.124 6.544-0.168 10.286-0.168s8.4 0.044 10.292 0.168c0.124-0.012 0.267-0.019 0.412-0.019 1.656 0 3.101 0.905 3.866 2.247l0.012 0.022c0.982 1.624 1.418 4.27 1.418 8.582 0 4.338-0.438 6.982-1.422 8.6-0.789 1.364-2.241 2.268-3.904 2.268-0.133 0-0.265-0.006-0.395-0.017l0.017 0.001c-1.926 0.092-6.632 0.148-10.296 0.148zM16 8c-3.712 0-8.334 0.042-10.168 0.164-1.688 0.094-2.14 0.306-2.702 1.268-0.756 1.81-1.195 3.913-1.195 6.119 0 0.51 0.024 1.015 0.069 1.513l-0.005-0.064c-0.042 0.435-0.065 0.941-0.065 1.453 0 2.198 0.438 4.294 1.231 6.205l-0.039-0.107c0.566 0.968 1.022 1.184 2.708 1.296 3.29 0.184 17.022 0.184 20.34 0 1.678-0.11 2.132-0.326 2.684-1.28 0.764-1.803 1.208-3.899 1.208-6.1 0-0.513-0.024-1.020-0.071-1.52l0.005 0.064c0.042-0.436 0.065-0.943 0.065-1.455 0-2.203-0.439-4.303-1.235-6.218l0.040 0.107v-0.016c-0.554-0.958-1-1.17-2.684-1.264-1.862-0.122-6.644-0.164-10.186-0.164zM13 23c-0.552 0-1-0.448-1-1v0-10c0 0 0 0 0 0 0-0.552 0.448-1 1-1 0.196 0 0.38 0.057 0.534 0.154l-0.004-0.002 8 5c0.284 0.18 0.47 0.492 0.47 0.848s-0.186 0.668-0.466 0.846l-0.004 0.002-8 5c-0.15 0.095-0.334 0.152-0.53 0.152 0 0 0 0 0 0v0zM14 13.8v6.4l5.114-3.2z"></path>\n</svg>\n',snapchat:'\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>snapchat</title>\n<path d="M16.186 30h-0.266c-1.843-0.023-3.525-0.693-4.834-1.792l0.012 0.010c-0.476-0.405-1.043-0.72-1.665-0.909l-0.033-0.009c-0.287-0.044-0.617-0.069-0.954-0.069-0.492 0-0.972 0.053-1.434 0.155l0.044-0.008c-0.261 0.061-0.564 0.102-0.875 0.114l-0.009 0c-0.017 0.001-0.036 0.001-0.056 0.001-0.811 0-1.495-0.545-1.705-1.288l-0.003-0.012c-0.076-0.26-0.132-0.506-0.186-0.746-0.961-0.157-1.822-0.412-2.633-0.76l0.073 0.028c-0.667-0.259-1.199-0.745-1.509-1.362l-0.007-0.016c-0.082-0.189-0.135-0.409-0.146-0.64l-0-0.004c-0.002-0.031-0.003-0.067-0.003-0.103 0-0.841 0.614-1.538 1.417-1.668l0.010-0.001c0.822-0.141 1.555-0.438 2.198-0.859l-0.022 0.013c0.611-0.405 1.138-0.872 1.591-1.404l0.009-0.010c0.526-0.595 0.98-1.273 1.337-2.007l0.023-0.053c0.060-0.102 0.107-0.22 0.135-0.346l0.001-0.008c-0.092-0.020-0.73-0.222-0.972-0.298s-0.374-0.12-0.506-0.17c-0.546-0.205-1.016-0.487-1.424-0.839l0.006 0.005c-0.471-0.388-0.768-0.971-0.768-1.624 0-0.126 0.011-0.249 0.032-0.369l-0.002 0.013c0.143-0.644 0.551-1.172 1.1-1.474l0.011-0.006c0.389-0.241 0.861-0.384 1.366-0.384 0.347 0 0.678 0.067 0.982 0.19l-0.018-0.006c0.128 0.060 0.242 0.106 0.344 0.142-0.082-0.573-0.129-1.235-0.129-1.908 0-1.482 0.227-2.91 0.648-4.253l-0.027 0.101c0.512-1.142 1.207-2.114 2.056-2.925l0.004-0.003c0.7-0.664 1.516-1.214 2.413-1.616l0.055-0.022c1.128-0.5 2.444-0.794 3.828-0.8h0.592c1.386 0.007 2.701 0.301 3.893 0.825l-0.063-0.025c0.956 0.42 1.777 0.967 2.485 1.632l-0.005-0.004c0.855 0.815 1.55 1.789 2.039 2.876l0.023 0.058c0.396 1.237 0.625 2.659 0.625 4.135 0 0.658-0.045 1.304-0.133 1.938l0.008-0.073 0.172-0.076c0.303-0.16 0.661-0.253 1.042-0.253 0.374 0 0.728 0.091 1.039 0.251l-0.013-0.006c0.886 0.274 1.528 1.063 1.582 2.008l0 0.006c-0.001 0.602-0.25 1.146-0.65 1.536l-0 0c-0.429 0.408-0.945 0.73-1.516 0.935l-0.030 0.009c-0.144 0.056-0.316 0.112-0.504 0.17-0.367 0.103-0.686 0.235-0.984 0.398l0.024-0.012c0.018 0.030 0.042 0.094 0.086 0.18 0.963 2.174 2.834 3.796 5.118 4.4l0.054 0.012c0.814 0.133 1.427 0.83 1.427 1.671 0 0.036-0.001 0.072-0.003 0.108l0-0.005c-0.012 0.241-0.070 0.465-0.165 0.669l0.005-0.011c-0.319 0.624-0.847 1.103-1.489 1.352l-0.019 0.006c-0.739 0.323-1.6 0.578-2.497 0.724l-0.063 0.008c-0.056 0.264-0.112 0.496-0.186 0.742-0.215 0.747-0.893 1.284-1.696 1.284-0.011 0-0.021-0-0.032-0l0.002 0c-0.328-0.004-0.644-0.042-0.949-0.11l0.031 0.006c-0.404-0.090-0.869-0.142-1.345-0.142-0.353 0-0.7 0.029-1.038 0.083l0.037-0.005c-0.653 0.195-1.218 0.508-1.699 0.917l0.007-0.005c-1.275 1.065-2.916 1.731-4.71 1.788l-0.012 0zM8.444 25.218c0.457 0.001 0.904 0.041 1.339 0.117l-0.047-0.007c0.966 0.232 1.808 0.664 2.516 1.252l-0.010-0.008c0.96 0.829 2.199 1.357 3.56 1.427l0.014 0.001h0.37c1.373-0.070 2.61-0.597 3.576-1.43l-0.008 0.006c0.701-0.583 1.546-1.016 2.474-1.239l0.042-0.009c0.394-0.063 0.849-0.1 1.312-0.1 0.615 0 1.216 0.064 1.795 0.186l-0.057-0.010c0.105 0.023 0.238 0.045 0.372 0.059l0.016 0.001c0.042-0.162 0.076-0.314 0.11-0.47 0.059-0.339 0.156-0.641 0.287-0.924l-0.009 0.023 0.234-0.44 0.492-0.078c0.99-0.119 1.892-0.359 2.738-0.705l-0.070 0.025c0.086-0.040 0.158-0.076 0.216-0.11-2.748-0.86-4.933-2.816-6.081-5.342l-0.025-0.062c-0.184-0.31-0.294-0.684-0.294-1.083 0-0.27 0.050-0.528 0.14-0.765l-0.005 0.015c0.492-0.783 1.284-1.339 2.212-1.507l0.020-0.003c0.14-0.044 0.27-0.084 0.376-0.126 0.327-0.108 0.609-0.272 0.849-0.482l-0.003 0.002c0.074-0.106 0-0.2-0.216-0.284-0.094-0.041-0.203-0.065-0.318-0.066h-0c-0.529 0.242-1.142 0.411-1.786 0.474l-0.024 0.002c-0.313-0-0.612-0.064-0.883-0.18l0.015 0.006-0.628-0.28 0.072-1.272c0.093-0.623 0.146-1.342 0.146-2.074 0-1.269-0.16-2.501-0.46-3.677l0.022 0.103c-0.396-0.896-0.936-1.659-1.598-2.296l-0.002-0.002c-0.541-0.508-1.172-0.928-1.865-1.233l-0.043-0.017c-0.895-0.396-1.939-0.629-3.036-0.634h-0.002l-0.218-1v1h-0.348c-1.105 0.003-2.155 0.237-3.106 0.656l0.050-0.020c-0.733 0.322-1.361 0.742-1.903 1.253l0.003-0.003c-0.663 0.638-1.203 1.398-1.582 2.247l-0.018 0.045c-0.279 1.065-0.44 2.287-0.44 3.547 0 0.704 0.050 1.395 0.147 2.072l-0.009-0.078 0.080 1.372-0.618 0.284c-0.31 0.108-0.666 0.17-1.038 0.17-0.6 0-1.163-0.163-1.645-0.446l0.015 0.008c-0.019-0.001-0.041-0.002-0.064-0.002-0.154 0-0.299 0.039-0.425 0.109l0.005-0.002c-0.063 0.032-0.115 0.078-0.153 0.135l-0.001 0.001c0.258 0.244 0.567 0.435 0.91 0.556l0.018 0.006c0.094 0.036 0.2 0.070 0.32 0.108 0.971 0.167 1.784 0.732 2.282 1.516l0.008 0.014c0.087 0.225 0.137 0.486 0.137 0.758 0 0.403-0.11 0.781-0.303 1.104l0.005-0.010c-0.459 0.983-1.016 1.829-1.677 2.582l0.011-0.012c-0.588 0.687-1.26 1.279-2.004 1.768l-0.036 0.022c-0.689 0.451-1.49 0.805-2.346 1.017l-0.054 0.011c0.060 0.034 0.132 0.072 0.218 0.112 0.776 0.322 1.678 0.561 2.618 0.675l0.050 0.005 0.498 0.078 0.234 0.446c0.116 0.255 0.209 0.553 0.265 0.863l0.003 0.023c0.038 0.164 0.072 0.328 0.118 0.496 0.12-0.014 0.242-0.042 0.378-0.068 0.528-0.12 1.138-0.192 1.762-0.2l0.006-0zM30.244 22.892v0z"></path>\n</svg>\n',tiktok:'\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>tiktok</title>\n<path d="M29.046 7.029c-3.359 0-6.092-2.733-6.092-6.092 0-0.518-0.42-0.938-0.938-0.938h-5.021c-0.518 0-0.938 0.42-0.938 0.938v20.585c0 1.975-1.606 3.581-3.581 3.581s-3.581-1.606-3.581-3.581c0-1.975 1.606-3.581 3.581-3.581 0.518 0 0.938-0.42 0.938-0.938v-5.021c0-0.518-0.42-0.938-0.938-0.938-5.777 0-10.477 4.7-10.477 10.477s4.7 10.477 10.477 10.477c5.777 0 10.477-4.7 10.477-10.477v-9.112c1.866 0.995 3.942 1.514 6.092 1.514 0.518 0 0.938-0.42 0.938-0.938v-5.021c0-0.518-0.42-0.938-0.938-0.938zM28.108 12.011c-2.001-0.166-3.902-0.866-5.544-2.047-0.285-0.206-0.662-0.234-0.975-0.073s-0.51 0.482-0.51 0.834v10.798c0 4.743-3.859 8.602-8.602 8.602s-8.602-3.859-8.602-8.602c0-4.427 3.361-8.083 7.665-8.552v3.176c-2.563 0.446-4.519 2.687-4.519 5.376 0 3.009 2.447 5.456 5.456 5.456s5.456-2.448 5.456-5.456v-19.648h3.201c0.429 3.645 3.329 6.545 6.974 6.974z"></path>\n</svg>\n'},this.socialSlot=this.host.querySelector('[slot="social-item"]')?.innerHTML||'<a href={link} rel="noopener" target="_blank" title={type} aria-label={type}><span class="s-social-icon">{icon}</span></a>',salla.lang.onLoaded((()=>{this.links=salla.config.get("store.social")}))}getLinksArray(){return this.links?Object.entries(this.links).filter((([c,l])=>!!l&&"whatsapp"!==c)).map((([c,l])=>({type:c,value:l}))):[]}componentWillLoad(){return new Promise((c=>salla.onReady(c)))}render(){const c=this.getLinksArray();return l(t,{key:"a4c05f6fcf54b6d34c547d7b27a61d4afbd91f10"},l("ul",{key:"ab690b3eba0190d6830a5988510c404dafa4e450",class:"s-social-list"},c.map((c=>l("li",{class:"s-social-link"},l("div",{id:"social-slot",innerHTML:this.socialSlot.replace(/\{icon\}/g,this.iconsList[c.type]).replace(/\{type\}/g,c.type).replace(/\{link\}/g,c.value.toString())}))))))}componentDidRender(){this.host.querySelectorAll("#social-slot").forEach((c=>c.replaceWith(c.firstChild))),this.host.querySelector('[slot="social-item"]')?.remove()}get host(){return s(this)}};a.style=":host{display:block}";export{a as salla_social}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as e,h as s}from"./p-BHYtfMwX.js";import{G as l}from"./p-OF8QcbMM.js";const a=class{constructor(s){e(this,s),this.minAge=10,this.isEditable=!0,this.disableAction=!1,this.isLoading=!0,this.first_name_trans=salla.lang.get("pages.profile.first_name"),this.last_name_trans=salla.lang.get("pages.profile.last_name"),this.birthday_trans=salla.lang.get("pages.profile.birthday"),this.birthday_placeholder_trans=salla.lang.get("pages.profile.birthday_placeholder"),this.gender_trans=salla.lang.get("pages.profile.gender"),this.gender_placeholder_trans=salla.lang.get("pages.profile.gender_placeholder"),this.male_trans=salla.lang.get("pages.profile.male"),this.female_trans=salla.lang.get("pages.profile.female"),this.email_trans=salla.lang.get("common.elements.email"),this.mobile_trans=salla.lang.get("common.elements.mobile"),this.save_btn_trans=salla.lang.get("common.elements.save"),this.drag_and_drop_trans=salla.lang.get("common.uploader.drag_and_drop"),this.browse_trans=salla.lang.get("common.uploader.browse"),this.email_required_trans=salla.lang.get("pages.checkout.email_required"),this.invalid_email_trans=salla.lang.get("pages.error.invalid_value",{attribute:"email"}),salla.lang.onLoaded((()=>{this.first_name_trans=salla.lang.get("pages.profile.first_name"),this.last_name_trans=salla.lang.get("pages.profile.last_name"),this.birthday_trans=salla.lang.get("pages.profile.birthday"),this.birthday_placeholder_trans=salla.lang.get("pages.profile.birthday_placeholder"),this.gender_trans=salla.lang.get("pages.profile.gender"),this.gender_placeholder_trans=salla.lang.get("pages.profile.gender_placeholder"),this.male_trans=salla.lang.get("pages.profile.male"),this.female_trans=salla.lang.get("pages.profile.female"),this.email_trans=salla.lang.get("common.elements.email"),this.mobile_trans=salla.lang.get("common.elements.mobile"),this.save_btn_trans=salla.lang.get("common.elements.save"),this.drag_and_drop_trans=salla.lang.get("common.uploader.drag_and_drop"),this.browse_trans=salla.lang.get("common.uploader.browse"),this.email_required_trans=salla.lang.get("pages.checkout.email_required"),this.invalid_email_trans=salla.lang.get("pages.error.invalid_value",{attribute:"email"})}))}phoneNumberFieldEventHandler(e){e.detail.number?(this.userData.phone.number=Number.parseInt(e.detail.number),this.userData.phone.country=e.detail.country_code,this.disableAction=!1):this.disableAction=!0}handleFieldChange(e,s,l=!1){s.target.value?(this.userData[e]=s.target.value,this.disableAction=!1):l&&(this.disableAction=!0)}handleEmailInput(e,s){const l=document.getElementById("email-error"),a=s.target.value;if(!a)return this.disableAction=!0,void(l.textContent=this.email_required_trans);/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i.test(a)||(this.disableAction=!0,l.textContent=this.invalid_email_trans),l.textContent="",this.userData[e]=a,this.disableAction=!1}submitForm(e){e.preventDefault(),this.disableAction=!0;const s=Object.assign({},this.userData);s.phone=void 0,s.phone=this.userData.phone.number,s.country_code=this.userData.phone.country,salla.api.profile.update(s).finally((()=>{this.disableAction=!1}))}getBirthDateRestriction(){const e=new Date,s=e.getFullYear()-this.minAge;return e.setFullYear(s),e}fetchData(){return salla.api.profile.info().then((e=>{this.userData=e.data})).finally((()=>{this.isLoading=!1,this.isEditable=!Salla.config.get("store.features").includes("sso-login")}))}renderLoadingSection(){return s("div",{class:"s-user-profile-skeleton-wrapper"},Array.from({length:6},((e,l)=>s("salla-skeleton",{class:"skeleton-item",width:"100%",height:"50px",key:l}))))}componentWillLoad(){Salla.onReady().then((()=>this.fetchData()))}render(){return this.isLoading?this.renderLoadingSection():s("form",{onSubmit:e=>this.submitForm(e)},s("div",{class:"s-user-profile-wrapper"},s("div",{class:"s-user-profile-field"},s("label",{htmlFor:"first-name",class:"s-user-profile-field-label"},this.first_name_trans),s("input",{disabled:!this.isEditable,type:"text",name:"first_name",value:this.userData.first_name,id:"first-name",required:!0,autocomplete:"first_name",class:"form-input",onChange:e=>this.handleFieldChange("first_name",e)})),s("div",{class:"s-user-profile-field"},s("label",{htmlFor:"last-name",class:"s-user-profile-field-label"},this.last_name_trans),s("input",{disabled:!this.isEditable,type:"text",name:"last_name",value:this.userData.last_name,id:"last-name",required:!0,autocomplete:"last_name",class:"form-input",onChange:e=>this.handleFieldChange("last_name",e)})),s("div",{class:"s-user-profile-field"},s("label",{htmlFor:"birthday",class:"s-user-profile-field-label"},this.birthday_trans),s("salla-datetime-picker",{disabled:!this.isEditable,dateFormat:"Y-m-d",value:this.userData.birthday,placeholder:this.birthday_placeholder_trans,required:!0,maxDate:this.getBirthDateRestriction(),name:"birthday",onPicked:e=>this.handleFieldChange("birthday",e)})),s("div",{class:"s-user-profile-field"},s("label",{htmlFor:"gender",class:"s-user-profile-field-label"},this.gender_trans),s("select",{disabled:!this.isEditable,class:"form-input",name:"gender",required:!0,onChange:e=>this.handleFieldChange("gender",e)},s("option",{value:""},this.gender_placeholder_trans),s("option",{value:l.Male,selected:this.userData.gender===l.Male},this.male_trans),s("option",{value:l.Female,selected:this.userData.gender===l.Female},this.female_trans))),s("div",{class:"s-user-profile-field"},s("label",{htmlFor:"email",class:"s-user-profile-field-label"},this.email_trans),s("input",{disabled:!this.isEditable,type:"email",name:"email",value:this.userData.email,id:"email",class:"form-input",required:!0,onInput:e=>this.handleEmailInput("email",e)}),s("p",{id:"email-error",class:"s-user-profile-field-error"})),s("div",{class:"s-user-profile-field"},s("label",{htmlFor:"international-mobile",class:"s-user-profile-field-label"},this.mobile_trans),s("salla-tel-input",{disabled:!this.isEditable,name:"international-mobile","country-code":this.userData.phone.country,phone:`${this.userData.phone.number}`,onPhoneEntered:e=>this.phoneNumberFieldEventHandler(e)}))),s("salla-button",{type:"submit",loading:this.disableAction,disabled:this.disableAction||!this.isEditable,"loader-position":"end",class:"s-user-profile-submit"},this.save_btn_trans))}};a.style=":host{display:block}";export{a as salla_user_profile}
4
+ import{r as e,h as s}from"./p-CFtXUFT2.js";import{G as l}from"./p-OF8QcbMM.js";const a=class{constructor(s){e(this,s),this.minAge=10,this.isEditable=!0,this.disableAction=!1,this.isLoading=!0,this.first_name_trans=salla.lang.get("pages.profile.first_name"),this.last_name_trans=salla.lang.get("pages.profile.last_name"),this.birthday_trans=salla.lang.get("pages.profile.birthday"),this.birthday_placeholder_trans=salla.lang.get("pages.profile.birthday_placeholder"),this.gender_trans=salla.lang.get("pages.profile.gender"),this.gender_placeholder_trans=salla.lang.get("pages.profile.gender_placeholder"),this.male_trans=salla.lang.get("pages.profile.male"),this.female_trans=salla.lang.get("pages.profile.female"),this.email_trans=salla.lang.get("common.elements.email"),this.mobile_trans=salla.lang.get("common.elements.mobile"),this.save_btn_trans=salla.lang.get("common.elements.save"),this.drag_and_drop_trans=salla.lang.get("common.uploader.drag_and_drop"),this.browse_trans=salla.lang.get("common.uploader.browse"),this.email_required_trans=salla.lang.get("pages.checkout.email_required"),this.invalid_email_trans=salla.lang.get("pages.error.invalid_value",{attribute:"email"}),salla.lang.onLoaded((()=>{this.first_name_trans=salla.lang.get("pages.profile.first_name"),this.last_name_trans=salla.lang.get("pages.profile.last_name"),this.birthday_trans=salla.lang.get("pages.profile.birthday"),this.birthday_placeholder_trans=salla.lang.get("pages.profile.birthday_placeholder"),this.gender_trans=salla.lang.get("pages.profile.gender"),this.gender_placeholder_trans=salla.lang.get("pages.profile.gender_placeholder"),this.male_trans=salla.lang.get("pages.profile.male"),this.female_trans=salla.lang.get("pages.profile.female"),this.email_trans=salla.lang.get("common.elements.email"),this.mobile_trans=salla.lang.get("common.elements.mobile"),this.save_btn_trans=salla.lang.get("common.elements.save"),this.drag_and_drop_trans=salla.lang.get("common.uploader.drag_and_drop"),this.browse_trans=salla.lang.get("common.uploader.browse"),this.email_required_trans=salla.lang.get("pages.checkout.email_required"),this.invalid_email_trans=salla.lang.get("pages.error.invalid_value",{attribute:"email"})}))}phoneNumberFieldEventHandler(e){e.detail.number?(this.userData.phone.number=Number.parseInt(e.detail.number),this.userData.phone.country=e.detail.country_code,this.disableAction=!1):this.disableAction=!0}handleFieldChange(e,s,l=!1){s.target.value?(this.userData[e]=s.target.value,this.disableAction=!1):l&&(this.disableAction=!0)}handleEmailInput(e,s){const l=document.getElementById("email-error"),a=s.target.value;if(!a)return this.disableAction=!0,void(l.textContent=this.email_required_trans);/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i.test(a)||(this.disableAction=!0,l.textContent=this.invalid_email_trans),l.textContent="",this.userData[e]=a,this.disableAction=!1}submitForm(e){e.preventDefault(),this.disableAction=!0;const s=Object.assign({},this.userData);s.phone=void 0,s.phone=this.userData.phone.number,s.country_code=this.userData.phone.country,salla.api.profile.update(s).finally((()=>{this.disableAction=!1}))}getBirthDateRestriction(){const e=new Date,s=e.getFullYear()-this.minAge;return e.setFullYear(s),e}fetchData(){return salla.api.profile.info().then((e=>{this.userData=e.data})).finally((()=>{this.isLoading=!1,this.isEditable=!Salla.config.get("store.features").includes("sso-login")}))}renderLoadingSection(){return s("div",{class:"s-user-profile-skeleton-wrapper"},Array.from({length:6},((e,l)=>s("salla-skeleton",{class:"skeleton-item",width:"100%",height:"50px",key:l}))))}componentWillLoad(){Salla.onReady().then((()=>this.fetchData()))}render(){return this.isLoading?this.renderLoadingSection():s("form",{onSubmit:e=>this.submitForm(e)},s("div",{class:"s-user-profile-wrapper"},s("div",{class:"s-user-profile-field"},s("label",{htmlFor:"first-name",class:"s-user-profile-field-label"},this.first_name_trans),s("input",{disabled:!this.isEditable,type:"text",name:"first_name",value:this.userData.first_name,id:"first-name",required:!0,autocomplete:"first_name",class:"form-input",onChange:e=>this.handleFieldChange("first_name",e)})),s("div",{class:"s-user-profile-field"},s("label",{htmlFor:"last-name",class:"s-user-profile-field-label"},this.last_name_trans),s("input",{disabled:!this.isEditable,type:"text",name:"last_name",value:this.userData.last_name,id:"last-name",required:!0,autocomplete:"last_name",class:"form-input",onChange:e=>this.handleFieldChange("last_name",e)})),s("div",{class:"s-user-profile-field"},s("label",{htmlFor:"birthday",class:"s-user-profile-field-label"},this.birthday_trans),s("salla-datetime-picker",{disabled:!this.isEditable,dateFormat:"Y-m-d",value:this.userData.birthday,placeholder:this.birthday_placeholder_trans,required:!0,maxDate:this.getBirthDateRestriction(),name:"birthday",onPicked:e=>this.handleFieldChange("birthday",e)})),s("div",{class:"s-user-profile-field"},s("label",{htmlFor:"gender",class:"s-user-profile-field-label"},this.gender_trans),s("select",{disabled:!this.isEditable,class:"form-input",name:"gender",required:!0,onChange:e=>this.handleFieldChange("gender",e)},s("option",{value:""},this.gender_placeholder_trans),s("option",{value:l.Male,selected:this.userData.gender===l.Male},this.male_trans),s("option",{value:l.Female,selected:this.userData.gender===l.Female},this.female_trans))),s("div",{class:"s-user-profile-field"},s("label",{htmlFor:"email",class:"s-user-profile-field-label"},this.email_trans),s("input",{disabled:!this.isEditable,type:"email",name:"email",value:this.userData.email,id:"email",class:"form-input",required:!0,onInput:e=>this.handleEmailInput("email",e)}),s("p",{id:"email-error",class:"s-user-profile-field-error"})),s("div",{class:"s-user-profile-field"},s("label",{htmlFor:"international-mobile",class:"s-user-profile-field-label"},this.mobile_trans),s("salla-tel-input",{disabled:!this.isEditable,name:"international-mobile","country-code":this.userData.phone.country,phone:`${this.userData.phone.number}`,onPhoneEntered:e=>this.phoneNumberFieldEventHandler(e)}))),s("salla-button",{type:"submit",loading:this.disableAction,disabled:this.disableAction||!this.isEditable,"loader-position":"end",class:"s-user-profile-submit"},this.save_btn_trans))}};a.style=":host{display:block}";export{a as salla_user_profile}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as s,h as a,a as t}from"./p-BHYtfMwX.js";import{a as c}from"./p-CgtvEd63.js";import{f as e,t as l}from"./p-CO-PeZ27.js";import{S as i}from"./p-DLNIOD9t.js";import{S as n}from"./p-8Tsmrwno.js";var o;!function(s){s.FACEBOOK="facebook",s.TWITTER="twitter",s.WHATSAPP="whatsapp",s.EMAIL="email",s.COPY_LINK="copy_link"}(o||(o={}));const r=class{constructor(a){s(this,a),this.opened=!1,this.allPlatforms=[o.WHATSAPP,o.FACEBOOK,o.TWITTER,o.EMAIL,o.COPY_LINK],this.platformIcons=[{icon:'\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>whatsapp</title>\n<path d="M16 32c-0.008 0-0.018 0-0.028 0-3.1 0-5.993-0.887-8.439-2.421l0.066 0.039-7.2 2.3 2.336-6.964c-1.713-2.492-2.736-5.575-2.736-8.897 0-0.020 0-0.040 0-0.060v0.003c0.009-8.833 7.167-15.991 15.999-16h0.001c8.837 0 16 7.163 16 16s-7.163 16-16 16v0zM7.906 27.424l0.4 0.264c2.169 1.449 4.837 2.312 7.707 2.312 7.732 0 14-6.268 14-14s-6.268-14-14-14c-0.004 0-0.009 0-0.013 0h0.001c-7.729 0.008-13.992 6.271-14 13.999v0.001c-0 0.010-0 0.021-0 0.032 0 3.072 1 5.909 2.693 8.206l-0.027-0.038 0.304 0.416-1.4 4.2zM20.716 24.958c-1.684-0.131-3.237-0.574-4.641-1.271l0.073 0.033c-3.098-1.456-5.634-3.668-7.438-6.405l-0.042-0.067c-1.102-1.357-1.819-3.067-1.962-4.938l-0.002-0.030c-0.001-0.036-0.001-0.078-0.001-0.12 0-1.575 0.66-2.995 1.719-4l0.002-0.002c0.547-0.52 1.289-0.839 2.105-0.839 0.033 0 0.066 0.001 0.099 0.002l-0.005-0c0.2 0 0.378 0 0.542 0.018 0.016-0.001 0.035-0.001 0.054-0.001 0.815 0 1.502 0.549 1.711 1.298l0.003 0.012 0.324 0.782c0.376 0.906 0.858 2.068 0.942 2.244 0.144 0.251 0.23 0.552 0.23 0.873 0 0.286-0.068 0.557-0.188 0.797l0.005-0.010c-0.149 0.307-0.332 0.57-0.55 0.802l0.002-0.002c-0.148 0.168-0.248 0.274-0.346 0.378s-0.172 0.18-0.26 0.284c0.575 0.92 1.237 1.713 1.992 2.406l0.008 0.008c0.829 0.758 1.802 1.373 2.872 1.8l0.064 0.022c0.369-0.266 0.672-0.6 0.896-0.985l0.008-0.015 0.174-0.232c0.328-0.484 0.875-0.798 1.495-0.798 0.249 0 0.487 0.051 0.703 0.142l-0.012-0.004c0.492 0.168 2.922 1.372 2.946 1.384l0.228 0.11c0.415 0.149 0.758 0.417 0.996 0.763l0.004 0.007c0.107 0.349 0.169 0.75 0.169 1.166 0 0.591-0.125 1.153-0.349 1.661l0.010-0.026c-0.702 1.368-1.983 2.353-3.511 2.637l-0.031 0.005c-0.309 0.071-0.663 0.112-1.028 0.112-0.004 0-0.007 0-0.011 0h0.001zM10.632 9.318c-0.028-0.002-0.062-0.004-0.095-0.004-0.245 0-0.472 0.076-0.659 0.206l0.004-0.002c-0.726 0.651-1.18 1.591-1.18 2.638 0 0.044 0.001 0.087 0.002 0.13l-0-0.006c0.122 1.404 0.662 2.662 1.495 3.671l-0.009-0.011 0.12 0.168c1.627 2.491 3.865 4.46 6.504 5.723l0.096 0.041c3.136 1.288 3.916 1.124 4.426 1.014 0.87-0.159 1.601-0.656 2.067-1.347l0.007-0.011c0.12-0.316 0.204-0.682 0.237-1.063l0.001-0.015-0.040-0.018-0.256-0.124c-0.8-0.4-2.46-1.2-2.734-1.292l-0.058 0.184c-0.346 0.501-0.684 0.934-1.045 1.347l0.015-0.017c-0.344 0.349-0.821 0.565-1.349 0.565-0.28 0-0.546-0.061-0.785-0.17l0.012 0.005c-1.403-0.547-2.609-1.301-3.646-2.239l0.010 0.009c-0.975-0.891-1.81-1.912-2.486-3.039l-0.034-0.061c-0.152-0.244-0.242-0.54-0.242-0.857 0-0.463 0.191-0.88 0.499-1.178l0-0c0.13-0.162 0.264-0.302 0.4-0.444l0.236-0.256c0.091-0.096 0.177-0.201 0.254-0.311l0.006-0.009c-0.158-0.36-0.622-1.472-0.988-2.352l-0.322-0.772-0.038-0.086c-0.188-0.010-0.302-0.016-0.426-0.016zM12.462 12.442v0.012z"></path>\n</svg>\n',name:o.WHATSAPP},{icon:e,name:o.FACEBOOK},{icon:l,name:o.TWITTER},{icon:i,name:o.EMAIL},{icon:'\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>link</title>\n<path d="M19.247 23.019l-4.189 4.189c-2.831 2.831-7.435 2.831-10.265 0-1.371-1.372-2.125-3.193-2.125-5.132s0.755-3.761 2.125-5.133l4.189-4.191c0.521-0.521 0.521-1.364 0-1.885s-1.364-0.521-1.885 0l-4.189 4.191c-1.875 1.875-2.907 4.367-2.907 7.019s1.032 5.143 2.907 7.017 4.368 2.907 7.019 2.907 5.143-1.032 7.017-2.908l4.189-4.189c0.521-0.521 0.521-1.364 0-1.885s-1.364-0.52-1.885 0.001zM22.276 9.724c-0.521-0.521-1.364-0.521-1.885 0l-10.667 10.667c-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.391l10.667-10.667c0.521-0.521 0.521-1.364 0-1.885zM29.093 2.908c-1.875-1.876-4.368-2.908-7.019-2.908s-5.143 1.032-7.017 2.908l-4.189 4.188c-0.521 0.521-0.521 1.364 0 1.885s1.364 0.521 1.885 0l4.189-4.189c2.831-2.831 7.435-2.831 10.265 0 1.371 1.372 2.125 3.193 2.125 5.132s-0.755 3.761-2.125 5.133l-4.189 4.191c-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.391l4.189-4.191c1.875-1.875 2.907-4.367 2.907-7.019s-1.032-5.143-2.907-7.016z"></path>\n</svg>\n',name:o.COPY_LINK}],this.convertedPlatforms=[],this.url="",this.urlName="",this.platforms="facebook,twitter,whatsapp,email,copy_link"}componentWillLoad(){if(this.host.hasAttribute("aria-label")&&this.host.removeAttribute("aria-label"),document.getElementById("a2a-script"))return;const s=document.createElement("script");s.src="https://static.addtoany.com/menu/page.js",s.setAttribute("id","a2a-script"),s.async=!0,s.onload=function(){window.a2a_config.locale=salla.config.get("user.language_code",salla.lang.getLocale()),window.a2a_config.callbacks=window.a2a_config.callbacks||[],window.a2a_config.callbacks.push({share:s=>{const a={share_via:s.service.toLowerCase(),url:s.url,title:s.title};salla.event.emit("share-element",a)}})},document.body.appendChild(s)}async open(){const s=(new c.timeline).add({targets:this.shareMenu,translateY:[-50,0],opacity:[0,1],duration:300,podding:"0",easing:"easeInOutSine"});s.add({targets:this.shareMenu.children,translateZ:0,translateY:[-30,0],scaleY:[0,1],opacity:[0,1],duration:1400,delay:c.stagger(100)},"-=200"),this.opened=!this.opened,this.opened?this.shareMenu.classList.add("opened"):(s.pause(),s.seek(0),this.shareMenu.classList.remove("opened"))}async refresh(){window.a2a?.init("page")}render(){return a("div",{key:"006a40f33ae7513a265f6f3f04425e68a1193cdb",class:"s-social-share-wrapper"},a("slot",{key:"e089609f48cd6c231e17488bdd89e78f76b0df78",name:"widget"},a("salla-button",{key:"788679ca99d366efbc37faac11332e554a2a7bde","aria-label":"Share",onClick:()=>this.open(),class:"s-social-share-btn",shape:"icon",fill:"outline",color:"light"},a("span",{key:"97f86e7e8d22f05c13db6cb0dfdf51e18bc3c814",innerHTML:this.opened?n:'\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>share-alt</title>\n<path 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"></path>\n</svg>\n'}))),a("ul",{key:"8b13d93d51ba38ff1a3794646d9f68b10c6500ff",ref:s=>this.shareMenu=s,class:"s-social-share-list a2a_kit share","data-a2a-url":this.url?this.url:window.location.href,"data-a2a-title":this.urlName?this.urlName:document.title},this.platforms.split(",").map((s=>a("li",null,a("a",{class:`a2a_button_${s}`,"aria-label":`Share Via ${s}`},this.platformIcons.map((t=>{if(t.name===s)return a("span",{class:"s-social-share-icon",innerHTML:t.icon})}))))))))}get host(){return t(this)}};r.style="";export{r as salla_social_share}
4
+ import{r as s,h as a,a as t}from"./p-CFtXUFT2.js";import{a as c}from"./p-CgtvEd63.js";import{f as e,t as l}from"./p-CO-PeZ27.js";import{S as i}from"./p-DLNIOD9t.js";import{S as n}from"./p-8Tsmrwno.js";var o;!function(s){s.FACEBOOK="facebook",s.TWITTER="twitter",s.WHATSAPP="whatsapp",s.EMAIL="email",s.COPY_LINK="copy_link"}(o||(o={}));const r=class{constructor(a){s(this,a),this.opened=!1,this.allPlatforms=[o.WHATSAPP,o.FACEBOOK,o.TWITTER,o.EMAIL,o.COPY_LINK],this.platformIcons=[{icon:'\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>whatsapp</title>\n<path d="M16 32c-0.008 0-0.018 0-0.028 0-3.1 0-5.993-0.887-8.439-2.421l0.066 0.039-7.2 2.3 2.336-6.964c-1.713-2.492-2.736-5.575-2.736-8.897 0-0.020 0-0.040 0-0.060v0.003c0.009-8.833 7.167-15.991 15.999-16h0.001c8.837 0 16 7.163 16 16s-7.163 16-16 16v0zM7.906 27.424l0.4 0.264c2.169 1.449 4.837 2.312 7.707 2.312 7.732 0 14-6.268 14-14s-6.268-14-14-14c-0.004 0-0.009 0-0.013 0h0.001c-7.729 0.008-13.992 6.271-14 13.999v0.001c-0 0.010-0 0.021-0 0.032 0 3.072 1 5.909 2.693 8.206l-0.027-0.038 0.304 0.416-1.4 4.2zM20.716 24.958c-1.684-0.131-3.237-0.574-4.641-1.271l0.073 0.033c-3.098-1.456-5.634-3.668-7.438-6.405l-0.042-0.067c-1.102-1.357-1.819-3.067-1.962-4.938l-0.002-0.030c-0.001-0.036-0.001-0.078-0.001-0.12 0-1.575 0.66-2.995 1.719-4l0.002-0.002c0.547-0.52 1.289-0.839 2.105-0.839 0.033 0 0.066 0.001 0.099 0.002l-0.005-0c0.2 0 0.378 0 0.542 0.018 0.016-0.001 0.035-0.001 0.054-0.001 0.815 0 1.502 0.549 1.711 1.298l0.003 0.012 0.324 0.782c0.376 0.906 0.858 2.068 0.942 2.244 0.144 0.251 0.23 0.552 0.23 0.873 0 0.286-0.068 0.557-0.188 0.797l0.005-0.010c-0.149 0.307-0.332 0.57-0.55 0.802l0.002-0.002c-0.148 0.168-0.248 0.274-0.346 0.378s-0.172 0.18-0.26 0.284c0.575 0.92 1.237 1.713 1.992 2.406l0.008 0.008c0.829 0.758 1.802 1.373 2.872 1.8l0.064 0.022c0.369-0.266 0.672-0.6 0.896-0.985l0.008-0.015 0.174-0.232c0.328-0.484 0.875-0.798 1.495-0.798 0.249 0 0.487 0.051 0.703 0.142l-0.012-0.004c0.492 0.168 2.922 1.372 2.946 1.384l0.228 0.11c0.415 0.149 0.758 0.417 0.996 0.763l0.004 0.007c0.107 0.349 0.169 0.75 0.169 1.166 0 0.591-0.125 1.153-0.349 1.661l0.010-0.026c-0.702 1.368-1.983 2.353-3.511 2.637l-0.031 0.005c-0.309 0.071-0.663 0.112-1.028 0.112-0.004 0-0.007 0-0.011 0h0.001zM10.632 9.318c-0.028-0.002-0.062-0.004-0.095-0.004-0.245 0-0.472 0.076-0.659 0.206l0.004-0.002c-0.726 0.651-1.18 1.591-1.18 2.638 0 0.044 0.001 0.087 0.002 0.13l-0-0.006c0.122 1.404 0.662 2.662 1.495 3.671l-0.009-0.011 0.12 0.168c1.627 2.491 3.865 4.46 6.504 5.723l0.096 0.041c3.136 1.288 3.916 1.124 4.426 1.014 0.87-0.159 1.601-0.656 2.067-1.347l0.007-0.011c0.12-0.316 0.204-0.682 0.237-1.063l0.001-0.015-0.040-0.018-0.256-0.124c-0.8-0.4-2.46-1.2-2.734-1.292l-0.058 0.184c-0.346 0.501-0.684 0.934-1.045 1.347l0.015-0.017c-0.344 0.349-0.821 0.565-1.349 0.565-0.28 0-0.546-0.061-0.785-0.17l0.012 0.005c-1.403-0.547-2.609-1.301-3.646-2.239l0.010 0.009c-0.975-0.891-1.81-1.912-2.486-3.039l-0.034-0.061c-0.152-0.244-0.242-0.54-0.242-0.857 0-0.463 0.191-0.88 0.499-1.178l0-0c0.13-0.162 0.264-0.302 0.4-0.444l0.236-0.256c0.091-0.096 0.177-0.201 0.254-0.311l0.006-0.009c-0.158-0.36-0.622-1.472-0.988-2.352l-0.322-0.772-0.038-0.086c-0.188-0.010-0.302-0.016-0.426-0.016zM12.462 12.442v0.012z"></path>\n</svg>\n',name:o.WHATSAPP},{icon:e,name:o.FACEBOOK},{icon:l,name:o.TWITTER},{icon:i,name:o.EMAIL},{icon:'\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>link</title>\n<path d="M19.247 23.019l-4.189 4.189c-2.831 2.831-7.435 2.831-10.265 0-1.371-1.372-2.125-3.193-2.125-5.132s0.755-3.761 2.125-5.133l4.189-4.191c0.521-0.521 0.521-1.364 0-1.885s-1.364-0.521-1.885 0l-4.189 4.191c-1.875 1.875-2.907 4.367-2.907 7.019s1.032 5.143 2.907 7.017 4.368 2.907 7.019 2.907 5.143-1.032 7.017-2.908l4.189-4.189c0.521-0.521 0.521-1.364 0-1.885s-1.364-0.52-1.885 0.001zM22.276 9.724c-0.521-0.521-1.364-0.521-1.885 0l-10.667 10.667c-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.391l10.667-10.667c0.521-0.521 0.521-1.364 0-1.885zM29.093 2.908c-1.875-1.876-4.368-2.908-7.019-2.908s-5.143 1.032-7.017 2.908l-4.189 4.188c-0.521 0.521-0.521 1.364 0 1.885s1.364 0.521 1.885 0l4.189-4.189c2.831-2.831 7.435-2.831 10.265 0 1.371 1.372 2.125 3.193 2.125 5.132s-0.755 3.761-2.125 5.133l-4.189 4.191c-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.391l4.189-4.191c1.875-1.875 2.907-4.367 2.907-7.019s-1.032-5.143-2.907-7.016z"></path>\n</svg>\n',name:o.COPY_LINK}],this.convertedPlatforms=[],this.url="",this.urlName="",this.platforms="facebook,twitter,whatsapp,email,copy_link"}componentWillLoad(){if(this.host.hasAttribute("aria-label")&&this.host.removeAttribute("aria-label"),document.getElementById("a2a-script"))return;const s=document.createElement("script");s.src="https://static.addtoany.com/menu/page.js",s.setAttribute("id","a2a-script"),s.async=!0,s.onload=function(){window.a2a_config.locale=salla.config.get("user.language_code",salla.lang.getLocale()),window.a2a_config.callbacks=window.a2a_config.callbacks||[],window.a2a_config.callbacks.push({share:s=>{const a={share_via:s.service.toLowerCase(),url:s.url,title:s.title};salla.event.emit("share-element",a)}})},document.body.appendChild(s)}async open(){const s=(new c.timeline).add({targets:this.shareMenu,translateY:[-50,0],opacity:[0,1],duration:300,podding:"0",easing:"easeInOutSine"});s.add({targets:this.shareMenu.children,translateZ:0,translateY:[-30,0],scaleY:[0,1],opacity:[0,1],duration:1400,delay:c.stagger(100)},"-=200"),this.opened=!this.opened,this.opened?this.shareMenu.classList.add("opened"):(s.pause(),s.seek(0),this.shareMenu.classList.remove("opened"))}async refresh(){window.a2a?.init("page")}render(){return a("div",{key:"006a40f33ae7513a265f6f3f04425e68a1193cdb",class:"s-social-share-wrapper"},a("slot",{key:"e089609f48cd6c231e17488bdd89e78f76b0df78",name:"widget"},a("salla-button",{key:"788679ca99d366efbc37faac11332e554a2a7bde","aria-label":"Share",onClick:()=>this.open(),class:"s-social-share-btn",shape:"icon",fill:"outline",color:"light"},a("span",{key:"97f86e7e8d22f05c13db6cb0dfdf51e18bc3c814",innerHTML:this.opened?n:'\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>share-alt</title>\n<path 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"></path>\n</svg>\n'}))),a("ul",{key:"8b13d93d51ba38ff1a3794646d9f68b10c6500ff",ref:s=>this.shareMenu=s,class:"s-social-share-list a2a_kit share","data-a2a-url":this.url?this.url:window.location.href,"data-a2a-title":this.urlName?this.urlName:document.title},this.platforms.split(",").map((s=>a("li",null,a("a",{class:`a2a_button_${s}`,"aria-label":`Share Via ${s}`},this.platformIcons.map((t=>{if(t.name===s)return a("span",{class:"s-social-share-icon",innerHTML:t.icon})}))))))))}get host(){return t(this)}};r.style="";export{r as salla_social_share}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,c as s,h as i,H as e,a as l}from"./p-BHYtfMwX.js";import{a,A as r}from"./p-Vqpj4CWE.js";import{L as n}from"./p-BO5AoBAP.js";import{S as h}from"./p-BscTeWDc.js";const o="BulletDeliveryAPI",d=t=>{const s=null==t?Number.NaN:Number(t);return!Number.isNaN(s)&&0!==s};async function c(t,s,i){try{return await t()}catch(t){return console.error(`${o}: ${i}`,t),s}}const u=new Map;function p(t){const s=u.get(t);return!s||Date.now()-s.timestamp>3e5?(u.delete(t),null):s.data}function b(t,s){u.set(t,{data:s,timestamp:Date.now()})}const y=t=>"SA"===String(t).toUpperCase(),v={async getCountries(t=!1,s){const i=s?.trim()?null:"countries_"+(t?1:0);if(i){const t=p(i);if(t)return t}const e=await c((async()=>{const i={for_branch:t?1:0};return t&&(i.for_allocation=1),s?.trim()&&(i.query=s.trim()),((await salla.api.request("shipping/countries",{params:i}))?.data??[]).map((t=>({id:t.id,code:t.code,name:t.name,has_regions:y(t.code)})))}),[],"Error getting countries");return i&&e.length>0&&b(i,e),e},async getRegions(t,s){if(!d(t))return console.warn(`${o}: getRegions called without valid country_id`),[];const i=s?.trim()?null:`regions_${t}`;if(i){const t=p(i);if(t)return t}const e=await c((async()=>{const i={};return s?.trim()&&(i.query=s.trim()),((await salla.api.request(`shipping/countries/${t}/regions`,{params:i}))?.data??[]).map((s=>({id:s.id,name:s.name,code:s.code,country_id:Number(t)})))}),[],"Error fetching regions");return i&&e.length>0&&b(i,e),e},async getCities(t,s,i){if(!d(t))return console.warn(`${o}: getCities called without valid country_id`),[];const e=i?.trim()?null:`cities_${t}_${s||"all"}`;if(e){const t=p(e);if(t)return t}const l=await c((async()=>{const e={for_branch:0,country_id:t};return s&&(e.region_id=s),i?.trim()&&(e.query=i.trim()),((await salla.api.request("shipping/cities",{params:e}))?.data??[]).map((s=>({id:s.id,name:s.name,country_id:t,...null!=s.region_id&&{region_id:s.region_id}})))}),[],"Error fetching cities");return e&&l.length>0&&b(e,l),l},getDistricts:async(t,s)=>d(t)?c((async()=>{const i={for_branch:0,city_id:t};s?.trim()&&(i.query=s.trim());const e=(await salla.api.request("shipping/districts",{params:i}))?.data;return(Array.isArray(e)?e:Array.isArray(e?.districts)?e.districts:[]).map((s=>({id:s.id,name:s.name,name_en:s.name_en,city_id:t})))}),[],"Error fetching districts"):(console.warn(`${o}: getDistricts called without valid city_id`),[]),getSavedAddresses:async()=>c((async()=>{const t=(await salla.api.request("address"))?.data;return Array.isArray(t)?t:[]}),[],"Error fetching user addresses"),async getBranches({query:t,lat:s,lng:i,country_id:e,per_page:l=20}={}){const a=t?.trim()?.length>=2||s||i||!e?null:`branches_${e}`;if(a){const t=p(a);if(t)return t}const r=await c((async()=>{const a={per_page:l};t?.trim().length>=2&&(a.query=t),s&&(a.lat=s),i&&(a.lng=i),e&&(a.country_id=e);const r=await salla.api.request("branches",{params:a});return Array.isArray(r?.data)?r.data:[]}),[],"Error fetching branches");return a&&r.length>0&&b(a,r),r},saveAddressLocation:async t=>c((async()=>{const s=await salla.api.request("address/location",{...t,for_allocation:!0},"post"),i=s?.data??s;return{success:!0,address:"object"==typeof i&&null!=i&&"id"in i?i:void 0}}),{success:!1},"Error saving address/location"),setDeliveryScope:async t=>c((async()=>(await salla.api.withoutNotifier((()=>salla.scope.change({id:t}))),salla.storage.set("scope",{...salla.storage.get("scope")||{},id:t}),!0)),!1,"Error setting delivery scope"),async allocateScope(t){try{const s=await salla.api.withoutNotifier((()=>salla.api.request("scopes/allocation",t,"post")));return{success:!0,data:s?.data??s}}catch(t){console.error(`${o}: Error allocating scope`,t);const i=t;return{success:!1,error:null!=i?.response?.data?(s=i.response.data,s?.error?.message??s?.message??"Failed to allocate scope"):i?.message??"Unknown error"}}var s}};function m(){u.clear()}const g=t=>t*(Math.PI/180);function f(t,s,i,e){const l=g(i-t),a=g(e-s),r=Math.sin(l/2)**2+Math.cos(g(t))*Math.cos(g(i))*Math.sin(a/2)**2;return 12742*Math.atan2(Math.sqrt(r),Math.sqrt(1-r))}function _(t,s){const[i,e]=String(t).trim().split(":").map(Number);return Number.isNaN(i)||Number.isNaN(e)?t:new Date(2e3,0,1,i,e).toLocaleTimeString(s,{hour:"numeric",minute:"2-digit",hour12:!0})}const S=(t,s,i)=>{if("branch"===t.type){const s=t.branch_details?.city??t.branch_details?.name;return s?`${i} ${s}`.trim():""}if("address"===t.type&&t.address_details){const i=[t.address_details.district?.name,t.address_details.city?.name,t.address_details.country?.name].filter(Boolean).join("، ")||t.address_details.short_address||"";return i?`${s} ${i}`.trim():""}return""},w=t=>null!=t?Number(t):void 0,C=t=>w(t?.address_details?.country?.id),k=t=>t?.country_code??t?.address_details?.country?.code??"",I=t=>w(t?.address_details?.region?.id),x=t=>w(t?.address_details?.city?.id),A=t=>w(t?.address_details?.district?.id),M=t=>t?.branch_details?.id,B=t=>t?.branch_details?.latitude,N=t=>t?.branch_details?.longitude,D=t=>{if(!t||"address"!==t.type||t.address_id)return!1;const s=C(t),i=x(t),e=A(t),l=k(t),a=null!=e&&0!==Number(e),r=Boolean(t.address_details?.district?.name?.trim()),n=!y(l)||a||r;return!!(s&&i&&n)},$=(t,s,i)=>!t||!y(t)||null!=s&&0!==Number(s)&&null!=i&&("number"==typeof i?0!==i:String(i).trim().length>0),L={[GeolocationPositionError.PERMISSION_DENIED]:"Location permission denied",[GeolocationPositionError.POSITION_UNAVAILABLE]:"Location unavailable",[GeolocationPositionError.TIMEOUT]:"Location timeout"};var T='<svg width="15" height="14" viewBox="0 0 15 14" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path\n d="M1.14453 5.83032L1.14453 9.16486C1.14453 11.0511 1.14453 11.9943 1.73032 12.5803C2.3161 13.1663 3.25891 13.1663 5.14453 13.1663L9.14453 13.1663C11.0301 13.1663 11.9729 13.1663 12.5587 12.5803C13.1445 11.9943 13.1445 11.0511 13.1445 9.16486V5.83032"\n stroke="currentcolor" stroke-linecap="round" />\n <path\n d="M9.14453 10.1619C8.68846 10.5667 7.9624 10.8285 7.14453 10.8285C6.32666 10.8285 5.60059 10.5667 5.14453 10.1619"\n stroke="currentcolor" stroke-linecap="round" />\n <path\n d="M5.90256 4.44533C5.71455 5.12426 5.03086 6.29542 3.73185 6.46516C2.58488 6.61502 1.71497 6.11437 1.49277 5.90504C1.24779 5.7353 0.689441 5.19216 0.552703 4.85269C0.415966 4.51322 0.575492 3.77771 0.689441 3.47785L1.14495 2.15892C1.25615 1.82765 1.51646 1.04411 1.78334 0.779094C2.05022 0.514073 2.59054 0.502543 2.81294 0.502543L7.48329 0.502543C8.68543 0.519525 11.3139 0.491824 11.8335 0.502545C12.3532 0.513266 12.6654 0.948828 12.7565 1.13553C13.5318 3.01341 13.8333 4.08889 13.8333 4.54717C13.7321 5.03605 13.3133 5.95787 11.8335 6.36332C10.2956 6.7847 9.42363 5.96509 9.15007 5.65043M5.27015 5.65044C5.48665 5.91635 6.16578 6.45158 7.15029 6.46516C8.1348 6.47873 8.98485 5.79188 9.28681 5.44676C9.37227 5.34492 9.55687 5.04279 9.7483 4.44533"\n stroke="currentcolor" stroke-linecap="round" stroke-linejoin="round" />\n</svg>\n ';const E="salla-bullet-delivery-override-ip",P=class{constructor(i){t(this,i),this.bulletDeliveryConfirmed=s(this,"bulletDeliveryConfirmed"),this.bulletDeliveryClosed=s(this,"bulletDeliveryClosed"),this.addressCreated=s(this,"addressCreated"),this.headerContextUpdate=s(this,"headerContextUpdate"),this.confirming=!1,this.pendingCartSubmitResolver=null,this.pendingCartSubmitPromise=null,this.cartSubmitConfirmationPending=!1,this.branchSearchDebounceTimer=null,this.countrySearchTimer=null,this.regionSearchTimer=null,this.citySearchTimer=null,this.districtSearchTimer=null,this.citySearchCounter=0,this.componentReady=!1,this.pendingOpen=!1,this.tabChanging=!1,this.intentStorageKey="bullet_delivery_intent",this.sessionShownKey="bullet_delivery_shown",this.incompleteIntentPromptKey="bullet_delivery_incomplete_intent_prompted",this.cartItemAddedEvent="cart::item.added",this.cartItemAddedHandler=null,this.cartSubmittingHandler=null,this.useCartEventApi=!1,this.authLoggedInHandler=null,this.authLoggedOutHandler=null,this.loginClosedHandler=null,this.hasExplicitPreselectedIdsForOpen=!1,this.bulletDeliveryOpenHandler=t=>{this.preselectedAddressId=t?.preselected_address_id,this.preselectedBranchId=t?.preselected_branch_id,this.hasExplicitPreselectedIdsForOpen=null!=t?.preselected_address_id||null!=t?.preselected_branch_id,this.open()},this.closeHandler=null,this.bulletDeliveryMobileSelectHandler=null,this.savedAddressesLoaded=!1,this.activeTab="address",this.isLoggedIn=!1,this.viewMode="main",this.countries=[],this.regions=[],this.cities=[],this.districts=[],this.loadingRegions=!1,this.selectedCountry=null,this.selectedRegion=null,this.selectedCity=null,this.selectedDistrict=null,this.districtName="",this.savedAddresses=[],this.selectedSavedAddress=null,this.selectedSessionAddress=!1,this.branches=[],this.filteredBranches=[],this.selectedBranch=null,this.branchSearchQuery="",this.loadingCountries=!1,this.loadingCities=!1,this.loadingDistricts=!1,this.loadingBranches=!1,this.loadingNearestBranch=!1,this.locationError="",this.savingAddress=!1,this.loadingSavedAddresses=!1,this.showCartWillBeClearedBanner=!1,this.countrySearchQuery="",this.regionSearchQuery="",this.citySearchQuery="",this.districtSearchQuery="",this.searchingCountries=!1,this.searchingRegions=!1,this.searchingCities=!1,this.searchingDistricts=!1,this.displayedCountries=[],this.displayedRegions=[],this.displayedCities=[],this.displayedDistricts=[],this.allocationOutOfCoverageMessage=null,this.newAddressForm={...P.INITIAL_ADDRESS_FORM},this.handleCountrySearch=t=>{this.countrySearchQuery=t},this.handleRegionSearch=t=>{this.regionSearchQuery=t},this.handleCitySearch=t=>{if(this.citySearchQuery=t,this.citySearchTimer&&clearTimeout(this.citySearchTimer),!t.trim())return this.displayedCities=this.cities,void(this.searchingCities=!1);if(t.trim().length<P.DROPDOWN_SEARCH_MIN_CHARS)return;const s=++this.citySearchCounter;this.citySearchTimer=setTimeout((async()=>{this.searchingCities=!0;try{const i=y(this.selectedCountry?.code??"")?this.selectedRegion?.id:void 0,e=await v.getCities(this.selectedCountry?.id,i,t);s===this.citySearchCounter&&(this.displayedCities=e)}catch{s===this.citySearchCounter&&(this.displayedCities=this.cities)}finally{s===this.citySearchCounter&&(this.searchingCities=!1)}}),P.DROPDOWN_SEARCH_DEBOUNCE_MS)},this.handleDistrictSearch=t=>{this.districtSearchQuery=t},this.handleCountryDropdownClosed=()=>{this.countrySearchQuery="",this.displayedCountries=this.countries,this.searchingCountries=!1},this.handleRegionDropdownClosed=()=>{this.regionSearchQuery="",this.displayedRegions=this.regions,this.searchingRegions=!1},this.handleCityDropdownClosed=()=>{this.citySearchQuery="",this.citySearchTimer&&(clearTimeout(this.citySearchTimer),this.citySearchTimer=null),++this.citySearchCounter,this.displayedCities=this.cities,this.searchingCities=!1},this.handleDistrictDropdownClosed=()=>{this.districtSearchQuery="",this.displayedDistricts=this.districts,this.searchingDistricts=!1},this.handleSubmitAddAddress=async t=>{if(t.preventDefault(),!this.savingAddress&&this.selectedCountry&&this.selectedCity&&$(this.selectedCountry?.code,this.selectedRegion?.id,this.selectedDistrict?.id??(this.districtName?.trim()||null))){this.savingAddress=!0;try{const t=this.buildAddressLocationPayload(),{success:s,address:i}=await v.saveAddressLocation(t);if(s){await this.loadSavedAddresses();const t=i??this.savedAddresses[0]??null;t?.is_in_coverage&&(this.selectedSessionAddress=!1,this.selectedSavedAddress=t),this.addressCreated.emit({address:t}),this.viewMode="main",this.districtName=""}else Salla.notify?.error(Salla.lang.get("common.errors.error_occurred"))}catch(t){console.error("SallaBulletDelivery: Error saving address",t),Salla.notify?.error(Salla.lang.get("common.errors.error_occurred"))}finally{this.savingAddress=!1}}},this.handleCountrySelected=t=>{const s=this.countries.find((s=>String(s.id)===String(t.id)))||t;this.countrySearchQuery="",this.displayedCountries=this.countries,this.applyCountryChange(s||null)},this.handleRegionSelected=t=>{const s=this.regions.find((s=>String(s.id)===String(t.id)))||t;this.selectedRegion=s||null,this.regionSearchQuery="",this.displayedRegions=this.regions,this.updateNewAddressForm({region_id:s?.id,city_id:void 0,district_id:void 0,city:void 0,district:void 0}),s&&this.selectedCountry&&this.loadCities(this.selectedCountry.id,s.id)},this.handleCitySelected=t=>{const s=y(this.selectedCountry?.code??""),i=this.cities.find((s=>String(s.id)===String(t.id)))||t;this.selectedCity=i||null,this.selectedDistrict=null,this.districtName="",this.citySearchQuery="",this.displayedCities=this.cities,i&&(this.updateNewAddressForm({city:i,district:void 0}),s&&this.loadDistricts(i.id))},this.handleDistrictSelected=t=>{const s=this.districts.find((s=>String(s.id)===String(t.id)))||t;this.selectedDistrict=s||null,this.districtName="",this.districtSearchQuery="",this.displayedDistricts=this.districts,s&&this.updateNewAddressForm({district:s})}}get supportsPickup(){return Boolean(Salla.config.get("store.shipping.support_pickup"))||Boolean(Salla.config.get("store.support_pickup"))}get openingType(){return Salla.config.get("store.settings.bullet_delivery.settings.type")}get isRequired(){return!!Salla.config.get("store.settings.bullet_delivery.settings.is_required")}get isMobileApp(){return Salla.config.isMobileApp()}async open(){if(this.isMobileApp)Salla.event.dispatch("salla::bullet-delivery.open-sheet");else if(this.componentReady&&this.modal){this.resetState(),this.modal.open(),Salla.event.dispatch("salla::bullet-delivery.modal.opened");try{this.isLoggedIn=!this.isGuestUser();const t=this.cleanStaleGuestAddressIdIfNeeded(this.getStoredIntent());this.applyPreselectedIdsFromIntent(t);const s=!this.isLoggedIn&&"address"===t?.type&&null!=C(t)&&null!=x(t);if(this.activeTab=this.supportsPickup&&t?.type&&("address"===t.type||"branch"===t.type)?t.type:"address",this.isLoggedIn&&"address"===this.activeTab&&(this.loadingSavedAddresses=!0),await Promise.all([this.loadCountries(s),this.isLoggedIn&&"address"===this.activeTab?this.loadSavedAddresses().then((()=>{this.savedAddressesLoaded=!0})).finally((()=>{this.loadingSavedAddresses=!1})):Promise.resolve()]),this.isLoggedIn&&this.preselectedAddressId){const t=this.savedAddresses.find((t=>t.id===this.preselectedAddressId));t&&(this.selectedSessionAddress=!1,this.selectedSavedAddress=t)}if("branch"===this.activeTab){const s=B(t),i=N(t);if(null!=s&&null!=i?await this.loadBranchesWithLocation(s,i):await this.loadBranches(),this.preselectedBranchId){const t=this.branches.find((t=>t.id===this.preselectedBranchId));t&&(this.selectedBranch=t)}}await this.prefillFromSessionStorage()}catch(t){console.error("SallaBulletDelivery: Error loading data",t)}finally{this.overrideScopeSwitchUI()}}else this.pendingOpen=!0}async close(){if(!this.shouldForceNonClosable()||this.confirming)return this.cartSubmitConfirmationPending&&!this.confirming&&this.resolvePendingCartSubmit(),this.bulletDeliveryClosed.emit(),this.modal?.close()}resetState(){this.viewMode="main",this.selectedCountry=null,this.selectedRegion=null,this.selectedCity=null,this.selectedDistrict=null,this.districtName="",this.selectedSavedAddress=null,this.selectedSessionAddress=!1,this.selectedBranch=null,this.branchSearchQuery="",this.regions=[],this.cities=[],this.districts=[],this.branches=[],this.filteredBranches=[],this.newAddressForm={...P.INITIAL_ADDRESS_FORM},this.showCartWillBeClearedBanner=!1,this.allocationOutOfCoverageMessage=null,this.locationError="",this.savedAddressesLoaded=!1,this.loadingSavedAddresses=!1,this.loadingCountries=!1,this.resetSearchState()}getIntentStorage(){const t=Boolean(Salla.config.get("store.settings.bullet_delivery.settings.remember_last_session"));return Salla.storage[t?"store":"session"]}getShownStorage(){return Salla.storage.session}getStoredIntent(){return this.getIntentStorage().get(this.intentStorageKey)}isGuestUser(){return"guest"===String(Salla.config.get("user.type")??"guest")}cleanStaleGuestAddressIdIfNeeded(t){if(!this.isGuestUser()||"address"!==t?.type||!t.address_id)return t;const s={...t,address_id:void 0};return this.setStoredIntent(s),s}applyPreselectedIdsFromIntent(t){this.hasExplicitPreselectedIdsForOpen?this.hasExplicitPreselectedIdsForOpen=!1:(this.preselectedAddressId=void 0,this.preselectedBranchId=void 0,this.isGuestUser()?"branch"===t?.type&&t.branch_id&&(this.preselectedBranchId=t.branch_id):"address"===t?.type&&t.address_id?this.preselectedAddressId=t.address_id:"branch"===t?.type&&t.branch_id&&(this.preselectedBranchId=t.branch_id))}hasIncompleteUserAddressIntent(){if(this.isGuestUser())return!1;const t=this.getStoredIntent();return!(!t||"address"!==t.type||t.address_id||!t.address_details)&&D(t)}hasCompleteIntentForLoggedInUser(){if(this.isGuestUser())return!1;const t=this.getStoredIntent();return!!t&&("address"===t.type?!!t.address_id:"branch"===t.type&&!!t.branch_id)}shouldForceNonClosable(){return!this.isGuestUser()&&!!Salla.url.is_page("cart")&&!this.hasCompleteIntentForLoggedInUser()}shouldPromptIncompleteIntentThisSession(){const t=this.getShownStorage();return this.hasIncompleteUserAddressIntent()&&!0!==t.get(this.incompleteIntentPromptKey)}markIncompleteIntentPrompted(){this.getShownStorage().set(this.incompleteIntentPromptKey,!0)}setStoredIntent(t){this.getIntentStorage().set(this.intentStorageKey,t),this.overrideScopeSwitchUI()}clearBulletDeliveryStoredData(){Salla.storage.session.remove(this.intentStorageKey),Salla.storage.store.remove(this.intentStorageKey),Salla.storage.session.remove(this.sessionShownKey),Salla.storage.session.remove(this.incompleteIntentPromptKey),this.overrideScopeSwitchUI()}async prefillAddressFromStoredIntent(){const t=this.getStoredIntent();if(!t||"address"!==t.type||null==x(t))return;const s=C(t);if(!s)return;const i=this.countries.find((t=>String(t.id)===String(s)));if(!i)return;this.selectedCountry=i,this.updateNewAddressForm({country_id:Number(i.id)});const e=y(i.code),l=x(t),a=I(t),r=A(t),n=t.address_details?.district?.name,[h,o,d]=await Promise.all([e?v.getRegions(i.id):Promise.resolve([]),v.getCities(i.id,e&&null!=a?a:void 0),null!=l?v.getDistricts(Number(l)):Promise.resolve([])]);if(e&&(this.regions=h,this.displayedRegions=this.regions),this.cities=o,this.displayedCities=this.cities,this.districts=d,this.displayedDistricts=this.districts,this.loadingCities=!1,this.loadingRegions=!1,this.loadingDistricts=!1,e&&null!=a){const t=this.regions.find((t=>String(t.id)===String(a)));t&&(this.selectedRegion=t,this.updateNewAddressForm({region_id:t.id}))}if(null!=l&&this.cities.length>0){const t=this.cities.find((t=>String(t.id)===String(l)));t&&(this.selectedCity=t,this.updateNewAddressForm({city_id:t.id,city:t}))}if(this.districts.length>0){const t=this.findPrefillDistrict(r,n);t&&(this.updateNewAddressForm({district_id:t.id,district:t}),this.selectedDistrict=t)}!this.selectedDistrict&&n&&(this.districtName=n)}updateNewAddressForm(t){this.newAddressForm={...this.newAddressForm,...t}}hasBeenShownThisSession(){return!0===this.getShownStorage().get(this.sessionShownKey)}markShownThisSession(){this.getShownStorage().set(this.sessionShownKey,!0)}getIPLocationConfig(){const t="store.shipping.delivery_location",s={countryId:Salla.config.get(`${t}.country_id`),regionId:Salla.config.get(`${t}.region_id`),cityId:Salla.config.get(`${t}.city_id`),districtId:Salla.config.get(`${t}.district_id`)};return localStorage.getItem(E)?JSON.parse(localStorage.getItem(E)):s}async loadCountries(t=!1){this.loadingCountries=!0;const s="branch"===this.activeTab;try{this.countries=await v.getCountries(s),this.displayedCountries=this.countries;const{countryId:l,regionId:a,cityId:r,districtId:n}=this.getIPLocationConfig();i="getIPLocationConfig",e=this.getIPLocationConfig(),localStorage.getItem("salla-bullet-delivery-debug")&&(void 0!==e?console.log(i,e):console.log(i));const h=l&&this.countries.length>0?this.countries.find((t=>String(t.id)===String(l))):null;h&&(this.selectedCountry=h,this.updateNewAddressForm({country_id:Number(this.selectedCountry.id)}),!t)&&(null!=a||null!=r||null!=n?await this.prefillFromIPLocation(h,{regionId:a,cityId:r,districtId:n}):y(this.selectedCountry.code)?await this.loadRegions(this.selectedCountry.id):await this.loadCities(this.selectedCountry.id))}finally{this.loadingCountries=!1}var i,e}async prefillFromIPLocation(t,s){const i=y(t.code),{regionId:e,cityId:l,districtId:a}=s,[r,n,h]=await Promise.all([i?v.getRegions(t.id):Promise.resolve([]),v.getCities(t.id,i&&null!=e?e:void 0),null!=l?v.getDistricts(Number(l)):Promise.resolve([])]);if(i&&(this.regions=r,this.displayedRegions=this.regions),this.cities=n,this.displayedCities=this.cities,this.districts=h,this.displayedDistricts=this.districts,this.loadingRegions=!1,this.loadingCities=!1,this.loadingDistricts=!1,i&&null!=e){const t=this.regions.find((t=>String(t.id)===String(e)));t&&(this.selectedRegion=t,this.updateNewAddressForm({region_id:t.id}))}if(null!=l&&this.cities.length>0){const t=this.cities.find((t=>String(t.id)===String(l)));t&&(this.selectedCity=t,this.updateNewAddressForm({city_id:t.id,city:t}))}if(null!=a&&this.districts.length>0){const t=this.findPrefillDistrict(a);t&&(this.selectedDistrict=t,this.updateNewAddressForm({district_id:t.id,district:t}))}}async loadCities(t,s){this.loadingCities=!0,this.cities=[],this.displayedCities=[],this.districts=[],this.displayedDistricts=[],this.selectedCity=null,this.selectedDistrict=null,this.districtName="";try{this.cities=await v.getCities(t,s),this.displayedCities=this.cities}finally{this.loadingCities=!1}}async loadDistricts(t){this.loadingDistricts=!0,this.districts=[],this.displayedDistricts=[],this.selectedDistrict=null,this.districtName="";try{this.districts=await v.getDistricts(t),this.displayedDistricts=this.districts}finally{this.loadingDistricts=!1}}findPrefillDistrict(t,s){if(0===this.districts.length)return;if(null!=t){const s=this.districts.find((s=>String(s.id)===String(t)));if(s)return s}const i=s?.trim().toLowerCase();return i?this.districts.find((t=>{const s=t.name?.trim().toLowerCase(),e=t.name_en?.trim().toLowerCase();return s===i||e===i})):void 0}async loadBranches(){this.loadingBranches=!0;try{this.branches=await v.getBranches({country_id:this.selectedCountry?.id}),this.filterBranches()}finally{this.loadingBranches=!1}}filterBranches(){this.filteredBranches=((t,s)=>{if(!s)return t;const i=s.toLowerCase();return t.filter((t=>t.name.toLowerCase().includes(i)||t.city?.name?.toLowerCase().includes(i)))})(this.branches,this.branchSearchQuery)}async prefillFromSessionStorage(){try{const t=this.getStoredIntent();if(!t)return;if("address"!==this.activeTab||"address"!==t.type||this.isLoggedIn||await this.prefillAddressFromStoredIntent(),"branch"===this.activeTab&&"branch"===t.type){const s=C(t);if(null!=s){const i=this.countries.find((t=>String(t.id)===String(s)));if(i){this.selectedCountry=i,this.updateNewAddressForm({country_id:Number(i.id)});const s=M(t);if(null!=s&&this.branches.length>0){const t=this.branches.find((t=>t.id===s));t&&(this.selectedBranch=t)}}}}}catch(t){console.error("[BulletDelivery] Error prefilling from session storage:",t)}}async loadSavedAddresses(){this.savedAddresses=await v.getSavedAddresses();const t=this.getStoredIntent();if(D(t))this.selectedSessionAddress=!0,this.selectedSavedAddress=null;else{const t=this.savedAddresses.find((t=>t.is_default&&!1!==t.is_in_coverage));if(t)this.selectedSavedAddress=t;else{const t=this.savedAddresses.find((t=>!1!==t.is_in_coverage));t&&(this.selectedSavedAddress=t)}}}applyCountryChange(t){this.selectedCountry=t,this.selectedRegion=null,this.regions=[],this.displayedRegions=[],this.cities=[],this.displayedCities=[],this.districts=[],this.displayedDistricts=[],this.selectedCity=null,this.selectedDistrict=null,this.districtName="",this.allocationOutOfCoverageMessage=null,this.regionSearchQuery="",this.citySearchQuery="",this.districtSearchQuery="",this.searchingRegions=!1,this.searchingCities=!1,this.searchingDistricts=!1,this.clearSearchTimers(),this.selectedCountry&&(this.updateNewAddressForm({country_id:Number(this.selectedCountry.id),region_id:void 0,city_id:void 0,district_id:void 0,city:void 0,district:void 0}),"branch"===this.activeTab?this.loadBranches():y(this.selectedCountry.code)?this.loadRegions(this.selectedCountry.id):this.loadCities(this.selectedCountry.id))}async loadRegions(t){this.loadingRegions=!0,this.regions=[],this.displayedRegions=[],this.selectedRegion=null,this.cities=[],this.displayedCities=[],this.districts=[],this.displayedDistricts=[],this.selectedCity=null,this.selectedDistrict=null,this.districtName="";try{this.regions=await v.getRegions(t),this.displayedRegions=this.regions}finally{this.loadingRegions=!1}}emitHeaderContextUpdate(t,s,i){let e="";"address"===t.type?s?e=s.district?.name&&s.city?.name?`${s.district.name}، ${s.city.name}`:s.city?.name??"":this.selectedCity?e=this.selectedDistrict?`${this.selectedDistrict.name}، ${this.selectedCity.name}`:this.selectedCity.name:t.address_details&&(e=[t.address_details.district?.name,t.address_details.city.name,t.address_details.country.name].filter(Boolean).join("، ")||t.address_details.short_address||""):i?e=i.name:t.branch_details&&(e=t.branch_details.city??t.branch_details.name);const l="address"===t.type?Salla.lang.get("mobile_app.strings.delivery"):Salla.lang.get("mobile_app.strings.pickup");this.headerContextUpdate.emit({type:t.type,display_text:e?`${l}: ${e}`:"",country_code:t.country_code,city:this.selectedCity?.name??t.address_details?.city?.name,district:this.selectedDistrict?.name??t.address_details?.district?.name,branch_name:i?.name??t.branch_details?.name})}handleBranchSearch(t){const s=t.target.value;if(this.branchSearchQuery=s,this.branchSearchDebounceTimer&&clearTimeout(this.branchSearchDebounceTimer),!s?.trim())return this.branchSearchQuery="",void this.loadBranches();this.branchSearchDebounceTimer=setTimeout((async()=>{if(!(s.trim().length<2)){this.loadingBranches=!0;try{this.branches=await v.getBranches({country_id:this.selectedCountry?.id,query:s}),this.filterBranches()}finally{this.loadingBranches=!1}}}),1e3)}clearSearchTimers(){[this.countrySearchTimer,this.regionSearchTimer,this.citySearchTimer,this.districtSearchTimer].forEach((t=>{t&&clearTimeout(t)})),this.countrySearchTimer=this.regionSearchTimer=this.citySearchTimer=this.districtSearchTimer=null}resetSearchState(){this.countrySearchQuery="",this.regionSearchQuery="",this.citySearchQuery="",this.districtSearchQuery="",this.searchingCountries=!1,this.searchingRegions=!1,this.searchingCities=!1,this.searchingDistricts=!1,this.displayedCountries=[],this.displayedRegions=[],this.displayedCities=[],this.displayedDistricts=[],this.clearSearchTimers()}async loadBranchesWithLocation(t,s){this.loadingBranches=!0;try{if(this.branches=await v.getBranches({country_id:this.selectedCountry?.id,lat:t,lng:s}),this.filterBranches(),!this.selectedCountry&&this.branches.length>0){const t=this.branches[0];if(t.country){const s=this.countries.find((s=>s.id===t.country.id));s&&(this.selectedCountry=s,this.updateNewAddressForm({country_id:Number(s.id)}))}}}finally{this.loadingBranches=!1}}async handleFindNearestBranch(){if(navigator.geolocation){this.loadingNearestBranch=!0,this.locationError="";try{const t=await new Promise(((t,s)=>{navigator.geolocation.getCurrentPosition(t,s,{enableHighAccuracy:!0,timeout:1e4,maximumAge:0})})),{latitude:s,longitude:i}=t.coords;await this.loadBranchesWithLocation(s,i);const e=function(t,s,i){let e=null,l=Number.POSITIVE_INFINITY;for(const a of t){const t=null!=a.location?.lat?Number(a.location.lat):Number.NaN,r=null!=a.location?.lng?Number(a.location.lng):Number.NaN;if(Number.isNaN(t)||Number.isNaN(r)||!1===a.is_open)continue;const n=f(s,i,t,r);n<l&&(l=n,e=a)}return e}(this.branches,s,i);e&&(this.selectedBranch=e,this.branchSearchQuery="",this.filterBranches())}catch(t){const s=t;this.locationError=L["number"==typeof s?.code?s.code:-1]??"An error occurred while detecting location"}finally{this.loadingNearestBranch=!1}}else this.locationError=Salla.lang.get("pages.checkout.current_location_not_supported")}handleBranchSelect(t){this.selectedBranch=t}handleSavedAddressSelect(t){!1!==t.is_in_coverage?(this.selectedSavedAddress=t,this.selectedSessionAddress=!1):Salla.notify?.error(Salla.lang.get("pages.checkout.shipping_not_available"))}handleSessionAddressSelect(){this.selectedSessionAddress=!0,this.selectedSavedAddress=null}async handleAddNewAddress(){this.viewMode="add-address";const t=this.getStoredIntent(),s=C(t);if(s&&this.countries.length>0){const t=this.countries.find((t=>t.id===s));t&&(this.selectedCountry=t,this.updateNewAddressForm({country_id:Number(t.id)}),y(t.code)?await this.loadRegions(t.id):await this.loadCities(t.id))}}handleBackToAddressList(){this.viewMode="main"}buildAddressLocationPayload(){const t=this.selectedDistrict?.name??this.districtName?.trim()??"";return function(t){const{countryId:s,countryCode:i,regionId:e,cityId:l,districtId:a,description:r=""}=t,n=r||"";return{country_id:Number(s)||void 0,region_id:null!=e?Number(e):void 0,city_id:null!=l?Number(l):void 0,district_id:null!=a?Number(a):void 0,description:n,...i&&y(i)&&{local:n}}}({countryId:this.selectedCountry?.id??0,countryCode:this.selectedCountry?.code,regionId:this.selectedRegion?.id,cityId:this.selectedCity?.id,districtId:this.selectedDistrict?.id,description:t})}async handleTabChange(t){if(!this.tabChanging){this.tabChanging=!0;try{this.activeTab=t,this.showCartWillBeClearedBanner=!1,this.allocationOutOfCoverageMessage=null,this.resetSearchState();const s="branch"===t;this.countries=await v.getCountries(s),this.displayedCountries=this.countries;const i=this.selectedCountry?.id;if(null!=i&&(this.selectedCountry=this.countries.find((t=>t.id===i))||null),!this.selectedCountry){const{countryId:t}=this.getIPLocationConfig();t&&this.countries.length>0&&(this.selectedCountry=this.countries.find((s=>String(s.id)===String(t)))||null),this.selectedCountry||1!==this.countries.length||(this.selectedCountry=this.countries[0])}if(this.selectedCountry)if("branch"===t){const t=this.getStoredIntent(),s=B(t),i=N(t);null!=s&&null!=i?await this.loadBranchesWithLocation(s,i):await this.loadBranches();const e=M(t);if(null!=e&&this.branches.length>0){const t=this.branches.find((t=>t.id===e));t&&(this.selectedBranch=t)}}else if("address"===t){if(this.isLoggedIn&&!this.savedAddressesLoaded){this.loadingSavedAddresses=!0;try{await this.loadSavedAddresses(),this.savedAddressesLoaded=!0}finally{this.loadingSavedAddresses=!1}}if(!this.isLoggedIn){const t=this.getStoredIntent();t&&x(t)&&await this.prefillAddressFromStoredIntent()}}}finally{this.tabChanging=!1}}}isConfirmDisabled(){return"branch"===this.activeTab?!this.selectedBranch:!("address"!==this.activeTab||this.isLoggedIn&&this.selectedSessionAddress||(this.isLoggedIn&&this.selectedSavedAddress?!1!==this.selectedSavedAddress.is_in_coverage:this.selectedCountry&&this.selectedCity&&$(this.selectedCountry?.code,this.selectedRegion?.id,this.selectedDistrict?.id??(this.districtName?.trim()||null))))}handleLogin(){Salla.auth.setCanRedirect(!1),Salla.event.dispatch("salla::bullet-delivery.modal.close.requested"),Salla.event.dispatch("login::open",Salla.url.is_page("cart")?{withoutReload:!0,source:"cart-submit"}:{withoutReload:!0,source:"bullet-delivery"})}resolvePendingCartSubmit(){if(!this.pendingCartSubmitResolver)return;const t=this.pendingCartSubmitResolver;this.pendingCartSubmitResolver=null,this.pendingCartSubmitPromise=null,this.cartSubmitConfirmationPending=!1,t()}buildIntentAddress(){if("address"!==this.activeTab||!this.selectedCountry||!this.selectedCity)return;const t={id:this.selectedCountry.id,name:this.selectedCountry.name,code:this.selectedCountry.code},s={id:this.selectedCity.id,name:this.selectedCity.name},i=this.selectedRegion?{id:this.selectedRegion.id,name:this.selectedRegion.name,code:this.selectedRegion.code}:void 0,e=this.selectedDistrict?{id:this.selectedDistrict.id,name:this.selectedDistrict.name}:this.districtName?{id:0,name:this.districtName}:void 0,l=this.selectedSavedAddress?.short_address;return{country:t,region:i,city:s,district:e,short_address:l}}buildIntentAddressFromSaved(t){return{country:{id:t.country?.id??t.country_id??0,name:t.country?.name??"",code:t.country?.code},region:t.region?{id:t.region.id,name:t.region.name,code:t.region.code}:void 0,city:{id:t.city?.id??t.city_id??0,name:t.city?.name??""},district:t.district?{id:t.district.id,name:t.district.name}:void 0,short_address:t.short_address}}buildIntentBranch(){if("branch"!==this.activeTab||!this.selectedBranch)return;const t=this.selectedBranch,s=null!=t.location?.lat?Number(t.location.lat):void 0,i=null!=t.location?.lng?Number(t.location.lng):void 0;return{id:t.id,name:t.name,city:t.city?.name,latitude:s,longitude:i}}buildAllocationConfirmedAddressData(t){return"address"!==this.activeTab?null:{saved_address:t??this.selectedSavedAddress??void 0,country:this.selectedCountry??void 0,region:this.selectedRegion??void 0,city:this.selectedCity??void 0,district:this.selectedDistrict??void 0,district_name:this.districtName?.trim()||void 0,short_address:t?.short_address??this.selectedSavedAddress?.short_address,form_data:{...this.newAddressForm}}}buildAllocationConfirmedAddressFromIntent(t){if("address"!==t.type)return null;const s=t.address_details,i=Number(t.country_id)||0;return{country:s?.country?{id:s.country.id,name:s.country.name,code:s.country.code??t.country_code??""}:void 0,region:s?.region?{id:Number(s.region.id),name:s.region.name,country_id:i,code:s.region.code??void 0}:void 0,city:s?.city?{id:Number(s.city.id),name:s.city.name,country_id:i}:void 0,district:s?.district?{id:Number(s.district.id),name:s.district.name,city_id:Number(s.city?.id)||0}:void 0,short_address:s?.short_address}}buildBranchFromIntent(t){if("branch"!==t.type||!t.branch_details)return null;const s=t.branch_details,i={id:s.id,name:s.name};return s.city&&(i.city={id:0,name:s.city}),null!=s.latitude&&null!=s.longitude&&(i.location={lat:String(s.latitude),lng:String(s.longitude)}),i}buildAllocationRequestFromIntent(t){if("branch"===t.type)return{type:"branch",branch_id:null!=t.branch_id?String(t.branch_id):""};if(null!=t.address_id)return{type:"address",address_id:String(t.address_id)};const s=t.address_details,i={type:"address",country_id:null!=t.country_id?String(t.country_id):"",city_id:null!=s?.city?.id?String(s.city.id):""};return null!=s?.region?.id&&(i.region_id=String(s.region.id)),null!=s?.district?.id&&(i.district_id=String(s.district.id)),i}applyMobileBulletDeliverySelection(t){if(!t||"address"!==t.type&&"branch"!==t.type)return void console.warn("SallaBulletDelivery: ignoring invalid mobile select payload",t);const s=t.allocation_headers??{},i=s["s-scope-allocation-type"]??t.type,e=s["s-scope-allocation-id"];i&&Salla.api.setHeader("s-scope-allocation-type",i),e&&Salla.api.setHeader("s-scope-allocation-id",String(e));const l=Salla.config.get("store.scope",Salla.storage.get("scope"))||{};Salla.storage.set("scope",{...l,allocation_type:i,allocation_id:e?String(e):void 0}),this.markShownThisSession();const a={...t,allocation_headers:{"s-scope-allocation-type":i,"s-scope-allocation-id":e?String(e):void 0}};this.setStoredIntent(a),m();const r=this.buildBranchFromIntent(a),n={...a,address:this.buildAllocationConfirmedAddressFromIntent(a),branch:r,allocation_request:this.buildAllocationRequestFromIntent(a),allocation_response:null};Salla.event.dispatch("salla::bullet-delivery.allocation.confirmed",n),this.bulletDeliveryConfirmed.emit({...a,branch:r??void 0}),this.emitHeaderContextUpdate(a,void 0,r??void 0),setTimeout((()=>window.location.reload()),100)}extractMobileSelectPayload(t){return t&&"object"==typeof t?"payload"in t&&t.payload?t.payload:t:null}async handleConfirm(){if(this.isConfirmDisabled()||this.confirming)return;this.confirming=!0,this.confirmBtn?.load();let t=!1;try{const s={type:this.activeTab,country_id:Number(this.selectedCountry?.id)||0,country_code:this.selectedCountry?.code||""};let i,e,l;if("address"===this.activeTab)if(this.isLoggedIn&&this.selectedSessionAddress){const t=await this.saveSessionAddressToProfile();if(!t)return Salla.notify?.error(Salla.lang.get("common.errors.error_occurred")),void this.confirmBtn?.stop();s.address_id=t.id,i=t,this.selectedSessionAddress=!1,this.selectedSavedAddress=t,s.address_details=this.buildIntentAddressFromSaved(t)}else this.isLoggedIn&&this.selectedSavedAddress?(s.address_id=this.selectedSavedAddress.id,i=this.selectedSavedAddress,s.address_details=this.buildIntentAddressFromSaved(this.selectedSavedAddress)):s.address_details=this.buildIntentAddress();else s.branch_details=this.buildIntentBranch(),s.branch_id=this.selectedBranch?.id,e=this.selectedBranch||void 0;"address"===this.activeTab?this.isLoggedIn&&this.selectedSavedAddress?l={type:"address",address_id:String(this.selectedSavedAddress.id)}:(l={type:"address",country_id:String(this.selectedCountry?.id||0),city_id:String(this.selectedCity?.id||"")},y(this.selectedCountry?.code??"")&&(this.selectedRegion?.id&&(l.region_id=String(this.selectedRegion.id)),l.district_id=String(this.selectedDistrict?.id||""))):l={type:"branch",branch_id:String(this.selectedBranch?.id||"")};const a=await v.allocateScope(l);if(!a.success){console.error("BulletDelivery: Scope allocation failed",a.error);const t=a.error||("address"===this.activeTab?Salla.lang.get("pages.checkout.address_out_of_coverage"):Salla.lang.get("pages.checkout.failed_to_set_pickup"));return this.allocationOutOfCoverageMessage=t,this.confirmBtn?.stop(),void(this.confirming=!1)}let r;if(a.data){const t=a.data;r=t.id;const i=t?.allocation?.type,e=t?.allocation?.branch_id;i&&Salla.api.setHeader("s-scope-allocation-type",i),e&&Salla.api.setHeader("s-scope-allocation-id",String(e));const l=Salla.config.get("store.scope",Salla.storage.get("scope"))||{};Salla.storage.set("scope",{...l,id:r,allocation_type:i,allocation_id:e?String(e):void 0}),s.allocation_headers={"s-scope-allocation-type":i,"s-scope-allocation-id":e?String(e):void 0}}this.markShownThisSession(),this.setStoredIntent(s),r&&(await v.setDeliveryScope(r),m());const n={...s,address:this.buildAllocationConfirmedAddressData(i),branch:e??null,allocation_request:l,allocation_response:a.data??null};Salla.event.dispatch("salla::bullet-delivery.allocation.confirmed",n),this.bulletDeliveryConfirmed.emit({...s,address:i,branch:e}),this.emitHeaderContextUpdate(s,i,e),t=!0,setTimeout((()=>{if(this.confirmBtn?.stop(),this.close(),this.confirming=!1,this.cartSubmitConfirmationPending)this.resolvePendingCartSubmit();else if(r){const t=Salla.storage.get("scope")||{};let s=Salla.helpers.addParamToUrl("scope",r);t.allocation_id&&(s=Salla.helpers.addParamToUrl("allocation_id",t.allocation_id,s)),t.allocation_type&&(s=Salla.helpers.addParamToUrl("allocation_type",t.allocation_type,s)),window.location.replace(s)}else window.location.reload()}),500)}finally{t||(this.confirming=!1)}}getCartViewConfig(t){if(!t||!Salla.url.is_page("cart"))return null;const s="branch"===t.type,i="address"===t.type;return s&&!this.supportsPickup||!s&&!i?null:{title:s?Salla.lang.get("pages.checkout.pickup_option"):Salla.lang.get("pages.checkout.delivery_option"),subtitle:S(t,Salla.lang.get("common.elements.to"),""),buttonText:Salla.lang.get("common.elements.edit"),isAddress:i,intent:t}}createCartViewElement(){const t=this.getStoredIntent(),s=this.getCartViewConfig(t);if(!s)return null;const{title:i,subtitle:e,buttonText:l,intent:a}=s,r="branch"===a.type?{preselected_branch_id:M(a)}:{preselected_address_id:a.address_id},h=document.createElement("span");h.className="s-bullet-delivery-cart-view-icon s-bullet-delivery-tab-icon",h.setAttribute("aria-hidden","true"),h.innerHTML=n;const o=document.createElement("span");o.className="s-bullet-delivery-cart-view-title",o.textContent=i;const d=document.createElement("span");d.className="s-bullet-delivery-cart-view-subtitle",d.textContent=e;const c=document.createElement("div");c.className="s-bullet-delivery-cart-view-text",c.append(o,d);const u=document.createElement("div");u.className="s-bullet-delivery-cart-view-info",u.append(h,c);const p=document.createElement("salla-button");p.className="s-bullet-delivery-cart-view-button",p.setAttribute("fill","outline"),p.setAttribute("color","primary"),p.textContent=l,p.addEventListener("click",(()=>Salla.event.emit("salla::bullet-delivery.modal.open.requested",r)));const b=document.createElement("div");return b.className="s-bullet-delivery-cart-view",b.append(u,p),b}renderTabs(){return this.supportsPickup?i("div",{class:"s-bullet-delivery-tabs"},i("button",{type:"button",class:{"s-bullet-delivery-tab":!0,"s-bullet-delivery-tab--active":"address"===this.activeTab},onClick:()=>this.handleTabChange("address")},i("span",{class:"s-bullet-delivery-tab-icon",innerHTML:n,"aria-hidden":"true"}),i("span",null,Salla.lang.get("mobile_app.strings.delivery"))),i("button",{type:"button",class:{"s-bullet-delivery-tab":!0,"s-bullet-delivery-tab--active":"branch"===this.activeTab},onClick:()=>this.handleTabChange("branch")},i("span",{class:"s-bullet-delivery-tab-icon",innerHTML:T,"aria-hidden":"true"}),i("span",null,Salla.lang.get("mobile_app.strings.pickup")))):null}renderAlert(t){return i("div",{class:"s-bullet-delivery-allocation-out-of-coverage",role:"alert"},i("span",{class:"s-bullet-delivery-allocation-out-of-coverage-icon","aria-hidden":"true"},i("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-hidden":"true"},i("title",null,"Information"),i("circle",{cx:"10",cy:"10",r:"9",stroke:"currentColor","stroke-width":"1.5",fill:"currentColor"}),i("text",{x:"10",y:"14","text-anchor":"middle",fill:"white","font-size":"12","font-weight":"bold"},"i"))),i("span",{class:"s-bullet-delivery-allocation-out-of-coverage-text"},t))}renderAllocationOutOfCoverageAlert(){const t=this.allocationOutOfCoverageMessage||Salla.lang.get("pages.checkout.shipping_not_available");return this.renderAlert(t)}renderCountrySelect(){return i("div",{class:"s-bullet-delivery-field"},i("salla-searchable-dropdown",{label:Salla.lang.get("blocks.buy_as_gift.receiver_country"),placeholder:Salla.lang.get("pages.checkout.select_country"),items:this.displayedCountries,selectedItem:this.selectedCountry,loading:this.loadingCountries,searching:this.searchingCountries,disabled:this.countries.length<=1,required:!0,inputId:"bullet-delivery-country",searchQuery:this.countrySearchQuery,clientSearch:!0,onItemSelected:t=>this.handleCountrySelected(t.detail),onSearchInput:t=>this.handleCountrySearch(t.detail),onDropdownClosed:()=>this.handleCountryDropdownClosed()}))}renderRegionSelect(){return y(this.selectedCountry?.code??"")&&this.selectedCountry?i("div",{class:"s-bullet-delivery-field"},i("salla-searchable-dropdown",{label:Salla.lang.get("pages.checkout.region_field"),placeholder:Salla.lang.get("pages.checkout.select_region"),items:this.displayedRegions,selectedItem:this.selectedRegion,loading:this.loadingRegions,searching:this.searchingRegions,disabled:this.loadingRegions||0===this.regions.length,required:!0,inputId:"bullet-delivery-region",searchQuery:this.regionSearchQuery,clientSearch:!0,onItemSelected:t=>this.handleRegionSelected(t.detail),onSearchInput:t=>this.handleRegionSearch(t.detail),onDropdownClosed:()=>this.handleRegionDropdownClosed()})):null}renderCityDistrictSelects(){const t=y(this.selectedCountry?.code??""),s=t,e=s&&this.selectedCity&&!this.loadingDistricts&&0===this.districts.length,l=!this.selectedCountry||t&&!this.selectedRegion||this.loadingCities||0===this.cities.length,a=!this.selectedCountry||t&&!this.selectedRegion||!this.selectedCity||this.loadingDistricts;return i("div",{class:"s-bullet-delivery-field-row"},i("div",{class:"s-bullet-delivery-field"},i("salla-searchable-dropdown",{label:Salla.lang.get("blocks.buy_as_gift.receiver_city"),placeholder:Salla.lang.get("pages.checkout.select_city"),items:this.displayedCities,selectedItem:this.selectedCity,loading:this.loadingCities,searching:this.searchingCities,disabled:l,required:!0,inputId:"bullet-delivery-city",searchQuery:this.citySearchQuery,onItemSelected:t=>this.handleCitySelected(t.detail),onSearchInput:t=>this.handleCitySearch(t.detail),onDropdownClosed:()=>this.handleCityDropdownClosed(),dropUp:!0})),s&&i("div",{class:"s-bullet-delivery-field"},e?i("div",null,i("label",{class:"s-bullet-delivery-label",htmlFor:"bullet-delivery-district"},Salla.lang.get("pages.checkout.district_field"),i("span",{class:"text-red-500"}," *")),i("input",{id:"bullet-delivery-district",type:"text",class:"form-input",placeholder:Salla.lang.get("pages.checkout.select_district"),value:this.districtName,disabled:a,onInput:t=>{this.districtName=t.target.value,this.updateNewAddressForm({district:void 0})}})):i("salla-searchable-dropdown",{label:Salla.lang.get("pages.checkout.district_field"),placeholder:Salla.lang.get("pages.checkout.select_district"),items:this.displayedDistricts,selectedItem:this.selectedDistrict,loading:this.loadingDistricts,searching:this.searchingDistricts,disabled:a||0===this.districts.length,required:!0,inputId:"bullet-delivery-district",searchQuery:this.districtSearchQuery,clientSearch:!0,onItemSelected:t=>this.handleDistrictSelected(t.detail),onSearchInput:t=>this.handleDistrictSearch(t.detail),onDropdownClosed:()=>this.handleDistrictDropdownClosed(),dropUp:!0})))}renderSavedAddressesEmptyState(){return i("div",{class:"s-bullet-delivery-saved-addresses-empty"},i("div",{class:"s-bullet-delivery-saved-addresses-empty-icon","aria-hidden":"true"},i("svg",{width:"28",height:"28",viewBox:"0 0 28 29",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i("title",null,"No Saved Adresses"),i("path",{d:"M20.16 0C21.4613 0 22.6773 0.341333 23.808 1.024C24.9387 1.70667 25.8347 2.61333 26.496 3.744C27.1787 4.91733 27.52 6.18667 27.52 7.552C27.52 9.45067 26.8267 11.232 25.44 12.896C24.4587 14.0907 23.0827 15.2427 21.312 16.352H21.28C20.9387 16.5653 20.5653 16.672 20.16 16.672C19.7547 16.672 19.3813 16.5653 19.04 16.352H19.008C17.2373 15.2213 15.8613 14.0693 14.88 12.896C13.4933 11.232 12.8 9.45067 12.8 7.552C12.8 6.18667 13.1413 4.91733 13.824 3.744C14.4853 2.61333 15.3813 1.70667 16.512 1.024C17.6427 0.341333 18.8587 0 20.16 0ZM11.488 1.984C9.67467 2.368 8.04267 3.14667 6.592 4.32C5.14133 5.49333 4.01067 6.92267 3.2 8.608C2.34667 10.3573 1.92 12.224 1.92 14.208C1.92 14.72 1.952 15.2427 2.016 15.776L2.08 15.744C2.57067 15.488 2.94933 15.3067 3.216 15.2C3.48267 15.0933 3.73867 15.0933 3.984 15.2C4.22933 15.3067 4.4 15.488 4.496 15.744C4.592 16 4.58667 16.256 4.48 16.512C4.37333 16.768 4.19733 16.9493 3.952 17.056C3.70667 17.1627 3.36 17.3227 2.912 17.536L2.656 17.664C2.57067 17.7067 2.48533 17.7387 2.4 17.76C2.89067 19.4667 3.70133 20.9973 4.832 22.352C5.96267 23.7067 7.296 24.7573 8.832 25.504C10.432 26.272 12.1173 26.656 13.888 26.656C15.4667 26.656 16.9813 26.3467 18.432 25.728C19.8187 25.1307 21.0667 24.288 22.176 23.2C21.92 23.0507 21.7653 22.8373 21.712 22.56C21.6587 22.2827 21.7013 22.0267 21.84 21.792C21.9787 21.5573 22.176 21.408 22.432 21.344C22.8373 21.2587 23.2 21.12 23.52 20.928C23.6907 20.8427 23.8613 20.8 24.032 20.8C24.8 19.5413 25.3333 18.176 25.632 16.704C25.6747 16.4267 25.808 16.2133 26.032 16.064C26.256 15.9147 26.496 15.8667 26.752 15.92C27.008 15.9733 27.2107 16.1173 27.36 16.352C27.5093 16.5867 27.552 16.832 27.488 17.088C27.0613 19.2853 26.1973 21.264 24.896 23.024C23.5947 24.784 22.0053 26.1547 20.128 27.136C18.1653 28.16 16.0853 28.672 13.888 28.672C11.3707 28.672 9.03467 28.0107 6.88 26.688C4.78933 25.408 3.12533 23.68 1.888 21.504C0.629333 19.264 0 16.832 0 14.208C0 11.904 0.490667 9.73867 1.472 7.712C2.41067 5.74933 3.728 4.09067 5.424 2.736C7.12 1.38133 9.01333 0.48 11.104 0.032C11.36 -0.032 11.6 0.0106667 11.824 0.16C12.048 0.309333 12.1867 0.522667 12.24 0.8C12.2933 1.07733 12.2453 1.328 12.096 1.552C11.9467 1.776 11.744 1.92 11.488 1.984ZM14.72 7.552C14.72 8.96 15.2533 10.304 16.32 11.584C17.1733 12.5867 18.3893 13.6 19.968 14.624C20.032 14.6453 20.096 14.656 20.16 14.656C20.224 14.656 20.288 14.6453 20.352 14.624C21.9307 13.6213 23.1467 12.608 24 11.584C25.0667 10.304 25.6 8.96 25.6 7.552C25.6 6.57067 25.3547 5.65333 24.864 4.8C24.3733 3.94667 23.7067 3.26933 22.864 2.768C22.0213 2.26667 21.12 2.016 20.16 2.016C19.2 2.016 18.2987 2.26667 17.456 2.768C16.6133 3.26933 15.9467 3.94667 15.456 4.8C14.9653 5.65333 14.72 6.57067 14.72 7.552ZM17.28 7.68C17.28 6.848 17.5627 6.13867 18.128 5.552C18.6933 4.96533 19.3707 4.672 20.16 4.672C20.9493 4.672 21.6267 4.96533 22.192 5.552C22.7573 6.13867 23.04 6.848 23.04 7.68C23.04 8.512 22.7573 9.216 22.192 9.792C21.6267 10.368 20.9493 10.656 20.16 10.656C19.3707 10.656 18.6933 10.368 18.128 9.792C17.5627 9.216 17.28 8.512 17.28 7.68ZM6.752 14.688C7.62667 14.7733 8.53333 15.0293 9.472 15.456C9.70667 15.5627 9.87733 15.744 9.984 16C10.0907 16.256 10.0907 16.512 9.984 16.768C9.87733 17.024 9.70133 17.2 9.456 17.296C9.21067 17.392 8.97067 17.3867 8.736 17.28C7.94667 16.9387 7.22133 16.736 6.56 16.672C6.28267 16.6293 6.064 16.5013 5.904 16.288C5.744 16.0747 5.68 15.8293 5.712 15.552C5.744 15.2747 5.86133 15.0507 6.064 14.88C6.26667 14.7093 6.496 14.6453 6.752 14.688ZM17.6 20.544C18.304 20.864 18.976 21.0987 19.616 21.248C19.872 21.312 20.0693 21.4613 20.208 21.696C20.3467 21.9307 20.3893 22.1813 20.336 22.448C20.2827 22.7147 20.144 22.9227 19.92 23.072C19.696 23.2213 19.4453 23.264 19.168 23.2C18.4213 23.0293 17.632 22.752 16.8 22.368C16.5653 22.2613 16.4 22.08 16.304 21.824C16.208 21.568 16.2133 21.312 16.32 21.056C16.4267 20.8 16.6027 20.624 16.848 20.528C17.0933 20.432 17.344 20.4373 17.6 20.544ZM12.832 17.44C13.0027 17.568 13.248 17.7493 13.568 17.984L14.496 18.688C14.7093 18.8587 14.8373 19.0773 14.88 19.344C14.9227 19.6107 14.8693 19.856 14.72 20.08C14.5707 20.304 14.368 20.4427 14.112 20.496C13.856 20.5493 13.6107 20.5013 13.376 20.352L11.744 19.072C11.5307 18.9227 11.4027 18.7093 11.36 18.432C11.3173 18.1547 11.3707 17.904 11.52 17.68C11.6693 17.456 11.872 17.3227 12.128 17.28C12.384 17.2373 12.6187 17.2907 12.832 17.44ZM20.16 8.672C20.416 8.672 20.64 8.576 20.832 8.384C21.024 8.192 21.12 7.95733 21.12 7.68C21.12 7.40267 21.024 7.16267 20.832 6.96C20.64 6.75733 20.416 6.656 20.16 6.656C19.904 6.656 19.68 6.75733 19.488 6.96C19.296 7.16267 19.2 7.40267 19.2 7.68C19.2 7.95733 19.296 8.192 19.488 8.384C19.68 8.576 19.904 8.672 20.16 8.672Z",fill:"#666666"}))),i("p",{class:"s-bullet-delivery-saved-addresses-empty-title"},Salla.lang.get("pages.checkout.no_saved_addresses")),i("p",{class:"s-bullet-delivery-saved-addresses-empty-desc"},Salla.lang.get("pages.checkout.add_address_simplify_shipping")),i("salla-button",{onClick:()=>this.handleAddNewAddress(),onKeyUp:()=>this.handleAddNewAddress()},Salla.lang.get("pages.checkout.add_new_address")))}async saveSessionAddressToProfile(){const t=this.getStoredIntent(),s=C(t),i=x(t),e=A(t);if(!t||"address"!==t.type||!s||!i)return null;const l=k(t);if(y(l)&&!e)return null;const a=y(l),r=t.address_details?.district?.name??"",n={country_id:s,region_id:I(t),city_id:i,district_id:e,description:r};a&&(n.local=r);try{const{success:t,address:s}=await v.saveAddressLocation(n);if(!t)return null;const i=s??null;return i&&this.addressCreated.emit({address:i}),i}catch(t){return console.error("SallaBulletDelivery: Error saving session address",t),null}}renderSavedAddresses(){if(!this.isLoggedIn)return null;if(this.loadingSavedAddresses)return i("div",{class:"s-bullet-delivery-addresses-list s-scrollbar"},[1,2,3].map((t=>i("div",{key:t,class:"s-bullet-delivery-address-item s-bullet-delivery-address-item--skeleton"},i("salla-skeleton",{class:"s-bullet-delivery-skel-radio",height:"18px",width:"18px"}),i("salla-skeleton",{class:"s-bullet-delivery-skel-map",height:"36px",width:"36px"}),i("div",{class:"s-bullet-delivery-address-content"},i("div",{class:"s-bullet-delivery-address-lines"},i("salla-skeleton",{height:"18px",width:"72%"}),i("salla-skeleton",{height:"16px",width:"56%"})))))));const t=this.getStoredIntent(),s=D(t),e=s&&t?.address_details&&[t.address_details.city?.name,t.address_details.country?.name].filter(Boolean).join("، ")||"",l=s&&t?.address_details?(t.address_details.district?.name??"").trim():"";return 0!==this.savedAddresses.length||s?i("div",{class:"s-bullet-delivery-addresses-list s-scrollbar"},s&&this.renderAddressRow({key:"session-address",line1:e,line2:l,selected:this.selectedSessionAddress,onClick:()=>this.handleSessionAddressSelect()}),this.savedAddresses.map((t=>{const s=[t.building_number,t.street].filter(Boolean).join("، ")||t.formatted?.address_one||t.short_address||"",i=[t.district?.name,t.city?.name,t.country?.name].filter(Boolean).join("، "),e=(t.formatted?.address_two||i)??"",l=!1!==t.is_in_coverage;return this.renderAddressRow({key:String(t.id),line1:s,line2:e,selected:this.selectedSavedAddress?.id===t.id,disabled:!l,onClick:()=>l&&this.handleSavedAddressSelect(t)})}))):this.renderSavedAddressesEmptyState()}renderAddressRow(t){const{key:s,line1:e,line2:l,selected:a,disabled:r=!1,onClick:n}=t;return i("button",{key:s,class:{"s-bullet-delivery-address-item":!0,"s-bullet-delivery-address-item--selected":a,"s-bullet-delivery-address-item--disabled":r},type:"button",onClick:r?void 0:n,onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),r||n())}},i("input",{type:"radio",name:"saved_address",class:"s-bullet-delivery-radio",checked:a,disabled:r,onClick:t=>t.stopPropagation()}),i("span",{class:"s-bullet-delivery-address-map-icon",innerHTML:'<svg width="35" height="35" viewBox="0 0 35 35" fill="none" xmlns="http://www.w3.org/2000/svg">\n <g filter="url(#filter0_d_24181_220540)">\n <mask id="mask0_24181_220540" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="1" y="0" width="33" height="32">\n <rect x="1.90958" y="0.576577" width="30.8468" height="30.8468" rx="9.22523" fill="#D9D9D9" stroke="white" stroke-width="1.15315"/>\n </mask>\n <g mask="url(#mask0_24181_220540)">\n <rect x="1.90958" y="0.576577" width="30.8468" height="30.8468" rx="9.22523" fill="#E8E8E8" stroke="white" stroke-width="1.15315"/>\n <path d="M17.9096 6.77445L28.7204 5.33301H32.4681L32.7564 11.8195V23.6393L10.4141 23.9276V10.8105L17.9096 6.77445Z" fill="#97E7C8"/>\n <path d="M-2.70303 10.6664H10.2699M41.6934 5.47722C38.378 5.47722 34.7744 5.47722 27.8555 5.47722C20.9366 5.47722 18.4862 6.63037 15.4591 8.64839C12.4321 10.6664 10.2699 10.6664 10.2699 10.6664M10.2699 34.4502V23.6394M10.2699 10.6664V23.6394M-6.16249 23.6394H10.2699M10.2699 23.6394H21.0807M38.8105 23.6394H21.0807M21.0807 23.6394V34.4502" stroke="white" stroke-width="2.30631"/>\n <rect x="2.34202" y="1.00901" width="29.982" height="29.982" rx="8.79279" stroke="white" stroke-width="2.01802"/>\n </g>\n <g clip-path="url(#clip0_24181_220540)">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M18.069 19.8621C19.4995 18.6902 22.171 16.0948 22.171 13.0548C22.171 11.7333 21.6461 10.466 20.7117 9.5316C19.7773 8.5972 18.51 8.07227 17.1885 8.07227C15.8671 8.07227 14.5998 8.5972 13.6654 9.5316C12.731 10.466 12.2061 11.7333 12.2061 13.0548C12.2061 16.0948 14.8776 18.6902 16.3081 19.8621C16.5553 20.0679 16.8669 20.1806 17.1885 20.1806C17.5102 20.1806 17.8218 20.0679 18.069 19.8621ZM17.1885 14.1618C17.517 14.1618 17.838 14.0644 18.1111 13.8819C18.3842 13.6995 18.597 13.4401 18.7227 13.1367C18.8484 12.8333 18.8812 12.4994 18.8172 12.1773C18.7531 11.8552 18.595 11.5593 18.3627 11.3271C18.1305 11.0948 17.8346 10.9367 17.5125 10.8726C17.1904 10.8085 16.8565 10.8414 16.5531 10.9671C16.2497 11.0928 15.9903 11.3056 15.8079 11.5787C15.6254 11.8518 15.528 12.1728 15.528 12.5012C15.528 12.9416 15.703 13.364 16.0144 13.6754C16.3258 13.9868 16.7481 14.1618 17.1885 14.1618Z" fill="#55575D"/>\n </g>\n </g>\n <defs>\n <filter id="filter0_d_24181_220540" x="-0.000325561" y="0" width="34.6667" height="34.6667" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">\n <feFlood flood-opacity="0" result="BackgroundImageFix"/>\n <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>\n <feOffset dy="1.33333"/>\n <feGaussianBlur stdDeviation="0.666667"/>\n <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.04 0"/>\n <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_24181_220540"/>\n <feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_24181_220540" result="shape"/>\n </filter>\n <clipPath id="clip0_24181_220540">\n <rect width="12.1081" height="12.1081" fill="white" transform="translate(11.1338 8.07227)"/>\n </clipPath>\n </defs>\n </svg>\n ',"aria-hidden":"true"}),i("div",{class:"s-bullet-delivery-address-content"},i("div",{class:"s-bullet-delivery-address-lines"},i("span",{class:"s-bullet-delivery-address-line1"},e),i("span",{class:"s-bullet-delivery-address-line2"},l))))}renderGuestDeliveryForm(){const t=y(this.selectedCountry?.code??"");return[this.renderCountrySelect(),t?this.renderRegionSelect():null,this.renderCityDistrictSelects()]}renderDeliveryTab(){return i("div",{class:{"s-bullet-delivery-content":!0,"s-bullet-delivery-content--active":"address"===this.activeTab,"s-hidden":"address"!==this.activeTab}},this.isLoggedIn?this.renderSavedAddresses():this.renderGuestDeliveryForm())}renderBranchSearch(){return i("div",{class:"s-bullet-delivery-branch-search"},i("div",{class:"s-bullet-delivery-search-row"},i("div",{class:"s-bullet-delivery-search s-bullet-delivery-branch-search-wrap"},i("span",{class:"s-bullet-delivery-search-icon s-bullet-delivery-branch-search-icon",innerHTML:h,"aria-hidden":"true"}),i("input",{type:"text",class:"s-bullet-delivery-branch-search-input form-input",placeholder:Salla.lang.get("pages.checkout.search_for_city_or_branch"),value:this.branchSearchQuery,onInput:t=>this.handleBranchSearch(t),autocomplete:"off"})),i("button",{type:"button",class:{"s-bullet-delivery-location-btn":!0,"s-bullet-delivery-location-btn--full":!0,"s-bullet-delivery-location-btn--loading":this.loadingNearestBranch},onClick:()=>this.handleFindNearestBranch(),disabled:this.loadingNearestBranch},this.loadingNearestBranch?i("span",{class:"s-bullet-delivery-location-icon","aria-hidden":"true"},i("salla-skeleton",{height:"18px",width:"18px"})):i("span",{class:"s-bullet-delivery-location-icon",innerHTML:'<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path\n d="M13.3258 7.65006C13.3258 10.7797 10.7888 13.3167 7.65916 13.3167C4.52955 13.3167 1.99249 10.7797 1.99249 7.65006C1.99249 4.52045 4.52955 1.9834 7.65916 1.9834C10.7888 1.9834 13.3258 4.52045 13.3258 7.65006Z"\n stroke="#555555" stroke-width="1.3" />\n <path d="M14.65 7.65039H13.3167" stroke="#555555" stroke-width="1.3" stroke-linecap="round"\n stroke-linejoin="round" />\n <path d="M1.98336 7.65039L0.650024 7.65039" stroke="#555555" stroke-width="1.3"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M7.65002 0.650065L7.65002 1.9834" stroke="#555555" stroke-width="1.3"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M7.65002 13.3171L7.65002 14.6504" stroke="#555555" stroke-width="1.3"\n stroke-linecap="round" stroke-linejoin="round" />\n <path\n d="M9.64999 7.65039C9.64999 8.75496 8.75456 9.65039 7.64999 9.65039C6.54542 9.65039 5.64999 8.75496 5.64999 7.65039C5.64999 6.54582 6.54542 5.65039 7.64999 5.65039C8.75456 5.65039 9.64999 6.54582 9.64999 7.65039Z"\n stroke="#555555" stroke-width="1.3" />\n</svg>\n ',"aria-hidden":"true"}),i("span",null,Salla.lang.get("pages.checkout.nearest_to_my_location")))),this.locationError&&"branch"===this.activeTab&&i("span",{class:"s-bullet-delivery-error"},this.locationError))}renderBranchList(){return this.loadingBranches?i("div",{class:"s-bullet-delivery-branches-wrap"},i("div",{class:"s-bullet-delivery-branches-loading"},[1,2,3,4].map((t=>i("div",{key:t,class:"s-bullet-delivery-branch-skeleton"},i("salla-skeleton",{class:"s-bullet-delivery-branch-skeleton-radio",type:"circle",height:"16px",width:"16px"}),i("div",{class:"s-bullet-delivery-branch-skeleton-icon"},i("salla-skeleton",{height:"34px",width:"34px"})),i("div",{class:"s-bullet-delivery-branch-skeleton-content"},i("salla-skeleton",{class:"s-bullet-delivery-branch-skeleton-title",height:"12px",width:"124px"})),i("salla-skeleton",{class:"s-bullet-delivery-branch-skeleton-time",height:"12px",width:"88px"}),i("div",{class:"s-bullet-delivery-branch-skeleton-map"},i("salla-skeleton",{height:"32px",width:"32px"}))))))):0===this.filteredBranches.length?i("salla-placeholder",{alignment:"center",class:"s-bullet-delivery-placeholder"},i("span",{slot:"title"},Salla.lang.get("pages.checkout.no_pickup_branches_found"))):i("div",{class:"s-bullet-delivery-branches-wrap"},i("ul",{class:"s-bullet-delivery-branches-list s-scrollbar"},this.filteredBranches.map((t=>i("li",{key:t.id,class:{"s-bullet-delivery-branch-item":!0,"s-bullet-delivery-branch-item--selected":this.selectedBranch?.id===t.id,"s-bullet-delivery-branch-item--disabled":!1===t.is_open},tabIndex:!1===t.is_open?-1:0,role:"option","aria-disabled":!1===t.is_open,onClick:()=>!1!==t.is_open&&this.handleBranchSelect(t),onKeyDown:s=>{"Enter"!==s.key&&" "!==s.key||(s.preventDefault(),!1!==t.is_open&&this.handleBranchSelect(t))}},i("input",{type:"radio",name:"branch",class:"s-bullet-delivery-radio",checked:this.selectedBranch?.id===t.id,disabled:!1===t.is_open}),i("span",{class:"s-bullet-delivery-branch-icon","aria-hidden":"true"},i("span",{innerHTML:T})),i("div",{class:"s-bullet-delivery-branch-info"},i("span",{class:"s-bullet-delivery-branch-name"},t.name),t.preparation_time?i("span",{class:"s-bullet-delivery-branch-prep"},`${Salla.lang.get("pages.checkout.processing_time")}: ${t.preparation_time}`):null),(()=>{const s=(e=t.working_hours,e?.[0]?.times?.[0]??null);var e;return s?i("span",{class:"s-bullet-delivery-branch-time"},function(t,s,i,e){const l=String(t).trim(),a=String(s).trim();return l&&a?"00:00"===l?`${e} ${_(a,i)}`:`${_(l,i)} - ${_(a,i)}`:""}(s.from,s.to,Salla.config.get("user.language_code")||"ar",Salla.lang.get("pages.checkout.until"))):null})(),null!=t.location?.lat&&null!=t.location?.lng&&i("a",{href:`https://www.google.com/maps?q=${t.location.lat},${t.location.lng}`,target:"_blank",rel:"noopener noreferrer",class:"s-bullet-delivery-branch-map-link",title:Salla.lang.get("common.elements.open_in_google_maps"),onClick:t=>t.stopPropagation()},i("span",{class:"s-bullet-delivery-branch-map-link-icon",innerHTML:'<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path\n d="M7.94798 3.19336C11.1309 2.1083 12.7223 1.56578 13.5783 2.42174C14.4342 3.27771 13.8917 4.86914 12.8066 8.05201L12.0678 10.2195C11.2344 12.6639 10.8178 13.8861 10.131 13.9872C9.94631 14.0144 9.75517 13.9981 9.57248 13.9394C8.89297 13.7212 8.53377 12.4326 7.81538 9.8553C7.65604 9.28364 7.57637 8.99781 7.39494 8.7795C7.34228 8.71614 7.28386 8.65772 7.2205 8.60506C7.00219 8.42363 6.71636 8.34396 6.1447 8.18462C3.56741 7.46623 2.27876 7.10703 2.0606 6.42752C2.00195 6.24483 1.98558 6.05369 2.01277 5.86903C2.11392 5.18221 3.33613 4.76556 5.78054 3.93225L7.94798 3.19336Z"\n stroke="#555555" stroke-width="1.2" />\n</svg>\n '.replace(/mask0_25437_34440/g,`mask0_branch_${t.id}`),"aria-hidden":"true"}),i("span",{class:"sr-only"},Salla.lang.get("common.elements.open_in_google_maps"))))))))}renderPickupTab(){return i("div",{class:{"s-bullet-delivery-content":!0,"s-bullet-delivery-content--active":"branch"===this.activeTab,"s-hidden":"branch"!==this.activeTab}},this.renderCountrySelect(),this.renderBranchSearch(),this.renderBranchList())}renderAddAddressForm(){const t=Salla.lang.get("pages.checkout.add_new_address"),s=y(this.selectedCountry?.code??""),e=this.selectedCountry&&this.selectedCity&&(!s||this.selectedRegion)&&(!s||!!this.selectedDistrict||!!(this.districtName&&this.districtName.trim().length>0)),l=this.savingAddress?Salla.lang.get("pages.checkout.loading"):Salla.lang.get("pages.checkout.confirm_address"),n=this.savedAddresses.length>0||D(this.getStoredIntent());return i("div",{class:"s-bullet-delivery-add-address"},i("div",{class:"s-bullet-delivery-add-address-header"},n?i("button",{type:"button",class:"s-bullet-delivery-add-address-title",onClick:()=>this.handleBackToAddressList(),onKeyDown:t=>"Enter"===t.key&&this.handleBackToAddressList()},i("span",{innerHTML:this.isRTL?a:r,"aria-hidden":"true"}),i("span",{class:"s-bullet-delivery-add-address-title-text"},t)):i("span",{class:"s-bullet-delivery-add-address-title"},i("span",{class:"s-bullet-delivery-add-address-title-text"},t))),i("form",{class:"s-bullet-delivery-add-address-form",onSubmit:t=>this.handleSubmitAddAddress(t)},this.renderGuestDeliveryForm(),i("div",{class:"s-bullet-delivery-form-actions s-bullet-delivery-form-actions--single"},i("salla-button",{type:"submit",loading:this.savingAddress,disabled:!e||this.savingAddress,class:"s-bullet-delivery-add-address-submit"},l))))}renderFooter(){const t="address"===this.activeTab&&this.isLoggedIn;return i("div",{class:"s-bullet-delivery-footer"},i("salla-button",{ref:t=>{this.confirmBtn=t},disabled:this.isConfirmDisabled(),onClick:()=>this.handleConfirm(),"loader-position":"center",width:"wide"},"branch"===this.activeTab?Salla.lang.get("pages.checkout.confirm_receipt_from_the_branch"):Salla.lang.get("pages.checkout.confirm_address")),t&&i("salla-button",{onClick:()=>this.handleAddNewAddress(),width:"wide",shape:"link"},Salla.lang.get("pages.checkout.add_new_address")),!this.isLoggedIn&&i("salla-button",{shape:"link",onClick:this.handleLogin},Salla.lang.get("pages.checkout.login_to_use_saved_addresses")))}renderMainView(){const t=this.isLoggedIn&&"address"===this.activeTab&&0===this.savedAddresses.length&&!D(this.getStoredIntent()),s="branch"===this.activeTab&&this.supportsPickup?this.renderPickupTab():this.renderDeliveryTab();return i("div",null,i("div",{class:"s-bullet-delivery-header"},i("h2",{class:"s-bullet-delivery-title"},"address"===this.activeTab?Salla.lang.get("blocks.home.add_address_for_order_delivery"):Salla.lang.get("blocks.home.how_prefer_to_receive_order")),i("p",{class:"s-bullet-delivery-subtitle"},"address"===this.activeTab?Salla.lang.get("blocks.home.products_available_for_delivery_shown_while_shopping"):Salla.lang.get("blocks.home.products_available_for_delivery_or_pickup_shown_while_shopping"))),this.renderTabs(),this.showCartWillBeClearedBanner&&this.renderAlert(Salla.lang.get("blocks.scope.empty_cart_warning")),this.allocationOutOfCoverageMessage&&this.renderAllocationOutOfCoverageAlert(),s,!t&&this.renderFooter())}handleAfterAddToCart(){if("after_add_to_cart"!==this.openingType)return;const t=this.shouldPromptIncompleteIntentThisSession();this.hasBeenShownThisSession()&&!t||this.modal?.hasAttribute?.("visible")||(t&&this.markIncompleteIntentPrompted(),this.open())}overrideScopeSwitchUI(){const t=this.getStoredIntent(),s=document.querySelector('[onclick*="scopes"]');if(!s)return;if(!t||"address"!==t.type&&"branch"!==t.type)return s.style.display="none",void(s.onclick=()=>this.open());const i=(t,s)=>t&&t.length>s?`${t.slice(0,s)}...`:t??"",e="branch"===t.type?`${Salla.lang.get("mobile_app.strings.pickup")} ${Salla.lang.get("common.elements.from")} ${i(t.branch_details?.name,20)}`:`${Salla.lang.get("mobile_app.strings.delivery")} ${Salla.lang.get("common.elements.to")} ${i(t.address_details?.city?.name,10)}`;s.style.display="inline-flex",s.onclick=()=>this.open();const l=s.querySelector('span:not([class*="sicon"]):not([class*="icon"])');if(l)l.textContent=e;else{const t=Array.from(s.childNodes).find((t=>t.nodeType===Node.TEXT_NODE&&t.textContent?.trim()));t&&(t.textContent=` ${e}`)}}async componentWillLoad(){await Salla.onReady();try{this.overrideScopeSwitchUI(),this.cartSubmittingHandler=async()=>{this.pendingCartSubmitPromise?await this.pendingCartSubmitPromise:this.hasCompleteIntentForLoggedInUser()||(this.cartSubmitConfirmationPending=!0,this.pendingCartSubmitPromise=new Promise((t=>{if(this.pendingCartSubmitResolver=t,this.isGuestUser())return Salla.auth.setCanRedirect(!1),void Salla.event.dispatch("login::open",{withoutReload:!0,source:"cart-submit"});this.open()})),await this.pendingCartSubmitPromise)},Salla.cart.event.onSubmitting(this.cartSubmittingHandler)}catch(t){console.warn("SallaBulletDelivery: overrideScopeSwitchUI failed",t)}Salla.event.on("salla::bullet-delivery.modal.open.requested",this.bulletDeliveryOpenHandler),this.closeHandler=this.close.bind(this),Salla.event.on("salla::bullet-delivery.modal.close.requested",this.closeHandler),this.isRTL=Salla.config.get("theme.is_rtl"),this.authLoggedInHandler=()=>{if(this.cartSubmitConfirmationPending)return Salla.event.dispatch("login::close"),this.hasCompleteIntentForLoggedInUser()?void this.resolvePendingCartSubmit():void(this.modal?.hasAttribute?.("visible")||this.open());this.hasIncompleteUserAddressIntent()&&(this.modal?.hasAttribute?.("visible")||this.open())},Salla.event.on("auth::logged.in",this.authLoggedInHandler),this.authLoggedOutHandler=()=>{this.clearBulletDeliveryStoredData()},Salla.event.on("auth::logged.out",this.authLoggedOutHandler),this.loginClosedHandler=()=>{this.cartSubmitConfirmationPending&&this.isGuestUser()&&(this.hasCompleteIntentForLoggedInUser()||this.resolvePendingCartSubmit())},Salla.event.on("salla-login::closed",this.loginClosedHandler),this.cartItemAddedHandler=()=>this.handleAfterAddToCart(),"function"==typeof Salla.cart?.event?.onItemAdded?(this.useCartEventApi=!0,Salla.cart.event.onItemAdded(this.cartItemAddedHandler)):Salla.event.on(this.cartItemAddedEvent,this.cartItemAddedHandler)}render(){return this.isMobileApp?null:i(e,{class:"s-bullet-delivery"},i("salla-modal",{ref:t=>{this.modal=t},isClosable:!this.isRequired&&!this.shouldForceNonClosable(),class:"s-bullet-delivery-modal",width:"sm"},i("div",{class:"s-bullet-delivery-inner"},"main"===this.viewMode&&this.renderMainView(),"add-address"===this.viewMode&&this.renderAddAddressForm())))}componentDidLoad(){if(this.componentReady=!0,this.isMobileApp)return this.hasBeenShownThisSession()||Salla.event.dispatch("salla::bullet-delivery.open-sheet"),this.bulletDeliveryMobileSelectHandler=t=>{const s=this.extractMobileSelectPayload(t);s?this.applyMobileBulletDeliverySelection(s):console.warn("SallaBulletDelivery: received empty mobile select payload",t)},void Salla.event.on("salla::bullet-delivery.select",this.bulletDeliveryMobileSelectHandler);if(this.pendingOpen)return this.pendingOpen=!1,void this.open();switch(this.openingType){case"first_visit":this.hasBeenShownThisSession()?this.shouldPromptIncompleteIntentThisSession()&&(this.markIncompleteIntentPrompted(),this.open()):this.open();break;case"on_cart_click":Salla.url.is_page("cart")&&(!0===this.getShownStorage().get(this.sessionShownKey)?this.shouldPromptIncompleteIntentThisSession()&&(this.markIncompleteIntentPrompted(),this.open()):this.open())}const t=this.createCartViewElement();t&&"function"==typeof salla?.hooks?.mount&&Salla.hooks.mount("cart:items.start",t).catch((()=>{}))}disconnectedCallback(){this.componentReady=!1,Salla.event.off("salla::bullet-delivery.modal.open.requested",this.bulletDeliveryOpenHandler),this.closeHandler&&(Salla.event.off("salla::bullet-delivery.modal.close.requested",this.closeHandler),this.closeHandler=null),this.cartItemAddedHandler&&(this.useCartEventApi&&"function"==typeof Salla.cart?.event?.offItemAdded?Salla.cart.event.offItemAdded(this.cartItemAddedHandler):Salla.event.off(this.cartItemAddedEvent,this.cartItemAddedHandler),this.cartItemAddedHandler=null),this.cartSubmittingHandler&&("function"==typeof Salla.cart?.event?.offSubmitting?Salla.cart.event.offSubmitting(this.cartSubmittingHandler):Salla.event.off("cart::submitting",this.cartSubmittingHandler),this.cartSubmittingHandler=null),this.authLoggedInHandler&&(Salla.event.off("auth::logged.in",this.authLoggedInHandler),this.authLoggedInHandler=null),this.authLoggedOutHandler&&(Salla.event.off("auth::logged.out",this.authLoggedOutHandler),this.authLoggedOutHandler=null),this.loginClosedHandler&&(Salla.event.off("salla-login::closed",this.loginClosedHandler),this.loginClosedHandler=null),this.bulletDeliveryMobileSelectHandler&&(Salla.event.off("salla::bullet-delivery.select",this.bulletDeliveryMobileSelectHandler),this.bulletDeliveryMobileSelectHandler=null)}};P.INITIAL_ADDRESS_FORM={country_id:0,is_default:!1,city_id:void 0,district_id:void 0,street:void 0,building_number:void 0,additional_number:void 0,postal_code:void 0,description:void 0},P.DROPDOWN_SEARCH_DEBOUNCE_MS=400,P.DROPDOWN_SEARCH_MIN_CHARS=2,P.style="@supports (interpolate-size: allow-keywords) and (block-size: calc-size(auto, size)) {\n .s-bullet-delivery .s-bullet-delivery-modal .s-modal-body, .s-bullet-delivery-inner {\n @apply [interpolate-size:allow-keywords];\n }\n .s-bullet-delivery .s-bullet-delivery-modal .s-modal-body {\n @apply [overflow:clip] [transition:block-size_500ms_ease];\n }\n .s-bullet-delivery-inner {\n @apply [overflow:clip] [transition:block-size_500ms_ease];\n block-size: calc-size(auto, size);\n }\n}\n\n/* Allow searchable dropdown popover to paint outside the modal body */\n.s-bullet-delivery .s-bullet-delivery-modal .s-modal-body:has(.s-searchable-dropdown--open) {\n overflow: visible !important;\n}\n\n@keyframes s-bullet-delivery-fade-in {\n from {\n opacity: 0;\n transform: translateY(6px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}";const F=class{constructor(i){t(this,i),this.itemSelected=s(this,"itemSelected"),this.searchInput=s(this,"searchInput"),this.dropdownOpened=s(this,"dropdownOpened"),this.dropdownClosed=s(this,"dropdownClosed"),this.placeholder="",this.items=[],this.selectedItem=null,this.loading=!1,this.searching=!1,this.disabled=!1,this.required=!1,this.noResultsText="",this.inputId="",this.searchQuery="",this.clientSearch=!1,this.dropUp=!1,this.searchable=!0,this.keepParentScroll=!1,this.isOpen=!1,this.focusedIndex=-1,this.clientSearchQuery="",this.scrollableAncestor=null,this.handleTriggerClick=()=>{this.isOpen?this.close():this.open()},this.handleTriggerKeyDown=t=>{this.isOpen?this.navigateItems(t):"Enter"===t.key||" "===t.key||"ArrowDown"===t.key?(t.preventDefault(),this.open()):"Escape"===t.key&&this.close()},this.handleSearchInputChange=t=>{const s=t.target.value;this.clientSearch&&(this.clientSearchQuery=s),this.searchInput.emit(s),this.focusedIndex=-1},this.handleSearchKeyDown=t=>{this.navigateItems(t)}}connectedCallback(){this.boundHandleClickOutside=this.handleClickOutside.bind(this),document.addEventListener("mousedown",this.boundHandleClickOutside)}disconnectedCallback(){document.removeEventListener("mousedown",this.boundHandleClickOutside),this.scrollableAncestor&&(this.scrollableAncestor.style.overflow="",this.scrollableAncestor=null)}onItemsChange(){this.focusedIndex=-1}normalizeArabic(t){return t.replace(/[أإآا]/g,"ا")}get filteredItems(){if(!this.clientSearch||!this.clientSearchQuery.trim())return this.items;const t=this.normalizeArabic(this.clientSearchQuery.trim().toLowerCase());return this.items.filter((s=>{const i=this.normalizeArabic(s.name.toLowerCase()),e=s.name_en?s.name_en.toLowerCase():"";return i.includes(t)||e.includes(t)}))}getDisplayName(t){const s=salla?.config?.get("user.language_code");return s&&"ar"!==s&&t.name_en?.trim()?t.name_en.trim():t.name}handleClickOutside(t){this.isOpen&&(this.host.contains(t.target)||this.close())}findScrollableAncestor(){let t=this.host.parentElement;for(;t;){const s=getComputedStyle(t),i=s.overflowY;if("auto"===i||"scroll"===i||"hidden"===i||"clip"===s.overflow)return t;t=t.parentElement}return null}open(){this.disabled||this.loading||(this.isOpen=!0,this.focusedIndex=-1,this.keepParentScroll||(this.scrollableAncestor=this.findScrollableAncestor(),this.scrollableAncestor&&(this.scrollableAncestor.style.overflow="visible")),this.dropdownOpened.emit(),requestAnimationFrame((()=>this.searchInputRef?.focus())))}close(){this.isOpen&&(this.isOpen=!1,this.focusedIndex=-1,this.clientSearchQuery="",this.scrollableAncestor&&(this.scrollableAncestor.style.overflow="",this.scrollableAncestor=null),this.dropdownClosed.emit())}navigateItems(t){const s=this.filteredItems,i=s.length;switch(t.key){case"ArrowDown":t.preventDefault(),this.focusedIndex=i>0?(this.focusedIndex+1)%i:-1,this.scrollFocusedIntoView();break;case"ArrowUp":t.preventDefault(),this.focusedIndex=i>0?(this.focusedIndex-1+i)%i:-1,this.scrollFocusedIntoView();break;case"Enter":t.preventDefault(),this.focusedIndex>=0&&this.focusedIndex<i&&this.selectItem(s[this.focusedIndex]);break;case"Escape":t.preventDefault(),this.close()}}scrollFocusedIntoView(){this.focusedIndex<0||requestAnimationFrame((()=>{const t=this.panelRef?.querySelector(".s-searchable-dropdown-list"),s=t?.children[this.focusedIndex];s?.scrollIntoView({block:"nearest"})}))}selectItem(t){this.itemSelected.emit(t),this.close()}render(){const t=null!=this.selectedItem,s=`${this.inputId}-listbox`;return i(e,{key:"c529f2b61adbc38aa1e5403da6fdb985fe256baa",class:"s-searchable-dropdown"},i("div",{key:"88ab96afd36421fdf965b79298fa14f435adbcef",class:{"s-searchable-dropdown":!0,"s-searchable-dropdown--open":this.isOpen}},this.label&&i("label",{key:"6ee8a2d0428e1347e36eabec32a3129897481abc",class:"s-searchable-dropdown-label",htmlFor:this.inputId},this.label,this.required&&i("span",{key:"8473884ec18e73c72c79e7749264bd9c24c56ae9",class:"s-searchable-dropdown-required"}," *")),i("div",{key:"bffbea7ff0cb9466c8a852a841a21ed8351ef92d",class:{"s-searchable-dropdown-trigger":!0,"s-searchable-dropdown-trigger--disabled":this.disabled||this.loading,"s-searchable-dropdown-trigger--open":this.isOpen},role:"combobox","aria-expanded":this.isOpen?"true":"false","aria-haspopup":"listbox","aria-controls":s,"aria-disabled":this.disabled||this.loading?"true":"false",tabIndex:this.disabled||this.loading?-1:0,onClick:this.handleTriggerClick,onKeyDown:this.handleTriggerKeyDown},t?i("span",{class:"s-searchable-dropdown-trigger-text"},this.getDisplayName(this.selectedItem)):i("span",{class:"s-searchable-dropdown-trigger-placeholder"},this.placeholder),i("i",{key:"e3aee1ffe1b80a9ef21f4c9cca02de0a590b0825",class:{"sicon-keyboard_arrow_down":!0,"s-searchable-dropdown-trigger-icon":!0,"s-searchable-dropdown-trigger-icon--open":this.isOpen},"aria-hidden":"true"})),this.isOpen&&i("div",{key:"7a19f2d6847b3e0dda5e0ea509df91a2f48fa098",class:{"s-searchable-dropdown-panel":!0,"s-searchable-dropdown-panel--up":this.dropUp},ref:t=>this.panelRef=t},this.searchable&&i("div",{key:"601529f76a09762a57fe7b7663ecfa1505462367",class:"s-searchable-dropdown-search-wrap"},i("i",{key:"f91e464e7efed3759837880b5a7593daa4f84ecb",class:"sicon-search s-searchable-dropdown-search-icon","aria-hidden":"true"}),i("input",{key:"f72a7e12d0a6e90bab3983258c9b08aa286bc897",ref:t=>this.searchInputRef=t,id:this.inputId,type:"text",class:"s-searchable-dropdown-search-input",placeholder:this.placeholder,value:this.clientSearch?this.clientSearchQuery:this.searchQuery,onInput:this.handleSearchInputChange,onKeyDown:this.handleSearchKeyDown,autocomplete:"off","aria-autocomplete":"list","aria-expanded":this.isOpen?"true":"false","aria-controls":s})),i("div",{key:"495aa88fc76d3d17956db7277cc98aff08b4c1af",id:s,class:"s-searchable-dropdown-list s-scrollbar",role:"listbox"},this.renderListContent()))))}renderListContent(){if(this.searching||this.loading)return i("div",{class:"s-searchable-dropdown-loading"},i("svg",{class:"s-searchable-dropdown-spinner",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"3","stroke-linecap":"round",opacity:"0.25"}),i("path",{d:"M12 2a10 10 0 0 1 10 10",stroke:"currentColor","stroke-width":"3","stroke-linecap":"round"})));const t=this.filteredItems;return 0===t.length?i("div",{class:"s-searchable-dropdown-empty"},this.noResultsText||salla?.lang?.get("common.elements.no_options")||"No results found"):t.map(((t,s)=>{const e=this.selectedItem?.id===t.id;return i("button",{key:t.id,type:"button",role:"option",class:{"s-searchable-dropdown-item":!0,"s-searchable-dropdown-item--selected":e,"s-searchable-dropdown-item--focused":this.focusedIndex===s&&!e},"aria-selected":e?"true":"false",onClick:()=>this.selectItem(t)},i("span",{class:{"s-searchable-dropdown-item-name":!0,"s-searchable-dropdown-item-name--selected":e}},this.getDisplayName(t)),e&&i("i",{class:"sicon-check s-searchable-dropdown-item-check","aria-hidden":"true"}))}))}get host(){return l(this)}static get watchers(){return{items:["onItemsChange"]}}};export{P as salla_bullet_delivery,F as salla_searchable_dropdown}
4
+ import{r as t,c as s,h as i,H as e,a as l}from"./p-CFtXUFT2.js";import{a,A as r}from"./p-Vqpj4CWE.js";import{L as n}from"./p-BO5AoBAP.js";import{S as h}from"./p-BscTeWDc.js";const o="BulletDeliveryAPI",d=t=>{const s=null==t?Number.NaN:Number(t);return!Number.isNaN(s)&&0!==s};async function c(t,s,i){try{return await t()}catch(t){return console.error(`${o}: ${i}`,t),s}}const u=new Map;function p(t){const s=u.get(t);return!s||Date.now()-s.timestamp>3e5?(u.delete(t),null):s.data}function b(t,s){u.set(t,{data:s,timestamp:Date.now()})}const y=t=>"SA"===String(t).toUpperCase(),v={async getCountries(t=!1,s){const i=s?.trim()?null:"countries_"+(t?1:0);if(i){const t=p(i);if(t)return t}const e=await c((async()=>{const i={for_branch:t?1:0};return t&&(i.for_allocation=1),s?.trim()&&(i.query=s.trim()),((await salla.api.request("shipping/countries",{params:i}))?.data??[]).map((t=>({id:t.id,code:t.code,name:t.name,has_regions:y(t.code)})))}),[],"Error getting countries");return i&&e.length>0&&b(i,e),e},async getRegions(t,s){if(!d(t))return console.warn(`${o}: getRegions called without valid country_id`),[];const i=s?.trim()?null:`regions_${t}`;if(i){const t=p(i);if(t)return t}const e=await c((async()=>{const i={};return s?.trim()&&(i.query=s.trim()),((await salla.api.request(`shipping/countries/${t}/regions`,{params:i}))?.data??[]).map((s=>({id:s.id,name:s.name,code:s.code,country_id:Number(t)})))}),[],"Error fetching regions");return i&&e.length>0&&b(i,e),e},async getCities(t,s,i){if(!d(t))return console.warn(`${o}: getCities called without valid country_id`),[];const e=i?.trim()?null:`cities_${t}_${s||"all"}`;if(e){const t=p(e);if(t)return t}const l=await c((async()=>{const e={for_branch:0,country_id:t};return s&&(e.region_id=s),i?.trim()&&(e.query=i.trim()),((await salla.api.request("shipping/cities",{params:e}))?.data??[]).map((s=>({id:s.id,name:s.name,country_id:t,...null!=s.region_id&&{region_id:s.region_id}})))}),[],"Error fetching cities");return e&&l.length>0&&b(e,l),l},getDistricts:async(t,s)=>d(t)?c((async()=>{const i={for_branch:0,city_id:t};s?.trim()&&(i.query=s.trim());const e=(await salla.api.request("shipping/districts",{params:i}))?.data;return(Array.isArray(e)?e:Array.isArray(e?.districts)?e.districts:[]).map((s=>({id:s.id,name:s.name,name_en:s.name_en,city_id:t})))}),[],"Error fetching districts"):(console.warn(`${o}: getDistricts called without valid city_id`),[]),getSavedAddresses:async()=>c((async()=>{const t=(await salla.api.request("address"))?.data;return Array.isArray(t)?t:[]}),[],"Error fetching user addresses"),async getBranches({query:t,lat:s,lng:i,country_id:e,per_page:l=20}={}){const a=t?.trim()?.length>=2||s||i||!e?null:`branches_${e}`;if(a){const t=p(a);if(t)return t}const r=await c((async()=>{const a={per_page:l};t?.trim().length>=2&&(a.query=t),s&&(a.lat=s),i&&(a.lng=i),e&&(a.country_id=e);const r=await salla.api.request("branches",{params:a});return Array.isArray(r?.data)?r.data:[]}),[],"Error fetching branches");return a&&r.length>0&&b(a,r),r},saveAddressLocation:async t=>c((async()=>{const s=await salla.api.request("address/location",{...t,for_allocation:!0},"post"),i=s?.data??s;return{success:!0,address:"object"==typeof i&&null!=i&&"id"in i?i:void 0}}),{success:!1},"Error saving address/location"),setDeliveryScope:async t=>c((async()=>(await salla.api.withoutNotifier((()=>salla.scope.change({id:t}))),salla.storage.set("scope",{...salla.storage.get("scope")||{},id:t}),!0)),!1,"Error setting delivery scope"),async allocateScope(t){try{const s=await salla.api.withoutNotifier((()=>salla.api.request("scopes/allocation",t,"post")));return{success:!0,data:s?.data??s}}catch(t){console.error(`${o}: Error allocating scope`,t);const i=t;return{success:!1,error:null!=i?.response?.data?(s=i.response.data,s?.error?.message??s?.message??"Failed to allocate scope"):i?.message??"Unknown error"}}var s}};function m(){u.clear()}const g=t=>t*(Math.PI/180);function f(t,s,i,e){const l=g(i-t),a=g(e-s),r=Math.sin(l/2)**2+Math.cos(g(t))*Math.cos(g(i))*Math.sin(a/2)**2;return 12742*Math.atan2(Math.sqrt(r),Math.sqrt(1-r))}function _(t,s){const[i,e]=String(t).trim().split(":").map(Number);return Number.isNaN(i)||Number.isNaN(e)?t:new Date(2e3,0,1,i,e).toLocaleTimeString(s,{hour:"numeric",minute:"2-digit",hour12:!0})}const S=(t,s,i)=>{if("branch"===t.type){const s=t.branch_details?.city??t.branch_details?.name;return s?`${i} ${s}`.trim():""}if("address"===t.type&&t.address_details){const i=[t.address_details.district?.name,t.address_details.city?.name,t.address_details.country?.name].filter(Boolean).join("، ")||t.address_details.short_address||"";return i?`${s} ${i}`.trim():""}return""},w=t=>null!=t?Number(t):void 0,C=t=>w(t?.address_details?.country?.id),k=t=>t?.country_code??t?.address_details?.country?.code??"",I=t=>w(t?.address_details?.region?.id),x=t=>w(t?.address_details?.city?.id),A=t=>w(t?.address_details?.district?.id),M=t=>t?.branch_details?.id,B=t=>t?.branch_details?.latitude,N=t=>t?.branch_details?.longitude,D=t=>{if(!t||"address"!==t.type||t.address_id)return!1;const s=C(t),i=x(t),e=A(t),l=k(t),a=null!=e&&0!==Number(e),r=Boolean(t.address_details?.district?.name?.trim()),n=!y(l)||a||r;return!!(s&&i&&n)},$=(t,s,i)=>!t||!y(t)||null!=s&&0!==Number(s)&&null!=i&&("number"==typeof i?0!==i:String(i).trim().length>0),L={[GeolocationPositionError.PERMISSION_DENIED]:"Location permission denied",[GeolocationPositionError.POSITION_UNAVAILABLE]:"Location unavailable",[GeolocationPositionError.TIMEOUT]:"Location timeout"};var T='<svg width="15" height="14" viewBox="0 0 15 14" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path\n d="M1.14453 5.83032L1.14453 9.16486C1.14453 11.0511 1.14453 11.9943 1.73032 12.5803C2.3161 13.1663 3.25891 13.1663 5.14453 13.1663L9.14453 13.1663C11.0301 13.1663 11.9729 13.1663 12.5587 12.5803C13.1445 11.9943 13.1445 11.0511 13.1445 9.16486V5.83032"\n stroke="currentcolor" stroke-linecap="round" />\n <path\n d="M9.14453 10.1619C8.68846 10.5667 7.9624 10.8285 7.14453 10.8285C6.32666 10.8285 5.60059 10.5667 5.14453 10.1619"\n stroke="currentcolor" stroke-linecap="round" />\n <path\n d="M5.90256 4.44533C5.71455 5.12426 5.03086 6.29542 3.73185 6.46516C2.58488 6.61502 1.71497 6.11437 1.49277 5.90504C1.24779 5.7353 0.689441 5.19216 0.552703 4.85269C0.415966 4.51322 0.575492 3.77771 0.689441 3.47785L1.14495 2.15892C1.25615 1.82765 1.51646 1.04411 1.78334 0.779094C2.05022 0.514073 2.59054 0.502543 2.81294 0.502543L7.48329 0.502543C8.68543 0.519525 11.3139 0.491824 11.8335 0.502545C12.3532 0.513266 12.6654 0.948828 12.7565 1.13553C13.5318 3.01341 13.8333 4.08889 13.8333 4.54717C13.7321 5.03605 13.3133 5.95787 11.8335 6.36332C10.2956 6.7847 9.42363 5.96509 9.15007 5.65043M5.27015 5.65044C5.48665 5.91635 6.16578 6.45158 7.15029 6.46516C8.1348 6.47873 8.98485 5.79188 9.28681 5.44676C9.37227 5.34492 9.55687 5.04279 9.7483 4.44533"\n stroke="currentcolor" stroke-linecap="round" stroke-linejoin="round" />\n</svg>\n ';const E="salla-bullet-delivery-override-ip",P=class{constructor(i){t(this,i),this.bulletDeliveryConfirmed=s(this,"bulletDeliveryConfirmed"),this.bulletDeliveryClosed=s(this,"bulletDeliveryClosed"),this.addressCreated=s(this,"addressCreated"),this.headerContextUpdate=s(this,"headerContextUpdate"),this.confirming=!1,this.pendingCartSubmitResolver=null,this.pendingCartSubmitPromise=null,this.cartSubmitConfirmationPending=!1,this.branchSearchDebounceTimer=null,this.countrySearchTimer=null,this.regionSearchTimer=null,this.citySearchTimer=null,this.districtSearchTimer=null,this.citySearchCounter=0,this.componentReady=!1,this.pendingOpen=!1,this.tabChanging=!1,this.intentStorageKey="bullet_delivery_intent",this.sessionShownKey="bullet_delivery_shown",this.incompleteIntentPromptKey="bullet_delivery_incomplete_intent_prompted",this.cartItemAddedEvent="cart::item.added",this.cartItemAddedHandler=null,this.cartSubmittingHandler=null,this.useCartEventApi=!1,this.authLoggedInHandler=null,this.authLoggedOutHandler=null,this.loginClosedHandler=null,this.hasExplicitPreselectedIdsForOpen=!1,this.bulletDeliveryOpenHandler=t=>{this.preselectedAddressId=t?.preselected_address_id,this.preselectedBranchId=t?.preselected_branch_id,this.hasExplicitPreselectedIdsForOpen=null!=t?.preselected_address_id||null!=t?.preselected_branch_id,this.open()},this.closeHandler=null,this.bulletDeliveryMobileSelectHandler=null,this.savedAddressesLoaded=!1,this.activeTab="address",this.isLoggedIn=!1,this.viewMode="main",this.countries=[],this.regions=[],this.cities=[],this.districts=[],this.loadingRegions=!1,this.selectedCountry=null,this.selectedRegion=null,this.selectedCity=null,this.selectedDistrict=null,this.districtName="",this.savedAddresses=[],this.selectedSavedAddress=null,this.selectedSessionAddress=!1,this.branches=[],this.filteredBranches=[],this.selectedBranch=null,this.branchSearchQuery="",this.loadingCountries=!1,this.loadingCities=!1,this.loadingDistricts=!1,this.loadingBranches=!1,this.loadingNearestBranch=!1,this.locationError="",this.savingAddress=!1,this.loadingSavedAddresses=!1,this.showCartWillBeClearedBanner=!1,this.countrySearchQuery="",this.regionSearchQuery="",this.citySearchQuery="",this.districtSearchQuery="",this.searchingCountries=!1,this.searchingRegions=!1,this.searchingCities=!1,this.searchingDistricts=!1,this.displayedCountries=[],this.displayedRegions=[],this.displayedCities=[],this.displayedDistricts=[],this.allocationOutOfCoverageMessage=null,this.newAddressForm={...P.INITIAL_ADDRESS_FORM},this.handleCountrySearch=t=>{this.countrySearchQuery=t},this.handleRegionSearch=t=>{this.regionSearchQuery=t},this.handleCitySearch=t=>{if(this.citySearchQuery=t,this.citySearchTimer&&clearTimeout(this.citySearchTimer),!t.trim())return this.displayedCities=this.cities,void(this.searchingCities=!1);if(t.trim().length<P.DROPDOWN_SEARCH_MIN_CHARS)return;const s=++this.citySearchCounter;this.citySearchTimer=setTimeout((async()=>{this.searchingCities=!0;try{const i=y(this.selectedCountry?.code??"")?this.selectedRegion?.id:void 0,e=await v.getCities(this.selectedCountry?.id,i,t);s===this.citySearchCounter&&(this.displayedCities=e)}catch{s===this.citySearchCounter&&(this.displayedCities=this.cities)}finally{s===this.citySearchCounter&&(this.searchingCities=!1)}}),P.DROPDOWN_SEARCH_DEBOUNCE_MS)},this.handleDistrictSearch=t=>{this.districtSearchQuery=t},this.handleCountryDropdownClosed=()=>{this.countrySearchQuery="",this.displayedCountries=this.countries,this.searchingCountries=!1},this.handleRegionDropdownClosed=()=>{this.regionSearchQuery="",this.displayedRegions=this.regions,this.searchingRegions=!1},this.handleCityDropdownClosed=()=>{this.citySearchQuery="",this.citySearchTimer&&(clearTimeout(this.citySearchTimer),this.citySearchTimer=null),++this.citySearchCounter,this.displayedCities=this.cities,this.searchingCities=!1},this.handleDistrictDropdownClosed=()=>{this.districtSearchQuery="",this.displayedDistricts=this.districts,this.searchingDistricts=!1},this.handleSubmitAddAddress=async t=>{if(t.preventDefault(),!this.savingAddress&&this.selectedCountry&&this.selectedCity&&$(this.selectedCountry?.code,this.selectedRegion?.id,this.selectedDistrict?.id??(this.districtName?.trim()||null))){this.savingAddress=!0;try{const t=this.buildAddressLocationPayload(),{success:s,address:i}=await v.saveAddressLocation(t);if(s){await this.loadSavedAddresses();const t=i??this.savedAddresses[0]??null;t?.is_in_coverage&&(this.selectedSessionAddress=!1,this.selectedSavedAddress=t),this.addressCreated.emit({address:t}),this.viewMode="main",this.districtName=""}else Salla.notify?.error(Salla.lang.get("common.errors.error_occurred"))}catch(t){console.error("SallaBulletDelivery: Error saving address",t),Salla.notify?.error(Salla.lang.get("common.errors.error_occurred"))}finally{this.savingAddress=!1}}},this.handleCountrySelected=t=>{const s=this.countries.find((s=>String(s.id)===String(t.id)))||t;this.countrySearchQuery="",this.displayedCountries=this.countries,this.applyCountryChange(s||null)},this.handleRegionSelected=t=>{const s=this.regions.find((s=>String(s.id)===String(t.id)))||t;this.selectedRegion=s||null,this.regionSearchQuery="",this.displayedRegions=this.regions,this.updateNewAddressForm({region_id:s?.id,city_id:void 0,district_id:void 0,city:void 0,district:void 0}),s&&this.selectedCountry&&this.loadCities(this.selectedCountry.id,s.id)},this.handleCitySelected=t=>{const s=y(this.selectedCountry?.code??""),i=this.cities.find((s=>String(s.id)===String(t.id)))||t;this.selectedCity=i||null,this.selectedDistrict=null,this.districtName="",this.citySearchQuery="",this.displayedCities=this.cities,i&&(this.updateNewAddressForm({city:i,district:void 0}),s&&this.loadDistricts(i.id))},this.handleDistrictSelected=t=>{const s=this.districts.find((s=>String(s.id)===String(t.id)))||t;this.selectedDistrict=s||null,this.districtName="",this.districtSearchQuery="",this.displayedDistricts=this.districts,s&&this.updateNewAddressForm({district:s})}}get supportsPickup(){return Boolean(Salla.config.get("store.shipping.support_pickup"))||Boolean(Salla.config.get("store.support_pickup"))}get openingType(){return Salla.config.get("store.settings.bullet_delivery.settings.type")}get isRequired(){return!!Salla.config.get("store.settings.bullet_delivery.settings.is_required")}get isMobileApp(){return Salla.config.isMobileApp()}async open(){if(this.isMobileApp)Salla.event.dispatch("salla::bullet-delivery.open-sheet");else if(this.componentReady&&this.modal){this.resetState(),this.modal.open(),Salla.event.dispatch("salla::bullet-delivery.modal.opened");try{this.isLoggedIn=!this.isGuestUser();const t=this.cleanStaleGuestAddressIdIfNeeded(this.getStoredIntent());this.applyPreselectedIdsFromIntent(t);const s=!this.isLoggedIn&&"address"===t?.type&&null!=C(t)&&null!=x(t);if(this.activeTab=this.supportsPickup&&t?.type&&("address"===t.type||"branch"===t.type)?t.type:"address",this.isLoggedIn&&"address"===this.activeTab&&(this.loadingSavedAddresses=!0),await Promise.all([this.loadCountries(s),this.isLoggedIn&&"address"===this.activeTab?this.loadSavedAddresses().then((()=>{this.savedAddressesLoaded=!0})).finally((()=>{this.loadingSavedAddresses=!1})):Promise.resolve()]),this.isLoggedIn&&this.preselectedAddressId){const t=this.savedAddresses.find((t=>t.id===this.preselectedAddressId));t&&(this.selectedSessionAddress=!1,this.selectedSavedAddress=t)}if("branch"===this.activeTab){const s=B(t),i=N(t);if(null!=s&&null!=i?await this.loadBranchesWithLocation(s,i):await this.loadBranches(),this.preselectedBranchId){const t=this.branches.find((t=>t.id===this.preselectedBranchId));t&&(this.selectedBranch=t)}}await this.prefillFromSessionStorage()}catch(t){console.error("SallaBulletDelivery: Error loading data",t)}finally{this.overrideScopeSwitchUI()}}else this.pendingOpen=!0}async close(){if(!this.shouldForceNonClosable()||this.confirming)return this.cartSubmitConfirmationPending&&!this.confirming&&this.resolvePendingCartSubmit(),this.bulletDeliveryClosed.emit(),this.modal?.close()}resetState(){this.viewMode="main",this.selectedCountry=null,this.selectedRegion=null,this.selectedCity=null,this.selectedDistrict=null,this.districtName="",this.selectedSavedAddress=null,this.selectedSessionAddress=!1,this.selectedBranch=null,this.branchSearchQuery="",this.regions=[],this.cities=[],this.districts=[],this.branches=[],this.filteredBranches=[],this.newAddressForm={...P.INITIAL_ADDRESS_FORM},this.showCartWillBeClearedBanner=!1,this.allocationOutOfCoverageMessage=null,this.locationError="",this.savedAddressesLoaded=!1,this.loadingSavedAddresses=!1,this.loadingCountries=!1,this.resetSearchState()}getIntentStorage(){const t=Boolean(Salla.config.get("store.settings.bullet_delivery.settings.remember_last_session"));return Salla.storage[t?"store":"session"]}getShownStorage(){return Salla.storage.session}getStoredIntent(){return this.getIntentStorage().get(this.intentStorageKey)}isGuestUser(){return"guest"===String(Salla.config.get("user.type")??"guest")}cleanStaleGuestAddressIdIfNeeded(t){if(!this.isGuestUser()||"address"!==t?.type||!t.address_id)return t;const s={...t,address_id:void 0};return this.setStoredIntent(s),s}applyPreselectedIdsFromIntent(t){this.hasExplicitPreselectedIdsForOpen?this.hasExplicitPreselectedIdsForOpen=!1:(this.preselectedAddressId=void 0,this.preselectedBranchId=void 0,this.isGuestUser()?"branch"===t?.type&&t.branch_id&&(this.preselectedBranchId=t.branch_id):"address"===t?.type&&t.address_id?this.preselectedAddressId=t.address_id:"branch"===t?.type&&t.branch_id&&(this.preselectedBranchId=t.branch_id))}hasIncompleteUserAddressIntent(){if(this.isGuestUser())return!1;const t=this.getStoredIntent();return!(!t||"address"!==t.type||t.address_id||!t.address_details)&&D(t)}hasCompleteIntentForLoggedInUser(){if(this.isGuestUser())return!1;const t=this.getStoredIntent();return!!t&&("address"===t.type?!!t.address_id:"branch"===t.type&&!!t.branch_id)}shouldForceNonClosable(){return!this.isGuestUser()&&!!Salla.url.is_page("cart")&&!this.hasCompleteIntentForLoggedInUser()}shouldPromptIncompleteIntentThisSession(){const t=this.getShownStorage();return this.hasIncompleteUserAddressIntent()&&!0!==t.get(this.incompleteIntentPromptKey)}markIncompleteIntentPrompted(){this.getShownStorage().set(this.incompleteIntentPromptKey,!0)}setStoredIntent(t){this.getIntentStorage().set(this.intentStorageKey,t),this.overrideScopeSwitchUI()}clearBulletDeliveryStoredData(){Salla.storage.session.remove(this.intentStorageKey),Salla.storage.store.remove(this.intentStorageKey),Salla.storage.session.remove(this.sessionShownKey),Salla.storage.session.remove(this.incompleteIntentPromptKey),this.overrideScopeSwitchUI()}async prefillAddressFromStoredIntent(){const t=this.getStoredIntent();if(!t||"address"!==t.type||null==x(t))return;const s=C(t);if(!s)return;const i=this.countries.find((t=>String(t.id)===String(s)));if(!i)return;this.selectedCountry=i,this.updateNewAddressForm({country_id:Number(i.id)});const e=y(i.code),l=x(t),a=I(t),r=A(t),n=t.address_details?.district?.name,[h,o,d]=await Promise.all([e?v.getRegions(i.id):Promise.resolve([]),v.getCities(i.id,e&&null!=a?a:void 0),null!=l?v.getDistricts(Number(l)):Promise.resolve([])]);if(e&&(this.regions=h,this.displayedRegions=this.regions),this.cities=o,this.displayedCities=this.cities,this.districts=d,this.displayedDistricts=this.districts,this.loadingCities=!1,this.loadingRegions=!1,this.loadingDistricts=!1,e&&null!=a){const t=this.regions.find((t=>String(t.id)===String(a)));t&&(this.selectedRegion=t,this.updateNewAddressForm({region_id:t.id}))}if(null!=l&&this.cities.length>0){const t=this.cities.find((t=>String(t.id)===String(l)));t&&(this.selectedCity=t,this.updateNewAddressForm({city_id:t.id,city:t}))}if(this.districts.length>0){const t=this.findPrefillDistrict(r,n);t&&(this.updateNewAddressForm({district_id:t.id,district:t}),this.selectedDistrict=t)}!this.selectedDistrict&&n&&(this.districtName=n)}updateNewAddressForm(t){this.newAddressForm={...this.newAddressForm,...t}}hasBeenShownThisSession(){return!0===this.getShownStorage().get(this.sessionShownKey)}markShownThisSession(){this.getShownStorage().set(this.sessionShownKey,!0)}getIPLocationConfig(){const t="store.shipping.delivery_location",s={countryId:Salla.config.get(`${t}.country_id`),regionId:Salla.config.get(`${t}.region_id`),cityId:Salla.config.get(`${t}.city_id`),districtId:Salla.config.get(`${t}.district_id`)};return localStorage.getItem(E)?JSON.parse(localStorage.getItem(E)):s}async loadCountries(t=!1){this.loadingCountries=!0;const s="branch"===this.activeTab;try{this.countries=await v.getCountries(s),this.displayedCountries=this.countries;const{countryId:l,regionId:a,cityId:r,districtId:n}=this.getIPLocationConfig();i="getIPLocationConfig",e=this.getIPLocationConfig(),localStorage.getItem("salla-bullet-delivery-debug")&&(void 0!==e?console.log(i,e):console.log(i));const h=l&&this.countries.length>0?this.countries.find((t=>String(t.id)===String(l))):null;h&&(this.selectedCountry=h,this.updateNewAddressForm({country_id:Number(this.selectedCountry.id)}),!t)&&(null!=a||null!=r||null!=n?await this.prefillFromIPLocation(h,{regionId:a,cityId:r,districtId:n}):y(this.selectedCountry.code)?await this.loadRegions(this.selectedCountry.id):await this.loadCities(this.selectedCountry.id))}finally{this.loadingCountries=!1}var i,e}async prefillFromIPLocation(t,s){const i=y(t.code),{regionId:e,cityId:l,districtId:a}=s,[r,n,h]=await Promise.all([i?v.getRegions(t.id):Promise.resolve([]),v.getCities(t.id,i&&null!=e?e:void 0),null!=l?v.getDistricts(Number(l)):Promise.resolve([])]);if(i&&(this.regions=r,this.displayedRegions=this.regions),this.cities=n,this.displayedCities=this.cities,this.districts=h,this.displayedDistricts=this.districts,this.loadingRegions=!1,this.loadingCities=!1,this.loadingDistricts=!1,i&&null!=e){const t=this.regions.find((t=>String(t.id)===String(e)));t&&(this.selectedRegion=t,this.updateNewAddressForm({region_id:t.id}))}if(null!=l&&this.cities.length>0){const t=this.cities.find((t=>String(t.id)===String(l)));t&&(this.selectedCity=t,this.updateNewAddressForm({city_id:t.id,city:t}))}if(null!=a&&this.districts.length>0){const t=this.findPrefillDistrict(a);t&&(this.selectedDistrict=t,this.updateNewAddressForm({district_id:t.id,district:t}))}}async loadCities(t,s){this.loadingCities=!0,this.cities=[],this.displayedCities=[],this.districts=[],this.displayedDistricts=[],this.selectedCity=null,this.selectedDistrict=null,this.districtName="";try{this.cities=await v.getCities(t,s),this.displayedCities=this.cities}finally{this.loadingCities=!1}}async loadDistricts(t){this.loadingDistricts=!0,this.districts=[],this.displayedDistricts=[],this.selectedDistrict=null,this.districtName="";try{this.districts=await v.getDistricts(t),this.displayedDistricts=this.districts}finally{this.loadingDistricts=!1}}findPrefillDistrict(t,s){if(0===this.districts.length)return;if(null!=t){const s=this.districts.find((s=>String(s.id)===String(t)));if(s)return s}const i=s?.trim().toLowerCase();return i?this.districts.find((t=>{const s=t.name?.trim().toLowerCase(),e=t.name_en?.trim().toLowerCase();return s===i||e===i})):void 0}async loadBranches(){this.loadingBranches=!0;try{this.branches=await v.getBranches({country_id:this.selectedCountry?.id}),this.filterBranches()}finally{this.loadingBranches=!1}}filterBranches(){this.filteredBranches=((t,s)=>{if(!s)return t;const i=s.toLowerCase();return t.filter((t=>t.name.toLowerCase().includes(i)||t.city?.name?.toLowerCase().includes(i)))})(this.branches,this.branchSearchQuery)}async prefillFromSessionStorage(){try{const t=this.getStoredIntent();if(!t)return;if("address"!==this.activeTab||"address"!==t.type||this.isLoggedIn||await this.prefillAddressFromStoredIntent(),"branch"===this.activeTab&&"branch"===t.type){const s=C(t);if(null!=s){const i=this.countries.find((t=>String(t.id)===String(s)));if(i){this.selectedCountry=i,this.updateNewAddressForm({country_id:Number(i.id)});const s=M(t);if(null!=s&&this.branches.length>0){const t=this.branches.find((t=>t.id===s));t&&(this.selectedBranch=t)}}}}}catch(t){console.error("[BulletDelivery] Error prefilling from session storage:",t)}}async loadSavedAddresses(){this.savedAddresses=await v.getSavedAddresses();const t=this.getStoredIntent();if(D(t))this.selectedSessionAddress=!0,this.selectedSavedAddress=null;else{const t=this.savedAddresses.find((t=>t.is_default&&!1!==t.is_in_coverage));if(t)this.selectedSavedAddress=t;else{const t=this.savedAddresses.find((t=>!1!==t.is_in_coverage));t&&(this.selectedSavedAddress=t)}}}applyCountryChange(t){this.selectedCountry=t,this.selectedRegion=null,this.regions=[],this.displayedRegions=[],this.cities=[],this.displayedCities=[],this.districts=[],this.displayedDistricts=[],this.selectedCity=null,this.selectedDistrict=null,this.districtName="",this.allocationOutOfCoverageMessage=null,this.regionSearchQuery="",this.citySearchQuery="",this.districtSearchQuery="",this.searchingRegions=!1,this.searchingCities=!1,this.searchingDistricts=!1,this.clearSearchTimers(),this.selectedCountry&&(this.updateNewAddressForm({country_id:Number(this.selectedCountry.id),region_id:void 0,city_id:void 0,district_id:void 0,city:void 0,district:void 0}),"branch"===this.activeTab?this.loadBranches():y(this.selectedCountry.code)?this.loadRegions(this.selectedCountry.id):this.loadCities(this.selectedCountry.id))}async loadRegions(t){this.loadingRegions=!0,this.regions=[],this.displayedRegions=[],this.selectedRegion=null,this.cities=[],this.displayedCities=[],this.districts=[],this.displayedDistricts=[],this.selectedCity=null,this.selectedDistrict=null,this.districtName="";try{this.regions=await v.getRegions(t),this.displayedRegions=this.regions}finally{this.loadingRegions=!1}}emitHeaderContextUpdate(t,s,i){let e="";"address"===t.type?s?e=s.district?.name&&s.city?.name?`${s.district.name}، ${s.city.name}`:s.city?.name??"":this.selectedCity?e=this.selectedDistrict?`${this.selectedDistrict.name}، ${this.selectedCity.name}`:this.selectedCity.name:t.address_details&&(e=[t.address_details.district?.name,t.address_details.city.name,t.address_details.country.name].filter(Boolean).join("، ")||t.address_details.short_address||""):i?e=i.name:t.branch_details&&(e=t.branch_details.city??t.branch_details.name);const l="address"===t.type?Salla.lang.get("mobile_app.strings.delivery"):Salla.lang.get("mobile_app.strings.pickup");this.headerContextUpdate.emit({type:t.type,display_text:e?`${l}: ${e}`:"",country_code:t.country_code,city:this.selectedCity?.name??t.address_details?.city?.name,district:this.selectedDistrict?.name??t.address_details?.district?.name,branch_name:i?.name??t.branch_details?.name})}handleBranchSearch(t){const s=t.target.value;if(this.branchSearchQuery=s,this.branchSearchDebounceTimer&&clearTimeout(this.branchSearchDebounceTimer),!s?.trim())return this.branchSearchQuery="",void this.loadBranches();this.branchSearchDebounceTimer=setTimeout((async()=>{if(!(s.trim().length<2)){this.loadingBranches=!0;try{this.branches=await v.getBranches({country_id:this.selectedCountry?.id,query:s}),this.filterBranches()}finally{this.loadingBranches=!1}}}),1e3)}clearSearchTimers(){[this.countrySearchTimer,this.regionSearchTimer,this.citySearchTimer,this.districtSearchTimer].forEach((t=>{t&&clearTimeout(t)})),this.countrySearchTimer=this.regionSearchTimer=this.citySearchTimer=this.districtSearchTimer=null}resetSearchState(){this.countrySearchQuery="",this.regionSearchQuery="",this.citySearchQuery="",this.districtSearchQuery="",this.searchingCountries=!1,this.searchingRegions=!1,this.searchingCities=!1,this.searchingDistricts=!1,this.displayedCountries=[],this.displayedRegions=[],this.displayedCities=[],this.displayedDistricts=[],this.clearSearchTimers()}async loadBranchesWithLocation(t,s){this.loadingBranches=!0;try{if(this.branches=await v.getBranches({country_id:this.selectedCountry?.id,lat:t,lng:s}),this.filterBranches(),!this.selectedCountry&&this.branches.length>0){const t=this.branches[0];if(t.country){const s=this.countries.find((s=>s.id===t.country.id));s&&(this.selectedCountry=s,this.updateNewAddressForm({country_id:Number(s.id)}))}}}finally{this.loadingBranches=!1}}async handleFindNearestBranch(){if(navigator.geolocation){this.loadingNearestBranch=!0,this.locationError="";try{const t=await new Promise(((t,s)=>{navigator.geolocation.getCurrentPosition(t,s,{enableHighAccuracy:!0,timeout:1e4,maximumAge:0})})),{latitude:s,longitude:i}=t.coords;await this.loadBranchesWithLocation(s,i);const e=function(t,s,i){let e=null,l=Number.POSITIVE_INFINITY;for(const a of t){const t=null!=a.location?.lat?Number(a.location.lat):Number.NaN,r=null!=a.location?.lng?Number(a.location.lng):Number.NaN;if(Number.isNaN(t)||Number.isNaN(r)||!1===a.is_open)continue;const n=f(s,i,t,r);n<l&&(l=n,e=a)}return e}(this.branches,s,i);e&&(this.selectedBranch=e,this.branchSearchQuery="",this.filterBranches())}catch(t){const s=t;this.locationError=L["number"==typeof s?.code?s.code:-1]??"An error occurred while detecting location"}finally{this.loadingNearestBranch=!1}}else this.locationError=Salla.lang.get("pages.checkout.current_location_not_supported")}handleBranchSelect(t){this.selectedBranch=t}handleSavedAddressSelect(t){!1!==t.is_in_coverage?(this.selectedSavedAddress=t,this.selectedSessionAddress=!1):Salla.notify?.error(Salla.lang.get("pages.checkout.shipping_not_available"))}handleSessionAddressSelect(){this.selectedSessionAddress=!0,this.selectedSavedAddress=null}async handleAddNewAddress(){this.viewMode="add-address";const t=this.getStoredIntent(),s=C(t);if(s&&this.countries.length>0){const t=this.countries.find((t=>t.id===s));t&&(this.selectedCountry=t,this.updateNewAddressForm({country_id:Number(t.id)}),y(t.code)?await this.loadRegions(t.id):await this.loadCities(t.id))}}handleBackToAddressList(){this.viewMode="main"}buildAddressLocationPayload(){const t=this.selectedDistrict?.name??this.districtName?.trim()??"";return function(t){const{countryId:s,countryCode:i,regionId:e,cityId:l,districtId:a,description:r=""}=t,n=r||"";return{country_id:Number(s)||void 0,region_id:null!=e?Number(e):void 0,city_id:null!=l?Number(l):void 0,district_id:null!=a?Number(a):void 0,description:n,...i&&y(i)&&{local:n}}}({countryId:this.selectedCountry?.id??0,countryCode:this.selectedCountry?.code,regionId:this.selectedRegion?.id,cityId:this.selectedCity?.id,districtId:this.selectedDistrict?.id,description:t})}async handleTabChange(t){if(!this.tabChanging){this.tabChanging=!0;try{this.activeTab=t,this.showCartWillBeClearedBanner=!1,this.allocationOutOfCoverageMessage=null,this.resetSearchState();const s="branch"===t;this.countries=await v.getCountries(s),this.displayedCountries=this.countries;const i=this.selectedCountry?.id;if(null!=i&&(this.selectedCountry=this.countries.find((t=>t.id===i))||null),!this.selectedCountry){const{countryId:t}=this.getIPLocationConfig();t&&this.countries.length>0&&(this.selectedCountry=this.countries.find((s=>String(s.id)===String(t)))||null),this.selectedCountry||1!==this.countries.length||(this.selectedCountry=this.countries[0])}if(this.selectedCountry)if("branch"===t){const t=this.getStoredIntent(),s=B(t),i=N(t);null!=s&&null!=i?await this.loadBranchesWithLocation(s,i):await this.loadBranches();const e=M(t);if(null!=e&&this.branches.length>0){const t=this.branches.find((t=>t.id===e));t&&(this.selectedBranch=t)}}else if("address"===t){if(this.isLoggedIn&&!this.savedAddressesLoaded){this.loadingSavedAddresses=!0;try{await this.loadSavedAddresses(),this.savedAddressesLoaded=!0}finally{this.loadingSavedAddresses=!1}}if(!this.isLoggedIn){const t=this.getStoredIntent();t&&x(t)&&await this.prefillAddressFromStoredIntent()}}}finally{this.tabChanging=!1}}}isConfirmDisabled(){return"branch"===this.activeTab?!this.selectedBranch:!("address"!==this.activeTab||this.isLoggedIn&&this.selectedSessionAddress||(this.isLoggedIn&&this.selectedSavedAddress?!1!==this.selectedSavedAddress.is_in_coverage:this.selectedCountry&&this.selectedCity&&$(this.selectedCountry?.code,this.selectedRegion?.id,this.selectedDistrict?.id??(this.districtName?.trim()||null))))}handleLogin(){Salla.auth.setCanRedirect(!1),Salla.event.dispatch("salla::bullet-delivery.modal.close.requested"),Salla.event.dispatch("login::open",Salla.url.is_page("cart")?{withoutReload:!0,source:"cart-submit"}:{withoutReload:!0,source:"bullet-delivery"})}resolvePendingCartSubmit(){if(!this.pendingCartSubmitResolver)return;const t=this.pendingCartSubmitResolver;this.pendingCartSubmitResolver=null,this.pendingCartSubmitPromise=null,this.cartSubmitConfirmationPending=!1,t()}buildIntentAddress(){if("address"!==this.activeTab||!this.selectedCountry||!this.selectedCity)return;const t={id:this.selectedCountry.id,name:this.selectedCountry.name,code:this.selectedCountry.code},s={id:this.selectedCity.id,name:this.selectedCity.name},i=this.selectedRegion?{id:this.selectedRegion.id,name:this.selectedRegion.name,code:this.selectedRegion.code}:void 0,e=this.selectedDistrict?{id:this.selectedDistrict.id,name:this.selectedDistrict.name}:this.districtName?{id:0,name:this.districtName}:void 0,l=this.selectedSavedAddress?.short_address;return{country:t,region:i,city:s,district:e,short_address:l}}buildIntentAddressFromSaved(t){return{country:{id:t.country?.id??t.country_id??0,name:t.country?.name??"",code:t.country?.code},region:t.region?{id:t.region.id,name:t.region.name,code:t.region.code}:void 0,city:{id:t.city?.id??t.city_id??0,name:t.city?.name??""},district:t.district?{id:t.district.id,name:t.district.name}:void 0,short_address:t.short_address}}buildIntentBranch(){if("branch"!==this.activeTab||!this.selectedBranch)return;const t=this.selectedBranch,s=null!=t.location?.lat?Number(t.location.lat):void 0,i=null!=t.location?.lng?Number(t.location.lng):void 0;return{id:t.id,name:t.name,city:t.city?.name,latitude:s,longitude:i}}buildAllocationConfirmedAddressData(t){return"address"!==this.activeTab?null:{saved_address:t??this.selectedSavedAddress??void 0,country:this.selectedCountry??void 0,region:this.selectedRegion??void 0,city:this.selectedCity??void 0,district:this.selectedDistrict??void 0,district_name:this.districtName?.trim()||void 0,short_address:t?.short_address??this.selectedSavedAddress?.short_address,form_data:{...this.newAddressForm}}}buildAllocationConfirmedAddressFromIntent(t){if("address"!==t.type)return null;const s=t.address_details,i=Number(t.country_id)||0;return{country:s?.country?{id:s.country.id,name:s.country.name,code:s.country.code??t.country_code??""}:void 0,region:s?.region?{id:Number(s.region.id),name:s.region.name,country_id:i,code:s.region.code??void 0}:void 0,city:s?.city?{id:Number(s.city.id),name:s.city.name,country_id:i}:void 0,district:s?.district?{id:Number(s.district.id),name:s.district.name,city_id:Number(s.city?.id)||0}:void 0,short_address:s?.short_address}}buildBranchFromIntent(t){if("branch"!==t.type||!t.branch_details)return null;const s=t.branch_details,i={id:s.id,name:s.name};return s.city&&(i.city={id:0,name:s.city}),null!=s.latitude&&null!=s.longitude&&(i.location={lat:String(s.latitude),lng:String(s.longitude)}),i}buildAllocationRequestFromIntent(t){if("branch"===t.type)return{type:"branch",branch_id:null!=t.branch_id?String(t.branch_id):""};if(null!=t.address_id)return{type:"address",address_id:String(t.address_id)};const s=t.address_details,i={type:"address",country_id:null!=t.country_id?String(t.country_id):"",city_id:null!=s?.city?.id?String(s.city.id):""};return null!=s?.region?.id&&(i.region_id=String(s.region.id)),null!=s?.district?.id&&(i.district_id=String(s.district.id)),i}applyMobileBulletDeliverySelection(t){if(!t||"address"!==t.type&&"branch"!==t.type)return void console.warn("SallaBulletDelivery: ignoring invalid mobile select payload",t);const s=t.allocation_headers??{},i=s["s-scope-allocation-type"]??t.type,e=s["s-scope-allocation-id"];i&&Salla.api.setHeader("s-scope-allocation-type",i),e&&Salla.api.setHeader("s-scope-allocation-id",String(e));const l=Salla.config.get("store.scope",Salla.storage.get("scope"))||{};Salla.storage.set("scope",{...l,allocation_type:i,allocation_id:e?String(e):void 0}),this.markShownThisSession();const a={...t,allocation_headers:{"s-scope-allocation-type":i,"s-scope-allocation-id":e?String(e):void 0}};this.setStoredIntent(a),m();const r=this.buildBranchFromIntent(a),n={...a,address:this.buildAllocationConfirmedAddressFromIntent(a),branch:r,allocation_request:this.buildAllocationRequestFromIntent(a),allocation_response:null};Salla.event.dispatch("salla::bullet-delivery.allocation.confirmed",n),this.bulletDeliveryConfirmed.emit({...a,branch:r??void 0}),this.emitHeaderContextUpdate(a,void 0,r??void 0),setTimeout((()=>window.location.reload()),100)}extractMobileSelectPayload(t){return t&&"object"==typeof t?"payload"in t&&t.payload?t.payload:t:null}async handleConfirm(){if(this.isConfirmDisabled()||this.confirming)return;this.confirming=!0,this.confirmBtn?.load();let t=!1;try{const s={type:this.activeTab,country_id:Number(this.selectedCountry?.id)||0,country_code:this.selectedCountry?.code||""};let i,e,l;if("address"===this.activeTab)if(this.isLoggedIn&&this.selectedSessionAddress){const t=await this.saveSessionAddressToProfile();if(!t)return Salla.notify?.error(Salla.lang.get("common.errors.error_occurred")),void this.confirmBtn?.stop();s.address_id=t.id,i=t,this.selectedSessionAddress=!1,this.selectedSavedAddress=t,s.address_details=this.buildIntentAddressFromSaved(t)}else this.isLoggedIn&&this.selectedSavedAddress?(s.address_id=this.selectedSavedAddress.id,i=this.selectedSavedAddress,s.address_details=this.buildIntentAddressFromSaved(this.selectedSavedAddress)):s.address_details=this.buildIntentAddress();else s.branch_details=this.buildIntentBranch(),s.branch_id=this.selectedBranch?.id,e=this.selectedBranch||void 0;"address"===this.activeTab?this.isLoggedIn&&this.selectedSavedAddress?l={type:"address",address_id:String(this.selectedSavedAddress.id)}:(l={type:"address",country_id:String(this.selectedCountry?.id||0),city_id:String(this.selectedCity?.id||"")},y(this.selectedCountry?.code??"")&&(this.selectedRegion?.id&&(l.region_id=String(this.selectedRegion.id)),l.district_id=String(this.selectedDistrict?.id||""))):l={type:"branch",branch_id:String(this.selectedBranch?.id||"")};const a=await v.allocateScope(l);if(!a.success){console.error("BulletDelivery: Scope allocation failed",a.error);const t=a.error||("address"===this.activeTab?Salla.lang.get("pages.checkout.address_out_of_coverage"):Salla.lang.get("pages.checkout.failed_to_set_pickup"));return this.allocationOutOfCoverageMessage=t,this.confirmBtn?.stop(),void(this.confirming=!1)}let r;if(a.data){const t=a.data;r=t.id;const i=t?.allocation?.type,e=t?.allocation?.branch_id;i&&Salla.api.setHeader("s-scope-allocation-type",i),e&&Salla.api.setHeader("s-scope-allocation-id",String(e));const l=Salla.config.get("store.scope",Salla.storage.get("scope"))||{};Salla.storage.set("scope",{...l,id:r,allocation_type:i,allocation_id:e?String(e):void 0}),s.allocation_headers={"s-scope-allocation-type":i,"s-scope-allocation-id":e?String(e):void 0}}this.markShownThisSession(),this.setStoredIntent(s),r&&(await v.setDeliveryScope(r),m());const n={...s,address:this.buildAllocationConfirmedAddressData(i),branch:e??null,allocation_request:l,allocation_response:a.data??null};Salla.event.dispatch("salla::bullet-delivery.allocation.confirmed",n),this.bulletDeliveryConfirmed.emit({...s,address:i,branch:e}),this.emitHeaderContextUpdate(s,i,e),t=!0,setTimeout((()=>{if(this.confirmBtn?.stop(),this.close(),this.confirming=!1,this.cartSubmitConfirmationPending)this.resolvePendingCartSubmit();else if(r){const t=Salla.storage.get("scope")||{};let s=Salla.helpers.addParamToUrl("scope",r);t.allocation_id&&(s=Salla.helpers.addParamToUrl("allocation_id",t.allocation_id,s)),t.allocation_type&&(s=Salla.helpers.addParamToUrl("allocation_type",t.allocation_type,s)),window.location.replace(s)}else window.location.reload()}),500)}finally{t||(this.confirming=!1)}}getCartViewConfig(t){if(!t||!Salla.url.is_page("cart"))return null;const s="branch"===t.type,i="address"===t.type;return s&&!this.supportsPickup||!s&&!i?null:{title:s?Salla.lang.get("pages.checkout.pickup_option"):Salla.lang.get("pages.checkout.delivery_option"),subtitle:S(t,Salla.lang.get("common.elements.to"),""),buttonText:Salla.lang.get("common.elements.edit"),isAddress:i,intent:t}}createCartViewElement(){const t=this.getStoredIntent(),s=this.getCartViewConfig(t);if(!s)return null;const{title:i,subtitle:e,buttonText:l,intent:a}=s,r="branch"===a.type?{preselected_branch_id:M(a)}:{preselected_address_id:a.address_id},h=document.createElement("span");h.className="s-bullet-delivery-cart-view-icon s-bullet-delivery-tab-icon",h.setAttribute("aria-hidden","true"),h.innerHTML=n;const o=document.createElement("span");o.className="s-bullet-delivery-cart-view-title",o.textContent=i;const d=document.createElement("span");d.className="s-bullet-delivery-cart-view-subtitle",d.textContent=e;const c=document.createElement("div");c.className="s-bullet-delivery-cart-view-text",c.append(o,d);const u=document.createElement("div");u.className="s-bullet-delivery-cart-view-info",u.append(h,c);const p=document.createElement("salla-button");p.className="s-bullet-delivery-cart-view-button",p.setAttribute("fill","outline"),p.setAttribute("color","primary"),p.textContent=l,p.addEventListener("click",(()=>Salla.event.emit("salla::bullet-delivery.modal.open.requested",r)));const b=document.createElement("div");return b.className="s-bullet-delivery-cart-view",b.append(u,p),b}renderTabs(){return this.supportsPickup?i("div",{class:"s-bullet-delivery-tabs"},i("button",{type:"button",class:{"s-bullet-delivery-tab":!0,"s-bullet-delivery-tab--active":"address"===this.activeTab},onClick:()=>this.handleTabChange("address")},i("span",{class:"s-bullet-delivery-tab-icon",innerHTML:n,"aria-hidden":"true"}),i("span",null,Salla.lang.get("mobile_app.strings.delivery"))),i("button",{type:"button",class:{"s-bullet-delivery-tab":!0,"s-bullet-delivery-tab--active":"branch"===this.activeTab},onClick:()=>this.handleTabChange("branch")},i("span",{class:"s-bullet-delivery-tab-icon",innerHTML:T,"aria-hidden":"true"}),i("span",null,Salla.lang.get("mobile_app.strings.pickup")))):null}renderAlert(t){return i("div",{class:"s-bullet-delivery-allocation-out-of-coverage",role:"alert"},i("span",{class:"s-bullet-delivery-allocation-out-of-coverage-icon","aria-hidden":"true"},i("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-hidden":"true"},i("title",null,"Information"),i("circle",{cx:"10",cy:"10",r:"9",stroke:"currentColor","stroke-width":"1.5",fill:"currentColor"}),i("text",{x:"10",y:"14","text-anchor":"middle",fill:"white","font-size":"12","font-weight":"bold"},"i"))),i("span",{class:"s-bullet-delivery-allocation-out-of-coverage-text"},t))}renderAllocationOutOfCoverageAlert(){const t=this.allocationOutOfCoverageMessage||Salla.lang.get("pages.checkout.shipping_not_available");return this.renderAlert(t)}renderCountrySelect(){return i("div",{class:"s-bullet-delivery-field"},i("salla-searchable-dropdown",{label:Salla.lang.get("blocks.buy_as_gift.receiver_country"),placeholder:Salla.lang.get("pages.checkout.select_country"),items:this.displayedCountries,selectedItem:this.selectedCountry,loading:this.loadingCountries,searching:this.searchingCountries,disabled:this.countries.length<=1,required:!0,inputId:"bullet-delivery-country",searchQuery:this.countrySearchQuery,clientSearch:!0,onItemSelected:t=>this.handleCountrySelected(t.detail),onSearchInput:t=>this.handleCountrySearch(t.detail),onDropdownClosed:()=>this.handleCountryDropdownClosed()}))}renderRegionSelect(){return y(this.selectedCountry?.code??"")&&this.selectedCountry?i("div",{class:"s-bullet-delivery-field"},i("salla-searchable-dropdown",{label:Salla.lang.get("pages.checkout.region_field"),placeholder:Salla.lang.get("pages.checkout.select_region"),items:this.displayedRegions,selectedItem:this.selectedRegion,loading:this.loadingRegions,searching:this.searchingRegions,disabled:this.loadingRegions||0===this.regions.length,required:!0,inputId:"bullet-delivery-region",searchQuery:this.regionSearchQuery,clientSearch:!0,onItemSelected:t=>this.handleRegionSelected(t.detail),onSearchInput:t=>this.handleRegionSearch(t.detail),onDropdownClosed:()=>this.handleRegionDropdownClosed()})):null}renderCityDistrictSelects(){const t=y(this.selectedCountry?.code??""),s=t,e=s&&this.selectedCity&&!this.loadingDistricts&&0===this.districts.length,l=!this.selectedCountry||t&&!this.selectedRegion||this.loadingCities||0===this.cities.length,a=!this.selectedCountry||t&&!this.selectedRegion||!this.selectedCity||this.loadingDistricts;return i("div",{class:"s-bullet-delivery-field-row"},i("div",{class:"s-bullet-delivery-field"},i("salla-searchable-dropdown",{label:Salla.lang.get("blocks.buy_as_gift.receiver_city"),placeholder:Salla.lang.get("pages.checkout.select_city"),items:this.displayedCities,selectedItem:this.selectedCity,loading:this.loadingCities,searching:this.searchingCities,disabled:l,required:!0,inputId:"bullet-delivery-city",searchQuery:this.citySearchQuery,onItemSelected:t=>this.handleCitySelected(t.detail),onSearchInput:t=>this.handleCitySearch(t.detail),onDropdownClosed:()=>this.handleCityDropdownClosed(),dropUp:!0})),s&&i("div",{class:"s-bullet-delivery-field"},e?i("div",null,i("label",{class:"s-bullet-delivery-label",htmlFor:"bullet-delivery-district"},Salla.lang.get("pages.checkout.district_field"),i("span",{class:"text-red-500"}," *")),i("input",{id:"bullet-delivery-district",type:"text",class:"form-input",placeholder:Salla.lang.get("pages.checkout.select_district"),value:this.districtName,disabled:a,onInput:t=>{this.districtName=t.target.value,this.updateNewAddressForm({district:void 0})}})):i("salla-searchable-dropdown",{label:Salla.lang.get("pages.checkout.district_field"),placeholder:Salla.lang.get("pages.checkout.select_district"),items:this.displayedDistricts,selectedItem:this.selectedDistrict,loading:this.loadingDistricts,searching:this.searchingDistricts,disabled:a||0===this.districts.length,required:!0,inputId:"bullet-delivery-district",searchQuery:this.districtSearchQuery,clientSearch:!0,onItemSelected:t=>this.handleDistrictSelected(t.detail),onSearchInput:t=>this.handleDistrictSearch(t.detail),onDropdownClosed:()=>this.handleDistrictDropdownClosed(),dropUp:!0})))}renderSavedAddressesEmptyState(){return i("div",{class:"s-bullet-delivery-saved-addresses-empty"},i("div",{class:"s-bullet-delivery-saved-addresses-empty-icon","aria-hidden":"true"},i("svg",{width:"28",height:"28",viewBox:"0 0 28 29",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i("title",null,"No Saved Adresses"),i("path",{d:"M20.16 0C21.4613 0 22.6773 0.341333 23.808 1.024C24.9387 1.70667 25.8347 2.61333 26.496 3.744C27.1787 4.91733 27.52 6.18667 27.52 7.552C27.52 9.45067 26.8267 11.232 25.44 12.896C24.4587 14.0907 23.0827 15.2427 21.312 16.352H21.28C20.9387 16.5653 20.5653 16.672 20.16 16.672C19.7547 16.672 19.3813 16.5653 19.04 16.352H19.008C17.2373 15.2213 15.8613 14.0693 14.88 12.896C13.4933 11.232 12.8 9.45067 12.8 7.552C12.8 6.18667 13.1413 4.91733 13.824 3.744C14.4853 2.61333 15.3813 1.70667 16.512 1.024C17.6427 0.341333 18.8587 0 20.16 0ZM11.488 1.984C9.67467 2.368 8.04267 3.14667 6.592 4.32C5.14133 5.49333 4.01067 6.92267 3.2 8.608C2.34667 10.3573 1.92 12.224 1.92 14.208C1.92 14.72 1.952 15.2427 2.016 15.776L2.08 15.744C2.57067 15.488 2.94933 15.3067 3.216 15.2C3.48267 15.0933 3.73867 15.0933 3.984 15.2C4.22933 15.3067 4.4 15.488 4.496 15.744C4.592 16 4.58667 16.256 4.48 16.512C4.37333 16.768 4.19733 16.9493 3.952 17.056C3.70667 17.1627 3.36 17.3227 2.912 17.536L2.656 17.664C2.57067 17.7067 2.48533 17.7387 2.4 17.76C2.89067 19.4667 3.70133 20.9973 4.832 22.352C5.96267 23.7067 7.296 24.7573 8.832 25.504C10.432 26.272 12.1173 26.656 13.888 26.656C15.4667 26.656 16.9813 26.3467 18.432 25.728C19.8187 25.1307 21.0667 24.288 22.176 23.2C21.92 23.0507 21.7653 22.8373 21.712 22.56C21.6587 22.2827 21.7013 22.0267 21.84 21.792C21.9787 21.5573 22.176 21.408 22.432 21.344C22.8373 21.2587 23.2 21.12 23.52 20.928C23.6907 20.8427 23.8613 20.8 24.032 20.8C24.8 19.5413 25.3333 18.176 25.632 16.704C25.6747 16.4267 25.808 16.2133 26.032 16.064C26.256 15.9147 26.496 15.8667 26.752 15.92C27.008 15.9733 27.2107 16.1173 27.36 16.352C27.5093 16.5867 27.552 16.832 27.488 17.088C27.0613 19.2853 26.1973 21.264 24.896 23.024C23.5947 24.784 22.0053 26.1547 20.128 27.136C18.1653 28.16 16.0853 28.672 13.888 28.672C11.3707 28.672 9.03467 28.0107 6.88 26.688C4.78933 25.408 3.12533 23.68 1.888 21.504C0.629333 19.264 0 16.832 0 14.208C0 11.904 0.490667 9.73867 1.472 7.712C2.41067 5.74933 3.728 4.09067 5.424 2.736C7.12 1.38133 9.01333 0.48 11.104 0.032C11.36 -0.032 11.6 0.0106667 11.824 0.16C12.048 0.309333 12.1867 0.522667 12.24 0.8C12.2933 1.07733 12.2453 1.328 12.096 1.552C11.9467 1.776 11.744 1.92 11.488 1.984ZM14.72 7.552C14.72 8.96 15.2533 10.304 16.32 11.584C17.1733 12.5867 18.3893 13.6 19.968 14.624C20.032 14.6453 20.096 14.656 20.16 14.656C20.224 14.656 20.288 14.6453 20.352 14.624C21.9307 13.6213 23.1467 12.608 24 11.584C25.0667 10.304 25.6 8.96 25.6 7.552C25.6 6.57067 25.3547 5.65333 24.864 4.8C24.3733 3.94667 23.7067 3.26933 22.864 2.768C22.0213 2.26667 21.12 2.016 20.16 2.016C19.2 2.016 18.2987 2.26667 17.456 2.768C16.6133 3.26933 15.9467 3.94667 15.456 4.8C14.9653 5.65333 14.72 6.57067 14.72 7.552ZM17.28 7.68C17.28 6.848 17.5627 6.13867 18.128 5.552C18.6933 4.96533 19.3707 4.672 20.16 4.672C20.9493 4.672 21.6267 4.96533 22.192 5.552C22.7573 6.13867 23.04 6.848 23.04 7.68C23.04 8.512 22.7573 9.216 22.192 9.792C21.6267 10.368 20.9493 10.656 20.16 10.656C19.3707 10.656 18.6933 10.368 18.128 9.792C17.5627 9.216 17.28 8.512 17.28 7.68ZM6.752 14.688C7.62667 14.7733 8.53333 15.0293 9.472 15.456C9.70667 15.5627 9.87733 15.744 9.984 16C10.0907 16.256 10.0907 16.512 9.984 16.768C9.87733 17.024 9.70133 17.2 9.456 17.296C9.21067 17.392 8.97067 17.3867 8.736 17.28C7.94667 16.9387 7.22133 16.736 6.56 16.672C6.28267 16.6293 6.064 16.5013 5.904 16.288C5.744 16.0747 5.68 15.8293 5.712 15.552C5.744 15.2747 5.86133 15.0507 6.064 14.88C6.26667 14.7093 6.496 14.6453 6.752 14.688ZM17.6 20.544C18.304 20.864 18.976 21.0987 19.616 21.248C19.872 21.312 20.0693 21.4613 20.208 21.696C20.3467 21.9307 20.3893 22.1813 20.336 22.448C20.2827 22.7147 20.144 22.9227 19.92 23.072C19.696 23.2213 19.4453 23.264 19.168 23.2C18.4213 23.0293 17.632 22.752 16.8 22.368C16.5653 22.2613 16.4 22.08 16.304 21.824C16.208 21.568 16.2133 21.312 16.32 21.056C16.4267 20.8 16.6027 20.624 16.848 20.528C17.0933 20.432 17.344 20.4373 17.6 20.544ZM12.832 17.44C13.0027 17.568 13.248 17.7493 13.568 17.984L14.496 18.688C14.7093 18.8587 14.8373 19.0773 14.88 19.344C14.9227 19.6107 14.8693 19.856 14.72 20.08C14.5707 20.304 14.368 20.4427 14.112 20.496C13.856 20.5493 13.6107 20.5013 13.376 20.352L11.744 19.072C11.5307 18.9227 11.4027 18.7093 11.36 18.432C11.3173 18.1547 11.3707 17.904 11.52 17.68C11.6693 17.456 11.872 17.3227 12.128 17.28C12.384 17.2373 12.6187 17.2907 12.832 17.44ZM20.16 8.672C20.416 8.672 20.64 8.576 20.832 8.384C21.024 8.192 21.12 7.95733 21.12 7.68C21.12 7.40267 21.024 7.16267 20.832 6.96C20.64 6.75733 20.416 6.656 20.16 6.656C19.904 6.656 19.68 6.75733 19.488 6.96C19.296 7.16267 19.2 7.40267 19.2 7.68C19.2 7.95733 19.296 8.192 19.488 8.384C19.68 8.576 19.904 8.672 20.16 8.672Z",fill:"#666666"}))),i("p",{class:"s-bullet-delivery-saved-addresses-empty-title"},Salla.lang.get("pages.checkout.no_saved_addresses")),i("p",{class:"s-bullet-delivery-saved-addresses-empty-desc"},Salla.lang.get("pages.checkout.add_address_simplify_shipping")),i("salla-button",{onClick:()=>this.handleAddNewAddress(),onKeyUp:()=>this.handleAddNewAddress()},Salla.lang.get("pages.checkout.add_new_address")))}async saveSessionAddressToProfile(){const t=this.getStoredIntent(),s=C(t),i=x(t),e=A(t);if(!t||"address"!==t.type||!s||!i)return null;const l=k(t);if(y(l)&&!e)return null;const a=y(l),r=t.address_details?.district?.name??"",n={country_id:s,region_id:I(t),city_id:i,district_id:e,description:r};a&&(n.local=r);try{const{success:t,address:s}=await v.saveAddressLocation(n);if(!t)return null;const i=s??null;return i&&this.addressCreated.emit({address:i}),i}catch(t){return console.error("SallaBulletDelivery: Error saving session address",t),null}}renderSavedAddresses(){if(!this.isLoggedIn)return null;if(this.loadingSavedAddresses)return i("div",{class:"s-bullet-delivery-addresses-list s-scrollbar"},[1,2,3].map((t=>i("div",{key:t,class:"s-bullet-delivery-address-item s-bullet-delivery-address-item--skeleton"},i("salla-skeleton",{class:"s-bullet-delivery-skel-radio",height:"18px",width:"18px"}),i("salla-skeleton",{class:"s-bullet-delivery-skel-map",height:"36px",width:"36px"}),i("div",{class:"s-bullet-delivery-address-content"},i("div",{class:"s-bullet-delivery-address-lines"},i("salla-skeleton",{height:"18px",width:"72%"}),i("salla-skeleton",{height:"16px",width:"56%"})))))));const t=this.getStoredIntent(),s=D(t),e=s&&t?.address_details&&[t.address_details.city?.name,t.address_details.country?.name].filter(Boolean).join("، ")||"",l=s&&t?.address_details?(t.address_details.district?.name??"").trim():"";return 0!==this.savedAddresses.length||s?i("div",{class:"s-bullet-delivery-addresses-list s-scrollbar"},s&&this.renderAddressRow({key:"session-address",line1:e,line2:l,selected:this.selectedSessionAddress,onClick:()=>this.handleSessionAddressSelect()}),this.savedAddresses.map((t=>{const s=[t.building_number,t.street].filter(Boolean).join("، ")||t.formatted?.address_one||t.short_address||"",i=[t.district?.name,t.city?.name,t.country?.name].filter(Boolean).join("، "),e=(t.formatted?.address_two||i)??"",l=!1!==t.is_in_coverage;return this.renderAddressRow({key:String(t.id),line1:s,line2:e,selected:this.selectedSavedAddress?.id===t.id,disabled:!l,onClick:()=>l&&this.handleSavedAddressSelect(t)})}))):this.renderSavedAddressesEmptyState()}renderAddressRow(t){const{key:s,line1:e,line2:l,selected:a,disabled:r=!1,onClick:n}=t;return i("button",{key:s,class:{"s-bullet-delivery-address-item":!0,"s-bullet-delivery-address-item--selected":a,"s-bullet-delivery-address-item--disabled":r},type:"button",onClick:r?void 0:n,onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),r||n())}},i("input",{type:"radio",name:"saved_address",class:"s-bullet-delivery-radio",checked:a,disabled:r,onClick:t=>t.stopPropagation()}),i("span",{class:"s-bullet-delivery-address-map-icon",innerHTML:'<svg width="35" height="35" viewBox="0 0 35 35" fill="none" xmlns="http://www.w3.org/2000/svg">\n <g filter="url(#filter0_d_24181_220540)">\n <mask id="mask0_24181_220540" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="1" y="0" width="33" height="32">\n <rect x="1.90958" y="0.576577" width="30.8468" height="30.8468" rx="9.22523" fill="#D9D9D9" stroke="white" stroke-width="1.15315"/>\n </mask>\n <g mask="url(#mask0_24181_220540)">\n <rect x="1.90958" y="0.576577" width="30.8468" height="30.8468" rx="9.22523" fill="#E8E8E8" stroke="white" stroke-width="1.15315"/>\n <path d="M17.9096 6.77445L28.7204 5.33301H32.4681L32.7564 11.8195V23.6393L10.4141 23.9276V10.8105L17.9096 6.77445Z" fill="#97E7C8"/>\n <path d="M-2.70303 10.6664H10.2699M41.6934 5.47722C38.378 5.47722 34.7744 5.47722 27.8555 5.47722C20.9366 5.47722 18.4862 6.63037 15.4591 8.64839C12.4321 10.6664 10.2699 10.6664 10.2699 10.6664M10.2699 34.4502V23.6394M10.2699 10.6664V23.6394M-6.16249 23.6394H10.2699M10.2699 23.6394H21.0807M38.8105 23.6394H21.0807M21.0807 23.6394V34.4502" stroke="white" stroke-width="2.30631"/>\n <rect x="2.34202" y="1.00901" width="29.982" height="29.982" rx="8.79279" stroke="white" stroke-width="2.01802"/>\n </g>\n <g clip-path="url(#clip0_24181_220540)">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M18.069 19.8621C19.4995 18.6902 22.171 16.0948 22.171 13.0548C22.171 11.7333 21.6461 10.466 20.7117 9.5316C19.7773 8.5972 18.51 8.07227 17.1885 8.07227C15.8671 8.07227 14.5998 8.5972 13.6654 9.5316C12.731 10.466 12.2061 11.7333 12.2061 13.0548C12.2061 16.0948 14.8776 18.6902 16.3081 19.8621C16.5553 20.0679 16.8669 20.1806 17.1885 20.1806C17.5102 20.1806 17.8218 20.0679 18.069 19.8621ZM17.1885 14.1618C17.517 14.1618 17.838 14.0644 18.1111 13.8819C18.3842 13.6995 18.597 13.4401 18.7227 13.1367C18.8484 12.8333 18.8812 12.4994 18.8172 12.1773C18.7531 11.8552 18.595 11.5593 18.3627 11.3271C18.1305 11.0948 17.8346 10.9367 17.5125 10.8726C17.1904 10.8085 16.8565 10.8414 16.5531 10.9671C16.2497 11.0928 15.9903 11.3056 15.8079 11.5787C15.6254 11.8518 15.528 12.1728 15.528 12.5012C15.528 12.9416 15.703 13.364 16.0144 13.6754C16.3258 13.9868 16.7481 14.1618 17.1885 14.1618Z" fill="#55575D"/>\n </g>\n </g>\n <defs>\n <filter id="filter0_d_24181_220540" x="-0.000325561" y="0" width="34.6667" height="34.6667" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">\n <feFlood flood-opacity="0" result="BackgroundImageFix"/>\n <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>\n <feOffset dy="1.33333"/>\n <feGaussianBlur stdDeviation="0.666667"/>\n <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.04 0"/>\n <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_24181_220540"/>\n <feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_24181_220540" result="shape"/>\n </filter>\n <clipPath id="clip0_24181_220540">\n <rect width="12.1081" height="12.1081" fill="white" transform="translate(11.1338 8.07227)"/>\n </clipPath>\n </defs>\n </svg>\n ',"aria-hidden":"true"}),i("div",{class:"s-bullet-delivery-address-content"},i("div",{class:"s-bullet-delivery-address-lines"},i("span",{class:"s-bullet-delivery-address-line1"},e),i("span",{class:"s-bullet-delivery-address-line2"},l))))}renderGuestDeliveryForm(){const t=y(this.selectedCountry?.code??"");return[this.renderCountrySelect(),t?this.renderRegionSelect():null,this.renderCityDistrictSelects()]}renderDeliveryTab(){return i("div",{class:{"s-bullet-delivery-content":!0,"s-bullet-delivery-content--active":"address"===this.activeTab,"s-hidden":"address"!==this.activeTab}},this.isLoggedIn?this.renderSavedAddresses():this.renderGuestDeliveryForm())}renderBranchSearch(){return i("div",{class:"s-bullet-delivery-branch-search"},i("div",{class:"s-bullet-delivery-search-row"},i("div",{class:"s-bullet-delivery-search s-bullet-delivery-branch-search-wrap"},i("span",{class:"s-bullet-delivery-search-icon s-bullet-delivery-branch-search-icon",innerHTML:h,"aria-hidden":"true"}),i("input",{type:"text",class:"s-bullet-delivery-branch-search-input form-input",placeholder:Salla.lang.get("pages.checkout.search_for_city_or_branch"),value:this.branchSearchQuery,onInput:t=>this.handleBranchSearch(t),autocomplete:"off"})),i("button",{type:"button",class:{"s-bullet-delivery-location-btn":!0,"s-bullet-delivery-location-btn--full":!0,"s-bullet-delivery-location-btn--loading":this.loadingNearestBranch},onClick:()=>this.handleFindNearestBranch(),disabled:this.loadingNearestBranch},this.loadingNearestBranch?i("span",{class:"s-bullet-delivery-location-icon","aria-hidden":"true"},i("salla-skeleton",{height:"18px",width:"18px"})):i("span",{class:"s-bullet-delivery-location-icon",innerHTML:'<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path\n d="M13.3258 7.65006C13.3258 10.7797 10.7888 13.3167 7.65916 13.3167C4.52955 13.3167 1.99249 10.7797 1.99249 7.65006C1.99249 4.52045 4.52955 1.9834 7.65916 1.9834C10.7888 1.9834 13.3258 4.52045 13.3258 7.65006Z"\n stroke="#555555" stroke-width="1.3" />\n <path d="M14.65 7.65039H13.3167" stroke="#555555" stroke-width="1.3" stroke-linecap="round"\n stroke-linejoin="round" />\n <path d="M1.98336 7.65039L0.650024 7.65039" stroke="#555555" stroke-width="1.3"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M7.65002 0.650065L7.65002 1.9834" stroke="#555555" stroke-width="1.3"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M7.65002 13.3171L7.65002 14.6504" stroke="#555555" stroke-width="1.3"\n stroke-linecap="round" stroke-linejoin="round" />\n <path\n d="M9.64999 7.65039C9.64999 8.75496 8.75456 9.65039 7.64999 9.65039C6.54542 9.65039 5.64999 8.75496 5.64999 7.65039C5.64999 6.54582 6.54542 5.65039 7.64999 5.65039C8.75456 5.65039 9.64999 6.54582 9.64999 7.65039Z"\n stroke="#555555" stroke-width="1.3" />\n</svg>\n ',"aria-hidden":"true"}),i("span",null,Salla.lang.get("pages.checkout.nearest_to_my_location")))),this.locationError&&"branch"===this.activeTab&&i("span",{class:"s-bullet-delivery-error"},this.locationError))}renderBranchList(){return this.loadingBranches?i("div",{class:"s-bullet-delivery-branches-wrap"},i("div",{class:"s-bullet-delivery-branches-loading"},[1,2,3,4].map((t=>i("div",{key:t,class:"s-bullet-delivery-branch-skeleton"},i("salla-skeleton",{class:"s-bullet-delivery-branch-skeleton-radio",type:"circle",height:"16px",width:"16px"}),i("div",{class:"s-bullet-delivery-branch-skeleton-icon"},i("salla-skeleton",{height:"34px",width:"34px"})),i("div",{class:"s-bullet-delivery-branch-skeleton-content"},i("salla-skeleton",{class:"s-bullet-delivery-branch-skeleton-title",height:"12px",width:"124px"})),i("salla-skeleton",{class:"s-bullet-delivery-branch-skeleton-time",height:"12px",width:"88px"}),i("div",{class:"s-bullet-delivery-branch-skeleton-map"},i("salla-skeleton",{height:"32px",width:"32px"}))))))):0===this.filteredBranches.length?i("salla-placeholder",{alignment:"center",class:"s-bullet-delivery-placeholder"},i("span",{slot:"title"},Salla.lang.get("pages.checkout.no_pickup_branches_found"))):i("div",{class:"s-bullet-delivery-branches-wrap"},i("ul",{class:"s-bullet-delivery-branches-list s-scrollbar"},this.filteredBranches.map((t=>i("li",{key:t.id,class:{"s-bullet-delivery-branch-item":!0,"s-bullet-delivery-branch-item--selected":this.selectedBranch?.id===t.id,"s-bullet-delivery-branch-item--disabled":!1===t.is_open},tabIndex:!1===t.is_open?-1:0,role:"option","aria-disabled":!1===t.is_open,onClick:()=>!1!==t.is_open&&this.handleBranchSelect(t),onKeyDown:s=>{"Enter"!==s.key&&" "!==s.key||(s.preventDefault(),!1!==t.is_open&&this.handleBranchSelect(t))}},i("input",{type:"radio",name:"branch",class:"s-bullet-delivery-radio",checked:this.selectedBranch?.id===t.id,disabled:!1===t.is_open}),i("span",{class:"s-bullet-delivery-branch-icon","aria-hidden":"true"},i("span",{innerHTML:T})),i("div",{class:"s-bullet-delivery-branch-info"},i("span",{class:"s-bullet-delivery-branch-name"},t.name),t.preparation_time?i("span",{class:"s-bullet-delivery-branch-prep"},`${Salla.lang.get("pages.checkout.processing_time")}: ${t.preparation_time}`):null),(()=>{const s=(e=t.working_hours,e?.[0]?.times?.[0]??null);var e;return s?i("span",{class:"s-bullet-delivery-branch-time"},function(t,s,i,e){const l=String(t).trim(),a=String(s).trim();return l&&a?"00:00"===l?`${e} ${_(a,i)}`:`${_(l,i)} - ${_(a,i)}`:""}(s.from,s.to,Salla.config.get("user.language_code")||"ar",Salla.lang.get("pages.checkout.until"))):null})(),null!=t.location?.lat&&null!=t.location?.lng&&i("a",{href:`https://www.google.com/maps?q=${t.location.lat},${t.location.lng}`,target:"_blank",rel:"noopener noreferrer",class:"s-bullet-delivery-branch-map-link",title:Salla.lang.get("common.elements.open_in_google_maps"),onClick:t=>t.stopPropagation()},i("span",{class:"s-bullet-delivery-branch-map-link-icon",innerHTML:'<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path\n d="M7.94798 3.19336C11.1309 2.1083 12.7223 1.56578 13.5783 2.42174C14.4342 3.27771 13.8917 4.86914 12.8066 8.05201L12.0678 10.2195C11.2344 12.6639 10.8178 13.8861 10.131 13.9872C9.94631 14.0144 9.75517 13.9981 9.57248 13.9394C8.89297 13.7212 8.53377 12.4326 7.81538 9.8553C7.65604 9.28364 7.57637 8.99781 7.39494 8.7795C7.34228 8.71614 7.28386 8.65772 7.2205 8.60506C7.00219 8.42363 6.71636 8.34396 6.1447 8.18462C3.56741 7.46623 2.27876 7.10703 2.0606 6.42752C2.00195 6.24483 1.98558 6.05369 2.01277 5.86903C2.11392 5.18221 3.33613 4.76556 5.78054 3.93225L7.94798 3.19336Z"\n stroke="#555555" stroke-width="1.2" />\n</svg>\n '.replace(/mask0_25437_34440/g,`mask0_branch_${t.id}`),"aria-hidden":"true"}),i("span",{class:"sr-only"},Salla.lang.get("common.elements.open_in_google_maps"))))))))}renderPickupTab(){return i("div",{class:{"s-bullet-delivery-content":!0,"s-bullet-delivery-content--active":"branch"===this.activeTab,"s-hidden":"branch"!==this.activeTab}},this.renderCountrySelect(),this.renderBranchSearch(),this.renderBranchList())}renderAddAddressForm(){const t=Salla.lang.get("pages.checkout.add_new_address"),s=y(this.selectedCountry?.code??""),e=this.selectedCountry&&this.selectedCity&&(!s||this.selectedRegion)&&(!s||!!this.selectedDistrict||!!(this.districtName&&this.districtName.trim().length>0)),l=this.savingAddress?Salla.lang.get("pages.checkout.loading"):Salla.lang.get("pages.checkout.confirm_address"),n=this.savedAddresses.length>0||D(this.getStoredIntent());return i("div",{class:"s-bullet-delivery-add-address"},i("div",{class:"s-bullet-delivery-add-address-header"},n?i("button",{type:"button",class:"s-bullet-delivery-add-address-title",onClick:()=>this.handleBackToAddressList(),onKeyDown:t=>"Enter"===t.key&&this.handleBackToAddressList()},i("span",{innerHTML:this.isRTL?a:r,"aria-hidden":"true"}),i("span",{class:"s-bullet-delivery-add-address-title-text"},t)):i("span",{class:"s-bullet-delivery-add-address-title"},i("span",{class:"s-bullet-delivery-add-address-title-text"},t))),i("form",{class:"s-bullet-delivery-add-address-form",onSubmit:t=>this.handleSubmitAddAddress(t)},this.renderGuestDeliveryForm(),i("div",{class:"s-bullet-delivery-form-actions s-bullet-delivery-form-actions--single"},i("salla-button",{type:"submit",loading:this.savingAddress,disabled:!e||this.savingAddress,class:"s-bullet-delivery-add-address-submit"},l))))}renderFooter(){const t="address"===this.activeTab&&this.isLoggedIn;return i("div",{class:"s-bullet-delivery-footer"},i("salla-button",{ref:t=>{this.confirmBtn=t},disabled:this.isConfirmDisabled(),onClick:()=>this.handleConfirm(),"loader-position":"center",width:"wide"},"branch"===this.activeTab?Salla.lang.get("pages.checkout.confirm_receipt_from_the_branch"):Salla.lang.get("pages.checkout.confirm_address")),t&&i("salla-button",{onClick:()=>this.handleAddNewAddress(),width:"wide",shape:"link"},Salla.lang.get("pages.checkout.add_new_address")),!this.isLoggedIn&&i("salla-button",{shape:"link",onClick:this.handleLogin},Salla.lang.get("pages.checkout.login_to_use_saved_addresses")))}renderMainView(){const t=this.isLoggedIn&&"address"===this.activeTab&&0===this.savedAddresses.length&&!D(this.getStoredIntent()),s="branch"===this.activeTab&&this.supportsPickup?this.renderPickupTab():this.renderDeliveryTab();return i("div",null,i("div",{class:"s-bullet-delivery-header"},i("h2",{class:"s-bullet-delivery-title"},"address"===this.activeTab?Salla.lang.get("blocks.home.add_address_for_order_delivery"):Salla.lang.get("blocks.home.how_prefer_to_receive_order")),i("p",{class:"s-bullet-delivery-subtitle"},"address"===this.activeTab?Salla.lang.get("blocks.home.products_available_for_delivery_shown_while_shopping"):Salla.lang.get("blocks.home.products_available_for_delivery_or_pickup_shown_while_shopping"))),this.renderTabs(),this.showCartWillBeClearedBanner&&this.renderAlert(Salla.lang.get("blocks.scope.empty_cart_warning")),this.allocationOutOfCoverageMessage&&this.renderAllocationOutOfCoverageAlert(),s,!t&&this.renderFooter())}handleAfterAddToCart(){if("after_add_to_cart"!==this.openingType)return;const t=this.shouldPromptIncompleteIntentThisSession();this.hasBeenShownThisSession()&&!t||this.modal?.hasAttribute?.("visible")||(t&&this.markIncompleteIntentPrompted(),this.open())}overrideScopeSwitchUI(){const t=this.getStoredIntent(),s=document.querySelector('[onclick*="scopes"]');if(!s)return;if(!t||"address"!==t.type&&"branch"!==t.type)return s.style.display="none",void(s.onclick=()=>this.open());const i=(t,s)=>t&&t.length>s?`${t.slice(0,s)}...`:t??"",e="branch"===t.type?`${Salla.lang.get("mobile_app.strings.pickup")} ${Salla.lang.get("common.elements.from")} ${i(t.branch_details?.name,20)}`:`${Salla.lang.get("mobile_app.strings.delivery")} ${Salla.lang.get("common.elements.to")} ${i(t.address_details?.city?.name,10)}`;s.style.display="inline-flex",s.onclick=()=>this.open();const l=s.querySelector('span:not([class*="sicon"]):not([class*="icon"])');if(l)l.textContent=e;else{const t=Array.from(s.childNodes).find((t=>t.nodeType===Node.TEXT_NODE&&t.textContent?.trim()));t&&(t.textContent=` ${e}`)}}async componentWillLoad(){await Salla.onReady();try{this.overrideScopeSwitchUI(),this.cartSubmittingHandler=async()=>{this.pendingCartSubmitPromise?await this.pendingCartSubmitPromise:this.hasCompleteIntentForLoggedInUser()||(this.cartSubmitConfirmationPending=!0,this.pendingCartSubmitPromise=new Promise((t=>{if(this.pendingCartSubmitResolver=t,this.isGuestUser())return Salla.auth.setCanRedirect(!1),void Salla.event.dispatch("login::open",{withoutReload:!0,source:"cart-submit"});this.open()})),await this.pendingCartSubmitPromise)},Salla.cart.event.onSubmitting(this.cartSubmittingHandler)}catch(t){console.warn("SallaBulletDelivery: overrideScopeSwitchUI failed",t)}Salla.event.on("salla::bullet-delivery.modal.open.requested",this.bulletDeliveryOpenHandler),this.closeHandler=this.close.bind(this),Salla.event.on("salla::bullet-delivery.modal.close.requested",this.closeHandler),this.isRTL=Salla.config.get("theme.is_rtl"),this.authLoggedInHandler=()=>{if(this.cartSubmitConfirmationPending)return Salla.event.dispatch("login::close"),this.hasCompleteIntentForLoggedInUser()?void this.resolvePendingCartSubmit():void(this.modal?.hasAttribute?.("visible")||this.open());this.hasIncompleteUserAddressIntent()&&(this.modal?.hasAttribute?.("visible")||this.open())},Salla.event.on("auth::logged.in",this.authLoggedInHandler),this.authLoggedOutHandler=()=>{this.clearBulletDeliveryStoredData()},Salla.event.on("auth::logged.out",this.authLoggedOutHandler),this.loginClosedHandler=()=>{this.cartSubmitConfirmationPending&&this.isGuestUser()&&(this.hasCompleteIntentForLoggedInUser()||this.resolvePendingCartSubmit())},Salla.event.on("salla-login::closed",this.loginClosedHandler),this.cartItemAddedHandler=()=>this.handleAfterAddToCart(),"function"==typeof Salla.cart?.event?.onItemAdded?(this.useCartEventApi=!0,Salla.cart.event.onItemAdded(this.cartItemAddedHandler)):Salla.event.on(this.cartItemAddedEvent,this.cartItemAddedHandler)}render(){return this.isMobileApp?null:i(e,{class:"s-bullet-delivery"},i("salla-modal",{ref:t=>{this.modal=t},isClosable:!this.isRequired&&!this.shouldForceNonClosable(),class:"s-bullet-delivery-modal",width:"sm"},i("div",{class:"s-bullet-delivery-inner"},"main"===this.viewMode&&this.renderMainView(),"add-address"===this.viewMode&&this.renderAddAddressForm())))}componentDidLoad(){if(this.componentReady=!0,this.isMobileApp)return this.hasBeenShownThisSession()||Salla.event.dispatch("salla::bullet-delivery.open-sheet"),this.bulletDeliveryMobileSelectHandler=t=>{const s=this.extractMobileSelectPayload(t);s?this.applyMobileBulletDeliverySelection(s):console.warn("SallaBulletDelivery: received empty mobile select payload",t)},void Salla.event.on("salla::bullet-delivery.select",this.bulletDeliveryMobileSelectHandler);if(this.pendingOpen)return this.pendingOpen=!1,void this.open();switch(this.openingType){case"first_visit":this.hasBeenShownThisSession()?this.shouldPromptIncompleteIntentThisSession()&&(this.markIncompleteIntentPrompted(),this.open()):this.open();break;case"on_cart_click":Salla.url.is_page("cart")&&(!0===this.getShownStorage().get(this.sessionShownKey)?this.shouldPromptIncompleteIntentThisSession()&&(this.markIncompleteIntentPrompted(),this.open()):this.open())}const t=this.createCartViewElement();t&&"function"==typeof salla?.hooks?.mount&&Salla.hooks.mount("cart:items.start",t).catch((()=>{}))}disconnectedCallback(){this.componentReady=!1,Salla.event.off("salla::bullet-delivery.modal.open.requested",this.bulletDeliveryOpenHandler),this.closeHandler&&(Salla.event.off("salla::bullet-delivery.modal.close.requested",this.closeHandler),this.closeHandler=null),this.cartItemAddedHandler&&(this.useCartEventApi&&"function"==typeof Salla.cart?.event?.offItemAdded?Salla.cart.event.offItemAdded(this.cartItemAddedHandler):Salla.event.off(this.cartItemAddedEvent,this.cartItemAddedHandler),this.cartItemAddedHandler=null),this.cartSubmittingHandler&&("function"==typeof Salla.cart?.event?.offSubmitting?Salla.cart.event.offSubmitting(this.cartSubmittingHandler):Salla.event.off("cart::submitting",this.cartSubmittingHandler),this.cartSubmittingHandler=null),this.authLoggedInHandler&&(Salla.event.off("auth::logged.in",this.authLoggedInHandler),this.authLoggedInHandler=null),this.authLoggedOutHandler&&(Salla.event.off("auth::logged.out",this.authLoggedOutHandler),this.authLoggedOutHandler=null),this.loginClosedHandler&&(Salla.event.off("salla-login::closed",this.loginClosedHandler),this.loginClosedHandler=null),this.bulletDeliveryMobileSelectHandler&&(Salla.event.off("salla::bullet-delivery.select",this.bulletDeliveryMobileSelectHandler),this.bulletDeliveryMobileSelectHandler=null)}};P.INITIAL_ADDRESS_FORM={country_id:0,is_default:!1,city_id:void 0,district_id:void 0,street:void 0,building_number:void 0,additional_number:void 0,postal_code:void 0,description:void 0},P.DROPDOWN_SEARCH_DEBOUNCE_MS=400,P.DROPDOWN_SEARCH_MIN_CHARS=2,P.style="@supports (interpolate-size: allow-keywords) and (block-size: calc-size(auto, size)) {\n .s-bullet-delivery .s-bullet-delivery-modal .s-modal-body, .s-bullet-delivery-inner {\n @apply [interpolate-size:allow-keywords];\n }\n .s-bullet-delivery .s-bullet-delivery-modal .s-modal-body {\n @apply [overflow:clip] [transition:block-size_500ms_ease];\n }\n .s-bullet-delivery-inner {\n @apply [overflow:clip] [transition:block-size_500ms_ease];\n block-size: calc-size(auto, size);\n }\n}\n\n/* Allow searchable dropdown popover to paint outside the modal body */\n.s-bullet-delivery .s-bullet-delivery-modal .s-modal-body:has(.s-searchable-dropdown--open) {\n overflow: visible !important;\n}\n\n@keyframes s-bullet-delivery-fade-in {\n from {\n opacity: 0;\n transform: translateY(6px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}";const F=class{constructor(i){t(this,i),this.itemSelected=s(this,"itemSelected"),this.searchInput=s(this,"searchInput"),this.dropdownOpened=s(this,"dropdownOpened"),this.dropdownClosed=s(this,"dropdownClosed"),this.placeholder="",this.items=[],this.selectedItem=null,this.loading=!1,this.searching=!1,this.disabled=!1,this.required=!1,this.noResultsText="",this.inputId="",this.searchQuery="",this.clientSearch=!1,this.dropUp=!1,this.searchable=!0,this.keepParentScroll=!1,this.isOpen=!1,this.focusedIndex=-1,this.clientSearchQuery="",this.scrollableAncestor=null,this.handleTriggerClick=()=>{this.isOpen?this.close():this.open()},this.handleTriggerKeyDown=t=>{this.isOpen?this.navigateItems(t):"Enter"===t.key||" "===t.key||"ArrowDown"===t.key?(t.preventDefault(),this.open()):"Escape"===t.key&&this.close()},this.handleSearchInputChange=t=>{const s=t.target.value;this.clientSearch&&(this.clientSearchQuery=s),this.searchInput.emit(s),this.focusedIndex=-1},this.handleSearchKeyDown=t=>{this.navigateItems(t)}}connectedCallback(){this.boundHandleClickOutside=this.handleClickOutside.bind(this),document.addEventListener("mousedown",this.boundHandleClickOutside)}disconnectedCallback(){document.removeEventListener("mousedown",this.boundHandleClickOutside),this.scrollableAncestor&&(this.scrollableAncestor.style.overflow="",this.scrollableAncestor=null)}onItemsChange(){this.focusedIndex=-1}normalizeArabic(t){return t.replace(/[أإآا]/g,"ا")}get filteredItems(){if(!this.clientSearch||!this.clientSearchQuery.trim())return this.items;const t=this.normalizeArabic(this.clientSearchQuery.trim().toLowerCase());return this.items.filter((s=>{const i=this.normalizeArabic(s.name.toLowerCase()),e=s.name_en?s.name_en.toLowerCase():"";return i.includes(t)||e.includes(t)}))}getDisplayName(t){const s=salla?.config?.get("user.language_code");return s&&"ar"!==s&&t.name_en?.trim()?t.name_en.trim():t.name}handleClickOutside(t){this.isOpen&&(this.host.contains(t.target)||this.close())}findScrollableAncestor(){let t=this.host.parentElement;for(;t;){const s=getComputedStyle(t),i=s.overflowY;if("auto"===i||"scroll"===i||"hidden"===i||"clip"===s.overflow)return t;t=t.parentElement}return null}open(){this.disabled||this.loading||(this.isOpen=!0,this.focusedIndex=-1,this.keepParentScroll||(this.scrollableAncestor=this.findScrollableAncestor(),this.scrollableAncestor&&(this.scrollableAncestor.style.overflow="visible")),this.dropdownOpened.emit(),requestAnimationFrame((()=>this.searchInputRef?.focus())))}close(){this.isOpen&&(this.isOpen=!1,this.focusedIndex=-1,this.clientSearchQuery="",this.scrollableAncestor&&(this.scrollableAncestor.style.overflow="",this.scrollableAncestor=null),this.dropdownClosed.emit())}navigateItems(t){const s=this.filteredItems,i=s.length;switch(t.key){case"ArrowDown":t.preventDefault(),this.focusedIndex=i>0?(this.focusedIndex+1)%i:-1,this.scrollFocusedIntoView();break;case"ArrowUp":t.preventDefault(),this.focusedIndex=i>0?(this.focusedIndex-1+i)%i:-1,this.scrollFocusedIntoView();break;case"Enter":t.preventDefault(),this.focusedIndex>=0&&this.focusedIndex<i&&this.selectItem(s[this.focusedIndex]);break;case"Escape":t.preventDefault(),this.close()}}scrollFocusedIntoView(){this.focusedIndex<0||requestAnimationFrame((()=>{const t=this.panelRef?.querySelector(".s-searchable-dropdown-list"),s=t?.children[this.focusedIndex];s?.scrollIntoView({block:"nearest"})}))}selectItem(t){this.itemSelected.emit(t),this.close()}render(){const t=null!=this.selectedItem,s=`${this.inputId}-listbox`;return i(e,{key:"c529f2b61adbc38aa1e5403da6fdb985fe256baa",class:"s-searchable-dropdown"},i("div",{key:"88ab96afd36421fdf965b79298fa14f435adbcef",class:{"s-searchable-dropdown":!0,"s-searchable-dropdown--open":this.isOpen}},this.label&&i("label",{key:"6ee8a2d0428e1347e36eabec32a3129897481abc",class:"s-searchable-dropdown-label",htmlFor:this.inputId},this.label,this.required&&i("span",{key:"8473884ec18e73c72c79e7749264bd9c24c56ae9",class:"s-searchable-dropdown-required"}," *")),i("div",{key:"bffbea7ff0cb9466c8a852a841a21ed8351ef92d",class:{"s-searchable-dropdown-trigger":!0,"s-searchable-dropdown-trigger--disabled":this.disabled||this.loading,"s-searchable-dropdown-trigger--open":this.isOpen},role:"combobox","aria-expanded":this.isOpen?"true":"false","aria-haspopup":"listbox","aria-controls":s,"aria-disabled":this.disabled||this.loading?"true":"false",tabIndex:this.disabled||this.loading?-1:0,onClick:this.handleTriggerClick,onKeyDown:this.handleTriggerKeyDown},t?i("span",{class:"s-searchable-dropdown-trigger-text"},this.getDisplayName(this.selectedItem)):i("span",{class:"s-searchable-dropdown-trigger-placeholder"},this.placeholder),i("i",{key:"e3aee1ffe1b80a9ef21f4c9cca02de0a590b0825",class:{"sicon-keyboard_arrow_down":!0,"s-searchable-dropdown-trigger-icon":!0,"s-searchable-dropdown-trigger-icon--open":this.isOpen},"aria-hidden":"true"})),this.isOpen&&i("div",{key:"7a19f2d6847b3e0dda5e0ea509df91a2f48fa098",class:{"s-searchable-dropdown-panel":!0,"s-searchable-dropdown-panel--up":this.dropUp},ref:t=>this.panelRef=t},this.searchable&&i("div",{key:"601529f76a09762a57fe7b7663ecfa1505462367",class:"s-searchable-dropdown-search-wrap"},i("i",{key:"f91e464e7efed3759837880b5a7593daa4f84ecb",class:"sicon-search s-searchable-dropdown-search-icon","aria-hidden":"true"}),i("input",{key:"f72a7e12d0a6e90bab3983258c9b08aa286bc897",ref:t=>this.searchInputRef=t,id:this.inputId,type:"text",class:"s-searchable-dropdown-search-input",placeholder:this.placeholder,value:this.clientSearch?this.clientSearchQuery:this.searchQuery,onInput:this.handleSearchInputChange,onKeyDown:this.handleSearchKeyDown,autocomplete:"off","aria-autocomplete":"list","aria-expanded":this.isOpen?"true":"false","aria-controls":s})),i("div",{key:"495aa88fc76d3d17956db7277cc98aff08b4c1af",id:s,class:"s-searchable-dropdown-list s-scrollbar",role:"listbox"},this.renderListContent()))))}renderListContent(){if(this.searching||this.loading)return i("div",{class:"s-searchable-dropdown-loading"},i("svg",{class:"s-searchable-dropdown-spinner",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"3","stroke-linecap":"round",opacity:"0.25"}),i("path",{d:"M12 2a10 10 0 0 1 10 10",stroke:"currentColor","stroke-width":"3","stroke-linecap":"round"})));const t=this.filteredItems;return 0===t.length?i("div",{class:"s-searchable-dropdown-empty"},this.noResultsText||salla?.lang?.get("common.elements.no_options")||"No results found"):t.map(((t,s)=>{const e=this.selectedItem?.id===t.id;return i("button",{key:t.id,type:"button",role:"option",class:{"s-searchable-dropdown-item":!0,"s-searchable-dropdown-item--selected":e,"s-searchable-dropdown-item--focused":this.focusedIndex===s&&!e},"aria-selected":e?"true":"false",onClick:()=>this.selectItem(t)},i("span",{class:{"s-searchable-dropdown-item-name":!0,"s-searchable-dropdown-item-name--selected":e}},this.getDisplayName(t)),e&&i("i",{class:"sicon-check s-searchable-dropdown-item-check","aria-hidden":"true"}))}))}get host(){return l(this)}static get watchers(){return{items:["onItemsChange"]}}};export{P as salla_bullet_delivery,F as salla_searchable_dropdown}