/**
* @author Flycart (Alagesan)
* @license http://www.gnu.org/licenses/gpl-3.0.html
* @link https://www.flycart.org
* */ "undefined"==typeof wlr_jquery&&(wlr_jquery=jQuery.noConflict()),wlr=window.wlr||{},function(e){e.show_notice=function(e,t){t||(t=wlr_jquery(".woocommerce-notices-wrapper:first")||wlr_jquery(".cart-empty").closest(".woocommerce")||wlr_jquery(".woocommerce-cart-form")),t.prepend(e)},e.displayStoreNotice=function(e,t="info"){let a="is-info";"error"===t&&(a="is-error");let o=wlr_jquery(".wc-block-components-sidebar-layout.wc-block-checkout #contact-fields .wc-block-components-notices__snackbar.wc-block-components-notice-snackbar-list div");if(o.length){let n=wlr_jquery('
');o.prepend(n),setTimeout(function(){wlr_jquery(".wlr-custom-notice").remove()},2e3)}},e.removeMessage=function(){wlr_jquery(this).remove()},e.copyLink=function(e){var t=document.getElementById(e);t.select(),t.focus(),t.select(),document.execCommand("copy")};let t=[];e.socialShare=function(a,o){if(wlr_localize_data.social_share_window_open?window.open(a,o,"width=626, height=436"):window.open(a,"_blank"),!t.includes(o)){var n={action:"wlr_social_"+o,wlr_nonce:wlr_localize_data.apply_share_nonce};e.award_social_point(n),t.push(o)}},e.followUpShare=function(a,o,n){if(wlr_localize_data.followup_share_window_open?window.open(o,n,"width=626, height=436"):window.open(o,"_blank"),!t.includes(n)){var r={action:"wlr_follow_"+n,wlr_nonce:wlr_localize_data.apply_share_nonce,id:a};e.award_social_point(r),t.push(n)}},e.award_social_point=function(e){wlr_jquery.ajax({data:e,type:"post",url:wlr_localize_data.ajax_url,error:function(e,t){},success:function(e){window.location.reload()}})},wlr_jquery(document).on("revertEnable",function(e,t){wlr_jquery(".wlr-myaccount-page .wlr-revert-tool i").toggleClass("wlrf-arrow-down wlrf-arrow_right"),wlr_jquery(t).toggleClass("wlr-revert-active ")}),wlr_jquery(document).on("wlr_copy_link",function(e,t){var a=document.getElementById(t);a.disabled=!1,a.select(),a.focus(),a.select(),document.execCommand("copy"),a.disabled=!0}),wlr_jquery(document).on("readMoreLessContent",function(e,t){wlr_jquery(".wlr-myaccount-page "+t).toggleClass("show-less-content show-more-content")}),wlr_jquery(document).on("wlr_my_reward_section",function(e,t,a=!1,o=""){if(wlr_jquery(".wlr-myaccount-page .wlr-my-rewards-title").removeClass("active"),wlr_jquery(".wlr-myaccount-page .wlr-user-reward-contents .active").removeClass("active"),wlr_jquery(".wlr-myaccount-page .wlr-"+t+"-title").addClass("active"),wlr_jquery(".wlr-myaccount-page .wlr-"+t+"-container").addClass("active"),a){let n=window.location.href,r=n.indexOf("loyalty_reward");if(-1!==r){let c=n.substring(0,r+14);history.pushState({},document.title,c)}}window.location.href="#wlr-your-reward"}),wlr_jquery(document).on("click",".wlr-coupons-expired-title",function(){wlr_jquery(".wlr-myaccount-page .wlr-toggle-arrow").toggleClass("wlrf-arrow-down wlrf-arrow-up"),wlr_jquery(".wlr-myaccount-page .wlr-user-expired-reward-section").toggleClass("active ")}),wlr_jquery(document).on("wlr_get_used_reward",function(e){let t=wlr_jquery(".wlr-myaccount-page #wlr-points #wlr_currency_list").data("user-used-reward"),a=wlr_jquery(".wlr-myaccount-page #wlr-points #wlr_currency_list").data("user-used-reward-count"),o=wlr_jquery(".wlr-myaccount-page #wlr-points #wlr_currency_list").val();wlr_jquery(".wlr-myaccount-page #wlr-used-reward-value-count").html(a[o]),wlr_jquery(".wlr-myaccount-page #wlr-used-reward-value").html(t[o])}),wlr_jquery(document).on("wlr_copy_coupon",function(e,t,a){var o=wlr_jquery("");wlr_jquery("body").append(o),o.val(wlr_jquery(t).text()).select(),document.execCommand("copy"),alertify.set("notifier","position","top-right"),wlr_jquery(".wlr-myaccount-page .wlr-coupon-card .wlrf-save").toggleClass("wlrf-copy wlrf-save"),wlr_jquery(a).toggleClass("wlrf-copy wlrf-save"),o.remove()}),wlr_jquery(document).on("wlr_enable_email_sent",function(e,t){let a=wlr_jquery("#"+t).is(":checked")?1:0;wlr_jquery.ajax({url:wlr_localize_data.ajax_url,type:"POST",dataType:"json",data:{action:"wlr_enable_email_sent",wlr_nonce:wlr_localize_data.enable_sent_email_nonce,is_allow_send_email:a},success:function(e){window.location.reload()}})});let a=[];if(wlr_jquery(document).on("wlr_apply_reward_action",function(t,o,n,r="",c=!1,l=""){if(!a.includes(o)){""!==r&&e.disableButton(r);var s={action:"wlr_apply_reward",wlr_nonce:wlr_localize_data.wlr_reward_nonce,reward_id:o,type:n,is_block:wlr_localize_data.is_checkout_block};wlr_jquery.ajax({type:"POST",url:wlr_localize_data.ajax_url,data:s,dataType:"json",before:function(){},success:function(e){wlr_localize_data.is_checkout_block&&(e?.data?.message_type==="error"&&e?.data?.message?localStorage.setItem("wlr_error_message",e?.data?.message):e?.data?.message&&localStorage.setItem("wlr_success_message",e?.data?.message)),c&&""!==l&&window.location.href!==l?window.location.href=l:window.location.reload()}}),a.push(o)}}),wlr_jquery(document).on("wlr_redirect_url",function(e,t){window.location.href=t}),wlr_jquery(document).on("wlr_my_rewards_pagination",function(e,t,a,o){let n=wlr_jquery(".wlr-myaccount-page .wlr-coupons-list #wlr-endpoint-url").data("url");wlr_jquery.ajax({type:"POST",url:wlr_localize_data.ajax_url,data:{type:t,page_number:a,page_type:o,action:"wlr_my_rewards_pagination",wlr_nonce:wlr_localize_data.pagination_nonce,endpoint_url:n},dataType:"json",before:function(){},success:function(e){if(e.status){var a=wlr_jquery(".wlr-"+t+"-container");a.css("opacity",0),setTimeout(function(){a.html(e.data.html),a.css("opacity",1)},350)}}})}),wlr_jquery(document).on("wlr_apply_point_conversion_reward",function(t,a,o,n,r="",c="",l=!1,s=""){""!==c&&e.disableButton(c);let i=wlr_jquery(r).val(),u={action:"wlr_apply_reward",wlr_nonce:wlr_localize_data.wlr_reward_nonce,reward_id:a,type:o,points:i,is_block:wlr_localize_data.is_checkout_block};wlr_jquery.ajax({type:"POST",url:wlr_localize_data.ajax_url,data:u,dataType:"json",before:function(){},success:function(e){wlr_jquery(document).trigger("wlr_apply_reward_action_trigger",[e.data,wlr_localize_data]),wlr_localize_data.is_checkout_block&&(e?.data?.message_type==="error"&&e?.data?.message?localStorage.setItem("wlr_error_message",e?.data?.message):e?.data?.message&&localStorage.setItem("wlr_success_message",e?.data?.message)),l&&""!==s&&window.location.href!==s?window.location.href=s:window.location.reload()}})}),wlr_jquery(document).on("wlr_apply_point_conversion_reward_action",function(t,a,o,n,r=""){""!==r&&e.disableButton(r),alertify.prompt(wlr_localize_data.point_popup_message,n,function(e,t){var n={action:"wlr_apply_reward",wlr_nonce:wlr_localize_data.wlr_reward_nonce,reward_id:a,type:o,points:t};wlr_jquery.ajax({type:"POST",url:wlr_localize_data.ajax_url,data:n,dataType:"json",before:function(){},success:function(e){window.location.reload()}})}).setHeader("").set("labels",{ok:wlr_localize_data.popup_ok,cancel:wlr_localize_data.popup_cancel}).set("oncancel",function(){window.location.reload()})}),e.disableButton=function(e,t=!1){let a=wlr_jquery(".wlr-myaccount-page").find(".wlr-button");t?wlr_jquery(e).addClass("wlr-button-spinner"):wlr_jquery(e).toggleClass("wlr-button-action wlr-button-spinner"),wlr_jquery.each(a,function(e,t){wlr_jquery(t).hasClass("wlr-button-action")&&wlr_jquery(t).css("background","#cccccc"),t.setAttribute("disabled",!0),t.removeAttribute("onclick")}),wlr_jquery(e).hasClass("wlr-button-spinner")&&wlr_jquery(e).html('\n \n
')},wlr_jquery(document).on("wlr_calculate_point_conversion",function(e,t,a){let o=wlr_jquery(".wlr-myaccount-page #"+t),n=o.attr("data-require-point");n=isNaN(parseInt(n))?0:parseInt(n);let r=o.attr("data-discount-value");r=isNaN(parseFloat(r))?0:parseFloat(r);let c=o.attr("data-available-point");c=isNaN(parseInt(c))?0:parseInt(c);let l=isNaN(parseInt(o.val()))?0:parseInt(o.val()),s=o.attr("data-max-allowed-point"),i=o.attr("data-min-allowed-point");s=isNaN(parseInt(s))?0:parseInt(s);let u=o.attr("data-button-id");wlr_jquery("#"+u).attr("disabled",!1),wlr_jquery(".wlr-error").remove();let d=o.attr("data-is-max-changed");if(i>0&&l'+p+""),wlr_jquery(".wlr-myaccount-page .wlr-input-point-section #"+t).css({outline:"1px solid red","border-radius":"6px 0 0 6px"}),wlr_jquery(".wlr-myaccount-page .wlr-point-conversion-section #"+t+"_button").hide()}else if(s>0&&l>s){let w=o.attr("data-max-message");wlr_jquery("#"+u).attr("disabled",!0);wlr_jquery("#"+o.attr("data-section-id")).after(''+w+""),wlr_jquery(".wlr-myaccount-page .wlr-input-point-section #"+t).css({outline:"1px solid red","border-radius":"6px 0 0 6px"}),wlr_jquery(".wlr-myaccount-page .wlr-point-conversion-section #"+t+"_button").hide()}else d&&0===s?(wlr_jquery(".wlr-myaccount-page .wlr-input-point-section #"+t).css({outline:"1px solid red","border-radius":"6px 0 0 6px"}),wlr_jquery(".wlr-myaccount-page .wlr-point-conversion-section #"+t+"_button").hide()):l>c||0===l?(wlr_jquery(".wlr-myaccount-page .wlr-input-point-section #"+t).css({outline:"1px solid red","border-radius":"6px 0 0 6px"}),wlr_jquery(".wlr-myaccount-page .wlr-point-conversion-section #"+t+"_button").hide()):(wlr_jquery(".wlr-myaccount-page .wlr-input-point-section #"+t).css({outline:"unset"}),wlr_jquery(".wlr-myaccount-page .wlr-point-conversion-section #"+t+"_button").show());let m={input_value:(l/n*r).toFixed(2),input_point:l,require_point:n,discount_value:r};wlr_jquery(this).trigger("wlr_calculate_point_conversion_input_value",[m]),wlr_jquery(".wlr-myaccount-page #"+a).text(m.input_value)}),wlr_jquery(document).on("wlr_apply_social_share",function(t,a,o){e.socialShare(a,o)}),wlr_jquery(document).on("wlr_apply_followup_share",function(t,a,o,n){e.followUpShare(a,o,n)}),wlr_jquery(document).on("click","#wlr-reward-link",function(e){let t=wlr_jquery(this).data("isblock"),a={action:"wlr_show_loyalty_rewards",wlr_nonce:wlr_localize_data.wlr_redeem_nonce,is_block:t};wlr_jquery(this).css("pointer-events","none"),wlr_jquery(this).after(''),wlr_jquery.ajax({type:"POST",url:wlr_localize_data.ajax_url,data:a,dataType:"json",before:function(){},success:function(e){alertify.defaults.defaultFocusOff=!0,wlr_jquery(".wlr-dot-pulse").remove(),wlr_jquery("#wlr-reward-link").css("pointer-events",""),alertify.alert(e.data.html).setHeader("").set("label",wlr_localize_data.popup_ok)}})}),wlr_jquery(document).on("click","#wlr_point_apply_discount_button",function(t){if(1===wlr_jquery("#wlr_is_partial").val())return t.preventDefault(),!1;var a=wlr_jquery("#wlr_is_checkout").val(),o={action:"wlr_apply_loyal_discount",discount_amount:wlr_jquery("#wlr_discount_point").val(),wlr_nonce:wlr_localize_data.wlr_discount_none};return wlr_jquery.ajax({type:"POST",url:wlr_localize_data.ajax_url,data:o,dataType:"json",success:function(t){1==a?t.success&&wlr_jquery(document.body).trigger("update_checkout",{update_shipping_method:!0}):(wlr_jquery(".woocommerce-error, .woocommerce-message, .woocommerce-info").remove(),t.data.message&&e.show_notice(t.data.message),wlr_jquery(document.body).trigger("wc_update_cart",!0))}}),!1}),wlr_jquery(document).ready(function(){wlr_jquery(document).on("click",".wlr_change_product",function(){var e=wlr_jquery(this).attr("data-pid"),t=wlr_jquery(this).attr("data-rule_id"),a=wlr_jquery(this).attr("data-parent_id"),o={action:"wlr_change_reward_product_in_cart",variant_id:e,rule_unique_id:t,product_id:a,wlr_nonce:wlr_localize_data.wlr_reward_nonce};wlr_jquery.ajax({url:wlr_localize_data.ajax_url,data:o,type:"POST",success:function(e){!0==e.success&&(wlr_jquery("[name='update_cart']").removeAttr("disabled"),wlr_jquery("[name='update_cart']").trigger("click"))},error:function(e){}})}),wlr_jquery(document).on("click",".wlr-select-free-variant-product-toggle",function(e){e.preventDefault(),this.classList.toggle("wlr-select-free-variant-product-toggle-active");var t=this.nextElementSibling;"block"===t.style.display?wlr_jquery(t).slideUp(1e3):wlr_jquery(t).slideDown(1e3)})}),wlr_jquery(document).on("wlr_update_birthday_action",function(e,t,a,o){var n={action:"wlr_update_birthday",wlr_nonce:wlr_localize_data.wlr_reward_nonce,campaign_id:t,birth_date:wlr_jquery(a).val()};wlr_jquery.ajax({type:"POST",url:wlr_localize_data.ajax_url,data:n,dataType:"json",before:function(){},success:function(e){window.location.reload()}})}),e.checkDateEmpty=function(t,a){return("object"==typeof t||0!==Object.keys(t).length)&&"string"==typeof a&&e.validateDate(t,a)},e.validateDate=function(t,a){if("object"!=typeof t&&0===Object.keys(t).length||"string"!=typeof a)return!1;let o=parseInt(t.value),n;switch(a){case"Y":let r=new Date().getFullYear();n=isNaN(o)||o<1823||o>r||4!==t.value.length?e.validationError(t,!0):e.validationError(t,!1);break;case"m":n=isNaN(o)||o<1||o>12?e.validationError(t,!0):e.validationError(t,!1);break;case"d":n=isNaN(o)||o<1||o>31?e.validationError(t,!0):e.validationError(t,!1)}return n},e.validationError=function(e,t=!0){if("object"!=typeof e&&0===Object.keys(e).length||"boolean"!=typeof t)return!1;let a=!1;return t?e.style.border="3px solid red":(a=!0,e.style.border=""),a},wlr_jquery(document).on("wlr_update_birthday_date_action",function(t,a,o,n){let r=document.getElementById("wlr-customer-birth-date-day-"+o),c=document.getElementById("wlr-customer-birth-date-month-"+o),l=document.getElementById("wlr-customer-birth-date-year-"+o);if(!e.checkDateEmpty(r,"d")||!e.checkDateEmpty(c,"m")||!e.checkDateEmpty(l,"Y"))return;let s=l.value+"-"+c.value+"-"+r.value,i={action:"wlr_update_birthday",wlr_nonce:wlr_localize_data.wlr_reward_nonce,campaign_id:a,birth_date:s};wlr_jquery.ajax({type:"POST",url:wlr_localize_data.ajax_url,data:i,dataType:"json",before:function(){},success:function(e){window.location.reload()}})}),wlr_jquery(document).on("wlr_revoke_coupon",function(t,a,o){e.disableButton("#wlr-"+a+"-"+o,!0),wlr_jquery("#wlr-"+a+"-"+o).removeAttr("onclick"),alertify.confirm().set({closable:!1}),alertify.confirm(""+wlr_localize_data.revoke_coupon_message+"",function(e,t){var o={action:"wlr_revoke_coupon",wlr_nonce:wlr_localize_data.revoke_coupon_nonce,user_reward_id:a,is_block:wlr_localize_data.is_checkout_block};wlr_jquery.ajax({type:"POST",url:wlr_localize_data.ajax_url,data:o,dataType:"json",before:function(){},success:function(e){wlr_localize_data.is_checkout_block&&(!e?.data?.success&&e?.data?.message?localStorage.setItem("wlr_error_message",e?.data?.message):e?.data?.message&&localStorage.setItem("wlr_success_message",e?.data?.message)),window.location.reload()}})},function(e,t){wlr_jquery(document).trigger("revertEnable",["#wlr-"+a+"-"+o]),window.location.reload()}).setHeader("").set("labels",{ok:wlr_localize_data.popup_ok,cancel:wlr_localize_data.popup_cancel})}),wlr_localize_data.is_pro&&"1"===wlr_localize_data.is_allow_update_referral&&localStorage.getItem("wployalty_referral_code")){let o={action:"wlr_update_referral_code",wlr_nonce:wlr_localize_data.wlr_reward_nonce,referral_code:localStorage.getItem("wployalty_referral_code")};wlr_jquery.ajax({type:"POST",url:wlr_localize_data.ajax_url,data:o,dataType:"json",before:function(){},success:function(e){}})}wlr_jquery(document).on("ready",function(){let t=localStorage.getItem("wlr_error_message");t&&(e.displayStoreNotice(t,"error"),localStorage.setItem("wlr_error_message",""));let a=localStorage.getItem("wlr_success_message");a&&(e.displayStoreNotice(a),localStorage.setItem("wlr_success_message",""))}),wlr_jquery(document).on("wlr_my_reward_section_tab",function(e,t,a=""){wlr_jquery(".wlr-myaccount-page .wlr-my-rewards-title").removeClass("active"),wlr_jquery(".wlr-myaccount-page .wlr-user-reward-contents .active").removeClass("active"),wlr_jquery(".wlr-myaccount-page .wlr-"+t+"-title").addClass("active"),wlr_jquery(".wlr-myaccount-page .wlr-"+t+"-container").addClass("active")}),wlr_jquery(document).on("wlr_new_revoke_coupon",function(t,a,o,n){e.disableButton("#wlr-"+a+"-"+o,!0);let r=window.location.href;r.indexOf("active_reward_page");let c=!0;-1!==r.indexOf("active_reward_page")&&(c=!1),wlr_jquery("#wlr-"+a+"-"+o).removeAttr("onclick"),alertify.confirm().set({closable:!1}),alertify.confirm(""+wlr_localize_data.revoke_coupon_message+"",function(e,t){var o={action:"wlr_revoke_coupon",wlr_nonce:wlr_localize_data.revoke_coupon_nonce,user_reward_id:a,is_block:wlr_localize_data.is_checkout_block};wlr_jquery.ajax({type:"POST",url:wlr_localize_data.ajax_url,data:o,dataType:"json",before:function(){},success:function(e){wlr_localize_data.is_checkout_block&&(!e?.data?.success&&e?.data?.message?localStorage.setItem("wlr_error_message",e?.data?.message):e?.data?.message&&localStorage.setItem("wlr_success_message",e?.data?.message)),c?window.location.href=n:window.location.reload()}})},function(e,t){wlr_jquery(document).trigger("revertEnable",["#wlr-"+a+"-"+o]),c?window.location.href=n:window.location.reload()}).setHeader("").set("labels",{ok:wlr_localize_data.popup_ok,cancel:wlr_localize_data.popup_cancel})}),wlr_jquery(document).on("wlr_my_reward_section_pagination",function(e,t,a,o){wlr_jquery.ajax({type:"POST",url:wlr_localize_data.ajax_url,data:{type:t,page_number:a,page_type:o,action:"wlr_my_reward_section_pagination",wlr_nonce:wlr_localize_data.pagination_nonce},dataType:"json",before:function(){},success:function(e){if(e.success){let a=wlr_jquery(".wlr-"+t+"-container");a.css("opacity",0),setTimeout(function(){a.html(e.data.html),a.css("opacity",1)},350)}}})})}(wlr_jquery);