text: !function(s,r){"use strict";r.utilites.namespace("cherrySearch"),r.cherrySearch={settings:{searchFormWrapperClass:".cherry-search-wrapper",searchFormClass:".cherry-search__form",inputClass:".cherry-search__field",submitClass:".cherry-search__submit",listClass:".cherry-search__results-list",itemClass:".cherry-search__results-item",messageHolder:".cherry-search__message",spinner:".cherry-search__spinner",moreButton:".cherry-search__more-button",searchHandlerId:"cherry_search_public_action"},init:function(){s("body").on("focus"+this.settings.searchFormWrapperClass,this.settings.inputClass,this.initCherrySearch.bind(this))},initCherrySearch:function(r){var e=s(r.target).closest(this.settings.searchFormWrapperClass);e.cherrySearch(this.settings)}},r.cherrySearch.init(),s.fn.cherrySearch=function(e){var a=this[0],t=e,o=window.cherrySearchMessages,c=null,n=null,i=s(t.listClass,a),l=s(t.messageHolder,i),h=s(t.spinner,i),u=s(a).data("args")||[];return a.isInit?"is init: true":(a.isInit=!0,a.inputChangeHandler=function(r){var e=r.target.value;s("ul",i).html(""),a.outputMessage("",""),e?(a.showList(),h.addClass("show"),clearTimeout(c),c=setTimeout(function(){u.value=e,a.searchAjaxInstancer.sendData(u)},450)):a.hideList()},a.successCallback=function(r){var e=r.data,t=e.error,c=e.message,m=e.posts,C=null,p="";if("error-notice"!==r.type){if(0===e.post_count||t)a.outputMessage(c,"show");else{l.removeClass("show");for(C in m)"more_button"===C?p+=m[C]:(n=wp.template("search-form-results-item-"+u.id),p+=n(m[C]))}h.removeClass("show"),s("ul",i).html(p)}else a.outputMessage(o.serverError,"error show")},a.errorCallback=function(s){"abort"!==s.statusText&&(h.removeClass("show"),a.outputMessage(o.serverError,"error show"))},a.hideList=function(){i.removeClass("show")},a.showList=function(){i.addClass("show")},a.focusHandler=function(){0!==s("ul > li",i).length&&a.showList()},a.outputMessage=function(s,r){l.removeClass("error show").addClass(r).html(s)},a.formClick=function(s){s.stopPropagation()},a.clickMoreButton=function(){s(t.searchFormClass,a).submit()},a.searchAjaxInstancer=new r.CherryAjaxHandler({handlerId:t.searchHandlerId,successCallback:a.successCallback,errorCallback:a.errorCallback}),s(t.inputClass,a).on("input",a.inputChangeHandler).on("focus",a.focusHandler),s(a).on("click"+t.searchFormWrapperClass,a.formClick).on("click"+t.searchFormWrapperClass,t.moreButton,a.clickMoreButton),s("body").on("click"+t.searchFormWrapperClass,a.hideList),void 0)}}(jQuery,window.CherryJsCore);