(function(){"use strict";angular.module("wbx-multifactor",[])})(),function(){"use strict";function n(n,t,i,r){function s(){i.getPublicKey().then(y)}function h(){f()&&(n.$watch("vm.form.$submitted",function(){e()}),n.$watch("vm.form.$pristine",function(n){n===!0&&v()}))}function c(){t.app.name=="PWPApp"&&u.gtmExpiredCallback();r(function(){u.response="";u.ngModel.$setViewValue(u.response);u.onExpire()})}function l(){return u.response==""||u.response==undefined}function a(n){t.app.name=="PWPApp"&&u.gtmCallback();o(n);e();u.onSuccess({reponse:u.response,uniqueId:u.widgetId});f()&&u.form.$setDirty()}function e(){f()&&u.form.$setValidity("recaptcha",!!u.response&&u.response.length>0)}function v(){i.reset(u.widgetId)}function f(){return!!u.form&&!!u.form.$setValidity}function o(n){u.response=n;u.ngModel.$setViewValue(u.response);u.ngModel.$render()}function y(n){n.data==""||n.data==undefined?(u.recaptchaEnabled=!1,o("Recaptcha is disabled")):(u.recaptchaEnabled=!0,i.create("wbxRecaptcha"+(u.customId||""),{callback:a,sitekey:n.data,"expired-callback":c},u.lang).then(function(n){u.widgetId=n;h()}))}var u=this;u.fnIsEmpty=l;u.$onInit=s}angular.module("wbx-multifactor").component("wbxRecaptcha",{require:{form:"?^^form",ngModel:"ngModel"},bindings:{customId:"<?",lang:"<?",widgetId:"=?",response:"=?",onCreate:"&",onSuccess:"&",onExpire:"&",fnIsEmpty:"=?",gtmCallback:"&?",gtmExpiredCallback:"&?"},controller:n,controllerAs:"vm",template:'<div id="wbxRecaptcha{{::vm.customId}}" class="wbx-recaptcha" ng-class="{\'hidden\':!vm.recaptchaEnabled}" langCode="zh"/>'});n.$inject=["$scope","$window","wbxRecaptchaService","$timeout"]}(),function(){"use strict";function n(n,t,i,r){function h(){u.formName="verifyYourIdentityVerificationForm"+u.customId;u.verifyIdentity={DisplayRememberThisDevice:u.displayRememberThisDevice}}function c(){u.createMember()}function l(n){ft(n)&&(f(u.displayErrorMessage||!1),e(!(u.displayErrorMessage||!1)))}function a(){r.setClickInfo("click","enter two-factor verification code","recaptcha","field_interaction","successful callback","checkbox","im not a robot")}function v(){r.setClickInfo("error","enter two-factor verification code","recaptcha","field_interaction","expired callback","checkbox","im not a robot")}function y(){r.setClickInfo("click","two-factor authentication","enter two-factor verification code","field_interaction","the following entries require attention","button","submit")}function p(){u.createMember()}function w(){r.setClickInfo("click","two-factor authentication","enter two-factor verification code","field_interaction","","button","verify");f(!1);n.sendCode(u.selectedMethod,u.recaptchaToken,u.customProfileId).then(nt,g)}function b(){r.setClickInfo("click","two-factor authentication","enter two-factor verification code","field_interaction","","button","submit");u.verifyIdentity.RememberThisDevice=u.verifyIdentity.RememberThisDevice===undefined||u.verifyIdentity.RememberThisDevice===!1?!1:!0;f(!1);var t;t=angular.isFunction(u.actionCallback)?u.actionCallback(u.verifyIdentity.VerificationCode,u.selectedMethod):n.submitVerificationCode(u.verifyIdentity.VerificationCode,u.verifyIdentity.RememberThisDevice,u.selectedMethod,u.verifyMethodOnSuccess,u.customProfileId);t.then(function(){angular.isFunction(u.successCallback)&&(r.setClickInfo("success","two-factor authentication","enter two-factor verification code","field_interaction","valid verification code","button","submit"),u.successCallback())},function(){f(!0,k())})}function k(){var n;return u.IsMWP?"Two_Factor_Invalid_Code":(n="Invalid verification code.",r.setClickInfo("error","two-factor authentication","enter two-factor verification code","field_interaction",n,"button","submit"),n)}function d(){r.setClickInfo("click","two-factor authentication","enter two-factor verification code","field_interaction","","button","resend code");u.displayVerifyResendCode=!0}function g(){t.reset();f(!0);e(!1)}function nt(){f(!1);e(!0);u.displayVerifyResendCode=!1}function f(n,t){u.errorBanner={message:t||u.customSendCodeErrorMessage||u.sendCodeErrorMessagesByType[u.selectedMethod],show:n||!1}}function e(n,t){u.infoBanner={message:t||u.customSendCodeMessage||u.sendCodeMessagesByType[u.selectedMethod],show:n||!1}}function tt(){var n;return u.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 it(){var n;return u.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 rt(){var n;return u.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"?u.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"?u.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 ut(){return o("email")}function s(){return o("phone")}function ft(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 u=this;u.control=u.control||{};u.control.resetVerificationCode=function(){u.verifyIdentity.VerificationCode=null};u.IsMWP=i.IsMWP;u.lang=i.SelectedLanguage;u.sendCodeMessagesByType={Email:tt(),Sms:it(),Voice:rt()};u.sendCodeErrorMessagesByType={Email:ut(),Sms:s(),Voice:s()};u.$onInit=h;u.$onChanges=l;u.submitCode=b;u.resendCode=d;u.sendCode=w;u.emptySubmit=y;u.callback=a;u.expiredCallback=v;u.toggleVerifyAuthenticatorCode=p;u.relinkAuthenticatorAppModal=c}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","wbxRecaptchaService","DataService","GoogleTagManagerService"]}(),function(){"use strict";function n(n,t,i,r){function o(){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&&a();u.customBodyEnabled!=!0&&u.isForgotPassword==!1&&l();angular.element("#verifyYourIdentityLoading").remove();u.openRelinkAuthenticatorAppDialog=b;u.removeAuthenticatorAppLinkAccess=k;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?s(u.mfaProviders[0]):u.mfaProviders.length==0&&u.AllowEmail2FAForUserWithoutProfile==!0?u.methodTypes.email:null}function s(n){return n==1?u.methodTypes.email:n==2?u.methodTypes.sms:n==4?u.methodTypes.authenticator:void 0}function h(){i.setClickInfo("click","verify your email address","recaptcha","field_interaction","successful callback","checkbox","im not a robot")}function c(){i.setClickInfo("error","verify your email address","recaptcha","field_interaction","expired callback","checkbox","im not a robot")}function l(){n.getTwoFactorFeatures().then(function(n){n.data.smsFeature===!1&&(u.displayOnlyEmailFeature=!0)})}function a(){n.getUserData().then(function(n){u.email=n.data.Email})}function v(){if(u.usedMethods=[],u.codeSent===!0&&(u.displaySendCodeError=!1,u.codeSent=!1),u.onMethodChange!=undefined)u.onMethodChange({method:u.selectedMethod})}function y(){if(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(f,p)}}function f(){u.usedMethods.push(u.selectedMethod);u.codeSent=!0}function p(){f();u.displaySendCodeError=!0}function w(){return u.usedMethods.filter(function(n){return n===u.selectedMethod}).length>0}function b(){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 k(){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,e;u.$onInit=o;u.sendCode=y;u.disableVerifyForUsedMethods=w;u.onChangeMethod=v;u.IsMWP=t.IsMWP;u.lang=t.SelectedLanguage;u.callback=h;u.expiredCallback=c;e=setInterval(function(){u.UnlinkAuthenticatorAppDialogControl!==undefined&&(clearInterval(e),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;c()}function s(n,t,i){return v(i),a().then(function(){l(n,t)})}function h(n){grecaptcha||setTimeout(function(){grecaptcha.reset(n)},500)}function c(){e.resolve(!0)}function l(n,t){return grecaptcha.render(n,t)}function a(){return e.promise}function v(t){var e,u;angular.isDefined(n.grecaptcha)?f():n.document.querySelector('script[src^="https://www.google.com/recaptcha/api.js"]')?e=r(function(){angular.isDefined(n.grecaptcha)&&(r.cancel(e),f())},25):(t!=""&&(t="&hl="+t),u=n.document.createElement("script"),u.async=!0,u.defer=!0,u.src="https://www.google.com/recaptcha/api.js?onload=wbxrecaptchaloaded&render=explicit"+t,i.find("body")[0].appendChild(u))}var e=t.defer();this.create=s;this.reset=h;this.getPublicKey=o;n.wbxrecaptchaloaded=f}angular.module("wbx-multifactor").service("wbxRecaptchaService",n);n.$inject=["$window","$q","$document","$interval","API"]}()