!function(e){"use strict";let t,s;const a=function(e){t.toggleClass("loading",void 0===e||e)},n=function(t){s=e("#learn-press-setup-form");const a=s.serializeJSON();return e.extend(a,t||{})},c=function(s){const a=e(s);t.replaceWith(a),t=a},r=function(a){if(a.preventDefault(),!function(t){const s=t.find('input[type="email"]');let a=!0;return s.each((function(){const t=e(this);switch(t.css("border-color",""),t.attr("name")){case"settings[paypal][paypal_email]":case"settings[paypal][paypal_sandbox_email]":if(!t.closest("tr").prev().find('input[type="checkbox"]').is(":checked"))return}var s;s=this.value,/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(s)||(a=!1,t.css("border-color","#FF0000"))})),a}(s))return;const r=e(this).attr("href");t.addClass("loading"),e.post({url:r,data:n(),success(s){const a=e(s);c(a.contents().filter("#main")),LP.setUrl(r),e(".learn-press-dropdown-pages").LP("DropdownPages"),e(".learn-press-tip").LP("QuickTip"),t.removeClass("loading")}})},i=function(){const t=e(this).children(":selected").html().match(/\((.*)\)/),s=t?t[1]:"";e("#currency-pos").children().each((function(){const t=e(this);let a=t.html();switch(t.val()){case"left":a=a.replace(/\( (.*)69/,"( "+s+"69");break;case"right":a=a.replace(/9([^0-9]*) \)/,"9"+s+" )");break;case"left_with_space":a=a.replace(/\( (.*) 6/,"( "+s+" 6");break;case"right_with_space":a=a.replace(/9 (.*) \)/,"9 "+s+" )")}t.html(a)}))},o=function(){e.post({url:"",dataType:"html",data:n({"lp-ajax":"get-price-format"}),success(t){e("#preview-price").html(t)}})},l=function(t){t.preventDefault(),a(),e.post({url:e(this).attr("href"),dataType:"html",data:n({"lp-ajax":"setup-create-pages"}),success(t){c(e(t).contents().filter("#main")),e(".learn-press-dropdown-pages").LP("DropdownPages"),a(!1)}})},p=function(t){t.preventDefault();const s=e(this);a(),e.post({url:e(this).attr("href"),dataType:"html",data:{},success(t){a(!1),s.replaceWith(e(t).find("a:first").addClass("button button-primary"))}})};e((function(){t=e("#main"),s=e("#learn-press-setup-form"),e(document).on("click",".buttons .button",r).on("change","#currency",i).on("change","input, select",o).on("click","#create-pages",l).on("click","#install-sample-course",p)}))}(jQuery);