@salla.sa/twilight-components 2.14.450 → 2.14.452

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 (323) hide show
  1. package/dist/cjs/{filepond-u7zONIpU.js → filepond-CUDa4yzK.js} +1 -1
  2. package/dist/cjs/{filepond-plugin-file-poster-DPE2-7A4.js → filepond-plugin-file-poster-ZBZ4eV18.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-validate-size-QFJIY-td.js → filepond-plugin-file-validate-size-MuHAoRee.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-type-CqUNeom7.js → filepond-plugin-file-validate-type-YJnozwws.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-image-edit-B2Z3rRkn.js → filepond-plugin-image-edit-DoGvWbfA.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-exif-orientation-DxoN6Z-R.js → filepond-plugin-image-exif-orientation-DHT3msJG.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-preview-doqEZlz_.js → filepond-plugin-image-preview-Cilr0qGC.js} +1 -1
  8. package/dist/cjs/{functions-CZozSu7O.js → functions-BD36RfEv.js} +1 -1
  9. package/dist/cjs/{index-CCSZWnkr.js → index-B3yg95Y_.js} +1 -1
  10. package/dist/cjs/{index-tPF0UB3W.js → index-D-llXlYu.js} +12 -7
  11. package/dist/cjs/index.esm-DOwgk2YK.js +2444 -0
  12. package/dist/cjs/loader.cjs.js +2 -2
  13. package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
  14. package/dist/cjs/salla-accordion_6.cjs.entry.js +1 -1
  15. package/dist/cjs/salla-add-product-button_5.cjs.entry.js +1 -1
  16. package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
  17. package/dist/cjs/salla-alert_2.cjs.entry.js +21 -17
  18. package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
  19. package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
  20. package/dist/cjs/salla-badge.cjs.entry.js +1 -1
  21. package/dist/cjs/salla-booking-field_7.cjs.entry.js +10 -10
  22. package/dist/cjs/salla-bullet-delivery_2.cjs.entry.js +4611 -24
  23. package/dist/cjs/salla-cart-coupons.cjs.entry.js +1 -1
  24. package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
  25. package/dist/cjs/salla-cashback-banner.cjs.entry.js +1 -1
  26. package/dist/cjs/salla-comment-form_8.cjs.entry.js +1 -1
  27. package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
  28. package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
  29. package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
  30. package/dist/cjs/salla-count-down.cjs.entry.js +1 -1
  31. package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
  32. package/dist/cjs/salla-delivery-promise.cjs.entry.js +1 -1
  33. package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
  34. package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
  35. package/dist/cjs/salla-filters.cjs.entry.js +1 -1
  36. package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
  37. package/dist/cjs/salla-gifting.cjs.entry.js +1 -1
  38. package/dist/cjs/salla-hook.cjs.entry.js +1 -1
  39. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +1 -1
  40. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  41. package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
  42. package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
  43. package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
  44. package/dist/cjs/salla-loyalty-banner.cjs.entry.js +2 -2
  45. package/dist/cjs/salla-loyalty-hero_2.cjs.entry.js +2 -2
  46. package/dist/cjs/salla-loyalty-panel.cjs.entry.js +3 -3
  47. package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
  48. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
  49. package/dist/cjs/salla-loyalty-program.cjs.entry.js +3 -3
  50. package/dist/cjs/salla-loyalty-reward.cjs.entry.js +2 -2
  51. package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
  52. package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
  53. package/dist/cjs/salla-map.cjs.entry.js +1 -1
  54. package/dist/cjs/salla-menu.cjs.entry.js +1 -1
  55. package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
  56. package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
  57. package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
  58. package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
  59. package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
  60. package/dist/cjs/salla-notification-item.cjs.entry.js +1 -1
  61. package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
  62. package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
  63. package/dist/cjs/salla-offer.cjs.entry.js +1 -1
  64. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
  65. package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
  66. package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
  67. package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
  68. package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
  69. package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
  70. package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
  71. package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
  72. package/dist/cjs/salla-orders.cjs.entry.js +1 -1
  73. package/dist/cjs/salla-payments.cjs.entry.js +1 -1
  74. package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
  75. package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
  76. package/dist/cjs/salla-product-card-embed.cjs.entry.js +1 -1
  77. package/dist/cjs/salla-product-card_2.cjs.entry.js +1 -1
  78. package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
  79. package/dist/cjs/salla-products-list.cjs.entry.js +1 -1
  80. package/dist/cjs/salla-progress-bar.cjs.entry.js +1 -1
  81. package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
  82. package/dist/cjs/salla-rating-modal.cjs.entry.js +1 -1
  83. package/dist/cjs/salla-reward-action_4.cjs.entry.js +3 -3
  84. package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
  85. package/dist/cjs/salla-search.cjs.entry.js +1 -1
  86. package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
  87. package/dist/cjs/salla-slider.cjs.entry.js +1 -1
  88. package/dist/cjs/salla-social-share.cjs.entry.js +1 -1
  89. package/dist/cjs/salla-social.cjs.entry.js +1 -1
  90. package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
  91. package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
  92. package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
  93. package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
  94. package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
  95. package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
  96. package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
  97. package/dist/cjs/salla-verify.cjs.entry.js +1 -1
  98. package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
  99. package/dist/cjs/{tracked-promise-DVCwmpuo.js → tracked-promise-XWqMedEM.js} +1 -1
  100. package/dist/cjs/twilight.cjs.js +2 -2
  101. package/dist/cjs/{vanilla-picker-DQ8iQ9l5.js → vanilla-picker-DuVcVt-y.js} +1 -1
  102. package/dist/collection/assets/svg/location-tag.svg +10 -0
  103. package/dist/collection/components/salla-bottom-alert/salla-bottom-alert.js +20 -16
  104. package/dist/collection/components/salla-bullet-delivery/api-service.js +6 -0
  105. package/dist/collection/components/salla-bullet-delivery/helpers.js +3 -1
  106. package/dist/collection/components/salla-bullet-delivery/salla-bullet-delivery.css +128 -0
  107. package/dist/collection/components/salla-bullet-delivery/salla-bullet-delivery.js +195 -20
  108. package/dist/components/index.esm.js +2424 -0
  109. package/dist/components/index.js +8 -3
  110. package/dist/components/salla-bottom-alert.js +20 -16
  111. package/dist/components/salla-bullet-delivery.js +4644 -51
  112. package/dist/esm/{filepond-N1L04Plt.js → filepond-B8YVLlGK.js} +1 -1
  113. package/dist/esm/{filepond-plugin-file-poster-2E1WZVzP.js → filepond-plugin-file-poster-BVHkBLq8.js} +1 -1
  114. package/dist/esm/{filepond-plugin-file-validate-size-C0LhcfOR.js → filepond-plugin-file-validate-size-Cq7xe76f.js} +1 -1
  115. package/dist/esm/{filepond-plugin-file-validate-type-Be8IgUh8.js → filepond-plugin-file-validate-type-CTsg2jzF.js} +1 -1
  116. package/dist/esm/{filepond-plugin-image-edit-CFFuq7E_.js → filepond-plugin-image-edit-B_lgP65N.js} +1 -1
  117. package/dist/esm/{filepond-plugin-image-exif-orientation-DPCeA1B5.js → filepond-plugin-image-exif-orientation-CiQmLZE0.js} +1 -1
  118. package/dist/esm/{filepond-plugin-image-preview-CEvNq5JJ.js → filepond-plugin-image-preview-DEDwRroB.js} +1 -1
  119. package/dist/esm/{functions-Ba6VuRnB.js → functions-BTVjvurG.js} +1 -1
  120. package/dist/esm/{index-CrNw20pf.js → index-Dimo1ZpU.js} +12 -7
  121. package/dist/esm/{index-IqFJsnTE.js → index-iyZKRGHO.js} +1 -1
  122. package/dist/esm/index.esm-BkPzCq-C.js +2424 -0
  123. package/dist/esm/loader.js +3 -3
  124. package/dist/esm/salla-accordion-body_2.entry.js +1 -1
  125. package/dist/esm/salla-accordion_6.entry.js +1 -1
  126. package/dist/esm/salla-add-product-button_5.entry.js +1 -1
  127. package/dist/esm/salla-advertisement.entry.js +1 -1
  128. package/dist/esm/salla-alert_2.entry.js +21 -17
  129. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  130. package/dist/esm/salla-apps-icons.entry.js +1 -1
  131. package/dist/esm/salla-badge.entry.js +1 -1
  132. package/dist/esm/salla-booking-field_7.entry.js +10 -10
  133. package/dist/esm/salla-bullet-delivery_2.entry.js +4646 -59
  134. package/dist/esm/salla-cart-coupons.entry.js +1 -1
  135. package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
  136. package/dist/esm/salla-cashback-banner.entry.js +1 -1
  137. package/dist/esm/salla-comment-form_8.entry.js +1 -1
  138. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  139. package/dist/esm/salla-contacts.entry.js +1 -1
  140. package/dist/esm/salla-cookies-bar.entry.js +1 -1
  141. package/dist/esm/salla-count-down.entry.js +1 -1
  142. package/dist/esm/salla-custom-fields.entry.js +1 -1
  143. package/dist/esm/salla-delivery-promise.entry.js +1 -1
  144. package/dist/esm/salla-edit-order-button.entry.js +1 -1
  145. package/dist/esm/salla-filters-widget.entry.js +1 -1
  146. package/dist/esm/salla-filters.entry.js +1 -1
  147. package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
  148. package/dist/esm/salla-gifting.entry.js +1 -1
  149. package/dist/esm/salla-hook.entry.js +1 -1
  150. package/dist/esm/salla-infinite-scroll.entry.js +1 -1
  151. package/dist/esm/salla-installment.entry.js +1 -1
  152. package/dist/esm/salla-list-tile.entry.js +1 -1
  153. package/dist/esm/salla-localization-modal.entry.js +1 -1
  154. package/dist/esm/salla-login-modal.entry.js +1 -1
  155. package/dist/esm/salla-loyalty-banner.entry.js +2 -2
  156. package/dist/esm/salla-loyalty-hero_2.entry.js +2 -2
  157. package/dist/esm/salla-loyalty-panel.entry.js +3 -3
  158. package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
  159. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  160. package/dist/esm/salla-loyalty-program.entry.js +3 -3
  161. package/dist/esm/salla-loyalty-reward.entry.js +2 -2
  162. package/dist/esm/salla-loyalty.entry.js +1 -1
  163. package/dist/esm/salla-maintenance-alert.entry.js +1 -1
  164. package/dist/esm/salla-map.entry.js +1 -1
  165. package/dist/esm/salla-menu.entry.js +1 -1
  166. package/dist/esm/salla-metadata.entry.js +1 -1
  167. package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
  168. package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
  169. package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
  170. package/dist/esm/salla-next-order-coupon.entry.js +1 -1
  171. package/dist/esm/salla-notification-item.entry.js +1 -1
  172. package/dist/esm/salla-notifications.entry.js +1 -1
  173. package/dist/esm/salla-offer-modal.entry.js +1 -1
  174. package/dist/esm/salla-offer.entry.js +1 -1
  175. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
  176. package/dist/esm/salla-order-details-options.entry.js +1 -1
  177. package/dist/esm/salla-order-details.entry.js +1 -1
  178. package/dist/esm/salla-order-edit-item.entry.js +1 -1
  179. package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
  180. package/dist/esm/salla-order-edit.entry.js +1 -1
  181. package/dist/esm/salla-order-summary.entry.js +1 -1
  182. package/dist/esm/salla-order-totals-card.entry.js +1 -1
  183. package/dist/esm/salla-orders.entry.js +1 -1
  184. package/dist/esm/salla-payments.entry.js +1 -1
  185. package/dist/esm/salla-placeholder.entry.js +1 -1
  186. package/dist/esm/salla-price-range.entry.js +1 -1
  187. package/dist/esm/salla-product-card-embed.entry.js +1 -1
  188. package/dist/esm/salla-product-card_2.entry.js +1 -1
  189. package/dist/esm/salla-product-size-guide.entry.js +1 -1
  190. package/dist/esm/salla-products-list.entry.js +1 -1
  191. package/dist/esm/salla-progress-bar.entry.js +1 -1
  192. package/dist/esm/salla-quick-order.entry.js +1 -1
  193. package/dist/esm/salla-rating-modal.entry.js +1 -1
  194. package/dist/esm/salla-reward-action_4.entry.js +3 -3
  195. package/dist/esm/salla-scopes.entry.js +1 -1
  196. package/dist/esm/salla-search.entry.js +1 -1
  197. package/dist/esm/salla-skeleton.entry.js +1 -1
  198. package/dist/esm/salla-slider.entry.js +1 -1
  199. package/dist/esm/salla-social-share.entry.js +1 -1
  200. package/dist/esm/salla-social.entry.js +1 -1
  201. package/dist/esm/salla-tab-content_3.entry.js +1 -1
  202. package/dist/esm/salla-tiered-offer.entry.js +1 -1
  203. package/dist/esm/salla-tooltip.entry.js +1 -1
  204. package/dist/esm/salla-trust-badges.entry.js +1 -1
  205. package/dist/esm/salla-user-menu.entry.js +1 -1
  206. package/dist/esm/salla-user-profile.entry.js +1 -1
  207. package/dist/esm/salla-user-settings.entry.js +1 -1
  208. package/dist/esm/salla-verify.entry.js +1 -1
  209. package/dist/esm/salla-wallet.entry.js +1 -1
  210. package/dist/esm/{tracked-promise-DH7_DYgQ.js → tracked-promise-CvY0ZPlq.js} +1 -1
  211. package/dist/esm/twilight.js +3 -3
  212. package/dist/esm/{vanilla-picker-NvsTGeIC.js → vanilla-picker-DR-rCO7V.js} +1 -1
  213. package/dist/twilight/{p-446bfa5f.entry.js → p-02189879.entry.js} +1 -1
  214. package/dist/twilight/{p-5c07ab28.entry.js → p-023b2fdd.entry.js} +1 -1
  215. package/dist/twilight/{p-1633e09a.entry.js → p-02abc240.entry.js} +1 -1
  216. package/dist/twilight/{p-c42fd7ea.entry.js → p-06ba7dd1.entry.js} +1 -1
  217. package/dist/twilight/{p-120ca46f.entry.js → p-0d1154bf.entry.js} +1 -1
  218. package/dist/twilight/{p-6ffe65f2.entry.js → p-0f6b0f92.entry.js} +1 -1
  219. package/dist/twilight/{p-f83a4131.entry.js → p-16339bf0.entry.js} +1 -1
  220. package/dist/twilight/{p-c8ad8625.entry.js → p-17b94783.entry.js} +1 -1
  221. package/dist/twilight/p-1af6d934.entry.js +4 -0
  222. package/dist/twilight/{p-f47cd970.entry.js → p-1b859261.entry.js} +1 -1
  223. package/dist/twilight/{p-3d7d52b9.entry.js → p-1e2f547d.entry.js} +1 -1
  224. package/dist/twilight/{p-3649da70.entry.js → p-206e6265.entry.js} +1 -1
  225. package/dist/twilight/{p-e034fe03.entry.js → p-266aa19a.entry.js} +1 -1
  226. package/dist/twilight/{p-00a2d304.entry.js → p-2b1d0041.entry.js} +1 -1
  227. package/dist/twilight/{p-ff148d38.entry.js → p-3e541136.entry.js} +1 -1
  228. package/dist/twilight/{p-5395aed1.entry.js → p-41db9b1a.entry.js} +1 -1
  229. package/dist/twilight/{p-46301bdd.entry.js → p-43a4763b.entry.js} +1 -1
  230. package/dist/twilight/{p-1726199f.entry.js → p-4523e5c0.entry.js} +1 -1
  231. package/dist/twilight/{p-77c69000.entry.js → p-453e432c.entry.js} +1 -1
  232. package/dist/twilight/{p-f011898b.entry.js → p-46039e28.entry.js} +1 -1
  233. package/dist/twilight/p-48da0c37.entry.js +1019 -0
  234. package/dist/twilight/p-4901594b.entry.js +4 -0
  235. package/dist/twilight/{p-eec8f211.entry.js → p-4a242b08.entry.js} +1 -1
  236. package/dist/twilight/{p-ba68d83b.entry.js → p-4d6914e5.entry.js} +1 -1
  237. package/dist/twilight/{p-bd790b16.entry.js → p-4e90d0fb.entry.js} +1 -1
  238. package/dist/twilight/{p-942e5b3e.entry.js → p-5088b883.entry.js} +1 -1
  239. package/dist/twilight/{p-a22fd70d.entry.js → p-5d44c12a.entry.js} +1 -1
  240. package/dist/twilight/{p-4896533c.entry.js → p-60b9640d.entry.js} +1 -1
  241. package/dist/twilight/{p-cf3d3103.entry.js → p-615626cd.entry.js} +1 -1
  242. package/dist/twilight/{p-a68644af.entry.js → p-6342b0a5.entry.js} +1 -1
  243. package/dist/twilight/{p-9b225829.entry.js → p-63c68634.entry.js} +1 -1
  244. package/dist/twilight/{p-82fdf4e7.entry.js → p-63e74f12.entry.js} +1 -1
  245. package/dist/twilight/{p-7988b7a5.entry.js → p-642345d6.entry.js} +1 -1
  246. package/dist/twilight/{p-771ca405.entry.js → p-653b4634.entry.js} +1 -1
  247. package/dist/twilight/{p-5e4a9088.entry.js → p-6802c454.entry.js} +1 -1
  248. package/dist/twilight/{p-c5e14a6d.entry.js → p-6b1aeef4.entry.js} +1 -1
  249. package/dist/twilight/{p-4818c549.entry.js → p-6bc83d28.entry.js} +1 -1
  250. package/dist/twilight/{p-9d9da993.entry.js → p-6eb716e9.entry.js} +1 -1
  251. package/dist/twilight/{p-83b70db5.entry.js → p-74bb0829.entry.js} +1 -1
  252. package/dist/twilight/{p-bac02561.entry.js → p-75f69c89.entry.js} +1 -1
  253. package/dist/twilight/{p-4b9070f7.entry.js → p-7edf9c5f.entry.js} +1 -1
  254. package/dist/twilight/{p-c1ab6774.entry.js → p-7f07b3db.entry.js} +1 -1
  255. package/dist/twilight/{p-1fe09ed1.entry.js → p-81288fd1.entry.js} +1 -1
  256. package/dist/twilight/{p-57a86efd.entry.js → p-81741aef.entry.js} +1 -1
  257. package/dist/twilight/{p-eff611b9.entry.js → p-884a8742.entry.js} +1 -1
  258. package/dist/twilight/{p-bf7f213d.entry.js → p-8eb1ea0f.entry.js} +1 -1
  259. package/dist/twilight/{p-2774b070.entry.js → p-8f197b19.entry.js} +1 -1
  260. package/dist/twilight/{p-033c9e98.entry.js → p-8f93bae7.entry.js} +1 -1
  261. package/dist/twilight/{p-f7376365.entry.js → p-8f9cf7be.entry.js} +1 -1
  262. package/dist/twilight/{p-7f99f835.entry.js → p-90933152.entry.js} +1 -1
  263. package/dist/twilight/{p-fc540bfc.entry.js → p-9612e6b1.entry.js} +1 -1
  264. package/dist/twilight/{p-b9922101.entry.js → p-965ca629.entry.js} +1 -1
  265. package/dist/twilight/p-98a1855a.entry.js +4 -0
  266. package/dist/twilight/{p-40ea40b7.entry.js → p-99299763.entry.js} +1 -1
  267. package/dist/twilight/{p-4c69d380.entry.js → p-9c2d73d6.entry.js} +1 -1
  268. package/dist/twilight/{p-Cq2l9LEk.js → p-BLQ1h81p.js} +1 -1
  269. package/dist/twilight/p-BkPzCq-C.js +4 -0
  270. package/dist/twilight/{p-Cb-27f78.js → p-C6CshMy7.js} +1 -1
  271. package/dist/twilight/{p-CcwaGQ9_.js → p-C_of-n0U.js} +1 -1
  272. package/dist/twilight/{p-CzMGWnoB.js → p-D70qx2vr.js} +1 -1
  273. package/dist/twilight/p-D82DKoi_.js +4 -0
  274. package/dist/twilight/{p-BZ_8M_tQ.js → p-DNGUZSFZ.js} +1 -1
  275. package/dist/twilight/{p-oPliK7PL.js → p-Dd4Vpmci.js} +1 -1
  276. package/dist/twilight/p-Dimo1ZpU.js +5 -0
  277. package/dist/twilight/{p-DD5p3dqh.js → p-Dxrx9S2J.js} +1 -1
  278. package/dist/twilight/{p-D1BtXmLB.js → p-ESYTDRNV.js} +1 -1
  279. package/dist/twilight/{p-C0GYDeEy.js → p-JpkF-q4E.js} +1 -1
  280. package/dist/twilight/{p-13160d7a.entry.js → p-a1add8d1.entry.js} +1 -1
  281. package/dist/twilight/{p-53b1b8dd.entry.js → p-a1c2765d.entry.js} +1 -1
  282. package/dist/twilight/{p-886d3ea9.entry.js → p-a64332cc.entry.js} +1 -1
  283. package/dist/twilight/{p-380c9f58.entry.js → p-a7a021e1.entry.js} +1 -1
  284. package/dist/twilight/{p-d36d4dd0.entry.js → p-a86e5802.entry.js} +1 -1
  285. package/dist/twilight/{p-1a624e8e.entry.js → p-ab456964.entry.js} +1 -1
  286. package/dist/twilight/{p-dabf3edb.entry.js → p-ac57d9b4.entry.js} +1 -1
  287. package/dist/twilight/{p-81362474.entry.js → p-addd0fd8.entry.js} +1 -1
  288. package/dist/twilight/{p-2fea82d1.entry.js → p-b40525ea.entry.js} +1 -1
  289. package/dist/twilight/{p-36b79398.entry.js → p-b4a2e25b.entry.js} +1 -1
  290. package/dist/twilight/{p-20ca668a.entry.js → p-b5640db5.entry.js} +1 -1
  291. package/dist/twilight/{p-368d6551.entry.js → p-b8eedf15.entry.js} +1 -1
  292. package/dist/twilight/{p-1184e75d.entry.js → p-b973cdeb.entry.js} +1 -1
  293. package/dist/twilight/{p-42d531d7.entry.js → p-bc324586.entry.js} +1 -1
  294. package/dist/twilight/{p-bca94624.entry.js → p-bc633001.entry.js} +1 -1
  295. package/dist/twilight/{p-09a25c7b.entry.js → p-bd2364b9.entry.js} +1 -1
  296. package/dist/twilight/{p-7679487d.entry.js → p-bd36fa14.entry.js} +1 -1
  297. package/dist/twilight/{p-db9d3135.entry.js → p-be39695f.entry.js} +1 -1
  298. package/dist/twilight/{p-d62d8969.entry.js → p-c19843de.entry.js} +1 -1
  299. package/dist/twilight/{p-f0320140.entry.js → p-c2a09e77.entry.js} +1 -1
  300. package/dist/twilight/{p-6a5e3e9b.entry.js → p-c5d58f7b.entry.js} +1 -1
  301. package/dist/twilight/{p-3160ed65.entry.js → p-cb7c5983.entry.js} +1 -1
  302. package/dist/twilight/{p-3bfc8662.entry.js → p-cc748f8d.entry.js} +1 -1
  303. package/dist/twilight/{p-33369508.entry.js → p-cf518897.entry.js} +1 -1
  304. package/dist/twilight/{p-84daf1b1.entry.js → p-cfa61a61.entry.js} +1 -1
  305. package/dist/twilight/{p-9b14cfd6.entry.js → p-d061531b.entry.js} +1 -1
  306. package/dist/twilight/{p-4508f1ad.entry.js → p-d288d199.entry.js} +1 -1
  307. package/dist/twilight/{p-50fd3bb0.entry.js → p-de91804b.entry.js} +1 -1
  308. package/dist/twilight/{p-3feb7ca8.entry.js → p-df78511a.entry.js} +1 -1
  309. package/dist/twilight/{p-084a6e4a.entry.js → p-e65d2899.entry.js} +1 -1
  310. package/dist/twilight/{p-2eb7be80.entry.js → p-f870a5da.entry.js} +1 -1
  311. package/dist/twilight/{p-BGYOHdWO.js → p-fUqHHnkG.js} +1 -1
  312. package/dist/twilight/twilight.esm.js +1 -1
  313. package/dist/types/components/salla-bullet-delivery/api-service.d.ts +1 -0
  314. package/dist/types/components/salla-bullet-delivery/helpers.d.ts +3 -0
  315. package/dist/types/components/salla-bullet-delivery/interfaces.d.ts +3 -0
  316. package/dist/types/components/salla-bullet-delivery/salla-bullet-delivery.d.ts +23 -1
  317. package/package.json +9 -5
  318. package/dist/twilight/p-94d03d81.entry.js +0 -4
  319. package/dist/twilight/p-CrNw20pf.js +0 -5
  320. package/dist/twilight/p-SRRlvI95.js +0 -4
  321. package/dist/twilight/p-a09eb593.entry.js +0 -4
  322. package/dist/twilight/p-d86fb5f9.entry.js +0 -4
  323. package/dist/twilight/p-e96b8d47.entry.js +0 -4
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as a,h as s,H as t,a as i}from"./p-CrNw20pf.js";import{W as e}from"./p-ZT7ehBBk.js";import{C as l}from"./p-BV4kqbdL.js";import{H as n}from"./p-CHf8XdiS.js";import{I as r}from"./p-C-tzSDxw.js";import{W as o}from"./p-CgR-T_ZS.js";import{S as d}from"./p-DLNIOD9t.js";import{a as h}from"./p-CgtvEd63.js";var g='\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>shipping-fast</title>\n<path d="M10.667 14.667c0-0.737-0.597-1.333-1.333-1.333h-8c-0.736 0-1.333 0.596-1.333 1.333s0.597 1.333 1.333 1.333h8c0.736 0 1.333-0.596 1.333-1.333zM9.333 18.667c-2.941 0-5.333 2.392-5.333 5.333s2.392 5.333 5.333 5.333 5.333-2.392 5.333-5.333-2.392-5.333-5.333-5.333zM9.333 26.667c-1.471 0-2.667-1.196-2.667-2.667s1.196-2.667 2.667-2.667 2.667 1.196 2.667 2.667-1.196 2.667-2.667 2.667zM1.333 10.667h5.333c0.736 0 1.333-0.596 1.333-1.333s-0.597-1.333-1.333-1.333h-5.333c-0.736 0-1.333 0.596-1.333 1.333s0.597 1.333 1.333 1.333zM31.123 13.103l-3.147-3.935c-1.273-1.589-3.171-2.501-5.205-2.501h-1.437c0-2.205-1.795-4-4-4h-13.333c-0.736 0-1.333 0.596-1.333 1.333s0.597 1.333 1.333 1.333h13.333c0.735 0 1.333 0.597 1.333 1.333v1.333c0 0.248 0.087 0.468 0.204 0.667-0.117 0.199-0.204 0.419-0.204 0.667v5.333c0 0.737 0.597 1.333 1.333 1.333h9.333v6.667h-1.333c-0.063 0-0.117 0.028-0.179 0.036-0.583-2.313-2.664-4.036-5.155-4.036-2.941 0-5.333 2.392-5.333 5.333s2.392 5.333 5.333 5.333c2.491 0 4.572-1.723 5.155-4.036 0.061 0.008 0.116 0.036 0.179 0.036h2.667c0.736 0 1.333-0.596 1.333-1.333v-8.399c0-0.905-0.311-1.792-0.877-2.499zM21.333 13.333v-4h1.437c1.221 0 2.36 0.547 3.124 1.501l1.997 2.499zM22.667 26.667c-1.471 0-2.667-1.196-2.667-2.667s1.196-2.667 2.667-2.667 2.667 1.196 2.667 2.667-1.196 2.667-2.667 2.667z"></path>\n</svg>\n';const m=class{constructor(s){a(this,s),this.hasError=!1,this.showContactWidget=!0,this.images=[],this.productImages={},this.editItemImages=[],this.contact_body=(a,s,t)=>salla.lang.get("pages.rating.contact_subject",{store:a,id:s,customer:t}),this.editMode=!1,this.defaultMode=!1,this.deleteMode=!1,this.shouldOpenDeleteModal=!1,this.editItem=null,this.dragAndDropFilesLabel=salla.lang.get("common.uploader.drag_and_drop_files"),this.contactSubjectLabel=salla.lang.get("pages.rating.contact_subject"),this.editReviewLabel=salla.lang.get("pages.rating.edit_review"),this.allowedImagesTypesLabel=salla.lang.get("common.uploader.allowed_images_types"),this.addImagesLabel=salla.lang.get("pages.rating.add_images"),this.editImagesLabel=salla.lang.get("pages.rating.edit_images"),this.threeImagesMax=salla.lang.get("common.uploader.max_three_images"),this.areYouSureLabel=salla.lang.get("pages.rating.are_you_sure_you_want_to_delete_review"),this.confirmDeletionLabel=salla.lang.get("pages.rating.confirm_deletion"),this.cancelLabel=salla.lang.get("common.elements.cancel"),this.confirmDeleteBtn=salla.lang.get("common.elements.confirm_delete"),this.updatedSuccessfullyLabel=salla.lang.get("pages.rating.review_updated_successfully"),this.deletedSuccessfullyLabel=salla.lang.get("pages.rating.review_deleted_successfully"),this.contactUsLabel=salla.lang.get("blocks.footer.social"),this.allowAttachImages=salla.config.get("store.settings.rating.allow_attach_images"),this.allowContactSupport=salla.config.get("store.settings.rating.allow_contact_support"),this.contentRefs=[],this.hiddenInputs=[],this.isOpen=[],this.stepsCount=0,this.currentIndex=0,this.submitted=[],this.MAX_UPLOAD_LIMIT=3,this.onOpen=a=>new Promise((s=>{h({targets:this.contentRefs[a],duration:100,height:this.contentRefs[a].scrollHeight,opacity:[0,1],easing:"easeOutQuart",complete:()=>s()})})),this.onClose=a=>new Promise((s=>{h({targets:this.contentRefs[a],duration:100,height:0,opacity:[1,0],easing:"easeOutQuart",complete:()=>s()})})),this.toggleUploader=async a=>{this.isOpen[a]=!this.isOpen[a],n.toggleElementClassIf(this.contentRefs[a],"is-closed","is-opened",(()=>!this.isOpen[a])),await(this.isOpen[a]?this.onOpen(a):this.onClose(a)),await new Promise((a=>setTimeout(a,101))),this.body&&this.currentTab&&setTimeout((()=>this.body.setAttribute("style",`height:${this.currentTab.offsetHeight+(this.editMode?60:0)}px`)))},salla.onReady((()=>{this.orderId=salla.config.get("page.id")})),salla.lang.onLoaded((()=>{this.contactUsLabel=salla.lang.get("blocks.footer.social");const a=(a,s,t)=>new Promise((i=>{salla.helpers.setNested(salla.lang.messages[a],s,t),i(!0)}));(async()=>{await a("ar.trans","common.uploader.drag_and_drop_files","اسحب الملفات وأفلتها هنا"),await a("en.trans","common.uploader.drag_and_drop_files","Drag and drop files here"),await a("ar.trans","common.uploader.allowed_images_types"," .jpg أو jpeg أو png يُسمح بإضافة صور بصيغة"),await a("en.trans","common.uploader.allowed_images_types","Images in jpg, jpeg, or png format are allowed."),await a("ar.trans","pages.rating.add_images","اضافة صور"),await a("en.trans","pages.rating.add_images","Add Images"),await a("ar.trans","pages.rating.edit_images","تعديل الصور"),await a("en.trans","pages.rating.edit_images","Edit Images"),await a("ar.trans","pages.rating.edit_review","تعديل التقييم"),await a("en.trans","pages.rating.edit_review","Edit review"),await a("ar.trans","pages.rating.confirm_deletion","تأكيد حذف التقييم"),await a("en.trans","pages.rating.confirm_deletion","Confirm review deletion"),await a("ar.trans","pages.rating.are_you_sure_you_want_to_delete_review","هل أنت متأكد من حذف تقييمك؟"),await a("en.trans","pages.rating.are_you_sure_you_want_to_delete_review","Are you sure you want to delete your review?"),await a("ar.trans","pages.rating.review_updated_successfully","تم تعديل التقييم بنجاح"),await a("en.trans","pages.rating.review_updated_successfully","The review has been successfully updated."),await a("ar.trans","pages.rating.review_deleted_successfully","تم حذف التقييم بنجاح"),await a("en.trans","pages.rating.review_deleted_successfully","The review has been successfully deleted."),await a("ar.trans","pages.rating.images_count","الصور ( :current من أصل :total )"),await a("en.trans","pages.rating.images_count","Images ( :current of :total )"),await a("ar.trans","common.uploader.max_three_images",`.أضف ${this.MAX_UPLOAD_LIMIT} صور كحد أقصى`),await a("en.trans","common.uploader.max_three_images",`Add up to ${this.MAX_UPLOAD_LIMIT} images maximum.`),await a("ar.trans","common.elements.confirm_delete","تأكيد الحذف"),await a("en.trans","common.elements.confirm_delete","Confirm deletion"),this.dragAndDropFilesLabel=salla.lang.get("common.uploader.drag_and_drop_files"),this.allowedImagesTypesLabel=salla.lang.get("common.uploader.allowed_images_types"),this.addImagesLabel=salla.lang.get("pages.rating.add_images"),this.threeImagesMax=salla.lang.get("common.uploader.max_three_images"),this.contactSubjectLabel=salla.lang.get("pages.rating.contact_subject"),this.editReviewLabel=salla.lang.get("pages.rating.edit_review"),this.editImagesLabel=salla.lang.get("pages.rating.edit_images"),this.areYouSureLabel=salla.lang.get("pages.rating.are_you_sure_you_want_to_delete_review"),this.confirmDeletionLabel=salla.lang.get("pages.rating.confirm_deletion"),this.cancelLabel=salla.lang.get("common.elements.cancel"),this.updatedSuccessfullyLabel=salla.lang.get("pages.rating.review_updated_successfully"),this.deletedSuccessfullyLabel=salla.lang.get("pages.rating.review_deleted_successfully"),this.confirmDeleteBtn=salla.lang.get("common.elements.confirm_delete"),this.contact_body=(a,s,t)=>salla.lang.get("pages.rating.contact_body",{store:a,id:s,customer:t})})()}))}async open(){return this.defaultMode=!0,new Promise((a=>{setTimeout((()=>{this.modal.open().then((()=>this.order||salla.api.withoutNotifier((()=>salla.rating.api.order(this.orderId?this.orderId:salla.config.get("page.id")))).then((a=>this.order=a.data)))).then((()=>this.modal.setTitle(`${salla.lang.get("pages.rating.rate_order")} <span class="unicode">(#${this.order.id})</span>`))).then((()=>{const a={};if(this.order?.products)for(const s of this.order.products)a[s.product.id]=[];this.productImages=a})).then((()=>this.modal.stopLoading())).then((()=>this.stepsCount=[this.order.testimonials_enabled,this.order.products_enabled,this.order.shipping_enabled].filter((a=>a)).length)).then((()=>setTimeout((()=>this.handleWizard()),100))).catch((s=>{a(!1),this.hasError=!0,this.errorMessage=s.response?.data?.error?.message||s.response?.data,this.modal.stopLoading()})),a(!0)}),50)}))}async openEditModal(a){this.defaultMode=!1,this.editMode=!0,this.editType=a.type,this.editFeedbackId=a.feedback_id;try{await this.fetchEditItem(a.feedback_id),this.editModal.open()}catch(a){this.hasError=!0,this.errorMessage=a.response?.data?.error?.message||a.response?.data}}async fetchEditItem(a){const s=`rating/${a}/show`,t=await salla.api.request(s);this.editItem=t.data,this.allowAttachImages&&"product"==this.editType&&this.editItem.images.length&&(this.editItemImages=this.editItem.images.map((a=>({id:`${Math.floor(100+900*Math.random())}`,url:a}))))}async editReview(){const a={};this.editModal.querySelectorAll("[name]").forEach((s=>{const t=salla.helpers.inputData(s.name,s.value,a);a[t.name]=t.value})),a.images&&(a.images=a.images.split(","));const s=`rating/${this.editFeedbackId}`;await salla.api.request(s,a,"put").then((a=>{this.editModal.close(),salla.notify.success(a.message||this.updatedSuccessfullyLabel),setTimeout((()=>{window.location.reload()}),500)}))}async openDeleteModal(a){return this.defaultMode=!1,this.deleteMode=!0,this.deleteFeedbackId=a.feedback_id,this.shouldOpenDeleteModal=!0,new Promise((a=>{setTimeout((()=>{this.deleteModal.open().then((()=>a(!0)))}),50)}))}async deleteReview(){const a=`rating/${this.deleteFeedbackId}`;await salla.api.request(a,null,"delete").then((()=>{this.deleteModal.close(),salla.notify.success(this.deletedSuccessfullyLabel),setTimeout((()=>{window.location.reload()}),500)}))}async close(){return this.modal.close()}handleWizard(){this.steps=this.modal.querySelectorAll(".s-rating-modal-step"),this.dots=this.modal.querySelectorAll(".s-rating-modal-step-dot"),this.showActiveStep()}showActiveStep(a=null){this.currentTab=a||this.steps[this.currentIndex],n.toggleClassIf(".s-rating-modal-step-dot","s-rating-modal-bg-gray","s-rating-modal-bg-primary",(a=>a!=this.dots[this.currentIndex])).toggleClassIf(".s-rating-modal-step","s-rating-modal-active","s-rating-modal-hidden",(a=>a==this.currentTab)),0!==this.currentIndex&&(n.toggleElementClassIf(this.currentTab,"s-rating-modal-unactive","s-rating-modal-hidden",(()=>!0)),setTimeout((()=>n.toggleElementClassIf(this.currentTab,"s-rating-modal-active","s-rating-modal-unactive",(()=>!0))),300));const s=this.steps[this.currentIndex+1]?.dataset.type;this.nextBtn?.setText(s?`${salla.lang.get("pages.rating.rate")} ${salla.lang.get(`pages.rating.${s}`)}`:salla.lang.get("pages.rating.send_ratings")),setTimeout((()=>this.body?.setAttribute("style",`height:${this.currentTab?.offsetHeight}px`)))}previousTab(){this.currentIndex>0&&this.currentIndex--,n.toggleElementClassIf(this.backBtn,"s-rating-modal-unvisiable","block",(()=>0==this.currentIndex)),this.showActiveStep()}submit(){this.submittedBefore()||this.validate(),salla.config.canLeave=!1,this.nextBtn.load().then((()=>this.submittedBefore()||this.sendFeedback())).then((()=>this.currentTab.querySelectorAll("[name],.s-rating-modal-btn-star").forEach((a=>a.setAttribute("disabled",""))))).then((()=>this.currentIndex<this.stepsCount&&this.currentIndex++)).then((()=>this.showActiveStep())).then((()=>n.toggleClassIf("#prev-btn","block","s-rating-modal-unvisiable",(()=>!0)))).finally((()=>{this.nextBtn.stop(),salla.config.canLeave=!0,this.currentIndex==this.stepsCount&&(this.showThankYou(),this.showContactWidget=!1)}))}submittedBefore(){return this.submitted.includes(this.currentIndex)}validate(a=null,s=null){if(!a&&"products"===this.currentTab.dataset.type)return void this.currentTab.querySelectorAll(".rating-outer-form").forEach((a=>this.validate(a,"product")));const t=(a=a||this.currentTab).querySelector(".rating_hidden_input").value,i=a.querySelector(".s-rating-modal-validation-msg");if(s=s||a.dataset.type,!t)throw i.innerHTML=salla.lang.get(`pages.rating.rate_${s}_stars`).replace(" (:item)",""),new Error(i.innerHTML);i.innerHTML=""}sendFeedback(){const a={};if(this.currentTab.querySelectorAll("[name]").forEach((s=>{const t=salla.helpers.inputData(s.name,s.value,a);a[t.name]=t.value})),this.allowAttachImages&&a.products)for(let s in a.products)a.products[s].images&&(a.products[s].images=a.products[s].images.split(","));if(0!=Object.keys(a).length)return a.order_id=this.orderId,a.type=this.currentTab.dataset.type,salla.rating.api[this.currentTab.dataset.type](a).then((a=>(this.submitted.push(this.currentIndex),a)))}showThankYou(){let a=10,s=setInterval((()=>{this.thanksTime.innerHTML="00:0"+a--,a>0||(clearInterval(s),this.thanksTime.remove(),this.close().then((()=>window.location.reload())))}),1e3);this.modal.querySelector(".s-rating-modal-footer").classList.add("s-rating-modal-unvisiable"),this.showActiveStep(this.thanksTab)}getFilepondPlaceholder(){return`<div class="s-rating-modal-filepond-placeholder"><span class="s-rating-modal-filepond-placeholder-icon">${r}</span><p class="s-rating-modal-filepond-placeholder-text">${this.dragAndDropFilesLabel}<br>\n <span> ${this.allowedImagesTypesLabel} <br> ${this.threeImagesMax} </span></p></div>`}getCustomerName(){return`${salla.config.get("user.first_name")||salla.storage.get("user.first_name")||""} ${salla.config.get("user.last_name")||salla.storage.get("user.last_name")||""}`}handleSendEmail(){const a=`${this.contactSubjectLabel} #${this.order.id}`,s=this.contact_body(salla.config.get("store.name"),this.order.id,this.getCustomerName()),t=`mailto:${salla.config.get("store.contacts.email")}?subject=${encodeURIComponent(a)}&body=${encodeURIComponent(s)}`;window.open(t,"_blank")}handleSendWhatsApp(){const a=this.contact_body(salla.config.get("store.name"),this.order.id,this.getCustomerName()),s=`https://wa.me/${salla.config.get("store.contacts.whatsapp")}?text=${encodeURIComponent(a)}`;window.open(s,"_blank")}resetData(a){a.detail||(this.modal?.close(),this.editItem=null,this.editItemImages=[],this.hiddenInputs[1]&&(this.hiddenInputs[1].value=""),this.deleteFeedbackId=null,this.editFeedbackId=null,this.shouldOpenDeleteModal=!1,this.editMode=!1,this.deleteMode=!1,this.defaultMode=!1)}getDeleteModal(){return s("salla-modal",{ref:a=>this.deleteModal=a,width:"xs",onModalVisibilityChanged:a=>this.resetData(a)},s("div",{class:"s-rating-modal-delete-wrapper",ref:a=>this.body=a},s("h3",null,this.confirmDeletionLabel),s("p",null,this.areYouSureLabel),s("div",{class:"s-rating-modal-delete-actions"},s("salla-button",{loaderPosition:"center",onClick:()=>this.deleteReview()},this.confirmDeleteBtn),s("salla-button",{color:"danger",fill:"outline",onClick:()=>this.deleteModal.close()},this.cancelLabel))))}renderUploadedImagesCount(a){const t=this.editMode?this.editItemImages.length:(this.productImages[a]||[]).length;return s("span",{class:"s-rating-modal-upload-count"},salla.lang.choice("pages.rating.images_count",t,{current:t,total:this.MAX_UPLOAD_LIMIT}))}getEditModal(){return s("salla-modal",{ref:a=>this.editModal=a,width:"md",onModalVisibilityChanged:a=>this.resetData(a)},s("div",{class:"s-rating-modal-edit-wrapper",ref:a=>this.body=a},"store"===this.editType&&this.editItem?s("div",{class:"rating-outer-form s-rating-modal-step-wrap s-rating-modal-step","data-type":"store",ref:a=>this.currentTab=a},s("div",{class:"s-rating-modal-rounded-icon"},s("img",{src:salla.config.get("store.logo","https://assets.salla.sa/cp/assets/images/logo-new.png"),alt:"store name",class:"s-rating-modal-store-logo"})),s("h2",{class:"s-rating-modal-title"},salla.lang.get("pages.rating.rate_the_store")),s("div",{class:"s-rating-modal-stars-company"},s("salla-rating-stars",{withLabel:!0,size:"large",editable:!0,value:this.editItem.stars})),s("textarea",{name:"content",value:this.editItem.content,class:"s-rating-modal-comment",placeholder:salla.lang.get("pages.rating.write_store_rate")}),s("small",{class:"s-rating-modal-validation-msg"})):null,"shipping"===this.editType&&this.editItem?s("div",{class:"rating-outer-form s-rating-modal-step-wrap s-rating-modal-step","data-type":"shipping",ref:a=>this.currentTab=a},this.editItem.shipping.logo?s("div",{class:"s-rating-modal-rounded-icon"},s("img",{src:this.editItem.shipping.logo,class:"s-rating-modal-shipping-logo",alt:this.editItem.shipping.name})):s("span",{class:"s-rating-modal-icon",innerHTML:g}),s("div",{class:"s-rating-modal-title"}," ",`${salla.lang.get("pages.rating.rate_shipping")} ${this.editItem.shipping.name}`),s("div",{class:"s-rating-modal-stars-company"},s("salla-rating-stars",{withLabel:!0,size:"large",editable:!0,value:this.editItem.stars})),s("textarea",{name:"content",class:"s-rating-modal-comment",value:this.editItem.content,placeholder:salla.lang.get("pages.rating.write_shipping_rate")}),s("small",{class:"s-rating-modal-validation-msg"})):null,"product"==this.editType&&this.editItem?s("section",{class:"s-rating-modal-step","data-type":"products",ref:a=>this.currentTab=a},s("div",{class:"s-rating-modal-product"},s("div",{class:"rating-outer-form","data-stars-error":salla.lang.get("pages.rating.rate_product_stars")},s("div",{class:"s-rating-modal-product-img-wrap"},s("img",{src:this.editItem.product.image.url,alt:this.editItem.product.name,class:"s-rating-modal-product-img"})),s("div",{class:"s-rating-modal-product-details"},s("div",{class:"s-rating-modal-product-details-main"},s("div",null,s("h3",{class:"s-rating-modal-product-title"}," ",this.editItem.product.name),s("div",{class:"s-rating-modal-stars-product"},s("salla-rating-stars",{withLabel:!0,size:"small",editable:!0,value:this.editItem.stars}))),this.allowAttachImages&&s("salla-button",{class:"s-comments-item-like-btn mt-0",loaderPosition:"center",fill:"outline",size:"small",onClick:()=>this.toggleUploader(1)},s("span",null,this.editItemImages.length?this.editImagesLabel:this.addImagesLabel),s("span",{innerHTML:r}))),s("textarea",{value:this.editItem.content,placeholder:salla.lang.get("pages.rating.write_product_rate"),name:"content",class:"s-rating-modal-comment"}),s("small",{class:"s-rating-modal-validation-msg"}))),this.allowAttachImages&&s("div",{class:"s-rating-modal-uploader is-closed",ref:a=>this.contentRefs[1]=a},s("salla-file-upload",{name:"images",allowMultiple:!0,maxFilesCount:this.MAX_UPLOAD_LIMIT,imagePreviewHeight:117,filePosterHeight:117,"instant-upload":!0,type:"feedback",files:JSON.stringify(this.editItemImages),payloadName:"files[]",id:`file-${this.editItem.product.id}`,title:this.editItem.product.name,instantUpload:!0,accept:"image/png, image/jpeg, image/jpg",url:salla.url.api("upload"),onUploaded:a=>{this.editItemImages=[...this.editItemImages,a.detail],this.hiddenInputs[1].value=this.editItemImages.map((a=>a.url)).join()},onRemoved:a=>{const s=a.detail;s&&(this.editItemImages=this.editItemImages.filter((a=>a.id!==s)),this.hiddenInputs[1].value=this.editItemImages.map((a=>a.url)).join())},labelIdle:this.getFilepondPlaceholder()}),s("input",{type:"hidden",name:"images",value:this.editItem.images.join(","),ref:a=>this.hiddenInputs[1]=a}),this.renderUploadedImagesCount(this.editItem.product.id)))):null,s("div",{class:"s-rating-modal-footer s-rating-modal-footer-end"},s("salla-button",{"loader-position":"center",onClick:()=>this.editReview()},this.editReviewLabel))))}render(){return this.deleteMode?s(t,{class:"s-rating-modal"},this.getDeleteModal()):this.editMode?s(t,{class:"s-rating-modal"},this.getEditModal()):this.defaultMode?s(t,{class:"s-rating-modal"},s("salla-modal",{class:"s-rating-modal-wrap",onModalVisibilityChanged:a=>this.resetData(a),isLoading:!0,width:"md",ref:a=>this.modal=a},s("div",{slot:"loading"},s("div",{class:"s-rating-modal-skeleton"},s("salla-skeleton",{type:"circle",height:"80px",width:"80px"}),s("salla-skeleton",{height:"15px",width:"60%"}),s("salla-skeleton",{height:"10px",width:"30%"}),s("div",{class:"s-rating-modal-skeleton-stars"},[...Array(5)].map((a=>s("div",{key:a,innerHTML:e})))),s("salla-skeleton",{height:"100px",width:"100%"}),s("div",{class:"s-rating-modal-skeleton-footer"},s("salla-skeleton",{height:"40px",width:"30%"})))),!this.hasError&&this.order?[s("div",{class:"s-rating-modal-wrapper",ref:a=>this.body=a},this.order?.testimonials_enabled?s("div",{class:"rating-outer-form s-rating-modal-step-wrap s-rating-modal-step s-rating-modal-hidden","data-type":"store"},s("div",{class:"s-rating-modal-rounded-icon"},s("img",{src:salla.config.get("store.logo","https://assets.salla.sa/cp/assets/images/logo-new.png"),alt:"store name",class:"s-rating-modal-store-logo"})),s("h2",{class:"s-rating-modal-title"},salla.lang.get("pages.rating.rate_the_store")),s("div",{class:"s-rating-modal-stars-company"},s("salla-rating-stars",{withLabel:!0,size:"large"})),s("textarea",{name:"comment",class:"s-rating-modal-comment",placeholder:salla.lang.get("pages.rating.write_store_rate")}),s("small",{class:"s-rating-modal-validation-msg"})):"",this.order.products_enabled?s("section",{class:"s-rating-modal-step s-rating-modal-hidden","data-type":"products"},this.order.products.map(((a,t)=>s("div",{class:"s-rating-modal-product",key:t},s("div",{class:"rating-outer-form","data-stars-error":salla.lang.get("pages.rating.rate_product_stars")},s("div",{class:"s-rating-modal-product-img-wrap"},s("img",{src:a.product.thumbnail,alt:a.product.name,class:"s-rating-modal-product-img"})),s("div",{class:"s-rating-modal-product-details"},s("div",{class:"s-rating-modal-product-details-main"},s("div",null,s("h3",{class:"s-rating-modal-product-title"}," ",a.product.name),s("div",{class:"s-rating-modal-stars-product"},s("salla-rating-stars",{withLabel:!0,size:"small",name:`products[${t}][rating]`}))),this.allowAttachImages&&s("salla-button",{class:"s-comments-item-like-btn mt-0",loaderPosition:"center",fill:"outline",size:"small",onClick:()=>this.toggleUploader(t)},s("span",null,this.addImagesLabel),s("span",{innerHTML:r}))),s("input",{type:"hidden",name:`products[${t}][product_id]`,value:a.product.id}),s("textarea",{placeholder:salla.lang.get("pages.rating.write_product_rate"),name:`products[${t}][comment]`,class:"s-rating-modal-comment"}),s("small",{class:"s-rating-modal-validation-msg"}))),this.allowAttachImages&&s("div",{class:"s-rating-modal-uploader is-closed",ref:a=>this.contentRefs[t]=a},s("salla-file-upload",{name:"image",maxFilesCount:this.MAX_UPLOAD_LIMIT,imagePreviewHeight:117,"instant-upload":!0,type:"feedback",payloadName:"files[]",id:`file-${a.product.id}`,title:a.product.name,allowMultiple:!0,instantUpload:!0,accept:"image/png, image/jpeg, image/jpg",url:salla.url.api("upload"),onUploaded:s=>{this.productImages={...this.productImages,[a.product.id]:[...this.productImages[a.product.id]||[],s.detail]},this.hiddenInputs[t].value=this.productImages[a.product.id].map((a=>a.url)).join(",")},onRemoved:s=>{const i=s.detail;i&&this.productImages[a.product.id]&&(this.productImages={...this.productImages,[a.product.id]:this.productImages[a.product.id].filter((a=>a.id!==i))},this.hiddenInputs[t].value=this.productImages[a.product.id].map((a=>a.url)).join(","))},labelIdle:this.getFilepondPlaceholder()}),s("input",{type:"hidden",name:`products[${t}][images]`,value:(this.productImages[a.product.id]||[]).map((a=>a.url)).join(","),ref:a=>this.hiddenInputs[t]=a}),this.renderUploadedImagesCount(a.product.id)))))):"",this.order.shipping_enabled&&this.order.shipping?.company?s("div",{class:"rating-outer-form s-rating-modal-step-wrap s-rating-modal-step s-rating-modal-hidden","data-type":"shipping"},s("input",{type:"hidden",name:"shipping_company_id",value:this.order.shipping.company.id}),this.order.shipping.company.logo?s("div",{class:"s-rating-modal-rounded-icon"},s("img",{src:this.order.shipping.company.logo,class:"s-rating-modal-shipping-logo",alt:this.order.shipping.company.name})):s("span",{class:"s-rating-modal-icon",innerHTML:g}),s("div",{class:"s-rating-modal-title"}," ",`${salla.lang.get("pages.rating.rate_shipping")} ${this.order.shipping.company.name}`),s("div",{class:"s-rating-modal-stars-company"},s("salla-rating-stars",{withLabel:!0,size:"large"})),s("textarea",{name:"comment",class:"s-rating-modal-comment",placeholder:salla.lang.get("pages.rating.write_shipping_rate")}),s("small",{class:"s-rating-modal-validation-msg"})):"",s("div",{class:"s-rating-modal-thanks s-rating-modal-hidden",ref:a=>this.thanksTab=a},s("span",{class:"s-rating-modal-icon",innerHTML:l}),s("h3",{class:"s-rating-modal-thanks-title"},salla.lang.get("pages.rating.thanks")),s("div",{class:"s-rating-modal-thanks-msg",innerHTML:this.order.thanks_message}),s("time",{class:"s-rating-modal-thanks-time",ref:a=>this.thanksTime=a}))),this.allowContactSupport&&this.showContactWidget&&(salla.config.get("store.contacts.whatsapp")||salla.config.get("store.contacts.email"))?s("div",{class:"s-rating-modal-contact"},s("p",null,this.contactUsLabel),s("div",{class:"s-rating-modal-contact-icons"},salla.config.get("store.contacts.whatsapp")&&s("span",{onClick:()=>this.handleSendWhatsApp(),innerHTML:o}),salla.config.get("store.contacts.email")&&s("span",{onClick:()=>this.handleSendEmail(),innerHTML:d}))):"",s("div",{class:"s-rating-modal-footer"},s("button",{ref:a=>this.backBtn=a,onClick:()=>this.previousTab(),class:"s-rating-modal-btn s-rating-modal-unvisiable"},salla.lang.get("common.elements.back")),this.stepsCount>1?s("ul",{class:"s-rating-modal-dots"},[0,1,2].slice(0,this.stepsCount).map((a=>s("li",{key:a,class:"s-rating-modal-bg-gray s-rating-modal-step-dot"})))):"",s("salla-button",{"loader-position":"center",ref:a=>this.nextBtn=a,onClick:()=>this.submit()},salla.lang.get("common.elements.next")))]:s("salla-placeholder",{alignment:"center"}))):void 0}componentWillLoad(){salla.event.on("rating::open",(()=>this.open())),salla.event.on("rating::edit",(a=>this.openEditModal(a))),salla.event.on("rating::delete",(a=>this.openDeleteModal(a)))}componentDidLoad(){salla.event.dispatch("rating::ready",this)}get host(){return i(this)}};m.style="";export{m as salla_rating_modal}
4
+ import{r as a,h as s,H as t,a as i}from"./p-Dimo1ZpU.js";import{W as e}from"./p-ZT7ehBBk.js";import{C as l}from"./p-BV4kqbdL.js";import{H as n}from"./p-CHf8XdiS.js";import{I as r}from"./p-C-tzSDxw.js";import{W as o}from"./p-CgR-T_ZS.js";import{S as d}from"./p-DLNIOD9t.js";import{a as h}from"./p-CgtvEd63.js";var g='\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>shipping-fast</title>\n<path d="M10.667 14.667c0-0.737-0.597-1.333-1.333-1.333h-8c-0.736 0-1.333 0.596-1.333 1.333s0.597 1.333 1.333 1.333h8c0.736 0 1.333-0.596 1.333-1.333zM9.333 18.667c-2.941 0-5.333 2.392-5.333 5.333s2.392 5.333 5.333 5.333 5.333-2.392 5.333-5.333-2.392-5.333-5.333-5.333zM9.333 26.667c-1.471 0-2.667-1.196-2.667-2.667s1.196-2.667 2.667-2.667 2.667 1.196 2.667 2.667-1.196 2.667-2.667 2.667zM1.333 10.667h5.333c0.736 0 1.333-0.596 1.333-1.333s-0.597-1.333-1.333-1.333h-5.333c-0.736 0-1.333 0.596-1.333 1.333s0.597 1.333 1.333 1.333zM31.123 13.103l-3.147-3.935c-1.273-1.589-3.171-2.501-5.205-2.501h-1.437c0-2.205-1.795-4-4-4h-13.333c-0.736 0-1.333 0.596-1.333 1.333s0.597 1.333 1.333 1.333h13.333c0.735 0 1.333 0.597 1.333 1.333v1.333c0 0.248 0.087 0.468 0.204 0.667-0.117 0.199-0.204 0.419-0.204 0.667v5.333c0 0.737 0.597 1.333 1.333 1.333h9.333v6.667h-1.333c-0.063 0-0.117 0.028-0.179 0.036-0.583-2.313-2.664-4.036-5.155-4.036-2.941 0-5.333 2.392-5.333 5.333s2.392 5.333 5.333 5.333c2.491 0 4.572-1.723 5.155-4.036 0.061 0.008 0.116 0.036 0.179 0.036h2.667c0.736 0 1.333-0.596 1.333-1.333v-8.399c0-0.905-0.311-1.792-0.877-2.499zM21.333 13.333v-4h1.437c1.221 0 2.36 0.547 3.124 1.501l1.997 2.499zM22.667 26.667c-1.471 0-2.667-1.196-2.667-2.667s1.196-2.667 2.667-2.667 2.667 1.196 2.667 2.667-1.196 2.667-2.667 2.667z"></path>\n</svg>\n';const m=class{constructor(s){a(this,s),this.hasError=!1,this.showContactWidget=!0,this.images=[],this.productImages={},this.editItemImages=[],this.contact_body=(a,s,t)=>salla.lang.get("pages.rating.contact_subject",{store:a,id:s,customer:t}),this.editMode=!1,this.defaultMode=!1,this.deleteMode=!1,this.shouldOpenDeleteModal=!1,this.editItem=null,this.dragAndDropFilesLabel=salla.lang.get("common.uploader.drag_and_drop_files"),this.contactSubjectLabel=salla.lang.get("pages.rating.contact_subject"),this.editReviewLabel=salla.lang.get("pages.rating.edit_review"),this.allowedImagesTypesLabel=salla.lang.get("common.uploader.allowed_images_types"),this.addImagesLabel=salla.lang.get("pages.rating.add_images"),this.editImagesLabel=salla.lang.get("pages.rating.edit_images"),this.threeImagesMax=salla.lang.get("common.uploader.max_three_images"),this.areYouSureLabel=salla.lang.get("pages.rating.are_you_sure_you_want_to_delete_review"),this.confirmDeletionLabel=salla.lang.get("pages.rating.confirm_deletion"),this.cancelLabel=salla.lang.get("common.elements.cancel"),this.confirmDeleteBtn=salla.lang.get("common.elements.confirm_delete"),this.updatedSuccessfullyLabel=salla.lang.get("pages.rating.review_updated_successfully"),this.deletedSuccessfullyLabel=salla.lang.get("pages.rating.review_deleted_successfully"),this.contactUsLabel=salla.lang.get("blocks.footer.social"),this.allowAttachImages=salla.config.get("store.settings.rating.allow_attach_images"),this.allowContactSupport=salla.config.get("store.settings.rating.allow_contact_support"),this.contentRefs=[],this.hiddenInputs=[],this.isOpen=[],this.stepsCount=0,this.currentIndex=0,this.submitted=[],this.MAX_UPLOAD_LIMIT=3,this.onOpen=a=>new Promise((s=>{h({targets:this.contentRefs[a],duration:100,height:this.contentRefs[a].scrollHeight,opacity:[0,1],easing:"easeOutQuart",complete:()=>s()})})),this.onClose=a=>new Promise((s=>{h({targets:this.contentRefs[a],duration:100,height:0,opacity:[1,0],easing:"easeOutQuart",complete:()=>s()})})),this.toggleUploader=async a=>{this.isOpen[a]=!this.isOpen[a],n.toggleElementClassIf(this.contentRefs[a],"is-closed","is-opened",(()=>!this.isOpen[a])),await(this.isOpen[a]?this.onOpen(a):this.onClose(a)),await new Promise((a=>setTimeout(a,101))),this.body&&this.currentTab&&setTimeout((()=>this.body.setAttribute("style",`height:${this.currentTab.offsetHeight+(this.editMode?60:0)}px`)))},salla.onReady((()=>{this.orderId=salla.config.get("page.id")})),salla.lang.onLoaded((()=>{this.contactUsLabel=salla.lang.get("blocks.footer.social");const a=(a,s,t)=>new Promise((i=>{salla.helpers.setNested(salla.lang.messages[a],s,t),i(!0)}));(async()=>{await a("ar.trans","common.uploader.drag_and_drop_files","اسحب الملفات وأفلتها هنا"),await a("en.trans","common.uploader.drag_and_drop_files","Drag and drop files here"),await a("ar.trans","common.uploader.allowed_images_types"," .jpg أو jpeg أو png يُسمح بإضافة صور بصيغة"),await a("en.trans","common.uploader.allowed_images_types","Images in jpg, jpeg, or png format are allowed."),await a("ar.trans","pages.rating.add_images","اضافة صور"),await a("en.trans","pages.rating.add_images","Add Images"),await a("ar.trans","pages.rating.edit_images","تعديل الصور"),await a("en.trans","pages.rating.edit_images","Edit Images"),await a("ar.trans","pages.rating.edit_review","تعديل التقييم"),await a("en.trans","pages.rating.edit_review","Edit review"),await a("ar.trans","pages.rating.confirm_deletion","تأكيد حذف التقييم"),await a("en.trans","pages.rating.confirm_deletion","Confirm review deletion"),await a("ar.trans","pages.rating.are_you_sure_you_want_to_delete_review","هل أنت متأكد من حذف تقييمك؟"),await a("en.trans","pages.rating.are_you_sure_you_want_to_delete_review","Are you sure you want to delete your review?"),await a("ar.trans","pages.rating.review_updated_successfully","تم تعديل التقييم بنجاح"),await a("en.trans","pages.rating.review_updated_successfully","The review has been successfully updated."),await a("ar.trans","pages.rating.review_deleted_successfully","تم حذف التقييم بنجاح"),await a("en.trans","pages.rating.review_deleted_successfully","The review has been successfully deleted."),await a("ar.trans","pages.rating.images_count","الصور ( :current من أصل :total )"),await a("en.trans","pages.rating.images_count","Images ( :current of :total )"),await a("ar.trans","common.uploader.max_three_images",`.أضف ${this.MAX_UPLOAD_LIMIT} صور كحد أقصى`),await a("en.trans","common.uploader.max_three_images",`Add up to ${this.MAX_UPLOAD_LIMIT} images maximum.`),await a("ar.trans","common.elements.confirm_delete","تأكيد الحذف"),await a("en.trans","common.elements.confirm_delete","Confirm deletion"),this.dragAndDropFilesLabel=salla.lang.get("common.uploader.drag_and_drop_files"),this.allowedImagesTypesLabel=salla.lang.get("common.uploader.allowed_images_types"),this.addImagesLabel=salla.lang.get("pages.rating.add_images"),this.threeImagesMax=salla.lang.get("common.uploader.max_three_images"),this.contactSubjectLabel=salla.lang.get("pages.rating.contact_subject"),this.editReviewLabel=salla.lang.get("pages.rating.edit_review"),this.editImagesLabel=salla.lang.get("pages.rating.edit_images"),this.areYouSureLabel=salla.lang.get("pages.rating.are_you_sure_you_want_to_delete_review"),this.confirmDeletionLabel=salla.lang.get("pages.rating.confirm_deletion"),this.cancelLabel=salla.lang.get("common.elements.cancel"),this.updatedSuccessfullyLabel=salla.lang.get("pages.rating.review_updated_successfully"),this.deletedSuccessfullyLabel=salla.lang.get("pages.rating.review_deleted_successfully"),this.confirmDeleteBtn=salla.lang.get("common.elements.confirm_delete"),this.contact_body=(a,s,t)=>salla.lang.get("pages.rating.contact_body",{store:a,id:s,customer:t})})()}))}async open(){return this.defaultMode=!0,new Promise((a=>{setTimeout((()=>{this.modal.open().then((()=>this.order||salla.api.withoutNotifier((()=>salla.rating.api.order(this.orderId?this.orderId:salla.config.get("page.id")))).then((a=>this.order=a.data)))).then((()=>this.modal.setTitle(`${salla.lang.get("pages.rating.rate_order")} <span class="unicode">(#${this.order.id})</span>`))).then((()=>{const a={};if(this.order?.products)for(const s of this.order.products)a[s.product.id]=[];this.productImages=a})).then((()=>this.modal.stopLoading())).then((()=>this.stepsCount=[this.order.testimonials_enabled,this.order.products_enabled,this.order.shipping_enabled].filter((a=>a)).length)).then((()=>setTimeout((()=>this.handleWizard()),100))).catch((s=>{a(!1),this.hasError=!0,this.errorMessage=s.response?.data?.error?.message||s.response?.data,this.modal.stopLoading()})),a(!0)}),50)}))}async openEditModal(a){this.defaultMode=!1,this.editMode=!0,this.editType=a.type,this.editFeedbackId=a.feedback_id;try{await this.fetchEditItem(a.feedback_id),this.editModal.open()}catch(a){this.hasError=!0,this.errorMessage=a.response?.data?.error?.message||a.response?.data}}async fetchEditItem(a){const s=`rating/${a}/show`,t=await salla.api.request(s);this.editItem=t.data,this.allowAttachImages&&"product"==this.editType&&this.editItem.images.length&&(this.editItemImages=this.editItem.images.map((a=>({id:`${Math.floor(100+900*Math.random())}`,url:a}))))}async editReview(){const a={};this.editModal.querySelectorAll("[name]").forEach((s=>{const t=salla.helpers.inputData(s.name,s.value,a);a[t.name]=t.value})),a.images&&(a.images=a.images.split(","));const s=`rating/${this.editFeedbackId}`;await salla.api.request(s,a,"put").then((a=>{this.editModal.close(),salla.notify.success(a.message||this.updatedSuccessfullyLabel),setTimeout((()=>{window.location.reload()}),500)}))}async openDeleteModal(a){return this.defaultMode=!1,this.deleteMode=!0,this.deleteFeedbackId=a.feedback_id,this.shouldOpenDeleteModal=!0,new Promise((a=>{setTimeout((()=>{this.deleteModal.open().then((()=>a(!0)))}),50)}))}async deleteReview(){const a=`rating/${this.deleteFeedbackId}`;await salla.api.request(a,null,"delete").then((()=>{this.deleteModal.close(),salla.notify.success(this.deletedSuccessfullyLabel),setTimeout((()=>{window.location.reload()}),500)}))}async close(){return this.modal.close()}handleWizard(){this.steps=this.modal.querySelectorAll(".s-rating-modal-step"),this.dots=this.modal.querySelectorAll(".s-rating-modal-step-dot"),this.showActiveStep()}showActiveStep(a=null){this.currentTab=a||this.steps[this.currentIndex],n.toggleClassIf(".s-rating-modal-step-dot","s-rating-modal-bg-gray","s-rating-modal-bg-primary",(a=>a!=this.dots[this.currentIndex])).toggleClassIf(".s-rating-modal-step","s-rating-modal-active","s-rating-modal-hidden",(a=>a==this.currentTab)),0!==this.currentIndex&&(n.toggleElementClassIf(this.currentTab,"s-rating-modal-unactive","s-rating-modal-hidden",(()=>!0)),setTimeout((()=>n.toggleElementClassIf(this.currentTab,"s-rating-modal-active","s-rating-modal-unactive",(()=>!0))),300));const s=this.steps[this.currentIndex+1]?.dataset.type;this.nextBtn?.setText(s?`${salla.lang.get("pages.rating.rate")} ${salla.lang.get(`pages.rating.${s}`)}`:salla.lang.get("pages.rating.send_ratings")),setTimeout((()=>this.body?.setAttribute("style",`height:${this.currentTab?.offsetHeight}px`)))}previousTab(){this.currentIndex>0&&this.currentIndex--,n.toggleElementClassIf(this.backBtn,"s-rating-modal-unvisiable","block",(()=>0==this.currentIndex)),this.showActiveStep()}submit(){this.submittedBefore()||this.validate(),salla.config.canLeave=!1,this.nextBtn.load().then((()=>this.submittedBefore()||this.sendFeedback())).then((()=>this.currentTab.querySelectorAll("[name],.s-rating-modal-btn-star").forEach((a=>a.setAttribute("disabled",""))))).then((()=>this.currentIndex<this.stepsCount&&this.currentIndex++)).then((()=>this.showActiveStep())).then((()=>n.toggleClassIf("#prev-btn","block","s-rating-modal-unvisiable",(()=>!0)))).finally((()=>{this.nextBtn.stop(),salla.config.canLeave=!0,this.currentIndex==this.stepsCount&&(this.showThankYou(),this.showContactWidget=!1)}))}submittedBefore(){return this.submitted.includes(this.currentIndex)}validate(a=null,s=null){if(!a&&"products"===this.currentTab.dataset.type)return void this.currentTab.querySelectorAll(".rating-outer-form").forEach((a=>this.validate(a,"product")));const t=(a=a||this.currentTab).querySelector(".rating_hidden_input").value,i=a.querySelector(".s-rating-modal-validation-msg");if(s=s||a.dataset.type,!t)throw i.innerHTML=salla.lang.get(`pages.rating.rate_${s}_stars`).replace(" (:item)",""),new Error(i.innerHTML);i.innerHTML=""}sendFeedback(){const a={};if(this.currentTab.querySelectorAll("[name]").forEach((s=>{const t=salla.helpers.inputData(s.name,s.value,a);a[t.name]=t.value})),this.allowAttachImages&&a.products)for(let s in a.products)a.products[s].images&&(a.products[s].images=a.products[s].images.split(","));if(0!=Object.keys(a).length)return a.order_id=this.orderId,a.type=this.currentTab.dataset.type,salla.rating.api[this.currentTab.dataset.type](a).then((a=>(this.submitted.push(this.currentIndex),a)))}showThankYou(){let a=10,s=setInterval((()=>{this.thanksTime.innerHTML="00:0"+a--,a>0||(clearInterval(s),this.thanksTime.remove(),this.close().then((()=>window.location.reload())))}),1e3);this.modal.querySelector(".s-rating-modal-footer").classList.add("s-rating-modal-unvisiable"),this.showActiveStep(this.thanksTab)}getFilepondPlaceholder(){return`<div class="s-rating-modal-filepond-placeholder"><span class="s-rating-modal-filepond-placeholder-icon">${r}</span><p class="s-rating-modal-filepond-placeholder-text">${this.dragAndDropFilesLabel}<br>\n <span> ${this.allowedImagesTypesLabel} <br> ${this.threeImagesMax} </span></p></div>`}getCustomerName(){return`${salla.config.get("user.first_name")||salla.storage.get("user.first_name")||""} ${salla.config.get("user.last_name")||salla.storage.get("user.last_name")||""}`}handleSendEmail(){const a=`${this.contactSubjectLabel} #${this.order.id}`,s=this.contact_body(salla.config.get("store.name"),this.order.id,this.getCustomerName()),t=`mailto:${salla.config.get("store.contacts.email")}?subject=${encodeURIComponent(a)}&body=${encodeURIComponent(s)}`;window.open(t,"_blank")}handleSendWhatsApp(){const a=this.contact_body(salla.config.get("store.name"),this.order.id,this.getCustomerName()),s=`https://wa.me/${salla.config.get("store.contacts.whatsapp")}?text=${encodeURIComponent(a)}`;window.open(s,"_blank")}resetData(a){a.detail||(this.modal?.close(),this.editItem=null,this.editItemImages=[],this.hiddenInputs[1]&&(this.hiddenInputs[1].value=""),this.deleteFeedbackId=null,this.editFeedbackId=null,this.shouldOpenDeleteModal=!1,this.editMode=!1,this.deleteMode=!1,this.defaultMode=!1)}getDeleteModal(){return s("salla-modal",{ref:a=>this.deleteModal=a,width:"xs",onModalVisibilityChanged:a=>this.resetData(a)},s("div",{class:"s-rating-modal-delete-wrapper",ref:a=>this.body=a},s("h3",null,this.confirmDeletionLabel),s("p",null,this.areYouSureLabel),s("div",{class:"s-rating-modal-delete-actions"},s("salla-button",{loaderPosition:"center",onClick:()=>this.deleteReview()},this.confirmDeleteBtn),s("salla-button",{color:"danger",fill:"outline",onClick:()=>this.deleteModal.close()},this.cancelLabel))))}renderUploadedImagesCount(a){const t=this.editMode?this.editItemImages.length:(this.productImages[a]||[]).length;return s("span",{class:"s-rating-modal-upload-count"},salla.lang.choice("pages.rating.images_count",t,{current:t,total:this.MAX_UPLOAD_LIMIT}))}getEditModal(){return s("salla-modal",{ref:a=>this.editModal=a,width:"md",onModalVisibilityChanged:a=>this.resetData(a)},s("div",{class:"s-rating-modal-edit-wrapper",ref:a=>this.body=a},"store"===this.editType&&this.editItem?s("div",{class:"rating-outer-form s-rating-modal-step-wrap s-rating-modal-step","data-type":"store",ref:a=>this.currentTab=a},s("div",{class:"s-rating-modal-rounded-icon"},s("img",{src:salla.config.get("store.logo","https://assets.salla.sa/cp/assets/images/logo-new.png"),alt:"store name",class:"s-rating-modal-store-logo"})),s("h2",{class:"s-rating-modal-title"},salla.lang.get("pages.rating.rate_the_store")),s("div",{class:"s-rating-modal-stars-company"},s("salla-rating-stars",{withLabel:!0,size:"large",editable:!0,value:this.editItem.stars})),s("textarea",{name:"content",value:this.editItem.content,class:"s-rating-modal-comment",placeholder:salla.lang.get("pages.rating.write_store_rate")}),s("small",{class:"s-rating-modal-validation-msg"})):null,"shipping"===this.editType&&this.editItem?s("div",{class:"rating-outer-form s-rating-modal-step-wrap s-rating-modal-step","data-type":"shipping",ref:a=>this.currentTab=a},this.editItem.shipping.logo?s("div",{class:"s-rating-modal-rounded-icon"},s("img",{src:this.editItem.shipping.logo,class:"s-rating-modal-shipping-logo",alt:this.editItem.shipping.name})):s("span",{class:"s-rating-modal-icon",innerHTML:g}),s("div",{class:"s-rating-modal-title"}," ",`${salla.lang.get("pages.rating.rate_shipping")} ${this.editItem.shipping.name}`),s("div",{class:"s-rating-modal-stars-company"},s("salla-rating-stars",{withLabel:!0,size:"large",editable:!0,value:this.editItem.stars})),s("textarea",{name:"content",class:"s-rating-modal-comment",value:this.editItem.content,placeholder:salla.lang.get("pages.rating.write_shipping_rate")}),s("small",{class:"s-rating-modal-validation-msg"})):null,"product"==this.editType&&this.editItem?s("section",{class:"s-rating-modal-step","data-type":"products",ref:a=>this.currentTab=a},s("div",{class:"s-rating-modal-product"},s("div",{class:"rating-outer-form","data-stars-error":salla.lang.get("pages.rating.rate_product_stars")},s("div",{class:"s-rating-modal-product-img-wrap"},s("img",{src:this.editItem.product.image.url,alt:this.editItem.product.name,class:"s-rating-modal-product-img"})),s("div",{class:"s-rating-modal-product-details"},s("div",{class:"s-rating-modal-product-details-main"},s("div",null,s("h3",{class:"s-rating-modal-product-title"}," ",this.editItem.product.name),s("div",{class:"s-rating-modal-stars-product"},s("salla-rating-stars",{withLabel:!0,size:"small",editable:!0,value:this.editItem.stars}))),this.allowAttachImages&&s("salla-button",{class:"s-comments-item-like-btn mt-0",loaderPosition:"center",fill:"outline",size:"small",onClick:()=>this.toggleUploader(1)},s("span",null,this.editItemImages.length?this.editImagesLabel:this.addImagesLabel),s("span",{innerHTML:r}))),s("textarea",{value:this.editItem.content,placeholder:salla.lang.get("pages.rating.write_product_rate"),name:"content",class:"s-rating-modal-comment"}),s("small",{class:"s-rating-modal-validation-msg"}))),this.allowAttachImages&&s("div",{class:"s-rating-modal-uploader is-closed",ref:a=>this.contentRefs[1]=a},s("salla-file-upload",{name:"images",allowMultiple:!0,maxFilesCount:this.MAX_UPLOAD_LIMIT,imagePreviewHeight:117,filePosterHeight:117,"instant-upload":!0,type:"feedback",files:JSON.stringify(this.editItemImages),payloadName:"files[]",id:`file-${this.editItem.product.id}`,title:this.editItem.product.name,instantUpload:!0,accept:"image/png, image/jpeg, image/jpg",url:salla.url.api("upload"),onUploaded:a=>{this.editItemImages=[...this.editItemImages,a.detail],this.hiddenInputs[1].value=this.editItemImages.map((a=>a.url)).join()},onRemoved:a=>{const s=a.detail;s&&(this.editItemImages=this.editItemImages.filter((a=>a.id!==s)),this.hiddenInputs[1].value=this.editItemImages.map((a=>a.url)).join())},labelIdle:this.getFilepondPlaceholder()}),s("input",{type:"hidden",name:"images",value:this.editItem.images.join(","),ref:a=>this.hiddenInputs[1]=a}),this.renderUploadedImagesCount(this.editItem.product.id)))):null,s("div",{class:"s-rating-modal-footer s-rating-modal-footer-end"},s("salla-button",{"loader-position":"center",onClick:()=>this.editReview()},this.editReviewLabel))))}render(){return this.deleteMode?s(t,{class:"s-rating-modal"},this.getDeleteModal()):this.editMode?s(t,{class:"s-rating-modal"},this.getEditModal()):this.defaultMode?s(t,{class:"s-rating-modal"},s("salla-modal",{class:"s-rating-modal-wrap",onModalVisibilityChanged:a=>this.resetData(a),isLoading:!0,width:"md",ref:a=>this.modal=a},s("div",{slot:"loading"},s("div",{class:"s-rating-modal-skeleton"},s("salla-skeleton",{type:"circle",height:"80px",width:"80px"}),s("salla-skeleton",{height:"15px",width:"60%"}),s("salla-skeleton",{height:"10px",width:"30%"}),s("div",{class:"s-rating-modal-skeleton-stars"},[...Array(5)].map((a=>s("div",{key:a,innerHTML:e})))),s("salla-skeleton",{height:"100px",width:"100%"}),s("div",{class:"s-rating-modal-skeleton-footer"},s("salla-skeleton",{height:"40px",width:"30%"})))),!this.hasError&&this.order?[s("div",{class:"s-rating-modal-wrapper",ref:a=>this.body=a},this.order?.testimonials_enabled?s("div",{class:"rating-outer-form s-rating-modal-step-wrap s-rating-modal-step s-rating-modal-hidden","data-type":"store"},s("div",{class:"s-rating-modal-rounded-icon"},s("img",{src:salla.config.get("store.logo","https://assets.salla.sa/cp/assets/images/logo-new.png"),alt:"store name",class:"s-rating-modal-store-logo"})),s("h2",{class:"s-rating-modal-title"},salla.lang.get("pages.rating.rate_the_store")),s("div",{class:"s-rating-modal-stars-company"},s("salla-rating-stars",{withLabel:!0,size:"large"})),s("textarea",{name:"comment",class:"s-rating-modal-comment",placeholder:salla.lang.get("pages.rating.write_store_rate")}),s("small",{class:"s-rating-modal-validation-msg"})):"",this.order.products_enabled?s("section",{class:"s-rating-modal-step s-rating-modal-hidden","data-type":"products"},this.order.products.map(((a,t)=>s("div",{class:"s-rating-modal-product",key:t},s("div",{class:"rating-outer-form","data-stars-error":salla.lang.get("pages.rating.rate_product_stars")},s("div",{class:"s-rating-modal-product-img-wrap"},s("img",{src:a.product.thumbnail,alt:a.product.name,class:"s-rating-modal-product-img"})),s("div",{class:"s-rating-modal-product-details"},s("div",{class:"s-rating-modal-product-details-main"},s("div",null,s("h3",{class:"s-rating-modal-product-title"}," ",a.product.name),s("div",{class:"s-rating-modal-stars-product"},s("salla-rating-stars",{withLabel:!0,size:"small",name:`products[${t}][rating]`}))),this.allowAttachImages&&s("salla-button",{class:"s-comments-item-like-btn mt-0",loaderPosition:"center",fill:"outline",size:"small",onClick:()=>this.toggleUploader(t)},s("span",null,this.addImagesLabel),s("span",{innerHTML:r}))),s("input",{type:"hidden",name:`products[${t}][product_id]`,value:a.product.id}),s("textarea",{placeholder:salla.lang.get("pages.rating.write_product_rate"),name:`products[${t}][comment]`,class:"s-rating-modal-comment"}),s("small",{class:"s-rating-modal-validation-msg"}))),this.allowAttachImages&&s("div",{class:"s-rating-modal-uploader is-closed",ref:a=>this.contentRefs[t]=a},s("salla-file-upload",{name:"image",maxFilesCount:this.MAX_UPLOAD_LIMIT,imagePreviewHeight:117,"instant-upload":!0,type:"feedback",payloadName:"files[]",id:`file-${a.product.id}`,title:a.product.name,allowMultiple:!0,instantUpload:!0,accept:"image/png, image/jpeg, image/jpg",url:salla.url.api("upload"),onUploaded:s=>{this.productImages={...this.productImages,[a.product.id]:[...this.productImages[a.product.id]||[],s.detail]},this.hiddenInputs[t].value=this.productImages[a.product.id].map((a=>a.url)).join(",")},onRemoved:s=>{const i=s.detail;i&&this.productImages[a.product.id]&&(this.productImages={...this.productImages,[a.product.id]:this.productImages[a.product.id].filter((a=>a.id!==i))},this.hiddenInputs[t].value=this.productImages[a.product.id].map((a=>a.url)).join(","))},labelIdle:this.getFilepondPlaceholder()}),s("input",{type:"hidden",name:`products[${t}][images]`,value:(this.productImages[a.product.id]||[]).map((a=>a.url)).join(","),ref:a=>this.hiddenInputs[t]=a}),this.renderUploadedImagesCount(a.product.id)))))):"",this.order.shipping_enabled&&this.order.shipping?.company?s("div",{class:"rating-outer-form s-rating-modal-step-wrap s-rating-modal-step s-rating-modal-hidden","data-type":"shipping"},s("input",{type:"hidden",name:"shipping_company_id",value:this.order.shipping.company.id}),this.order.shipping.company.logo?s("div",{class:"s-rating-modal-rounded-icon"},s("img",{src:this.order.shipping.company.logo,class:"s-rating-modal-shipping-logo",alt:this.order.shipping.company.name})):s("span",{class:"s-rating-modal-icon",innerHTML:g}),s("div",{class:"s-rating-modal-title"}," ",`${salla.lang.get("pages.rating.rate_shipping")} ${this.order.shipping.company.name}`),s("div",{class:"s-rating-modal-stars-company"},s("salla-rating-stars",{withLabel:!0,size:"large"})),s("textarea",{name:"comment",class:"s-rating-modal-comment",placeholder:salla.lang.get("pages.rating.write_shipping_rate")}),s("small",{class:"s-rating-modal-validation-msg"})):"",s("div",{class:"s-rating-modal-thanks s-rating-modal-hidden",ref:a=>this.thanksTab=a},s("span",{class:"s-rating-modal-icon",innerHTML:l}),s("h3",{class:"s-rating-modal-thanks-title"},salla.lang.get("pages.rating.thanks")),s("div",{class:"s-rating-modal-thanks-msg",innerHTML:this.order.thanks_message}),s("time",{class:"s-rating-modal-thanks-time",ref:a=>this.thanksTime=a}))),this.allowContactSupport&&this.showContactWidget&&(salla.config.get("store.contacts.whatsapp")||salla.config.get("store.contacts.email"))?s("div",{class:"s-rating-modal-contact"},s("p",null,this.contactUsLabel),s("div",{class:"s-rating-modal-contact-icons"},salla.config.get("store.contacts.whatsapp")&&s("span",{onClick:()=>this.handleSendWhatsApp(),innerHTML:o}),salla.config.get("store.contacts.email")&&s("span",{onClick:()=>this.handleSendEmail(),innerHTML:d}))):"",s("div",{class:"s-rating-modal-footer"},s("button",{ref:a=>this.backBtn=a,onClick:()=>this.previousTab(),class:"s-rating-modal-btn s-rating-modal-unvisiable"},salla.lang.get("common.elements.back")),this.stepsCount>1?s("ul",{class:"s-rating-modal-dots"},[0,1,2].slice(0,this.stepsCount).map((a=>s("li",{key:a,class:"s-rating-modal-bg-gray s-rating-modal-step-dot"})))):"",s("salla-button",{"loader-position":"center",ref:a=>this.nextBtn=a,onClick:()=>this.submit()},salla.lang.get("common.elements.next")))]:s("salla-placeholder",{alignment:"center"}))):void 0}componentWillLoad(){salla.event.on("rating::open",(()=>this.open())),salla.event.on("rating::edit",(a=>this.openEditModal(a))),salla.event.on("rating::delete",(a=>this.openDeleteModal(a)))}componentDidLoad(){salla.event.dispatch("rating::ready",this)}get host(){return i(this)}};m.style="";export{m as salla_rating_modal}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as e,h as t,H as a}from"./p-CrNw20pf.js";const s=class{constructor(t){e(this,t),this.href=void 0,this.target="_self"}generateClass(){return{"s-list-tile-item":!0,"s-list-tile-item-href":!!this.href}}render(){return t(a,{key:"bb33776d01406ff1e04bbdc741312f1a17ac3b7b"},t("a",{key:"386b417c954bf4b2bac34e40d9bae19db7f61ec3",class:this.generateClass(),href:this.href||"#",target:this.target,"aria-label":"List Tile Link"},t("div",{key:"cbcd8c6f92a4cbe7afbd8797c36ae6f529abed1c",class:"s-list-tile-item-icon"},t("slot",{key:"bff76fdb467b2491f0c3b40bd7f475eda23fa9c8",name:"icon"})),t("div",{key:"c80e7c032abedea8d5929d8bb36a642336724fe1",class:"s-list-tile-item-content"},t("div",{key:"2bea0273bb4c012e0f9f7ee948b14bc9ea8afc2a",class:"s-list-tile-item-title"},t("slot",{key:"60c872b9ec9b369ba65452abad7860b3ba6ba640",name:"title"})),t("div",{key:"fbb1b6e49284c74f2933f056aa16fcbc25526703",class:"s-list-tile-item-subtitle"},t("slot",{key:"5ad1bba1b71db13d4deb594ccb0f5898f24d2f23",name:"subtitle"}))),t("div",{key:"96358bf7ed34907a799efd8c6fb2caae6ca02f43",class:"s-list-tile-item-action"},t("slot",{key:"8d496724103f0c3959845c8f5d4e662a3095c09e",name:"action"}))))}};s.style="";export{s as salla_list_tile}
4
+ import{r as e,h as t,H as a}from"./p-Dimo1ZpU.js";const s=class{constructor(t){e(this,t),this.href=void 0,this.target="_self"}generateClass(){return{"s-list-tile-item":!0,"s-list-tile-item-href":!!this.href}}render(){return t(a,{key:"bb33776d01406ff1e04bbdc741312f1a17ac3b7b"},t("a",{key:"386b417c954bf4b2bac34e40d9bae19db7f61ec3",class:this.generateClass(),href:this.href||"#",target:this.target,"aria-label":"List Tile Link"},t("div",{key:"cbcd8c6f92a4cbe7afbd8797c36ae6f529abed1c",class:"s-list-tile-item-icon"},t("slot",{key:"bff76fdb467b2491f0c3b40bd7f475eda23fa9c8",name:"icon"})),t("div",{key:"c80e7c032abedea8d5929d8bb36a642336724fe1",class:"s-list-tile-item-content"},t("div",{key:"2bea0273bb4c012e0f9f7ee948b14bc9ea8afc2a",class:"s-list-tile-item-title"},t("slot",{key:"60c872b9ec9b369ba65452abad7860b3ba6ba640",name:"title"})),t("div",{key:"fbb1b6e49284c74f2933f056aa16fcbc25526703",class:"s-list-tile-item-subtitle"},t("slot",{key:"5ad1bba1b71db13d4deb594ccb0f5898f24d2f23",name:"subtitle"}))),t("div",{key:"96358bf7ed34907a799efd8c6fb2caae6ca02f43",class:"s-list-tile-item-action"},t("slot",{key:"8d496724103f0c3959845c8f5d4e662a3095c09e",name:"action"}))))}};s.style="";export{s as salla_list_tile}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as s,c as t,h as i,H as e,a}from"./p-CrNw20pf.js";import{H as h}from"./p-CHf8XdiS.js";import{F as l}from"./p-DL4h2bc3.js";import"./p-CgtvEd63.js";const r=class{constructor(i){s(this,i),this.changed=t(this,"changed"),this.initialItemCount=10,this.expandedItemCount=15,this.calculatedInitialHeight=0,this.calculatedExpandedHeight=0,this.isOpen=!0,this.isShowMore=!1,this.showMoreLabel="عرض المزيد",this.showLessLabel="عرض أقل",this.page=salla.config.get("page"),this.searchQuery="",this.filteredCount=0}connectedCallback(){this.withLoadMore="price"!=this.option.key&&Array.isArray(this.option.values)&&this.option.values.length>this.initialItemCount,salla.onReady((()=>{this.page=salla.config.get("page")})),salla.lang.onLoaded((()=>{this.showMoreLabel=salla.lang.getWithDefault("common.titles.more",this.showMoreLabel),this.showLessLabel=salla.lang.getWithDefault("common.elements.show_less",this.showLessLabel)}))}componentDidLoad(){const s=this.widgetValues.querySelectorAll(".s-filters-label");if(s.length>0){const t=Math.min(this.initialItemCount,s.length);this.calculatedInitialHeight=35*this.initialItemCount,this.calculatedExpandedHeight=s.length>this.initialItemCount?35*this.expandedItemCount:35*t}this.widgetValues.scrollHeight<this.calculatedInitialHeight&&(this.withLoadMore=!1),this.withLoadMore&&this.widgetValues&&(this.widgetValues.style.maxHeight=`${this.calculatedInitialHeight}px`),this.widgetContent.style.height=`${this.widgetContent.scrollHeight}px`}async setWidgetHeight(s=250){this.widgetContent.removeAttribute("style"),setTimeout((()=>{this.widgetContent.style.height=this.widgetContent.scrollHeight+"px"}),s)}async reset(){this.option.type===l.RANGE&&this.priceRange.reset(),Array.from(this.host.querySelectorAll("input")).forEach((s=>s.checked=!1))}async showMore(){this.isShowMore=!this.isShowMore,this.widgetContent.style.height="auto",this.isShowMore||(this.widgetValues.scrollTop=0);const s=this.isShowMore?this.calculatedExpandedHeight:this.calculatedInitialHeight,t=this.searchQuery?this.filteredCount:Array.isArray(this.option.values)?this.option.values.length:0;this.widgetValues.style.maxHeight=`${s}px`,this.widgetValues.style.overflowY=this.isShowMore&&t>this.expandedItemCount?"auto":"hidden",setTimeout((()=>{this.widgetContent.style.height=`${this.widgetContent.scrollHeight}px`}),400)}async toggleWidget(){this.isOpen=!this.isOpen,h.toggleElementClassIf(this.widgetContent,"s-filters-widget-opened","s-filters-widget-closed",(()=>this.isOpen))}renderFilterOption(s){if(![l.VALUES,l.MINIMUM,l.VARIANTS].includes(s.type))return"";const t=s.values.filter((s=>{if(!this.searchQuery)return!0;const t="number"==typeof s?String(s):s?.value||s?.key||"";return String(t).toLowerCase().includes(this.searchQuery.toLowerCase())}));return this.filteredCount=t.length,0===t.length?i("div",{class:"s-filters-widget-empty-state"},salla.lang.get("common.elements.no_options")||"لا توجد نتائج"):t.map((t=>{let e="number"==typeof t?t:t.key||t.value;return i("label",{class:"s-filters-label",htmlFor:`${s.key}-option-${e}`,key:`${s.key}-option-${e}`},i("input",{id:`${s.key}-option-${e}`,name:s.key,type:"radio",checked:this.isSelectedOption(s,e),class:"s-filters-radio",onChange:t=>this.changed.emit({event:t,option:s,value:e})}),this.getOptionLabel(s,t))}))}isSelectedOption(s,t){return s.type===l.MINIMUM?this.filtersData[s.key]==t:s.type===l.VARIANTS?this.filtersData[s.type]&&this.filtersData[s.type][Object.keys(this.filtersData[s.type])[0]]==t:s.type===l.RANGE?this.filtersData[s.key]&&this.filtersData[s.key].min==t.min&&this.filtersData[s.key].max==t.max:s.type===l.VALUES&&this.filtersData[s.key]&&Number(this.filtersData[s.key])==Number(t)}getOptionLabel(s,t){return"rating"==s.key?i("salla-rating-stars",{size:"small",value:t}):i("span",{class:"s-filters-option-name"},t.value||"null")}render(){return i(e,{key:"a3377234cae7a9565f403d859e60ee71cb9b9e00",class:"s-filters-widget-container"},i("h3",{key:"d797565b06c795a6b19d5fa6c93da583e291cc01",class:"s-filters-widget-title",onClick:()=>this.toggleWidget()},i("span",{key:"35e933096973744c332cfb3a0346b57f7dd28a76"},this.option.label),i("span",{key:"2c27dacf5242da14f2cddca9f99af09bb9cb3bea",class:"s-filters-widget-plusminus "+(this.isOpen?"s-filters-widget-plusminus-active":"")})),i("div",{key:"6f85c5af558a2b47e9779225d2fb9b99d2dd78e5",class:"s-filters-widget-content",ref:s=>this.widgetContent=s},Array.isArray(this.option.values)&&this.option.values.length>5&&i("div",{key:"d6c9fe9baf08d095346d52e5e6836ca7a26dae7f",class:"s-filters-widget-search-wrapper",style:{padding:"8px 0",marginBottom:"8px"}},i("input",{key:"44ac9fc9e7488165acccbac8a7bd95a3f863dab8",type:"text",class:"s-filters-widget-search-input",placeholder:salla.lang.get("blocks.header.search_placeholder")||"بحث...",value:this.searchQuery,onInput:s=>this.searchQuery=s.target.value})),i("div",{key:"a8350384975504985098f0b9f1ae6c086537886b",class:"s-filters-widget-values",ref:s=>this.widgetValues=s},i("slot",{key:"20acece0e29070b6f1359ab1d3f16e928d461742"}),this.option.type!==l.RANGE?this.renderFilterOption(this.option):i("salla-price-range",{onChanged:s=>{this.changed.emit(s.detail)},ref:s=>this.priceRange=s,filtersData:this.filtersData,option:this.option})),this.withLoadMore&&(!this.searchQuery||this.filteredCount>this.initialItemCount)&&i("a",{key:"a628397d54fc254fe36458c4bbdca0dad0a0e6ad",class:"s-filters-widget-more",onClick:()=>this.showMore()},this.isShowMore?this.showLessLabel:this.showMoreLabel)))}get host(){return a(this)}};r.style=":host{display:block}";export{r as salla_filters_widget}
4
+ import{r as s,c as t,h as i,H as e,a}from"./p-Dimo1ZpU.js";import{H as h}from"./p-CHf8XdiS.js";import{F as l}from"./p-DL4h2bc3.js";import"./p-CgtvEd63.js";const r=class{constructor(i){s(this,i),this.changed=t(this,"changed"),this.initialItemCount=10,this.expandedItemCount=15,this.calculatedInitialHeight=0,this.calculatedExpandedHeight=0,this.isOpen=!0,this.isShowMore=!1,this.showMoreLabel="عرض المزيد",this.showLessLabel="عرض أقل",this.page=salla.config.get("page"),this.searchQuery="",this.filteredCount=0}connectedCallback(){this.withLoadMore="price"!=this.option.key&&Array.isArray(this.option.values)&&this.option.values.length>this.initialItemCount,salla.onReady((()=>{this.page=salla.config.get("page")})),salla.lang.onLoaded((()=>{this.showMoreLabel=salla.lang.getWithDefault("common.titles.more",this.showMoreLabel),this.showLessLabel=salla.lang.getWithDefault("common.elements.show_less",this.showLessLabel)}))}componentDidLoad(){const s=this.widgetValues.querySelectorAll(".s-filters-label");if(s.length>0){const t=Math.min(this.initialItemCount,s.length);this.calculatedInitialHeight=35*this.initialItemCount,this.calculatedExpandedHeight=s.length>this.initialItemCount?35*this.expandedItemCount:35*t}this.widgetValues.scrollHeight<this.calculatedInitialHeight&&(this.withLoadMore=!1),this.withLoadMore&&this.widgetValues&&(this.widgetValues.style.maxHeight=`${this.calculatedInitialHeight}px`),this.widgetContent.style.height=`${this.widgetContent.scrollHeight}px`}async setWidgetHeight(s=250){this.widgetContent.removeAttribute("style"),setTimeout((()=>{this.widgetContent.style.height=this.widgetContent.scrollHeight+"px"}),s)}async reset(){this.option.type===l.RANGE&&this.priceRange.reset(),Array.from(this.host.querySelectorAll("input")).forEach((s=>s.checked=!1))}async showMore(){this.isShowMore=!this.isShowMore,this.widgetContent.style.height="auto",this.isShowMore||(this.widgetValues.scrollTop=0);const s=this.isShowMore?this.calculatedExpandedHeight:this.calculatedInitialHeight,t=this.searchQuery?this.filteredCount:Array.isArray(this.option.values)?this.option.values.length:0;this.widgetValues.style.maxHeight=`${s}px`,this.widgetValues.style.overflowY=this.isShowMore&&t>this.expandedItemCount?"auto":"hidden",setTimeout((()=>{this.widgetContent.style.height=`${this.widgetContent.scrollHeight}px`}),400)}async toggleWidget(){this.isOpen=!this.isOpen,h.toggleElementClassIf(this.widgetContent,"s-filters-widget-opened","s-filters-widget-closed",(()=>this.isOpen))}renderFilterOption(s){if(![l.VALUES,l.MINIMUM,l.VARIANTS].includes(s.type))return"";const t=s.values.filter((s=>{if(!this.searchQuery)return!0;const t="number"==typeof s?String(s):s?.value||s?.key||"";return String(t).toLowerCase().includes(this.searchQuery.toLowerCase())}));return this.filteredCount=t.length,0===t.length?i("div",{class:"s-filters-widget-empty-state"},salla.lang.get("common.elements.no_options")||"لا توجد نتائج"):t.map((t=>{let e="number"==typeof t?t:t.key||t.value;return i("label",{class:"s-filters-label",htmlFor:`${s.key}-option-${e}`,key:`${s.key}-option-${e}`},i("input",{id:`${s.key}-option-${e}`,name:s.key,type:"radio",checked:this.isSelectedOption(s,e),class:"s-filters-radio",onChange:t=>this.changed.emit({event:t,option:s,value:e})}),this.getOptionLabel(s,t))}))}isSelectedOption(s,t){return s.type===l.MINIMUM?this.filtersData[s.key]==t:s.type===l.VARIANTS?this.filtersData[s.type]&&this.filtersData[s.type][Object.keys(this.filtersData[s.type])[0]]==t:s.type===l.RANGE?this.filtersData[s.key]&&this.filtersData[s.key].min==t.min&&this.filtersData[s.key].max==t.max:s.type===l.VALUES&&this.filtersData[s.key]&&Number(this.filtersData[s.key])==Number(t)}getOptionLabel(s,t){return"rating"==s.key?i("salla-rating-stars",{size:"small",value:t}):i("span",{class:"s-filters-option-name"},t.value||"null")}render(){return i(e,{key:"a3377234cae7a9565f403d859e60ee71cb9b9e00",class:"s-filters-widget-container"},i("h3",{key:"d797565b06c795a6b19d5fa6c93da583e291cc01",class:"s-filters-widget-title",onClick:()=>this.toggleWidget()},i("span",{key:"35e933096973744c332cfb3a0346b57f7dd28a76"},this.option.label),i("span",{key:"2c27dacf5242da14f2cddca9f99af09bb9cb3bea",class:"s-filters-widget-plusminus "+(this.isOpen?"s-filters-widget-plusminus-active":"")})),i("div",{key:"6f85c5af558a2b47e9779225d2fb9b99d2dd78e5",class:"s-filters-widget-content",ref:s=>this.widgetContent=s},Array.isArray(this.option.values)&&this.option.values.length>5&&i("div",{key:"d6c9fe9baf08d095346d52e5e6836ca7a26dae7f",class:"s-filters-widget-search-wrapper",style:{padding:"8px 0",marginBottom:"8px"}},i("input",{key:"44ac9fc9e7488165acccbac8a7bd95a3f863dab8",type:"text",class:"s-filters-widget-search-input",placeholder:salla.lang.get("blocks.header.search_placeholder")||"بحث...",value:this.searchQuery,onInput:s=>this.searchQuery=s.target.value})),i("div",{key:"a8350384975504985098f0b9f1ae6c086537886b",class:"s-filters-widget-values",ref:s=>this.widgetValues=s},i("slot",{key:"20acece0e29070b6f1359ab1d3f16e928d461742"}),this.option.type!==l.RANGE?this.renderFilterOption(this.option):i("salla-price-range",{onChanged:s=>{this.changed.emit(s.detail)},ref:s=>this.priceRange=s,filtersData:this.filtersData,option:this.option})),this.withLoadMore&&(!this.searchQuery||this.filteredCount>this.initialItemCount)&&i("a",{key:"a628397d54fc254fe36458c4bbdca0dad0a0e6ad",class:"s-filters-widget-more",onClick:()=>this.showMore()},this.isShowMore?this.showLessLabel:this.showMoreLabel)))}get host(){return a(this)}};r.style=":host{display:block}";export{r as salla_filters_widget}
@@ -0,0 +1,4 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ import{r as s,h as t,H as e,a as i}from"./p-Dimo1ZpU.js";const a=class{constructor(t){s(this,t),this.isVisible=!0,this.isMobile=!1,this.mobileBreakpoint=768,this.mobileQueryHandler=s=>this.isMobile=s.matches,this.openRequestedHandler=()=>this.open(),this.selectedConsent="rejected"}async componentWillLoad(){await Salla.onReady(),await Salla.lang.onLoaded(),this.loadTranslations(),this.selectedConsent=this.getStoredConsentChoice(),Salla.event.on("salla-cookies-bar::open",this.openRequestedHandler),this.unregisterAfterFetchMenuItemsHook=Salla.hooks.registerHook("salla-menu","afterFetchMenuItems",(s=>this.appendCookiesSettingsLink(s))),Salla.storage.get("cookies-consent")&&(this.isVisible=!1)}loadTranslations(){this.messageLabel=Salla.lang.get("common.cookies.message"),this.linkLabel=Salla.lang.get("common.cookies.link"),this.acceptLabel=Salla.lang.get("common.cookies.accept"),this.rejectLabel=Salla.lang.get("common.cookies.reject")}componentDidLoad(){this.mobileQuery=window.matchMedia(`(max-width: ${this.mobileBreakpoint-1}px)`),this.isMobile=this.mobileQuery.matches,this.mobileQuery.addEventListener("change",this.mobileQueryHandler)}disconnectedCallback(){this.mobileQuery?.removeEventListener("change",this.mobileQueryHandler),Salla.event.off("salla-cookies-bar::open",this.openRequestedHandler),this.unregisterAfterFetchMenuItemsHook?.(),this.unregisterAfterFetchMenuItemsHook=void 0}async accept(){return this.selectedConsent="accepted",this.isVisible=!1,Salla.event.emit("salla-cookies-bar::accepted"),Salla.storage.set("cookies-consent","accepted"),this.host}async reject(){return this.selectedConsent="rejected",this.isVisible=!1,Salla.event.emit("salla-cookies-bar::rejected"),Salla.storage.set("cookies-consent","rejected"),this.host}async open(){return this.selectedConsent=this.getStoredConsentChoice(),this.isVisible=!0,this.host}getStoredConsentChoice(){const s=Salla.storage.get("cookies-consent");return"accepted"===s||"rejected"===s?s:"rejected"}isRtl(){return Salla.config.get("theme.is_rtl",!0)}appendCookiesSettingsLink(s){const t=Salla.config.get("store.features")?.includes("website-cookies");if(!t||!s?.withCookiePreferences||"footer"!==s?.source)return;const e="#cookies-settings",i=s?.menus.some((s=>s?.url===e));i||(s.menus=[...s.menus,{id:"cookies-settings",order:null,title:Salla.lang.get("common.cookies.settings"),url:e,target:"_self",is_by_form_builder:!1,children:[],image:null,callback:()=>Salla.event.emit("salla-cookies-bar::open")}])}render(){return this.isVisible?t(e,null,t("div",{dir:this.isRtl()?"rtl":"ltr",class:"s-cookies-bar fixed bottom-0 inset-x-0 z-50 bg-white p-4"},t("div",{class:"s-cookies-bar-content flex flex-col justify-center gap-6 max-w-screen-xl mx-auto px-4"},t("p",{class:"s-cookies-bar-message text-sm font-medium leading-relaxed text-gray-500 m-0"},this.messageLabel,Salla.config.get("policy_url")&&t("a",{href:Salla.config.get("policy_url"),target:"_blank",class:"s-cookies-bar-link text-primary ms-1"},this.linkLabel)),t("div",{class:"s-cookies-bar-actions flex flex-row gap-2 shrink-0"},t("salla-button",{class:"s-cookies-bar-btn--accept "+("rejected"===this.selectedConsent?"s-cookies-bar-btn--active":""),color:"primary",fill:"rejected"===this.selectedConsent?"solid":"outline",type:"button",size:this.isMobile?"small":"medium",onClick:()=>this.accept()},this.acceptLabel),t("salla-button",{class:"s-cookies-bar-btn--reject "+("accepted"===this.selectedConsent?"s-cookies-bar-btn--active":""),color:"accepted"===this.selectedConsent?"primary":void 0,fill:"accepted"===this.selectedConsent?"solid":"outline",type:"button",size:this.isMobile?"small":"medium",onClick:()=>this.reject()},this.rejectLabel))))):t(e,null)}get host(){return i(this)}};a.style=":host{display:block;overflow:visible}.s-cookies-bar{box-shadow:0 0 20px 4px rgba(0, 0, 0, 0.15)}.s-cookies-bar-btn--active{box-shadow:0 0 0 2px rgba(0, 0, 0, 0.08)}";export{a as salla_cookies_bar}
@@ -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}from"./p-CrNw20pf.js";import{a}from"./p-C8xwacGT.js";import"./p-CoQJOPRz.js";const r=class{constructor(i){t(this,i),this.orderItemUpdated=s(this,"orderItemUpdated"),this.orderItemRemoved=s(this,"orderItemRemoved"),this.quantityInput=null,this.productOptions=null,this.handleQuantityChange=t=>{const s=t.detail,i=s?.quantity??parseInt(t.target.value,10);isNaN(i)||i<1||i!==this.quantity&&(this.quantity=i,this.emitUpdate(i))},this.handleOptionsChange=()=>{this.emitUpdate(this.quantity)}}componentWillLoad(){this.quantity=this.item?.quantity||1}handleItemChange(t){const s=t?.quantity||1;s!==this.quantity&&(this.quantity=s,this.quantityInput?.setValue?.(s,!1))}get hasOptions(){return(this.item.product?.options?.length||0)>0}async getSelectedOptions(){return await(this.productOptions?.getSelectedOptionsData?.())||{}}async getOptionsData(){return await(this.productOptions?.getOptionsData?.())||this.item.product?.options||[]}async emitUpdate(t){const s=this.item?.id;if(null==s)return;const i={itemId:s,quantity:t};this.hasOptions&&(i.options=await this.getSelectedOptions(),i.optionDefinitions=await this.getOptionsData()),this.orderItemUpdated.emit(i)}removeItem(){const t=this.item?.id;null!=t&&this.orderItemRemoved.emit({itemId:t})}render(){if(!this.item)return null;const t=this.item.product,s=this.item.name||t?.name||"",r=t?.image?.url||"",n=t?.image?.alt||s,l=t?.url||"#",o=t?.price,h=a(t),d=t?.weight_label,c=this.item.product?.options,m=`order-edit-item-${this.item.id}-${t?.id}`,u={value:this.quantity};return h&&(u.max=h),i(e,null,i("div",null,i("div",{class:"s-order-edit-item-header"},i("div",{class:"s-order-edit-item-media"},r&&i("a",{href:l},i("img",{src:r,alt:n,class:"s-order-edit-item-image"})),i("div",{class:"s-order-edit-item-details"},i("h2",{class:"s-order-edit-item-name"},i("a",{href:l,class:"s-order-edit-item-link"},s)),null!=o&&i("span",{class:"s-order-edit-item-price",innerHTML:salla.money(o)}),d&&i("p",{class:"s-order-edit-item-weight"},salla.lang.getWithDefault("pages.products.weight","الوزن")," ",d))),i("salla-button",{type:"button",shape:"icon",size:"small",color:"danger","aria-label":salla.lang.getWithDefault("common.elements.delete","حذف"),onClick:()=>this.removeItem()},i("i",{class:"sicon-cancel"}))),i("div",{class:"s-order-edit-item-quantity"},i("h3",{class:"s-order-edit-item-quantity-label"},salla.lang.getWithDefault("common.elements.quantity","الكمية")),i("div",{class:"s-order-edit-item-quantity-input"},i("salla-quantity-input",{ref:t=>this.quantityInput=t,...u,onChange:this.handleQuantityChange}))),this.hasOptions&&i("form",{class:"s-order-edit-item-options",onSubmit:t=>t.preventDefault()},i("salla-product-options",{ref:t=>this.productOptions=t,onChange:this.handleOptionsChange,"product-id":t.id,"unique-key":m,options:JSON.stringify(c),key:`${m}-options`}))))}static get watchers(){return{item:["handleItemChange"]}}};r.style=":host{display:block}";export{r as salla_order_edit_item}
4
+ import{r as t,c as s,h as i,H as e}from"./p-Dimo1ZpU.js";import{a}from"./p-C8xwacGT.js";import"./p-CoQJOPRz.js";const r=class{constructor(i){t(this,i),this.orderItemUpdated=s(this,"orderItemUpdated"),this.orderItemRemoved=s(this,"orderItemRemoved"),this.quantityInput=null,this.productOptions=null,this.handleQuantityChange=t=>{const s=t.detail,i=s?.quantity??parseInt(t.target.value,10);isNaN(i)||i<1||i!==this.quantity&&(this.quantity=i,this.emitUpdate(i))},this.handleOptionsChange=()=>{this.emitUpdate(this.quantity)}}componentWillLoad(){this.quantity=this.item?.quantity||1}handleItemChange(t){const s=t?.quantity||1;s!==this.quantity&&(this.quantity=s,this.quantityInput?.setValue?.(s,!1))}get hasOptions(){return(this.item.product?.options?.length||0)>0}async getSelectedOptions(){return await(this.productOptions?.getSelectedOptionsData?.())||{}}async getOptionsData(){return await(this.productOptions?.getOptionsData?.())||this.item.product?.options||[]}async emitUpdate(t){const s=this.item?.id;if(null==s)return;const i={itemId:s,quantity:t};this.hasOptions&&(i.options=await this.getSelectedOptions(),i.optionDefinitions=await this.getOptionsData()),this.orderItemUpdated.emit(i)}removeItem(){const t=this.item?.id;null!=t&&this.orderItemRemoved.emit({itemId:t})}render(){if(!this.item)return null;const t=this.item.product,s=this.item.name||t?.name||"",r=t?.image?.url||"",n=t?.image?.alt||s,l=t?.url||"#",o=t?.price,h=a(t),d=t?.weight_label,c=this.item.product?.options,m=`order-edit-item-${this.item.id}-${t?.id}`,u={value:this.quantity};return h&&(u.max=h),i(e,null,i("div",null,i("div",{class:"s-order-edit-item-header"},i("div",{class:"s-order-edit-item-media"},r&&i("a",{href:l},i("img",{src:r,alt:n,class:"s-order-edit-item-image"})),i("div",{class:"s-order-edit-item-details"},i("h2",{class:"s-order-edit-item-name"},i("a",{href:l,class:"s-order-edit-item-link"},s)),null!=o&&i("span",{class:"s-order-edit-item-price",innerHTML:salla.money(o)}),d&&i("p",{class:"s-order-edit-item-weight"},salla.lang.getWithDefault("pages.products.weight","الوزن")," ",d))),i("salla-button",{type:"button",shape:"icon",size:"small",color:"danger","aria-label":salla.lang.getWithDefault("common.elements.delete","حذف"),onClick:()=>this.removeItem()},i("i",{class:"sicon-cancel"}))),i("div",{class:"s-order-edit-item-quantity"},i("h3",{class:"s-order-edit-item-quantity-label"},salla.lang.getWithDefault("common.elements.quantity","الكمية")),i("div",{class:"s-order-edit-item-quantity-input"},i("salla-quantity-input",{ref:t=>this.quantityInput=t,...u,onChange:this.handleQuantityChange}))),this.hasOptions&&i("form",{class:"s-order-edit-item-options",onSubmit:t=>t.preventDefault()},i("salla-product-options",{ref:t=>this.productOptions=t,onChange:this.handleOptionsChange,"product-id":t.id,"unique-key":m,options:JSON.stringify(c),key:`${m}-options`}))))}static get watchers(){return{item:["handleItemChange"]}}};r.style=":host{display:block}";export{r as salla_order_edit_item}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as s,h as t}from"./p-CrNw20pf.js";import{a as i}from"./p-CgtvEd63.js";import{a as e}from"./p-BedNk7k1.js";import{S as a}from"./p-8Tsmrwno.js";import{S as l}from"./p-0-eTJXSD.js";const h=class{constructor(t){s(this,t),this.defaultEvent="gifting:open",this.selectImageForYourGift=salla.lang.get("blocks.buy_as_gift.select_image_or_upload"),this.currentStep=1,this.showCalendar=!1,this.showGiftText=!1,this.currentLang="",this.parentClass="is-current-step-1",this.errors={},this.gift=void 0,this.selectedGiftTextOption=void 0,this.selectedCountryId=void 0,this.selectedCountryCode=void 0,this.loadingCities=!1,this.loadingRegions=!1,this.regions=[],this.selectedRegionId=void 0,this.isKSA=!1,this.selectedCountry=null,this.selectedRegion=null,this.displayedCities=[],this.selectedCity=null,this.searchingCities=!1,this.enableCityAjaxSearch=!1,this.citySearchQuery="",this.step2Animated=!1,this.citySearchTimer=null,this.citySearchCounter=0,this.locationRequestCounter=0,this.showTextArea=!1,this.selectedImage=void 0,this.uploadedImage=void 0,this.selectedText=void 0,this.hasError=!1,this.timeZone=null,this.receiverCountryCode=salla.config.get("store.scope.countries")?.[0]||salla.config.get("store.store_country")||"SA",this.hostId=`salla-gifting-${Math.random().toString(36).slice(2,10)}`,this.formSelector="form.product-form, form.form--product-options",this.handleCitySearch=s=>{if(this.citySearchQuery=s,!this.enableCityAjaxSearch)return;this.citySearchTimer&&clearTimeout(this.citySearchTimer);const t=++this.citySearchCounter;this.citySearchTimer=setTimeout((async()=>{this.searchingCities=!0;try{const i=await this.fetchCities(s);t===this.citySearchCounter&&(this.displayedCities=i)}catch(s){t===this.citySearchCounter&&(this.displayedCities=[])}finally{t===this.citySearchCounter&&(this.searchingCities=!1)}}),h.CITY_SEARCH_DEBOUNCE_MS)},this.handleCitySelected=s=>{this.selectedCity=s,this.receiverCity=String(s.id),this.clearError("receiver.city_id")},this.handleCityDropdownClosed=()=>{this.citySearchQuery="",this.citySearchTimer&&(clearTimeout(this.citySearchTimer),this.citySearchTimer=null),++this.citySearchCounter,this.displayedCities=this.gift?.cities??[],this.searchingCities=!1},this.handleCountryDropdownClosed=()=>{},this.handleRegionDropdownClosed=()=>{},salla.lang.onLoaded((()=>{this.selectImageOrUpload=salla.lang.get("blocks.buy_as_gift.select_image_or_upload"),this.selectImageForYourGift=salla.lang.get("blocks.buy_as_gift.select_image_for_your_gift"),this.sectionTitle=salla.lang.get("blocks.buy_as_gift.gift_the_one_you_love"),this.sectionSubtitle=salla.lang.get("blocks.buy_as_gift.gift_the_one_you_love_message"),this.sectionBtnText=salla.lang.get("blocks.buy_as_gift.send_as_a_gift"),this.giftDetails=salla.lang.get("blocks.buy_as_gift.gift_details"),this.selectGiftMessage=salla.lang.get("blocks.buy_as_gift.select_gift_message"),this.giftCustomText=salla.lang.get("blocks.buy_as_gift.gift_custom_text"),this.textId=salla.lang.get("blocks.buy_as_gift.text_id"),this.incorrectGiftText=salla.lang.get("blocks.buy_as_gift.incorrect_gift_text"),this.nextStep=salla.lang.get("blocks.buy_as_gift.next_step"),this.senderNameLabel=salla.lang.get("blocks.buy_as_gift.sender_name"),this.receiverNameFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_name"),this.receiverMobileFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_mobile"),this.receiverCountryFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_country"),this.ksa=salla.lang.get("pages.checkout.ksa"),this.selectCity=salla.lang.get("pages.checkout.select_city"),this.selectCountry=salla.lang.get("pages.checkout.select_country"),this.selectCityInfo=salla.lang.get("blocks.buy_as_gift.city_info"),this.receiverCityFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_city"),this.receiverRegionFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_region")||salla.lang.get("pages.checkout.region"),this.selectRegion=salla.lang.get("pages.checkout.select_region"),this.receiverEmailFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_email"),this.emailPlaceholder=salla.lang.get("common.elements.email_placeholder"),this.sendLater=salla.lang.get("blocks.buy_as_gift.send_later"),this.selectSendDateAndTime=salla.lang.get("blocks.buy_as_gift.select_send_date_and_time"),this.canNotEditOrderAfterSelectDate=salla.lang.get("blocks.buy_as_gift.can_not_edit_order_after_select_date"),this.sendGift=salla.lang.get("blocks.buy_as_gift.send_gift"),this.donationRequired=salla.lang.get("pages.products.donation_amount_required"),this.currentLang=salla.lang.locale})),salla.event.on(this.defaultEvent,(()=>{this.open()}))}isPhysical(){return this.physicalProducts||this.physical}componentDidLoad(){salla.event.product.onPriceUpdated((()=>{const s=document.querySelector(".s-quantity-input-input");this.quantity=s?.value}))}getFormDataFromForm(){if(!this.formSelector)return null;const s=document.querySelector(this.formSelector);return s?new FormData(s):null}mergeObjectToFormData(s,t,i){for(let e in s){if(!s.hasOwnProperty(e)||null==s[e])continue;const a=i?`${i}[${e}]`:e;"object"!=typeof s[e]||null===s[e]||s[e]instanceof File?t.set(a,s[e]):this.mergeObjectToFormData(s[e],t,a)}return t}async open(){if(salla.config.isGuest())return salla.api.auth.setAfterLoginEvent(this.defaultEvent),void salla.event.dispatch("login::open",{withoutReload:!0});await this.modal.open();const s=this.productId?()=>salla.product.getGiftProductDetails(this.productId):()=>salla.cart.getGiftCartDetails();return await salla.api.withoutNotifier(s).then((s=>{this.gift=s.data,this.senderName=this.gift.sender_name})).catch((s=>{this.hasError=!0,this.errorMessage=s.response?.data?.error?.message||s.response?.data})).finally((()=>this.modal.stopLoading()))}async close(){return this.modal.close()}async setWrapperHeight(s=1,t=250,i=0,e=0){let a=document.querySelector(`#${this.hostId} .gift-step-${s}`);const l=()=>{this.stepsWrapper.style.height=e?`${e}px`:a.offsetHeight+i+"px"};this.step2Animated&&2===s?requestAnimationFrame(l):setTimeout(l,t)}toggleCalendar(){this.showCalendar=!this.showCalendar,this.setWrapperHeight(2,150,0)}toggleGiftText(s){this.textSelect?.classList.remove("s-form-has-error");let t=s.target.children[s.target.selectedIndex].getAttribute("data-id"),i="custom"==t;this.showGiftText=i,t?(this.selectedGiftTextOption=t,this.selectedText=i?void 0:s.target.value,this.setWrapperHeight(1,150,5)):(this.textArea.value="",this.selectedText=void 0,this.selectedGiftTextOption=void 0,this.setWrapperHeight(1,150,-15))}async goToStep2(){return this.selectedGiftTextOption?"custom"!=this.selectedGiftTextOption||this.selectedText?(this.textSelect.classList.remove("s-form-has-error"),this.customTextArea.classList.remove("s-form-has-error"),this.setWrapperHeight(2,600,0),(new i.timeline).add({targets:this.step1Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[1,0],translateX:[0,50],delay:i.stagger(70),duration:1200}).add({targets:".gift-step-2",translateX:["-110%",0],opacity:[0,1]},"-=1800").add({targets:this.step2Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[0,1],translateX:[-50,0],delay:i.stagger(70),duration:1200,complete:()=>{this.step2Elems.querySelectorAll(`#${this.hostId} .anime-item`).forEach((s=>{s.classList.remove("opacity-0"),s.removeAttribute("style")})),this.step2Animated=!0}},"-=1200"),this.currentStep=2,void(this.parentClass=`is-current-step-${this.currentStep}`)):(this.textSelect.classList.remove("s-form-has-error"),void this.customTextArea.classList.add("s-form-has-error")):(this.textSelect.classList.add("s-form-has-error"),void this.customTextArea.classList.remove("s-form-has-error"))}goToStep1(s){s.preventDefault();let t=new i.timeline({autoplay:!1});t.add({targets:this.step2Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[1,0],translateX:[0,-50],delay:i.stagger(70),duration:1200}).add({targets:".gift-step-1",translateX:["110%",0],opacity:[0,1]},"-=1800").add({targets:this.step1Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[0,1],translateX:[50,0],delay:i.stagger(70),duration:1200,complete:()=>{this.step1Elems.querySelectorAll(`#${this.hostId} .anime-item`).forEach((s=>{s.classList.remove("opacity-0"),s.removeAttribute("style")}))}},"-=1200"),t.play(),this.step2Animated=!1,this.setWrapperHeight(1,600,0),this.currentStep=1,this.parentClass=`is-current-step-${this.currentStep}`}getFilepondPlaceholder(){return`<div class="s-gifting-filepond-placeholder"><span class="s-gifting-filepond-placeholder-icon"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>images</title>\n<path d="M22.667 29.333h-13.333c-3.676 0-6.667-2.991-6.667-6.667v-13.333c0-0.737-0.597-1.333-1.333-1.333s-1.333 0.596-1.333 1.333v13.333c0 5.145 4.187 9.333 9.333 9.333h13.333c0.736 0 1.333-0.596 1.333-1.333s-0.597-1.333-1.333-1.333zM22.667 5.333c-2.205 0-4 1.795-4 4s1.795 4 4 4 4-1.795 4-4-1.795-4-4-4zM22.667 10.667c-0.735 0-1.333-0.597-1.333-1.333s0.599-1.333 1.333-1.333 1.333 0.597 1.333 1.333-0.599 1.333-1.333 1.333zM25.333 0h-13.333c-3.676 0-6.667 2.991-6.667 6.667v13.333c0 1.055 0.268 2.040 0.707 2.927 0.039 0.099 0.088 0.188 0.151 0.277 1.137 2.053 3.301 3.463 5.809 3.463h13.333c3.676 0 6.667-2.991 6.667-6.667v-13.333c0-3.676-2.991-6.667-6.667-6.667zM12 24c-1.244 0-2.344-0.583-3.077-1.476l5.721-7.047 6.629 8.523zM29.333 20c0 2.205-1.795 4-4 4h-0.68l-8.933-11.485c-0.251-0.32-0.633-0.511-1.039-0.515h-0.015c-0.401 0-0.781 0.181-1.035 0.492l-5.632 6.935v-12.76c0-2.205 1.795-4 4-4h13.333c2.205 0 4 1.795 4 4z"></path>\n</svg>\n</span><p class="s-gifting-filepond-placeholder-text">${this.selectImageOrUpload?this.selectImageOrUpload:""}</p></div>`}setPreview(s){this.uploader?.classList.add("has-bg");var t=document.querySelector(`#${this.hostId}.filepond-bg`)?document.querySelector(`#${this.hostId} .filepond-bg`):document.createElement("div");t.classList.add("filepond-bg"),t.classList.remove("s-hidden"),t.style.backgroundImage="url('"+s.url+"')",this.uploader?.querySelector(".filepond--root")?.appendChild(t),this.uploadedImage=s.url,this.gift&&this.gift.gift_images.length&&this.setWrapperHeight(1,150,0)}removePreview(){this.uploader.classList.remove("has-bg");let s=document.querySelector(`#${this.hostId} .filepond-bg`);s.removeAttribute("style"),s.classList.add("s-hidden"),this.handleRemoveImage()}handleTextAreaChange(s){this.selectedText=s.target.value,this.customTextArea.classList.remove("s-form-has-error")}clearError(s){if(this.errors?.[s]){const{[s]:t,...i}=this.errors;this.errors=i}}handleSenderName(s){this.senderName=s.target.value,this.clearError("sender_name")}handleReceiverName(s){this.receiverName=s.target.value,this.clearError("receiver.name")}resetCityState(){this.citySearchTimer&&(clearTimeout(this.citySearchTimer),this.citySearchTimer=null),++this.citySearchCounter,this.gift={...this.gift,cities:[]},this.displayedCities=[],this.receiverCity=void 0,this.selectedCity=null,this.citySearchQuery="",this.searchingCities=!1,this.enableCityAjaxSearch=!1}setInitialCities(s){this.gift={...this.gift,cities:s},this.displayedCities=s,this.enableCityAjaxSearch=s.length>=h.CITY_AJAX_THRESHOLD}async fetchCities(s=""){if(!this.selectedCountryId)return[];if(this.isKSA&&!this.selectedRegionId)return[];const t=["for_branch=0",`country_id=${this.selectedCountryId}`];this.isKSA&&this.selectedRegionId&&t.push(`region_id=${this.selectedRegionId}`),s?.trim()&&t.push(`query=${encodeURIComponent(s.trim())}`);const i=await salla.api.request(`shipping/cities?${t.join("&")}`);return i?.data??[]}async handleCountrySelected(s){const t=s?.id;this.selectedCountry=s??null,this.selectedCountryId=t,this.selectedCountryCode=s?.country_code,this.isKSA="SA"===s?.country_code,this.clearError("receiver.country"),this.regions=[],this.selectedRegionId=void 0,this.selectedRegion=null,this.resetCityState();const i=++this.locationRequestCounter;if(!t)return this.selectedCountryCode=void 0,this.isKSA=!1,void this.setWrapperHeight(2,0,0);if(this.isKSA){this.loadingRegions=!0,this.setWrapperHeight(2,0,0);try{const s=await salla.api.request(`shipping/countries/${t}/regions`);if(i!==this.locationRequestCounter)return;s&&s.data&&(this.regions=s.data)}catch(s){if(i!==this.locationRequestCounter)return;console.error("Error fetching regions:",s)}finally{i===this.locationRequestCounter&&(this.loadingRegions=!1,this.setWrapperHeight(2,0,0))}}else{this.loadingCities=!0,this.setWrapperHeight(2,0,0);try{const s=await this.fetchCities();if(i!==this.locationRequestCounter)return;this.setInitialCities(s)}catch(s){if(i!==this.locationRequestCounter)return;console.error("Error fetching cities:",s)}finally{i===this.locationRequestCounter&&(this.loadingCities=!1)}}}async handleRegionSelected(s){const t=s?.id;this.selectedRegion=s??null,this.selectedRegionId=t,this.clearError("receiver.region"),this.resetCityState();const i=++this.locationRequestCounter;if(t){this.loadingCities=!0;try{const s=await this.fetchCities();if(i!==this.locationRequestCounter)return;this.setInitialCities(s)}catch(s){if(i!==this.locationRequestCounter)return;console.error("Error fetching cities:",s)}finally{i===this.locationRequestCounter&&(this.loadingCities=!1,this.setWrapperHeight(2,0,0))}}}handleUploadImage(s){this.uploadedImage=s,this.gift&&this.gift.gift_images.length&&this.setWrapperHeight(1,150,0)}handleRemoveImage(){this.uploadedImage="",this.gift&&this.gift.gift_images.length&&this.setWrapperHeight(1,150,0)}handlePhoneInputChange(s){let t=s.detail;this.receiverMobile=t.number,this.receiverCountryCode=t.country_code,this.clearError("receiver.mobile")}handleDateTimePicker(s){this.deliveryDate=s.detail}getCalendarClasses(){return{"s-form-group":!0,"anime-item":!0,"s-gifting-calendar":!0,shown:this.showCalendar,hide:!this.showCalendar,"s-form-has-error":!!this.errors&&this.errors.deliver_at}}async submitForm(){const s=document.querySelector("#donating-amount")?.value;if(this.calendarFormGroup.classList.remove("s-form-has-error"),this.errors&&(this.errors={},this.setWrapperHeight(2,150,0)),this.showCalendar&&!this.deliveryDate)return void this.calendarFormGroup.classList.add("s-form-has-error");const t=[{key:"sender_name",value:this.senderName,label:this.senderNameLabel},{key:"receiver.name",value:this.receiverName,label:this.receiverNameFieldLabel},{key:"receiver.mobile",value:this.receiverMobile,label:this.receiverMobileFieldLabel},...this.isPhysical()?[{key:"receiver.country",value:this.selectedCountryId,label:this.receiverCountryFieldLabel},...this.isKSA?[{key:"receiver.region",value:this.selectedRegionId,label:this.receiverRegionFieldLabel}]:[],{key:"receiver.city_id",value:this.receiverCity,label:this.receiverCityFieldLabel}]:[]],i={};if(t.forEach((({key:s,value:t,label:e})=>{t||(i[s]=salla.lang.get("common.errors.field_required",{attribute:e}))})),Object.keys(i).length)return this.errors=i,void this.setWrapperHeight(2,150,0);const e={text:this.selectedText,sender_name:this.senderName,quantity:this.quantity,deliver_at:this.showCalendar?this.deliveryDate:null,image_url:this.uploadedImage??this.selectedImage,donation_amount:s||null,receiver:{name:this.receiverName,mobile_country_code:this.receiverCountryCode,mobile:this.receiverMobile,...this.isPhysical()&&this.selectedCountryCode?{country_code:this.selectedCountryCode}:{},...this.isPhysical()&&this.selectedRegionId?{region_id:this.selectedRegionId}:{},...this.receiverCity&&this.isPhysical()?{city_id:this.receiverCity}:{}},has_apple_pay:salla.helpers.hasApplePay()};let a;this.productId&&this.formSelector&&(a=this.getFormDataFromForm()||new FormData,a=this.mergeObjectToFormData(e,a));const l=this.productId?()=>salla.product.addProductGiftToCart(this.productId,a,!0):()=>salla.cart.addCartGiftToCart(e,!0);return await l().then((()=>this.modal.close())).catch((s=>{s.response&&422==s.response.status?this.errors=s.response.data.error.fields:console.log(s),this.setWrapperHeight(2,150,0)}))}step2ItemClass(s=""){const t="anime-item"+(this.step2Animated?"":" opacity-0");return s?`${s} ${t}`:t}generateClass(){return{"s-gifting-widget":!0,"s-gifting-widget-vertical":!!this.vertical,"s-gifting-widget-horizontal":!this.vertical}}async handleGiftButtonClick(){if(this.productId&&this.formSelector){const s=document.querySelector(this.formSelector);if(!s)return void console.error("SallaGifting:: Form not found in the document!");if(!(s instanceof HTMLFormElement))return void console.error("SallaGifting:: The specified selector does not correspond to a form tag!");if(!s.reportValidity())return console.error("SallaGifting:: Form is not valid!"),void salla.error(salla.lang.get("common.messages.required_fields"))}const s=document.querySelector(`salla-product-options[product-id="${this.productId}"]`);!s||await s.reportValidity()?this.open():salla.error(salla.lang.get("common.messages.required_fields"))}render(){return[t("div",{key:"db700f9ec96a6974f3b815bb017ebe97ae8fe5c0"},t("salla-list-tile",{key:"1e2fd1c0b375c85fcd4af1ea071c36879e6913c5",class:this.generateClass()},t("div",{key:"a9d02c933bc13bf8765e7e91ce08b2c9495954e5",slot:"title"},this.vertical?t("span",{innerHTML:l}):"",t("h3",{key:"56bd850368806c6ed5770ea5f6b0339749a77dfa"},this.widgetTitle?this.widgetTitle:this.sectionTitle)),t("div",{key:"fbb4940fd3e3578f2f5a479d9d44be8dfbda7e43",slot:"subtitle"},t("div",{key:"fb7e8532984fbfc6fd61c55a6d44d7cdbb4bc9a2"},this.widgetSubtitle?this.widgetSubtitle:this.sectionSubtitle)),t("div",{key:"04f27f1ddbfa0b06be111b6c3176fbda5ea6d43a",slot:"action"},t("salla-button",{key:"fe71a1a773e5275ede7d1b3ea535c330688028b7",color:"primary",fill:"outline",width:"wide",class:"s-gifting-widget-action",onClick:()=>this.handleGiftButtonClick()},t("slot",{key:"d62127d30254df2d8add55e0e1dbcfefb686e359",name:"widget-btn-content"},t("div",{key:"5ddbb695af142baf3bb6986627f97a7a7607eb31",class:"s-gifting-widget-action-content"},t("span",{key:"7820fb6abd9d7a9c1035c0f80191a3ff2a4c5fe8",innerHTML:l}),"  ",t("span",{key:"2cfc69862d3d087375efaed3bcec0ff0c1587989"},this.sectionBtnText)))))),t("salla-modal",{key:"32c19391248ba6186f43fea59493171079e7bf07",id:this.hostId,isLoading:!0,class:"s-gifting-modal",width:"sm",ref:s=>this.modal=s},t("div",{key:"e4b5829416314f25793158dae0c530b8057b4085",slot:"loading"},t("div",{key:"6ee873add5868f105b7ec7291c2a8c8fc033c588",class:"s-gifting-skeleton"},t("div",{key:"40aae38f8b2d62b434394811a3ef6d8bc00f6f32",class:"s-gifting-modal-header"},t("salla-skeleton",{key:"a652cd74a16d0db662ea4a518ebfab366a3c3899",type:"circle",height:"5rem",width:"5rem"}),t("h2",{key:"edb4a1477893246e98207aeba7bfb5af686f20b9",class:"s-gifting-modal-title"},t("div",{key:"83ef942b15450cc59ad32d8c5b3ba43a32bcb29c",class:"s-gifting-modal-badge-wrapper"},t("salla-skeleton",{key:"d9041c777a2fa0aa7ffc752958c7441916a02f85",height:"15px",width:"150px"})))),t("div",{key:"fe3bb9dad01becba87486c4886037fd67b059919",class:"s-gifting-skeleton-content"},t("salla-skeleton",{key:"08bd8304b66264b70f6df68e64da3560a1f75461",height:"10px",width:"150px"}),t("salla-skeleton",{key:"bbea0d7ff0c846897af2ef5d3696b252a2f4e662",height:"230px"}),t("salla-skeleton",{key:"8cb1fde02e31a1accabd2e26409983e7ba56eeb1",height:"10px",width:"150px"}),t("salla-skeleton",{key:"f80a986b953278bac41505506adf8d611566a167",height:"30px"}),t("salla-skeleton",{key:"f7eccce69b619de385872642e1fb62b2cf6c3082",height:"40px"})))),t("slot",{key:"d299e46040193b441f8171d05e0048849e3df8d5",name:"header"}),this.hasError?t("salla-placeholder",{alignment:"center"},t("span",{slot:"title"},this.errorMessage||salla.lang.get("common.errors.empty_results")),t("span",{slot:"description"}," ")):[t("div",{class:"s-gifting-modal-header"},t("span",{class:"s-gifting-modal-icon"},t("span",{innerHTML:l})),t("h2",{class:"s-gifting-modal-title"},t("div",{class:"s-gifting-modal-badge-wrapper"},t("div",{class:"s-gifting-modal-badge"},t("span",null,t("span",null,this.currentStep),"/2")),t("span",null,this.giftDetails)))),t("div",{class:"s-gifting-steps-wrapper "+this.parentClass,ref:s=>this.stepsWrapper=s},t("div",{class:"s-gifting-step-one gift-step-1",ref:s=>this.step1Elems=s},t("div",{class:"s-gifting-modal-uploader-title anime-item"},this.selectImageForYourGift),t("div",{class:"s-gifting-modal-uploader anime-item",ref:s=>this.uploader=s},t("span",{class:"s-gifting-remove-preview",onClick:()=>this.removePreview(),innerHTML:a}),this.selectImageOrUpload&&t("salla-file-upload",{"instant-upload":!0,name:"image_url",url:salla.url.api(salla.product.api.getUrl("giftImage")),onUploaded:s=>this.handleUploadImage(s.detail),labelIdle:this.getFilepondPlaceholder(),onRemoved:()=>this.handleRemoveImage()})),t("div",{class:"anime-item"},!this.uploadedImage&&this.gift&&this.gift.gift_images&&this.gift.gift_images.length>0?t("salla-slider",{id:"gifting-slider",loop:!1,"controls-outer":!0,class:"s-gifting-slider",type:"carousel"},t("div",{slot:"items"},this.gift&&this.gift.gift_images?this.gift?.gift_images.map((s=>t("a",{class:"s-gifting-clickable s-gifting-image",onClick:()=>this.setPreview(s)},t("img",{style:{width:"120px"},src:s.url,alt:`${s.id}`})))):"")):""),t("div",{class:"anime-item"},t("div",{class:"s-form-group s-gifting-selectText",ref:s=>this.textSelect=s},t("select",{id:"gift-text-selection",name:"gift-text-selection",class:"s-form-control s-gifting-select",onChange:s=>this.toggleGiftText(s)},t("option",{"data-id":null,selected:!0},this.selectGiftMessage),this.gift&&this.gift.gift_texts?this.gift?.gift_texts.map((s=>t("option",{"data-id":s.id,value:s.text,key:s.id},s.text))):"",t("option",{"data-id":"custom"},this.giftCustomText))),t("div",{class:this.showGiftText?"s-form-group s-gifting-textarea shown":"s-form-group s-gifting-textarea hide",ref:s=>this.customTextArea=s},t("label",{htmlFor:"gift-custom-text",class:"s-form-label"},this.giftCustomText),t("div",{class:"mt-1"},t("textarea",{onInput:s=>this.handleTextAreaChange(s),rows:4,ref:s=>this.textArea=s,name:"gift-custom-text",id:"gift-custom-text",class:"s-form-control"})))),t("div",{class:"anime-item"},t("salla-button",{color:"primary",width:"wide",onClick:()=>this.goToStep2()},t("span",null,this.nextStep)))),t("div",{class:"s-gifting-step-two gift-step-2",ref:s=>this.step2Elems=s},t("div",{class:this.step2ItemClass(this.errors?.sender_name?"s-form-group s-form-has-error":"s-form-group")},t("label",{htmlFor:"sender_name",class:"s-form-label"},this.senderNameLabel),t("input",{type:"text",class:"s-form-control",name:"sender_name",id:"sender_name",value:this.senderName,onInput:s=>this.handleSenderName(s),placeholder:""}),this.errors&&this.errors.sender_name?t("span",{class:"s-gifting-error"},this.errors.sender_name):""),t("div",{class:this.step2ItemClass(this.errors?.["receiver.name"]?"s-form-group s-form-has-error":"s-form-group")},t("label",{htmlFor:"receiver_name",class:"s-form-label"},this.receiverNameFieldLabel),t("input",{type:"text",class:"s-form-control",name:"receiver_name",id:"receiver_name",value:"",onInput:s=>this.handleReceiverName(s),placeholder:""}),this.errors&&this.errors["receiver.name"]?t("span",{class:"s-gifting-error"},this.errors["receiver.name"]):""),t("div",{class:this.step2ItemClass(this.errors?.["receiver.mobile"]?"s-form-group s-form-has-error":"s-form-group")},t("label",{class:"s-form-label"},this.receiverMobileFieldLabel),t("salla-tel-input",{class:"s-gifting-tel-input",phone:this.receiverMobile,countryCode:this.receiverCountryCode,onPhoneEntered:s=>this.handlePhoneInputChange(s)}),this.errors&&this.errors["receiver.mobile"]?t("span",{class:"s-gifting-error"},this.errors["receiver.mobile"]):""),this.isPhysical()&&t("div",{class:this.step2ItemClass(this.errors?.["receiver.country"]?"s-form-group s-form-has-error":"s-form-group")},t("label",{class:"s-form-label",htmlFor:`${this.hostId}-country`},this.receiverCountryFieldLabel),t("salla-searchable-dropdown",{placeholder:this.selectCountry,items:this.gift?.countries??[],selectedItem:this.selectedCountry,disabled:!this.gift?.countries?.length,required:!0,inputId:`${this.hostId}-country`,searchable:!1,keepParentScroll:!0,onItemSelected:s=>this.handleCountrySelected(s.detail),onDropdownClosed:()=>this.handleCountryDropdownClosed()}),this.errors&&this.errors["receiver.country"]?t("span",{class:"s-gifting-error"},this.errors["receiver.country"]):""),this.isPhysical()&&this.isKSA&&t("div",{class:this.step2ItemClass(this.errors?.["receiver.region"]?"s-form-group s-form-has-error":"s-form-group")},t("label",{class:"s-form-label",htmlFor:`${this.hostId}-region`},this.receiverRegionFieldLabel),t("salla-searchable-dropdown",{placeholder:this.selectRegion,items:this.regions??[],selectedItem:this.selectedRegion,loading:this.loadingRegions,disabled:this.loadingRegions||!this.regions?.length,required:!0,inputId:`${this.hostId}-region`,searchable:!1,keepParentScroll:!0,onItemSelected:s=>this.handleRegionSelected(s.detail),onDropdownClosed:()=>this.handleRegionDropdownClosed()}),this.errors&&this.errors["receiver.region"]?t("span",{class:"s-gifting-error"},this.errors["receiver.region"]):""),this.isPhysical()&&t("div",{class:this.step2ItemClass(this.errors?.["receiver.city_id"]?"s-form-group s-form-has-error":"s-form-group")},t("label",{class:"s-form-label",htmlFor:`${this.hostId}-city`},this.receiverCityFieldLabel),t("salla-searchable-dropdown",{placeholder:this.selectCity,items:this.displayedCities,selectedItem:this.selectedCity,loading:this.loadingCities,searching:this.searchingCities,disabled:this.loadingCities||this.isKSA&&!this.selectedRegionId,required:!0,inputId:`${this.hostId}-city`,searchQuery:this.citySearchQuery,clientSearch:!this.enableCityAjaxSearch,dropUp:!0,keepParentScroll:!0,onItemSelected:s=>this.handleCitySelected(s.detail),onSearchInput:s=>this.handleCitySearch(s.detail),onDropdownClosed:()=>this.handleCityDropdownClosed()}),this.errors&&this.errors["receiver.city_id"]?t("span",{class:"s-gifting-error"},this.errors["receiver.city_id"]):""),this.isPhysical()&&t("div",{class:this.step2ItemClass("s-gifting-info")},t("span",{innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>alert</title>\n<path d="M16 13.333c-0.736 0-1.333 0.597-1.333 1.333v8c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-8c0-0.736-0.597-1.333-1.333-1.333zM16 9.327c-0.736 0-1.333 0.604-1.333 1.34s0.597 1.333 1.333 1.333 1.333-0.597 1.333-1.333v-0.013c0-0.736-0.597-1.327-1.333-1.327zM27.313 4.687c-6.237-6.237-16.389-6.239-22.628 0-6.237 6.239-6.237 16.389 0 22.628 3.119 3.119 7.216 4.679 11.313 4.679s8.195-1.559 11.313-4.679c6.24-6.239 6.24-16.391 0.001-22.628zM25.428 25.428c-5.199 5.197-13.657 5.197-18.857 0-5.197-5.199-5.197-13.659 0-18.857 5.199-5.197 13.659-5.197 18.857 0 5.199 5.2 5.199 13.659 0 18.857z"></path>\n</svg>\n'}),t("span",null,this.selectCityInfo)),!this.isPhysical()&&t("div",{class:this.step2ItemClass()},t("label",{class:"s-gifting-schedule s-gifting-clickable",htmlFor:`schedule-${this.hostId}`},t("input",{type:"checkbox",name:"schedule",id:`schedule-${this.hostId}`,onChange:()=>this.toggleCalendar(),class:"s-checkbox"}),t("span",{class:"s-form-label"}," ",this.sendLater," "))),t("div",{class:this.getCalendarClasses(),ref:s=>this.calendarFormGroup=s},t("label",{class:"s-form-label"},this.selectSendDateAndTime),t("salla-datetime-picker",{value:this.deliveryDate,placeholder:this.selectSendDateAndTime,"enable-time":!0,"date-format":"Y-m-d h:i K",onPicked:s=>this.handleDateTimePicker(s)}),t("span",{class:"s-gifting-calendar-hint"},this.canNotEditOrderAfterSelectDate)),t("div",{class:this.step2ItemClass("s-gifting-step-two-footer")},t("a",{href:"#!",innerHTML:e,onClick:s=>this.goToStep1(s)}),t("salla-button",{onClick:()=>this.submitForm(),color:"primary",width:"wide"},t("span",null,this.sendGift)))))],t("slot",{key:"bd8cd1628ed4282b177f0ddcd5fb93289c47b4d6",name:"footer"})))]}};h.CITY_AJAX_THRESHOLD=400,h.CITY_SEARCH_DEBOUNCE_MS=100,h.style=".s-gifting-steps-wrapper{transition:0.2s cubic-bezier(0.55, 0, 0.1, 1) 0s}.s-gifting-select{background-image:url(\"data:image/svg+xml;utf8,<svg version='1.1' fill='gray' xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'><title>keyboard_arrow_down</title><path d='M9.875 11.104l6.125 6.125 6.125-6.125 1.875 1.875-8 8-8-8z'></path></svg>\");background-size:24px;background-repeat:no-repeat;background-position:99%;appearance:none}[dir=rtl] .s-gifting-select{background-position:5px}.s-gifting-widget-vertical .s-list-tile-item [slot=title]{display:flex;align-items:center;gap:1.5rem}.s-gifting-widget-vertical .s-list-tile-item-content{width:100%}.s-gifting-modal .s-searchable-dropdown-trigger{border-color:#d1d5db}.s-gifting-modal .s-searchable-dropdown-trigger:hover:not(.s-searchable-dropdown-trigger--disabled){border-color:#d1d5db}.s-gifting-modal .s-searchable-dropdown-trigger--open,.s-gifting-modal .s-searchable-dropdown-trigger:focus{border-color:var(--color-primary, #00897b);box-shadow:0 0 0 1px var(--color-primary, #00897b)}.s-gifting-modal .s-searchable-dropdown-trigger-placeholder{color:#000}";export{h as salla_gifting}
4
+ import{r as s,h as t}from"./p-Dimo1ZpU.js";import{a as i}from"./p-CgtvEd63.js";import{a as e}from"./p-BedNk7k1.js";import{S as a}from"./p-8Tsmrwno.js";import{S as l}from"./p-0-eTJXSD.js";const h=class{constructor(t){s(this,t),this.defaultEvent="gifting:open",this.selectImageForYourGift=salla.lang.get("blocks.buy_as_gift.select_image_or_upload"),this.currentStep=1,this.showCalendar=!1,this.showGiftText=!1,this.currentLang="",this.parentClass="is-current-step-1",this.errors={},this.gift=void 0,this.selectedGiftTextOption=void 0,this.selectedCountryId=void 0,this.selectedCountryCode=void 0,this.loadingCities=!1,this.loadingRegions=!1,this.regions=[],this.selectedRegionId=void 0,this.isKSA=!1,this.selectedCountry=null,this.selectedRegion=null,this.displayedCities=[],this.selectedCity=null,this.searchingCities=!1,this.enableCityAjaxSearch=!1,this.citySearchQuery="",this.step2Animated=!1,this.citySearchTimer=null,this.citySearchCounter=0,this.locationRequestCounter=0,this.showTextArea=!1,this.selectedImage=void 0,this.uploadedImage=void 0,this.selectedText=void 0,this.hasError=!1,this.timeZone=null,this.receiverCountryCode=salla.config.get("store.scope.countries")?.[0]||salla.config.get("store.store_country")||"SA",this.hostId=`salla-gifting-${Math.random().toString(36).slice(2,10)}`,this.formSelector="form.product-form, form.form--product-options",this.handleCitySearch=s=>{if(this.citySearchQuery=s,!this.enableCityAjaxSearch)return;this.citySearchTimer&&clearTimeout(this.citySearchTimer);const t=++this.citySearchCounter;this.citySearchTimer=setTimeout((async()=>{this.searchingCities=!0;try{const i=await this.fetchCities(s);t===this.citySearchCounter&&(this.displayedCities=i)}catch(s){t===this.citySearchCounter&&(this.displayedCities=[])}finally{t===this.citySearchCounter&&(this.searchingCities=!1)}}),h.CITY_SEARCH_DEBOUNCE_MS)},this.handleCitySelected=s=>{this.selectedCity=s,this.receiverCity=String(s.id),this.clearError("receiver.city_id")},this.handleCityDropdownClosed=()=>{this.citySearchQuery="",this.citySearchTimer&&(clearTimeout(this.citySearchTimer),this.citySearchTimer=null),++this.citySearchCounter,this.displayedCities=this.gift?.cities??[],this.searchingCities=!1},this.handleCountryDropdownClosed=()=>{},this.handleRegionDropdownClosed=()=>{},salla.lang.onLoaded((()=>{this.selectImageOrUpload=salla.lang.get("blocks.buy_as_gift.select_image_or_upload"),this.selectImageForYourGift=salla.lang.get("blocks.buy_as_gift.select_image_for_your_gift"),this.sectionTitle=salla.lang.get("blocks.buy_as_gift.gift_the_one_you_love"),this.sectionSubtitle=salla.lang.get("blocks.buy_as_gift.gift_the_one_you_love_message"),this.sectionBtnText=salla.lang.get("blocks.buy_as_gift.send_as_a_gift"),this.giftDetails=salla.lang.get("blocks.buy_as_gift.gift_details"),this.selectGiftMessage=salla.lang.get("blocks.buy_as_gift.select_gift_message"),this.giftCustomText=salla.lang.get("blocks.buy_as_gift.gift_custom_text"),this.textId=salla.lang.get("blocks.buy_as_gift.text_id"),this.incorrectGiftText=salla.lang.get("blocks.buy_as_gift.incorrect_gift_text"),this.nextStep=salla.lang.get("blocks.buy_as_gift.next_step"),this.senderNameLabel=salla.lang.get("blocks.buy_as_gift.sender_name"),this.receiverNameFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_name"),this.receiverMobileFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_mobile"),this.receiverCountryFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_country"),this.ksa=salla.lang.get("pages.checkout.ksa"),this.selectCity=salla.lang.get("pages.checkout.select_city"),this.selectCountry=salla.lang.get("pages.checkout.select_country"),this.selectCityInfo=salla.lang.get("blocks.buy_as_gift.city_info"),this.receiverCityFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_city"),this.receiverRegionFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_region")||salla.lang.get("pages.checkout.region"),this.selectRegion=salla.lang.get("pages.checkout.select_region"),this.receiverEmailFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_email"),this.emailPlaceholder=salla.lang.get("common.elements.email_placeholder"),this.sendLater=salla.lang.get("blocks.buy_as_gift.send_later"),this.selectSendDateAndTime=salla.lang.get("blocks.buy_as_gift.select_send_date_and_time"),this.canNotEditOrderAfterSelectDate=salla.lang.get("blocks.buy_as_gift.can_not_edit_order_after_select_date"),this.sendGift=salla.lang.get("blocks.buy_as_gift.send_gift"),this.donationRequired=salla.lang.get("pages.products.donation_amount_required"),this.currentLang=salla.lang.locale})),salla.event.on(this.defaultEvent,(()=>{this.open()}))}isPhysical(){return this.physicalProducts||this.physical}componentDidLoad(){salla.event.product.onPriceUpdated((()=>{const s=document.querySelector(".s-quantity-input-input");this.quantity=s?.value}))}getFormDataFromForm(){if(!this.formSelector)return null;const s=document.querySelector(this.formSelector);return s?new FormData(s):null}mergeObjectToFormData(s,t,i){for(let e in s){if(!s.hasOwnProperty(e)||null==s[e])continue;const a=i?`${i}[${e}]`:e;"object"!=typeof s[e]||null===s[e]||s[e]instanceof File?t.set(a,s[e]):this.mergeObjectToFormData(s[e],t,a)}return t}async open(){if(salla.config.isGuest())return salla.api.auth.setAfterLoginEvent(this.defaultEvent),void salla.event.dispatch("login::open",{withoutReload:!0});await this.modal.open();const s=this.productId?()=>salla.product.getGiftProductDetails(this.productId):()=>salla.cart.getGiftCartDetails();return await salla.api.withoutNotifier(s).then((s=>{this.gift=s.data,this.senderName=this.gift.sender_name})).catch((s=>{this.hasError=!0,this.errorMessage=s.response?.data?.error?.message||s.response?.data})).finally((()=>this.modal.stopLoading()))}async close(){return this.modal.close()}async setWrapperHeight(s=1,t=250,i=0,e=0){let a=document.querySelector(`#${this.hostId} .gift-step-${s}`);const l=()=>{this.stepsWrapper.style.height=e?`${e}px`:a.offsetHeight+i+"px"};this.step2Animated&&2===s?requestAnimationFrame(l):setTimeout(l,t)}toggleCalendar(){this.showCalendar=!this.showCalendar,this.setWrapperHeight(2,150,0)}toggleGiftText(s){this.textSelect?.classList.remove("s-form-has-error");let t=s.target.children[s.target.selectedIndex].getAttribute("data-id"),i="custom"==t;this.showGiftText=i,t?(this.selectedGiftTextOption=t,this.selectedText=i?void 0:s.target.value,this.setWrapperHeight(1,150,5)):(this.textArea.value="",this.selectedText=void 0,this.selectedGiftTextOption=void 0,this.setWrapperHeight(1,150,-15))}async goToStep2(){return this.selectedGiftTextOption?"custom"!=this.selectedGiftTextOption||this.selectedText?(this.textSelect.classList.remove("s-form-has-error"),this.customTextArea.classList.remove("s-form-has-error"),this.setWrapperHeight(2,600,0),(new i.timeline).add({targets:this.step1Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[1,0],translateX:[0,50],delay:i.stagger(70),duration:1200}).add({targets:".gift-step-2",translateX:["-110%",0],opacity:[0,1]},"-=1800").add({targets:this.step2Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[0,1],translateX:[-50,0],delay:i.stagger(70),duration:1200,complete:()=>{this.step2Elems.querySelectorAll(`#${this.hostId} .anime-item`).forEach((s=>{s.classList.remove("opacity-0"),s.removeAttribute("style")})),this.step2Animated=!0}},"-=1200"),this.currentStep=2,void(this.parentClass=`is-current-step-${this.currentStep}`)):(this.textSelect.classList.remove("s-form-has-error"),void this.customTextArea.classList.add("s-form-has-error")):(this.textSelect.classList.add("s-form-has-error"),void this.customTextArea.classList.remove("s-form-has-error"))}goToStep1(s){s.preventDefault();let t=new i.timeline({autoplay:!1});t.add({targets:this.step2Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[1,0],translateX:[0,-50],delay:i.stagger(70),duration:1200}).add({targets:".gift-step-1",translateX:["110%",0],opacity:[0,1]},"-=1800").add({targets:this.step1Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[0,1],translateX:[50,0],delay:i.stagger(70),duration:1200,complete:()=>{this.step1Elems.querySelectorAll(`#${this.hostId} .anime-item`).forEach((s=>{s.classList.remove("opacity-0"),s.removeAttribute("style")}))}},"-=1200"),t.play(),this.step2Animated=!1,this.setWrapperHeight(1,600,0),this.currentStep=1,this.parentClass=`is-current-step-${this.currentStep}`}getFilepondPlaceholder(){return`<div class="s-gifting-filepond-placeholder"><span class="s-gifting-filepond-placeholder-icon"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>images</title>\n<path d="M22.667 29.333h-13.333c-3.676 0-6.667-2.991-6.667-6.667v-13.333c0-0.737-0.597-1.333-1.333-1.333s-1.333 0.596-1.333 1.333v13.333c0 5.145 4.187 9.333 9.333 9.333h13.333c0.736 0 1.333-0.596 1.333-1.333s-0.597-1.333-1.333-1.333zM22.667 5.333c-2.205 0-4 1.795-4 4s1.795 4 4 4 4-1.795 4-4-1.795-4-4-4zM22.667 10.667c-0.735 0-1.333-0.597-1.333-1.333s0.599-1.333 1.333-1.333 1.333 0.597 1.333 1.333-0.599 1.333-1.333 1.333zM25.333 0h-13.333c-3.676 0-6.667 2.991-6.667 6.667v13.333c0 1.055 0.268 2.040 0.707 2.927 0.039 0.099 0.088 0.188 0.151 0.277 1.137 2.053 3.301 3.463 5.809 3.463h13.333c3.676 0 6.667-2.991 6.667-6.667v-13.333c0-3.676-2.991-6.667-6.667-6.667zM12 24c-1.244 0-2.344-0.583-3.077-1.476l5.721-7.047 6.629 8.523zM29.333 20c0 2.205-1.795 4-4 4h-0.68l-8.933-11.485c-0.251-0.32-0.633-0.511-1.039-0.515h-0.015c-0.401 0-0.781 0.181-1.035 0.492l-5.632 6.935v-12.76c0-2.205 1.795-4 4-4h13.333c2.205 0 4 1.795 4 4z"></path>\n</svg>\n</span><p class="s-gifting-filepond-placeholder-text">${this.selectImageOrUpload?this.selectImageOrUpload:""}</p></div>`}setPreview(s){this.uploader?.classList.add("has-bg");var t=document.querySelector(`#${this.hostId}.filepond-bg`)?document.querySelector(`#${this.hostId} .filepond-bg`):document.createElement("div");t.classList.add("filepond-bg"),t.classList.remove("s-hidden"),t.style.backgroundImage="url('"+s.url+"')",this.uploader?.querySelector(".filepond--root")?.appendChild(t),this.uploadedImage=s.url,this.gift&&this.gift.gift_images.length&&this.setWrapperHeight(1,150,0)}removePreview(){this.uploader.classList.remove("has-bg");let s=document.querySelector(`#${this.hostId} .filepond-bg`);s.removeAttribute("style"),s.classList.add("s-hidden"),this.handleRemoveImage()}handleTextAreaChange(s){this.selectedText=s.target.value,this.customTextArea.classList.remove("s-form-has-error")}clearError(s){if(this.errors?.[s]){const{[s]:t,...i}=this.errors;this.errors=i}}handleSenderName(s){this.senderName=s.target.value,this.clearError("sender_name")}handleReceiverName(s){this.receiverName=s.target.value,this.clearError("receiver.name")}resetCityState(){this.citySearchTimer&&(clearTimeout(this.citySearchTimer),this.citySearchTimer=null),++this.citySearchCounter,this.gift={...this.gift,cities:[]},this.displayedCities=[],this.receiverCity=void 0,this.selectedCity=null,this.citySearchQuery="",this.searchingCities=!1,this.enableCityAjaxSearch=!1}setInitialCities(s){this.gift={...this.gift,cities:s},this.displayedCities=s,this.enableCityAjaxSearch=s.length>=h.CITY_AJAX_THRESHOLD}async fetchCities(s=""){if(!this.selectedCountryId)return[];if(this.isKSA&&!this.selectedRegionId)return[];const t=["for_branch=0",`country_id=${this.selectedCountryId}`];this.isKSA&&this.selectedRegionId&&t.push(`region_id=${this.selectedRegionId}`),s?.trim()&&t.push(`query=${encodeURIComponent(s.trim())}`);const i=await salla.api.request(`shipping/cities?${t.join("&")}`);return i?.data??[]}async handleCountrySelected(s){const t=s?.id;this.selectedCountry=s??null,this.selectedCountryId=t,this.selectedCountryCode=s?.country_code,this.isKSA="SA"===s?.country_code,this.clearError("receiver.country"),this.regions=[],this.selectedRegionId=void 0,this.selectedRegion=null,this.resetCityState();const i=++this.locationRequestCounter;if(!t)return this.selectedCountryCode=void 0,this.isKSA=!1,void this.setWrapperHeight(2,0,0);if(this.isKSA){this.loadingRegions=!0,this.setWrapperHeight(2,0,0);try{const s=await salla.api.request(`shipping/countries/${t}/regions`);if(i!==this.locationRequestCounter)return;s&&s.data&&(this.regions=s.data)}catch(s){if(i!==this.locationRequestCounter)return;console.error("Error fetching regions:",s)}finally{i===this.locationRequestCounter&&(this.loadingRegions=!1,this.setWrapperHeight(2,0,0))}}else{this.loadingCities=!0,this.setWrapperHeight(2,0,0);try{const s=await this.fetchCities();if(i!==this.locationRequestCounter)return;this.setInitialCities(s)}catch(s){if(i!==this.locationRequestCounter)return;console.error("Error fetching cities:",s)}finally{i===this.locationRequestCounter&&(this.loadingCities=!1)}}}async handleRegionSelected(s){const t=s?.id;this.selectedRegion=s??null,this.selectedRegionId=t,this.clearError("receiver.region"),this.resetCityState();const i=++this.locationRequestCounter;if(t){this.loadingCities=!0;try{const s=await this.fetchCities();if(i!==this.locationRequestCounter)return;this.setInitialCities(s)}catch(s){if(i!==this.locationRequestCounter)return;console.error("Error fetching cities:",s)}finally{i===this.locationRequestCounter&&(this.loadingCities=!1,this.setWrapperHeight(2,0,0))}}}handleUploadImage(s){this.uploadedImage=s,this.gift&&this.gift.gift_images.length&&this.setWrapperHeight(1,150,0)}handleRemoveImage(){this.uploadedImage="",this.gift&&this.gift.gift_images.length&&this.setWrapperHeight(1,150,0)}handlePhoneInputChange(s){let t=s.detail;this.receiverMobile=t.number,this.receiverCountryCode=t.country_code,this.clearError("receiver.mobile")}handleDateTimePicker(s){this.deliveryDate=s.detail}getCalendarClasses(){return{"s-form-group":!0,"anime-item":!0,"s-gifting-calendar":!0,shown:this.showCalendar,hide:!this.showCalendar,"s-form-has-error":!!this.errors&&this.errors.deliver_at}}async submitForm(){const s=document.querySelector("#donating-amount")?.value;if(this.calendarFormGroup.classList.remove("s-form-has-error"),this.errors&&(this.errors={},this.setWrapperHeight(2,150,0)),this.showCalendar&&!this.deliveryDate)return void this.calendarFormGroup.classList.add("s-form-has-error");const t=[{key:"sender_name",value:this.senderName,label:this.senderNameLabel},{key:"receiver.name",value:this.receiverName,label:this.receiverNameFieldLabel},{key:"receiver.mobile",value:this.receiverMobile,label:this.receiverMobileFieldLabel},...this.isPhysical()?[{key:"receiver.country",value:this.selectedCountryId,label:this.receiverCountryFieldLabel},...this.isKSA?[{key:"receiver.region",value:this.selectedRegionId,label:this.receiverRegionFieldLabel}]:[],{key:"receiver.city_id",value:this.receiverCity,label:this.receiverCityFieldLabel}]:[]],i={};if(t.forEach((({key:s,value:t,label:e})=>{t||(i[s]=salla.lang.get("common.errors.field_required",{attribute:e}))})),Object.keys(i).length)return this.errors=i,void this.setWrapperHeight(2,150,0);const e={text:this.selectedText,sender_name:this.senderName,quantity:this.quantity,deliver_at:this.showCalendar?this.deliveryDate:null,image_url:this.uploadedImage??this.selectedImage,donation_amount:s||null,receiver:{name:this.receiverName,mobile_country_code:this.receiverCountryCode,mobile:this.receiverMobile,...this.isPhysical()&&this.selectedCountryCode?{country_code:this.selectedCountryCode}:{},...this.isPhysical()&&this.selectedRegionId?{region_id:this.selectedRegionId}:{},...this.receiverCity&&this.isPhysical()?{city_id:this.receiverCity}:{}},has_apple_pay:salla.helpers.hasApplePay()};let a;this.productId&&this.formSelector&&(a=this.getFormDataFromForm()||new FormData,a=this.mergeObjectToFormData(e,a));const l=this.productId?()=>salla.product.addProductGiftToCart(this.productId,a,!0):()=>salla.cart.addCartGiftToCart(e,!0);return await l().then((()=>this.modal.close())).catch((s=>{s.response&&422==s.response.status?this.errors=s.response.data.error.fields:console.log(s),this.setWrapperHeight(2,150,0)}))}step2ItemClass(s=""){const t="anime-item"+(this.step2Animated?"":" opacity-0");return s?`${s} ${t}`:t}generateClass(){return{"s-gifting-widget":!0,"s-gifting-widget-vertical":!!this.vertical,"s-gifting-widget-horizontal":!this.vertical}}async handleGiftButtonClick(){if(this.productId&&this.formSelector){const s=document.querySelector(this.formSelector);if(!s)return void console.error("SallaGifting:: Form not found in the document!");if(!(s instanceof HTMLFormElement))return void console.error("SallaGifting:: The specified selector does not correspond to a form tag!");if(!s.reportValidity())return console.error("SallaGifting:: Form is not valid!"),void salla.error(salla.lang.get("common.messages.required_fields"))}const s=document.querySelector(`salla-product-options[product-id="${this.productId}"]`);!s||await s.reportValidity()?this.open():salla.error(salla.lang.get("common.messages.required_fields"))}render(){return[t("div",{key:"db700f9ec96a6974f3b815bb017ebe97ae8fe5c0"},t("salla-list-tile",{key:"1e2fd1c0b375c85fcd4af1ea071c36879e6913c5",class:this.generateClass()},t("div",{key:"a9d02c933bc13bf8765e7e91ce08b2c9495954e5",slot:"title"},this.vertical?t("span",{innerHTML:l}):"",t("h3",{key:"56bd850368806c6ed5770ea5f6b0339749a77dfa"},this.widgetTitle?this.widgetTitle:this.sectionTitle)),t("div",{key:"fbb4940fd3e3578f2f5a479d9d44be8dfbda7e43",slot:"subtitle"},t("div",{key:"fb7e8532984fbfc6fd61c55a6d44d7cdbb4bc9a2"},this.widgetSubtitle?this.widgetSubtitle:this.sectionSubtitle)),t("div",{key:"04f27f1ddbfa0b06be111b6c3176fbda5ea6d43a",slot:"action"},t("salla-button",{key:"fe71a1a773e5275ede7d1b3ea535c330688028b7",color:"primary",fill:"outline",width:"wide",class:"s-gifting-widget-action",onClick:()=>this.handleGiftButtonClick()},t("slot",{key:"d62127d30254df2d8add55e0e1dbcfefb686e359",name:"widget-btn-content"},t("div",{key:"5ddbb695af142baf3bb6986627f97a7a7607eb31",class:"s-gifting-widget-action-content"},t("span",{key:"7820fb6abd9d7a9c1035c0f80191a3ff2a4c5fe8",innerHTML:l}),"  ",t("span",{key:"2cfc69862d3d087375efaed3bcec0ff0c1587989"},this.sectionBtnText)))))),t("salla-modal",{key:"32c19391248ba6186f43fea59493171079e7bf07",id:this.hostId,isLoading:!0,class:"s-gifting-modal",width:"sm",ref:s=>this.modal=s},t("div",{key:"e4b5829416314f25793158dae0c530b8057b4085",slot:"loading"},t("div",{key:"6ee873add5868f105b7ec7291c2a8c8fc033c588",class:"s-gifting-skeleton"},t("div",{key:"40aae38f8b2d62b434394811a3ef6d8bc00f6f32",class:"s-gifting-modal-header"},t("salla-skeleton",{key:"a652cd74a16d0db662ea4a518ebfab366a3c3899",type:"circle",height:"5rem",width:"5rem"}),t("h2",{key:"edb4a1477893246e98207aeba7bfb5af686f20b9",class:"s-gifting-modal-title"},t("div",{key:"83ef942b15450cc59ad32d8c5b3ba43a32bcb29c",class:"s-gifting-modal-badge-wrapper"},t("salla-skeleton",{key:"d9041c777a2fa0aa7ffc752958c7441916a02f85",height:"15px",width:"150px"})))),t("div",{key:"fe3bb9dad01becba87486c4886037fd67b059919",class:"s-gifting-skeleton-content"},t("salla-skeleton",{key:"08bd8304b66264b70f6df68e64da3560a1f75461",height:"10px",width:"150px"}),t("salla-skeleton",{key:"bbea0d7ff0c846897af2ef5d3696b252a2f4e662",height:"230px"}),t("salla-skeleton",{key:"8cb1fde02e31a1accabd2e26409983e7ba56eeb1",height:"10px",width:"150px"}),t("salla-skeleton",{key:"f80a986b953278bac41505506adf8d611566a167",height:"30px"}),t("salla-skeleton",{key:"f7eccce69b619de385872642e1fb62b2cf6c3082",height:"40px"})))),t("slot",{key:"d299e46040193b441f8171d05e0048849e3df8d5",name:"header"}),this.hasError?t("salla-placeholder",{alignment:"center"},t("span",{slot:"title"},this.errorMessage||salla.lang.get("common.errors.empty_results")),t("span",{slot:"description"}," ")):[t("div",{class:"s-gifting-modal-header"},t("span",{class:"s-gifting-modal-icon"},t("span",{innerHTML:l})),t("h2",{class:"s-gifting-modal-title"},t("div",{class:"s-gifting-modal-badge-wrapper"},t("div",{class:"s-gifting-modal-badge"},t("span",null,t("span",null,this.currentStep),"/2")),t("span",null,this.giftDetails)))),t("div",{class:"s-gifting-steps-wrapper "+this.parentClass,ref:s=>this.stepsWrapper=s},t("div",{class:"s-gifting-step-one gift-step-1",ref:s=>this.step1Elems=s},t("div",{class:"s-gifting-modal-uploader-title anime-item"},this.selectImageForYourGift),t("div",{class:"s-gifting-modal-uploader anime-item",ref:s=>this.uploader=s},t("span",{class:"s-gifting-remove-preview",onClick:()=>this.removePreview(),innerHTML:a}),this.selectImageOrUpload&&t("salla-file-upload",{"instant-upload":!0,name:"image_url",url:salla.url.api(salla.product.api.getUrl("giftImage")),onUploaded:s=>this.handleUploadImage(s.detail),labelIdle:this.getFilepondPlaceholder(),onRemoved:()=>this.handleRemoveImage()})),t("div",{class:"anime-item"},!this.uploadedImage&&this.gift&&this.gift.gift_images&&this.gift.gift_images.length>0?t("salla-slider",{id:"gifting-slider",loop:!1,"controls-outer":!0,class:"s-gifting-slider",type:"carousel"},t("div",{slot:"items"},this.gift&&this.gift.gift_images?this.gift?.gift_images.map((s=>t("a",{class:"s-gifting-clickable s-gifting-image",onClick:()=>this.setPreview(s)},t("img",{style:{width:"120px"},src:s.url,alt:`${s.id}`})))):"")):""),t("div",{class:"anime-item"},t("div",{class:"s-form-group s-gifting-selectText",ref:s=>this.textSelect=s},t("select",{id:"gift-text-selection",name:"gift-text-selection",class:"s-form-control s-gifting-select",onChange:s=>this.toggleGiftText(s)},t("option",{"data-id":null,selected:!0},this.selectGiftMessage),this.gift&&this.gift.gift_texts?this.gift?.gift_texts.map((s=>t("option",{"data-id":s.id,value:s.text,key:s.id},s.text))):"",t("option",{"data-id":"custom"},this.giftCustomText))),t("div",{class:this.showGiftText?"s-form-group s-gifting-textarea shown":"s-form-group s-gifting-textarea hide",ref:s=>this.customTextArea=s},t("label",{htmlFor:"gift-custom-text",class:"s-form-label"},this.giftCustomText),t("div",{class:"mt-1"},t("textarea",{onInput:s=>this.handleTextAreaChange(s),rows:4,ref:s=>this.textArea=s,name:"gift-custom-text",id:"gift-custom-text",class:"s-form-control"})))),t("div",{class:"anime-item"},t("salla-button",{color:"primary",width:"wide",onClick:()=>this.goToStep2()},t("span",null,this.nextStep)))),t("div",{class:"s-gifting-step-two gift-step-2",ref:s=>this.step2Elems=s},t("div",{class:this.step2ItemClass(this.errors?.sender_name?"s-form-group s-form-has-error":"s-form-group")},t("label",{htmlFor:"sender_name",class:"s-form-label"},this.senderNameLabel),t("input",{type:"text",class:"s-form-control",name:"sender_name",id:"sender_name",value:this.senderName,onInput:s=>this.handleSenderName(s),placeholder:""}),this.errors&&this.errors.sender_name?t("span",{class:"s-gifting-error"},this.errors.sender_name):""),t("div",{class:this.step2ItemClass(this.errors?.["receiver.name"]?"s-form-group s-form-has-error":"s-form-group")},t("label",{htmlFor:"receiver_name",class:"s-form-label"},this.receiverNameFieldLabel),t("input",{type:"text",class:"s-form-control",name:"receiver_name",id:"receiver_name",value:"",onInput:s=>this.handleReceiverName(s),placeholder:""}),this.errors&&this.errors["receiver.name"]?t("span",{class:"s-gifting-error"},this.errors["receiver.name"]):""),t("div",{class:this.step2ItemClass(this.errors?.["receiver.mobile"]?"s-form-group s-form-has-error":"s-form-group")},t("label",{class:"s-form-label"},this.receiverMobileFieldLabel),t("salla-tel-input",{class:"s-gifting-tel-input",phone:this.receiverMobile,countryCode:this.receiverCountryCode,onPhoneEntered:s=>this.handlePhoneInputChange(s)}),this.errors&&this.errors["receiver.mobile"]?t("span",{class:"s-gifting-error"},this.errors["receiver.mobile"]):""),this.isPhysical()&&t("div",{class:this.step2ItemClass(this.errors?.["receiver.country"]?"s-form-group s-form-has-error":"s-form-group")},t("label",{class:"s-form-label",htmlFor:`${this.hostId}-country`},this.receiverCountryFieldLabel),t("salla-searchable-dropdown",{placeholder:this.selectCountry,items:this.gift?.countries??[],selectedItem:this.selectedCountry,disabled:!this.gift?.countries?.length,required:!0,inputId:`${this.hostId}-country`,searchable:!1,keepParentScroll:!0,onItemSelected:s=>this.handleCountrySelected(s.detail),onDropdownClosed:()=>this.handleCountryDropdownClosed()}),this.errors&&this.errors["receiver.country"]?t("span",{class:"s-gifting-error"},this.errors["receiver.country"]):""),this.isPhysical()&&this.isKSA&&t("div",{class:this.step2ItemClass(this.errors?.["receiver.region"]?"s-form-group s-form-has-error":"s-form-group")},t("label",{class:"s-form-label",htmlFor:`${this.hostId}-region`},this.receiverRegionFieldLabel),t("salla-searchable-dropdown",{placeholder:this.selectRegion,items:this.regions??[],selectedItem:this.selectedRegion,loading:this.loadingRegions,disabled:this.loadingRegions||!this.regions?.length,required:!0,inputId:`${this.hostId}-region`,searchable:!1,keepParentScroll:!0,onItemSelected:s=>this.handleRegionSelected(s.detail),onDropdownClosed:()=>this.handleRegionDropdownClosed()}),this.errors&&this.errors["receiver.region"]?t("span",{class:"s-gifting-error"},this.errors["receiver.region"]):""),this.isPhysical()&&t("div",{class:this.step2ItemClass(this.errors?.["receiver.city_id"]?"s-form-group s-form-has-error":"s-form-group")},t("label",{class:"s-form-label",htmlFor:`${this.hostId}-city`},this.receiverCityFieldLabel),t("salla-searchable-dropdown",{placeholder:this.selectCity,items:this.displayedCities,selectedItem:this.selectedCity,loading:this.loadingCities,searching:this.searchingCities,disabled:this.loadingCities||this.isKSA&&!this.selectedRegionId,required:!0,inputId:`${this.hostId}-city`,searchQuery:this.citySearchQuery,clientSearch:!this.enableCityAjaxSearch,dropUp:!0,keepParentScroll:!0,onItemSelected:s=>this.handleCitySelected(s.detail),onSearchInput:s=>this.handleCitySearch(s.detail),onDropdownClosed:()=>this.handleCityDropdownClosed()}),this.errors&&this.errors["receiver.city_id"]?t("span",{class:"s-gifting-error"},this.errors["receiver.city_id"]):""),this.isPhysical()&&t("div",{class:this.step2ItemClass("s-gifting-info")},t("span",{innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>alert</title>\n<path d="M16 13.333c-0.736 0-1.333 0.597-1.333 1.333v8c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-8c0-0.736-0.597-1.333-1.333-1.333zM16 9.327c-0.736 0-1.333 0.604-1.333 1.34s0.597 1.333 1.333 1.333 1.333-0.597 1.333-1.333v-0.013c0-0.736-0.597-1.327-1.333-1.327zM27.313 4.687c-6.237-6.237-16.389-6.239-22.628 0-6.237 6.239-6.237 16.389 0 22.628 3.119 3.119 7.216 4.679 11.313 4.679s8.195-1.559 11.313-4.679c6.24-6.239 6.24-16.391 0.001-22.628zM25.428 25.428c-5.199 5.197-13.657 5.197-18.857 0-5.197-5.199-5.197-13.659 0-18.857 5.199-5.197 13.659-5.197 18.857 0 5.199 5.2 5.199 13.659 0 18.857z"></path>\n</svg>\n'}),t("span",null,this.selectCityInfo)),!this.isPhysical()&&t("div",{class:this.step2ItemClass()},t("label",{class:"s-gifting-schedule s-gifting-clickable",htmlFor:`schedule-${this.hostId}`},t("input",{type:"checkbox",name:"schedule",id:`schedule-${this.hostId}`,onChange:()=>this.toggleCalendar(),class:"s-checkbox"}),t("span",{class:"s-form-label"}," ",this.sendLater," "))),t("div",{class:this.getCalendarClasses(),ref:s=>this.calendarFormGroup=s},t("label",{class:"s-form-label"},this.selectSendDateAndTime),t("salla-datetime-picker",{value:this.deliveryDate,placeholder:this.selectSendDateAndTime,"enable-time":!0,"date-format":"Y-m-d h:i K",onPicked:s=>this.handleDateTimePicker(s)}),t("span",{class:"s-gifting-calendar-hint"},this.canNotEditOrderAfterSelectDate)),t("div",{class:this.step2ItemClass("s-gifting-step-two-footer")},t("a",{href:"#!",innerHTML:e,onClick:s=>this.goToStep1(s)}),t("salla-button",{onClick:()=>this.submitForm(),color:"primary",width:"wide"},t("span",null,this.sendGift)))))],t("slot",{key:"bd8cd1628ed4282b177f0ddcd5fb93289c47b4d6",name:"footer"})))]}};h.CITY_AJAX_THRESHOLD=400,h.CITY_SEARCH_DEBOUNCE_MS=100,h.style=".s-gifting-steps-wrapper{transition:0.2s cubic-bezier(0.55, 0, 0.1, 1) 0s}.s-gifting-select{background-image:url(\"data:image/svg+xml;utf8,<svg version='1.1' fill='gray' xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'><title>keyboard_arrow_down</title><path d='M9.875 11.104l6.125 6.125 6.125-6.125 1.875 1.875-8 8-8-8z'></path></svg>\");background-size:24px;background-repeat:no-repeat;background-position:99%;appearance:none}[dir=rtl] .s-gifting-select{background-position:5px}.s-gifting-widget-vertical .s-list-tile-item [slot=title]{display:flex;align-items:center;gap:1.5rem}.s-gifting-widget-vertical .s-list-tile-item-content{width:100%}.s-gifting-modal .s-searchable-dropdown-trigger{border-color:#d1d5db}.s-gifting-modal .s-searchable-dropdown-trigger:hover:not(.s-searchable-dropdown-trigger--disabled){border-color:#d1d5db}.s-gifting-modal .s-searchable-dropdown-trigger--open,.s-gifting-modal .s-searchable-dropdown-trigger:focus{border-color:var(--color-primary, #00897b);box-shadow:0 0 0 1px var(--color-primary, #00897b)}.s-gifting-modal .s-searchable-dropdown-trigger-placeholder{color:#000}";export{h as salla_gifting}
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{d as t}from"./p-CrNw20pf.js";function n(t,n){return n.forEach((function(n){n&&"string"!=typeof n&&!Array.isArray(n)&&Object.keys(n).forEach((function(e){if("default"!==e&&!(e in t)){var r=Object.getOwnPropertyDescriptor(n,e);Object.defineProperty(t,e,r.get?r:{enumerable:!0,get:function(){return n[e]}})}}))})),Object.freeze(t)}var e,r={exports:{}},i=(e||(e=1,r.exports=function(){var t={type:"spring",stiffness:.5,damping:.45,mass:10},n=function(t){return-.5*(Math.cos(Math.PI*t)-1)},e=function(t){var n=Math.min(10/t.width,10/t.height),e=document.createElement("canvas"),i=e.getContext("2d"),o=e.width=Math.ceil(t.width*n),a=e.height=Math.ceil(t.height*n);i.drawImage(t,0,0,o,a);var _=null;try{_=i.getImageData(0,0,o,a).data}catch(t){return null}for(var E=_.length,u=0,I=0,c=0,T=0;T<E;T+=4)u+=_[T]*_[T],I+=_[T+1]*_[T+1],c+=_[T+2]*_[T+2];return{r:u=r(u,E),g:I=r(I,E),b:c=r(c,E)}},r=function(t,n){return Math.floor(Math.sqrt(t/(n/4)))},i=function(t,e,r,i,o){t.width=e,t.height=r;var a=t.getContext("2d"),_=.5*e,E=a.createRadialGradient(_,r+110,r-100,_,r+110,r+100);(function(t,e){for(var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:10,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,_=1-a,E=e.join(","),u=0;u<=o;u++){var I=u/o;t.addColorStop(a+_*I,"rgba(".concat(E,", ").concat(i(I)*r,")"))}})(E,i,o,void 0,8,.4),a.save(),a.translate(-250,0),a.scale(2,1),a.fillStyle=E,a.fillRect(0,0,e,r),a.restore()},o="undefined"!=typeof navigator,a="undefined"!=typeof document,_=500,E=200,u=o&&a&&document.createElement("canvas"),I=o&&a&&document.createElement("canvas"),c=o&&a&&document.createElement("canvas"),T=[40,40,40],f=[196,78,71],l=[54,151,99];o&&a&&(i(u,_,E,T,.85),i(I,_,E,f,1),i(c,_,E,l,1));var s=function(n){var r=n.utils.createView({name:"file-poster-overlay",tag:"canvas",ignoreRect:!0,create:function(t){var n,e;(e=t.root.element).width=(n=t.props.template).width,e.height=n.height,e.getContext("2d").drawImage(n,0,0)},mixins:{styles:["opacity"],animations:{opacity:{type:"spring",mass:25}}}}),o=function(t){var n=t.root;n.ref.overlayShadow.opacity=1,n.ref.overlayError.opacity=0,n.ref.overlaySuccess.opacity=0},a=function(t){var n=t.root;n.ref.overlayShadow.opacity=.25,n.ref.overlayError.opacity=1};return n.utils.createView({name:"file-poster-wrapper",create:function(e){var o=e.root,a=e.props,s=o.query("GET_FILE_POSTER_ITEM_OVERLAY_SHADOW_COLOR"),O=o.query("GET_FILE_POSTER_ITEM_OVERLAY_ERROR_COLOR"),R=o.query("GET_FILE_POSTER_ITEM_OVERLAY_SUCCESS_COLOR");s&&s!==T&&i(u,_,E,T=s,.85),O&&O!==f&&i(I,_,E,f=O,1),R&&R!==l&&i(c,_,E,l=R,1);var v=function(n){return n.utils.createView({name:"file-poster",tag:"div",ignoreRect:!0,create:function(t){var n=t.root;n.ref.image=document.createElement("img"),n.element.appendChild(n.ref.image)},write:n.utils.createRoute({DID_FILE_POSTER_LOAD:function(t){var n=t.root,e=t.props,r=e.id,i=n.query("GET_ITEM",{id:e.id});if(i){var o=i.getMetadata("poster");n.ref.image.src=o,n.dispatch("DID_FILE_POSTER_DRAW",{id:r})}}}),mixins:{styles:["scaleX","scaleY","opacity"],animations:{scaleX:t,scaleY:t,opacity:{type:"tween",duration:750}}}})}(n);o.ref.image=o.appendChildView(o.createChildView(v,{id:a.id,scaleX:1.25,scaleY:1.25,opacity:0})),o.ref.overlayShadow=o.appendChildView(o.createChildView(r,{template:u,opacity:0})),o.ref.overlaySuccess=o.appendChildView(o.createChildView(r,{template:c,opacity:0})),o.ref.overlayError=o.appendChildView(o.createChildView(r,{template:I,opacity:0}))},write:n.utils.createRoute({DID_FILE_POSTER_LOAD:function(t){t.root.ref.overlayShadow.opacity=1},DID_FILE_POSTER_DRAW:function(t){var n=t.root.ref.image;n.scaleX=1,n.scaleY=1,n.opacity=1},DID_FILE_POSTER_CONTAINER_CREATE:function(t){var n,r,i,o=t.root,a=t.props.id,_=o.query("GET_ITEM",a);if(_){var E=_.getMetadata("poster"),u=function(t){var n=o.query("GET_FILE_POSTER_CALCULATE_AVERAGE_IMAGE_COLOR")?e(t):null;_.setMetadata("color",n,!0),o.dispatch("DID_FILE_POSTER_LOAD",{id:a,data:t})};n=E,r=function(t,n){var e,r;o.dispatch("DID_FILE_POSTER_CALCULATE_SIZE",{id:a,width:t,height:n}),(e=E,r=o.query("GET_FILE_POSTER_CROSS_ORIGIN_ATTRIBUTE_VALUE"),new Promise((function(t,n){var i=new Image;"string"==typeof crossOrigin&&(i.crossOrigin=r),i.onload=function(){t(i)},i.onerror=function(t){n(t)},i.src=e}))).then(u)},(i=new Image).onload=function(){var t=i.naturalWidth,n=i.naturalHeight;i=null,r(t,n)},i.src=n}},DID_THROW_ITEM_LOAD_ERROR:a,DID_THROW_ITEM_PROCESSING_ERROR:a,DID_THROW_ITEM_INVALID:a,DID_COMPLETE_ITEM_PROCESSING:function(t){var n=t.root;n.ref.overlayShadow.opacity=.25,n.ref.overlaySuccess.opacity=1},DID_START_ITEM_PROCESSING:o,DID_REVERT_ITEM_PROCESSING:o})})},O=function(t){var n=t.addFilter,e=t.utils,r=e.Type,i=e.createRoute,o=s(t);return n("CREATE_VIEW",(function(t){var n=t.view,e=t.query;if((0,t.is)("file")&&e("GET_ALLOW_FILE_POSTER")){var r=function(t,r){var i=r.id,a=e("GET_ITEM",i);a&&a.getMetadata("poster")&&!a.archived&&t.ref.previousPoster!==a.getMetadata("poster")&&(t.ref.previousPoster=a.getMetadata("poster"),e("GET_FILE_POSTER_FILTER_ITEM")(a)&&(t.ref.filePoster&&n.removeChildView(t.ref.filePoster),t.ref.filePoster=n.appendChildView(n.createChildView(o,{id:i})),t.dispatch("DID_FILE_POSTER_CONTAINER_CREATE",{id:i})))},a=function(t){var n=t.root,e=n.query("GET_FILE_POSTER_HEIGHT");if(e)return e;var r=n.query("GET_FILE_POSTER_MIN_HEIGHT"),i=n.query("GET_FILE_POSTER_MAX_HEIGHT");if(r&&n.ref.imageHeight<r)return r;var o=n.rect.element.width*(n.ref.imageHeight/n.ref.imageWidth);return r&&o<r?r:i&&o>i?i:o};n.registerWriter(i({DID_LOAD_ITEM:function(t){r(t.root,t.props)},DID_FILE_POSTER_CALCULATE_SIZE:function(t){var n=t.root,e=t.action;n.ref.filePoster&&(n.ref.imageWidth=e.width,n.ref.imageHeight=e.height,n.ref.shouldUpdatePanelHeight=!0,n.dispatch("KICK"))},DID_UPDATE_ITEM_METADATA:function(t){var n=t.root,e=t.props;/poster/.test(t.action.change.key)&&r(n,e)}},(function(t){var n=t.root;n.ref.filePoster&&(n.rect.element.hidden||n.ref.shouldUpdatePanelHeight&&(n.dispatch("DID_UPDATE_PANEL_HEIGHT",{id:t.props.id,height:a({root:n})}),n.ref.shouldUpdatePanelHeight=!1))})))}})),{options:{allowFilePoster:[!0,r.BOOLEAN],filePosterHeight:[null,r.INT],filePosterMinHeight:[null,r.INT],filePosterMaxHeight:[null,r.INT],filePosterFilterItem:[function(){return!0},r.FUNCTION],filePosterCalculateAverageImageColor:[!1,r.BOOLEAN],filePosterCrossOriginAttributeValue:["Anonymous",r.STRING],filePosterItemOverlayShadowColor:[null,r.ARRAY],filePosterItemOverlayErrorColor:[null,r.ARRAY],filePosterItemOverlaySuccessColor:[null,r.ARRAY]}}};return"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:O})),O}()),r.exports),o=n({__proto__:null,default:t(i)},[i]);
4
+ import{d as t}from"./p-Dimo1ZpU.js";function n(t,n){return n.forEach((function(n){n&&"string"!=typeof n&&!Array.isArray(n)&&Object.keys(n).forEach((function(e){if("default"!==e&&!(e in t)){var r=Object.getOwnPropertyDescriptor(n,e);Object.defineProperty(t,e,r.get?r:{enumerable:!0,get:function(){return n[e]}})}}))})),Object.freeze(t)}var e,r={exports:{}},i=(e||(e=1,r.exports=function(){var t={type:"spring",stiffness:.5,damping:.45,mass:10},n=function(t){return-.5*(Math.cos(Math.PI*t)-1)},e=function(t){var n=Math.min(10/t.width,10/t.height),e=document.createElement("canvas"),i=e.getContext("2d"),o=e.width=Math.ceil(t.width*n),a=e.height=Math.ceil(t.height*n);i.drawImage(t,0,0,o,a);var _=null;try{_=i.getImageData(0,0,o,a).data}catch(t){return null}for(var E=_.length,u=0,I=0,c=0,T=0;T<E;T+=4)u+=_[T]*_[T],I+=_[T+1]*_[T+1],c+=_[T+2]*_[T+2];return{r:u=r(u,E),g:I=r(I,E),b:c=r(c,E)}},r=function(t,n){return Math.floor(Math.sqrt(t/(n/4)))},i=function(t,e,r,i,o){t.width=e,t.height=r;var a=t.getContext("2d"),_=.5*e,E=a.createRadialGradient(_,r+110,r-100,_,r+110,r+100);(function(t,e){for(var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:10,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,_=1-a,E=e.join(","),u=0;u<=o;u++){var I=u/o;t.addColorStop(a+_*I,"rgba(".concat(E,", ").concat(i(I)*r,")"))}})(E,i,o,void 0,8,.4),a.save(),a.translate(-250,0),a.scale(2,1),a.fillStyle=E,a.fillRect(0,0,e,r),a.restore()},o="undefined"!=typeof navigator,a="undefined"!=typeof document,_=500,E=200,u=o&&a&&document.createElement("canvas"),I=o&&a&&document.createElement("canvas"),c=o&&a&&document.createElement("canvas"),T=[40,40,40],f=[196,78,71],l=[54,151,99];o&&a&&(i(u,_,E,T,.85),i(I,_,E,f,1),i(c,_,E,l,1));var s=function(n){var r=n.utils.createView({name:"file-poster-overlay",tag:"canvas",ignoreRect:!0,create:function(t){var n,e;(e=t.root.element).width=(n=t.props.template).width,e.height=n.height,e.getContext("2d").drawImage(n,0,0)},mixins:{styles:["opacity"],animations:{opacity:{type:"spring",mass:25}}}}),o=function(t){var n=t.root;n.ref.overlayShadow.opacity=1,n.ref.overlayError.opacity=0,n.ref.overlaySuccess.opacity=0},a=function(t){var n=t.root;n.ref.overlayShadow.opacity=.25,n.ref.overlayError.opacity=1};return n.utils.createView({name:"file-poster-wrapper",create:function(e){var o=e.root,a=e.props,s=o.query("GET_FILE_POSTER_ITEM_OVERLAY_SHADOW_COLOR"),O=o.query("GET_FILE_POSTER_ITEM_OVERLAY_ERROR_COLOR"),R=o.query("GET_FILE_POSTER_ITEM_OVERLAY_SUCCESS_COLOR");s&&s!==T&&i(u,_,E,T=s,.85),O&&O!==f&&i(I,_,E,f=O,1),R&&R!==l&&i(c,_,E,l=R,1);var v=function(n){return n.utils.createView({name:"file-poster",tag:"div",ignoreRect:!0,create:function(t){var n=t.root;n.ref.image=document.createElement("img"),n.element.appendChild(n.ref.image)},write:n.utils.createRoute({DID_FILE_POSTER_LOAD:function(t){var n=t.root,e=t.props,r=e.id,i=n.query("GET_ITEM",{id:e.id});if(i){var o=i.getMetadata("poster");n.ref.image.src=o,n.dispatch("DID_FILE_POSTER_DRAW",{id:r})}}}),mixins:{styles:["scaleX","scaleY","opacity"],animations:{scaleX:t,scaleY:t,opacity:{type:"tween",duration:750}}}})}(n);o.ref.image=o.appendChildView(o.createChildView(v,{id:a.id,scaleX:1.25,scaleY:1.25,opacity:0})),o.ref.overlayShadow=o.appendChildView(o.createChildView(r,{template:u,opacity:0})),o.ref.overlaySuccess=o.appendChildView(o.createChildView(r,{template:c,opacity:0})),o.ref.overlayError=o.appendChildView(o.createChildView(r,{template:I,opacity:0}))},write:n.utils.createRoute({DID_FILE_POSTER_LOAD:function(t){t.root.ref.overlayShadow.opacity=1},DID_FILE_POSTER_DRAW:function(t){var n=t.root.ref.image;n.scaleX=1,n.scaleY=1,n.opacity=1},DID_FILE_POSTER_CONTAINER_CREATE:function(t){var n,r,i,o=t.root,a=t.props.id,_=o.query("GET_ITEM",a);if(_){var E=_.getMetadata("poster"),u=function(t){var n=o.query("GET_FILE_POSTER_CALCULATE_AVERAGE_IMAGE_COLOR")?e(t):null;_.setMetadata("color",n,!0),o.dispatch("DID_FILE_POSTER_LOAD",{id:a,data:t})};n=E,r=function(t,n){var e,r;o.dispatch("DID_FILE_POSTER_CALCULATE_SIZE",{id:a,width:t,height:n}),(e=E,r=o.query("GET_FILE_POSTER_CROSS_ORIGIN_ATTRIBUTE_VALUE"),new Promise((function(t,n){var i=new Image;"string"==typeof crossOrigin&&(i.crossOrigin=r),i.onload=function(){t(i)},i.onerror=function(t){n(t)},i.src=e}))).then(u)},(i=new Image).onload=function(){var t=i.naturalWidth,n=i.naturalHeight;i=null,r(t,n)},i.src=n}},DID_THROW_ITEM_LOAD_ERROR:a,DID_THROW_ITEM_PROCESSING_ERROR:a,DID_THROW_ITEM_INVALID:a,DID_COMPLETE_ITEM_PROCESSING:function(t){var n=t.root;n.ref.overlayShadow.opacity=.25,n.ref.overlaySuccess.opacity=1},DID_START_ITEM_PROCESSING:o,DID_REVERT_ITEM_PROCESSING:o})})},O=function(t){var n=t.addFilter,e=t.utils,r=e.Type,i=e.createRoute,o=s(t);return n("CREATE_VIEW",(function(t){var n=t.view,e=t.query;if((0,t.is)("file")&&e("GET_ALLOW_FILE_POSTER")){var r=function(t,r){var i=r.id,a=e("GET_ITEM",i);a&&a.getMetadata("poster")&&!a.archived&&t.ref.previousPoster!==a.getMetadata("poster")&&(t.ref.previousPoster=a.getMetadata("poster"),e("GET_FILE_POSTER_FILTER_ITEM")(a)&&(t.ref.filePoster&&n.removeChildView(t.ref.filePoster),t.ref.filePoster=n.appendChildView(n.createChildView(o,{id:i})),t.dispatch("DID_FILE_POSTER_CONTAINER_CREATE",{id:i})))},a=function(t){var n=t.root,e=n.query("GET_FILE_POSTER_HEIGHT");if(e)return e;var r=n.query("GET_FILE_POSTER_MIN_HEIGHT"),i=n.query("GET_FILE_POSTER_MAX_HEIGHT");if(r&&n.ref.imageHeight<r)return r;var o=n.rect.element.width*(n.ref.imageHeight/n.ref.imageWidth);return r&&o<r?r:i&&o>i?i:o};n.registerWriter(i({DID_LOAD_ITEM:function(t){r(t.root,t.props)},DID_FILE_POSTER_CALCULATE_SIZE:function(t){var n=t.root,e=t.action;n.ref.filePoster&&(n.ref.imageWidth=e.width,n.ref.imageHeight=e.height,n.ref.shouldUpdatePanelHeight=!0,n.dispatch("KICK"))},DID_UPDATE_ITEM_METADATA:function(t){var n=t.root,e=t.props;/poster/.test(t.action.change.key)&&r(n,e)}},(function(t){var n=t.root;n.ref.filePoster&&(n.rect.element.hidden||n.ref.shouldUpdatePanelHeight&&(n.dispatch("DID_UPDATE_PANEL_HEIGHT",{id:t.props.id,height:a({root:n})}),n.ref.shouldUpdatePanelHeight=!1))})))}})),{options:{allowFilePoster:[!0,r.BOOLEAN],filePosterHeight:[null,r.INT],filePosterMinHeight:[null,r.INT],filePosterMaxHeight:[null,r.INT],filePosterFilterItem:[function(){return!0},r.FUNCTION],filePosterCalculateAverageImageColor:[!1,r.BOOLEAN],filePosterCrossOriginAttributeValue:["Anonymous",r.STRING],filePosterItemOverlayShadowColor:[null,r.ARRAY],filePosterItemOverlayErrorColor:[null,r.ARRAY],filePosterItemOverlaySuccessColor:[null,r.ARRAY]}}};return"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:O})),O}()),r.exports),o=n({__proto__:null,default:t(i)},[i]);
5
5
  /*!
6
6
  * FilePondPluginFilePoster 2.5.2
7
7
  * Licensed under MIT, https://opensource.org/licenses/MIT/
@@ -0,0 +1,4 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ const{getOwnPropertyNames:t,getOwnPropertySymbols:r}=Object,{hasOwnProperty:e}=Object.prototype;function s(t,r){return function(e,s,n){return t(e,s,n)&&r(e,s,n)}}function n(t){return function(r,e,s){if(!r||!e||"object"!=typeof r||"object"!=typeof e)return t(r,e,s);const{cache:n}=s,i=n.get(r),o=n.get(e);if(i&&o)return i===e&&o===r;n.set(r,e),n.set(e,r);const a=t(r,e,s);return n.delete(r),n.delete(e),a}}function i(e){return t(e).concat(r(e))}const o=Object.hasOwn||((t,r)=>e.call(t,r));function a(t,r){return t===r||!t&&!r&&t!=t&&r!=r}const{getOwnPropertyDescriptor:c,keys:u}=Object;function h(t,r){return t.byteLength===r.byteLength&&A(new Uint8Array(t),new Uint8Array(r))}function l(t,r,e){let s=t.length;if(r.length!==s)return!1;for(;s-- >0;)if(!e.equals(t[s],r[s],s,s,t,r,e))return!1;return!0}function f(t,r){return t.byteLength===r.byteLength&&A(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(r.buffer,r.byteOffset,r.byteLength))}function m(t,r){return a(t.getTime(),r.getTime())}function p(t,r){return t.name===r.name&&t.message===r.message&&t.cause===r.cause&&t.stack===r.stack}function d(t,r){return t===r}function g(t,r,e){const s=t.size;if(s!==r.size)return!1;if(!s)return!0;const n=new Array(s),i=t.entries();let o,a,c=0;for(;(o=i.next())&&!o.done;){const s=r.entries();let i=!1,u=0;for(;(a=s.next())&&!a.done;){if(n[u]){u++;continue}const s=o.value,h=a.value;if(e.equals(s[0],h[0],c,u,t,r,e)&&e.equals(s[1],h[1],s[0],h[0],t,r,e)){i=n[u]=!0;break}u++}if(!i)return!1;c++}return!0}const w=a;function y(t,r,e){const s=u(t);let n=s.length;if(u(r).length!==n)return!1;for(;n-- >0;)if(!x(t,r,e,s[n]))return!1;return!0}function b(t,r,e){const s=i(t);let n,o,a,u=s.length;if(i(r).length!==u)return!1;for(;u-- >0;){if(n=s[u],!x(t,r,e,n))return!1;if(o=c(t,n),a=c(r,n),(o||a)&&(!o||!a||o.configurable!==a.configurable||o.enumerable!==a.enumerable||o.writable!==a.writable))return!1}return!0}function M(t,r){return a(t.valueOf(),r.valueOf())}function E(t,r){return t.source===r.source&&t.flags===r.flags}function j(t,r,e){const s=t.size;if(s!==r.size)return!1;if(!s)return!0;const n=new Array(s),i=t.values();let o,a;for(;(o=i.next())&&!o.done;){const s=r.values();let i=!1,c=0;for(;(a=s.next())&&!a.done;){if(!n[c]&&e.equals(o.value,a.value,o.value,a.value,t,r,e)){i=n[c]=!0;break}c++}if(!i)return!1}return!0}function A(t,r){let e=t.byteLength;if(r.byteLength!==e||t.byteOffset!==r.byteOffset)return!1;for(;e-- >0;)if(t[e]!==r[e])return!1;return!0}function v(t,r){return t.hostname===r.hostname&&t.pathname===r.pathname&&t.protocol===r.protocol&&t.port===r.port&&t.hash===r.hash&&t.username===r.username&&t.password===r.password}function x(t,r,e,s){return!("_owner"!==s&&"__o"!==s&&"__v"!==s||!t.$$typeof&&!r.$$typeof)||o(r,s)&&e.equals(t[s],r[s],s,s,t,r,e)}const k={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},q=Object.prototype.toString;const O=C();function C(t={}){const{circular:r=!1,createInternalComparator:e,createState:i,strict:o=!1}=t,a=function({circular:t,createCustomConfig:r,strict:e}){let i={areArrayBuffersEqual:h,areArraysEqual:e?b:l,areDataViewsEqual:f,areDatesEqual:m,areErrorsEqual:p,areFunctionsEqual:d,areMapsEqual:e?s(g,b):g,areNumbersEqual:w,areObjectsEqual:e?b:y,arePrimitiveWrappersEqual:M,areRegExpsEqual:E,areSetsEqual:e?s(j,b):j,areTypedArraysEqual:e?s(A,b):A,areUrlsEqual:v,unknownTagComparators:void 0};if(r&&(i=Object.assign({},i,r(i))),t){const t=n(i.areArraysEqual),r=n(i.areMapsEqual),e=n(i.areObjectsEqual),s=n(i.areSetsEqual);i=Object.assign({},i,{areArraysEqual:t,areMapsEqual:r,areObjectsEqual:e,areSetsEqual:s})}return i}(t),c=function({areArrayBuffersEqual:t,areArraysEqual:r,areDataViewsEqual:e,areDatesEqual:s,areErrorsEqual:n,areFunctionsEqual:i,areMapsEqual:o,areNumbersEqual:a,areObjectsEqual:c,arePrimitiveWrappersEqual:u,areRegExpsEqual:h,areSetsEqual:l,areTypedArraysEqual:f,areUrlsEqual:m,unknownTagComparators:p}){return function(d,g,w){if(d===g)return!0;if(null==d||null==g)return!1;const y=typeof d;if(y!==typeof g)return!1;if("object"!==y)return"number"===y?a(d,g,w):"function"===y&&i(d,g,w);const b=d.constructor;if(b!==g.constructor)return!1;if(b===Object)return c(d,g,w);if(Array.isArray(d))return r(d,g,w);if(b===Date)return s(d,g,w);if(b===RegExp)return h(d,g,w);if(b===Map)return o(d,g,w);if(b===Set)return l(d,g,w);const M=q.call(d);if("[object Date]"===M)return s(d,g,w);if("[object RegExp]"===M)return h(d,g,w);if("[object Map]"===M)return o(d,g,w);if("[object Set]"===M)return l(d,g,w);if("[object Object]"===M)return"function"!=typeof d.then&&"function"!=typeof g.then&&c(d,g,w);if("[object URL]"===M)return m(d,g,w);if("[object Error]"===M)return n(d,g,w);if("[object Arguments]"===M)return c(d,g,w);if(k[M])return f(d,g,w);if("[object ArrayBuffer]"===M)return t(d,g,w);if("[object DataView]"===M)return e(d,g,w);if("[object Boolean]"===M||"[object Number]"===M||"[object String]"===M)return u(d,g,w);if(p){let t=p[M];if(!t){const r=null!=(E=d)?E[Symbol.toStringTag]:void 0;r&&(t=p[r])}if(t)return t(d,g,w)}var E;return!1}}(a);var u;return function({circular:t,comparator:r,createState:e,equals:s,strict:n}){if(e)return function(i,o){const{cache:a=(t?new WeakMap:void 0),meta:c}=e();return r(i,o,{cache:a,equals:s,meta:c,strict:n})};if(t)return function(t,e){return r(t,e,{cache:new WeakMap,equals:s,meta:void 0,strict:n})};const i={cache:void 0,equals:s,meta:void 0,strict:n};return function(t,e){return r(t,e,i)}}({circular:r,comparator:c,createState:i,equals:e?e(c):(u=c,function(t,r,e,s,n,i,o){return u(t,r,o)}),strict:o})}C({strict:!0}),C({circular:!0}),C({circular:!0,strict:!0}),C({createInternalComparator:()=>a}),C({strict:!0,createInternalComparator:()=>a}),C({circular:!0,createInternalComparator:()=>a}),C({circular:!0,createInternalComparator:()=>a,strict:!0});const U=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class P{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[r,e]=new Uint8Array(t,0,2);if(219!==r)throw new Error("Data does not appear to be in a KDBush format.");const s=e>>4;if(1!==s)throw new Error(`Got v${s} data when expected v1.`);const n=U[15&e];if(!n)throw new Error("Unrecognized array type.");const[i]=new Uint16Array(t,2,1),[o]=new Uint32Array(t,4,1);return new P(o,i,n,t)}constructor(t,r=64,e=Float64Array,s){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=e,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const n=U.indexOf(this.ArrayType),i=2*t*this.ArrayType.BYTES_PER_ELEMENT,o=t*this.IndexArrayType.BYTES_PER_ELEMENT,a=(8-o%8)%8;if(n<0)throw new Error(`Unexpected typed array class: ${e}.`);s&&s instanceof ArrayBuffer?(this.data=s,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+o+a,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+i+o+a),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+o+a,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+n]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=t)}add(t,r){const e=this._pos>>1;return this.ids[e]=e,this.coords[this._pos++]=t,this.coords[this._pos++]=r,e}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return S(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,r,e,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:i,nodeSize:o}=this,a=[0,n.length-1,0],c=[];for(;a.length;){const u=a.pop()||0,h=a.pop()||0,l=a.pop()||0;if(h-l<=o){for(let o=l;o<=h;o++){const a=i[2*o],u=i[2*o+1];a>=t&&a<=e&&u>=r&&u<=s&&c.push(n[o])}continue}const f=l+h>>1,m=i[2*f],p=i[2*f+1];m>=t&&m<=e&&p>=r&&p<=s&&c.push(n[f]),(0===u?t<=m:r<=p)&&(a.push(l),a.push(f-1),a.push(1-u)),(0===u?e>=m:s>=p)&&(a.push(f+1),a.push(h),a.push(1-u))}return c}within(t,r,e){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:s,coords:n,nodeSize:i}=this,o=[0,s.length-1,0],a=[],c=e*e;for(;o.length;){const u=o.pop()||0,h=o.pop()||0,l=o.pop()||0;if(h-l<=i){for(let e=l;e<=h;e++)z(n[2*e],n[2*e+1],t,r)<=c&&a.push(s[e]);continue}const f=l+h>>1,m=n[2*f],p=n[2*f+1];z(m,p,t,r)<=c&&a.push(s[f]),(0===u?t-e<=m:r-e<=p)&&(o.push(l),o.push(f-1),o.push(1-u)),(0===u?t+e>=m:r+e>=p)&&(o.push(f+1),o.push(h),o.push(1-u))}return a}}function S(t,r,e,s,n,i){if(n-s<=e)return;const o=s+n>>1;D(t,r,o,s,n,i),S(t,r,e,s,o-1,1-i),S(t,r,e,o+1,n,1-i)}function D(t,r,e,s,n,i){for(;n>s;){if(n-s>600){const o=n-s+1,a=e-s+1,c=Math.log(o),u=.5*Math.exp(2*c/3),h=.5*Math.sqrt(c*u*(o-u)/o)*(a-o/2<0?-1:1);D(t,r,e,Math.max(s,Math.floor(e-a*u/o+h)),Math.min(n,Math.floor(e+(o-a)*u/o+h)),i)}const o=r[2*e+i];let a=s,c=n;for(I(t,r,s,e),r[2*n+i]>o&&I(t,r,s,n);a<c;){for(I(t,r,a,c),a++,c--;r[2*a+i]<o;)a++;for(;r[2*c+i]>o;)c--}r[2*s+i]===o?I(t,r,s,c):(c++,I(t,r,c,n)),c<=e&&(s=c+1),e<=c&&(n=c-1)}}function I(t,r,e,s){_(t,e,s),_(r,2*e,2*s),_(r,2*e+1,2*s+1)}function _(t,r,e){const s=t[r];t[r]=t[e],t[e]=s}function z(t,r,e,s){const n=t-e,i=r-s;return n*n+i*i}const Z={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},F=Math.fround||(B=new Float32Array(1),t=>(B[0]=+t,B[0]));var B;class ${constructor(t){this.options=Object.assign(Object.create(Z),t),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(t){const{log:r,minZoom:e,maxZoom:s}=this.options;r&&console.time("total time");const n=`prepare ${t.length} points`;r&&console.time(n),this.points=t;const i=[];for(let r=0;r<t.length;r++){const e=t[r];if(!e.geometry)continue;const[s,n]=e.geometry.coordinates,o=F(T(s)),a=F(R(n));i.push(o,a,1/0,r,-1,1),this.options.reduce&&i.push(0)}let o=this.trees[s+1]=this._createTree(i);r&&console.timeEnd(n);for(let t=s;t>=e;t--){const e=+Date.now();o=this.trees[t]=this._createTree(this._cluster(o,t)),r&&console.log("z%d: %d clusters in %dms",t,o.numItems,+Date.now()-e)}return r&&console.timeEnd("total time"),this}getClusters(t,r){let e=((t[0]+180)%360+360)%360-180;const s=Math.max(-90,Math.min(90,t[1]));let n=180===t[2]?180:((t[2]+180)%360+360)%360-180;const i=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)e=-180,n=180;else if(e>n){const t=this.getClusters([e,s,180,i],r),o=this.getClusters([-180,s,n,i],r);return t.concat(o)}const o=this.trees[this._limitZoom(r)],a=o.range(T(e),R(i),T(n),R(s)),c=o.data,u=[];for(const t of a){const r=this.stride*t;u.push(c[r+5]>1?N(c,r,this.clusterProps):this.points[c[r+3]])}return u}getChildren(t){const r=this._getOriginId(t),e=this._getOriginZoom(t),s="No cluster with the specified id.",n=this.trees[e];if(!n)throw new Error(s);const i=n.data;if(r*this.stride>=i.length)throw new Error(s);const o=this.options.radius/(this.options.extent*Math.pow(2,e-1)),a=n.within(i[r*this.stride],i[r*this.stride+1],o),c=[];for(const r of a){const e=r*this.stride;i[e+4]===t&&c.push(i[e+5]>1?N(i,e,this.clusterProps):this.points[i[e+3]])}if(0===c.length)throw new Error(s);return c}getLeaves(t,r,e){const s=[];return this._appendLeaves(s,t,r=r||10,e=e||0,0),s}getTile(t,r,e){const s=this.trees[this._limitZoom(t)],n=Math.pow(2,t),{extent:i,radius:o}=this.options,a=o/i,c=(e-a)/n,u=(e+1+a)/n,h={features:[]};return this._addTileFeatures(s.range((r-a)/n,c,(r+1+a)/n,u),s.data,r,e,n,h),0===r&&this._addTileFeatures(s.range(1-a/n,c,1,u),s.data,n,e,n,h),r===n-1&&this._addTileFeatures(s.range(0,c,a/n,u),s.data,-1,e,n,h),h.features.length?h:null}getClusterExpansionZoom(t){let r=this._getOriginZoom(t)-1;for(;r<=this.options.maxZoom;){const e=this.getChildren(t);if(r++,1!==e.length)break;t=e[0].properties.cluster_id}return r}_appendLeaves(t,r,e,s,n){const i=this.getChildren(r);for(const r of i){const i=r.properties;if(i&&i.cluster?n+i.point_count<=s?n+=i.point_count:n=this._appendLeaves(t,i.cluster_id,e,s,n):n<s?n++:t.push(r),t.length===e)break}return n}_createTree(t){const r=new P(t.length/this.stride|0,this.options.nodeSize,Float32Array);for(let e=0;e<t.length;e+=this.stride)r.add(t[e],t[e+1]);return r.finish(),r.data=t,r}_addTileFeatures(t,r,e,s,n,i){for(const o of t){const t=o*this.stride,a=r[t+5]>1;let c,u,h;if(a)c=W(r,t,this.clusterProps),u=r[t],h=r[t+1];else{const e=this.points[r[t+3]];c=e.properties;const[s,n]=e.geometry.coordinates;u=T(s),h=R(n)}const l={type:1,geometry:[[Math.round(this.options.extent*(u*n-e)),Math.round(this.options.extent*(h*n-s))]],tags:c};let f;f=a||this.options.generateId?r[t+3]:this.points[r[t+3]].id,void 0!==f&&(l.id=f),i.features.push(l)}}_limitZoom(t){return Math.max(this.options.minZoom,Math.min(Math.floor(+t),this.options.maxZoom+1))}_cluster(t,r){const{radius:e,extent:s,reduce:n,minPoints:i}=this.options,o=e/(s*Math.pow(2,r)),a=t.data,c=[],u=this.stride;for(let e=0;e<a.length;e+=u){if(a[e+2]<=r)continue;a[e+2]=r;const s=a[e],h=a[e+1],l=t.within(a[e],a[e+1],o),f=a[e+5];let m=f;for(const t of l){const e=t*u;a[e+2]>r&&(m+=a[e+5])}if(m>f&&m>=i){let t,i=s*f,o=h*f,p=-1;const d=(e/u<<5)+(r+1)+this.points.length;for(const s of l){const c=s*u;if(a[c+2]<=r)continue;a[c+2]=r;const h=a[c+5];i+=a[c]*h,o+=a[c+1]*h,a[c+4]=d,n&&(t||(t=this._map(a,e,!0),p=this.clusterProps.length,this.clusterProps.push(t)),n(t,this._map(a,c)))}a[e+4]=d,c.push(i/m,o/m,1/0,d,-1,m),n&&c.push(p)}else{for(let t=0;t<u;t++)c.push(a[e+t]);if(m>1)for(const t of l){const e=t*u;if(!(a[e+2]<=r)){a[e+2]=r;for(let t=0;t<u;t++)c.push(a[e+t])}}}}return c}_getOriginId(t){return t-this.points.length>>5}_getOriginZoom(t){return(t-this.points.length)%32}_map(t,r,e){if(t[r+5]>1){const s=this.clusterProps[t[r+6]];return e?Object.assign({},s):s}const s=this.points[t[r+3]].properties,n=this.options.map(s);return e&&n===s?Object.assign({},n):n}}function N(t,r,e){return{type:"Feature",id:t[r+3],properties:W(t,r,e),geometry:{type:"Point",coordinates:[(s=t[r],360*(s-.5)),V(t[r+1])]}};var s}function W(t,r,e){const s=t[r+5],n=s>=1e4?`${Math.round(s/1e3)}k`:s>=1e3?Math.round(s/100)/10+"k":s,i=t[r+6],o=-1===i?{}:Object.assign({},e[i]);return Object.assign(o,{cluster:!0,cluster_id:t[r+3],point_count:s,point_count_abbreviated:n})}function T(t){return t/360+.5}function R(t){const r=Math.sin(t*Math.PI/180),e=.5-.25*Math.log((1+r)/(1-r))/Math.PI;return e<0?0:e>1?1:e}function V(t){const r=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(r))/Math.PI-90}function L(t,r){var e={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&r.indexOf(s)<0&&(e[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n<s.length;n++)r.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(e[s[n]]=t[s[n]])}return e}"function"==typeof SuppressedError&&SuppressedError;class G{static isAdvancedMarkerAvailable(t){return google.maps.marker&&!0===t.getMapCapabilities().isAdvancedMarkersAvailable}static isAdvancedMarker(t){return google.maps.marker&&t instanceof google.maps.marker.AdvancedMarkerElement}static setMap(t,r){this.isAdvancedMarker(t)?t.map=r:t.setMap(r)}static getPosition(t){if(this.isAdvancedMarker(t)){if(t.position){if(t.position instanceof google.maps.LatLng)return t.position;if(Number.isFinite(t.position.lat)&&Number.isFinite(t.position.lng))return new google.maps.LatLng(t.position.lat,t.position.lng)}return new google.maps.LatLng(null)}return t.getPosition()}static getVisible(t){return!!this.isAdvancedMarker(t)||t.getVisible()}}class K{constructor({markers:t,position:r}){this.markers=[],t&&(this.markers=t),r&&(this._position=r instanceof google.maps.LatLng?r:new google.maps.LatLng(r))}get bounds(){if(0===this.markers.length&&!this._position)return;const t=new google.maps.LatLngBounds(this._position,this._position);for(const r of this.markers)t.extend(G.getPosition(r));return t}get position(){return this._position||this.bounds.getCenter()}get count(){return this.markers.filter((t=>G.getVisible(t))).length}push(t){this.markers.push(t)}delete(){this.marker&&(G.setMap(this.marker,null),this.marker=void 0),this.markers.length=0}}function H(t,r="assertion failed"){if(null==t)throw Error(r)}const J=(t,r,e,s)=>{const n=t.getBounds();H(n);const i=Q(n,r,s);return e.filter((t=>i.contains(G.getPosition(t))))},Q=(t,r,e)=>{const{northEast:s,southWest:n}=tt(t,r),i=rt({northEast:s,southWest:n},e);return et(i,r)},X=(t,r,e)=>{const s=Q(t,r,e),n=s.getNorthEast(),i=s.getSouthWest();return[i.lng(),i.lat(),n.lng(),n.lat()]},Y=(t,r)=>{const e=(r.lat-t.lat)*Math.PI/180,s=(r.lng-t.lng)*Math.PI/180,n=Math.sin(e/2),i=Math.sin(s/2),o=n*n+Math.cos(t.lat*Math.PI/180)*Math.cos(r.lat*Math.PI/180)*i*i;return 2*Math.atan2(Math.sqrt(o),Math.sqrt(1-o))*6371},tt=(t,r)=>{const e=r.fromLatLngToDivPixel(t.getNorthEast()),s=r.fromLatLngToDivPixel(t.getSouthWest());return H(e),H(s),{northEast:e,southWest:s}},rt=({northEast:t,southWest:r},e)=>(t.x+=e,t.y-=e,r.x-=e,r.y+=e,{northEast:t,southWest:r}),et=({northEast:t,southWest:r},e)=>{const s=e.fromDivPixelToLatLng(r),n=e.fromDivPixelToLatLng(t);return new google.maps.LatLngBounds(s,n)};class st{constructor({maxZoom:t=16}){this.maxZoom=t}noop({markers:t}){return it(t)}}class nt extends st{constructor(t){var{viewportPadding:r=60}=t;super(L(t,["viewportPadding"])),this.viewportPadding=60,this.viewportPadding=r}calculate({markers:t,map:r,mapCanvasProjection:e}){const s=r.getZoom();return H(s),s>=this.maxZoom?{clusters:this.noop({markers:t}),changed:!1}:{clusters:this.cluster({markers:J(r,e,t,this.viewportPadding),map:r,mapCanvasProjection:e})}}}const it=t=>t.map((t=>new K({position:G.getPosition(t),markers:[t]})));class ot extends nt{constructor(t){var{maxDistance:r=4e4,gridSize:e=40}=t;super(L(t,["maxDistance","gridSize"])),this.clusters=[],this.state={zoom:-1},this.maxDistance=r,this.gridSize=e}calculate({markers:t,map:r,mapCanvasProjection:e}){const s=r.getZoom();H(s);const n={zoom:s};let i=!1;return this.state.zoom>=this.maxZoom&&n.zoom>=this.maxZoom||(i=!O(this.state,n)),this.state=n,s>=this.maxZoom?{clusters:this.noop({markers:t}),changed:i}:{clusters:this.cluster({markers:J(r,e,t,this.viewportPadding),map:r,mapCanvasProjection:e})}}cluster({markers:t,map:r,mapCanvasProjection:e}){return this.clusters=[],t.forEach((t=>{this.addToClosestCluster(t,r,e)})),this.clusters}addToClosestCluster(t,r,e){let s=this.maxDistance,n=null;for(let r=0;r<this.clusters.length;r++){const e=this.clusters[r];H(e.bounds);const i=Y(e.bounds.getCenter().toJSON(),G.getPosition(t).toJSON());i<s&&(s=i,n=e)}if(n)if(H(n.bounds),Q(n.bounds,e,this.gridSize).contains(G.getPosition(t)))n.push(t);else{const r=new K({markers:[t]});this.clusters.push(r)}else{const r=new K({markers:[t]});this.clusters.push(r)}}}class at extends st{constructor(t){super(L(t,[]))}calculate({markers:t,map:r,mapCanvasProjection:e}){return{clusters:this.cluster({markers:t,map:r,mapCanvasProjection:e}),changed:!1}}cluster(t){return this.noop(t)}}class ct extends st{constructor(t){var{maxZoom:r,radius:e=60}=t,s=L(t,["maxZoom","radius"]);super({maxZoom:r}),this.markers=[],this.clusters=[],this.state={zoom:-1},this.superCluster=new $(Object.assign({maxZoom:this.maxZoom,radius:e},s))}calculate(t){let r=!1,e=t.map.getZoom();H(e),e=Math.round(e);const s={zoom:e};if(!O(t.markers,this.markers)){r=!0,this.markers=[...t.markers];const e=this.markers.map((t=>{const r=G.getPosition(t);return{type:"Feature",geometry:{type:"Point",coordinates:[r.lng(),r.lat()]},properties:{marker:t}}}));this.superCluster.load(e)}return r||(this.state.zoom<=this.maxZoom||s.zoom<=this.maxZoom)&&(r=!O(this.state,s)),this.state=s,0===t.markers.length?(this.clusters=[],{clusters:this.clusters,changed:r}):(r&&(this.clusters=this.cluster(t)),{clusters:this.clusters,changed:r})}cluster({map:t}){const r=t.getZoom();return H(r),this.superCluster.getClusters([-180,-90,180,90],Math.round(r)).map((t=>this.transformCluster(t)))}transformCluster({geometry:{coordinates:[t,r]},properties:e}){if(e.cluster)return new K({markers:this.superCluster.getLeaves(e.cluster_id,1/0).map((t=>t.properties.marker)),position:{lat:r,lng:t}});const s=e.marker;return new K({markers:[s],position:G.getPosition(s)})}}class ut extends nt{constructor(t){var{maxZoom:r,radius:e=60,viewportPadding:s=60}=t,n=L(t,["maxZoom","radius","viewportPadding"]);super({maxZoom:r,viewportPadding:s}),this.markers=[],this.clusters=[],this.superCluster=new $(Object.assign({maxZoom:this.maxZoom,radius:e},n)),this.state={zoom:-1,view:[0,0,0,0]}}calculate(t){const r=this.getViewportState(t);let e=!O(this.state,r);if(!O(t.markers,this.markers)){e=!0,this.markers=[...t.markers];const r=this.markers.map((t=>{const r=G.getPosition(t);return{type:"Feature",geometry:{type:"Point",coordinates:[r.lng(),r.lat()]},properties:{marker:t}}}));this.superCluster.load(r)}return e&&(this.clusters=this.cluster(t),this.state=r),{clusters:this.clusters,changed:e}}cluster(t){const r=this.getViewportState(t);return this.superCluster.getClusters(r.view,r.zoom).map((t=>this.transformCluster(t)))}transformCluster({geometry:{coordinates:[t,r]},properties:e}){if(e.cluster)return new K({markers:this.superCluster.getLeaves(e.cluster_id,1/0).map((t=>t.properties.marker)),position:{lat:r,lng:t}});const s=e.marker;return new K({markers:[s],position:G.getPosition(s)})}getViewportState(t){const r=t.map.getZoom(),e=t.map.getBounds();return H(r),H(e),{zoom:Math.round(r),view:X(e,t.mapCanvasProjection,this.viewportPadding)}}}class ht{constructor(t,r){this.markers={sum:t.length};const e=r.map((t=>t.count)),s=e.reduce(((t,r)=>t+r),0);this.clusters={count:r.length,markers:{mean:s/r.length,sum:s,min:Math.min(...e),max:Math.max(...e)}}}}class lt{render({count:t,position:r},e,s){const n=`<svg fill="${t>Math.max(10,e.clusters.markers.mean)?"#ff0000":"#0000ff"}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 240" width="50" height="50">\n<circle cx="120" cy="120" opacity=".6" r="70" />\n<circle cx="120" cy="120" opacity=".3" r="90" />\n<circle cx="120" cy="120" opacity=".2" r="110" />\n<text x="50%" y="50%" style="fill:#fff" text-anchor="middle" font-size="50" dominant-baseline="middle" font-family="roboto,arial,sans-serif">${t}</text>\n</svg>`,i=`Cluster of ${t} markers`,o=Number(google.maps.Marker.MAX_ZINDEX)+t;if(G.isAdvancedMarkerAvailable(s)){const t=(new DOMParser).parseFromString(n,"image/svg+xml").documentElement;return t.setAttribute("transform","translate(0 25)"),new google.maps.marker.AdvancedMarkerElement({map:s,position:r,zIndex:o,title:i,content:t})}const a={position:r,zIndex:o,title:i,icon:{url:`data:image/svg+xml;base64,${btoa(n)}`,anchor:new google.maps.Point(25,25)}};return new google.maps.Marker(a)}}class ft{constructor(){!function(t,r){for(let e in r.prototype)t.prototype[e]=r.prototype[e]}(ft,google.maps.OverlayView)}}var mt;!function(t){t.CLUSTERING_BEGIN="clusteringbegin",t.CLUSTERING_END="clusteringend",t.CLUSTER_CLICK="click",t.GMP_CLICK="gmp-click"}(mt||(mt={}));const pt=(t,r,e)=>{r.bounds&&e.fitBounds(r.bounds)};class dt extends ft{constructor({map:t,markers:r=[],algorithmOptions:e={},algorithm:s=new ct(e),renderer:n=new lt,onClusterClick:i=pt}){super(),this.map=null,this.idleListener=null,this.markers=[...r],this.clusters=[],this.algorithm=s,this.renderer=n,this.onClusterClick=i,t&&this.setMap(t)}addMarker(t,r){this.markers.includes(t)||(this.markers.push(t),r||this.render())}addMarkers(t,r){t.forEach((t=>{this.addMarker(t,!0)})),r||this.render()}removeMarker(t,r){const e=this.markers.indexOf(t);return-1!==e&&(G.setMap(t,null),this.markers.splice(e,1),r||this.render(),!0)}removeMarkers(t,r){let e=!1;return t.forEach((t=>{e=this.removeMarker(t,!0)||e})),e&&!r&&this.render(),e}clearMarkers(t){this.markers.length=0,t||this.render()}render(){const t=this.getMap();if(t instanceof google.maps.Map&&t.getProjection()){google.maps.event.trigger(this,mt.CLUSTERING_BEGIN,this);const{clusters:r,changed:e}=this.algorithm.calculate({markers:this.markers,map:t,mapCanvasProjection:this.getProjection()});if(e||null==e){const t=new Set;for(const e of r)1==e.markers.length&&t.add(e.markers[0]);const e=[];for(const r of this.clusters)null!=r.marker&&(1==r.markers.length?t.has(r.marker)||G.setMap(r.marker,null):e.push(r.marker));this.clusters=r,this.renderClusters(),requestAnimationFrame((()=>e.forEach((t=>G.setMap(t,null)))))}google.maps.event.trigger(this,mt.CLUSTERING_END,this)}}onAdd(){const t=this.getMap();H(t),this.idleListener=t.addListener("idle",this.render.bind(this)),this.render()}onRemove(){this.idleListener&&google.maps.event.removeListener(this.idleListener),this.reset()}reset(){this.markers.forEach((t=>G.setMap(t,null))),this.clusters.forEach((t=>t.delete())),this.clusters=[]}renderClusters(){const t=new ht(this.markers,this.clusters),r=this.getMap();this.clusters.forEach((e=>{if(1===e.markers.length)e.marker=e.markers[0];else if(e.marker=this.renderer.render(e,t,r),e.markers.forEach((t=>G.setMap(t,null))),this.onClusterClick){const t=G.isAdvancedMarker(e.marker)?mt.GMP_CLICK:mt.CLUSTER_CLICK;e.marker.addListener(t,(t=>{google.maps.event.trigger(this,mt.CLUSTER_CLICK,e),this.onClusterClick(t,e,r)}))}G.setMap(e.marker,r)}))}}export{st as AbstractAlgorithm,nt as AbstractViewportAlgorithm,K as Cluster,ht as ClusterStats,lt as DefaultRenderer,ot as GridAlgorithm,dt as MarkerClusterer,mt as MarkerClustererEvents,G as MarkerUtils,at as NoopAlgorithm,ct as SuperClusterAlgorithm,ut as SuperClusterViewportAlgorithm,pt as defaultOnClusterClickHandler,Y as distanceBetweenPoints,Q as extendBoundsToPaddedViewport,rt as extendPixelBounds,J as filterMarkersToPaddedViewport,X as getPaddedViewport,it as noop,et as pixelBoundsToLatLngBounds}
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{d as e}from"./p-CrNw20pf.js";function E(e,E){return E.forEach((function(E){E&&"string"!=typeof E&&!Array.isArray(E)&&Object.keys(E).forEach((function(i){if("default"!==i&&!(i in e)){var _=Object.getOwnPropertyDescriptor(E,i);Object.defineProperty(e,i,_.get?_:{enumerable:!0,get:function(){return E[i]}})}}))})),Object.freeze(e)}var i,_,l={exports:{}},n=i?l.exports:(i=1,l.exports=(_=function(e){var E=e.addFilter,i=e.utils,_=i.Type,l=i.replaceInString,n=i.toNaturalFileSize;return E("ALLOW_HOPPER_ITEM",(function(e,E){var i=E.query;if(!i("GET_ALLOW_FILE_SIZE_VALIDATION"))return!0;var _=i("GET_MAX_FILE_SIZE");if(null!==_&&e.size>_)return!1;var l=i("GET_MIN_FILE_SIZE");return!(null!==l&&e.size<l)})),E("LOAD_FILE",(function(e,E){var i=E.query;return new Promise((function(E,_){if(!i("GET_ALLOW_FILE_SIZE_VALIDATION"))return E(e);var t=i("GET_FILE_VALIDATE_SIZE_FILTER");if(t&&!t(e))return E(e);var I=i("GET_MAX_FILE_SIZE");if(null!==I&&e.size>I)_({status:{main:i("GET_LABEL_MAX_FILE_SIZE_EXCEEDED"),sub:l(i("GET_LABEL_MAX_FILE_SIZE"),{filesize:n(I,".",i("GET_FILE_SIZE_BASE"),i("GET_FILE_SIZE_LABELS",i))})}});else{var L=i("GET_MIN_FILE_SIZE");if(null!==L&&e.size<L)_({status:{main:i("GET_LABEL_MIN_FILE_SIZE_EXCEEDED"),sub:l(i("GET_LABEL_MIN_FILE_SIZE"),{filesize:n(L,".",i("GET_FILE_SIZE_BASE"),i("GET_FILE_SIZE_LABELS",i))})}});else{var a=i("GET_MAX_TOTAL_FILE_SIZE");if(null!==a&&i("GET_ACTIVE_ITEMS").reduce((function(e,E){return e+E.fileSize}),0)>a)return void _({status:{main:i("GET_LABEL_MAX_TOTAL_FILE_SIZE_EXCEEDED"),sub:l(i("GET_LABEL_MAX_TOTAL_FILE_SIZE"),{filesize:n(a,".",i("GET_FILE_SIZE_BASE"),i("GET_FILE_SIZE_LABELS",i))})}});E(e)}}}))})),{options:{allowFileSizeValidation:[!0,_.BOOLEAN],maxFileSize:[null,_.INT],minFileSize:[null,_.INT],maxTotalFileSize:[null,_.INT],fileValidateSizeFilter:[null,_.FUNCTION],labelMinFileSizeExceeded:["File is too small",_.STRING],labelMinFileSize:["Minimum file size is {filesize}",_.STRING],labelMaxFileSizeExceeded:["File is too large",_.STRING],labelMaxFileSize:["Maximum file size is {filesize}",_.STRING],labelMaxTotalFileSizeExceeded:["Maximum total size exceeded",_.STRING],labelMaxTotalFileSize:["Maximum total file size is {filesize}",_.STRING]}}},"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:_})),_)),t=E({__proto__:null,default:e(n)},[n]);
4
+ import{d as e}from"./p-Dimo1ZpU.js";function E(e,E){return E.forEach((function(E){E&&"string"!=typeof E&&!Array.isArray(E)&&Object.keys(E).forEach((function(i){if("default"!==i&&!(i in e)){var _=Object.getOwnPropertyDescriptor(E,i);Object.defineProperty(e,i,_.get?_:{enumerable:!0,get:function(){return E[i]}})}}))})),Object.freeze(e)}var i,_,l={exports:{}},n=i?l.exports:(i=1,l.exports=(_=function(e){var E=e.addFilter,i=e.utils,_=i.Type,l=i.replaceInString,n=i.toNaturalFileSize;return E("ALLOW_HOPPER_ITEM",(function(e,E){var i=E.query;if(!i("GET_ALLOW_FILE_SIZE_VALIDATION"))return!0;var _=i("GET_MAX_FILE_SIZE");if(null!==_&&e.size>_)return!1;var l=i("GET_MIN_FILE_SIZE");return!(null!==l&&e.size<l)})),E("LOAD_FILE",(function(e,E){var i=E.query;return new Promise((function(E,_){if(!i("GET_ALLOW_FILE_SIZE_VALIDATION"))return E(e);var t=i("GET_FILE_VALIDATE_SIZE_FILTER");if(t&&!t(e))return E(e);var I=i("GET_MAX_FILE_SIZE");if(null!==I&&e.size>I)_({status:{main:i("GET_LABEL_MAX_FILE_SIZE_EXCEEDED"),sub:l(i("GET_LABEL_MAX_FILE_SIZE"),{filesize:n(I,".",i("GET_FILE_SIZE_BASE"),i("GET_FILE_SIZE_LABELS",i))})}});else{var L=i("GET_MIN_FILE_SIZE");if(null!==L&&e.size<L)_({status:{main:i("GET_LABEL_MIN_FILE_SIZE_EXCEEDED"),sub:l(i("GET_LABEL_MIN_FILE_SIZE"),{filesize:n(L,".",i("GET_FILE_SIZE_BASE"),i("GET_FILE_SIZE_LABELS",i))})}});else{var a=i("GET_MAX_TOTAL_FILE_SIZE");if(null!==a&&i("GET_ACTIVE_ITEMS").reduce((function(e,E){return e+E.fileSize}),0)>a)return void _({status:{main:i("GET_LABEL_MAX_TOTAL_FILE_SIZE_EXCEEDED"),sub:l(i("GET_LABEL_MAX_TOTAL_FILE_SIZE"),{filesize:n(a,".",i("GET_FILE_SIZE_BASE"),i("GET_FILE_SIZE_LABELS",i))})}});E(e)}}}))})),{options:{allowFileSizeValidation:[!0,_.BOOLEAN],maxFileSize:[null,_.INT],minFileSize:[null,_.INT],maxTotalFileSize:[null,_.INT],fileValidateSizeFilter:[null,_.FUNCTION],labelMinFileSizeExceeded:["File is too small",_.STRING],labelMinFileSize:["Minimum file size is {filesize}",_.STRING],labelMaxFileSizeExceeded:["File is too large",_.STRING],labelMaxFileSize:["Maximum file size is {filesize}",_.STRING],labelMaxTotalFileSizeExceeded:["Maximum total size exceeded",_.STRING],labelMaxTotalFileSize:["Maximum total file size is {filesize}",_.STRING]}}},"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:_})),_)),t=E({__proto__:null,default:e(n)},[n]);
5
5
  /*!
6
6
  * FilePondPluginFileValidateSize 2.2.8
7
7
  * Licensed under MIT, https://opensource.org/licenses/MIT/
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{d as A}from"./p-CrNw20pf.js";function n(A,n){return n.forEach((function(n){n&&"string"!=typeof n&&!Array.isArray(n)&&Object.keys(n).forEach((function(e){if("default"!==e&&!(e in A)){var r=Object.getOwnPropertyDescriptor(n,e);Object.defineProperty(A,e,r.get?r:{enumerable:!0,get:function(){return n[e]}})}}))})),Object.freeze(A)}var e,r={exports:{}},i=(e||(e=1,r.exports=function(){var A=65496,n=65505,e=1165519206,r=18761,i=274,t=65280,o=function(A,n){return A.getUint16(n,arguments.length>2&&void 0!==arguments[2]&&arguments[2])},a=function(A,n){return A.getUint32(n,arguments.length>2&&void 0!==arguments[2]&&arguments[2])},f="undefined"!=typeof window&&void 0!==window.document,u=void 0,d=f?new Image:{};d.onload=function(){return u=d.naturalWidth>d.naturalHeight},d.src="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=";var c=function(f){var d=f.utils,c=d.Type,v=d.isFile;return(0,f.addFilter)("DID_LOAD_ITEM",(function(f,d){var c=d.query;return new Promise((function(d){var w=f.file;if(!(v(w)&&function(A){return/^image\/jpeg/.test(A.type)}(w)&&c("GET_ALLOW_IMAGE_EXIF_ORIENTATION")&&u))return d(f);(function(f){return new Promise((function(u){var d=new FileReader;d.onload=function(f){var d=new DataView(f.target.result);if(o(d,0)===A){for(var c=d.byteLength,v=2;v<c;){var w=o(d,v);if(v+=2,w===n){if(a(d,v+=2)!==e)break;var g=o(d,v+=6)===r;v+=a(d,v+4,g);var l=o(d,v,g);v+=2;for(var p=0;p<l;p++)if(o(d,v+12*p,g)===i)return void u(o(d,v+12*p+8,g))}else{if((w&t)!==t)break;v+=o(d,v)}}u(-1)}else u(-1)},d.readAsArrayBuffer(f.slice(0,65536))}))})(w).then((function(A){f.setMetadata("exif",{orientation:A}),d(f)}))}))})),{options:{allowImageExifOrientation:[!0,c.BOOLEAN]}}};return"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:c})),c}()),r.exports),t=n({__proto__:null,default:A(i)},[i]);
4
+ import{d as A}from"./p-Dimo1ZpU.js";function n(A,n){return n.forEach((function(n){n&&"string"!=typeof n&&!Array.isArray(n)&&Object.keys(n).forEach((function(e){if("default"!==e&&!(e in A)){var r=Object.getOwnPropertyDescriptor(n,e);Object.defineProperty(A,e,r.get?r:{enumerable:!0,get:function(){return n[e]}})}}))})),Object.freeze(A)}var e,r={exports:{}},i=(e||(e=1,r.exports=function(){var A=65496,n=65505,e=1165519206,r=18761,i=274,t=65280,o=function(A,n){return A.getUint16(n,arguments.length>2&&void 0!==arguments[2]&&arguments[2])},a=function(A,n){return A.getUint32(n,arguments.length>2&&void 0!==arguments[2]&&arguments[2])},u="undefined"!=typeof window&&void 0!==window.document,f=void 0,d=u?new Image:{};d.onload=function(){return f=d.naturalWidth>d.naturalHeight},d.src="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=";var c=function(u){var d=u.utils,c=d.Type,v=d.isFile;return(0,u.addFilter)("DID_LOAD_ITEM",(function(u,d){var c=d.query;return new Promise((function(d){var w=u.file;if(!(v(w)&&function(A){return/^image\/jpeg/.test(A.type)}(w)&&c("GET_ALLOW_IMAGE_EXIF_ORIENTATION")&&f))return d(u);(function(u){return new Promise((function(f){var d=new FileReader;d.onload=function(u){var d=new DataView(u.target.result);if(o(d,0)===A){for(var c=d.byteLength,v=2;v<c;){var w=o(d,v);if(v+=2,w===n){if(a(d,v+=2)!==e)break;var g=o(d,v+=6)===r;v+=a(d,v+4,g);var l=o(d,v,g);v+=2;for(var p=0;p<l;p++)if(o(d,v+12*p,g)===i)return void f(o(d,v+12*p+8,g))}else{if((w&t)!==t)break;v+=o(d,v)}}f(-1)}else f(-1)},d.readAsArrayBuffer(u.slice(0,65536))}))})(w).then((function(A){u.setMetadata("exif",{orientation:A}),d(u)}))}))})),{options:{allowImageExifOrientation:[!0,c.BOOLEAN]}}};return"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:c})),c}()),r.exports),t=n({__proto__:null,default:A(i)},[i]);
5
5
  /*!
6
6
  * FilePondPluginImageExifOrientation 1.0.11
7
7
  * Licensed under MIT, https://opensource.org/licenses/MIT/
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{h as n}from"./p-CrNw20pf.js";function a(n,a=(window.matchMedia("(min-width: 768px)").matches?3:2)){return n<a?n:n-n%a}function t(n=null){for(const n of document.querySelectorAll("salla-modal"))n.close();n&&requestAnimationFrame(n)}function o(n){const a=(n.prizes||[]).map((n=>({...n,items:(n.items||[]).map((a=>({...a,group_title:n.title,group_type:n.type})))}))),t={type:"all",title:salla.lang.get("pages.loyalty_program.all"),items:a.reduce(((n,a)=>n.concat(a.items)),[])};return a.unshift(t),{...n,prizes:a,prizes_count:t.items.length,points:n.points??[]}}function l(n){return[n.name.replace(/\s/g,"-"),`brand-${n.id}`].join("/")}function r(a){return"number"==typeof a?n("span",null,a," ",salla.lang.get("pages.loyalty_program.point")):function(n){for(const a of n.conditions??[])if(a.key?.endsWith("_FOR_UNIT"))return!0;return!1}(a)?n("span",null,"1 ",salla.config.currency().symbol," = ",a.points," ",salla.lang.get("pages.loyalty_program.point")):n("span",null,a.points," ",salla.lang.get("pages.loyalty_program.point"))}export{a,l as b,t as c,r as f,o as n}
4
+ import{h as n}from"./p-Dimo1ZpU.js";function a(n,a=(window.matchMedia("(min-width: 768px)").matches?3:2)){return n<a?n:n-n%a}function t(n=null){for(const n of document.querySelectorAll("salla-modal"))n.close();n&&requestAnimationFrame(n)}function o(n){const a=(n.prizes||[]).map((n=>({...n,items:(n.items||[]).map((a=>({...a,group_title:n.title,group_type:n.type})))}))),t={type:"all",title:salla.lang.get("pages.loyalty_program.all"),items:a.reduce(((n,a)=>n.concat(a.items)),[])};return a.unshift(t),{...n,prizes:a,prizes_count:t.items.length,points:n.points??[]}}function l(n){return[n.name.replace(/\s/g,"-"),`brand-${n.id}`].join("/")}function r(a){return"number"==typeof a?n("span",null,a," ",salla.lang.get("pages.loyalty_program.point")):function(n){for(const a of n.conditions??[])if(a.key?.endsWith("_FOR_UNIT"))return!0;return!1}(a)?n("span",null,"1 ",salla.config.currency().symbol," = ",a.points," ",salla.lang.get("pages.loyalty_program.point")):n("span",null,a.points," ",salla.lang.get("pages.loyalty_program.point"))}export{a,l as b,t as c,r as f,o as n}
@@ -0,0 +1,4 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ import{f as t}from"./p-Dimo1ZpU.js";function r(r,s={}){return s=Object.assign({initialData:void 0,initialStatus:"idle"},s),(i,o)=>{const e=Object.assign((function(...s){const i=r=>{Object.assign(this[o],r),t(this)};return i({status:"pending",error:void 0}),r.call(this,...s).then((t=>(i({status:"success",data:t,error:void 0}),t)),(t=>(i({status:"error",error:t}),Promise.reject(t))))}),{status:s.initialStatus,data:s.initialData,error:void 0});Object.defineProperty(i,o,{value:e})}}export{r as T}