From 6f53b4454bb3be132f7e70629b5dd92d4b6bfcd5 Mon Sep 17 00:00:00 2001 From: lastofpudge Date: Sat, 16 Mar 2024 22:07:12 +0200 Subject: [PATCH] fix: remove wrong --- app/Admin/AdminOptions.php | 3 - app/{CustomFields => CarbonFields}/Blocks.php | 0 .../Blocks/example.css | 0 .../Blocks/example.php | 2 +- .../Blocks/example.view.php | 0 .../Fields/about.php | 0 .../Fields/home.php | 0 .../OptionFields.php | 0 .../PostFields.php | 3 - app/Controllers/CategoryController.php | 2 +- app/Controllers/Controller.php | 8 - app/Controllers/ProductController.php | 62 - app/CustomFields/Fields/product.php | 11 - app/CustomFields/Fields/product_variants.php | 5 - app/Handlers/AjaxHandlers/addToCart.php | 51 - app/Handlers/AjaxHandlers/applyCoupon.php | 5 - app/Handlers/AjaxHandlers/removeFromCart.php | 25 - app/Handlers/ajax.php | 4 - composer.json | 8 +- jsconfig.json | 8 - package.json | 2 - resources/assets/dist/css/bundle.min.css | 1432 +- resources/assets/dist/js/app.min.js | 13883 +--------------- resources/assets/src/scripts/app.js | 8 +- resources/assets/src/scripts/cart/add.js | 91 - resources/assets/src/scripts/cart/cart.js | 11 - resources/assets/src/scripts/cart/quantity.js | 10 - resources/assets/src/scripts/cart/remove.js | 51 - .../assets/src/scripts/cart/variations.js | 11 - resources/assets/src/scripts/rangeSlider.js | 44 - resources/assets/src/styles/_plugins.scss | 1 - resources/assets/src/styles/bundle.scss | 19 - resources/views/categories/category.twig | 4 +- resources/views/components/footer.twig | 10 +- resources/views/components/head.twig | 11 +- resources/views/components/header.twig | 36 +- resources/views/woocommerce/account.twig | 24 - resources/views/woocommerce/cart.twig | 130 - resources/views/woocommerce/checkout.twig | 24 - .../woocommerce/components/cartSmall.twig | 90 - resources/views/woocommerce/product.twig | 156 - resources/views/woocommerce/shop.twig | 92 - routes/base.php | 17 - todo.md | 34 - webpack.mix.js | 27 +- woocommerce/archive-product.php | 6 - woocommerce/auth/footer.php | 25 - woocommerce/auth/form-grant-access.php | 61 - woocommerce/auth/form-login.php | 54 - woocommerce/auth/header.php | 33 - woocommerce/block-notices/error.php | 50 - woocommerce/block-notices/notice.php | 37 - woocommerce/block-notices/success.php | 37 - woocommerce/cart/cart-empty.php | 39 - woocommerce/cart/cart-item-data.php | 26 - woocommerce/cart/cart-shipping.php | 96 - woocommerce/cart/cart-totals.php | 112 - woocommerce/cart/cart.php | 209 - woocommerce/cart/cross-sells.php | 51 - woocommerce/cart/mini-cart.php | 102 - .../cart/proceed-to-checkout-button.php | 27 - woocommerce/cart/shipping-calculator.php | 96 - woocommerce/checkout/cart-errors.php | 25 - woocommerce/checkout/form-billing.php | 74 - woocommerce/checkout/form-checkout.php | 66 - woocommerce/checkout/form-coupon.php | 43 - woocommerce/checkout/form-login.php | 36 - woocommerce/checkout/form-pay.php | 109 - woocommerce/checkout/form-shipping.php | 70 - woocommerce/checkout/form-verify-email.php | 53 - woocommerce/checkout/order-receipt.php | 46 - woocommerce/checkout/order-received.php | 42 - woocommerce/checkout/payment-method.php | 33 - woocommerce/checkout/payment.php | 63 - woocommerce/checkout/review-order.php | 110 - woocommerce/checkout/terms.php | 40 - woocommerce/checkout/thankyou.php | 90 - woocommerce/emails/admin-cancelled-order.php | 60 - woocommerce/emails/admin-failed-order.php | 61 - woocommerce/emails/admin-new-order.php | 58 - .../emails/customer-completed-order.php | 61 - woocommerce/emails/customer-invoice.php | 98 - .../emails/customer-new-account-blocks.php | 44 - woocommerce/emails/customer-new-account.php | 39 - woocommerce/emails/customer-note.php | 66 - woocommerce/emails/customer-on-hold-order.php | 60 - .../emails/customer-processing-order.php | 63 - .../emails/customer-refunded-order.php | 70 - .../emails/customer-reset-password.php | 47 - woocommerce/emails/email-addresses.php | 80 - woocommerce/emails/email-customer-details.php | 31 - woocommerce/emails/email-downloads.php | 68 - woocommerce/emails/email-footer.php | 75 - woocommerce/emails/email-header.php | 72 - woocommerce/emails/email-mobile-messaging.php | 20 - woocommerce/emails/email-order-details.php | 90 - woocommerce/emails/email-order-items.php | 104 - woocommerce/emails/email-styles.php | 264 - .../emails/plain/admin-cancelled-order.php | 58 - .../emails/plain/admin-failed-order.php | 58 - woocommerce/emails/plain/admin-new-order.php | 58 - .../emails/plain/customer-completed-order.php | 60 - woocommerce/emails/plain/customer-invoice.php | 78 - .../plain/customer-new-account-blocks.php | 45 - .../emails/plain/customer-new-account.php | 46 - woocommerce/emails/plain/customer-note.php | 67 - .../emails/plain/customer-on-hold-order.php | 59 - .../plain/customer-processing-order.php | 60 - .../emails/plain/customer-refunded-order.php | 65 - .../emails/plain/customer-reset-password.php | 43 - woocommerce/emails/plain/email-addresses.php | 66 - .../emails/plain/email-customer-details.php | 26 - woocommerce/emails/plain/email-downloads.php | 50 - .../emails/plain/email-order-details.php | 54 - .../emails/plain/email-order-items.php | 66 - woocommerce/global/breadcrumb.php | 43 - woocommerce/global/form-login.php | 61 - woocommerce/global/quantity-input.php | 64 - woocommerce/global/sidebar.php | 24 - woocommerce/global/wrapper-end.php | 52 - woocommerce/global/wrapper-start.php | 49 - woocommerce/loop/add-to-cart.php | 36 - woocommerce/loop/loop-end.php | 22 - woocommerce/loop/loop-start.php | 22 - woocommerce/loop/no-products-found.php | 23 - woocommerce/loop/orderby.php | 31 - woocommerce/loop/pagination.php | 51 - woocommerce/loop/price.php | 27 - woocommerce/loop/rating.php | 28 - woocommerce/loop/result-count.php | 40 - woocommerce/loop/sale-flash.php | 32 - woocommerce/myaccount/dashboard.php | 81 - woocommerce/myaccount/downloads.php | 47 - .../myaccount/form-add-payment-method.php | 61 - woocommerce/myaccount/form-edit-account.php | 76 - woocommerce/myaccount/form-edit-address.php | 56 - woocommerce/myaccount/form-login.php | 119 - woocommerce/myaccount/form-lost-password.php | 45 - woocommerce/myaccount/form-reset-password.php | 52 - .../myaccount/lost-password-confirmation.php | 27 - woocommerce/myaccount/my-account.php | 36 - woocommerce/myaccount/my-address.php | 77 - woocommerce/myaccount/my-downloads.php | 52 - woocommerce/myaccount/my-orders.php | 95 - woocommerce/myaccount/navigation.php | 35 - woocommerce/myaccount/orders.php | 104 - woocommerce/myaccount/payment-methods.php | 78 - woocommerce/myaccount/view-order.php | 56 - woocommerce/notices/error.php | 33 - woocommerce/notices/notice.php | 32 - woocommerce/notices/success.php | 30 - woocommerce/order/attribution-details.php | 112 - woocommerce/order/customer-history.php | 59 - woocommerce/order/form-tracking.php | 61 - woocommerce/order/order-again.php | 23 - woocommerce/order/order-details-customer.php | 66 - woocommerce/order/order-details-item.php | 68 - woocommerce/order/order-details.php | 115 - woocommerce/order/order-downloads.php | 73 - woocommerce/order/tracking.php | 60 - woocommerce/single-product.php | 6 - yarn.lock | 17 +- 162 files changed, 45 insertions(+), 23278 deletions(-) rename app/{CustomFields => CarbonFields}/Blocks.php (100%) rename app/{CustomFields => CarbonFields}/Blocks/example.css (100%) rename app/{CustomFields => CarbonFields}/Blocks/example.php (90%) rename app/{CustomFields => CarbonFields}/Blocks/example.view.php (100%) rename app/{CustomFields => CarbonFields}/Fields/about.php (100%) rename app/{CustomFields => CarbonFields}/Fields/home.php (100%) rename app/{CustomFields => CarbonFields}/OptionFields.php (100%) rename app/{CustomFields => CarbonFields}/PostFields.php (78%) delete mode 100644 app/Controllers/ProductController.php delete mode 100644 app/CustomFields/Fields/product.php delete mode 100644 app/CustomFields/Fields/product_variants.php delete mode 100644 app/Handlers/AjaxHandlers/addToCart.php delete mode 100644 app/Handlers/AjaxHandlers/applyCoupon.php delete mode 100644 app/Handlers/AjaxHandlers/removeFromCart.php delete mode 100644 jsconfig.json delete mode 100644 resources/assets/src/scripts/cart/add.js delete mode 100644 resources/assets/src/scripts/cart/cart.js delete mode 100644 resources/assets/src/scripts/cart/quantity.js delete mode 100644 resources/assets/src/scripts/cart/remove.js delete mode 100644 resources/assets/src/scripts/cart/variations.js delete mode 100644 resources/assets/src/scripts/rangeSlider.js delete mode 100644 resources/views/woocommerce/account.twig delete mode 100644 resources/views/woocommerce/cart.twig delete mode 100644 resources/views/woocommerce/checkout.twig delete mode 100644 resources/views/woocommerce/components/cartSmall.twig delete mode 100644 resources/views/woocommerce/product.twig delete mode 100644 resources/views/woocommerce/shop.twig delete mode 100644 todo.md delete mode 100644 woocommerce/archive-product.php delete mode 100644 woocommerce/auth/footer.php delete mode 100644 woocommerce/auth/form-grant-access.php delete mode 100644 woocommerce/auth/form-login.php delete mode 100644 woocommerce/auth/header.php delete mode 100644 woocommerce/block-notices/error.php delete mode 100644 woocommerce/block-notices/notice.php delete mode 100644 woocommerce/block-notices/success.php delete mode 100644 woocommerce/cart/cart-empty.php delete mode 100644 woocommerce/cart/cart-item-data.php delete mode 100644 woocommerce/cart/cart-shipping.php delete mode 100644 woocommerce/cart/cart-totals.php delete mode 100644 woocommerce/cart/cart.php delete mode 100644 woocommerce/cart/cross-sells.php delete mode 100644 woocommerce/cart/mini-cart.php delete mode 100644 woocommerce/cart/proceed-to-checkout-button.php delete mode 100644 woocommerce/cart/shipping-calculator.php delete mode 100644 woocommerce/checkout/cart-errors.php delete mode 100644 woocommerce/checkout/form-billing.php delete mode 100644 woocommerce/checkout/form-checkout.php delete mode 100644 woocommerce/checkout/form-coupon.php delete mode 100644 woocommerce/checkout/form-login.php delete mode 100644 woocommerce/checkout/form-pay.php delete mode 100644 woocommerce/checkout/form-shipping.php delete mode 100644 woocommerce/checkout/form-verify-email.php delete mode 100644 woocommerce/checkout/order-receipt.php delete mode 100644 woocommerce/checkout/order-received.php delete mode 100644 woocommerce/checkout/payment-method.php delete mode 100644 woocommerce/checkout/payment.php delete mode 100644 woocommerce/checkout/review-order.php delete mode 100644 woocommerce/checkout/terms.php delete mode 100644 woocommerce/checkout/thankyou.php delete mode 100644 woocommerce/emails/admin-cancelled-order.php delete mode 100644 woocommerce/emails/admin-failed-order.php delete mode 100644 woocommerce/emails/admin-new-order.php delete mode 100644 woocommerce/emails/customer-completed-order.php delete mode 100644 woocommerce/emails/customer-invoice.php delete mode 100644 woocommerce/emails/customer-new-account-blocks.php delete mode 100644 woocommerce/emails/customer-new-account.php delete mode 100644 woocommerce/emails/customer-note.php delete mode 100644 woocommerce/emails/customer-on-hold-order.php delete mode 100644 woocommerce/emails/customer-processing-order.php delete mode 100644 woocommerce/emails/customer-refunded-order.php delete mode 100644 woocommerce/emails/customer-reset-password.php delete mode 100644 woocommerce/emails/email-addresses.php delete mode 100644 woocommerce/emails/email-customer-details.php delete mode 100644 woocommerce/emails/email-downloads.php delete mode 100644 woocommerce/emails/email-footer.php delete mode 100644 woocommerce/emails/email-header.php delete mode 100644 woocommerce/emails/email-mobile-messaging.php delete mode 100644 woocommerce/emails/email-order-details.php delete mode 100644 woocommerce/emails/email-order-items.php delete mode 100644 woocommerce/emails/email-styles.php delete mode 100644 woocommerce/emails/plain/admin-cancelled-order.php delete mode 100644 woocommerce/emails/plain/admin-failed-order.php delete mode 100644 woocommerce/emails/plain/admin-new-order.php delete mode 100644 woocommerce/emails/plain/customer-completed-order.php delete mode 100644 woocommerce/emails/plain/customer-invoice.php delete mode 100644 woocommerce/emails/plain/customer-new-account-blocks.php delete mode 100644 woocommerce/emails/plain/customer-new-account.php delete mode 100644 woocommerce/emails/plain/customer-note.php delete mode 100644 woocommerce/emails/plain/customer-on-hold-order.php delete mode 100644 woocommerce/emails/plain/customer-processing-order.php delete mode 100644 woocommerce/emails/plain/customer-refunded-order.php delete mode 100644 woocommerce/emails/plain/customer-reset-password.php delete mode 100644 woocommerce/emails/plain/email-addresses.php delete mode 100644 woocommerce/emails/plain/email-customer-details.php delete mode 100644 woocommerce/emails/plain/email-downloads.php delete mode 100644 woocommerce/emails/plain/email-order-details.php delete mode 100644 woocommerce/emails/plain/email-order-items.php delete mode 100644 woocommerce/global/breadcrumb.php delete mode 100644 woocommerce/global/form-login.php delete mode 100644 woocommerce/global/quantity-input.php delete mode 100644 woocommerce/global/sidebar.php delete mode 100644 woocommerce/global/wrapper-end.php delete mode 100644 woocommerce/global/wrapper-start.php delete mode 100644 woocommerce/loop/add-to-cart.php delete mode 100644 woocommerce/loop/loop-end.php delete mode 100644 woocommerce/loop/loop-start.php delete mode 100644 woocommerce/loop/no-products-found.php delete mode 100644 woocommerce/loop/orderby.php delete mode 100644 woocommerce/loop/pagination.php delete mode 100644 woocommerce/loop/price.php delete mode 100644 woocommerce/loop/rating.php delete mode 100644 woocommerce/loop/result-count.php delete mode 100644 woocommerce/loop/sale-flash.php delete mode 100644 woocommerce/myaccount/dashboard.php delete mode 100644 woocommerce/myaccount/downloads.php delete mode 100644 woocommerce/myaccount/form-add-payment-method.php delete mode 100644 woocommerce/myaccount/form-edit-account.php delete mode 100644 woocommerce/myaccount/form-edit-address.php delete mode 100644 woocommerce/myaccount/form-login.php delete mode 100644 woocommerce/myaccount/form-lost-password.php delete mode 100644 woocommerce/myaccount/form-reset-password.php delete mode 100644 woocommerce/myaccount/lost-password-confirmation.php delete mode 100644 woocommerce/myaccount/my-account.php delete mode 100644 woocommerce/myaccount/my-address.php delete mode 100644 woocommerce/myaccount/my-downloads.php delete mode 100644 woocommerce/myaccount/my-orders.php delete mode 100644 woocommerce/myaccount/navigation.php delete mode 100644 woocommerce/myaccount/orders.php delete mode 100644 woocommerce/myaccount/payment-methods.php delete mode 100644 woocommerce/myaccount/view-order.php delete mode 100644 woocommerce/notices/error.php delete mode 100644 woocommerce/notices/notice.php delete mode 100644 woocommerce/notices/success.php delete mode 100644 woocommerce/order/attribution-details.php delete mode 100644 woocommerce/order/customer-history.php delete mode 100644 woocommerce/order/form-tracking.php delete mode 100644 woocommerce/order/order-again.php delete mode 100644 woocommerce/order/order-details-customer.php delete mode 100644 woocommerce/order/order-details-item.php delete mode 100644 woocommerce/order/order-details.php delete mode 100644 woocommerce/order/order-downloads.php delete mode 100644 woocommerce/order/tracking.php delete mode 100644 woocommerce/single-product.php diff --git a/app/Admin/AdminOptions.php b/app/Admin/AdminOptions.php index 9e00a43..591d379 100644 --- a/app/Admin/AdminOptions.php +++ b/app/Admin/AdminOptions.php @@ -26,7 +26,6 @@ public function index(): void 'script', 'style' ]); - remove_theme_support('block-templates'); remove_theme_support('core-block-patterns'); @@ -34,8 +33,6 @@ public function index(): void add_theme_support('post-thumbnails'); add_theme_support('custom-logo'); add_theme_support('responsive-embeds'); - - add_theme_support('woocommerce'); } public function manageAdminAccess(): void diff --git a/app/CustomFields/Blocks.php b/app/CarbonFields/Blocks.php similarity index 100% rename from app/CustomFields/Blocks.php rename to app/CarbonFields/Blocks.php diff --git a/app/CustomFields/Blocks/example.css b/app/CarbonFields/Blocks/example.css similarity index 100% rename from app/CustomFields/Blocks/example.css rename to app/CarbonFields/Blocks/example.css diff --git a/app/CustomFields/Blocks/example.php b/app/CarbonFields/Blocks/example.php similarity index 90% rename from app/CustomFields/Blocks/example.php rename to app/CarbonFields/Blocks/example.php index 13fbfb8..02715bd 100644 --- a/app/CustomFields/Blocks/example.php +++ b/app/CarbonFields/Blocks/example.php @@ -5,7 +5,7 @@ wp_register_style( 'crb-my-shiny-gutenberg-block-stylesheet', - get_stylesheet_directory_uri() . '../app/CustomFields/Blocks/example.css' + get_stylesheet_directory_uri() . '../app/CarbonFields/Blocks/example.css' ); diff --git a/app/CustomFields/Blocks/example.view.php b/app/CarbonFields/Blocks/example.view.php similarity index 100% rename from app/CustomFields/Blocks/example.view.php rename to app/CarbonFields/Blocks/example.view.php diff --git a/app/CustomFields/Fields/about.php b/app/CarbonFields/Fields/about.php similarity index 100% rename from app/CustomFields/Fields/about.php rename to app/CarbonFields/Fields/about.php diff --git a/app/CustomFields/Fields/home.php b/app/CarbonFields/Fields/home.php similarity index 100% rename from app/CustomFields/Fields/home.php rename to app/CarbonFields/Fields/home.php diff --git a/app/CustomFields/OptionFields.php b/app/CarbonFields/OptionFields.php similarity index 100% rename from app/CustomFields/OptionFields.php rename to app/CarbonFields/OptionFields.php diff --git a/app/CustomFields/PostFields.php b/app/CarbonFields/PostFields.php similarity index 78% rename from app/CustomFields/PostFields.php rename to app/CarbonFields/PostFields.php index f9bd86c..4c06485 100644 --- a/app/CustomFields/PostFields.php +++ b/app/CarbonFields/PostFields.php @@ -6,11 +6,8 @@ add_action('carbon_fields_register_fields', function () { include __DIR__ . '/Fields/home.php'; include __DIR__ . '/Fields/about.php'; - include __DIR__ . '/Fields/product.php'; // Container::make( 'comment_meta', 'Comment fields' ) // ->add_fields( array( // Field::make( 'text', 'comment_rating', 'Rating' ), // ) ); }); - -include __DIR__ . '/Fields/product_variants.php'; diff --git a/app/Controllers/CategoryController.php b/app/Controllers/CategoryController.php index e7dd242..14ef841 100644 --- a/app/Controllers/CategoryController.php +++ b/app/Controllers/CategoryController.php @@ -19,7 +19,7 @@ public function __construct() public function index(): array { $this->data['term'] = Timber::get_term(); - // $this->data['posts'] = Timber::get_posts(); + $this->data['posts'] = Timber::get_posts(); return $this->data; } diff --git a/app/Controllers/Controller.php b/app/Controllers/Controller.php index 932e002..3749dcc 100644 --- a/app/Controllers/Controller.php +++ b/app/Controllers/Controller.php @@ -6,13 +6,5 @@ class Controller { public function __construct() { - add_filter('timber/context', function ($context) { - $context['cart'] = WC()->cart; - $context['checkout_link'] = wc_get_checkout_url(); - $context['cart_link'] = wc_get_cart_url(); - $context['currency_symbol'] = get_woocommerce_currency_symbol(); - - return $context; - }); } } diff --git a/app/Controllers/ProductController.php b/app/Controllers/ProductController.php deleted file mode 100644 index 58ea61f..0000000 --- a/app/Controllers/ProductController.php +++ /dev/null @@ -1,62 +0,0 @@ -data = Timber::context(); - } - - public function index(): array - { - $this->data['product'] = wc_get_product(get_the_ID()); - $this->data['post'] = Timber::get_post(); - $this->data['categories'] = get_the_terms(get_the_ID(), 'product_cat'); - - $related_limit = wc_get_loop_prop('columns'); - $related_ids = wc_get_related_products(get_the_ID(), $related_limit); - $this->data['related_products'] = Timber::get_posts($related_ids); - - return $this->data; - } - - public function category(): array - { - $queried_object = get_queried_object(); - $term_id = $queried_object->term_id; - $this->data['category'] = get_term($term_id, 'product_cat'); - $this->data['title'] = single_term_title('', false); - - return $this->data; - } - - public function archive(): array - { - $this->data['attributes'] = array_map(fn ($taxonomy) => [ - 'label' => $taxonomy->attribute_label, - 'name' => $taxonomy->attribute_name, - 'terms' => get_terms([ - 'taxonomy' => 'pa_' . $taxonomy->attribute_name, - 'hide_empty' => false, - ]) ?? [], - ], wc_get_attribute_taxonomies()); - - return $this->data; - } - - public function cart(): array - { - $this->data['coupons_enabled'] = wc_coupons_enabled(); - - return $this->data; - } -} diff --git a/app/CustomFields/Fields/product.php b/app/CustomFields/Fields/product.php deleted file mode 100644 index c633a5f..0000000 --- a/app/CustomFields/Fields/product.php +++ /dev/null @@ -1,11 +0,0 @@ -where('post_type', '=', 'product') - ->add_fields([ - Field::make('text', 'sub_title', 'Sub-title'), - ]); diff --git a/app/CustomFields/Fields/product_variants.php b/app/CustomFields/Fields/product_variants.php deleted file mode 100644 index 343a187..0000000 --- a/app/CustomFields/Fields/product_variants.php +++ /dev/null @@ -1,5 +0,0 @@ - 'error', 'message' => 'nonce_error']); -} - -$product_id = absint($_POST['product_id']); -$variation_id = $_POST['variation'] ? absint($_POST['variation']) : 0; - -try { - $result = WC()->cart->add_to_cart($product_id, absint($_POST['quantity']), $variation_id); - if (!$result) { - wp_send_json(['type' => 'error', 'message' => 'Error adding to cart']); - } -} catch (Exception $e) { - wp_send_json(['type' => 'error', 'message' => $e->getMessage()]); -} - -$cart = WC()->cart->get_cart(); -$cart_data = []; - -foreach ($cart as $cart_item_key => $cart_item) { - $_product = $cart_item['data']; - $sale_price = null; - - if (!empty($_product->get_sale_price())) { - $sale_price = wc_price($_product->get_sale_price()); - } - - $item_data = [ - 'id' => $cart_item['product_id'], - 'name' => $_product->get_name(), - 'link' => get_permalink($cart_item['product_id']), - 'thumbnail' => $_product->get_image(), - 'quantity' => $cart_item['quantity'], - 'cart_item_key' => $result, - 'regular_price' => wc_price($_product->get_regular_price()), - 'sale_price' => $sale_price, - ]; - - $cart_data[] = $item_data; -} - -wp_send_json([ - 'type' => 'success', - 'message' => 'Product added to the cart.', - 'cart' => $cart_data, - 'total' => number_format(WC()->cart->get_cart_contents_total(), 2, '.', ''), - 'subTotal' => WC()->cart->get_subtotal(), - 'count' => WC()->cart->get_cart_contents_count(), -]); diff --git a/app/Handlers/AjaxHandlers/applyCoupon.php b/app/Handlers/AjaxHandlers/applyCoupon.php deleted file mode 100644 index 677b8b0..0000000 --- a/app/Handlers/AjaxHandlers/applyCoupon.php +++ /dev/null @@ -1,5 +0,0 @@ - 'error', 'message' => 'nonce_error']); -} diff --git a/app/Handlers/AjaxHandlers/removeFromCart.php b/app/Handlers/AjaxHandlers/removeFromCart.php deleted file mode 100644 index bccc586..0000000 --- a/app/Handlers/AjaxHandlers/removeFromCart.php +++ /dev/null @@ -1,25 +0,0 @@ - 'error', 'message' => 'nonce_error']); -} - -$key = sanitize_text_field($_POST['key']); - -$response = WC()->cart->remove_cart_item($key); - -$total = WC()->cart->get_cart_contents_total(); -$subTotal = WC()->cart->get_subtotal(); -$cartItemCount = WC()->cart->get_cart_contents_count(); - -if ($response) { - wp_send_json([ - 'type' => 'success', - 'message' => 'Product removed from the cart.', - 'total' => number_format($total, 2, '.', ''), - 'subTotal' => $subTotal, - 'count' => $cartItemCount - ]); -} else { - wp_send_json(['type' => 'error', 'response' => $response]); -} diff --git a/app/Handlers/ajax.php b/app/Handlers/ajax.php index 31e8c05..a10a9ee 100644 --- a/app/Handlers/ajax.php +++ b/app/Handlers/ajax.php @@ -2,7 +2,3 @@ add_ajax_action('login'); add_ajax_action('contact'); - -add_ajax_action('removeFromCart'); -add_ajax_action('addToCart'); -add_ajax_action('applyCoupon'); diff --git a/composer.json b/composer.json index 154faf1..8bd4451 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,7 @@ "htmlburger/carbon-fields": "^3.6", "timber/timber": "^2.0.0", "twig/twig": "^v3.8.0", - "wp-theme/core": "^1.1.4", + "wp-theme/core": "^1.0.4", "wpackagist-plugin/all-in-one-wp-migration": "*", "wpackagist-plugin/wordpress-seo": "*" }, @@ -42,9 +42,9 @@ "bootstrap/app.php", "app/helpers.php", "app/Handlers/ajax.php", - "app/CustomFields/OptionFields.php", - "app/CustomFields/PostFields.php", - "app/CustomFields/Blocks.php", + "app/CarbonFields/OptionFields.php", + "app/CarbonFields/PostFields.php", + "app/CarbonFields/Blocks.php", "routes/api.php" ] }, diff --git a/jsconfig.json b/jsconfig.json deleted file mode 100644 index 8cd106a..0000000 --- a/jsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "compilerOptions": { - "baseUrl": ".", - "paths": { - "@/*": ["resources/assets/src/scripts/*"] - } - } -} \ No newline at end of file diff --git a/package.json b/package.json index 9f60f4f..93fd421 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,6 @@ "devDependencies": { "git-commit-msg-linter": "^5.0.0", "laravel-mix": "^6.0.6", - "path": "^0.12.7", "prettier": "^3.2.5", "prettier-plugin-twig-melody": "^0.4.6", "sass": "^1.70.0", @@ -17,7 +16,6 @@ }, "dependencies": { "axios": "^1.6.7", - "nouislider": "^15.7.1", "sweetalert2": "^11.6.15" } } diff --git a/resources/assets/dist/css/bundle.min.css b/resources/assets/dist/css/bundle.min.css index 02b3e8f..fe7a73c 100644 --- a/resources/assets/dist/css/bundle.min.css +++ b/resources/assets/dist/css/bundle.min.css @@ -1,1431 +1 @@ -.swal2-popup.swal2-toast { - box-sizing: border-box; - grid-column: 1/4 !important; - grid-row: 1/4 !important; - grid-template-columns: min-content auto min-content; - padding: 1em; - overflow-y: hidden; - background: #fff; - box-shadow: 0 0 1px hsla(0, 0%, 0%, 0.075), 0 1px 2px hsla(0, 0%, 0%, 0.075), 1px 2px 4px hsla(0, 0%, 0%, 0.075), 1px 3px 8px hsla(0, 0%, 0%, 0.075), 2px 4px 16px hsla(0, 0%, 0%, 0.075); - pointer-events: all; -} -.swal2-popup.swal2-toast > * { - grid-column: 2; -} -.swal2-popup.swal2-toast .swal2-title { - margin: 0.5em 1em; - padding: 0; - font-size: 1em; - text-align: initial; -} -.swal2-popup.swal2-toast .swal2-loading { - justify-content: center; -} -.swal2-popup.swal2-toast .swal2-input { - height: 2em; - margin: 0.5em; - font-size: 1em; -} -.swal2-popup.swal2-toast .swal2-validation-message { - font-size: 1em; -} -.swal2-popup.swal2-toast .swal2-footer { - margin: 0.5em 0 0; - padding: 0.5em 0 0; - font-size: 0.8em; -} -.swal2-popup.swal2-toast .swal2-close { - grid-column: 3/3; - grid-row: 1/99; - align-self: center; - width: 0.8em; - height: 0.8em; - margin: 0; - font-size: 2em; -} -.swal2-popup.swal2-toast .swal2-html-container { - margin: 0.5em 1em; - padding: 0; - overflow: initial; - font-size: 1em; - text-align: initial; -} -.swal2-popup.swal2-toast .swal2-html-container:empty { - padding: 0; -} -.swal2-popup.swal2-toast .swal2-loader { - grid-column: 1; - grid-row: 1/99; - align-self: center; - width: 2em; - height: 2em; - margin: 0.25em; -} -.swal2-popup.swal2-toast .swal2-icon { - grid-column: 1; - grid-row: 1/99; - align-self: center; - width: 2em; - min-width: 2em; - height: 2em; - margin: 0 0.5em 0 0; -} -.swal2-popup.swal2-toast .swal2-icon .swal2-icon-content { - display: flex; - align-items: center; - font-size: 1.8em; - font-weight: bold; -} -.swal2-popup.swal2-toast .swal2-icon.swal2-success .swal2-success-ring { - width: 2em; - height: 2em; -} -.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line] { - top: 0.875em; - width: 1.375em; -} -.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left] { - left: 0.3125em; -} -.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right] { - right: 0.3125em; -} -.swal2-popup.swal2-toast .swal2-actions { - justify-content: flex-start; - height: auto; - margin: 0; - margin-top: 0.5em; - padding: 0 0.5em; -} -.swal2-popup.swal2-toast .swal2-styled { - margin: 0.25em 0.5em; - padding: 0.4em 0.6em; - font-size: 1em; -} -.swal2-popup.swal2-toast .swal2-success { - border-color: #a5dc86; -} -.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line] { - position: absolute; - width: 1.6em; - height: 3em; - border-radius: 50%; -} -.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=left] { - top: -0.8em; - left: -0.5em; - transform: rotate(-45deg); - transform-origin: 2em 2em; - border-radius: 4em 0 0 4em; -} -.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=right] { - top: -0.25em; - left: 0.9375em; - transform-origin: 0 1.5em; - border-radius: 0 4em 4em 0; -} -.swal2-popup.swal2-toast .swal2-success .swal2-success-ring { - width: 2em; - height: 2em; -} -.swal2-popup.swal2-toast .swal2-success .swal2-success-fix { - top: 0; - left: 0.4375em; - width: 0.4375em; - height: 2.6875em; -} -.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line] { - height: 0.3125em; -} -.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=tip] { - top: 1.125em; - left: 0.1875em; - width: 0.75em; -} -.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=long] { - top: 0.9375em; - right: 0.1875em; - width: 1.375em; -} -.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-tip { - animation: swal2-toast-animate-success-line-tip 0.75s; -} -.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-long { - animation: swal2-toast-animate-success-line-long 0.75s; -} -.swal2-popup.swal2-toast.swal2-show { - animation: swal2-toast-show 0.5s; -} -.swal2-popup.swal2-toast.swal2-hide { - animation: swal2-toast-hide 0.1s forwards; -} - -div:where(.swal2-container) { - display: grid; - position: fixed; - z-index: 1060; - inset: 0; - box-sizing: border-box; - grid-template-areas: "top-start top top-end" "center-start center center-end" "bottom-start bottom-center bottom-end"; - grid-template-rows: minmax(min-content, auto) minmax(min-content, auto) minmax(min-content, auto); - height: 100%; - padding: 0.625em; - overflow-x: hidden; - transition: background-color 0.1s; - -webkit-overflow-scrolling: touch; -} -div:where(.swal2-container).swal2-backdrop-show, div:where(.swal2-container).swal2-noanimation { - background: rgba(0, 0, 0, 0.4); -} -div:where(.swal2-container).swal2-backdrop-hide { - background: transparent !important; -} -div:where(.swal2-container).swal2-top-start, div:where(.swal2-container).swal2-center-start, div:where(.swal2-container).swal2-bottom-start { - grid-template-columns: minmax(0, 1fr) auto auto; -} -div:where(.swal2-container).swal2-top, div:where(.swal2-container).swal2-center, div:where(.swal2-container).swal2-bottom { - grid-template-columns: auto minmax(0, 1fr) auto; -} -div:where(.swal2-container).swal2-top-end, div:where(.swal2-container).swal2-center-end, div:where(.swal2-container).swal2-bottom-end { - grid-template-columns: auto auto minmax(0, 1fr); -} -div:where(.swal2-container).swal2-top-start > .swal2-popup { - align-self: start; -} -div:where(.swal2-container).swal2-top > .swal2-popup { - grid-column: 2; - place-self: start center; -} -div:where(.swal2-container).swal2-top-end > .swal2-popup, div:where(.swal2-container).swal2-top-right > .swal2-popup { - grid-column: 3; - place-self: start end; -} -div:where(.swal2-container).swal2-center-start > .swal2-popup, div:where(.swal2-container).swal2-center-left > .swal2-popup { - grid-row: 2; - align-self: center; -} -div:where(.swal2-container).swal2-center > .swal2-popup { - grid-column: 2; - grid-row: 2; - place-self: center center; -} -div:where(.swal2-container).swal2-center-end > .swal2-popup, div:where(.swal2-container).swal2-center-right > .swal2-popup { - grid-column: 3; - grid-row: 2; - place-self: center end; -} -div:where(.swal2-container).swal2-bottom-start > .swal2-popup, div:where(.swal2-container).swal2-bottom-left > .swal2-popup { - grid-column: 1; - grid-row: 3; - align-self: end; -} -div:where(.swal2-container).swal2-bottom > .swal2-popup { - grid-column: 2; - grid-row: 3; - place-self: end center; -} -div:where(.swal2-container).swal2-bottom-end > .swal2-popup, div:where(.swal2-container).swal2-bottom-right > .swal2-popup { - grid-column: 3; - grid-row: 3; - place-self: end end; -} -div:where(.swal2-container).swal2-grow-row > .swal2-popup, div:where(.swal2-container).swal2-grow-fullscreen > .swal2-popup { - grid-column: 1/4; - width: 100%; -} -div:where(.swal2-container).swal2-grow-column > .swal2-popup, div:where(.swal2-container).swal2-grow-fullscreen > .swal2-popup { - grid-row: 1/4; - align-self: stretch; -} -div:where(.swal2-container).swal2-no-transition { - transition: none !important; -} -div:where(.swal2-container) div:where(.swal2-popup) { - display: none; - position: relative; - box-sizing: border-box; - grid-template-columns: minmax(0, 100%); - width: 32em; - max-width: 100%; - padding: 0 0 1.25em; - border: none; - border-radius: 5px; - background: #fff; - color: #545454; - font-family: inherit; - font-size: 1rem; -} -div:where(.swal2-container) div:where(.swal2-popup):focus { - outline: none; -} -div:where(.swal2-container) div:where(.swal2-popup).swal2-loading { - overflow-y: hidden; -} -div:where(.swal2-container) h2:where(.swal2-title) { - position: relative; - max-width: 100%; - margin: 0; - padding: 0.8em 1em 0; - color: inherit; - font-size: 1.875em; - font-weight: 600; - text-align: center; - text-transform: none; - word-wrap: break-word; -} -div:where(.swal2-container) div:where(.swal2-actions) { - display: flex; - z-index: 1; - box-sizing: border-box; - flex-wrap: wrap; - align-items: center; - justify-content: center; - width: auto; - margin: 1.25em auto 0; - padding: 0; -} -div:where(.swal2-container) div:where(.swal2-actions):not(.swal2-loading) .swal2-styled[disabled] { - opacity: 0.4; -} -div:where(.swal2-container) div:where(.swal2-actions):not(.swal2-loading) .swal2-styled:hover { - background-image: linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1)); -} -div:where(.swal2-container) div:where(.swal2-actions):not(.swal2-loading) .swal2-styled:active { - background-image: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)); -} -div:where(.swal2-container) div:where(.swal2-loader) { - display: none; - align-items: center; - justify-content: center; - width: 2.2em; - height: 2.2em; - margin: 0 1.875em; - animation: swal2-rotate-loading 1.5s linear 0s infinite normal; - border-width: 0.25em; - border-style: solid; - border-radius: 100%; - border-color: #2778c4 transparent #2778c4 transparent; -} -div:where(.swal2-container) button:where(.swal2-styled) { - margin: 0.3125em; - padding: 0.625em 1.1em; - transition: box-shadow 0.1s; - box-shadow: 0 0 0 3px transparent; - font-weight: 500; -} -div:where(.swal2-container) button:where(.swal2-styled):not([disabled]) { - cursor: pointer; -} -div:where(.swal2-container) button:where(.swal2-styled).swal2-confirm { - border: 0; - border-radius: 0.25em; - background: initial; - background-color: #7066e0; - color: #fff; - font-size: 1em; -} -div:where(.swal2-container) button:where(.swal2-styled).swal2-confirm:focus { - box-shadow: 0 0 0 3px rgba(112, 102, 224, 0.5); -} -div:where(.swal2-container) button:where(.swal2-styled).swal2-deny { - border: 0; - border-radius: 0.25em; - background: initial; - background-color: #dc3741; - color: #fff; - font-size: 1em; -} -div:where(.swal2-container) button:where(.swal2-styled).swal2-deny:focus { - box-shadow: 0 0 0 3px rgba(220, 55, 65, 0.5); -} -div:where(.swal2-container) button:where(.swal2-styled).swal2-cancel { - border: 0; - border-radius: 0.25em; - background: initial; - background-color: #6e7881; - color: #fff; - font-size: 1em; -} -div:where(.swal2-container) button:where(.swal2-styled).swal2-cancel:focus { - box-shadow: 0 0 0 3px rgba(110, 120, 129, 0.5); -} -div:where(.swal2-container) button:where(.swal2-styled).swal2-default-outline:focus { - box-shadow: 0 0 0 3px rgba(100, 150, 200, 0.5); -} -div:where(.swal2-container) button:where(.swal2-styled):focus { - outline: none; -} -div:where(.swal2-container) button:where(.swal2-styled)::-moz-focus-inner { - border: 0; -} -div:where(.swal2-container) div:where(.swal2-footer) { - margin: 1em 0 0; - padding: 1em 1em 0; - border-top: 1px solid #eee; - color: inherit; - font-size: 1em; - text-align: center; -} -div:where(.swal2-container) .swal2-timer-progress-bar-container { - position: absolute; - right: 0; - bottom: 0; - left: 0; - grid-column: auto !important; - overflow: hidden; - border-bottom-right-radius: 5px; - border-bottom-left-radius: 5px; -} -div:where(.swal2-container) div:where(.swal2-timer-progress-bar) { - width: 100%; - height: 0.25em; - background: rgba(0, 0, 0, 0.2); -} -div:where(.swal2-container) img:where(.swal2-image) { - max-width: 100%; - margin: 2em auto 1em; -} -div:where(.swal2-container) button:where(.swal2-close) { - z-index: 2; - align-items: center; - justify-content: center; - width: 1.2em; - height: 1.2em; - margin-top: 0; - margin-right: 0; - margin-bottom: -1.2em; - padding: 0; - overflow: hidden; - transition: color 0.1s, box-shadow 0.1s; - border: none; - border-radius: 5px; - background: transparent; - color: #ccc; - font-family: monospace; - font-size: 2.5em; - cursor: pointer; - justify-self: end; -} -div:where(.swal2-container) button:where(.swal2-close):hover { - transform: none; - background: transparent; - color: #f27474; -} -div:where(.swal2-container) button:where(.swal2-close):focus { - outline: none; - box-shadow: inset 0 0 0 3px rgba(100, 150, 200, 0.5); -} -div:where(.swal2-container) button:where(.swal2-close)::-moz-focus-inner { - border: 0; -} -div:where(.swal2-container) .swal2-html-container { - z-index: 1; - justify-content: center; - margin: 1em 1.6em 0.3em; - padding: 0; - overflow: auto; - color: inherit; - font-size: 1.125em; - font-weight: normal; - line-height: normal; - text-align: center; - word-wrap: break-word; - word-break: break-word; -} -div:where(.swal2-container) input:where(.swal2-input), -div:where(.swal2-container) input:where(.swal2-file), -div:where(.swal2-container) textarea:where(.swal2-textarea), -div:where(.swal2-container) select:where(.swal2-select), -div:where(.swal2-container) div:where(.swal2-radio), -div:where(.swal2-container) label:where(.swal2-checkbox) { - margin: 1em 2em 3px; -} -div:where(.swal2-container) input:where(.swal2-input), -div:where(.swal2-container) input:where(.swal2-file), -div:where(.swal2-container) textarea:where(.swal2-textarea) { - box-sizing: border-box; - width: auto; - transition: border-color 0.1s, box-shadow 0.1s; - border: 1px solid #d9d9d9; - border-radius: 0.1875em; - background: transparent; - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.06), 0 0 0 3px transparent; - color: inherit; - font-size: 1.125em; -} -div:where(.swal2-container) input:where(.swal2-input).swal2-inputerror, -div:where(.swal2-container) input:where(.swal2-file).swal2-inputerror, -div:where(.swal2-container) textarea:where(.swal2-textarea).swal2-inputerror { - border-color: #f27474 !important; - box-shadow: 0 0 2px #f27474 !important; -} -div:where(.swal2-container) input:where(.swal2-input):focus, -div:where(.swal2-container) input:where(.swal2-file):focus, -div:where(.swal2-container) textarea:where(.swal2-textarea):focus { - border: 1px solid #b4dbed; - outline: none; - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.06), 0 0 0 3px rgba(100, 150, 200, 0.5); -} -div:where(.swal2-container) input:where(.swal2-input)::-moz-placeholder, div:where(.swal2-container) input:where(.swal2-file)::-moz-placeholder, div:where(.swal2-container) textarea:where(.swal2-textarea)::-moz-placeholder { - color: #ccc; -} -div:where(.swal2-container) input:where(.swal2-input)::placeholder, -div:where(.swal2-container) input:where(.swal2-file)::placeholder, -div:where(.swal2-container) textarea:where(.swal2-textarea)::placeholder { - color: #ccc; -} -div:where(.swal2-container) .swal2-range { - margin: 1em 2em 3px; - background: #fff; -} -div:where(.swal2-container) .swal2-range input { - width: 80%; -} -div:where(.swal2-container) .swal2-range output { - width: 20%; - color: inherit; - font-weight: 600; - text-align: center; -} -div:where(.swal2-container) .swal2-range input, -div:where(.swal2-container) .swal2-range output { - height: 2.625em; - padding: 0; - font-size: 1.125em; - line-height: 2.625em; -} -div:where(.swal2-container) .swal2-input { - height: 2.625em; - padding: 0 0.75em; -} -div:where(.swal2-container) .swal2-file { - width: 75%; - margin-right: auto; - margin-left: auto; - background: transparent; - font-size: 1.125em; -} -div:where(.swal2-container) .swal2-textarea { - height: 6.75em; - padding: 0.75em; -} -div:where(.swal2-container) .swal2-select { - min-width: 50%; - max-width: 100%; - padding: 0.375em 0.625em; - background: transparent; - color: inherit; - font-size: 1.125em; -} -div:where(.swal2-container) .swal2-radio, -div:where(.swal2-container) .swal2-checkbox { - align-items: center; - justify-content: center; - background: #fff; - color: inherit; -} -div:where(.swal2-container) .swal2-radio label, -div:where(.swal2-container) .swal2-checkbox label { - margin: 0 0.6em; - font-size: 1.125em; -} -div:where(.swal2-container) .swal2-radio input, -div:where(.swal2-container) .swal2-checkbox input { - flex-shrink: 0; - margin: 0 0.4em; -} -div:where(.swal2-container) label:where(.swal2-input-label) { - display: flex; - justify-content: center; - margin: 1em auto 0; -} -div:where(.swal2-container) div:where(.swal2-validation-message) { - align-items: center; - justify-content: center; - margin: 1em 0 0; - padding: 0.625em; - overflow: hidden; - background: #f0f0f0; - color: #666666; - font-size: 1em; - font-weight: 300; -} -div:where(.swal2-container) div:where(.swal2-validation-message)::before { - content: "!"; - display: inline-block; - width: 1.5em; - min-width: 1.5em; - height: 1.5em; - margin: 0 0.625em; - border-radius: 50%; - background-color: #f27474; - color: #fff; - font-weight: 600; - line-height: 1.5em; - text-align: center; -} -div:where(.swal2-container) .swal2-progress-steps { - flex-wrap: wrap; - align-items: center; - max-width: 100%; - margin: 1.25em auto; - padding: 0; - background: transparent; - font-weight: 600; -} -div:where(.swal2-container) .swal2-progress-steps li { - display: inline-block; - position: relative; -} -div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step { - z-index: 20; - flex-shrink: 0; - width: 2em; - height: 2em; - border-radius: 2em; - background: #2778c4; - color: #fff; - line-height: 2em; - text-align: center; -} -div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step { - background: #2778c4; -} -div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step ~ .swal2-progress-step { - background: #add8e6; - color: #fff; -} -div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step ~ .swal2-progress-step-line { - background: #add8e6; -} -div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step-line { - z-index: 10; - flex-shrink: 0; - width: 2.5em; - height: 0.4em; - margin: 0 -1px; - background: #2778c4; -} - -div:where(.swal2-icon) { - position: relative; - box-sizing: content-box; - justify-content: center; - width: 5em; - height: 5em; - margin: 2.5em auto 0.6em; - border: 0.25em solid transparent; - border-radius: 50%; - border-color: #000; - font-family: inherit; - line-height: 5em; - cursor: default; - -webkit-user-select: none; - -moz-user-select: none; - user-select: none; -} -div:where(.swal2-icon) .swal2-icon-content { - display: flex; - align-items: center; - font-size: 3.75em; -} -div:where(.swal2-icon).swal2-error { - border-color: #f27474; - color: #f27474; -} -div:where(.swal2-icon).swal2-error .swal2-x-mark { - position: relative; - flex-grow: 1; -} -div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line] { - display: block; - position: absolute; - top: 2.3125em; - width: 2.9375em; - height: 0.3125em; - border-radius: 0.125em; - background-color: #f27474; -} -div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line][class$=left] { - left: 1.0625em; - transform: rotate(45deg); -} -div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line][class$=right] { - right: 1em; - transform: rotate(-45deg); -} -div:where(.swal2-icon).swal2-error.swal2-icon-show { - animation: swal2-animate-error-icon 0.5s; -} -div:where(.swal2-icon).swal2-error.swal2-icon-show .swal2-x-mark { - animation: swal2-animate-error-x-mark 0.5s; -} -div:where(.swal2-icon).swal2-warning { - border-color: #facea8; - color: #f8bb86; -} -div:where(.swal2-icon).swal2-warning.swal2-icon-show { - animation: swal2-animate-error-icon 0.5s; -} -div:where(.swal2-icon).swal2-warning.swal2-icon-show .swal2-icon-content { - animation: swal2-animate-i-mark 0.5s; -} -div:where(.swal2-icon).swal2-info { - border-color: #9de0f6; - color: #3fc3ee; -} -div:where(.swal2-icon).swal2-info.swal2-icon-show { - animation: swal2-animate-error-icon 0.5s; -} -div:where(.swal2-icon).swal2-info.swal2-icon-show .swal2-icon-content { - animation: swal2-animate-i-mark 0.8s; -} -div:where(.swal2-icon).swal2-question { - border-color: #c9dae1; - color: #87adbd; -} -div:where(.swal2-icon).swal2-question.swal2-icon-show { - animation: swal2-animate-error-icon 0.5s; -} -div:where(.swal2-icon).swal2-question.swal2-icon-show .swal2-icon-content { - animation: swal2-animate-question-mark 0.8s; -} -div:where(.swal2-icon).swal2-success { - border-color: #a5dc86; - color: #a5dc86; -} -div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line] { - position: absolute; - width: 3.75em; - height: 7.5em; - border-radius: 50%; -} -div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line][class$=left] { - top: -0.4375em; - left: -2.0635em; - transform: rotate(-45deg); - transform-origin: 3.75em 3.75em; - border-radius: 7.5em 0 0 7.5em; -} -div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line][class$=right] { - top: -0.6875em; - left: 1.875em; - transform: rotate(-45deg); - transform-origin: 0 3.75em; - border-radius: 0 7.5em 7.5em 0; -} -div:where(.swal2-icon).swal2-success .swal2-success-ring { - position: absolute; - z-index: 2; - top: -0.25em; - left: -0.25em; - box-sizing: content-box; - width: 100%; - height: 100%; - border: 0.25em solid rgba(165, 220, 134, 0.3); - border-radius: 50%; -} -div:where(.swal2-icon).swal2-success .swal2-success-fix { - position: absolute; - z-index: 1; - top: 0.5em; - left: 1.625em; - width: 0.4375em; - height: 5.625em; - transform: rotate(-45deg); -} -div:where(.swal2-icon).swal2-success [class^=swal2-success-line] { - display: block; - position: absolute; - z-index: 2; - height: 0.3125em; - border-radius: 0.125em; - background-color: #a5dc86; -} -div:where(.swal2-icon).swal2-success [class^=swal2-success-line][class$=tip] { - top: 2.875em; - left: 0.8125em; - width: 1.5625em; - transform: rotate(45deg); -} -div:where(.swal2-icon).swal2-success [class^=swal2-success-line][class$=long] { - top: 2.375em; - right: 0.5em; - width: 2.9375em; - transform: rotate(-45deg); -} -div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-line-tip { - animation: swal2-animate-success-line-tip 0.75s; -} -div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-line-long { - animation: swal2-animate-success-line-long 0.75s; -} -div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-circular-line-right { - animation: swal2-rotate-success-circular-line 4.25s ease-in; -} - -[class^=swal2] { - -webkit-tap-highlight-color: transparent; -} - -.swal2-show { - animation: swal2-show 0.3s; -} - -.swal2-hide { - animation: swal2-hide 0.15s forwards; -} - -.swal2-noanimation { - transition: none; -} - -.swal2-scrollbar-measure { - position: absolute; - top: -9999px; - width: 50px; - height: 50px; - overflow: scroll; -} - -.swal2-rtl .swal2-close { - margin-right: initial; - margin-left: 0; -} -.swal2-rtl .swal2-timer-progress-bar { - right: 0; - left: auto; -} - -@keyframes swal2-toast-show { - 0% { - transform: translateY(-0.625em) rotateZ(2deg); - } - 33% { - transform: translateY(0) rotateZ(-2deg); - } - 66% { - transform: translateY(0.3125em) rotateZ(2deg); - } - 100% { - transform: translateY(0) rotateZ(0deg); - } -} -@keyframes swal2-toast-hide { - 100% { - transform: rotateZ(1deg); - opacity: 0; - } -} -@keyframes swal2-toast-animate-success-line-tip { - 0% { - top: 0.5625em; - left: 0.0625em; - width: 0; - } - 54% { - top: 0.125em; - left: 0.125em; - width: 0; - } - 70% { - top: 0.625em; - left: -0.25em; - width: 1.625em; - } - 84% { - top: 1.0625em; - left: 0.75em; - width: 0.5em; - } - 100% { - top: 1.125em; - left: 0.1875em; - width: 0.75em; - } -} -@keyframes swal2-toast-animate-success-line-long { - 0% { - top: 1.625em; - right: 1.375em; - width: 0; - } - 65% { - top: 1.25em; - right: 0.9375em; - width: 0; - } - 84% { - top: 0.9375em; - right: 0; - width: 1.125em; - } - 100% { - top: 0.9375em; - right: 0.1875em; - width: 1.375em; - } -} -@keyframes swal2-show { - 0% { - transform: scale(0.7); - } - 45% { - transform: scale(1.05); - } - 80% { - transform: scale(0.95); - } - 100% { - transform: scale(1); - } -} -@keyframes swal2-hide { - 0% { - transform: scale(1); - opacity: 1; - } - 100% { - transform: scale(0.5); - opacity: 0; - } -} -@keyframes swal2-animate-success-line-tip { - 0% { - top: 1.1875em; - left: 0.0625em; - width: 0; - } - 54% { - top: 1.0625em; - left: 0.125em; - width: 0; - } - 70% { - top: 2.1875em; - left: -0.375em; - width: 3.125em; - } - 84% { - top: 3em; - left: 1.3125em; - width: 1.0625em; - } - 100% { - top: 2.8125em; - left: 0.8125em; - width: 1.5625em; - } -} -@keyframes swal2-animate-success-line-long { - 0% { - top: 3.375em; - right: 2.875em; - width: 0; - } - 65% { - top: 3.375em; - right: 2.875em; - width: 0; - } - 84% { - top: 2.1875em; - right: 0; - width: 3.4375em; - } - 100% { - top: 2.375em; - right: 0.5em; - width: 2.9375em; - } -} -@keyframes swal2-rotate-success-circular-line { - 0% { - transform: rotate(-45deg); - } - 5% { - transform: rotate(-45deg); - } - 12% { - transform: rotate(-405deg); - } - 100% { - transform: rotate(-405deg); - } -} -@keyframes swal2-animate-error-x-mark { - 0% { - margin-top: 1.625em; - transform: scale(0.4); - opacity: 0; - } - 50% { - margin-top: 1.625em; - transform: scale(0.4); - opacity: 0; - } - 80% { - margin-top: -0.375em; - transform: scale(1.15); - } - 100% { - margin-top: 0; - transform: scale(1); - opacity: 1; - } -} -@keyframes swal2-animate-error-icon { - 0% { - transform: rotateX(100deg); - opacity: 0; - } - 100% { - transform: rotateX(0deg); - opacity: 1; - } -} -@keyframes swal2-rotate-loading { - 0% { - transform: rotate(0deg); - } - 100% { - transform: rotate(360deg); - } -} -@keyframes swal2-animate-question-mark { - 0% { - transform: rotateY(-360deg); - } - 100% { - transform: rotateY(0); - } -} -@keyframes swal2-animate-i-mark { - 0% { - transform: rotateZ(45deg); - opacity: 0; - } - 25% { - transform: rotateZ(-25deg); - opacity: 0.4; - } - 50% { - transform: rotateZ(15deg); - opacity: 0.8; - } - 75% { - transform: rotateZ(-5deg); - opacity: 1; - } - 100% { - transform: rotateX(0); - opacity: 1; - } -} -body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown) { - overflow: hidden; -} -body.swal2-height-auto { - height: auto !important; -} -body.swal2-no-backdrop .swal2-container { - background-color: transparent !important; - pointer-events: none; -} -body.swal2-no-backdrop .swal2-container .swal2-popup { - pointer-events: all; -} -body.swal2-no-backdrop .swal2-container .swal2-modal { - box-shadow: 0 0 10px rgba(0, 0, 0, 0.4); -} -@media print { - body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown) { - overflow-y: scroll !important; - } - body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown) > [aria-hidden=true] { - display: none; - } - body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown) .swal2-container { - position: static !important; - } -} -body.swal2-toast-shown .swal2-container { - box-sizing: border-box; - width: 360px; - max-width: 100%; - background-color: transparent; - pointer-events: none; -} -body.swal2-toast-shown .swal2-container.swal2-top { - inset: 0 auto auto 50%; - transform: translateX(-50%); -} -body.swal2-toast-shown .swal2-container.swal2-top-end, body.swal2-toast-shown .swal2-container.swal2-top-right { - inset: 0 0 auto auto; -} -body.swal2-toast-shown .swal2-container.swal2-top-start, body.swal2-toast-shown .swal2-container.swal2-top-left { - inset: 0 auto auto 0; -} -body.swal2-toast-shown .swal2-container.swal2-center-start, body.swal2-toast-shown .swal2-container.swal2-center-left { - inset: 50% auto auto 0; - transform: translateY(-50%); -} -body.swal2-toast-shown .swal2-container.swal2-center { - inset: 50% auto auto 50%; - transform: translate(-50%, -50%); -} -body.swal2-toast-shown .swal2-container.swal2-center-end, body.swal2-toast-shown .swal2-container.swal2-center-right { - inset: 50% 0 auto auto; - transform: translateY(-50%); -} -body.swal2-toast-shown .swal2-container.swal2-bottom-start, body.swal2-toast-shown .swal2-container.swal2-bottom-left { - inset: auto auto 0 0; -} -body.swal2-toast-shown .swal2-container.swal2-bottom { - inset: auto auto 0 50%; - transform: translateX(-50%); -} -body.swal2-toast-shown .swal2-container.swal2-bottom-end, body.swal2-toast-shown .swal2-container.swal2-bottom-right { - inset: auto 0 0 auto; -} - -.noUi-target, .noUi-target * { - -webkit-touch-callout: none; - -webkit-tap-highlight-color: transparent; - -webkit-user-select: none; - touch-action: none; - -moz-user-select: none; - user-select: none; - box-sizing: border-box; -} - -.noUi-target { - position: relative; -} - -.noUi-base, .noUi-connects { - width: 100%; - height: 100%; - position: relative; - z-index: 1; -} - -.noUi-connects { - overflow: hidden; - z-index: 0; -} - -.noUi-connect, .noUi-origin { - will-change: transform; - position: absolute; - z-index: 1; - top: 0; - right: 0; - height: 100%; - width: 100%; - -ms-transform-origin: 0 0; - -webkit-transform-origin: 0 0; - -webkit-transform-style: preserve-3d; - transform-origin: 0 0; - transform-style: flat; -} - -.noUi-txt-dir-rtl.noUi-horizontal .noUi-origin { - left: 0; - right: auto; -} - -.noUi-vertical .noUi-origin { - top: -100%; - width: 0; -} - -.noUi-horizontal .noUi-origin { - height: 0; -} - -.noUi-handle { - backface-visibility: hidden; - position: absolute; -} - -.noUi-touch-area { - height: 100%; - width: 100%; -} - -.noUi-state-tap .noUi-connect, .noUi-state-tap .noUi-origin { - transition: transform 0.3s; -} - -.noUi-state-drag * { - cursor: inherit !important; -} - -.noUi-horizontal { - height: 18px; -} - -.noUi-horizontal .noUi-handle { - width: 34px; - height: 28px; - right: -17px; - top: -6px; -} - -.noUi-vertical { - width: 18px; -} - -.noUi-vertical .noUi-handle { - width: 28px; - height: 34px; - right: -6px; - bottom: -17px; -} - -.noUi-txt-dir-rtl.noUi-horizontal .noUi-handle { - left: -17px; - right: auto; -} - -.noUi-target { - background: #FAFAFA; - border-radius: 4px; - border: 1px solid #D3D3D3; - box-shadow: inset 0 1px 1px #F0F0F0, 0 3px 6px -5px #BBB; -} - -.noUi-connects { - border-radius: 3px; -} - -.noUi-connect { - background: #3FB8AF; -} - -.noUi-draggable { - cursor: ew-resize; -} - -.noUi-vertical .noUi-draggable { - cursor: ns-resize; -} - -.noUi-handle { - border: 1px solid #D9D9D9; - border-radius: 3px; - background: #FFF; - cursor: default; - box-shadow: inset 0 0 1px #FFF, inset 0 1px 7px #EBEBEB, 0 3px 6px -3px #BBB; -} - -.noUi-active { - box-shadow: inset 0 0 1px #FFF, inset 0 1px 7px #DDD, 0 3px 6px -3px #BBB; -} - -.noUi-handle:after, .noUi-handle:before { - content: ""; - display: block; - position: absolute; - height: 14px; - width: 1px; - background: #E8E7E6; - left: 14px; - top: 6px; -} - -.noUi-handle:after { - left: 17px; -} - -.noUi-vertical .noUi-handle:after, .noUi-vertical .noUi-handle:before { - width: 14px; - height: 1px; - left: 6px; - top: 14px; -} - -.noUi-vertical .noUi-handle:after { - top: 17px; -} - -[disabled] .noUi-connect { - background: #B8B8B8; -} - -[disabled] .noUi-handle, [disabled].noUi-handle, [disabled].noUi-target { - cursor: not-allowed; -} - -.noUi-pips, .noUi-pips * { - box-sizing: border-box; -} - -.noUi-pips { - position: absolute; - color: #999; -} - -.noUi-value { - position: absolute; - white-space: nowrap; - text-align: center; -} - -.noUi-value-sub { - color: #ccc; - font-size: 10px; -} - -.noUi-marker { - position: absolute; - background: #CCC; -} - -.noUi-marker-sub { - background: #AAA; -} - -.noUi-marker-large { - background: #AAA; -} - -.noUi-pips-horizontal { - padding: 10px 0; - height: 80px; - top: 100%; - left: 0; - width: 100%; -} - -.noUi-value-horizontal { - transform: translate(-50%, 50%); -} - -.noUi-rtl .noUi-value-horizontal { - transform: translate(50%, 50%); -} - -.noUi-marker-horizontal.noUi-marker { - margin-left: -1px; - width: 2px; - height: 5px; -} - -.noUi-marker-horizontal.noUi-marker-sub { - height: 10px; -} - -.noUi-marker-horizontal.noUi-marker-large { - height: 15px; -} - -.noUi-pips-vertical { - padding: 0 10px; - height: 100%; - top: 0; - left: 100%; -} - -.noUi-value-vertical { - transform: translate(0, -50%); - padding-left: 25px; -} - -.noUi-rtl .noUi-value-vertical { - transform: translate(0, 50%); -} - -.noUi-marker-vertical.noUi-marker { - width: 5px; - height: 2px; - margin-top: -1px; -} - -.noUi-marker-vertical.noUi-marker-sub { - width: 10px; -} - -.noUi-marker-vertical.noUi-marker-large { - width: 15px; -} - -.noUi-tooltip { - display: block; - position: absolute; - border: 1px solid #D9D9D9; - border-radius: 3px; - background: #fff; - color: #000; - padding: 5px; - text-align: center; - white-space: nowrap; -} - -.noUi-horizontal .noUi-tooltip { - transform: translate(-50%, 0); - left: 50%; - bottom: 120%; -} - -.noUi-vertical .noUi-tooltip { - transform: translate(0, -50%); - top: 50%; - right: 120%; -} - -.noUi-horizontal .noUi-origin > .noUi-tooltip { - transform: translate(50%, 0); - left: auto; - bottom: 10px; -} - -.noUi-vertical .noUi-origin > .noUi-tooltip { - transform: translate(0, -18px); - top: auto; - right: 28px; -} - -.preloader-main { - position: absolute; - inset: 0; - width: 100%; - height: 100%; - pointer-events: none; - transition: opacity 0.2s ease-in-out; - z-index: -1; - opacity: 0; -} - -.js-preloading.js-preloader-main { - background: rgba(255, 255, 255, 0.78) url(../images/preloader.svg) no-repeat 50% 50%; - position: fixed; - z-index: 300; - pointer-events: all; - opacity: 1; -} - -@media screen and (min-width: 1024px) { - .js-preloading.js-preloader-main { - background: rgba(255, 255, 255, 0.78) url(../images/preloader.svg) 50%/7% no-repeat; - } -} -img { - display: block; - max-width: 100%; - height: auto; -} - -.dropdown:hover .dropdown-menu { - display: block; -} - -.thumb-sm img { - width: 100px; - max-width: unset; -} - -.js-remove-from-cart i { - pointer-events: none; -} +.swal2-popup.swal2-toast{background:#fff;box-shadow:0 0 1px rgba(0,0,0,.075),0 1px 2px rgba(0,0,0,.075),1px 2px 4px rgba(0,0,0,.075),1px 3px 8px rgba(0,0,0,.075),2px 4px 16px rgba(0,0,0,.075);box-sizing:border-box;grid-column:1/4!important;grid-row:1/4!important;grid-template-columns:min-content auto min-content;overflow-y:hidden;padding:1em;pointer-events:all}.swal2-popup.swal2-toast>*{grid-column:2}.swal2-popup.swal2-toast .swal2-title{font-size:1em;margin:.5em 1em;padding:0;text-align:initial}.swal2-popup.swal2-toast .swal2-loading{justify-content:center}.swal2-popup.swal2-toast .swal2-input{font-size:1em;height:2em;margin:.5em}.swal2-popup.swal2-toast .swal2-validation-message{font-size:1em}.swal2-popup.swal2-toast .swal2-footer{font-size:.8em;margin:.5em 0 0;padding:.5em 0 0}.swal2-popup.swal2-toast .swal2-close{align-self:center;font-size:2em;grid-column:3/3;grid-row:1/99;height:.8em;margin:0;width:.8em}.swal2-popup.swal2-toast .swal2-html-container{font-size:1em;margin:.5em 1em;overflow:initial;padding:0;text-align:initial}.swal2-popup.swal2-toast .swal2-html-container:empty{padding:0}.swal2-popup.swal2-toast .swal2-loader{align-self:center;grid-column:1;grid-row:1/99;height:2em;margin:.25em;width:2em}.swal2-popup.swal2-toast .swal2-icon{align-self:center;grid-column:1;grid-row:1/99;height:2em;margin:0 .5em 0 0;min-width:2em;width:2em}.swal2-popup.swal2-toast .swal2-icon .swal2-icon-content{align-items:center;display:flex;font-size:1.8em;font-weight:bold}.swal2-popup.swal2-toast .swal2-icon.swal2-success .swal2-success-ring{height:2em;width:2em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line]{top:.875em;width:1.375em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:.3125em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:.3125em}.swal2-popup.swal2-toast .swal2-actions{height:auto;justify-content:flex-start;margin:.5em 0 0;padding:0 .5em}.swal2-popup.swal2-toast .swal2-styled{font-size:1em;margin:.25em .5em;padding:.4em .6em}.swal2-popup.swal2-toast .swal2-success{border-color:#a5dc86}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line]{border-radius:50%;height:3em;position:absolute;width:1.6em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=left]{border-radius:4em 0 0 4em;left:-.5em;top:-.8em;transform:rotate(-45deg);transform-origin:2em 2em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=right]{border-radius:0 4em 4em 0;left:.9375em;top:-.25em;transform-origin:0 1.5em}.swal2-popup.swal2-toast .swal2-success .swal2-success-ring{height:2em;width:2em}.swal2-popup.swal2-toast .swal2-success .swal2-success-fix{height:2.6875em;left:.4375em;top:0;width:.4375em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line]{height:.3125em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=tip]{left:.1875em;top:1.125em;width:.75em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=long]{right:.1875em;top:.9375em;width:1.375em}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-tip{animation:swal2-toast-animate-success-line-tip .75s}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-long{animation:swal2-toast-animate-success-line-long .75s}.swal2-popup.swal2-toast.swal2-show{animation:swal2-toast-show .5s}.swal2-popup.swal2-toast.swal2-hide{animation:swal2-toast-hide .1s forwards}div:where(.swal2-container){-webkit-overflow-scrolling:touch;box-sizing:border-box;display:grid;grid-template-areas:"top-start top top-end" "center-start center center-end" "bottom-start bottom-center bottom-end";grid-template-rows:minmax(min-content,auto) minmax(min-content,auto) minmax(min-content,auto);height:100%;inset:0;overflow-x:hidden;padding:.625em;position:fixed;transition:background-color .1s;z-index:1060}div:where(.swal2-container).swal2-backdrop-show,div:where(.swal2-container).swal2-noanimation{background:rgba(0,0,0,.4)}div:where(.swal2-container).swal2-backdrop-hide{background:transparent!important}div:where(.swal2-container).swal2-bottom-start,div:where(.swal2-container).swal2-center-start,div:where(.swal2-container).swal2-top-start{grid-template-columns:minmax(0,1fr) auto auto}div:where(.swal2-container).swal2-bottom,div:where(.swal2-container).swal2-center,div:where(.swal2-container).swal2-top{grid-template-columns:auto minmax(0,1fr) auto}div:where(.swal2-container).swal2-bottom-end,div:where(.swal2-container).swal2-center-end,div:where(.swal2-container).swal2-top-end{grid-template-columns:auto auto minmax(0,1fr)}div:where(.swal2-container).swal2-top-start>.swal2-popup{align-self:start}div:where(.swal2-container).swal2-top>.swal2-popup{grid-column:2;place-self:start center}div:where(.swal2-container).swal2-top-end>.swal2-popup,div:where(.swal2-container).swal2-top-right>.swal2-popup{grid-column:3;place-self:start end}div:where(.swal2-container).swal2-center-left>.swal2-popup,div:where(.swal2-container).swal2-center-start>.swal2-popup{align-self:center;grid-row:2}div:where(.swal2-container).swal2-center>.swal2-popup{grid-column:2;grid-row:2;place-self:center center}div:where(.swal2-container).swal2-center-end>.swal2-popup,div:where(.swal2-container).swal2-center-right>.swal2-popup{grid-column:3;grid-row:2;place-self:center end}div:where(.swal2-container).swal2-bottom-left>.swal2-popup,div:where(.swal2-container).swal2-bottom-start>.swal2-popup{align-self:end;grid-column:1;grid-row:3}div:where(.swal2-container).swal2-bottom>.swal2-popup{grid-column:2;grid-row:3;place-self:end center}div:where(.swal2-container).swal2-bottom-end>.swal2-popup,div:where(.swal2-container).swal2-bottom-right>.swal2-popup{grid-column:3;grid-row:3;place-self:end end}div:where(.swal2-container).swal2-grow-fullscreen>.swal2-popup,div:where(.swal2-container).swal2-grow-row>.swal2-popup{grid-column:1/4;width:100%}div:where(.swal2-container).swal2-grow-column>.swal2-popup,div:where(.swal2-container).swal2-grow-fullscreen>.swal2-popup{align-self:stretch;grid-row:1/4}div:where(.swal2-container).swal2-no-transition{transition:none!important}div:where(.swal2-container) div:where(.swal2-popup){background:#fff;border:none;border-radius:5px;box-sizing:border-box;color:#545454;display:none;font-family:inherit;font-size:1rem;grid-template-columns:minmax(0,100%);max-width:100%;padding:0 0 1.25em;position:relative;width:32em}div:where(.swal2-container) div:where(.swal2-popup):focus{outline:none}div:where(.swal2-container) div:where(.swal2-popup).swal2-loading{overflow-y:hidden}div:where(.swal2-container) h2:where(.swal2-title){word-wrap:break-word;color:inherit;font-size:1.875em;font-weight:600;margin:0;max-width:100%;padding:.8em 1em 0;position:relative;text-align:center;text-transform:none}div:where(.swal2-container) div:where(.swal2-actions){align-items:center;box-sizing:border-box;display:flex;flex-wrap:wrap;justify-content:center;margin:1.25em auto 0;padding:0;width:auto;z-index:1}div:where(.swal2-container) div:where(.swal2-actions):not(.swal2-loading) .swal2-styled[disabled]{opacity:.4}div:where(.swal2-container) div:where(.swal2-actions):not(.swal2-loading) .swal2-styled:hover{background-image:linear-gradient(rgba(0,0,0,.1),rgba(0,0,0,.1))}div:where(.swal2-container) div:where(.swal2-actions):not(.swal2-loading) .swal2-styled:active{background-image:linear-gradient(rgba(0,0,0,.2),rgba(0,0,0,.2))}div:where(.swal2-container) div:where(.swal2-loader){align-items:center;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border-color:#2778c4 transparent;border-radius:100%;border-style:solid;border-width:.25em;display:none;height:2.2em;justify-content:center;margin:0 1.875em;width:2.2em}div:where(.swal2-container) button:where(.swal2-styled){box-shadow:0 0 0 3px transparent;font-weight:500;margin:.3125em;padding:.625em 1.1em;transition:box-shadow .1s}div:where(.swal2-container) button:where(.swal2-styled):not([disabled]){cursor:pointer}div:where(.swal2-container) button:where(.swal2-styled).swal2-confirm{background:initial;background-color:#7066e0;border:0;border-radius:.25em;color:#fff;font-size:1em}div:where(.swal2-container) button:where(.swal2-styled).swal2-confirm:focus{box-shadow:0 0 0 3px rgba(112,102,224,.5)}div:where(.swal2-container) button:where(.swal2-styled).swal2-deny{background:initial;background-color:#dc3741;border:0;border-radius:.25em;color:#fff;font-size:1em}div:where(.swal2-container) button:where(.swal2-styled).swal2-deny:focus{box-shadow:0 0 0 3px rgba(220,55,65,.5)}div:where(.swal2-container) button:where(.swal2-styled).swal2-cancel{background:initial;background-color:#6e7881;border:0;border-radius:.25em;color:#fff;font-size:1em}div:where(.swal2-container) button:where(.swal2-styled).swal2-cancel:focus{box-shadow:0 0 0 3px hsla(208,8%,47%,.5)}div:where(.swal2-container) button:where(.swal2-styled).swal2-default-outline:focus{box-shadow:0 0 0 3px rgba(100,150,200,.5)}div:where(.swal2-container) button:where(.swal2-styled):focus{outline:none}div:where(.swal2-container) button:where(.swal2-styled)::-moz-focus-inner{border:0}div:where(.swal2-container) div:where(.swal2-footer){border-top:1px solid #eee;color:inherit;font-size:1em;margin:1em 0 0;padding:1em 1em 0;text-align:center}div:where(.swal2-container) .swal2-timer-progress-bar-container{border-bottom-left-radius:5px;border-bottom-right-radius:5px;bottom:0;grid-column:auto!important;left:0;overflow:hidden;position:absolute;right:0}div:where(.swal2-container) div:where(.swal2-timer-progress-bar){background:rgba(0,0,0,.2);height:.25em;width:100%}div:where(.swal2-container) img:where(.swal2-image){margin:2em auto 1em;max-width:100%}div:where(.swal2-container) button:where(.swal2-close){align-items:center;background:transparent;border:none;border-radius:5px;color:#ccc;cursor:pointer;font-family:monospace;font-size:2.5em;height:1.2em;justify-content:center;justify-self:end;margin-bottom:-1.2em;margin-right:0;margin-top:0;overflow:hidden;padding:0;transition:color .1s,box-shadow .1s;width:1.2em;z-index:2}div:where(.swal2-container) button:where(.swal2-close):hover{background:transparent;color:#f27474;transform:none}div:where(.swal2-container) button:where(.swal2-close):focus{box-shadow:inset 0 0 0 3px rgba(100,150,200,.5);outline:none}div:where(.swal2-container) button:where(.swal2-close)::-moz-focus-inner{border:0}div:where(.swal2-container) .swal2-html-container{word-wrap:break-word;color:inherit;font-size:1.125em;font-weight:normal;justify-content:center;line-height:normal;margin:1em 1.6em .3em;overflow:auto;padding:0;text-align:center;word-break:break-word;z-index:1}div:where(.swal2-container) div:where(.swal2-radio),div:where(.swal2-container) input:where(.swal2-file),div:where(.swal2-container) input:where(.swal2-input),div:where(.swal2-container) label:where(.swal2-checkbox),div:where(.swal2-container) select:where(.swal2-select),div:where(.swal2-container) textarea:where(.swal2-textarea){margin:1em 2em 3px}div:where(.swal2-container) input:where(.swal2-file),div:where(.swal2-container) input:where(.swal2-input),div:where(.swal2-container) textarea:where(.swal2-textarea){background:transparent;border:1px solid #d9d9d9;border-radius:.1875em;box-shadow:inset 0 1px 1px rgba(0,0,0,.06),0 0 0 3px transparent;box-sizing:border-box;color:inherit;font-size:1.125em;transition:border-color .1s,box-shadow .1s;width:auto}div:where(.swal2-container) input:where(.swal2-file).swal2-inputerror,div:where(.swal2-container) input:where(.swal2-input).swal2-inputerror,div:where(.swal2-container) textarea:where(.swal2-textarea).swal2-inputerror{border-color:#f27474!important;box-shadow:0 0 2px #f27474!important}div:where(.swal2-container) input:where(.swal2-file):focus,div:where(.swal2-container) input:where(.swal2-input):focus,div:where(.swal2-container) textarea:where(.swal2-textarea):focus{border:1px solid #b4dbed;box-shadow:inset 0 1px 1px rgba(0,0,0,.06),0 0 0 3px rgba(100,150,200,.5);outline:none}div:where(.swal2-container) input:where(.swal2-file)::-moz-placeholder,div:where(.swal2-container) input:where(.swal2-input)::-moz-placeholder,div:where(.swal2-container) textarea:where(.swal2-textarea)::-moz-placeholder{color:#ccc}div:where(.swal2-container) input:where(.swal2-file)::placeholder,div:where(.swal2-container) input:where(.swal2-input)::placeholder,div:where(.swal2-container) textarea:where(.swal2-textarea)::placeholder{color:#ccc}div:where(.swal2-container) .swal2-range{background:#fff;margin:1em 2em 3px}div:where(.swal2-container) .swal2-range input{width:80%}div:where(.swal2-container) .swal2-range output{color:inherit;font-weight:600;text-align:center;width:20%}div:where(.swal2-container) .swal2-range input,div:where(.swal2-container) .swal2-range output{font-size:1.125em;height:2.625em;line-height:2.625em;padding:0}div:where(.swal2-container) .swal2-input{height:2.625em;padding:0 .75em}div:where(.swal2-container) .swal2-file{background:transparent;font-size:1.125em;margin-left:auto;margin-right:auto;width:75%}div:where(.swal2-container) .swal2-textarea{height:6.75em;padding:.75em}div:where(.swal2-container) .swal2-select{background:transparent;color:inherit;font-size:1.125em;max-width:100%;min-width:50%;padding:.375em .625em}div:where(.swal2-container) .swal2-checkbox,div:where(.swal2-container) .swal2-radio{align-items:center;background:#fff;color:inherit;justify-content:center}div:where(.swal2-container) .swal2-checkbox label,div:where(.swal2-container) .swal2-radio label{font-size:1.125em;margin:0 .6em}div:where(.swal2-container) .swal2-checkbox input,div:where(.swal2-container) .swal2-radio input{flex-shrink:0;margin:0 .4em}div:where(.swal2-container) label:where(.swal2-input-label){display:flex;justify-content:center;margin:1em auto 0}div:where(.swal2-container) div:where(.swal2-validation-message){align-items:center;background:#f0f0f0;color:#666;font-size:1em;font-weight:300;justify-content:center;margin:1em 0 0;overflow:hidden;padding:.625em}div:where(.swal2-container) div:where(.swal2-validation-message):before{background-color:#f27474;border-radius:50%;color:#fff;content:"!";display:inline-block;font-weight:600;height:1.5em;line-height:1.5em;margin:0 .625em;min-width:1.5em;text-align:center;width:1.5em}div:where(.swal2-container) .swal2-progress-steps{align-items:center;background:transparent;flex-wrap:wrap;font-weight:600;margin:1.25em auto;max-width:100%;padding:0}div:where(.swal2-container) .swal2-progress-steps li{display:inline-block;position:relative}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step{background:#2778c4;border-radius:2em;color:#fff;flex-shrink:0;height:2em;line-height:2em;text-align:center;width:2em;z-index:20}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step{background:#2778c4}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step{background:#add8e6;color:#fff}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step-line{background:#add8e6}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step-line{background:#2778c4;flex-shrink:0;height:.4em;margin:0 -1px;width:2.5em;z-index:10}div:where(.swal2-icon){border:.25em solid #000;border-radius:50%;box-sizing:content-box;cursor:default;font-family:inherit;height:5em;justify-content:center;line-height:5em;margin:2.5em auto .6em;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:5em}div:where(.swal2-icon) .swal2-icon-content{align-items:center;display:flex;font-size:3.75em}div:where(.swal2-icon).swal2-error{border-color:#f27474;color:#f27474}div:where(.swal2-icon).swal2-error .swal2-x-mark{flex-grow:1;position:relative}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line]{background-color:#f27474;border-radius:.125em;display:block;height:.3125em;position:absolute;top:2.3125em;width:2.9375em}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line][class$=left]{left:1.0625em;transform:rotate(45deg)}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line][class$=right]{right:1em;transform:rotate(-45deg)}div:where(.swal2-icon).swal2-error.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-error.swal2-icon-show .swal2-x-mark{animation:swal2-animate-error-x-mark .5s}div:where(.swal2-icon).swal2-warning{border-color:#facea8;color:#f8bb86}div:where(.swal2-icon).swal2-warning.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-warning.swal2-icon-show .swal2-icon-content{animation:swal2-animate-i-mark .5s}div:where(.swal2-icon).swal2-info{border-color:#9de0f6;color:#3fc3ee}div:where(.swal2-icon).swal2-info.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-info.swal2-icon-show .swal2-icon-content{animation:swal2-animate-i-mark .8s}div:where(.swal2-icon).swal2-question{border-color:#c9dae1;color:#87adbd}div:where(.swal2-icon).swal2-question.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-question.swal2-icon-show .swal2-icon-content{animation:swal2-animate-question-mark .8s}div:where(.swal2-icon).swal2-success{border-color:#a5dc86;color:#a5dc86}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line]{border-radius:50%;height:7.5em;position:absolute;width:3.75em}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line][class$=left]{border-radius:7.5em 0 0 7.5em;left:-2.0635em;top:-.4375em;transform:rotate(-45deg);transform-origin:3.75em 3.75em}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line][class$=right]{border-radius:0 7.5em 7.5em 0;left:1.875em;top:-.6875em;transform:rotate(-45deg);transform-origin:0 3.75em}div:where(.swal2-icon).swal2-success .swal2-success-ring{border:.25em solid hsla(98,55%,69%,.3);border-radius:50%;box-sizing:content-box;height:100%;left:-.25em;position:absolute;top:-.25em;width:100%;z-index:2}div:where(.swal2-icon).swal2-success .swal2-success-fix{height:5.625em;left:1.625em;position:absolute;top:.5em;transform:rotate(-45deg);width:.4375em;z-index:1}div:where(.swal2-icon).swal2-success [class^=swal2-success-line]{background-color:#a5dc86;border-radius:.125em;display:block;height:.3125em;position:absolute;z-index:2}div:where(.swal2-icon).swal2-success [class^=swal2-success-line][class$=tip]{left:.8125em;top:2.875em;transform:rotate(45deg);width:1.5625em}div:where(.swal2-icon).swal2-success [class^=swal2-success-line][class$=long]{right:.5em;top:2.375em;transform:rotate(-45deg);width:2.9375em}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-line-tip{animation:swal2-animate-success-line-tip .75s}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-line-long{animation:swal2-animate-success-line-long .75s}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-circular-line-right{animation:swal2-rotate-success-circular-line 4.25s ease-in}[class^=swal2]{-webkit-tap-highlight-color:transparent}.swal2-show{animation:swal2-show .3s}.swal2-hide{animation:swal2-hide .15s forwards}.swal2-noanimation{transition:none}.swal2-scrollbar-measure{height:50px;overflow:scroll;position:absolute;top:-9999px;width:50px}.swal2-rtl .swal2-close{margin-left:0;margin-right:0}.swal2-rtl .swal2-timer-progress-bar{left:auto;right:0}@keyframes swal2-toast-show{0%{transform:translateY(-.625em) rotate(2deg)}33%{transform:translateY(0) rotate(-2deg)}66%{transform:translateY(.3125em) rotate(2deg)}to{transform:translateY(0) rotate(0deg)}}@keyframes swal2-toast-hide{to{opacity:0;transform:rotate(1deg)}}@keyframes swal2-toast-animate-success-line-tip{0%{left:.0625em;top:.5625em;width:0}54%{left:.125em;top:.125em;width:0}70%{left:-.25em;top:.625em;width:1.625em}84%{left:.75em;top:1.0625em;width:.5em}to{left:.1875em;top:1.125em;width:.75em}}@keyframes swal2-toast-animate-success-line-long{0%{right:1.375em;top:1.625em;width:0}65%{right:.9375em;top:1.25em;width:0}84%{right:0;top:.9375em;width:1.125em}to{right:.1875em;top:.9375em;width:1.375em}}@keyframes swal2-show{0%{transform:scale(.7)}45%{transform:scale(1.05)}80%{transform:scale(.95)}to{transform:scale(1)}}@keyframes swal2-hide{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.5)}}@keyframes swal2-animate-success-line-tip{0%{left:.0625em;top:1.1875em;width:0}54%{left:.125em;top:1.0625em;width:0}70%{left:-.375em;top:2.1875em;width:3.125em}84%{left:1.3125em;top:3em;width:1.0625em}to{left:.8125em;top:2.8125em;width:1.5625em}}@keyframes swal2-animate-success-line-long{0%{right:2.875em;top:3.375em;width:0}65%{right:2.875em;top:3.375em;width:0}84%{right:0;top:2.1875em;width:3.4375em}to{right:.5em;top:2.375em;width:2.9375em}}@keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}to{transform:rotate(-405deg)}}@keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;opacity:0;transform:scale(.4)}50%{margin-top:1.625em;opacity:0;transform:scale(.4)}80%{margin-top:-.375em;transform:scale(1.15)}to{margin-top:0;opacity:1;transform:scale(1)}}@keyframes swal2-animate-error-icon{0%{opacity:0;transform:rotateX(100deg)}to{opacity:1;transform:rotateX(0deg)}}@keyframes swal2-rotate-loading{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}@keyframes swal2-animate-question-mark{0%{transform:rotateY(-1turn)}to{transform:rotateY(0)}}@keyframes swal2-animate-i-mark{0%{opacity:0;transform:rotate(45deg)}25%{opacity:.4;transform:rotate(-25deg)}50%{opacity:.8;transform:rotate(15deg)}75%{opacity:1;transform:rotate(-5deg)}to{opacity:1;transform:rotateX(0)}}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow:hidden}body.swal2-height-auto{height:auto!important}body.swal2-no-backdrop .swal2-container{background-color:transparent!important;pointer-events:none}body.swal2-no-backdrop .swal2-container .swal2-popup{pointer-events:all}body.swal2-no-backdrop .swal2-container .swal2-modal{box-shadow:0 0 10px rgba(0,0,0,.4)}@media print{body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow-y:scroll!important}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown)>[aria-hidden=true]{display:none}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown) .swal2-container{position:static!important}}body.swal2-toast-shown .swal2-container{background-color:transparent;box-sizing:border-box;max-width:100%;pointer-events:none;width:360px}body.swal2-toast-shown .swal2-container.swal2-top{inset:0 auto auto 50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-top-end,body.swal2-toast-shown .swal2-container.swal2-top-right{inset:0 0 auto auto}body.swal2-toast-shown .swal2-container.swal2-top-left,body.swal2-toast-shown .swal2-container.swal2-top-start{inset:0 auto auto 0}body.swal2-toast-shown .swal2-container.swal2-center-left,body.swal2-toast-shown .swal2-container.swal2-center-start{inset:50% auto auto 0;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-center{inset:50% auto auto 50%;transform:translate(-50%,-50%)}body.swal2-toast-shown .swal2-container.swal2-center-end,body.swal2-toast-shown .swal2-container.swal2-center-right{inset:50% 0 auto auto;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-left,body.swal2-toast-shown .swal2-container.swal2-bottom-start{inset:auto auto 0 0}body.swal2-toast-shown .swal2-container.swal2-bottom{inset:auto auto 0 50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-end,body.swal2-toast-shown .swal2-container.swal2-bottom-right{inset:auto 0 0 auto}.preloader-main{height:100%;inset:0;opacity:0;pointer-events:none;position:absolute;transition:opacity .2s ease-in-out;width:100%;z-index:-1}.js-preloading.js-preloader-main{background:hsla(0,0%,100%,.78) url(../images/preloader.svg) no-repeat 50% 50%;opacity:1;pointer-events:all;position:fixed;z-index:300}@media screen and (min-width:1024px){.js-preloading.js-preloader-main{background:hsla(0,0%,100%,.78) url(../images/preloader.svg) 50%/7% no-repeat}} diff --git a/resources/assets/dist/js/app.min.js b/resources/assets/dist/js/app.min.js index 481e309..bd15cc7 100644 --- a/resources/assets/dist/js/app.min.js +++ b/resources/assets/dist/js/app.min.js @@ -1,13881 +1,2 @@ -/******/ (() => { // webpackBootstrap -/******/ var __webpack_modules__ = ({ - -/***/ "./resources/assets/src/scripts/app.js": -/*!*********************************************!*\ - !*** ./resources/assets/src/scripts/app.js ***! - \*********************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! axios */ "./node_modules/axios/lib/axios.js"); -/* harmony import */ var _contact__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @/contact */ "./resources/assets/src/scripts/contact.js"); -/* harmony import */ var _login__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @/login */ "./resources/assets/src/scripts/login.js"); -/* harmony import */ var _cart_cart__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/cart/cart */ "./resources/assets/src/scripts/cart/cart.js"); -/* harmony import */ var _rangeSlider__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @/rangeSlider */ "./resources/assets/src/scripts/rangeSlider.js"); - -window.axios = axios__WEBPACK_IMPORTED_MODULE_0__["default"]; - - - - -document.addEventListener('DOMContentLoaded', function () { - (0,_contact__WEBPACK_IMPORTED_MODULE_1__.initContactForm)(); - (0,_login__WEBPACK_IMPORTED_MODULE_2__.initLoginForm)(); - (0,_cart_cart__WEBPACK_IMPORTED_MODULE_3__.initCart)(); - (0,_rangeSlider__WEBPACK_IMPORTED_MODULE_4__.initRangeSlider)(); -}); - -/***/ }), - -/***/ "./resources/assets/src/scripts/cart/add.js": -/*!**************************************************!*\ - !*** ./resources/assets/src/scripts/cart/add.js ***! - \**************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ addToCart: () => (/* binding */ addToCart) -/* harmony export */ }); -/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! axios */ "./node_modules/axios/lib/axios.js"); -/* harmony import */ var _libs_Toast__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/libs/Toast */ "./resources/assets/src/scripts/libs/Toast.js"); -function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } -function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; } -function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } -function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } - - -function addToCart() { - var preloader = document.querySelector('.js-preloader-main'); - var addButtons = document.querySelectorAll('.js-add-to-cart'); - var totals = document.querySelectorAll('.js-total'); - var subTotals = document.querySelectorAll('.js-sub-total'); - var cartCount = document.querySelector('.js-cart-total'); - var cartList = document.querySelector('.js-cart-list'); - var addedProduct = function addedProduct(product) { - return "\n \n \n \n ").concat(product.thumbnail, "\n \n \n \n ").concat(product.name, "\n \n \n x").concat(product.quantity, "\n \n ").concat(product.sale_price ? "".concat(product.sale_price) : "".concat(product.regular_price), "\n \n \n \n \n \n "); - }; - addButtons.forEach(function (addButton) { - addButton.addEventListener('click', /*#__PURE__*/function () { - var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(event) { - var formData, _yield$axios$post, response; - return _regeneratorRuntime().wrap(function _callee$(_context) { - while (1) switch (_context.prev = _context.next) { - case 0: - preloader.classList.add('js-preloading'); - formData = new FormData(); - formData.append('action', 'addToCart'); - formData.append('nonce', data.nonce); - formData.append('product_id', addButton.dataset.product_id); - formData.append('quantity', addButton.dataset.quantity); - if (addButton.dataset.variation) { - formData.append('variation', addButton.dataset.variation); - } - _context.prev = 7; - _context.next = 10; - return axios__WEBPACK_IMPORTED_MODULE_1__["default"].post(data.ajax_url, formData, { - params: { - action: 'addToCart' - } - }); - case 10: - _yield$axios$post = _context.sent; - response = _yield$axios$post.data; - if (response.type === 'success') { - // totals - totals.forEach(function (totalElement) { - totalElement.innerHTML = response.total; - }); - - // sub-totals - subTotals.forEach(function (subTotalElement) { - subTotalElement.innerHTML = response.subTotal; - }); - cartCount.innerHTML = response.count; - - // cart items - if (response.cart) { - cartList.innerHTML = ''; - response.cart.forEach(function (product) { - var newProduct = addedProduct(product); // Pass each product data to your addedProduct function - cartList.innerHTML += newProduct; - }); - } - _libs_Toast__WEBPACK_IMPORTED_MODULE_0__["default"].fire({ - icon: 'success', - iconColor: '#007cba', - title: response.message - }); - } - if (response.type === 'error') { - _libs_Toast__WEBPACK_IMPORTED_MODULE_0__["default"].fire({ - icon: 'error', - iconColor: 'red', - title: response.message - }); - } - preloader.classList.remove('js-preloading'); - _context.next = 21; - break; - case 17: - _context.prev = 17; - _context.t0 = _context["catch"](7); - preloader.classList.remove('js-preloading'); - console.error(_context.t0); - case 21: - case "end": - return _context.stop(); - } - }, _callee, null, [[7, 17]]); - })); - return function (_x) { - return _ref.apply(this, arguments); - }; - }()); - }); -} - -/***/ }), - -/***/ "./resources/assets/src/scripts/cart/cart.js": -/*!***************************************************!*\ - !*** ./resources/assets/src/scripts/cart/cart.js ***! - \***************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ initCart: () => (/* binding */ initCart) -/* harmony export */ }); -/* harmony import */ var _cart_remove__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/cart/remove */ "./resources/assets/src/scripts/cart/remove.js"); -/* harmony import */ var _cart_add__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @/cart/add */ "./resources/assets/src/scripts/cart/add.js"); -/* harmony import */ var _cart_variations__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @/cart/variations */ "./resources/assets/src/scripts/cart/variations.js"); -/* harmony import */ var _cart_quantity__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/cart/quantity */ "./resources/assets/src/scripts/cart/quantity.js"); - - - - -function initCart() { - (0,_cart_remove__WEBPACK_IMPORTED_MODULE_0__.removeFromCart)(); - (0,_cart_add__WEBPACK_IMPORTED_MODULE_1__.addToCart)(); - (0,_cart_variations__WEBPACK_IMPORTED_MODULE_2__.changeVariations)(); - (0,_cart_quantity__WEBPACK_IMPORTED_MODULE_3__.initQuantity)(); -} - -/***/ }), - -/***/ "./resources/assets/src/scripts/cart/quantity.js": -/*!*******************************************************!*\ - !*** ./resources/assets/src/scripts/cart/quantity.js ***! - \*******************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ initQuantity: () => (/* binding */ initQuantity) -/* harmony export */ }); -function initQuantity() { - var qtyButton = document.querySelector('.js-product-qty'); - var cartButton = document.querySelector('.js-add-to-cart'); - if (qtyButton && cartButton) { - qtyButton.addEventListener('change', function (event) { - cartButton.dataset.quantity = event.target.value; - }); - } -} - -/***/ }), - -/***/ "./resources/assets/src/scripts/cart/remove.js": -/*!*****************************************************!*\ - !*** ./resources/assets/src/scripts/cart/remove.js ***! - \*****************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ removeFromCart: () => (/* binding */ removeFromCart) -/* harmony export */ }); -/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! axios */ "./node_modules/axios/lib/axios.js"); -function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } -function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; } -function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } -function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } - -function removeFromCart() { - var preloader = document.querySelector('.js-preloader-main'); - var cartContainer = document.querySelector('body'); - var totals = document.querySelectorAll('.js-total'); - var subTotals = document.querySelectorAll('.js-sub-total'); - var cartCount = document.querySelector('.js-cart-total'); - cartContainer.addEventListener('click', /*#__PURE__*/function () { - var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(event) { - var target, formData, _yield$axios$post, response, cartItems; - return _regeneratorRuntime().wrap(function _callee$(_context) { - while (1) switch (_context.prev = _context.next) { - case 0: - target = event.target; - if (!target.classList.contains('js-remove-from-cart')) { - _context.next = 20; - break; - } - preloader.classList.add('js-preloading'); - formData = new FormData(); - formData.append('action', 'removeFromCart'); - formData.append('nonce', data.nonce); - formData.append('key', target.dataset.key); - _context.prev = 7; - _context.next = 10; - return axios__WEBPACK_IMPORTED_MODULE_0__["default"].post(data.ajax_url, formData, { - params: { - action: 'removeFromCart' - } - }); - case 10: - _yield$axios$post = _context.sent; - response = _yield$axios$post.data; - if (response.type === 'success') { - cartItems = cartContainer.querySelectorAll("[data-key=\"".concat(target.dataset.key, "\"]")); - cartItems.forEach(function (cartItem) { - cartItem.remove(); - }); - totals.forEach(function (totalElement) { - totalElement.innerHTML = response.total; - }); - subTotals.forEach(function (subTotalElement) { - subTotalElement.innerHTML = response.subTotal; - }); - cartCount.innerHTML = response.count; - } - preloader.classList.remove('js-preloading'); - _context.next = 20; - break; - case 16: - _context.prev = 16; - _context.t0 = _context["catch"](7); - console.error(_context.t0); - preloader.classList.remove('js-preloading'); - case 20: - case "end": - return _context.stop(); - } - }, _callee, null, [[7, 16]]); - })); - return function (_x) { - return _ref.apply(this, arguments); - }; - }()); -} - -/***/ }), - -/***/ "./resources/assets/src/scripts/cart/variations.js": -/*!*********************************************************!*\ - !*** ./resources/assets/src/scripts/cart/variations.js ***! - \*********************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ changeVariations: () => (/* binding */ changeVariations) -/* harmony export */ }); -function changeVariations() { - var select = document.querySelector('.js-variant'); - if (select) { - var addButton = document.querySelector('.js-add-to-cart'); - select.addEventListener('change', function (event) { - addButton.dataset.variation = event.target.value; - addButton.removeAttribute('disabled'); - }); - } -} - -/***/ }), - -/***/ "./resources/assets/src/scripts/contact.js": -/*!*************************************************!*\ - !*** ./resources/assets/src/scripts/contact.js ***! - \*************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ initContactForm: () => (/* binding */ initContactForm) -/* harmony export */ }); -/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! axios */ "./node_modules/axios/lib/axios.js"); -/* harmony import */ var _libs_Toast__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./libs/Toast */ "./resources/assets/src/scripts/libs/Toast.js"); -function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } -function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; } -function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } -function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } - - -function initContactForm() { - var contactForm = document.querySelector('.js-contact-form'); - if (!contactForm) return; - contactForm.addEventListener('submit', /*#__PURE__*/function () { - var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(event) { - var formData, preloader, _yield$axios$post, response, toastConfig; - return _regeneratorRuntime().wrap(function _callee$(_context) { - while (1) switch (_context.prev = _context.next) { - case 0: - event.preventDefault(); - formData = new FormData(contactForm); - formData.append('action', 'contact'); - formData.append('nonce', data.nonce); - preloader = document.querySelector('.js-preloader-main'); - preloader.classList.add('js-preloading'); - _context.prev = 6; - _context.next = 9; - return axios__WEBPACK_IMPORTED_MODULE_1__["default"].post(data.ajax_url, formData, { - params: { - action: 'contact' - } - }); - case 9: - _yield$axios$post = _context.sent; - response = _yield$axios$post.data; - toastConfig = { - icon: response.type, - iconColor: response.type === 'success' ? '#007cba' : 'red', - title: response.message - }; - _libs_Toast__WEBPACK_IMPORTED_MODULE_0__["default"].fire(toastConfig); - _context.next = 18; - break; - case 15: - _context.prev = 15; - _context.t0 = _context["catch"](6); - console.error(_context.t0); - case 18: - preloader.classList.remove('js-preloading'); - contactForm.reset(); - case 20: - case "end": - return _context.stop(); - } - }, _callee, null, [[6, 15]]); - })); - return function (_x) { - return _ref.apply(this, arguments); - }; - }()); -} - -/***/ }), - -/***/ "./resources/assets/src/scripts/libs/Toast.js": -/*!****************************************************!*\ - !*** ./resources/assets/src/scripts/libs/Toast.js ***! - \****************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony import */ var sweetalert2_dist_sweetalert2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! sweetalert2/dist/sweetalert2.js */ "./node_modules/sweetalert2/dist/sweetalert2.js"); -/* harmony import */ var sweetalert2_dist_sweetalert2_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(sweetalert2_dist_sweetalert2_js__WEBPACK_IMPORTED_MODULE_0__); - -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (sweetalert2_dist_sweetalert2_js__WEBPACK_IMPORTED_MODULE_0___default().mixin({ - toast: true, - position: "top-right", - showClass: { - backdrop: "swal2-noanimation", - popup: "", - icon: "" - }, - showConfirmButton: false, - timer: 2000, - timerProgressBar: true -})); - -/***/ }), - -/***/ "./resources/assets/src/scripts/login.js": -/*!***********************************************!*\ - !*** ./resources/assets/src/scripts/login.js ***! - \***********************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ initLoginForm: () => (/* binding */ initLoginForm) -/* harmony export */ }); -/* harmony import */ var _libs_Toast__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./libs/Toast */ "./resources/assets/src/scripts/libs/Toast.js"); -/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! axios */ "./node_modules/axios/lib/axios.js"); -function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } -function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; } -function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } -function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } - - -function initLoginForm() { - var loginForm = document.querySelector('.js-login-form'); - if (!loginForm) return; - loginForm.addEventListener('submit', /*#__PURE__*/function () { - var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(event) { - var formData, preloader, _yield$axios$post, response; - return _regeneratorRuntime().wrap(function _callee$(_context) { - while (1) switch (_context.prev = _context.next) { - case 0: - event.preventDefault(); - formData = new FormData(loginForm); - formData.append('action', 'login'); - formData.append('nonce', data.nonce); - preloader = document.querySelector('.js-preloader-main'); - preloader.classList.add('js-preloading'); - _context.prev = 6; - _context.next = 9; - return axios__WEBPACK_IMPORTED_MODULE_1__["default"].post(data.ajax_url, formData, { - params: { - action: 'login' - } - }); - case 9: - _yield$axios$post = _context.sent; - response = _yield$axios$post.data; - if (response.type === 'success') { - location.reload(); - } else { - _libs_Toast__WEBPACK_IMPORTED_MODULE_0__["default"].fire({ - icon: 'error', - iconColor: 'red', - title: 'Error login' - }); - } - _context.next = 17; - break; - case 14: - _context.prev = 14; - _context.t0 = _context["catch"](6); - console.error(_context.t0); - case 17: - preloader.classList.remove('js-preloading'); - loginForm.reset(); - case 19: - case "end": - return _context.stop(); - } - }, _callee, null, [[6, 14]]); - })); - return function (_x) { - return _ref.apply(this, arguments); - }; - }()); -} - -/***/ }), - -/***/ "./resources/assets/src/scripts/rangeSlider.js": -/*!*****************************************************!*\ - !*** ./resources/assets/src/scripts/rangeSlider.js ***! - \*****************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ initRangeSlider: () => (/* binding */ initRangeSlider) -/* harmony export */ }); -/* harmony import */ var nouislider__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! nouislider */ "./node_modules/nouislider/dist/nouislider.mjs"); - -function initRangeSlider() { - var nonLinearStepSlider = document.getElementById('rangeSlider'); - if (nonLinearStepSlider) { - var nonLinearStepSliderValueElement = document.getElementById('slider-non-linear-step-value'); - var slider = nouislider__WEBPACK_IMPORTED_MODULE_0__["default"].create(nonLinearStepSlider, { - start: [0, 100], - connect: true, - range: { - min: 0, - max: 100 - } - }); - nonLinearStepSlider.noUiSlider.on('update', function (values) { - nonLinearStepSliderValueElement.innerHTML = values.join(' - '); - }); - var valueElement = document.getElementById('slider-non-linear-step-value'); - var urlParams = new URLSearchParams(window.location.search); - var setSliderValues = function setSliderValues(values) { - slider.set(values); - valueElement.innerHTML = values.join(' - '); - }; - var minPrice = parseFloat(urlParams.get('min_price')) || 0; - var maxPrice = parseFloat(urlParams.get('max_price')) || 100; - setSliderValues([minPrice, maxPrice]); - slider.on('set', function (values) { - var newUrlParams = new URLSearchParams(urlParams); - newUrlParams.set('min_price', values[0]); - newUrlParams.set('max_price', values[1]); - var newUrl = window.location.pathname + '?' + newUrlParams.toString(); - history.pushState({}, '', newUrl); - location.reload(); - }); - } -} - -/***/ }), - -/***/ "./node_modules/base64-js/index.js": -/*!*****************************************!*\ - !*** ./node_modules/base64-js/index.js ***! - \*****************************************/ -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - - -exports.byteLength = byteLength -exports.toByteArray = toByteArray -exports.fromByteArray = fromByteArray - -var lookup = [] -var revLookup = [] -var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array - -var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' -for (var i = 0, len = code.length; i < len; ++i) { - lookup[i] = code[i] - revLookup[code.charCodeAt(i)] = i -} - -// Support decoding URL-safe base64 strings, as Node.js does. -// See: https://en.wikipedia.org/wiki/Base64#URL_applications -revLookup['-'.charCodeAt(0)] = 62 -revLookup['_'.charCodeAt(0)] = 63 - -function getLens (b64) { - var len = b64.length - - if (len % 4 > 0) { - throw new Error('Invalid string. Length must be a multiple of 4') - } - - // Trim off extra bytes after placeholder bytes are found - // See: https://github.com/beatgammit/base64-js/issues/42 - var validLen = b64.indexOf('=') - if (validLen === -1) validLen = len - - var placeHoldersLen = validLen === len - ? 0 - : 4 - (validLen % 4) - - return [validLen, placeHoldersLen] -} - -// base64 is 4/3 + up to two characters of the original data -function byteLength (b64) { - var lens = getLens(b64) - var validLen = lens[0] - var placeHoldersLen = lens[1] - return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen -} - -function _byteLength (b64, validLen, placeHoldersLen) { - return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen -} - -function toByteArray (b64) { - var tmp - var lens = getLens(b64) - var validLen = lens[0] - var placeHoldersLen = lens[1] - - var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) - - var curByte = 0 - - // if there are placeholders, only get up to the last complete 4 chars - var len = placeHoldersLen > 0 - ? validLen - 4 - : validLen - - var i - for (i = 0; i < len; i += 4) { - tmp = - (revLookup[b64.charCodeAt(i)] << 18) | - (revLookup[b64.charCodeAt(i + 1)] << 12) | - (revLookup[b64.charCodeAt(i + 2)] << 6) | - revLookup[b64.charCodeAt(i + 3)] - arr[curByte++] = (tmp >> 16) & 0xFF - arr[curByte++] = (tmp >> 8) & 0xFF - arr[curByte++] = tmp & 0xFF - } - - if (placeHoldersLen === 2) { - tmp = - (revLookup[b64.charCodeAt(i)] << 2) | - (revLookup[b64.charCodeAt(i + 1)] >> 4) - arr[curByte++] = tmp & 0xFF - } - - if (placeHoldersLen === 1) { - tmp = - (revLookup[b64.charCodeAt(i)] << 10) | - (revLookup[b64.charCodeAt(i + 1)] << 4) | - (revLookup[b64.charCodeAt(i + 2)] >> 2) - arr[curByte++] = (tmp >> 8) & 0xFF - arr[curByte++] = tmp & 0xFF - } - - return arr -} - -function tripletToBase64 (num) { - return lookup[num >> 18 & 0x3F] + - lookup[num >> 12 & 0x3F] + - lookup[num >> 6 & 0x3F] + - lookup[num & 0x3F] -} - -function encodeChunk (uint8, start, end) { - var tmp - var output = [] - for (var i = start; i < end; i += 3) { - tmp = - ((uint8[i] << 16) & 0xFF0000) + - ((uint8[i + 1] << 8) & 0xFF00) + - (uint8[i + 2] & 0xFF) - output.push(tripletToBase64(tmp)) - } - return output.join('') -} - -function fromByteArray (uint8) { - var tmp - var len = uint8.length - var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes - var parts = [] - var maxChunkLength = 16383 // must be multiple of 3 - - // go through the array every three bytes, we'll deal with trailing stuff later - for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { - parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength))) - } - - // pad the end with zeros, but make sure to not forget the extra bytes - if (extraBytes === 1) { - tmp = uint8[len - 1] - parts.push( - lookup[tmp >> 2] + - lookup[(tmp << 4) & 0x3F] + - '==' - ) - } else if (extraBytes === 2) { - tmp = (uint8[len - 2] << 8) + uint8[len - 1] - parts.push( - lookup[tmp >> 10] + - lookup[(tmp >> 4) & 0x3F] + - lookup[(tmp << 2) & 0x3F] + - '=' - ) - } - - return parts.join('') -} - - -/***/ }), - -/***/ "./node_modules/buffer/index.js": -/*!**************************************!*\ - !*** ./node_modules/buffer/index.js ***! - \**************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ -/* eslint-disable no-proto */ - - - -var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js") -var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js") -var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js") - -exports.Buffer = Buffer -exports.SlowBuffer = SlowBuffer -exports.INSPECT_MAX_BYTES = 50 - -/** - * If `Buffer.TYPED_ARRAY_SUPPORT`: - * === true Use Uint8Array implementation (fastest) - * === false Use Object implementation (most compatible, even IE6) - * - * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, - * Opera 11.6+, iOS 4.2+. - * - * Due to various browser bugs, sometimes the Object implementation will be used even - * when the browser supports typed arrays. - * - * Note: - * - * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances, - * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438. - * - * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function. - * - * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of - * incorrect length in some situations. - - * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they - * get the Object implementation, which is slower but behaves correctly. - */ -Buffer.TYPED_ARRAY_SUPPORT = __webpack_require__.g.TYPED_ARRAY_SUPPORT !== undefined - ? __webpack_require__.g.TYPED_ARRAY_SUPPORT - : typedArraySupport() - -/* - * Export kMaxLength after typed array support is determined. - */ -exports.kMaxLength = kMaxLength() - -function typedArraySupport () { - try { - var arr = new Uint8Array(1) - arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }} - return arr.foo() === 42 && // typed array instances can be augmented - typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray` - arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray` - } catch (e) { - return false - } -} - -function kMaxLength () { - return Buffer.TYPED_ARRAY_SUPPORT - ? 0x7fffffff - : 0x3fffffff -} - -function createBuffer (that, length) { - if (kMaxLength() < length) { - throw new RangeError('Invalid typed array length') - } - if (Buffer.TYPED_ARRAY_SUPPORT) { - // Return an augmented `Uint8Array` instance, for best performance - that = new Uint8Array(length) - that.__proto__ = Buffer.prototype - } else { - // Fallback: Return an object instance of the Buffer class - if (that === null) { - that = new Buffer(length) - } - that.length = length - } - - return that -} - -/** - * The Buffer constructor returns instances of `Uint8Array` that have their - * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of - * `Uint8Array`, so the returned instances will have all the node `Buffer` methods - * and the `Uint8Array` methods. Square bracket notation works as expected -- it - * returns a single octet. - * - * The `Uint8Array` prototype remains unmodified. - */ - -function Buffer (arg, encodingOrOffset, length) { - if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) { - return new Buffer(arg, encodingOrOffset, length) - } - - // Common case. - if (typeof arg === 'number') { - if (typeof encodingOrOffset === 'string') { - throw new Error( - 'If encoding is specified then the first argument must be a string' - ) - } - return allocUnsafe(this, arg) - } - return from(this, arg, encodingOrOffset, length) -} - -Buffer.poolSize = 8192 // not used by this implementation - -// TODO: Legacy, not needed anymore. Remove in next major version. -Buffer._augment = function (arr) { - arr.__proto__ = Buffer.prototype - return arr -} - -function from (that, value, encodingOrOffset, length) { - if (typeof value === 'number') { - throw new TypeError('"value" argument must not be a number') - } - - if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) { - return fromArrayBuffer(that, value, encodingOrOffset, length) - } - - if (typeof value === 'string') { - return fromString(that, value, encodingOrOffset) - } - - return fromObject(that, value) -} - -/** - * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError - * if value is a number. - * Buffer.from(str[, encoding]) - * Buffer.from(array) - * Buffer.from(buffer) - * Buffer.from(arrayBuffer[, byteOffset[, length]]) - **/ -Buffer.from = function (value, encodingOrOffset, length) { - return from(null, value, encodingOrOffset, length) -} - -if (Buffer.TYPED_ARRAY_SUPPORT) { - Buffer.prototype.__proto__ = Uint8Array.prototype - Buffer.__proto__ = Uint8Array - if (typeof Symbol !== 'undefined' && Symbol.species && - Buffer[Symbol.species] === Buffer) { - // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 - Object.defineProperty(Buffer, Symbol.species, { - value: null, - configurable: true - }) - } -} - -function assertSize (size) { - if (typeof size !== 'number') { - throw new TypeError('"size" argument must be a number') - } else if (size < 0) { - throw new RangeError('"size" argument must not be negative') - } -} - -function alloc (that, size, fill, encoding) { - assertSize(size) - if (size <= 0) { - return createBuffer(that, size) - } - if (fill !== undefined) { - // Only pay attention to encoding if it's a string. This - // prevents accidentally sending in a number that would - // be interpretted as a start offset. - return typeof encoding === 'string' - ? createBuffer(that, size).fill(fill, encoding) - : createBuffer(that, size).fill(fill) - } - return createBuffer(that, size) -} - -/** - * Creates a new filled Buffer instance. - * alloc(size[, fill[, encoding]]) - **/ -Buffer.alloc = function (size, fill, encoding) { - return alloc(null, size, fill, encoding) -} - -function allocUnsafe (that, size) { - assertSize(size) - that = createBuffer(that, size < 0 ? 0 : checked(size) | 0) - if (!Buffer.TYPED_ARRAY_SUPPORT) { - for (var i = 0; i < size; ++i) { - that[i] = 0 - } - } - return that -} - -/** - * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. - * */ -Buffer.allocUnsafe = function (size) { - return allocUnsafe(null, size) -} -/** - * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. - */ -Buffer.allocUnsafeSlow = function (size) { - return allocUnsafe(null, size) -} - -function fromString (that, string, encoding) { - if (typeof encoding !== 'string' || encoding === '') { - encoding = 'utf8' - } - - if (!Buffer.isEncoding(encoding)) { - throw new TypeError('"encoding" must be a valid string encoding') - } - - var length = byteLength(string, encoding) | 0 - that = createBuffer(that, length) - - var actual = that.write(string, encoding) - - if (actual !== length) { - // Writing a hex string, for example, that contains invalid characters will - // cause everything after the first invalid character to be ignored. (e.g. - // 'abxxcd' will be treated as 'ab') - that = that.slice(0, actual) - } - - return that -} - -function fromArrayLike (that, array) { - var length = array.length < 0 ? 0 : checked(array.length) | 0 - that = createBuffer(that, length) - for (var i = 0; i < length; i += 1) { - that[i] = array[i] & 255 - } - return that -} - -function fromArrayBuffer (that, array, byteOffset, length) { - array.byteLength // this throws if `array` is not a valid ArrayBuffer - - if (byteOffset < 0 || array.byteLength < byteOffset) { - throw new RangeError('\'offset\' is out of bounds') - } - - if (array.byteLength < byteOffset + (length || 0)) { - throw new RangeError('\'length\' is out of bounds') - } - - if (byteOffset === undefined && length === undefined) { - array = new Uint8Array(array) - } else if (length === undefined) { - array = new Uint8Array(array, byteOffset) - } else { - array = new Uint8Array(array, byteOffset, length) - } - - if (Buffer.TYPED_ARRAY_SUPPORT) { - // Return an augmented `Uint8Array` instance, for best performance - that = array - that.__proto__ = Buffer.prototype - } else { - // Fallback: Return an object instance of the Buffer class - that = fromArrayLike(that, array) - } - return that -} - -function fromObject (that, obj) { - if (Buffer.isBuffer(obj)) { - var len = checked(obj.length) | 0 - that = createBuffer(that, len) - - if (that.length === 0) { - return that - } - - obj.copy(that, 0, 0, len) - return that - } - - if (obj) { - if ((typeof ArrayBuffer !== 'undefined' && - obj.buffer instanceof ArrayBuffer) || 'length' in obj) { - if (typeof obj.length !== 'number' || isnan(obj.length)) { - return createBuffer(that, 0) - } - return fromArrayLike(that, obj) - } - - if (obj.type === 'Buffer' && isArray(obj.data)) { - return fromArrayLike(that, obj.data) - } - } - - throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.') -} - -function checked (length) { - // Note: cannot use `length < kMaxLength()` here because that fails when - // length is NaN (which is otherwise coerced to zero.) - if (length >= kMaxLength()) { - throw new RangeError('Attempt to allocate Buffer larger than maximum ' + - 'size: 0x' + kMaxLength().toString(16) + ' bytes') - } - return length | 0 -} - -function SlowBuffer (length) { - if (+length != length) { // eslint-disable-line eqeqeq - length = 0 - } - return Buffer.alloc(+length) -} - -Buffer.isBuffer = function isBuffer (b) { - return !!(b != null && b._isBuffer) -} - -Buffer.compare = function compare (a, b) { - if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { - throw new TypeError('Arguments must be Buffers') - } - - if (a === b) return 0 - - var x = a.length - var y = b.length - - for (var i = 0, len = Math.min(x, y); i < len; ++i) { - if (a[i] !== b[i]) { - x = a[i] - y = b[i] - break - } - } - - if (x < y) return -1 - if (y < x) return 1 - return 0 -} - -Buffer.isEncoding = function isEncoding (encoding) { - switch (String(encoding).toLowerCase()) { - case 'hex': - case 'utf8': - case 'utf-8': - case 'ascii': - case 'latin1': - case 'binary': - case 'base64': - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return true - default: - return false - } -} - -Buffer.concat = function concat (list, length) { - if (!isArray(list)) { - throw new TypeError('"list" argument must be an Array of Buffers') - } - - if (list.length === 0) { - return Buffer.alloc(0) - } - - var i - if (length === undefined) { - length = 0 - for (i = 0; i < list.length; ++i) { - length += list[i].length - } - } - - var buffer = Buffer.allocUnsafe(length) - var pos = 0 - for (i = 0; i < list.length; ++i) { - var buf = list[i] - if (!Buffer.isBuffer(buf)) { - throw new TypeError('"list" argument must be an Array of Buffers') - } - buf.copy(buffer, pos) - pos += buf.length - } - return buffer -} - -function byteLength (string, encoding) { - if (Buffer.isBuffer(string)) { - return string.length - } - if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' && - (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) { - return string.byteLength - } - if (typeof string !== 'string') { - string = '' + string - } - - var len = string.length - if (len === 0) return 0 - - // Use a for loop to avoid recursion - var loweredCase = false - for (;;) { - switch (encoding) { - case 'ascii': - case 'latin1': - case 'binary': - return len - case 'utf8': - case 'utf-8': - case undefined: - return utf8ToBytes(string).length - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return len * 2 - case 'hex': - return len >>> 1 - case 'base64': - return base64ToBytes(string).length - default: - if (loweredCase) return utf8ToBytes(string).length // assume utf8 - encoding = ('' + encoding).toLowerCase() - loweredCase = true - } - } -} -Buffer.byteLength = byteLength - -function slowToString (encoding, start, end) { - var loweredCase = false - - // No need to verify that "this.length <= MAX_UINT32" since it's a read-only - // property of a typed array. - - // This behaves neither like String nor Uint8Array in that we set start/end - // to their upper/lower bounds if the value passed is out of range. - // undefined is handled specially as per ECMA-262 6th Edition, - // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. - if (start === undefined || start < 0) { - start = 0 - } - // Return early if start > this.length. Done here to prevent potential uint32 - // coercion fail below. - if (start > this.length) { - return '' - } - - if (end === undefined || end > this.length) { - end = this.length - } - - if (end <= 0) { - return '' - } - - // Force coersion to uint32. This will also coerce falsey/NaN values to 0. - end >>>= 0 - start >>>= 0 - - if (end <= start) { - return '' - } - - if (!encoding) encoding = 'utf8' - - while (true) { - switch (encoding) { - case 'hex': - return hexSlice(this, start, end) - - case 'utf8': - case 'utf-8': - return utf8Slice(this, start, end) - - case 'ascii': - return asciiSlice(this, start, end) - - case 'latin1': - case 'binary': - return latin1Slice(this, start, end) - - case 'base64': - return base64Slice(this, start, end) - - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return utf16leSlice(this, start, end) - - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = (encoding + '').toLowerCase() - loweredCase = true - } - } -} - -// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect -// Buffer instances. -Buffer.prototype._isBuffer = true - -function swap (b, n, m) { - var i = b[n] - b[n] = b[m] - b[m] = i -} - -Buffer.prototype.swap16 = function swap16 () { - var len = this.length - if (len % 2 !== 0) { - throw new RangeError('Buffer size must be a multiple of 16-bits') - } - for (var i = 0; i < len; i += 2) { - swap(this, i, i + 1) - } - return this -} - -Buffer.prototype.swap32 = function swap32 () { - var len = this.length - if (len % 4 !== 0) { - throw new RangeError('Buffer size must be a multiple of 32-bits') - } - for (var i = 0; i < len; i += 4) { - swap(this, i, i + 3) - swap(this, i + 1, i + 2) - } - return this -} - -Buffer.prototype.swap64 = function swap64 () { - var len = this.length - if (len % 8 !== 0) { - throw new RangeError('Buffer size must be a multiple of 64-bits') - } - for (var i = 0; i < len; i += 8) { - swap(this, i, i + 7) - swap(this, i + 1, i + 6) - swap(this, i + 2, i + 5) - swap(this, i + 3, i + 4) - } - return this -} - -Buffer.prototype.toString = function toString () { - var length = this.length | 0 - if (length === 0) return '' - if (arguments.length === 0) return utf8Slice(this, 0, length) - return slowToString.apply(this, arguments) -} - -Buffer.prototype.equals = function equals (b) { - if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') - if (this === b) return true - return Buffer.compare(this, b) === 0 -} - -Buffer.prototype.inspect = function inspect () { - var str = '' - var max = exports.INSPECT_MAX_BYTES - if (this.length > 0) { - str = this.toString('hex', 0, max).match(/.{2}/g).join(' ') - if (this.length > max) str += ' ... ' - } - return '' -} - -Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { - if (!Buffer.isBuffer(target)) { - throw new TypeError('Argument must be a Buffer') - } - - if (start === undefined) { - start = 0 - } - if (end === undefined) { - end = target ? target.length : 0 - } - if (thisStart === undefined) { - thisStart = 0 - } - if (thisEnd === undefined) { - thisEnd = this.length - } - - if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { - throw new RangeError('out of range index') - } - - if (thisStart >= thisEnd && start >= end) { - return 0 - } - if (thisStart >= thisEnd) { - return -1 - } - if (start >= end) { - return 1 - } - - start >>>= 0 - end >>>= 0 - thisStart >>>= 0 - thisEnd >>>= 0 - - if (this === target) return 0 - - var x = thisEnd - thisStart - var y = end - start - var len = Math.min(x, y) - - var thisCopy = this.slice(thisStart, thisEnd) - var targetCopy = target.slice(start, end) - - for (var i = 0; i < len; ++i) { - if (thisCopy[i] !== targetCopy[i]) { - x = thisCopy[i] - y = targetCopy[i] - break - } - } - - if (x < y) return -1 - if (y < x) return 1 - return 0 -} - -// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, -// OR the last index of `val` in `buffer` at offset <= `byteOffset`. -// -// Arguments: -// - buffer - a Buffer to search -// - val - a string, Buffer, or number -// - byteOffset - an index into `buffer`; will be clamped to an int32 -// - encoding - an optional encoding, relevant is val is a string -// - dir - true for indexOf, false for lastIndexOf -function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { - // Empty buffer means no match - if (buffer.length === 0) return -1 - - // Normalize byteOffset - if (typeof byteOffset === 'string') { - encoding = byteOffset - byteOffset = 0 - } else if (byteOffset > 0x7fffffff) { - byteOffset = 0x7fffffff - } else if (byteOffset < -0x80000000) { - byteOffset = -0x80000000 - } - byteOffset = +byteOffset // Coerce to Number. - if (isNaN(byteOffset)) { - // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer - byteOffset = dir ? 0 : (buffer.length - 1) - } - - // Normalize byteOffset: negative offsets start from the end of the buffer - if (byteOffset < 0) byteOffset = buffer.length + byteOffset - if (byteOffset >= buffer.length) { - if (dir) return -1 - else byteOffset = buffer.length - 1 - } else if (byteOffset < 0) { - if (dir) byteOffset = 0 - else return -1 - } - - // Normalize val - if (typeof val === 'string') { - val = Buffer.from(val, encoding) - } - - // Finally, search either indexOf (if dir is true) or lastIndexOf - if (Buffer.isBuffer(val)) { - // Special case: looking for empty string/buffer always fails - if (val.length === 0) { - return -1 - } - return arrayIndexOf(buffer, val, byteOffset, encoding, dir) - } else if (typeof val === 'number') { - val = val & 0xFF // Search for a byte value [0-255] - if (Buffer.TYPED_ARRAY_SUPPORT && - typeof Uint8Array.prototype.indexOf === 'function') { - if (dir) { - return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) - } else { - return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) - } - } - return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir) - } - - throw new TypeError('val must be string, number or Buffer') -} - -function arrayIndexOf (arr, val, byteOffset, encoding, dir) { - var indexSize = 1 - var arrLength = arr.length - var valLength = val.length - - if (encoding !== undefined) { - encoding = String(encoding).toLowerCase() - if (encoding === 'ucs2' || encoding === 'ucs-2' || - encoding === 'utf16le' || encoding === 'utf-16le') { - if (arr.length < 2 || val.length < 2) { - return -1 - } - indexSize = 2 - arrLength /= 2 - valLength /= 2 - byteOffset /= 2 - } - } - - function read (buf, i) { - if (indexSize === 1) { - return buf[i] - } else { - return buf.readUInt16BE(i * indexSize) - } - } - - var i - if (dir) { - var foundIndex = -1 - for (i = byteOffset; i < arrLength; i++) { - if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { - if (foundIndex === -1) foundIndex = i - if (i - foundIndex + 1 === valLength) return foundIndex * indexSize - } else { - if (foundIndex !== -1) i -= i - foundIndex - foundIndex = -1 - } - } - } else { - if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength - for (i = byteOffset; i >= 0; i--) { - var found = true - for (var j = 0; j < valLength; j++) { - if (read(arr, i + j) !== read(val, j)) { - found = false - break - } - } - if (found) return i - } - } - - return -1 -} - -Buffer.prototype.includes = function includes (val, byteOffset, encoding) { - return this.indexOf(val, byteOffset, encoding) !== -1 -} - -Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, true) -} - -Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, false) -} - -function hexWrite (buf, string, offset, length) { - offset = Number(offset) || 0 - var remaining = buf.length - offset - if (!length) { - length = remaining - } else { - length = Number(length) - if (length > remaining) { - length = remaining - } - } - - // must be an even number of digits - var strLen = string.length - if (strLen % 2 !== 0) throw new TypeError('Invalid hex string') - - if (length > strLen / 2) { - length = strLen / 2 - } - for (var i = 0; i < length; ++i) { - var parsed = parseInt(string.substr(i * 2, 2), 16) - if (isNaN(parsed)) return i - buf[offset + i] = parsed - } - return i -} - -function utf8Write (buf, string, offset, length) { - return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) -} - -function asciiWrite (buf, string, offset, length) { - return blitBuffer(asciiToBytes(string), buf, offset, length) -} - -function latin1Write (buf, string, offset, length) { - return asciiWrite(buf, string, offset, length) -} - -function base64Write (buf, string, offset, length) { - return blitBuffer(base64ToBytes(string), buf, offset, length) -} - -function ucs2Write (buf, string, offset, length) { - return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) -} - -Buffer.prototype.write = function write (string, offset, length, encoding) { - // Buffer#write(string) - if (offset === undefined) { - encoding = 'utf8' - length = this.length - offset = 0 - // Buffer#write(string, encoding) - } else if (length === undefined && typeof offset === 'string') { - encoding = offset - length = this.length - offset = 0 - // Buffer#write(string, offset[, length][, encoding]) - } else if (isFinite(offset)) { - offset = offset | 0 - if (isFinite(length)) { - length = length | 0 - if (encoding === undefined) encoding = 'utf8' - } else { - encoding = length - length = undefined - } - // legacy write(string, encoding, offset, length) - remove in v0.13 - } else { - throw new Error( - 'Buffer.write(string, encoding, offset[, length]) is no longer supported' - ) - } - - var remaining = this.length - offset - if (length === undefined || length > remaining) length = remaining - - if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { - throw new RangeError('Attempt to write outside buffer bounds') - } - - if (!encoding) encoding = 'utf8' - - var loweredCase = false - for (;;) { - switch (encoding) { - case 'hex': - return hexWrite(this, string, offset, length) - - case 'utf8': - case 'utf-8': - return utf8Write(this, string, offset, length) - - case 'ascii': - return asciiWrite(this, string, offset, length) - - case 'latin1': - case 'binary': - return latin1Write(this, string, offset, length) - - case 'base64': - // Warning: maxLength not taken into account in base64Write - return base64Write(this, string, offset, length) - - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return ucs2Write(this, string, offset, length) - - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = ('' + encoding).toLowerCase() - loweredCase = true - } - } -} - -Buffer.prototype.toJSON = function toJSON () { - return { - type: 'Buffer', - data: Array.prototype.slice.call(this._arr || this, 0) - } -} - -function base64Slice (buf, start, end) { - if (start === 0 && end === buf.length) { - return base64.fromByteArray(buf) - } else { - return base64.fromByteArray(buf.slice(start, end)) - } -} - -function utf8Slice (buf, start, end) { - end = Math.min(buf.length, end) - var res = [] - - var i = start - while (i < end) { - var firstByte = buf[i] - var codePoint = null - var bytesPerSequence = (firstByte > 0xEF) ? 4 - : (firstByte > 0xDF) ? 3 - : (firstByte > 0xBF) ? 2 - : 1 - - if (i + bytesPerSequence <= end) { - var secondByte, thirdByte, fourthByte, tempCodePoint - - switch (bytesPerSequence) { - case 1: - if (firstByte < 0x80) { - codePoint = firstByte - } - break - case 2: - secondByte = buf[i + 1] - if ((secondByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) - if (tempCodePoint > 0x7F) { - codePoint = tempCodePoint - } - } - break - case 3: - secondByte = buf[i + 1] - thirdByte = buf[i + 2] - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) - if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { - codePoint = tempCodePoint - } - } - break - case 4: - secondByte = buf[i + 1] - thirdByte = buf[i + 2] - fourthByte = buf[i + 3] - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) - if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { - codePoint = tempCodePoint - } - } - } - } - - if (codePoint === null) { - // we did not generate a valid codePoint so insert a - // replacement char (U+FFFD) and advance only 1 byte - codePoint = 0xFFFD - bytesPerSequence = 1 - } else if (codePoint > 0xFFFF) { - // encode to utf16 (surrogate pair dance) - codePoint -= 0x10000 - res.push(codePoint >>> 10 & 0x3FF | 0xD800) - codePoint = 0xDC00 | codePoint & 0x3FF - } - - res.push(codePoint) - i += bytesPerSequence - } - - return decodeCodePointsArray(res) -} - -// Based on http://stackoverflow.com/a/22747272/680742, the browser with -// the lowest limit is Chrome, with 0x10000 args. -// We go 1 magnitude less, for safety -var MAX_ARGUMENTS_LENGTH = 0x1000 - -function decodeCodePointsArray (codePoints) { - var len = codePoints.length - if (len <= MAX_ARGUMENTS_LENGTH) { - return String.fromCharCode.apply(String, codePoints) // avoid extra slice() - } - - // Decode in chunks to avoid "call stack size exceeded". - var res = '' - var i = 0 - while (i < len) { - res += String.fromCharCode.apply( - String, - codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) - ) - } - return res -} - -function asciiSlice (buf, start, end) { - var ret = '' - end = Math.min(buf.length, end) - - for (var i = start; i < end; ++i) { - ret += String.fromCharCode(buf[i] & 0x7F) - } - return ret -} - -function latin1Slice (buf, start, end) { - var ret = '' - end = Math.min(buf.length, end) - - for (var i = start; i < end; ++i) { - ret += String.fromCharCode(buf[i]) - } - return ret -} - -function hexSlice (buf, start, end) { - var len = buf.length - - if (!start || start < 0) start = 0 - if (!end || end < 0 || end > len) end = len - - var out = '' - for (var i = start; i < end; ++i) { - out += toHex(buf[i]) - } - return out -} - -function utf16leSlice (buf, start, end) { - var bytes = buf.slice(start, end) - var res = '' - for (var i = 0; i < bytes.length; i += 2) { - res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256) - } - return res -} - -Buffer.prototype.slice = function slice (start, end) { - var len = this.length - start = ~~start - end = end === undefined ? len : ~~end - - if (start < 0) { - start += len - if (start < 0) start = 0 - } else if (start > len) { - start = len - } - - if (end < 0) { - end += len - if (end < 0) end = 0 - } else if (end > len) { - end = len - } - - if (end < start) end = start - - var newBuf - if (Buffer.TYPED_ARRAY_SUPPORT) { - newBuf = this.subarray(start, end) - newBuf.__proto__ = Buffer.prototype - } else { - var sliceLen = end - start - newBuf = new Buffer(sliceLen, undefined) - for (var i = 0; i < sliceLen; ++i) { - newBuf[i] = this[i + start] - } - } - - return newBuf -} - -/* - * Need to make sure that buffer isn't trying to write out of bounds. - */ -function checkOffset (offset, ext, length) { - if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') - if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') -} - -Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var val = this[offset] - var mul = 1 - var i = 0 - while (++i < byteLength && (mul *= 0x100)) { - val += this[offset + i] * mul - } - - return val -} - -Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) { - checkOffset(offset, byteLength, this.length) - } - - var val = this[offset + --byteLength] - var mul = 1 - while (byteLength > 0 && (mul *= 0x100)) { - val += this[offset + --byteLength] * mul - } - - return val -} - -Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { - if (!noAssert) checkOffset(offset, 1, this.length) - return this[offset] -} - -Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 2, this.length) - return this[offset] | (this[offset + 1] << 8) -} - -Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 2, this.length) - return (this[offset] << 8) | this[offset + 1] -} - -Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - - return ((this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16)) + - (this[offset + 3] * 0x1000000) -} - -Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset] * 0x1000000) + - ((this[offset + 1] << 16) | - (this[offset + 2] << 8) | - this[offset + 3]) -} - -Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var val = this[offset] - var mul = 1 - var i = 0 - while (++i < byteLength && (mul *= 0x100)) { - val += this[offset + i] * mul - } - mul *= 0x80 - - if (val >= mul) val -= Math.pow(2, 8 * byteLength) - - return val -} - -Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var i = byteLength - var mul = 1 - var val = this[offset + --i] - while (i > 0 && (mul *= 0x100)) { - val += this[offset + --i] * mul - } - mul *= 0x80 - - if (val >= mul) val -= Math.pow(2, 8 * byteLength) - - return val -} - -Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { - if (!noAssert) checkOffset(offset, 1, this.length) - if (!(this[offset] & 0x80)) return (this[offset]) - return ((0xff - this[offset] + 1) * -1) -} - -Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 2, this.length) - var val = this[offset] | (this[offset + 1] << 8) - return (val & 0x8000) ? val | 0xFFFF0000 : val -} - -Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 2, this.length) - var val = this[offset + 1] | (this[offset] << 8) - return (val & 0x8000) ? val | 0xFFFF0000 : val -} - -Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16) | - (this[offset + 3] << 24) -} - -Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset] << 24) | - (this[offset + 1] << 16) | - (this[offset + 2] << 8) | - (this[offset + 3]) -} - -Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - return ieee754.read(this, offset, true, 23, 4) -} - -Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - return ieee754.read(this, offset, false, 23, 4) -} - -Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 8, this.length) - return ieee754.read(this, offset, true, 52, 8) -} - -Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 8, this.length) - return ieee754.read(this, offset, false, 52, 8) -} - -function checkInt (buf, value, offset, ext, max, min) { - if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance') - if (value > max || value < min) throw new RangeError('"value" argument is out of bounds') - if (offset + ext > buf.length) throw new RangeError('Index out of range') -} - -Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { - value = +value - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) { - var maxBytes = Math.pow(2, 8 * byteLength) - 1 - checkInt(this, value, offset, byteLength, maxBytes, 0) - } - - var mul = 1 - var i = 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { - value = +value - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) { - var maxBytes = Math.pow(2, 8 * byteLength) - 1 - checkInt(this, value, offset, byteLength, maxBytes, 0) - } - - var i = byteLength - 1 - var mul = 1 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) - if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) - this[offset] = (value & 0xff) - return offset + 1 -} - -function objectWriteUInt16 (buf, value, offset, littleEndian) { - if (value < 0) value = 0xffff + value + 1 - for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) { - buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>> - (littleEndian ? i : 1 - i) * 8 - } -} - -Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - } else { - objectWriteUInt16(this, value, offset, true) - } - return offset + 2 -} - -Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value >>> 8) - this[offset + 1] = (value & 0xff) - } else { - objectWriteUInt16(this, value, offset, false) - } - return offset + 2 -} - -function objectWriteUInt32 (buf, value, offset, littleEndian) { - if (value < 0) value = 0xffffffff + value + 1 - for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) { - buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff - } -} - -Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset + 3] = (value >>> 24) - this[offset + 2] = (value >>> 16) - this[offset + 1] = (value >>> 8) - this[offset] = (value & 0xff) - } else { - objectWriteUInt32(this, value, offset, true) - } - return offset + 4 -} - -Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value >>> 24) - this[offset + 1] = (value >>> 16) - this[offset + 2] = (value >>> 8) - this[offset + 3] = (value & 0xff) - } else { - objectWriteUInt32(this, value, offset, false) - } - return offset + 4 -} - -Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) { - var limit = Math.pow(2, 8 * byteLength - 1) - - checkInt(this, value, offset, byteLength, limit - 1, -limit) - } - - var i = 0 - var mul = 1 - var sub = 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { - sub = 1 - } - this[offset + i] = ((value / mul) >> 0) - sub & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) { - var limit = Math.pow(2, 8 * byteLength - 1) - - checkInt(this, value, offset, byteLength, limit - 1, -limit) - } - - var i = byteLength - 1 - var mul = 1 - var sub = 0 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { - sub = 1 - } - this[offset + i] = ((value / mul) >> 0) - sub & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) - if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) - if (value < 0) value = 0xff + value + 1 - this[offset] = (value & 0xff) - return offset + 1 -} - -Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - } else { - objectWriteUInt16(this, value, offset, true) - } - return offset + 2 -} - -Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value >>> 8) - this[offset + 1] = (value & 0xff) - } else { - objectWriteUInt16(this, value, offset, false) - } - return offset + 2 -} - -Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - this[offset + 2] = (value >>> 16) - this[offset + 3] = (value >>> 24) - } else { - objectWriteUInt32(this, value, offset, true) - } - return offset + 4 -} - -Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) - if (value < 0) value = 0xffffffff + value + 1 - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value >>> 24) - this[offset + 1] = (value >>> 16) - this[offset + 2] = (value >>> 8) - this[offset + 3] = (value & 0xff) - } else { - objectWriteUInt32(this, value, offset, false) - } - return offset + 4 -} - -function checkIEEE754 (buf, value, offset, ext, max, min) { - if (offset + ext > buf.length) throw new RangeError('Index out of range') - if (offset < 0) throw new RangeError('Index out of range') -} - -function writeFloat (buf, value, offset, littleEndian, noAssert) { - if (!noAssert) { - checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) - } - ieee754.write(buf, value, offset, littleEndian, 23, 4) - return offset + 4 -} - -Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { - return writeFloat(this, value, offset, true, noAssert) -} - -Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { - return writeFloat(this, value, offset, false, noAssert) -} - -function writeDouble (buf, value, offset, littleEndian, noAssert) { - if (!noAssert) { - checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) - } - ieee754.write(buf, value, offset, littleEndian, 52, 8) - return offset + 8 -} - -Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { - return writeDouble(this, value, offset, true, noAssert) -} - -Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { - return writeDouble(this, value, offset, false, noAssert) -} - -// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) -Buffer.prototype.copy = function copy (target, targetStart, start, end) { - if (!start) start = 0 - if (!end && end !== 0) end = this.length - if (targetStart >= target.length) targetStart = target.length - if (!targetStart) targetStart = 0 - if (end > 0 && end < start) end = start - - // Copy 0 bytes; we're done - if (end === start) return 0 - if (target.length === 0 || this.length === 0) return 0 - - // Fatal error conditions - if (targetStart < 0) { - throw new RangeError('targetStart out of bounds') - } - if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds') - if (end < 0) throw new RangeError('sourceEnd out of bounds') - - // Are we oob? - if (end > this.length) end = this.length - if (target.length - targetStart < end - start) { - end = target.length - targetStart + start - } - - var len = end - start - var i - - if (this === target && start < targetStart && targetStart < end) { - // descending copy from end - for (i = len - 1; i >= 0; --i) { - target[i + targetStart] = this[i + start] - } - } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) { - // ascending copy from start - for (i = 0; i < len; ++i) { - target[i + targetStart] = this[i + start] - } - } else { - Uint8Array.prototype.set.call( - target, - this.subarray(start, start + len), - targetStart - ) - } - - return len -} - -// Usage: -// buffer.fill(number[, offset[, end]]) -// buffer.fill(buffer[, offset[, end]]) -// buffer.fill(string[, offset[, end]][, encoding]) -Buffer.prototype.fill = function fill (val, start, end, encoding) { - // Handle string cases: - if (typeof val === 'string') { - if (typeof start === 'string') { - encoding = start - start = 0 - end = this.length - } else if (typeof end === 'string') { - encoding = end - end = this.length - } - if (val.length === 1) { - var code = val.charCodeAt(0) - if (code < 256) { - val = code - } - } - if (encoding !== undefined && typeof encoding !== 'string') { - throw new TypeError('encoding must be a string') - } - if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { - throw new TypeError('Unknown encoding: ' + encoding) - } - } else if (typeof val === 'number') { - val = val & 255 - } - - // Invalid ranges are not set to a default, so can range check early. - if (start < 0 || this.length < start || this.length < end) { - throw new RangeError('Out of range index') - } - - if (end <= start) { - return this - } - - start = start >>> 0 - end = end === undefined ? this.length : end >>> 0 - - if (!val) val = 0 - - var i - if (typeof val === 'number') { - for (i = start; i < end; ++i) { - this[i] = val - } - } else { - var bytes = Buffer.isBuffer(val) - ? val - : utf8ToBytes(new Buffer(val, encoding).toString()) - var len = bytes.length - for (i = 0; i < end - start; ++i) { - this[i + start] = bytes[i % len] - } - } - - return this -} - -// HELPER FUNCTIONS -// ================ - -var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g - -function base64clean (str) { - // Node strips out invalid characters like \n and \t from the string, base64-js does not - str = stringtrim(str).replace(INVALID_BASE64_RE, '') - // Node converts strings with length < 2 to '' - if (str.length < 2) return '' - // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not - while (str.length % 4 !== 0) { - str = str + '=' - } - return str -} - -function stringtrim (str) { - if (str.trim) return str.trim() - return str.replace(/^\s+|\s+$/g, '') -} - -function toHex (n) { - if (n < 16) return '0' + n.toString(16) - return n.toString(16) -} - -function utf8ToBytes (string, units) { - units = units || Infinity - var codePoint - var length = string.length - var leadSurrogate = null - var bytes = [] - - for (var i = 0; i < length; ++i) { - codePoint = string.charCodeAt(i) - - // is surrogate component - if (codePoint > 0xD7FF && codePoint < 0xE000) { - // last char was a lead - if (!leadSurrogate) { - // no lead yet - if (codePoint > 0xDBFF) { - // unexpected trail - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - continue - } else if (i + 1 === length) { - // unpaired lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - continue - } - - // valid lead - leadSurrogate = codePoint - - continue - } - - // 2 leads in a row - if (codePoint < 0xDC00) { - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - leadSurrogate = codePoint - continue - } - - // valid surrogate pair - codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000 - } else if (leadSurrogate) { - // valid bmp char, but last char was a lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - } - - leadSurrogate = null - - // encode utf8 - if (codePoint < 0x80) { - if ((units -= 1) < 0) break - bytes.push(codePoint) - } else if (codePoint < 0x800) { - if ((units -= 2) < 0) break - bytes.push( - codePoint >> 0x6 | 0xC0, - codePoint & 0x3F | 0x80 - ) - } else if (codePoint < 0x10000) { - if ((units -= 3) < 0) break - bytes.push( - codePoint >> 0xC | 0xE0, - codePoint >> 0x6 & 0x3F | 0x80, - codePoint & 0x3F | 0x80 - ) - } else if (codePoint < 0x110000) { - if ((units -= 4) < 0) break - bytes.push( - codePoint >> 0x12 | 0xF0, - codePoint >> 0xC & 0x3F | 0x80, - codePoint >> 0x6 & 0x3F | 0x80, - codePoint & 0x3F | 0x80 - ) - } else { - throw new Error('Invalid code point') - } - } - - return bytes -} - -function asciiToBytes (str) { - var byteArray = [] - for (var i = 0; i < str.length; ++i) { - // Node's code seems to be doing this and not & 0x7F.. - byteArray.push(str.charCodeAt(i) & 0xFF) - } - return byteArray -} - -function utf16leToBytes (str, units) { - var c, hi, lo - var byteArray = [] - for (var i = 0; i < str.length; ++i) { - if ((units -= 2) < 0) break - - c = str.charCodeAt(i) - hi = c >> 8 - lo = c % 256 - byteArray.push(lo) - byteArray.push(hi) - } - - return byteArray -} - -function base64ToBytes (str) { - return base64.toByteArray(base64clean(str)) -} - -function blitBuffer (src, dst, offset, length) { - for (var i = 0; i < length; ++i) { - if ((i + offset >= dst.length) || (i >= src.length)) break - dst[i + offset] = src[i] - } - return i -} - -function isnan (val) { - return val !== val // eslint-disable-line no-self-compare -} - - -/***/ }), - -/***/ "./node_modules/ieee754/index.js": -/*!***************************************!*\ - !*** ./node_modules/ieee754/index.js ***! - \***************************************/ -/***/ ((__unused_webpack_module, exports) => { - -/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ -exports.read = function (buffer, offset, isLE, mLen, nBytes) { - var e, m - var eLen = (nBytes * 8) - mLen - 1 - var eMax = (1 << eLen) - 1 - var eBias = eMax >> 1 - var nBits = -7 - var i = isLE ? (nBytes - 1) : 0 - var d = isLE ? -1 : 1 - var s = buffer[offset + i] - - i += d - - e = s & ((1 << (-nBits)) - 1) - s >>= (-nBits) - nBits += eLen - for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {} - - m = e & ((1 << (-nBits)) - 1) - e >>= (-nBits) - nBits += mLen - for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {} - - if (e === 0) { - e = 1 - eBias - } else if (e === eMax) { - return m ? NaN : ((s ? -1 : 1) * Infinity) - } else { - m = m + Math.pow(2, mLen) - e = e - eBias - } - return (s ? -1 : 1) * m * Math.pow(2, e - mLen) -} - -exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { - var e, m, c - var eLen = (nBytes * 8) - mLen - 1 - var eMax = (1 << eLen) - 1 - var eBias = eMax >> 1 - var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) - var i = isLE ? 0 : (nBytes - 1) - var d = isLE ? 1 : -1 - var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 - - value = Math.abs(value) - - if (isNaN(value) || value === Infinity) { - m = isNaN(value) ? 1 : 0 - e = eMax - } else { - e = Math.floor(Math.log(value) / Math.LN2) - if (value * (c = Math.pow(2, -e)) < 1) { - e-- - c *= 2 - } - if (e + eBias >= 1) { - value += rt / c - } else { - value += rt * Math.pow(2, 1 - eBias) - } - if (value * c >= 2) { - e++ - c /= 2 - } - - if (e + eBias >= eMax) { - m = 0 - e = eMax - } else if (e + eBias >= 1) { - m = ((value * c) - 1) * Math.pow(2, mLen) - e = e + eBias - } else { - m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) - e = 0 - } - } - - for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} - - e = (e << mLen) | m - eLen += mLen - for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} - - buffer[offset + i - d] |= s * 128 -} - - -/***/ }), - -/***/ "./node_modules/isarray/index.js": -/*!***************************************!*\ - !*** ./node_modules/isarray/index.js ***! - \***************************************/ -/***/ ((module) => { - -var toString = {}.toString; - -module.exports = Array.isArray || function (arr) { - return toString.call(arr) == '[object Array]'; -}; - - -/***/ }), - -/***/ "./resources/assets/src/styles/bundle.scss": -/*!*************************************************!*\ - !*** ./resources/assets/src/styles/bundle.scss ***! - \*************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -// extracted by mini-css-extract-plugin - - -/***/ }), - -/***/ "./node_modules/sweetalert2/dist/sweetalert2.js": -/*!******************************************************!*\ - !*** ./node_modules/sweetalert2/dist/sweetalert2.js ***! - \******************************************************/ -/***/ (function(module) { - -/*! -* sweetalert2 v11.10.5 -* Released under the MIT License. -*/ -(function (global, factory) { - true ? module.exports = factory() : - 0; -})(this, (function () { 'use strict'; - - function _callSuper(t, o, e) { - return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); - } - function _construct(t, e, r) { - if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments); - var o = [null]; - o.push.apply(o, e); - var p = new (t.bind.apply(t, o))(); - return r && _setPrototypeOf(p, r.prototype), p; - } - function _isNativeReflectConstruct() { - try { - var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); - } catch (t) {} - return (_isNativeReflectConstruct = function () { - return !!t; - })(); - } - function _iterableToArrayLimit(r, l) { - var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; - if (null != t) { - var e, - n, - i, - u, - a = [], - f = !0, - o = !1; - try { - if (i = (t = t.call(r)).next, 0 === l) { - if (Object(t) !== t) return; - f = !1; - } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); - } catch (r) { - o = !0, n = r; - } finally { - try { - if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; - } finally { - if (o) throw n; - } - } - return a; - } - } - function _toPrimitive(t, r) { - if ("object" != typeof t || !t) return t; - var e = t[Symbol.toPrimitive]; - if (void 0 !== e) { - var i = e.call(t, r || "default"); - if ("object" != typeof i) return i; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return ("string" === r ? String : Number)(t); - } - function _toPropertyKey(t) { - var i = _toPrimitive(t, "string"); - return "symbol" == typeof i ? i : String(i); - } - function _typeof(o) { - "@babel/helpers - typeof"; - - return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { - return typeof o; - } : function (o) { - return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; - }, _typeof(o); - } - function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } - } - function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); - } - } - function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); - Object.defineProperty(Constructor, "prototype", { - writable: false - }); - return Constructor; - } - function _inherits(subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function"); - } - subClass.prototype = Object.create(superClass && superClass.prototype, { - constructor: { - value: subClass, - writable: true, - configurable: true - } - }); - Object.defineProperty(subClass, "prototype", { - writable: false - }); - if (superClass) _setPrototypeOf(subClass, superClass); - } - function _getPrototypeOf(o) { - _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { - return o.__proto__ || Object.getPrototypeOf(o); - }; - return _getPrototypeOf(o); - } - function _setPrototypeOf(o, p) { - _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { - o.__proto__ = p; - return o; - }; - return _setPrototypeOf(o, p); - } - function _assertThisInitialized(self) { - if (self === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - } - return self; - } - function _possibleConstructorReturn(self, call) { - if (call && (typeof call === "object" || typeof call === "function")) { - return call; - } else if (call !== void 0) { - throw new TypeError("Derived constructors may only return object or undefined"); - } - return _assertThisInitialized(self); - } - function _superPropBase(object, property) { - while (!Object.prototype.hasOwnProperty.call(object, property)) { - object = _getPrototypeOf(object); - if (object === null) break; - } - return object; - } - function _get() { - if (typeof Reflect !== "undefined" && Reflect.get) { - _get = Reflect.get.bind(); - } else { - _get = function _get(target, property, receiver) { - var base = _superPropBase(target, property); - if (!base) return; - var desc = Object.getOwnPropertyDescriptor(base, property); - if (desc.get) { - return desc.get.call(arguments.length < 3 ? target : receiver); - } - return desc.value; - }; - } - return _get.apply(this, arguments); - } - function _slicedToArray(arr, i) { - return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); - } - function _toConsumableArray(arr) { - return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); - } - function _arrayWithoutHoles(arr) { - if (Array.isArray(arr)) return _arrayLikeToArray(arr); - } - function _arrayWithHoles(arr) { - if (Array.isArray(arr)) return arr; - } - function _iterableToArray(iter) { - if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); - } - function _unsupportedIterableToArray(o, minLen) { - if (!o) return; - if (typeof o === "string") return _arrayLikeToArray(o, minLen); - var n = Object.prototype.toString.call(o).slice(8, -1); - if (n === "Object" && o.constructor) n = o.constructor.name; - if (n === "Map" || n === "Set") return Array.from(o); - if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); - } - function _arrayLikeToArray(arr, len) { - if (len == null || len > arr.length) len = arr.length; - for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; - return arr2; - } - function _nonIterableSpread() { - throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); - } - function _nonIterableRest() { - throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); - } - function _classPrivateFieldGet(receiver, privateMap) { - var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); - return _classApplyDescriptorGet(receiver, descriptor); - } - function _classPrivateFieldSet(receiver, privateMap, value) { - var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); - _classApplyDescriptorSet(receiver, descriptor, value); - return value; - } - function _classExtractFieldDescriptor(receiver, privateMap, action) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to " + action + " private field on non-instance"); - } - return privateMap.get(receiver); - } - function _classApplyDescriptorGet(receiver, descriptor) { - if (descriptor.get) { - return descriptor.get.call(receiver); - } - return descriptor.value; - } - function _classApplyDescriptorSet(receiver, descriptor, value) { - if (descriptor.set) { - descriptor.set.call(receiver, value); - } else { - if (!descriptor.writable) { - throw new TypeError("attempted to set read only private field"); - } - descriptor.value = value; - } - } - function _checkPrivateRedeclaration(obj, privateCollection) { - if (privateCollection.has(obj)) { - throw new TypeError("Cannot initialize the same private elements twice on an object"); - } - } - function _classPrivateFieldInitSpec(obj, privateMap, value) { - _checkPrivateRedeclaration(obj, privateMap); - privateMap.set(obj, value); - } - - var RESTORE_FOCUS_TIMEOUT = 100; - - /** @type {GlobalState} */ - var globalState = {}; - var focusPreviousActiveElement = function focusPreviousActiveElement() { - if (globalState.previousActiveElement instanceof HTMLElement) { - globalState.previousActiveElement.focus(); - globalState.previousActiveElement = null; - } else if (document.body) { - document.body.focus(); - } - }; - - /** - * Restore previous active (focused) element - * - * @param {boolean} returnFocus - * @returns {Promise} - */ - var restoreActiveElement = function restoreActiveElement(returnFocus) { - return new Promise(function (resolve) { - if (!returnFocus) { - return resolve(); - } - var x = window.scrollX; - var y = window.scrollY; - globalState.restoreFocusTimeout = setTimeout(function () { - focusPreviousActiveElement(); - resolve(); - }, RESTORE_FOCUS_TIMEOUT); // issues/900 - - window.scrollTo(x, y); - }); - }; - - var swalPrefix = 'swal2-'; - - /** - * @typedef - * { | 'container' - * | 'shown' - * | 'height-auto' - * | 'iosfix' - * | 'popup' - * | 'modal' - * | 'no-backdrop' - * | 'no-transition' - * | 'toast' - * | 'toast-shown' - * | 'show' - * | 'hide' - * | 'close' - * | 'title' - * | 'html-container' - * | 'actions' - * | 'confirm' - * | 'deny' - * | 'cancel' - * | 'default-outline' - * | 'footer' - * | 'icon' - * | 'icon-content' - * | 'image' - * | 'input' - * | 'file' - * | 'range' - * | 'select' - * | 'radio' - * | 'checkbox' - * | 'label' - * | 'textarea' - * | 'inputerror' - * | 'input-label' - * | 'validation-message' - * | 'progress-steps' - * | 'active-progress-step' - * | 'progress-step' - * | 'progress-step-line' - * | 'loader' - * | 'loading' - * | 'styled' - * | 'top' - * | 'top-start' - * | 'top-end' - * | 'top-left' - * | 'top-right' - * | 'center' - * | 'center-start' - * | 'center-end' - * | 'center-left' - * | 'center-right' - * | 'bottom' - * | 'bottom-start' - * | 'bottom-end' - * | 'bottom-left' - * | 'bottom-right' - * | 'grow-row' - * | 'grow-column' - * | 'grow-fullscreen' - * | 'rtl' - * | 'timer-progress-bar' - * | 'timer-progress-bar-container' - * | 'scrollbar-measure' - * | 'icon-success' - * | 'icon-warning' - * | 'icon-info' - * | 'icon-question' - * | 'icon-error' - * } SwalClass - * @typedef {Record} SwalClasses - */ - - /** - * @typedef {'success' | 'warning' | 'info' | 'question' | 'error'} SwalIcon - * @typedef {Record} SwalIcons - */ - - /** @type {SwalClass[]} */ - var classNames = ['container', 'shown', 'height-auto', 'iosfix', 'popup', 'modal', 'no-backdrop', 'no-transition', 'toast', 'toast-shown', 'show', 'hide', 'close', 'title', 'html-container', 'actions', 'confirm', 'deny', 'cancel', 'default-outline', 'footer', 'icon', 'icon-content', 'image', 'input', 'file', 'range', 'select', 'radio', 'checkbox', 'label', 'textarea', 'inputerror', 'input-label', 'validation-message', 'progress-steps', 'active-progress-step', 'progress-step', 'progress-step-line', 'loader', 'loading', 'styled', 'top', 'top-start', 'top-end', 'top-left', 'top-right', 'center', 'center-start', 'center-end', 'center-left', 'center-right', 'bottom', 'bottom-start', 'bottom-end', 'bottom-left', 'bottom-right', 'grow-row', 'grow-column', 'grow-fullscreen', 'rtl', 'timer-progress-bar', 'timer-progress-bar-container', 'scrollbar-measure', 'icon-success', 'icon-warning', 'icon-info', 'icon-question', 'icon-error']; - var swalClasses = classNames.reduce(function (acc, className) { - acc[className] = swalPrefix + className; - return acc; - }, /** @type {SwalClasses} */{}); - - /** @type {SwalIcon[]} */ - var icons = ['success', 'warning', 'info', 'question', 'error']; - var iconTypes = icons.reduce(function (acc, icon) { - acc[icon] = swalPrefix + icon; - return acc; - }, /** @type {SwalIcons} */{}); - - var consolePrefix = 'SweetAlert2:'; - - /** - * Capitalize the first letter of a string - * - * @param {string} str - * @returns {string} - */ - var capitalizeFirstLetter = function capitalizeFirstLetter(str) { - return str.charAt(0).toUpperCase() + str.slice(1); - }; - - /** - * Standardize console warnings - * - * @param {string | string[]} message - */ - var warn = function warn(message) { - console.warn("".concat(consolePrefix, " ").concat(_typeof(message) === 'object' ? message.join(' ') : message)); - }; - - /** - * Standardize console errors - * - * @param {string} message - */ - var error = function error(message) { - console.error("".concat(consolePrefix, " ").concat(message)); - }; - - /** - * Private global state for `warnOnce` - * - * @type {string[]} - * @private - */ - var previousWarnOnceMessages = []; - - /** - * Show a console warning, but only if it hasn't already been shown - * - * @param {string} message - */ - var warnOnce = function warnOnce(message) { - if (!previousWarnOnceMessages.includes(message)) { - previousWarnOnceMessages.push(message); - warn(message); - } - }; - - /** - * Show a one-time console warning about deprecated params/methods - * - * @param {string} deprecatedParam - * @param {string} useInstead - */ - var warnAboutDeprecation = function warnAboutDeprecation(deprecatedParam, useInstead) { - warnOnce("\"".concat(deprecatedParam, "\" is deprecated and will be removed in the next major release. Please use \"").concat(useInstead, "\" instead.")); - }; - - /** - * If `arg` is a function, call it (with no arguments or context) and return the result. - * Otherwise, just pass the value through - * - * @param {Function | any} arg - * @returns {any} - */ - var callIfFunction = function callIfFunction(arg) { - return typeof arg === 'function' ? arg() : arg; - }; - - /** - * @param {any} arg - * @returns {boolean} - */ - var hasToPromiseFn = function hasToPromiseFn(arg) { - return arg && typeof arg.toPromise === 'function'; - }; - - /** - * @param {any} arg - * @returns {Promise} - */ - var asPromise = function asPromise(arg) { - return hasToPromiseFn(arg) ? arg.toPromise() : Promise.resolve(arg); - }; - - /** - * @param {any} arg - * @returns {boolean} - */ - var isPromise = function isPromise(arg) { - return arg && Promise.resolve(arg) === arg; - }; - - /** - * Gets the popup container which contains the backdrop and the popup itself. - * - * @returns {HTMLElement | null} - */ - var getContainer = function getContainer() { - return document.body.querySelector(".".concat(swalClasses.container)); - }; - - /** - * @param {string} selectorString - * @returns {HTMLElement | null} - */ - var elementBySelector = function elementBySelector(selectorString) { - var container = getContainer(); - return container ? container.querySelector(selectorString) : null; - }; - - /** - * @param {string} className - * @returns {HTMLElement | null} - */ - var elementByClass = function elementByClass(className) { - return elementBySelector(".".concat(className)); - }; - - /** - * @returns {HTMLElement | null} - */ - var getPopup = function getPopup() { - return elementByClass(swalClasses.popup); - }; - - /** - * @returns {HTMLElement | null} - */ - var getIcon = function getIcon() { - return elementByClass(swalClasses.icon); - }; - - /** - * @returns {HTMLElement | null} - */ - var getIconContent = function getIconContent() { - return elementByClass(swalClasses['icon-content']); - }; - - /** - * @returns {HTMLElement | null} - */ - var getTitle = function getTitle() { - return elementByClass(swalClasses.title); - }; - - /** - * @returns {HTMLElement | null} - */ - var getHtmlContainer = function getHtmlContainer() { - return elementByClass(swalClasses['html-container']); - }; - - /** - * @returns {HTMLElement | null} - */ - var getImage = function getImage() { - return elementByClass(swalClasses.image); - }; - - /** - * @returns {HTMLElement | null} - */ - var getProgressSteps = function getProgressSteps() { - return elementByClass(swalClasses['progress-steps']); - }; - - /** - * @returns {HTMLElement | null} - */ - var getValidationMessage = function getValidationMessage() { - return elementByClass(swalClasses['validation-message']); - }; - - /** - * @returns {HTMLButtonElement | null} - */ - var getConfirmButton = function getConfirmButton() { - return /** @type {HTMLButtonElement} */elementBySelector(".".concat(swalClasses.actions, " .").concat(swalClasses.confirm)); - }; - - /** - * @returns {HTMLButtonElement | null} - */ - var getCancelButton = function getCancelButton() { - return /** @type {HTMLButtonElement} */elementBySelector(".".concat(swalClasses.actions, " .").concat(swalClasses.cancel)); - }; - - /** - * @returns {HTMLButtonElement | null} - */ - var getDenyButton = function getDenyButton() { - return /** @type {HTMLButtonElement} */elementBySelector(".".concat(swalClasses.actions, " .").concat(swalClasses.deny)); - }; - - /** - * @returns {HTMLElement | null} - */ - var getInputLabel = function getInputLabel() { - return elementByClass(swalClasses['input-label']); - }; - - /** - * @returns {HTMLElement | null} - */ - var getLoader = function getLoader() { - return elementBySelector(".".concat(swalClasses.loader)); - }; - - /** - * @returns {HTMLElement | null} - */ - var getActions = function getActions() { - return elementByClass(swalClasses.actions); - }; - - /** - * @returns {HTMLElement | null} - */ - var getFooter = function getFooter() { - return elementByClass(swalClasses.footer); - }; - - /** - * @returns {HTMLElement | null} - */ - var getTimerProgressBar = function getTimerProgressBar() { - return elementByClass(swalClasses['timer-progress-bar']); - }; - - /** - * @returns {HTMLElement | null} - */ - var getCloseButton = function getCloseButton() { - return elementByClass(swalClasses.close); - }; - - // https://github.com/jkup/focusable/blob/master/index.js - var focusable = "\n a[href],\n area[href],\n input:not([disabled]),\n select:not([disabled]),\n textarea:not([disabled]),\n button:not([disabled]),\n iframe,\n object,\n embed,\n [tabindex=\"0\"],\n [contenteditable],\n audio[controls],\n video[controls],\n summary\n"; - /** - * @returns {HTMLElement[]} - */ - var getFocusableElements = function getFocusableElements() { - var popup = getPopup(); - if (!popup) { - return []; - } - /** @type {NodeListOf} */ - var focusableElementsWithTabindex = popup.querySelectorAll('[tabindex]:not([tabindex="-1"]):not([tabindex="0"])'); - var focusableElementsWithTabindexSorted = Array.from(focusableElementsWithTabindex) - // sort according to tabindex - .sort(function (a, b) { - var tabindexA = parseInt(a.getAttribute('tabindex') || '0'); - var tabindexB = parseInt(b.getAttribute('tabindex') || '0'); - if (tabindexA > tabindexB) { - return 1; - } else if (tabindexA < tabindexB) { - return -1; - } - return 0; - }); - - /** @type {NodeListOf} */ - var otherFocusableElements = popup.querySelectorAll(focusable); - var otherFocusableElementsFiltered = Array.from(otherFocusableElements).filter(function (el) { - return el.getAttribute('tabindex') !== '-1'; - }); - return _toConsumableArray(new Set(focusableElementsWithTabindexSorted.concat(otherFocusableElementsFiltered))).filter(function (el) { - return isVisible$1(el); - }); - }; - - /** - * @returns {boolean} - */ - var isModal = function isModal() { - return hasClass(document.body, swalClasses.shown) && !hasClass(document.body, swalClasses['toast-shown']) && !hasClass(document.body, swalClasses['no-backdrop']); - }; - - /** - * @returns {boolean} - */ - var isToast = function isToast() { - var popup = getPopup(); - if (!popup) { - return false; - } - return hasClass(popup, swalClasses.toast); - }; - - /** - * @returns {boolean} - */ - var isLoading = function isLoading() { - var popup = getPopup(); - if (!popup) { - return false; - } - return popup.hasAttribute('data-loading'); - }; - - /** - * Securely set innerHTML of an element - * https://github.com/sweetalert2/sweetalert2/issues/1926 - * - * @param {HTMLElement} elem - * @param {string} html - */ - var setInnerHtml = function setInnerHtml(elem, html) { - elem.textContent = ''; - if (html) { - var parser = new DOMParser(); - var parsed = parser.parseFromString(html, "text/html"); - var head = parsed.querySelector('head'); - head && Array.from(head.childNodes).forEach(function (child) { - elem.appendChild(child); - }); - var body = parsed.querySelector('body'); - body && Array.from(body.childNodes).forEach(function (child) { - if (child instanceof HTMLVideoElement || child instanceof HTMLAudioElement) { - elem.appendChild(child.cloneNode(true)); // https://github.com/sweetalert2/sweetalert2/issues/2507 - } else { - elem.appendChild(child); - } - }); - } - }; - - /** - * @param {HTMLElement} elem - * @param {string} className - * @returns {boolean} - */ - var hasClass = function hasClass(elem, className) { - if (!className) { - return false; - } - var classList = className.split(/\s+/); - for (var i = 0; i < classList.length; i++) { - if (!elem.classList.contains(classList[i])) { - return false; - } - } - return true; - }; - - /** - * @param {HTMLElement} elem - * @param {SweetAlertOptions} params - */ - var removeCustomClasses = function removeCustomClasses(elem, params) { - Array.from(elem.classList).forEach(function (className) { - if (!Object.values(swalClasses).includes(className) && !Object.values(iconTypes).includes(className) && !Object.values(params.showClass || {}).includes(className)) { - elem.classList.remove(className); - } - }); - }; - - /** - * @param {HTMLElement} elem - * @param {SweetAlertOptions} params - * @param {string} className - */ - var applyCustomClass = function applyCustomClass(elem, params, className) { - removeCustomClasses(elem, params); - if (params.customClass && params.customClass[className]) { - if (typeof params.customClass[className] !== 'string' && !params.customClass[className].forEach) { - warn("Invalid type of customClass.".concat(className, "! Expected string or iterable object, got \"").concat(_typeof(params.customClass[className]), "\"")); - return; - } - addClass(elem, params.customClass[className]); - } - }; - - /** - * @param {HTMLElement} popup - * @param {import('./renderers/renderInput').InputClass | SweetAlertInput} inputClass - * @returns {HTMLInputElement | null} - */ - var getInput$1 = function getInput(popup, inputClass) { - if (!inputClass) { - return null; - } - switch (inputClass) { - case 'select': - case 'textarea': - case 'file': - return popup.querySelector(".".concat(swalClasses.popup, " > .").concat(swalClasses[inputClass])); - case 'checkbox': - return popup.querySelector(".".concat(swalClasses.popup, " > .").concat(swalClasses.checkbox, " input")); - case 'radio': - return popup.querySelector(".".concat(swalClasses.popup, " > .").concat(swalClasses.radio, " input:checked")) || popup.querySelector(".".concat(swalClasses.popup, " > .").concat(swalClasses.radio, " input:first-child")); - case 'range': - return popup.querySelector(".".concat(swalClasses.popup, " > .").concat(swalClasses.range, " input")); - default: - return popup.querySelector(".".concat(swalClasses.popup, " > .").concat(swalClasses.input)); - } - }; - - /** - * @param {HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement} input - */ - var focusInput = function focusInput(input) { - input.focus(); - - // place cursor at end of text in text input - if (input.type !== 'file') { - // http://stackoverflow.com/a/2345915 - var val = input.value; - input.value = ''; - input.value = val; - } - }; - - /** - * @param {HTMLElement | HTMLElement[] | null} target - * @param {string | string[] | readonly string[] | undefined} classList - * @param {boolean} condition - */ - var toggleClass = function toggleClass(target, classList, condition) { - if (!target || !classList) { - return; - } - if (typeof classList === 'string') { - classList = classList.split(/\s+/).filter(Boolean); - } - classList.forEach(function (className) { - if (Array.isArray(target)) { - target.forEach(function (elem) { - condition ? elem.classList.add(className) : elem.classList.remove(className); - }); - } else { - condition ? target.classList.add(className) : target.classList.remove(className); - } - }); - }; - - /** - * @param {HTMLElement | HTMLElement[] | null} target - * @param {string | string[] | readonly string[] | undefined} classList - */ - var addClass = function addClass(target, classList) { - toggleClass(target, classList, true); - }; - - /** - * @param {HTMLElement | HTMLElement[] | null} target - * @param {string | string[] | readonly string[] | undefined} classList - */ - var removeClass = function removeClass(target, classList) { - toggleClass(target, classList, false); - }; - - /** - * Get direct child of an element by class name - * - * @param {HTMLElement} elem - * @param {string} className - * @returns {HTMLElement | undefined} - */ - var getDirectChildByClass = function getDirectChildByClass(elem, className) { - var children = Array.from(elem.children); - for (var i = 0; i < children.length; i++) { - var child = children[i]; - if (child instanceof HTMLElement && hasClass(child, className)) { - return child; - } - } - }; - - /** - * @param {HTMLElement} elem - * @param {string} property - * @param {*} value - */ - var applyNumericalStyle = function applyNumericalStyle(elem, property, value) { - if (value === "".concat(parseInt(value))) { - value = parseInt(value); - } - if (value || parseInt(value) === 0) { - elem.style.setProperty(property, typeof value === 'number' ? "".concat(value, "px") : value); - } else { - elem.style.removeProperty(property); - } - }; - - /** - * @param {HTMLElement | null} elem - * @param {string} display - */ - var show = function show(elem) { - var display = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'flex'; - elem && (elem.style.display = display); - }; - - /** - * @param {HTMLElement | null} elem - */ - var hide = function hide(elem) { - elem && (elem.style.display = 'none'); - }; - - /** - * @param {HTMLElement | null} elem - * @param {string} display - */ - var showWhenInnerHtmlPresent = function showWhenInnerHtmlPresent(elem) { - var display = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'block'; - if (!elem) { - return; - } - new MutationObserver(function () { - toggle(elem, elem.innerHTML, display); - }).observe(elem, { - childList: true, - subtree: true - }); - }; - - /** - * @param {HTMLElement} parent - * @param {string} selector - * @param {string} property - * @param {string} value - */ - var setStyle = function setStyle(parent, selector, property, value) { - /** @type {HTMLElement | null} */ - var el = parent.querySelector(selector); - if (el) { - el.style.setProperty(property, value); - } - }; - - /** - * @param {HTMLElement} elem - * @param {any} condition - * @param {string} display - */ - var toggle = function toggle(elem, condition) { - var display = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'flex'; - condition ? show(elem, display) : hide(elem); - }; - - /** - * borrowed from jquery $(elem).is(':visible') implementation - * - * @param {HTMLElement | null} elem - * @returns {boolean} - */ - var isVisible$1 = function isVisible(elem) { - return !!(elem && (elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length)); - }; - - /** - * @returns {boolean} - */ - var allButtonsAreHidden = function allButtonsAreHidden() { - return !isVisible$1(getConfirmButton()) && !isVisible$1(getDenyButton()) && !isVisible$1(getCancelButton()); - }; - - /** - * @param {HTMLElement} elem - * @returns {boolean} - */ - var isScrollable = function isScrollable(elem) { - return !!(elem.scrollHeight > elem.clientHeight); - }; - - /** - * borrowed from https://stackoverflow.com/a/46352119 - * - * @param {HTMLElement} elem - * @returns {boolean} - */ - var hasCssAnimation = function hasCssAnimation(elem) { - var style = window.getComputedStyle(elem); - var animDuration = parseFloat(style.getPropertyValue('animation-duration') || '0'); - var transDuration = parseFloat(style.getPropertyValue('transition-duration') || '0'); - return animDuration > 0 || transDuration > 0; - }; - - /** - * @param {number} timer - * @param {boolean} reset - */ - var animateTimerProgressBar = function animateTimerProgressBar(timer) { - var reset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - var timerProgressBar = getTimerProgressBar(); - if (!timerProgressBar) { - return; - } - if (isVisible$1(timerProgressBar)) { - if (reset) { - timerProgressBar.style.transition = 'none'; - timerProgressBar.style.width = '100%'; - } - setTimeout(function () { - timerProgressBar.style.transition = "width ".concat(timer / 1000, "s linear"); - timerProgressBar.style.width = '0%'; - }, 10); - } - }; - var stopTimerProgressBar = function stopTimerProgressBar() { - var timerProgressBar = getTimerProgressBar(); - if (!timerProgressBar) { - return; - } - var timerProgressBarWidth = parseInt(window.getComputedStyle(timerProgressBar).width); - timerProgressBar.style.removeProperty('transition'); - timerProgressBar.style.width = '100%'; - var timerProgressBarFullWidth = parseInt(window.getComputedStyle(timerProgressBar).width); - var timerProgressBarPercent = timerProgressBarWidth / timerProgressBarFullWidth * 100; - timerProgressBar.style.width = "".concat(timerProgressBarPercent, "%"); - }; - - /** - * Detect Node env - * - * @returns {boolean} - */ - var isNodeEnv = function isNodeEnv() { - return typeof window === 'undefined' || typeof document === 'undefined'; - }; - - var sweetHTML = "\n
\n \n
    \n
    \n \n

    \n
    \n \n \n
    \n \n \n
    \n \n
    \n \n \n
    \n
    \n
    \n \n \n \n
    \n
    \n
    \n
    \n
    \n
    \n").replace(/(^|\n)\s*/g, ''); - - /** - * @returns {boolean} - */ - var resetOldContainer = function resetOldContainer() { - var oldContainer = getContainer(); - if (!oldContainer) { - return false; - } - oldContainer.remove(); - removeClass([document.documentElement, document.body], [swalClasses['no-backdrop'], swalClasses['toast-shown'], swalClasses['has-column']]); - return true; - }; - var resetValidationMessage$1 = function resetValidationMessage() { - globalState.currentInstance.resetValidationMessage(); - }; - var addInputChangeListeners = function addInputChangeListeners() { - var popup = getPopup(); - var input = getDirectChildByClass(popup, swalClasses.input); - var file = getDirectChildByClass(popup, swalClasses.file); - /** @type {HTMLInputElement} */ - var range = popup.querySelector(".".concat(swalClasses.range, " input")); - /** @type {HTMLOutputElement} */ - var rangeOutput = popup.querySelector(".".concat(swalClasses.range, " output")); - var select = getDirectChildByClass(popup, swalClasses.select); - /** @type {HTMLInputElement} */ - var checkbox = popup.querySelector(".".concat(swalClasses.checkbox, " input")); - var textarea = getDirectChildByClass(popup, swalClasses.textarea); - input.oninput = resetValidationMessage$1; - file.onchange = resetValidationMessage$1; - select.onchange = resetValidationMessage$1; - checkbox.onchange = resetValidationMessage$1; - textarea.oninput = resetValidationMessage$1; - range.oninput = function () { - resetValidationMessage$1(); - rangeOutput.value = range.value; - }; - range.onchange = function () { - resetValidationMessage$1(); - rangeOutput.value = range.value; - }; - }; - - /** - * @param {string | HTMLElement} target - * @returns {HTMLElement} - */ - var getTarget = function getTarget(target) { - return typeof target === 'string' ? document.querySelector(target) : target; - }; - - /** - * @param {SweetAlertOptions} params - */ - var setupAccessibility = function setupAccessibility(params) { - var popup = getPopup(); - popup.setAttribute('role', params.toast ? 'alert' : 'dialog'); - popup.setAttribute('aria-live', params.toast ? 'polite' : 'assertive'); - if (!params.toast) { - popup.setAttribute('aria-modal', 'true'); - } - }; - - /** - * @param {HTMLElement} targetElement - */ - var setupRTL = function setupRTL(targetElement) { - if (window.getComputedStyle(targetElement).direction === 'rtl') { - addClass(getContainer(), swalClasses.rtl); - } - }; - - /** - * Add modal + backdrop + no-war message for Russians to DOM - * - * @param {SweetAlertOptions} params - */ - var init = function init(params) { - // Clean up the old popup container if it exists - var oldContainerExisted = resetOldContainer(); - if (isNodeEnv()) { - error('SweetAlert2 requires document to initialize'); - return; - } - var container = document.createElement('div'); - container.className = swalClasses.container; - if (oldContainerExisted) { - addClass(container, swalClasses['no-transition']); - } - setInnerHtml(container, sweetHTML); - var targetElement = getTarget(params.target); - targetElement.appendChild(container); - setupAccessibility(params); - setupRTL(targetElement); - addInputChangeListeners(); - }; - - /** - * @param {HTMLElement | object | string} param - * @param {HTMLElement} target - */ - var parseHtmlToContainer = function parseHtmlToContainer(param, target) { - // DOM element - if (param instanceof HTMLElement) { - target.appendChild(param); - } - - // Object - else if (_typeof(param) === 'object') { - handleObject(param, target); - } - - // Plain string - else if (param) { - setInnerHtml(target, param); - } - }; - - /** - * @param {any} param - * @param {HTMLElement} target - */ - var handleObject = function handleObject(param, target) { - // JQuery element(s) - if (param.jquery) { - handleJqueryElem(target, param); - } - - // For other objects use their string representation - else { - setInnerHtml(target, param.toString()); - } - }; - - /** - * @param {HTMLElement} target - * @param {any} elem - */ - var handleJqueryElem = function handleJqueryElem(target, elem) { - target.textContent = ''; - if (0 in elem) { - for (var i = 0; (i in elem); i++) { - target.appendChild(elem[i].cloneNode(true)); - } - } else { - target.appendChild(elem.cloneNode(true)); - } - }; - - /** - * @returns {'webkitAnimationEnd' | 'animationend' | false} - */ - var animationEndEvent = function () { - // Prevent run in Node env - if (isNodeEnv()) { - return false; - } - var testEl = document.createElement('div'); - - // Chrome, Safari and Opera - if (typeof testEl.style.webkitAnimation !== 'undefined') { - return 'webkitAnimationEnd'; - } - - // Standard syntax - if (typeof testEl.style.animation !== 'undefined') { - return 'animationend'; - } - return false; - }(); - - /** - * @param {SweetAlert} instance - * @param {SweetAlertOptions} params - */ - var renderActions = function renderActions(instance, params) { - var actions = getActions(); - var loader = getLoader(); - if (!actions || !loader) { - return; - } - - // Actions (buttons) wrapper - if (!params.showConfirmButton && !params.showDenyButton && !params.showCancelButton) { - hide(actions); - } else { - show(actions); - } - - // Custom class - applyCustomClass(actions, params, 'actions'); - - // Render all the buttons - renderButtons(actions, loader, params); - - // Loader - setInnerHtml(loader, params.loaderHtml || ''); - applyCustomClass(loader, params, 'loader'); - }; - - /** - * @param {HTMLElement} actions - * @param {HTMLElement} loader - * @param {SweetAlertOptions} params - */ - function renderButtons(actions, loader, params) { - var confirmButton = getConfirmButton(); - var denyButton = getDenyButton(); - var cancelButton = getCancelButton(); - if (!confirmButton || !denyButton || !cancelButton) { - return; - } - - // Render buttons - renderButton(confirmButton, 'confirm', params); - renderButton(denyButton, 'deny', params); - renderButton(cancelButton, 'cancel', params); - handleButtonsStyling(confirmButton, denyButton, cancelButton, params); - if (params.reverseButtons) { - if (params.toast) { - actions.insertBefore(cancelButton, confirmButton); - actions.insertBefore(denyButton, confirmButton); - } else { - actions.insertBefore(cancelButton, loader); - actions.insertBefore(denyButton, loader); - actions.insertBefore(confirmButton, loader); - } - } - } - - /** - * @param {HTMLElement} confirmButton - * @param {HTMLElement} denyButton - * @param {HTMLElement} cancelButton - * @param {SweetAlertOptions} params - */ - function handleButtonsStyling(confirmButton, denyButton, cancelButton, params) { - if (!params.buttonsStyling) { - removeClass([confirmButton, denyButton, cancelButton], swalClasses.styled); - return; - } - addClass([confirmButton, denyButton, cancelButton], swalClasses.styled); - - // Buttons background colors - if (params.confirmButtonColor) { - confirmButton.style.backgroundColor = params.confirmButtonColor; - addClass(confirmButton, swalClasses['default-outline']); - } - if (params.denyButtonColor) { - denyButton.style.backgroundColor = params.denyButtonColor; - addClass(denyButton, swalClasses['default-outline']); - } - if (params.cancelButtonColor) { - cancelButton.style.backgroundColor = params.cancelButtonColor; - addClass(cancelButton, swalClasses['default-outline']); - } - } - - /** - * @param {HTMLElement} button - * @param {'confirm' | 'deny' | 'cancel'} buttonType - * @param {SweetAlertOptions} params - */ - function renderButton(button, buttonType, params) { - var buttonName = /** @type {'Confirm' | 'Deny' | 'Cancel'} */capitalizeFirstLetter(buttonType); - toggle(button, params["show".concat(buttonName, "Button")], 'inline-block'); - setInnerHtml(button, params["".concat(buttonType, "ButtonText")] || ''); // Set caption text - button.setAttribute('aria-label', params["".concat(buttonType, "ButtonAriaLabel")] || ''); // ARIA label - - // Add buttons custom classes - button.className = swalClasses[buttonType]; - applyCustomClass(button, params, "".concat(buttonType, "Button")); - } - - /** - * @param {SweetAlert} instance - * @param {SweetAlertOptions} params - */ - var renderCloseButton = function renderCloseButton(instance, params) { - var closeButton = getCloseButton(); - if (!closeButton) { - return; - } - setInnerHtml(closeButton, params.closeButtonHtml || ''); - - // Custom class - applyCustomClass(closeButton, params, 'closeButton'); - toggle(closeButton, params.showCloseButton); - closeButton.setAttribute('aria-label', params.closeButtonAriaLabel || ''); - }; - - /** - * @param {SweetAlert} instance - * @param {SweetAlertOptions} params - */ - var renderContainer = function renderContainer(instance, params) { - var container = getContainer(); - if (!container) { - return; - } - handleBackdropParam(container, params.backdrop); - handlePositionParam(container, params.position); - handleGrowParam(container, params.grow); - - // Custom class - applyCustomClass(container, params, 'container'); - }; - - /** - * @param {HTMLElement} container - * @param {SweetAlertOptions['backdrop']} backdrop - */ - function handleBackdropParam(container, backdrop) { - if (typeof backdrop === 'string') { - container.style.background = backdrop; - } else if (!backdrop) { - addClass([document.documentElement, document.body], swalClasses['no-backdrop']); - } - } - - /** - * @param {HTMLElement} container - * @param {SweetAlertOptions['position']} position - */ - function handlePositionParam(container, position) { - if (!position) { - return; - } - if (position in swalClasses) { - addClass(container, swalClasses[position]); - } else { - warn('The "position" parameter is not valid, defaulting to "center"'); - addClass(container, swalClasses.center); - } - } - - /** - * @param {HTMLElement} container - * @param {SweetAlertOptions['grow']} grow - */ - function handleGrowParam(container, grow) { - if (!grow) { - return; - } - addClass(container, swalClasses["grow-".concat(grow)]); - } - - /** - * This module contains `WeakMap`s for each effectively-"private property" that a `Swal` has. - * For example, to set the private property "foo" of `this` to "bar", you can `privateProps.foo.set(this, 'bar')` - * This is the approach that Babel will probably take to implement private methods/fields - * https://github.com/tc39/proposal-private-methods - * https://github.com/babel/babel/pull/7555 - * Once we have the changes from that PR in Babel, and our core class fits reasonable in *one module* - * then we can use that language feature. - */ - - var privateProps = { - innerParams: new WeakMap(), - domCache: new WeakMap() - }; - - /** @type {InputClass[]} */ - var inputClasses = ['input', 'file', 'range', 'select', 'radio', 'checkbox', 'textarea']; - - /** - * @param {SweetAlert} instance - * @param {SweetAlertOptions} params - */ - var renderInput = function renderInput(instance, params) { - var popup = getPopup(); - if (!popup) { - return; - } - var innerParams = privateProps.innerParams.get(instance); - var rerender = !innerParams || params.input !== innerParams.input; - inputClasses.forEach(function (inputClass) { - var inputContainer = getDirectChildByClass(popup, swalClasses[inputClass]); - if (!inputContainer) { - return; - } - - // set attributes - setAttributes(inputClass, params.inputAttributes); - - // set class - inputContainer.className = swalClasses[inputClass]; - if (rerender) { - hide(inputContainer); - } - }); - if (params.input) { - if (rerender) { - showInput(params); - } - // set custom class - setCustomClass(params); - } - }; - - /** - * @param {SweetAlertOptions} params - */ - var showInput = function showInput(params) { - if (!params.input) { - return; - } - if (!renderInputType[params.input]) { - error("Unexpected type of input! Expected ".concat(Object.keys(renderInputType).join(' | '), ", got \"").concat(params.input, "\"")); - return; - } - var inputContainer = getInputContainer(params.input); - var input = renderInputType[params.input](inputContainer, params); - show(inputContainer); - - // input autofocus - if (params.inputAutoFocus) { - setTimeout(function () { - focusInput(input); - }); - } - }; - - /** - * @param {HTMLInputElement} input - */ - var removeAttributes = function removeAttributes(input) { - for (var i = 0; i < input.attributes.length; i++) { - var attrName = input.attributes[i].name; - if (!['id', 'type', 'value', 'style'].includes(attrName)) { - input.removeAttribute(attrName); - } - } - }; - - /** - * @param {InputClass} inputClass - * @param {SweetAlertOptions['inputAttributes']} inputAttributes - */ - var setAttributes = function setAttributes(inputClass, inputAttributes) { - var input = getInput$1(getPopup(), inputClass); - if (!input) { - return; - } - removeAttributes(input); - for (var attr in inputAttributes) { - input.setAttribute(attr, inputAttributes[attr]); - } - }; - - /** - * @param {SweetAlertOptions} params - */ - var setCustomClass = function setCustomClass(params) { - var inputContainer = getInputContainer(params.input); - if (_typeof(params.customClass) === 'object') { - addClass(inputContainer, params.customClass.input); - } - }; - - /** - * @param {HTMLInputElement | HTMLTextAreaElement} input - * @param {SweetAlertOptions} params - */ - var setInputPlaceholder = function setInputPlaceholder(input, params) { - if (!input.placeholder || params.inputPlaceholder) { - input.placeholder = params.inputPlaceholder; - } - }; - - /** - * @param {Input} input - * @param {Input} prependTo - * @param {SweetAlertOptions} params - */ - var setInputLabel = function setInputLabel(input, prependTo, params) { - if (params.inputLabel) { - var label = document.createElement('label'); - var labelClass = swalClasses['input-label']; - label.setAttribute('for', input.id); - label.className = labelClass; - if (_typeof(params.customClass) === 'object') { - addClass(label, params.customClass.inputLabel); - } - label.innerText = params.inputLabel; - prependTo.insertAdjacentElement('beforebegin', label); - } - }; - - /** - * @param {SweetAlertOptions['input']} inputType - * @returns {HTMLElement} - */ - var getInputContainer = function getInputContainer(inputType) { - return getDirectChildByClass(getPopup(), swalClasses[inputType] || swalClasses.input); - }; - - /** - * @param {HTMLInputElement | HTMLOutputElement | HTMLTextAreaElement} input - * @param {SweetAlertOptions['inputValue']} inputValue - */ - var checkAndSetInputValue = function checkAndSetInputValue(input, inputValue) { - if (['string', 'number'].includes(_typeof(inputValue))) { - input.value = "".concat(inputValue); - } else if (!isPromise(inputValue)) { - warn("Unexpected type of inputValue! Expected \"string\", \"number\" or \"Promise\", got \"".concat(_typeof(inputValue), "\"")); - } - }; - - /** @type {Record Input>} */ - var renderInputType = {}; - - /** - * @param {HTMLInputElement} input - * @param {SweetAlertOptions} params - * @returns {HTMLInputElement} - */ - renderInputType.text = renderInputType.email = renderInputType.password = renderInputType.number = renderInputType.tel = renderInputType.url = renderInputType.search = renderInputType.date = renderInputType['datetime-local'] = renderInputType.time = renderInputType.week = renderInputType.month = function (input, params) { - checkAndSetInputValue(input, params.inputValue); - setInputLabel(input, input, params); - setInputPlaceholder(input, params); - input.type = params.input; - return input; - }; - - /** - * @param {HTMLInputElement} input - * @param {SweetAlertOptions} params - * @returns {HTMLInputElement} - */ - renderInputType.file = function (input, params) { - setInputLabel(input, input, params); - setInputPlaceholder(input, params); - return input; - }; - - /** - * @param {HTMLInputElement} range - * @param {SweetAlertOptions} params - * @returns {HTMLInputElement} - */ - renderInputType.range = function (range, params) { - var rangeInput = range.querySelector('input'); - var rangeOutput = range.querySelector('output'); - checkAndSetInputValue(rangeInput, params.inputValue); - rangeInput.type = params.input; - checkAndSetInputValue(rangeOutput, params.inputValue); - setInputLabel(rangeInput, range, params); - return range; - }; - - /** - * @param {HTMLSelectElement} select - * @param {SweetAlertOptions} params - * @returns {HTMLSelectElement} - */ - renderInputType.select = function (select, params) { - select.textContent = ''; - if (params.inputPlaceholder) { - var placeholder = document.createElement('option'); - setInnerHtml(placeholder, params.inputPlaceholder); - placeholder.value = ''; - placeholder.disabled = true; - placeholder.selected = true; - select.appendChild(placeholder); - } - setInputLabel(select, select, params); - return select; - }; - - /** - * @param {HTMLInputElement} radio - * @returns {HTMLInputElement} - */ - renderInputType.radio = function (radio) { - radio.textContent = ''; - return radio; - }; - - /** - * @param {HTMLLabelElement} checkboxContainer - * @param {SweetAlertOptions} params - * @returns {HTMLInputElement} - */ - renderInputType.checkbox = function (checkboxContainer, params) { - var checkbox = getInput$1(getPopup(), 'checkbox'); - checkbox.value = '1'; - checkbox.checked = Boolean(params.inputValue); - var label = checkboxContainer.querySelector('span'); - setInnerHtml(label, params.inputPlaceholder); - return checkbox; - }; - - /** - * @param {HTMLTextAreaElement} textarea - * @param {SweetAlertOptions} params - * @returns {HTMLTextAreaElement} - */ - renderInputType.textarea = function (textarea, params) { - checkAndSetInputValue(textarea, params.inputValue); - setInputPlaceholder(textarea, params); - setInputLabel(textarea, textarea, params); - - /** - * @param {HTMLElement} el - * @returns {number} - */ - var getMargin = function getMargin(el) { - return parseInt(window.getComputedStyle(el).marginLeft) + parseInt(window.getComputedStyle(el).marginRight); - }; - - // https://github.com/sweetalert2/sweetalert2/issues/2291 - setTimeout(function () { - // https://github.com/sweetalert2/sweetalert2/issues/1699 - if ('MutationObserver' in window) { - var initialPopupWidth = parseInt(window.getComputedStyle(getPopup()).width); - var textareaResizeHandler = function textareaResizeHandler() { - // check if texarea is still in document (i.e. popup wasn't closed in the meantime) - if (!document.body.contains(textarea)) { - return; - } - var textareaWidth = textarea.offsetWidth + getMargin(textarea); - if (textareaWidth > initialPopupWidth) { - getPopup().style.width = "".concat(textareaWidth, "px"); - } else { - applyNumericalStyle(getPopup(), 'width', params.width); - } - }; - new MutationObserver(textareaResizeHandler).observe(textarea, { - attributes: true, - attributeFilter: ['style'] - }); - } - }); - return textarea; - }; - - /** - * @param {SweetAlert} instance - * @param {SweetAlertOptions} params - */ - var renderContent = function renderContent(instance, params) { - var htmlContainer = getHtmlContainer(); - if (!htmlContainer) { - return; - } - showWhenInnerHtmlPresent(htmlContainer); - applyCustomClass(htmlContainer, params, 'htmlContainer'); - - // Content as HTML - if (params.html) { - parseHtmlToContainer(params.html, htmlContainer); - show(htmlContainer, 'block'); - } - - // Content as plain text - else if (params.text) { - htmlContainer.textContent = params.text; - show(htmlContainer, 'block'); - } - - // No content - else { - hide(htmlContainer); - } - renderInput(instance, params); - }; - - /** - * @param {SweetAlert} instance - * @param {SweetAlertOptions} params - */ - var renderFooter = function renderFooter(instance, params) { - var footer = getFooter(); - if (!footer) { - return; - } - showWhenInnerHtmlPresent(footer); - toggle(footer, params.footer, 'block'); - if (params.footer) { - parseHtmlToContainer(params.footer, footer); - } - - // Custom class - applyCustomClass(footer, params, 'footer'); - }; - - /** - * @param {SweetAlert} instance - * @param {SweetAlertOptions} params - */ - var renderIcon = function renderIcon(instance, params) { - var innerParams = privateProps.innerParams.get(instance); - var icon = getIcon(); - if (!icon) { - return; - } - - // if the given icon already rendered, apply the styling without re-rendering the icon - if (innerParams && params.icon === innerParams.icon) { - // Custom or default content - setContent(icon, params); - applyStyles(icon, params); - return; - } - if (!params.icon && !params.iconHtml) { - hide(icon); - return; - } - if (params.icon && Object.keys(iconTypes).indexOf(params.icon) === -1) { - error("Unknown icon! Expected \"success\", \"error\", \"warning\", \"info\" or \"question\", got \"".concat(params.icon, "\"")); - hide(icon); - return; - } - show(icon); - - // Custom or default content - setContent(icon, params); - applyStyles(icon, params); - - // Animate icon - addClass(icon, params.showClass && params.showClass.icon); - }; - - /** - * @param {HTMLElement} icon - * @param {SweetAlertOptions} params - */ - var applyStyles = function applyStyles(icon, params) { - for (var _i = 0, _Object$entries = Object.entries(iconTypes); _i < _Object$entries.length; _i++) { - var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2), - iconType = _Object$entries$_i[0], - iconClassName = _Object$entries$_i[1]; - if (params.icon !== iconType) { - removeClass(icon, iconClassName); - } - } - addClass(icon, params.icon && iconTypes[params.icon]); - - // Icon color - setColor(icon, params); - - // Success icon background color - adjustSuccessIconBackgroundColor(); - - // Custom class - applyCustomClass(icon, params, 'icon'); - }; - - // Adjust success icon background color to match the popup background color - var adjustSuccessIconBackgroundColor = function adjustSuccessIconBackgroundColor() { - var popup = getPopup(); - if (!popup) { - return; - } - var popupBackgroundColor = window.getComputedStyle(popup).getPropertyValue('background-color'); - /** @type {NodeListOf} */ - var successIconParts = popup.querySelectorAll('[class^=swal2-success-circular-line], .swal2-success-fix'); - for (var i = 0; i < successIconParts.length; i++) { - successIconParts[i].style.backgroundColor = popupBackgroundColor; - } - }; - var successIconHtml = "\n
    \n \n
    \n
    \n"; - var errorIconHtml = "\n \n \n \n \n"; - - /** - * @param {HTMLElement} icon - * @param {SweetAlertOptions} params - */ - var setContent = function setContent(icon, params) { - if (!params.icon && !params.iconHtml) { - return; - } - var oldContent = icon.innerHTML; - var newContent = ''; - if (params.iconHtml) { - newContent = iconContent(params.iconHtml); - } else if (params.icon === 'success') { - newContent = successIconHtml; - oldContent = oldContent.replace(/ style=".*?"/g, ''); // undo adjustSuccessIconBackgroundColor() - } else if (params.icon === 'error') { - newContent = errorIconHtml; - } else if (params.icon) { - var defaultIconHtml = { - question: '?', - warning: '!', - info: 'i' - }; - newContent = iconContent(defaultIconHtml[params.icon]); - } - if (oldContent.trim() !== newContent.trim()) { - setInnerHtml(icon, newContent); - } - }; - - /** - * @param {HTMLElement} icon - * @param {SweetAlertOptions} params - */ - var setColor = function setColor(icon, params) { - if (!params.iconColor) { - return; - } - icon.style.color = params.iconColor; - icon.style.borderColor = params.iconColor; - for (var _i2 = 0, _arr = ['.swal2-success-line-tip', '.swal2-success-line-long', '.swal2-x-mark-line-left', '.swal2-x-mark-line-right']; _i2 < _arr.length; _i2++) { - var sel = _arr[_i2]; - setStyle(icon, sel, 'background-color', params.iconColor); - } - setStyle(icon, '.swal2-success-ring', 'border-color', params.iconColor); - }; - - /** - * @param {string} content - * @returns {string} - */ - var iconContent = function iconContent(content) { - return "
    ").concat(content, "
    "); - }; - - /** - * @param {SweetAlert} instance - * @param {SweetAlertOptions} params - */ - var renderImage = function renderImage(instance, params) { - var image = getImage(); - if (!image) { - return; - } - if (!params.imageUrl) { - hide(image); - return; - } - show(image, ''); - - // Src, alt - image.setAttribute('src', params.imageUrl); - image.setAttribute('alt', params.imageAlt || ''); - - // Width, height - applyNumericalStyle(image, 'width', params.imageWidth); - applyNumericalStyle(image, 'height', params.imageHeight); - - // Class - image.className = swalClasses.image; - applyCustomClass(image, params, 'image'); - }; - - /** - * @param {SweetAlert} instance - * @param {SweetAlertOptions} params - */ - var renderPopup = function renderPopup(instance, params) { - var container = getContainer(); - var popup = getPopup(); - if (!container || !popup) { - return; - } - - // Width - // https://github.com/sweetalert2/sweetalert2/issues/2170 - if (params.toast) { - applyNumericalStyle(container, 'width', params.width); - popup.style.width = '100%'; - var loader = getLoader(); - loader && popup.insertBefore(loader, getIcon()); - } else { - applyNumericalStyle(popup, 'width', params.width); - } - - // Padding - applyNumericalStyle(popup, 'padding', params.padding); - - // Color - if (params.color) { - popup.style.color = params.color; - } - - // Background - if (params.background) { - popup.style.background = params.background; - } - hide(getValidationMessage()); - - // Classes - addClasses$1(popup, params); - }; - - /** - * @param {HTMLElement} popup - * @param {SweetAlertOptions} params - */ - var addClasses$1 = function addClasses(popup, params) { - var showClass = params.showClass || {}; - // Default Class + showClass when updating Swal.update({}) - popup.className = "".concat(swalClasses.popup, " ").concat(isVisible$1(popup) ? showClass.popup : ''); - if (params.toast) { - addClass([document.documentElement, document.body], swalClasses['toast-shown']); - addClass(popup, swalClasses.toast); - } else { - addClass(popup, swalClasses.modal); - } - - // Custom class - applyCustomClass(popup, params, 'popup'); - if (typeof params.customClass === 'string') { - addClass(popup, params.customClass); - } - - // Icon class (#1842) - if (params.icon) { - addClass(popup, swalClasses["icon-".concat(params.icon)]); - } - }; - - /** - * @param {SweetAlert} instance - * @param {SweetAlertOptions} params - */ - var renderProgressSteps = function renderProgressSteps(instance, params) { - var progressStepsContainer = getProgressSteps(); - if (!progressStepsContainer) { - return; - } - var progressSteps = params.progressSteps, - currentProgressStep = params.currentProgressStep; - if (!progressSteps || progressSteps.length === 0 || currentProgressStep === undefined) { - hide(progressStepsContainer); - return; - } - show(progressStepsContainer); - progressStepsContainer.textContent = ''; - if (currentProgressStep >= progressSteps.length) { - warn('Invalid currentProgressStep parameter, it should be less than progressSteps.length ' + '(currentProgressStep like JS arrays starts from 0)'); - } - progressSteps.forEach(function (step, index) { - var stepEl = createStepElement(step); - progressStepsContainer.appendChild(stepEl); - if (index === currentProgressStep) { - addClass(stepEl, swalClasses['active-progress-step']); - } - if (index !== progressSteps.length - 1) { - var lineEl = createLineElement(params); - progressStepsContainer.appendChild(lineEl); - } - }); - }; - - /** - * @param {string} step - * @returns {HTMLLIElement} - */ - var createStepElement = function createStepElement(step) { - var stepEl = document.createElement('li'); - addClass(stepEl, swalClasses['progress-step']); - setInnerHtml(stepEl, step); - return stepEl; - }; - - /** - * @param {SweetAlertOptions} params - * @returns {HTMLLIElement} - */ - var createLineElement = function createLineElement(params) { - var lineEl = document.createElement('li'); - addClass(lineEl, swalClasses['progress-step-line']); - if (params.progressStepsDistance) { - applyNumericalStyle(lineEl, 'width', params.progressStepsDistance); - } - return lineEl; - }; - - /** - * @param {SweetAlert} instance - * @param {SweetAlertOptions} params - */ - var renderTitle = function renderTitle(instance, params) { - var title = getTitle(); - if (!title) { - return; - } - showWhenInnerHtmlPresent(title); - toggle(title, params.title || params.titleText, 'block'); - if (params.title) { - parseHtmlToContainer(params.title, title); - } - if (params.titleText) { - title.innerText = params.titleText; - } - - // Custom class - applyCustomClass(title, params, 'title'); - }; - - /** - * @param {SweetAlert} instance - * @param {SweetAlertOptions} params - */ - var render = function render(instance, params) { - renderPopup(instance, params); - renderContainer(instance, params); - renderProgressSteps(instance, params); - renderIcon(instance, params); - renderImage(instance, params); - renderTitle(instance, params); - renderCloseButton(instance, params); - renderContent(instance, params); - renderActions(instance, params); - renderFooter(instance, params); - var popup = getPopup(); - if (typeof params.didRender === 'function' && popup) { - params.didRender(popup); - } - }; - - /* - * Global function to determine if SweetAlert2 popup is shown - */ - var isVisible = function isVisible() { - return isVisible$1(getPopup()); - }; - - /* - * Global function to click 'Confirm' button - */ - var clickConfirm = function clickConfirm() { - var _dom$getConfirmButton; - return (_dom$getConfirmButton = getConfirmButton()) === null || _dom$getConfirmButton === void 0 ? void 0 : _dom$getConfirmButton.click(); - }; - - /* - * Global function to click 'Deny' button - */ - var clickDeny = function clickDeny() { - var _dom$getDenyButton; - return (_dom$getDenyButton = getDenyButton()) === null || _dom$getDenyButton === void 0 ? void 0 : _dom$getDenyButton.click(); - }; - - /* - * Global function to click 'Cancel' button - */ - var clickCancel = function clickCancel() { - var _dom$getCancelButton; - return (_dom$getCancelButton = getCancelButton()) === null || _dom$getCancelButton === void 0 ? void 0 : _dom$getCancelButton.click(); - }; - - /** @typedef {'cancel' | 'backdrop' | 'close' | 'esc' | 'timer'} DismissReason */ - - /** @type {Record} */ - var DismissReason = Object.freeze({ - cancel: 'cancel', - backdrop: 'backdrop', - close: 'close', - esc: 'esc', - timer: 'timer' - }); - - /** - * @param {GlobalState} globalState - */ - var removeKeydownHandler = function removeKeydownHandler(globalState) { - if (globalState.keydownTarget && globalState.keydownHandlerAdded) { - globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, { - capture: globalState.keydownListenerCapture - }); - globalState.keydownHandlerAdded = false; - } - }; - - /** - * @param {GlobalState} globalState - * @param {SweetAlertOptions} innerParams - * @param {*} dismissWith - */ - var addKeydownHandler = function addKeydownHandler(globalState, innerParams, dismissWith) { - removeKeydownHandler(globalState); - if (!innerParams.toast) { - globalState.keydownHandler = function (e) { - return keydownHandler(innerParams, e, dismissWith); - }; - globalState.keydownTarget = innerParams.keydownListenerCapture ? window : getPopup(); - globalState.keydownListenerCapture = innerParams.keydownListenerCapture; - globalState.keydownTarget.addEventListener('keydown', globalState.keydownHandler, { - capture: globalState.keydownListenerCapture - }); - globalState.keydownHandlerAdded = true; - } - }; - - /** - * @param {number} index - * @param {number} increment - */ - var setFocus = function setFocus(index, increment) { - var _dom$getPopup; - var focusableElements = getFocusableElements(); - // search for visible elements and select the next possible match - if (focusableElements.length) { - index = index + increment; - - // rollover to first item - if (index === focusableElements.length) { - index = 0; - - // go to last item - } else if (index === -1) { - index = focusableElements.length - 1; - } - focusableElements[index].focus(); - return; - } - // no visible focusable elements, focus the popup - (_dom$getPopup = getPopup()) === null || _dom$getPopup === void 0 || _dom$getPopup.focus(); - }; - var arrowKeysNextButton = ['ArrowRight', 'ArrowDown']; - var arrowKeysPreviousButton = ['ArrowLeft', 'ArrowUp']; - - /** - * @param {SweetAlertOptions} innerParams - * @param {KeyboardEvent} event - * @param {Function} dismissWith - */ - var keydownHandler = function keydownHandler(innerParams, event, dismissWith) { - if (!innerParams) { - return; // This instance has already been destroyed - } - - // Ignore keydown during IME composition - // https://developer.mozilla.org/en-US/docs/Web/API/Document/keydown_event#ignoring_keydown_during_ime_composition - // https://github.com/sweetalert2/sweetalert2/issues/720 - // https://github.com/sweetalert2/sweetalert2/issues/2406 - if (event.isComposing || event.keyCode === 229) { - return; - } - if (innerParams.stopKeydownPropagation) { - event.stopPropagation(); - } - - // ENTER - if (event.key === 'Enter') { - handleEnter(event, innerParams); - } - - // TAB - else if (event.key === 'Tab') { - handleTab(event); - } - - // ARROWS - switch focus between buttons - else if ([].concat(arrowKeysNextButton, arrowKeysPreviousButton).includes(event.key)) { - handleArrows(event.key); - } - - // ESC - else if (event.key === 'Escape') { - handleEsc(event, innerParams, dismissWith); - } - }; - - /** - * @param {KeyboardEvent} event - * @param {SweetAlertOptions} innerParams - */ - var handleEnter = function handleEnter(event, innerParams) { - // https://github.com/sweetalert2/sweetalert2/issues/2386 - if (!callIfFunction(innerParams.allowEnterKey)) { - return; - } - var input = getInput$1(getPopup(), innerParams.input); - if (event.target && input && event.target instanceof HTMLElement && event.target.outerHTML === input.outerHTML) { - if (['textarea', 'file'].includes(innerParams.input)) { - return; // do not submit - } - clickConfirm(); - event.preventDefault(); - } - }; - - /** - * @param {KeyboardEvent} event - */ - var handleTab = function handleTab(event) { - var targetElement = event.target; - var focusableElements = getFocusableElements(); - var btnIndex = -1; - for (var i = 0; i < focusableElements.length; i++) { - if (targetElement === focusableElements[i]) { - btnIndex = i; - break; - } - } - - // Cycle to the next button - if (!event.shiftKey) { - setFocus(btnIndex, 1); - } - - // Cycle to the prev button - else { - setFocus(btnIndex, -1); - } - event.stopPropagation(); - event.preventDefault(); - }; - - /** - * @param {string} key - */ - var handleArrows = function handleArrows(key) { - var actions = getActions(); - var confirmButton = getConfirmButton(); - var denyButton = getDenyButton(); - var cancelButton = getCancelButton(); - if (!actions || !confirmButton || !denyButton || !cancelButton) { - return; - } - /** @type HTMLElement[] */ - var buttons = [confirmButton, denyButton, cancelButton]; - if (document.activeElement instanceof HTMLElement && !buttons.includes(document.activeElement)) { - return; - } - var sibling = arrowKeysNextButton.includes(key) ? 'nextElementSibling' : 'previousElementSibling'; - var buttonToFocus = document.activeElement; - if (!buttonToFocus) { - return; - } - for (var i = 0; i < actions.children.length; i++) { - buttonToFocus = buttonToFocus[sibling]; - if (!buttonToFocus) { - return; - } - if (buttonToFocus instanceof HTMLButtonElement && isVisible$1(buttonToFocus)) { - break; - } - } - if (buttonToFocus instanceof HTMLButtonElement) { - buttonToFocus.focus(); - } - }; - - /** - * @param {KeyboardEvent} event - * @param {SweetAlertOptions} innerParams - * @param {Function} dismissWith - */ - var handleEsc = function handleEsc(event, innerParams, dismissWith) { - if (callIfFunction(innerParams.allowEscapeKey)) { - event.preventDefault(); - dismissWith(DismissReason.esc); - } - }; - - /** - * This module contains `WeakMap`s for each effectively-"private property" that a `Swal` has. - * For example, to set the private property "foo" of `this` to "bar", you can `privateProps.foo.set(this, 'bar')` - * This is the approach that Babel will probably take to implement private methods/fields - * https://github.com/tc39/proposal-private-methods - * https://github.com/babel/babel/pull/7555 - * Once we have the changes from that PR in Babel, and our core class fits reasonable in *one module* - * then we can use that language feature. - */ - - var privateMethods = { - swalPromiseResolve: new WeakMap(), - swalPromiseReject: new WeakMap() - }; - - // From https://developer.paciellogroup.com/blog/2018/06/the-current-state-of-modal-dialog-accessibility/ - // Adding aria-hidden="true" to elements outside of the active modal dialog ensures that - // elements not within the active modal dialog will not be surfaced if a user opens a screen - // reader’s list of elements (headings, form controls, landmarks, etc.) in the document. - - var setAriaHidden = function setAriaHidden() { - var bodyChildren = Array.from(document.body.children); - bodyChildren.forEach(function (el) { - if (el === getContainer() || el.contains(getContainer())) { - return; - } - if (el.hasAttribute('aria-hidden')) { - el.setAttribute('data-previous-aria-hidden', el.getAttribute('aria-hidden') || ''); - } - el.setAttribute('aria-hidden', 'true'); - }); - }; - var unsetAriaHidden = function unsetAriaHidden() { - var bodyChildren = Array.from(document.body.children); - bodyChildren.forEach(function (el) { - if (el.hasAttribute('data-previous-aria-hidden')) { - el.setAttribute('aria-hidden', el.getAttribute('data-previous-aria-hidden') || ''); - el.removeAttribute('data-previous-aria-hidden'); - } else { - el.removeAttribute('aria-hidden'); - } - }); - }; - - // @ts-ignore - var isSafariOrIOS = typeof window !== 'undefined' && !!window.GestureEvent; // true for Safari desktop + all iOS browsers https://stackoverflow.com/a/70585394 - - /** - * Fix iOS scrolling - * http://stackoverflow.com/q/39626302 - */ - var iOSfix = function iOSfix() { - if (isSafariOrIOS && !hasClass(document.body, swalClasses.iosfix)) { - var offset = document.body.scrollTop; - document.body.style.top = "".concat(offset * -1, "px"); - addClass(document.body, swalClasses.iosfix); - lockBodyScroll(); - } - }; - - /** - * https://github.com/sweetalert2/sweetalert2/issues/1246 - */ - var lockBodyScroll = function lockBodyScroll() { - var container = getContainer(); - if (!container) { - return; - } - /** @type {boolean} */ - var preventTouchMove; - /** - * @param {TouchEvent} event - */ - container.ontouchstart = function (event) { - preventTouchMove = shouldPreventTouchMove(event); - }; - /** - * @param {TouchEvent} event - */ - container.ontouchmove = function (event) { - if (preventTouchMove) { - event.preventDefault(); - event.stopPropagation(); - } - }; - }; - - /** - * @param {TouchEvent} event - * @returns {boolean} - */ - var shouldPreventTouchMove = function shouldPreventTouchMove(event) { - var target = event.target; - var container = getContainer(); - var htmlContainer = getHtmlContainer(); - if (!container || !htmlContainer) { - return false; - } - if (isStylus(event) || isZoom(event)) { - return false; - } - if (target === container) { - return true; - } - if (!isScrollable(container) && target instanceof HTMLElement && target.tagName !== 'INPUT' && - // #1603 - target.tagName !== 'TEXTAREA' && - // #2266 - !(isScrollable(htmlContainer) && - // #1944 - htmlContainer.contains(target))) { - return true; - } - return false; - }; - - /** - * https://github.com/sweetalert2/sweetalert2/issues/1786 - * - * @param {*} event - * @returns {boolean} - */ - var isStylus = function isStylus(event) { - return event.touches && event.touches.length && event.touches[0].touchType === 'stylus'; - }; - - /** - * https://github.com/sweetalert2/sweetalert2/issues/1891 - * - * @param {TouchEvent} event - * @returns {boolean} - */ - var isZoom = function isZoom(event) { - return event.touches && event.touches.length > 1; - }; - var undoIOSfix = function undoIOSfix() { - if (hasClass(document.body, swalClasses.iosfix)) { - var offset = parseInt(document.body.style.top, 10); - removeClass(document.body, swalClasses.iosfix); - document.body.style.top = ''; - document.body.scrollTop = offset * -1; - } - }; - - /** - * Measure scrollbar width for padding body during modal show/hide - * https://github.com/twbs/bootstrap/blob/master/js/src/modal.js - * - * @returns {number} - */ - var measureScrollbar = function measureScrollbar() { - var scrollDiv = document.createElement('div'); - scrollDiv.className = swalClasses['scrollbar-measure']; - document.body.appendChild(scrollDiv); - var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth; - document.body.removeChild(scrollDiv); - return scrollbarWidth; - }; - - /** - * Remember state in cases where opening and handling a modal will fiddle with it. - * @type {number | null} - */ - var previousBodyPadding = null; - - /** - * @param {string} initialBodyOverflow - */ - var replaceScrollbarWithPadding = function replaceScrollbarWithPadding(initialBodyOverflow) { - // for queues, do not do this more than once - if (previousBodyPadding !== null) { - return; - } - // if the body has overflow - if (document.body.scrollHeight > window.innerHeight || initialBodyOverflow === 'scroll' // https://github.com/sweetalert2/sweetalert2/issues/2663 - ) { - // add padding so the content doesn't shift after removal of scrollbar - previousBodyPadding = parseInt(window.getComputedStyle(document.body).getPropertyValue('padding-right')); - document.body.style.paddingRight = "".concat(previousBodyPadding + measureScrollbar(), "px"); - } - }; - var undoReplaceScrollbarWithPadding = function undoReplaceScrollbarWithPadding() { - if (previousBodyPadding !== null) { - document.body.style.paddingRight = "".concat(previousBodyPadding, "px"); - previousBodyPadding = null; - } - }; - - /** - * @param {SweetAlert} instance - * @param {HTMLElement} container - * @param {boolean} returnFocus - * @param {Function} didClose - */ - function removePopupAndResetState(instance, container, returnFocus, didClose) { - if (isToast()) { - triggerDidCloseAndDispose(instance, didClose); - } else { - restoreActiveElement(returnFocus).then(function () { - return triggerDidCloseAndDispose(instance, didClose); - }); - removeKeydownHandler(globalState); - } - - // workaround for https://github.com/sweetalert2/sweetalert2/issues/2088 - // for some reason removing the container in Safari will scroll the document to bottom - if (isSafariOrIOS) { - container.setAttribute('style', 'display:none !important'); - container.removeAttribute('class'); - container.innerHTML = ''; - } else { - container.remove(); - } - if (isModal()) { - undoReplaceScrollbarWithPadding(); - undoIOSfix(); - unsetAriaHidden(); - } - removeBodyClasses(); - } - - /** - * Remove SweetAlert2 classes from body - */ - function removeBodyClasses() { - removeClass([document.documentElement, document.body], [swalClasses.shown, swalClasses['height-auto'], swalClasses['no-backdrop'], swalClasses['toast-shown']]); - } - - /** - * Instance method to close sweetAlert - * - * @param {any} resolveValue - */ - function close(resolveValue) { - resolveValue = prepareResolveValue(resolveValue); - var swalPromiseResolve = privateMethods.swalPromiseResolve.get(this); - var didClose = triggerClosePopup(this); - if (this.isAwaitingPromise) { - // A swal awaiting for a promise (after a click on Confirm or Deny) cannot be dismissed anymore #2335 - if (!resolveValue.isDismissed) { - handleAwaitingPromise(this); - swalPromiseResolve(resolveValue); - } - } else if (didClose) { - // Resolve Swal promise - swalPromiseResolve(resolveValue); - } - } - var triggerClosePopup = function triggerClosePopup(instance) { - var popup = getPopup(); - if (!popup) { - return false; - } - var innerParams = privateProps.innerParams.get(instance); - if (!innerParams || hasClass(popup, innerParams.hideClass.popup)) { - return false; - } - removeClass(popup, innerParams.showClass.popup); - addClass(popup, innerParams.hideClass.popup); - var backdrop = getContainer(); - removeClass(backdrop, innerParams.showClass.backdrop); - addClass(backdrop, innerParams.hideClass.backdrop); - handlePopupAnimation(instance, popup, innerParams); - return true; - }; - - /** - * @param {any} error - */ - function rejectPromise(error) { - var rejectPromise = privateMethods.swalPromiseReject.get(this); - handleAwaitingPromise(this); - if (rejectPromise) { - // Reject Swal promise - rejectPromise(error); - } - } - - /** - * @param {SweetAlert} instance - */ - var handleAwaitingPromise = function handleAwaitingPromise(instance) { - if (instance.isAwaitingPromise) { - delete instance.isAwaitingPromise; - // The instance might have been previously partly destroyed, we must resume the destroy process in this case #2335 - if (!privateProps.innerParams.get(instance)) { - instance._destroy(); - } - } - }; - - /** - * @param {any} resolveValue - * @returns {SweetAlertResult} - */ - var prepareResolveValue = function prepareResolveValue(resolveValue) { - // When user calls Swal.close() - if (typeof resolveValue === 'undefined') { - return { - isConfirmed: false, - isDenied: false, - isDismissed: true - }; - } - return Object.assign({ - isConfirmed: false, - isDenied: false, - isDismissed: false - }, resolveValue); - }; - - /** - * @param {SweetAlert} instance - * @param {HTMLElement} popup - * @param {SweetAlertOptions} innerParams - */ - var handlePopupAnimation = function handlePopupAnimation(instance, popup, innerParams) { - var container = getContainer(); - // If animation is supported, animate - var animationIsSupported = animationEndEvent && hasCssAnimation(popup); - if (typeof innerParams.willClose === 'function') { - innerParams.willClose(popup); - } - if (animationIsSupported) { - animatePopup(instance, popup, container, innerParams.returnFocus, innerParams.didClose); - } else { - // Otherwise, remove immediately - removePopupAndResetState(instance, container, innerParams.returnFocus, innerParams.didClose); - } - }; - - /** - * @param {SweetAlert} instance - * @param {HTMLElement} popup - * @param {HTMLElement} container - * @param {boolean} returnFocus - * @param {Function} didClose - */ - var animatePopup = function animatePopup(instance, popup, container, returnFocus, didClose) { - if (!animationEndEvent) { - return; - } - globalState.swalCloseEventFinishedCallback = removePopupAndResetState.bind(null, instance, container, returnFocus, didClose); - popup.addEventListener(animationEndEvent, function (e) { - if (e.target === popup) { - globalState.swalCloseEventFinishedCallback(); - delete globalState.swalCloseEventFinishedCallback; - } - }); - }; - - /** - * @param {SweetAlert} instance - * @param {Function} didClose - */ - var triggerDidCloseAndDispose = function triggerDidCloseAndDispose(instance, didClose) { - setTimeout(function () { - if (typeof didClose === 'function') { - didClose.bind(instance.params)(); - } - // instance might have been destroyed already - if (instance._destroy) { - instance._destroy(); - } - }); - }; - - /** - * Shows loader (spinner), this is useful with AJAX requests. - * By default the loader be shown instead of the "Confirm" button. - * - * @param {HTMLButtonElement | null} [buttonToReplace] - */ - var showLoading = function showLoading(buttonToReplace) { - var popup = getPopup(); - if (!popup) { - new Swal(); // eslint-disable-line no-new - } - popup = getPopup(); - if (!popup) { - return; - } - var loader = getLoader(); - if (isToast()) { - hide(getIcon()); - } else { - replaceButton(popup, buttonToReplace); - } - show(loader); - popup.setAttribute('data-loading', 'true'); - popup.setAttribute('aria-busy', 'true'); - popup.focus(); - }; - - /** - * @param {HTMLElement} popup - * @param {HTMLButtonElement | null} [buttonToReplace] - */ - var replaceButton = function replaceButton(popup, buttonToReplace) { - var actions = getActions(); - var loader = getLoader(); - if (!actions || !loader) { - return; - } - if (!buttonToReplace && isVisible$1(getConfirmButton())) { - buttonToReplace = getConfirmButton(); - } - show(actions); - if (buttonToReplace) { - hide(buttonToReplace); - loader.setAttribute('data-button-to-replace', buttonToReplace.className); - actions.insertBefore(loader, buttonToReplace); - } - addClass([popup, actions], swalClasses.loading); - }; - - /** - * @param {SweetAlert} instance - * @param {SweetAlertOptions} params - */ - var handleInputOptionsAndValue = function handleInputOptionsAndValue(instance, params) { - if (params.input === 'select' || params.input === 'radio') { - handleInputOptions(instance, params); - } else if (['text', 'email', 'number', 'tel', 'textarea'].some(function (i) { - return i === params.input; - }) && (hasToPromiseFn(params.inputValue) || isPromise(params.inputValue))) { - showLoading(getConfirmButton()); - handleInputValue(instance, params); - } - }; - - /** - * @param {SweetAlert} instance - * @param {SweetAlertOptions} innerParams - * @returns {SweetAlertInputValue} - */ - var getInputValue = function getInputValue(instance, innerParams) { - var input = instance.getInput(); - if (!input) { - return null; - } - switch (innerParams.input) { - case 'checkbox': - return getCheckboxValue(input); - case 'radio': - return getRadioValue(input); - case 'file': - return getFileValue(input); - default: - return innerParams.inputAutoTrim ? input.value.trim() : input.value; - } - }; - - /** - * @param {HTMLInputElement} input - * @returns {number} - */ - var getCheckboxValue = function getCheckboxValue(input) { - return input.checked ? 1 : 0; - }; - - /** - * @param {HTMLInputElement} input - * @returns {string | null} - */ - var getRadioValue = function getRadioValue(input) { - return input.checked ? input.value : null; - }; - - /** - * @param {HTMLInputElement} input - * @returns {FileList | File | null} - */ - var getFileValue = function getFileValue(input) { - return input.files && input.files.length ? input.getAttribute('multiple') !== null ? input.files : input.files[0] : null; - }; - - /** - * @param {SweetAlert} instance - * @param {SweetAlertOptions} params - */ - var handleInputOptions = function handleInputOptions(instance, params) { - var popup = getPopup(); - if (!popup) { - return; - } - /** - * @param {Record} inputOptions - */ - var processInputOptions = function processInputOptions(inputOptions) { - if (params.input === 'select') { - populateSelectOptions(popup, formatInputOptions(inputOptions), params); - } else if (params.input === 'radio') { - populateRadioOptions(popup, formatInputOptions(inputOptions), params); - } - }; - if (hasToPromiseFn(params.inputOptions) || isPromise(params.inputOptions)) { - showLoading(getConfirmButton()); - asPromise(params.inputOptions).then(function (inputOptions) { - instance.hideLoading(); - processInputOptions(inputOptions); - }); - } else if (_typeof(params.inputOptions) === 'object') { - processInputOptions(params.inputOptions); - } else { - error("Unexpected type of inputOptions! Expected object, Map or Promise, got ".concat(_typeof(params.inputOptions))); - } - }; - - /** - * @param {SweetAlert} instance - * @param {SweetAlertOptions} params - */ - var handleInputValue = function handleInputValue(instance, params) { - var input = instance.getInput(); - if (!input) { - return; - } - hide(input); - asPromise(params.inputValue).then(function (inputValue) { - input.value = params.input === 'number' ? "".concat(parseFloat(inputValue) || 0) : "".concat(inputValue); - show(input); - input.focus(); - instance.hideLoading(); - })["catch"](function (err) { - error("Error in inputValue promise: ".concat(err)); - input.value = ''; - show(input); - input.focus(); - instance.hideLoading(); - }); - }; - - /** - * @param {HTMLElement} popup - * @param {InputOptionFlattened[]} inputOptions - * @param {SweetAlertOptions} params - */ - function populateSelectOptions(popup, inputOptions, params) { - var select = getDirectChildByClass(popup, swalClasses.select); - if (!select) { - return; - } - /** - * @param {HTMLElement} parent - * @param {string} optionLabel - * @param {string} optionValue - */ - var renderOption = function renderOption(parent, optionLabel, optionValue) { - var option = document.createElement('option'); - option.value = optionValue; - setInnerHtml(option, optionLabel); - option.selected = isSelected(optionValue, params.inputValue); - parent.appendChild(option); - }; - inputOptions.forEach(function (inputOption) { - var optionValue = inputOption[0]; - var optionLabel = inputOption[1]; - // spec: - // https://www.w3.org/TR/html401/interact/forms.html#h-17.6 - // "...all OPTGROUP elements must be specified directly within a SELECT element (i.e., groups may not be nested)..." - // check whether this is a - if (Array.isArray(optionLabel)) { - // if it is an array, then it is an - var optgroup = document.createElement('optgroup'); - optgroup.label = optionValue; - optgroup.disabled = false; // not configurable for now - select.appendChild(optgroup); - optionLabel.forEach(function (o) { - return renderOption(optgroup, o[1], o[0]); - }); - } else { - // case of