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7B,OAAOiB,WAAa0I,WACT,mBAAfC,aACTA,YAAY9J,eAGlB,EACA+J,KAAM,WACJ,IAAIC,MAAQjI,KAuCZ,GApCAnB,YAAYN,KAAK,sBAAsBoD,MAAK,SAAUC,MAAOC,IAE7D,IAEAhD,YAAYqJ,GACV,QACA,0DACA,SAAUpE,OACJhF,EAAEkB,MAAMmI,GAAG,MACbrE,MAAMsE,iBAGR,IAAIC,kBAAoBvJ,EAAEkB,MAAMsI,QAAQ,sBAIpCnG,UAFUkG,kBAAkBxI,KAAK,WAClBwI,kBAAkBxI,KAAK,iBAC3BwI,kBAAkBxI,KAAK,mBAClCiC,MAAQhD,EAAEkB,MAAMH,KAAK,mBAIzBoI,MAAMjG,kBAAkBF,MAAOuG,mBAC/BJ,MAAM5F,0BAA0BP,MAAOuG,mBAEvCJ,MAAM/B,kBAAkBpE,MAAOK,UAC/B8F,MAAMJ,eAAe1F,SAAUL,OAE/BmG,MAAMjD,mBACR,IAQyB,GAAvBiD,MAAM5I,cAAoB,CAC5B,IAAIkJ,QAAU1H,KAAK3C,SAASsK,MAAM,GAE7BD,QAAQxH,UAGXkH,MAAM7C,qBAAqBmD,SAF3BN,MAAM5C,uBAAuBkD,QAIjC,CAEAN,MAAMxI,mBACNwI,MAAM7H,mBACN6H,MAAM5H,mBACN4H,MAAMxF,sBACNwF,MAAM1F,iBACR,GA+CF3D,OAAO6J,iBAAiB,oBAAoB,KAC9B,WAARC,MACFxK,SAAS8J,MACX,G","sources":["webpack://build/../barrocaneon/assets/javascripts/variants.js"],"sourcesContent":["window.$attributes = $('[data-product-attributes]');\nwindow.variants = {\n $wrapperProduct: $(store.config.selectorWrapperProduct),\n config: {\n // pega o elemento que corresponde ao primeiro atributo\n $attr1: '',\n attr1Name: '',\n // pega o elemento que corresponde ao segundo atributo\n $attr2: '',\n attr2Name: '',\n // pega o elemento que corresponde ao terceiro atributo\n $attr3: '',\n attr3Name: '',\n // quantos atributos o produto tem para seleção\n qtdAttributes: 0,\n hasAttribute1: false,\n hasAttribute2: false,\n hasAttribute3: false,\n },\n setConfigDefault: function () {\n var _this = this;\n\n var $attr1 = $attributes.find('[data-attribute=\"1\"]:not(.hidden)');\n var $attr2 = $attributes.find('[data-attribute=\"2\"]:not(.hidden)');\n var $attr3 = $attributes.find('[data-attribute=\"3\"]:not(.hidden)');\n\n var itensAttr1 = '';\n var itensAttr2 = '';\n var itensAttr3 = '';\n\n if ($attr1.length > 0) {\n itensAttr1 = $attr1.data('items');\n itensAttr1 = itensAttr1.split(' // ');\n }\n\n if ($attr2.length > 0) {\n itensAttr2 = $attr2.data('items');\n itensAttr2 = itensAttr2.split(' // ');\n }\n\n if ($attr3.length > 0) {\n itensAttr3 = $attr3.data('items');\n itensAttr3 = itensAttr3.split(' // ');\n }\n\n $.extend(true, _this.config, {\n // pega o elemento que corresponde ao primeiro atributo\n $attr1: $attr1,\n attr1Name: $attr1.data('attribute-name'),\n itemsAttr1: itensAttr1,\n // pega o elemento que corresponde ao segundo atributo\n $attr2: $attr2,\n attr2Name: $attr2.data('attribute-name'),\n itemsAttr2: itensAttr2,\n // pega o elemento que corresponde ao terceiro atributo\n $attr3: $attr3,\n attr3Name: $attr3.data('attribute-name'),\n itemsAttr3: itensAttr3,\n });\n },\n setQtdAttributes: function () {\n // Seta quantos atributos o produto possuí para seleção\n\n var qtdAttributes = 0;\n\n var $input = $attributes.find('[data-quantidade-atributos]');\n\n var $attr1 = this.config.$attr1;\n var $attr2 = this.config.$attr2;\n var $attr3 = this.config.$attr3;\n\n // considerando que o tamanho é o primeiro atributo\n if ($attr1.length > 0) {\n qtdAttributes++;\n this.config.hasAttribute1 = true;\n }\n\n // considerando que a cor é o segundo atributo\n if ($attr2.length > 0) {\n qtdAttributes++;\n this.config.hasAttribute2 = true;\n }\n\n // considerando que o custom é o terceiro atributo\n if ($attr3.length > 0) {\n qtdAttributes++;\n this.config.hasAttribute3 = true;\n }\n\n this.config.qtdAttributes = qtdAttributes;\n },\n setDisponibility: function () {\n var _this = this;\n console.info('setDisponibility');\n // console.info(_this.config);\n\n if (_this.config.qtdAttributes > 1) {\n // Para quando há o atributo 1 e o atributo 2\n if (_this.config.hasAttribute1 && _this.config.hasAttribute2) {\n // Itera todas os tamanhos para verificar a disponibilidade\n for (var i = 0; i < _this.config.itemsAttr1.length; i++) {\n var tamanho = _this.config.itemsAttr1[i];\n var $tamanho = _this.config.$attr1.find('[data-attribute-value=\"' + tamanho + '\"]');\n var objFind = {};\n var tamanhoAvailable = false;\n objFind[_this.config.attr1Name] = tamanho;\n\n // Busca todas as variações que contém o tamanho\n var results = vnda.variants.find(objFind);\n\n // Percorre todas as variantes com o tamanho\n for (var ii = 0; ii < results.length; ii++) {\n // Verifica se alguma variação tem o tamanho\n if (results[ii].available) {\n corAvailable = true;\n }\n }\n\n $tamanho.data('available', tamanhoAvailable);\n $tamanho.attr('data-available', tamanhoAvailable);\n\n if (tamanhoAvailable) {\n $tamanho.removeClass('unavailable');\n $tamanho.addClass('available');\n } else {\n $tamanho.removeClass('available');\n $tamanho.addClass('unavailable');\n }\n }\n }\n }\n },\n toggleOptionsStyle: function (_$option) {\n /*\n Define se o estilo do atributo passado por parametro é input ou dropdown\n */\n var selecao = _$option.data('selecao');\n var styleType = _$option.data('selecao-style');\n var $optionList = _$option.find('[data-attribute-value]');\n var show = true;\n var showStatusList = [];\n\n // console.info('atributo', selecao, styleType);\n\n $optionList.each(function (index, el) {\n var value = $(el).data('attribute-value');\n\n // console.info(value, value.length);\n if (selecao != 'cor') {\n if (value.length > 4) {\n showStatusList[index] = true;\n } else {\n showStatusList[index] = false;\n }\n } else {\n if (value.indexOf('#') < 0) {\n showStatusList[index] = true;\n } else {\n showStatusList[index] = false;\n }\n }\n });\n\n if (showStatusList.indexOf(true) >= 0) {\n if (styleType == 'input') {\n show = false;\n } else if (styleType == 'dropdown') {\n show = true;\n }\n } else {\n if (styleType == 'input') {\n show = true;\n } else if (styleType == 'dropdown') {\n show = false;\n }\n }\n\n if (!show) {\n _$option.addClass('hidden');\n }\n },\n setAttributeValue: function (_value, _$attribute) {\n // console.info('setAttributeValue', _value, _$attribute);\n\n var attrName = _$attribute.data('attribute-name');\n var $input = _$attribute.find('input[data-attribute-name=\"' + attrName + '\"]');\n\n $input.val(_value);\n },\n setAttributeValueSelected: function (_value, _$attribute) {\n // console.info('setAttributeValueSelected', _value, _$attribute);\n\n var $selected = _$attribute.find('[data-selected]');\n $selected.html(_value);\n },\n markFirstOption: function () {\n var _this = this;\n\n var $attr1 = this.config.$attr1;\n var $attr2 = this.config.$attr2;\n var $attr3 = this.config.$attr3;\n\n console.log($attr1.find('[data-attribute-value][data-available=true]').first());\n console.log($attr2.find('[data-attribute-value][data-available=true]').first());\n console.log($attr3.find('[data-attribute-value][data-available=true]').first());\n\n // atributo com dropdown\n if ($attr1.find('[data-attribute-value][data-available=true]').first().length > 0) {\n $attr1.find('[data-attribute-value][data-available=true]').first().trigger('click');\n } else {\n $attr1.find('[data-attribute-value]').first().trigger('click');\n }\n\n if ($attr2.find('[data-attribute-value][data-available=true]').first().length > 0) {\n $attr2.find('[data-attribute-value][data-available=true]').first().trigger('click');\n } else {\n $attr2.find('[data-attribute-value]').first().trigger('click');\n }\n\n /*if ($attr3.find('[data-attribute-value][data-available=true]').first().length > 0) {\n $attr3.find('[data-attribute-value][data-available=true]').first().trigger('click');\n } else {\n $attr3.find('[data-attribute-value]').first().trigger('click');\n } */\n },\n checkFirstAttribute: function () {\n var attributes = variants.config.itemsAttr1;\n for (var i = 0; i < attributes.length; i++) {\n var attribute = attributes[i];\n var attrSize = $('[data-attribute-value=\"' + attribute + '\"]');\n var obj = {};\n\n obj[variants.config.attr1Name] = String(attribute);\n var results = vnda.variants.find(obj);\n var available = results.some((el) => el.available);\n\n if (available) {\n attrSize.data('available', true);\n attrSize.attr('data-available', true);\n\n attrSize.removeClass('unavailable');\n attrSize.addClass('available');\n } else {\n attrSize.data('available', false);\n attrSize.attr('data-available', false);\n\n attrSize.removeClass('available');\n attrSize.addClass('unavailable');\n }\n }\n },\n getSkuAttributes: function () {\n var _this = this;\n var objFindVariant = {};\n var objVariant;\n\n if (_this.config.hasAttribute1) {\n var nameAttr1 = _this.config.attr1Name;\n var valueAttr1 = _this.config.$attr1\n .find('input[data-attribute-name=\"' + nameAttr1 + '\"]')\n .val();\n objFindVariant[nameAttr1] = valueAttr1;\n }\n\n if (_this.config.hasAttribute2) {\n var nameAttr2 = _this.config.attr2Name;\n var valueAttr2 = _this.config.$attr2\n .find('input[data-attribute-name=\"' + nameAttr2 + '\"]')\n .val();\n objFindVariant[nameAttr2] = valueAttr2;\n }\n\n if (_this.config.hasAttribute3) {\n var nameAttr3 = _this.config.attr3Name;\n var valueAttr3 = _this.config.$attr3\n .find('input[data-attribute-name=\"' + nameAttr3 + '\"]')\n .val();\n objFindVariant[nameAttr3] = valueAttr3;\n }\n\n objVariant = vnda.variants.find(objFindVariant);\n\n console.info('objFindVariant', objFindVariant);\n console.info('objVariant', objVariant);\n\n return objVariant;\n },\n updatePrice: function (sku) {\n var elemPrice = document.querySelector('[data-section-product] [data-init-price]');\n var event = new Event('change');\n\n if (!elemPrice) return;\n elemPrice.setAttribute('data-sku', sku);\n elemPrice.dispatchEvent(event);\n\n },\n checkPersonalizationsPrice: function(){\n // Verifica por personalizações que possam alterar o preço\n const personalizations = [...document.querySelectorAll('[data-customization-price]')];\n let activePersonalizations = [];\n if (personalizations.length > 0) {\n\n activePersonalizations = personalizations.filter(item => { return item.checked });\n\n // Se tem personalização selecionada, verifica se alguma tem valor para adicionar\n if (activePersonalizations.length > 0) {\n const priceEl = document.querySelector('[data-section-product] [data-update-price]');\n const productPrice = Number(priceEl.getAttribute('data-current-price'));\n const salePrice = Number(priceEl.getAttribute('data-sale-price'))\n let customPrice = 0;\n let hasChanged = false;\n\n // Realiza a soma dos valores\n activePersonalizations.forEach(item => {\n const value = Number(item.getAttribute('data-customization-price'));\n if (value > 0) { customPrice += value }\n })\n\n // Chama atualização de valores\n variants.updatePrice(salePrice, productPrice, [], customPrice, true);\n }\n }\n },\n // COMPORTAMENTO DE QUANDO O USUÁRIO SELECIONA UM ATRIBUTO\n setResultVariants: function () {\n var _this = this;\n // busca a variante\n var objVariant = _this.getSkuAttributes();\n\n // console.info('objVariant', objVariant);\n\n if (objVariant.length > 0) {\n // seta o sku da variante que o usuário selecionou\n _this.$wrapperProduct.find('input[name=\"sku\"]').val(objVariant[0].sku);\n\n // atualiza o preço do produto conforme a variante selecionada\n _this.updatePrice(objVariant[0].sale_price, objVariant[0].price, objVariant[0].installments);\n\n if ($('[data-form-notify]').length > 0) {\n $('[data-form-notify] input[name=\"sku\"]').val(objVariant[0].sku);\n }\n\n // verifica se a variante selecionada está disponível ou não\n if (!objVariant[0].available) {\n _this.setProdutoIndisponivel(objVariant[0]);\n } else {\n _this.setProdutoDisponivel(objVariant[0]);\n }\n } else {\n _this.setProdutoIndisponivel(objVariant[0]);\n }\n\n if (objVariant.length > 0) {\n $attributes.find('[data-variant-selected]').html(objVariant[0].name);\n\n // PARA AS IMAGENS\n _this.setImagesProduct(objVariant[0].sku);\n }\n },\n setProdutoIndisponivel: function (_variant) {\n var _this = this;\n var $btnComprar = _this.$wrapperProduct.find(store.config.selectorBtnBuy);\n var textUnavailable = $btnComprar.data('text-unavailable');\n\n $btnComprar.data('available', 'false');\n $btnComprar.removeClass('available');\n $btnComprar.addClass('unavailable');\n $btnComprar.html(textUnavailable);\n\n // AVISE-ME QUANDO CHEGAR AQUI\n if (_variant) {\n _this.setFormNotify(_variant);\n }\n },\n setFormNotify: function (_variant) {\n var height = $('[data-form-notify]').find('.form-wrapper').outerHeight(true);\n\n $('[data-form-notify]').addClass('active').css('height', height);\n\n setTimeout(function () {\n $(document.body).trigger('sticky_kit:recalc');\n }, 500);\n\n if ($('[data-form-notify]').length > 0) {\n $('[data-form-notify] input[name=\"sku\"]').val(_variant.sku);\n }\n },\n checkCombinations: function (_value, _attributeName) {\n var _this = this;\n var obj = {};\n obj[_attributeName] = String(_value);\n var results = vnda.variants.find(obj);\n\n // console.info('checkCombinations', _attributeName, _value);\n // console.info('results combinations', results);\n\n // Verifica a disponibilidade das cores quando um tamanho é selecionado\n if (_this.config.attr1Name == _attributeName) {\n var cores = _this.config.itemsAttr2;\n var objFind = {};\n objFind[_attributeName] = String(_value);\n\n for (var i = 0; i < cores.length; i++) {\n objFind[_this.config.attr2Name] = String(cores[i]);\n var corTamanhoResults = vnda.variants.find(objFind);\n\n var cor = cores[i];\n var $cor = $('[data-attribute-value=\"' + cor + '\"]');\n\n console.info('corTamanhoResults', corTamanhoResults);\n\n if (corTamanhoResults.length > 0) {\n var available = corTamanhoResults.some((el) => el.available);\n\n $cor.removeClass('disable');\n\n if (available) {\n $cor.data('available', true);\n $cor.attr('data-available', true);\n\n $cor.removeClass('unavailable');\n $cor.addClass('available');\n } else {\n $cor.data('available', false);\n $cor.attr('data-available', false);\n\n $cor.removeClass('available');\n $cor.addClass('unavailable');\n }\n } else {\n $cor.addClass('disable');\n }\n }\n }\n\n // verifica a disponibilidade do terceiro atributo quando o segundo é selecionado\n else if (_this.config.attr2Name == _attributeName) {\n var itemsAttr3 = _this.config.itemsAttr3;\n var objFind = {};\n objFind[_this.config.attr1Name] = String(\n $(`[name=\"attribute-${_this.config.attr1Name}\"]:checked`).val()\n );\n objFind[_this.config.attr2Name] = String(_value);\n\n // console.log('objFind', objFind)\n\n for (var i = 0; i < itemsAttr3.length; i++) {\n objFind[_this.config.attr3Name] = String(itemsAttr3[i]);\n var AllAttrResults = vnda.variants.find(objFind);\n\n var selected = itemsAttr3[i];\n var $attr3El = $('[data-attribute-value=\"' + selected + '\"]');\n\n // console.info('AllAttrResults', AllAttrResults);\n\n if (AllAttrResults.length > 0) {\n var variantResult = AllAttrResults[0];\n\n $attr3El.removeClass('disable');\n\n if (variantResult.available) {\n $attr3El.data('available', true);\n $attr3El.attr('data-available', true);\n\n $attr3El.removeClass('unavailable');\n $attr3El.addClass('available');\n } else {\n $attr3El.data('available', false);\n $attr3El.attr('data-available', false);\n\n $attr3El.removeClass('available');\n $attr3El.addClass('unavailable');\n }\n } else {\n $attr3El.addClass('disable');\n }\n }\n }\n },\n setProdutoDisponivel: function () {\n var _this = this;\n var $btnComprar = _this.$wrapperProduct.find(store.config.selectorBtnBuy);\n var textAvailable = $btnComprar.data('text-available');\n\n $btnComprar.data('available', 'true');\n $btnComprar.removeClass('unavailable');\n $btnComprar.addClass('available');\n $btnComprar.html(textAvailable);\n\n $('[data-form-notify]').removeClass('active').css('height', 0);\n },\n /* \n Exibe as imagens que contém o sku passado por parâmetro\n */\n setImagesProduct: function (_sku) {\n var $images = template_store.product.$wrapperImages;\n var $mainImages = template_store.product.$sliderProduct;\n var $thumbsImages = template_store.product.$thumbsProduct;\n var slideProduct = template_store.product.sliderProduct[0];\n var slideThumbs = template_store.product.sliderProduct[1];\n var qtdImagesSku = $mainImages.find('[data-skus-image*=\"' + _sku + ',\"]').length;\n var $imagesWithoutSkus = $mainImages.find('.image-without-sku');\n var $thumbsWithoutSkus = $thumbsImages.find('.image-without-sku');\n\n console.info($mainImages.find('[data-skus-image*=\"' + _sku + ',\"]'));\n console.info('[data-skus-image*=\"' + _sku + '\"]');\n\n if (qtdImagesSku > 0) {\n // Esconde as imagens que não contém o sku\n $mainImages.find('[data-image][data-skus-image]').removeClass('active').addClass('inactive');\n\n $thumbsImages\n .find('[data-image-thumb][data-skus-image]')\n .removeClass('active')\n .addClass('inactive');\n\n // Mostra as imagens que contém o sku\n $mainImages\n .find('[data-image][data-skus-image*=\"' + _sku + ',\"]')\n .addClass('active')\n .removeClass('inactive');\n\n $thumbsImages\n .find('[data-image-thumb][data-skus-image*=\"' + _sku + ',\"]')\n .addClass('active')\n .removeClass('inactive');\n\n // As imagens sem skus selecionados são exibidas sempre\n $imagesWithoutSkus.removeClass('inactive').addClass('active');\n\n $thumbsWithoutSkus.removeClass('inactive').addClass('active');\n\n // $(document.body).trigger(\"sticky_kit:recalc\");\n // console.log(slideProduct);\n slideProduct.update();\n slideThumbs.update();\n slideProduct.slideTo(0);\n } else {\n $mainImages.find('[data-image][data-skus-image]').removeClass('active').addClass('inactive');\n\n $thumbsImages\n .find('[data-image-thumb][data-skus-image]')\n .removeClass('active')\n .addClass('inactive');\n\n $imagesWithoutSkus.removeClass('inactive').addClass('active');\n\n $thumbsWithoutSkus.removeClass('inactive').addClass('active');\n }\n },\n execActionAttr: function (_attrName, _valueSelected) {\n var _this = this;\n\n if (_this.config.attr1Name == _attrName) {\n if (typeof attr1Action == 'function') {\n attr1Action(_valueSelected);\n }\n } else if (_this.config.attr2Name == _attrName) {\n if (typeof attr2Action == 'function') {\n attr2Action(_valueSelected);\n }\n } else if (_this.config.attr3Name == _attrName) {\n if (typeof attr3Action == 'function') {\n attr3Action(_valueSelected);\n }\n }\n },\n init: function () {\n var _this = this;\n\n // DEFINE SE O QUE VAI APARECER É A OPÇÃO EM INPUT RADIO OU O DROPDOWN\n $attributes.find('[data-prod-option]').each(function (index, el) {\n // _this.toggleOptionsStyle($(el));\n });\n\n $attributes.on(\n 'click',\n '[data-prod-option]:not(.hidden) [data-attribute-value]',\n function (event) {\n if ($(this).is('a')) {\n event.preventDefault();\n }\n\n var $wrapperAttribute = $(this).closest('[data-prod-option]');\n\n var selecao = $wrapperAttribute.data('selecao');\n var selecaoStyle = $wrapperAttribute.data('selecao-style');\n var attrName = $wrapperAttribute.data('attribute-name');\n var value = $(this).data('attribute-value');\n\n // console.info('selecao value', selecao, attrName, value);\n\n _this.setAttributeValue(value, $wrapperAttribute);\n _this.setAttributeValueSelected(value, $wrapperAttribute);\n\n _this.checkCombinations(value, attrName);\n _this.execActionAttr(attrName, value);\n\n _this.setResultVariants();\n }\n );\n\n // const personalizations = document.querySelectorAll('[data-customization-price]');\n // if (personalizations.length > 0) personalizations.forEach(item => {\n // item.addEventListener('change', _this.checkPersonalizationsPrice)\n // })\n\n if (_this.qtdAttributes == 0) {\n var variant = vnda.variants.all()[0];\n\n if (!variant.available) {\n _this.setProdutoIndisponivel(variant);\n } else {\n _this.setProdutoDisponivel(variant);\n }\n }\n\n _this.setConfigDefault();\n _this.setQtdAttributes();\n _this.setDisponibility();\n _this.checkFirstAttribute();\n _this.markFirstOption();\n },\n};\n\nfunction attr1Action(_valueSelected) {\n var $attr1 = variants.config.$attr1;\n var $attr2 = variants.config.$attr2;\n var $attr3 = variants.config.$attr3;\n\n // console.log($attr1.find('[data-attribute-value][data-available=true]').first());\n // console.log($attr2.find('[data-attribute-value][data-available=true]').first());\n // console.log($attr3.find('[data-attribute-value][data-available=true]').first());\n\n if ($attr2.find('[data-attribute-value][data-available=true]:not(.disable)').first().length > 0) {\n //console.log('THIS', $attr2.find('[data-attribute-value][data-available=true]:not(.disable)').first())\n $attr2\n .find('[data-attribute-value][data-available=true]:not(.disable)')\n .first()\n .trigger('click');\n } else if ($attr2.find('[data-attribute-value][data-available=true]').first().length > 0) {\n $attr2.find('[data-attribute-value][data-available=true]').first().trigger('click');\n } else {\n $attr2.find('[data-attribute-value]').first().trigger('click');\n }\n}\n\nfunction attr2Action(_valueSelected) {\n var $attr1 = variants.config.$attr1;\n var $attr2 = variants.config.$attr2;\n var $attr3 = variants.config.$attr3;\n\n // console.log($attr1.find('[data-attribute-value][data-available=true]').first());\n // console.log($attr2.find('[data-attribute-value][data-available=true]').first());\n // console.log($attr3.find('[data-attribute-value][data-available=true]').first());\n\n if ($attr3.find('[data-attribute-value][data-available=true]:not(.disable)').first().length > 0) {\n //console.log('THIS', $attr3.find('[data-attribute-value][data-available=true]:not(.disable)').first())\n $attr3\n .find('[data-attribute-value][data-available=true]:not(.disable)')\n .first()\n .trigger('click');\n } else if ($attr3.find('[data-attribute-value][data-available=true]').first().length > 0) {\n $attr3.find('[data-attribute-value][data-available=true]').first().trigger('click');\n } else {\n $attr3.find('[data-attribute-value]').first().trigger('click');\n }\n}\n\nwindow.addEventListener('DOMContentLoaded', () => {\n if (page == 'product') {\n variants.init();\n }\n});\n"],"names":["attr1Action","_valueSelected","variants","config","$attr1","$attr2","$attr3","find","first","length","trigger","attr2Action","window","$attributes","$","$wrapperProduct","store","selectorWrapperProduct","attr1Name","attr2Name","attr3Name","qtdAttributes","hasAttribute1","hasAttribute2","hasAttribute3","setConfigDefault","itensAttr1","itensAttr2","itensAttr3","data","split","extend","this","itemsAttr1","itemsAttr2","itemsAttr3","setQtdAttributes","setDisponibility","console","info","i","tamanho","$tamanho","objFind","results","vnda","ii","available","corAvailable","attr","removeClass","addClass","toggleOptionsStyle","_$option","selecao","styleType","$optionList","show","showStatusList","each","index","el","value","indexOf","setAttributeValue","_value","_$attribute","attrName","val","setAttributeValueSelected","html","markFirstOption","log","checkFirstAttribute","attributes","attribute","attrSize","obj","String","some","getSkuAttributes","objVariant","objFindVariant","nameAttr1","valueAttr1","nameAttr2","valueAttr2","nameAttr3","valueAttr3","updatePrice","sku","elemPrice","document","querySelector","event","Event","setAttribute","dispatchEvent","checkPersonalizationsPrice","personalizations","querySelectorAll","activePersonalizations","filter","item","checked","priceEl","productPrice","Number","getAttribute","salePrice","customPrice","forEach","setResultVariants","sale_price","price","installments","setProdutoDisponivel","setProdutoIndisponivel","name","setImagesProduct","_variant","$btnComprar","selectorBtnBuy","textUnavailable","setFormNotify","height","outerHeight","css","setTimeout","body","checkCombinations","_attributeName","cores","corTamanhoResults","cor","$cor","AllAttrResults","selected","$attr3El","variantResult","textAvailable","_sku","template_store","product","$wrapperImages","$mainImages","$sliderProduct","$thumbsImages","$thumbsProduct","slideProduct","sliderProduct","slideThumbs","qtdImagesSku","$imagesWithoutSkus","$thumbsWithoutSkus","update","slideTo","execActionAttr","_attrName","attr3Action","init","_this","on","is","preventDefault","$wrapperAttribute","closest","variant","all","addEventListener","page"],"sourceRoot":""}