!function e(t,n,r){function s(a,o){if(!n[a]){if(!t[a]){var u="function"==typeof require&&require;if(!o&&u)return u(a,!0);if(i)return i(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[a]={exports:{}};t[a][0].call(l.exports,function(e){var n=t[a][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;av)return void s(e,t,n,u)}e.resolve(n)}function s(e,t,n,r){var s=Math.ceil(r/v),i=f.range(1,s),o=[];f.each(i,function(e){var n=v*e,r=n+v;t.headers["REST-Range"]="resources="+n+"-"+r,o.push(a(t))}),$.when.apply($,o).then(function(){1===o.length?(n=f.union(n,f.first(arguments)),e.resolve(n)):(f.each(arguments,function(e){n=f.union(n,f.first(e))}),e.resolve(n))}).fail(e.reject)}function i(t,n,r){var s=$.extend({},e[t]);return s?(n&&$.each(n,function(e,n){var r=s.url.indexOf(e)!==-1;return r?void(s.url=s.url.replace("{{"+e+"}}",n)):void console.error("Attribute "+e+" not found on resource "+t)}),r&&($.each(r,function(e,n){s.data.hasOwnProperty(e)||console.warn("Attribute "+e+" not exist on resource "+t),s.data[e]=n}),$.each(s.data,function(e,n){void 0===n&&console.warn("Attribute "+e+" not defined on resource "+t)})),s):void console.error("Resource ID "+t+" not found!")}function a(e){return e.dataType="json",e.accepts="application/vnd.vtex.ds.v10+json",e.data&&(e.contentType="application/json",e.data=JSON.stringify(e.data)),$.ajax(e)}return{fetchResource:n,renderResources:t}}var p={ModuleHandlersStack:t,validModuleConfiguration:r,renderTemplate:n,GenericSelector:l,ResourceHandler:d},f=e("underscore"),m=e("jsrender"),v=15;return p}()},{jsrender:12,underscore:13}],2:[function(e,t,n){t.exports={ratingAttribute:"data-rating",accountName:"blind",masterDataAcronymAssessment:"PA",ratingScale:5,displayAssessmentContainerID:"meanAssessmentContainer",meanAssessmentContainerClass:"meanAssessment",assessmentTextContainerClass:"meanAssessmentText",assessmentTextPluralization:{zero:"Sin calificaciones",one:"Una calificación",many:"calificaciones"},activationHandler:"Anchor_Jump",anchorName:"assessment",productShowcaseDisplayAssessmentContainer:"meanAssessment",productContainer:"product-vitrine",productIDAttribute:"data-idproduct",assessmentRegisterContainerID:"registerAssessment",masterDataAcronymSuggestedAnswers:"SA",suggestedAnswersContainerClass:"suggestedAnswers",answerContainerClass:"answer",assessmentFormId:"assessmentForm",userInputName:"userName",userInputErrorText:"Ingrese su nombre",userInputErrorClassContainer:"userNameError",emailInputName:"userEmail",emailInputErrorText:"Ingrese su correo",emailInputFormatErrorText:"El correo debe ser en formato ejemplo@correo.com",emailInputErrorClassContainer:"userEmailError",descriptionInputName:"description",descriptionInputErrorText:"Ingrese su opinión de este producto",descriptionInputErrorClassContainer:"descriptionError",assessmentInputContainerClass:"assessmentInput",registerUserSubmitName:"submitAssessment",formMessagesContainerClass:"messages",assessmentExistWithEmail:"Ya existe una valoración con el correo ingresado",assessmentRegisterSuccessfulText:"Su valoración ha sido registrada con éxito",assessmentRegisterFailureText:"Hubo un error al guardar su valoración, por favor inténtelo más tarde",assessmentsListContainerID:"assessmentsList",requireApprovedAssessment:!0}},{}],3:[function(e,t,n){t.exports={module:"productAssessment",attributesList:[{name:"ratingAttribute",type:"string",validations:["required"]},{name:"accountName",type:"string",validations:["required"]},{name:"masterDataAcronymAssessment",type:"string",validations:["required"]},{name:"ratingScale",type:"number",validations:["required"]},{name:"displayAssessmentContainerID",type:"string",validations:["required","idName"]},{name:"meanAssessmentContainerClass",type:"string",validations:["required","className"]},{name:"assessmentTextContainerClass",type:"string",validations:["required","className"]},{name:"assessmentTextPluralization",type:"object",validations:["required"]},{name:"activationHandler",type:"string",validations:["required"]},{name:"anchorName",type:"string",validations:["required","nameAttribute"]},{name:"productShowcaseDisplayAssessmentContainer",type:"string",validations:["required","className"]},{name:"productContainer",type:"string",validations:["required","className"]},{name:"productIDAttribute",type:"string",validations:["required"]},{name:"assessmentRegisterContainerID",type:"string",validations:["required","idName"]},{name:"masterDataAcronymSuggestedAnswers",type:"string",validations:["required"]},{name:"suggestedAnswersContainerClass",type:"string",validations:["required","className"]},{name:"answerContainerClass",type:"string",validations:["required","className"]},{name:"suggestedAnswersContainerClass",type:"string",validations:["required","className"]},{name:"assessmentFormId",type:"string",validations:["required","idName"]},{name:"userInputName",type:"string",validations:["required","nameAttribute"]},{name:"userInputErrorClassContainer",type:"string",validations:["required","className"]},{name:"emailInputName",type:"string",validations:["required","nameAttribute"]},{name:"userInputErrorText",type:"string",validations:["required"]},{name:"emailInputErrorText",type:"string",validations:["required"]},{name:"emailInputFormatErrorText",type:"string",validations:["required"]},{name:"emailInputErrorClassContainer",type:"string",validations:["required","className"]},{name:"descriptionInputName",type:"string",validations:["required","nameAttribute"]},{name:"descriptionInputErrorText",type:"string",validations:["required"]},{name:"descriptionInputErrorClassContainer",type:"string",validations:["required","className"]},{name:"assessmentInputContainerClass",type:"string",validations:["required","className"]},{name:"registerUserSubmitName",type:"string",validations:["required","nameAttribute"]},{name:"formMessagesContainerClass",type:"string",validations:["required","className"]},{name:"assessmentExistWithEmail",type:"string",validations:["required"]},{name:"assessmentRegisterSuccessfulText",type:"string",validations:["required"]},{name:"assessmentRegisterFailureText",type:"string",validations:["required"]},{name:"assessmentsListContainerID",type:"string",validations:["required","idName"]},{name:"requireApprovedAssessment",type:"boolean",validations:[]}]}},{}],4:[function(e,t,n){t.exports=function(){"use strict";function t(){$(document).on("Product:Render",function(e,t){g.registerHandler(s,[t])})}function n(){d=p.getConfiguration(),r(),g.applyHandlers()}function r(){if(window.skuJson){var e=skuJson.productId,t=function(e){var t=f.getSelector("meanAssessmentContainerSelector");i(e,t),u(t)},n=function(e){console.log(e)};p.getAssessmentsByProductID(e,t,n)}}function s(e){var t=e.productId,n=function(t){var n=$("."+d.productContainer).filter("["+d.productIDAttribute+"='"+e.productId+"']");return n.length?void n.each(function(){var e=$(this);if(!e.hasClass("productAssessment")){var n=e.find("."+d.productShowcaseDisplayAssessmentContainer);i(t,n),e.addClass("productAssessment")}}):void console.error("Unable to find container for product "+e.productId)},r=function(e){console.log(e)};p.getAssessmentsByProductID(t,n,r)}function i(e,t){h=e;var n=e.length,r=0;if(n>0){var s=0;v.each(e,function(e){s+=e.assessment}),r=s/n}else r=-1;t.empty();var i=p.generateRatingSelectorInput();i.appendTo(t),t.find("select").barrating({theme:"fontawesome-stars-o",readonly:!0,initialRating:r}),a(n,t)}function a(e,t){var n=t.is(f.getSelector("meanAssessmentContainerSelector"));if(n){var r="",s=f.getSelector("assessmentTextContainerSelector");switch(e){case 0:r=d.assessmentTextPluralization.zero;break;case 1:r=d.assessmentTextPluralization.one;break;default:r=d.assessmentTextPluralization.many}s.html(e+" "+r)}}function o(e){var t=f.getSelector("meanAssessmentContainerSelector");e.assessment=Number(e.assessment),h.push(e),i(h,t)}function u(e){var t;switch(d.activationHandler){case"None":break;case"Anchor_Jump":t=c;break;default:console.warn("Unrecognized activation handler '"+d.activationHandler+"', assuming 'None'"),t=v.identity}e.click(t)}function c(){event.preventDefault(),$("html, body").animate({scrollTop:$('[name="'+d.anchorName+'"]').offset().top},500)}var l={};l.init=n,l.updateMeanAssessment=o,l.attachListeners=t;var d,p=e("../service/productAssessment.service.js"),f=e("../service/templates.service.js"),m=e("../../../../global/modulesUtils.js"),v=e("underscore"),g=new m.ModuleHandlersStack,h=[];return l}()},{"../../../../global/modulesUtils.js":1,"../service/productAssessment.service.js":8,"../service/templates.service.js":9,underscore:13}],5:[function(e,t,n){t.exports=function(){"use strict";function t(){v=y.getConfiguration(),n(),o(),d()}function n(){var e={};e.errorPlacement=r,e.submitHandler=s,b.getSelector("assessmentFormSelector").validate(e),i()}function r(e,t){var n=t.attr("name");switch(n){case v.userInputName:b.getSelector("userInputErrorSelector").html(e);break;case v.emailInputName:b.getSelector("emailInputErrorSelector").html(e);break;case v.descriptionInputName:b.getSelector("descriptionInputErrorSelector").html(e);break;default:console.warn("Unrecognized input for assessment form:",t)}}function s(){var e={email:b.getSelector("emailInputSelector").val(),productID:window.skuJson.productId},t=function(e){if(e.length)return void u(v.assessmentExistWithEmail);var t={};t.name=b.getSelector("userInputSelector").val(),t.email=b.getSelector("emailInputSelector").val(),t.description=b.getSelector("descriptionInputSelector").val(),t.assessment=f(),t.productID=window.skuJson.productId,a(t)},n=function(e){u(v.assessmentRegisterFailureText),console.warn("Unable to validate existing email",e)};return y.getAssessmentByEmailAndProductID(e,t,n),!1}function i(){b.getSelector("userInputSelector").rules("add",{required:!0,messages:{required:v.userInputErrorText}}),b.getSelector("emailInputSelector").rules("add",{required:!0,email:!0,messages:{required:v.emailInputErrorText,email:v.emailInputFormatErrorText}}),b.getSelector("descriptionInputSelector").rules("add",{required:!0,messages:{required:v.descriptionInputErrorText}})}function a(e){var t=b.getSelector("registerUserSubmitSelector");t.prop("disabled",!0);var n=function(){t.prop("disabled",!1),c(0),u(v.assessmentRegisterSuccessfulText),v.requireApprovedAssessment||(w.addAssessment(e),x.updateMeanAssessment(e)),b.getSelector("assessmentFormSelector").trigger("reset")},r=function(e){t.prop("disabled",!1),u(v.assessmentRegisterFailureText),console.warn("Unable to register assessment",e)};y.registerAssessment(e,n,r)}function o(){var e=function(e){l(e),c(0)},t=function(e){console.warn("Unable to load suggested answer list",e)};y.getSuggestedAnswerList(e,t)}function u(e){var t=b.getSelector("formMessagesContainerSelector");t.html(e),t.show(),setTimeout(function(){t.fadeOut("fast")},2e3)}function c(e){if(g){h=e;var t={answerList:g[e]},n=$(b.renderTemplate(A,t));n.find("."+v.answerContainerClass).click(function(){var e=$(this).attr("data-answer");if(S.isUndefined(e))return void console.error("The attribute 'data-answer' is required for each answer option");var t=b.getSelector("descriptionInputSelector"),n=(h+1)%g.length;t.val(t.val()+e),c(n),t.focus()}),b.getSelector("suggestedAnswersContainerSelector").empty(),b.getSelector("suggestedAnswersContainerSelector").append(n)}}function l(e){var t=S.sortBy(e,S.property("levelID"));g=S.map(t,function(e){return e.suggestedAnswers.split(",")})}function d(){var e,t=b.getSelector("assessmentInputSelector");t.empty(),e=v.ratingScale-1;var n=y.generateRatingSelectorInput();n.appendTo(t),t.find("select").barrating({theme:"fontawesome-stars-o",onSelect:p,initialRating:e}),p(e)}function p(e){var t=b.getSelector("assessmentInputSelector");t.attr(v.ratingAttribute,e)}function f(){return b.getSelector("assessmentInputSelector").attr(v.ratingAttribute)}var m={};m.init=t;var v,g,h,y=e("../service/productAssessment.service.js"),b=e("../service/templates.service.js"),w=e("./assessmentsList.controller.js"),x=e("./assessmentDisplay.controller.js"),A=e("../../templates/suggestedAnswer.html"),S=e("underscore");return m}()},{"../../templates/suggestedAnswer.html":11,"../service/productAssessment.service.js":8,"../service/templates.service.js":9,"./assessmentDisplay.controller.js":4,"./assessmentsList.controller.js":6,underscore:13}],6:[function(e,t,n){t.exports=function(){"use strict";function t(){o=u.getConfiguration(),n()}function n(){var e=function(e){console.error("Unable to load assessment list:",e)};u.getAssessmentsByProductID(skuJson.productId,r,e)}function r(t){var n=c.getSelector("assessmentsListContainerSelector");n.empty(),t=l.map(t,function(e){return e.ratingAttribute=o.ratingAttribute,e});var r=e("../../templates/assessment.html"),i=$(c.renderTemplate(r,{assessmentList:t}));n.append(i),s(),d=t}function s(){var e=c.getSelector("assessmentsListContainerSelector"),t=e.find("["+o.ratingAttribute+"]");t.empty();var n=u.generateRatingSelectorInput();n.appendTo(t),t.each(function(e,t){t=$(t);var n=t.attr(o.ratingAttribute);t.find("select").barrating({theme:"fontawesome-stars-o",readonly:!0,initialRating:n})})}function i(e){d.push(e),r(d)}var a={};a.init=t,a.addAssessment=i;var o,u=e("../service/productAssessment.service.js"),c=e("../service/templates.service.js"),l=e("underscore"),d=[];return a}()},{"../../templates/assessment.html":10,"../service/productAssessment.service.js":8,"../service/templates.service.js":9,underscore:13}],7:[function(e,t,n){!function(){"use strict";function t(){i.setConfiguration(o),u.validModuleConfiguration(o,c)&&(window.skuJson&&(a.setSelector("displayAssessmentContainerSelector","idName",o.displayAssessmentContainerID),a.setSelector("meanAssessmentContainerSelector","className",o.meanAssessmentContainerClass,"displayAssessmentContainerSelector"),a.setSelector("assessmentTextContainerSelector","className",o.assessmentTextContainerClass,"displayAssessmentContainerSelector"),"Anchor_Jump"===o.activationHandler&&a.setSelector("anchorNameSelector","nameAttribute",o.anchorName),a.setSelector("assessmentRegisterContainerSelector","idName",o.assessmentRegisterContainerID),a.setSelector("suggestedAnswersContainerSelector","className",o.suggestedAnswersContainerClass,"assessmentRegisterContainerSelector"),a.setSelector("assessmentFormSelector","idName",o.assessmentFormId,"assessmentRegisterContainerSelector"),a.setSelector("userInputSelector","nameAttribute",o.userInputName,"assessmentFormSelector"),a.setSelector("userInputErrorSelector","className",o.userInputErrorClassContainer,"assessmentRegisterContainerSelector"),a.setSelector("emailInputSelector","nameAttribute",o.emailInputName,"assessmentFormSelector"),a.setSelector("emailInputErrorSelector","className",o.emailInputErrorClassContainer,"assessmentRegisterContainerSelector"),a.setSelector("descriptionInputSelector","nameAttribute",o.descriptionInputName,"assessmentFormSelector"),a.setSelector("descriptionInputErrorSelector","className",o.descriptionInputErrorClassContainer,"assessmentRegisterContainerSelector"),a.setSelector("assessmentInputSelector","className",o.assessmentInputContainerClass,"assessmentFormSelector"),a.setSelector("registerUserSubmitSelector","nameAttribute",o.registerUserSubmitName,"assessmentFormSelector"),a.setSelector("formMessagesContainerSelector","className",o.formMessagesContainerClass,"assessmentRegisterContainerSelector"),r.init(),a.setSelector("assessmentsListContainerSelector","idName",o.assessmentsListContainerID),s.init()),a.setSelector("productContainerSelector","className",o.productContainer),a.setSelector("productShowcaseDisplayAssessmentContainerSelector","className",o.productShowcaseDisplayAssessmentContainer,"productContainerSelector"),n.init())}var n=e("./controller/assessmentDisplay.controller.js"),r=e("./controller/assessmentRegister.controller.js"),s=e("./controller/assessmentsList.controller.js"),i=e("./service/productAssessment.service.js"),a=e("./service/templates.service.js"),o=e("../module.config"),u=e("../../../global/modulesUtils.js"),c=e("./../module.validations.js");n.attachListeners(),$(document).ready(t)}()},{"../../../global/modulesUtils.js":1,"../module.config":2,"./../module.validations.js":3,"./controller/assessmentDisplay.controller.js":4,"./controller/assessmentRegister.controller.js":5,"./controller/assessmentsList.controller.js":6,"./service/productAssessment.service.js":8,"./service/templates.service.js":9}],8:[function(e,t,n){t.exports=function(){"use strict";function t(e){u=e;var t=[{name:"accountName",value:u.accountName},{name:"acronymAssessment",value:u.masterDataAcronymAssessment},{name:"acronymSuggestedAnswers",value:u.masterDataAcronymSuggestedAnswers}],n={name:"approved"};n.value=e.requireApprovedAssessment?"AND approved=true":"",t.push(n),f.renderResources(t)}function n(){return u}function r(e,t,n){f.fetchResource("addAssessment",void 0,e).done(t).fail(n)}function s(e,t,n){f.fetchResource("getAssessmentByEmailAndProductId",e).done(t).fail(n)}function i(e,t,n){f.fetchResource("getAssessmentByProductId",{productID:e}).done(t).fail(n)}function a(e,t){f.fetchResource("getSuggestedAnswer").done(e).fail(t)}function o(){var e=$("