//# sourceMappingURL=utils.js.map
var FrontUtils=function(){return{getUrlParam:function(a){a=a.split("&");for(var b={},c=0;c<a.length;c++){var d=a[c].split("="),e=decodeURIComponent(d[0]),d=decodeURIComponent(d[1]);"undefined"===typeof b[e]?b[e]=decodeURIComponent(d):"string"===typeof b[e]?(d=[b[e],decodeURIComponent(d)],b[e]=d):b[e].push(decodeURIComponent(d))}return b},removeUrlParam:function(a){var b=new URL(window.location.href);b.searchParams.delete(a);window.history.replaceState({},document.title,b.toString())},processBatch:function(a,
b){for(var c,d=+new Date,e=a.slice(0),f=this,g=[];d+100>=+new Date;){c=e.shift();if(!c)return g;g.push(b(c))}setTimeout(function(){f.processBatch(a,b)},10)},isArray:function(a){return"undefined"===typeof Array.isArray?"[object Array]"===Object.prototype.toString.call(a):Array.isArray(a)},isElementInViewport:function(a){"function"===typeof jQuery&&a instanceof jQuery&&(a=a[0]);a=a.getBoundingClientRect();return 0<=a.top&&0<=a.left&&a.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&
a.right<=(window.innerWidth||document.documentElement.clientWidth)},isElementCloseOfTheViewport:function(a){"function"===typeof jQuery&&a instanceof jQuery&&(a=a[0]);a=a.getBoundingClientRect();if(0===a.top&&0===a.left&&0===a.bottom&&0===a.right)return!1;var b=1.5;"true"===$("#isMobile").val()&&(b=2);return 0<=a.top&&0<=a.left&&a.bottom<=(window.innerHeight||document.documentElement.clientHeight)+document.documentElement.clientHeight/1.5&&a.right<=(window.innerWidth||document.documentElement.clientWidth)*
b},mergeObjects:function(a,b){a=a||{};b=b||{};var c={},d;for(d in a)c[d]=a[d];for(d in b)c[d]=b[d];return c},getHeight:function(a){var b=/^\d+(px)?$/i;if(window.getComputedStyle)a=parseFloat(getComputedStyle(a,null).height.replace("px",""));else{var c=a.currentStyle.height;if(b.test(c))a=parseInt(c);else{var b=a.style.left,d=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;a.style.left=c||0;c=a.style.pixelLeft;a.style.left=b;a.runtimeStyle.left=d;a=c}}return a},setHeight:function(a,b){"function"===
typeof b&&(b=b());a.style.height="string"===typeof b?b:b+"px"}}},onlyNumbers=function(a,b){return a=b?"-":""+a.replace(/(^-{1})|(\d)|(\D)/g,"$1$2")},formatDateInternational=function(a){a=a.split("/");if(!a.length)return!1;var b="20"+a.pop(),c=a.pop();return b+"/"+c+"/"+(a.length?a[0]:"01")},_hasOwnProperty=Object.prototype.hasOwnProperty,isEmptyObject=function(a){if(null==a||void 0==a||0==a)return!0;for(var b in a)if(_hasOwnProperty.call(a,b))return!1;return!0},MESSAGES_TO_USER={creditcard:"N\u00famero de cart\u00e3o inv\u00e1lido.",
expiration:"Data de expira\u00e7\u00e3o inv\u00e1lida.",cpf:"Este n\u00famero de CPF n\u00e3o \u00e9 v\u00e1lido."},messageValidation=function(a){if(a=a||null)return MESSAGES_TO_USER[a.toLowerCase()]||"Campo inv\u00e1lido"},validationFields=function(a){if(isEmptyObject(a))return{status:"error",fieldName:null,msg:"nenhum campo para validar"};var b=ValidateData(),c;for(c in a){var d=a[c];if(d.required&&!d.value)return{status:"error",fieldName:c,msg:"Campo Obrig\u00e1torio"};if(d.validationRules&&d.validationRules.length&&
(b.setData(d.value),!b[d.validationRules[0]]()))return{status:"error",fieldName:c,msg:messageValidation(d.validationRules[0])}}return{status:"success"}};String.prototype.toCamelCase=function(){return this.replace(/^([A-Z])|[\s-_]+(\w)/g,function(a,b,c,d){return c?c.toUpperCase():b.toLowerCase()})};
String.prototype.toSlug=function(){str=this;str=str.replace(/^\s+|\s+$/g,"");str=str.toLowerCase();for(var a=0;28>a;a++)str=str.replace(new RegExp("\u00e0\u00e1\u00e4\u00e2\u00e8\u00e9\u00eb\u00ea\u00ec\u00ed\u00ef\u00ee\u00f2\u00f3\u00f6\u00f4\u00f9\u00fa\u00fc\u00fb\u00f1\u00e7\u00b7/_,:;".charAt(a),"g"),"aaaaeeeeiiiioooouuuunc------".charAt(a));return str=str.replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-")};
String.prototype.toNumber=function(){var a=parseFloat(this.replace("R$ ","").replace(".","").replace(".","").replace(",",".")).toFixed(2);return parseFloat(a)};String.prototype.toClean=function(){var a;return a=this.replace(/[^A-z\u00c0-\u00fa0-9-,\.\s]|[\[\]`\\]|\.{2,}/gi," ")};
var ValidateData=function(){return{_data:"",getData:function(){return this._data},setData:function(a){this._data=a},CPF:function(){this.setData(onlyNumbers(this._data,!1));return this._cpfRule()},CNPJ:function(){this.setData(onlyNumbers(this._data,!1));return this._cnpjRule()},CREDITCARD:function(){this.setData(onlyNumbers(this._data,!1));return this._credidCardRule()},GETBRAND:function(){this.setData(onlyNumbers(this._data,!1));return this._brandCardRule()},EXPIRATION:function(){this.setData(formatDateInternational(this._data));
return this._expirationRule()},MONTH:function(){this.setData(this.getData());return this._monthRule()},DATEVALID:function(){this.set=this.getData;return this._dateValidRule()},_cpfRule:function(){var a=this.getData();if(11!=a.length)return!1;var b;b=0;if("00000000000"==a)return!1;for(i=1;9>=i;i++)b+=parseInt(a.substring(i-1,i))*(11-i);b=10*b%11;if(10==b||11==b)b=0;if(b!=parseInt(a.substring(9,10)))return!1;b=0;for(i=1;10>=i;i++)b+=parseInt(a.substring(i-1,i))*(12-i);b=10*b%11;if(10==b||11==b)b=0;
return b!=parseInt(a.substring(10,11))?!1:!0},_cnpjRule:function(){var a=this.getData(),a=a.replace(/[^\d]+/g,"");if(""==a||14!=a.length||"00000000000000"==a||"11111111111111"==a||"22222222222222"==a||"33333333333333"==a||"44444444444444"==a||"55555555555555"==a||"66666666666666"==a||"77777777777777"==a||"88888888888888"==a||"99999999999999"==a)return!1;var b=a.length-2,c=a.substring(0,b),d=a.substring(b),e=0,f=b-7;for(i=b;1<=i;i--)e+=c.charAt(b-i)*f--,2>f&&(f=9);if((2>e%11?0:11-e%11)!=d.charAt(0))return!1;
b+=1;c=a.substring(0,b);e=0;f=b-7;for(i=b;1<=i;i--)e+=c.charAt(b-i)*f--,2>f&&(f=9);return(2>e%11?0:11-e%11)!=d.charAt(1)?!1:!0},_credidCardRule:function(){return 13<=this.getData().length},_brandCardRule:function(){var a="",b=/^4/;null!=this.getData().match(b)&&(a="Visa");/^(5[1-5][0-9]{14}|2(22[1-9][0-9]{12}|2[3-9][0-9]{13}|[3-6][0-9]{14}|7[0-1][0-9]{13}|720[0-9]{12}))$/.test(this._data)&&(a="MasterCard");b=/^3(?:0[0-5]|[68][0-96011437910711850])/;null!=this.getData().match(b)&&(a="Diners");b=/^3[47]/;
null!=this.getData().match(b)&&(a="American Express");b=/^401178|^401179|^431274|^438935|^451416|^457393|^457631|^457632|^504175|^627780|^636297|^636368|^(506699|5067[0-6]\d|50677[0-8])|^(50900\d|5090[1-9]\d|509[1-9]\d{2})|^65003[1-3]|^(65003[5-9]|65004\d|65005[0-1])|^(65040[5-9]|6504[1-3]\d)|^(65048[5-9]|65049\d|6505[0-2]\d|65053     [0-8])|^(65054[1-9]|6505[5-8]\d|65059[0-8])|^(65070\d|65071[0-8])|^65072[0-7]|^(65090[1-9]|65091\d|650920)|^(65165[2-9]|6516[6-7]\d)|^(65500\d|65501\d)|^(65502[1-9]|6550[3-4]\d|65505[0-8])/;
null!=this.getData().match(b)&&(a="Elo");b=/^(6011|622(12[6-9]|1[3-9][0-9]|[2-8][0-9]{2}|9[0-1][0-9]|92[0-5]|64[4-9])|65)/;null!=this.getData().match(b)&&(a="Discover");b=/^3841[046]0|^606282/;null!=this.getData().match(b)&&(a="Hipercard");b=/^637095|^637612|^637599|^637609|^637568/;null!=this.getData().match(b)&&(a="Hiper");return a},_monthRule:function(){var a=0,a=this.getData(),a=7>=a.length?a.split("/")[0]:a.split("/")[1];return 1<=a&&12>=a},_expirationRule:function(){var a=this.getData();if(!a)return!1;
var a=new Date(a),b=new Date,c=a.getFullYear(),d=a.getMonth(),e=(new Date(b.getFullYear(),b.getMonth()+1,0)).getDate(),f=b.getFullYear(),g=b.getMonth(),h=b.getDay();return c>f||c==f&&(a.getMonth()>b.getMonth()||d==g&&e>=h)?!0:!1},_dateValidRule:function(){var a=this.getData(),b=a.substring(0,2),c=a.substring(3,5),a=a.substring(6,10),d=new Date(a,c-1,b),b=parseInt(b,10)==parseInt(d.getDate()),c=parseInt(c,10)==parseInt(d.getMonth()+1),a=parseInt(a)==parseInt(d.getFullYear());return b&&c&&a}}},NormalizeData=
function(){return{_data:"",dataMasked:function(){return this._data},newData:function(a){this._data=a},CREDITCARD:function(){this.newData=onlyNumbers(this._data);16<=this.dataMasked().length&&(this.newData=this.dataMasked().slice(0,16));this._creditCardNumberRule();return this.dataMasked()},CPF:function(){this.newData=onlyNumbers(this._data);11<=this.dataMasked().length&&(this.newData=this.dataMasked().slice(0,11));this._cpfMaskRule();return this.dataMasked()},CNPJ:function(){this.newData=onlyNumbers(this._data);
14<=this.dataMasked().length&&(this.newData=this.dataMasked().slice(0,14));this._cnpjMaskRule();return this.dataMasked()},DATEFORMAT:function(){this.newData=onlyNumbers(this._data);8<=this.dataMasked().length&&(this.newData=this.dataMasked().slice(0,8));this._dateFormatRule();return this.dataMasked()},_creditCardNumberRule:function(){var a=this.dataMasked(),a=a.replace(/(\d{4})/g,"$1 ");this.newData=a=a.replace(/\s$/,"")},_cpfMaskRule:function(){if(isNaN(this._data))return console.warn("NormalizeData.CPF() precisa ser um n\u00famero"),
!1;var a=this.dataMasked(),a=a.replace(/^(\d{3})(\d)/,"$1.$2"),a=a.replace(/^(\d{3})\.(\d{3})(\d)/,"$1.$2.$3");this.newData=a=a.replace(/(\.\d{3})(\d{2})$/,"$1-$2")},_cnpjMaskRule:function(){if(isNaN(this._data))return console.warn("Normalize.CNPJ() precisa ser um n\u00famero"),!1;var a=this.dataMasked(),a=a.replace(/^(\d{2})(\d{3})(\d{3})(\d{4})/,"$1.$2.$3/$4");this.newData=a=a.replace(/(\/\d{4})(\d{2})$/,"$1-$2")},_dateFormatRule:function(){if(isNaN(this._data))return console.warn("NormalizeData.PHONE() precisa ser um n\u00famero"),
!1;var a=this.dataMasked(),a=a.replace(/^(\d{2})(\d)/g,"$1/$2");this.newData=a=a.replace(/(\d)(\d{4})$/,"$1/$2")}}};
function authWithCredentialsAjax(a,b,c){return $.ajax({type:"POST",url:"/j_spring_security_check_oauth?"+function(a){var b=[],c;for(c in a)b.push(encodeURIComponent(c)+"="+encodeURIComponent(a[c]));return b.join("&")}({targetUri:"/",j_username:a,j_password:b,j_mfa:c}),headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8",Accept:"application/json, text/javascript, */*; q=0.01","X-Requested-With":"XMLHttpRequest"},async:!1,data:{},success:function(a){return!0},error:function(a){console.log("Error in ajax auth");
console.log(a);return!1}}).responseJSON}function getCookieFromBrowser(a){a+="=";for(var b=decodeURIComponent(document.cookie).split(";"),c=0;c<b.length;c++){for(var d=b[c];" "==d.charAt(0);)d=d.substring(1);if(0==d.indexOf(a))return d.substring(a.length,d.length)}return""}function getCookieSession(){return getAjaxBackendUserInfo("/login/ajaxSessionId")}function getTokenSession(){return getAjaxBackendUserInfo("/login/ajaxSessionToken")}
function getIsAttendant(){return getAjaxBackendUserInfo("/login/ajaxAttendantInfo")}function getAjaxBackendUserInfo(a){return $.ajax({type:"GET",url:a,async:!1,success:function(a){return a}}).responseText}function clickToggleMobileMenu(){return 0<$(".nav-button-icon").length?($(".nav-button-icon").click(),!0):!1}
function selectItemEvent(a,b,c){var d="";c&&(c=a.closest(".skus-carousel"),null!==c&&(d=c.getAttribute("data-name")));c={};c=a.querySelectorAll(".produto-preco");if(null===c||0===c.length)if(a.classList.contains("y-product"))c=a;else{console.log("Error getting information for select_item event");return}else c=c[0];a={item_id:c.getAttribute("data-sku-id"),item_name:c.getAttribute("data-sku-name"),item_brand:c.getAttribute("data-sku-brand"),item_category:c.getAttribute("data-sku-category"),item_category2:c.getAttribute("data-sku-category2"),
item_category3:c.getAttribute("data-sku-category3"),quantity:1,item_list_id:""!=d?d:c.getAttribute("data-name"),item_list_name:""!=d?d:c.getAttribute("data-name")};var e=null,f=$("[data-template-done][data-sku-id="+b+"]");null!==f&&0<f.length&&(e=getPriceByProductElement(f[0]));null!==e&&""!==e?a.price=parseFloat(e):(e=$("#priceSkuId-"+b).val(),null!==e&&""!==e&&(a.price=parseFloat(e)));""!==$("#isGoogleAnalytics").val()&&gtag("event","select_item",{item_list_id:""!=d?d:c.getAttribute("data-name"),
item_list_name:""!=d?d:c.getAttribute("data-name"),items:[a]})}function getPriceByProductElement(a){for(var b=null,c=0;c<a.children.length;c++)if("offers"===a.children[c].getAttribute("itemprop")){b=a.children[c];break}if(null!==b)for(a=0;a<b.children.length;a++)if("price"===b.children[a].getAttribute("itemprop"))return b.children[a].content;return null}function handleDatalayer(a,b,c,d){selectItemEvent(a,b,c);sendKinesisDataAjax(d)}
function copySkuPartnerPartCodeTag(a){var b=document.getElementById("partnerPartCodeMain-"+a).textContent.match(/Interno\s(\d+)/),b=b?b[1]:null,c=document.createElement("input");c.style="position: absolute; left: -1000px; top: -1000px";c.value=b;document.body.appendChild(c);c.select();document.execCommand("copy");document.body.removeChild(c);$("#textCopyInternalCode-"+a).css("display","flex").attr("style","display: flex !important;");$("#copyInterlCode-"+a).hide();setTimeout(function(){$("#textCopyInternalCode-"+
a).hide();$("#copyInterlCode-"+a).show()},3E3)}
function sendKinesisDataAjax(a){"removeCart"===a.actionID&&a.actionObj?sendGA(a):"addCart"===a.actionID&&sendAddDatalayer(a);var b=new Date,c=JSON.parse(localStorage.getItem("LOCATION_CDP_USER"));if(c)var d=c.zipcode,e=c.state,f=c.city,g=$.cookie("session-id");return $.ajax({type:"POST",url:"/sendKinesisData",data:{session:g,actionID:a.actionID,actionData:a.actionData,dateTime:b.getTime(),locationZipcode:a.locationZipcode?a.locationZipcode:d,locationState:a.locationState?a.locationState:e,locationCity:a.locationCity?
a.locationCity:f},success:function(a){return!0},error:function(a){return!1}}).responseJSON}
function selectSkuGrid(a){var b=a.options[a.selectedIndex].getAttribute("data-grid-card"),c=JSON.parse(a.options[a.selectedIndex].value),d="",d=$("#baseUrl");a=$(a).parent().parent();d&&(c.skuNameSecondary&&!c.gridSkuRoot?(a.parent().parent().parent().find("#image-sku-"+c.skuId).attr("src",d.val()+"/"+c.skuImgPath.replace("full","m")+c.skuImgName),d="/p/"+c.skuIDSecondary+"/"+c.skuSourceSecondary,a.parent().find("#price-template-"+c.skuId).html(priceBuild(a,c.skuId,c.skuIDSecondary,d,c.skuNameSecondary,
b?null:"secundary"))):(a.parent().parent().parent().find("#image-sku-"+c.id).attr("src",c.imageSet.baseUrl+"/m"+c.imageSet.paths[0]),d="/p/"+c.id+"/"+c.nameSource,a.parent().find("#price-template-"+c.id).html(priceBuild(a,c.id,c.id,d,c.nameSimple,b?null:"secundary"))),loadSkuPrice(c.skuId))}function parseBrazilFormattedDate(a){a=a.split("/");return 3>a.length?null:new Date(parseInt(a[2]),parseInt(a[1])-1,parseInt(a[0]))}
function priceBuild(a,b,c,d,e,f){a.find("#produto-nome-"+b).text(e);a.parent().parent().parent().parent().find("#link-sku-image-"+b).attr("href",d);a.find("#link-sku-name-"+b).attr("href",d);a.find("#btn-others-"+b).attr("href",d);a='<div class="produto-preco" id=sku-price-'+b+' data-template="search-price-template" data-sku-id='+c+" data-sku-link="+d+" data-sku-link-login="+d+' data-sku-origin="search" data-grid-card='+f+' name="'+e+'"><span class="imageLoading"></span></div>';"true"===$("#isPriceV2").val()&&
setPriceCalculateIntervalIfNotExists();return a}
function sendDatalayer(a){if(void 0!=a.actionObj){var b=JSON.parse(a.actionObj);if("undefined"!==typeof dataLayerManager&&window.dataLayer){var c=void 0!=b.defaultPrice?Number(parseFloat(b.defaultPrice.replace("R$ ","").replace(".","").replace(",",".")).toFixed(2)):0,d,e;"removeCart"==a.actionID?(d=b.totalDecimal.value,e=b.realQuantity):(e=1,d=void 0!=b.saleDecimal?b.saleDecimal.value:0);dataLayerManager.pushGeneric({eventName:a.actionEvent,event:a.actionEvent,currency:"BRL",value:d,item:{item_id:b.productId.toString(),
item_name:b.name,affiliation:b.sellerName,currency:"BRL",index:1,item_list_id:"shopping_cart_items",item_list_name:"Cart Items",discount:Math.abs(b.discountedValue),item_brand:b.brand,item_category:null!=b.category?b.category:"",item_category2:null!=b.category2?b.category2:"",item_category3:null!=b.category3?b.category3:"",price:c,sellPrice:b.saleDecimal.value,quantity:e}})}}}
function sendAddDatalayer(a){if(void 0!=a.actionObj){var b=JSON.parse(a.actionObj);if(gtag){var c=void 0!=a.price?Number(parseFloat(a.price).toFixed(2)):0,d=void 0!=a.originPrice?Number(parseFloat(a.originPrice).toFixed(2)):0;gtag("event",a.actionEvent,{eventName:a.actionEvent,event:a.actionEvent,currency:"BRL",value:Number(parseFloat(c*a.quantity).toFixed(2)),items:{item_id:b.id.toString(),item_name:b.name,affiliation:a.sellerName,currency:"BRL",discount:Math.abs(c-d),item_brand:b.brand?b.brand.name:
"",item_category:b.category1?null!=b.category1.displayName?b.category1.displayName:"":"",item_category2:b.category2?null!=b.category2.displayName?b.category2.displayName:"":"",item_category3:b.category3?null!=b.category3.displayName?b.category3.displayName:"":"",price:c,sellPrice:d,quantity:a.quantity}})}}}
function sendGA(a){if(document.getElementById("googleAnalytics").value&&void 0!=a.actionObj){var b=JSON.parse(a.actionObj);if("undefined"!==typeof dataLayerManager&&window.dataLayer){var c=void 0!=b.defaultPrice?Number(parseFloat(b.defaultPrice.replace("R$ ","").replace(".","").replace(",",".")).toFixed(2)):0,d,e;"removeCart"==a.actionID?(d=b.totalDecimal.value,e=b.realQuantity):(e=1,d=void 0!=b.saleDecimal?b.saleDecimal.value:0);gtag("event",a.actionEvent,{eventName:a.actionEvent,event:a.actionEvent,
currency:"BRL",value:d,items:{item_id:b.productId.toString(),item_name:b.name,affiliation:b.sellerName,currency:"BRL",discount:Math.abs(b.discountedValue),item_brand:b.brand,item_category:null!=b.category?b.category:"",item_category2:null!=b.category2?b.category2:"",item_category3:null!=b.category3?b.category3:"",price:c,index:1,sellPrice:b.saleDecimal.value,quantity:e,item_list_id:"shopping_cart_items",item_list_name:"Cart Items"}})}}}
function sendAddToFavoritesDatalayer(a,b,c,d){b&&(checkIfIsFavoriteRemove(a)||gtag("event","add_to_wishlist",{currency:"BRL",value:getPriceByElementId(c),items:[d]}))}function checkIfIsFavoriteRemove(a){for(var b=0;b<a.children.length;b++){var c=a.children[b];if(c)for(var d=0;d<c.classList.length;d++)if("fa-heart"===c.classList[d])return!0}return!1}
function getPriceByElementId(a){var b=document.getElementById(a);return b?"skuBestPrice"===a?parseFloat(b.value):(a=b.querySelectorAll('[itemprop="price"]'))&&0!==a.length?parseFloat(a[0].content):null:null}function deleteCookiesWithPrefix(a){for(var b=document.cookie.split(";"),c=0;c<b.length;c++){for(var d=b[c];" "===d.charAt(0);)d=d.substring(1);0===d.indexOf(a)&&(d=d.split("=")[0],document.cookie=d+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;")}}
function getCropSelected(){return localStorage.getItem("cropSelected")};