var Panel=function(){var e,a,n,t,r,s,o=!0,i=$(document.getElementById("page-loader")),c=$(".price-selection"),l=$(document.getElementById("card-month")),d=$(document.getElementById("card-year")),m=$("#licenseType").val(),u=$("#licensePurchase"),f=$("#payment-form"),p=$("#paypalPayment"),v=function(){i.show()},A=function(){i.hide()},h=function(){var e=navigator.language?navigator.language:navigator.userLanguage;moment.locale(e)},E=function(){$(window).scroll(function(e){var a=$(window).scrollTop();a>=200?$("div.scrollTop").fadeIn():a<200&&$("div.scrollTop").fadeOut()}),$("#scrollTop").on("click",function(e){$("html, body").animate({scrollTop:0},"slow")})},L=function(){$('[data-toggle="tooltip"]').tooltip({container:"body"})},T=function(e){if("year"===e)switch(m){case"master":u.val("MASTER_ANNUAL"),p.attr("href","/License/PremiumAnnual");break;case"pro":u.val("PRO_ANNUAL"),p.attr("href","/License/ProfessionalAnnual");break;case"edu-pro":u.val("EDU_ANNUAL"),p.attr("href","/License/EduAnnual");break;case"edu-team":u.val("EDU_TEAM_ANNUAL"),p.attr("href","/License/EduTeamAnnual");break;case"team":u.val("TEAM_ANNUAL"),p.attr("href","/License/TeamAnnual")}else switch(m){case"master":u.val("MASTER_MONTH"),p.attr("href","/License/Premium");break;case"pro":u.val("PRO_MONTH"),p.attr("href","/License/Professional");break;case"edu-pro":u.val("EDU_ANNUAL"),p.attr("href","/License/EduAnnual");break;case"edu-team":u.val("EDU_TEAM_MONTH"),p.attr("href","/License/EduTeam");break;case"team":u.val("TEAM_MONTH"),p.attr("href","/License/Team")}},N=function(n){var t=$(this).val();switch(c.removeClass("price-selected"),$(this).closest(".price-selection").addClass("price-selected"),t){case"year":e.addClass("hidden"),a.removeClass("hidden");break;case"month":e.removeClass("hidden"),a.addClass("hidden")}T(t)},y=function(){n.on("change",N)},b=function(){
// Initialize the type of license to purchase
switch(m){case"master":u.val("MASTER_ANNUAL"),p.attr("href","/License/PremiumAnnual");break;case"pro":u.val("PRO_ANNUAL"),p.attr("href","/License/ProfessionalAnnual");break;case"edu-pro":u.val("EDU_ANNUAL"),p.attr("href","/License/EduAnnual");break;case"edu-team":u.val("EDU_TEAM_ANNUAL"),p.attr("href","/License/EduTeamAnnual");break;case"team":u.val("TEAM_ANNUAL"),p.attr("href","/License/TeamAnnual")}},g=function(e,a){var n=$("#payment-form");if(a.error)n.find(".payment-errors").text(a.error.message),n.find("#error-payment").show(),n.find(".submit").prop("disabled",!1);else{var t=a.id;n.append($('<input type="hidden" name="stripeToken">').val(t)),n.get(0).submit()}},k=function(){f.submit(function(e){e.preventDefault();var a=!1;return""===t.val()&&(a=!0,t.addClass("error")),""===l.val()&&(a=!0,l.addClass("error")),""===d.val()&&(a=!0,d.addClass("error")),""===r.val()&&(a=!0,r.addClass("error")),!a&&(f.find(".submit").prop("disabled",!0),f.find("#make-payment").css({"pointer-events":"none"}),Stripe.card.createToken(f,g),setTimeout(function(){$("#make-payment").css({"pointer-events":""})},5e3),!1)}),n=$(".subscription-period"),t=$(document.getElementById("card-number")),r=$(document.getElementById("card-cv")),s=$(document.getElementById("make-payment")),e=$(document.getElementById("disclaimer-month")),a=$(document.getElementById("disclaimer-anual")),h(),E(),L(),y(),$(".contracted-logo").click(function(){$("html, body").animate({scrollTop:0},"slow")}),b()};return{initialize:k,showLoader:v,hideLoader:A,isPurchase:o}}();