// source --> https://www.pepiniere-lavandinpaysage.com/wp-content/plugins/woocommerce/assets/js/frontend/cart-fragments.min.js?ver=10.7.0 
jQuery(function(e){if("undefined"==typeof wc_cart_fragments_params)return!1;var t=!0,r=wc_cart_fragments_params.cart_hash_key;try{t="sessionStorage"in window&&null!==window.sessionStorage,window.sessionStorage.setItem("wc","test"),window.sessionStorage.removeItem("wc"),window.localStorage.setItem("wc","test"),window.localStorage.removeItem("wc")}catch(f){t=!1}function n(){t&&sessionStorage.setItem("wc_cart_created",(new Date).getTime())}function o(e){t&&(localStorage.setItem(r,e),sessionStorage.setItem(r,e))}var a={url:wc_cart_fragments_params.wc_ajax_url.toString().replace("%%endpoint%%","get_refreshed_fragments"),type:"POST",data:{time:(new Date).getTime()},timeout:wc_cart_fragments_params.request_timeout,success:function(r){r&&r.fragments&&(e.each(r.fragments,function(t,r){e(t).replaceWith(r)}),t&&(sessionStorage.setItem(wc_cart_fragments_params.fragment_name,JSON.stringify(r.fragments)),o(r.cart_hash),r.cart_hash&&n()),e(document.body).trigger("wc_fragments_refreshed"))},error:function(){e(document.body).trigger("wc_fragments_ajax_error")}};function s(){e.ajax(a)}if(t){var i=null;e(document.body).on("wc_fragment_refresh updated_wc_div",function(){s()}),e(document.body).on("added_to_cart removed_from_cart",function(e,t,a){var s=sessionStorage.getItem(r);null!==s&&s!==undefined&&""!==s||n(),sessionStorage.setItem(wc_cart_fragments_params.fragment_name,JSON.stringify(t)),o(a)}),e(document.body).on("wc_fragments_refreshed",function(){clearTimeout(i),i=setTimeout(s,864e5)}),e(window).on("storage onstorage",function(e){r===e.originalEvent.key&&localStorage.getItem(r)!==sessionStorage.getItem(r)&&s()}),e(window).on("pageshow",function(t){t.originalEvent.persisted&&(e(".widget_shopping_cart_content").empty(),e(document.body).trigger("wc_fragment_refresh"))});try{var c=JSON.parse(sessionStorage.getItem(wc_cart_fragments_params.fragment_name)),_=sessionStorage.getItem(r),g=Cookies.get("woocommerce_cart_hash"),m=sessionStorage.getItem("wc_cart_created");if(null!==_&&_!==undefined&&""!==_||(_=""),null!==g&&g!==undefined&&""!==g||(g=""),_&&(null===m||m===undefined||""===m))throw"No cart_created";if(m){var d=1*m+864e5,w=(new Date).getTime();if(d<w)throw"Fragment expired";i=setTimeout(s,d-w)}if(!c||!c["div.widget_shopping_cart_content"]||_!==g)throw"No fragment";e.each(c,function(t,r){e(t).replaceWith(r)}),e(document.body).trigger("wc_fragments_loaded")}catch(f){s()}}else s();Cookies.get("woocommerce_items_in_cart")>0?e(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").show():e(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").hide(),e(document.body).on("adding_to_cart",function(){e(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").show()}),"undefined"!=typeof wp&&wp.customize&&wp.customize.selectiveRefresh&&wp.customize.widgetsPreview&&wp.customize.widgetsPreview.WidgetPartial&&wp.customize.selectiveRefresh.bind("partial-content-rendered",function(){s()})});
// source --> https://www.pepiniere-lavandinpaysage.com/wp-content/themes/ecomus/assets/js/plugins/jquery.countdown.js?ver=1.0 
/**
 * jQuery Tabs plugin 1.0.0
 *
 * @author Drfuri
 */
(function ($) {
    $.fn.ecomus_countdown = function () {
        return this.each(function () {
            var $this = $(this),
                diff = $this.data('expire'),
                icon = $this.data('icon');

            var updateClock = function (distance) {
                var days = Math.floor(distance / (60 * 60 * 24));
                var hours = Math.floor((distance % (60 * 60 * 24)) / (60 * 60));
                var minutes = Math.floor((distance % (60 * 60)) / (60));
                var seconds = Math.floor(distance % 60);
                var texts = $this.data('text');
                var icons = icon ? icon : '';
                var daySimple = texts.day ? texts.day : texts.days;
                var hourSimple = texts.hour ? texts.hour : texts.hours;
                var minuteSimple = texts.minute ? texts.minute : texts.minutes;
                var secondSimple = texts.second ? texts.second : texts.seconds;

                $this.html(
                    icons +
                    '<span class="days timer"><span class="digits">' + days + '</span><span class="text">' + (days == 1 ? daySimple : texts.days) + '</span><span class="divider">:</span></span>' +
                    '<span class="hours timer"><span class="digits">' + (hours < 10 ? '0' : '') + hours + '</span><span class="text">' + (hours == 1 ? hourSimple : texts.hours) + '</span><span class="divider">:</span></span>' +
                    '<span class="minutes timer"><span class="digits">' + (minutes < 10 ? '0' : '') + minutes + '</span><span class="text">' + (minutes == 1 ? minuteSimple : texts.minutes) + '</span><span class="divider">:</span></span>' +
                    '<span class="seconds timer"><span class="digits">' + (seconds < 10 ? '0' : '') + seconds + '</span><span class="text">' + (seconds == 1 ? secondSimple : texts.seconds) + '</span></span>'
                );
            };

            updateClock(diff);

            var countdown = setInterval(function () {
                diff = diff - 1;
                var new_diff = diff < 0 ? 0 : diff;
                updateClock(new_diff);

                if (diff < 0) {
                    clearInterval(countdown);
                }
            }, 1000);
        });
    };

    /* Init tabs */
    $(function () {
        $('.ecomus-countdown').ecomus_countdown();

        $(document.body).on('ecomus_countdown', function (e, $el) {
            $el.ecomus_countdown();
        });
    });
})(jQuery);