(()=>{"use strict";const e="PEN",t="oechsle",o="atm_transactionsGA4",i=e=>{const t=[];if(Array.isArray(e)&&e.length>0){const o=e.map((e=>`productId:${e}`)).join(",");let i=[];const n=new XMLHttpRequest;n.open("GET","/api/catalog_system/pub/products/search/?fq="+o,!1),n.setRequestHeader("Accept","application/json"),n.setRequestHeader("Content-type","application/json"),n.send(),i=JSON.parse(n.responseText),i.length>0&&i.forEach((e=>{const o={id:e.productId,name:e.productName,brand:e.brand,categoryId:e.categoryId,categoryName:e.categories[0].replace(/(\/$)|(^\/)/g,"").split("/").reverse()[0],categoriesIds:e.categoriesIds[0].replace(/(\/$)|(^\/)/g,""),categoriesNames:e.categories[0].replace(/(\/$)|(^\/)/g,""),skuList:[],sellers:[],listPrice:0,price:0,discount:0,ohPrice:0,ohDiscount:0,tags:"",octagons:"",discountPercent:0,ohDiscountPercent:0};if(e.items&&e.items.length>0){const t=e.items.find((e=>e.sellers.find((e=>e.commertialOffer&&e.commertialOffer.AvailableQuantity))))||e.items[0];o.sellers=t.sellers.map((e=>({id:e.sellerId,name:e.sellerName,isDefault:e.sellerDefault})));const i=(t.sellers.find((e=>e.sellerDefault))||t.sellers[0]).commertialOffer;if(i){o.listPrice=i.ListPrice,o.price=i.Price,o.discount=parseFloat((parseFloat(i.ListPrice)-parseFloat(i.Price)).toFixed(2)),o.discountPercent=Math.floor(o.discount/parseFloat(i.ListPrice)*100);let t=0,n=0;const a=i.PromotionTeasers&&i.PromotionTeasers.length>0?i.PromotionTeasers[0]:{};if(void 0!==a.Effects){const e=a.Effects.Parameters;e&&e.length>0&&e.forEach((e=>{"PromotionalPriceTableItemsDiscount"===e.Name?(t=parseFloat((o.discount+parseFloat(e.Value||"0")).toFixed(2)),n=Math.floor(t/parseFloat(i.ListPrice)*100)):"PercentualDiscount"===e.Name&&(n=parseFloat(parseFloat(e.Value||"0").toFixed(2)),t=parseFloat((n*i.ListPrice/100).toFixed(2)))}))}o.ohDiscount=t,o.ohDiscountPercent=n,o.ohPrice=i.ListPrice-t,o.skuList=e.items.map((e=>{const t={id:e.itemId,name:e.name,variations:{}};return e.variations&&e.variations.length>0&&e.variations.forEach((o=>{Array.isArray(e[o])?t.variations[o]=e[o][0]||"":t.variations[o]=e[o]||""})),t}))}}const i=e.clusterHighlights||e.searchableClusters;if(i){const e="ALL|Todos los Productos".toLowerCase().split("|"),t=[],n=[],a={sodio:"Sodio",azucar:"Azúcar",saturadas:"Grasas Saturadas",trans:"Grasas Trans"},r="sodio,azucar,saturadas,trans,sodio_trans,azucar_sodio,azucar_trans,saturadas_sodio,saturadas_azucar,saturadas_trans,saturadas_sodio_trans,saturadas_azucar_sodio,saturadas_azucar_trans".split(",");Object.keys(i).forEach((o=>{const c=i[o];if(""!==c&&-1===e.indexOf(c.toLowerCase())){let e=!1;r.forEach((t=>{c===t&&(t.split("_").forEach((e=>{n.push(a[e])})),e=!0)})),e||t.push(c)}})),t.length>0&&(o.tags=t.join(", ")),n.length>0&&(o.octagons=n.join("::"))}t.push(o)}))}return t},n=e=>{let t;if(void 0!==e){let o=[];const i=new XMLHttpRequest;i.open("GET","https://api.oechsleonline.pe/api/order/v1/detail?orderId="+e,!1),i.setRequestHeader("Accept","application/json"),i.setRequestHeader("Content-type","application/json"),i.setRequestHeader("client_id","7ba1ed99-ffdf-39c4-a275-7aab67f39d01");try{i.send(),o=200===i.status?JSON.parse(i.responseText):null}catch(e){o=null}o&&(t=o)}return t},a="data-product-",r={seller:"1",listPrice:"5",price:"6",ohPrice:"7",onlineDiscount:"",onlineDiscountPercent:"8",ohDiscount:"",ohDiscountPercent:"9",tags:"10",exclusive:"12",categoryId:"14",location:"15",octagons:"16",cluster:"17"},c=e=>{window.dataLayer=window.dataLayer||[];const t=Object.assign({event:"ga4.trackEvent"},e);window.dataLayer.push(t)},s=e=>{let t=0;return e.forEach((e=>{t+=Number(e.price)*Number(e.quantity)})),t},l=(e,t)=>{const o=t.skus.find((t=>t.sku.toString()===e));return(null==o?void 0:o.available)?"disponible":"no disponible"},d=e=>{const t=new Set;return e.forEach((e=>{t.add(e.item_category1)})),[...t]},u=e=>{let t={id:e.getAttribute(`${a}id`)||"",name:e.getAttribute(`${a}name`)||"",brand:e.getAttribute(`${a}brand`)||"",category:e.getAttribute(`${a}category`)||"",categories:e.getAttribute(`${a}categories`)||"",price:parseFloat(e.getAttribute(`${a}price`)||"0.00").toFixed(2),variant:e.getAttribute(`${a}variant`)||"",list:e.getAttribute(`${a}list`)||"",position:"",sku:"",categoryId:"",listPrice:"",onlineDiscount:"",onlineDiscountPercent:"",ohPrice:"",ohDiscountPercent:"",ohDiscount:"",seller:"",tags:"",octagons:"",exclusive:"",location:"",quantity:null,cluster:""};const o=e.getAttribute(`${a}position`)||"";""!==o&&(t.position=o);const i=e.getAttribute(`${a}sku`)||"";""!==i&&(t.sku=i);const n=e.getAttribute(`${a}category-id`)||"";""!==n&&(t.categoryId=n);const r=e.getAttribute(`${a}list-price`)||"";""!==r&&(t.listPrice=r);const c=e.getAttribute(`${a}online-discount`)||"";""!==c&&(t.onlineDiscount=c);const s=e.getAttribute(`${a}online-discount-percent`)||"";""!==s&&(t.onlineDiscountPercent=s);const l=e.getAttribute(`${a}oh-price`)||"";""!==l&&(t.ohPrice=l);const d=e.getAttribute(`${a}oh-discount`)||"";""!==d&&(t.ohDiscount=d);const u=e.getAttribute(`${a}oh-discount-percent`)||"";""!==u&&(t.ohDiscountPercent=u);const m=e.getAttribute(`${a}seller`)||"";""!==m&&(t.seller=m);const p=e.getAttribute(`${a}tags`)||"";""!==p&&(t.tags=p);const g=e.getAttribute(`${a}octagons`)||"";""!==g&&(t.octagons=g);const h=e.getAttribute(`${a}exclusive`)||"";""!==h&&(t.exclusive=h);const v=e.getAttribute(`${a}location`)||"";""!==v&&(t.location=v);const _=e.getAttribute(`${a}quantity`)||"";""!==_&&(t.quantity=_);const f=e.getAttribute(`${a}cluster`)||"";return""!==f&&(t.cluster=f),t},m=e=>{const t=`${e}=`,o=document.cookie.split(";");for(let e=0;e/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(e),g=(e,t)=>{const o="data-product-";Object.keys(t).forEach((i=>{const n=i.replace(/(?!^)([A-Z])/g,"-$&").replace(/_/g,"-").toLowerCase();let a="";void 0!==t[i]&&(a=t[i].toString()),""!==a?e.setAttribute(`${o}${n}`,a):e.removeAttribute(`${o}${n}`)}))},h=(e,t=void 0)=>{let o=e||"";t&&(o=o.toLowerCase());const i="àáâãäåòóôõöøèéêëðçìíîïùúûüñšÿýžÀÁÂÃÄÅÒÓÔÕÖØÈÉÊËÐÇÌÍÎÏÙÚÛÜÑŠŸÝŽ",n=o.split(""),a=[];for(let e=0;e{let t=!0;if(e)if(e.offsetWidth||e.offsetHeight||e.getClientRects().length){const o=window.getComputedStyle(e,null);o?("none"===o.display||"hidden"===o.visibility||0===parseFloat(o.opacity))&&(t=!1):t=!1}else t=!1;else t=!1;return t},_=e=>{const t=e.getBoundingClientRect(),o=t.width*t.height;let i=0;if(o>0){const e=Math.max(t.width-Math.max(t.right-document.documentElement.clientWidth,0)-Math.abs(Math.min(t.left,0)),0),n=Math.max(t.height-Math.max(t.bottom-document.documentElement.clientHeight,0)-Math.abs(Math.min(t.top,0)),0);i=Math.max(e*n,0)/o}return i},f=()=>{const e=window.location.pathname,t=window.location.hostname;return e.match(/\/p$/)?"PDP":e.match(/^\/coleccion/)?"COLECCION":e.match(/^\/busca(\/)?$/)||t.match(/^busca\./)||"/"!==e&&void 0!==window.catNameSub?"PLP":"/"===e?"Home":void 0},y=(e,t,o,i)=>{((e,t,o,i,n)=>{window.seeker=window.seeker||{for:{},defaults:{tries:20,delay:500}};const a=o||{},r={tries:a.tries||window.seeker.defaults.tries,delay:a.delay||window.seeker.defaults.delay};let c="";c=`${t}__${e.replace(/[^a-zA-Z0-9]/g," ").trim().replace(/\s+/g,"_").toLowerCase()}`,null!=window.seeker.for[c]&&clearInterval(window.seeker.for[c].instance),window.seeker.for[c]={triesLeft:r.tries,instance:null},window.seeker.for[c].instance=setInterval((()=>{if(window.seeker.for[c].triesLeft>0){{const t=document.querySelectorAll(e);t&&t.length>0&&(clearInterval(window.seeker.for[c].instance),"function"==typeof i&&i(t))}window.seeker.for[c].triesLeft-=1}else clearInterval(window.seeker.for[c].instance),"function"==typeof n&&n()}),r.delay)})(e,"els",t,o,i)},b=e=>{const t=r||{},o={};return Object.keys(e).forEach((i=>{t[i]&&(o[`dimension${t[i]}`]=e[i])})),o};var I=function(e,t,o,i){return new(o||(o=Promise))((function(n,a){function r(e){try{s(i.next(e))}catch(e){a(e)}}function c(e){try{s(i.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?n(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(r,c)}s((i=i.apply(e,t||[])).next())}))};const S=e=>{var t;const o=e.shippingData.logisticsInfo[0].slas.find((t=>t.id===e.shippingData.logisticsInfo[0].selectedSla)),i=new Date(e.creationDate),n=i.setDate(i.getDate()+4),a=new Date(null===(t=o.deliveryWindow)||void 0===t?void 0:t.endDateUtc)||new Date(n);let r=a.getDate().toString().padStart(2,"0"),c=a.getMonth().toString().padStart(2,"0");return`${a.getFullYear()}-${c}-${r}`},P=e=>e.paymentData.transactions[0].payments[0].paymentSystemName,w=()=>I(void 0,void 0,void 0,(function*(){const i=yield new Promise((e=>{const t=[],o=()=>I(void 0,void 0,void 0,(function*(){var o;const a=document.querySelectorAll('span[id="order-id"]');if(0!==a.length){for(const e of a)if(e instanceof HTMLElement)if(void 0!==e.dataset.order)t.push(JSON.parse(e.dataset.order));else{const i=null===(o=e.textContent)||void 0===o?void 0:o.replace(/#/g,"");if(i)try{const e=yield n(i);t.push(e)}catch(e){console.error("Error al obtener order:",e)}}i.disconnect(),e(t)}})),i=new MutationObserver((()=>{o()})),a=document.getElementById("app-container");a&&i.observe(a,{childList:!0,subtree:!0}),o()}));yield(i=>{i.forEach((i=>I(void 0,void 0,void 0,(function*(){if(void 0!==i&&Object.prototype.hasOwnProperty.call(i,"orderId")){const r=new Date,s=Object.prototype.hasOwnProperty.call(i,"creationDate")?new Date(i.creationDate):new Date,l=Math.abs(Math.round((r.getTime()-s.getTime())/1e3/60)),u=m(o),p=""===u?[]:u.split("|");if(!u.includes(i.orderId)&&l<10){const r=[],s=JSON.parse(localStorage.getItem("listItemCollection"))||[],l=m("intelligent-search-history"),u=decodeURI(l.split(",")[0]),g=JSON.parse(localStorage.getItem("listItemPromotion"))||[];let h=0;for(const e of i.items){const t=e.additionalInfo.categoriesIds.split("/").filter(Boolean).map((t=>e.additionalInfo.categories.find((e=>e.id.toString()===t.toString())).name)).join("/").split("/"),o=s.find((t=>parseInt(t.item_id)===parseInt(e.productId))),n=g.find((t=>t.products.includes(parseInt(e.productId)))),a=e.isGift?0:e.price/100||0,c=e.quantity,l=e.isGift?0:e.priceTags.length>0?Math.abs(e.priceTags.filter((e=>!e.name.includes("shipping"))).reduce(((e,t)=>e+t.value),0))/100:0,d=i.shippingData.logisticsInfo.find((t=>t.itemId===e.id)).price/100||0,u=e.isGift?0:a-l-(a-l)/1.18,m=e.bundleItems.length>0?e.bundleItems.reduce(((e,t)=>e+t.price),0)/100:0;h+=m;const p={item_id:e.id||e.productId||"",item_name:e.name||"",item_brand:e.additionalInfo.brandName||"",item_category:e.additionalInfo.categoriesIds.split("/").filter(Boolean).map((t=>e.additionalInfo.categories.find((e=>e.id.toString()===t.toString())).name)).join("/"),item_variant:e.productId||"",item_list_id:(null==o?void 0:o.item_list_id)||null,item_list_name:(null==o?void 0:o.item_list_name)||null,price:a-l/c,quantity:c,item_discount:l,discount:l,shipping:d,item_tax:u,item_service:m,affiliation:"1"===e.seller?"oechsle":e.seller,item_category1:"1"===e.seller?"oechsle":e.seller,item_category10:e.tags||"",item_category14:e.additionalInfo.categoriesIds.split("/").filter(Boolean).join("/"),item_category2:void 0!==t[0]?t[0]:null,item_category3:void 0!==t[1]?t[1]:null,item_category4:void 0!==t[2]?t[2]:null,item_category5:void 0!==t[3]?t[3]:null,promotion_id:(null==n?void 0:n.promotion_id)||null,promotion_name:(null==n?void 0:n.promotion_name)||null,item_position:(null==n?void 0:n.position)||null,item_section:(null==n?void 0:n.section)||null,item_creative_slot:(null==n?void 0:n.creative_slot)||null};r.push(p)}const v=i.totals.find((e=>"Items"==e.id)).value/100||0,_=Math.abs(i.totals.find((e=>"Discounts"==e.id)).value)/100||0,f=i.totals.find((e=>"Shipping"==e.id)).value/100||0,y=v-_-(v-_)/1.18,b={eventName:"purchase",eventParams:{transaction_id:i.orderId,coupon:(i.marketingData&&i.marketingData.coupon?i.marketingData.coupon:"").toUpperCase(),value:v-_-h,discount:_,shipping:f,tax:y,total_value:i.value/100,total_service:h,currency:e,payment_type:P(i),shipping_tier:i.shippingData.logisticsInfo[0].selectedSla,shipping_date:S(i),lista_sellers:d(r),bandera:t,search_term:u.length>1?u:null,items:r,user_data:{sha256_email_address:localStorage.getItem("itc_hash_email")||""}}};c(b),p.push(i.orderId),localStorage.removeItem("listItemCollection"),localStorage.removeItem("listItemPromotion"),n=o,a=p.join("|"),document.cookie=`${n}=${a};path=/`}}var n,a}))))})(i)}));var A=function(e,t,o,i){return new(o||(o=Promise))((function(n,a){function r(e){try{s(i.next(e))}catch(e){a(e)}}function c(e){try{s(i.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?n(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(r,c)}s((i=i.apply(e,t||[])).next())}))};let k=null,E=null;const x=()=>A(void 0,void 0,void 0,(function*(){const o=setInterval((()=>A(void 0,void 0,void 0,(function*(){const i=document.querySelectorAll(".cart .product-item[data-product-id]");if(i&&i.length>0){clearInterval(o);const n=[];for(const t of i){const o=u(t),i=(JSON.parse(localStorage.getItem("listItemCollection"))||[]).find((e=>parseInt(e.item_id)===parseInt(o.id))),a=(JSON.parse(localStorage.getItem("listItemPromotion"))||[]).find((e=>e.products.includes(parseInt(o.id)))),r=o.category.split("/"),c={item_id:o.sku,item_name:o.name,item_list_name:(null==i?void 0:i.item_list_name)||null,item_list_id:(null==i?void 0:i.item_list_id)||null,item_brand:o.brand,item_category:o.category,item_variant:o.variant,price:o.price,quantity:o.quantity||"",currency:e,discount:o.ohDiscount,coupon:"",affiliation:"1"===o.seller?"oechsle":o.seller,item_category1:"1"===o.seller?"oechsle":o.seller,item_category10:o.tags||"",item_category14:o.categoryId,item_category2:void 0!==r[0]?r[0]:null,item_category3:void 0!==r[1]?r[1]:null,item_category4:void 0!==r[2]?r[2]:null,item_category5:void 0!==r[3]?r[3]:null,promotion_id:(null==a?void 0:a.promotion_id)||null,promotion_name:(null==a?void 0:a.promotion_name)||null,item_position:(null==a?void 0:a.position)||null,item_section:(null==a?void 0:a.section)||null,item_creative_slot:(null==a?void 0:a.creative_slot)||null};n.push(c)}const a=m("intelligent-search-history"),r=decodeURI(a.split(",")[0]),s={eventName:"view_cart",eventParams:{currency:e,value:(vtexjs.checkout.orderForm.value/100).toFixed(2),lista_sellers:d(n),bandera:t,search_term:r.length>1?r:null,items:n}};c(s)}}))),1e3)})),L=e=>{var o,i;const n=1===e?document.querySelectorAll(".cart .product-item"):document.querySelectorAll(".cart .hproduct.item"),a=(null===(i=null===(o=window.vtexjs.checkout)||void 0===o?void 0:o.orderForm)||void 0===i?void 0:i.items)||[],r=JSON.parse(sessionStorage.getItem("product"))||[];n.length&&a.length&&n.forEach((e=>{if(e instanceof HTMLElement){const o=a.find((t=>t.id===e.dataset.sku)),i=r.find((t=>t.sku===e.dataset.sku)),n={id:o.productId||o.id,sku:o.id||o.productId,name:o.name||"",brand:o.additionalInfo.brandName||"",category:o.productCategoryIds.split("/").filter(Boolean).map((e=>o.productCategories[e])).join("/")||"",categoryId:o.productCategoryIds.split("/").filter(Boolean).join("/")||"",price:(o.price/100).toFixed(2)||"0.00",listPrice:"",onlineDiscount:"",onlineDiscountPercent:"",ohPrice:"",ohDiscount:"",ohDiscountPercent:"",variant:"",seller:"",tags:"",location:"",quantity:""};n.listPrice=(o.listPrice/100).toFixed(2)||"0.00",n.listPrice="0.00"===n.listPrice?n.price:n.listPrice,n.onlineDiscount="0.00",n.onlineDiscountPercent="0%","0.00"!==n.listPrice&&"0.00"!==n.price&&(n.onlineDiscount=parseFloat(Math.max(0,parseFloat(n.listPrice)-parseFloat(n.price)).toString()).toFixed(2),n.onlineDiscountPercent=`${Math.floor(parseFloat(n.onlineDiscount)/parseFloat(n.listPrice)*100)}%`),n.ohPrice=i&&i.priceOh?i.priceOh.toFixed(2):"0.00",n.ohPrice="0.00"===n.ohPrice?n.price:n.ohPrice,n.ohDiscount="0.00",n.ohDiscountPercent="0%","0.00"!==n.listPrice&&"0.00"!==n.ohPrice&&(n.ohDiscount=parseFloat(Math.max(0,parseFloat(n.listPrice)-parseFloat(n.ohPrice)).toString()).toFixed(2),n.ohDiscountPercent=`${Math.floor(parseFloat(n.ohDiscount)/parseFloat(n.listPrice)*100)}%`),n.variant="Estandar",n.seller="1"===o.seller?t:o.seller.toLowerCase(),n.tags=i&&i.tags?i.tags:"",n.location="checkout page",n.quantity=o.quantity,g(e,n)}}))},q=(t,o)=>{const i=t.target;L(1);const n=i.closest(".product-item[data-product-id]");if(n){const t=[],i=u(n),a=(JSON.parse(localStorage.getItem("listItemAux")),(JSON.parse(localStorage.getItem("listItemCollection"))||[]).find((e=>parseInt(e.item_id)===parseInt(i.id)))),r=i.category.split("/"),c=(JSON.parse(localStorage.getItem("listItemPromotion"))||[]).find((e=>e.products.includes(parseInt(i.id)))),s={item_id:i.sku,item_name:i.name,item_brand:i.brand,item_category:i.category,item_variant:i.variant,price:i.price,quantity:"remove_from_cart_all"===o?i.quantity:1,currency:e,discount:i.onlineDiscount,item_category1:"1"===i.seller?"oechsle":i.seller,affiliation:"1"===i.seller?"oechsle":i.seller,item_category10:i.tags||"",item_category14:i.categoryId,item_category2:void 0!==r[0]?r[0]:null,item_category3:void 0!==r[1]?r[1]:null,item_category4:void 0!==r[2]?r[2]:null,item_category5:void 0!==r[3]?r[3]:null,item_list_id:(null==a?void 0:a.item_list_id)||null,item_list_name:(null==a?void 0:a.item_list_name)||null,promotion_id:(null==c?void 0:c.promotion_id)||null,promotion_name:(null==c?void 0:c.promotion_name)||null,item_position:(null==c?void 0:c.position)||null,item_section:(null==c?void 0:c.section)||null,item_creative_slot:(null==c?void 0:c.creative_slot)||null};return t.push(s),t}},N=()=>{const{items:o}=vtexjs.checkout.orderForm,i=[];for(const t of o){const o=(t.productCategoryIds.split("/").filter(Boolean).map((e=>t.productCategories[e])).join("/")||"").split("/"),n=(JSON.parse(localStorage.getItem("listItemCollection"))||[]).find((e=>parseInt(e.item_id)===parseInt(t.productId))),a=(JSON.parse(localStorage.getItem("listItemPromotion"))||[]).find((e=>e.products.includes(parseInt(t.productId)))),r={currency:e,item_id:t.id,item_name:t.name,item_brand:t.additionalInfo.brandName,item_category:t.productCategoryIds.split("/").filter(Boolean).map((e=>t.productCategories[e])).join("/")||"",list:t.list||"",item_variant:t.variant||"",quantity:t.quantity,price:(t.price/100).toFixed(2),discount:t.price!==t.sellingPrice?((t.price-t.sellingPrice)/100).toFixed(2):0,affiliation:"1"===t.seller?"oechsle":t.seller,item_category1:"1"===t.seller?"oechsle":t.seller,item_category10:t.tags||"",item_category14:t.productCategoryIds,item_category2:void 0!==o[0]?o[0]:null,item_category3:void 0!==o[1]?o[1]:null,item_category4:void 0!==o[2]?o[2]:null,item_category5:void 0!==o[3]?o[3]:null,item_list_id:(null==n?void 0:n.item_list_id)||null,item_list_name:(null==n?void 0:n.item_list_name)||null,promotion_id:(null==a?void 0:a.promotion_id)||null,promotion_name:(null==a?void 0:a.promotion_name)||null,item_position:(null==a?void 0:a.position)||null,item_section:(null==a?void 0:a.section)||null,item_creative_slot:(null==a?void 0:a.creative_slot)||null};i.push(r)}const n=m("intelligent-search-history"),a=decodeURI(n.split(",")[0]),r={eventName:"begin_checkout",eventParams:{value:s(i).toFixed(2),bandera:t,currency:e,search_term:a.length>1?a:null,items:i}};c(r)},D=()=>{M(1,{stage:"ingresa email",bandera:t}),M(1,{stage:"ingresa datos",bandera:t})},C=()=>{N();const e={user_id:vtexjs.checkout.orderForm.userProfileId,bandera:t};M(1,e),M(2,{login_type:"auto login",bandera:t})},F=()=>{const{items:o,shippingData:i,value:n}=vtexjs.checkout.orderForm,a=[];for(const e of o){const t=(e.productCategoryIds.split("/").filter(Boolean).map((t=>e.productCategories[t])).join("/")||"").split("/"),o=(JSON.parse(localStorage.getItem("listItemCollection"))||[]).find((t=>parseInt(t.item_id)===parseInt(e.productId))),i=(JSON.parse(localStorage.getItem("listItemPromotion"))||[]).find((t=>t.products.includes(parseInt(e.productId)))),n={item_id:e.id,item_name:e.name,item_brand:e.additionalInfo.brandName,item_category:e.productCategoryIds.split("/").filter(Boolean).map((t=>e.productCategories[t])).join("/")||"",list:e.list||"",item_variant:e.variant||"",price:(e.price/100).toFixed(2),discount:e.listPrice!==e.price?((e.listPrice-e.price)/100).toFixed(2):0,affiliation:"1"===e.seller?"oechsle":e.seller,item_category1:"1"===e.seller?"oechsle":e.seller,item_category10:e.tags||"",item_category14:e.productCategoryIds,item_category2:void 0!==t[0]?t[0]:null,item_category3:void 0!==t[1]?t[1]:null,item_category4:void 0!==t[2]?t[2]:null,item_category5:void 0!==t[3]?t[3]:null,item_list_id:(null==o?void 0:o.item_list_id)||null,item_list_name:(null==o?void 0:o.item_list_name)||null,promotion_id:(null==i?void 0:i.promotion_id)||null,promotion_name:(null==i?void 0:i.promotion_name)||null,item_position:(null==i?void 0:i.position)||null,item_section:(null==i?void 0:i.section)||null,item_creative_slot:(null==i?void 0:i.creative_slot)||null};a.push(n)}const r=m("intelligent-search-history"),s=decodeURI(r.split(",")[0]),l={eventName:"add_shipping_info",eventParams:{currency:e,value:(n/100).toFixed(2),bandera:t,shipping_date:S(vtexjs.checkout.orderForm),shipping_tier:i.logisticsInfo[0].selectedSla,search_term:s.length>1?s:null,items:a}};c(l),M(3,{bandera:t})},O=()=>{const{items:o,paymentData:i,value:n}=vtexjs.checkout.orderForm,a=[];for(const t of o){const o=(t.productCategoryIds.split("/").filter(Boolean).map((e=>t.productCategories[e])).join("/")||"").split("/"),i=(JSON.parse(localStorage.getItem("listItemCollection"))||[]).find((e=>parseInt(e.item_id)===parseInt(t.productId))),n=(JSON.parse(localStorage.getItem("listItemPromotion"))||[]).find((e=>e.products.includes(parseInt(t.productId)))),r={item_id:t.id,item_name:t.name,item_brand:t.additionalInfo.brandName,item_category:t.productCategoryIds.split("/").filter(Boolean).map((e=>t.productCategories[e])).join("/")||"",item_list_id:(null==i?void 0:i.item_list_id)||null,item_list_name:(null==i?void 0:i.item_list_name)||null,price:(t.price/100).toFixed(2),currency:e,discount:t.listPrice!==t.price?((t.listPrice-t.price)/100).toFixed(2):0,affiliation:"1"===t.seller?"oechsle":t.seller,item_category1:"1"===t.seller?"oechsle":t.seller,item_category10:t.tags||"",item_category14:t.productCategoryIds,item_category2:void 0!==o[0]?o[0]:null,item_category3:void 0!==o[1]?o[1]:null,item_category4:void 0!==o[2]?o[2]:null,item_category5:void 0!==o[3]?o[3]:null,promotion_id:(null==n?void 0:n.promotion_id)||null,promotion_name:(null==n?void 0:n.promotion_name)||null,item_position:(null==n?void 0:n.position)||null,item_section:(null==n?void 0:n.section)||null,item_creative_slot:(null==n?void 0:n.creative_slot)||null};a.push(r)}const r=m("intelligent-search-history"),s=decodeURI(r.split(",")[0]),l={eventName:"add_payment_info",eventParams:{currency:e,value:(n/100).toFixed(2),bandera:t,payment_type:i.paymentSystems.find((e=>e.id===Number(i.payments[0].paymentSystem))).name,search_term:s.length>1?s:null,items:a}};c(l)},j=()=>{document.querySelectorAll(".item-quantity-change-increment").forEach((e=>{e.addEventListener("click",(function(e){k="add_to_cart",E=q(e,k)[0]}))}))},T=()=>{document.querySelectorAll(".item-quantity-change-decrement, .item-link-remove").forEach((e=>{"item-link-remove"==e.className?e.addEventListener("click",(function(e){k="remove_from_cart_all",E=q(e,k)[0]})):e.addEventListener("click",(function(e){k="remove_from_cart",E=q(e,k)[0]}))}))},U=()=>{setTimeout((()=>{$(".item_armado .warranty-content .wp_text_precio input").each((function(){$(this).unbind().change((function(){const e={name:$($(this).parents(".wp_text_precio")[0]).find("span.text").text(),price:$($(this).parents(".wp_text_precio")[0]).find("span.servivio_precio_span").text()};J("add_to_cart",this,e.name,e.price)}))})),$("a.js-remove_service").each((function(){$(this).unbind().on("click",(function(){const e={name:$($(this).parents(".wp_servise")[0]).find("div.nombre_service").text(),price:$($(this).parents(".wp_servise")[0]).find("div.precio_service").text()};J("remove_from_cart",this,e.name,e.price)}))}))}),3e3)},J=(o,i,n,a)=>{const r=$(i).parents("tr.product-item.check-item")[0],s={item_name:$(r).attr("data-product-name"),item_category:n,price:a,quantity:$(r).attr("data-product-quantity"),affiliation:t};c({eventName:o,eventParams:{currency:e,value:1,section:"carrito",bandera:t,items:[s]}})},M=(e,t)=>{const o={eventName:"checkout_steps",eventParams:Object.assign({step:e},t)};c(o)},B=e=>{const t=e.target;t.setAttribute("data-old-value",t.value)},R=e=>{const t=e.target;L(1);const o=t.closest(".product-item[data-product-id]");if(o){const e=[],i=u(o);i.quantity=Math.abs(t.value-t.dataset.oldValue);const n={name:i.name,id:i.id,price:i.price,brand:i.brand,category:i.category,list:i.list,variant:i.variant,quantity:i.quantity},a=b(i);Object.assign(n,a),e.push(n),t.value,t.dataset.oldValue}},z=()=>A(void 0,void 0,void 0,(function*(){var o;const i=e=>{(e=>{L(e),j(),T(),document.querySelectorAll('.quantity input[id*="item-quantity-"]').forEach((e=>{e.removeEventListener("focus",B),e.addEventListener("focus",B),e.removeEventListener("change",R),e.addEventListener("change",R)}))})(e),(e=>{const t=e<=2?document.querySelectorAll(".cart .product-item[data-product-id]"):document.querySelectorAll(".cart .hproduct.item[data-product-id]"),o=[];t.length&&(t.forEach((e=>{const t=u(e),i={name:t.name,id:t.id,price:t.price,brand:t.brand,category:t.category,list:t.list,variant:t.variant,quantity:t.quantity},n=b(t);Object.assign(i,n),o.push(i)})),localStorage.setItem("checkout",JSON.stringify({products:o,date:new Date})))})(e)};if(""===window.location.hash||/#\/cart/.test(window.location.hash)?i(1):/#\/email/.test(window.location.hash)?i(2):/#\/profile/.test(window.location.hash)?i(3):/#\/shipping/.test(window.location.hash)?i(4):/#\/payment/.test(window.location.hash)&&i(5),(""===window.location.hash||/#\/cart/.test(window.location.hash))&&(x(),j(),T(),U(),null===(o=vtexjs.checkout.orderForm.clientProfileData)||void 0===o?void 0:o.email)){const e=document.querySelector("#cart-to-orderform");e.removeEventListener("click",C),e.addEventListener("click",C)}$(window).on("hashchange",(function(){var e;if(""===window.location.hash||/#\/cart/.test(window.location.hash)){if(x(),j(),T(),U(),null===(e=vtexjs.checkout.orderForm.clientProfileData)||void 0===e?void 0:e.email){const e=document.querySelector("#cart-to-orderform");e.removeEventListener("click",C),e.addEventListener("click",C)}}else if(/#\/email/.test(window.location.hash)){const e=document.querySelector("#btn-client-pre-email");e.removeEventListener("click",D),e.addEventListener("click",D);const t=document.querySelector("#btn-identified-user-button");t.removeEventListener("click",N),t.addEventListener("click",N)}else/#\/profile/.test(window.location.hash)?M(1,{stage:"ingresa email",bandera:t}):/#\/shipping/.test(window.location.hash)?N():/#\/payment/.test(window.location.hash)&&M(3,{bandera:t})})),$(window).on("orderFormUpdated.vtex",((o,n)=>{if(i(1),""===window.location.hash||/#\/cart/.test(window.location.hash)){if(j(),T(),U(),k){let o=n.items.find((e=>e.id===E.item_id));o||(o=n.items.find((e=>e.name===E.item_name))),"remove_from_cart_all"==k&&(k="remove_from_cart"),((o,i)=>{const n={eventName:i,eventParams:{currency:e,value:s([o]),section:"carrito",bandera:t,items:[o]}};c(n)})(E,k),k=null,E=null}}else if(/#\/email/.test(window.location.hash)){const e=document.querySelector("#btn-client-pre-email");e.removeEventListener("click",D),e.addEventListener("click",D)}else if(/#\/profile/.test(window.location.hash))document.querySelectorAll("#go-to-shipping").forEach((e=>{e.removeEventListener("click",N),e.addEventListener("click",N)}));else if(/#\/shipping/.test(window.location.hash)){(()=>{let e;vtexjs.checkout.orderForm.shippingData.selectedAddresses.length>0?e={user_id:vtexjs.checkout.orderForm.userProfileId,login_type:"login :: registrado",itc_hash_email:localStorage.getItem("itc_hash_email"),bandera:t}:0===vtexjs.checkout.orderForm.shippingData.selectedAddresses.length&&(e={login_type:"invitado",user_id:vtexjs.checkout.orderForm.userProfileId,itc_hash_id:localStorage.getItem("itc_hash_id"),itc_hash_dni:localStorage.getItem("itc_hash_dni"),itc_hash_email:localStorage.getItem("itc_hash_email"),itc_hash_mobile:localStorage.getItem("itc_hash_mobile"),itc_hash_mobile2:localStorage.getItem("itc_hash_mobile2"),bandera:t}),M(2,e)})();const e=document.querySelector(".btn-go-to-payment#btn-go-to-payment");e&&(e.removeEventListener("click",F),e.addEventListener("click",F))}else/#\/payment/.test(window.location.hash)&&document.querySelectorAll("#payment-data-submit").forEach((e=>{e.removeEventListener("click",O),e.addEventListener("click",O)}));j(),T()}))}));let H;const G=()=>{const e=window.skuJson||{},t=window.vtxctx||{},o=H[0]||{},i=document.querySelector("article#containerProduct");if(i&&void 0!==e.productId){const n={};n.id=e.productId,n.sku=n.id;const a=document.querySelector(".skuReference");a&&(n.sku=a.innerText);let r=e.skus.find((e=>e.sku.toString()===n.sku.toString()));n.name=r.skuname||e.name,n.brand=o.brand||"",n.category=o.categoriesNames||"",n.categoryId="";const c=[];if(c.push(t.departmentyId),c.push(t.categoryId),n.categoryId=o.categoriesIds||c.join("/"),n.price="0.00",r)n.price=parseFloat(r.bestPriceFormated.replace(/(S\/(\.)?)|\$|,|\s/g,"")||"0").toFixed(2);else{const e=document.querySelector('[data-js="pdp-price-online"] .justify-content-end span[itemprop="lowPrice"]');e&&(n.price=parseFloat(e.textContent.replace(/(S\/(\.)?)|\$|,|\s/g,"")||"0").toFixed(2))}if(n.listPrice="0.00",r)n.listPrice=parseFloat(r.listPriceFormated.replace(/(S\/(\.)?)|\$|,|\s/g,"")||"0").toFixed(2);else{const e=document.querySelector('[data-js="pdp-price-regular"] .justify-content-end span[itemprop="price"]');e&&(n.listPrice=parseFloat(e.textContent.replace(/(S\/(\.)?)|\$|,|\s/g,"")||"0").toFixed(2))}if(n.listPrice="0.00"===n.listPrice||0===n.listPrice?n.price:n.listPrice,n.onlineDiscount="0.00",n.onlineDiscountPercent="0%","0.00"!==n.listPrice&&"0.00"!==n.price&&(n.onlineDiscount=parseFloat(Math.max(0,parseFloat(n.listPrice)-parseFloat(n.price)).toString()).toFixed(2),n.onlineDiscountPercent=`${Math.floor(parseFloat(n.onlineDiscount)/parseFloat(n.listPrice)*100)}%`),n.variant="Estandar",r){const e=[];Object.keys(r.dimensions).forEach((t=>{e.push(`${t}:${r.dimensions[t]}`)})),e.length>0&&(n.variant=e.join("|"))}else{const e=document.querySelectorAll('[data-js="prod-attr"] ul.topic .skuList');if(e.length>0){const t=[];e.forEach((e=>{const o=e.querySelector('input[type="radio"][data-dimension][data-value]:checked');o&&t.push(`${o.getAttribute("data-dimension")}:${o.getAttribute("data-value")}`)})),t.length>0&&(n.variant=t.join("|"))}}n.ohPrice="0.00";const s=document.querySelector('[data-js="pdp-price-oh"] .justify-content-end span.fw-bold');s&&(n.ohPrice=parseFloat(s.textContent.replace(/(S\/(\.)?)|\$|,|\s/g,"")||"0").toFixed(2)),n.ohPrice="0.00"===n.ohPrice?n.price:n.ohPrice,n.ohDiscount="0.00",n.ohDiscountPercent="0%","0.00"!==n.listPrice&&"0.00"!==n.ohPrice&&(n.ohDiscount=parseFloat(Math.max(0,parseFloat(n.listPrice)-parseFloat(n.ohPrice)).toString()).toFixed(2),n.ohDiscountPercent=`${Math.floor(parseFloat(n.ohDiscount)/parseFloat(n.listPrice)*100)}%`),n.seller="oechsle",o.sellers.length>0&&(n.seller=(o.sellers[0].name||"").replace(/ seller/g,"").toLowerCase());const l=document.querySelector('[data-js="marketplace"] > [data-js*="marketplace"]:not(.d-none) .box-seller .name-seller');l&&"Estandar"===o.sellers&&("img"===l.nodeName.toLowerCase()?n.seller=l.getAttribute("alt").toLowerCase()||"":n.seller=l.innerText.trim().toLowerCase()),n.tags="",n.octagons="";const d=document.querySelectorAll('[data-js="pdp-tags"] p.flag:not(.d-none):not(.all):not(.todos-los-productos)');if(d.length>0){const e=[],t=[],o={sodio:"Sodio",azucar:"Azúcar",saturadas:"Grasas Saturadas",trans:"Grasas Trans"},i="sodio,azucar,saturadas,trans,sodio_trans,azucar_sodio,azucar_trans,saturadas_sodio,saturadas_azucar,saturadas_trans,saturadas_sodio_trans,saturadas_azucar_sodio,saturadas_azucar_trans".split(",");d.forEach((n=>{let a=!1;i.forEach((e=>{n.classList.contains(e)&&(e.split("_").forEach((e=>{t.push(o[e])})),a=!0)})),a||""!==(n.innerText||"")&&e.push(n.innerText)})),e.length>0&&(n.tags=e.join(", ")),t.length>0&&(n.octagons=t.join("::"))}n.location="details page",n.list=localStorage.getItem("previousList")||"",g(i,n)}},Z=o=>{let i,n;const a=setInterval((()=>{if(i=document.querySelector("article#containerProduct"),n=document.querySelector(".fn.productName").textContent,i){clearInterval(a);const n=u(i);V(n.id,n.sku);const r=(JSON.parse(localStorage.getItem("listItemCollection"))||[]).find((e=>parseInt(e.item_id)===parseInt(n.id))),s=(JSON.parse(localStorage.getItem("listItemPromotion"))||[]).find((e=>e.products.includes(parseInt(n.id)))),d=n.category.split("/"),p={item_id:n.sku,item_name:n.name,item_brand:n.brand,item_category:n.category,item_variant:n.variant,price:n.price,currency:e,affiliation:"1"===n.seller?"oechsle":n.seller,item_category1:"1"===n.seller?"oechsle":n.seller,item_category10:n.tags||"",item_category14:n.categoryId,item_category2:void 0!==d[0]?d[0]:null,item_category3:void 0!==d[1]?d[1]:null,item_category4:void 0!==d[2]?d[2]:null,item_category5:void 0!==d[3]?d[3]:null,item_list_id:(null==r?void 0:r.item_list_id)||null,item_list_name:(null==r?void 0:r.item_list_name)||null,promotion_id:(null==s?void 0:s.promotion_id)||null,promotion_name:(null==s?void 0:s.promotion_name)||null,item_position:(null==s?void 0:s.position)||null,item_section:(null==s?void 0:s.section)||null,item_creative_slot:(null==s?void 0:s.creative_slot)||null},g=m("intelligent-search-history"),h=decodeURI(g.split(",")[0]),v={eventName:"view_item",eventParams:{currency:e,value:n.price,bandera:t,stock:l(n.sku,o),search_term:h.length>1?h:null,items:[p]}};c(v);const _=n.category+" :: "+n.id.toString();Y(_),X(_)}}),1e3)},Q=()=>{G();const e=window.skuJson||{};Z(e)},V=(e,t)=>{const o=new Set;localStorage.getItem("listItemCollection")&&(JSON.parse(localStorage.getItem("listItemCollection"))||[]).filter(((e,t,o)=>t===o.findIndex((t=>t.item_id===e.item_id)))).forEach((i=>{""!==i.item_id&&void 0!==i.item_sku&&(i.item_id==e?(i.item_sku=parseInt(t),o.add(i)):o.add(i))}));const i=[...o];localStorage.setItem("listItemCollection",JSON.stringify(i))},W=o=>{const i=document.querySelector("article#containerProduct");if(document.querySelector(".fn.productName").textContent,i&&i.querySelector('.buy-button[href*="/checkout/cart/add"]')){const o=u(i);let n=1;n=parseInt($("#controlQuantityProduct input[name='quantity']").val());const a=(JSON.parse(localStorage.getItem("listItemCollection"))||[]).find((e=>parseInt(e.item_id)===parseInt(o.id))),r=o.category.split("/"),l=(JSON.parse(localStorage.getItem("listItemPromotion"))||[]).find((e=>e.products.includes(parseInt(o.id)))),d={item_id:o.sku,item_name:o.name,item_brand:o.brand,item_category:o.category,item_variant:o.variant,price:o.price,quantity:n,currency:e,discount:o.onlineDiscount,affiliation:"1"===o.seller?"oechsle":o.seller,item_category1:"1"===o.seller?"oechsle":o.seller,item_category10:o.tags||"",item_category14:o.categoryId,item_category2:void 0!==r[0]?r[0]:null,item_category3:void 0!==r[1]?r[1]:null,item_category4:void 0!==r[2]?r[2]:null,item_category5:void 0!==r[3]?r[3]:null,item_list_id:(null==a?void 0:a.item_list_id)||null,item_list_name:(null==a?void 0:a.item_list_name)||null,promotion_id:(null==l?void 0:l.promotion_id)||null,promotion_name:(null==l?void 0:l.promotion_name)||null,item_position:(null==l?void 0:l.position)||null,item_section:(null==l?void 0:l.section)||null,item_creative_slot:(null==l?void 0:l.creative_slot)||null},p=localStorage.getItem("list_name"),g={item_id:o.sku,item_list_name:p,item_list_id:-1!==p.search("Coleccion")?p.slice(-4):localStorage.getItem("list_id")},h=new Set;localStorage.getItem("listItemAux")&&JSON.parse(localStorage.getItem("listItemAux")).forEach((e=>{h.add(e)})),h.add(g);const v=[...h];localStorage.setItem("listItemAux",JSON.stringify(v));const _=m("intelligent-search-history"),y=decodeURI(_.split(",")[0]),b={eventName:"add_to_cart",eventParams:{currency:e,value:s([d]),section:f(),bandera:t,search_term:y.length>1?y:null,items:[d]}};c(b)}},K=o=>{const i=document.querySelector("article#containerProduct");if(i){const o=u(i);let n=1;n=parseInt($("#controlQuantityProduct input[name='quantity']").val());const a=o.category.split("/"),r={item_id:o.sku,item_name:o.name,item_brand:o.brand,item_category:o.category,item_variant:o.variant,quantity:n,price:o.price,discount:o.onlineDiscount,affiliation:"1"===o.seller?"oechsle":o.seller,item_category1:"1"===o.seller?"oechsle":o.seller,item_category10:o.tags||"",item_category14:o.categoryId,item_category2:void 0!==a[0]?a[0]:null,item_category3:void 0!==a[1]?a[1]:null,item_category4:void 0!==a[2]?a[2]:null,item_category5:void 0!==a[3]?a[3]:null},l={eventName:"remove_from_cart",eventParams:{currency:e,value:s([r]),section:f(),bandera:t,items:[r]}};c(l)}},Y=e=>{const t=document.querySelector(".toggle-description");t.removeEventListener("click",(t=>{ee(t,e,"ver mas detalle :: "+e)})),t.addEventListener("click",(t=>{ee(t,e,"ver mas detalle :: "+e)}))},X=e=>{document.querySelectorAll("button").forEach((t=>{(t.innerText.includes("Califica este producto")||t.innerText.includes("Sea el primero en calificar este producto"))&&(t.removeEventListener("click",(t=>{ee(t,e,"calificar producto :: "+e)})),t.addEventListener("click",(t=>{ee(t,e,"calificar producto :: "+e)})))}))},ee=(e,o,i)=>{const n={eventName:"user_interaction",eventParams:{action:"click",element:i,section:f(),bandera:t}};c(n)},te=()=>{const e=window.skuJson||{};(t=>{const o=window.skuJson||{};H=i([o.productId])||[],G(),Z(e),(()=>{const e=document.querySelectorAll(".containerProductDetail #containerControlAddToCart .btnAddToCart#btnAddToCart");e&&e.forEach((e=>{e.removeEventListener("click",(e=>{W(e)})),e.addEventListener("click",(e=>{W(e)}))}));const t=document.querySelector(".containerProductDetail .skuReference");t&&((e,t)=>{if("undefined"!=typeof MutationObserver){const o=new MutationObserver((e=>{const o=e[0].target.closest("[data-latest-content]");if(o){const e=o.getAttribute("data-latest-content"),i=o.innerText;i!==e&&("function"==typeof t&&t(o,i,e),o.setAttribute("data-latest-content",i))}})),i=e=>{e.setAttribute("data-latest-content",e.innerText),o.observe(e,{attributes:!1,childList:!0,subtree:!0,characterDataOldValue:!0,characterData:!0})};e instanceof NodeList?e.forEach((e=>{i(e)})):e instanceof Node&&i(e)}})(t,Q)})(),(()=>{const e=document.querySelectorAll(".containerProductDetail #controlQuantityProduct button:first-child");e&&e.forEach((e=>{e.removeEventListener("click",(e=>{K()})),e.addEventListener("click",(e=>{K()}))}))})()})()};const oe=/^busca\.oechsle\.pe$/.test(window.location.hostname)||/^\/busca(\/)?$/.test(window.location.pathname),ie=void 0!==window.BSearch&&window.BSearch.Data&&window.BSearch.Data.Query,ne=ie?window.BSearch.Data.Query.text:"",ae="data-";let re=[],ce=0;const se=e=>{let t={id:$(e).data("product-id")||"",name:$(e).data("product-name")||"",brand:$(e).data("product-brand")||"",category:$(e).data("product-category")||"",price:parseFloat($(e).data("product-price")||"0.00").toFixed(2),variant:$(e).data("product-variant")||"",list:$(e).data("product-list")||"",position:"",sku:"",categoryId:"",listPrice:"",onlineDiscount:"",onlineDiscountPercent:"",ohPrice:"",ohDiscountPercent:"",ohDiscount:"",seller:"",tags:"",octagons:"",location:""};const o=$(e).data("product-position")||"";""!==o&&(t.position=o);const i=e.getAttribute(`${ae}sku`)||"";""!==i&&(t.sku=i);const n=$(e).data("product-category-id")||"";""!==n&&(t.categoryId=n);const a=e.getAttribute(`${ae}list-price`)||"";""!==a&&(t.listPrice=a);const r=e.getAttribute(`${ae}online-discount`)||"";""!==r&&(t.onlineDiscount=r);const c=e.getAttribute(`${ae}online-discount-percent`)||"";""!==c&&(t.onlineDiscountPercent=c);const s=e.getAttribute(`${ae}oh-price`)||"";""!==s&&(t.ohPrice=s);const l=e.getAttribute(`${ae}oh-discount`)||"";""!==l&&(t.ohDiscount=l);const d=e.getAttribute(`${ae}oh-discount-percent`)||"";""!==d&&(t.ohDiscountPercent=d);const u=$(e).data("product-seller")||"";""!==u&&(t.seller=u);const m=e.getAttribute(`${ae}tags`)||"";""!==m&&(t.tags=m);const p=e.getAttribute(`${ae}octagons`)||"";""!==p&&(t.octagons=p);const g=$(e).data("product-location")||"";return""!==g&&(t.location=g),t},le=()=>{let e="";if(oe||ie)e=`Resultados de búsqueda :: ${ne}`;else{const t=[],o=document.querySelectorAll('#breadcrumb[data-js="breadcrumb"] a[href]:not([href="/"])');if(o.length>0)for(let e=0;e{const o=oe&&ie?".biggy-search__products__list [data-product] .product":'.resultItemsWrapper .product[data-js="plp-product"]';y(`${o}:not([data-tagged="true"])`,{},(e=>{const t=()=>{const t=le().replace(/\//g," - ");((o,n)=>{if(o&&o.length>0){const n=[];o.forEach((e=>{let t=e.getAttribute("data-id");null!=t&&""!==t?n.push(t):(t=e.parentElement.getAttribute("data-product"),null!=t&&""!==t&&n.push(t))})),re=i(n)||[],((e,t)=>{e&&e.length>0&&e.forEach((e=>{const o={};o.list=t||"";let i={};if(oe&&ie){o.id=e.closest("[data-product]").getAttribute("data-product")||"";const t=(void 0!==window.BSearch&&window.BSearch.Data&&window.BSearch.Data.Products?window.BSearch.Data.Products:[]).find((e=>e.id===o.id));if(i=re.find((e=>e.id===o.id))||{},t)o.name=t.name,o.categories=t.categories.join("/"),o.category=t.categories[t.categories.length-1],o.category=t.categories.join("/"),o.categoryId=t.categoryIds[t.categoryIds.length-1],o.categoryId=t.categoryIds.join("/"),o.brand=t.brand;else{o.name="";const t=e.querySelector(".prod-name");t&&(o.name=t.innerText),o.category="",o.brand="";const i=e.querySelector(".brand");i&&(o.brand=i.innerText)}}else{o.id=e.getAttribute("data-id")||"",o.name=e.getAttribute("data-name")||"";const t=[];t.push(e.getAttribute("data-dep")||""),t.push(e.getAttribute("data-sub")||window.catNameSub||""),t.push(e.getAttribute("data-cat")||window.catName||""),o.category=t.join("/"),o.brand=e.getAttribute("data-brand")||"",i=re.find((e=>e.id===o.id))||{}}o.name=i.name||"",o.categoryId=i.categoriesIds||o.categoryId,o.category=i.categoriesNames||o.categoryName,o.price="0.00";const n=e.querySelectorAll(".BestPrice");n.length&&n.forEach((e=>{o.price=parseFloat(e.innerText.replace(/(S\/(\.)?)|\$|,|\s/g,"")||"0").toFixed(2)})),o.listPrice="0.00";const a=e.querySelectorAll(".ListPrice");a.length&&a.forEach((e=>{o.listPrice=parseFloat(e.innerText.replace(/(S\/(\.)?)|\$|,|\s/g,"")||"0").toFixed(2)})),o.listPrice="0.00"===o.listPrice?o.price:o.listPrice,o.ohPrice="0.00";const r=e.querySelectorAll(".tOhPrice");r.length&&r.forEach((e=>{o.ohPrice=parseFloat(e.innerText.replace(/(S\/(\.)?)|\$|,|\s/g,"")||"0").toFixed(2)})),o.ohPrice="0.00"===o.ohPrice?o.price:o.ohPrice,o.onlineDiscount="0.00",o.onlineDiscountPercent="0%","0.00"!==o.listPrice&&"0.00"!==o.price&&(o.onlineDiscount=parseFloat(Math.max(0,parseFloat(o.listPrice)-parseFloat(o.price)).toString()).toFixed(2),o.onlineDiscountPercent=`${Math.floor(parseFloat(o.onlineDiscount)/parseFloat(o.listPrice)*100)}%`),o.ohDiscount="0.00",o.ohDiscountPercent="0%","0.00"!==o.listPrice&&"0.00"!==o.ohPrice&&(o.ohDiscount=parseFloat(Math.max(0,parseFloat(o.listPrice)-parseFloat(o.ohPrice)).toString()).toFixed(2),o.ohDiscountPercent=`${Math.floor(parseFloat(o.ohDiscount)/parseFloat(o.listPrice)*100)}%`),o.variant="Estandar";const c=e.querySelectorAll(".skuList label");if(c.length>0){let e=null,t=c[0];c.forEach((o=>{o.matches(".checked")&&(t=o,o.matches("[for]")&&(e=document.querySelector(`.skuList input#${o.getAttribute("for")}`)))})),e||(e=t.previousElementSibling);let i="",n="";e&&(n=e.getAttribute("value").replace(/\w\S*/g,(e=>e.charAt(0).toUpperCase()+e.substring(1).toLowerCase())),e.classList.forEach((e=>{/^input-dimension-([A-Za-z-]+)$/.test(e)&&(i=e.replace(/^input-dimension-([A-Za-z-]+)$/,"$1").replace(/-/g," "))}))),""!==i&&""!==n&&(o.variant=`${i}:${n}`)}o.seller="oechsle",i.sellers.length>0&&(o.seller=(i.sellers[0].name||"").replace(/ seller/g,"").toLowerCase()),o.tags=i.tags||"",o.octagons=i.octagons||"",o.location=oe?"search page":"collection page",ce+=1,o.position=ce,g(e,o),e.setAttribute("data-tagged","true")}))})(e,t)}})(e)};y(`${o} .prod-attr .skuList`,{tries:15,delay:200},(()=>{t()}),(()=>{t()}))}),(()=>{}));const n=document.querySelectorAll(o);setTimeout((()=>{(o=>{const i=[];if(o&&o.length>0){o.forEach((e=>{const t=se(e),o=t.category.split("/");if(-1===i.indexOf(t.id)){const e={item_id:t.id,item_name:t.name,list:t.list,index:t.position,item_brand:t.brand,item_category:t.category,item_variant:t.variant,price:t.price,affiliation:"1"===t.seller?"oechsle":t.seller,item_category1:"1"===t.seller?"oechsle":t.seller,item_category10:t.tags,item_category14:t.categoryId,item_category2:void 0!==o[0]?o[0]:null,item_category3:void 0!==o[1]?o[1]:null,item_category4:void 0!==o[2]?o[2]:null,item_category5:void 0!==o[3]?o[3]:null};i.push(e)}}));const n=document.URL,a=document.URL.slice(document.URL.indexOf("H:"),document.URL.length);if(i.length>0){const o={eventName:"view_item_list",eventParams:{item_list_name:le(),item_list_id:-1!==n.search("/coleccion")?a:vtxctx.categoryId||"",section:f(),bandera:t,currency:e,items:i}};c(o)}}})(n)}),4e3),(()=>{const o=oe&&ie?".biggy-search__products__list [data-product] .product":'.resultItemsWrapper .product[data-js="plp-product"]',i=document.querySelectorAll(o);i&&i.length>0&&i.forEach((o=>{o.addEventListener("click",(function(){var i,n;const a=JSON.parse(localStorage.getItem("listItemAux"))||[],r=se(o),s=r.category.split("/"),l={item_id:r.id,item_name:r.name,list:r.list,index:r.position,item_brand:r.brand,item_category:r.category,item_variant:r.variant,price:r.price,affiliation:"1"===r.seller?"oechsle":r.seller,item_category1:"1"===r.seller?"oechsle":r.seller,item_category10:r.tags,item_category14:r.categoryId,item_category2:void 0!==s[0]?s[0]:null,item_category3:void 0!==s[1]?s[1]:null,item_category4:void 0!==s[2]?s[2]:null,item_category5:void 0!==s[3]?s[3]:null};(e=>{const t=window.location.pathname+window.location.search,o=new Set;localStorage.getItem("listItemPromotion")&&JSON.parse(localStorage.getItem("listItemPromotion")).forEach((i=>{""!==i.promotion_name&&void 0!==i.promotion_name&&(t.includes(i.promotion_id)&&!i.products.includes(e[0].item_id)&&void 0!==e[0].item_id&&""!==e[0].item_id&&i.products.push(parseInt(e[0].item_id)),o.add(i))}));const i=[...o];localStorage.setItem("listItemPromotion",JSON.stringify(i))})([l]);const d=document.URL,u=document.URL.slice(document.URL.indexOf("H:"),document.URL.length),m=(JSON.parse(localStorage.getItem("listItemPromotion"))||[]).find((e=>e.products.includes(parseInt(r.id)))),p={eventName:"select_item",eventParams:{item_list_id:-1!==d.search("/coleccion")?u:(null===(i=a.find((e=>e.item_id===r.id)))||void 0===i?void 0:i.item_list_id)||null,item_list_name:-1!==d.search("/coleccion")?le():(null===(n=a.find((e=>e.item_id===r.id)))||void 0===n?void 0:n.item_list_name)||null,promotion_id:(null==m?void 0:m.promotion_id)||null,promotion_name:(null==m?void 0:m.promotion_name)||null,section:f(),bandera:t,currency:e,items:[l]}};c(p)}))}))})()},ue=()=>{document.querySelectorAll(".item-banner").forEach((e=>{const o=e.querySelector("a"),i={eventName:"select_promotion",eventParams:{promotion_id:o.getAttribute("href"),promotion_name:e.getAttribute("data-promo-name"),creative_name:e.getAttribute("data-promo-creative"),creative_slot:"Banner PLP",position:e.getAttribute("data-promo-position"),promo_category:e.getAttribute("title"),section:f(),bandera:t}};c(i),me(o.getAttribute("href"),e.getAttribute("data-promo-name"),e.getAttribute("data-promo-position"),f(),"Banner PLP")}))},me=(e,t,o,i,n)=>{const a=new Set;let r=!1;if(localStorage.getItem("listItemPromotion")){const c=JSON.parse(localStorage.getItem("listItemPromotion"));if(c.forEach((e=>{""!==e.promotion_name&&void 0!==e.promotion_name&&(e.position||(e.position=o),e.section||(e.section=i),e.creative_slot||(e.creative_slot=n),a.add(e))})),c.forEach((e=>{""===e.promotion_name||void 0===e.promotion_name||e.promotion_name!=t||e.position!=o||(r=!0)})),!r){let r={promotion_id:e,promotion_name:t,position:o,section:i,creative_slot:n,products:[]};a.add(r)}}else{const r={promotion_id:e,promotion_name:t,position:o,section:i,creative_slot:n,products:[]};a.add(r)}const c=[...a];localStorage.setItem("listItemPromotion",JSON.stringify(c))},pe=()=>{return e=void 0,o=void 0,n=function*(){setTimeout((()=>{localStorage.removeItem("previousList"),de();const e=-1!==(o=location.href).indexOf("?")&&-1===o.search("/coleccion")?o.slice(0,o.indexOf("?")).slice(23).replaceAll("/"," :: "):-1!==o.search("/coleccion")?`Coleccion :: ${o.slice(-4)}`:o.slice(23).replaceAll("/"," :: ");var o;localStorage.setItem("list_id",vtxctx.categoryId),localStorage.setItem("list_name",e),document.querySelectorAll(".item-banner").forEach((e=>{const o=e.querySelector("a");if("#"!==o.href&&o.href!==window.location.href&&""!==o.href){e.removeEventListener("click",ue),e.addEventListener("click",ue);const o={eventName:"view_promotion",eventParams:{promotion_id:e.querySelector("a").getAttribute("href"),promotion_name:e.getAttribute("data-promo-name"),creative_name:e.getAttribute("data-promo-creative"),creative_slot:"Banner PLP",position:e.getAttribute("data-promo-position"),promo_category:e.getAttribute("title"),section:f(),bandera:t}};c(o)}}))}),3e3)},new((i=void 0)||(i=Promise))((function(t,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function c(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var o;e.done?t(e.value):(o=e.value,o instanceof i?o:new i((function(e){e(o)}))).then(r,c)}s((n=n.apply(e,o||[])).next())}));var e,o,i,n};const ge=e=>{const o=document.querySelector(".popup-home-link").getAttribute("href"),i=document.querySelector(".popup-home-image").getAttribute("src"),n=document.querySelector(".modal-content.pdp-modal").getAttribute("data-name"),a={eventName:"select_promotion",eventParams:{promotion_id:o,promotion_name:n,creative_name:i,creative_slot:"POP UP HOME",position:"Home",promo_category:null,section:f(),bandera:t}};c(a),he(o,n,"Home",f(),"POP UP HOME")},he=(e,t,o,i,n)=>{const a=new Set;let r=!1;if(localStorage.getItem("listItemPromotion")){const c=JSON.parse(localStorage.getItem("listItemPromotion"));if(c.forEach((e=>{""!==e.promotion_name&&void 0!==e.promotion_name&&(e.position||(e.position=o),e.section||(e.section=i),e.creative_slot||(e.creative_slot=n),a.add(e))})),c.forEach((e=>{""===e.promotion_name||void 0===e.promotion_name||e.promotion_name!=t||e.position!=o||(r=!0)})),!r){let r={promotion_id:e,promotion_name:t,position:o,section:i,creative_slot:n,products:[]};a.add(r)}}else{const r={promotion_id:e,promotion_name:t,position:o,section:i,creative_slot:n,products:[]};a.add(r)}const c=[...a];localStorage.setItem("listItemPromotion",JSON.stringify(c))},ve=()=>{return e=void 0,o=void 0,n=function*(){const e=document.querySelector(".modal-content.pdp-modal");e&&(e=>{const o=o=>{new IntersectionObserver(((i,n)=>{i.forEach((i=>{var a,r,s,l,d;if(i.isIntersecting){(e=>{const t=e.querySelector(".container__img");t.removeEventListener("click",ge),t.addEventListener("click",ge)})(e);const u=null!==(r=null===(a=document.querySelector(".popup-home-link"))||void 0===a?void 0:a.getAttribute("href"))&&void 0!==r?r:"",m=null!==(l=null===(s=document.querySelector(".popup-home-image"))||void 0===s?void 0:s.getAttribute("src"))&&void 0!==l?l:"",p={eventName:"view_promotion",eventParams:{promotion_id:u,promotion_name:null!==(d=o.getAttribute("data-name"))&&void 0!==d?d:"",creative_name:m,creative_slot:"POP UP HOME",position:"Home",promo_category:null,section:f(),bandera:t}};c(p),n.unobserve(i.target)}}))}),{threshold:.5}).observe(o)};if(e)o(e);else{const t=new MutationObserver(((t,i)=>{const n=e;n&&(i.disconnect(),o(n))})),i=document.getElementById("modal-overlay");i&&t.observe(i,{childList:!0,subtree:!0})}})(e)},new((i=void 0)||(i=Promise))((function(t,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function c(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var o;e.done?t(e.value):(o=e.value,o instanceof i?o:new i((function(e){e(o)}))).then(r,c)}s((n=n.apply(e,o||[])).next())}));var e,o,i,n};let _e=null,fe=null,ye=[];const be=e=>{c({eventName:"form_error",eventParams:{error_message:e,section:"login",step:"0",bandera:t}})},Ie=()=>{$.ajaxSetup({beforeSend:function(e,t){e.interceptedUrl=t.url},complete:function(e,t){/^https?:\/\/(?:oechslerd\.vtexcommercestable\.com\.br|www\.oechsle\.pe)\/api\/vtexid\/pub\/authentication\/classic\/validate$/.test(e.interceptedUrl)&&(_e=e.responseText)}})},Se=()=>{let e="";const t=[],o=document.querySelectorAll('#breadcrumb[data-js="breadcrumb"] a[href]:not([href="/"])');if(o.length>0)for(let e=0;e{if(ye=ye||[],e&&e.length>0){const o=[],i=[];let n=[],a=[];e.forEach(((r,c)=>{const s=r.getAttribute("data-alt-id")||"";if(-1===ye.indexOf(s)){if(""!==(r.getAttribute("data-product-id")||"")){const e=u(r);e.list="Promociones Home",e.position=r.getAttribute("data-alt-position")||"",e.id,e.name,e.price,e.brand,e.category,e.variant,e.list,e.position}const e=r.getAttribute("data-name")||null,o=r.getAttribute("data-alt-creative")||null,i=r.getAttribute("data-alt-position")||null,a=r.getAttribute("data-seccion")||null,c=r.getAttribute("href")||null,l=r.getAttribute("title")||null;null!==i&&n.push({promotion_id:c,promotion_name:"CINTILLO"===(null!=a?a:"").toUpperCase()?c.toUpperCase().replace("-"," ").replace("/",""):"undefined"===e?l:e,creative_name:o,creative_slot:a,position:i||o,promo_category:l||e,section:f(),bandera:t}),ye.push(s)}(20===n.length||c===e.length-1&&n.length>0)&&(o.push(n),n=[]),(20===a.length||c===e.length-1&&a.length>0)&&(i.push(a),a=[])})),o.length>0&&o[0].forEach(((e,t)=>{const o={eventName:"view_promotion",eventParams:e};setTimeout((()=>{c(o)}),200*t)}))}},we=()=>{let e="";const t=document.querySelector('script[src*="OE-home"]');if(t){e="normal";const o=t.getAttribute("src").match(/OE-home-([a-zA-Z].*)\.js/);o&&o.length>1&&(e=o[1]||"")}return e},Ae=e=>{const o=e.currentTarget;let i=!1;if(o.closest('.slick-initialized[data-swiping="true"]')&&(i=!0),!i){const e=o.getAttribute("data-name")||null,i=o.getAttribute("data-alt-creative")||null,n=o.getAttribute("data-alt-position")||null,a=o.getAttribute("data-seccion")||null,r=o.getAttribute("href")||null,s=o.getAttribute("title")||null,l={eventName:"select_promotion",eventParams:{promotion_id:r,promotion_name:"CINTILLO"===(null!=a?a:"").toUpperCase()?r.toUpperCase().replace("-"," ").replace("/",""):"undefined"===e?s:e,creative_name:i,creative_slot:a,position:n||i,promo_category:s||e,section:f(),bandera:t}};c(l),Ee(r,e,n||i,f(),a)}},ke=e=>{const o=e.currentTarget;let i=!1;if(o.closest('.slick-initialized[data-swiping="true"]')&&(i=!0),!i){const e=o.getAttribute("data-name")||"";c({eventName:"user_interaction",eventParams:{action:"click",element:`Nuevas categorias:: ${e}`,section:"home",bandera:t}})}},Ee=(e,t,o,i,n)=>{const a=new Set;let r=!1;if(localStorage.getItem("listItemPromotion")){const c=JSON.parse(localStorage.getItem("listItemPromotion"));if(c.forEach((e=>{""!==e.promotion_name&&void 0!==e.promotion_name&&(e.position||(e.position=o),e.section||(e.section=i),e.creative_slot||(e.creative_slot=n),a.add(e))})),c.forEach((e=>{""===e.promotion_name||void 0===e.promotion_name||e.promotion_name!=t||e.position!=o||(r=!0)})),!r){let r={promotion_id:e,promotion_name:t,position:o,section:i,creative_slot:n,products:[]};a.add(r)}}else{const r={promotion_id:e,promotion_name:t,position:o,section:i,creative_slot:n,products:[]};a.add(r)}const c=[...a];localStorage.setItem("listItemPromotion",JSON.stringify(c))},xe=()=>{setTimeout((()=>{(()=>{const e=document.querySelectorAll('.header__left--search input[type="text"]');e.length>0&&e.forEach((e=>{let o=null;e.addEventListener("focus",(e=>{const i=e.target;""!==h(i.getAttribute("placeholder"))&&$(i).on("keydown",(function(e){let i=[];o&&clearTimeout(o),o=setTimeout((()=>{document.querySelectorAll(".listProductSuggestions .listProductSuggestions--item").forEach((o=>{o.addEventListener("click",(function(){const o={eventName:"view_search_results",eventParams:{search_term:e.target.value.length>1?e.target.value:null,typeahead:i,bandera:t}};e.target.value.length>1&&c(o)}))}))}),3e3)}))}))}))})(),document.querySelectorAll(".subheader.marcas a").forEach((e=>{e.addEventListener("click",(function(){const o={eventName:"user_interaction",eventParams:{action:"click",element:e.textContent.toLowerCase(),section:"header",bandera:t}};c(o)}))})),document.querySelectorAll("#header .item-cart a,#header .menu__nav li.d-none.d-lg-block").forEach((e=>{e.addEventListener("click",(function(){const o={eventName:"user_interaction",eventParams:{action:"click",element:e.textContent.toLowerCase().trim(),section:"header",bandera:t}};c(o)}))})),document.querySelectorAll("#header .oe-logo.virtual-event").forEach((e=>{e.addEventListener("click",(function(){e.textContent,c({eventName:"user_interaction",eventParams:{action:"click",element:"home",section:"header",bandera:t}})}))})),document.querySelectorAll("#header .tooltips_menu .tooltips_item").forEach((e=>{e.addEventListener("click",(function(){const o=e.textContent,i={eventName:"user_interaction",eventParams:{action:"click",element:o.toLowerCase().trim(),section:"header",bandera:t}};c(i),"Iniciar Sesión"===o&&(()=>{const e=setInterval((()=>{c({eventName:"form_step",eventParams:{step:"0",section:"login",bandera:t}}),Ie();const o=document.querySelectorAll(".vtexIdUI-classic-login button.close.vtexIdUI-close");o[0]&&o[0].addEventListener("click",(function(){c({eventName:"user_interaction",eventParams:{action:"click",element:"cerrar",section:"login",bandera:t}})}));const i=document.querySelectorAll(".vtexIdUI-classic-login a.dead-link.pull-right");i.length>0&&i[0].addEventListener("click",(function(){c({eventName:"user_interaction",eventParams:{action:"click",element:"olvide mi contraseña",section:"login",bandera:t}})})),document.querySelectorAll(".vtexIdUI-classic-login a.dead-link.pull-right")[1].addEventListener("click",(function(){c({eventName:"user_interaction",eventParams:{action:"click",element:"registrarme",section:"login",bandera:t}})}));const n=document.querySelectorAll("ul.vtexIdUI-providers-list button#vtexIdUI-google-plus");n.length>0&&n[0].addEventListener("click",(function(){c({eventName:"sign_up",eventParams:{method:"google",bandera:t}})}));const a=document.querySelectorAll("ul.vtexIdUI-providers-list button#vtexIdUI-facebook");a.length>0&&a[0].addEventListener("click",(function(){c({eventName:"sign_up",eventParams:{method:"facebook",bandera:t}})})),document.querySelectorAll("ul.vtexIdUI-providers-list button#loginWithAccessKeyBtn")[0].addEventListener("click",(function(){c({eventName:"sign_up",eventParams:{method:"clave acceso rapido",bandera:t}}),document.getElementById("sendAccessKeyBtn").addEventListener("click",(function(){setTimeout((()=>{document.getElementById("confirmLoginAccessKeyBtn").addEventListener("click",(function(){c({eventName:"user_interaction",eventParams:{action:"click",element:"ingresar",section:"login",bandera:t}})}))}),2e3)}))})),document.querySelectorAll(".vtexIdUI-classic-login button.btn.btn-large.btn-success.pull-right")[0].addEventListener("click",(function(){setTimeout((()=>{const e=document.querySelectorAll("input#inputEmail")[0].value,o=document.querySelectorAll("input#inputPassword")[0].value;e?p(e)||be("El correo electrónico no es válido."):be("El campo de correo electrónico es obligatorio."),o||be("El campo de contraseña es obligatorio."),e.length>0&&o.length>0&&p(e)&&(setTimeout((function(){if(null!==_e){const e=JSON.parse(_e);if(e.authStatus.length>0&&"Success"!==e.authStatus){const o={eventName:"form_message",eventParams:{error_message:e.authStatus,section:"login",step:"0",bandera:t}};c(o)}else"Success"===e.authStatus&&c({eventName:"user_interaction",eventParams:{method:"mail",bandera:t}})}}),1e3),c({eventName:"user_interaction",eventParams:{action:"click",element:"ingresar",section:"login",bandera:t}}))}),2e3)})),document.querySelectorAll(".dead-link.pull-right")[1].addEventListener("click",(function(){const e=document.querySelector("#vtexIdUI-email-confirmation button[ng-disabled='isSendingEmailConfirmation']");e&&e.addEventListener("click",(function(){const e=document.querySelectorAll("input#inputEmail")[0].value;e?p(e)?c({eventName:"form_step",eventParams:{section:"registro",step:"0",bandera:t}}):be("El correo electrónico no es válido."):be("El campo de correo electrónico es obligatorio.")})),setTimeout((()=>{const e=document.getElementById("sendAccessKeyBtn");null==e||e.addEventListener("click",(function(){c({eventName:"form_step",eventParams:{section:"registro",step:"1",bandera:t}}),setTimeout((()=>{const e=document.getElementById("tryChangePswdBtn");null==e||e.addEventListener("click",(function(){c({eventName:"form_step",eventParams:{section:"registro",step:"2",bandera:t}}),setTimeout((()=>{const e=document.getElementById("changePswdBtn");null==e||e.addEventListener("click",(function(){setTimeout((function(){if(null!==fe&&"Success"===JSON.parse(fe).authStatus){const e={eventName:"user_interaction",eventParams:{method:"mail",timestamp:Date.now(),bandera:t}};c(e)}}),1e3)}))}),2e3)}))}),2e3)}))}),2e3)})),o.length>0&&clearInterval(e)}),2e3)})()}))})),Ie(),$.ajaxSetup({beforeSend:function(e,t){e.interceptedUrl=t.url},complete:function(e,t){/^https?:\/\/(?:oechslerd\.vtexcommercestable\.com\.br|www\.oechsle\.pe)\/api\/vtexid\/pub\/authentication\/classic\/validate$/.test(e.interceptedUrl)&&(fe=e.responseText)}}),document.querySelectorAll(".mainmenu__item").forEach((e=>{e.addEventListener("click",(e=>{const o=e.target,i=o.querySelector("a[data-menucategory]"),n=null==i?void 0:i.getAttribute("data-menucategory"),a={eventName:"user_interaction",eventParams:{action:"click",element:n?`menu :: ${n} :: ${o.textContent.toLowerCase().trim()}`:`menu :: ${o.textContent.toLowerCase().trim()}`,section:f(),bandera:t}};c(a)}))})),document.querySelectorAll(".mainmenu__categoria.departamento a").forEach((e=>{e.addEventListener("click",(e=>{const o={eventName:"user_interaction",eventParams:{action:"click",element:`menu :: ${e.target.parentNode.textContent.slice(0,-8)} :: ver todo`,section:f(),bandera:t}};c(o)}))})),document.querySelectorAll(".plp-btn-item.plp-tag.slick-slide").forEach((e=>{e.addEventListener("click",(o=>{const i=e.getAttribute("href"),n=e.getAttribute("title"),a={eventName:"user_interaction",eventParams:{action:"click",link:i,element:`btnplp :: ${Se()} :: ${n}`,section:f(),bandera:t}};c(a)}))}))}),3e3);const e=new MutationObserver(((e,t)=>{const o=document.querySelectorAll("a.gtm_promotionClick");(e=>{const t=`Home ${we().toLowerCase()}`;if(e&&e.length>0){const o=[],i=[];if(e.forEach((e=>{e.matches(".slick-slide.slick-cloned")||e.matches(".slick-slide > a + a")&&e.getAttribute("href")===e.previousElementSibling.getAttribute("href")?i.push(e):o.push(e)})),o.length>0){let e="",i=0;o.forEach((o=>{var n;const a=h(o.getAttribute("data-seccion"))||"",r=h(o.getAttribute("data-tipo")||"").toLowerCase(),c=h(o.getAttribute("data-position")||"1").toLowerCase(),s=null===(n=o.parentElement)||void 0===n?void 0:n.matches(".containerUrl__Mobile");let l=a,d="";const u=(null==o?void 0:o.closest("[data-js]"))||null;if(u){const e=u.querySelector("h2.title-category");e&&(l=h(e.innerText).toLowerCase())}const m=o.matches("a.slick-slide")?o.querySelector("img"):o.parentElement.querySelector("img.gtm_promotionView");m&&(d=m.getAttribute("src")||"",""===d||d.match(/^(http|\/\/)/)||(d=`https://oechsle.vteximg.com.br/${d.replace(/^\//g,"")}`));const p=`${l} ${r}`;e!==p?(e=p,i=1):s||(i+=1);let g=h(`${l} ${r} ${c}`,!0).replace(/\s/g,"_"),v=`${t} - ${l} - ${r} - ${c}`;const _=d;o.setAttribute("data-alt-id",g),o.setAttribute("data-alt-creative",_),o.setAttribute("data-alt-position",v),o.setAttribute("data-unique","true")}))}i.length>0&&i.forEach((e=>{const t=e.getAttribute("href").replace(/[\r\n\t]/gm,"")||"";if(e.matches(".slick-slide:not(.slick-cloned) > a + a")){const o=e.parentElement.querySelector(`[data-unique="true"][href*="${t}"]`);o&&(e.setAttribute("data-alt-id",o.getAttribute("data-alt-id")),e.setAttribute("data-alt-creative",o.getAttribute("data-alt-creative")),e.setAttribute("data-alt-position",o.getAttribute("data-alt-position")),e.setAttribute("data-cloned","true"))}else{const o=e.closest("[data-js]");if(o){const i=o.querySelector(`[data-unique="true"][href*="${t}"]`);i&&(e.setAttribute("data-alt-id",i.getAttribute("data-alt-id")),e.setAttribute("data-alt-creative",i.getAttribute("data-alt-creative")),e.setAttribute("data-alt-position",i.getAttribute("data-alt-position")),e.setAttribute("data-cloned","true"))}}}))}})(o),(e=>{if("undefined"!=typeof IntersectionObserver){const t=new IntersectionObserver(((e,t)=>{const o=[];e.forEach((e=>{if(e.isIntersecting&&!document.hidden){const i=e.target.matches(".url.gtm_promotionClick");e.target.matches('.gtm_promotionClick:not([data-viewed="true"])')&&v(e.target)&&!i&&(o.push(e.target),e.target.setAttribute("data-viewed","true"),t.unobserve(e.target))}})),o.length>0&&Pe(o)}),{threshold:[.9]});e.forEach((e=>{t.observe(e)}))}else{const t=()=>{const t=[];e.forEach((e=>{e.matches('.gtm_promotionClick:not([data-viewed="true"])')&&v(e)&&_(e)>=.9&&(t.push(e),e.setAttribute("data-viewed","true"))})),t.length>0&&Pe(t)};t(),window.addEventListener("scroll",t)}"undefined"!=typeof $&&document.querySelectorAll(".slick-initialized").forEach((e=>{const t=e=>{if(!document.hidden){const t=e.querySelectorAll('.slick-slide.slick-active a.gtm_promotionClick:not([data-viewed="true"])'),o=[];t.forEach((e=>{v(e)&&_(e)>=.9&&o.push(e)})),o.length>0&&Pe(o)}};$(e).on("afterChange",((e,o)=>{t(o.$slider[0])})),$(e).on("init",((e,o)=>{t(o.$slider[0])})),t(e)}))})(o),((e,t=!1)=>{"undefined"!=typeof $&&document.querySelectorAll(".slickinitialized").forEach((e=>{$(e).on("beforeChange",(e=>{e.currentTarget.setAttribute("data-swiping","true")})),$(e).on("afterChange",(e=>{e.currentTarget.removeAttribute("data-swiping","true")}))})),t?e.forEach((e=>{e.removeEventListener("click",ke),e.addEventListener("click",ke)})):e.forEach((e=>{e.removeEventListener("click",Ae),e.addEventListener("click",Ae)}))})(o)}));e.observe(document.body,{childList:!0,subtree:!0}),setTimeout((()=>{e.disconnect()}),6e4)};(()=>{const e=window.location.pathname,t=window.location.hostname;e.match(/\/p$/)&&te(),/\/checkout($|\/$)/.test(e)&&z(),/\/checkout\/orderPlaced/.test(e)&&w(),(e.match(/^\/busca(\/)?$/)||t.match(/^busca\./)||"/"!==e&&void 0!==window.catNameSub)&&pe(),"/"===e&&ve(),xe()})()})();