text: $(function(){function a(a){return decodeURIComponent(a).replace(/^\?/,"").split("&").filter(function(a){return a}).reduce(function(a,b){var c=b.split("="),d=c[0],e=c[1];return a[d]=a[d]?[e].concat(a[d]):e,a},{})}function b(a){var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(encodeURIComponent(c)+"="+encodeURIComponent(a[c]));return"?"+b.join("&")}function c(c){a(window.location.search).hasOwnProperty("query")&&(c=c+"&query="+a(window.location.search).query),a(window.location.search).hasOwnProperty("sort")&&(c=c+"&sort="+a(window.location.search).sort),$(".overlay-filter").show(),oldParams=a(window.location.search),newParams=a(c),newQuery=b(newParams),window.history.pushState("","",newQuery),$.ajax({type:"POST",url:location.origin+location.pathname,data:c,success:a=>{$("#catalogRow").html(""),$(".pagination").remove(),$("#paginationAppend").append(a.pagination);for(var b=0;b<a.items.length;b++){let c=f(a.items[b].image_url,a.items[b].name,a.items[b].min_price,a.items[b].shops_count,a.items[b].category_url,a.items[b].reviews_count,a.items[b].avg_rate,a.items[b].old_price);$("#catalogRow").append(c)}$(".overlay-filter").hide()}})}function d(a){var b="";a.options.items.forEach(function(c){b+=e(a.slug+"[]",c.filter_option_slug,c.filter_option_name,c.products_count)});var c="<section class=\"choose\" data-filter-type-id=\""+a.id+"\">\n        <div class=\"choose__mini-title-block\">\n            <h6 class=\"choose__mini-title\">"+a.name+"</h6>\n            <img class=\"choose__arrow\" src=\"/img/theme/icons/arrow.svg\" alt=\"\" role=\"presentation\" />\n        </div><ul class=\"choose__amounts\" data-page=\"1\" data-click-count=\"0\">"+b+"</ul><button  class=\"choose__button choose__filter-button button button-blue show-more\" type=\"button\" value=\"\u043F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u0435\u0449\u0435\">\u043F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u0435\u0449\u0435</button>\n    </section>";return c}function e(a,b,c,d){return"<li class=\"choose__row\">\n        <label class=\"choose__label label-checkbox\">\n            <input class=\"choose__input label-checkbox__input-hidden\" type=\"checkbox\" name=\""+a+"\" value=\""+b+"\" />\n            <span class=\"choose__check label-checkbox__label-span\"></span>\n            <span class=\"choose__brand\">"+c+"</span>\n            <span class=\"choose__amount-block\">\n                <span class=\"choose__left-bracker\">(</span>\n                <span class=\"choose__amount\">"+d+"</span>\n                <span class=\"choose__right-bracker\">)</span>\n            </span>\n        </label>\n    </li>"}function f(a,b,c,d,e,f,i,j=!1){if(j){var k=h(a,b,c,1,e,f,i,j);$("#catalogRow").append(k)}else{var k=g(a,b,c,d,e,f,i);$("#catalogRow").append(k)}}function g(a,b,c,d,e,f,g,h=!1){if(c=i(c),h&&(h=i(h)),$(".sortable__tables").hasClass("active")){var j="<div class=\"col-12\">\n                                        <div class=\"popular__card reverse-card\">\n                                            <a class=\"popular__img-link\" href=\"/catalog/"+e+"\" title=\"\">\n                                                <img class=\"popular__img\" src=\""+JSON.parse(a)+"\" alt=\""+b+"\" title=\""+b+"\" />\n                                            </a>\n                                            <div class=\"popular__reverse-block\">\n                                                <a class=\"popular__img-link-desc\" href=\"/catalog/"+e+"\" title=\""+b+"\">"+b+"</a>\n                                                <div class=\"rating\">\n                                                    <div class=\"rating__stars-block\" style=\"font-size: 0\">\n";for($i=0;5>$i;$i++)j+=$i+1<=g?"<img class=\"rating__star\" src=\"/img/theme/icons/star_checked.png\" alt=\"\" role=\"presentation\" />":"<img class=\"rating__star\" src=\"/img/theme/icons/star_unchecked.png\" alt=\"\" role=\"presentation\" />";j+="                                                    </div>\n                                                    <div class=\"rating__feed-block\">\n                                                        <span class=\"rating__feed-count\">"+f+"</span>\n                                                        <span class=\"rating__feed-title\">\u043E\u0442\u0437\u044B\u0432\u043E\u0432</span>\n                                                    </div>\n                                                </div>\n                                            </div>\n                                            <div class=\"popular__reverse-right-block\">\n                                                <div class=\"popular__price-shop\">\n                                                    <span class=\"popular__from-word\">\u043E\u0442</span>\n                                                    <span class=\"popular__total-price shop\">"+c+"</span>\n                                                </div>\n                                                <div class=\"popular__shops\">\n                                                    <span class=\"popular__shop-in\">\u0432</span>\n                                                    <span class=\"popular__shop-count\">"+d+"</span>\n                                                    <span class=\"popular__shop-title\">\u043C\u0430\u0433\u0430\u0437\u0438\u043D\u0430\u0445</span>\n                                                </div>\n                                                <a class=\"popular__link-shop button button-yellow\" href=\"/catalog/"+e+"\" title=\"\u0421\u0440\u0430\u0432\u043D\u0438\u0442\u044C \u0446\u0435\u043D\u044B\">\u0421\u0440\u0430\u0432\u043D\u0438\u0442\u044C \u0446\u0435\u043D\u044B</a>\n                                            </div>\n                                        </div>\n                                    </div>"}else if($(".sortable__cards").hasClass("active")){var j="<div class=\"col-12 col-sm-6 col-md-6 col-lg-4\">\n                                        <div class=\"popular__card\">\n                                            <a class=\"popular__img-link\" href=\"/catalog/"+e+"\" title=\"\">\n                                                <img class=\"popular__img\" src=\""+JSON.parse(a)+"\" alt=\""+b+"\" title=\""+b+"\" />\n                                            </a>\n                                            <div class=\"popular__reverse-block\">\n                                                <a class=\"popular__img-link-desc\" href=\"/catalog/"+e+"\" title=\""+b+"\">"+b+"</a>\n                                                <div class=\"rating\">\n                                                    <div class=\"rating__stars-block\" style=\"font-size: 0\">\n";for($i=0;5>$i;$i++)j+=$i+1<=g?"<img class=\"rating__star\" src=\"/img/theme/icons/star_checked.png\" alt=\"\" role=\"presentation\" />":"<img class=\"rating__star\" src=\"/img/theme/icons/star_unchecked.png\" alt=\"\" role=\"presentation\" />";j+="                                                    </div>\n                                                    <div class=\"rating__feed-block\">\n                                                        <span class=\"rating__feed-count\">"+f+"</span>\n                                                        <span class=\"rating__feed-title\">\u043E\u0442\u0437\u044B\u0432\u043E\u0432</span>\n                                                    </div>\n                                                </div>\n                                            </div>\n                                            <div class=\"popular__reverse-right-block\">\n                                                <div class=\"popular__price-shop\">\n                                                    <span class=\"popular__from-word\">\u043E\u0442</span>\n                                                    <span class=\"popular__total-price shop\">"+c+"</span>\n                                                </div>\n                                                <div class=\"popular__shops\">\n                                                    <span class=\"popular__shop-in\">\u0432</span>\n                                                    <span class=\"popular__shop-count\">"+d+"</span>\n                                                    <span class=\"popular__shop-title\">\u043C\u0430\u0433\u0430\u0437\u0438\u043D\u0430\u0445</span>\n                                                </div>\n                                                <a class=\"popular__link-shop button button-yellow\" href=\"/catalog/"+e+"\" title=\"\u0421\u0440\u0430\u0432\u043D\u0438\u0442\u044C \u0446\u0435\u043D\u044B\">\u0421\u0440\u0430\u0432\u043D\u0438\u0442\u044C \u0446\u0435\u043D\u044B</a>\n                                            </div>\n                                        </div>\n                                    </div>"}return j}function h(a,b,c,d,e,f,g,h){if(c=i(c),h&&(h=i(h)),$(".sortable__tables").hasClass("active")){var j="<div class=\"col-12\">\n                                            <div class=\"popular__card reverse-card\">\n                                                <img class=\"popular__sale-img\" src=\"/img/theme/icons/persent.png\" alt=\"persent\" title=\"\">\n                                                <a class=\"popular__img-link\" href=\"/sales/"+e+"\" title=\""+b+"\">\n                                                    <img class=\"popular__img\" src=\""+JSON.parse(a)+"\" alt=\""+b+"\" title=\""+b+"\">\n                                                </a>\n                                                <div class=\"popular__reverse-block\">\n                                                    <a class=\"popular__img-link-desc\" href=\"/sales/"+e+"\" title=\""+b+"\">"+b+"</a>\n                                                    <div class=\"rating\">\n                                                        <div class=\"rating__stars-block\" style=\"font-size: 0\">";for($i=0;5>$i;$i++)j+=$i+1<=g?"<img class=\"rating__star\" src=\"/img/theme/icons/star_checked.png\" alt=\"\" role=\"presentation\" />":"<img class=\"rating__star\" src=\"/img/theme/icons/star_unchecked.png\" alt=\"\" role=\"presentation\" />";j+="                                                    </div>\n                                                    <div class=\"rating__feed-block\">\n                                                        <span class=\"rating__feed-count\">"+f+"</span>\n                                                        <span class=\"rating__feed-title\">\u043E\u0442\u0437\u044B\u0432\u043E\u0432</span>\n                                                    </div>\n                                                </div>\n                                            </div>\n                                            <div class=\"popular__reverse-right-block\">\n                                                <div class=\"popular__price-shop discount\">\n                                                    <span class=\"popular__from-word\">\u043E\u0442</span>\n                                                    <span class=\"popular__total-price shop discount\">"+c+"</span>\n                                                    <span class=\"popular__old-price\"><span class=\"strike\">"+h+"</span></span>\n                                                </div>\n                                                <div class=\"popular__shops\">\n                                                    <span class=\"popular__shop-in\">\u0432</span>\n                                                    <span class=\"popular__shop-count\">"+d+"</span>\n                                                    <span class=\"popular__shop-title\">\u043C\u0430\u0433\u0430\u0437\u0438\u043D\u0430\u0445</span>\n                                                </div>\n                                                <a class=\"popular__link-shop button button-yellow\" href=\"/sales/"+e+"\" title=\"\u0421\u0440\u0430\u0432\u043D\u0438\u0442\u044C \u0446\u0435\u043D\u044B\">\u0421\u0440\u0430\u0432\u043D\u0438\u0442\u044C \u0446\u0435\u043D\u044B</a>\n                                            </div>\n                                        </div>\n                                    </div>"}else if($(".sortable__cards").hasClass("active")){var j="<div class=\"col-12 col-lg-4 col-md-6 col-sm-6\">\n                                            <div class=\"popular__card\">\n                                                <img class=\"popular__sale-img\" src=\"/img/theme/icons/persent.png\" alt=\"persent\" title=\"\">\n                                                <a class=\"popular__img-link\" href=\"/sales/"+e+"\" title=\""+b+"\">\n                                                    <img class=\"popular__img\" src=\""+JSON.parse(a)+"\" alt=\""+b+"\" title=\""+b+"\" />\n                                                </a>\n                                                <div class=\"popular__reverse-block\">\n                                                    <a class=\"popular__img-link-desc\" href=\"/sales/"+e+"\" title=\""+b+"\">"+b+"</a>\n                                                    <div class=\"rating\">\n                                                        <div class=\"rating__stars-block\" style=\"font-size: 0\">";for($i=0;5>$i;$i++)j+=$i+1<=g?"<img class=\"rating__star\" src=\"/img/theme/icons/star_checked.png\" alt=\"\" role=\"presentation\" />":"<img class=\"rating__star\" src=\"/img/theme/icons/star_unchecked.png\" alt=\"\" role=\"presentation\" />";j+="                                                    </div>\n                                                    <div class=\"rating__feed-block\">\n                                                        <span class=\"rating__feed-count\">"+f+"</span>\n                                                        <span class=\"rating__feed-title\">\u043E\u0442\u0437\u044B\u0432\u043E\u0432</span>\n                                                    </div>\n                                                </div>\n                                            </div>\n                                            <div class=\"popular__reverse-right-block\">\n                                                <div class=\"popular__price-shop discount\">\n                                                    <span class=\"popular__from-word\">\u043E\u0442</span>\n                                                    <span class=\"popular__total-price shop discount\">"+c+"</span>\n                                                    <span class=\"popular__old-price\"><span class=\"strike\">"+h+"</span></span>\n                                                </div>\n                                                <div class=\"popular__shops\">\n                                                    <span class=\"popular__shop-in\">\u0432</span>\n                                                    <span class=\"popular__shop-count\">"+d+"</span>\n                                                    <span class=\"popular__shop-title\">\u043C\u0430\u0433\u0430\u0437\u0438\u043D\u0430\u0445</span>\n                                                </div>\n                                                <a class=\"popular__link-shop button button-yellow\" href=\"/sales/"+e+"\" title=\"\u0421\u0440\u0430\u0432\u043D\u0438\u0442\u044C \u0446\u0435\u043D\u044B\">\u0421\u0440\u0430\u0432\u043D\u0438\u0442\u044C \u0446\u0435\u043D\u044B</a>\n                                            </div>\n                                        </div>\n                                    </div>"}return j}function i(a){return(a+"").replace(/(\d)(?=(\d\d\d)+([^\d]|$))/g,"$1 ")}$(".sortable__link").click(function(d){d.preventDefault();var e=$(this).attr("data-sort-by"),f=$(this).attr("data-sort-direction");$(this).find(".sortable__arrow").show(),$(".sortable__link.active").removeClass("active").find(".sortable__arrow").hide().removeClass("rotate"),$(this).addClass("active").find(".sortable__arrow").show();var g=a(window.location.search);"asc"===f?($(this).attr("data-sort-direction","desc"),g.sort=e+"-desc",$(this).find(".sortable__arrow").addClass("rotate")):"desc"===f?($(this).attr("data-sort-direction","asc"),g.sort=e+"-asc",$(this).find(".sortable__arrow").removeClass("rotate")):void 0;newQuery=b(g),window.history.pushState("","",newQuery);var h=$(".selection__form").serialize();c(h)}),$("body").on("click",".pagination__arrow-right",function(a){if($("body").find(".pagination__arrow-right").prev(".pagination__item").hasClass("active"))a.preventDefault();else{a.preventDefault();var b=$(".pagination").find(".pagination__item.active span").text();b=parseInt(b)+1;var d=$(".selection__form").serialize()+"&page="+b;c(d),$("body,html").animate({scrollTop:0},800)}}),$("body").on("click",".pagination__arrow-left",function(a){if($("body").find(".pagination__arrow-left").next(".pagination__item").hasClass("active"))a.preventDefault();else{a.preventDefault();var b=$(".pagination").find(".pagination__item.active span").text();b=parseInt(b)-1;var d=$(".selection__form").serialize()+"&page="+b;c(d),$("body,html").animate({scrollTop:0},800)}}),$("body").on("click",".pagination__link",function(a){a.preventDefault();var b=$(this).find("span").text(),d=$(".selection__form").serialize()+"&page="+b;c(d),$("body,html").animate({scrollTop:0},800)}),$("body").on("click",".choose__label",function(a){a.preventDefault(),!0==$(this).find("input").prop("checked")?$(this).find("input").prop("checked",!1):$(this).find("input").prop("checked",!0);var b=$(".filter-section").find("input:checked").length,d=$(this).find("input").attr("name"),e=$(".selection__form").serialize();c(e)}),$("body").on("click",".show-more",function(a){a.preventDefault();let b=$(this).closest(".choose").data("filter-type-id");var c=$(this).closest(".choose").find(".choose__amounts").attr("data-click-count");c++,$(this).closest(".choose").find(".choose__amounts").attr("data-click-count",c);var d=parseInt($(this).closest(".choose").find(".choose__amounts").attr("data-page"));d++,$(this).closest(".choose").find(".choose__amounts").attr("data-page",d);var f=$(this).closest(".choose").find("input").attr("name");$.ajax({type:"POST",url:"/get-more-options/"+categoryId,data:{"filter-type-id":b,limit:5,page:d,isSales:isSales},success:a=>{a.count;if("vendors"==$(this).closest(".choose").data("filter-type-id"))for(var d=0;d<a.items.length;d++){let c=e(f,a.items[d].vendor_id,a.items[d].name,a.items[d].products_count,b);$("[data-filter-type-id='"+b+"']").find(".choose__amounts").append(c)}else for(var d=0;d<a.items.length;d++){let c=e(f,a.items[d].filter_option_slug,a.items[d].filter_option_name,a.items[d].products_count,b);$("[data-filter-type-id='"+b+"']").find(".choose__amounts").append(c)}3<=c&&$(this).removeClass("choose__filter-button"),5*(c+1)>=a.count&&$(this).removeClass("choose__filter-button")}})}),$("#slider").on("slidechange",function(){var a=$(".selection__form").serialize();c(a)}),0<$("#slider").length&&$("#slider").slider({range:!0,min:minPrice,max:maxPrice,values:[minPriceSelected,maxPriceSelected],slide:function(a,b){$(".ui-slider__from-input").val(b.values[0]),$(".ui-slider__to-input").val(b.values[1])}}),$(".ui-slider__from-input").change(function(){var a=$(this).val();$("#slider").slider("values",0,a)}),$(".ui-slider__to-input").change(function(){var a=$(this).val();$("#slider").slider("values",1,a)}),$("body").on("click",".selection__button",function(a){a.preventDefault();var b=parseInt($(this).closest(".selection__form").attr("data-click-count"));b++,$(this).closest(".selection__form").attr("data-click-count",b);var c=parseInt($(this).closest(".selection__form").attr("data-page"));c++,$(this).closest(".selection__form").attr("data-page",c);$.ajax({type:"POST",url:"/get-more-filters/"+categoryId,data:{limit:5,page:c,isSales:isSales},success:a=>{a.count;4<=b&&$(this).hide(),5*(b+1)>a.count&&$(this).hide(),filterTypesHtml="";for(var c=0;c<a.items.length;c++)filterTypesHtml+=d(a.items[c]);$(".selection__wrapper").append(filterTypesHtml)}})})});
  