(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,536,10375,77236,37729,54087,87972,51343,e=>{"use strict";(t=T||(T={})).ConcurrentModificationException="ConcurrentModificationException",t.ForbiddenException="ForbiddenException",t.InternalErrorException="InternalErrorException",t.InvalidParameterException="InvalidParameterException",t.NotAuthorizedException="NotAuthorizedException",t.ResourceNotFoundException="ResourceNotFoundException",t.SoftwareTokenMFANotFoundException="SoftwareTokenMFANotFoundException",(n=N||(N={})).ForbiddenException="ForbiddenException",n.InternalErrorException="InternalErrorException",n.InvalidParameterException="InvalidParameterException",n.InvalidPasswordException="InvalidPasswordException",n.LimitExceededException="LimitExceededException",n.NotAuthorizedException="NotAuthorizedException",n.PasswordResetRequiredException="PasswordResetRequiredException",n.ResourceNotFoundException="ResourceNotFoundException",n.TooManyRequestsException="TooManyRequestsException",n.UserNotConfirmedException="UserNotConfirmedException",n.UserNotFoundException="UserNotFoundException",(o=f||(f={})).ForbiddenException="ForbiddenException",o.InternalErrorException="InternalErrorException",o.InvalidLambdaResponseException="InvalidLambdaResponseException",o.InvalidParameterException="InvalidParameterException",o.InvalidPasswordException="InvalidPasswordException",o.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",o.NotAuthorizedException="NotAuthorizedException",o.PasswordResetRequiredException="PasswordResetRequiredException",o.ResourceNotFoundException="ResourceNotFoundException",o.TooManyRequestsException="TooManyRequestsException",o.UsernameExistsException="UsernameExistsException",o.UserNotConfirmedException="UserNotConfirmedException",o.UserNotFoundException="UserNotFoundException",(i=y||(y={})).CodeMismatchException="CodeMismatchException",i.ExpiredCodeException="ExpiredCodeException",i.ForbiddenException="ForbiddenException",i.InternalErrorException="InternalErrorException",i.InvalidLambdaResponseException="InvalidLambdaResponseException",i.InvalidParameterException="InvalidParameterException",i.InvalidPasswordException="InvalidPasswordException",i.LimitExceededException="LimitExceededException",i.NotAuthorizedException="NotAuthorizedException",i.ResourceNotFoundException="ResourceNotFoundException",i.TooManyFailedAttemptsException="TooManyFailedAttemptsException",i.TooManyRequestsException="TooManyRequestsException",i.UnexpectedLambdaException="UnexpectedLambdaException",i.UserLambdaValidationException="UserLambdaValidationException",i.UserNotConfirmedException="UserNotConfirmedException",i.UserNotFoundException="UserNotFoundException",(r=U||(U={})).AliasExistsException="AliasExistsException",r.CodeMismatchException="CodeMismatchException",r.ExpiredCodeException="ExpiredCodeException",r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidLambdaResponseException="InvalidLambdaResponseException",r.InvalidParameterException="InvalidParameterException",r.LimitExceededException="LimitExceededException",r.NotAuthorizedException="NotAuthorizedException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyFailedAttemptsException="TooManyFailedAttemptsException",r.TooManyRequestsException="TooManyRequestsException",r.UnexpectedLambdaException="UnexpectedLambdaException",r.UserLambdaValidationException="UserLambdaValidationException",r.UserNotFoundException="UserNotFoundException",(a=F||(F={})).ForbiddenException="ForbiddenException",a.InternalErrorException="InternalErrorException",a.InvalidParameterException="InvalidParameterException",a.NotAuthorizedException="NotAuthorizedException",a.PasswordResetRequiredException="PasswordResetRequiredException",a.ResourceNotFoundException="ResourceNotFoundException",a.TooManyRequestsException="TooManyRequestsException",a.UserNotConfirmedException="UserNotConfirmedException",a.UserNotFoundException="UserNotFoundException",(s=_||(_={})).ForbiddenException="ForbiddenException",s.InternalErrorException="InternalErrorException",s.InvalidParameterException="InvalidParameterException",s.NotAuthorizedException="NotAuthorizedException",s.PasswordResetRequiredException="PasswordResetRequiredException",s.ResourceNotFoundException="ResourceNotFoundException",s.TooManyRequestsException="TooManyRequestsException",s.UserNotConfirmedException="UserNotConfirmedException",s.UserNotFoundException="UserNotFoundException",(c=w||(w={})).ForbiddenException="ForbiddenException",c.InternalErrorException="InternalErrorException",c.InvalidParameterException="InvalidParameterException",c.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",c.NotAuthorizedException="NotAuthorizedException",c.PasswordResetRequiredException="PasswordResetRequiredException",c.ResourceNotFoundException="ResourceNotFoundException",c.TooManyRequestsException="TooManyRequestsException",c.UserNotConfirmedException="UserNotConfirmedException",c.UserNotFoundException="UserNotFoundException",(l=D||(D={})).CodeDeliveryFailureException="CodeDeliveryFailureException",l.ForbiddenException="ForbiddenException",l.InternalErrorException="InternalErrorException",l.InvalidEmailRoleAccessPolicyException="InvalidEmailRoleAccessPolicyException",l.InvalidLambdaResponseException="InvalidLambdaResponseException",l.InvalidParameterException="InvalidParameterException",l.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",l.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",l.LimitExceededException="LimitExceededException",l.NotAuthorizedException="NotAuthorizedException",l.ResourceNotFoundException="ResourceNotFoundException",l.TooManyRequestsException="TooManyRequestsException",l.UnexpectedLambdaException="UnexpectedLambdaException",l.UserLambdaValidationException="UserLambdaValidationException",l.UserNotFoundException="UserNotFoundException",(d=M||(M={})).ForbiddenException="ForbiddenException",d.InternalErrorException="InternalErrorException",d.InvalidParameterException="InvalidParameterException",d.NotAuthorizedException="NotAuthorizedException",d.PasswordResetRequiredException="PasswordResetRequiredException",d.ResourceNotFoundException="ResourceNotFoundException",d.TooManyRequestsException="TooManyRequestsException",d.UserNotConfirmedException="UserNotConfirmedException",d.UserNotFoundException="UserNotFoundException",(E=O||(O={})).ExternalServiceException="ExternalServiceException",E.InternalErrorException="InternalErrorException",E.InvalidParameterException="InvalidParameterException",E.LimitExceededException="LimitExceededException",E.NotAuthorizedException="NotAuthorizedException",E.ResourceConflictException="ResourceConflictException",E.ResourceNotFoundException="ResourceNotFoundException",E.TooManyRequestsException="TooManyRequestsException",(p=b||(b={})).ExternalServiceException="ExternalServiceException",p.InternalErrorException="InternalErrorException",p.InvalidIdentityPoolConfigurationException="InvalidIdentityPoolConfigurationException",p.InvalidParameterException="InvalidParameterException",p.NotAuthorizedException="NotAuthorizedException",p.ResourceConflictException="ResourceConflictException",p.ResourceNotFoundException="ResourceNotFoundException",p.TooManyRequestsException="TooManyRequestsException",(u=L||(L={})).CodeDeliveryFailureException="CodeDeliveryFailureException",u.ForbiddenException="ForbiddenException",u.InternalErrorException="InternalErrorException",u.InvalidEmailRoleAccessPolicyException="InvalidEmailRoleAccessPolicyException",u.InvalidLambdaResponseException="InvalidLambdaResponseException",u.InvalidParameterException="InvalidParameterException",u.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",u.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",u.LimitExceededException="LimitExceededException",u.NotAuthorizedException="NotAuthorizedException",u.PasswordResetRequiredException="PasswordResetRequiredException",u.ResourceNotFoundException="ResourceNotFoundException",u.TooManyRequestsException="TooManyRequestsException",u.UnexpectedLambdaException="UnexpectedLambdaException",u.UserLambdaValidationException="UserLambdaValidationException",u.UserNotConfirmedException="UserNotConfirmedException",u.UserNotFoundException="UserNotFoundException",(h=V||(V={})).ForbiddenException="ForbiddenException",h.InternalErrorException="InternalErrorException",h.InvalidParameterException="InvalidParameterException",h.NotAuthorizedException="NotAuthorizedException",h.PasswordResetRequiredException="PasswordResetRequiredException",h.ResourceNotFoundException="ResourceNotFoundException",h.TooManyRequestsException="TooManyRequestsException",h.UserNotConfirmedException="UserNotConfirmedException",(x=k||(k={})).PasswordResetRequiredException="PasswordResetRequiredException",x.ForbiddenException="ForbiddenException",x.InternalErrorException="InternalErrorException",x.InvalidLambdaResponseException="InvalidLambdaResponseException",x.InvalidParameterException="InvalidParameterException",x.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",x.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",x.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",x.NotAuthorizedException="NotAuthorizedException",x.ResourceNotFoundException="ResourceNotFoundException",x.TooManyRequestsException="TooManyRequestsException",x.UnexpectedLambdaException="UnexpectedLambdaException",x.UserLambdaValidationException="UserLambdaValidationException",x.UserNotConfirmedException="UserNotConfirmedException",x.UserNotFoundException="UserNotFoundException",(g=B||(B={})).CodeDeliveryFailureException="CodeDeliveryFailureException",g.ForbiddenException="ForbiddenException",g.InternalErrorException="InternalErrorException",g.InvalidEmailRoleAccessPolicyException="InvalidEmailRoleAccessPolicyException",g.InvalidLambdaResponseException="InvalidLambdaResponseException",g.InvalidParameterException="InvalidParameterException",g.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",g.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",g.LimitExceededException="LimitExceededException",g.NotAuthorizedException="NotAuthorizedException",g.ResourceNotFoundException="ResourceNotFoundException",g.TooManyRequestsException="TooManyRequestsException",g.UnexpectedLambdaException="UnexpectedLambdaException",g.UserLambdaValidationException="UserLambdaValidationException",g.UserNotFoundException="UserNotFoundException",(S=q||(q={})).AliasExistsException="AliasExistsException",S.CodeMismatchException="CodeMismatchException",S.ExpiredCodeException="ExpiredCodeException",S.ForbiddenException="ForbiddenException",S.InternalErrorException="InternalErrorException",S.InvalidLambdaResponseException="InvalidLambdaResponseException",S.InvalidParameterException="InvalidParameterException",S.InvalidPasswordException="InvalidPasswordException",S.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",S.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",S.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",S.MFAMethodNotFoundException="MFAMethodNotFoundException",S.NotAuthorizedException="NotAuthorizedException",S.PasswordResetRequiredException="PasswordResetRequiredException",S.ResourceNotFoundException="ResourceNotFoundException",S.SoftwareTokenMFANotFoundException="SoftwareTokenMFANotFoundException",S.TooManyRequestsException="TooManyRequestsException",S.UnexpectedLambdaException="UnexpectedLambdaException",S.UserLambdaValidationException="UserLambdaValidationException",S.UserNotConfirmedException="UserNotConfirmedException",S.UserNotFoundException="UserNotFoundException",(A=H||(H={})).ForbiddenException="ForbiddenException",A.InternalErrorException="InternalErrorException",A.InvalidParameterException="InvalidParameterException",A.NotAuthorizedException="NotAuthorizedException",A.PasswordResetRequiredException="PasswordResetRequiredException",A.ResourceNotFoundException="ResourceNotFoundException",A.UserNotConfirmedException="UserNotConfirmedException",A.UserNotFoundException="UserNotFoundException",(m=W||(W={})).CodeDeliveryFailureException="CodeDeliveryFailureException",m.InternalErrorException="InternalErrorException",m.InvalidEmailRoleAccessPolicyException="InvalidEmailRoleAccessPolicyException",m.InvalidLambdaResponseException="InvalidLambdaResponseException",m.InvalidParameterException="InvalidParameterException",m.InvalidPasswordException="InvalidPasswordException",m.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",m.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",m.NotAuthorizedException="NotAuthorizedException",m.ResourceNotFoundException="ResourceNotFoundException",m.TooManyRequestsException="TooManyRequestsException",m.UnexpectedLambdaException="UnexpectedLambdaException",m.UserLambdaValidationException="UserLambdaValidationException",m.UsernameExistsException="UsernameExistsException",(I=z||(z={})).AliasExistsException="AliasExistsException",I.CodeDeliveryFailureException="CodeDeliveryFailureException",I.CodeMismatchException="CodeMismatchException",I.ExpiredCodeException="ExpiredCodeException",I.ForbiddenException="ForbiddenException",I.InternalErrorException="InternalErrorException",I.InvalidEmailRoleAccessPolicyException="InvalidEmailRoleAccessPolicyException",I.InvalidLambdaResponseException="InvalidLambdaResponseException",I.InvalidParameterException="InvalidParameterException",I.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",I.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",I.NotAuthorizedException="NotAuthorizedException",I.PasswordResetRequiredException="PasswordResetRequiredException",I.ResourceNotFoundException="ResourceNotFoundException",I.TooManyRequestsException="TooManyRequestsException",I.UnexpectedLambdaException="UnexpectedLambdaException",I.UserLambdaValidationException="UserLambdaValidationException",I.UserNotConfirmedException="UserNotConfirmedException",I.UserNotFoundException="UserNotFoundException",(R=K||(K={})).CodeMismatchException="CodeMismatchException",R.EnableSoftwareTokenMFAException="EnableSoftwareTokenMFAException",R.ForbiddenException="ForbiddenException",R.InternalErrorException="InternalErrorException",R.InvalidParameterException="InvalidParameterException",R.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",R.NotAuthorizedException="NotAuthorizedException",R.PasswordResetRequiredException="PasswordResetRequiredException",R.ResourceNotFoundException="ResourceNotFoundException",R.SoftwareTokenMFANotFoundException="SoftwareTokenMFANotFoundException",R.TooManyRequestsException="TooManyRequestsException",R.UserNotConfirmedException="UserNotConfirmedException",R.UserNotFoundException="UserNotFoundException",(C=$||($={})).AliasExistsException="AliasExistsException",C.CodeMismatchException="CodeMismatchException",C.ExpiredCodeException="ExpiredCodeException",C.ForbiddenException="ForbiddenException",C.InternalErrorException="InternalErrorException",C.InvalidParameterException="InvalidParameterException",C.LimitExceededException="LimitExceededException",C.NotAuthorizedException="NotAuthorizedException",C.PasswordResetRequiredException="PasswordResetRequiredException",C.ResourceNotFoundException="ResourceNotFoundException",C.TooManyRequestsException="TooManyRequestsException",C.UserNotConfirmedException="UserNotConfirmedException",C.UserNotFoundException="UserNotFoundException",(P=G||(G={})).ForbiddenException="ForbiddenException",P.InternalErrorException="InternalErrorException",P.InvalidParameterException="InvalidParameterException",P.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",P.NotAuthorizedException="NotAuthorizedException",P.PasswordResetRequiredException="PasswordResetRequiredException",P.ResourceNotFoundException="ResourceNotFoundException",P.TooManyRequestsException="TooManyRequestsException",P.UserNotConfirmedException="UserNotConfirmedException",P.UserNotFoundException="UserNotFoundException",(v=Y||(Y={})).ForbiddenException="ForbiddenException",v.InternalErrorException="InternalErrorException",v.InvalidParameterException="InvalidParameterException",v.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",v.NotAuthorizedException="NotAuthorizedException",v.PasswordResetRequiredException="PasswordResetRequiredException",v.ResourceNotFoundException="ResourceNotFoundException",v.TooManyRequestsException="TooManyRequestsException",v.UserNotConfirmedException="UserNotConfirmedException",v.UserNotFoundException="UserNotFoundException",e.s(["InitiateAuthException",()=>k],536);var t,n,o,i,r,a,s,c,l,d,E,p,u,h,x,g,S,A,m,I,R,C,P,v,T,N,f,y,U,F,_,w,D,M,O,b,L,V,k,B,q,H,W,z,K,$,G,Y,Z=e.i(7348),j=e.i(38025),J=e.i(39615),Q=e.i(21089),X=e.i(75585);let ee=e=>(0,Z.composeServiceApi)(Q.cognitoUserPoolTransferHandler,(0,j.createUserPoolSerializer)("InitiateAuth"),(0,J.createUserPoolDeserializer)(),{...X.DEFAULT_SERVICE_CLIENT_API_CONFIG,...e});e.s(["createInitiateAuthClient",()=>ee],10375);let et=e=>(0,Z.composeServiceApi)(Q.cognitoUserPoolTransferHandler,(0,j.createUserPoolSerializer)("RespondToAuthChallenge"),(0,J.createUserPoolDeserializer)(),{...X.DEFAULT_SERVICE_CLIENT_API_CONFIG,...e});e.s(["createRespondToAuthChallengeClient",()=>et],77236);let en=e=>(0,Z.composeServiceApi)(Q.cognitoUserPoolTransferHandler,(0,j.createUserPoolSerializer)("VerifySoftwareToken"),(0,J.createUserPoolDeserializer)(),{...X.DEFAULT_SERVICE_CLIENT_API_CONFIG,...e});e.s(["createVerifySoftwareTokenClient",()=>en],37729);let eo=e=>(0,Z.composeServiceApi)(Q.cognitoUserPoolTransferHandler,(0,j.createUserPoolSerializer)("AssociateSoftwareToken"),(0,J.createUserPoolDeserializer)(),{...X.DEFAULT_SERVICE_CLIENT_API_CONFIG,...e});e.s(["createAssociateSoftwareTokenClient",()=>eo],54087);var ei=e.i(78475),er=e.i(69993),ea=e.i(83124);async function es(e){if(e.AccessToken){let t,n,o,i=(0,ei.decodeJWT)(e.AccessToken),r=1e3*(i.payload.iat||0),a=new Date().getTime();e.RefreshToken&&(n=e.RefreshToken),e.IdToken&&(t=(0,ei.decodeJWT)(e.IdToken)),e?.NewDeviceMetadata&&(o=e.NewDeviceMetadata);let s={accessToken:i,idToken:t,refreshToken:n,clockDrift:r>0?r-a:0,deviceMetadata:o,username:e.username};e?.signInDetails&&(s.signInDetails=e.signInDetails),await ea.tokenOrchestrator.setTokens({tokens:s})}else throw new er.AmplifyError({message:"Invalid tokens",name:"InvalidTokens",recoverySuggestion:"Check Cognito UserPool settings"})}e.s(["cacheCognitoTokens",()=>es],87972);var ec=e.i(71094),el=e.i(63408),ed=e.i(1924),eE=e.i(44440);let ep=async()=>{try{ec.Hub.dispatch("auth",{event:"signedIn",data:await (0,el.getCurrentUser)()},"Auth",ec.AMPLIFY_SYMBOL)}catch(e){if(e.name===ed.USER_UNAUTHENTICATED_EXCEPTION)throw new eE.AuthError({name:ed.UNEXPECTED_SIGN_IN_INTERRUPTION_EXCEPTION,message:"Unable to get user session following successful sign-in.",recoverySuggestion:"This most likely is due to auth tokens not being persisted. If you are using cookie store, please ensure cookies can be correctly set from your server."});throw e}};e.s(["dispatchSignedInHubEvent",()=>ep],51343)},48085,e=>{"use strict";let t;var n,o=e.i(38216);let i="CognitoSignInState",r={username:`${i}.username`,challengeName:`${i}.challengeName`,signInSession:`${i}.signInSession`,expiry:`${i}.expiry`},a=()=>{l.dispatch({type:"RESET_STATE"})},s=()=>{for(let e of Object.values(r))o.syncSessionStorage.removeItem(e)},c=()=>({username:void 0,challengeName:void 0,signInSession:void 0}),l=(t=(n=(e,t)=>{switch(t.type){case"SET_SIGN_IN_SESSION":return E({signInSession:t.value}),{...e,signInSession:t.value};case"SET_SIGN_IN_STATE":return E(t.value),{...t.value};case"SET_CHALLENGE_NAME":return E({challengeName:t.value}),{...e,challengeName:t.value};case"SET_USERNAME":return E({username:t.value}),{...e,username:t.value};case"SET_INITIAL_STATE":let n=o.syncSessionStorage.getItem(r.expiry);if(!n||Number(n)<=Date.now())return s(),c();return{username:o.syncSessionStorage.getItem(r.username)??void 0,challengeName:o.syncSessionStorage.getItem(r.challengeName)??void 0,signInSession:o.syncSessionStorage.getItem(r.signInSession)??void 0};case"RESET_STATE":return s(),c();default:return e}})(c(),{type:"SET_INITIAL_STATE"}),{getState:()=>t,dispatch:e=>{t=n(t,e)}});function d(e){l.dispatch({type:"SET_SIGN_IN_STATE",value:e})}let E=({challengeName:e,signInSession:t,username:n})=>{n&&o.syncSessionStorage.setItem(r.username,n),e&&o.syncSessionStorage.setItem(r.challengeName,e),t&&(o.syncSessionStorage.setItem(r.signInSession,t),o.syncSessionStorage.setItem(r.expiry,String(Date.now()+18e4)))};e.s(["resetActiveSignInState",()=>a,"setActiveSignInState",()=>d,"signInStore",()=>l])},63007,89968,5457,e=>{"use strict";let t,n,o,i;var r,a,s,c=e.i(74860),l=e.i(13157),d=e.i(78475),E=e.i(76518),p=e.i(44440),u=e.i(536),h=e.i(9488),x=e.i(79613),g=e.i(89914),S=e.i(1924),A=e.i(63408),m=e.i(4528),I=e.i(10375),R=e.i(77236),C=e.i(37729),P=e.i(54087),v=e.i(26399),T=e.i(70095),N=e.i(87972),f=e.i(51343),y=e.i(48085),U=e.i(62410),F=e.i(69993);let _="Passkeys may not be supported on this device. Ensure your application is running in a secure context (HTTPS) and Web Authentication API is supported.";class w extends F.AmplifyError{constructor(e){super(e),this.constructor=w,Object.setPrototypeOf(this,w.prototype)}}(r=s||(s={})).PasskeyNotSupported="PasskeyNotSupported",r.PasskeyAlreadyExists="PasskeyAlreadyExists",r.InvalidPasskeyRegistrationOptions="InvalidPasskeyRegistrationOptions",r.InvalidPasskeyAuthenticationOptions="InvalidPasskeyAuthenticationOptions",r.RelyingPartyMismatch="RelyingPartyMismatch",r.PasskeyRegistrationFailed="PasskeyRegistrationFailed",r.PasskeyRetrievalFailed="PasskeyRetrievalFailed",r.PasskeyRegistrationCanceled="PasskeyRegistrationCanceled",r.PasskeyAuthenticationCanceled="PasskeyAuthenticationCanceled",r.PasskeyOperationAborted="PasskeyOperationAborted";let D="User may have canceled the ceremony or another interruption has occurred. Check underlying error for details.",M="Ensure your user pool is configured to support the WEB_AUTHN as an authentication factor.",O={[s.PasskeyNotSupported]:{message:"Passkeys may not be supported on this device.",recoverySuggestion:_},[s.InvalidPasskeyRegistrationOptions]:{message:"Invalid passkey registration options.",recoverySuggestion:M},[s.InvalidPasskeyAuthenticationOptions]:{message:"Invalid passkey authentication options.",recoverySuggestion:M},[s.PasskeyRegistrationFailed]:{message:"Device failed to create passkey.",recoverySuggestion:_},[s.PasskeyRetrievalFailed]:{message:"Device failed to retrieve passkey.",recoverySuggestion:"Passkeys may not be available on this device. Try an alternative authentication factor like PASSWORD, EMAIL_OTP, or SMS_OTP."},[s.PasskeyAlreadyExists]:{message:"Passkey already exists in authenticator.",recoverySuggestion:"Proceed with existing passkey or try again after deleting the credential."},[s.PasskeyRegistrationCanceled]:{message:"Passkey registration ceremony has been canceled.",recoverySuggestion:D},[s.PasskeyAuthenticationCanceled]:{message:"Passkey authentication ceremony has been canceled.",recoverySuggestion:D},[s.PasskeyOperationAborted]:{message:"Passkey operation has been aborted.",recoverySuggestion:D},[s.RelyingPartyMismatch]:{message:"Relying party does not match current domain.",recoverySuggestion:"Ensure relying party identifier matches current domain."}},b=(0,U.createAssertionFunction)(O,w);var L=e.i(59785),V=e.i(20367),k=e.i(78428);let B={convert(e,t={urlSafe:!1,skipPadding:!1}){let n="string"==typeof e?e:Array.from(e,e=>String.fromCodePoint(e)).join(""),o=(0,k.getBtoa)()(n);return t.urlSafe&&(o=o.replace(/\+/g,"-").replace(/\//g,"_")),t.skipPadding&&(o=o.replace(/=/g,"")),o}},q=e=>B.convert(new Uint8Array(e),{urlSafe:!0,skipPadding:!0});var H=e.i(74883);let W=e=>Uint8Array.from(H.base64Decoder.convert(e,{urlSafe:!0}),e=>e.charCodeAt(0)).buffer,z=async e=>{try{let t,n,o,i,r=(0,V.isBrowser)()&&window.isSecureContext&&"credentials"in navigator&&"function"==typeof window.PublicKeyCredential;b(r,s.PasskeyNotSupported);let a=(t=W(e.challenge),n=(e.allowCredentials||[]).map(e=>({...e,id:W(e.id)})),{...e,challenge:t,allowCredentials:n}),c=await navigator.credentials.get({publicKey:a});return b(c&&c instanceof PublicKeyCredential&&c.response instanceof AuthenticatorAssertionResponse,s.PasskeyRetrievalFailed),o={clientDataJSON:q(c.response.clientDataJSON),authenticatorData:q(c.response.authenticatorData),signature:q(c.response.signature)},c.response.userHandle&&(o.userHandle=q(c.response.userHandle)),i={id:c.id,rawId:q(c.rawId),type:c.type,clientExtensionResults:c.getClientExtensionResults(),response:o},c.authenticatorAttachment&&(i.authenticatorAttachment=c.authenticatorAttachment),i}catch(e){throw(e=>{if(e instanceof w)return e;if(e instanceof Error&&"NotAllowedError"===e.name){let{message:t,recoverySuggestion:n}=O[s.PasskeyAuthenticationCanceled];return new w({name:s.PasskeyAuthenticationCanceled,message:t,recoverySuggestion:n,underlyingError:e})}return(e=>{if(e instanceof Error){if("AbortError"===e.name){let{message:t,recoverySuggestion:n}=O[s.PasskeyOperationAborted];return new w({name:s.PasskeyOperationAborted,message:t,recoverySuggestion:n,underlyingError:e})}if("SecurityError"===e.name){let{message:t,recoverySuggestion:n}=O[s.RelyingPartyMismatch];return new w({name:s.RelyingPartyMismatch,message:t,recoverySuggestion:n,underlyingError:e})}}return new w({name:L.AmplifyErrorCode.Unknown,message:"An unknown error has occurred.",underlyingError:e})})(e)})(e)}},K=async()=>{let{userAgentData:e}=navigator;if(!e)return navigator.userAgent;let{platform:t="",platformVersion:n="",model:o="",architecture:i="",fullVersionList:r=[]}=await e.getHighEntropyValues(["platform","platformVersion","architecture","model","fullVersionList"]);return[t,n,i,o,t,r.map(e=>`${e.brand}/${e.version}`).join(";")].filter(e=>e).join(" ")||navigator.userAgent};var $=e.i(7348),G=e.i(21089),Y=e.i(38025),Z=e.i(39615),j=e.i(75585);let J={convert:e=>new TextEncoder().encode(e)};function Q(e,t){null!=e&&this.fromString(e,t)}function X(){return new Q(null,null)}let ee="u">typeof navigator;ee&&"Microsoft Internet Explorer"===navigator.appName?(Q.prototype.am=function(e,t,n,o,i,r){let a=32767&t,s=t>>15;for(;--r>=0;){let t=32767&this[e],r=this[e++]>>15,c=s*t+r*a;i=((t=a*t+((32767&c)<<15)+n[o]+(0x3fffffff&i))>>>30)+(c>>>15)+s*r+(i>>>30),n[o++]=0x3fffffff&t}return i},t=30):ee&&"Netscape"!==navigator.appName?(Q.prototype.am=function(e,t,n,o,i,r){for(;--r>=0;){let r=t*this[e++]+n[o]+i;i=Math.floor(r/0x4000000),n[o++]=0x3ffffff&r}return i},t=26):(Q.prototype.am=function(e,t,n,o,i,r){let a=16383&t,s=t>>14;for(;--r>=0;){let t=16383&this[e],r=this[e++]>>14,c=s*t+r*a;i=((t=a*t+((16383&c)<<14)+n[o]+i)>>28)+(c>>14)+s*r,n[o++]=0xfffffff&t}return i},t=28),Q.prototype.DB=t,Q.prototype.DM=(1<>>16)&&(e=t,n+=16),0!=(t=e>>8)&&(e=t,n+=8),0!=(t=e>>4)&&(e=t,n+=4),0!=(t=e>>2)&&(e=t,n+=2),0!=(t=e>>1)&&(e=t,n+=1),n}function er(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(t,t),t},er.prototype.revert=function(e){let t=X();return e.copyTo(t),this.reduce(t),t},er.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(let t=0;t>15)*this.mpl&this.um)<<15)&e.DM;for(n=t+this.m.t,e[n]+=this.m.am(0,o,e,t,0,this.m.t);e[n]>=e.DV;)e[n]-=e.DV,e[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},er.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},er.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},Q.prototype.copyTo=function(e){for(let t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},Q.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0},Q.prototype.fromString=function(e,t){let n;if(16===t)n=4;else if(8===t)n=3;else if(2===t)n=1;else if(32===t)n=5;else if(4===t)n=2;else throw Error("Only radix 2, 4, 8, 16, 32 are supported");this.t=0,this.s=0;let o=e.length,i=!1,r=0;for(;--o>=0;){let t=function(e,t){let n=et[e.charCodeAt(t)];return null==n?-1:n}(e,o);if(t<0){"-"===e.charAt(o)&&(i=!0);continue}i=!1,0===r?this[this.t++]=t:r+n>this.DB?(this[this.t-1]|=(t&(1<>this.DB-r):this[this.t-1]|=t<=this.DB&&(r-=this.DB)}this.clamp(),i&&Q.ZERO.subTo(this,this)},Q.prototype.clamp=function(){let e=this.s&this.DM;for(;this.t>0&&this[this.t-1]==e;)--this.t},Q.prototype.dlShiftTo=function(e,t){let n;for(n=this.t-1;n>=0;--n)t[n+e]=this[n];for(n=e-1;n>=0;--n)t[n]=0;t.t=this.t+e,t.s=this.s},Q.prototype.drShiftTo=function(e,t){for(let n=e;n=0;--n)t[n+a+1]=this[n]>>i|s,s=(this[n]&r)<=0;--n)t[n]=0;t[a]=s,t.t=this.t+a+1,t.s=this.s,t.clamp()},Q.prototype.rShiftTo=function(e,t){t.s=this.s;let n=Math.floor(e/this.DB);if(n>=this.t){t.t=0;return}let o=e%this.DB,i=this.DB-o,r=(1<>o;for(let e=n+1;e>o;o>0&&(t[this.t-n-1]|=(this.s&r)<>=this.DB;if(e.t>=this.DB;o+=this.s}else{for(o+=this.s;n>=this.DB;o-=e.s}t.s=o<0?-1:0,o<-1?t[n++]=this.DV+o:o>0&&(t[n++]=o),t.t=n,t.clamp()},Q.prototype.multiplyTo=function(e,t){let n=this.abs(),o=e.abs(),i=n.t;for(t.t=i+o.t;--i>=0;)t[i]=0;for(i=0;i=0;)e[n]=0;for(n=0;n=t.DV&&(e[n+t.t]-=t.DV,e[n+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(n,t[n],e,2*n,0,1)),e.s=0,e.clamp()},Q.prototype.divRemTo=function(e,t,n){let o=e.abs();if(o.t<=0)return;let i=this.abs();if(i.t0?(o.lShiftTo(c,r),i.lShiftTo(c,n)):(o.copyTo(r),i.copyTo(n));let l=r.t,d=r[l-1];if(0===d)return;let E=d*(1<1?r[l-2]>>this.F2:0),p=this.FV/E,u=(1<=0&&(n[n.t++]=1,n.subTo(S,n)),Q.ONE.dlShiftTo(l,S),S.subTo(r,r);r.t=0;){let e=n[--x]===d?this.DM:Math.floor(n[x]*p+(n[x-1]+h)*u);if((n[x]+=r.am(0,e,n,g,0,l))0&&n.rShiftTo(c,n),a<0&&Q.ZERO.subTo(n,n)},Q.prototype.invDigit=function(){if(this.t<1)return 0;let e=this[0];if((1&e)==0)return 0;let t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},Q.prototype.addTo=function(e,t){let n=0,o=0,i=Math.min(e.t,this.t);for(;n>=this.DB;if(e.t>=this.DB;o+=this.s}else{for(o+=this.s;n>=this.DB;o+=e.s}t.s=o<0?-1:0,o>0?t[n++]=o:o<-1&&(t[n++]=this.DV+o),t.t=n,t.clamp()},Q.prototype.toString=function(e){let t,n;if(this.s<0)return"-"+this.negate().toString(e);if(16==e)t=4;else if(8===e)t=3;else if(2===e)t=1;else if(32===e)t=5;else if(4===e)t=2;else throw Error("Only radix 2, 4, 8, 16, 32 are supported");let o=(1<0)for(s>s)>0&&(i=!0,r=en(n));a>=0;)s>(s+=this.DB-t):(n=this[a]>>(s-=t)&o,s<=0&&(s+=this.DB,--a)),n>0&&(i=!0),i&&(r+=en(n));return i?r:"0"},Q.prototype.negate=function(){let e=X();return Q.ZERO.subTo(this,e),e},Q.prototype.abs=function(){return this.s<0?this.negate():this},Q.prototype.compareTo=function(e){let t=this.s-e.s;if(0!=t)return t;let n=this.t;if(0!=(t=n-e.t))return this.s<0?-t:t;for(;--n>=0;)if(0!=(t=this[n]-e[n]))return t;return 0},Q.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+ei(this[this.t-1]^this.s&this.DM)},Q.prototype.mod=function(e){let t=X();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(Q.ZERO)>0&&e.subTo(t,t),t},Q.prototype.equals=function(e){return 0===this.compareTo(e)},Q.prototype.add=function(e){let t=X();return this.addTo(e,t),t},Q.prototype.subtract=function(e){let t=X();return this.subTo(e,t),t},Q.prototype.multiply=function(e){let t=X();return this.multiplyTo(e,t),t},Q.prototype.divide=function(e){let t=X();return this.divRemTo(e,t,null),t},Q.prototype.modPow=function(e,t,n){let o,i,r,a=e.bitLength(),s=eo(1),c=new er(t);if(a<=0)return s;let l=[],d=3,E=(o=a<18?1:a<48?3:a<144?4:a<768?5:6)-1,p=(1<1){let e=X();for(c.sqrTo(l[1],e);d<=p;)l[d]=X(),c.mulTo(e,l[d-2],l[d]),d+=2}let u=e.t-1,h=!0,x=X();for(a=ei(e[u])-1;u>=0;){for(a>=E?i=e[u]>>a-E&p:(i=(e[u]&(1<0&&(i|=e[u-1]>>this.DB+a-E)),d=o;(1&i)==0;)i>>=1,--d;if((a-=d)<0&&(a+=this.DB,--u),h)l[i].copyTo(s),h=!1;else{for(;d>1;)c.sqrTo(s,x),c.sqrTo(x,s),d-=2;d>0?c.sqrTo(s,x):(r=s,s=x,x=r),c.mulTo(x,l[i],s)}for(;u>=0&&(e[u]&1<new Promise((s,c)=>{t.modPow(o,r,(t,l)=>{t?c(t):i.subtract(n.multiply(l)).modPow(e.add(a.multiply(o)),r,(e,t)=>{e?c(e):s(t.mod(r))})})}),es={},ec={};for(let e=0;e<256;e++){let t=e.toString(16).toLowerCase();1===t.length&&(t=`0${t}`),es[e]=t,ec[t]=e}let el=e=>{if(e.length%2!=0)throw Error("Hex encoded strings must have an even number length");let t=new Uint8Array(e.length/2);for(let n=0;n{let t="";for(let n=0;n{let t=new ed.Sha256;t.update(e);let n=eE(t.digestSync());return Array(64-n.length).join("0")+n},eu=/^[89a-f]/i,eh=e=>{if(!(e instanceof Q))throw Error("Not a BigInteger");let t=0>e.compareTo(Q.ZERO),n=e.abs().toString(16);return n=n.length%2!=0?`0${n}`:n,n=eu.test(n)?`00${n}`:n,t&&(n=new Q(n.split("").map(e=>{let t=15&~parseInt(e,16);return"0123456789ABCDEF".charAt(t)}).join(""),16).add(Q.ONE).toString(16)).toUpperCase().startsWith("FF8")&&(n=n.substring(2)),n};class ex{constructor(e,t){this.words=[];let n=e;n=this.words=n||[],void 0!==t?this.sigBytes=t:this.sigBytes=4*n.length}random(e){let t=[];for(let n=0;n>>2]>>>24-e%4*8&255;o.push((n>>>4).toString(16)),o.push((15&n).toString(16))}return o.join("")}(this)}}let eg=e=>el(new ex().random(e).toString());class eS{constructor({userPoolName:e,a:t,g:n,A:o,N:i}){this.encoder=J,this.userPoolName=e,this.a=t,this.g=n,this.A=o,this.N=i,this.k=new Q((e=>ep(el(e)))(`${eh(i)}${eh(n)}`),16)}getRandomPassword(){if(!this.randomPassword)throw new p.AuthError({name:"EmptyBigIntegerRandomPassword",message:"random password is empty"});return this.randomPassword}getSaltToHashDevices(){if(!this.saltToHashDevices)throw new p.AuthError({name:"EmptyBigIntegersaltToHashDevices",message:"saltToHashDevices is empty"});return this.saltToHashDevices}getVerifierDevices(){if(!this.verifierDevices)throw new p.AuthError({name:"EmptyBigIntegerVerifierDevices",message:"verifyDevices is empty"});return this.verifierDevices}async generateHashDevice(e,t){this.randomPassword=B.convert(eg(40));let n=ep(`${e}${t}:${this.randomPassword}`),o=eE(eg(16));return this.saltToHashDevices=eh(new Q(o,16)),new Promise((e,t)=>{this.g.modPow(new Q(ep(el(this.saltToHashDevices+n)),16),this.N,(n,o)=>{n?t(n):(this.verifierDevices=eh(o),e())})})}async getPasswordAuthenticationKey({username:e,password:t,serverBValue:n,salt:o}){var i,r;let a,s,c;if(n.mod(this.N).equals(Q.ZERO))throw Error("B cannot be zero.");let l=(({A:e,B:t})=>{let n=new Q(ep(el(eh(e)+eh(t))),16);if(n.equals(Q.ZERO))throw Error("U cannot be zero.");return n})({A:this.A,B:n}),d=ep(`${this.userPoolName}${e}:${t}`),E=new Q(ep(el(eh(o)+d)),16),p=await ea({a:this.a,g:this.g,k:this.k,x:E,B:n,N:this.N,U:l}),u=this.encoder.convert("Caldera Derived Key"),h=this.encoder.convert("\x01"),x=new Uint8Array(u.byteLength+h.byteLength);return x.set(u,0),x.set(h,u.byteLength),i=el(eh(p)),r=el(eh(l)),(a=new ed.Sha256(r)).update(i),s=a.digestSync(),(c=new ed.Sha256(s)).update(x),c.digestSync().slice(0,16)}}let eA=async({a:e,g:t,N:n})=>new Promise((o,i)=>{t.modPow(e,n,(e,t)=>{e?i(e):t.mod(n).equals(Q.ZERO)?i(Error("Illegal parameter. A mod N cannot be 0.")):o(t)})}),em=async e=>{let t=new Q("FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF",16),n=new Q("2",16),o=eI(),i=await eA({a:o,g:n,N:t});return new eS({userPoolName:e,a:o,g:n,A:i,N:t})},eI=()=>new Q(eE(eg(128)),16);async function eR({userPoolId:e,userPoolEndpoint:t,newDeviceMetadata:n,accessToken:o}){if(!n)return;let i=e.split("_")[1]||"",r=await em(i),a=n?.DeviceKey,s=n?.DeviceGroupKey;try{await r.generateHashDevice(s??"",a??"")}catch(e){return}let c={Salt:B.convert(el(r.getSaltToHashDevices())),PasswordVerifier:B.convert(el(r.getVerifierDevices()))},l=r.getRandomPassword();try{let i,r=(i={endpointResolver:(0,v.createCognitoUserPoolEndpointResolver)({endpointOverride:t})},(0,$.composeServiceApi)(G.cognitoUserPoolTransferHandler,(0,Y.createUserPoolSerializer)("ConfirmDevice"),(0,Z.createUserPoolDeserializer)(),{...j.DEFAULT_SERVICE_CLIENT_API_CONFIG,...i}));return await r({region:(0,T.getRegionFromUserPoolId)(e)},{AccessToken:o,DeviceName:await K(),DeviceKey:n?.DeviceKey,DeviceSecretVerifierConfig:c}),{deviceKey:a,deviceGroupKey:s,randomPassword:l}}catch(e){return}}async function eC(e){let t=c.Amplify.getConfig().Auth?.Cognito;(0,d.assertTokenProviderConfig)(t);let{username:n,signInSession:o,signInDetails:i,challengeName:r}=y.signInStore.getState();if("WEB_AUTHN"!==r||!n)throw new p.AuthError({name:h.AuthErrorCodes.SignInException,message:"Unable to proceed due to invalid sign in state."});let{CREDENTIAL_REQUEST_OPTIONS:a}=e;b(!!a,s.InvalidPasskeyAuthenticationOptions);let E=await z(JSON.parse(a)),u=(0,R.createRespondToAuthChallengeClient)({endpointResolver:(0,v.createCognitoUserPoolEndpointResolver)({endpointOverride:t.userPoolEndpoint})}),{ChallengeName:x,ChallengeParameters:g,AuthenticationResult:S,Session:A}=await u({region:(0,T.getRegionFromUserPoolId)(t.userPoolId),userAgentValue:(0,m.getAuthUserAgentValue)(l.AuthAction.ConfirmSignIn)},{ChallengeName:"WEB_AUTHN",ChallengeResponses:{USERNAME:n,CREDENTIAL:JSON.stringify(E)},ClientId:t.userPoolClientId,Session:o});if((0,y.setActiveSignInState)({signInSession:A,username:n,challengeName:x,signInDetails:i}),S)return await (0,N.cacheCognitoTokens)({...S,username:n,NewDeviceMetadata:await eR({userPoolId:t.userPoolId,userPoolEndpoint:t.userPoolEndpoint,newDeviceMetadata:S.NewDeviceMetadata,accessToken:S.AccessToken}),signInDetails:i}),y.signInStore.dispatch({type:"RESET_STATE"}),await (0,f.dispatchSignedInHubEvent)(),{isSignedIn:!0,nextStep:{signInStep:"DONE"}};if("WEB_AUTHN"===x)throw new p.AuthError({name:h.AuthErrorCodes.SignInException,message:"Sequential WEB_AUTHN challenges returned from underlying service cannot be handled."});return{challengeName:x,challengeParameters:g}}e.s(["getNewDeviceMetadata",()=>eR],89968);var eP=e.i(20093);let ev=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],eT=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],eN=()=>{let e=new Date,t=eT[e.getUTCDay()],n=ev[e.getUTCMonth()],o=e.getUTCDate(),i=e.getUTCHours();i<10&&(i=`0${i}`);let r=e.getUTCMinutes();r<10&&(r=`0${r}`);let a=e.getUTCSeconds();a<10&&(a=`0${a}`);let s=e.getUTCFullYear();return`${t} ${n} ${o} ${i}:${r}:${a} UTC ${s}`},ef=({userPoolName:e,username:t,challengeParameters:n,dateNow:o,hkdf:i})=>{let r=J.convert(e),a=J.convert(t),s=ey(n.SECRET_BLOCK),c=J.convert(o),l=new Uint8Array(r.byteLength+a.byteLength+s.byteLength+c.byteLength);l.set(r,0),l.set(a,r.byteLength),l.set(s,r.byteLength+a.byteLength),l.set(c,r.byteLength+a.byteLength+s.byteLength);let d=new ed.Sha256(i);d.update(l);let E=d.digestSync();return B.convert(E)},ey=e=>{let t="=".repeat((4-e.length%4)%4),n=(e+t).replace(/-/g,"+").replace(/_/g,"/"),o=H.base64Decoder.convert(n),i=new Uint8Array(o.length);for(let e=0;e{n&&(t[`${ek}${e}`]=n)}),t}(i),NEW_PASSWORD:e,USERNAME:o},E=(0,eP.getUserContextData)({username:o,userPoolId:a,userPoolClientId:s});return(0,R.createRespondToAuthChallengeClient)({endpointResolver:(0,v.createCognitoUserPoolEndpointResolver)({endpointOverride:c})})({region:(0,T.getRegionFromUserPoolId)(a),userAgentValue:(0,m.getAuthUserAgentValue)(l.AuthAction.ConfirmSignIn)},{ChallengeName:"NEW_PASSWORD_REQUIRED",ChallengeResponses:d,ClientMetadata:t,Session:n,ClientId:s,UserContextData:E})}async function ez(e,t,n,o,i){let{userPoolClientId:r,userPoolId:a,userPoolEndpoint:s}=o,c={USERNAME:e,PASSWORD:t},d=await i.getDeviceMetadata(e);d&&d.deviceKey&&(c.DEVICE_KEY=d.deviceKey);let E=(0,eP.getUserContextData)({username:e,userPoolId:a,userPoolClientId:r}),p=(0,I.createInitiateAuthClient)({endpointResolver:(0,v.createCognitoUserPoolEndpointResolver)({endpointOverride:s})}),u=await p({region:(0,T.getRegionFromUserPoolId)(a),userAgentValue:(0,m.getAuthUserAgentValue)(l.AuthAction.SignIn)},{AuthFlow:"USER_PASSWORD_AUTH",AuthParameters:c,ClientMetadata:n,ClientId:r,UserContextData:E}),h=u.ChallengeParameters?.USERNAME??u.ChallengeParameters?.USER_ID_FOR_SRP??e;return(eM(h),"DEVICE_SRP_AUTH"===u.ChallengeName)?eF({username:h,config:o,clientMetadata:n,session:u.Session,tokenOrchestrator:i}):u}async function eK(e,t,n,o,i){return eO({username:e,password:t,clientMetadata:n,config:o,tokenOrchestrator:i,authFlow:"USER_SRP_AUTH"})}async function e$(e,t,n,o){let{userPoolClientId:i,userPoolId:r,userPoolEndpoint:a}=n,s={USERNAME:e},c=await o.getDeviceMetadata(e);c&&c.deviceKey&&(s.DEVICE_KEY=c.deviceKey);let d=(0,eP.getUserContextData)({username:e,userPoolId:r,userPoolClientId:i}),E=(0,I.createInitiateAuthClient)({endpointResolver:(0,v.createCognitoUserPoolEndpointResolver)({endpointOverride:a})}),p=await E({region:(0,T.getRegionFromUserPoolId)(r),userAgentValue:(0,m.getAuthUserAgentValue)(l.AuthAction.SignIn)},{AuthFlow:"CUSTOM_AUTH",AuthParameters:s,ClientMetadata:t,ClientId:i,UserContextData:d}),u=p.ChallengeParameters?.USERNAME??e;return(eM(u),"DEVICE_SRP_AUTH"===p.ChallengeName)?eF({username:u,config:n,clientMetadata:t,session:p.Session,tokenOrchestrator:o}):p}async function eG(e,t,n,o,i){(0,d.assertTokenProviderConfig)(o);let{userPoolId:r,userPoolClientId:a,userPoolEndpoint:s}=o,c=r?.split("_")[1]||"",E=await em(c),p={USERNAME:e,SRP_A:E.A.toString(16),CHALLENGE_NAME:"SRP_A"},u=(0,eP.getUserContextData)({username:e,userPoolId:r,userPoolClientId:a}),h=(0,I.createInitiateAuthClient)({endpointResolver:(0,v.createCognitoUserPoolEndpointResolver)({endpointOverride:s})}),{ChallengeParameters:x,Session:g}=await h({region:(0,T.getRegionFromUserPoolId)(r),userAgentValue:(0,m.getAuthUserAgentValue)(l.AuthAction.SignIn)},{AuthFlow:"CUSTOM_AUTH",AuthParameters:p,ClientMetadata:n,ClientId:a,UserContextData:u}),S=x?.USERNAME??e;return eM(S),eD(ew,[t,x,n,g,E,o,i],S,i)}async function eY(e){var t,n,o;let{challengeName:i,challengeParameters:r,availableChallenges:a}=e,s=c.Amplify.getConfig().Auth?.Cognito;switch((0,d.assertTokenProviderConfig)(s),i){case"CUSTOM_CHALLENGE":return{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_IN_WITH_CUSTOM_CHALLENGE",additionalInfo:r}};case"MFA_SETUP":{let{signInSession:e,username:o}=y.signInStore.getState(),i=eQ(eX(r.MFAS_CAN_SETUP))||[],a=i.filter(e=>"EMAIL"===e||"TOTP"===e),c=a.includes("TOTP"),l=a.includes("EMAIL");if(c&&l)return{isSignedIn:!1,nextStep:{signInStep:"CONTINUE_SIGN_IN_WITH_MFA_SETUP_SELECTION",allowedMFATypes:a}};if(l)return{isSignedIn:!1,nextStep:{signInStep:"CONTINUE_SIGN_IN_WITH_EMAIL_SETUP"}};if(c){let i=(0,P.createAssociateSoftwareTokenClient)({endpointResolver:(0,v.createCognitoUserPoolEndpointResolver)({endpointOverride:s.userPoolEndpoint})}),{Session:r,SecretCode:a}=await i({region:(0,T.getRegionFromUserPoolId)(s.userPoolId)},{Session:e});return y.signInStore.dispatch({type:"SET_SIGN_IN_SESSION",value:r}),{isSignedIn:!1,nextStep:{signInStep:"CONTINUE_SIGN_IN_WITH_TOTP_SETUP",totpSetupDetails:(t=a,n=o,{sharedSecret:t,getSetupUri:(e,o)=>{let i=`otpauth://totp/${e}:${o??n}?secret=${t}&issuer=${e}`;return new E.AmplifyUrl(i)}})}}}throw new p.AuthError({name:h.AuthErrorCodes.SignInException,message:`Cannot initiate MFA setup from available types: ${i}`})}case"NEW_PASSWORD_REQUIRED":return{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_IN_WITH_NEW_PASSWORD_REQUIRED",missingAttributes:(o=r.requiredAttributes)?JSON.parse(o).map(e=>e.includes(ek)?e.replace(ek,""):e):[]}};case"SELECT_MFA_TYPE":return{isSignedIn:!1,nextStep:{signInStep:"CONTINUE_SIGN_IN_WITH_MFA_SELECTION",allowedMFATypes:eQ(eX(r.MFAS_CAN_CHOOSE))}};case"SMS_OTP":case"SMS_MFA":return{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_IN_WITH_SMS_CODE",codeDeliveryDetails:{deliveryMedium:r.CODE_DELIVERY_DELIVERY_MEDIUM,destination:r.CODE_DELIVERY_DESTINATION}}};case"SOFTWARE_TOKEN_MFA":return{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_IN_WITH_TOTP_CODE"}};case"EMAIL_OTP":return{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_IN_WITH_EMAIL_CODE",codeDeliveryDetails:{deliveryMedium:r.CODE_DELIVERY_DELIVERY_MEDIUM,destination:r.CODE_DELIVERY_DESTINATION}}};case"WEB_AUTHN":{let e=await eC(r);if("isSignedIn"in e&&"nextStep"in e)return e;return eY(e)}case"PASSWORD":case"PASSWORD_SRP":return{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_IN_WITH_PASSWORD"}};case"SELECT_CHALLENGE":return{isSignedIn:!1,nextStep:{signInStep:"CONTINUE_SIGN_IN_WITH_FIRST_FACTOR_SELECTION",availableChallenges:a}}}throw new p.AuthError({name:h.AuthErrorCodes.SignInException,message:`An error occurred during the sign in process. ${i} challengeName returned by the underlying service was not addressed.`})}function eZ(e){return e===u.InitiateAuthException.PasswordResetRequiredException?{isSignedIn:!1,nextStep:{signInStep:"RESET_PASSWORD"}}:e===u.InitiateAuthException.UserNotConfirmedException?{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_UP"}}:void 0}async function ej(e,t,n,o,i,r,a,s){let c=s?.userAttributes,l=s?.friendlyDeviceName;switch(t){case"WEB_AUTHN":case"SELECT_CHALLENGE":if("PASSWORD_SRP"===o||"PASSWORD"===o)return{ChallengeName:o,Session:n,$metadata:{}};return eb({username:e,session:n,selectedChallenge:o,config:i,clientMetadata:a});case"SELECT_MFA_TYPE":return eH({challengeResponse:o,clientMetadata:a,session:n,username:e,config:i});case"MFA_SETUP":return eq({challengeResponse:o,clientMetadata:a,session:n,username:e,deviceName:l,config:i});case"NEW_PASSWORD_REQUIRED":return eW({challengeResponse:o,clientMetadata:a,session:n,username:e,requiredAttributes:c,config:i});case"CUSTOM_CHALLENGE":return eD(eB,[{challengeResponse:o,clientMetadata:a,session:n,username:e,config:i,tokenOrchestrator:r}],e,r);case"SMS_MFA":case"SOFTWARE_TOKEN_MFA":case"SMS_OTP":case"EMAIL_OTP":return e2({challengeName:t,challengeResponse:o,clientMetadata:a,session:n,username:e,config:i,tokenOrchestrator:r});case"PASSWORD":return eL(e,o,a,i,n);case"PASSWORD_SRP":return eV(e,o,a,i,n,r)}throw new p.AuthError({name:h.AuthErrorCodes.SignInException,message:`An error occurred during the sign in process. ${t} challengeName returned by the underlying service was not addressed.`})}function eJ(e){return"SMS_MFA"===e?"SMS":"SOFTWARE_TOKEN_MFA"===e?"TOTP":"EMAIL_OTP"===e?"EMAIL":void 0}function eQ(e){if(e)return e.map(eJ).filter(Boolean)}function eX(e){return e?JSON.parse(e):[]}async function e0(){let e;try{e=await (0,A.getCurrentUser)()}catch(e){}if(e&&e.userId&&e.username)throw new p.AuthError({name:S.USER_ALREADY_AUTHENTICATED_EXCEPTION,message:"There is already a signed in user.",recoverySuggestion:"Call signOut before calling signIn again."})}function e1(e){return y.signInStore.getState().username??e}async function e2({challengeName:e,challengeResponse:t,clientMetadata:n,session:o,username:i,config:r,tokenOrchestrator:a}){let{userPoolId:s,userPoolClientId:c,userPoolEndpoint:d}=r,E={USERNAME:i};"EMAIL_OTP"===e&&(E.EMAIL_OTP_CODE=t),"SMS_MFA"===e&&(E.SMS_MFA_CODE=t),"SMS_OTP"===e&&(E.SMS_OTP_CODE=t),"SOFTWARE_TOKEN_MFA"===e&&(E.SOFTWARE_TOKEN_MFA_CODE=t);let p=await a?.getDeviceMetadata(i);p&&p.deviceKey&&(E.DEVICE_KEY=p.deviceKey);let u=(0,eP.getUserContextData)({username:i,userPoolId:s,userPoolClientId:c}),h=(0,R.createRespondToAuthChallengeClient)({endpointResolver:(0,v.createCognitoUserPoolEndpointResolver)({endpointOverride:d})}),x=await h({region:(0,T.getRegionFromUserPoolId)(s),userAgentValue:(0,m.getAuthUserAgentValue)(l.AuthAction.ConfirmSignIn)},{ChallengeName:e,ChallengeResponses:E,Session:o,ClientMetadata:n,ClientId:c,UserContextData:u});return"DEVICE_SRP_AUTH"===x.ChallengeName?eF({username:i,config:r,clientMetadata:n,session:x.Session,tokenOrchestrator:a}):x}e.s(["assertUserNotAuthenticated",()=>e0,"getActiveSignInUsername",()=>e1,"getSignInResult",()=>eY,"getSignInResultFromError",()=>eZ,"handleChallengeName",()=>ej,"handleCustomAuthFlowWithoutSRP",()=>e$,"handleCustomSRPAuthFlow",()=>eG,"handleUserPasswordAuthFlow",()=>ez,"handleUserSRPAuthFlow",()=>eK],5457);var e6=e.i(88236),e5=e.i(83124);async function e8(e){let t=c.Amplify.getConfig().Auth?.Cognito;(0,d.assertTokenProviderConfig)(t);let{username:n,password:o,options:i}=e,r={loginId:n,authFlowType:"CUSTOM_WITHOUT_SRP"},a=i?.clientMetadata;(0,g.assertValidationError)(!!n,x.AuthValidationErrorCode.EmptySignInUsername),(0,g.assertValidationError)(!o,x.AuthValidationErrorCode.CustomAuthSignInPassword);try{let{ChallengeName:e,ChallengeParameters:o,AuthenticationResult:i,Session:s}=await eD(e$,[n,a,t,e5.tokenOrchestrator],n,e5.tokenOrchestrator),c=e1(n);if((0,y.setActiveSignInState)({signInSession:s,username:c,challengeName:e,signInDetails:r}),i)return await (0,N.cacheCognitoTokens)({username:c,...i,NewDeviceMetadata:await eR({userPoolId:t.userPoolId,userPoolEndpoint:t.userPoolEndpoint,newDeviceMetadata:i.NewDeviceMetadata,accessToken:i.AccessToken}),signInDetails:r}),(0,y.resetActiveSignInState)(),await (0,f.dispatchSignedInHubEvent)(),{isSignedIn:!0,nextStep:{signInStep:"DONE"}};return eY({challengeName:e,challengeParameters:o})}catch(t){(0,y.resetActiveSignInState)(),(0,e6.assertServiceError)(t);let e=eZ(t.name);if(e)return e;throw t}}async function e3(e){let{username:t,password:n,options:o}=e,i={loginId:t,authFlowType:"CUSTOM_WITH_SRP"},r=c.Amplify.getConfig().Auth?.Cognito;(0,d.assertTokenProviderConfig)(r);let a=o?.clientMetadata;(0,g.assertValidationError)(!!t,x.AuthValidationErrorCode.EmptySignInUsername),(0,g.assertValidationError)(!!n,x.AuthValidationErrorCode.EmptySignInPassword);try{let{ChallengeName:e,ChallengeParameters:o,AuthenticationResult:s,Session:c}=await eG(t,n,a,r,e5.tokenOrchestrator),l=e1(t);if((0,y.setActiveSignInState)({signInSession:c,username:l,challengeName:e,signInDetails:i}),s)return await (0,N.cacheCognitoTokens)({username:l,...s,NewDeviceMetadata:await eR({userPoolId:r.userPoolId,userPoolEndpoint:r.userPoolEndpoint,newDeviceMetadata:s.NewDeviceMetadata,accessToken:s.AccessToken}),signInDetails:i}),(0,y.resetActiveSignInState)(),await (0,f.dispatchSignedInHubEvent)(),{isSignedIn:!0,nextStep:{signInStep:"DONE"}};return eY({challengeName:e,challengeParameters:o})}catch(t){(0,y.resetActiveSignInState)(),(0,e6.assertServiceError)(t);let e=eZ(t.name);if(e)return e;throw t}}function e4(){return{active:!1}}let e7=(i=(a=(e,t)=>{switch(t.type){case"SET_USERNAME":return{...e,username:t.value};case"SET_SESSION":return{...e,session:t.value};case"START":return{...e,active:!0};case"RESET":return e4();default:return e}})(e4(),{type:"RESET"}),{getState:()=>i,dispatch:e=>{i=a(i,e)}});function e9(e=!0){e7.dispatch({type:"RESET"})}async function te(e){let{username:t,password:n}=e,o=c.Amplify.getConfig().Auth?.Cognito,i={loginId:t,authFlowType:"USER_SRP_AUTH"};(0,d.assertTokenProviderConfig)(o);let r=e.options?.clientMetadata;(0,g.assertValidationError)(!!t,x.AuthValidationErrorCode.EmptySignInUsername),(0,g.assertValidationError)(!!n,x.AuthValidationErrorCode.EmptySignInPassword);try{let{ChallengeName:e,ChallengeParameters:a,AuthenticationResult:s,Session:c}=await eK(t,n,r,o,e5.tokenOrchestrator),l=e1(t);if((0,y.setActiveSignInState)({signInSession:c,username:l,challengeName:e,signInDetails:i}),s)return await (0,N.cacheCognitoTokens)({username:l,...s,NewDeviceMetadata:await eR({userPoolId:o.userPoolId,userPoolEndpoint:o.userPoolEndpoint,newDeviceMetadata:s.NewDeviceMetadata,accessToken:s.AccessToken}),signInDetails:i}),(0,y.resetActiveSignInState)(),await (0,f.dispatchSignedInHubEvent)(),e9(),{isSignedIn:!0,nextStep:{signInStep:"DONE"}};return eY({challengeName:e,challengeParameters:a})}catch(t){(0,y.resetActiveSignInState)(),e9(),(0,e6.assertServiceError)(t);let e=eZ(t.name);if(e)return e;throw t}}async function tt(e){let{username:t,password:n,options:o}=e,i=c.Amplify.getConfig().Auth?.Cognito,r={loginId:t,authFlowType:"USER_PASSWORD_AUTH"};(0,d.assertTokenProviderConfig)(i);let a=o?.clientMetadata;(0,g.assertValidationError)(!!t,x.AuthValidationErrorCode.EmptySignInUsername),(0,g.assertValidationError)(!!n,x.AuthValidationErrorCode.EmptySignInPassword);try{let{ChallengeName:e,ChallengeParameters:o,AuthenticationResult:s,Session:c}=await eD(ez,[t,n,a,i,e5.tokenOrchestrator],t,e5.tokenOrchestrator),l=e1(t);if((0,y.setActiveSignInState)({signInSession:c,username:l,challengeName:e,signInDetails:r}),s)return await (0,N.cacheCognitoTokens)({...s,username:l,NewDeviceMetadata:await eR({userPoolId:i.userPoolId,userPoolEndpoint:i.userPoolEndpoint,newDeviceMetadata:s.NewDeviceMetadata,accessToken:s.AccessToken}),signInDetails:r}),(0,y.resetActiveSignInState)(),await (0,f.dispatchSignedInHubEvent)(),e9(),{isSignedIn:!0,nextStep:{signInStep:"DONE"}};return eY({challengeName:e,challengeParameters:o})}catch(t){(0,y.resetActiveSignInState)(),e9(),(0,e6.assertServiceError)(t);let e=eZ(t.name);if(e)return e;throw t}}async function tn({username:e,clientMetadata:t,config:n,tokenOrchestrator:o,preferredChallenge:i,password:r,session:a}){let{userPoolId:s,userPoolClientId:c,userPoolEndpoint:d}=n,E=(0,eP.getUserContextData)({username:e,userPoolId:s,userPoolClientId:c}),p={USERNAME:e};if(i){if(n.passwordless&&(("EMAIL_OTP"!==i||n.passwordless.emailOtpEnabled)&&("SMS_OTP"!==i||n.passwordless.smsOtpEnabled)&&("WEB_AUTHN"!==i||n.passwordless.webAuthn)||(0,g.assertValidationError)(!1,x.AuthValidationErrorCode.InvalidPreferredChallenge)),"PASSWORD_SRP"===i)return(0,g.assertValidationError)(!!r,x.AuthValidationErrorCode.EmptySignInPassword),eO({username:e,password:r,clientMetadata:t,config:n,tokenOrchestrator:o,authFlow:"USER_AUTH",preferredChallenge:i});"PASSWORD"===i&&((0,g.assertValidationError)(!!r,x.AuthValidationErrorCode.EmptySignInPassword),p.PASSWORD=r),p.PREFERRED_CHALLENGE=i}let u={AuthFlow:"USER_AUTH",AuthParameters:p,ClientMetadata:t,ClientId:c,UserContextData:E};a&&(u.Session=a);let h=(0,I.createInitiateAuthClient)({endpointResolver:(0,v.createCognitoUserPoolEndpointResolver)({endpointOverride:d})}),S=await h({region:(0,T.getRegionFromUserPoolId)(s),userAgentValue:(0,m.getAuthUserAgentValue)(l.AuthAction.SignIn)},u);return eM(e),S}async function to(e){let{username:t,password:n,options:o}=e,i=c.Amplify.getConfig().Auth?.Cognito,r={loginId:t,authFlowType:"USER_AUTH"};(0,d.assertTokenProviderConfig)(i);let a=o?.clientMetadata,s=o?.preferredChallenge??i?.passwordless?.preferredChallenge;(0,g.assertValidationError)(!!t,x.AuthValidationErrorCode.EmptySignInUsername);try{let e={username:t,config:i,tokenOrchestrator:e5.tokenOrchestrator,clientMetadata:a,preferredChallenge:s,password:n},o=e7.getState();o.active&&o.username===t&&(e.session=o.session);let c=await tn(e),l=e1(t);if((0,y.setActiveSignInState)({signInSession:c.Session,username:l,challengeName:c.ChallengeName,signInDetails:r}),c.AuthenticationResult)return await (0,N.cacheCognitoTokens)({username:l,...c.AuthenticationResult,NewDeviceMetadata:await eR({userPoolId:i.userPoolId,userPoolEndpoint:i.userPoolEndpoint,newDeviceMetadata:c.AuthenticationResult.NewDeviceMetadata,accessToken:c.AuthenticationResult.AccessToken}),signInDetails:r}),(0,y.resetActiveSignInState)(),await (0,f.dispatchSignedInHubEvent)(),e9(),{isSignedIn:!0,nextStep:{signInStep:"DONE"}};return eY({challengeName:c.ChallengeName,challengeParameters:c.ChallengeParameters,availableChallenges:"AvailableChallenges"in c?c.AvailableChallenges:void 0})}catch(t){(0,y.resetActiveSignInState)(),e9(),(0,e6.assertServiceError)(t);let e=eZ(t.name);if(e)return e;throw t}}async function ti(e){e9(!1);let t=e.options?.authFlowType;switch(await e0(),t){case"USER_SRP_AUTH":default:return te(e);case"USER_PASSWORD_AUTH":return tt(e);case"CUSTOM_WITHOUT_SRP":return e8(e);case"CUSTOM_WITH_SRP":return e3(e);case"USER_AUTH":return to(e)}}e.s(["signIn",()=>ti],63007)}]);