new class{constructor(){var e=jQuery;this.request,this.searchForm=e(".betterdocs-searchform"),this.searchField=e(".betterdocs-search-field"),this.searchCategory=e(".betterdocs-search-category"),this.popularSearch=e(".betterdocs-popular-search-keyword .popular-keyword"),this.searchClose=e(".docs-search-close"),this.liveSearch(),this.searchModal(),this.searchTab()}liveSearch(){var e=jQuery,t=this;this.popularSearch.on("click",(function(t){t.preventDefault();let r=e(this).text();e(this).parent(".betterdocs-popular-search-keyword").siblings(".betterdocs-searchform").find(".betterdocs-search-field").val(r).trigger("propertychange")})),this.searchForm.on("keyup keypress",(function(e){if(13===(e.keyCode||e.which))return e.preventDefault(),!1})),this.searchField.on("input propertychange paste",(function(r){let s=e(this),c=e(this).val(),a=s.parent(".betterdocs-searchform-input-wrap").siblings(".betterdocs-search-category").find(":selected").val(),o=s.parent().parent(".betterdocs-searchform"),i=s.parent().parent(".betterdocs-searchform").find(".betterdocs-search-kbslug").val();if(!c.length){var n=s.parents(".betterdocs-live-search").find(".betterdocs-search-result-wrap");n.length>0&&n.each((function(t){e(n[t]).remove()}))}t.liveSearchAction(r,s,c,a,o,i)})),this.searchCategory.on("change",(function(r){let s=e(this),c=s.siblings(".betterdocs-searchform-input-wrap").children(".betterdocs-search-field").val(),a=e(this).find(":selected").val(),o=s.parent(".betterdocs-searchform"),i=s.parent(".betterdocs-searchform").find(".betterdocs-search-kbslug").val();t.liveSearchAction(r,s,c,a,o,i)})),this.liveSearchAction=function(e,r,s,c,a,o){jQuery;let i=r.parent(".betterdocs-searchform").find(".betterdocs-search-result-wrap"),n=r.parent().find(".docs-search-loader"),h=r.parent().find(".docs-search-close"),d=betterdocsSearchConfig.search_letter_limit;"a"!=e.key&&17!=e.keyCode&&91!=e.keyCode&&s.length>=d?t.delay((function(){t.ajaxLoad(s,c,o,a,i,n,h,r)}),400):s.length||(r.parent().parent(".betterdocs-live-search").find(".betterdocs-search-result-wrap").addClass("hideArrow"),r.parent().parent(".betterdocs-live-search").find(".docs-search-result").slideUp(300),n.hide(),h.hide())},this.searchClose.on("click",(function(){e(this).hide(),e(this).parent().parent().find(".betterdocs-search-result-wrap").addClass("hideArrow"),e(this).parent().parent().find(".docs-search-result").slideUp(300),e(this).siblings(".betterdocs-search-field").val("")})),this.delay=function(){let e=0;return function(t,r){return clearTimeout(e),e=setTimeout(t,r),e}}(),this.ajaxLoad=function(e,t,r,s,c,a,o,i){var n=jQuery;let h;h&&h.abort(),h=n.ajax({url:betterdocsSearchConfig.ajax_url,type:"post",data:{action:"betterdocs_get_search_result",search_input:e,search_cat:t,kb_slug:r,is_post_type_archive:betterdocsSearchConfigTwo?.is_post_type_archive},beforeSend:function(){a.show(),o.hide(),c.addClass("hideArrow"),n(".betterdocs-live-search .docs-search-result").slideUp(400)},success:function(e){c.remove(),a.hide(),o.show();let t=betterdocsSearchConfig.search_letter_limit;if(i.val().length<t){var r=n(".betterdocs-live-search").find(".betterdocs-search-result-wrap");return r.length>0&&r.each((function(e){n(r[e]).slideUp(400)})),void o.hide()}s.append(e.data.post_lists)}})}}searchModal(){var e=jQuery;function t(){e(".betterdocs-search-wrapper").fadeIn()}function r(){e(".betterdocs-search-wrapper").fadeOut()}e(".betterdocs-search-popup .betterdocs-search-field").on("click",(function(){t()})),e(document).on("keydown",(function(e){(e.metaKey||e.ctrlKey)&&"k"===e.key&&(e.preventDefault(),t())})),e(document).on("click",(function(t){e(t.target).closest(".betterdocs-search-details").length||e(t.target).is(".betterdocs-search-popup .betterdocs-search-field")||r()})),e(document).on("keydown",(function(e){"Escape"===e.key&&r()}))}searchTab(){var e=jQuery;function t(t){e(".betterdocs-search-tabs .betterdocs-tab-items").removeClass("active"),e(".betterdocs-search-items-wrapper .betterdocs-search-item-content").removeClass("active"),e(".betterdocs-search-tabs .betterdocs-tab-items").eq(t).addClass("active"),e(".betterdocs-search-items-wrapper .betterdocs-search-item-content").eq(t).addClass("active")}e(".betterdocs-search-tabs .betterdocs-tab-items").on("click",(function(){t(e(this).index())})),t(0)}};