!function(){"use strict";function e(e,t){if(!e||""===e)return console.error("addAsset: caminho não definido.");if(e.includes(".js")){const r=document.createElement("script");return r.setAttribute("src",e),t&&"function"==typeof t&&(r.onload=t),document.body.appendChild(r)}if(e.includes(".css")){const t=document.createElement("link");return t.setAttribute("rel","stylesheet"),t.setAttribute("type","text/css"),t.setAttribute("href",e),document.head.appendChild(t)}{const t="addAsset: Erro ao criar o asset. Tipo de script não definido, ou não possui tratamento para este tipo de asset.";return console.error(t,e)}}function t(e){const t=new FormData(e),r={};for(const[o,n]of t)r[o]=n;const a=[];for(const o in r){const e=encodeURIComponent(o),t=encodeURIComponent(r[o]);a.push(`${e}=${t}`)}return a.join("&")}const r={root:document.querySelector("#component-cart-drawer-root"),buttons:document.querySelectorAll("[data-toggle-cart]"),countWrapper:document.querySelector("[data-cart-count]"),settings:window.cartDrawerSettings||!1,setCartDrawer:function(){const{settings:e,root:t}=r;if(!t||!e)return;const a=e.freeShippingValue>1?e.freeShippingValue:0,o=new Vnda.Component.CartDrawer({anchor:"right",display:"list",startOpen:!1,titleCart:"Carrinho de compras",disableShippingCalculation:!0,freeShipping:a});o.render(t),window.cartDrawerSettings.instance=o,r.settings=window.cartDrawerSettings,t.dispatchEvent(new Event("vnda:cart-drawer-loaded"))},loadComponent:function(){const{settings:t}=r;e(t.script,r.setCartDrawer),e(t.styles)},handleCartButton:function(e){e.classList.contains("-loading")||(e.classList.add("-loading"),r.show((()=>{e.classList.remove("-loading")})))},show:function(e){const{root:t}=r;window.mmenu&&window.mmenu.close(),r.settings.instance||r.loadComponent(),!1===r.settings.instance?t.addEventListener("vnda:cart-drawer-loaded",(()=>{r.settings.instance.open(),"function"==typeof e&&e()})):(r.settings.instance.open(),"function"==typeof e&&e())},getCartItens:async function(){try{const e=await fetch("/carrinho/itens");return await e.json()}catch(e){console.error("Erro ao buscar a quantidade de produtos do carrinho"),console.error(e)}},updateCartCount:async function(e=null){let t=e;null==e&&(t=await r.getCartItens()),this.countWrapper.innerHTML=t},init:function(){const e=this,{buttons:t}=e;e.updateCartCount(),t.length>0&&t.forEach((t=>{t.addEventListener("click",(()=>{e.handleCartButton(t)}))}))}};var a=r;var o={handleSubmenu:function(){document.querySelectorAll('[data-action="toggle-menu-footer"]').forEach((e=>{e.addEventListener("click",(()=>{e.classList.toggle("open")}))}))},init:function(){this.handleSubmenu()}};document.querySelectorAll("[data-toggle-search]").forEach((e=>{e.addEventListener("click",(()=>{document.querySelector("[data-search-container]").classList.toggle("open")}))}));var n={lastScrollTop:-1,scrollTop:window.pageYOffset,header:document.querySelector("#header"),setScroll:function(e,t){const r=this;e<=0?(r.header.classList.add("scroll-up"),r.header.classList.remove("scroll-down"),r.header.classList.add("on-top")):(r.header.classList.contains("on-top")&&r.header.classList.remove("on-top"),e>t?(r.header.classList.add("scroll-down"),r.header.classList.remove("scroll-up")):(r.header.classList.add("scroll-up"),r.header.classList.remove("scroll-down")))},init:function(){const e=this,{lastScrollTop:t,scrollTop:r}=e;e.setScroll(r,t),window.addEventListener("scroll",(function(){const r=window.pageYOffset;e.setScroll(r,t),e.lastScrollTop=r}))}},s=function(){function e(e){var t=this;this.listener=function(e){(e.matches?t.matchFns:t.unmatchFns).forEach((function(e){e()}))},this.toggler=window.matchMedia(e),this.toggler.addListener(this.listener),this.matchFns=[],this.unmatchFns=[]}return e.prototype.add=function(e,t){this.matchFns.push(e),this.unmatchFns.push(t),(this.toggler.matches?e:t)()},e}(),i=function(e){return Array.prototype.slice.call(e)},c=function(e,t){return i((t||document).querySelectorAll(e))},l="mm-spn",d=function(){function e(e,t,r,a,o){this.node=e,this.title=t,this.slidingSubmenus=a,this.selectedClass=r,this.node.classList.add(l),this.node.classList.add(l+"--"+o),this.node.classList.add(l+"--"+(this.slidingSubmenus?"navbar":"vertical")),this._setSelectedl(),this._initAnchors()}return Object.defineProperty(e.prototype,"prefix",{get:function(){return l},enumerable:!1,configurable:!0}),e.prototype.openPanel=function(e){var t=e.parentElement;if(this.slidingSubmenus){var r=e.dataset.mmSpnTitle;t===this.node?this.node.classList.add(l+"--main"):(this.node.classList.remove(l+"--main"),r||i(t.children).forEach((function(e){e.matches("a, span")&&(r=e.textContent)}))),r||(r=this.title),this.node.dataset.mmSpnTitle=r,c("."+l+"--open",this.node).forEach((function(e){e.classList.remove(l+"--open"),e.classList.remove(l+"--parent")})),e.classList.add(l+"--open"),e.classList.remove(l+"--parent");for(var a=e.parentElement.closest("ul");a;)a.classList.add(l+"--open"),a.classList.add(l+"--parent"),a=a.parentElement.closest("ul")}else{var o=e.matches("."+l+"--open");c("."+l+"--open",this.node).forEach((function(e){e.classList.remove(l+"--open")})),e.classList[o?"remove":"add"](l+"--open");for(var n=e.parentElement.closest("ul");n;)n.classList.add(l+"--open"),n=n.parentElement.closest("ul")}},e.prototype._setSelectedl=function(){var e=c("."+this.selectedClass,this.node),t=e[e.length-1],r=null;t&&(r=t.closest("ul")),r||(r=this.node.querySelector("ul")),this.openPanel(r)},e.prototype._initAnchors=function(){var e=this;this.node.addEventListener("click",(function(t){var r=t.target,a=!1;a=a||function(e){return!!e.matches("a")}(r),a=a||function(t){var r;return!!(r=t.closest("span")?t.parentElement:!!t.closest("li")&&t)&&(i(r.children).forEach((function(t){t.matches("ul")&&e.openPanel(t)})),!0)}(r),a=a||function(t){var r=c("."+l+"--open",t),a=r[r.length-1];if(a){var o=a.parentElement.closest("ul");if(o)return e.openPanel(o),!0}return!1}(r),a&&t.stopImmediatePropagation()}))},e}(),u="mm-ocd",p=function(){function e(e,t){var r=this;void 0===e&&(e=null),this.wrapper=document.createElement("div"),this.wrapper.classList.add(""+u),this.wrapper.classList.add(u+"--"+t),this.content=document.createElement("div"),this.content.classList.add(u+"__content"),this.wrapper.append(this.content),this.backdrop=document.createElement("div"),this.backdrop.classList.add(u+"__backdrop"),this.wrapper.append(this.backdrop),document.body.append(this.wrapper),e&&this.content.append(e);var a=function(e){r.close(),e.stopImmediatePropagation()};this.backdrop.addEventListener("touchstart",a,{passive:!0}),this.backdrop.addEventListener("mousedown",a,{passive:!0})}return Object.defineProperty(e.prototype,"prefix",{get:function(){return u},enumerable:!1,configurable:!0}),e.prototype.open=function(){this.wrapper.classList.add(u+"--open"),document.body.classList.add(u+"-opened")},e.prototype.close=function(){this.wrapper.classList.remove(u+"--open"),document.body.classList.remove(u+"-opened")},e}(),m=function(){function e(e,t){void 0===t&&(t="all"),this.menu=e,this.toggler=new s(t)}return e.prototype.navigation=function(e){var t=this;if(!this.navigator){var r=(e=e||{}).title,a=void 0===r?"Menu":r,o=e.selectedClass,n=void 0===o?"Selected":o,s=e.slidingSubmenus,i=void 0===s||s,c=e.theme,l=void 0===c?"light":c;this.navigator=new d(this.menu,a,n,i,l),this.toggler.add((function(){return t.menu.classList.add(t.navigator.prefix)}),(function(){return t.menu.classList.remove(t.navigator.prefix)}))}return this.navigator},e.prototype.offcanvas=function(e){var t=this;if(!this.drawer){var r=(e=e||{}).position,a=void 0===r?"left":r;this.drawer=new p(null,a);var o=document.createComment("original menu location");this.menu.after(o),this.toggler.add((function(){t.drawer.content.append(t.menu)}),(function(){t.drawer.close(),o.after(t.menu)}))}return this.drawer},e}(),h=m;window.MmenuLight=m;var v={setMenuMobile:function(){const e=document.querySelector("#mm-menu-mobile"),t=new h(e),r=(t.navigation({title:"Menu"}),t.offcanvas());document.querySelector('[data-action="open-menu-mobile"]').addEventListener("click",(e=>{e.preventDefault(),r.open()})),document.querySelector('[data-action="close-menu-mobile"]').addEventListener("click",(e=>{e.preventDefault(),r.close()})),window.mmenu=r},init:function(){this.setMenuMobile()}};var f={togglePopup:function(e){document.querySelector(`[data-popup="${e}"].popup`).classList.toggle("-open")},init:function(){var e=this;document.querySelectorAll('[data-action="toggle-popup"]').forEach((t=>{t.addEventListener("click",(r=>{r.preventDefault();let a=t.dataset.popup;e.togglePopup(a)}))}))}};const b={submitWebForm:async function(e,r){const a=t(e),o=e.querySelector(".action").innerHTML;if(void 0!==r&&""!=r||(r=e.querySelector('[name="email"]').value),e.querySelector('[name="reply_to"]').value=r,!e.classList.contains("sending")){e.classList.add("sending"),e.classList.remove("error"),e.querySelector(".action").innerHTML="Enviando";try{const t=await fetch("/webform",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},body:a});if(t.ok)console.info("Formulário enviado com sucesso"),e.classList.add("sent"),e.querySelector(".msg-success").classList.add("-visible"),e.querySelector(".action").innerHTML="Enviado",e.reset(),setTimeout((function(){e.classList.remove("sent"),e.querySelector(".msg-success").classList.remove("-visible"),e.querySelector(".action").innerHTML=o}),3500);else{const r=await t.text();console.error(`Ocorreu um erro no envio do formulário. Erro ${t.status}`),console.error(r),e.classList.add("error"),e.querySelector(".msg-error").classList.add("-visible"),e.querySelector(".action").innerHTML="Falha ao enviar",setTimeout((function(){e.classList.remove("error"),e.querySelector(".msg-error").classList.remove("-visible"),e.querySelector(".action").innerHTML=o}),3500)}}catch(n){console.error("Erro ao enviar o webform"),console.error(n),e.classList.add("error"),e.querySelector(".msg-error").classList.add("-visible"),e.querySelector(".action").innerHTML="Falha ao enviar",setTimeout((function(){e.classList.remove("error"),e.querySelector(".msg-error").classList.remove("-visible"),e.querySelector(".action").innerHTML=o}),3500)}e.classList.remove("sending")}},submitNotify:async function(e){const r=t(e),a=e.querySelector(".action").innerHTML;if(!e.classList.contains("sending")){e.classList.remove("error"),e.classList.add("sending"),e.querySelector(".action").innerHTML="Enviando";try{const t=await fetch("/lista_de_espera",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},body:r});if(t.ok)e.classList.remove("sending"),console.log("Lista de espera enviada com sucesso"),b.submitWebForm(e);else{const r=await t.text();console.error(`Ocorreu um erro ao enviar o formulário de Lista de Espera. Erro ${t.status}`),console.error(r),e.classList.add("error"),e.querySelector(".msg-error").classList.add("-visible"),e.querySelector(".action").innerHTML="Falha ao enviar",setTimeout((()=>{e.classList.remove("error"),e.querySelector(".msg-error").classList.remove("-visible"),e.querySelector(".action").innerHTML=a}),3500)}}catch(o){console.error("Falha ao enviar lista de espera. Verificar integração."),console.error(o),e.classList.add("error"),e.querySelector(".msg-error").classList.add("-visible"),e.querySelector(".action").innerHTML="Falha ao enviar",setTimeout((()=>{e.classList.remove("error"),e.querySelector(".msg-error").classList.remove("-visible"),e.querySelector(".action").innerHTML=a}),3500)}e.classList.remove("sending")}},showMessage:function(e,t){const r=t.querySelector("[data-msg]");r.classList.add("-visible"),r.innerText="Preencha os campos obrigatórios",e.classList.add("-emphasis"),setTimeout((()=>{r.classList.remove("-visible"),r.innerText="",e.classList.remove("-emphasis")}),2e3)},validateForm:function(e,t){let r=!0;if(""==e.value){e.setAttribute("required",!1);t.querySelectorAll("[required]:not([required=false])").forEach((e=>{""==e.value&&(r=!1,b.showMessage(e,t)),"checkbox"==e.type&&0==e.checked&&(r=!1,b.showMessage(e,t))})),r&&("form-notify"==t.id?b.submitNotify(t):b.submitWebForm(t))}},setWebForms:function(){const e=document.querySelectorAll("[data-webform]");e.length>0&&e.forEach((e=>{const t=e.querySelector("button"),r=e.querySelector("fieldset");let a=e.querySelector('input[name="vnda"]');a.addEventListener("input",(()=>r.setAttribute("disabled",!0))),t&&t.addEventListener("click",(()=>b.validateForm(a,e))),t&&t.addEventListener("keypress",(t=>{"Enter"===t.key&&b.validateForm(a,e)}))}))},init:function(){this.setWebForms()}};var y=b;var g={openCartDrawer:!0,openCartDrawerMobile:!0,addItem:async function(e,t,r){const a=this,o=t.querySelector('[data-action="add-cart"]'),n=function(e){let t="";function r(e){return encodeURIComponent(e).replace(/%20/g,"+")}for(const a of e.entries())"string"==typeof a[1]&&(t+=(t?"&":"")+r(a[0])+"="+r(a[1]));return t}(new FormData(e)),s=t.querySelector("[data-form-product] .msg-response:not(.resp-validate)");if(!o.classList.contains("-adding")){o.classList.add("-adding");try{const t=await fetch("/carrinho/adicionar",{method:"POST",headers:{Accept:"application/json, text/javascript, */*; q=0.0","Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},body:n}),o=await t.text();console.log("success"),"function"==typeof r?r("produto-adicionado",o,s,e):a.addItemResult("produto-adicionado",o,s,e)}catch(i){console.log("error"),console.error(i),"function"==typeof r?r("erro-adicionar",i,s,e):a.addItemResult("erro-adicionar",i,s,e)}o.classList.remove("-adding")}},deleteItem:async function(e,t,r){const o=this;if(!t.classList.contains("-removing")){t.classList.add("-removing");try{await fetch("/carrinho",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({_method:"delete",item_id:e})});console.log("success"),window.innerWidth>768?o.openCartDrawer&&a.updateCartCount():o.openCartDrawerMobile&&a.updateCartCount(),"function"==typeof r&&r(t)}catch(n){console.log("Erro ao remover item do carrinho"),console.log(n)}t.classList.remove("-removing")}},validateFormProduct:function(e){var t=!0,r=[];return"false"==e.querySelector('[data-action="add-cart"]').dataset.available?(t=!1,r.push("")):(""==e.querySelector('[name="sku"]').value&&(t=!1,r.push("Selecione um atributo para o produto")),e.querySelector('input[name="quantity"]').value<=0&&(t=!1,r.push("Quantidade indisponível"))),{validated:t,errors:r}},setRespValidateProduct:function(e,t,r){let a="";if(e.validated)r.innerHTML="";else{for(var o=e.errors.length-1;o>=0;o--)a+=''+e.errors[o]+"";r.innerHTML=a}},addItemResult:function(e,t,r,o){const n=this;if("produto-adicionado"==e){const e=o.querySelector('[data-action="add-cart"]');e&&e.classList.add("success"),setTimeout((function(){e&&e.classList.remove("success"),e&&(e.innerHTML=e.dataset.textAvailable)}),3500),a.updateCartCount(),window.innerWidth>768?n.openCartDrawer?a.show():setTimeout((()=>{window.location.href=urlCart}),150):n.openCartDrawerMobile?a.show():setTimeout((()=>{window.location.href=urlCart}),150);const t=document.querySelector("[data-popup-purchase]");null!=t&&t.classList.contains("-active")&&t.querySelector("[data-close-popup-purchase]").click()}else"erro-adicionar"==e&&void 0!==r&&r.length>0&&(window.scrollTo({top:r.offsetTop,behavior:"smooth"}),r.classList.add("error"),r.classList.remove("success"),r.querySelector("span").innerHTML="Ocorreu um erro, tente novamente.")}};const L={productVariants:productVariants,products:document.querySelectorAll("[data-product-purchase]"),checkCombinations:function(e,t){const r=e.getAttribute("data-product-id"),a=Number(t.getAttribute("data-attribute-index")),o=L.productVariants[`${r}`],n={attr1:[...e.querySelectorAll('[data-attribute-index="1"]')],attr2:[...e.querySelectorAll('[data-attribute-index="2"]')],attr3:[...e.querySelectorAll('[data-attribute-index="3"]')]},s={attr1:e.querySelector('[data-attribute="1"] input:checked + label'),attr2:e.querySelector('[data-attribute="2"] input:checked + label'),attr3:e.querySelector('[data-attribute="3"] input:checked + label')};switch(s[`attr${a}`]=t,a){case 1:L.markAttributes([...n.attr2],2,o,s,e),L.markAttributes([...n.attr3],3,o,s,e);break;case 2:L.markAttributes([...n.attr3],3,o,s,e)}},markAttributes:function(e,t,r,a,o){if(null!=e&&e.length>0){switch(t){case 1:a.attr2=null,a.attr3=null;break;case 2:a.attr3=null}e.forEach((e=>{const n=e.getAttribute("data-attribute-value"),s=`property${t}`;let i=!1;const c={...a,[`attr${t}`]:e},l=r.filter((e=>{const t=e.properties;let r=!1,a=!1,o=!1;if(null==c.attr1&&(r=!0),null==c.attr2&&(a=!0),null==c.attr3&&(o=!0),null==t.property1&&(r=!0),null==t.property2&&(a=!0),null==t.property3&&(o=!0),0==r){const e=c.attr1.getAttribute("data-attribute-value");t.property1.value==e&&(r=!0)}if(0==a){const e=c.attr2.getAttribute("data-attribute-value");t.property2.value==e&&(a=!0)}if(0==o){const e=c.attr3.getAttribute("data-attribute-value");t.property3.value==e&&(o=!0)}if(r&&a&&o)return e}));if(e.classList.remove("-available"),e.classList.remove("-unavailable"),e.classList.remove("-disabled"),l.length>0)l.forEach((e=>{e.properties[s]?e.properties[s].value==n&&(i=0!=e.available):i=!1})),i?e.classList.add("-available"):e.classList.add("-unavailable");else if(0===l.length){e.classList.add("-disabled");const r=e.getAttribute("data-attribute-value"),a=o.querySelector(`[data-attribute="${t}"] input[value="${r}"]`);a.checked&&(a.checked=!1,setTimeout((()=>{const e=o.querySelector(`label[data-attribute-index="${t}"]:not(.-disabled)`);e&&e.click()}),50))}}))}},checkSelection:function(e){const t=e.getAttribute("data-product-id"),r=L.productVariants[`${t}`],a=e.querySelector('[data-attribute="1"] input:checked'),o=e.querySelector('[data-attribute="2"] input:checked'),n=e.querySelector('[data-attribute="3"] input:checked');let s=!1;for(let i=0;i0){const r=[...e.querySelectorAll('[data-attribute="1"] [data-attribute-value]')],a=[...e.querySelectorAll('[data-attribute="2"] [data-attribute-value]')],o=[...e.querySelectorAll('[data-attribute="3"] [data-attribute-value]')];let n={index:!1,options:[]};if(o.length>0&&(n={index:"property3",options:o}),a.length>0&&(n={index:"property2",options:a}),r.length>0&&(n={index:"property1",options:r}),n.options.length>0){for(let r=0;r{if(e.properties[n.index].value==a&&e.available)return e})).length>0?e.classList.add("-available"):e.classList.add("-unavailable")}let e=!1;for(const t of n.options)if(t.classList.contains("-available")){if(t.click(),e=!0,"property1"==n.index){for(const e of a)if(e.classList.contains("-available")){e.click();break}for(const e of o)if(e.classList.contains("-available")){e.click();break}}if("property2"==n.index)for(const e of o)if(e.classList.contains("-available")){e.click();break}break}e||(n.options[0].click(),"property1"==n.index&&(a.length>0&&a[0].click(),o.length>0&&o[0].click()),"property2"==n.index&&o.length>0&&o[0].click())}}},setLastUnits:function(e,t){const r=e.querySelector(".last-units"),a=t.quantity;a<=5&&a?a>1?(r.innerHTML=`Últimas ${a} unidades disponíveis`,r.classList.add("-visible")):(r.innerHTML="Última unidade disponível",r.classList.add("-visible")):(r.innerHTML="",r.classList.remove("-visible"))},setQuantitySelector:function(e){const t=e.querySelector(".msg-response .msg-error"),r=e.querySelector("[data-qtd-plus]"),a=e.querySelector("[data-qtd-minus]"),o=e.querySelector('[name="quantity"]');null!=r&&null!=a&&(r.addEventListener("click",(()=>{const e=Number(o.value)+1,r=Number(o.dataset.availableQuantity);r?e>r?(t.innerHTML="Quantidade máxima em estoque.",t.classList.add("-visible")):(o.value=e,o.setAttribute("value",e)):(t.innerHTML="Produto em falta no estoque",t.classList.add("-visible"))})),a.addEventListener("click",(()=>{const e=Number(o.value)-1;e>0&&(o.value=e,o.setAttribute("value",e),t.classList.contains("-visible")&&t.classList.remove("-visible"))})))},submitForm:function(e){e.addEventListener("submit",(t=>{t.preventDefault();if(null==e.closest("[data-product-box]").getAttribute("data-prod-group-shop")){const t=e,r=t.closest("[data-product-box]"),a=g.validateFormProduct(t),o=r.querySelector(".msg-response");a.validated?g.addItem(t,r):g.setRespValidateProduct(a,t,o)}}))},popupPurchase:{popupEl:document.querySelector("[data-popup-purchase]"),currentOpenProduct:!1,open:function(e){L.popupPurchase.currentOpenProduct=e;const t=e.querySelector(".images").cloneNode(!0),r=e.querySelector(".name").cloneNode(!0),a=e.querySelector(".price").cloneNode(),o=e.querySelector("[data-product-purchase]"),n=this.popupEl.querySelector(".product"),s=document.createElement("div"),i=document.createElement("div"),c=document.createElement("a");c.classList.add("more-link"),c.innerText="Mais detalhes",c.setAttribute("href",e.querySelector("a").getAttribute("href"));let l=document.createElement("div");l.classList.add("price-wrapper"),l.appendChild(a),s.appendChild(t),i.appendChild(r),i.appendChild(l),i.appendChild(o),i.appendChild(c),n.appendChild(s),n.appendChild(i),a.setAttribute("data-was-processed",!1),window.Vnda.Component.Price.update(),this.popupEl.classList.add("-active")},close:function(){const e=this.popupEl;e.querySelectorAll("[data-close-popup-purchase]").forEach((t=>{"false"==t.getAttribute("data-processed")&&(t.addEventListener("click",(()=>{e.classList.remove("-active"),setTimeout((()=>{const t=e.querySelector("[data-product-purchase]");L.popupPurchase.currentOpenProduct.appendChild(t),L.popupPurchase.currentOpenProduct=!1;const r=e.querySelector(".product");for(;r.firstChild;)r.removeChild(r.firstChild)}),300)})),t.setAttribute("data-processed",!0))}))}},init:function(e){(e||!1)&&(this.products=document.querySelectorAll("[data-product-purchase]"),this.productVariants=productVariants);const{products:t,checkCombinations:r,checkSelection:a,markFirstVariant:o,submitForm:n,setQuantitySelector:s}=this;L.popupPurchase.close(),t.length>0&&t.forEach((e=>{if("false"==e.getAttribute("data-processed")){const t=e.querySelectorAll("[data-attribute-value]"),i=e.querySelectorAll("input");t.forEach((t=>{t.addEventListener("click",(()=>{r(e,t)}))})),i.forEach((t=>{t.addEventListener("change",(()=>{a(e)}))})),s(e),o(e),n(e),e.setAttribute("data-processed",!0);const c=e.parentElement.querySelector("[data-open-popup-purchase]");null!=c&&c.addEventListener("click",(()=>{L.popupPurchase.open(e.parentElement)}))}})),window.ProductPurchase=L}};var w=L;const S={root:document.querySelector("#component-popup-newsletter-root"),settings:window.popupNewsletterSettings||!1,loaded:!1,setPopupNewsletter:function(){const{settings:e,root:t}=S;let r=e.maxWidth,a=e.imageUrl,o=e.title,n=e.description,s=e.subdomain,i=e.success;new Vnda.Component.NewsletterPopup({maxWidth:r,maxHeight:500,imageUrl:a,imagePosition:"left",popupPosition:"center",title:o,description:n,textBtnSubmit:"Enviar",classBtnSubmit:"button-newsletter",formKey:`${s}-newsletter`,hasNameField:!1,hasLastNameField:!1,hasDateOfBirthField:!1,hasPhoneField:!1,successMessage:i,delay:500,frequency:"7",language:"pt-BR"}).render(t),S.loaded=!0},loadPopupNewsletter:function(){if(!S.loaded){const{settings:t}=S;e(t.script,S.setPopupNewsletter),e(t.styles)}},init:function(){const{root:e,settings:t}=this;if(!e||!t)return;const r=window.innerWidth<=1024?"scroll":"mousemove";window.addEventListener(r,(()=>{S.loadPopupNewsletter()}),{once:!0})}};const q={script:window.priceComponent||!1,loaded:!1,init:function(){if(!q.script)return;const t=document.querySelectorAll("[data-product-box]");if(0===t.length)return;const r=new IntersectionObserver((t=>{t[0].isIntersecting&&(q.loaded||(e(q.script),q.loaded=!0),r.disconnect())}),{threshold:.1});t.forEach((e=>{r.observe(e)}))}};let E=700;window.innerWidth<768&&(E=400),window.lazyLoadOptions={elements_selector:".lazy",threshold:E},window.addEventListener("LazyLoad::Initialized",(e=>{window.lazyLoadInstance=e.detail.instance}),{passive:!0}),console.log("%cVnda - Tecnologia em Ecommerce",'color: #f88d5b; font-size: 15px; font-family: "Verdana", sans-serif; font-weight: bold;'),window.addEventListener("DOMContentLoaded",(()=>{a.init(),n.init(),o.init(),f.init(),w.init(),q.init(),y.init(),S.init(),window.innerWidth<992&&v.init()}))}();
//# sourceMappingURL=main.js.map