"use strict";function xs_show_hide_parents_elements(e){if(e){jQuery(e).find("span.toggle-indicator").toggleClass("active");var t=jQuery(e).closest(".xs-repeater-field-wrap").find(".xs-row-body"),a=t.closest(".xs-repeater-field-wrap");t&&(t.toggleClass("xs-donate-visible"),a.hasClass("xs-opened")?a.removeClass("xs-opened").addClass("xs-closed"):a.removeClass("xs-closed").addClass("xs-opened"))}}function xs_modify_lebel_name(e){if(jQuery("#"+e.id)){var t=jQuery(e).parents(".xs-repeater-field-wrap").find(".level_donate_multi");t&&t.html(jQuery(e).val())}}function xs_donate_donation_type(e){var t=document.querySelector(".xs-donate-fixed-field-section"),a=document.querySelector(".xs-donate-repeatable-field-section"),s=document.querySelector(".xs-donate-repeatable-field-section-display");t&&t.classList.toggle("xs-donate-visible"),a&&a.classList.toggle("xs-donate-visible"),s&&s.classList.toggle("xs-donate-visible")}function xs_show_hide_donate(e){var t=document.querySelectorAll(e);if(t)for(var a=0;a<t.length;a++)t[a].classList.toggle("xs-donate-visible")}function xs_show_hide_donate_multiple(e,t){var a=document.querySelectorAll(e);if(a)for(var s=0;s<a.length;s++)a[s].classList.remove("xs-donate-visible");var o=document.querySelectorAll(t);if(o)for(var n=0;n<o.length;n++)o[n].classList.add("xs-donate-visible")}function xs_show_hide_donate_attr(e,t){var a=document.querySelectorAll(e);if(a)for(var s=0;s<a.length;s++)a[s].toggleAttribute(t)}function wdp_set_defult_amount(e){var t=document.querySelectorAll(".xs_donate_set_default");if(t){for(var a=0;a<t.length;a++)t[a].checked=!1;e.checked=!0}}function wdp_set_defult_amount_pledge(e){var t=document.querySelectorAll(".xs_pledge_set_default");if(t){for(var a=0;a<t.length;a++)t[a].checked=!1;e.checked=!0}}function wdp_copyTextData(e){var t=document.querySelector("#"+e);t&&(t.select(),document.execCommand("copy"))}function wdp_status_modify_report(e){event.preventDefault();var t=e.id,a="id="+t+"&status="+e.value;jQuery.ajax({data:a,type:"get",url:window.wfp_conf.resturl+"xs-donate-form/donate-active/"+t,beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",wfp_conf.nonce)},success:function(t){if(t.error.length>0){var a=e.parentElement;if(!(o=a.querySelector(".message-donate-status"))){var s=document.createElement("span");s.setAttribute("class","message-donate-status"),a.insertBefore(s,a.childNodes[0]);var o=a.querySelector(".message-donate-status")}o.innerHTML=t.error}else t.success.length>0&&e.setAttribute("class",t.success)}})}function wdp_payment_modify_report(e){event.preventDefault();var t=e.querySelector('input[name="paymenttype"]').value,a="type="+t;jQuery.ajax({data:a,type:"get",url:window.xs_donate_url.resturl+"xs-donate-form/payment-type-modify/"+t,beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",wfp_conf.nonce)},success:function(e){if(!(e.error.length>0)&&e.success.length>0){xs_show_hide_donate_multiple(".welcome-default-check","."+t+"-target-welcome"),xs_show_hide_donate(".wfp-woocommerce-message");var a=document.querySelectorAll(".wfp-disabled-div");if(a)for(var s=0;s<a.length;s++)a[s].classList.toggle("wfp-disabled")}}})}jQuery(document).ready((function(){function e(){setTimeout((function(){var e=window.location.hash.substr(1);e&&(jQuery(".xs-donate-metabox-tabs li").removeClass("active"),jQuery('.xs-donate-metabox-tabs li a[href="#'+e+'"]').parent().addClass("active"),jQuery(".xs-donate-metabox-div > div").removeClass("active"),jQuery(".xs-donate-metabox-div > div#"+e).addClass("active"))}),15)}e(),jQuery('.xs-donate-metabox-tabs li a[href*="#"]').click((function(){e()}))})),jQuery(document).ready((function(e){jQuery(".wfdp_color_field").each((function(){e(this).wpColorPicker()}))})),jQuery(document).ready((function(e){e(".datepicker-donate").each((function(){var t=e(this).parent(".search-tab"),a=e(this).parent(".search-tab").hasClass("wfp-no-date-limit"),s={appendTo:t.get(0),dateFormat:"Y-m-d"};a||(s.maxDate="today"),e(this).flatpickr(s)}))})),jQuery(document).ready((function(e){function t(){e('input[value="crowdfunding"]').is(":checked")?e(".custom-amount-fieldset, .xs-donate-repeatable-field-section-display").hide():e(".custom-amount-fieldset, .xs-donate-repeatable-field-section-display").show()}e('input[name="xs_submit_donation_data[donation][format]"]').change(t),t()}));