(function(){"use strict";angular.module("wbx-multifactor",[])})(),function(){"use strict";function n(n,t,i){function o(){i.getPublicKey().then(s)}function s(n){u=n.data;u==""||u==undefined?(r.recaptchaEnabled=!1,e("Recaptcha is disabled")):(r.recaptchaEnabled=!0,f())}function f(){i.create(r.lang,u,r.action).then(function(n){e(n)})}function e(n){r.response=n;r.ngModel.$setViewValue(r.response)}function h(){return r.response==""||r.response==undefined}var r=this,u;r.fnIsEmpty=h;r.$onInit=o;n.$watch("vm.buttonClicked",function(n){n&&(f(),r.buttonClicked=!1)})}angular.module("wbx-multifactor").component("wbxRecaptcha",{require:{form:"?^^form",ngModel:"ngModel"},bindings:{customId:"<?",lang:"<?",action:"=?",response:"=?",buttonClicked:"=?",onCreate:"&",onSuccess:"&",onExpire:"&",fnIsEmpty:"=?"},controller:n,controllerAs:"vm"});n.$inject=["$scope","$window","wbxRecaptchaService","$timeout"]}(),function(){"use strict";function n(n,t,i){function h(){r.formName="verifyYourIdentityVerificationForm"+r.customId;r.verifyIdentity={DisplayRememberThisDevice:r.displayRememberThisDevice}}function c(){r.createMember()}function l(n){it(n)&&(u(r.displayErrorMessage||!1),f(!(r.displayErrorMessage||!1)))}function a(){i.setClickInfo("click","two-factor authentication","enter two-factor verification code","field_interaction","the following entries require attention","button","submit")}function v(){r.createMember()}function e(){i.setClickInfo("click","two-factor authentication","enter two-factor verification code","field_interaction","","button","verify");u(!1);r.buttonClicked=!0;n.sendCode(r.selectedMethod,r.recaptchaToken,r.customProfileId).then(function(n){n.data==="Code has successfully sent."?k():n.data.Message=="Recaptcha timeout or duplicate"?setTimeout(e,2e3):b(n.data.Message)})}function y(){i.setClickInfo("click","two-factor authentication","enter two-factor verification code","field_interaction","","button","submit");r.verifyIdentity.RememberThisDevice=r.verifyIdentity.RememberThisDevice===undefined||r.verifyIdentity.RememberThisDevice===!1?!1:!0;u(!1);var t;t=angular.isFunction(r.actionCallback)?r.actionCallback(r.verifyIdentity.VerificationCode,r.selectedMethod):n.submitVerificationCode(r.verifyIdentity.VerificationCode,r.verifyIdentity.RememberThisDevice,r.selectedMethod,r.verifyMethodOnSuccess,r.customProfileId);t.then(function(){angular.isFunction(r.successCallback)&&(i.setClickInfo("success","two-factor authentication","enter two-factor verification code","field_interaction","valid verification code","button","submit"),r.successCallback())},function(){u(!0,p())})}function p(){var n;return r.IsMWP?"Two_Factor_Invalid_Code":(n="Invalid verification code.",i.setClickInfo("error","two-factor authentication","enter two-factor verification code","field_interaction",n,"button","submit"),n)}function w(){i.setClickInfo("click","two-factor authentication","enter two-factor verification code","field_interaction","","button","resend code");r.displayVerifyResendCode=!0}function b(n){u(!0,n);f(!1)}function k(){u(!1);f(!0);r.displayVerifyResendCode=!1}function u(n,t){r.errorBanner={message:t||r.customSendCodeErrorMessage||r.sendCodeErrorMessagesByType[r.selectedMethod],show:n||!1}}function f(n,t){r.infoBanner={message:t||r.customSendCodeMessage||r.sendCodeMessagesByType[r.selectedMethod],show:n||!1}}function d(){var n;return r.IsMWP?"Two_Factor_Send_Code_Email_Message":"A verification code was emailed to you. Enter it below to complete the process. Codes are valid for 15 minutes."}function g(){var n;return r.IsMWP?"Two_Factor_Send_Code_Sms_Message":"A text has been sent. Enter the verification code from that text to complete the process. Codes will be valid for 60 seconds."}function nt(){var n;return r.IsMWP?"Two_Factor_Send_Code_Voice_Message":"The voice method is not supported by now. Please select other method"}function o(n){var t;return n=="email"?r.IsMWP?"Two_Factor_UnableToSendCodeEmail":"We are unable to send a verification code to your email right now. Choose an alternate method to confirm your identity.":n=="phone"?r.IsMWP?"Two_Factor_UnableToSendCodePhone":"We are unable to send a verification code to your phone right now. Choose an alternate method to confirm your identity.":void 0}function tt(){return o("email")}function s(){return o("phone")}function it(n){try{return n.selectedMethod!==undefined&&n.selectedMethod.currentValue!==n.selectedMethod.previousValue||n.displayErrorMessage!==undefined&&n.displayErrorMessage.currentValue!==n.displayErrorMessage.previousValue||n.displayVerifyCodePanel!==undefined&&n.displayVerifyCodePanel.currentValue===!0}catch(t){return!1}}var r=this;r.control=r.control||{};r.control.resetVerificationCode=function(){r.verifyIdentity.VerificationCode=null};r.IsMWP=t.IsMWP;r.lang=t.SelectedLanguage;r.sendCodeMessagesByType={Email:d(),Sms:g(),Voice:nt()};r.sendCodeErrorMessagesByType={Email:tt(),Sms:s(),Voice:s()};r.$onInit=h;r.$onChanges=l;r.submitCode=y;r.resendCode=w;r.sendCode=e;r.emptySubmit=a;r.toggleVerifyAuthenticatorCode=v;r.relinkAuthenticatorAppModal=c;r.action="resend_code";r.buttonClicked=!1}angular.module("wbx-multifactor").component("wbxVerifyCode",{bindings:{customId:"<",selectedMethod:"<",displayVerifyCodePanel:"=",displayErrorMessage:"<?",actionCallback:"=",successCallback:"=?",verifyMethodOnSuccess:"=?",customSendCodeMessage:"<?",customSendCodeErrorMessage:"<?",customProfileId:"<?",displayRememberThisDevice:"=",displayVerificationProcessFailsMessage:"=?",displayRelinkAuthenticatorAppMessage:"=?",displayContactCustomerServiceMessage:"=?",createMember:"&?",control:"=?"},controller:n,controllerAs:"vm",templateUrl:"/Templates/VerifyMultiFactorCode"});n.$inject=["MultifactorService","DataService","GoogleTagManagerService"]}(),function(){"use strict";function n(n,t,i,r){function s(){u.methodTypes=n.getMethodsEnum();u.usedMethods=[];u.hasOnlyEmail=u.phone==undefined||u.phone=="";u.displaySendCodeError=!1;u.displayOnlyEmailFeature==undefined&&(u.displayOnlyEmailFeature=!1);u.displayVerifyCodePanel==undefined&&(u.displayVerifyCodePanel=!1);u.isFirstTimeSetup==undefined&&(u.isFirstTimeSetup=!1);u.isForgotPassword==undefined&&(u.isForgotPassword=!1);(u.email==undefined||u.email=="")&&u.customBodyEnabled!=!0&&u.isForgotPassword==!1&&l();u.customBodyEnabled!=!0&&u.isForgotPassword==!1&&c();angular.element("#verifyYourIdentityLoading").remove();u.openRelinkAuthenticatorAppDialog=y;u.removeAuthenticatorAppLinkAccess=p;u.mfaProviders=t.hasOwnProperty("mfaProviders")==!0?t.mfaProviders:[];u.verificationMethod=u.mfaProviders.length>1?0:u.mfaProviders.length==1?u.mfaProviders[0]:0;u.AllowEmail2FAForUserWithoutProfile=t.hasOwnProperty("AllowEmail2FAForUserWithoutProfile")==!0?t.AllowEmail2FAForUserWithoutProfile:!1;u.selectedMethod=u.isFirstTimeSetup==!0?u.customAuthMethod||u.methodTypes.email:u.mfaProviders.length>1?null:u.mfaProviders.length==1?h(u.mfaProviders[0]):u.mfaProviders.length==0&&u.AllowEmail2FAForUserWithoutProfile==!0?u.methodTypes.email:null}function h(n){return n==1?u.methodTypes.email:n==2?u.methodTypes.sms:n==4?u.methodTypes.authenticator:void 0}function c(){n.getTwoFactorFeatures().then(function(n){n.data.smsFeature===!1&&(u.displayOnlyEmailFeature=!0)})}function l(){n.getUserData().then(function(n){u.email=n.data.Email})}function a(){if(u.usedMethods=[],u.codeSent===!0&&(u.displaySendCodeError=!1,u.codeSent=!1),u.onMethodChange!=undefined)u.onMethodChange({method:u.selectedMethod})}function e(){if(u.buttonClicked=!0,u.displaySendCodeError=!1,u.selectedMethod===u.methodTypes.authenticator)f();else{var t=u.selectedMethod!=null&&u.selectedMethod!=undefined?u.selectedMethod.toLowerCase():" verification 2FA code sent";i.setClickInfo("click","two-factor authentication","verify your identity","field_interaction",t,"button","send code");n.sendCode(u.selectedMethod,u.recaptchaToken).then(function(n){n.data.Status==!1?(u.errorMessage=n.data.Message,u.errorMessageKey=n.data.messageKey,u.displaySendCodeError=!0,u.errorMessage=="Recaptcha timeout or duplicate"&&(u.displaySendCodeError=!1,setTimeout(e,2e3))):f()})}}function f(){u.usedMethods.push(u.selectedMethod);u.codeSent=!0}function v(){return u.usedMethods.filter(function(n){return n===u.selectedMethod}).length>0}function y(){i.setClickInfo("click","two-factor authentication","relink authenticator app link","field_interaction","","link","re-link your account to an authenticator app.");u.UnlinkAuthenticatorAppDialogControl.showDialog()}function p(){r.post("/Account/RelinkAuthenticatorApp").then(function(){i.setClickInfo("click","two-factor authentication","warning relink authenticator app modal","field_interaction","","button","remove current link");u.UnlinkAuthenticatorAppDialogControl.hideDialog();window.location.href="/FirstTime2fa/Index"})}var u=this,o;u.$onInit=s;u.sendCode=e;u.disableVerifyForUsedMethods=v;u.onChangeMethod=a;u.IsMWP=t.IsMWP;u.lang=t.SelectedLanguage;u.action="verify_identity";u.buttonClicked=!1;o=setInterval(function(){u.UnlinkAuthenticatorAppDialogControl!==undefined&&(clearInterval(o),u.UnlinkAuthenticatorAppDialogControl.hideDialog=function(){i.setClickInfo("click","two-factor authentication","warning relink authenticator app modal","field_interaction","","button","cancel");$("#UnlinkAuthenticatorAppModalDialog").modal("hide")})},1e3)}angular.module("wbx-multifactor").component("wbxVerifyYourIdentity",{bindings:{customHeaderEnabled:"=?",customBodyEnabled:"=?",customFooterEnabled:"=?",customVerifyEnabled:"=?",customAuthMethod:"<?",displayVerifyCodePanel:"=?",displayVerifyCodePanelErrorMessage:"=?",successCallback:"=",actionCallback:"=?",displayOnlyEmailFeature:"=?",email:"<",phone:"<?",customId:"<?",customProfileId:"<?",displayBackButton:"<?",backButtonHref:"<?",clickBackButton:"&?",customSendCodeMessage:"<?",customSendCodeErrorMessage:"<?",onMethodChange:"&?",isFirstTimeSetup:"<?",isForgotPassword:"<?"},transclude:{header:"?customHeader",body:"?customBody",footer:"?customFooter",verify:"?customVerify",extra:"?extraContent"},controller:n,controllerAs:"vm",templateUrl:"/Templates/VerifyYourIdentity"});n.$inject=["MultifactorService","DataService","GoogleTagManagerService","API"]}(),function(){bindApi(angular.module("wbx-multifactor"))}(),function(){"use strict";function n(n){function t(t,i,r,u,f){return n.post("/Multifactor/SubmitCode",{code:t,rememberThisDevice:i,method:r,verifyMethodOnSuccess:u,encryptedProfileId:f})}function i(t,i,r){return n.post("/Multifactor/SendCode",{method:t,recaptcha:i,encryptedProfileId:r})}function r(t,i,r){return n.post("/Multifactor/UpdateAuthMethod",{method:t,newValue:i,recaptcha:r})}function u(t,i,r,u){return n.post("/Multifactor/SubmitCode",{method:r,code:t,RememberThisDevice:i,verifyMethodOnSuccess:u})}function f(){return n.get("/Multifactor/GetUserData")}function e(){return{email:"Email",sms:"Sms",voide:"Voice",authenticator:"Authenticator"}}function o(){return n.get("/Multifactor/GetTwoFactorFeatures")}function s(){return n.post("/Multifactor/SkipSms")}return{submitVerificationCode:t,sendCode:i,getMethodsEnum:e,updateAuthMethod:r,getTwoFactorFeatures:o,getUserData:f,skipSms:s,submitCode:u}}angular.module("wbx-multifactor").service("MultifactorService",n);n.$inject=["API"]}(),function(){"use strict";function n(n,t,i,r,u){function o(){return u.get("/Multifactor/GetRecaptchaPublicKey")}function f(){var t=n.grecaptcha;h()}function s(n,t,i){return a(n,t),l().then(function(){return c(t,i)})}function h(){e.resolve(!0)}function c(n,t){return new Promise(function(i){grecaptcha.ready(function(){grecaptcha.execute(n,{action:t}).then(function(n){i(n)})})})}function l(){return e.promise}function a(t,u){var o,e;angular.isDefined(n.grecaptcha)?f():n.document.querySelector('script[src^="https://www.google.com/recaptcha/api.js"]')?o=r(function(){angular.isDefined(n.grecaptcha)&&(r.cancel(o),f())},25):(t!=""&&(t="&hl="+t),e=n.document.createElement("script"),e.async=!0,e.defer=!0,e.src="https://www.google.com/recaptcha/api.js?render="+u,e.onload=f,i.find("body")[0].appendChild(e))}var e=t.defer();this.create=s;this.getPublicKey=o;n.wbxrecaptchaloaded=f}angular.module("wbx-multifactor").service("wbxRecaptchaService",n);n.$inject=["$window","$q","$document","$interval","API"]}()