`}function getSavedBikes(){$.ajax({url:"/HqvBikeSelectionFilter/GetBikeFilters",type:"GET",success:function(n){var t="";n.forEach(function(n,i){t=t.concat(generateBikeHtml(n,i))});$("#bikeItems").html(t);t!=""&&($("#newLetter").hasClass("d-none")||$("#newLetter").addClass("d-none"),$("#bikefilter").hasClass("d-none")||$("#bikefilter").addClass("d-none"),$("#userbikes").hasClass("d-none")&&$("#userbikes").removeClass("d-none"))},error:function(){displayBarNotification("Error getting saved bikes !","warning",2e3)}})}function addNewFilter(){$("#bikeForm").trigger("reset");resetSelectList(`#modelList`);resetSelectList(`#yearList`);$("#newLetter").hasClass("d-none")||$("#newLetter").addClass("d-none");$("#userbikes").hasClass("d-none")||$("#userbikes").addClass("d-none");$("#bikefilter").hasClass("d-none")&&$("#bikefilter").removeClass("d-none")}function backToMain(){$("#newLetter").hasClass("d-none")||$("#newLetter").addClass("d-none");$("#bikefilter").hasClass("d-none")||$("#bikefilter").addClass("d-none");$("#userbikes").hasClass("d-none")&&$("#userbikes").removeClass("d-none")}function saveNewsletter(){if(!$("#subscription-checkbox").is(":checked")){displayBarNotification("Du musst den Datenschutz akzeptieren um fortzufahren","warning",2e3);return}var t=$("#modellId").val(),n=$("#newsletter-email").val();if(!n.length){displayBarNotification("Bitte gib eine gültige E-Mail-Adresse an","warning",2e3);return}if(!validEmailRegex.test(n)){displayBarNotification("Ungültige E-Mail-Adresse","warning",2e3);return}displayAjaxLoading(!0);$.ajax({type:"POST",url:"/HqvBikeSelectionFilter/ActiveSubscription",data:{modelId:t,email:n},success:function(n){var t="";n.forEach(function(n,i){t=t.concat(generateBikeHtml(n,i))});$("#bikeItems").html(t);t!=""&&backToMain();displayAjaxLoading(!1);displayBarNotification("Bike Info wurde erfolgreich aktiviert","success",2e3)},error:function(n){console.log(n);displayAjaxLoading(!1);displayBarNotification("Fehler beim aktivieren der Bike Info","error",2e3)}})}function ativeSubscription(n){var i=$(n).attr("data-modelId"),t=$(n).attr("data-email");i.length&&$("#modellId").val(i);t.length&&validEmailRegex.test(t)&&$("#newsletter-email").val(t);$("#bikefilter").hasClass("d-none")||$("#bikefilter").addClass("d-none");$("#userbikes").hasClass("d-none")||$("#userbikes").addClass("d-none");$("#newLetter").hasClass("d-none")&&$("#newLetter").removeClass("d-none")}function deativeSubscription(n){var t=$(n).attr("data-id");displayAjaxLoading(!0);$.ajax({type:"POST",url:"/HqvBikeSelectionFilter/DeativeSubscription",data:{id:t},success:function(n){var t="";n.forEach(function(n,i){t=t.concat(generateBikeHtml(n,i))});$("#bikeItems").html(t);displayAjaxLoading(!1);displayBarNotification("Bike Info wurde erfolgreich aktiviert","success",2e3)},error:function(n){console.log(n);displayAjaxLoading(!1);displayBarNotification("Fehler beim aktivieren der Bike Info","error",2e3)}})}var validEmailRegex=/^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;$(document).ready(function(){var i=window.location.href,n=new URL(i),t=n.searchParams.get("ModellId");t||n.pathname.includes("KTM-PowerParts")||n.pathname.includes("KTM-Spareparts-Kits")||n.pathname.includes("KTM-SparePartsFinder")||n.pathname.includes("KTM_PowerParts")||n.pathname.includes("KTM_Spareparts-Kits")||n.pathname.includes("KTM_SparePartsFinder")||n.pathname.includes("KTE-PowerParts")||n.pathname.includes("KTE-Spareparts-Kits")||n.pathname.includes("KTE-SparePartsFinder")?$.ajax({url:"/HqvBikeSelectionFilter/GetBikeFilter",type:"GET",data:{modelId:t},success:function(n){if(n!=!1){var t=n.ModelId,i=n.Terrain,r=n.ModelGroup,u=n.ModelName;resetSelectList(`#modelList`);resetSelectList(`#yearList`);getBrands(i,r,u,t);initEventListeners();$("#newLetter").hasClass("d-none")||$("#newLetter").addClass("d-none");$("#userbikes").hasClass("d-none")||$("#userbikes").addClass("d-none");$("#bikefilter").hasClass("d-none")&&$("#bikefilter").removeClass("d-none")}else getSavedBikes(),getBrands(),initEventListeners(),$("#modelList").val(""),$("#yearList").val("")},error:function(){getSavedBikes();getBrands();initEventListeners();$("#modelList").val("");$("#yearList").val("")}}):(getSavedBikes(),getBrands(),initEventListeners(),$("#modelList").val(""),$("#yearList").val(""))});$("#typeApproval").autocomplete({source:function(n,t){$.ajax({url:"/HqvBikeSelectionFilter/SearchTypeApprovals",data:{searchValue:n.term},success:function(n){t(n)}})},minLength:4,select:function(n,t){$("#typeApproval").val(t.item.value)}})