/*!
* WP Grid Builder Bricks Add-on
*
* @package   WP Grid Builder - Bricks
* @author    Loïc Blascos
* @link      https://www.wpgridbuilder.com
* @copyright 2019-2024 Loïc Blascos
*
*/
(()=>{var e={365:()=>{[Element.prototype,CharacterData.prototype,DocumentType.prototype].forEach((function(e){e.hasOwnProperty("after")||Object.defineProperty(e,"after",{configurable:!0,enumerable:!0,writable:!0,value:function(){const e=Array.prototype.slice.call(arguments),t=document.createDocumentFragment();e.forEach((function(e){const n=e instanceof Node;t.appendChild(n?e:document.createTextNode(String(e)))})),this.parentNode.insertBefore(t,this.nextSibling)}})}))},823:()=>{[Element.prototype,Document.prototype,DocumentFragment.prototype].forEach((function(e){e.hasOwnProperty("append")||Object.defineProperty(e,"append",{configurable:!0,enumerable:!0,writable:!0,value:function(){const e=Array.prototype.slice.call(arguments),t=document.createDocumentFragment();e.forEach((function(e){const n=e instanceof Node;t.appendChild(n?e:document.createTextNode(String(e)))})),this.appendChild(t)}})}))},120:()=>{[Element.prototype,CharacterData.prototype,DocumentType.prototype].forEach((function(e){e.hasOwnProperty("before")||Object.defineProperty(e,"before",{configurable:!0,enumerable:!0,writable:!0,value:function(){const e=Array.prototype.slice.call(arguments),t=document.createDocumentFragment();e.forEach((function(e){const n=e instanceof Node;t.appendChild(n?e:document.createTextNode(String(e)))})),this.parentNode.insertBefore(t,this)}})}))},440:()=>{Element.prototype.closest||(Element.prototype.closest=function(e){let t=this;if(!document.documentElement.contains(t))return null;do{if(t.matches(e))return t;t=t.parentElement||t.parentNode}while(null!==t&&1===t.nodeType);return null})},983:function(e,t,n){var s;s=void 0!==n.g?n.g:this,e.exports=function(e){if(e.CSS&&e.CSS.escape)return e.CSS.escape;var t=function(e){if(0==arguments.length)throw new TypeError("`CSS.escape` requires an argument.");for(var t,n=String(e),s=n.length,i=-1,o="",r=n.charCodeAt(0);++i<s;)0!=(t=n.charCodeAt(i))?o+=t>=1&&t<=31||127==t||0==i&&t>=48&&t<=57||1==i&&t>=48&&t<=57&&45==r?"\\"+t.toString(16)+" ":0==i&&1==s&&45==t||!(t>=128||45==t||95==t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122)?"\\"+n.charAt(i):n.charAt(i):o+="�";return o};return e.CSS||(e.CSS={}),e.CSS.escape=t,t}(s)},822:()=>{Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector)},19:()=>{window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=function(e,t){t=t||window;for(var n=0;n<this.length;n++)e.call(t,this[n],n,this)})},919:()=>{[Element.prototype,CharacterData.prototype,DocumentType.prototype].forEach((function(e){e.hasOwnProperty("remove")||Object.defineProperty(e,"remove",{configurable:!0,enumerable:!0,writable:!0,value:function(){null!==this.parentNode&&this.parentNode.removeChild(this)}})}))},565:()=>{window.addEventListener("click",(({target:e})=>{e.closest(".brxe-accordion-nested .listening, .brxe-tabs-nested .tab-title")&&function(e){const t=e?e.querySelectorAll(".wp-grid-builder"):[];t.forEach((e=>{const t=WP_Grid_Builder.instances[e.instance];setTimeout((()=>t&&t.grid.layout()),500),t&&t.grid.layout(),t&&t.carousel&&t.carousel.resize()}))}(e.closest(".brxe-accordion-nested, .brxe-tabs-nested"))}))}},t={};function n(s){var i=t[s];if(void 0!==i)return i.exports;var o=t[s]={exports:{}};return e[s].call(o.exports,o,o.exports,n),o.exports}n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),(()=>{"use strict";n(365),n(120),n(823),n(919),n(822),n(440),n(19),n(983),n(565);function e(){["bricksPrettify","bricksAccordion","bricksAnimatedTyping","bricksAnimation","bricksAudio","bricksCountdown","bricksCounter","bricksSplide","bricksSwiper","bricksVideo","bricksLightbox","bricksLazyLoad","bricksPieChart","bricksProgressBar","bricksAlertDismiss","bricksTabs","bricksVideoOverlayClickDetector","bricksBackgroundVideoInit","bricksPhotoswipe","bricksInteractions","bricksPopups","bricksPricingTables","bricksPostReadingProgressBar","bricksForm","bricksPostReadingTime","bricksNavNested","bricksOffcanvas","bricksToggle"].forEach((e=>window?.[e]?.())),"undefined"!=typeof bricksWooMiniCartHideDetailsClickOutside&&bricksWooMiniCartHideDetailsClickOutside?.(),"undefined"!=typeof bricksWooAjaxAddToCartText&&bricksWooAjaxAddToCartText?.(),"undefined"!=typeof bricksWooAjaxAddToCartFn&&bricksWooAjaxAddToCartFn?.run?.(),"undefined"!=typeof bricksWooCheckoutSubmitBehavior&&bricksWooCheckoutSubmitBehavior?.(),"undefined"!=typeof bricksWooProductGalleryEnhance&&bricksWooProductGalleryEnhance?.(),"undefined"!=typeof bricksWooQuantityTriggersFn&&bricksWooQuantityTriggersFn?.run?.(),"undefined"!=typeof bricksWooLoopQtyListenerFn&&bricksWooLoopQtyListenerFn?.run?.()}class t{constructor(e){this.instance=e,this.setupElement(),e.facets.on("fetch",this),e.facets.on("fetched",this),e.facets.on("appended",this)}fetch(e){this.paged&&(e.paged=this.paged)}fetched(e){if(!e.posts)return;const t=document.createRange().createContextualFragment(e.posts);this.replaceNoResults(t,e),this.appendNoResults(t,e)}appended(){window?.bricksIsotope?.(),e()}paginate(e){e.target.closest(".page-numbers")&&e.target.href&&(e.preventDefault(),e.stopPropagation(),this.paged=(e.target.href||"").match(/\/(\d+)/),this.paged=this.paged&&this.paged[1]||1,this.paged&&this.instance.facets.refresh(),this.scrollToTop())}scrollToTop(){const e=this.instance.element.getBoundingClientRect().top+window.pageYOffset-120;this.instance.element.tabIndex=-1,this.instance.element.focus({preventScroll:!0}),"scrollBehavior"in document.documentElement.style?window.scrollTo({top:e,behavior:"smooth"}):document.documentElement.scrollTop=e}replacePagination(e){const t=e.querySelector(".bricks-pagination");this.instance.element.querySelector(".bricks-pagination")?.remove(),t&&this.instance.element.append(t),this.paged=!1}replaceNoResults(e,t){if(!this.instance.element.classList.contains("bricks-posts-nothing-found"))return void this.replacePagination(e);const n=e.querySelector(".brxe-posts");t.posts="",this.replaceElement(n),this.setupElement(),this.appended()}appendNoResults(e,t){const n=e.querySelector(".bricks-posts-nothing-found");n&&(t.posts="",this.replaceElement(n),this.setupElement(),this.appended())}replaceElement(e){this.instance.element.replaceWith(e),this.instance.element=e,this.instance.facets.element=e}setupElement(){this.instance.element.classList.add("wpgb-enabled"),this.instance.element.removeAttribute("data-options"),this.instance.element.dataset.instance=this.instance.instance,this.instance.element.addEventListener("click",this.paginate.bind(this),!0)}}class s{constructor(e){this.instance=e,this.setupElement(),e.facets.on("fetch",this),e.facets.on("fetched",this),e.facets.on("appended",this)}fetch(e){this.paged&&(e.paged=this.paged)}fetched(e){if(!e.posts)return;const t=document.createRange().createContextualFragment(e.posts);this.replaceNoResults(t,e),this.appendNoResults(t,e)}appended(){e()}paginate(e){e.target.closest(".page-numbers")&&e.target.href&&(e.preventDefault(),e.stopPropagation(),this.paged=(e.target.href||"").match(/(\d+|\product-page=d+)/),this.paged=this.paged&&this.paged[1]||1,this.paged&&this.instance.facets.refresh(),this.scrollToTop())}scrollToTop(){const e=this.instance.element.getBoundingClientRect().top+window.pageYOffset-120;this.instance.element.tabIndex=-1,this.instance.element.focus({preventScroll:!0}),"scrollBehavior"in document.documentElement.style?window.scrollTo({top:e,behavior:"smooth"}):document.documentElement.scrollTop=e}replacePagination(e){const t=e?.querySelector?.(".bricks-products-widgets.before"),n=e?.querySelector?.(".bricks-products-widgets.after");t&&this.instance.element?.querySelector?.(".bricks-products-widgets.before")?.replaceWith?.(t),n&&this.instance.element?.querySelector?.(".bricks-products-widgets.after")?.replaceWith?.(n),this.paged=!1}replaceNoResults(e,t){const n=this.instance.element.querySelector("ul.products.woocommerce li"),s=e.querySelector("ul.products.woocommerce li");n?this.replacePagination(e):s&&(t.posts="",this.replaceElement(e.firstElementChild.cloneNode(!0)),this.setupElement(),this.appended())}appendNoResults(e,t){e.querySelector("ul.products.woocommerce li")||(t.posts="",this.replaceElement(e.firstElementChild.cloneNode(!0)),this.setupElement(),this.appended())}replaceElement(e){this.instance.element.replaceWith(e),this.instance.element=e,this.instance.facets.element=e}setupElement(){this.instance.element.classList.add("wpgb-enabled"),this.instance.element.removeAttribute("data-options"),this.instance.element.dataset.instance=this.instance.instance,this.instance.element.addEventListener("click",this.paginate.bind(this),!0)}}class i{constructor(e){this.instance=e,this.className=`brxe-${e.id.split("-").pop()}`,this.instance.element&&(this.setupPlaceholder(),this.changeElement(),e.facets.on("fetch",this),e.facets.on("fetched",this),e.facets.on("appended",this))}fetch(e,t){"render"!==t&&this.loading(!0)}fetched(e){if(!e.posts)return;const t=document.createRange();t.selectNodeContents(t.createContextualFragment("<template>").lastChild);const n=t.createContextualFragment(e.posts),s=this.instance.facets.isLoadingMore()?"append":"replace";let i=this.placeholder;if("replace"===s&&(this.unsetDynamicStyles(),this.removeStyles(),this.removePopups()),"replace"===s)for(;this.placeholder.nextElementSibling&&(this.placeholder.nextElementSibling.id===this.className||"STYLE"===this.placeholder.nextElementSibling.tagName||this.placeholder.nextElementSibling.classList.contains(this.className)||this.placeholder.nextElementSibling.classList.contains("brx-query-trail")||this.placeholder.nextElementSibling.classList.contains("bricks-posts-nothing-found"));)this.placeholder.nextElementSibling.remove();else for(;i.nextElementSibling&&i.nextElementSibling.classList.contains(this.className);)i=i.nextElementSibling;const o=n.querySelectorAll(`.${this.className}`);for(let e=n.children.length-1;e>-1;e--)n.children[e].removeAttribute("data-options"),n.children[e].classList.remove("bricks-lazy-hidden"),n.children[e]?.classList?.contains("brx-popup")?document.body.append(n.children[e]):"STYLE"!==n.children[e].tagName?(this.instance.facets.isLoadingMore()||n.children[e].classList.add("wpgb-loading"),n.children[e]?.classList?.contains("brx-popup")||n.children[e]?.classList?.contains("brx-query-trail")||n.children[e]&&i.after(n.children[e])):(n.children[e].classList.add(`wpgb-style-${this.className}`),document.body.append(n.children[e]));requestAnimationFrame((()=>this.loading(!1))),this.instance.facets.emit("appended",[o,s]),e.posts=""}unsetDynamicStyles(){const e=document.getElementById("bricks-dynamic-data-inline-css");if(!e)return;const t=new RegExp(`\\.${this.className}[^{]*\\[data-query-loop-index="\\d+"\\][^{]*{[^}]*}`,"gi");e.textContent=e.textContent.replace(t,"").trim()}removePopups(){document.querySelectorAll(`[data-popup-loop="${CSS.escape(this.className.replace("brxe-",""))}"]`).forEach((e=>e.remove()))}removeStyles(){document.querySelectorAll(`.wpgb-style-${this.className}`).forEach((e=>e.remove()))}appended(){e()}loading(e){if(this.instance.facets.isLoadingMore())return;const t=e?"add":"remove";let n=this.placeholder.nextElementSibling;for(;n&&(n.id===this.className||n.classList.contains(this.className)||n.classList.contains("bricks-posts-nothing-found"));)n.classList[t]?.("wpgb-loading"),n=n.nextElementSibling}setupPlaceholder(){this.placeholder=document.createComment(" Gridbuilder ᵂᴾ Plugin (https://wpgridbuilder.com) "),this.instance.element.parentElement.insertBefore(this.placeholder,this.instance.element)}changeElement(){this.instance.element.removeAttribute("data-instance"),this.instance.element.classList.remove("wpgb-enabled"),this.instance.element=this.instance.element.parentElement,this.instance.facets.element=this.instance.element,this.instance.element.classList.add("wpgb-enabled"),this.instance.element.dataset.instance=this.instance.instance}}function o(e){if(e.options&&e.options.element&&e.options.isTemplate&&"Bricks"===e.options.isTemplate)switch(e.options.element){case"posts":new t(e);break;case"div":case"block":case"container":new i(e);break;case"woocommerce-products":new s(e)}}function r(){if(WP_Grid_Builder.instances&&Object.keys(WP_Grid_Builder.instances).length)for(const e in WP_Grid_Builder.instances)o(WP_Grid_Builder.instances[e]);else WP_Grid_Builder.on("init",o)}window.WP_Grid_Builder?r():window.addEventListener("wpgb.loaded",(()=>r()))})()})();