function GSPBajaxpagination(e){let t=e.dataset.containerid,a=document.getElementById(t),n=e.dataset.sorttype,i=e.dataset.offset,s=parseInt(a.dataset.perpage),r=a.parentElement.querySelector(".gspb_filter_panel"),o,p=null;r&&(p=r.querySelector(".gspb_tax_dropdown .gspb_choosed_tax")),null!=p&&""!=p.innerHTML&&(o=p.getAttribute("data-taxdata"));let l=a.dataset.filterargs,g=a.dataset.innerargs,c=a.getAttribute("id").replace(/-/g,"_"),f=void 0!==window[c]?window[c]:"",u=a.dataset.template,d=a.querySelector(".wp-block-post-template");gspbpaginationvars.filternonce;let b=new XMLHttpRequest;b.open("POST",gspbpaginationvars.ajax_url,!0),b.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),b.responseType="json",b.onload=function(){if(this.status>=200&&this.status<400){let t=this.response.data,n=Math.floor(1e5*Math.random());if(d){let i=t.replace(/gspbgrid_item /g,"gspbgrid_item gspb_grid"+n+" ");d.insertAdjacentHTML("beforeend",i)}else a.insertAdjacentHTML("beforeend",t);if(d&&null!=d.querySelector(".gspb_ajax_pagination")){if(t.indexOf("gcnomoreclass")>=0)d.querySelector(".gspb_ajax_pagination").remove(),a.querySelector(".gspb_ajax_pagination")&&a.querySelector(".gspb_ajax_pagination").remove();else{null!==a.querySelector(".gspb_ajax_pagination_outer")&&a.querySelector(".gspb_ajax_pagination_outer").remove(),d.appendChild(d.querySelector(".gspb_ajax_pagination"));let r=parseInt(a.querySelector(".gspb_ajax_pagination span").dataset.offset);d.querySelector(".gspb_ajax_pagination span").dataset.offset=r+s}}else if(null!=a.querySelector(".gspb_ajax_pagination")){if(t.indexOf("gcnomoreclass")>=0)a.querySelector(".gspb_ajax_pagination").remove();else{a.appendChild(a.querySelector(".gspb_ajax_pagination"));let o=parseInt(a.querySelector(".gspb_ajax_pagination span").dataset.offset);a.querySelector(".gspb_ajax_pagination span").dataset.offset=o+s}}if(e.closest(".gs-swiper-init")){e.closest(".gs-swiper-init").querySelector(".swiper").swiper.destroy();GSPB_render_Swiper(e.closest(".gs-swiper-init"))}if(d&&e.closest(".gs-gsap-wrap")){let p=e.closest(".gs-gsap-wrap");"batch"==p.getAttribute("data-triggertype")&&"undefined"!=typeof gsap&&gsap.matchMedia().add({isDesktop:"(min-width: 768px)",isMobile:"(max-width: 767px)"},e=>{let t=GSGetBasicTween(p,e);GSBatchScrollTrigger(p,t,".gspb_grid"+n,"","",e)})}let l=a.querySelectorAll(".gspb_grid"+n);l&&l.length>0&&l.forEach(e=>{let t=e.querySelectorAll("[data-gspbactions]");t&&t.length>0&&"function"==typeof GSPB_Trigger_Actions&&GSPB_Trigger_Actions("front",t),"function"==typeof GSPBSlidingPanelInit&&GSPBSlidingPanelInit(e),"function"==typeof gsInitTabs&&gsInitTabs(".gspb-tabs",e),"function"==typeof GSPB_Swiper_Init&&GSPB_Swiper_Init(e),"function"==typeof GS_Videos_Init&&GS_Videos_Init(e),"function"==typeof GSPB_Toggler_Init&&GSPB_Toggler_Init(e),"function"==typeof GSPB_quantityInput&&GSPB_quantityInput(e);let a=new CustomEvent("gsAjaxFilterSuccess",{detail:e});document.dispatchEvent(a)})}},b.onerror=function(){},b.send("action=gspb_filterpost&security="+gspbpaginationvars.filternonce+"&sorttype="+n+"&filterargs="+l+"&template="+u+"&tax="+o+"&containerid="+t+"&offset="+i+"&innerargs="+g+"&blockinstance="+f)}function gspbInfiniteScrollObserver(){if(!document.querySelector(".gspb_aj_pag_auto_wrap"))return;let e=document.querySelectorAll(".gspb_aj_pag_auto_wrap .gspb_ajax_pagination_btn"),t=new IntersectionObserver(e=>{e.forEach(e=>{e.isIntersecting&&GSPBajaxpagination(e.target)})});e.length>0&&Array.from(e).forEach(function(e){t.observe(e)})}function gspbInfiniteClickObserver(e=document){e.addEventListener("click",function(e){e.target.classList&&e.target.classList.contains("gspb_ajax_pagination_btn")&&(e.preventDefault(),GSPBajaxpagination(e.target))})}gspbInfiniteScrollObserver(),gspbInfiniteClickObserver();