!function(){"use strict";var e=function(){return(e=Object.assign||function(e){for(var t,s=1,i=arguments.length;s',l=t.data("swpparentel");l?(this.parent_el=jQuery(l),this.parent_el.html(h)):this.config.parent_el?(this.parent_el=jQuery(this.config.parent_el),this.parent_el.html(h)):jQuery("body").append(jQuery(h)),this.results_el=jQuery("#"+this.results_id),this.position_results(),jQuery(window).resize((function(){e.position_results()})),this.config.spinner&&(void 0===this.config.spinner.scale&&(this.config.spinner.scale=1),void 0===this.config.spinner.fadeColor&&(this.config.spinner.fadeColor="transparent"),void 0===this.config.spinner.animation&&(this.config.spinner.animation="searchwp-spinner-line-fade-quick"),void 0===this.config.spinner.position&&(this.config.spinner.position="absolute"),this.spinner=new s(this.config.spinner)),void 0===this.config.abort_on_enter&&(this.config.abort_on_enter=!0),t.keyup((function(t){jQuery.inArray(t.keyCode,e.a11y_keys)>-1||(e.current_request&&e.config.abort_on_enter&&13===t.keyCode&&e.current_request.abort(),jQuery.trim(e.input_el.val()).length?e.results_showing||(e.position_results(),e.results_el.addClass("searchwp-live-search-results-showing"),e.show_spinner(),e.results_showing=!0):e.destroy_results(),e.has_results&&!e.spinner_showing&&e.last_string!==jQuery.trim(e.input_el.val())&&(e.results_el.empty(),e.show_spinner()),t.currentTarget.value.length>=e.config.input.min_chars?e.results_el.removeClass("searchwp-live-search-no-min-chars"):e.results_el.addClass("searchwp-live-search-no-min-chars"))})).keyup(jQuery.proxy(this.maybe_search,this)),(this.config.results_destroy_on_blur||void 0===this.config.results_destroy_on_blur)&&jQuery("html").click((function(t){jQuery(t.target).parents(".searchwp-live-search-results").length||e.destroy_results()})),t.click((function(e){e.stopPropagation()}))}else alert(searchwp_live_search_params.msg_no_config_found)},keyboard_navigation:function(){var e=this,t=this.input_el,s=this.results_el,i="searchwp-live-search-result--focused",r=".searchwp-live-search-result",n=this.a11y_keys;jQuery(document).off("keyup.searchwp_a11y").on("keyup.searchwp_a11y",(function(a){if(s.hasClass("searchwp-live-search-results-showing")){if(-1!==jQuery.inArray(a.keyCode,n)){if(a.preventDefault(),27===a.keyCode&&!t.is(":focus"))return e.destroy_results(),jQuery(document).off("keyup.searchwp_a11y"),t.focus(),void jQuery(document).trigger("searchwp_live_escape_results");if(40===a.keyCode){var o=jQuery(s[0]).find("."+i);1===o.length&&1===o.next().length?o.removeClass(i).attr("aria-selected","false").next().addClass(i).attr("aria-selected","true").find("a").focus():(o.removeClass(i).attr("aria-selected","false"),s.find(r+":first").addClass(i).attr("aria-selected","true").find("a").focus()),jQuery(document).trigger("searchwp_live_key_arrowdown_pressed")}if(38===a.keyCode){var h=jQuery(s[0]).find("."+i);1===h.length&&1===h.prev().length?h.removeClass(i).attr("aria-selected","false").prev().addClass(i).attr("aria-selected","true").find("a").focus():(h.removeClass(i).attr("aria-selected","false"),s.find(r+":last").addClass(i).attr("aria-selected","true").find("a").focus()),jQuery(document).trigger("searchwp_live_key_arrowup_pressed")}13===a.keyCode&&jQuery(document).trigger("searchwp_live_key_enter_pressed"),9===a.keyCode&&jQuery(document).trigger("searchwp_live_key_tab_pressed")}}else jQuery(document).off("keyup.searchwp_a11y")})),jQuery(document).trigger("searchwp_live_keyboad_navigation")},aria_expanded:function(e){var t=this.results_el;e?t.attr("aria-expanded","true"):t.attr("aria-expanded","false"),jQuery(document).trigger("searchwp_live_aria_expanded")},position_results:function(){var e=this.input_el,t=e.offset(),s=this.results_el,i=0;if(!e.is(":hidden")){switch(t.left+=parseInt(this.config.results.offset.x,10),t.top+=parseInt(this.config.results.offset.y,10),this.config.results.position){case"top":i=0-s.height();break;default:i=e.outerHeight()}s.css("left",t.left),s.css("top",t.top+i+"px"),"auto"===this.config.results.width&&s.width(e.outerWidth()-parseInt(s.css("paddingRight").replace("px",""),10)-parseInt(s.css("paddingLeft").replace("px",""),10)),jQuery(document).trigger("searchwp_live_position_results",[s.css("left"),s.css("top"),s.width()])}},destroy_results:function(e){this.hide_spinner(),this.aria_expanded(!1),this.results_el.empty().removeClass("searchwp-live-search-results-showing"),this.results_showing=!1,this.has_results=!1,jQuery(document).trigger("searchwp_live_destroy_results")},maybe_search:function(e){jQuery.inArray(e.keyCode,this.a11y_keys)>-1||(clearTimeout(this.timer),e.currentTarget.value.length>=this.config.input.min_chars&&(this.current_request&&this.current_request.abort(),this.timer=setTimeout(jQuery.proxy(this.search,this,e),this.config.input.delay)))},show_spinner:function(){this.config.spinner&&!this.spinner_showing&&(this.spinner.spin(document.getElementById(this.results_id)),this.spinner_showing=!0,jQuery(document).trigger("searchwp_live_show_spinner"))},hide_spinner:function(){this.config.spinner&&(this.spinner.stop(),this.spinner_showing=!1,jQuery(document).trigger("searchwp_live_hide_spinner"))},search:function(e){var t=this,s=this.form_el,i=s.serialize(),r=s.attr("action")?s.attr("action"):"",n=this.input_el,a=this.results_el;jQuery(document).trigger("searchwp_live_search_start",[n,a,s,r,i]),this.aria_expanded(!1),i+="&action=searchwp_live_search&swpengine="+n.data("swpengine")+"&swpquery="+encodeURIComponent(n.val())+"&origin_id="+parseInt(searchwp_live_search_params.origin_id,10),-1!==r.indexOf("?")&&(r=r.split("?"),i+="&"+r[1]),this.last_string=n.val(),this.has_results=!0,this.current_request=jQuery.ajax({url:searchwp_live_search_params.ajaxurl,type:"POST",data:i,complete:function(){jQuery(document).trigger("searchwp_live_search_complete",[n,a,s,r,i]),t.spinner_showing=!1,t.hide_spinner(),this.current_request=!1,jQuery(document).trigger("searchwp_live_search_shutdown",[n,a,s,r,i])},success:function(e){0===e&&(e=""),jQuery(document).trigger("searchwp_live_search_success",[n,a,s,r,i]),t.position_results(),a.html(e),t.aria_expanded(!0),t.keyboard_navigation(),jQuery(document).trigger("searchwp_live_search_shutdown",[n,a,s,r,i])}})},uniqid:function(e,t){var s;void 0===e&&(e="");var i=function(e,t){return t<(e=parseInt(e,10).toString(16)).length?e.slice(e.length-t):t>e.length?new Array(t-e.length+1).join("0")+e:e};return this.php_js||(this.php_js={}),this.php_js.uniqidSeed||(this.php_js.uniqidSeed=Math.floor(123456789*Math.random())),this.php_js.uniqidSeed++,s=e,s+=i(parseInt((new Date).getTime()/1e3,10),8),s+=i(this.php_js.uniqidSeed,5),t&&(s+=(10*Math.random()).toFixed(8).toString()),s}},jQuery.fn[e]=function(s){return this.each((function(){jQuery.data(this,"plugin_"+e)||jQuery.data(this,"plugin_"+e,new t(jQuery(this),s))})),this}}(),jQuery(document).ready((function(){"function"==typeof jQuery().searchwp_live_search&&(jQuery('input[data-swplive="true"]').searchwp_live_search(),"undefined"!=typeof _SEARCHWP_LIVE_AJAX_SEARCH_BLOCKS&&_SEARCHWP_LIVE_AJAX_SEARCH_BLOCKS&&jQuery("input.wp-block-search__input").each((function(){jQuery(this).attr("data-swpengine",_SEARCHWP_LIVE_AJAX_SEARCH_ENGINE),jQuery(this).attr("data-swpconfig",_SEARCHWP_LIVE_AJAX_SEARCH_CONFIG),jQuery(this).searchwp_live_search()})))}))}();