(function(){var a,b,c=function(a,b){return function(){return a.apply(b,arguments)}},d=[].slice;b=window||exports,b.EVENT_HISTORY||(b.EVENT_HISTORY={}),a=function(){function a(){this.generateSelectors=c(this.generateSelectors,this),this.triggerProductEvent=c(this.triggerProductEvent,this),this.bindProductEvent=c(this.bindProductEvent,this)}return a.prototype.bindProductEvent=function(a,b,c){var e,f,g,h,i,j;if(null==c&&(c=0),e=function(a,b,e){var f;return $(window).on(a,function(){var a,f,g;return f=arguments[0],a=2<=arguments.length?d.call(arguments,1):[],g=a[c],e===g?b.apply(null,[f].concat(d.call(a))):void 0}),null!=(null!=(f=EVENT_HISTORY[e])?f[a]:void 0)?b.apply(null,EVENT_HISTORY[e][a]):void 0},this.options.multipleProductIds){for(i=this.productId,j=[],g=0,h=i.length;h>g;g++)f=i[g],j.push(e(a,b,f));return j}return e(a,b,this.productId)},a.prototype.triggerProductEvent=function(){var a,b,c,e,f,g;return f=arguments[0],a=2<=arguments.length?d.call(arguments,1):[],c=this.element||$window,e=jQuery.Event(f),b=[this.productId].concat(d.call(a)),c.trigger(e,b),EVENT_HISTORY[g=this.productId]||(EVENT_HISTORY[g]={}),EVENT_HISTORY[this.productId][f]=[e].concat(d.call(b))},a.prototype.generateSelectors=function(a){var b,c,d=this;for(b in a)c=a[b],"function"==typeof c?this["find"+b]=c:this["find"+b]=function(a){return function(){return d.element.find(a)}}(c),this["findFirst"+b]=function(a){return function(){return $(d["find"+a]()[0])}}(b),this["show"+b]=function(a){return function(){return d["find"+a]().show()}}(b),this["hide"+b]=function(a){return function(){return d["find"+a]().hide()}}(b);return this.showAll=function(a){return function(){var e;e=[];for(b in a)c=a[b],e.push(d["show"+b]());return e}}(a),this.hideAll=function(a){return function(){var e;e=[];for(b in a)c=a[b],e.push(d["hide"+b]());return e}}(a)},a}(),b.ProductComponent=a}).call(this),function(){function a(a,c){return a.write('
Selecione a variação do produto
').reference(c._get(!1,["name"]),c,"h").write('
').reference(c._get(!1,[
').section(c._get(!1,["dimensions"]),c,{block:b},null).write('

Para ser avisado da disponibilidade deste Produto, basta preencher os campos abaixo.

')}function b(a,b){return a.write('")}function c(a,b){return a.write('")}function d(a,b){return a.write('")}function e(a,b){return a.write('').section(b._get(!1,["values"]),b,{block:f},null).write("")}function f(a,b){return a.write('")}return dust.register("sku-selector-modal",a),a}(),function(){function a(a,c){return a.section(c._get(!1,["dimensions"]),c,{block:b},null)}function b(a,b){return a.write('")}function c(a,b){return a.write('")}function d(a,b){return a.write('")}function e(a,b){return a.write('').section(b._get(!1,["values"]),b,{block:f},null).write("")}function f(a,b){return a.write('")}return dust.register("sku-selector-product",a),a}(),function(){var a,b,c=function(a,b){return function(){return a.apply(b,arguments)}},d={}.hasOwnProperty,e=function(a,b){function c(){this.constructor=a}for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};a=window.jQuery,_.extend(dust.filters,{sanitize:function(a){return _.sanitize(a)},spacesToHyphens:function(a){return _.spacesToHyphens(a)}}),b=function(b){function d(b,d,e){var f,g,h,i,j,k,l,m,n,o,p,q,r,s=this;for(this.element=b,this.productData=d,this.options=e,this.showWarnUnavailable=c(this.showWarnUnavailable,this),this.showPriceRange=c(this.showPriceRange,this),this.showPrice=c(this.showPrice,this),this.showConfirmButton=c(this.showConfirmButton,this),this.showBuyButton=c(this.showBuyButton,this),this.hideWarnUnavailable=c(this.hideWarnUnavailable,this),this.hidePriceRange=c(this.hidePriceRange,this),this.hidePrice=c(this.hidePrice,this),this.hideConfirmButton=c(this.hideConfirmButton,this),this.hideBuyButton=c(this.hideBuyButton,this),this.buyIfNoVariations=c(this.buyIfNoVariations,this),this.findPrices=c(this.findPrices,this),this.warnUnavailableSubmitHandler=c(this.warnUnavailableSubmitHandler,this),this.buyButtonHandler=c(this.buyButtonHandler,this),this.hideAllNM=c(this.hideAllNM,this),this.disableUnavailableValue=c(this.disableUnavailableValue,this),this.disableInvalidValue=c(this.disableInvalidValue,this),this.selectValue=c(this.selectValue,this),this.resetDimension=c(this.resetDimension,this),this.skuMatches=c(this.skuMatches,this),this.findSelectionStatus=c(this.findSelectionStatus,this),this.selectDimensionValue=c(this.selectDimensionValue,this),this.selectSku=c(this.selectSku,this),this.selectSkuHandler=c(this.selectSkuHandler,this),this.skuObjectFromId=c(this.skuObjectFromId,this),this.setSelectedDimension=c(this.setSelectedDimension,this),this.getSelectedDimension=c(this.getSelectedDimension,this),this.findUndefinedDimensions=c(this.findUndefinedDimensions,this),this.getDimensionByName=c(this.getDimensionByName,this),this.searchDimensions=c(this.searchDimensions,this),this.findSelectedSku=c(this.findSelectedSku,this),this.findSelectableSkus=c(this.findSelectableSkus,this),this.isSkuSelectable=c(this.isSkuSelectable,this),this.dimensionChangeHandler=c(this.dimensionChangeHandler,this),this.bindEvents=c(this.bindEvents,this),this.render=c(this.render,this),this.isSelectedInexistent=c(this.isSelectedInexistent,this),this.update=c(this.update,this),this.init=c(this.init,this),this.productId=this.productData.productId,this.name=this.productData.name,this.salesChannel=this.productData.salesChannel,this.skus=this.productData.skus,this.image=this.skus[0].image,h=0,this.dimensions=function(){var a,b,c,d,e,f;for(c=this.productData.dimensions,f=[],a=0,b=c.length;b>a;a++)g=c[a],f.push({index:h++,name:g,values:this.productData.dimensionsMap[g],selected:void 0,inputType:this.options.forceInputType?this.options.forceInputType:(null!=(d=this.productData.dimensionsInputType)&&null!=(e=d[g])?e.toLowerCase():void 0)||"radio"});return f}.call(this),p=this.dimensions,j=0,m=p.length;m>j;j++)f=p[j],f.isRadio="radio"===f.inputType;for(q=this.dimensions,k=0,n=q.length;n>k;k++)f=q[k],f.isCombo="combo"===f.inputType;for(r=this.skus,l=0,o=r.length;o>l;l++)i=r[l],i.values=function(){var a,b,c,d;for(c=this.dimensions,d=[],a=0,b=c.length;b>a;a++)f=c[a],d.push(i.dimensions[f.name]);return d}.call(this);this.generateSelectors({listPriceValue:".skuselector-list-price .value",bestPriceValue:".skuselector-best-price .value",installment:".skuselector-installment",buyButton:".skuselector-buy-btn",confirmButton:".skuselector-confirm-btn",price:".skuselector-price",priceRange:".skuselector-price-range",warning:".skuselector-warning",warnUnavailable:".skuselector-warn-unavailable",NMTitle:".notifyme-title",NMForm:"form",NMSkuId:".notifyme-skuid",NMLoading:".notifyme-loading",NMSuccess:".notifyme-success",NMError:".notifyme-error",inputs:function(){return a("input, select",s.element)},itemDimension:function(b){return a(".item-dimension-"+_.sanitize(b),s.element)},itemDimensionInput:function(a){return s.finditemDimension(a).find("input")},itemDimensionLabel:function(a){return s.finditemDimension(a).find("label")},itemDimensionSelect:function(a){return s.finditemDimension(a).find("select")},itemDimensionOption:function(a){return s.finditemDimension(a).find("option")},itemDimensionValueInput:function(a,b){return s.finditemDimension(a).find("input[value='"+b+"']")},itemDimensionValueLabel:function(a,b){return s.finditemDimension(a).find("label.skuespec_"+_.sanitize(b))},itemDimensionValueOption:function(a,b){return s.finditemDimension(a).find("option[value='"+b+"']")}}),this.history={},this.init()}return e(d,b),d.prototype.init=function(){var a,b,c,d,e,f,g,h,i;if(this.update(),this.options.selectOnOpening)for(g=this.skus,c=0,e=g.length;e>c;c++)if(b=g[c],b.available){this.selectSku(b);break}if(this.render(),this.bindEvents(),1===this.skus.length&&this.selectSku(this.skus[0]),this.options.selectSingleDimensionsOnOpening){for(h=this.dimensions,i=[],d=0,f=h.length;f>d;d++)a=h[d],i.push(1===a.values.length?this.selectDimensionValue(a.name,a.values[0]):void 0);return i}},d.prototype.update=function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;for(f=-1,g=-1,v=this.dimensions,e=n=0,r=v.length;r>n;e=++n)d=v[e],d.name===a&&(d.selected=b,f=e);for(w=this.dimensions,e=o=w.length-1;o>=0&&(d=w[e],f!==e);e=o+=-1)l=this.findSelectionStatus(function(){var a,b,d,e;for(d=this.dimensions,e=[],a=0,b=d.length;b>a;a++)c=d[a],e.push(c.selected);return e}.call(this)),"invalid"===l&&(d.selected=null);for(x=this.dimensions,e=p=x.length-1;p>=0;e=p+=-1)if(d=x[e],null!==d.selected&&void 0!==d.selected){g=e;break}for(h=function(){var a,b,d,e;for(d=this.dimensions,e=[],a=0,b=d.length;b>a;a++)c=d[a],e.push(c.selected);return e}.call(this),y=this.dimensions,e=q=0,s=y.length;s>q;e=++q){if(d=y[e],this.resetDimension(d),e>=g)for(z=d.values,u=0,t=z.length;t>u;u++)switch(m=z[u],k=h.slice(0),k[e]=m,this.findSelectionStatus(k)){case"invalid":this.disableInvalidValue(d,m);break;case"unavailable":this.disableUnavailableValue(d,m)}this.selectValue(d)}if(i=this.findSelectableSkus(),this.triggerProductEvent("vtex.sku.dimensionChanged",a,b),this.triggerProductEvent("skuDimensionChanged.vtex",a,b),1===i.length?(this.triggerProductEvent("skuSelected",i[0]),this.triggerProductEvent("vtex.sku.selected",i[0]),this.triggerProductEvent("skuSelected.vtex",i[0])):(this.triggerProductEvent("vtex.sku.unselected",i),this.triggerProductEvent("skuUnselected.vtex",i),i.length>1&&(this.triggerProductEvent("vtex.sku.selectable",i),this.triggerProductEvent("skuSelectable.vtex",i))),this.hideConfirmButton(),this.hideAllNM(),this.hidePriceRange(),this.hidePrice(),1===i.length){if(j=i[0],j.available)return this.showBuyButton(j),this.showPrice(j);if(this.hideBuyButton(),this.options.warnUnavailable)switch(this.showNMTitle(),this.history[j.sku]){case"success":return this.showNMSuccess();default:return this.findNMSkuId().val(j.sku),this.showNMForm()}}else if(i.length>1&&this.options.showPriceRange)return this.showPriceRange(this.findPrices(i))},d.prototype.isSelectedInexistent=function(){return 0===this.findSelectableSkus().length},d.prototype.render=function(){var a,b=this;return a=this.options.modalLayout?"sku-selector-modal":"sku-selector-product",dust.render(a,this,function(a,c){if(a)throw new Error("Sku Selector Dust error: "+a);return b.element.html(c),b.update(),b.showBuyButton(),b.buyIfNoVariations(),b.element.trigger("vtex.sku.ready"),b.element.trigger("skuReady.vtex")})},d.prototype.bindEvents=function(){return this.findinputs().on("change",this.dimensionChangeHandler),this.bindProductEvent("skuSelect.vtex",this.selectSkuHandler),this.findbuyButton().on("click",this.buyButtonHandler),this.options.warnUnavailable?this.findwarnUnavailable().find("form").on("submit",this.warnUnavailableSubmitHandler):void 0},d.prototype.dimensionChangeHandler=function(b){var c,d,e;return c=a(b.target),d=c.data("dimension"),e=""===c.val()?void 0:c.val(),this.update(d,e)},d.prototype.isSkuSelectable=function(a){var b,c,d,e;for(e=this.dimensions,c=0,d=e.length;d>c;c++)if(b=e[c],void 0!==b.selected&&b.selected!==a.dimensions[b.name])return!1;return!0},d.prototype.findSelectableSkus=function(){var a,b,c,d,e;for(d=this.skus,e=[],b=0,c=d.length;c>b;b++)a=d[b],this.isSkuSelectable(a)&&e.push(a);return e},d.prototype.findSelectedSku=function(){var a;return a=this.findSelectableSkus(),1===a.length?a[0]:null},d.prototype.searchDimensions=function(b){return null==b&&(b=function(){return!0}),a.grep(this.dimensions,b)},d.prototype.getDimensionByName=function(a){return this.searchDimensions(function(b){return b.name===a})[0]},d.prototype.findUndefinedDimensions=function(){return this.searchDimensions(function(a){return!a.selected})},d.prototype.getSelectedDimension=function(a){return this.getDimensionByName(a).selected},d.prototype.setSelectedDimension=function(a,b){return this.getDimensionByName(a).selected=b},d.prototype.skuObjectFromId=function(a){var b,c,d,e;for(e=this.skus,c=0,d=e.length;d>c;c++)if(b=e[c],+b.sku===+a)return b},d.prototype.selectSkuHandler=function(a,b,c){return(c===+c||c===c+"")&&(c=this.skuObjectFromId(+c)),this.selectSku(c)},d.prototype.selectSku=function(a){var b,c,d,e;for(e=this.dimensions,c=0,d=e.length;d>c;c++)b=e[c],this.selectDimensionValue(b.name,a.dimensions[b.name]);return this.triggerProductEvent("vtex.sku.selected",a),this.triggerProductEvent("skuSelected.vtex",a)},d.prototype.selectDimensionValue=function(a,b){return this.finditemDimensionValueInput(a,b).prop("checked",!0).trigger("change"),this.finditemDimensionSelect(a).val(b).trigger("change")},d.prototype.findSelectionStatus=function(a){var b,c,d,e,f;for(b=!1,f=this.skus,d=0,e=f.length;e>d;d++)if(c=f[d],this.skuMatches(c,a)){if(c.available)return"ok";b=!0}return b?"unavailable":"invalid"},d.prototype.skuMatches=function(a,b){var c,d,e,f,g;for(g=a.values,c=e=0,f=g.length;f>e;c=++e)if(d=g[c],void 0!==b[c]&&null!==b[c]&&b[c]!==d)return!1;return!0},d.prototype.resetDimension=function(a){return this.finditemDimensionInput(a.name).removeAttr("checked").removeAttr("disabled").removeClass("item_unavaliable sku-picked checked item_unavailable item_doesnt_exist combination_unavaliable"),this.finditemDimensionLabel(a.name).removeClass("item_unavaliable sku-picked checked item_unavailable disabled item_doesnt_exist combination_unavaliable"),this.finditemDimensionOption(a.name).removeClass("item_unavaliable sku-picked checked item_unavailable disabled item_doesnt_exist combination_unavaliable").removeAttr("disabled").removeAttr("selected")},d.prototype.selectValue=function(a){var b;return b=a.selected,null===b||void 0===b?(this.finditemDimensionInput(a.name).removeAttr("checked"),this.finditemDimensionOption(a.name).removeAttr("selected"),this.finditemDimensionValueOption(a.name,"").attr("selected","selected")):(this.finditemDimensionValueInput(a.name,b).attr("checked","checked").addClass("checked sku-picked"),this.finditemDimensionValueLabel(a.name,b).addClass("checked sku-picked"),this.finditemDimensionValueOption(a.name,b).attr("selected","selected").addClass("checked sku-picked"))},d.prototype.disableInvalidValue=function(a,b){return this.finditemDimensionValueInput(a.name,b).addClass("item_doesnt_exist combination_unavaliable").attr("disabled","disabled"),this.finditemDimensionValueLabel(a.name,b).addClass("item_doesnt_exist combination_unavaliable"),this.finditemDimensionValueOption(a.name,b).addClass("item_doesnt_exist combination_unavaliable").attr("disabled","disabled")},d.prototype.disableUnavailableValue=function(a,b){return this.finditemDimensionValueInput(a.name,b).addClass("item_unavaliable item_unavailable"),this.finditemDimensionValueLabel(a.name,b).addClass("item_unavaliable item_unavailable disabled"),this.finditemDimensionValueOption(a.name,b).addClass("item_unavaliable item_unavailable disabled")},d.prototype.hideAllNM=function(){return this.hideNMTitle(),this.hideNMForm(),this.hideNMLoading(),this.hideNMSuccess(),this.hideNMError()},d.prototype.buyButtonHandler=function(b){var c,d=this;return c=this.findSelectedSku(),c?this.options.confirmBuy?(b.preventDefault(),this.showConfirmButton(c)):(a(window).trigger("modalHide.vtex"),a.get(a.skuSelector.getAddUrlForSku(c.sku,c.sellerId,1,this.productData.salesChannel,!1)).done(function(b){return a(window).trigger("productAddedToCart"),a(window).trigger("cartProductAdded.vtex")}).fail(function(b,e){return window.location.href=a.skuSelector.getAddUrlForSku(c.sku,c.sellerId,1,d.productData.salesChannel)}),!1):(this.findwarning().show().text("Por favor, escolha: "+this.findUndefinedDimensions()[0].name),!1)},d.prototype.warnUnavailableSubmitHandler=function(b){var c,d,e=this;return c=this.findSelectedSku(),b.preventDefault(),this.showNMLoading(),this.hideNMForm(),d=a.post("/no-cache/AviseMe.aspx",a(b.target).serialize()),d.done(function(){return e.showNMSuccess(),e.history[c.sku]="success"}),d.fail(function(){return e.showNMError(),e.history[c.sku]="fail"}),d.always(function(){return e.hideNMLoading()}),!1},d.prototype.findPrices=function(b){var c;return null==b&&(b=void 0),b||(b=this.findSelectableSkus()),b=function(){var a,d,e;for(e=[],a=0,d=b.length;d>a;a++)c=b[a],c.available&&e.push(c);return e}(),a.map(b,function(a){return a.bestPrice}).sort(function(a,b){return parseInt(a)-parseInt(b)})},d.prototype.buyIfNoVariations=function(){var a=this;return this.skus.length<2&&this.options.modalLayout?setTimeout(function(){return a.findbuyButton().click()},1):void 0},d.prototype.hideBuyButton=function(){return this.findbuyButton().attr("href","javascript:void(0);").hide()},d.prototype.hideConfirmButton=function(){return this.findconfirmButton().attr("href","javascript:void(0);").hide()},d.prototype.hidePrice=function(){return this.findprice().hide()},d.prototype.hidePriceRange=function(){return this.findpriceRange().hide()},d.prototype.hideWarnUnavailable=function(){return this.findwarning().hide(),this.findwarnUnavailable().filter(":visible").hide()},d.prototype.showBuyButton=function(b){return this.findbuyButton().show().parent().show(),b?this.findbuyButton().attr("href",a.skuSelector.getAddUrlForSku(b.sku,b.sellerId,1,this.salesChannel,this.options.redirect)):void 0},d.prototype.showConfirmButton=function(b){var c;return c=a.map(b.dimensions,function(a,b){return a}).join(", "),this.findconfirmButton().attr("href",a.skuSelector.getAddUrlForSku(b.sku,b.sellerId,1,this.salesChannel,this.options.redirect)).show().find(".skuselector-confirm-dimensions").text(c)},d.prototype.showPrice=function(a){var b,c,d,e;return e=_.formatCurrency(a.listPrice/100),b=_.formatCurrency(a.bestPrice/100),d=a.installments,c=_.formatCurrency(a.installmentsValue/100),this.findlistPriceValue().text("R$ "+e),this.findbestPriceValue().text("R$ "+b),d>1&&this.findinstallment().text("ou até "+d+"x de R$ "+c),this.findprice().show()},d.prototype.showPriceRange=function(a){var b,c,d;return b=this.findpriceRange().show(),d=_.formatCurrency(a[0]/100),c=_.formatCurrency(a[a.length-1]/100),b.find(".lowPrice").text(" R$ "+d+" "),b.find(".highPrice").text(" R$ "+c+" ")},d.prototype.showWarnUnavailable=function(a){return this.findwarnUnavailable().show().find("input.sku-notifyme-skuid").val(a)},d}(ProductComponent),a.fn.skuSelector=function(c,d){var e,f,g,h,i,j,k;for(null==d&&(d={}),f=a.extend(!0,{},a.fn.skuSelector.defaults),j=0,k=this.length;k>j;j++)h=this[j],e=a(h),e.addClass("sku-selector-loading"),g=e.data(),i=a.extend(!0,f,g,d),e.data("skuSelector")||e.data("skuSelector",new b(e,c,i)),e.removeClass("sku-selector-loading");return this},a.fn.skuSelector.defaults={modalLayout:!1,warnUnavailable:!1,selectOnOpening:!1,selectSingleDimensionsOnOpening:!0,confirmBuy:!1,showPriceRange:!1,forceInputType:null},a.skuSelector={getAddUrlForSku:function(a,b,c,d,e){return null==b&&(b=1),null==c&&(c=1),null==d&&(d=1),null==e&&(e=!0),"/checkout/cart/add?qty="+c+"&seller="+b+"&sku="+a+"&sc="+d+"&redirect="+e}},a(document).ready(function(){var b;return(b=_.urlParams().idsku)?a(window).trigger("skuSelect.vtex",[skuJson.productId,b]):void 0}),a(document).on("skuSelected.vtex",function(a,b,c){return"function"==typeof window.FireSkuChangeImage&&window.FireSkuChangeImage(c.sku),"function"==typeof window.FireSkuSelectionChanged?window.FireSkuSelectionChanged(c.sku):void 0}),a(document).on("skuSelectable.vtex",function(a,b,c){return"function"==typeof window.FireSkuChangeImage?window.FireSkuChangeImage(c[0].sku):void 0})}.call(this);