{"version":3,"sources":["../node_modules/@aws-amplify/ui-components/dist/esm-es5/amplify-confirm-sign-in_7.entry.js","../node_modules/@aws-amplify/ui-components/dist/esm-es5/auth-helpers-475f7fa4.js"],"names":["__awaiter","thisArg","_arguments","P","generator","Promise","resolve","reject","fulfilled","value","step","next","e","rejected","result","done","then","apply","__generator","body","f","y","t","g","_","label","sent","trys","ops","verb","Symbol","iterator","this","n","v","op","TypeError","call","pop","length","push","__spreadArrays","s","i","il","arguments","r","Array","k","a","j","jl","AmplifyConfirmSignIn","class_1","hostRef","_this","registerInstance","handleSubmit","event","confirm","headerText","Translations","CONFIRM_SMS_CODE","submitButtonText","CONFIRM","handleAuthStateChange","dispatchAuthStateChangeEvent","defaultFormFields","type","required","handleInputChange","handleCodeChange","formFields","mfaOption","MfaOption","SMS","loading","prototype","componentWillLoad","setup","userHandler","user","ChallengeName","SoftwareTokenMFA","TOTP","CONFIRM_TOTP_CODE","constructedFormFieldOptions","constructFormFieldOptions","code","target","mfaType","error_1","_a","preventDefault","Auth","confirmSignIn","Error","NO_AUTH_MODULE_FOUND","checkContact","dispatchToastHubEvent","content","undefined","forEach","formField","Object","assign","render","h","Host","I18n","get","secondaryFooterContent","variant","onClick","AuthState","SignIn","BACK_TO_SIGN_IN","defineProperty","enumerable","configurable","AmplifyConfirmSignUp","class_2","confirmSignUp","CONFIRM_SIGN_UP_HEADER_TEXT","CONFIRM_SIGN_UP_SUBMIT_BUTTON_TEXT","usernameAlias","newFormFields","phoneNumber","countryDialCodeValue","COUNTRY_DIAL_CODE_DEFAULT","phoneNumberValue","formFieldsHandler","buildFormFields","userInput","username","_signUpAttrs","signUpAttrs","checkUsernameAlias","buildDefaultFormFields","handleFormFieldInputChange","disabled","inputProps","autocomplete","CONFIRM_SIGN_UP_CODE_LABEL","placeholder","CONFIRM_SIGN_UP_CODE_PLACEHOLDER","hint","CONFIRM_SIGN_UP_LOST_CODE","resendConfirmCode","CONFIRM_SIGN_UP_RESEND_CODE","newFields_1","field","newField","isHintValid","handleFormFieldInputWithCallback","fieldType","handlePhoneNumberChange","setFieldValue","dialCode","fnToCall","cb","bind","getUsername","composePhoneNumberInput","error_2","resendSignUp","EMPTY_USERNAME","trim","error_3","CONFIRM_SIGN_UP_FAILED","password","handleSignIn","logger","Logger","AmplifyForgotPassword","class_3","RESET_YOUR_PASSWORD","sendButtonText","SEND_CODE","SUBMIT","handleSend","send","submit","delivery","forgotPasswordAttrs","newFields_2","formAttributes","data","error_4","forgotPassword","error","debug","NEW_PASSWORD_LABEL","NEW_PASSWORD_PLACEHOLDER","CodeDeliveryDetails","error_5","_b","forgotPasswordSubmit","submitFn","testDataPrefix","logger$1","ConsoleLogger","AmplifyRequireNewPassword","class_4","CHANGE_PASSWORD","CHANGE_PASSWORD_ACTION","completeNewPassword","AuthFormField","Password","handlePasswordChange","requiredAttributes","setCurrentUser","handleRequiredAttributeInputChange","attribute","formatPhoneNumber","error_6","userRequiredAttributes","requiredAttributesMap_1","currentAuthenticatedUser","currentUser","challengeParam","getRequiredAttributesMap","name","PHONE_SUFFIX","composedInput","err","error_7","challengeName","SMSMFA","MFASetup","ConfirmSignIn","TOTPSetup","AmplifySignIn","class_5","signIn","SIGN_IN_HEADER_TEXT","SIGN_IN_ACTION","hideSignUp","signInAttributes","formFieldInputs","FORGOT_PASSWORD_TEXT","ForgotPassword","RESET_PASSWORD_TEXT","newFields_3","slot","federated","isEmpty","class","NO_ACCOUNT_TEXT","SignUp","CREATE_ACCOUNT_TEXT","style","AmplifySignUp","class_6","signUp","handleSignUp","params","authSignUp","SIGN_UP_HEADER_TEXT","SIGN_UP_SUBMIT_BUTTON_TEXT","haveAccountText","SIGN_UP_HAVE_ACCOUNT_TEXT","signInText","SIGN_IN_TEXT","signUpAttributes","attributes","email","SIGN_UP_FAILED","assignPhoneNumberToSignUpAttributes","phone_number","assignUserNameAliasToSignUpAttributes","assignFormInputToSignUpAttributes","validateSignUpAttributes","UsernameAlias","EMPTY_EMAIL","EMPTY_PHONE","indexOf","USERNAME_REMOVE_WHITESPACE","PASSWORD_REMOVE_WHITESPACE","error_8","userConfirmed","ConfirmSignUp","SIGN_UP_EMAIL_PLACEHOLDER","SIGN_UP_PASSWORD_PLACEHOLDER","SIGN_UP_USERNAME_PLACEHOLDER","newFields_4","logger$2","AmplifyVerifyContact","class_7","verifyAttr","verify","contact","attr","error_9","verifyCurrentUserAttributeSubmit","SignedIn","error_10","verifyCurrentUserAttribute","inputName","renderSubmit","CODE_PLACEHOLDER","renderVerify","unverified","VERIFY_CONTACT_EMAIL_LABEL","key","VERIFY_CONTACT_PHONE_LABEL","VERIFY_CONTACT_HEADER_TEXT","VERIFY_CONTACT_SUBMIT_LABEL","VERIFY_CONTACT_VERIFY_LABEL","newUser","verifiedContact","isCognitoUser","verified","VerifyContact","NewPasswordRequired","ResetPassword","CustomChallenge","trigger","CustomConfirmSignIn","message","EMPTY_PASSWORD","CognitoUser"],"mappings":"4GAAA,geAAIA,EAAwC,SAAUC,EAASC,EAAYC,EAAGC,GAE1E,OAAO,IAAKD,IAAMA,EAAIE,WAAU,SAAUC,EAASC,GAC/C,SAASC,EAAUC,GAAS,IAAMC,EAAKN,EAAUO,KAAKF,GAAmC,CAAxB,MAAOG,GAAKL,EAAOK,EAAK,CAAE,CAC3F,SAASC,EAASJ,GAAS,IAAMC,EAAKN,EAAS,MAAUK,GAAmC,CAAxB,MAAOG,GAAKL,EAAOK,EAAK,CAAE,CAC9F,SAASF,EAAKI,GAJlB,IAAeL,EAIaK,EAAOC,KAAOT,EAAQQ,EAAOL,QAJ1CA,EAIyDK,EAAOL,MAJhDA,aAAiBN,EAAIM,EAAQ,IAAIN,GAAE,SAAUG,GAAWA,EAAQG,EAAS,KAIlBO,KAAKR,EAAWK,EAAY,CAC9GH,GAAMN,EAAYA,EAAUa,MAAMhB,EAASC,GAAc,KAAKS,OACjE,GACJ,EACGO,EAA4C,SAAUjB,EAASkB,GAC/D,IAAsGC,EAAGC,EAAGC,EAAGC,EAA3GC,EAAI,CA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AAQ5E,MACboF,EAAOmB,MAAM,oCACb9H,EAAsBiD,IAAU+H,eAAgB,CAAE3G,SAAUA,KAEtC,8BAAjB8B,EAAQ5E,MAAqD,KAAbkF,GACrDE,EAAOmB,MAAM,4BACb3B,EAAQ2J,QAAUlQ,IAAamQ,gBAE1B5J,EAAQ2J,UAAYlQ,IAAayG,iBAClCzC,IAAkBoJ,IAAcP,QAChCtG,EAAQ2J,QAAUlQ,IAAaqN,aAE/BrJ,IAAkBoJ,IAAcJ,eAChCzG,EAAQ2J,QAAUlQ,IAAasN,cAGvChL,YAAsBiE,GACf,CAAC,EAAa,IACzB,KAAK,GAAI,MAAO,CAAC,GAExB,GACJ,GAAI,EACDmJ,EAAgB,SAAUtO,GAC1B,OAAOA,aAAgBgP,GAC1B,C","file":"static/js/13.38e5f833.chunk.js","sourcesContent":["var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar __spreadArrays = (this && this.__spreadArrays) || function () {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n};\nimport { r as registerInstance, h, H as Host } from './index-83f2275b.js';\nimport { I18n, Logger, ConsoleLogger, isEmpty } from '@aws-amplify/core';\nimport { M as MfaOption, C as ChallengeName, A as AuthState, a as AuthFormField, U as UsernameAlias } from './auth-types-78df304e.js';\nimport { Auth } from '@aws-amplify/auth';\nimport { T as Translations } from './Translations-c833f663.js';\nimport { N as NO_AUTH_MODULE_FOUND, g as COUNTRY_DIAL_CODE_DEFAULT, b as PHONE_SUFFIX } from './constants-c8ecaa24.js';\nimport { d as dispatchAuthStateChangeEvent, a as dispatchToastHubEvent, c as checkUsernameAlias, i as isHintValid, h as handlePhoneNumberChange, b as composePhoneNumberInput, g as getRequiredAttributesMap } from './helpers-9703fe65.js';\nimport { c as checkContact, h as handleSignIn } from './auth-helpers-475f7fa4.js';\nvar AmplifyConfirmSignIn = /** @class */ (function () {\n function class_1(hostRef) {\n var _this = this;\n registerInstance(this, hostRef);\n /** Fires when confirm sign in form is submitted */\n this.handleSubmit = function (event) { return _this.confirm(event); };\n /** Used for header text in confirm sign in component */\n this.headerText = Translations.CONFIRM_SMS_CODE;\n /** Used for the submit button text in confirm sign in component */\n this.submitButtonText = Translations.CONFIRM;\n /** Auth state change handler for this component */\n this.handleAuthStateChange = dispatchAuthStateChangeEvent;\n /** Default form field */\n this.defaultFormFields = [\n {\n type: 'code',\n required: true,\n handleInputChange: function (event) { return _this.handleCodeChange(event); },\n },\n ];\n /**\n * Form fields allows you to utilize our pre-built components such as username field, code field, password field, email field, etc.\n * by passing an array of strings that you would like the order of the form to be in. If you need more customization, such as changing\n * text for a label or adjust a placeholder, you can follow the structure below in order to do just that.\n * ```\n * [\n * {\n * type: string,\n * label: string,\n * placeholder: string,\n * hint: string | Functional Component | null,\n * required: boolean\n * }\n * ]\n * ```\n */\n this.formFields = this.defaultFormFields;\n /** The MFA option to confirm with */\n this.mfaOption = MfaOption.SMS;\n /* Whether or not the confirm-sign-in component is loading */\n this.loading = false;\n }\n class_1.prototype.componentWillLoad = function () {\n this.setup();\n };\n class_1.prototype.userHandler = function () {\n this.setup();\n };\n class_1.prototype.setup = function () {\n if (this.user &&\n this.user['challengeName'] === ChallengeName.SoftwareTokenMFA) {\n this.mfaOption = MfaOption.TOTP;\n // If header text is using default use TOTP string\n if (this.headerText === Translations.CONFIRM_SMS_CODE) {\n this.headerText = Translations.CONFIRM_TOTP_CODE;\n }\n }\n this.constructedFormFieldOptions = this.constructFormFieldOptions(this.formFields);\n };\n class_1.prototype.handleCodeChange = function (event) {\n this.code = event.target.value;\n };\n class_1.prototype.confirm = function (event) {\n return __awaiter(this, void 0, void 0, function () {\n var mfaType, error_1;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (event) {\n event.preventDefault();\n }\n mfaType = this.user['challengeName'] === ChallengeName.SoftwareTokenMFA\n ? ChallengeName.SoftwareTokenMFA\n : null;\n if (!Auth || typeof Auth.confirmSignIn !== 'function') {\n throw new Error(NO_AUTH_MODULE_FOUND);\n }\n this.loading = true;\n _a.label = 1;\n case 1:\n _a.trys.push([1, 4, 5, 6]);\n return [4 /*yield*/, Auth.confirmSignIn(this.user, this.code, mfaType)];\n case 2:\n _a.sent();\n return [4 /*yield*/, checkContact(this.user, this.handleAuthStateChange)];\n case 3:\n _a.sent();\n return [3 /*break*/, 6];\n case 4:\n error_1 = _a.sent();\n dispatchToastHubEvent(error_1);\n return [3 /*break*/, 6];\n case 5:\n this.loading = false;\n return [7 /*endfinally*/];\n case 6: return [2 /*return*/];\n }\n });\n });\n };\n class_1.prototype.constructFormFieldOptions = function (formFields) {\n var _this = this;\n var content = [];\n if (formFields === undefined)\n return undefined;\n if (formFields.length <= 0)\n return this.defaultFormFields;\n formFields.forEach(function (formField) {\n if (typeof formField === 'string' || formField.type !== 'code') {\n // This is either a `string`, and/or a custom field that isn't `code`. Pass this directly.\n content.push(formField);\n }\n else {\n // This is a code input field. Attach input handler.\n content.push(Object.assign({ handleInputChange: function (event) { return _this.handleCodeChange(event); } }, formField));\n }\n });\n return content;\n };\n class_1.prototype.render = function () {\n var _this = this;\n return (h(Host, null, h(\"amplify-form-section\", { headerText: I18n.get(this.headerText), handleSubmit: this.handleSubmit, submitButtonText: I18n.get(this.submitButtonText), loading: this.loading, secondaryFooterContent: h(\"span\", null, h(\"amplify-button\", { variant: \"anchor\", onClick: function () { return _this.handleAuthStateChange(AuthState.SignIn); } }, I18n.get(Translations.BACK_TO_SIGN_IN))) }, h(\"amplify-auth-fields\", { formFields: this.constructedFormFieldOptions }))));\n };\n Object.defineProperty(class_1, \"watchers\", {\n get: function () {\n return {\n \"user\": [\"userHandler\"]\n };\n },\n enumerable: false,\n configurable: true\n });\n return class_1;\n}());\nvar AmplifyConfirmSignUp = /** @class */ (function () {\n function class_2(hostRef) {\n var _this = this;\n registerInstance(this, hostRef);\n /** Fires when sign up form is submitted */\n this.handleSubmit = function (event) { return _this.confirmSignUp(event); };\n /** Used for header text in confirm sign up component */\n this.headerText = Translations.CONFIRM_SIGN_UP_HEADER_TEXT;\n /** Used for the submit button text in confirm sign up component */\n this.submitButtonText = Translations.CONFIRM_SIGN_UP_SUBMIT_BUTTON_TEXT;\n /**\n * Form fields allows you to utilize our pre-built components such as username field, code field, password field, email field, etc.\n * by passing an array of strings that you would like the order of the form to be in. If you need more customization, such as changing\n * text for a label or adjust a placeholder, you can follow the structure below in order to do just that.\n * ```\n * [\n * {\n * type: string,\n * label: string,\n * placeholder: string,\n * hint: string | Functional Component | null,\n * required: boolean\n * }\n * ]\n * ```\n */\n this.formFields = [];\n /** Auth state change handler for this components\n * e.g. SignIn -> 'Create Account' link -> SignUp\n */\n this.handleAuthStateChange = dispatchAuthStateChangeEvent;\n /** Username Alias is used to setup authentication with `username`, `email` or `phone_number` */\n this.usernameAlias = 'username';\n this.loading = false;\n this.newFormFields = [];\n this.phoneNumber = {\n countryDialCodeValue: COUNTRY_DIAL_CODE_DEFAULT,\n phoneNumberValue: null,\n };\n }\n class_2.prototype.componentWillLoad = function () {\n this.setup();\n };\n class_2.prototype.formFieldsHandler = function () {\n this.buildFormFields();\n };\n class_2.prototype.userHandler = function () {\n this.setup();\n };\n class_2.prototype.setup = function () {\n // TODO: Use optional chaining instead\n this.userInput = this.user && this.user.username;\n this._signUpAttrs = this.user && this.user.signUpAttrs;\n checkUsernameAlias(this.usernameAlias);\n this.buildFormFields();\n };\n class_2.prototype.buildDefaultFormFields = function () {\n var _this = this;\n this.newFormFields = [\n {\n type: \"\" + this.usernameAlias,\n required: true,\n handleInputChange: this.handleFormFieldInputChange(\"\" + this.usernameAlias),\n value: this.userInput,\n disabled: this.userInput ? true : false,\n inputProps: { autocomplete: 'username' },\n },\n {\n type: 'code',\n label: I18n.get(Translations.CONFIRM_SIGN_UP_CODE_LABEL),\n placeholder: I18n.get(Translations.CONFIRM_SIGN_UP_CODE_PLACEHOLDER),\n required: true,\n hint: (h(\"div\", null, I18n.get(Translations.CONFIRM_SIGN_UP_LOST_CODE), ' ', h(\"amplify-button\", { variant: \"anchor\", onClick: function () { return _this.resendConfirmCode(); } }, I18n.get(Translations.CONFIRM_SIGN_UP_RESEND_CODE)))),\n handleInputChange: this.handleFormFieldInputChange('code'),\n },\n ];\n };\n class_2.prototype.buildFormFields = function () {\n var _this = this;\n if (this.formFields.length === 0) {\n this.buildDefaultFormFields();\n }\n else {\n var newFields_1 = [];\n this.formFields.forEach(function (field) {\n var newField = Object.assign({}, field);\n if (newField.type === 'code') {\n newField['hint'] = isHintValid(newField) ? (h(\"div\", null, I18n.get(Translations.CONFIRM_SIGN_UP_LOST_CODE), ' ', h(\"amplify-button\", { variant: \"anchor\", onClick: function () { return _this.resendConfirmCode(); } }, I18n.get(Translations.CONFIRM_SIGN_UP_RESEND_CODE)))) : (newField['hint']);\n }\n newField['handleInputChange'] = function (event) { return _this.handleFormFieldInputWithCallback(event, field); };\n newFields_1.push(newField);\n });\n this.newFormFields = newFields_1;\n }\n };\n class_2.prototype.handleFormFieldInputChange = function (fieldType) {\n var _this = this;\n switch (fieldType) {\n case 'username':\n case 'email':\n return function (event) { return (_this.userInput = event.target.value); };\n case 'phone_number':\n return function (event) { return handlePhoneNumberChange(event, _this.phoneNumber); };\n case 'code':\n return function (event) { return (_this.code = event.target.value); };\n default:\n return;\n }\n };\n class_2.prototype.setFieldValue = function (field) {\n switch (field.type) {\n case 'username':\n case 'email':\n if (field.value === undefined) {\n this.userInput = '';\n }\n else {\n this.userInput = field.value;\n }\n break;\n case 'phone_number':\n if (field.dialCode) {\n this.phoneNumber.countryDialCodeValue = field.dialCode;\n }\n this.phoneNumber.phoneNumberValue = field.value;\n break;\n }\n };\n class_2.prototype.handleFormFieldInputWithCallback = function (event, field) {\n var fnToCall = field['handleInputChange']\n ? field['handleInputChange']\n : function (event, cb) {\n cb(event);\n };\n var callback = this.handleFormFieldInputChange(field.type);\n fnToCall(event, callback.bind(this));\n };\n /**\n * Returns the username of the user to confirm. If a valid `user.username` has been passed as a prop, we return that.\n * Otherwise, we return the `userInput` on the form.\n */\n class_2.prototype.getUsername = function () {\n if (this.user && this.user.username)\n return this.user.username;\n switch (this.usernameAlias) {\n case 'username':\n case 'email':\n return this.userInput;\n case 'phone_number':\n return composePhoneNumberInput(this.phoneNumber);\n }\n };\n class_2.prototype.resendConfirmCode = function () {\n return __awaiter(this, void 0, void 0, function () {\n var username, error_2;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (event) {\n event.preventDefault();\n }\n if (!Auth || typeof Auth.resendSignUp !== 'function') {\n throw new Error(NO_AUTH_MODULE_FOUND);\n }\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n username = this.getUsername();\n if (!username)\n throw new Error(Translations.EMPTY_USERNAME);\n return [4 /*yield*/, Auth.resendSignUp(username.trim())];\n case 2:\n _a.sent();\n return [3 /*break*/, 4];\n case 3:\n error_2 = _a.sent();\n dispatchToastHubEvent(error_2);\n return [3 /*break*/, 4];\n case 4: return [2 /*return*/];\n }\n });\n });\n };\n // TODO: Add validation\n // TODO: Prefix\n class_2.prototype.confirmSignUp = function (event) {\n return __awaiter(this, void 0, void 0, function () {\n var username, confirmSignUpResult, error_3;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (event) {\n event.preventDefault();\n }\n if (!Auth || typeof Auth.confirmSignUp !== 'function') {\n throw new Error(NO_AUTH_MODULE_FOUND);\n }\n this.loading = true;\n _a.label = 1;\n case 1:\n _a.trys.push([1, 6, 7, 8]);\n username = this.getUsername();\n if (!username)\n throw new Error(Translations.EMPTY_USERNAME);\n username = username.trim();\n return [4 /*yield*/, Auth.confirmSignUp(username, this.code)];\n case 2:\n confirmSignUpResult = _a.sent();\n if (!confirmSignUpResult) {\n throw new Error(I18n.get(Translations.CONFIRM_SIGN_UP_FAILED));\n }\n if (!(this._signUpAttrs &&\n this._signUpAttrs.password &&\n this._signUpAttrs.password !== '')) return [3 /*break*/, 4];\n // Auto sign in user if password is available from previous workflow\n return [4 /*yield*/, handleSignIn(username, this._signUpAttrs.password, this.handleAuthStateChange)];\n case 3:\n // Auto sign in user if password is available from previous workflow\n _a.sent();\n return [3 /*break*/, 5];\n case 4:\n this.handleAuthStateChange(AuthState.SignIn);\n _a.label = 5;\n case 5: return [3 /*break*/, 8];\n case 6:\n error_3 = _a.sent();\n dispatchToastHubEvent(error_3);\n return [3 /*break*/, 8];\n case 7:\n this.loading = false;\n return [7 /*endfinally*/];\n case 8: return [2 /*return*/];\n }\n });\n });\n };\n class_2.prototype.render = function () {\n var _this = this;\n return (h(Host, null, h(\"amplify-form-section\", { headerText: I18n.get(this.headerText), submitButtonText: I18n.get(this.submitButtonText), handleSubmit: this.handleSubmit, loading: this.loading, secondaryFooterContent: h(\"div\", null, h(\"span\", null, h(\"amplify-button\", { variant: \"anchor\", onClick: function () { return _this.handleAuthStateChange(AuthState.SignIn); } }, I18n.get(Translations.BACK_TO_SIGN_IN)))) }, h(\"amplify-auth-fields\", { formFields: this.newFormFields }))));\n };\n Object.defineProperty(class_2, \"watchers\", {\n get: function () {\n return {\n \"formFields\": [\"formFieldsHandler\"],\n \"user\": [\"userHandler\"]\n };\n },\n enumerable: false,\n configurable: true\n });\n return class_2;\n}());\nvar logger = new Logger('ForgotPassword');\nvar AmplifyForgotPassword = /** @class */ (function () {\n function class_3(hostRef) {\n var _this = this;\n registerInstance(this, hostRef);\n /** The header text of the forgot password section */\n this.headerText = Translations.RESET_YOUR_PASSWORD;\n /** The text displayed inside of the send code button for the form */\n this.sendButtonText = Translations.SEND_CODE;\n /** The text displayed inside of the submit button for the form */\n this.submitButtonText = Translations.SUBMIT;\n /** The form fields displayed inside of the forgot password form */\n this.formFields = [];\n /** The function called when making a request to reset password */\n this.handleSend = function (event) { return _this.send(event); };\n /** The function called when submitting a new password */\n this.handleSubmit = function (event) { return _this.submit(event); };\n /** Auth state change handler for this component */\n this.handleAuthStateChange = dispatchAuthStateChangeEvent;\n /** Username Alias is used to setup authentication with `username`, `email` or `phone_number` */\n this.usernameAlias = 'username';\n this.delivery = null;\n this.loading = false;\n this.phoneNumber = {\n countryDialCodeValue: COUNTRY_DIAL_CODE_DEFAULT,\n phoneNumberValue: null,\n };\n this.newFormFields = [];\n this.forgotPasswordAttrs = {\n userInput: '',\n password: '',\n code: '',\n };\n }\n class_3.prototype.componentWillLoad = function () {\n checkUsernameAlias(this.usernameAlias);\n this.buildFormFields();\n };\n class_3.prototype.formFieldsHandler = function () {\n this.buildFormFields();\n };\n class_3.prototype.buildFormFields = function () {\n var _this = this;\n if (this.formFields.length === 0) {\n this.buildDefaultFormFields();\n }\n else {\n var newFields_2 = [];\n this.formFields.forEach(function (field) {\n var newField = Object.assign({}, field);\n newField['handleInputChange'] = function (event) { return _this.handleFormFieldInputWithCallback(event, field); };\n newFields_2.push(newField);\n });\n this.newFormFields = newFields_2;\n }\n };\n class_3.prototype.buildDefaultFormFields = function () {\n switch (this.usernameAlias) {\n case 'email':\n this.newFormFields = [\n {\n type: 'email',\n required: true,\n handleInputChange: this.handleFormFieldInputChange('email'),\n inputProps: {\n 'data-test': 'forgot-password-email-input',\n },\n },\n ];\n break;\n case 'phone_number':\n this.newFormFields = [\n {\n type: 'phone_number',\n required: true,\n handleInputChange: this.handleFormFieldInputChange('phone_number'),\n inputProps: {\n 'data-test': 'forgot-password-phone-number-input',\n },\n },\n ];\n break;\n case 'username':\n default:\n this.newFormFields = [\n {\n type: 'username',\n required: true,\n handleInputChange: this.handleFormFieldInputChange('username'),\n inputProps: {\n 'data-test': 'forgot-password-username-input',\n },\n },\n ];\n break;\n }\n };\n class_3.prototype.handleFormFieldInputChange = function (fieldType) {\n var _this = this;\n switch (fieldType) {\n case 'username':\n case 'email':\n return function (event) { return (_this.forgotPasswordAttrs.userInput = event.target.value); };\n case 'phone_number':\n return function (event) { return handlePhoneNumberChange(event, _this.phoneNumber); };\n case 'password':\n case 'code':\n return function (event) { return (_this.forgotPasswordAttrs[fieldType] = event.target.value); };\n default:\n return;\n }\n };\n class_3.prototype.setFieldValue = function (field, formAttributes) {\n switch (field.type) {\n case 'username':\n case 'email':\n if (field.value === undefined) {\n formAttributes.userInput = '';\n }\n else {\n formAttributes.userInput = field.value;\n }\n break;\n case 'phone_number':\n if (field.dialCode) {\n this.phoneNumber.countryDialCodeValue = field.dialCode;\n }\n this.phoneNumber.phoneNumberValue = field.value;\n break;\n case 'password':\n case 'code':\n if (field.value === undefined) {\n formAttributes[field.type] = '';\n }\n else {\n formAttributes[field.type] = field.value;\n }\n break;\n }\n };\n class_3.prototype.handleFormFieldInputWithCallback = function (event, field) {\n var fnToCall = field['handleInputChange']\n ? field['handleInputChange']\n : function (event, cb) {\n cb(event);\n };\n var callback = this.handleFormFieldInputChange(field.type);\n fnToCall(event, callback.bind(this));\n };\n class_3.prototype.send = function (event) {\n return __awaiter(this, void 0, void 0, function () {\n var data, error_4;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (event) {\n event.preventDefault();\n }\n if (!Auth || typeof Auth.forgotPassword !== 'function') {\n throw new Error(NO_AUTH_MODULE_FOUND);\n }\n this.loading = true;\n switch (this.usernameAlias) {\n case 'phone_number':\n try {\n this.forgotPasswordAttrs.userInput = composePhoneNumberInput(this.phoneNumber);\n }\n catch (error) {\n dispatchToastHubEvent(error);\n }\n break;\n }\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, 4, 5]);\n return [4 /*yield*/, Auth.forgotPassword(this.forgotPasswordAttrs.userInput.trim())];\n case 2:\n data = _a.sent();\n logger.debug(data);\n this.newFormFields = [\n {\n type: 'code',\n required: true,\n handleInputChange: this.handleFormFieldInputChange('code'),\n inputProps: {\n 'data-test': 'forgot-password-code-input',\n },\n },\n {\n type: 'password',\n required: true,\n handleInputChange: this.handleFormFieldInputChange('password'),\n label: I18n.get(Translations.NEW_PASSWORD_LABEL),\n placeholder: I18n.get(Translations.NEW_PASSWORD_PLACEHOLDER),\n },\n ];\n this.delivery = data.CodeDeliveryDetails;\n return [3 /*break*/, 5];\n case 3:\n error_4 = _a.sent();\n dispatchToastHubEvent(error_4);\n return [3 /*break*/, 5];\n case 4:\n this.loading = false;\n return [7 /*endfinally*/];\n case 5: return [2 /*return*/];\n }\n });\n });\n };\n class_3.prototype.submit = function (event) {\n return __awaiter(this, void 0, void 0, function () {\n var _a, userInput, code, password, data, error_5;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n if (event) {\n event.preventDefault();\n }\n if (!Auth || typeof Auth.forgotPasswordSubmit !== 'function') {\n throw new Error(NO_AUTH_MODULE_FOUND);\n }\n this.loading = true;\n _b.label = 1;\n case 1:\n _b.trys.push([1, 3, 4, 5]);\n _a = this.forgotPasswordAttrs, userInput = _a.userInput, code = _a.code, password = _a.password;\n return [4 /*yield*/, Auth.forgotPasswordSubmit(userInput.trim(), code, password)];\n case 2:\n data = _b.sent();\n logger.debug(data);\n this.handleAuthStateChange(AuthState.SignIn);\n this.delivery = null;\n return [3 /*break*/, 5];\n case 3:\n error_5 = _b.sent();\n dispatchToastHubEvent(error_5);\n return [3 /*break*/, 5];\n case 4:\n this.loading = false;\n return [7 /*endfinally*/];\n case 5: return [2 /*return*/];\n }\n });\n });\n };\n class_3.prototype.render = function () {\n var _this = this;\n var submitFn = this.delivery\n ? function (event) { return _this.handleSubmit(event); }\n : function (event) { return _this.handleSend(event); };\n var submitButtonText = this.delivery\n ? this.submitButtonText\n : this.sendButtonText;\n return (h(Host, null, h(\"amplify-form-section\", { headerText: I18n.get(this.headerText), handleSubmit: submitFn, loading: this.loading, secondaryFooterContent: h(\"amplify-button\", { variant: \"anchor\", onClick: function () { return _this.handleAuthStateChange(AuthState.SignIn); }, \"data-test\": \"forgot-password-back-to-sign-in-link\" }, I18n.get(Translations.BACK_TO_SIGN_IN)), testDataPrefix: 'forgot-password', submitButtonText: I18n.get(submitButtonText) }, h(\"amplify-auth-fields\", { formFields: this.newFormFields }))));\n };\n Object.defineProperty(class_3, \"watchers\", {\n get: function () {\n return {\n \"formFields\": [\"formFieldsHandler\"]\n };\n },\n enumerable: false,\n configurable: true\n });\n return class_3;\n}());\nvar logger$1 = new ConsoleLogger('amplify-require-new-password');\nvar AmplifyRequireNewPassword = /** @class */ (function () {\n function class_4(hostRef) {\n var _this = this;\n registerInstance(this, hostRef);\n /** The header text of the forgot password section */\n this.headerText = Translations.CHANGE_PASSWORD;\n /** The text displayed inside of the submit button for the form */\n this.submitButtonText = Translations.CHANGE_PASSWORD_ACTION;\n /** The function called when submitting a new password */\n this.handleSubmit = function (event) { return _this.completeNewPassword(event); };\n /** Auth state change handler for this component */\n this.handleAuthStateChange = dispatchAuthStateChangeEvent;\n /** The form fields displayed inside of the forgot password form */\n this.formFields = [\n {\n type: AuthFormField.Password,\n required: true,\n handleInputChange: function (event) { return _this.handlePasswordChange(event); },\n label: I18n.get(Translations.NEW_PASSWORD_LABEL),\n placeholder: I18n.get(Translations.NEW_PASSWORD_PLACEHOLDER),\n inputProps: {\n 'data-test': 'require-new-password-password-input',\n },\n },\n ];\n this.loading = false;\n this.requiredAttributes = {};\n this.newFormFields = this.formFields;\n this.phoneNumber = {\n countryDialCodeValue: COUNTRY_DIAL_CODE_DEFAULT,\n phoneNumberValue: ' ',\n };\n }\n class_4.prototype.userHandler = function () {\n this.setCurrentUser();\n };\n class_4.prototype.handleRequiredAttributeInputChange = function (attribute, event) {\n if (attribute === 'phone_number') {\n this.formatPhoneNumber(event);\n }\n else {\n this.requiredAttributes[attribute] = event.target.value;\n }\n };\n class_4.prototype.setCurrentUser = function () {\n return __awaiter(this, void 0, void 0, function () {\n var user, error_6, userRequiredAttributes, requiredAttributesMap_1;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!!this.user) return [3 /*break*/, 5];\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n return [4 /*yield*/, Auth.currentAuthenticatedUser()];\n case 2:\n user = _a.sent();\n if (user)\n this.currentUser = user;\n return [3 /*break*/, 4];\n case 3:\n error_6 = _a.sent();\n dispatchToastHubEvent(error_6);\n return [3 /*break*/, 4];\n case 4: return [3 /*break*/, 6];\n case 5:\n this.currentUser = this.user;\n _a.label = 6;\n case 6:\n if (this.currentUser &&\n this.currentUser.challengeParam &&\n this.currentUser.challengeParam.requiredAttributes) {\n userRequiredAttributes = this.currentUser.challengeParam\n .requiredAttributes;\n requiredAttributesMap_1 = getRequiredAttributesMap();\n userRequiredAttributes.forEach(function (attribute) {\n var formField = {\n type: attribute,\n required: true,\n label: requiredAttributesMap_1[attribute].label,\n placeholder: requiredAttributesMap_1[attribute].placeholder,\n handleInputChange: function (event) { return _this.handleRequiredAttributeInputChange(attribute, event); },\n inputProps: {\n 'data-test': \"require-new-password-\" + attribute + \"-input\",\n },\n };\n _this.newFormFields = __spreadArrays(_this.newFormFields, [formField]);\n });\n }\n return [2 /*return*/];\n }\n });\n });\n };\n class_4.prototype.componentWillLoad = function () {\n return this.setCurrentUser();\n };\n class_4.prototype.handlePasswordChange = function (event) {\n this.password = event.target.value;\n };\n class_4.prototype.formatPhoneNumber = function (event) {\n handlePhoneNumberChange(event, this.phoneNumber);\n /**\n * composePhoneNumberInput will throw an error if the phoneNumberValue it receives\n * is empty. Adding a check here to try and make sure that doesn't happen...but will\n * wrap it in a try/catch block just in case as well\n */\n try {\n if (event.target.name === PHONE_SUFFIX &&\n this.phoneNumber.phoneNumberValue) {\n var composedInput = composePhoneNumberInput(this.phoneNumber);\n this.requiredAttributes['phone_number'] = composedInput;\n }\n }\n catch (err) {\n logger$1.error(\"error in phone number field - \" + err);\n }\n };\n class_4.prototype.completeNewPassword = function (event) {\n return __awaiter(this, void 0, void 0, function () {\n var user, _a, error_7;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n if (event) {\n event.preventDefault();\n }\n if (!Auth || typeof Auth.completeNewPassword !== 'function') {\n throw new Error(NO_AUTH_MODULE_FOUND);\n }\n this.loading = true;\n _b.label = 1;\n case 1:\n _b.trys.push([1, 8, 9, 10]);\n return [4 /*yield*/, Auth.completeNewPassword(this.currentUser, this.password, this.requiredAttributes)];\n case 2:\n user = _b.sent();\n logger$1.debug('complete new password', user);\n _a = user.challengeName;\n switch (_a) {\n case ChallengeName.SMSMFA: return [3 /*break*/, 3];\n case ChallengeName.MFASetup: return [3 /*break*/, 4];\n }\n return [3 /*break*/, 5];\n case 3:\n this.handleAuthStateChange(AuthState.ConfirmSignIn, user);\n return [3 /*break*/, 7];\n case 4:\n logger$1.debug('TOTP setup', user.challengeParam);\n this.handleAuthStateChange(AuthState.TOTPSetup, user);\n return [3 /*break*/, 7];\n case 5: return [4 /*yield*/, checkContact(user, this.handleAuthStateChange)];\n case 6:\n _b.sent();\n _b.label = 7;\n case 7: return [3 /*break*/, 10];\n case 8:\n error_7 = _b.sent();\n dispatchToastHubEvent(error_7);\n return [3 /*break*/, 10];\n case 9:\n this.loading = false;\n return [7 /*endfinally*/];\n case 10: return [2 /*return*/];\n }\n });\n });\n };\n class_4.prototype.render = function () {\n var _this = this;\n return (h(Host, null, h(\"amplify-form-section\", { headerText: I18n.get(this.headerText), handleSubmit: this.handleSubmit, loading: this.loading, secondaryFooterContent: h(\"amplify-button\", { variant: \"anchor\", onClick: function () { return _this.handleAuthStateChange(AuthState.SignIn); } }, I18n.get(Translations.BACK_TO_SIGN_IN)), submitButtonText: I18n.get(this.submitButtonText) }, h(\"amplify-auth-fields\", { formFields: this.newFormFields }))));\n };\n Object.defineProperty(class_4, \"watchers\", {\n get: function () {\n return {\n \"user\": [\"userHandler\"]\n };\n },\n enumerable: false,\n configurable: true\n });\n return class_4;\n}());\nvar amplifySignInCss = \":host{--footer-size:var(--amplify-text-sm);--footer-color:var(--amplify-grey);--footer-font-family:var(--amplify-font-family);--font-weight:var(--amplify-font-weight)}.sign-in-form-footer{font-family:var(--footer-font-family);font-size:var(--footer-size);color:var(--footer-color);font-weight:--font-weight;display:-ms-flexbox;display:flex;-ms-flex-direction:column-reverse;flex-direction:column-reverse;-ms-flex-align:center;align-items:center;-ms-flex-pack:distribute;justify-content:space-around}.sign-in-form-footer amplify-button{margin-bottom:0.625rem}@media (min-width: 672px){.sign-in-form-footer{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:baseline;align-items:baseline}.sign-in-form-footer amplify-button{margin-bottom:0}}.sign-in-form-footer *+*{margin-bottom:15px}.full-width-footer-content{width:100%}\";\nvar AmplifySignIn = /** @class */ (function () {\n function class_5(hostRef) {\n var _this = this;\n registerInstance(this, hostRef);\n /** Fires when sign in form is submitted */\n this.handleSubmit = function (event) { return _this.signIn(event); };\n /** Used for header text in sign in component */\n this.headerText = Translations.SIGN_IN_HEADER_TEXT;\n /** Used for the submit button text in sign in component */\n this.submitButtonText = Translations.SIGN_IN_ACTION;\n /** Auth state change handler for this component */\n // prettier-ignore\n this.handleAuthStateChange = dispatchAuthStateChangeEvent;\n /** Username Alias is used to setup authentication with `username`, `email` or `phone_number` */\n this.usernameAlias = 'username';\n /**\n * Form fields allows you to utilize our pre-built components such as username field, code field, password field, email field, etc.\n * by passing an array of strings that you would like the order of the form to be in. If you need more customization, such as changing\n * text for a label or adjust a placeholder, you can follow the structure below in order to do just that.\n * ```\n * [\n * {\n * type: string,\n * label: string,\n * placeholder: string,\n * hint: string | Functional Component | null,\n * required: boolean\n * }\n * ]\n * ```\n */\n this.formFields = [];\n /** Hides the sign up link */\n this.hideSignUp = false;\n this.newFormFields = [];\n /* Whether or not the sign-in component is loading */\n this.loading = false;\n this.phoneNumber = {\n countryDialCodeValue: COUNTRY_DIAL_CODE_DEFAULT,\n phoneNumberValue: null,\n };\n this.signInAttributes = {\n userInput: '',\n password: '',\n };\n }\n class_5.prototype.componentWillLoad = function () {\n checkUsernameAlias(this.usernameAlias);\n this.buildFormFields();\n };\n class_5.prototype.formFieldsHandler = function () {\n this.buildFormFields();\n };\n class_5.prototype.handleFormFieldInputChange = function (fieldType) {\n var _this = this;\n switch (fieldType) {\n case 'username':\n case 'email':\n return function (event) { return (_this.signInAttributes.userInput = event.target.value); };\n case 'phone_number':\n return function (event) { return handlePhoneNumberChange(event, _this.phoneNumber); };\n case 'password':\n return function (event) { return (_this.signInAttributes.password = event.target.value); };\n default:\n return function () { };\n }\n };\n class_5.prototype.handleFormFieldInputWithCallback = function (event, field) {\n var fnToCall = field['handleInputChange']\n ? field['handleInputChange']\n : function (event, cb) {\n cb(event);\n };\n var callback = this.handleFormFieldInputChange(field.type);\n fnToCall(event, callback.bind(this));\n };\n class_5.prototype.signIn = function (event) {\n return __awaiter(this, void 0, void 0, function () {\n var username;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n // avoid submitting the form\n if (event) {\n event.preventDefault();\n }\n this.loading = true;\n switch (this.usernameAlias) {\n case 'phone_number':\n try {\n this.signInAttributes.userInput = composePhoneNumberInput(this.phoneNumber);\n }\n catch (error) {\n dispatchToastHubEvent(error);\n }\n }\n username = this.signInAttributes.userInput.trim();\n return [4 /*yield*/, handleSignIn(username, this.signInAttributes.password, this.handleAuthStateChange, this.usernameAlias)];\n case 1:\n _a.sent();\n this.loading = false;\n return [2 /*return*/];\n }\n });\n });\n };\n class_5.prototype.buildDefaultFormFields = function () {\n var _this = this;\n var formFieldInputs = [];\n switch (this.usernameAlias) {\n case 'email':\n formFieldInputs.push({\n type: 'email',\n required: true,\n handleInputChange: this.handleFormFieldInputChange('email'),\n inputProps: {\n 'data-test': 'sign-in-email-input',\n autocomplete: 'username',\n },\n });\n break;\n case 'phone_number':\n formFieldInputs.push({\n type: 'phone_number',\n required: true,\n handleInputChange: this.handleFormFieldInputChange('phone_number'),\n inputProps: {\n 'data-test': 'sign-in-phone-number-input',\n autocomplete: 'username',\n },\n });\n break;\n case 'username':\n default:\n formFieldInputs.push({\n type: 'username',\n required: true,\n handleInputChange: this.handleFormFieldInputChange('username'),\n inputProps: {\n 'data-test': 'sign-in-username-input',\n autocomplete: 'username',\n },\n });\n break;\n }\n formFieldInputs.push({\n type: 'password',\n hint: (h(\"div\", null, I18n.get(Translations.FORGOT_PASSWORD_TEXT), ' ', h(\"amplify-button\", { variant: \"anchor\", onClick: function () { return _this.handleAuthStateChange(AuthState.ForgotPassword); }, \"data-test\": \"sign-in-forgot-password-link\" }, I18n.get(Translations.RESET_PASSWORD_TEXT)))),\n required: true,\n handleInputChange: this.handleFormFieldInputChange('password'),\n inputProps: {\n 'data-test': 'sign-in-password-input',\n },\n });\n this.newFormFields = __spreadArrays(formFieldInputs);\n };\n class_5.prototype.buildFormFields = function () {\n var _this = this;\n if (this.formFields.length === 0) {\n this.buildDefaultFormFields();\n }\n else {\n var newFields_3 = [];\n this.formFields.forEach(function (field) {\n var newField = Object.assign({}, field);\n // TODO: handle hint better\n if (newField.type === 'password') {\n newField['hint'] = isHintValid(newField) ? (h(\"div\", null, I18n.get(Translations.FORGOT_PASSWORD_TEXT), ' ', h(\"amplify-button\", { variant: \"anchor\", onClick: function () { return _this.handleAuthStateChange(AuthState.ForgotPassword); }, \"data-test\": \"sign-in-forgot-password-link\" }, I18n.get(Translations.RESET_PASSWORD_TEXT)))) : (newField['hint']);\n }\n newField['handleInputChange'] = function (event) { return _this.handleFormFieldInputWithCallback(event, field); };\n _this.setFieldValue(newField, _this.signInAttributes);\n newFields_3.push(newField);\n });\n this.newFormFields = newFields_3;\n }\n };\n class_5.prototype.setFieldValue = function (field, formAttributes) {\n switch (field.type) {\n case 'username':\n case 'email':\n if (field.value === undefined) {\n formAttributes.userInput = '';\n }\n else {\n formAttributes.userInput = field.value;\n }\n break;\n case 'phone_number':\n if (field.dialCode) {\n this.phoneNumber.countryDialCodeValue = field.dialCode;\n }\n this.phoneNumber.phoneNumberValue = field.value;\n break;\n case 'password':\n if (field.value === undefined) {\n formAttributes.password = '';\n }\n else {\n formAttributes.password = field.value;\n }\n break;\n }\n };\n class_5.prototype.render = function () {\n var _this = this;\n return (h(Host, null, h(\"amplify-form-section\", { headerText: I18n.get(this.headerText), handleSubmit: this.handleSubmit, testDataPrefix: 'sign-in' }, h(\"div\", { slot: \"subtitle\" }, h(\"slot\", { name: \"header-subtitle\" })), h(\"slot\", { name: \"federated-buttons\" }, h(\"amplify-federated-buttons\", { handleAuthStateChange: this.handleAuthStateChange, federated: this.federated })), !isEmpty(this.federated) && h(\"amplify-strike\", null, \"or\"), h(\"amplify-auth-fields\", { formFields: this.newFormFields }), h(\"div\", { slot: \"amplify-form-section-footer\", class: \"sign-in-form-footer\" }, h(\"slot\", { name: \"footer\" }, !this.hideSignUp && (h(\"slot\", { name: \"secondary-footer-content\" }, h(\"span\", null, I18n.get(Translations.NO_ACCOUNT_TEXT), ' ', h(\"amplify-button\", { variant: \"anchor\", onClick: function () { return _this.handleAuthStateChange(AuthState.SignUp); }, \"data-test\": \"sign-in-create-account-link\" }, I18n.get(Translations.CREATE_ACCOUNT_TEXT))))), h(\"div\", { class: this.hideSignUp ? 'full-width-footer-content' : '' }, h(\"slot\", { name: \"primary-footer-content\" }, h(\"amplify-button\", { type: \"submit\", disabled: this.loading, \"data-test\": \"sign-in-sign-in-button\" }, this.loading ? (h(\"amplify-loading-spinner\", null)) : (h(\"span\", null, I18n.get(this.submitButtonText)))))))))));\n };\n Object.defineProperty(class_5, \"watchers\", {\n get: function () {\n return {\n \"formFields\": [\"formFieldsHandler\"]\n };\n },\n enumerable: false,\n configurable: true\n });\n return class_5;\n}());\nAmplifySignIn.style = amplifySignInCss;\nvar amplifySignUpCss = \"amplify-sign-up{--footer-font-family:var(--amplify-font-family);--footer-font-size:var(--amplify-text-sm);--footer-color:var(--amplify-grey);--font-weight:var(--amplify-font-weight)}.sign-up-form-footer{font-family:var(--footer-font-family);font-size:var(--footer-font-size);color:var(--footer-color);font-weight:--font-weight;display:-ms-flexbox;display:flex;-ms-flex-direction:column-reverse;flex-direction:column-reverse;-ms-flex-align:center;align-items:center;-ms-flex-pack:distribute;justify-content:space-around}.sign-up-form-footer amplify-button{margin-bottom:0.625rem}@media (min-width: 672px){.sign-up-form-footer{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:baseline;align-items:baseline}.sign-up-form-footer amplify-button{margin-bottom:0}}.sign-up-form-footer *+*{margin-bottom:15px}\";\nvar AmplifySignUp = /** @class */ (function () {\n function class_6(hostRef) {\n var _this = this;\n registerInstance(this, hostRef);\n /** Fires when sign up form is submitted */\n this.handleSubmit = function (event) { return _this.signUp(event); };\n /** Override for handling the Auth.SignUp API call */\n this.handleSignUp = function (params) { return _this.authSignUp(params); };\n /** Used for header text in sign up component */\n this.headerText = Translations.SIGN_UP_HEADER_TEXT;\n /** Used for the submit button text in sign up component */\n this.submitButtonText = Translations.SIGN_UP_SUBMIT_BUTTON_TEXT;\n /** Used for the submit button text in sign up component */\n this.haveAccountText = Translations.SIGN_UP_HAVE_ACCOUNT_TEXT;\n /** Text used for the sign in hyperlink */\n this.signInText = Translations.SIGN_IN_TEXT;\n /**\n * Form fields allows you to utilize our pre-built components such as username field, code field, password field, email field, etc.\n * by passing an array of strings that you would like the order of the form to be in. If you need more customization, such as changing\n * text for a label or adjust a placeholder, you can follow the structure below in order to do just that.\n * ```\n * [\n * {\n * type: string,\n * label: string,\n * placeholder: string,\n * hint: string | Functional Component | null,\n * required: boolean\n * }\n * ]\n * ```\n */\n this.formFields = [];\n /** Auth state change handler for this component\n * e.g. SignIn -> 'Create Account' link -> SignUp\n */\n // prettier-ignore\n this.handleAuthStateChange = dispatchAuthStateChangeEvent;\n /** Username Alias is used to setup authentication with `username`, `email` or `phone_number` */\n this.usernameAlias = 'username';\n // private userInput: string | PhoneNumberInterface;\n this.newFormFields = [];\n this.phoneNumber = {\n countryDialCodeValue: COUNTRY_DIAL_CODE_DEFAULT,\n phoneNumberValue: null,\n };\n this.loading = false;\n this.signUpAttributes = {\n username: '',\n password: '',\n attributes: {},\n };\n }\n class_6.prototype.handleFormFieldInputChange = function (fieldType) {\n var _this = this;\n switch (fieldType) {\n case 'username':\n return function (event) { return (_this.signUpAttributes.username = event.target.value); };\n case 'password':\n return function (event) { return (_this.signUpAttributes.password = event.target.value); };\n case 'email':\n return function (event) { return (_this.signUpAttributes.attributes.email = event.target.value); };\n case 'phone_number':\n return function (event) { return handlePhoneNumberChange(event, _this.phoneNumber); };\n default:\n return function (event) { return (_this.signUpAttributes.attributes[fieldType] = event.target.value); };\n }\n };\n class_6.prototype.handleFormFieldInputWithCallback = function (event, field) {\n var fnToCall = field['handleInputChange']\n ? field['handleInputChange']\n : function (event, cb) {\n cb(event);\n };\n var callback = this.handleFormFieldInputChange(field.type);\n fnToCall(event, callback.bind(this));\n };\n class_6.prototype.authSignUp = function (params) {\n return __awaiter(this, void 0, void 0, function () {\n var data;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, Auth.signUp(params)];\n case 1:\n data = _a.sent();\n if (!data) {\n throw new Error(Translations.SIGN_UP_FAILED);\n }\n return [2 /*return*/, data];\n }\n });\n });\n };\n class_6.prototype.assignPhoneNumberToSignUpAttributes = function () {\n if (this.phoneNumber.phoneNumberValue) {\n try {\n this.signUpAttributes.attributes.phone_number = composePhoneNumberInput(this.phoneNumber);\n }\n catch (error) {\n dispatchToastHubEvent(error);\n }\n }\n };\n class_6.prototype.assignUserNameAliasToSignUpAttributes = function () {\n switch (this.usernameAlias) {\n case 'email':\n case 'phone_number':\n this.signUpAttributes.username = this.signUpAttributes.attributes[this.usernameAlias];\n break;\n }\n };\n class_6.prototype.assignFormInputToSignUpAttributes = function () {\n this.assignPhoneNumberToSignUpAttributes();\n this.assignUserNameAliasToSignUpAttributes();\n };\n class_6.prototype.validateSignUpAttributes = function () {\n if (!this.signUpAttributes.username) {\n if (this.usernameAlias === UsernameAlias.email) {\n throw new Error(Translations.EMPTY_EMAIL);\n }\n else if (this.usernameAlias === UsernameAlias.phone_number) {\n throw new Error(Translations.EMPTY_PHONE);\n }\n else {\n throw new Error(Translations.EMPTY_USERNAME);\n }\n }\n if (this.signUpAttributes.username.indexOf(' ') >= 0) {\n throw new Error(Translations.USERNAME_REMOVE_WHITESPACE);\n }\n if (this.signUpAttributes.password !== this.signUpAttributes.password.trim()) {\n throw new Error(Translations.PASSWORD_REMOVE_WHITESPACE);\n }\n };\n // TODO: Add validation\n // TODO: Prefix\n class_6.prototype.signUp = function (event) {\n return __awaiter(this, void 0, void 0, function () {\n var data, signUpAttrs, error_8;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (event) {\n event.preventDefault();\n }\n if (!Auth || typeof Auth.signUp !== 'function') {\n throw new Error(NO_AUTH_MODULE_FOUND);\n }\n this.loading = true;\n this.assignFormInputToSignUpAttributes();\n _a.label = 1;\n case 1:\n _a.trys.push([1, 6, 7, 8]);\n this.validateSignUpAttributes();\n return [4 /*yield*/, this.handleSignUp(this.signUpAttributes)];\n case 2:\n data = _a.sent();\n if (!data.userConfirmed) return [3 /*break*/, 4];\n return [4 /*yield*/, handleSignIn(this.signUpAttributes.username, this.signUpAttributes.password, this.handleAuthStateChange)];\n case 3:\n _a.sent();\n return [3 /*break*/, 5];\n case 4:\n signUpAttrs = Object.assign({}, this.signUpAttributes);\n this.handleAuthStateChange(AuthState.ConfirmSignUp, Object.assign(Object.assign({}, data.user), { signUpAttrs: signUpAttrs }));\n _a.label = 5;\n case 5: return [3 /*break*/, 8];\n case 6:\n error_8 = _a.sent();\n dispatchToastHubEvent(error_8);\n return [3 /*break*/, 8];\n case 7:\n this.loading = false;\n return [7 /*endfinally*/];\n case 8: return [2 /*return*/];\n }\n });\n });\n };\n class_6.prototype.buildDefaultFormFields = function () {\n switch (this.usernameAlias) {\n case 'email':\n this.newFormFields = [\n {\n type: 'email',\n placeholder: I18n.get(Translations.SIGN_UP_EMAIL_PLACEHOLDER),\n required: true,\n handleInputChange: this.handleFormFieldInputChange('email'),\n inputProps: {\n 'data-test': 'sign-up-email-input',\n autocomplete: 'username',\n },\n },\n {\n type: 'password',\n placeholder: I18n.get(Translations.SIGN_UP_PASSWORD_PLACEHOLDER),\n required: true,\n handleInputChange: this.handleFormFieldInputChange('password'),\n inputProps: {\n 'data-test': 'sign-up-password-input',\n autocomplete: 'new-password',\n },\n },\n {\n type: 'phone_number',\n required: true,\n handleInputChange: this.handleFormFieldInputChange('phone_number'),\n inputProps: {\n 'data-test': 'sign-up-phone-number-input',\n autocomplete: 'tel-national',\n },\n },\n ];\n break;\n case 'phone_number':\n this.newFormFields = [\n {\n type: 'phone_number',\n required: true,\n handleInputChange: this.handleFormFieldInputChange('phone_number'),\n inputProps: {\n 'data-test': 'sign-up-phone-number-input',\n autocomplete: 'username',\n },\n },\n {\n type: 'password',\n placeholder: I18n.get(Translations.SIGN_UP_PASSWORD_PLACEHOLDER),\n required: true,\n handleInputChange: this.handleFormFieldInputChange('password'),\n inputProps: {\n 'data-test': 'sign-up-password-input',\n autocomplete: 'new-password',\n },\n },\n {\n type: 'email',\n placeholder: I18n.get(Translations.SIGN_UP_EMAIL_PLACEHOLDER),\n required: true,\n handleInputChange: this.handleFormFieldInputChange('email'),\n inputProps: {\n 'data-test': 'sign-up-email-input',\n autocomplete: 'email',\n },\n },\n ];\n break;\n case 'username':\n default:\n this.newFormFields = [\n {\n type: 'username',\n placeholder: I18n.get(Translations.SIGN_UP_USERNAME_PLACEHOLDER),\n required: true,\n handleInputChange: this.handleFormFieldInputChange('username'),\n inputProps: {\n 'data-test': 'sign-up-username-input',\n autocomplete: 'username',\n },\n },\n {\n type: 'password',\n placeholder: I18n.get(Translations.SIGN_UP_PASSWORD_PLACEHOLDER),\n required: true,\n handleInputChange: this.handleFormFieldInputChange('password'),\n inputProps: {\n 'data-test': 'sign-up-password-input',\n autocomplete: 'new-password',\n },\n },\n {\n type: 'email',\n placeholder: I18n.get(Translations.SIGN_UP_EMAIL_PLACEHOLDER),\n required: true,\n handleInputChange: this.handleFormFieldInputChange('email'),\n inputProps: {\n 'data-test': 'sign-up-email-input',\n },\n },\n {\n type: 'phone_number',\n required: true,\n handleInputChange: this.handleFormFieldInputChange('phone_number'),\n inputProps: {\n 'data-test': 'sign-up-phone-number-input',\n },\n },\n ];\n break;\n }\n };\n class_6.prototype.buildFormFields = function () {\n var _this = this;\n if (this.formFields.length === 0) {\n this.buildDefaultFormFields();\n }\n else {\n var newFields_4 = [];\n this.formFields.forEach(function (field) {\n var newField = Object.assign({}, field);\n newField['handleInputChange'] = function (event) { return _this.handleFormFieldInputWithCallback(event, field); };\n _this.setFieldValue(field, _this.signUpAttributes);\n newFields_4.push(newField);\n });\n this.newFormFields = newFields_4;\n }\n };\n class_6.prototype.setFieldValue = function (field, formAttributes) {\n switch (field.type) {\n case 'username':\n if (field.value === undefined) {\n formAttributes.username = '';\n }\n else {\n formAttributes.username = field.value;\n }\n break;\n case 'password':\n if (field.value === undefined) {\n formAttributes.password = '';\n }\n else {\n formAttributes.password = field.value;\n }\n break;\n case 'email':\n formAttributes.attributes.email = field.value;\n break;\n case 'phone_number':\n if (field.dialCode) {\n this.phoneNumber.countryDialCodeValue = field.dialCode;\n }\n this.phoneNumber.phoneNumberValue = field.value;\n break;\n default:\n formAttributes.attributes[field.type] = field.value;\n break;\n }\n };\n class_6.prototype.componentWillLoad = function () {\n checkUsernameAlias(this.usernameAlias);\n this.buildFormFields();\n };\n class_6.prototype.formFieldsHandler = function () {\n this.buildFormFields();\n };\n class_6.prototype.render = function () {\n var _this = this;\n return (h(Host, null, h(\"amplify-form-section\", { headerText: I18n.get(this.headerText), handleSubmit: this.handleSubmit, testDataPrefix: 'sign-up' }, h(\"div\", { slot: \"subtitle\" }, h(\"slot\", { name: \"header-subtitle\" })), h(\"amplify-auth-fields\", { formFields: this.newFormFields }), h(\"div\", { class: \"sign-up-form-footer\", slot: \"amplify-form-section-footer\" }, h(\"slot\", { name: \"footer\" }, h(\"slot\", { name: \"secondary-footer-content\" }, h(\"span\", null, I18n.get(this.haveAccountText), ' ', h(\"amplify-button\", { variant: \"anchor\", onClick: function () { return _this.handleAuthStateChange(AuthState.SignIn); }, \"data-test\": \"sign-up-sign-in-link\" }, I18n.get(this.signInText)))), h(\"slot\", { name: \"primary-footer-content\" }, h(\"amplify-button\", { type: \"submit\", \"data-test\": \"sign-up-create-account-button\", disabled: this.loading }, this.loading ? (h(\"amplify-loading-spinner\", null)) : (h(\"span\", null, I18n.get(this.submitButtonText))))))))));\n };\n Object.defineProperty(class_6, \"watchers\", {\n get: function () {\n return {\n \"formFields\": [\"formFieldsHandler\"]\n };\n },\n enumerable: false,\n configurable: true\n });\n return class_6;\n}());\nAmplifySignUp.style = amplifySignUpCss;\nvar logger$2 = new Logger('AmplifyVerifyContact');\nvar AmplifyVerifyContact = /** @class */ (function () {\n function class_7(hostRef) {\n registerInstance(this, hostRef);\n /** Authentication state handler */\n this.handleAuthStateChange = dispatchAuthStateChangeEvent;\n this.loading = false;\n }\n class_7.prototype.handleSubmit = function (event) {\n event.preventDefault();\n this.verifyAttr ? this.submit(this.code) : this.verify(this.contact);\n };\n class_7.prototype.submit = function (code) {\n return __awaiter(this, void 0, void 0, function () {\n var attr, data, error_9;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n attr = this.verifyAttr;\n if (!Auth || typeof Auth.verifyCurrentUserAttributeSubmit !== 'function') {\n throw new Error(NO_AUTH_MODULE_FOUND);\n }\n this.loading = true;\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, 4, 5]);\n return [4 /*yield*/, Auth.verifyCurrentUserAttributeSubmit(attr, code)];\n case 2:\n data = _a.sent();\n logger$2.debug(data);\n this.handleAuthStateChange(AuthState.SignedIn, this.user);\n this.verifyAttr = null;\n return [3 /*break*/, 5];\n case 3:\n error_9 = _a.sent();\n dispatchToastHubEvent(error_9);\n logger$2.error(error_9);\n return [3 /*break*/, 5];\n case 4:\n this.loading = false;\n return [7 /*endfinally*/];\n case 5: return [2 /*return*/];\n }\n });\n });\n };\n class_7.prototype.verify = function (contact) {\n return __awaiter(this, void 0, void 0, function () {\n var data, error_10;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!contact) {\n logger$2.error('Neither Email nor Phone Number selected');\n return [2 /*return*/];\n }\n if (!Auth || typeof Auth.verifyCurrentUserAttribute !== 'function') {\n throw new Error(NO_AUTH_MODULE_FOUND);\n }\n this.loading = true;\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, 4, 5]);\n return [4 /*yield*/, Auth.verifyCurrentUserAttribute(contact)];\n case 2:\n data = _a.sent();\n logger$2.debug(data);\n this.verifyAttr = contact;\n return [3 /*break*/, 5];\n case 3:\n error_10 = _a.sent();\n dispatchToastHubEvent(error_10);\n logger$2.error(error_10);\n return [3 /*break*/, 5];\n case 4:\n this.loading = false;\n return [7 /*endfinally*/];\n case 5: return [2 /*return*/];\n }\n });\n });\n };\n class_7.prototype.handleInputChange = function (event) {\n var inputName = event.target.name;\n if (inputName === 'code') {\n this.code = event.target.value;\n }\n else if (inputName === 'contact') {\n this.contact = event.target.value;\n }\n };\n class_7.prototype.renderSubmit = function () {\n var _this = this;\n return (h(\"div\", null, h(\"amplify-input\", { inputProps: {\n autocomplete: 'off',\n 'data-test': 'verify-contact-code-input',\n }, name: \"code\", placeholder: I18n.get(Translations.CODE_PLACEHOLDER), handleInputChange: function (event) { return _this.handleInputChange(event); } })));\n };\n class_7.prototype.renderVerify = function () {\n var _this = this;\n var user = this.user;\n if (!user) {\n logger$2.debug('No user to verify');\n return null;\n }\n var unverified = user.unverified;\n if (!unverified) {\n logger$2.debug('Unverified variable does not exist on user');\n return null;\n }\n var email = unverified.email, phone_number = unverified.phone_number;\n return (h(\"div\", null, email && (h(\"amplify-radio-button\", { label: I18n.get(Translations.VERIFY_CONTACT_EMAIL_LABEL), key: \"email\", name: \"contact\", value: \"email\", handleInputChange: function (event) { return _this.handleInputChange(event); }, inputProps: {\n 'data-test': 'verify-contact-email-radio',\n } })), phone_number && (h(\"amplify-radio-button\", { label: I18n.get(Translations.VERIFY_CONTACT_PHONE_LABEL), key: \"phone_number\", name: \"contact\", value: \"phone_number\", handleInputChange: function (event) { return _this.handleInputChange(event); }, inputProps: {\n 'data-test': 'verify-contact-phone-number-radio',\n } }))));\n };\n class_7.prototype.render = function () {\n var _this = this;\n return (h(Host, null, h(\"amplify-form-section\", { handleSubmit: function (event) { return _this.handleSubmit(event); }, headerText: I18n.get(Translations.VERIFY_CONTACT_HEADER_TEXT), loading: this.loading, secondaryFooterContent: h(\"span\", null, h(\"amplify-button\", { variant: \"anchor\", onClick: function () { return _this.handleAuthStateChange(AuthState.SignedIn, _this.user); }, \"data-test\": \"verify-contact-skip-link\" }, \"Skip\")), submitButtonText: this.verifyAttr\n ? I18n.get(Translations.VERIFY_CONTACT_SUBMIT_LABEL)\n : I18n.get(Translations.VERIFY_CONTACT_VERIFY_LABEL) }, this.verifyAttr ? this.renderSubmit() : this.renderVerify())));\n };\n return class_7;\n}());\nexport { AmplifyConfirmSignIn as amplify_confirm_sign_in, AmplifyConfirmSignUp as amplify_confirm_sign_up, AmplifyForgotPassword as amplify_forgot_password, AmplifyRequireNewPassword as amplify_require_new_password, AmplifySignIn as amplify_sign_in, AmplifySignUp as amplify_sign_up, AmplifyVerifyContact as amplify_verify_contact };\n","var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nimport { Logger, isEmpty } from '@aws-amplify/core';\nimport { A as AuthState, C as ChallengeName, U as UsernameAlias } from './auth-types-78df304e.js';\nimport { Auth, CognitoUser } from '@aws-amplify/auth';\nimport { T as Translations } from './Translations-c833f663.js';\nimport { N as NO_AUTH_MODULE_FOUND } from './constants-c8ecaa24.js';\nimport { a as dispatchToastHubEvent } from './helpers-9703fe65.js';\nvar logger = new Logger('auth-helpers');\nfunction checkContact(user, handleAuthStateChange) {\n return __awaiter(this, void 0, void 0, function () {\n var data, newUser, error_1;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!Auth || typeof Auth.verifiedContact !== 'function') {\n throw new Error(NO_AUTH_MODULE_FOUND);\n }\n // If `user` is a federated user, we shouldn't call `verifiedContact`\n // since `user` isn't `CognitoUser`\n if (!isCognitoUser(user)) {\n handleAuthStateChange(AuthState.SignedIn, user);\n return [2 /*return*/];\n }\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n return [4 /*yield*/, Auth.verifiedContact(user)];\n case 2:\n data = _a.sent();\n if (!isEmpty(data.verified) || isEmpty(data.unverified)) {\n handleAuthStateChange(AuthState.SignedIn, user);\n }\n else {\n newUser = Object.assign(user, data);\n handleAuthStateChange(AuthState.VerifyContact, newUser);\n }\n return [3 /*break*/, 4];\n case 3:\n error_1 = _a.sent();\n dispatchToastHubEvent(error_1);\n return [3 /*break*/, 4];\n case 4: return [2 /*return*/];\n }\n });\n });\n}\nvar handleSignIn = function (username, password, handleAuthStateChange, usernameAlias) { return __awaiter(void 0, void 0, void 0, function () {\n var user, error_2;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!Auth || typeof Auth.signIn !== 'function') {\n throw new Error(NO_AUTH_MODULE_FOUND);\n }\n _a.label = 1;\n case 1:\n _a.trys.push([1, 9, , 10]);\n return [4 /*yield*/, Auth.signIn(username, password)];\n case 2:\n user = _a.sent();\n logger.debug(user);\n if (!(user.challengeName === ChallengeName.SMSMFA ||\n user.challengeName === ChallengeName.SoftwareTokenMFA)) return [3 /*break*/, 3];\n logger.debug('confirm user with ' + user.challengeName);\n handleAuthStateChange(AuthState.ConfirmSignIn, user);\n return [3 /*break*/, 8];\n case 3:\n if (!(user.challengeName === ChallengeName.NewPasswordRequired)) return [3 /*break*/, 4];\n logger.debug('require new password', user.challengeParam);\n handleAuthStateChange(AuthState.ResetPassword, user);\n return [3 /*break*/, 8];\n case 4:\n if (!(user.challengeName === ChallengeName.MFASetup)) return [3 /*break*/, 5];\n logger.debug('TOTP setup', user.challengeParam);\n handleAuthStateChange(AuthState.TOTPSetup, user);\n return [3 /*break*/, 8];\n case 5:\n if (!(user.challengeName === ChallengeName.CustomChallenge &&\n user.challengeParam &&\n user.challengeParam.trigger === 'true')) return [3 /*break*/, 6];\n logger.debug('custom challenge', user.challengeParam);\n handleAuthStateChange(AuthState.CustomConfirmSignIn, user);\n return [3 /*break*/, 8];\n case 6: return [4 /*yield*/, checkContact(user, handleAuthStateChange)];\n case 7:\n _a.sent();\n _a.label = 8;\n case 8: return [3 /*break*/, 10];\n case 9:\n error_2 = _a.sent();\n if (error_2.code === 'UserNotConfirmedException') {\n logger.debug('the user is not confirmed');\n handleAuthStateChange(AuthState.ConfirmSignUp, { username: username });\n }\n else if (error_2.code === 'PasswordResetRequiredException') {\n logger.debug('the user requires a new password');\n handleAuthStateChange(AuthState.ForgotPassword, { username: username });\n }\n else if (error_2.code === 'InvalidParameterException' && password === '') {\n logger.debug('Password cannot be empty');\n error_2.message = Translations.EMPTY_PASSWORD;\n }\n else if (error_2.message === Translations.EMPTY_USERNAME) {\n if (usernameAlias === UsernameAlias.email) {\n error_2.message = Translations.EMPTY_EMAIL;\n }\n if (usernameAlias === UsernameAlias.phone_number) {\n error_2.message = Translations.EMPTY_PHONE;\n }\n }\n dispatchToastHubEvent(error_2);\n return [3 /*break*/, 10];\n case 10: return [2 /*return*/];\n }\n });\n}); };\nvar isCognitoUser = function (user) {\n return user instanceof CognitoUser;\n};\nexport { checkContact as c, handleSignIn as h };\n"],"sourceRoot":""}