!function(S,b,T){"use strict";S.yit_infinitescroll=function(e){var f,h,t,o,p=S.extend({nextSelector:"",navSelector:"",itemSelector:"",contentSelector:"",eventType:"scroll",presetLoader:"",customLoader:"",buttonLabel:"",buttonClass:"",loadEffect:"fadeIn"},e),d="undefined"!=typeof yith_infs_script&&yith_infs_script.shop,i="undefined"!=typeof yith_infs_script&&yith_infs_script.block_loader,u=!1,y=!1,n=!1,e=!1,_=S(p.nextSelector).prop("href"),v=[],g=[],m=function(e,t){b.location.pathname!=e&&(b.history.replaceState({url:""+e},"Title",e),t&&(T.title=t),S(T).trigger("yith_infs_url_changed",[e,t]))},l=("pagination"!=p.eventType&&S(p.navSelector).hide(),d&&(h=S(p.itemSelector).first().nextUntil(".first",p.itemSelector).length+1),function(){n&&S(p.navSelector).last().after('<div class="yith-infs-loader">'+n+"</div>"),u=!0;var e=new URL(decodeURIComponent(_));e.searchParams["delete"]("_"),_=e.toString().replace(/^(?:\/\/|[^\/]+)*\//,"/"),S.ajax({url:_,dataType:"html",cache:yith_infs_script.use_cache,success:function(e){f=S(p.itemSelector).last();var t,n,i,e=S(e),o=e.find(p.contentSelector),l=e.find(p.itemSelector),r=e.find(p.navSelector),s=e.find(p.nextSelector),a=_,c=b.scrollY;s.length?_=s.prop("href"):(y=!0,S(T).trigger("yith-infs-scroll-finished")),d&&!f.hasClass("last")&&"pagination"!=p.eventType&&(s=l,n=(t=h)-f.prevUntil(".last",p.itemSelector).length,i=0,s.each(function(){var e=S(this);i++,e.removeClass("first"),e.removeClass("last"),(i-n)%t==0?e.addClass("first"):(i-(n-1))%t==0&&e.addClass("last")})),S(p.navSelector).replaceWith(r),"pagination"!=p.eventType?(f.after(l),S(p.navSelector).hide()):(S(p.contentSelector).replaceWith(o),S(b).scrollTop(S(p.contentSelector).offset().top)),S(".yith-infs-loader").remove(),S(T).trigger("yith_infs_adding_elem",[l,a]),l.addClass("yith-infs-animated"),l.addClass(p.loadEffect),yith_infs_script.change_url&&(s=e.filter("title").length?e.filter("title").text():"","pagination"!=p.eventType&&(v.length||v.push([b.location.href,T.title]),v.push([a,s]),g.push(f)),"scroll"!=p.eventType&&m(a,s),"button"===p.eventType)&&S("html, body").animate({scrollTop:c},"slow"),setTimeout(function(){u=!1,l.removeClass("yith-infs-animated"),l.removeClass(p.loadEffect),S(T).trigger("yith_infs_added_elem",[l,a])},1e3)}})});"scroll"==p.eventType?(n='<img src="'+(""==p.customLoader?p.presetLoader.image:p.customLoader)+'">',S(b).on("scroll touchstart",function(){S(this).trigger("yith_infs_start")}),S(b).on("yith_infs_start",function(){var e=S(this),t=S(p.itemSelector).last(),n=null!=yith_infs_script.elem_height?yith_infs_script.elem_height:2*t.height();void 0!==t&&!u&&!y&&e.scrollTop()+e.height()>=t.offset().top-n&&l()})):"button"==p.eventType?(e='<div class="yith-infs-button-wrapper"><button id="'+(t="yith-infs-button-"+(new Date).getTime())+'" class="'+p.buttonClass+'">'+p.buttonLabel+"</button></div>",S(p.navSelector).last().after(e),S(T).on("yith-infs-scroll-finished",function(){S(".yith-infs-button-wrapper").remove()}),S("#"+t).off("click").on("click",function(){var n=S(this);u||(i&&n.block({message:null,overlayCSS:{background:"#fff url("+i+") no-repeat center",opacity:.5,cursor:"none"}}),l()),S(T).on("yith_infs_adding_elem",function(e,t){i&&n.unblock(),yith_infs_script.scroll_top_on_click_load_more&&S("html, body").animate({scrollTop:S(t).first().offset().top-100},1)})})):"pagination"==p.eventType&&S(T).off("click",p.navSelector+" a").on("click",p.navSelector+" a",function(e){e.preventDefault(),_=S(this).prop("href"),i&&S(p.navSelector).block({message:null,overlayCSS:{background:"#fff url("+i+") no-repeat center",opacity:.5,cursor:"none"}}),l()}),S(b).on("scroll touchstart",function(e){var t,n,i=S(b),i=i.scrollTop()+i.height();void 0!==f&&v.length&&(t=g.indexOf(f),n=f.offset().top+f.height(),i<o?i<=n&&(f=g[t&&t-1],m(v[t][0],v[t][1])):n+250<i&&(t+1<g.length&&(f=g[t+1]),m(v[t+1][0],v[t+1][1])),o=i)})},S(T.body).trigger("wc-enhanced-select-init")}(jQuery,window,document);