!function(t){"function"==typeof define&&define.amd?define("scripts",t):t()}((function(){"use strict";function t(t){if("undefined"==typeof window)return new Buffer(t,"base64").toString("utf-8");if(void 0!==window.atob)return decodeURIComponent(escape(window.atob(t)));var e,n,i,o,a,s,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",d=0,l=0,u="",c=[];if(!t)return t;t+="";do{e=(s=r.indexOf(t.charAt(d++))<<18|r.indexOf(t.charAt(d++))<<12|(o=r.indexOf(t.charAt(d++)))<<6|(a=r.indexOf(t.charAt(d++))))>>16&255,n=s>>8&255,i=255&s,c[l++]=64===o?String.fromCharCode(e):64===a?String.fromCharCode(e,n):String.fromCharCode(e,n,i)}while(dn(".site-header").outerHeight()&&n(window).width()>974?(n(".site-navigation-fixed").show(),n(".site-navigation-fixed").css("width",n("#site-navigation").outerWidth()),n(".site-navigation-fixed").css("left",n("#site-navigation").offset().left)):n(".site-navigation-fixed").hide()})),n(window).on("resize",(function(){n(".site-navigation-fixed").is(":visible")&&(n(".site-navigation-fixed").css("width",n("#site-navigation").outerWidth()),n(".site-navigation-fixed").css("left",n("#site-navigation").offset().left))}))),o>991&&(n(".top-menu .menu-item a, .top-menu .menu-item .removed-link, .main-navigation .menu-item a, .main-navigation .menu-item .removed-link").on("mouseenter",(function(){n(this).parent().parent().find(".sub-menu:visible").hide(),n(this).parent().find(".sub-menu:first").show(),clearTimeout(i)})),n(".top-menu, .main-navigation").on({mouseenter:function(){clearTimeout(i)},mouseleave:function(){i=setTimeout(h,400)}})),o<=991&&(n("#site-navigation").on("click",".menu-item-has-children",(function(t){"A"!==t.target.nodeName&&"a"!==t.target.nodeName&&(t.stopPropagation(),n(this).toggleClass("open"),n(this).find(".sub-menu:first").slideToggle())})),n("#footer_menu").on("click",".menu-item-has-children",(function(t){"A"!==t.target.nodeName&&"a"!==t.target.nodeName&&(t.stopPropagation(),n(this).toggleClass("open"),n(this).find(".sub-menu:first").slideToggle())}))),n(".sidebar-navigation").on("click",".menu-item-has-children",(function(t){"A"!==t.target.nodeName&&"a"!==t.target.nodeName&&(t.stopPropagation(),n(this).toggleClass("open"),n(this).find(".sub-menu:first").slideToggle())})),void 0===window.top_menu_mobile_position&&(window.top_menu_mobile_position="prepend"),"bottom"===window.top_menu_mobile_position&&(window.top_menu_mobile_position="append"),"append"===window.top_menu_mobile_position?r.append(u.html()):"prepend"===window.top_menu_mobile_position&&r.prepend(u.html()),r.append(c.html()),n(document).on("click",".js-table-of-contents-hide",(function(){var t=n(this).parents(".table-of-contents");t.toggleClass("open"),t.hasClass("open")?(e("wpshop_toc_hide","",-1),n(".js-table-of-contents-list").slideDown()):(e("wpshop_toc_hide","hide"),n(".js-table-of-contents-list").slideUp())})),n(document).on("click",'.table-of-contents a[href*="#"]',(function(t){n("html,body").stop().animate({scrollTop:n(this.hash).offset().top-100},500),t.preventDefault()})),1==settings_array.lightbox_enabled&&(n(".entry-content").find("a:has(img)").wpshoplightbox(),n(document).find("a:has(img.lightbox-open)").wpshoplightbox()),n(".entry-content table").wrap(n("
")),n(".js-spoiler-box-title").on("click",(function(){n(this).toggleClass("active").next().slideToggle()})),console.log(window.location.hash),n("body").hasClass("single-paged")&&!window.location.hash){var m=n("#main").offset().top;n("html,body").animate({scrollTop:m},800)}function f(){n(".entry-content iframe, .responsive-iframe iframe").each((function(){if(!(n(this).parents(".not-responsive").length||n(this).width()<=n(this).parent().width())){var t=n(this).width(),e=n(this).height(),i=n(this).parent().width(),o=i/t,a=Math.round(e*o);n(this).css({width:i,height:a})}}))}jQuery(document).on("click",".js-link",(function(e){var n=jQuery(this).data("href");if("http"!==n.substring(0,4)&&"viber"!==n.substring(0,5)){var i=t(n);"http"===i.substring(0,4)&&(n=i)}var o="self";"blank"!==jQuery(this).data("target")&&"_blank"!==jQuery(this).data("target")&&"blank"!==jQuery(this).attr("target")&&"_blank"!==jQuery(this).attr("target")||(o="blank"),"blank"===o?window.open(n):document.location.href=n})),n(".js-share-link").on("click",(function(){n(this).hasClass("js-share-link-no-window")?window.location.href=n(this).data("uri"):function(t){var e,n=626,i=436,o=(screen.height-i)/2,a=(screen.width-n)/2;o<0&&(o=0);a<0&&(a=0);e="top="+o+",left="+a,e+=",height="+i+",width="+n+",resizable=no",open(t,"displayWindow",e)}(n(this).data("uri"))})),n(".ps-link").on("click",(function(){var e=t(n(this).data("uri"));window.open(e)})),n(document).on("click",".js-star-rating-item",(function(){var t=n(this),e=t.parent(),i=t.data("score"),o=e.data("post-id"),a=e.data("rating-count"),s=e.data("rating-sum"),r=e.data("rating-value");if(!e.hasClass("disabled")){e.addClass("disabled process");var d={action:"wpshop_star_rating_submit",nonce:wps_ajax.nonce,post_id:o,score:i,rating_count:a,rating_sum:s,rating_value:r};jQuery.post(wps_ajax.url,d,(function(o){if(o.success){a++,r=((s+=i)/a).toFixed(2);var d="assessment",u=n("html").attr("lang");"undefined"!=typeof rating_count_text_filter?d=rating_count_text_filter:("ru-RU"===u&&(d=l(a,["оценка","оценки","оценок"])),"uk"===u&&(d=l(a,["оцінка","оцінки","оцінок"]))),t.parent().parent().find(".star-rating-text").html("( "+a+" "+d+", "+settings_array.rating_text_average+" "+r+" "+settings_array.rating_text_from+" 5 )
")}else o.data,console.log(o);e.removeClass("process")}))}function l(t,e){return e[t%100>4&&t%100<20?2:[2,0,1,1,1,2][t%10<5?t%10:5]]}})),n(".js-star-rating-item").on({mouseenter:function(){n(this).parent().hasClass("disabled")||(n(this).parent().addClass("hover"),n(this).addClass("hover").prevAll().addClass("hover"))},mouseleave:function(){n(this).parent().hasClass("disabled")||(n(this).parent().removeClass("hover"),n(".js-star-rating-item").removeClass("hover"))}}),n(".js-comment-smiles img").on("click",(function(){var t=n(this);n("#comment").val(n("#comment").val()+" "+t.prop("alt"))})).on("dragstart",(function(t){t.preventDefault()})),f(),n(window).on("resize",(function(){f()}));var p=n(".js-scrolltop");p.on("click",(function(){return n("body,html").animate({scrollTop:0},500)})),n(window).on("scroll",(function(){n(this).scrollTop()>100?o<991?"on"===p.data("mob")&&p.fadeIn():p.fadeIn():p.fadeOut()}))}))}));