@salla.sa/twilight-components 2.14.550 → 2.14.552
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.
- package/dist/cjs/{filepond-B-8syvXC.js → filepond-BTsLGLic.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-poster-DxfU_d7d.js → filepond-plugin-file-poster-DSHHkMx8.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-C0XIW0bl.js → filepond-plugin-file-validate-size-BB6ltSRf.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-BHyBHLOg.js → filepond-plugin-file-validate-type-CNWlgtpi.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-Dnni9gl-.js → filepond-plugin-image-edit-DuY72vJR.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation-C7pHXy9M.js → filepond-plugin-image-exif-orientation-DWzZOyOL.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-CFttWV9E.js → filepond-plugin-image-preview-ropJ4nYL.js} +1 -1
- package/dist/cjs/{helpers-DHdDjm5V.js → helpers-Dm4BirHO.js} +2 -2
- package/dist/cjs/{index-CHvvKGJc.js → index-CoSVCFSp.js} +4 -4
- package/dist/cjs/{intlTelInput--yv-lZaU.js → intlTelInput-BSHBNNPO.js} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-accordion_6.cjs.entry.js +1 -1
- package/dist/cjs/salla-add-product-button_5.cjs.entry.js +1 -1
- package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
- package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
- package/dist/cjs/salla-applied-filters.cjs.entry.js +1 -1
- package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
- package/dist/cjs/salla-attachment-view_9.cjs.entry.js +10 -10
- package/dist/cjs/salla-badge.cjs.entry.js +1 -1
- package/dist/cjs/salla-basket-gap.cjs.entry.js +1 -1
- package/dist/cjs/{salla-bullet-delivery_2.cjs.entry.js → salla-bullet-delivery_3.cjs.entry.js} +60 -3
- package/dist/cjs/salla-cart-coupons.cjs.entry.js +1 -1
- package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-cart-summary-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-cashback-banner.cjs.entry.js +1 -1
- package/dist/cjs/salla-comment-factors.cjs.entry.js +1 -1
- package/dist/cjs/salla-comment-form_9.cjs.entry.js +1 -1
- package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
- package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
- package/dist/cjs/salla-count-down.cjs.entry.js +1 -1
- package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
- package/dist/cjs/salla-delivery-promise.cjs.entry.js +2 -2
- package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters.cjs.entry.js +1 -1
- package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
- package/dist/cjs/salla-gifting.cjs.entry.js +1 -1
- package/dist/cjs/salla-hook.cjs.entry.js +1 -1
- package/dist/cjs/salla-infinite-scroll.cjs.entry.js +1 -1
- package/dist/cjs/salla-installment.cjs.entry.js +1 -1
- package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
- package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-banner_10.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-exchange-product-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-points-history.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
- package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
- package/dist/cjs/salla-map_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-menu.cjs.entry.js +1 -1
- package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
- package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
- package/dist/cjs/salla-notification-item_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-branch.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-cancel.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-options-modal_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-shipments.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-orders.cjs.entry.js +1 -1
- package/dist/cjs/salla-payments.cjs.entry.js +1 -1
- package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
- package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
- package/dist/cjs/salla-product-card-embed.cjs.entry.js +1 -1
- package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
- package/dist/cjs/salla-products-list.cjs.entry.js +1 -1
- package/dist/cjs/salla-products-slider.cjs.entry.js +1 -1
- package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
- package/dist/cjs/salla-rating-modal-v2.cjs.entry.js +1 -1
- package/dist/cjs/salla-rating-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-review-factors-tags.cjs.entry.js +1 -1
- package/dist/cjs/salla-review-order-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
- package/dist/cjs/salla-search.cjs.entry.js +1 -1
- package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
- package/dist/cjs/salla-slider.cjs.entry.js +1 -1
- package/dist/cjs/salla-social-share.cjs.entry.js +1 -1
- package/dist/cjs/salla-social.cjs.entry.js +1 -1
- package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
- package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
- package/dist/cjs/salla-verify.cjs.entry.js +1 -1
- package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
- package/dist/cjs/salla-wishlist-actions.cjs.entry.js +1 -1
- package/dist/cjs/twilight.cjs.js +2 -2
- package/dist/cjs/{vanilla-picker-D-X0hQ7w.js → vanilla-picker-DdIwY7TN.js} +1 -1
- package/dist/collection/collection-manifest.json +6 -4
- package/dist/collection/components/salla-bullet-delivery/helpers.js +2 -2
- package/dist/collection/components/salla-bullet-delivery/salla-bullet-delivery.js +7 -1
- package/dist/collection/components/salla-bullet-delivery-tag/salla-bullet-delivery-tag.css +70 -0
- package/dist/collection/components/salla-bullet-delivery-tag/salla-bullet-delivery-tag.js +77 -0
- package/dist/components/helpers.js +2 -2
- package/dist/components/index.js +2 -2
- package/dist/components/salla-bullet-delivery-tag.d.ts +11 -0
- package/dist/components/salla-bullet-delivery-tag.js +76 -0
- package/dist/components/salla-bullet-delivery.js +7 -1
- package/dist/esm/{filepond-rGVsy4ep.js → filepond-CqbRA3Vl.js} +1 -1
- package/dist/esm/{filepond-plugin-file-poster-bfSOezL4.js → filepond-plugin-file-poster-Byt9onuT.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-DagZiT3e.js → filepond-plugin-file-validate-size-C1P2OJEv.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-Cf4JwDq-.js → filepond-plugin-file-validate-type-BP2FLMsG.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-DWZ8nbdr.js → filepond-plugin-image-edit-C69hhmiF.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-NHp2unXf.js → filepond-plugin-image-exif-orientation-B2QzeXLq.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-BSi_AIFs.js → filepond-plugin-image-preview-CR1odLVd.js} +1 -1
- package/dist/esm/{helpers-BDChq2t4.js → helpers-CV6uPJEJ.js} +2 -2
- package/dist/esm/{index-Bf2Z6A1M.js → index-Q9lz4Iuq.js} +4 -4
- package/dist/esm/{intlTelInput-DLtsxnoY.js → intlTelInput-DzbfeHCl.js} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/salla-accordion-body_2.entry.js +1 -1
- package/dist/esm/salla-accordion_6.entry.js +1 -1
- package/dist/esm/salla-add-product-button_5.entry.js +1 -1
- package/dist/esm/salla-advertisement.entry.js +1 -1
- package/dist/esm/salla-alert_2.entry.js +1 -1
- package/dist/esm/salla-app-install-alert.entry.js +1 -1
- package/dist/esm/salla-applied-filters.entry.js +1 -1
- package/dist/esm/salla-apps-icons.entry.js +1 -1
- package/dist/esm/salla-attachment-view_9.entry.js +10 -10
- package/dist/esm/salla-badge.entry.js +1 -1
- package/dist/esm/salla-basket-gap.entry.js +1 -1
- package/dist/esm/{salla-bullet-delivery_2.entry.js → salla-bullet-delivery_3.entry.js} +60 -4
- package/dist/esm/salla-cart-coupons.entry.js +1 -1
- package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
- package/dist/esm/salla-cart-summary-card.entry.js +1 -1
- package/dist/esm/salla-cashback-banner.entry.js +1 -1
- package/dist/esm/salla-comment-factors.entry.js +1 -1
- package/dist/esm/salla-comment-form_9.entry.js +1 -1
- package/dist/esm/salla-conditional-offer.entry.js +1 -1
- package/dist/esm/salla-contacts.entry.js +1 -1
- package/dist/esm/salla-cookies-bar.entry.js +1 -1
- package/dist/esm/salla-count-down.entry.js +1 -1
- package/dist/esm/salla-custom-fields.entry.js +1 -1
- package/dist/esm/salla-delivery-promise.entry.js +2 -2
- package/dist/esm/salla-edit-order-button.entry.js +1 -1
- package/dist/esm/salla-filters-widget.entry.js +1 -1
- package/dist/esm/salla-filters.entry.js +1 -1
- package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
- package/dist/esm/salla-gifting.entry.js +1 -1
- package/dist/esm/salla-hook.entry.js +1 -1
- package/dist/esm/salla-infinite-scroll.entry.js +1 -1
- package/dist/esm/salla-installment.entry.js +1 -1
- package/dist/esm/salla-list-tile.entry.js +1 -1
- package/dist/esm/salla-localization-modal.entry.js +1 -1
- package/dist/esm/salla-login-modal.entry.js +1 -1
- package/dist/esm/salla-loyalty-banner_10.entry.js +1 -1
- package/dist/esm/salla-loyalty-exchange-product-card.entry.js +1 -1
- package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
- package/dist/esm/salla-loyalty-points-history.entry.js +1 -1
- package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
- package/dist/esm/salla-loyalty.entry.js +1 -1
- package/dist/esm/salla-maintenance-alert.entry.js +1 -1
- package/dist/esm/salla-map_2.entry.js +1 -1
- package/dist/esm/salla-menu.entry.js +1 -1
- package/dist/esm/salla-metadata.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
- package/dist/esm/salla-next-order-coupon.entry.js +1 -1
- package/dist/esm/salla-notification-item_2.entry.js +1 -1
- package/dist/esm/salla-offer-modal.entry.js +1 -1
- package/dist/esm/salla-offer.entry.js +1 -1
- package/dist/esm/salla-order-branch.entry.js +1 -1
- package/dist/esm/salla-order-cancel.entry.js +1 -1
- package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
- package/dist/esm/salla-order-details-options.entry.js +1 -1
- package/dist/esm/salla-order-details.entry.js +1 -1
- package/dist/esm/salla-order-edit-item.entry.js +1 -1
- package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
- package/dist/esm/salla-order-edit.entry.js +1 -1
- package/dist/esm/salla-order-options-modal_2.entry.js +1 -1
- package/dist/esm/salla-order-shipments.entry.js +1 -1
- package/dist/esm/salla-order-summary.entry.js +1 -1
- package/dist/esm/salla-order-totals-card.entry.js +1 -1
- package/dist/esm/salla-orders.entry.js +1 -1
- package/dist/esm/salla-payments.entry.js +1 -1
- package/dist/esm/salla-placeholder.entry.js +1 -1
- package/dist/esm/salla-price-range.entry.js +1 -1
- package/dist/esm/salla-product-card-embed.entry.js +1 -1
- package/dist/esm/salla-product-size-guide.entry.js +1 -1
- package/dist/esm/salla-products-list.entry.js +1 -1
- package/dist/esm/salla-products-slider.entry.js +1 -1
- package/dist/esm/salla-quick-order.entry.js +1 -1
- package/dist/esm/salla-rating-modal-v2.entry.js +1 -1
- package/dist/esm/salla-rating-modal.entry.js +1 -1
- package/dist/esm/salla-review-factors-tags.entry.js +1 -1
- package/dist/esm/salla-review-order-item.entry.js +1 -1
- package/dist/esm/salla-scopes.entry.js +1 -1
- package/dist/esm/salla-search.entry.js +1 -1
- package/dist/esm/salla-skeleton.entry.js +1 -1
- package/dist/esm/salla-slider.entry.js +1 -1
- package/dist/esm/salla-social-share.entry.js +1 -1
- package/dist/esm/salla-social.entry.js +1 -1
- package/dist/esm/salla-tab-content_3.entry.js +1 -1
- package/dist/esm/salla-tiered-offer.entry.js +1 -1
- package/dist/esm/salla-tooltip.entry.js +1 -1
- package/dist/esm/salla-trust-badges.entry.js +1 -1
- package/dist/esm/salla-user-menu.entry.js +1 -1
- package/dist/esm/salla-user-profile.entry.js +1 -1
- package/dist/esm/salla-user-settings.entry.js +1 -1
- package/dist/esm/salla-verify.entry.js +1 -1
- package/dist/esm/salla-wallet.entry.js +1 -1
- package/dist/esm/salla-wishlist-actions.entry.js +1 -1
- package/dist/esm/twilight.js +3 -3
- package/dist/esm/{vanilla-picker-AjTapsL5.js → vanilla-picker-DZSS4OVz.js} +1 -1
- package/dist/twilight/{p-b19102f6.entry.js → p-008dcf73.entry.js} +1 -1
- package/dist/twilight/{p-b2380c6b.entry.js → p-00bb1a13.entry.js} +1 -1
- package/dist/twilight/{p-27396f6f.entry.js → p-0100262e.entry.js} +1 -1
- package/dist/twilight/{p-6e78cc02.entry.js → p-06109ef0.entry.js} +1 -1
- package/dist/twilight/{p-8838ad5c.entry.js → p-06abf9fb.entry.js} +1 -1
- package/dist/twilight/{p-69d75b45.entry.js → p-0bb678e7.entry.js} +1 -1
- package/dist/twilight/{p-e284728d.entry.js → p-1242708e.entry.js} +1 -1
- package/dist/twilight/{p-c818e0eb.entry.js → p-171c1927.entry.js} +1 -1
- package/dist/twilight/{p-e8b220e1.entry.js → p-1dc63988.entry.js} +1 -1
- package/dist/twilight/{p-277f3a46.entry.js → p-25017fcd.entry.js} +1 -1
- package/dist/twilight/{p-57b7cd9f.entry.js → p-25b7344e.entry.js} +1 -1
- package/dist/twilight/{p-581eeaf8.entry.js → p-27176c04.entry.js} +1 -1
- package/dist/twilight/{p-9e702ebb.entry.js → p-2845de1c.entry.js} +1 -1
- package/dist/twilight/{p-2c212d54.entry.js → p-31394018.entry.js} +1 -1
- package/dist/twilight/{p-9ae3a15c.entry.js → p-31d03d8c.entry.js} +1 -1
- package/dist/twilight/{p-f1322c8e.entry.js → p-34dfff49.entry.js} +1 -1
- package/dist/twilight/{p-d2c204f4.entry.js → p-36aa4c09.entry.js} +1 -1
- package/dist/twilight/{p-0dc61077.entry.js → p-382e5a40.entry.js} +1 -1
- package/dist/twilight/{p-5256180e.entry.js → p-3c0705e2.entry.js} +1 -1
- package/dist/twilight/{p-2f2771de.entry.js → p-40b70c18.entry.js} +1 -1
- package/dist/twilight/{p-03db1fe6.entry.js → p-462a49e4.entry.js} +1 -1
- package/dist/twilight/{p-0e12c9ca.entry.js → p-492c72eb.entry.js} +1 -1
- package/dist/twilight/{p-649ced48.entry.js → p-4941b3cd.entry.js} +1 -1
- package/dist/twilight/{p-cd51e722.entry.js → p-49cbb9ed.entry.js} +1 -1
- package/dist/twilight/{p-1c662f1d.entry.js → p-4abffe52.entry.js} +1 -1
- package/dist/twilight/{p-9cbc4733.entry.js → p-4b827efc.entry.js} +1 -1
- package/dist/twilight/{p-cfbf287b.entry.js → p-4bac36be.entry.js} +1 -1
- package/dist/twilight/{p-8cf65dbf.entry.js → p-52e1754b.entry.js} +1 -1
- package/dist/twilight/{p-b017b72e.entry.js → p-53e430c6.entry.js} +1 -1
- package/dist/twilight/{p-aa71f393.entry.js → p-5470f52a.entry.js} +1 -1
- package/dist/twilight/{p-c31b966f.entry.js → p-54bdc583.entry.js} +1 -1
- package/dist/twilight/{p-12d74e96.entry.js → p-56e93806.entry.js} +1 -1
- package/dist/twilight/{p-8e0bdbbc.entry.js → p-5b94bea7.entry.js} +1 -1
- package/dist/twilight/{p-4f1102f8.entry.js → p-5d671536.entry.js} +1 -1
- package/dist/twilight/{p-13fb9b74.entry.js → p-61ca8dd2.entry.js} +1 -1
- package/dist/twilight/{p-a8d6804c.entry.js → p-67b60d33.entry.js} +1 -1
- package/dist/twilight/{p-a3eb15e4.entry.js → p-6860331a.entry.js} +1 -1
- package/dist/twilight/{p-7e9d98c3.entry.js → p-6867eb35.entry.js} +1 -1
- package/dist/twilight/{p-785cee9b.entry.js → p-688b40b4.entry.js} +1 -1
- package/dist/twilight/{p-0c4c4419.entry.js → p-6f6d6f45.entry.js} +1 -1
- package/dist/twilight/{p-ebb73bcc.entry.js → p-7022989a.entry.js} +1 -1
- package/dist/twilight/{p-0ccba871.entry.js → p-729f3fa0.entry.js} +1 -1
- package/dist/twilight/{p-7e101885.entry.js → p-754af3dd.entry.js} +1 -1
- package/dist/twilight/{p-efa79191.entry.js → p-79451510.entry.js} +1 -1
- package/dist/twilight/{p-7b6fa77f.entry.js → p-79e2d7eb.entry.js} +1 -1
- package/dist/twilight/{p-cf21323d.entry.js → p-7d3899e7.entry.js} +1 -1
- package/dist/twilight/{p-3627d945.entry.js → p-7d9e3032.entry.js} +1 -1
- package/dist/twilight/{p-9fdb6380.entry.js → p-7dda74dd.entry.js} +1 -1
- package/dist/twilight/{p-f2e5f1fd.entry.js → p-7deba3f8.entry.js} +1 -1
- package/dist/twilight/{p-bded58cb.entry.js → p-7e8b2b0d.entry.js} +1 -1
- package/dist/twilight/{p-17c30aa6.entry.js → p-7f2bc499.entry.js} +1 -1
- package/dist/twilight/{p-9ee1e01c.entry.js → p-808fef3d.entry.js} +1 -1
- package/dist/twilight/{p-be95b40b.entry.js → p-8920aae0.entry.js} +1 -1
- package/dist/twilight/{p-3a4160c2.entry.js → p-89aad90f.entry.js} +1 -1
- package/dist/twilight/{p-c56725b9.entry.js → p-8abf3859.entry.js} +1 -1
- package/dist/twilight/{p-b603a180.entry.js → p-8bcf6db3.entry.js} +1 -1
- package/dist/twilight/{p-434f3557.entry.js → p-9118b3cf.entry.js} +1 -1
- package/dist/twilight/{p-3615a99b.entry.js → p-92fbada7.entry.js} +1 -1
- package/dist/twilight/{p-44ee3af8.entry.js → p-9f4fef0f.entry.js} +1 -1
- package/dist/twilight/{p-B59qdBmY.js → p-B31LPQuk.js} +1 -1
- package/dist/twilight/{p-BdsgfewR.js → p-BCwAi8HD.js} +1 -1
- package/dist/twilight/{p-CG1Rwy3q.js → p-CA-ne4vX.js} +1 -1
- package/dist/twilight/{p-CPqpCDCi.js → p-CPEEGqkw.js} +1 -1
- package/dist/twilight/{p-BDChq2t4.js → p-CV6uPJEJ.js} +1 -1
- package/dist/twilight/{p-uOF6Cufg.js → p-Ce0SoG8e.js} +1 -1
- package/dist/twilight/{p-BlDax_46.js → p-DPu3dYaG.js} +1 -1
- package/dist/twilight/{p-Bf2Z6A1M.js → p-Q9lz4Iuq.js} +1 -1
- package/dist/twilight/{p-DfIHi_xi.js → p-VPmzkmKU.js} +1 -1
- package/dist/twilight/{p-B-Q5WD6p.js → p-WyyaE0fN.js} +1 -1
- package/dist/twilight/{p-e54cc4f8.entry.js → p-a0e73c0f.entry.js} +1 -1
- package/dist/twilight/{p-bd3fef37.entry.js → p-a24168ae.entry.js} +1 -1
- package/dist/twilight/{p-5383a324.entry.js → p-a70cbfe9.entry.js} +1 -1
- package/dist/twilight/{p-97136699.entry.js → p-a7417d3a.entry.js} +1 -1
- package/dist/twilight/{p-5a4f7313.entry.js → p-aa1af88d.entry.js} +1 -1
- package/dist/twilight/{p-2607ac8e.entry.js → p-ae5ce421.entry.js} +1 -1
- package/dist/twilight/{p-33842645.entry.js → p-b881f716.entry.js} +1 -1
- package/dist/twilight/{p-c24f6325.entry.js → p-b92af898.entry.js} +1 -1
- package/dist/twilight/{p-0fb44a3c.entry.js → p-bbdec84a.entry.js} +1 -1
- package/dist/twilight/{p-95a3b9b9.entry.js → p-bd389ba7.entry.js} +1 -1
- package/dist/twilight/{p-09c1d9c8.entry.js → p-bf860754.entry.js} +1 -1
- package/dist/twilight/{p-4df5f9a0.entry.js → p-bfa2b7c5.entry.js} +1 -1
- package/dist/twilight/{p-0d199866.entry.js → p-c0599e5d.entry.js} +1 -1
- package/dist/twilight/{p-1653256e.entry.js → p-c6ed3a34.entry.js} +1 -1
- package/dist/twilight/{p-38b4dfa9.entry.js → p-c7482df4.entry.js} +1 -1
- package/dist/twilight/{p-4d3e018b.entry.js → p-c90ff0bf.entry.js} +1 -1
- package/dist/twilight/{p-bc595ee3.entry.js → p-ce8205e2.entry.js} +1 -1
- package/dist/twilight/{p-e8a1c501.entry.js → p-d6a04817.entry.js} +1 -1
- package/dist/twilight/{p-34240222.entry.js → p-d70c704f.entry.js} +25 -25
- package/dist/twilight/{p-fc587040.entry.js → p-d7c03cf7.entry.js} +1 -1
- package/dist/twilight/{p-d65a6462.entry.js → p-dfc67513.entry.js} +1 -1
- package/dist/twilight/{p-dfaf0617.entry.js → p-e0868b92.entry.js} +1 -1
- package/dist/twilight/{p-a818352a.entry.js → p-e305f635.entry.js} +1 -1
- package/dist/twilight/{p-018456c8.entry.js → p-e69f6c43.entry.js} +1 -1
- package/dist/twilight/{p-9f1d1b76.entry.js → p-e6b1dd40.entry.js} +1 -1
- package/dist/twilight/{p-c0c561b9.entry.js → p-ea3480ff.entry.js} +1 -1
- package/dist/twilight/{p-0da8a64f.entry.js → p-eddf3ee5.entry.js} +1 -1
- package/dist/twilight/{p-f586c239.entry.js → p-f0cefe50.entry.js} +1 -1
- package/dist/twilight/{p-d2556680.entry.js → p-f4207ccf.entry.js} +1 -1
- package/dist/twilight/{p-d63ca8bb.entry.js → p-f5485435.entry.js} +1 -1
- package/dist/twilight/{p-b7b4231f.entry.js → p-f632b2f7.entry.js} +1 -1
- package/dist/twilight/{p-b452c8a0.entry.js → p-f7c2ff0f.entry.js} +1 -1
- package/dist/twilight/{p-cfac0aa1.entry.js → p-fe34bfd0.entry.js} +1 -1
- package/dist/twilight/{p-0739e769.entry.js → p-ff6672b6.entry.js} +1 -1
- package/dist/twilight/{p-CMQ7Gxqu.js → p-sDtjU0pK.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/types/components/salla-bullet-delivery/interfaces.d.ts +2 -0
- package/dist/types/components/salla-bullet-delivery-tag/salla-bullet-delivery-tag.d.ts +26 -0
- package/dist/types/components.d.ts +77 -0
- package/package.json +5 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,h as i}from"./p-Bf2Z6A1M.js";import{a as e}from"./p-CgtvEd63.js";import{a as s}from"./p-BedNk7k1.js";import{C as r}from"./p-BsLF_HK7.js";import{G as a}from"./p-DxkgAGoT.js";const o=class{constructor(i){t(this,i),this.defaultEvent="gifting:open",this.selectImageForYourGift=salla.lang.get("blocks.buy_as_gift.select_image_for_your_gift"),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.disableClass=this.gift?.show_image_upload?"":"pointer-events-none",this.formSelector="form.product-form, form.form--product-options",this.handleCitySearch=t=>{if(this.citySearchQuery=t,!this.enableCityAjaxSearch)return;this.citySearchTimer&&clearTimeout(this.citySearchTimer);const i=++this.citySearchCounter;this.citySearchTimer=setTimeout((async()=>{this.searchingCities=!0;try{const e=await this.fetchCities(t);i===this.citySearchCounter&&(this.displayedCities=e)}catch(t){i===this.citySearchCounter&&(this.displayedCities=[])}finally{i===this.citySearchCounter&&(this.searchingCities=!1)}}),o.CITY_SEARCH_DEBOUNCE_MS)},this.handleCitySelected=t=>{this.selectedCity=t,this.receiverCity=String(t.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.giftText=salla.lang.get("blocks.buy_as_gift.gift_text"),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.cityChangeNotice=salla.lang.get("blocks.buy_as_gift.city_change_notice"),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}cityNoticeText(){return this.gift?.recipient_can_change_address?this.gift?.allows_different_shipping_cost?null:this.cityChangeNotice:this.selectCityInfo}componentDidLoad(){salla.event.product.onPriceUpdated((()=>{const t=document.querySelector(".s-quantity-input-input");this.quantity=t?.value}))}getFormDataFromForm(){if(!this.formSelector)return null;const t=document.querySelector(this.formSelector);return t?new FormData(t):null}mergeObjectToFormData(t,i,e){for(let s in t){if(!t.hasOwnProperty(s)||null==t[s])continue;const r=e?`${e}[${s}]`:s;"object"!=typeof t[s]||null===t[s]||t[s]instanceof File?i.set(r,t[s]):this.mergeObjectToFormData(t[s],i,r)}return i}async open(){if(salla.config.isGuest())return salla.api.auth.setAfterLoginEvent(this.defaultEvent),void salla.event.dispatch("login::open",{withoutReload:!0});this.resetStepsAnimation(),this.currentStep=1,this.parentClass="is-current-step-1",this.step2Animated=!1,this.stepsWrapper?.style.removeProperty("height"),await this.modal.open();const t=this.productId?()=>salla.product.getGiftProductDetails(this.productId):()=>salla.cart.getGiftCartDetails();return await salla.api.withoutNotifier(t).then((t=>{this.gift=t.data,this.senderName=this.gift.sender_name,this.disableClass=this.gift?.show_image_upload?"":"pointer-events-none",this.gift.show_texts||(this.selectedGiftTextOption=void 0,this.selectedText=void 0),this.gift.show_images||(this.selectedImage=void 0,this.uploadedImage=void 0),this.skipStep1()&&(this.currentStep=2,this.parentClass="is-current-step-2",this.step2Animated=!0)})).catch((t=>{this.hasError=!0,this.errorMessage=t.response?.data?.error?.message||t.response?.data})).finally((()=>this.modal.stopLoading()))}skipStep1(){return!!this.gift&&!this.gift.show_images&&!this.gift.show_texts}resetStepsAnimation(){[this.step1Elems,this.step2Elems].forEach((t=>{t?.querySelectorAll(".anime-item").forEach((t=>t.removeAttribute("style")))})),this.step1Elems?.removeAttribute("style"),this.step2Elems&&!this.skipStep1()&&(this.step2Elems.style.removeProperty("opacity"),this.step2Elems.style.removeProperty("transform"))}async close(){return this.modal.close()}async setWrapperHeight(t=1,i=250,e=0,s=0){let r=document.querySelector(`#${this.hostId} .gift-step-${t}`);const a=()=>{this.stepsWrapper.style.height=s?`${s}px`:r.offsetHeight+e+"px"};this.step2Animated&&2===t?requestAnimationFrame(a):setTimeout(a,i)}toggleCalendar(){this.showCalendar=!this.showCalendar,this.setWrapperHeight(2,150,0)}toggleGiftText(t){this.textSelect?.classList.remove("s-form-has-error");let i=t.target.children[t.target.selectedIndex].getAttribute("data-id"),e="custom"==i;const s=this.showGiftText!==e;this.showGiftText=e,i?(this.selectedGiftTextOption=i,this.selectedText=e?void 0:t.target.value):(this.textArea.value="",this.selectedText=void 0,this.selectedGiftTextOption=void 0),s&&this.setWrapperHeight(1,150,5)}async goToStep2(t=!0){this.step1Elems&&(t&&!this.validateStep1()||(this.stepsWrapper&&this.step1Elems&&(this.stepsWrapper.style.height=`${this.step1Elems.offsetHeight}px`),this.setWrapperHeight(2,50,0),(new e.timeline).add({targets:this.step1Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[1,0],translateX:[0,50],delay:e.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:e.stagger(70),duration:1200,complete:()=>{this.step2Elems.querySelectorAll(`#${this.hostId} .anime-item`).forEach((t=>{t.classList.remove("opacity-0"),t.removeAttribute("style")})),this.step2Animated=!0}},"-=1200"),this.currentStep=2,this.parentClass=`is-current-step-${this.currentStep}`))}validateStep1(){return!(this.gift?.show_texts&&(this.selectedGiftTextOption?"custom"!=this.selectedGiftTextOption||this.selectedText?(this.textSelect?.classList.remove("s-form-has-error"),this.customTextArea?.classList.remove("s-form-has-error"),0):(this.textSelect?.classList.remove("s-form-has-error"),this.customTextArea?.classList.add("s-form-has-error"),1):(this.textSelect?.classList.add("s-form-has-error"),this.customTextArea?.classList.remove("s-form-has-error"),1)))}goToStep1(t){t.preventDefault();let i=new e.timeline({autoplay:!1});i.add({targets:this.step2Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[1,0],translateX:[0,-50],delay:e.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:e.stagger(70),duration:1200,complete:()=>{this.step1Elems.querySelectorAll(`#${this.hostId} .anime-item`).forEach((t=>{t.classList.remove("opacity-0"),t.removeAttribute("style")}))}},"-=1200"),i.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.gift.show_image_upload?this.selectImageOrUpload:this.selectImageForYourGift}</p></div>`}setPreview(t){this.uploader?.classList.add("has-bg");var i=document.querySelector(`#${this.hostId}.filepond-bg`)?document.querySelector(`#${this.hostId} .filepond-bg`):document.createElement("div");i.classList.add("filepond-bg"),i.classList.remove("s-hidden"),i.style.backgroundImage="url('"+t.url+"')",this.uploader?.querySelector(".filepond--root")?.appendChild(i),this.uploadedImage=t.url,this.gift&&this.gift.gift_images?.length&&this.setWrapperHeight(1,150,0)}removePreview(){this.uploader.classList.remove("has-bg");let t=document.querySelector(`#${this.hostId} .filepond-bg`);t.removeAttribute("style"),t.classList.add("s-hidden"),this.handleRemoveImage()}handleTextAreaChange(t){this.selectedText=t.target.value,this.customTextArea?.classList.remove("s-form-has-error")}clearError(t){if(this.errors?.[t]){const{[t]:i,...e}=this.errors;this.errors=e}}handleSenderName(t){this.senderName=t.target.value,this.clearError("sender_name")}handleReceiverName(t){this.receiverName=t.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(t){this.gift={...this.gift,cities:t},this.displayedCities=t,this.enableCityAjaxSearch=t.length>=o.CITY_AJAX_THRESHOLD}async fetchCities(t=""){if(!this.selectedCountryId)return[];if(this.isKSA&&!this.selectedRegionId)return[];const i=["for_branch=0",`country_id=${this.selectedCountryId}`];this.isKSA&&this.selectedRegionId&&i.push(`region_id=${this.selectedRegionId}`),t?.trim()&&i.push(`query=${encodeURIComponent(t.trim())}`);const e=await salla.api.request(`shipping/cities?${i.join("&")}`);return e?.data??[]}async handleCountrySelected(t){const i=t?.id;this.selectedCountry=t??null,this.selectedCountryId=i,this.selectedCountryCode=t?.country_code,this.isKSA="SA"===t?.country_code,this.clearError("receiver.country"),this.regions=[],this.selectedRegionId=void 0,this.selectedRegion=null,this.resetCityState();const e=++this.locationRequestCounter;if(!i)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 t=await salla.api.request(`shipping/countries/${i}/regions`);if(e!==this.locationRequestCounter)return;t&&t.data&&(this.regions=t.data)}catch(t){if(e!==this.locationRequestCounter)return;console.error("Error fetching regions:",t)}finally{e===this.locationRequestCounter&&(this.loadingRegions=!1,this.setWrapperHeight(2,0,0))}}else{this.loadingCities=!0,this.setWrapperHeight(2,0,0);try{const t=await this.fetchCities();if(e!==this.locationRequestCounter)return;this.setInitialCities(t)}catch(t){if(e!==this.locationRequestCounter)return;console.error("Error fetching cities:",t)}finally{e===this.locationRequestCounter&&(this.loadingCities=!1)}}}async handleRegionSelected(t){const i=t?.id;this.selectedRegion=t??null,this.selectedRegionId=i,this.clearError("receiver.region"),this.resetCityState();const e=++this.locationRequestCounter;if(i){this.loadingCities=!0;try{const t=await this.fetchCities();if(e!==this.locationRequestCounter)return;this.setInitialCities(t)}catch(t){if(e!==this.locationRequestCounter)return;console.error("Error fetching cities:",t)}finally{e===this.locationRequestCounter&&(this.loadingCities=!1,this.setWrapperHeight(2,0,0))}}}handleUploadImage(t){this.uploadedImage="object"!=typeof t?t:t&&t.url,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(t){let i=t.detail;this.receiverMobile=i.number,this.receiverCountryCode=i.country_code,this.clearError("receiver.mobile")}handleDateTimePicker(t){this.deliveryDate=t.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 t=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 i=[{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}]:[]],e={};if(i.forEach((({key:t,value:i,label:s})=>{i||(e[t]=salla.lang.get("common.errors.field_required",{attribute:s}))})),Object.keys(e).length)return this.errors=e,void this.setWrapperHeight(2,150,0);const s="custom"===this.selectedGiftTextOption,r={text:s?this.selectedText:void 0,text_id:!s&&this.selectedGiftTextOption?Number(this.selectedGiftTextOption):void 0,sender_name:this.senderName,quantity:this.quantity,deliver_at:this.showCalendar?this.deliveryDate:null,image_url:this.uploadedImage??this.selectedImage,donation_amount:t||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(r,a));const o=this.productId?()=>salla.product.addProductGiftToCart(this.productId,a,!0):()=>salla.cart.addCartGiftToCart(r,!0);return await o().then((()=>this.modal.close())).catch((t=>{t.response&&422==t.response.status?this.errors=t.response.data.error.fields:console.log(t),this.setWrapperHeight(2,150,0)}))}step2ItemClass(t=""){const i="anime-item"+(this.step2Animated?"":" opacity-0");return t?`${t} ${i}`:i}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 t=document.querySelector(this.formSelector);if(!t)return void console.error("SallaGifting:: Form not found in the document!");if(!(t instanceof HTMLFormElement))return void console.error("SallaGifting:: The specified selector does not correspond to a form tag!");if(!t.reportValidity())return console.error("SallaGifting:: Form is not valid!"),void salla.error(salla.lang.get("common.messages.required_fields"))}const t=document.querySelector(`salla-product-options[product-id="${this.productId}"]`);!t||await t.reportValidity()?this.open():salla.error(salla.lang.get("common.messages.required_fields"))}render(){return[i("div",{key:"3795180f3f719218220086c66f6bfbe6e57dc1d4"},i("salla-list-tile",{key:"cb9fd3e10b02bb429b25c028fcd2d328e73eab6e",class:this.generateClass()},i("div",{key:"cca448eae1144b0606bf8f07844974cd7f966236",slot:"title"},this.vertical?i("span",{innerHTML:a}):"",i("h3",{key:"c33210bdf1a72cdf0151138ce2949fc462efaf94"},this.widgetTitle?this.widgetTitle:this.sectionTitle)),i("div",{key:"007fc138265e6ab82dbdfab8169baa407b111e60",slot:"subtitle"},i("div",{key:"89de9cc780511609d294f67a3d639a0305300b17"},this.widgetSubtitle?this.widgetSubtitle:this.sectionSubtitle)),i("div",{key:"ea647e47079ab8e57580675f485bc99c2b213cd4",slot:"action"},i("salla-button",{key:"e87bcc03e5ab02204ca9f1d590421cae13282269",color:"primary",fill:"outline",width:"wide",class:"s-gifting-widget-action",onClick:()=>this.handleGiftButtonClick()},i("slot",{key:"ce294391f8c18e345ec2117a15e2942dd00790fc",name:"widget-btn-content"},i("div",{key:"7106257d9f44b869fcd3933ae8a1d2a50f4486dd",class:"s-gifting-widget-action-content"},i("span",{key:"305822ae865b6da9275ced4600933d83d42e54e7",innerHTML:a})," ",i("span",{key:"13f2d03213e1fea9fe9911a94259b89085406ab3"},this.sectionBtnText)))))),i("salla-modal",{key:"b55185fbd34776043661ca6f15a739e34e98e0ef",id:this.hostId,isLoading:!0,class:"s-gifting-modal",width:"sm",ref:t=>this.modal=t},i("div",{key:"9f59cea6e2835d80e24bc269b78a5bc47b354f6a",slot:"loading"},i("div",{key:"3f74f3384be120a0733e921de696d2beeccd49ce",class:"s-gifting-skeleton"},i("div",{key:"e3ffb5b8d712bc391ad6b4190556ac870e37db0c",class:"s-gifting-modal-header"},i("salla-skeleton",{key:"b9b154ab445516fa1fae66cc458dd68114024d9d",type:"circle",height:"5rem",width:"5rem"}),i("h2",{key:"1ecf5c6ea1ebeccbd6ed7f259045647148863826",class:"s-gifting-modal-title"},i("div",{key:"165d927a3bcaf47dd5c7657db8543ad02b47dc44",class:"s-gifting-modal-badge-wrapper"},i("salla-skeleton",{key:"cba1667fa446566c5bc862c206313d8f48a0991e",height:"15px",width:"150px"})))),i("div",{key:"f56f8e8820f789ca117a0e19cf660bc4d836ec6a",class:"s-gifting-skeleton-content"},i("salla-skeleton",{key:"74b8cec4be6e18ec8a1b340d8fed0b2d136bb1d3",height:"10px",width:"150px"}),i("salla-skeleton",{key:"5c615a0c0eb72908e601c2cfd28fe12a6391ef80",height:"230px"}),i("salla-skeleton",{key:"5c432b6e3f8c70574e1d05d26f57443ff5da45fe",height:"10px",width:"150px"}),i("salla-skeleton",{key:"7f5d7ec5cf3ef50f945e2a57363ac215e41f306b",height:"30px"}),i("salla-skeleton",{key:"47c0e823643dc9c2d4908dde353adf5b0e4355ad",height:"40px"})))),i("slot",{key:"3ad3a57a07cb8182e5cd86783ba19c8ae8f34d3b",name:"header"}),this.hasError?i("salla-placeholder",{alignment:"center"},i("span",{slot:"title"},this.errorMessage||salla.lang.get("common.errors.empty_results")),i("span",{slot:"description"}," ")):[i("div",{class:"s-gifting-modal-header"},i("span",{class:"s-gifting-modal-icon"},i("span",{innerHTML:a})),i("h2",{class:"s-gifting-modal-title"},i("div",{class:"s-gifting-modal-badge-wrapper"},!this.skipStep1()&&i("div",{class:"s-gifting-modal-badge"},i("span",null,i("span",null,this.currentStep),"/2")),i("span",null,this.giftDetails)))),i("div",{class:"s-gifting-steps-wrapper "+this.parentClass,ref:t=>this.stepsWrapper=t},!this.skipStep1()&&i("div",{class:"s-gifting-step-one gift-step-1",ref:t=>this.step1Elems=t},this.gift&&this.gift.show_images&&i("div",{class:"s-gifting-modal-uploader-title anime-item"},this.selectImageForYourGift),this.gift&&this.gift.show_images&&i("div",{class:"s-gifting-image-section"},i("div",{class:`s-gifting-modal-uploader anime-item ${this.disableClass}`,ref:t=>this.uploader=t},i("span",{class:"s-gifting-remove-preview pointer-events-auto",onClick:()=>this.removePreview(),innerHTML:r}),this.selectImageOrUpload&&this.gift&&i("salla-file-upload",{"instant-upload":!0,name:"image_url",url:salla.url.api(salla.product.api.getUrl("giftImage")),onUploaded:t=>this.handleUploadImage(t.detail),labelIdle:this.getFilepondPlaceholder(),onRemoved:()=>this.handleRemoveImage()})),i("div",{class:"anime-item"},!this.uploadedImage&&this.gift&&this.gift.gift_images&&this.gift.gift_images.length>0?i("salla-slider",{id:"gifting-slider",loop:!1,"controls-outer":!0,class:"s-gifting-slider",type:"carousel"},i("div",{slot:"items"},this.gift&&this.gift.gift_images?this.gift?.gift_images.map((t=>i("a",{class:"s-gifting-clickable s-gifting-image",onClick:()=>this.setPreview(t)},i("img",{src:t.url,alt:`${t.id}`})))):"")):"")),this.gift&&this.gift.show_texts?i("div",{class:"anime-item"},i("div",{class:"s-gifting-modal-uploader-title s-gifting-text-title"},this.giftText),i("div",{class:"s-form-group s-gifting-selectText",ref:t=>this.textSelect=t},i("select",{id:"gift-text-selection",name:"gift-text-selection",class:"s-form-control s-gifting-select",onChange:t=>this.toggleGiftText(t)},i("option",{"data-id":null,selected:!this.selectedGiftTextOption},this.selectGiftMessage),this.gift&&this.gift.gift_texts?this.gift?.gift_texts.map((t=>i("option",{"data-id":t.id,value:t.text,key:t.id,selected:String(this.selectedGiftTextOption)===String(t.id)},t.text))):"",this.gift&&this.gift.show_custom_text?i("option",{"data-id":"custom",selected:"custom"===this.selectedGiftTextOption},this.giftCustomText):null)),i("div",{class:this.showGiftText&&this.gift&&this.gift.show_custom_text?"s-form-group s-gifting-textarea shown":"s-form-group s-gifting-textarea hide",ref:t=>this.customTextArea=t},i("label",{htmlFor:"gift-custom-text",class:"s-form-label"},this.giftCustomText),i("div",{class:"mt-1"},i("textarea",{onInput:t=>this.handleTextAreaChange(t),rows:4,ref:t=>this.textArea=t,name:"gift-custom-text",id:"gift-custom-text",class:"s-form-control"})))):null,i("div",{class:"anime-item"},i("salla-button",{color:"primary",width:"wide",onClick:()=>this.goToStep2(!!this.gift?.show_texts)},i("span",null,this.nextStep)))),i("div",{class:"s-gifting-step-two gift-step-2",style:this.skipStep1()?{opacity:"1",transform:"translateX(0)",position:"relative"}:void 0,ref:t=>this.step2Elems=t},i("div",{class:this.step2ItemClass(this.errors?.sender_name?"s-form-group s-form-has-error":"s-form-group")},i("label",{htmlFor:"sender_name",class:"s-form-label"},this.senderNameLabel),i("input",{type:"text",class:"s-form-control",name:"sender_name",id:"sender_name",value:this.senderName,onInput:t=>this.handleSenderName(t),placeholder:""}),this.errors&&this.errors.sender_name?i("span",{class:"s-gifting-error"},this.errors.sender_name):""),i("div",{class:this.step2ItemClass(this.errors?.["receiver.name"]?"s-form-group s-form-has-error":"s-form-group")},i("label",{htmlFor:"receiver_name",class:"s-form-label"},this.receiverNameFieldLabel),i("input",{type:"text",class:"s-form-control",name:"receiver_name",id:"receiver_name",value:"",onInput:t=>this.handleReceiverName(t),placeholder:""}),this.errors&&this.errors["receiver.name"]?i("span",{class:"s-gifting-error"},this.errors["receiver.name"]):""),i("div",{class:this.step2ItemClass(this.errors?.["receiver.mobile"]?"s-form-group s-form-has-error":"s-form-group")},i("label",{class:"s-form-label"},this.receiverMobileFieldLabel),i("salla-tel-input",{class:"s-gifting-tel-input",phone:this.receiverMobile,countryCode:this.receiverCountryCode,onPhoneEntered:t=>this.handlePhoneInputChange(t)}),this.errors&&this.errors["receiver.mobile"]?i("span",{class:"s-gifting-error"},this.errors["receiver.mobile"]):""),this.isPhysical()&&i("div",{class:this.step2ItemClass(this.errors?.["receiver.country"]?"s-form-group s-form-has-error":"s-form-group")},i("label",{class:"s-form-label",htmlFor:`${this.hostId}-country`},this.receiverCountryFieldLabel),i("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:t=>this.handleCountrySelected(t.detail),onDropdownClosed:()=>this.handleCountryDropdownClosed()}),this.errors&&this.errors["receiver.country"]?i("span",{class:"s-gifting-error"},this.errors["receiver.country"]):""),this.isPhysical()&&this.isKSA&&i("div",{class:this.step2ItemClass(this.errors?.["receiver.region"]?"s-form-group s-form-has-error":"s-form-group")},i("label",{class:"s-form-label",htmlFor:`${this.hostId}-region`},this.receiverRegionFieldLabel),i("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:t=>this.handleRegionSelected(t.detail),onDropdownClosed:()=>this.handleRegionDropdownClosed()}),this.errors&&this.errors["receiver.region"]?i("span",{class:"s-gifting-error"},this.errors["receiver.region"]):""),this.isPhysical()&&i("div",{class:this.step2ItemClass(this.errors?.["receiver.city_id"]?"s-form-group s-form-has-error":"s-form-group")},i("label",{class:"s-form-label",htmlFor:`${this.hostId}-city`},this.receiverCityFieldLabel),i("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:t=>this.handleCitySelected(t.detail),onSearchInput:t=>this.handleCitySearch(t.detail),onDropdownClosed:()=>this.handleCityDropdownClosed()}),this.errors&&this.errors["receiver.city_id"]?i("span",{class:"s-gifting-error"},this.errors["receiver.city_id"]):""),this.isPhysical()&&this.cityNoticeText()&&i("div",{class:this.step2ItemClass("s-gifting-info")},i("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'}),i("span",null,this.cityNoticeText())),!this.isPhysical()&&i("div",{class:this.step2ItemClass()},i("label",{class:"s-gifting-schedule s-gifting-clickable",htmlFor:`schedule-${this.hostId}`},i("input",{type:"checkbox",name:"schedule",id:`schedule-${this.hostId}`,onChange:()=>this.toggleCalendar(),class:"s-checkbox"}),i("span",{class:"s-form-label"}," ",this.sendLater," "))),i("div",{class:this.getCalendarClasses(),ref:t=>this.calendarFormGroup=t},i("label",{class:"s-form-label"},this.selectSendDateAndTime),i("salla-datetime-picker",{value:this.deliveryDate,placeholder:this.selectSendDateAndTime,"enable-time":!0,"date-format":"Y-m-d h:i K",onPicked:t=>this.handleDateTimePicker(t)}),i("span",{class:"s-gifting-calendar-hint"},this.canNotEditOrderAfterSelectDate)),i("div",{class:this.step2ItemClass("s-gifting-step-two-footer")},!this.skipStep1()&&i("a",{href:"#!",innerHTML:s,onClick:t=>this.goToStep1(t)}),i("salla-button",{onClick:()=>this.submitForm(),color:"primary",width:"wide"},i("span",null,this.sendGift)))))],i("slot",{key:"4b5e340be26e46c09508d192207fa6af9ec0cc44",name:"footer"})))]}};o.CITY_AJAX_THRESHOLD=400,o.CITY_SEARCH_DEBOUNCE_MS=100,o.style='/*!twlt*/.s-gifting-steps-wrapper{transition:height 0.8s 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}.s-gifting-modal .s-gifting-image-section{margin-bottom:1.5rem}.s-gifting-modal .s-gifting-slider{margin-bottom:0.5rem}.s-gifting-modal .s-gifting-image{display:block}.s-gifting-modal .s-gifting-image img{display:block;width:auto;height:100px;object-fit:contain}.s-gifting-modal .s-gifting-image-section+.anime-item .s-gifting-text-title{margin-top:1rem}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.static{position:static}.fixed{position:fixed}.relative{position:relative}.mt-1{margin-top:0.25rem}.inline{display:inline}.hidden{display:none}.grow{flex-grow:1}.transform{transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.resize{resize:both}.opacity-0{opacity:0}.outline{outline-style:solid}.transition{transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-hidden{display:none}.has-error .s-form-label{color:#ff443a}.has-error .s-form-control,.has-error .s-tel-input-control,.has-error .s-datetime-picker-input{border-color:#ff443a;color:#ff443a}.s-hidden{display:none}.s-form-control{display:block;width:100%;border-radius:var(--s-radius, 0.25rem);border-width:1px;--tw-border-opacity:1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.5rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-form-control:focus{border-color:var(--color-primary);--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)}.s-form-label{margin-bottom:0.25rem;display:block;font-size:0.875rem;line-height:1.25rem;font-weight:500;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-form-group{margin-top:0.75rem;margin-bottom:0.75rem}.s-checkbox{cursor:pointer;--tw-border-opacity:1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1));appearance:none;background-color:#fff;margin:0;width:18px;height:18px;border-width:1px;border-radius:4px;display:grid;place-content:center}.s-checkbox:before{width:10px;height:10px;clip-path:polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);transform:scale(0);transform-origin:bottom left;transition:120ms transform ease-in-out;box-shadow:inset 1em 1em #444;background-color:#444}.s-checkbox:checked:before{transform:scale(1)}.s-checkbox::before{--tw-content:\'\';content:var(--tw-content)}.s-form-has-error .s-form-label{color:#ff443a}.s-form-has-error .s-form-control,.s-form-has-error .s-tel-input-control,.s-form-has-error .s-datetime-picker-input{border-color:#ff443a;color:#ff443a}.s-gifting-widget .s-list-tile-item-icon{display:none}.s-gifting-widget-vertical .s-list-tile-item-icon{display:block}.s-gifting-widget-vertical .s-list-tile-item-title svg{fill:var(--color-primary)}.s-gifting-widget-vertical .s-list-tile-item-subtitle{padding-right:3.5rem;font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-gifting-widget-vertical .s-list-tile-item{flex-wrap:wrap;padding:0px}@media (min-width: 1024px){.s-gifting-widget-vertical .s-list-tile-item-action{flex:1 1 0%}}.s-gifting-widget-vertical .widget-icon{--tw-translate-y:0.625rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));font-size:1.875rem;line-height:2.25rem;color:var(--color-primary)}.s-gifting-widget .s-button-text{display:flex}.s-gifting-widget .s-list-tile-item{flex-direction:column;justify-content:space-between;gap:1rem;border-radius:0.75rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));padding:1.25rem;text-align:center}@media (min-width: 768px){.s-gifting-widget .s-list-tile-item{text-align:left}}@media (min-width: 1024px){.s-gifting-widget .s-list-tile-item{flex-direction:row}}@media (min-width: 768px){.s-gifting-widget .s-list-tile-item:where([dir="rtl"],[dir="rtl"] *){text-align:right}}.s-gifting-widget-horizontal .s-gifting-widget-action button{padding-left:2rem;padding-right:2rem;font-weight:400}.s-gifting-info{display:flex;align-items:center;gap:0.5rem;border-radius:0.5rem;--tw-border-opacity:1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1));padding:1rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.s-gifting-info svg{height:1.25rem;width:1.25rem;fill:#1d4ed8}.s-gifting-error{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.s-gifting-info span{font-size:0.75rem;line-height:1rem}.s-gifting-widget-action-content{display:flex;align-items:center}.s-gifting-widget-action-content svg{margin-left:0.5rem;margin-right:0.5rem}.s-gifting-modal-header{margin-bottom:1.25rem;display:flex;flex-direction:column;align-items:center;justify-content:center}.s-gifting-modal .s-modal-header{display:block}.s-gifting-modal .s-modal-body{position:relative !important;left:unset !important;bottom:unset !important;padding-bottom:2rem}@media (min-width: 640px){.s-gifting-modal .s-modal-body{padding-bottom:1.5rem}}.s-gifting-modal-icon{margin-bottom:1.25rem;display:flex;height:5rem;width:5rem;flex-direction:row;align-items:center;justify-content:center;border-radius:9999px;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));font-size:1.875rem;line-height:2.25rem}.s-gifting-modal-title{display:flex;width:100%;align-items:center;justify-content:space-between}.s-gifting-modal-title::before{display:block;height:1px;flex:1 1 auto;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1));--tw-content:\'\';content:var(--tw-content)}.s-gifting-modal-title::after{display:block;height:1px;flex:1 1 auto;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1));--tw-content:\'\';content:var(--tw-content)}.s-gifting-modal-badge-wrapper{display:flex;align-items:center;padding-left:0.75rem;padding-right:0.75rem}.s-gifting-modal-badge{margin-right:0.5rem;border-radius:0.5rem;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1));padding-left:0.5rem;padding-right:0.5rem;padding-top:0.25rem;padding-bottom:0.25rem;font-size:0.875rem;line-height:1.25rem}.s-gifting-modal-badge:where([dir="rtl"],[dir="rtl"] *){margin-right:0px;margin-left:0.5rem}.s-gifting-modal-uploader.has-bg{position:relative}.s-gifting-modal-uploader.has-bg .s-gifting-remove-preview{pointer-events:auto;--tw-scale-x:1;--tw-scale-y:1;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));opacity:1}.s-gifting-modal-uploader-title{margin-bottom:0.5rem;font-size:0.875rem;line-height:1.25rem}.s-gifting-steps-wrapper{position:relative}.s-gifting-steps-wrapper .s-button-wrap{pointer-events:auto !important}.is-current-step-2 .gift-step-1,.is-current-step-1 .gift-step-2{pointer-events:none;z-index:-1}.s-gifting-step-one{padding-top:1.25rem}.s-gifting-step-two{position:absolute;top:0px;left:0px;margin-left:auto;margin-right:auto;display:flex;width:100%;--tw-translate-x:-105%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));flex-direction:column;opacity:0}.s-gifting-step-one .swiper-wrapper{height:100px}.s-gifting-step-one .swiper-slide{width:auto !important}.s-gifting-step-one .filepond--list-scroller{overflow-y:hidden}.s-gifting-step-one .swiper-wrapper img{border-radius:0.375rem;object-fit:cover}.s-gifting-step-one .filepond--root{height:230px}.s-gifting-step-one .filepond--list{left:0px !important;height:100% !important}.s-gifting-step-one .filepond-bg{position:absolute;top:0px;z-index:10;height:100%;width:100%;border-radius:var(--s-radius, 0.25rem);--tw-bg-opacity:1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1));background-size:cover}.s-gifting-step-one .s-slider-button-next{top:35% !important}.s-gifting-step-one .s-slider-button-next button{height:35px;width:35px;--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-gifting-step-one .s-slider-button-prev{top:35% !important}.s-gifting-step-one .s-slider-button-prev button{height:35px;width:35px;--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-gifting-tel-input .s-tel-input-control{--tw-border-opacity:1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.s-gifting-tel-input .s-tel-input-error-msg{display:none}.s-gifting-step-two-footer{margin-top:1.25rem;display:flex;flex-direction:row;align-items:center;justify-content:center}.s-gifting-step-two-footer>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.625rem * var(--tw-space-x-reverse));margin-left:calc(0.625rem * calc(1 - var(--tw-space-x-reverse)))}.s-gifting-step-two-footer:where([dir="rtl"],[dir="rtl"] *){flex-direction:row-reverse}.s-gifting-step-two-footer a{border-radius:0.375rem;border-width:1px;border-color:var(--color-primary);fill:var(--color-primary);padding-top:8px;padding-bottom:8px;padding-left:25px;padding-right:25px}.s-gifting-step-two-footer a svg{height:1.25rem;width:1.25rem}.s-gifting-step-two .s-form-group.s-form-has-error .s-tel-input-control{--tw-border-opacity:1 !important;border-color:rgb(255 68 58 / var(--tw-border-opacity, 1)) !important}.s-gifting-selectText{margin-bottom:20px !important}.s-gifting-schedule .s-form-label{margin-bottom:0px !important}.s-gifting-schedule{margin-bottom:0.5rem;display:flex;align-items:center;justify-content:flex-start}.s-gifting-schedule>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.375rem * var(--tw-space-x-reverse));margin-left:calc(0.375rem * calc(1 - var(--tw-space-x-reverse)))}.s-gifting-schedule:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-gifting-clickable{cursor:pointer}.s-gifting-remove-preview{pointer-events:none;position:absolute;top:-7px;left:-7px;z-index:10;display:flex;height:1.25rem;width:1.25rem;--tw-scale-x:0;--tw-scale-y:0;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));cursor:pointer;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1));text-align:center;font-size:1rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1));opacity:0;transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-gifting-remove-preview:where([dir="rtl"],[dir="rtl"] *){left:unset;right:-7px}.s-gifting-remove-preview svg{height:100%;width:15px;fill:#fff}.s-gifting-textarea{transition-property:all;transition-duration:200ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.s-gifting-calendar-hint{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.s-gifting-calendar.shown{margin-top:0.75rem;height:75px;opacity:1}.s-gifting-textarea.shown{height:122px;opacity:1}.s-gifting-calendar.hide{pointer-events:none;visibility:hidden;margin:0px;height:0px;opacity:0}.s-gifting-textarea.hide{pointer-events:none;visibility:hidden;margin:0px;height:0px;opacity:0}.s-gifting-filepond-placeholder-icon svg{margin-top:12px;margin-bottom:12px;margin-left:auto;margin-right:auto;height:4rem;width:3rem;fill:#e5e7eb}.s-gifting-filepond-placeholder-text{margin-left:auto;margin-right:auto;width:65%;min-width:18rem;font-size:0.75rem !important;line-height:1rem !important;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1));margin-top:0.75rem;margin-bottom:0.75rem;font-family:var(--font-main), -apple-system, BlinkMacSystemFont}.s-gifting-skeleton-content salla-skeleton:nth-child(1){margin-bottom:0.75rem}.s-gifting-skeleton-content salla-skeleton:nth-child(2){margin-bottom:1.25rem}.s-gifting-skeleton-content salla-skeleton:nth-child(3){margin-bottom:0.75rem}.s-gifting-skeleton-content salla-skeleton:nth-child(4){margin-bottom:1.25rem}.s-gifting-skeleton .s-gifting-modal-header salla-skeleton{margin-bottom:1.25rem}.s-gifting-skeleton .s-gifting-modal-title{margin-bottom:1.25rem}.s-gifting-image{margin-left:5px;margin-right:5px}';export{o as salla_gifting}
|
|
4
|
+
import{r as t,h as i}from"./p-Q9lz4Iuq.js";import{a as e}from"./p-CgtvEd63.js";import{a as s}from"./p-BedNk7k1.js";import{C as r}from"./p-BsLF_HK7.js";import{G as a}from"./p-DxkgAGoT.js";const o=class{constructor(i){t(this,i),this.defaultEvent="gifting:open",this.selectImageForYourGift=salla.lang.get("blocks.buy_as_gift.select_image_for_your_gift"),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.disableClass=this.gift?.show_image_upload?"":"pointer-events-none",this.formSelector="form.product-form, form.form--product-options",this.handleCitySearch=t=>{if(this.citySearchQuery=t,!this.enableCityAjaxSearch)return;this.citySearchTimer&&clearTimeout(this.citySearchTimer);const i=++this.citySearchCounter;this.citySearchTimer=setTimeout((async()=>{this.searchingCities=!0;try{const e=await this.fetchCities(t);i===this.citySearchCounter&&(this.displayedCities=e)}catch(t){i===this.citySearchCounter&&(this.displayedCities=[])}finally{i===this.citySearchCounter&&(this.searchingCities=!1)}}),o.CITY_SEARCH_DEBOUNCE_MS)},this.handleCitySelected=t=>{this.selectedCity=t,this.receiverCity=String(t.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.giftText=salla.lang.get("blocks.buy_as_gift.gift_text"),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.cityChangeNotice=salla.lang.get("blocks.buy_as_gift.city_change_notice"),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}cityNoticeText(){return this.gift?.recipient_can_change_address?this.gift?.allows_different_shipping_cost?null:this.cityChangeNotice:this.selectCityInfo}componentDidLoad(){salla.event.product.onPriceUpdated((()=>{const t=document.querySelector(".s-quantity-input-input");this.quantity=t?.value}))}getFormDataFromForm(){if(!this.formSelector)return null;const t=document.querySelector(this.formSelector);return t?new FormData(t):null}mergeObjectToFormData(t,i,e){for(let s in t){if(!t.hasOwnProperty(s)||null==t[s])continue;const r=e?`${e}[${s}]`:s;"object"!=typeof t[s]||null===t[s]||t[s]instanceof File?i.set(r,t[s]):this.mergeObjectToFormData(t[s],i,r)}return i}async open(){if(salla.config.isGuest())return salla.api.auth.setAfterLoginEvent(this.defaultEvent),void salla.event.dispatch("login::open",{withoutReload:!0});this.resetStepsAnimation(),this.currentStep=1,this.parentClass="is-current-step-1",this.step2Animated=!1,this.stepsWrapper?.style.removeProperty("height"),await this.modal.open();const t=this.productId?()=>salla.product.getGiftProductDetails(this.productId):()=>salla.cart.getGiftCartDetails();return await salla.api.withoutNotifier(t).then((t=>{this.gift=t.data,this.senderName=this.gift.sender_name,this.disableClass=this.gift?.show_image_upload?"":"pointer-events-none",this.gift.show_texts||(this.selectedGiftTextOption=void 0,this.selectedText=void 0),this.gift.show_images||(this.selectedImage=void 0,this.uploadedImage=void 0),this.skipStep1()&&(this.currentStep=2,this.parentClass="is-current-step-2",this.step2Animated=!0)})).catch((t=>{this.hasError=!0,this.errorMessage=t.response?.data?.error?.message||t.response?.data})).finally((()=>this.modal.stopLoading()))}skipStep1(){return!!this.gift&&!this.gift.show_images&&!this.gift.show_texts}resetStepsAnimation(){[this.step1Elems,this.step2Elems].forEach((t=>{t?.querySelectorAll(".anime-item").forEach((t=>t.removeAttribute("style")))})),this.step1Elems?.removeAttribute("style"),this.step2Elems&&!this.skipStep1()&&(this.step2Elems.style.removeProperty("opacity"),this.step2Elems.style.removeProperty("transform"))}async close(){return this.modal.close()}async setWrapperHeight(t=1,i=250,e=0,s=0){let r=document.querySelector(`#${this.hostId} .gift-step-${t}`);const a=()=>{this.stepsWrapper.style.height=s?`${s}px`:r.offsetHeight+e+"px"};this.step2Animated&&2===t?requestAnimationFrame(a):setTimeout(a,i)}toggleCalendar(){this.showCalendar=!this.showCalendar,this.setWrapperHeight(2,150,0)}toggleGiftText(t){this.textSelect?.classList.remove("s-form-has-error");let i=t.target.children[t.target.selectedIndex].getAttribute("data-id"),e="custom"==i;const s=this.showGiftText!==e;this.showGiftText=e,i?(this.selectedGiftTextOption=i,this.selectedText=e?void 0:t.target.value):(this.textArea.value="",this.selectedText=void 0,this.selectedGiftTextOption=void 0),s&&this.setWrapperHeight(1,150,5)}async goToStep2(t=!0){this.step1Elems&&(t&&!this.validateStep1()||(this.stepsWrapper&&this.step1Elems&&(this.stepsWrapper.style.height=`${this.step1Elems.offsetHeight}px`),this.setWrapperHeight(2,50,0),(new e.timeline).add({targets:this.step1Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[1,0],translateX:[0,50],delay:e.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:e.stagger(70),duration:1200,complete:()=>{this.step2Elems.querySelectorAll(`#${this.hostId} .anime-item`).forEach((t=>{t.classList.remove("opacity-0"),t.removeAttribute("style")})),this.step2Animated=!0}},"-=1200"),this.currentStep=2,this.parentClass=`is-current-step-${this.currentStep}`))}validateStep1(){return!(this.gift?.show_texts&&(this.selectedGiftTextOption?"custom"!=this.selectedGiftTextOption||this.selectedText?(this.textSelect?.classList.remove("s-form-has-error"),this.customTextArea?.classList.remove("s-form-has-error"),0):(this.textSelect?.classList.remove("s-form-has-error"),this.customTextArea?.classList.add("s-form-has-error"),1):(this.textSelect?.classList.add("s-form-has-error"),this.customTextArea?.classList.remove("s-form-has-error"),1)))}goToStep1(t){t.preventDefault();let i=new e.timeline({autoplay:!1});i.add({targets:this.step2Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[1,0],translateX:[0,-50],delay:e.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:e.stagger(70),duration:1200,complete:()=>{this.step1Elems.querySelectorAll(`#${this.hostId} .anime-item`).forEach((t=>{t.classList.remove("opacity-0"),t.removeAttribute("style")}))}},"-=1200"),i.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.gift.show_image_upload?this.selectImageOrUpload:this.selectImageForYourGift}</p></div>`}setPreview(t){this.uploader?.classList.add("has-bg");var i=document.querySelector(`#${this.hostId}.filepond-bg`)?document.querySelector(`#${this.hostId} .filepond-bg`):document.createElement("div");i.classList.add("filepond-bg"),i.classList.remove("s-hidden"),i.style.backgroundImage="url('"+t.url+"')",this.uploader?.querySelector(".filepond--root")?.appendChild(i),this.uploadedImage=t.url,this.gift&&this.gift.gift_images?.length&&this.setWrapperHeight(1,150,0)}removePreview(){this.uploader.classList.remove("has-bg");let t=document.querySelector(`#${this.hostId} .filepond-bg`);t.removeAttribute("style"),t.classList.add("s-hidden"),this.handleRemoveImage()}handleTextAreaChange(t){this.selectedText=t.target.value,this.customTextArea?.classList.remove("s-form-has-error")}clearError(t){if(this.errors?.[t]){const{[t]:i,...e}=this.errors;this.errors=e}}handleSenderName(t){this.senderName=t.target.value,this.clearError("sender_name")}handleReceiverName(t){this.receiverName=t.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(t){this.gift={...this.gift,cities:t},this.displayedCities=t,this.enableCityAjaxSearch=t.length>=o.CITY_AJAX_THRESHOLD}async fetchCities(t=""){if(!this.selectedCountryId)return[];if(this.isKSA&&!this.selectedRegionId)return[];const i=["for_branch=0",`country_id=${this.selectedCountryId}`];this.isKSA&&this.selectedRegionId&&i.push(`region_id=${this.selectedRegionId}`),t?.trim()&&i.push(`query=${encodeURIComponent(t.trim())}`);const e=await salla.api.request(`shipping/cities?${i.join("&")}`);return e?.data??[]}async handleCountrySelected(t){const i=t?.id;this.selectedCountry=t??null,this.selectedCountryId=i,this.selectedCountryCode=t?.country_code,this.isKSA="SA"===t?.country_code,this.clearError("receiver.country"),this.regions=[],this.selectedRegionId=void 0,this.selectedRegion=null,this.resetCityState();const e=++this.locationRequestCounter;if(!i)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 t=await salla.api.request(`shipping/countries/${i}/regions`);if(e!==this.locationRequestCounter)return;t&&t.data&&(this.regions=t.data)}catch(t){if(e!==this.locationRequestCounter)return;console.error("Error fetching regions:",t)}finally{e===this.locationRequestCounter&&(this.loadingRegions=!1,this.setWrapperHeight(2,0,0))}}else{this.loadingCities=!0,this.setWrapperHeight(2,0,0);try{const t=await this.fetchCities();if(e!==this.locationRequestCounter)return;this.setInitialCities(t)}catch(t){if(e!==this.locationRequestCounter)return;console.error("Error fetching cities:",t)}finally{e===this.locationRequestCounter&&(this.loadingCities=!1)}}}async handleRegionSelected(t){const i=t?.id;this.selectedRegion=t??null,this.selectedRegionId=i,this.clearError("receiver.region"),this.resetCityState();const e=++this.locationRequestCounter;if(i){this.loadingCities=!0;try{const t=await this.fetchCities();if(e!==this.locationRequestCounter)return;this.setInitialCities(t)}catch(t){if(e!==this.locationRequestCounter)return;console.error("Error fetching cities:",t)}finally{e===this.locationRequestCounter&&(this.loadingCities=!1,this.setWrapperHeight(2,0,0))}}}handleUploadImage(t){this.uploadedImage="object"!=typeof t?t:t&&t.url,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(t){let i=t.detail;this.receiverMobile=i.number,this.receiverCountryCode=i.country_code,this.clearError("receiver.mobile")}handleDateTimePicker(t){this.deliveryDate=t.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 t=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 i=[{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}]:[]],e={};if(i.forEach((({key:t,value:i,label:s})=>{i||(e[t]=salla.lang.get("common.errors.field_required",{attribute:s}))})),Object.keys(e).length)return this.errors=e,void this.setWrapperHeight(2,150,0);const s="custom"===this.selectedGiftTextOption,r={text:s?this.selectedText:void 0,text_id:!s&&this.selectedGiftTextOption?Number(this.selectedGiftTextOption):void 0,sender_name:this.senderName,quantity:this.quantity,deliver_at:this.showCalendar?this.deliveryDate:null,image_url:this.uploadedImage??this.selectedImage,donation_amount:t||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(r,a));const o=this.productId?()=>salla.product.addProductGiftToCart(this.productId,a,!0):()=>salla.cart.addCartGiftToCart(r,!0);return await o().then((()=>this.modal.close())).catch((t=>{t.response&&422==t.response.status?this.errors=t.response.data.error.fields:console.log(t),this.setWrapperHeight(2,150,0)}))}step2ItemClass(t=""){const i="anime-item"+(this.step2Animated?"":" opacity-0");return t?`${t} ${i}`:i}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 t=document.querySelector(this.formSelector);if(!t)return void console.error("SallaGifting:: Form not found in the document!");if(!(t instanceof HTMLFormElement))return void console.error("SallaGifting:: The specified selector does not correspond to a form tag!");if(!t.reportValidity())return console.error("SallaGifting:: Form is not valid!"),void salla.error(salla.lang.get("common.messages.required_fields"))}const t=document.querySelector(`salla-product-options[product-id="${this.productId}"]`);!t||await t.reportValidity()?this.open():salla.error(salla.lang.get("common.messages.required_fields"))}render(){return[i("div",{key:"3795180f3f719218220086c66f6bfbe6e57dc1d4"},i("salla-list-tile",{key:"cb9fd3e10b02bb429b25c028fcd2d328e73eab6e",class:this.generateClass()},i("div",{key:"cca448eae1144b0606bf8f07844974cd7f966236",slot:"title"},this.vertical?i("span",{innerHTML:a}):"",i("h3",{key:"c33210bdf1a72cdf0151138ce2949fc462efaf94"},this.widgetTitle?this.widgetTitle:this.sectionTitle)),i("div",{key:"007fc138265e6ab82dbdfab8169baa407b111e60",slot:"subtitle"},i("div",{key:"89de9cc780511609d294f67a3d639a0305300b17"},this.widgetSubtitle?this.widgetSubtitle:this.sectionSubtitle)),i("div",{key:"ea647e47079ab8e57580675f485bc99c2b213cd4",slot:"action"},i("salla-button",{key:"e87bcc03e5ab02204ca9f1d590421cae13282269",color:"primary",fill:"outline",width:"wide",class:"s-gifting-widget-action",onClick:()=>this.handleGiftButtonClick()},i("slot",{key:"ce294391f8c18e345ec2117a15e2942dd00790fc",name:"widget-btn-content"},i("div",{key:"7106257d9f44b869fcd3933ae8a1d2a50f4486dd",class:"s-gifting-widget-action-content"},i("span",{key:"305822ae865b6da9275ced4600933d83d42e54e7",innerHTML:a})," ",i("span",{key:"13f2d03213e1fea9fe9911a94259b89085406ab3"},this.sectionBtnText)))))),i("salla-modal",{key:"b55185fbd34776043661ca6f15a739e34e98e0ef",id:this.hostId,isLoading:!0,class:"s-gifting-modal",width:"sm",ref:t=>this.modal=t},i("div",{key:"9f59cea6e2835d80e24bc269b78a5bc47b354f6a",slot:"loading"},i("div",{key:"3f74f3384be120a0733e921de696d2beeccd49ce",class:"s-gifting-skeleton"},i("div",{key:"e3ffb5b8d712bc391ad6b4190556ac870e37db0c",class:"s-gifting-modal-header"},i("salla-skeleton",{key:"b9b154ab445516fa1fae66cc458dd68114024d9d",type:"circle",height:"5rem",width:"5rem"}),i("h2",{key:"1ecf5c6ea1ebeccbd6ed7f259045647148863826",class:"s-gifting-modal-title"},i("div",{key:"165d927a3bcaf47dd5c7657db8543ad02b47dc44",class:"s-gifting-modal-badge-wrapper"},i("salla-skeleton",{key:"cba1667fa446566c5bc862c206313d8f48a0991e",height:"15px",width:"150px"})))),i("div",{key:"f56f8e8820f789ca117a0e19cf660bc4d836ec6a",class:"s-gifting-skeleton-content"},i("salla-skeleton",{key:"74b8cec4be6e18ec8a1b340d8fed0b2d136bb1d3",height:"10px",width:"150px"}),i("salla-skeleton",{key:"5c615a0c0eb72908e601c2cfd28fe12a6391ef80",height:"230px"}),i("salla-skeleton",{key:"5c432b6e3f8c70574e1d05d26f57443ff5da45fe",height:"10px",width:"150px"}),i("salla-skeleton",{key:"7f5d7ec5cf3ef50f945e2a57363ac215e41f306b",height:"30px"}),i("salla-skeleton",{key:"47c0e823643dc9c2d4908dde353adf5b0e4355ad",height:"40px"})))),i("slot",{key:"3ad3a57a07cb8182e5cd86783ba19c8ae8f34d3b",name:"header"}),this.hasError?i("salla-placeholder",{alignment:"center"},i("span",{slot:"title"},this.errorMessage||salla.lang.get("common.errors.empty_results")),i("span",{slot:"description"}," ")):[i("div",{class:"s-gifting-modal-header"},i("span",{class:"s-gifting-modal-icon"},i("span",{innerHTML:a})),i("h2",{class:"s-gifting-modal-title"},i("div",{class:"s-gifting-modal-badge-wrapper"},!this.skipStep1()&&i("div",{class:"s-gifting-modal-badge"},i("span",null,i("span",null,this.currentStep),"/2")),i("span",null,this.giftDetails)))),i("div",{class:"s-gifting-steps-wrapper "+this.parentClass,ref:t=>this.stepsWrapper=t},!this.skipStep1()&&i("div",{class:"s-gifting-step-one gift-step-1",ref:t=>this.step1Elems=t},this.gift&&this.gift.show_images&&i("div",{class:"s-gifting-modal-uploader-title anime-item"},this.selectImageForYourGift),this.gift&&this.gift.show_images&&i("div",{class:"s-gifting-image-section"},i("div",{class:`s-gifting-modal-uploader anime-item ${this.disableClass}`,ref:t=>this.uploader=t},i("span",{class:"s-gifting-remove-preview pointer-events-auto",onClick:()=>this.removePreview(),innerHTML:r}),this.selectImageOrUpload&&this.gift&&i("salla-file-upload",{"instant-upload":!0,name:"image_url",url:salla.url.api(salla.product.api.getUrl("giftImage")),onUploaded:t=>this.handleUploadImage(t.detail),labelIdle:this.getFilepondPlaceholder(),onRemoved:()=>this.handleRemoveImage()})),i("div",{class:"anime-item"},!this.uploadedImage&&this.gift&&this.gift.gift_images&&this.gift.gift_images.length>0?i("salla-slider",{id:"gifting-slider",loop:!1,"controls-outer":!0,class:"s-gifting-slider",type:"carousel"},i("div",{slot:"items"},this.gift&&this.gift.gift_images?this.gift?.gift_images.map((t=>i("a",{class:"s-gifting-clickable s-gifting-image",onClick:()=>this.setPreview(t)},i("img",{src:t.url,alt:`${t.id}`})))):"")):"")),this.gift&&this.gift.show_texts?i("div",{class:"anime-item"},i("div",{class:"s-gifting-modal-uploader-title s-gifting-text-title"},this.giftText),i("div",{class:"s-form-group s-gifting-selectText",ref:t=>this.textSelect=t},i("select",{id:"gift-text-selection",name:"gift-text-selection",class:"s-form-control s-gifting-select",onChange:t=>this.toggleGiftText(t)},i("option",{"data-id":null,selected:!this.selectedGiftTextOption},this.selectGiftMessage),this.gift&&this.gift.gift_texts?this.gift?.gift_texts.map((t=>i("option",{"data-id":t.id,value:t.text,key:t.id,selected:String(this.selectedGiftTextOption)===String(t.id)},t.text))):"",this.gift&&this.gift.show_custom_text?i("option",{"data-id":"custom",selected:"custom"===this.selectedGiftTextOption},this.giftCustomText):null)),i("div",{class:this.showGiftText&&this.gift&&this.gift.show_custom_text?"s-form-group s-gifting-textarea shown":"s-form-group s-gifting-textarea hide",ref:t=>this.customTextArea=t},i("label",{htmlFor:"gift-custom-text",class:"s-form-label"},this.giftCustomText),i("div",{class:"mt-1"},i("textarea",{onInput:t=>this.handleTextAreaChange(t),rows:4,ref:t=>this.textArea=t,name:"gift-custom-text",id:"gift-custom-text",class:"s-form-control"})))):null,i("div",{class:"anime-item"},i("salla-button",{color:"primary",width:"wide",onClick:()=>this.goToStep2(!!this.gift?.show_texts)},i("span",null,this.nextStep)))),i("div",{class:"s-gifting-step-two gift-step-2",style:this.skipStep1()?{opacity:"1",transform:"translateX(0)",position:"relative"}:void 0,ref:t=>this.step2Elems=t},i("div",{class:this.step2ItemClass(this.errors?.sender_name?"s-form-group s-form-has-error":"s-form-group")},i("label",{htmlFor:"sender_name",class:"s-form-label"},this.senderNameLabel),i("input",{type:"text",class:"s-form-control",name:"sender_name",id:"sender_name",value:this.senderName,onInput:t=>this.handleSenderName(t),placeholder:""}),this.errors&&this.errors.sender_name?i("span",{class:"s-gifting-error"},this.errors.sender_name):""),i("div",{class:this.step2ItemClass(this.errors?.["receiver.name"]?"s-form-group s-form-has-error":"s-form-group")},i("label",{htmlFor:"receiver_name",class:"s-form-label"},this.receiverNameFieldLabel),i("input",{type:"text",class:"s-form-control",name:"receiver_name",id:"receiver_name",value:"",onInput:t=>this.handleReceiverName(t),placeholder:""}),this.errors&&this.errors["receiver.name"]?i("span",{class:"s-gifting-error"},this.errors["receiver.name"]):""),i("div",{class:this.step2ItemClass(this.errors?.["receiver.mobile"]?"s-form-group s-form-has-error":"s-form-group")},i("label",{class:"s-form-label"},this.receiverMobileFieldLabel),i("salla-tel-input",{class:"s-gifting-tel-input",phone:this.receiverMobile,countryCode:this.receiverCountryCode,onPhoneEntered:t=>this.handlePhoneInputChange(t)}),this.errors&&this.errors["receiver.mobile"]?i("span",{class:"s-gifting-error"},this.errors["receiver.mobile"]):""),this.isPhysical()&&i("div",{class:this.step2ItemClass(this.errors?.["receiver.country"]?"s-form-group s-form-has-error":"s-form-group")},i("label",{class:"s-form-label",htmlFor:`${this.hostId}-country`},this.receiverCountryFieldLabel),i("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:t=>this.handleCountrySelected(t.detail),onDropdownClosed:()=>this.handleCountryDropdownClosed()}),this.errors&&this.errors["receiver.country"]?i("span",{class:"s-gifting-error"},this.errors["receiver.country"]):""),this.isPhysical()&&this.isKSA&&i("div",{class:this.step2ItemClass(this.errors?.["receiver.region"]?"s-form-group s-form-has-error":"s-form-group")},i("label",{class:"s-form-label",htmlFor:`${this.hostId}-region`},this.receiverRegionFieldLabel),i("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:t=>this.handleRegionSelected(t.detail),onDropdownClosed:()=>this.handleRegionDropdownClosed()}),this.errors&&this.errors["receiver.region"]?i("span",{class:"s-gifting-error"},this.errors["receiver.region"]):""),this.isPhysical()&&i("div",{class:this.step2ItemClass(this.errors?.["receiver.city_id"]?"s-form-group s-form-has-error":"s-form-group")},i("label",{class:"s-form-label",htmlFor:`${this.hostId}-city`},this.receiverCityFieldLabel),i("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:t=>this.handleCitySelected(t.detail),onSearchInput:t=>this.handleCitySearch(t.detail),onDropdownClosed:()=>this.handleCityDropdownClosed()}),this.errors&&this.errors["receiver.city_id"]?i("span",{class:"s-gifting-error"},this.errors["receiver.city_id"]):""),this.isPhysical()&&this.cityNoticeText()&&i("div",{class:this.step2ItemClass("s-gifting-info")},i("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'}),i("span",null,this.cityNoticeText())),!this.isPhysical()&&i("div",{class:this.step2ItemClass()},i("label",{class:"s-gifting-schedule s-gifting-clickable",htmlFor:`schedule-${this.hostId}`},i("input",{type:"checkbox",name:"schedule",id:`schedule-${this.hostId}`,onChange:()=>this.toggleCalendar(),class:"s-checkbox"}),i("span",{class:"s-form-label"}," ",this.sendLater," "))),i("div",{class:this.getCalendarClasses(),ref:t=>this.calendarFormGroup=t},i("label",{class:"s-form-label"},this.selectSendDateAndTime),i("salla-datetime-picker",{value:this.deliveryDate,placeholder:this.selectSendDateAndTime,"enable-time":!0,"date-format":"Y-m-d h:i K",onPicked:t=>this.handleDateTimePicker(t)}),i("span",{class:"s-gifting-calendar-hint"},this.canNotEditOrderAfterSelectDate)),i("div",{class:this.step2ItemClass("s-gifting-step-two-footer")},!this.skipStep1()&&i("a",{href:"#!",innerHTML:s,onClick:t=>this.goToStep1(t)}),i("salla-button",{onClick:()=>this.submitForm(),color:"primary",width:"wide"},i("span",null,this.sendGift)))))],i("slot",{key:"4b5e340be26e46c09508d192207fa6af9ec0cc44",name:"footer"})))]}};o.CITY_AJAX_THRESHOLD=400,o.CITY_SEARCH_DEBOUNCE_MS=100,o.style='/*!twlt*/.s-gifting-steps-wrapper{transition:height 0.8s 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}.s-gifting-modal .s-gifting-image-section{margin-bottom:1.5rem}.s-gifting-modal .s-gifting-slider{margin-bottom:0.5rem}.s-gifting-modal .s-gifting-image{display:block}.s-gifting-modal .s-gifting-image img{display:block;width:auto;height:100px;object-fit:contain}.s-gifting-modal .s-gifting-image-section+.anime-item .s-gifting-text-title{margin-top:1rem}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.static{position:static}.fixed{position:fixed}.relative{position:relative}.mt-1{margin-top:0.25rem}.inline{display:inline}.hidden{display:none}.grow{flex-grow:1}.transform{transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.resize{resize:both}.opacity-0{opacity:0}.outline{outline-style:solid}.transition{transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-hidden{display:none}.has-error .s-form-label{color:#ff443a}.has-error .s-form-control,.has-error .s-tel-input-control,.has-error .s-datetime-picker-input{border-color:#ff443a;color:#ff443a}.s-hidden{display:none}.s-form-control{display:block;width:100%;border-radius:var(--s-radius, 0.25rem);border-width:1px;--tw-border-opacity:1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.5rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-form-control:focus{border-color:var(--color-primary);--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)}.s-form-label{margin-bottom:0.25rem;display:block;font-size:0.875rem;line-height:1.25rem;font-weight:500;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-form-group{margin-top:0.75rem;margin-bottom:0.75rem}.s-checkbox{cursor:pointer;--tw-border-opacity:1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1));appearance:none;background-color:#fff;margin:0;width:18px;height:18px;border-width:1px;border-radius:4px;display:grid;place-content:center}.s-checkbox:before{width:10px;height:10px;clip-path:polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);transform:scale(0);transform-origin:bottom left;transition:120ms transform ease-in-out;box-shadow:inset 1em 1em #444;background-color:#444}.s-checkbox:checked:before{transform:scale(1)}.s-checkbox::before{--tw-content:\'\';content:var(--tw-content)}.s-form-has-error .s-form-label{color:#ff443a}.s-form-has-error .s-form-control,.s-form-has-error .s-tel-input-control,.s-form-has-error .s-datetime-picker-input{border-color:#ff443a;color:#ff443a}.s-gifting-widget .s-list-tile-item-icon{display:none}.s-gifting-widget-vertical .s-list-tile-item-icon{display:block}.s-gifting-widget-vertical .s-list-tile-item-title svg{fill:var(--color-primary)}.s-gifting-widget-vertical .s-list-tile-item-subtitle{padding-right:3.5rem;font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-gifting-widget-vertical .s-list-tile-item{flex-wrap:wrap;padding:0px}@media (min-width: 1024px){.s-gifting-widget-vertical .s-list-tile-item-action{flex:1 1 0%}}.s-gifting-widget-vertical .widget-icon{--tw-translate-y:0.625rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));font-size:1.875rem;line-height:2.25rem;color:var(--color-primary)}.s-gifting-widget .s-button-text{display:flex}.s-gifting-widget .s-list-tile-item{flex-direction:column;justify-content:space-between;gap:1rem;border-radius:0.75rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));padding:1.25rem;text-align:center}@media (min-width: 768px){.s-gifting-widget .s-list-tile-item{text-align:left}}@media (min-width: 1024px){.s-gifting-widget .s-list-tile-item{flex-direction:row}}@media (min-width: 768px){.s-gifting-widget .s-list-tile-item:where([dir="rtl"],[dir="rtl"] *){text-align:right}}.s-gifting-widget-horizontal .s-gifting-widget-action button{padding-left:2rem;padding-right:2rem;font-weight:400}.s-gifting-info{display:flex;align-items:center;gap:0.5rem;border-radius:0.5rem;--tw-border-opacity:1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1));padding:1rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.s-gifting-info svg{height:1.25rem;width:1.25rem;fill:#1d4ed8}.s-gifting-error{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.s-gifting-info span{font-size:0.75rem;line-height:1rem}.s-gifting-widget-action-content{display:flex;align-items:center}.s-gifting-widget-action-content svg{margin-left:0.5rem;margin-right:0.5rem}.s-gifting-modal-header{margin-bottom:1.25rem;display:flex;flex-direction:column;align-items:center;justify-content:center}.s-gifting-modal .s-modal-header{display:block}.s-gifting-modal .s-modal-body{position:relative !important;left:unset !important;bottom:unset !important;padding-bottom:2rem}@media (min-width: 640px){.s-gifting-modal .s-modal-body{padding-bottom:1.5rem}}.s-gifting-modal-icon{margin-bottom:1.25rem;display:flex;height:5rem;width:5rem;flex-direction:row;align-items:center;justify-content:center;border-radius:9999px;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));font-size:1.875rem;line-height:2.25rem}.s-gifting-modal-title{display:flex;width:100%;align-items:center;justify-content:space-between}.s-gifting-modal-title::before{display:block;height:1px;flex:1 1 auto;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1));--tw-content:\'\';content:var(--tw-content)}.s-gifting-modal-title::after{display:block;height:1px;flex:1 1 auto;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1));--tw-content:\'\';content:var(--tw-content)}.s-gifting-modal-badge-wrapper{display:flex;align-items:center;padding-left:0.75rem;padding-right:0.75rem}.s-gifting-modal-badge{margin-right:0.5rem;border-radius:0.5rem;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1));padding-left:0.5rem;padding-right:0.5rem;padding-top:0.25rem;padding-bottom:0.25rem;font-size:0.875rem;line-height:1.25rem}.s-gifting-modal-badge:where([dir="rtl"],[dir="rtl"] *){margin-right:0px;margin-left:0.5rem}.s-gifting-modal-uploader.has-bg{position:relative}.s-gifting-modal-uploader.has-bg .s-gifting-remove-preview{pointer-events:auto;--tw-scale-x:1;--tw-scale-y:1;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));opacity:1}.s-gifting-modal-uploader-title{margin-bottom:0.5rem;font-size:0.875rem;line-height:1.25rem}.s-gifting-steps-wrapper{position:relative}.s-gifting-steps-wrapper .s-button-wrap{pointer-events:auto !important}.is-current-step-2 .gift-step-1,.is-current-step-1 .gift-step-2{pointer-events:none;z-index:-1}.s-gifting-step-one{padding-top:1.25rem}.s-gifting-step-two{position:absolute;top:0px;left:0px;margin-left:auto;margin-right:auto;display:flex;width:100%;--tw-translate-x:-105%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));flex-direction:column;opacity:0}.s-gifting-step-one .swiper-wrapper{height:100px}.s-gifting-step-one .swiper-slide{width:auto !important}.s-gifting-step-one .filepond--list-scroller{overflow-y:hidden}.s-gifting-step-one .swiper-wrapper img{border-radius:0.375rem;object-fit:cover}.s-gifting-step-one .filepond--root{height:230px}.s-gifting-step-one .filepond--list{left:0px !important;height:100% !important}.s-gifting-step-one .filepond-bg{position:absolute;top:0px;z-index:10;height:100%;width:100%;border-radius:var(--s-radius, 0.25rem);--tw-bg-opacity:1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1));background-size:cover}.s-gifting-step-one .s-slider-button-next{top:35% !important}.s-gifting-step-one .s-slider-button-next button{height:35px;width:35px;--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-gifting-step-one .s-slider-button-prev{top:35% !important}.s-gifting-step-one .s-slider-button-prev button{height:35px;width:35px;--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-gifting-tel-input .s-tel-input-control{--tw-border-opacity:1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.s-gifting-tel-input .s-tel-input-error-msg{display:none}.s-gifting-step-two-footer{margin-top:1.25rem;display:flex;flex-direction:row;align-items:center;justify-content:center}.s-gifting-step-two-footer>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.625rem * var(--tw-space-x-reverse));margin-left:calc(0.625rem * calc(1 - var(--tw-space-x-reverse)))}.s-gifting-step-two-footer:where([dir="rtl"],[dir="rtl"] *){flex-direction:row-reverse}.s-gifting-step-two-footer a{border-radius:0.375rem;border-width:1px;border-color:var(--color-primary);fill:var(--color-primary);padding-top:8px;padding-bottom:8px;padding-left:25px;padding-right:25px}.s-gifting-step-two-footer a svg{height:1.25rem;width:1.25rem}.s-gifting-step-two .s-form-group.s-form-has-error .s-tel-input-control{--tw-border-opacity:1 !important;border-color:rgb(255 68 58 / var(--tw-border-opacity, 1)) !important}.s-gifting-selectText{margin-bottom:20px !important}.s-gifting-schedule .s-form-label{margin-bottom:0px !important}.s-gifting-schedule{margin-bottom:0.5rem;display:flex;align-items:center;justify-content:flex-start}.s-gifting-schedule>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.375rem * var(--tw-space-x-reverse));margin-left:calc(0.375rem * calc(1 - var(--tw-space-x-reverse)))}.s-gifting-schedule:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-gifting-clickable{cursor:pointer}.s-gifting-remove-preview{pointer-events:none;position:absolute;top:-7px;left:-7px;z-index:10;display:flex;height:1.25rem;width:1.25rem;--tw-scale-x:0;--tw-scale-y:0;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));cursor:pointer;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1));text-align:center;font-size:1rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1));opacity:0;transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-gifting-remove-preview:where([dir="rtl"],[dir="rtl"] *){left:unset;right:-7px}.s-gifting-remove-preview svg{height:100%;width:15px;fill:#fff}.s-gifting-textarea{transition-property:all;transition-duration:200ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.s-gifting-calendar-hint{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.s-gifting-calendar.shown{margin-top:0.75rem;height:75px;opacity:1}.s-gifting-textarea.shown{height:122px;opacity:1}.s-gifting-calendar.hide{pointer-events:none;visibility:hidden;margin:0px;height:0px;opacity:0}.s-gifting-textarea.hide{pointer-events:none;visibility:hidden;margin:0px;height:0px;opacity:0}.s-gifting-filepond-placeholder-icon svg{margin-top:12px;margin-bottom:12px;margin-left:auto;margin-right:auto;height:4rem;width:3rem;fill:#e5e7eb}.s-gifting-filepond-placeholder-text{margin-left:auto;margin-right:auto;width:65%;min-width:18rem;font-size:0.75rem !important;line-height:1rem !important;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1));margin-top:0.75rem;margin-bottom:0.75rem;font-family:var(--font-main), -apple-system, BlinkMacSystemFont}.s-gifting-skeleton-content salla-skeleton:nth-child(1){margin-bottom:0.75rem}.s-gifting-skeleton-content salla-skeleton:nth-child(2){margin-bottom:1.25rem}.s-gifting-skeleton-content salla-skeleton:nth-child(3){margin-bottom:0.75rem}.s-gifting-skeleton-content salla-skeleton:nth-child(4){margin-bottom:1.25rem}.s-gifting-skeleton .s-gifting-modal-header salla-skeleton{margin-bottom:1.25rem}.s-gifting-skeleton .s-gifting-modal-title{margin-bottom:1.25rem}.s-gifting-image{margin-left:5px;margin-right:5px}';export{o as salla_gifting}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as e,h as r}from"./p-
|
|
4
|
+
import{r as e,h as r}from"./p-Q9lz4Iuq.js";function t(e){var r,a,s="";if("string"==typeof e||"number"==typeof e)s+=e;else if("object"==typeof e)if(Array.isArray(e))for(r=0;r<e.length;r++)e[r]&&(a=t(e[r]))&&(s&&(s+=" "),s+=a);else for(r in e)e[r]&&(s&&(s+=" "),s+=r);return s}const a=e=>"boolean"==typeof e?"".concat(e):0===e?"0":e,s=function(){for(var e,r,a=0,s="";a<arguments.length;)(e=arguments[a++])&&(r=t(e))&&(s&&(s+=" "),s+=r);return s},i=(o="s-badge-base",l={variants:{size:{xs:"s-badge-xs",sm:"s-badge-sm",md:"s-badge-md"},bg:{transparent:"s-badge-transparent",light:"s-badge-light","primary-100":"s-badge-primary-100"},color:{black:"s-badge-black","primary-900":"s-badge-color-primary-900"}}},e=>{var r;if(null==(null==l?void 0:l.variants))return s(o,null==e?void 0:e.class,null==e?void 0:e.className);const{variants:t,defaultVariants:i}=l,n=Object.keys(t).map((r=>{const s=null==e?void 0:e[r],o=null==i?void 0:i[r];if(null===s)return null;const l=a(s)||a(o);return t[r][l]})),d=e&&Object.entries(e).reduce(((e,r)=>{let[t,a]=r;return void 0===a||(e[t]=a),e}),{}),c=null==l||null===(r=l.compoundVariants)||void 0===r?void 0:r.reduce(((e,r)=>{let{class:t,className:a,...s}=r;return Object.entries(s).every((e=>{let[r,t]=e;return Array.isArray(t)?t.includes({...i,...d}[r]):{...i,...d}[r]===t}))?[...e,t,a]:e}),[]);return s(o,n,c,null==e?void 0:e.class,null==e?void 0:e.className)});var o,l;const n=class{constructor(r){e(this,r),this.size="sm",this.color="black",this.bg="light"}render(){return r("div",{key:"54d35eb76a59251edb581786e5e89a83b6f8fbf0",class:i({size:this.size,bg:this.bg,color:this.color})},r("slot",{key:"4641cb434a2c0a6d7c004e3384848a200cb79dff"}))}};n.style='/*!twlt*/.s-badge-base{display:flex;max-width:max-content;align-items:center}.s-badge-base>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.5rem * var(--tw-space-x-reverse));margin-left:calc(0.5rem * calc(1 - var(--tw-space-x-reverse)))}.s-badge-base{white-space:nowrap;border-radius:0.375rem;padding-left:0.5rem;padding-right:0.5rem;padding-top:0.25rem;padding-bottom:0.25rem;font-weight:500;--tw-text-opacity:1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.s-badge-base:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-badge-xs{font-size:0.75rem;line-height:1rem}.s-badge-xs svg{height:0.75rem;width:0.75rem}.s-badge-sm{font-size:0.875rem;line-height:1.25rem}.s-badge-sm svg{height:1rem;width:1rem}.s-badge-md{font-size:1rem;line-height:1.5rem}.s-badge-md svg{height:1.25rem;width:1.25rem}.s-badge-transparent{background-color:transparent}.s-badge-light{--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.s-badge-primary-100{background-color:color-mix(in srgb,var(--color-primary) 20%,white 80%)}.s-badge-color-black{--tw-text-opacity:1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.s-badge-color-primary-900{color:color-mix(in srgb,var(--color-primary) 45%,black 55%)}.s-badge-color-primary-900 svg{fill:currentColor}.s-badge-black{--tw-text-opacity:1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}';export{n as salla_badge}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,h as e,c as r,a}from"./p-
|
|
4
|
+
import{r as t,h as e,c as r,a}from"./p-Q9lz4Iuq.js";const s=class{constructor(e){t(this,e),this.isSelected=!1}async getChild(){return{selected:this.selected.bind(this),unselect:this.unselect.bind(this),name:this.name}}unselect(){this.isSelected=!1}selected(){this.isSelected=!0}render(){return e("div",{key:"f5cfa9676bc8314149cb78e103b9ef580c0d7559",class:{"s-tabs-content":!0,"s-tabs-content-selected":this.isSelected}},e("slot",{key:"1b86591377c09f1acb25cda20024b3af9c6a874d"}))}};s.style="";const o=class{constructor(e){t(this,e),this.tabSelected=r(this,"tabSelected"),this.id=Math.random().toString(36).slice(2,10),this.activeClass=void 0,this.height=void 0,this.centered=!1,this.isSelected=!1}async getChild(){return{selected:this.selected.bind(this),unselect:this.unselect.bind(this),name:this.name,id:this.id}}unselect(){this.isSelected=!1}selected(){this.isSelected=!0}onClick(){this.getChild().then((t=>{this.tabSelected.emit(t)}))}render(){return[e("div",{key:"a9548ed2a74d30e6fcf365dbe26aa5f7fdab2468",class:{"s-tabs-header-item":!0,"s-tabs-bg-normal":!0,"s-tabs-active":this.isSelected},onClick:this.onClick.bind(this)},e("slot",{key:"547edd40aab5843c6035bd3c36a34d9449dc12d3"}))]}};o.style="";const i=class{constructor(e){t(this,e),this.backgroundColor=void 0,this.vertical=!1}componentWillLoad(){this.createGroup().then((()=>{const[t]=this.tabGroup;this.selectGroup(t)}))}onSelectedTab(t){const e=this.tabGroup.find((e=>e.header.id===t.detail.id));this.selectGroup(e)}async createGroup(){const t=Array.from(this.host.querySelectorAll("salla-tab-header"));this.tabsHeader=await Promise.all(t.map((async t=>await t.getChild())));const e=Array.from(this.host.querySelectorAll("salla-tab-content"));this.tabsContent=await Promise.all(e.map((async t=>await t.getChild()))),this.tabGroup=this.tabsHeader.map((t=>{const e=this.tabsContent.find((e=>e.name===t.name));return{header:t,content:e}}))}selectGroup(t){this.tabGroup.map((t=>{t.header.unselect(),t.content.unselect()})),t.header.selected(),t.content.selected()}render(){return[e("div",{key:"e9054cb114c2bd66940b6afa98d7c7c230353a74",class:"s-tabs"},e("div",{key:"d245f64aef9b7fd77c9c51eb1d86ddfd9202e5fb",class:"s-tabs-header"},e("slot",{key:"f1b9a982cd746d637db5d514cb691f188af0cb7e",name:"header"})),e("div",{key:"0ba8441707b087a8c4d068b1a72bf10c8efb41cc",class:"s-tabs-content-wrapper"},e("slot",{key:"afcee28724a5a9ce263fcc3a38d624a631069945",name:"content"})))]}get host(){return a(this)}};i.style='/*!twlt*/.s-tabs-header{-ms-overflow-style:none;scrollbar-width:none;}.s-tabs-header::-webkit-scrollbar{display:none}.flex{display:flex}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-loyalty-program-rewards-container .s-tabs-content-wrapper{padding:0px}@media (min-width: 768px){.s-loyalty-program-rewards-container .s-tabs-content-wrapper{padding-top:1rem}}.s-loyalty-program-rewards-container .s-tabs-header{display:flex;align-items:center;justify-content:space-between;border-style:none}.s-loyalty-program-rewards-container .s-tabs-header div{order:1}.s-loyalty-program-rewards-container .s-tabs-header-item{position:relative;margin:0px;display:flex;width:max-content;align-items:center;justify-content:center;gap:0.5rem;border-radius:0.5rem;background-color:transparent;padding-top:0.5rem;padding-bottom:0.5rem;padding-left:1rem;padding-right:1rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.s-loyalty-program-rewards-container .s-tabs-bg-normal{background-color:transparent;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-loyalty-program-rewards-container-cart .s-tabs-bg-normal{background-color:transparent;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-loyalty-program-rewards-container-cart .s-tabs-header-item{display:flex;width:max-content;align-items:center;justify-content:center;gap:0.5rem;padding-top:0.5rem;padding-bottom:0.5rem;padding-left:1rem;padding-right:1rem;font-size:0.875rem;line-height:1.25rem}.s-loyalty-program-rewards-container-cart .s-tabs-content-wrapper{padding:0px}.s-loyalty-program-rewards-container-cart .s-tabs-header{overflow-x:auto;border-bottom-width:1px;border-color:var(--color-primary-light);padding-left:1.25rem;padding-right:1.25rem}@media (min-width: 640px){.s-loyalty-program-rewards-container-cart .s-tabs-header{margin-left:1.25rem;margin-right:1.25rem;padding-left:0px;padding-right:0px}}.s-loyalty-program-rewards-container .s-tabs-active{background-color:var(--color-primary-light);--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-loyalty-program-rewards-container-cart .s-tabs-active{background-color:var(--color-primary-light);--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-loyalty-program-reward-details .s-tabs-header{margin-top:0.5rem;margin-bottom:0.5rem;margin-left:1rem;margin-right:1rem;display:flex}.s-loyalty-program-reward-details .s-tabs-header>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.5rem * var(--tw-space-x-reverse));margin-left:calc(0.5rem * calc(1 - var(--tw-space-x-reverse)))}.s-loyalty-program-reward-details .s-tabs-header{border-style:none}@media (min-width: 768px){.s-loyalty-program-reward-details .s-tabs-header{margin-left:3rem;margin-right:3rem}}.s-loyalty-program-reward-details .s-tabs-header:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-loyalty-program-reward-details .s-tabs-header-item{display:flex;width:max-content;align-items:center}.s-loyalty-program-reward-details .s-tabs-header-item>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.5rem * var(--tw-space-x-reverse));margin-left:calc(0.5rem * calc(1 - var(--tw-space-x-reverse)))}.s-loyalty-program-reward-details .s-tabs-header-item{border-radius:9999px;padding-top:0.25rem;padding-bottom:0.25rem;padding-left:1rem;padding-right:1rem}.s-loyalty-program-reward-details .s-tabs-header-item:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-loyalty-program-reward-details .s-tabs-bg-normal{background-color:transparent;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-loyalty-program-reward-details .s-tabs-active{background-color:var(--color-primary-light);font-weight:700;--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.s-loyalty-program-reward-details .s-tabs-header-item span{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.s-loyalty-program-tabs-hider .s-tabs-header{border-style:none}.s-product-size-guide-wrapper .s-tabs-content{max-height:60vh;overflow:auto}@media (min-width: 768px){.s-product-size-guide-wrapper .s-tabs-content{max-height:70vh}}.s-tabs-bg-normal{--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.s-tabs-header{display:flex;cursor:pointer;align-content:center;justify-content:flex-start}.s-tabs-header>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.25rem * var(--tw-space-x-reverse));margin-left:calc(0.25rem * calc(1 - var(--tw-space-x-reverse)))}.s-tabs-header{overflow-x:auto;border-bottom-width:2px;border-color:var(--color-primary)}@media (min-width: 768px){.s-tabs-header{overflow-x:hidden}}.s-tabs-header:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-tabs-header *{pointer-events:auto !important}.s-tabs-header-item{border-top-left-radius:0.5rem;border-top-right-radius:0.5rem;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1));padding-top:0.5rem;padding-bottom:0.5rem;padding-left:0.75rem;padding-right:0.75rem;font-size:0.875rem;line-height:1.25rem}@media (min-width: 768px){.s-tabs-header-item{padding-left:1.75rem;padding-right:1.75rem}}.s-tabs-content{display:none}.s-tabs-content-wrapper{padding-top:0.75rem}.s-tabs-content-selected{display:block}.s-tabs-active{background-color:var(--color-primary);--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}';export{s as salla_tab_content,o as salla_tab_header,i as salla_tabs}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as a,h as t,H as l,a as n}from"./p-
|
|
4
|
+
import{r as a,h as t,H as l,a as n}from"./p-Q9lz4Iuq.js";const s=class{constructor(t){a(this,t),this.pointsData=null,this.productId=null}async componentWillLoad(){try{if(await salla.onReady(),await salla.lang.onLoaded(),this.productId=this.host.dataset.productId||salla.config.get("page.id"),!this.productId)return;const a=await salla.api.request(`/loyalty/products/${this.productId}/points`).catch((()=>null));this.pointsData=a?.data||null}catch(a){salla?.logger?.warn?.("salla-loyalty-points-banner: init failed",a)}}render(){return this.productId&&this.pointsData?.points?t(l,null,t("div",{class:"s-loyalty-points-banner-container"},t("div",{class:"s-loyalty-points-banner-icon"},t("span",{class:"s-loyalty-points-banner-inner-icon",innerHTML:'<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M8.76604 2.86201C9.31804 2.61001 9.93304 2.41501 10.611 2.27701C11.289 2.13901 12 2.07001 12.744 2.07001C13.572 2.07001 14.364 2.15401 15.12 2.32201C15.84 2.49001 16.356 2.81401 16.668 3.29401C16.932 3.70201 17.064 4.26001 17.064 4.96801V13.032C17.064 13.416 16.95 13.752 16.722 14.04C16.506 14.304 16.227 14.493 15.885 14.607C15.543 14.721 15.204 14.742 14.868 14.67C14.196 14.514 13.488 14.436 12.744 14.436C12.084 14.436 11.442 14.502 10.818 14.634C10.23 14.754 9.70204 14.922 9.23404 15.138C8.68204 15.39 8.06704 15.585 7.38904 15.723C6.71104 15.861 6.00004 15.93 5.25604 15.93C4.42804 15.93 3.63604 15.846 2.88004 15.678C2.18404 15.522 1.68004 15.21 1.36804 14.742C1.08004 14.322 0.936035 13.752 0.936035 13.032V4.96801C0.936035 4.58401 1.05004 4.24801 1.27804 3.96001C1.49404 3.69601 1.77304 3.50701 2.11504 3.39301C2.45704 3.27901 2.79604 3.25801 3.13204 3.33001C3.80404 3.48601 4.51204 3.56401 5.25604 3.56401C5.91604 3.56401 6.55804 3.49801 7.18204 3.36601C7.77004 3.24601 8.29804 3.07801 8.76604 2.86201ZM11.25 9.00001C11.25 8.59201 11.148 8.21701 10.944 7.87501C10.74 7.53301 10.467 7.26001 10.125 7.05601C9.78304 6.85201 9.40804 6.75001 9.00004 6.75001C8.59204 6.75001 8.21704 6.85201 7.87504 7.05601C7.53304 7.26001 7.26004 7.53301 7.05604 7.87501C6.85204 8.21701 6.75004 8.59201 6.75004 9.00001C6.75004 9.40801 6.85204 9.78301 7.05604 10.125C7.26004 10.467 7.53304 10.74 7.87504 10.944C8.21704 11.148 8.59204 11.25 9.00004 11.25C9.40804 11.25 9.78304 11.148 10.125 10.944C10.467 10.74 10.74 10.467 10.944 10.125C11.148 9.78301 11.25 9.40801 11.25 9.00001ZM14.328 7.79401C14.076 7.75801 13.812 7.73401 13.536 7.72201C13.38 7.71001 13.245 7.75501 13.131 7.85701C13.017 7.95901 12.954 8.08801 12.942 8.24401C12.93 8.40001 12.975 8.53501 13.077 8.64901C13.179 8.76301 13.308 8.82601 13.464 8.83801C13.704 8.85001 13.938 8.87401 14.166 8.91001C14.322 8.93401 14.463 8.90101 14.589 8.81101C14.715 8.72101 14.787 8.59801 14.805 8.44201C14.823 8.28601 14.787 8.14501 14.697 8.01901C14.607 7.89301 14.484 7.81801 14.328 7.79401ZM4.53604 9.16201C4.29604 9.15001 4.06204 9.12601 3.83404 9.09001C3.67804 9.06601 3.53704 9.09901 3.41104 9.18901C3.28504 9.27901 3.21304 9.40201 3.19504 9.55801C3.17704 9.71401 3.21304 9.85501 3.30304 9.98101C3.39304 10.107 3.51604 10.182 3.67204 10.206C3.92404 10.242 4.18804 10.266 4.46404 10.278C4.62004 10.29 4.75504 10.245 4.86904 10.143C4.98304 10.041 5.04604 9.91201 5.05804 9.75601C5.07004 9.60001 5.02504 9.46501 4.92304 9.35101C4.82104 9.23701 4.69204 9.17401 4.53604 9.16201Z" fill="white"/>\n</svg>\n'})),t("p",null,t("span",{class:"s-loyalty-points-banner-label"},salla.lang.get("pages.loyalty_program.earn")," "),t("span",{class:"s-loyalty-points-banner-label"},`+${this.pointsData.points}`," "),t("span",{class:"s-loyalty-points-banner-label"},salla.lang.get("pages.loyalty_program.loyalty_point")," "),t("span",{class:"s-loyalty-points-banner-description"},salla.lang.get("pages.loyalty_program.on_order_total_when_purchase"))))):null}get host(){return n(this)}};s.style="/*!twlt*/.s-loyalty-points-banner-container{margin-bottom:0.75rem;display:flex;width:100%;align-items:center;gap:0.5rem;border-radius:0.5rem;background-color:rgb(209 180 76 / var(--tw-bg-opacity, 1));--tw-bg-opacity:0.1;padding-left:0.75rem;padding-right:0.75rem;padding-top:0.5rem;padding-bottom:0.5rem}.s-loyalty-points-banner-icon{display:flex;height:2rem;width:2rem;flex-shrink:0;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(209 180 76 / var(--tw-bg-opacity, 1))}.s-loyalty-points-banner-label{font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(209 180 76 / var(--tw-text-opacity, 1))}.s-loyalty-points-banner-description{font-size:0.875rem;line-height:1.25rem}";export{s as salla_loyalty_points_banner}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{d as i}from"./p-
|
|
4
|
+
import{d as i}from"./p-Q9lz4Iuq.js";function n(i,n){return n.forEach((function(n){n&&"string"!=typeof n&&!Array.isArray(n)&&Object.keys(n).forEach((function(t){if("default"!==t&&!(t in i)){var e=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(i,t,e.get?e:{enumerable:!0,get:function(){return n[t]}})}}))})),Object.freeze(i)}var t,e,o,E={exports:{}},r=t?E.exports:(t=1,E.exports=(e=function(i){return/^image/.test(i.type)},o=function(i){var n=i.addFilter,t=i.utils,o=t.Type,E=t.createRoute,r=t.createItemAPI,l=void 0===r?function(i){return i}:r,_=i.views.fileActionButton;n("SHOULD_REMOVE_ON_REVERT",(function(i,n){var t=n.item,o=n.query;return new Promise((function(i){var n=t.file;i(!(o("GET_ALLOW_IMAGE_EDIT")&&o("GET_IMAGE_EDIT_ALLOW_EDIT")&&e(n)))}))})),n("DID_LOAD_ITEM",(function(i,n){var t=n.query,o=n.dispatch;return new Promise((function(n,E){if(i.origin>1)n(i);else{var r=i.file;if(t("GET_ALLOW_IMAGE_EDIT")&&t("GET_IMAGE_EDIT_INSTANT_EDIT"))if(e(r)){var l=function(i,n,t){return function(e){a.shift(),e?n(i):t(i),o("KICK"),_()}},_=function(){if(a.length){var i=a[0],n=i.item;o("EDIT_ITEM",{id:n.id,handleEditorResponse:l(n,i.resolve,i.reject)})}};u({item:i,resolve:n,reject:E}),1===a.length&&_()}else n(i);else n(i)}}))})),n("DID_CREATE_ITEM",(function(i,n){var t=n.dispatch;i.extend("edit",(function(){t("EDIT_ITEM",{id:i.id})}))}));var a=[],u=function(i){return a.push(i),i};return n("CREATE_VIEW",(function(i){var n=i.is,t=i.view,o=i.query;if(o("GET_ALLOW_IMAGE_EDIT")){var r=o("GET_ALLOW_IMAGE_PREVIEW");if(n("file-info")&&!r||n("file")&&r){var a=o("GET_IMAGE_EDIT_EDITOR");if(a){a.filepondCallbackBridge||(a.outputData=!0,a.outputFile=!1,a.filepondCallbackBridge={onconfirm:a.onconfirm||function(){},oncancel:a.oncancel||function(){}});t.registerDestroyer((function(i){var n=i.root;n.ref.buttonEditItem&&n.ref.buttonEditItem.off("click",n.ref.handleEdit),n.ref.editButton&&n.ref.editButton.removeEventListener("click",n.ref.handleEdit)}));var u={EDIT_ITEM:function(i){var n=i.root,t=i.props.id,e=i.action.handleEditorResponse;a.cropAspectRatio=n.query("GET_IMAGE_CROP_ASPECT_RATIO")||a.cropAspectRatio,a.outputCanvasBackgroundColor=n.query("GET_IMAGE_TRANSFORM_CANVAS_BACKGROUND_COLOR")||a.outputCanvasBackgroundColor;var o=n.query("GET_ITEM",t);if(o){var E=o.file,r=o.getMetadata("crop"),_=o.getMetadata("resize"),u=o.getMetadata("filter")||null,I=o.getMetadata("filters")||null,f=o.getMetadata("colors")||null,c=o.getMetadata("markup")||null,T={crop:r||{center:{x:.5,y:.5},flip:{horizontal:!1,vertical:!1},zoom:1,rotation:0,aspectRatio:null},size:_?{upscale:_.upscale,mode:_.mode,width:_.size.width,height:_.size.height}:null,filter:I?I.id||I.matrix:n.query("GET_ALLOW_IMAGE_FILTER")&&n.query("GET_IMAGE_FILTER_COLOR_MATRIX")&&!f?u:null,color:f,markup:c};a.onconfirm=function(i){var n=i.data,t=n.crop,E=n.size,r=n.filter,_=n.color,u=n.colorMatrix,I=n.markup,f={};if(t&&(f.crop=t),E){var c=(o.getMetadata("resize")||{}).size,T={width:E.width,height:E.height};T.width&&T.height||!c||(T.width=c.width,T.height=c.height),(T.width||T.height)&&(f.resize={upscale:E.upscale,mode:E.mode,size:T})}I&&(f.markup=I),f.colors=_,f.filters=r,f.filter=u,o.setMetadata(f),a.filepondCallbackBridge.onconfirm(n,l(o)),e&&(a.onclose=function(){e(!0),a.onclose=null})},a.oncancel=function(){a.filepondCallbackBridge.oncancel(l(o)),e&&(a.onclose=function(){e(!1),a.onclose=null})},a.open(E,T)}},DID_LOAD_ITEM:function(i){var n=i.root,E=i.props;if(o("GET_IMAGE_EDIT_ALLOW_EDIT")){var l=E.id,a=o("GET_ITEM",l);if(a&&e(a.file))if(n.ref.handleEdit=function(i){i.stopPropagation(),n.dispatch("EDIT_ITEM",{id:l})},r){var u=t.createChildView(_,{label:"edit",icon:o("GET_IMAGE_EDIT_ICON_EDIT"),opacity:0});u.element.classList.add("filepond--action-edit-item"),u.element.dataset.align=o("GET_STYLE_IMAGE_EDIT_BUTTON_EDIT_ITEM_POSITION"),u.on("click",n.ref.handleEdit),n.ref.buttonEditItem=t.appendChildView(u)}else{var I=t.element.querySelector(".filepond--file-info-main"),f=document.createElement("button");f.className="filepond--action-edit-item-alt",f.innerHTML=o("GET_IMAGE_EDIT_ICON_EDIT")+"<span>edit</span>",f.addEventListener("click",n.ref.handleEdit),I.appendChild(f),n.ref.editButton=f}}}};r&&(u.DID_IMAGE_PREVIEW_SHOW=function(i){var n=i.root;n.ref.buttonEditItem&&(n.ref.buttonEditItem.opacity=1)}),t.registerWriter(E(u))}}}})),{options:{allowImageEdit:[!0,o.BOOLEAN],styleImageEditButtonEditItemPosition:["bottom center",o.STRING],imageEditInstantEdit:[!1,o.BOOLEAN],imageEditAllowEdit:[!0,o.BOOLEAN],imageEditIconEdit:['<svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M8.5 17h1.586l7-7L15.5 8.414l-7 7V17zm-1.707-2.707l8-8a1 1 0 0 1 1.414 0l3 3a1 1 0 0 1 0 1.414l-8 8A1 1 0 0 1 10.5 19h-3a1 1 0 0 1-1-1v-3a1 1 0 0 1 .293-.707z" fill="currentColor" fill-rule="nonzero"/></svg>',o.STRING],imageEditEditor:[null,o.OBJECT]}}},"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:o})),o)),l=n({__proto__:null,default:i(r)},[r]);
|
|
5
5
|
/*!
|
|
6
6
|
* FilePondPluginImageEdit 1.6.3
|
|
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 e}from"./p-
|
|
4
|
+
import{d as e}from"./p-Q9lz4Iuq.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 t}from"./p-
|
|
4
|
+
import{d as t}from"./p-Q9lz4Iuq.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/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{d as t}from"./p-Bf2Z6A1M.js";function n(t,n){return n.forEach((function(n){n&&"string"!=typeof n&&!Array.isArray(n)&&Object.keys(n).forEach((function(i){if("default"!==i&&!(i in t)){var r=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(t,i,r.get?r:{enumerable:!0,get:function(){return n[i]}})}}))})),Object.freeze(t)}var i,r={exports:{}},e=(i||(i=1,r.exports=function(){function t(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,n){var i=[],r=!0,e=!1,a=void 0;try{for(var o,u=t[Symbol.iterator]();!(r=(o=u.next()).done)&&(i.push(o.value),i.length!==n);r=!0);}catch(t){e=!0,a=t}finally{try{r||null==u.return||u.return()}finally{if(e)throw a}}return i}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var n=function(t,n){return e(t.x*n,t.y*n)},i=function(t,n){return e(t.x+n.x,t.y+n.y)},r=function(t,n,i){var r=Math.cos(n),a=Math.sin(n),o=e(t.x-i.x,t.y-i.y);return e(i.x+r*o.x-a*o.y,i.y+a*o.x+r*o.y)},e=function(){return{x:arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,y:arguments.length>1&&void 0!==arguments[1]?arguments[1]:0}},a=function(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3?arguments[3]:void 0;return"string"==typeof t?parseFloat(t)*i:"number"==typeof t?t*(r?n[r]:Math.min(n.width,n.height)):void 0},o=function(t){return null!=t},u=function(t,n){return Object.keys(n).forEach((function(i){return t.setAttribute(i,n[i])}))},c=function(t,n){var i=document.createElementNS("http://www.w3.org/2000/svg",t);return n&&u(i,n),i},f={contain:"xMidYMid meet",cover:"xMidYMid slice"},E={left:"start",center:"middle",right:"end"},_=function(t){return function(n){return c(t,{id:n.id})}},s={image:function(t){var n=c("image",{id:t.id,"stroke-linecap":"round","stroke-linejoin":"round",opacity:"0"});return n.onload=function(){n.setAttribute("opacity",t.opacity||1)},n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",t.src),n},rect:_("rect"),ellipse:_("ellipse"),text:_("text"),path:_("path"),line:function(t){var n=c("g",{id:t.id,"stroke-linecap":"round","stroke-linejoin":"round"}),i=c("line");n.appendChild(i);var r=c("path");n.appendChild(r);var e=c("path");return n.appendChild(e),n}},l={rect:function(t){return u(t,Object.assign({},t.rect,t.styles))},ellipse:function(t){return u(t,Object.assign({cx:t.rect.x+.5*t.rect.width,cy:t.rect.y+.5*t.rect.height,rx:.5*t.rect.width,ry:.5*t.rect.height},t.styles))},image:function(t,n){u(t,Object.assign({},t.rect,t.styles,{preserveAspectRatio:f[n.fit]||"none"}))},text:function(t,n,i,r){var e=a(n.fontSize,i,r);u(t,Object.assign({},t.rect,t.styles,{"stroke-width":0,"font-weight":n.fontWeight||"normal","font-size":e,"font-family":n.fontFamily||"sans-serif","text-anchor":E[n.textAlign]||"start"})),t.text!==n.text&&(t.text=n.text,t.textContent=n.text.length?n.text:" ")},path:function(t,n,i,r){var e;u(t,Object.assign({},t.styles,{fill:"none",d:(e=n.points.map((function(t){return{x:a(t.x,i,r,"width"),y:a(t.y,i,r,"height")}})),e.map((function(t,n){return"".concat(0===n?"M":"L"," ").concat(t.x," ").concat(t.y)})).join(" "))}))},line:function(t,o,c,f){u(t,Object.assign({},t.rect,t.styles,{fill:"none"}));var E=t.childNodes[1],_=t.childNodes[2],s=t.rect,l={x:t.rect.x+t.rect.width,y:t.rect.y+t.rect.height};if(u(t.childNodes[0],{x1:s.x,y1:s.y,x2:l.x,y2:l.y}),o.lineDecoration){E.style.display="none",_.style.display="none";var v=function(t){var n=Math.sqrt(t.x*t.x+t.y*t.y);return 0===n?{x:0,y:0}:e(t.x/n,t.y/n)}({x:l.x-s.x,y:l.y-s.y}),h=a(.05,c,f);if(-1!==o.lineDecoration.indexOf("arrow-begin")){var I=n(v,h),d=i(s,I),p=r(s,2,d),M=r(s,-2,d);u(E,{style:"display:block;",d:"M".concat(p.x,",").concat(p.y," L").concat(s.x,",").concat(s.y," L").concat(M.x,",").concat(M.y)})}if(-1!==o.lineDecoration.indexOf("arrow-end")){var g=n(v,-h),m=i(l,g),T=r(l,2,m),A=r(l,-2,m);u(_,{style:"display:block;",d:"M".concat(T.x,",").concat(T.y," L").concat(l.x,",").concat(l.y," L").concat(A.x,",").concat(A.y)})}}}},v=function(t,n,i,r,e){"path"!==n&&(t.rect=function(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=a(t.x,n,i,"width")||a(t.left,n,i,"width"),e=a(t.y,n,i,"height")||a(t.top,n,i,"height"),u=a(t.width,n,i,"width"),c=a(t.height,n,i,"height"),f=a(t.right,n,i,"width"),E=a(t.bottom,n,i,"height");return o(e)||(e=o(c)&&o(E)?n.height-c-E:E),o(r)||(r=o(u)&&o(f)?n.width-u-f:f),o(u)||(u=o(r)&&o(f)?n.width-r-f:0),o(c)||(c=o(e)&&o(E)?n.height-e-E:0),{x:r||0,y:e||0,width:u||0,height:c||0}}(i,r,e)),t.styles=function(t,n,i){var r=t.borderStyle||t.lineStyle||"solid",e=t.backgroundColor||t.fontColor||"transparent",o=t.borderColor||t.lineColor||"transparent",u=a(t.borderWidth||t.lineWidth,n,i);return{"stroke-linecap":t.lineCap||"round","stroke-linejoin":t.lineJoin||"round","stroke-width":u||0,"stroke-dasharray":"string"==typeof r?"":r.map((function(t){return a(t,n,i)})).join(","),stroke:o,fill:e,opacity:t.opacity||1}}(i,r,e),l[n](t,i,r,e)},h=["x","y","left","top","right","bottom","width","height"],I=function(n){var i=t(n,2),r=i[0],e=i[1],a=e.points?{}:h.reduce((function(t,n){return t[n]="string"==typeof(i=e[n])&&/%/.test(i)?parseFloat(i)/100:i,t;var i}),{});return[r,Object.assign({zIndex:0},e,a)]},d=function(t,n){return t[1].zIndex>n[1].zIndex?1:t[1].zIndex<n[1].zIndex?-1:0},p=function(n){return n.utils.createView({name:"image-preview-markup",tag:"svg",ignoreRect:!0,mixins:{apis:["width","height","crop","markup","resize","dirty"]},write:function(n){var i=n.root,r=n.props;if(r.dirty){var e=r.crop,a=r.resize,o=r.markup,u=r.width,c=r.height,f=e.width,E=e.height;if(a){var _=a.size,l=_&&_.width,h=_&&_.height,p=a.mode;l&&!h&&(h=l),h&&!l&&(l=h);var M=f<l&&E<h;if(!M||M&&a.upscale){var g,m=l/f,T=h/E;"force"===p?(f=l,E=h):("cover"===p?g=Math.max(m,T):"contain"===p&&(g=Math.min(m,T)),f*=g,E*=g)}}var A={width:u,height:c};i.element.setAttribute("width",A.width),i.element.setAttribute("height",A.height);var w=Math.min(u/f,c/E);i.element.innerHTML="";var R=i.query("GET_IMAGE_PREVIEW_MARKUP_FILTER");o.filter(R).map(I).sort(d).forEach((function(n){var r=t(n,2),e=r[0],a=r[1],o=function(t,n){return s[t](n)}(e,a);v(o,e,a,A,w),i.element.appendChild(o)}))}}})},M=function(t,n){return{x:t,y:n}},g=function(t,n){return M(t.x-n.x,t.y-n.y)},m=function(t,n){return Math.sqrt(function(t,n){return function(t,n){return t.x*n.x+t.y*n.y}(g(t,n),g(t,n))}(t,n))},T=function(t,n){var i=t,r=n,e=1.5707963267948966-n,a=Math.sin(1.5707963267948966),o=Math.sin(r),u=Math.sin(e),c=Math.cos(e),f=i/a;return M(c*(f*o),c*(f*u))},A=function(t,n,i,r){var e=2*(r.x>.5?1-r.x:r.x)*t.width,a=2*(r.y>.5?1-r.y:r.y)*t.height,o=function(t,n){var i=t.height,r=T(t.width,n),e=T(i,n),a=M(t.x+Math.abs(r.x),t.y-Math.abs(r.y)),o=M(t.x+t.width+Math.abs(e.y),t.y+Math.abs(e.x)),u=M(t.x-Math.abs(e.y),t.y+t.height-Math.abs(e.x));return{width:m(a,o),height:m(a,u)}}(n,i);return Math.max(o.width/e,o.height/a)},w=function(t,n){var i=t.width,r=i*n;return r>t.height&&(i=(r=t.height)/n),{x:.5*(t.width-i),y:.5*(t.height-r),width:i,height:r}},R=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.zoom,r=n.rotation,e=n.center,a=n.aspectRatio;a||(a=t.height/t.width);var o=function(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=t.height/t.width,e=1,a=r;a>n&&(e=(a=n)/r);var o=Math.max(1/e,n/a),u=t.width/(i*o*e);return{width:u,height:u*n}}(t,a,i),u=void 0===n.scaleToFit||n.scaleToFit,c=i*A(t,w({width:o.width,height:o.height},a),r,u?e:{x:.5,y:.5});return{widthFloat:o.width/c,heightFloat:o.height/c,width:Math.round(o.width/c),height:Math.round(o.height/c)}},y={type:"spring",stiffness:.5,damping:.45,mass:10},G=function(t){return t.utils.createView({name:"image-clip",tag:"div",ignoreRect:!0,mixins:{apis:["crop","markup","resize","width","height","dirty","background"],styles:["width","height","opacity"],animations:{opacity:{type:"tween",duration:250}}},didWriteView:function(t){var n=t.props;n.background&&(t.root.element.style.backgroundColor=n.background)},create:function(n){var i=n.root,r=n.props;i.ref.image=i.appendChildView(i.createChildView(function(t){return t.utils.createView({name:"image-canvas-wrapper",tag:"div",ignoreRect:!0,mixins:{apis:["crop","width","height"],styles:["originX","originY","translateX","translateY","scaleX","scaleY","rotateZ"],animations:{originX:y,originY:y,scaleX:y,scaleY:y,translateX:y,translateY:y,rotateZ:y}},create:function(n){var i=n.root,r=n.props;r.width=r.image.width,r.height=r.image.height,i.ref.bitmap=i.appendChildView(i.createChildView(function(t){return t.utils.createView({name:"image-bitmap",ignoreRect:!0,mixins:{styles:["scaleX","scaleY"]},create:function(t){t.root.appendChild(t.props.image)}})}(t),{image:r.image}))},write:function(t){var n=t.props.crop.flip,i=t.root.ref.bitmap;i.scaleX=n.horizontal?-1:1,i.scaleY=n.vertical?-1:1}})}(t),Object.assign({},r))),i.ref.createMarkup=function(){i.ref.markup||(i.ref.markup=i.appendChildView(i.createChildView(p(t),Object.assign({},r))))},i.ref.destroyMarkup=function(){i.ref.markup&&(i.removeChildView(i.ref.markup),i.ref.markup=null)};var e=i.query("GET_IMAGE_PREVIEW_TRANSPARENCY_INDICATOR");null!==e&&(i.element.dataset.transparencyIndicator="grid"===e?e:"color")},write:function(t){var n=t.root,i=t.props,r=t.shouldOptimize,e=i.crop,a=i.markup,o=i.resize,u=i.dirty,c=i.width,f=i.height;n.ref.image.crop=e;var E={width:c,height:f,center:{x:.5*c,y:.5*f}},_={width:n.ref.image.width,height:n.ref.image.height},s={x:e.center.x*_.width,y:e.center.y*_.height},l={x:E.center.x-_.width*e.center.x,y:E.center.y-_.height*e.center.y},v=2*Math.PI+e.rotation%(2*Math.PI),h=void 0===e.scaleToFit||e.scaleToFit,I=A(_,w(E,e.aspectRatio||_.height/_.width),v,h?e.center:{x:.5,y:.5}),d=e.zoom*I;a&&a.length?(n.ref.createMarkup(),n.ref.markup.width=c,n.ref.markup.height=f,n.ref.markup.resize=o,n.ref.markup.dirty=u,n.ref.markup.markup=a,n.ref.markup.crop=R(_,e)):n.ref.markup&&n.ref.destroyMarkup();var p=n.ref.image;if(r)return p.originX=null,p.originY=null,p.translateX=null,p.translateY=null,p.rotateZ=null,p.scaleX=null,void(p.scaleY=null);p.originX=s.x,p.originY=s.y,p.translateX=l.x,p.translateY=l.y,p.rotateZ=v,p.scaleX=d,p.scaleY=d}})},P=0,D=function(){self.onmessage=function(t){createImageBitmap(t.data.message.file).then((function(n){self.postMessage({id:t.data.id,message:n},[n])}))}},O=function(){self.onmessage=function(t){for(var n=t.data.message.imageData,i=t.data.message.colorMatrix,r=n.data,e=r.length,a=i[0],o=i[1],u=i[2],c=i[3],f=i[4],E=i[5],_=i[6],s=i[7],l=i[8],v=i[9],h=i[10],I=i[11],d=i[12],p=i[13],M=i[14],g=i[15],m=i[16],T=i[17],A=i[18],w=i[19],R=0,y=0,G=0,P=0,D=0;R<e;R+=4)y=r[R]/255,G=r[R+1]/255,P=r[R+2]/255,D=r[R+3]/255,r[R]=Math.max(0,Math.min(255*(y*a+G*o+P*u+D*c+f),255)),r[R+1]=Math.max(0,Math.min(255*(y*E+G*_+P*s+D*l+v),255)),r[R+2]=Math.max(0,Math.min(255*(y*h+G*I+P*d+D*p+M),255)),r[R+3]=Math.max(0,Math.min(255*(y*g+G*m+P*T+D*A+w),255));self.postMessage({id:t.data.id,message:n},[n.data.buffer])}},x={1:function(){return[1,0,0,1,0,0]},2:function(t){return[-1,0,0,1,t,0]},3:function(t,n){return[-1,0,0,-1,t,n]},4:function(t,n){return[1,0,0,-1,0,n]},5:function(){return[0,1,1,0,0,0]},6:function(t,n){return[0,1,-1,0,n,0]},7:function(t,n){return[0,-1,-1,0,n,t]},8:function(t){return[0,-1,1,0,0,t]}},L=function(t,n,i,r){n=Math.round(n),i=Math.round(i);var e=document.createElement("canvas");e.width=n,e.height=i;var a=e.getContext("2d");if(r>=5&&r<=8){var o=[i,n];n=o[0],i=o[1]}return function(t,n,i,r){-1!==r&&t.transform.apply(t,x[r](n,i))}(a,n,i,r),a.drawImage(t,0,0,n,i),e},C=function(t){return/^image/.test(t.type)&&!/svg/.test(t.type)},W=function(t){var n=Math.min(10/t.width,10/t.height),i=document.createElement("canvas"),r=i.getContext("2d"),e=i.width=Math.ceil(t.width*n),a=i.height=Math.ceil(t.height*n);r.drawImage(t,0,0,e,a);var o=null;try{o=r.getImageData(0,0,e,a).data}catch(t){return null}for(var u=o.length,c=0,f=0,E=0,_=0;_<u;_+=4)c+=o[_]*o[_],f+=o[_+1]*o[_+1],E+=o[_+2]*o[_+2];return{r:c=S(c,u),g:f=S(f,u),b:E=S(E,u)}},S=function(t,n){return Math.floor(Math.sqrt(t/(n/4)))},k=function(t){var n=t.utils.createView({name:"image-preview-overlay",tag:"div",ignoreRect:!0,create:function(t){var n=t.root,i=t.props,r='<svg width="500" height="200" viewBox="0 0 500 200" preserveAspectRatio="none">\n <defs>\n <radialGradient id="gradient-__UID__" cx=".5" cy="1.25" r="1.15">\n <stop offset=\'50%\' stop-color=\'#000000\'/>\n <stop offset=\'56%\' stop-color=\'#0a0a0a\'/>\n <stop offset=\'63%\' stop-color=\'#262626\'/>\n <stop offset=\'69%\' stop-color=\'#4f4f4f\'/>\n <stop offset=\'75%\' stop-color=\'#808080\'/>\n <stop offset=\'81%\' stop-color=\'#b1b1b1\'/>\n <stop offset=\'88%\' stop-color=\'#dadada\'/>\n <stop offset=\'94%\' stop-color=\'#f6f6f6\'/>\n <stop offset=\'100%\' stop-color=\'#ffffff\'/>\n </radialGradient>\n <mask id="mask-__UID__">\n <rect x="0" y="0" width="500" height="200" fill="url(#gradient-__UID__)"></rect>\n </mask>\n </defs>\n <rect x="0" width="500" height="200" fill="currentColor" mask="url(#mask-__UID__)"></rect>\n</svg>';if(document.querySelector("base")){var e=new URL(window.location.href.replace(window.location.hash,"")).href;r=r.replace(/url\(\#/g,"url("+e+"#")}P++,n.element.classList.add("filepond--image-preview-overlay-".concat(i.status)),n.element.innerHTML=r.replace(/__UID__/g,P)},mixins:{styles:["opacity"],animations:{opacity:{type:"spring",mass:25}}}}),i=function(t){return t.utils.createView({name:"image-preview",tag:"div",ignoreRect:!0,mixins:{apis:["image","crop","markup","resize","dirty","background"],styles:["translateY","scaleX","scaleY","opacity"],animations:{scaleX:y,scaleY:y,translateY:y,opacity:{type:"tween",duration:400}}},create:function(n){var i=n.root,r=n.props;i.ref.clip=i.appendChildView(i.createChildView(G(t),{id:r.id,image:r.image,crop:r.crop,markup:r.markup,resize:r.resize,dirty:r.dirty,background:r.background}))},write:function(t){var n=t.root,i=t.props,r=t.shouldOptimize,e=n.ref.clip,a=i.image,o=i.crop,u=i.markup,c=i.resize,f=i.dirty;if(e.crop=o,e.markup=u,e.resize=c,e.dirty=f,e.opacity=r?0:1,!r&&!n.rect.element.hidden){var E=o.aspectRatio||a.height/a.width,_=n.rect.inner.width,s=n.rect.inner.height,l=n.query("GET_IMAGE_PREVIEW_HEIGHT"),v=n.query("GET_IMAGE_PREVIEW_MIN_HEIGHT"),h=n.query("GET_IMAGE_PREVIEW_MAX_HEIGHT"),I=n.query("GET_PANEL_ASPECT_RATIO"),d=n.query("GET_ALLOW_MULTIPLE");I&&!d&&(l=_*I,E=I);var p=null!==l?l:Math.max(v,Math.min(_*E,h)),M=p/E;M>_&&(p=(M=_)*E),p>s&&(p=s,M=s/E),e.width=M,e.height=p}}})}(t),r=t.utils.createWorker,e=function(t,n,i){return new Promise((function(e){t.ref.imageData||(t.ref.imageData=i.getContext("2d").getImageData(0,0,i.width,i.height));var a=function(t){var n;try{n=new ImageData(t.width,t.height)}catch(i){n=document.createElement("canvas").getContext("2d").createImageData(t.width,t.height)}return n.data.set(new Uint8ClampedArray(t.data)),n}(t.ref.imageData);if(!n||20!==n.length)return i.getContext("2d").putImageData(a,0,0),e();var o=r(O);o.post({imageData:a,colorMatrix:n},(function(t){i.getContext("2d").putImageData(t,0,0),o.terminate(),e()}),[a.data.buffer])}))},a=function(t){var n=t.root,r=t.image,e=t.props.id,a=n.query("GET_ITEM",{id:e});if(a){var o,u,c=a.getMetadata("crop")||{center:{x:.5,y:.5},flip:{horizontal:!1,vertical:!1},zoom:1,rotation:0,aspectRatio:null},f=n.query("GET_IMAGE_TRANSFORM_CANVAS_BACKGROUND_COLOR"),E=!1;n.query("GET_IMAGE_PREVIEW_MARKUP_SHOW")&&(o=a.getMetadata("markup")||[],u=a.getMetadata("resize"),E=!0);var _=n.appendChildView(n.createChildView(i,{id:e,image:r,crop:c,resize:u,markup:o,dirty:E,background:f,opacity:0,scaleX:1.15,scaleY:1.15,translateY:15}),n.childViews.length);n.ref.images.push(_),_.opacity=1,_.scaleX=1,_.scaleY=1,_.translateY=0,setTimeout((function(){n.dispatch("DID_IMAGE_PREVIEW_SHOW",{id:e})}),250)}},o=function(t){var n=t.root;n.ref.overlayShadow.opacity=1,n.ref.overlayError.opacity=0,n.ref.overlaySuccess.opacity=0},u=function(t){var n=t.root;n.ref.overlayShadow.opacity=.25,n.ref.overlayError.opacity=1};return t.utils.createView({name:"image-preview-wrapper",create:function(t){var i=t.root;i.ref.images=[],i.ref.imageData=null,i.ref.imageViewBin=[],i.ref.overlayShadow=i.appendChildView(i.createChildView(n,{opacity:0,status:"idle"})),i.ref.overlaySuccess=i.appendChildView(i.createChildView(n,{opacity:0,status:"success"})),i.ref.overlayError=i.appendChildView(i.createChildView(n,{opacity:0,status:"failure"}))},styles:["height"],apis:["height"],destroy:function(t){t.root.ref.images.forEach((function(t){t.image.width=1,t.image.height=1}))},didWriteView:function(t){t.root.ref.images.forEach((function(t){t.dirty=!1}))},write:t.utils.createRoute({DID_IMAGE_PREVIEW_DRAW:function(t){var n=t.root,i=n.ref.images[n.ref.images.length-1];i.translateY=0,i.scaleX=1,i.scaleY=1,i.opacity=1},DID_IMAGE_PREVIEW_CONTAINER_CREATE:function(t){var n,i,r,e=t.root,a=t.props.id,o=e.query("GET_ITEM",a);if(o){var u=URL.createObjectURL(o.file);n=u,i=function(t,n){e.dispatch("DID_IMAGE_PREVIEW_CALCULATE_SIZE",{id:a,width:t,height:n})},(r=new Image).onload=function(){var t=r.naturalWidth,n=r.naturalHeight;r=null,i(t,n)},r.src=n}},DID_FINISH_CALCULATE_PREVIEWSIZE:function(t){var n,i,o,u=t.root,c=t.props,f=u.query("GET_ITEM",c.id);if(f){var E=URL.createObjectURL(f.file),_=function(){var t;(t=E,new Promise((function(n,i){var r=new Image;r.crossOrigin="Anonymous",r.onload=function(){n(r)},r.onerror=function(t){i(t)},r.src=t}))).then(s)},s=function(t){URL.revokeObjectURL(E);var n=(f.getMetadata("exif")||{}).orientation||-1,i=t.width,r=t.height;if(i&&r){if(n>=5&&n<=8){var o=[r,i];i=o[0],r=o[1]}var _=Math.max(1,.75*window.devicePixelRatio),s=u.query("GET_IMAGE_PREVIEW_ZOOM_FACTOR")*_,l=r/i,v=u.rect.element.width,h=u.rect.element.height,I=v,d=I*l;l>1?d=(I=Math.min(i,v*s))*l:I=(d=Math.min(r,h*s))/l;var p=L(t,I,d,n),M=function(){var n=u.query("GET_IMAGE_PREVIEW_CALCULATE_AVERAGE_IMAGE_COLOR")?W(data):null;f.setMetadata("color",n,!0),"close"in t&&t.close(),u.ref.overlayShadow.opacity=1,a({root:u,props:c,image:p})},g=f.getMetadata("filter");g?e(u,g,p).then(M):M()}};if(n=f.file,i=window.navigator.userAgent.match(/Firefox\/([0-9]+)\./),null!==(o=i?parseInt(i[1]):null)&&o<=58||!("createImageBitmap"in window)||!C(n))_();else{var l=r(D);l.post({file:f.file},(function(t){l.terminate(),t?s(t):_()}))}}},DID_UPDATE_ITEM_METADATA:function(t){var n,i,r=t.root,o=t.props,u=t.action;if(/crop|filter|markup|resize/.test(u.change.key)&&r.ref.images.length){var c=r.query("GET_ITEM",{id:o.id});if(c)if(/filter/.test(u.change.key))e(r,u.change.value,r.ref.images[r.ref.images.length-1].image);else if(/crop|markup|resize/.test(u.change.key)){var f=c.getMetadata("crop"),E=r.ref.images[r.ref.images.length-1];if(f&&f.aspectRatio&&E.crop&&E.crop.aspectRatio&&Math.abs(f.aspectRatio-E.crop.aspectRatio)>1e-5){var _=function(t){var n=t.root,i=n.ref.images.shift();return i.opacity=0,i.translateY=-15,n.ref.imageViewBin.push(i),i}({root:r});a({root:r,props:o,image:(n=_.image,(i=i||document.createElement("canvas")).width=n.width,i.height=n.height,i.getContext("2d").drawImage(n,0,0),i)})}else!function(t){var n=t.root,i=n.query("GET_ITEM",{id:t.props.id});if(i){var r=n.ref.images[n.ref.images.length-1];r.crop=i.getMetadata("crop"),r.background=n.query("GET_IMAGE_TRANSFORM_CANVAS_BACKGROUND_COLOR"),n.query("GET_IMAGE_PREVIEW_MARKUP_SHOW")&&(r.dirty=!0,r.resize=i.getMetadata("resize"),r.markup=i.getMetadata("markup"))}}({root:r,props:o})}}},DID_THROW_ITEM_LOAD_ERROR:u,DID_THROW_ITEM_PROCESSING_ERROR:u,DID_THROW_ITEM_INVALID:u,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},(function(t){var n=t.root,i=n.ref.imageViewBin.filter((function(t){return 0===t.opacity}));n.ref.imageViewBin=n.ref.imageViewBin.filter((function(t){return t.opacity>0})),i.forEach((function(t){return function(t,n){t.removeChildView(n),n.image.width=1,n.image.height=1,n._destroy()}(n,t)})),i.length=0}))})},V=function(t){var n=t.addFilter,i=t.utils,r=i.Type,e=i.createRoute,a=i.isFile,o=k(t);return n("CREATE_VIEW",(function(t){var n=t.view,i=t.query;if((0,t.is)("file")&&i("GET_ALLOW_IMAGE_PREVIEW")){var r=function(t){t.root.ref.shouldRescale=!0};n.registerWriter(e({DID_RESIZE_ROOT:r,DID_STOP_RESIZE:r,DID_LOAD_ITEM:function(t){var r=t.root,e=t.props.id,u=i("GET_ITEM",e);if(u&&a(u.file)&&!u.archived){var c=u.file;if(function(t){return/^image/.test(t.type)}(c)&&i("GET_IMAGE_PREVIEW_FILTER_ITEM")(u)){var f="createImageBitmap"in(window||{}),E=i("GET_IMAGE_PREVIEW_MAX_FILE_SIZE");if(!(!f&&E&&c.size>E)){r.ref.imagePreview=n.appendChildView(n.createChildView(o,{id:e}));var _=r.query("GET_IMAGE_PREVIEW_HEIGHT");_&&r.dispatch("DID_UPDATE_PANEL_HEIGHT",{id:u.id,height:_});var s=!f&&c.size>i("GET_IMAGE_PREVIEW_MAX_INSTANT_PREVIEW_FILE_SIZE");r.dispatch("DID_IMAGE_PREVIEW_CONTAINER_CREATE",{id:e},s)}}}},DID_IMAGE_PREVIEW_CALCULATE_SIZE:function(t){var n=t.root,i=t.action;n.ref.imageWidth=i.width,n.ref.imageHeight=i.height,n.ref.shouldRescale=!0,n.ref.shouldDrawPreview=!0,n.dispatch("KICK")},DID_UPDATE_ITEM_METADATA:function(t){"crop"===t.action.change.key&&(t.root.ref.shouldRescale=!0)}},(function(t){var n=t.root,i=t.props;n.ref.imagePreview&&(n.rect.element.hidden||(n.ref.shouldRescale&&(function(t,n){if(t.ref.imagePreview){var i=t.query("GET_ITEM",{id:n.id});if(i){var r=t.query("GET_PANEL_ASPECT_RATIO"),e=t.query("GET_ITEM_PANEL_ASPECT_RATIO"),a=t.query("GET_IMAGE_PREVIEW_HEIGHT");if(!(r||e||a)){var o=t.ref,u=o.imageWidth,c=o.imageHeight;if(u&&c){var f=t.query("GET_IMAGE_PREVIEW_MIN_HEIGHT"),E=t.query("GET_IMAGE_PREVIEW_MAX_HEIGHT"),_=(i.getMetadata("exif")||{}).orientation||-1;if(_>=5&&_<=8){var s=[c,u];u=s[0],c=s[1]}if(!C(i.file)||t.query("GET_IMAGE_PREVIEW_UPSCALE")){var l=2048/u;u*=l,c*=l}var v=c/u,h=(i.getMetadata("crop")||{}).aspectRatio||v,I=Math.max(f,Math.min(c,E)),d=Math.min(t.rect.element.width*h,I);t.dispatch("DID_UPDATE_PANEL_HEIGHT",{id:i.id,height:d})}}}}}(n,i),n.ref.shouldRescale=!1),n.ref.shouldDrawPreview&&(requestAnimationFrame((function(){requestAnimationFrame((function(){n.dispatch("DID_FINISH_CALCULATE_PREVIEWSIZE",{id:i.id})}))})),n.ref.shouldDrawPreview=!1)))})))}})),{options:{allowImagePreview:[!0,r.BOOLEAN],imagePreviewFilterItem:[function(){return!0},r.FUNCTION],imagePreviewHeight:[null,r.INT],imagePreviewMinHeight:[44,r.INT],imagePreviewMaxHeight:[256,r.INT],imagePreviewMaxFileSize:[null,r.INT],imagePreviewZoomFactor:[2,r.INT],imagePreviewUpscale:[!1,r.BOOLEAN],imagePreviewMaxInstantPreviewFileSize:[1e6,r.INT],imagePreviewTransparencyIndicator:[null,r.STRING],imagePreviewCalculateAverageImageColor:[!1,r.BOOLEAN],imagePreviewMarkupShow:[!0,r.BOOLEAN],imagePreviewMarkupFilter:[function(){return!0},r.FUNCTION]}}};return"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:V})),V}()),r.exports),a=n({__proto__:null,default:t(e)},[e]);
|
|
4
|
+
import{d as t}from"./p-Q9lz4Iuq.js";function n(t,n){return n.forEach((function(n){n&&"string"!=typeof n&&!Array.isArray(n)&&Object.keys(n).forEach((function(i){if("default"!==i&&!(i in t)){var r=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(t,i,r.get?r:{enumerable:!0,get:function(){return n[i]}})}}))})),Object.freeze(t)}var i,r={exports:{}},e=(i||(i=1,r.exports=function(){function t(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,n){var i=[],r=!0,e=!1,a=void 0;try{for(var o,u=t[Symbol.iterator]();!(r=(o=u.next()).done)&&(i.push(o.value),i.length!==n);r=!0);}catch(t){e=!0,a=t}finally{try{r||null==u.return||u.return()}finally{if(e)throw a}}return i}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var n=function(t,n){return e(t.x*n,t.y*n)},i=function(t,n){return e(t.x+n.x,t.y+n.y)},r=function(t,n,i){var r=Math.cos(n),a=Math.sin(n),o=e(t.x-i.x,t.y-i.y);return e(i.x+r*o.x-a*o.y,i.y+a*o.x+r*o.y)},e=function(){return{x:arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,y:arguments.length>1&&void 0!==arguments[1]?arguments[1]:0}},a=function(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3?arguments[3]:void 0;return"string"==typeof t?parseFloat(t)*i:"number"==typeof t?t*(r?n[r]:Math.min(n.width,n.height)):void 0},o=function(t){return null!=t},u=function(t,n){return Object.keys(n).forEach((function(i){return t.setAttribute(i,n[i])}))},c=function(t,n){var i=document.createElementNS("http://www.w3.org/2000/svg",t);return n&&u(i,n),i},f={contain:"xMidYMid meet",cover:"xMidYMid slice"},E={left:"start",center:"middle",right:"end"},_=function(t){return function(n){return c(t,{id:n.id})}},s={image:function(t){var n=c("image",{id:t.id,"stroke-linecap":"round","stroke-linejoin":"round",opacity:"0"});return n.onload=function(){n.setAttribute("opacity",t.opacity||1)},n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",t.src),n},rect:_("rect"),ellipse:_("ellipse"),text:_("text"),path:_("path"),line:function(t){var n=c("g",{id:t.id,"stroke-linecap":"round","stroke-linejoin":"round"}),i=c("line");n.appendChild(i);var r=c("path");n.appendChild(r);var e=c("path");return n.appendChild(e),n}},l={rect:function(t){return u(t,Object.assign({},t.rect,t.styles))},ellipse:function(t){return u(t,Object.assign({cx:t.rect.x+.5*t.rect.width,cy:t.rect.y+.5*t.rect.height,rx:.5*t.rect.width,ry:.5*t.rect.height},t.styles))},image:function(t,n){u(t,Object.assign({},t.rect,t.styles,{preserveAspectRatio:f[n.fit]||"none"}))},text:function(t,n,i,r){var e=a(n.fontSize,i,r);u(t,Object.assign({},t.rect,t.styles,{"stroke-width":0,"font-weight":n.fontWeight||"normal","font-size":e,"font-family":n.fontFamily||"sans-serif","text-anchor":E[n.textAlign]||"start"})),t.text!==n.text&&(t.text=n.text,t.textContent=n.text.length?n.text:" ")},path:function(t,n,i,r){var e;u(t,Object.assign({},t.styles,{fill:"none",d:(e=n.points.map((function(t){return{x:a(t.x,i,r,"width"),y:a(t.y,i,r,"height")}})),e.map((function(t,n){return"".concat(0===n?"M":"L"," ").concat(t.x," ").concat(t.y)})).join(" "))}))},line:function(t,o,c,f){u(t,Object.assign({},t.rect,t.styles,{fill:"none"}));var E=t.childNodes[1],_=t.childNodes[2],s=t.rect,l={x:t.rect.x+t.rect.width,y:t.rect.y+t.rect.height};if(u(t.childNodes[0],{x1:s.x,y1:s.y,x2:l.x,y2:l.y}),o.lineDecoration){E.style.display="none",_.style.display="none";var v=function(t){var n=Math.sqrt(t.x*t.x+t.y*t.y);return 0===n?{x:0,y:0}:e(t.x/n,t.y/n)}({x:l.x-s.x,y:l.y-s.y}),h=a(.05,c,f);if(-1!==o.lineDecoration.indexOf("arrow-begin")){var I=n(v,h),d=i(s,I),p=r(s,2,d),M=r(s,-2,d);u(E,{style:"display:block;",d:"M".concat(p.x,",").concat(p.y," L").concat(s.x,",").concat(s.y," L").concat(M.x,",").concat(M.y)})}if(-1!==o.lineDecoration.indexOf("arrow-end")){var g=n(v,-h),m=i(l,g),T=r(l,2,m),A=r(l,-2,m);u(_,{style:"display:block;",d:"M".concat(T.x,",").concat(T.y," L").concat(l.x,",").concat(l.y," L").concat(A.x,",").concat(A.y)})}}}},v=function(t,n,i,r,e){"path"!==n&&(t.rect=function(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=a(t.x,n,i,"width")||a(t.left,n,i,"width"),e=a(t.y,n,i,"height")||a(t.top,n,i,"height"),u=a(t.width,n,i,"width"),c=a(t.height,n,i,"height"),f=a(t.right,n,i,"width"),E=a(t.bottom,n,i,"height");return o(e)||(e=o(c)&&o(E)?n.height-c-E:E),o(r)||(r=o(u)&&o(f)?n.width-u-f:f),o(u)||(u=o(r)&&o(f)?n.width-r-f:0),o(c)||(c=o(e)&&o(E)?n.height-e-E:0),{x:r||0,y:e||0,width:u||0,height:c||0}}(i,r,e)),t.styles=function(t,n,i){var r=t.borderStyle||t.lineStyle||"solid",e=t.backgroundColor||t.fontColor||"transparent",o=t.borderColor||t.lineColor||"transparent",u=a(t.borderWidth||t.lineWidth,n,i);return{"stroke-linecap":t.lineCap||"round","stroke-linejoin":t.lineJoin||"round","stroke-width":u||0,"stroke-dasharray":"string"==typeof r?"":r.map((function(t){return a(t,n,i)})).join(","),stroke:o,fill:e,opacity:t.opacity||1}}(i,r,e),l[n](t,i,r,e)},h=["x","y","left","top","right","bottom","width","height"],I=function(n){var i=t(n,2),r=i[0],e=i[1],a=e.points?{}:h.reduce((function(t,n){return t[n]="string"==typeof(i=e[n])&&/%/.test(i)?parseFloat(i)/100:i,t;var i}),{});return[r,Object.assign({zIndex:0},e,a)]},d=function(t,n){return t[1].zIndex>n[1].zIndex?1:t[1].zIndex<n[1].zIndex?-1:0},p=function(n){return n.utils.createView({name:"image-preview-markup",tag:"svg",ignoreRect:!0,mixins:{apis:["width","height","crop","markup","resize","dirty"]},write:function(n){var i=n.root,r=n.props;if(r.dirty){var e=r.crop,a=r.resize,o=r.markup,u=r.width,c=r.height,f=e.width,E=e.height;if(a){var _=a.size,l=_&&_.width,h=_&&_.height,p=a.mode;l&&!h&&(h=l),h&&!l&&(l=h);var M=f<l&&E<h;if(!M||M&&a.upscale){var g,m=l/f,T=h/E;"force"===p?(f=l,E=h):("cover"===p?g=Math.max(m,T):"contain"===p&&(g=Math.min(m,T)),f*=g,E*=g)}}var A={width:u,height:c};i.element.setAttribute("width",A.width),i.element.setAttribute("height",A.height);var w=Math.min(u/f,c/E);i.element.innerHTML="";var R=i.query("GET_IMAGE_PREVIEW_MARKUP_FILTER");o.filter(R).map(I).sort(d).forEach((function(n){var r=t(n,2),e=r[0],a=r[1],o=function(t,n){return s[t](n)}(e,a);v(o,e,a,A,w),i.element.appendChild(o)}))}}})},M=function(t,n){return{x:t,y:n}},g=function(t,n){return M(t.x-n.x,t.y-n.y)},m=function(t,n){return Math.sqrt(function(t,n){return function(t,n){return t.x*n.x+t.y*n.y}(g(t,n),g(t,n))}(t,n))},T=function(t,n){var i=t,r=n,e=1.5707963267948966-n,a=Math.sin(1.5707963267948966),o=Math.sin(r),u=Math.sin(e),c=Math.cos(e),f=i/a;return M(c*(f*o),c*(f*u))},A=function(t,n,i,r){var e=2*(r.x>.5?1-r.x:r.x)*t.width,a=2*(r.y>.5?1-r.y:r.y)*t.height,o=function(t,n){var i=t.height,r=T(t.width,n),e=T(i,n),a=M(t.x+Math.abs(r.x),t.y-Math.abs(r.y)),o=M(t.x+t.width+Math.abs(e.y),t.y+Math.abs(e.x)),u=M(t.x-Math.abs(e.y),t.y+t.height-Math.abs(e.x));return{width:m(a,o),height:m(a,u)}}(n,i);return Math.max(o.width/e,o.height/a)},w=function(t,n){var i=t.width,r=i*n;return r>t.height&&(i=(r=t.height)/n),{x:.5*(t.width-i),y:.5*(t.height-r),width:i,height:r}},R=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.zoom,r=n.rotation,e=n.center,a=n.aspectRatio;a||(a=t.height/t.width);var o=function(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=t.height/t.width,e=1,a=r;a>n&&(e=(a=n)/r);var o=Math.max(1/e,n/a),u=t.width/(i*o*e);return{width:u,height:u*n}}(t,a,i),u=void 0===n.scaleToFit||n.scaleToFit,c=i*A(t,w({width:o.width,height:o.height},a),r,u?e:{x:.5,y:.5});return{widthFloat:o.width/c,heightFloat:o.height/c,width:Math.round(o.width/c),height:Math.round(o.height/c)}},y={type:"spring",stiffness:.5,damping:.45,mass:10},G=function(t){return t.utils.createView({name:"image-clip",tag:"div",ignoreRect:!0,mixins:{apis:["crop","markup","resize","width","height","dirty","background"],styles:["width","height","opacity"],animations:{opacity:{type:"tween",duration:250}}},didWriteView:function(t){var n=t.props;n.background&&(t.root.element.style.backgroundColor=n.background)},create:function(n){var i=n.root,r=n.props;i.ref.image=i.appendChildView(i.createChildView(function(t){return t.utils.createView({name:"image-canvas-wrapper",tag:"div",ignoreRect:!0,mixins:{apis:["crop","width","height"],styles:["originX","originY","translateX","translateY","scaleX","scaleY","rotateZ"],animations:{originX:y,originY:y,scaleX:y,scaleY:y,translateX:y,translateY:y,rotateZ:y}},create:function(n){var i=n.root,r=n.props;r.width=r.image.width,r.height=r.image.height,i.ref.bitmap=i.appendChildView(i.createChildView(function(t){return t.utils.createView({name:"image-bitmap",ignoreRect:!0,mixins:{styles:["scaleX","scaleY"]},create:function(t){t.root.appendChild(t.props.image)}})}(t),{image:r.image}))},write:function(t){var n=t.props.crop.flip,i=t.root.ref.bitmap;i.scaleX=n.horizontal?-1:1,i.scaleY=n.vertical?-1:1}})}(t),Object.assign({},r))),i.ref.createMarkup=function(){i.ref.markup||(i.ref.markup=i.appendChildView(i.createChildView(p(t),Object.assign({},r))))},i.ref.destroyMarkup=function(){i.ref.markup&&(i.removeChildView(i.ref.markup),i.ref.markup=null)};var e=i.query("GET_IMAGE_PREVIEW_TRANSPARENCY_INDICATOR");null!==e&&(i.element.dataset.transparencyIndicator="grid"===e?e:"color")},write:function(t){var n=t.root,i=t.props,r=t.shouldOptimize,e=i.crop,a=i.markup,o=i.resize,u=i.dirty,c=i.width,f=i.height;n.ref.image.crop=e;var E={width:c,height:f,center:{x:.5*c,y:.5*f}},_={width:n.ref.image.width,height:n.ref.image.height},s={x:e.center.x*_.width,y:e.center.y*_.height},l={x:E.center.x-_.width*e.center.x,y:E.center.y-_.height*e.center.y},v=2*Math.PI+e.rotation%(2*Math.PI),h=void 0===e.scaleToFit||e.scaleToFit,I=A(_,w(E,e.aspectRatio||_.height/_.width),v,h?e.center:{x:.5,y:.5}),d=e.zoom*I;a&&a.length?(n.ref.createMarkup(),n.ref.markup.width=c,n.ref.markup.height=f,n.ref.markup.resize=o,n.ref.markup.dirty=u,n.ref.markup.markup=a,n.ref.markup.crop=R(_,e)):n.ref.markup&&n.ref.destroyMarkup();var p=n.ref.image;if(r)return p.originX=null,p.originY=null,p.translateX=null,p.translateY=null,p.rotateZ=null,p.scaleX=null,void(p.scaleY=null);p.originX=s.x,p.originY=s.y,p.translateX=l.x,p.translateY=l.y,p.rotateZ=v,p.scaleX=d,p.scaleY=d}})},P=0,D=function(){self.onmessage=function(t){createImageBitmap(t.data.message.file).then((function(n){self.postMessage({id:t.data.id,message:n},[n])}))}},O=function(){self.onmessage=function(t){for(var n=t.data.message.imageData,i=t.data.message.colorMatrix,r=n.data,e=r.length,a=i[0],o=i[1],u=i[2],c=i[3],f=i[4],E=i[5],_=i[6],s=i[7],l=i[8],v=i[9],h=i[10],I=i[11],d=i[12],p=i[13],M=i[14],g=i[15],m=i[16],T=i[17],A=i[18],w=i[19],R=0,y=0,G=0,P=0,D=0;R<e;R+=4)y=r[R]/255,G=r[R+1]/255,P=r[R+2]/255,D=r[R+3]/255,r[R]=Math.max(0,Math.min(255*(y*a+G*o+P*u+D*c+f),255)),r[R+1]=Math.max(0,Math.min(255*(y*E+G*_+P*s+D*l+v),255)),r[R+2]=Math.max(0,Math.min(255*(y*h+G*I+P*d+D*p+M),255)),r[R+3]=Math.max(0,Math.min(255*(y*g+G*m+P*T+D*A+w),255));self.postMessage({id:t.data.id,message:n},[n.data.buffer])}},x={1:function(){return[1,0,0,1,0,0]},2:function(t){return[-1,0,0,1,t,0]},3:function(t,n){return[-1,0,0,-1,t,n]},4:function(t,n){return[1,0,0,-1,0,n]},5:function(){return[0,1,1,0,0,0]},6:function(t,n){return[0,1,-1,0,n,0]},7:function(t,n){return[0,-1,-1,0,n,t]},8:function(t){return[0,-1,1,0,0,t]}},L=function(t,n,i,r){n=Math.round(n),i=Math.round(i);var e=document.createElement("canvas");e.width=n,e.height=i;var a=e.getContext("2d");if(r>=5&&r<=8){var o=[i,n];n=o[0],i=o[1]}return function(t,n,i,r){-1!==r&&t.transform.apply(t,x[r](n,i))}(a,n,i,r),a.drawImage(t,0,0,n,i),e},C=function(t){return/^image/.test(t.type)&&!/svg/.test(t.type)},W=function(t){var n=Math.min(10/t.width,10/t.height),i=document.createElement("canvas"),r=i.getContext("2d"),e=i.width=Math.ceil(t.width*n),a=i.height=Math.ceil(t.height*n);r.drawImage(t,0,0,e,a);var o=null;try{o=r.getImageData(0,0,e,a).data}catch(t){return null}for(var u=o.length,c=0,f=0,E=0,_=0;_<u;_+=4)c+=o[_]*o[_],f+=o[_+1]*o[_+1],E+=o[_+2]*o[_+2];return{r:c=S(c,u),g:f=S(f,u),b:E=S(E,u)}},S=function(t,n){return Math.floor(Math.sqrt(t/(n/4)))},k=function(t){var n=t.utils.createView({name:"image-preview-overlay",tag:"div",ignoreRect:!0,create:function(t){var n=t.root,i=t.props,r='<svg width="500" height="200" viewBox="0 0 500 200" preserveAspectRatio="none">\n <defs>\n <radialGradient id="gradient-__UID__" cx=".5" cy="1.25" r="1.15">\n <stop offset=\'50%\' stop-color=\'#000000\'/>\n <stop offset=\'56%\' stop-color=\'#0a0a0a\'/>\n <stop offset=\'63%\' stop-color=\'#262626\'/>\n <stop offset=\'69%\' stop-color=\'#4f4f4f\'/>\n <stop offset=\'75%\' stop-color=\'#808080\'/>\n <stop offset=\'81%\' stop-color=\'#b1b1b1\'/>\n <stop offset=\'88%\' stop-color=\'#dadada\'/>\n <stop offset=\'94%\' stop-color=\'#f6f6f6\'/>\n <stop offset=\'100%\' stop-color=\'#ffffff\'/>\n </radialGradient>\n <mask id="mask-__UID__">\n <rect x="0" y="0" width="500" height="200" fill="url(#gradient-__UID__)"></rect>\n </mask>\n </defs>\n <rect x="0" width="500" height="200" fill="currentColor" mask="url(#mask-__UID__)"></rect>\n</svg>';if(document.querySelector("base")){var e=new URL(window.location.href.replace(window.location.hash,"")).href;r=r.replace(/url\(\#/g,"url("+e+"#")}P++,n.element.classList.add("filepond--image-preview-overlay-".concat(i.status)),n.element.innerHTML=r.replace(/__UID__/g,P)},mixins:{styles:["opacity"],animations:{opacity:{type:"spring",mass:25}}}}),i=function(t){return t.utils.createView({name:"image-preview",tag:"div",ignoreRect:!0,mixins:{apis:["image","crop","markup","resize","dirty","background"],styles:["translateY","scaleX","scaleY","opacity"],animations:{scaleX:y,scaleY:y,translateY:y,opacity:{type:"tween",duration:400}}},create:function(n){var i=n.root,r=n.props;i.ref.clip=i.appendChildView(i.createChildView(G(t),{id:r.id,image:r.image,crop:r.crop,markup:r.markup,resize:r.resize,dirty:r.dirty,background:r.background}))},write:function(t){var n=t.root,i=t.props,r=t.shouldOptimize,e=n.ref.clip,a=i.image,o=i.crop,u=i.markup,c=i.resize,f=i.dirty;if(e.crop=o,e.markup=u,e.resize=c,e.dirty=f,e.opacity=r?0:1,!r&&!n.rect.element.hidden){var E=o.aspectRatio||a.height/a.width,_=n.rect.inner.width,s=n.rect.inner.height,l=n.query("GET_IMAGE_PREVIEW_HEIGHT"),v=n.query("GET_IMAGE_PREVIEW_MIN_HEIGHT"),h=n.query("GET_IMAGE_PREVIEW_MAX_HEIGHT"),I=n.query("GET_PANEL_ASPECT_RATIO"),d=n.query("GET_ALLOW_MULTIPLE");I&&!d&&(l=_*I,E=I);var p=null!==l?l:Math.max(v,Math.min(_*E,h)),M=p/E;M>_&&(p=(M=_)*E),p>s&&(p=s,M=s/E),e.width=M,e.height=p}}})}(t),r=t.utils.createWorker,e=function(t,n,i){return new Promise((function(e){t.ref.imageData||(t.ref.imageData=i.getContext("2d").getImageData(0,0,i.width,i.height));var a=function(t){var n;try{n=new ImageData(t.width,t.height)}catch(i){n=document.createElement("canvas").getContext("2d").createImageData(t.width,t.height)}return n.data.set(new Uint8ClampedArray(t.data)),n}(t.ref.imageData);if(!n||20!==n.length)return i.getContext("2d").putImageData(a,0,0),e();var o=r(O);o.post({imageData:a,colorMatrix:n},(function(t){i.getContext("2d").putImageData(t,0,0),o.terminate(),e()}),[a.data.buffer])}))},a=function(t){var n=t.root,r=t.image,e=t.props.id,a=n.query("GET_ITEM",{id:e});if(a){var o,u,c=a.getMetadata("crop")||{center:{x:.5,y:.5},flip:{horizontal:!1,vertical:!1},zoom:1,rotation:0,aspectRatio:null},f=n.query("GET_IMAGE_TRANSFORM_CANVAS_BACKGROUND_COLOR"),E=!1;n.query("GET_IMAGE_PREVIEW_MARKUP_SHOW")&&(o=a.getMetadata("markup")||[],u=a.getMetadata("resize"),E=!0);var _=n.appendChildView(n.createChildView(i,{id:e,image:r,crop:c,resize:u,markup:o,dirty:E,background:f,opacity:0,scaleX:1.15,scaleY:1.15,translateY:15}),n.childViews.length);n.ref.images.push(_),_.opacity=1,_.scaleX=1,_.scaleY=1,_.translateY=0,setTimeout((function(){n.dispatch("DID_IMAGE_PREVIEW_SHOW",{id:e})}),250)}},o=function(t){var n=t.root;n.ref.overlayShadow.opacity=1,n.ref.overlayError.opacity=0,n.ref.overlaySuccess.opacity=0},u=function(t){var n=t.root;n.ref.overlayShadow.opacity=.25,n.ref.overlayError.opacity=1};return t.utils.createView({name:"image-preview-wrapper",create:function(t){var i=t.root;i.ref.images=[],i.ref.imageData=null,i.ref.imageViewBin=[],i.ref.overlayShadow=i.appendChildView(i.createChildView(n,{opacity:0,status:"idle"})),i.ref.overlaySuccess=i.appendChildView(i.createChildView(n,{opacity:0,status:"success"})),i.ref.overlayError=i.appendChildView(i.createChildView(n,{opacity:0,status:"failure"}))},styles:["height"],apis:["height"],destroy:function(t){t.root.ref.images.forEach((function(t){t.image.width=1,t.image.height=1}))},didWriteView:function(t){t.root.ref.images.forEach((function(t){t.dirty=!1}))},write:t.utils.createRoute({DID_IMAGE_PREVIEW_DRAW:function(t){var n=t.root,i=n.ref.images[n.ref.images.length-1];i.translateY=0,i.scaleX=1,i.scaleY=1,i.opacity=1},DID_IMAGE_PREVIEW_CONTAINER_CREATE:function(t){var n,i,r,e=t.root,a=t.props.id,o=e.query("GET_ITEM",a);if(o){var u=URL.createObjectURL(o.file);n=u,i=function(t,n){e.dispatch("DID_IMAGE_PREVIEW_CALCULATE_SIZE",{id:a,width:t,height:n})},(r=new Image).onload=function(){var t=r.naturalWidth,n=r.naturalHeight;r=null,i(t,n)},r.src=n}},DID_FINISH_CALCULATE_PREVIEWSIZE:function(t){var n,i,o,u=t.root,c=t.props,f=u.query("GET_ITEM",c.id);if(f){var E=URL.createObjectURL(f.file),_=function(){var t;(t=E,new Promise((function(n,i){var r=new Image;r.crossOrigin="Anonymous",r.onload=function(){n(r)},r.onerror=function(t){i(t)},r.src=t}))).then(s)},s=function(t){URL.revokeObjectURL(E);var n=(f.getMetadata("exif")||{}).orientation||-1,i=t.width,r=t.height;if(i&&r){if(n>=5&&n<=8){var o=[r,i];i=o[0],r=o[1]}var _=Math.max(1,.75*window.devicePixelRatio),s=u.query("GET_IMAGE_PREVIEW_ZOOM_FACTOR")*_,l=r/i,v=u.rect.element.width,h=u.rect.element.height,I=v,d=I*l;l>1?d=(I=Math.min(i,v*s))*l:I=(d=Math.min(r,h*s))/l;var p=L(t,I,d,n),M=function(){var n=u.query("GET_IMAGE_PREVIEW_CALCULATE_AVERAGE_IMAGE_COLOR")?W(data):null;f.setMetadata("color",n,!0),"close"in t&&t.close(),u.ref.overlayShadow.opacity=1,a({root:u,props:c,image:p})},g=f.getMetadata("filter");g?e(u,g,p).then(M):M()}};if(n=f.file,i=window.navigator.userAgent.match(/Firefox\/([0-9]+)\./),null!==(o=i?parseInt(i[1]):null)&&o<=58||!("createImageBitmap"in window)||!C(n))_();else{var l=r(D);l.post({file:f.file},(function(t){l.terminate(),t?s(t):_()}))}}},DID_UPDATE_ITEM_METADATA:function(t){var n,i,r=t.root,o=t.props,u=t.action;if(/crop|filter|markup|resize/.test(u.change.key)&&r.ref.images.length){var c=r.query("GET_ITEM",{id:o.id});if(c)if(/filter/.test(u.change.key))e(r,u.change.value,r.ref.images[r.ref.images.length-1].image);else if(/crop|markup|resize/.test(u.change.key)){var f=c.getMetadata("crop"),E=r.ref.images[r.ref.images.length-1];if(f&&f.aspectRatio&&E.crop&&E.crop.aspectRatio&&Math.abs(f.aspectRatio-E.crop.aspectRatio)>1e-5){var _=function(t){var n=t.root,i=n.ref.images.shift();return i.opacity=0,i.translateY=-15,n.ref.imageViewBin.push(i),i}({root:r});a({root:r,props:o,image:(n=_.image,(i=i||document.createElement("canvas")).width=n.width,i.height=n.height,i.getContext("2d").drawImage(n,0,0),i)})}else!function(t){var n=t.root,i=n.query("GET_ITEM",{id:t.props.id});if(i){var r=n.ref.images[n.ref.images.length-1];r.crop=i.getMetadata("crop"),r.background=n.query("GET_IMAGE_TRANSFORM_CANVAS_BACKGROUND_COLOR"),n.query("GET_IMAGE_PREVIEW_MARKUP_SHOW")&&(r.dirty=!0,r.resize=i.getMetadata("resize"),r.markup=i.getMetadata("markup"))}}({root:r,props:o})}}},DID_THROW_ITEM_LOAD_ERROR:u,DID_THROW_ITEM_PROCESSING_ERROR:u,DID_THROW_ITEM_INVALID:u,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},(function(t){var n=t.root,i=n.ref.imageViewBin.filter((function(t){return 0===t.opacity}));n.ref.imageViewBin=n.ref.imageViewBin.filter((function(t){return t.opacity>0})),i.forEach((function(t){return function(t,n){t.removeChildView(n),n.image.width=1,n.image.height=1,n._destroy()}(n,t)})),i.length=0}))})},V=function(t){var n=t.addFilter,i=t.utils,r=i.Type,e=i.createRoute,a=i.isFile,o=k(t);return n("CREATE_VIEW",(function(t){var n=t.view,i=t.query;if((0,t.is)("file")&&i("GET_ALLOW_IMAGE_PREVIEW")){var r=function(t){t.root.ref.shouldRescale=!0};n.registerWriter(e({DID_RESIZE_ROOT:r,DID_STOP_RESIZE:r,DID_LOAD_ITEM:function(t){var r=t.root,e=t.props.id,u=i("GET_ITEM",e);if(u&&a(u.file)&&!u.archived){var c=u.file;if(function(t){return/^image/.test(t.type)}(c)&&i("GET_IMAGE_PREVIEW_FILTER_ITEM")(u)){var f="createImageBitmap"in(window||{}),E=i("GET_IMAGE_PREVIEW_MAX_FILE_SIZE");if(!(!f&&E&&c.size>E)){r.ref.imagePreview=n.appendChildView(n.createChildView(o,{id:e}));var _=r.query("GET_IMAGE_PREVIEW_HEIGHT");_&&r.dispatch("DID_UPDATE_PANEL_HEIGHT",{id:u.id,height:_});var s=!f&&c.size>i("GET_IMAGE_PREVIEW_MAX_INSTANT_PREVIEW_FILE_SIZE");r.dispatch("DID_IMAGE_PREVIEW_CONTAINER_CREATE",{id:e},s)}}}},DID_IMAGE_PREVIEW_CALCULATE_SIZE:function(t){var n=t.root,i=t.action;n.ref.imageWidth=i.width,n.ref.imageHeight=i.height,n.ref.shouldRescale=!0,n.ref.shouldDrawPreview=!0,n.dispatch("KICK")},DID_UPDATE_ITEM_METADATA:function(t){"crop"===t.action.change.key&&(t.root.ref.shouldRescale=!0)}},(function(t){var n=t.root,i=t.props;n.ref.imagePreview&&(n.rect.element.hidden||(n.ref.shouldRescale&&(function(t,n){if(t.ref.imagePreview){var i=t.query("GET_ITEM",{id:n.id});if(i){var r=t.query("GET_PANEL_ASPECT_RATIO"),e=t.query("GET_ITEM_PANEL_ASPECT_RATIO"),a=t.query("GET_IMAGE_PREVIEW_HEIGHT");if(!(r||e||a)){var o=t.ref,u=o.imageWidth,c=o.imageHeight;if(u&&c){var f=t.query("GET_IMAGE_PREVIEW_MIN_HEIGHT"),E=t.query("GET_IMAGE_PREVIEW_MAX_HEIGHT"),_=(i.getMetadata("exif")||{}).orientation||-1;if(_>=5&&_<=8){var s=[c,u];u=s[0],c=s[1]}if(!C(i.file)||t.query("GET_IMAGE_PREVIEW_UPSCALE")){var l=2048/u;u*=l,c*=l}var v=c/u,h=(i.getMetadata("crop")||{}).aspectRatio||v,I=Math.max(f,Math.min(c,E)),d=Math.min(t.rect.element.width*h,I);t.dispatch("DID_UPDATE_PANEL_HEIGHT",{id:i.id,height:d})}}}}}(n,i),n.ref.shouldRescale=!1),n.ref.shouldDrawPreview&&(requestAnimationFrame((function(){requestAnimationFrame((function(){n.dispatch("DID_FINISH_CALCULATE_PREVIEWSIZE",{id:i.id})}))})),n.ref.shouldDrawPreview=!1)))})))}})),{options:{allowImagePreview:[!0,r.BOOLEAN],imagePreviewFilterItem:[function(){return!0},r.FUNCTION],imagePreviewHeight:[null,r.INT],imagePreviewMinHeight:[44,r.INT],imagePreviewMaxHeight:[256,r.INT],imagePreviewMaxFileSize:[null,r.INT],imagePreviewZoomFactor:[2,r.INT],imagePreviewUpscale:[!1,r.BOOLEAN],imagePreviewMaxInstantPreviewFileSize:[1e6,r.INT],imagePreviewTransparencyIndicator:[null,r.STRING],imagePreviewCalculateAverageImageColor:[!1,r.BOOLEAN],imagePreviewMarkupShow:[!0,r.BOOLEAN],imagePreviewMarkupFilter:[function(){return!0},r.FUNCTION]}}};return"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:V})),V}()),r.exports),a=n({__proto__:null,default:t(e)},[e]);
|
|
5
5
|
/*!
|
|
6
6
|
* FilePondPluginImagePreview 4.6.12
|
|
7
7
|
* Licensed under MIT, https://opensource.org/licenses/MIT/
|