$(document).ready(function(){function n(){var n=[],t;$(".document-filters .years input:checkbox.all-value").first().prop("checked")||(n=$(".document-filters .years input:checked").map(function(){return this.value}).get());t={Years:n,Language:$(".document-filters #languages").val(),Tags:$(".document-filters .tags input:checked").map(function(){return this.value}).get(),Term:$("#search-input").val()};$.ajax({type:"POST",url:"/licensing/docs/Search/GetDocuments",datatype:"json",data:JSON.stringify(t),contentType:"applicationhttps://www.microsoft.com/json",success:function(n){$("#search-results").replaceWith(n);r();i()}})}function r(){$("#selected-filters").empty();var t=$("ul.filter-list .checkbox-field input:checked").get();t.forEach(t=>{let i=$("").html(t.nextElementSibling.innerHTML).on("click",i=>{i.preventDefault(),$(".document-filters input:checkbox[value="+t.value+"]").attr("checked",!1),n()});$("#selected-filters").append(i)})}function t(n,t){$(n).children(".resultDocument").hide();$(n).children(".resultDocument").slice(0,t).show();var i=$(n).find(".documents-page-size"),r=$(n).children(".resultDocument").length;$(n).find(".documentsTo").text(Math.min($(i).val(),r))}function i(){$(".resultDocumentSection").each(function(){t(this,5)});$(".documents-page-size").change(function(){var n=$(this).closest(".resultDocumentSection");t(n,$(this).val())})}$(".document-filters input:checkbox").change(function(t){var i=$(t.target),r=i.parents(".select-all").first();i.hasClass("all-value")?r.find("input:checkbox.valid-tag").prop("checked",!1):r.find("input:checkbox.all-value").prop("checked",!1);n()});$("#languages").change(function(){n()});$("#search-form").on("submit",function(t){t.preventDefault();var i=$(".document-filters input:checkbox:checked");i.length===0?window.location.href=window.location.pathname+"?term="+$("#search-input").val():n()});$("#search-button").on("click",function(t){t.preventDefault();var i=$(".document-filters input:checkbox:checked");i.length===0?window.location.href=window.location.pathname+"?term="+$("#search-input").val():n()});$(".reset-filters-link").click(function(n){n.preventDefault();var t=$(".document-filters input:checkbox:checked");t.attr("checked",!1);window.location.href=window.location.pathname+"?term="+$("#search-input").val()});i()})