t.attr("data-instance-count"),this.$ajax_results_container=jQuery(t.attr("data-ajax-target")),
this.results_url=t.attr("data-results-url"),this.debug_mode=t.attr("data-debug-mode"),this.update_ajax_url=t.attr("data-update-ajax-url"),this.pagination_type=t.attr("data-ajax-pagination-type"),this.auto_count=t.attr("data-auto-count"),this.auto_count_refresh_mode=t.attr("data-auto-count-refresh-mode"),this.only_results_ajax=t.attr("data-only-results-ajax"),this.scroll_to_pos=t.attr("data-scroll-to-pos"),this.custom_scroll_to=t.attr("data-custom-scroll-to"),this.scroll_on_action=t.attr("data-scroll-on-action"),this.lang_code=t.attr("data-lang-code"),this.ajax_url=t.attr("data-ajax-url"),this.ajax_form_url=t.attr("data-ajax-form-url"),this.is_rtl=t.attr("data-is-rtl"),this.display_result_method=t.attr("data-display-result-method"),this.maintain_state=t.attr("data-maintain-state"),this.ajax_action="",this.last_submit_query_params="",this.current_paged=parseInt(t.attr("data-init-paged")),this.last_load_more_html="",this.load_more_html="",this.ajax_data_type=t.attr("data-ajax-data-type"),this.ajax_target_attr=t.attr("data-ajax-target"),this.use_history_api=t.attr("data-use-history-api"),this.is_submitting=!1,this.last_ajax_request=null,"undefined"==typeof this.use_history_api&&(this.use_history_api=""),"undefined"==typeof this.pagination_type&&(this.pagination_type="normal"),"undefined"==typeof this.current_paged&&(this.current_paged=1),"undefined"==typeof this.ajax_target_attr&&(this.ajax_target_attr=""),"undefined"==typeof this.ajax_url&&(this.ajax_url=""),"undefined"==typeof this.ajax_form_url&&(this.ajax_form_url=""),"undefined"==typeof this.results_url&&(this.results_url=""),"undefined"==typeof this.scroll_to_pos&&(this.scroll_to_pos=""),"undefined"==typeof this.scroll_on_action&&(this.scroll_on_action=""),"undefined"==typeof this.custom_scroll_to&&(this.custom_scroll_to=""),this.$custom_scroll_to=jQuery(this.custom_scroll_to),"undefined"==typeof this.update_ajax_url&&(this.update_ajax_url=""),"undefined"==typeof this.debug_mode&&(this.debug_mode=""),"undefined"==typeof this.ajax_target_object&&(this.ajax_target_object=""),"undefined"==typeof this.template_is_loaded&&(this.template_is_loaded="0"),"undefined"==typeof this.auto_count_refresh_mode&&(this.auto_count_refresh_mode="0"),this.ajax_links_selector=t.attr("data-ajax-links-selector"),this.auto_update=t.attr("data-auto-update"),this.inputTimer=0,this.setInfiniteScrollContainer=function(){this.is_max_paged=!1,this.use_scroll_loader=t.attr("data-show-scroll-loader"),this.infinite_scroll_container=t.attr("data-infinite-scroll-container"),this.infinite_scroll_trigger_amount=t.attr("data-infinite-scroll-trigger"),this.infinite_scroll_result_class=t.attr("data-infinite-scroll-result-class"),this.$infinite_scroll_container=this.$ajax_results_container,"undefined"==typeof this.infinite_scroll_container?this.infinite_scroll_container="":this.$infinite_scroll_container=jQuery(t.attr("data-infinite-scroll-container")),"undefined"==typeof this.infinite_scroll_result_class&&(this.infinite_scroll_result_class=""),"undefined"==typeof this.use_scroll_loader&&(this.use_scroll_loader=1)},this.setInfiniteScrollContainer(),this.reset=function(t){return this.resetForm(t),!0},this.inputUpdate=function(t){if("undefined"==typeof t)var t=300;e.resetTimer(t)},this.dateInputType=function(){a(this);if(1==e.auto_update||1==e.auto_count_refresh_mode){var r=t.find(".sf-datepicker"),n=r.length;if(n>1){var i=0,s=0;r.each(function(){""==a(this).val()&&s++,i++}),0==s&&e.inputUpdate(1200)}else e.inputUpdate(1200)}},this.scrollToPos=function(){var r=0,n=!0;1==e.is_ajax&&("window"==e.scroll_to_pos?r=0:"form"==e.scroll_to_pos?r=t.offset().top:"results"==e.scroll_to_pos?e.$ajax_results_container.length>0&&(r=e.$ajax_results_container.offset().top):"custom"==e.scroll_to_pos?e.$custom_scroll_to.length>0&&(r=e.$custom_scroll_to.offset().top):n=!1,n&&a("html, body").stop().animate({scrollTop:r},"normal","easeOutQuad"))},this.attachActiveClass=function(){t.on("change",'input[type="radio"], input[type="checkbox"], select',function(t){var e=a(this),r=e.closest("li[data-sf-field-name]"),n=e.prop("tagName").toLowerCase(),i=e.attr("type"),s=r.prop("tagName").toLowerCase();if("input"!=n||"radio"!=i&&"checkbox"!=i||"li"!=s){if("select"==n){var o=e.children();o.removeClass("sf-option-active");var l=e.val(),u="string"==typeof l||l instanceof String?[l]:l;a(u).each(function(t,r){e.find("option[value='"+r+"']").addClass("sf-option-active")})}}else{var o=r.parent().find("li"),c=r.parent().find("input:checked");o.removeClass("sf-option-active"),c.each(function(){var t=a(this).closest("li");t.addClass("sf-option-active")})}})},this.initAutoUpdateEvents=function(){if(1==e.auto_update||1==e.auto_count_refresh_mode){t.on("change",'input[type="radio"], input[type="checkbox"], select',function(t){e.inputUpdate(200)}),t.on("input",'input[type="number"]',function(t){e.inputUpdate(800)});var r=t.find('input[type="text"]:not(.sf-datepicker)'),a=r.val();t.on("input",'input[type="text"]:not(.sf-datepicker)',function(){a!=r.val()&&e.inputUpdate(1200),a=r.val()}),t.on("keypress",'input[type="text"]:not(.sf-datepicker)',function(t){if(13==t.which)return t.preventDefault(),e.submitForm(),!1})}},this.clearTimer=function(){clearTimeout(e.inputTimer)},this.resetTimer=function(t){clearTimeout(e.inputTimer),e.inputTimer=setTimeout(e.formUpdated,t)},this.addDatePickers=function(){var r=t.find(".sf-datepicker");r.length>0&&(r.each(function(){var t=a(this),r="",n=!1,i=!1,s=t.closest(".sf_date_field");s.length>0&&(r=s.attr("data-date-format"),1==s.attr("data-date-use-year-dropdown")&&(n=!0),1==s.attr("data-date-use-month-dropdown")&&(i=!0));var o={inline:!0,showOtherMonths:!0,onSelect:function(){e.dateSelect()},dateFormat:r,changeMonth:i,changeYear:n};1==e.is_rtl&&(o.direction="rtl"),t.datepicker(o),""!=e.lang_code?a.datepicker.setDefaults(a.extend({dateFormat:r},a.datepicker.regional[e.lang_code])):a.datepicker.setDefaults(a.extend({dateFormat:r},a.datepicker.regional.en))}),0==a(".ll-skin-melon").length&&r.datepicker("widget").wrap('<div class="ll-skin-melon searchandfilter-date-picker"/>'))},this.dateSelect=function(){var t=a(this);if(1==e.auto_update||1==e.auto_count_refresh_mode){var r=t.find(".sf-datepicker"),n=r.length;if(n>1){var i=0,s=0;r.each(function(){""==a(this).val()&&s++,i++}),0==s&&e.inputUpdate(1)}else e.inputUpdate(1)}},this.addRangeSliders=function(){var r=t.find(".sf-meta-range-slider");r.length>0&&(r.each(function(){var t=a(this),r=t.attr("data-min"),n=t.attr("data-max"),i=t.attr("data-start-min"),o=t.attr("data-start-max"),l=t.attr("data-display-values-as"),u=t.attr("data-step"),c=t.find(".sf-range-min"),f=t.find(".sf-range-max"),d=t.attr("data-decimal-places"),p=t.attr("data-thousand-seperator"),h=t.attr("data-decimal-seperator"),m=wNumb({mark:h,decimals:parseFloat(d),thousand:p}),_=(parseFloat(i),m.to(parseFloat(i))),g=m.to(parseFloat(o));parseFloat(o);"textinput"==l?(c.val(_),f.val(g)):"text"==l&&(c.html(_),f.html(g));var v={range:{min:[parseFloat(r)],max:[parseFloat(n)]},start:[_,g],handles:2,connect:!0,step:parseFloat(u),behaviour:"extend-tap",format:m};1==e.is_rtl&&(v.direction="rtl");var x=a(this).find(".meta-slider")[0];"undefined"!=typeof x.noUiSlider&&x.noUiSlider.destroy(),s.create(x,v),c.off(),c.on("change",function(){x.noUiSlider.set([a(this).val(),null])}),f.off(),f.on("change",function(){x.noUiSlider.set([null,a(this).val()])}),x.noUiSlider.off("update"),x.noUiSlider.on("update",function(t,r){var a=_,n=g,i=t[r];r?g=i:_=i,"textinput"==l?(c.val(_),f.val(g)):"text"==l&&(c.html(_),f.html(g)),1!=e.auto_update&&1!=e.auto_count_refresh_mode||a==_&&n==g||e.inputUpdate(800)})}),e.clearTimer())},this.init=function(r){if("undefined"==typeof r)var r=!1;this.initAutoUpdateEvents(),this.attachActiveClass(),this.addDatePickers(),this.addRangeSliders();var n=t.find("select[data-combobox='1']");n.length>0&&n.each(function(t){var r=a(this),n=r.attr("data-combobox-nrm");if("undefined"!=typeof r.chosen){var i={search_contains:!0};"undefined"!=typeof n&&n&&(i.no_results_text=n),1==e.is_rtl&&r.addClass("chosen-rtl"),r.chosen(i)}else{var s={};1==e.is_rtl&&(s.dir="rtl"),"undefined"!=typeof n&&n&&(s.language={noResults:function(){return n}}),r.select2(s)}}),1==e.is_ajax&&e.setupAjaxPagination(),t.submit(this.submitForm),e.initWooCommerceControls(),0==r&&(e.last_submit_query_params=e.getUrlParams(!1))},this.onWindowScroll=function(t){if(!e.is_loading_more&&!e.is_max_paged){var r=a(window).scrollTop(),n=a(window).scrollTop()+a(window).height(),i=parseInt(e.infinite_scroll_trigger_amount);if(1==e.$infinite_scroll_container.length){var s=e.$infinite_scroll_container.offset().top+e.$infinite_scroll_container.height();e.$infinite_scroll_container.offset().top+e.$infinite_scroll_container.height()-r;n>s+i&&e.loadMoreResults()}}},this.stripQueryStringAndHashFromPath=function(t){return t.split("?")[0].split("#")[0]},this.gup=function(t,e){e||(e=location.href),t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var r="[\\?&]"+t+"=([^&#]*)",a=new RegExp(r),n=a.exec(e);return null==n?null:n[1]},this.getUrlParams=function(t,r,a){if("undefined"==typeof t)var t=!0;if("undefined"==typeof r)var r="";var n="",s=i.getUrlParams(e),o=Object.keys(s).length,l=0;if("undefined"!=typeof a&&s.hasOwnProperty(a)&&o--,o>0)for(var u in s)if(s.hasOwnProperty(u)){var c=!0;"undefined"!=typeof a&&u==a&&(c=!1),c&&(n+=u+"="+s[u],l<o-1&&(n+="&"),l++)}var f="",d=n;if(f=e.joinUrlParam(f,d),1==t){var p=e.$ajax_results_container.attr("data-paged");"undefined"==typeof p&&(p=1),p>1&&(f=e.joinUrlParam(f,"sf_paged="+p))}return f=e.addQueryParams(f,e.extra_query_params.all)},this.addQueryParams=function(t,r){var a="",n=Object.keys(r).length;if(n>0)for(var i in r)r.hasOwnProperty(i)&&""!=r[i]&&(a=i+"="+r[i],t=e.joinUrlParam(t,a));return t},this.addUrlParam=function(t,e){var r="";return""!=t&&(r+=t.indexOf("?")!=-1?"&":"?"),""!=e?t+r+e:t},this.joinUrlParam=function(t,e){var r="";return""!=t&&(r+="&"),""!=e?t+r+e:t},this.setAjaxResultsURLs=function(t){if("undefined"==typeof e.ajax_results_conf&&(e.ajax_results_conf=new Array),e.ajax_results_conf.processing_url="",e.ajax_results_conf.results_url="",e.ajax_results_conf.data_type="","shortcode"==e.display_result_method)e.ajax_results_conf.results_url=e.addUrlParam(e.results_url,t),""!=e.lang_code&&(t=e.joinUrlParam(t,"lang="+e.lang_code)),e.ajax_results_conf.processing_url=e.addUrlParam(e.ajax_url,t);else if("post_type_archive"==e.display_result_method){i.setTaxArchiveResultsUrl(e,e.results_url);var r=i.getResultsUrl(e,e.results_url);e.ajax_results_conf.results_url=e.addUrlParam(r,t),e.ajax_results_conf.processing_url=e.addUrlParam(r,t)}else if("custom_woocommerce_store"==e.display_result_method){i.setTaxArchiveResultsUrl(e,e.results_url);var r=i.getResultsUrl(e,e.results_url);e.ajax_results_conf.results_url=e.addUrlParam(r,t),e.ajax_results_conf.processing_url=e.addUrlParam(r,t)}else e.ajax_results_conf.results_url=e.addUrlParam(e.results_url,t),e.ajax_results_conf.processing_url=e.addUrlParam(e.ajax_url,t);e.ajax_results_conf.processing_url=e.addQueryParams(e.ajax_results_conf.processing_url,e.extra_query_params.ajax),e.ajax_results_conf.data_type=e.ajax_data_type},this.updateLoaderTag=function(t,r){var n;n=""!=e.infinite_scroll_result_class?e.$infinite_scroll_container.find(e.infinite_scroll_result_class).last().parent():e.$infinite_scroll_container;var r=n.prop("tagName"),i="div";"ol"!=r.toLowerCase()&&"ul"!=r.toLowerCase()||(i="li");var s=a("<"+i+" />").html(t.html()),o=t.prop("attributes");return a.each(o,function(){s.attr(this.name,this.value)}),s},this.loadMoreResults=function(){e.is_loading_more=!0;var t={sfid:e.sfid,targetSelector:e.ajax_target_attr,type:"load_more",object:e};e.triggerEvent("sf:ajaxstart",t);var r=e.getUrlParams(!0);e.last_submit_query_params=e.getUrlParams(!1);var n="",i="",s="",o=this.current_paged+1;if(r=e.joinUrlParam(r,"sf_paged="+o),e.setAjaxResultsURLs(r),n=e.ajax_results_conf.processing_url,i=e.ajax_results_conf.results_url,s=e.ajax_results_conf.data_type,e.last_ajax_request&&e.last_ajax_request.abort(),1==e.use_scroll_loader){var l=a("<div/>",{"class":"search-filter-scroll-loading"});l=e.updateLoaderTag(l),e.infiniteScrollAppend(l)}e.last_ajax_request=a.get(n,function(t,r,a){e.current_paged++,e.last_ajax_request=null,e.addResults(t,s)},s).fail(function(t,r,a){var i={};i.sfid=e.sfid,i.object=e,i.targetSelector=e.ajax_target_attr,i.ajaxURL=n,i.jqXHR=t,i.textStatus=r,i.errorThrown=a,e.triggerEvent("sf:ajaxerror",i)}).always(function(){var t={};t.sfid=e.sfid,t.targetSelector=e.ajax_target_attr,t.object=e,1==e.use_scroll_loader&&l.detach(),e.is_loading_more=!1,e.triggerEvent("sf:ajaxfinish",t)})},this.fetchAjaxResults=function(){var r={sfid:e.sfid,targetSelector:e.ajax_target_attr,type:"load_results",object:e};e.triggerEvent("sf:ajaxstart",r);var n=t.find('input[type="text"]:focus').not(".sf-datepicker");if(1==n.length)var s=n.attr("name");if(t.addClass("search-filter-disabled"),i.disableInputs(e),e.$ajax_results_container.animate({opacity:.5},"fast"),"pagination"==e.ajax_action){var o=e.$ajax_results_container.attr("data-paged");"undefined"==typeof o&&(o=1),i.setTaxArchiveResultsUrl(e,e.results_url),l=e.getUrlParams(!1),o>1&&(l=e.joinUrlParam(l,"sf_paged="+o))}else if("submit"==e.ajax_action){var l=e.getUrlParams(!0);e.last_submit_query_params=e.getUrlParams(!1)}var u="",c="",f="";e.setAjaxResultsURLs(l),u=e.ajax_results_conf.processing_url,c=e.ajax_results_conf.results_url,f=e.ajax_results_conf.data_type,e.last_ajax_request&&e.last_ajax_request.abort(),e.last_ajax_request=a.get(u,function(t,r,a){e.last_ajax_request=null,e.scrollResults(),e.updateResults(t,f),e.updateUrlHistory(c),e.setupAjaxPagination(),e.isSubmitting=!1,e.initWooCommerceControls()},f).fail(function(t,r,a){var n={};n.sfid=e.sfid,n.targetSelector=e.ajax_target_attr,n.object=e,n.ajaxURL=u,n.jqXHR=t,n.textStatus=r,n.errorThrown=a,e.isSubmitting=!1,e.triggerEvent("sf:ajaxerror",n)}).always(function(){e.$ajax_results_container.stop(!0,!0).animate({opacity:1},"fast");var r={};if(r.sfid=e.sfid,r.targetSelector=e.ajax_target_attr,r.object=e,t.removeClass("search-filter-disabled"),i.enableInputs(e),""!=s){var n=[];e.$fields.each(function(){var t=a(this).find("input[name='"+s+"']");1==t.length&&(n=t)}),1==n.length&&(n.focus().val(n.val()),e.focusCampo(n[0]))}t.find("input[name='_sf_search']").focus(),e.triggerEvent("sf:ajaxfinish",r)})},this.focusCampo=function(t){if(null!=t&&0!=t.value.length){if(t.createTextRange){var e=t.createTextRange();e.moveStart("character",t.value.length),e.collapse(),e.select()}else if(t.selectionStart||"0"==t.selectionStart){var r=t.value.length;t.selectionStart=r,t.selectionEnd=r,t.focus()}}else t.focus()},this.triggerEvent=function(t,r){var n=a(".searchandfilter[data-sf-form-id='"+e.sfid+"']");n.trigger(t,[r])},this.fetchAjaxForm=function(){var r={sfid:e.sfid,targetSelector:e.ajax_target_attr,type:"form",object:e};e.triggerEvent("sf:ajaxformstart",[r]),t.addClass("search-filter-disabled"),i.disableInputs(e);var n=e.getUrlParams();""!=e.lang_code&&(n=e.joinUrlParam(n,"lang="+e.lang_code));var s=e.addUrlParam(e.ajax_form_url,n),o="json";a.get(s,function(t,r,a){e.updateForm(t,o)},o).fail(function(t,r,a){var n={};n.sfid=e.sfid,n.targetSelector=e.ajax_target_attr,n.object=e,n.ajaxURL=s,n.jqXHR=t,n.textStatus=r,n.errorThrown=a,e.triggerEvent("sf:ajaxerror",[n])}).always(function(){var r={};r.sfid=e.sfid,r.targetSelector=e.ajax_target_attr,r.object=e,t.removeClass("search-filter-disabled"),i.enableInputs(e),e.triggerEvent("sf:ajaxformfinish",[r])})},this.copyListItemsContents=function(t,e){var r=this,n=new Array,i=new Array,s=t.find("> ul > li");s.each(function(t){n.push(a(this).html());var e=a(this).prop("attributes");i.push(e)});var o=0,l=e.find("> ul > li");l.each(function(t){a(this).html(n[o]);var e=a(s.get(o)),i=a(this);i.removeAttr("data-sf-taxonomy-archive"),r.copyAttributes(e,i),o++})},this.updateFormAttributes=function(t,e){var r=t.prop("attributes"),n=e.prop("attributes");a.each(n,function(){e.removeAttr(this.name)}),a.each(r,function(){e.attr(this.name,this.value)})},this.copyAttributes=function(t,e,r){if("undefined"==typeof r)var r="";var n=t.prop("attributes"),i=e.prop("attributes");a.each(i,function(){""!=r&&0==this.name.indexOf(r)&&e.removeAttr(this.name)}),a.each(n,function(){e.attr(this.name,this.value)})},this.copyFormAttributes=function(t,e){e.removeAttr("data-current-taxonomy-archive"),this.copyAttributes(t,e)},this.updateForm=function(e,r){var n=this;"json"==r&&"undefined"!=typeof e.form&&(t.off(),n.copyListItemsContents(a(e.form),t),this.init(!0),1==n.is_ajax&&n.setupAjaxPagination())},this.addResults=function(t,e){var r=this;if("json"==e)r.load_more_html=t.results;else if("html"==e){var n=a(t);r.load_more_html=n.find(r.ajax_target_attr).html()}var i=!1;if(a("<div>"+r.load_more_html+"</div>").find("[data-search-filter-action='infinite-scroll-end']").length>0&&(i=!0),""!=r.infinite_scroll_container&&(r.load_more_html=a("<div>"+r.load_more_html+"</div>").find(r.infinite_scroll_container).html()),""!=r.infinite_scroll_result_class){var s=a("<div>"+r.load_more_html+"</div>").find(r.infinite_scroll_result_class),o=a("<div/>",{});o.append(s),r.load_more_html=o.html()}i?(r.is_max_paged=!0,r.last_load_more_html=r.load_more_html,r.infiniteScrollAppend(r.load_more_html)):r.last_load_more_html!==r.load_more_html?(r.last_load_more_html=r.load_more_html,r.infiniteScrollAppend(r.load_more_html)):r.is_max_paged=!0},this.infiniteScrollAppend=function(t){""!=e.infinite_scroll_result_class?e.$infinite_scroll_container.find(e.infinite_scroll_result_class).last().after(t):e.$infinite_scroll_container.append(t)},this.updateResults=function(e,r){var n=this;if("json"==r)n.$ajax_results_container.html(e.results),"undefined"!=typeof e.form&&(t.off(),n.removeAjaxPagination(),n.copyListItemsContents(a(e.form),t),n.copyFormAttributes(a(e.form),t),t.searchAndFilter({isInit:!1}));else if("html"==r){var i=a(e);if(n.$ajax_results_container.html(i.find(n.ajax_target_attr).html()),n.$ajax_results_container.find(".searchandfilter").length>0&&n.$ajax_results_container.find(".searchandfilter").searchAndFilter(),0==n.$ajax_results_container.find(".searchandfilter[data-sf-form-id='"+n.sfid+"']").length){var s=i.find(".searchandfilter[data-sf-form-id='"+n.sfid+"']");1==s.length&&(t.off(),n.removeAjaxPagination(),n.copyListItemsContents(s,t),n.copyFormAttributes(s,t),t.searchAndFilter({isInit:!1}))}}n.is_max_paged=!1,n.current_paged=1,n.setInfiniteScrollContainer()},this.removeWooCommerceControls=function(){var t=a(".woocommerce-ordering .orderby"),e=a(".woocommerce-ordering");e.off(),t.off()},this.addQueryParam=function(t,r,a){if("undefined"==typeof a)var a="all";e.extra_query_params[a][t]=r},this.initWooCommerceControls=function(){e.removeWooCommerceControls();var r=a(".woocommerce-ordering .orderby"),n=a(".woocommerce-ordering"),i="";i=r.length>0?r.val():e.getQueryParamFromURL("orderby",window.location.href),"menu_order"==i&&(i=""),""!=i&&i&&(e.extra_query_params.all.orderby=i),n.on("submit",function(t){return t.preventDefault(),!1}),r.on("change",function(r){r.preventDefault();var n=a(this).val();return"menu_order"==n&&(n=""),e.extra_query_params.all.orderby=n,t.submit(),!1})},this.scrollResults=function(){var t=this;t.scroll_on_action!=t.ajax_action&&"all"!=t.scroll_on_action||t.scrollToPos()},this.updateUrlHistory=function(e){var r=this,a=0;window.history&&window.history.pushState&&(a=t.attr("data-use-history-api")),1==r.update_ajax_url&&1==a&&window.history&&window.history.pushState&&history.pushState(null,null,e)},this.removeAjaxPagination=function(){var t=this;if("undefined"!=typeof t.ajax_links_selector){var e=jQuery(t.ajax_links_selector);e.length>0&&e.off()}},this.canFetchAjaxResults=function(t){if("undefined"==typeof t)var t="";var e=this,r=!1;if(1==e.is_ajax){1==e.$ajax_results_container.length&&(r=!0);var a=e.results_url,n="",i=window.location.href,s=window.location.href.indexOf("#");if(s!==-1&&(i=window.location.href.substr(0,window.location.href.indexOf("#"))),("custom_woocommerce_store"==e.display_result_method||"post_type_archive"==e.display_result_method)&&1==e.enable_taxonomy_archives&&""!==e.current_taxonomy_archive)return r=!0;var o=i.split("?"),l="";l=o.length>0?o[0]:i;var u=e.getQueryParamFromURL("lang",window.location.href);"undefined"!=typeof u&&null!==u&&(l=e.addUrlParam(l,"lang="+u));var c=e.getQueryParamFromURL("sfid",window.location.href);Number(parseFloat(c))==c&&(l=e.addUrlParam(l,"sfid="+c)),l=l.replace(/\/$/,""),a=a.replace(/\/$/,""),n=encodeURI(a.replace(/\/$/,""));var f=-1;l!=a&&l.toLowerCase()!=n.toLowerCase()||(f=1),1==e.only_results_ajax?r=f>-1:"pagination"==t&&(f>-1||(r=!1))}return r},this.setupAjaxPagination=function(){"undefined"!=typeof e.ajax_links_selector&&("infinite_scroll"===this.pagination_type&&1===parseInt(this.instance_number)&&(a(window).off("scroll",e.onWindowScroll),e.canFetchAjaxResults("pagination")&&a(window).on("scroll",e.onWindowScroll)),a(document).off("click",e.ajax_links_selector),a(document).on("click",e.ajax_links_selector,function(t){if(e.canFetchAjaxResults("pagination")){t.preventDefault();var r=jQuery(this).attr("href");e.ajax_action="pagination";var a=e.getPagedFromURL(r);return e.$ajax_results_container.attr("data-paged",a),e.fetchAjaxResults(),!1}}))},this.getPagedFromURL=function(t){var r=1,a=e.getQueryParamFromURL("sf_paged",t);return"string"!=typeof a&&"number"!=typeof a||(r=a),r},this.getQueryParamFromURL=function(t,e){var r="?"+e.split("?")[1];if("undefined"!=typeof r){var a=decodeURIComponent((new RegExp("[?|&]"+t+"=([^&;]+?)(&|#|;|$)").exec(r)||[,""])[1].replace(/\+/g,"%20"))||null;return a}return""},this.formUpdated=function(t){return 1==e.auto_update?e.submitForm():0==e.auto_update&&1==e.auto_count_refresh_mode&&e.formUpdatedFetchAjax(),!1},this.formUpdatedFetchAjax=function(){return e.fetchAjaxForm(),!1},this.setFields=function(t){e.$fields.each(function(){var t=a(this),e=t.find(".sf-meta-range-slider").attr("data-display-values-as");"textinput"===e&&(t.find(".meta-slider").length>0,t.find(".meta-slider").each(function(t){var e=a(this)[0],r=a(this).closest(".sf-meta-range-slider"),n=r.find(".sf-range-min").val(),i=r.find(".sf-range-max").val();e.noUiSlider.set([n,i])}))})},this.submitForm=function(t){if(1==e.isSubmitting)return!1;if(e.setFields(),e.clearTimer(),e.isSubmitting=!0,i.setTaxArchiveResultsUrl(e,e.results_url),e.$ajax_results_container.attr("data-paged",1),e.canFetchAjaxResults())e.ajax_action="submit",e.fetchAjaxResults();else{var r=i.getResultsUrl(e,e.results_url),a=e.getUrlParams(!0,"");r=e.addUrlParam(r,a),window.location.href=r}return!1},this.resetForm=function(t){e.$fields.each(function(){var t=a(this);t.find("select:not([multiple='multiple']) > option:first-child").prop("selected",!0),t.find("select[multiple='multiple'] > option").prop("selected",!1),t.find("input[type='checkbox']").prop("checked",!1),t.find("> ul > li:first-child input[type='radio']").prop("checked",!0),t.find("input[type='text']").val(""),t.find(".sf-option-active").removeClass("sf-option-active"),t.find("> ul > li:first-child input[type='radio']").parent().addClass("sf-option-active"),t.find("input[type='number']").each(function(t){var e=a(this);e.parent().parent().hasClass("sf-meta-range")&&(0==t?e.val(e.attr("min")):1==t&&e.val(e.attr("max")))});var e=t.find(".sf-meta-range-select-fromto");if(e.length>0){var r=e.attr("data-min"),n=e.attr("data-max");e.find("select").each(function(t){var e=a(this);0==t?e.val(r):1==t&&e.val(n)})}var i=t.find(".sf-meta-range-radio-fromto");if(i.length>0){var r=i.attr("data-min"),n=i.attr("data-max"),s=i.find(".sf-input-range-radio");s.each(function(t){var e=a(this).find(".sf-input-radio");e.prop("checked",!1),0==t?e.filter('[value="'+r+'"]').prop("checked",!0):1==t&&e.filter('[value="'+n+'"]').prop("checked",!0)})}t.find(".meta-slider").each(function(t){var e=a(this)[0],r=a(this).closest(".sf-meta-range-slider"),n=r.attr("data-min"),i=r.attr("data-max");e.noUiSlider.set([n,i])});var o=t.find("select[data-combobox='1']");o.length>0&&("undefined"!=typeof o.chosen?o.trigger("chosen:updated"):(o.val(""),o.trigger("change.select2")))}),e.clearTimer(),"always"==t?e.submitForm():"never"==t?1==this.auto_count_refresh_mode&&e.formUpdatedFetchAjax():"auto"==t&&(1==this.auto_update?e.submitForm():1==this.auto_count_refresh_mode&&e.formUpdatedFetchAjax())},this.init();var o={};o.sfid=e.sfid,o.targetSelector=e.ajax_target_attr,o.object=this,r.isInit&&e.triggerEvent("sf:init",o)})}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./process_form":7,"./state":8,"js-cookie":2,nouislider:3}],7:[function(t,e,r){(function(t){var r="undefined"!=typeof window?window.jQuery:"undefined"!=typeof t?t.jQuery:null;e.exports={taxonomy_archives:0,url_params:{},tax_archive_results_url:"",active_tax:"",fields:{},init:function(t,e){this.taxonomy_archives=0,this.url_params={},this.tax_archive_results_url="",this.active_tax="",this.taxonomy_archives=t,this.current_taxonomy_archive=e,this.clearUrlComponents()},setTaxArchiveResultsUrl:function(t,e,a){var n=this;if(1==this.taxonomy_archives){if("undefined"==typeof a)var a=!1;var i=!1,s="",o="",l=t.$fields.parent().find("[data-sf-taxonomy-archive='1']");if(1==l.length){i=l;var u=i.attr("data-sf-field-type");if("tag"==u||"category"==u||"taxonomy"==u){var c=n.processTaxonomy(i,!0);s=i.attr("data-sf-field-name");var f=s.replace("_sft_","");c&&(o=c.value)}""==o&&(i=!1)}if(""!=n.current_taxonomy_archive&&n.current_taxonomy_archive!=f)return void(this.tax_archive_results_url=e);if(""!=o&&i||t.$fields.each(function(){if(!i){var t=r(this).attr("data-sf-field-type");if("tag"==t||"category"==t||"taxonomy"==t){var e=n.processTaxonomy(r(this),!0);s=r(this).attr("data-sf-field-name"),e&&(o=e.value,""!=o&&(i=r(this)))}}}),i&&""!=o){var d=i.attr("data-sf-term-rewrite");if(""!=d){var p=JSON.parse(d),h=i.attr("data-sf-field-input-type");if(n.active_tax=s,"radio"==h||"checkbox"==h){var m=!0,_=o.split(",").join("+").split("+");if(_.length>1&&(m=!1),m){var g=i.find("input[value='"+o+"']"),v=g.parent(),x=v.attr("data-sf-depth"),y=new Array;y.push(o);for(var b=x;b>0;b--)v=v.parent().parent(),y.push(v.find("input").val());y.reverse();var w=p[x],j=w;r(y).each(function(t,e){j=j.replace("["+t+"]",e)}),this.tax_archive_results_url=j}}else if("select"==h||"multiselect"==h){var m=!0,_=o.split(",").join("+").split("+");if(_.length>1&&(m=!1),m){var v=i.find("option[value='"+o+"']"),x=v.attr("data-sf-depth"),y=new Array;y.push(o);for(var b=x;b>0;b--)v=v.prevAll("option[data-sf-depth='"+(b-1)+"']"),y.push(v.val());y.reverse();var w=p[x],j=w;r(y).each(function(t,e){j=j.replace("["+t+"]",e)}),this.tax_archive_results_url=j}}}}}},getResultsUrl:function(t,e){return""==this.tax_archive_results_url?e:this.tax_archive_results_url},getUrlParams:function(t){if(this.buildUrlComponents(t,!0),""!=this.tax_archive_results_url&&""!=this.active_tax){var e=this.active_tax;"undefined"!=typeof this.url_params[e]&&delete this.url_params[e]}return this.url_params},clearUrlComponents:function(){this.url_params={}},disableInputs:function(t){t.$fields.each(function(){var t=r(this).find("input, select, .meta-slider");t.attr("disabled","disabled"),t.attr("disabled",!0),t.prop("disabled",!0),t.trigger("chosen:updated")})},enableInputs:function(t){t.$fields.each(function(){var t=r(this).find("input, select, .meta-slider");t.prop("disabled",!0),t.removeAttr("disabled"),t.trigger("chosen:updated")})},buildUrlComponents:function(t,e){var a=this;"undefined"!=typeof e&&1==e&&this.clearUrlComponents(),t.$fields.each(function(){var t=(r(this).attr("data-sf-field-name"),r(this).attr("data-sf-field-type"));"search"==t?a.processSearchField(r(this)):"tag"==t||"category"==t||"taxonomy"==t?a.processTaxonomy(r(this)):"sort_order"==t?a.processSortOrderField(r(this)):"posts_per_page"==t?a.processResultsPerPageField(r(this)):"author"==t?a.processAuthor(r(this)):"post_type"==t?a.processPostType(r(this)):"post_date"==t?a.processPostDate(r(this)):"post_meta"==t&&a.processPostMeta(r(this))})},processSearchField:function(t){var e=this,r=t.find("input[name^='_sf_search']");if(r.length>0){var a=(r.attr("name").replace("[]",""),r.val());""!=a&&(e.url_params._sf_s=encodeURIComponent(a))}},processSortOrderField:function(t){this.processAuthor(t)},processResultsPerPageField:function(t){this.processAuthor(t)},getActiveTax:function(t){return this.active_tax},getSelectVal:function(t){var e="";return 0!=t.val()&&(e=t.val()),null==e&&(e=""),e},getMetaSelectVal:function(t){var e="";return e=t.val(),null==e&&(e=""),e},getMultiSelectVal:function(t,e){var r="+";if("or"==e&&(r=","),"object"==typeof t.val()&&null!=t.val())return t.val().join(r)},getMetaMultiSelectVal:function(t,e){var a="-+-";if("or"==e&&(a="-,-"),"object"==typeof t.val()&&null!=t.val()){var n=[];return r(t.val()).each(function(t,e){n.push(e)}),n.join(a)}return""},getCheckboxVal:function(t,e){var a=t.map(function(){if(1==r(this).prop("checked"))return r(this).val()}).get(),n="+";return"or"==e&&(n=","),a.join(n)},getMetaCheckboxVal:function(t,e){var a=t.map(function(){if(1==r(this).prop("checked"))return r(this).val()}).get(),n="-+-";return"or"==e&&(n="-,-"),a.join(n)},getRadioVal:function(t){var e=t.map(function(){if(1==r(this).prop("checked"))return r(this).val()}).get();if(0!=e[0])return e[0]},getMetaRadioVal:function(t){var e=t.map(function(){if(1==r(this).prop("checked"))return r(this).val()}).get();return e[0]},processAuthor:function(t){var e,r=this,a=(t.attr("data-sf-field-type"),t.attr("data-sf-field-input-type")),n="",i="";if("select"==a)e=t.find("select"),n=e.attr("name").replace("[]",""),i=r.getSelectVal(e);else if("multiselect"==a){e=t.find("select"),n=e.attr("name").replace("[]","");e.attr("data-operator");i=r.getMultiSelectVal(e,"or")}else if("checkbox"==a){if(e=t.find("ul > li input:checkbox"),e.length>0){n=e.attr("name").replace("[]","");t.find("> ul").attr("data-operator");i=r.getCheckboxVal(e,"or")}}else"radio"==a&&(e=t.find("ul > li input:radio"),e.length>0&&(n=e.attr("name").replace("[]",""),i=r.getRadioVal(e)));if("undefined"!=typeof i&&""!=i){var s="";"_sf_author"==n?s="authors":"_sf_sort_order"==n?s="sort_order":"_sf_ppp"==n?s="_sf_ppp":"_sf_post_type"==n&&(s="post_types"),""!=s&&(r.url_params[s]=i)}},processPostType:function(t){this.processAuthor(t)},processPostMeta:function(t){var e,a=this,n=(t.attr("data-sf-field-type"),t.attr("data-sf-field-input-type")),i=t.attr("data-sf-meta-type"),s="",o="";if("number"==i){if("range-number"==n){e=t.find(".sf-meta-range-number input");var l=[];e.each(function(){l.push(r(this).val())}),s=l.join("+")}else if("range-slider"==n){e=t.find(".sf-meta-range-slider input");var u=t.find(".sf-meta-range-slider"),c=u.attr("data-decimal-places"),f=u.attr("data-thousand-seperator"),d=u.attr("data-decimal-seperator"),p=wNumb({mark:d,decimals:parseFloat(c),thousand:f}),l=[],h=t.find(".meta-slider")[0],m=h.noUiSlider.get();l.push(p.from(m[0])),l.push(p.from(m[1])),s=l.join("+"),o=u.attr("data-sf-field-name")}else if("range-radio"==n){e=t.find(".sf-input-range-radio"),0==e.length&&(e=t.find("> ul"));var u=t.find(".sf-meta-range");if(e.length>0){var _=[];e.each(function(){var t=r(this).find(".sf-input-radio");_.push(a.getMetaRadioVal(t))}),2==_.length&&Number(_[1])<Number(_[0])&&(_[1]=_[0]),s=_.join("+")}o=1==e.length?e.find(".sf-input-radio").attr("name").replace("[]",""):u.attr("data-sf-field-name")}else if("range-select"==n){e=t.find(".sf-input-select");var u=t.find(".sf-meta-range");if(e.length>0){var _=[];e.each(function(){var t=r(this);_.push(a.getMetaSelectVal(t))}),2==_.length&&Number(_[1])<Number(_[0])&&(_[1]=_[0]),s=_.join("+")}o=1==e.length?e.attr("name").replace("[]",""):u.attr("data-sf-field-name")}else"range-checkbox"==n&&(e=t.find("ul > li input:checkbox"),e.length>0&&(s=a.getCheckboxVal(e,"and")));""==o&&(o=e.attr("name").replace("[]",""))}else if("choice"==i){if("select"==n)e=t.find("select"),s=a.getMetaSelectVal(e);else if("multiselect"==n){
e=t.find("select");var g=e.attr("data-operator");s=a.getMetaMultiSelectVal(e,g)}else if("checkbox"==n){if(e=t.find("ul > li input:checkbox"),e.length>0){var g=t.find("> ul").attr("data-operator");s=a.getMetaCheckboxVal(e,g)}}else"radio"==n&&(e=t.find("ul > li input:radio"),e.length>0&&(s=a.getMetaRadioVal(e)));s=encodeURIComponent(s),"undefined"!=typeof e&&e.length>0&&(o=e.attr("name").replace("[]",""),o=o)}else"date"==i&&a.processPostDate(t);"undefined"!=typeof s&&""!=s&&(a.url_params[encodeURIComponent(o)]=s)},processPostDate:function(t){var e,a=this,n=(t.attr("data-sf-field-type"),t.attr("data-sf-field-input-type"),""),i="";e=t.find("ul > li input:text"),n=e.attr("name").replace("[]","");var s=[];if(e.each(function(){s.push(r(this).val())}),2==e.length?""==s[0]&&""==s[1]||(i=s.join("+"),i=i.replace(/\//g,"")):1==e.length&&""!=s[0]&&(i=s.join("+"),i=i.replace(/\//g,"")),"undefined"!=typeof i&&""!=i){var o="";o="_sf_post_date"==n?"post_date":n,""!=o&&(a.url_params[o]=i)}},processTaxonomy:function(t,e){"undefined"==typeof e&&(e=!1);var r,a=this,n=(t.attr("data-sf-field-type"),t.attr("data-sf-field-input-type")),i="",s="";if("select"==n)r=t.find("select"),i=r.attr("name").replace("[]",""),s=a.getSelectVal(r);else if("multiselect"==n){r=t.find("select"),i=r.