!function(e){var t={};function a(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,a),o.l=!0,o.exports}a.m=e,a.c=t,a.d=function(e,t,n){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)a.d(n,o,function(t){return e[t]}.bind(null,o));return n},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=208)}({1:function(e,t){e.exports=jQuery},177:function(e,t,a){"use strict";(function(e){a.d(t,"a",(function(){return n}));var n=function(){e.post(ajaxurl,{action:"edd_recapture_remote_install"},(function(e){e.success||!confirm(e.data.error)?window.location.href="https://recapture.io/register":location.reload()}))}}).call(this,a(1))},208:function(e,t,a){"use strict";a.r(t),function(e,t){var n=a(177),o=(a(209),{init:function(){this.general(),this.misc(),this.gateways(),this.emails()},general:function(){var t,a=e(".edd-color-picker");a.length&&a.wpColorPicker(),window.formfield="",e(document.body).on("click",".edd_settings_upload_button",(function(a){a.preventDefault();var n=e(this);window.formfield=e(n.data("input")),t||((t=wp.media.frames.file_frame=wp.media({title:n.data("uploader_title"),library:{type:"image"},button:{text:n.data("uploader_button_text")},multiple:!1})).on("menu:render:default",(function(e){e.unset("library-separator"),e.unset("gallery"),e.unset("featured-image"),e.unset("embed"),e.unset("playlist"),e.unset("video-playlist"),e.set({})})),t.on("select",(function(){t.state().get("selection").each((function(e,t){e=e.toJSON(),window.formfield.val(e.url)}))}))),t.open()})),window.formfield=""},misc:function(){var t=e('select[name="edd_settings[download_method]"]'),a=t.parent().parent().next(),n=e('input[name="edd_settings[allow_tracking]"]');"direct"===t.val()&&(a.css("opacity","0.4"),a.find("input").prop("checked",!1).prop("disabled",!0)),t.on("change",(function(){"direct"===e(this).val()?(a.css("opacity","0.4"),a.find("input").prop("checked",!1).prop("disabled",!0)):(a.find("input").prop("disabled",!1),a.css("opacity","1"))})),n.on("change",(function(){e(".allow_tracking.edd-heart").toggleClass("edd-hidden")}))},gateways:function(){e('#edd-payment-gateways input[type="checkbox"]').on("change",(function(){var t=e(this).data("gateway-key"),a=e("#edd_settings\\[default_gateway\\]"),n=a.find('option[value="'+t+'"]');n.prop("disabled",(function(e,t){return!t})),n.prop("selected")&&n.prop("selected",!1),a.trigger("chosen:updated")}))},emails:function(){e("#edd-recapture-connect").on("click",(function(t){t.preventDefault(),e(this).html(edd_vars.wait+' '),document.body.style.cursor="wait",Object(n.a)()}));var t=e('select[name="edd_settings[email_summary_recipient]"]'),a=t.val(),o=e('textarea[name="edd_settings[email_summary_custom_recipients]"]').parents("tr"),d=e("#edd-send-test-summary-save-changes-notice"),c=e("#edd-send-test-summary"),s=e("#edd-send-test-summary-notice");t.on("change",(function(){o.toggleClass("hidden"),c.removeClass("hidden updated-message"),s.empty(),d.empty(),a!==t.val()&&(c.addClass("hidden"),d.html('
'+edd_vars.test_email_save_changes+"
'+e.message+"
"+eddPayPalConnectVars.defaultError+"
";e.success?(a=e.data.account_status,e.data.actions&&e.data.actions.length&&(a+=''+e.data.actions.join(" ")+"
"),e.data.disconnect_links&&e.data.disconnect_links.length&&(document.getElementById("edd-paypal-disconnect").innerHTML=e.data.disconnect_links.join(" "))):e.data&&e.data.message&&(a=e.data.message),t.innerHTML=a,t.classList.remove("notice-success","notice-warning","notice-error");var n=e.success&&e.data.status?"notice-"+e.data.status:"notice-error";t.classList.add(n)}))}e("#edd-paypal-commerce-connect").on("click",(function(t){t.preventDefault();var a=e("#edd-paypal-commerce-errors");a.empty().removeClass("notice notice-error");var n=document.getElementById("edd-paypal-commerce-connect");n.classList.add("updating-message"),n.disabled=!0,e.post(ajaxurl,{action:"edd_paypal_commerce_connect",_ajax_nonce:e(this).data("nonce")},(function(e){if(!e.success)return console.log("Connection failure",e.data),n.classList.remove("updating-message"),n.disabled=!1,void a.html(""+e.data+"
").addClass("notice notice-error");var t=document.getElementById("edd-paypal-commerce-link");t.href=e.data.signupLink+"&displayMode=minibrowser",t.click()}))})),e("#edd-paypal-commerce-reconnect").on("click",(function(t){t.preventDefault();var a=e("#edd-paypal-commerce-errors");a.empty().removeClass("notice notice-error");var n=document.getElementById("edd-paypal-commerce-reconnect");n.classList.add("updating-message"),n.disabled=!0,e.post(ajaxurl,{action:"edd_paypal_commerce_reconnect",_ajax_nonce:e(this).data("nonce")},(function(e){if(!e.success)return console.log("Reconnect failure",e.data),n.classList.remove("updating-message"),n.disabled=!1,void a.html(""+e.data+"
").addClass("notice notice-error")}))})),t(),e(document).on("click",".edd-paypal-connect-action",(function(a){a.preventDefault();var n=e(this);n.prop("disabled",!0),n.addClass("updating-message");var o=e("#edd-paypal-commerce-connect-wrap").find(".edd-paypal-actions-error-wrap");o.length&&o.remove(),e.post(ajaxurl,{action:n.data("action"),_ajax_nonce:n.data("nonce")},(function(e){n.prop("disabled",!1),n.removeClass("updating-message"),e.success?(n.addClass("updated-message"),t()):n.parent().after(''+e.data+"
")}))}))})),window.eddPayPalOnboardingCallback=function(t,a){var n=document.getElementById("edd-paypal-commerce-connect"),o=document.getElementById("edd-paypal-commerce-errors");e.post(ajaxurl,{action:"edd_paypal_commerce_get_access_token",auth_code:t,share_id:a,_ajax_nonce:n.getAttribute("data-nonce")},(function(e){if(n.classList.remove("updating-message"),!e.success)return n.disabled=!1,o.innerHTML=""+e.data+"
",void o.classList.add("notice notice-error");n.classList.add("updated-message"),window.location.reload()}))}}).call(this,a(1))}});