@clerk/ui 1.0.0-snapshot.v20251217165918 → 1.0.0-snapshot.v20251218165926

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/dist/573_ui_17c90e_1.0.0-snapshot.v20251218165926.js +1 -0
  2. package/dist/ClerkUi.js +2 -2
  3. package/dist/common/WalletInitialIcon.js +36 -0
  4. package/dist/common/WalletInitialIcon.js.map +1 -0
  5. package/dist/components/OrganizationProfile/MemberListTable.js +3 -1
  6. package/dist/components/OrganizationProfile/MemberListTable.js.map +1 -1
  7. package/dist/components/SessionTasks/tasks/TaskChooseOrganization/index.js +50 -21
  8. package/dist/components/SessionTasks/tasks/TaskChooseOrganization/index.js.map +1 -1
  9. package/dist/components/SignIn/AlternativeMethods.js +1 -1
  10. package/dist/components/SignIn/SignInFactorOneSolanaWalletsCard.js +79 -0
  11. package/dist/components/SignIn/SignInFactorOneSolanaWalletsCard.js.map +1 -0
  12. package/dist/components/SignIn/SignInSocialButtons.js +2 -1
  13. package/dist/components/SignIn/SignInSocialButtons.js.map +1 -1
  14. package/dist/components/SignIn/index.js +5 -0
  15. package/dist/components/SignIn/index.js.map +1 -1
  16. package/dist/components/SignUp/SignUpSocialButtons.js +2 -1
  17. package/dist/components/SignUp/SignUpSocialButtons.js.map +1 -1
  18. package/dist/components/SignUp/SignUpStartSolanaWalletsCard.js +79 -0
  19. package/dist/components/SignUp/SignUpStartSolanaWalletsCard.js.map +1 -0
  20. package/dist/components/SignUp/index.js +5 -0
  21. package/dist/components/SignUp/index.js.map +1 -1
  22. package/dist/components/UserProfile/Web3Form.js +62 -41
  23. package/dist/components/UserProfile/Web3Form.js.map +1 -1
  24. package/dist/components/UserProfile/Web3Section.js +1 -1
  25. package/dist/components/UserProfile/Web3Section.js.map +1 -1
  26. package/dist/components/UserProfile/Web3SelectSolanaWalletScreen.js +73 -0
  27. package/dist/components/UserProfile/Web3SelectSolanaWalletScreen.js.map +1 -0
  28. package/dist/components/devPrompts/EnableOrganizationsPrompt/index.js +173 -110
  29. package/dist/components/devPrompts/EnableOrganizationsPrompt/index.js.map +1 -1
  30. package/dist/customizables/elementDescriptors.js +10 -1
  31. package/dist/customizables/elementDescriptors.js.map +1 -1
  32. package/dist/elements/Web3SolanaWalletButtons.js +182 -0
  33. package/dist/elements/Web3SolanaWalletButtons.js.map +1 -0
  34. package/dist/elements/contexts/index.js.map +1 -1
  35. package/dist/{enableOrganizationsPrompt_ui_7e9f20_1.0.0-snapshot.v20251217165918.js → enableOrganizationsPrompt_ui_17c90e_1.0.0-snapshot.v20251218165926.js} +108 -22
  36. package/dist/foundations/defaultFoundations.d.ts +153 -153
  37. package/dist/index.js +1 -1
  38. package/dist/internal/appearance.d.ts +9 -0
  39. package/dist/internal/appearance.d.ts.map +1 -1
  40. package/dist/internal/index.js +1 -1
  41. package/dist/lazyModules/components.d.ts +20 -20
  42. package/dist/sessionTasks_ui_17c90e_1.0.0-snapshot.v20251218165926.js +1 -0
  43. package/dist/signin_ui_17c90e_1.0.0-snapshot.v20251218165926.js +1 -0
  44. package/dist/signup_ui_17c90e_1.0.0-snapshot.v20251218165926.js +1 -0
  45. package/dist/taskChooseOrganization_ui_17c90e_1.0.0-snapshot.v20251218165926.js +1 -0
  46. package/dist/taskResetPassword_ui_17c90e_1.0.0-snapshot.v20251218165926.js +1 -0
  47. package/dist/themes/shadcn.js +2 -2
  48. package/dist/themes/shadcn.js.map +1 -1
  49. package/dist/ui-common_ui_17c90e_1.0.0-snapshot.v20251218165926.js +139 -0
  50. package/dist/ui.browser.js +3 -3
  51. package/dist/{userprofile_ui_7e9f20_1.0.0-snapshot.v20251217165918.js → userprofile_ui_17c90e_1.0.0-snapshot.v20251218165926.js} +2 -2
  52. package/dist/utils/web3CallbackErrorHandler.js +1 -1
  53. package/dist/utils/web3CallbackErrorHandler.js.map +1 -1
  54. package/dist/vendors_ui_17c90e_1.0.0-snapshot.v20251218165926.js +20 -0
  55. package/dist/web3-solana-wallet-buttons_ui_17c90e_1.0.0-snapshot.v20251218165926.js +143 -0
  56. package/package.json +10 -4
  57. package/dist/573_ui_7e9f20_1.0.0-snapshot.v20251217165918.js +0 -1
  58. package/dist/sessionTasks_ui_7e9f20_1.0.0-snapshot.v20251217165918.js +0 -1
  59. package/dist/signin_ui_7e9f20_1.0.0-snapshot.v20251217165918.js +0 -1
  60. package/dist/signup_ui_7e9f20_1.0.0-snapshot.v20251217165918.js +0 -1
  61. package/dist/taskChooseOrganization_ui_7e9f20_1.0.0-snapshot.v20251217165918.js +0 -1
  62. package/dist/taskResetPassword_ui_7e9f20_1.0.0-snapshot.v20251217165918.js +0 -1
  63. package/dist/ui-common_ui_7e9f20_1.0.0-snapshot.v20251217165918.js +0 -139
  64. package/dist/vendors_ui_7e9f20_1.0.0-snapshot.v20251217165918.js +0 -20
  65. /package/dist/{207_ui_7e9f20_1.0.0-snapshot.v20251217165918.js → 207_ui_17c90e_1.0.0-snapshot.v20251218165926.js} +0 -0
  66. /package/dist/{217_ui_7e9f20_1.0.0-snapshot.v20251217165918.js → 217_ui_17c90e_1.0.0-snapshot.v20251218165926.js} +0 -0
  67. /package/dist/{360_ui_7e9f20_1.0.0-snapshot.v20251217165918.js → 360_ui_17c90e_1.0.0-snapshot.v20251218165926.js} +0 -0
  68. /package/dist/{444_ui_7e9f20_1.0.0-snapshot.v20251217165918.js → 444_ui_17c90e_1.0.0-snapshot.v20251218165926.js} +0 -0
  69. /package/dist/{970_ui_7e9f20_1.0.0-snapshot.v20251217165918.js → 970_ui_17c90e_1.0.0-snapshot.v20251218165926.js} +0 -0
  70. /package/dist/{apiKeys_ui_7e9f20_1.0.0-snapshot.v20251217165918.js → apiKeys_ui_17c90e_1.0.0-snapshot.v20251218165926.js} +0 -0
  71. /package/dist/{blankcaptcha_ui_7e9f20_1.0.0-snapshot.v20251217165918.js → blankcaptcha_ui_17c90e_1.0.0-snapshot.v20251218165926.js} +0 -0
  72. /package/dist/{checkout_ui_7e9f20_1.0.0-snapshot.v20251217165918.js → checkout_ui_17c90e_1.0.0-snapshot.v20251218165926.js} +0 -0
  73. /package/dist/{copy-api-key-modal_ui_7e9f20_1.0.0-snapshot.v20251217165918.js → copy-api-key-modal_ui_17c90e_1.0.0-snapshot.v20251218165926.js} +0 -0
  74. /package/dist/{createorganization_ui_7e9f20_1.0.0-snapshot.v20251217165918.js → createorganization_ui_17c90e_1.0.0-snapshot.v20251218165926.js} +0 -0
  75. /package/dist/{framework_ui_7e9f20_1.0.0-snapshot.v20251217165918.js → framework_ui_17c90e_1.0.0-snapshot.v20251218165926.js} +0 -0
  76. /package/dist/{impersonationfab_ui_7e9f20_1.0.0-snapshot.v20251217165918.js → impersonationfab_ui_17c90e_1.0.0-snapshot.v20251218165926.js} +0 -0
  77. /package/dist/{keylessPrompt_ui_7e9f20_1.0.0-snapshot.v20251217165918.js → keylessPrompt_ui_17c90e_1.0.0-snapshot.v20251218165926.js} +0 -0
  78. /package/dist/{oauthConsent_ui_7e9f20_1.0.0-snapshot.v20251217165918.js → oauthConsent_ui_17c90e_1.0.0-snapshot.v20251218165926.js} +0 -0
  79. /package/dist/{onetap_ui_7e9f20_1.0.0-snapshot.v20251217165918.js → onetap_ui_17c90e_1.0.0-snapshot.v20251218165926.js} +0 -0
  80. /package/dist/{op-api-keys-page_ui_7e9f20_1.0.0-snapshot.v20251217165918.js → op-api-keys-page_ui_17c90e_1.0.0-snapshot.v20251218165926.js} +0 -0
  81. /package/dist/{op-billing-page_ui_7e9f20_1.0.0-snapshot.v20251217165918.js → op-billing-page_ui_17c90e_1.0.0-snapshot.v20251218165926.js} +0 -0
  82. /package/dist/{op-plans-page_ui_7e9f20_1.0.0-snapshot.v20251217165918.js → op-plans-page_ui_17c90e_1.0.0-snapshot.v20251218165926.js} +0 -0
  83. /package/dist/{organizationlist_ui_7e9f20_1.0.0-snapshot.v20251217165918.js → organizationlist_ui_17c90e_1.0.0-snapshot.v20251218165926.js} +0 -0
  84. /package/dist/{organizationprofile_ui_7e9f20_1.0.0-snapshot.v20251217165918.js → organizationprofile_ui_17c90e_1.0.0-snapshot.v20251218165926.js} +0 -0
  85. /package/dist/{organizationswitcher_ui_7e9f20_1.0.0-snapshot.v20251217165918.js → organizationswitcher_ui_17c90e_1.0.0-snapshot.v20251218165926.js} +0 -0
  86. /package/dist/{payment-attempt-page_ui_7e9f20_1.0.0-snapshot.v20251217165918.js → payment-attempt-page_ui_17c90e_1.0.0-snapshot.v20251218165926.js} +0 -0
  87. /package/dist/{planDetails_ui_7e9f20_1.0.0-snapshot.v20251217165918.js → planDetails_ui_17c90e_1.0.0-snapshot.v20251218165926.js} +0 -0
  88. /package/dist/{prefetchorganizationlist_ui_7e9f20_1.0.0-snapshot.v20251217165918.js → prefetchorganizationlist_ui_17c90e_1.0.0-snapshot.v20251218165926.js} +0 -0
  89. /package/dist/{pricingTable_ui_7e9f20_1.0.0-snapshot.v20251217165918.js → pricingTable_ui_17c90e_1.0.0-snapshot.v20251218165926.js} +0 -0
  90. /package/dist/{revoke-api-key-modal_ui_7e9f20_1.0.0-snapshot.v20251217165918.js → revoke-api-key-modal_ui_17c90e_1.0.0-snapshot.v20251218165926.js} +0 -0
  91. /package/dist/{statement-page_ui_7e9f20_1.0.0-snapshot.v20251217165918.js → statement-page_ui_17c90e_1.0.0-snapshot.v20251218165926.js} +0 -0
  92. /package/dist/{subscriptionDetails_ui_7e9f20_1.0.0-snapshot.v20251217165918.js → subscriptionDetails_ui_17c90e_1.0.0-snapshot.v20251218165926.js} +0 -0
  93. /package/dist/{up-api-keys-page_ui_7e9f20_1.0.0-snapshot.v20251217165918.js → up-api-keys-page_ui_17c90e_1.0.0-snapshot.v20251218165926.js} +0 -0
  94. /package/dist/{up-billing-page_ui_7e9f20_1.0.0-snapshot.v20251217165918.js → up-billing-page_ui_17c90e_1.0.0-snapshot.v20251218165926.js} +0 -0
  95. /package/dist/{up-plans-page_ui_7e9f20_1.0.0-snapshot.v20251217165918.js → up-plans-page_ui_17c90e_1.0.0-snapshot.v20251218165926.js} +0 -0
  96. /package/dist/{useravatar_ui_7e9f20_1.0.0-snapshot.v20251217165918.js → useravatar_ui_17c90e_1.0.0-snapshot.v20251218165926.js} +0 -0
  97. /package/dist/{userbutton_ui_7e9f20_1.0.0-snapshot.v20251217165918.js → userbutton_ui_17c90e_1.0.0-snapshot.v20251218165926.js} +0 -0
  98. /package/dist/{userverification_ui_7e9f20_1.0.0-snapshot.v20251217165918.js → userverification_ui_17c90e_1.0.0-snapshot.v20251218165926.js} +0 -0
  99. /package/dist/{waitlist_ui_7e9f20_1.0.0-snapshot.v20251217165918.js → waitlist_ui_17c90e_1.0.0-snapshot.v20251218165926.js} +0 -0
@@ -1,4 +1,4 @@
1
- "use strict";(globalThis.webpackChunk_clerk_ui=globalThis.webpackChunk_clerk_ui||[]).push([["718"],{4308:function(e,r,t){t.r(r),t.d(r,{UserProfile:()=>r4,UserProfileModal:()=>r6});var i=t(4518),n=t(5074),l=t(1227),o=t(3264),a=t(5240),s=t(4607),c=t(2861),d=t(3269),u=t(9764),h=t(5396),m=t(7831),f=t(2265);let p=e=>{let{pages:r,apiKeysProps:t}=(0,a.B)(),n=r.routes.filter(e=>e.id!==l.j2.API_KEYS||!t?.hide);return(0,i.FD)(u.XM,{contentRef:e.contentRef,children:[(0,i.Y)(u.jq,{title:(0,c.G)("userProfile.navbar.title"),description:(0,c.G)("userProfile.navbar.description"),routes:n,contentRef:e.contentRef}),e.children]})};var g=t(540),Y=t(7697),v=t(1210),P=t(6088),b=t(6153),y=t(8272),S=t(8920),_=t(1421),D=t(4003),R=t(8080),G=t(4468),C=t(2660),F=t(3453),$=t(2513),w=t(2216),x=t(4964),I=t(6735);let k=e=>{let{strategy:r}=e,t=(0,d.f0)(),{user:n}=(0,v.Jd)(),{navigate:l}=(0,x.r)(),{strategyToDisplayData:o}=(0,w.k)(),{additionalOAuthScopes:s,componentName:u,mode:h}=(0,a.B)(),m="modal"===h,f=(0,v.Wp)(()=>{let e=r.replace("oauth_",""),t=m?(0,_.j)({url:window.location.href,componentName:u,socialProvider:e}):window.location.href,i=s?s[e]:[];return n?.createExternalAccount({strategy:r,redirectUrl:t,additionalScopes:i})}),p=o[r].iconUrl?(0,i.Y)(y._V,{isLoading:t.loadingMetadata===r,isDisabled:t.isLoading,elementDescriptor:S.$z.providerIcon,elementId:S.$z.providerIcon.setId(o[r].id),src:o[r].iconUrl,alt:`Connect ${o[r].name} account`,sx:e=>({width:e.sizes.$4})}):(0,i.Y)(C.T,{id:o[r].id,value:o[r].name,isLoading:t.loadingMetadata===r,isDisabled:t.isLoading});return(0,i.Y)(D.rd.ActionMenuItem,{id:o[r].id,onClick:()=>{if(n)return t.setLoading(r),f().then(e=>{e&&e.verification?.externalVerificationRedirectURL&&((0,I.y)(2e3).then(()=>t.setIdle(r)),l(e.verification.externalVerificationRedirectURL.href))}).catch(e=>{(0,G.H4)(e,[],t.setError),t.setIdle(r)})},isDisabled:t.isLoading,variant:"ghost",isLoading:t.loadingMetadata===r,focusRing:!1,closeAfterClick:!1,localizationKey:(0,c.G)("userProfile.connectedAccountPage.socialButtonsBlockButton",{provider:o[r].name}),sx:e=>({justifyContent:"start",gap:e.space.$2}),leftIcon:p},r)},A=({onClick:e})=>{let{user:r}=(0,v.Jd)(),{strategies:t}=(0,w.k)(),n=t.filter(e=>e.startsWith("oauth")),l=r?.verifiedExternalAccounts.map(e=>`oauth_${e.provider}`),o=n.filter(e=>!l.includes(e));return 0===o.length?null:(0,i.Y)(D.rd.ActionMenu,{triggerLocalizationKey:(0,c.G)("userProfile.start.connectedAccountsSection.primaryButton"),id:"connectedAccounts",onClick:e,children:o.map(e=>(0,i.Y)(k,{strategy:e},e))})};var z=t(8046);let T=e=>{let{onSuccess:r,onReset:t}=e,{user:l}=(0,v.Jd)(),{emailId:o}=e,a=l?.emailAddresses.find(e=>e.id===o),s=n.useRef(a?.emailAddress),d=a?.verification?.status==="verified"?(0,c.G)("userProfile.emailAddressPage.removeResource.messageLine2"):void 0;return s.current?(0,i.Y)(z.P,{title:(0,c.G)("userProfile.emailAddressPage.removeResource.title"),messageLine1:(0,c.G)("userProfile.emailAddressPage.removeResource.messageLine1",{identifier:s.current}),messageLine2:d,successMessage:(0,c.G)("userProfile.emailAddressPage.removeResource.successMessage",{emailAddress:s.current}),deleteResource:()=>Promise.resolve(a?.destroy()),onSuccess:r,onReset:t}):null},E=e=>{let{phoneId:r,onSuccess:t,onReset:l}=e,{user:o}=(0,v.Jd)(),a=o?.phoneNumbers.find(e=>e.id===r),s=n.useRef(a?.phoneNumber),d=a?.verification?.status==="verified"?(0,c.G)("userProfile.phoneNumberPage.removeResource.messageLine2"):void 0;return s.current?(0,i.Y)(z.P,{title:(0,c.G)("userProfile.phoneNumberPage.removeResource.title"),messageLine1:(0,c.G)("userProfile.phoneNumberPage.removeResource.messageLine1",{identifier:s.current}),messageLine2:d,successMessage:(0,c.G)("userProfile.phoneNumberPage.removeResource.successMessage",{phoneNumber:s.current}),deleteResource:()=>Promise.resolve(a?.destroy()),onSuccess:t,onReset:l}):null},L=e=>{let{accountId:r,onSuccess:t,onReset:l}=e,{user:o}=(0,v.Jd)(),a=o?.externalAccounts.find(e=>e.id===r),s=n.useRef(a?.provider),{providerToDisplayData:d}=(0,w.k)();return s.current?(0,i.Y)(z.P,{title:(0,c.G)("userProfile.connectedAccountPage.removeResource.title"),messageLine1:(0,c.G)("userProfile.connectedAccountPage.removeResource.messageLine1",{identifier:d[s.current]?.name||""}),messageLine2:(0,c.G)("userProfile.connectedAccountPage.removeResource.messageLine2"),successMessage:(0,c.G)("userProfile.connectedAccountPage.removeResource.successMessage",{connectedAccount:d[s.current]?.name||""}),deleteResource:()=>Promise.resolve(a?.destroy()),onSuccess:t,onReset:l}):null},O=e=>{let{user:r}=(0,v.Jd)(),{walletId:t,onSuccess:l,onReset:o}=e,a=r?.web3Wallets.find(e=>e.id===t),s=n.useRef(a?.web3Wallet),d=a?.verification?.status==="verified"?(0,c.G)("userProfile.web3WalletPage.removeResource.messageLine2"):void 0;return s.current?(0,i.Y)(z.P,{title:(0,c.G)("userProfile.web3WalletPage.removeResource.title"),messageLine1:(0,c.G)("userProfile.web3WalletPage.removeResource.messageLine1",{identifier:s.current}),messageLine2:d,successMessage:(0,c.G)("userProfile.web3WalletPage.removeResource.successMessage",{web3Wallet:s.current}),deleteResource:()=>Promise.resolve(a?.destroy()),onSuccess:l,onReset:o}):null},K=e=>{let{user:r}=(0,v.Jd)(),{phoneId:t,onSuccess:l,onReset:o}=e,a=r?.phoneNumbers.find(e=>e.id===t),s=n.useRef(a?.phoneNumber);return s.current?(0,i.Y)(z.P,{title:(0,c.G)("userProfile.mfaPhoneCodePage.removeResource.title"),messageLine1:(0,c.G)("userProfile.mfaPhoneCodePage.removeResource.messageLine1",{identifier:s.current}),messageLine2:(0,c.G)("userProfile.mfaPhoneCodePage.removeResource.messageLine2"),successMessage:(0,c.G)("userProfile.mfaPhoneCodePage.removeResource.successMessage",{mfaPhoneCode:s.current}),deleteResource:()=>Promise.resolve(a?.setReservedForSecondFactor({reserved:!1})),onSuccess:l,onReset:o}):null},M=e=>{let{onSuccess:r,onReset:t}=e,{user:n}=(0,v.Jd)();return n?(0,i.Y)(z.P,{title:(0,c.G)("userProfile.mfaTOTPPage.removeResource.title"),messageLine1:(0,c.G)("userProfile.mfaTOTPPage.removeResource.messageLine1"),messageLine2:(0,c.G)("userProfile.mfaTOTPPage.removeResource.messageLine2"),successMessage:(0,c.G)("userProfile.mfaTOTPPage.removeResource.successMessage"),deleteResource:n.disableTOTP,onSuccess:r,onReset:t}):null},N=e=>{let{onSuccess:r,onReset:t,passkey:n}=e;return(0,i.Y)(z.P,{title:(0,c.G)("userProfile.passkeyScreen.removeResource.title"),messageLine1:(0,c.G)("userProfile.passkeyScreen.removeResource.messageLine1",{name:n.name||""}),deleteResource:n.delete,onSuccess:r,onReset:t})},B=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(L,{onSuccess:r,onReset:r,...e})},W=["external_account_missing_refresh_token","oauth_fetch_user_error","oauth_token_exchange_error","external_account_email_address_verification_required"],J=(0,d.dm)(({shouldAllowCreation:e=!0})=>{let{user:r}=(0,v.Jd)(),t=(0,d.f0)(),l=!!r?.externalAccounts?.length,[o,a]=(0,n.useState)(null);if(!r||!e&&!l)return null;let s=[...r.verifiedExternalAccounts,...r.unverifiedExternalAccounts.filter(e=>e.verification?.error)];return(0,i.FD)(D.rd.Root,{title:(0,c.G)("userProfile.start.connectedAccountsSection.title"),centered:!1,id:"connectedAccounts",children:[(0,i.Y)(P.Z.Alert,{children:t.error}),(0,i.FD)(F.r.Root,{value:o,onChange:a,children:[(0,i.Y)(D.rd.ItemList,{id:"connectedAccounts",children:s.map(e=>(0,i.Y)(q,{account:e},e.id))}),e&&(0,i.Y)(A,{onClick:()=>a(null)})]})]})}),q=({account:e})=>{let{additionalOAuthScopes:r,componentName:t,mode:l}=(0,a.B)(),{navigate:o}=(0,x.r)(),{user:s}=(0,v.Jd)(),u=(0,d.f0)(),h=e.id,m="modal"===l,f=m?(0,_.j)({url:window.location.href,componentName:t}):window.location.href,p=(0,v.Wp)(()=>s?.createExternalAccount({strategy:e.verification.strategy,redirectUrl:f,additionalScopes:b}));if(!s)return null;let{providerToDisplayData:g}=(0,w.k)(),Y=e.username||e.emailAddress,P=e.verification?.error?.longMessage,b=function(e,r){if(!r)return[];let t=r[e.provider]||[],i=e.approvedScopes.split(" ");return 0===t.filter(e=>!i.includes(e)).length?[]:t}(e,r),R=b.length>0&&""!=e.approvedScopes,$=W.includes(e.verification?.error?.code||"")||R,I=$?(0,c.G)("userProfile.start.connectedAccountsSection.subtitle__disconnected"):P,k=async()=>{let r=m?(0,_.j)({url:window.location.href,componentName:t}):window.location.href;try{let t;(t=R?await e.reauthorize({additionalScopes:b,redirectUrl:r}):await p())&&await o(t.verification.externalVerificationRedirectURL?.href||"")}catch(e){(0,G.H4)(e,[],u.setError)}};return(0,i.FD)(n.Fragment,{children:[(0,i.FD)(D.rd.Item,{id:"connectedAccounts",children:[(0,i.FD)(y.so,{sx:e=>({overflow:"hidden",gap:e.space.$2}),children:[(0,i.Y)(()=>g[e.provider].iconUrl?(0,i.Y)(y._V,{elementDescriptor:[S.$z.providerIcon],elementId:S.$z.socialButtonsProviderIcon.setId(e.provider),alt:g[e.provider].name,src:g[e.provider].iconUrl,sx:e=>({width:e.sizes.$4,flexShrink:0})}):(0,i.Y)(C.T,{id:e.provider,value:g[e.provider].name}),{}),(0,i.Y)(y.az,{sx:{whiteSpace:"nowrap",overflow:"hidden"},children:(0,i.FD)(y.so,{gap:1,center:!0,children:[(0,i.Y)(y.EY,{sx:e=>({color:e.colors.$colorForeground}),children:`${g[e.provider].name}`}),(0,i.Y)(y.EY,{truncate:!0,as:"span",colorScheme:"secondary",children:Y?`• ${Y}`:""})]})})]}),(0,i.Y)(U,{account:e})]}),$&&(0,i.FD)(y.az,{sx:e=>({padding:`${e.sizes.$none} ${e.sizes.$none} ${e.sizes.$1x5} ${e.sizes.$8x5}`}),children:[(0,i.Y)(y.EY,{colorScheme:"secondary",sx:e=>({paddingRight:e.sizes.$1x5,display:"inline-block"}),localizationKey:I}),(0,i.Y)(y.$n,{sx:{display:"inline-block"},onClick:k,variant:"link",localizationKey:(0,c.G)("userProfile.start.connectedAccountsSection.actionLabel__connectionFailed")})]}),e.verification?.error?.code&&!$&&(0,i.Y)(y.EY,{colorScheme:"danger",sx:e=>({padding:`${e.sizes.$none} ${e.sizes.$1x5} ${e.sizes.$1x5} ${e.sizes.$8x5}`}),children:P}),(0,i.Y)(F.r.Open,{value:`remove-${h}`,children:(0,i.Y)(F.r.Card,{variant:"destructive",children:(0,i.Y)(B,{accountId:e.id})})})]},e.id)},U=({account:e})=>{let{open:r}=(0,$.D5)(),t=e.id,n=[{label:(0,c.G)("userProfile.start.connectedAccountsSection.destructiveActionTitle"),isDestructive:!0,onClick:()=>r(`remove-${t}`)}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:n})},j=e=>e.defaultSecondFactor?-1:1;function V(e){let r=[];return Object.entries(e).forEach(([,e])=>{e.used_for_second_factor&&r.push(...e.second_factors)}),r}function H(e,r){let t=V(e);return r.totpEnabled&&(t=t.filter(e=>"totp"!==e)),(r.backupCodeEnabled||!r.twoFactorEnabled)&&(t=t.filter(e=>"backup_code"!==e)),t}function Z(e,r){if(!e)return[];let t=e.filter(e=>e.id===r),i=e.filter(e=>e.id!==r),n=i.filter(e=>e.verification?.status==="verified"),l=i.filter(e=>!!e.verification?.status&&e.verification?.status!=="verified"),o=i.filter(e=>!e.verification.status);return n.sort((e,r)=>e.id.localeCompare(r.id)),l.sort((e,r)=>e.verification?.expireAt&&r.verification?.expireAt?e.verification.expireAt.getTime()-r.verification.expireAt.getTime():0),[...t,...n,...l,...o]}var X=t(2336);let Q=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(T,{onSuccess:r,onReset:r,...e})},ee=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(X.v,{onSuccess:r,onReset:r,...e})},er=({shouldAllowCreation:e=!0})=>{let{user:r}=(0,v.Jd)();return(0,i.Y)(D.rd.Root,{title:(0,c.G)("userProfile.start.emailAddressesSection.title"),centered:!1,id:"emailAddresses",children:(0,i.Y)(F.r.Root,{children:(0,i.FD)(D.rd.ItemList,{id:"emailAddresses",children:[Z(r?.emailAddresses,r?.primaryEmailAddressId).map(e=>{let t=e.id;return(0,i.FD)(n.Fragment,{children:[(0,i.FD)(D.rd.Item,{id:"emailAddresses",children:[(0,i.FD)(y.so,{sx:e=>({overflow:"hidden",gap:e.space.$1}),children:[(0,i.Y)(y.EY,{sx:e=>({color:e.colors.$colorForeground}),truncate:!0,children:e.emailAddress}),r?.primaryEmailAddressId===t&&(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__primary")}),"verified"!==e.verification.status&&(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__unverified")})]}),(0,i.Y)(et,{email:e})]}),(0,i.Y)(F.r.Open,{value:`remove-${t}`,children:(0,i.Y)(F.r.Card,{variant:"destructive",children:(0,i.Y)(Q,{emailId:t})})}),(0,i.Y)(F.r.Open,{value:`verify-${t}`,children:(0,i.Y)(F.r.Card,{children:(0,i.Y)(ee,{emailId:t})})})]},e.emailAddress)}),e&&(0,i.FD)(i.FK,{children:[(0,i.Y)(F.r.Trigger,{value:"add",children:(0,i.Y)(D.rd.ArrowButton,{id:"emailAddresses",localizationKey:(0,c.G)("userProfile.start.emailAddressesSection.primaryButton")})}),(0,i.Y)(F.r.Open,{value:"add",children:(0,i.Y)(F.r.Card,{children:(0,i.Y)(ee,{})})})]})]})})})},et=({email:e})=>{let r=(0,d.f0)(),{user:t}=(0,v.Jd)(),{open:n}=(0,$.D5)(),l=e.id,o=t?.primaryEmailAddressId===l,a="verified"===e.verification.status,s=(0,v.Wp)(()=>t?.update({primaryEmailAddressId:l})),u=[o&&!a?{label:(0,c.G)("userProfile.start.emailAddressesSection.detailsAction__primary"),onClick:()=>n(`verify-${l}`)}:null,!o&&a?{label:(0,c.G)("userProfile.start.emailAddressesSection.detailsAction__nonPrimary"),onClick:()=>{s().catch(e=>(0,G.H4)(e,[],r.setError))}}:null,!o&&!a?{label:(0,c.G)("userProfile.start.emailAddressesSection.detailsAction__unverified"),onClick:()=>n(`verify-${l}`)}:null,{label:(0,c.G)("userProfile.start.emailAddressesSection.destructiveAction"),isDestructive:!0,onClick:()=>n(`remove-${l}`)}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:u})},ei=()=>{let{user:e}=(0,v.Jd)(),r=e?.enterpriseAccounts.filter(({enterpriseConnection:e})=>e?.active);return r?.length?(0,i.Y)(D.rd.Root,{title:(0,c.G)("userProfile.start.enterpriseAccountsSection.title"),id:"enterpriseAccounts",centered:!1,children:(0,i.Y)(D.rd.ItemList,{id:"enterpriseAccounts",children:r.map(e=>(0,i.Y)(en,{account:e},e.id))})}):null},en=({account:e})=>{let r=e.emailAddress,t=e?.enterpriseConnection?.name,n=e.verification?.error?.longMessage;return(0,i.FD)(D.rd.Item,{id:"enterpriseAccounts",sx:e=>({gap:e.space.$2,justifyContent:"start"}),children:[(0,i.Y)(el,{account:e}),(0,i.Y)(y.az,{sx:{whiteSpace:"nowrap",overflow:"hidden"},children:(0,i.FD)(y.so,{gap:1,center:!0,children:[(0,i.Y)(y.EY,{truncate:!0,colorScheme:"body",children:t}),(0,i.Y)(y.EY,{truncate:!0,as:"span",colorScheme:"secondary",children:r?`• ${r}`:""}),n&&(0,i.Y)(y.Ex,{colorScheme:"danger",localizationKey:(0,c.G)("badge__requiresAction")})]})})]},e.id)},el=({account:e})=>{let{provider:r,enterpriseConnection:t}=e,n=r.replace(/(oauth_|saml_)/,"").trim(),l=t?.name??n,o={elementDescriptor:[S.$z.providerIcon],alt:l,sx:e=>({width:e.sizes.$4}),elementId:S.$z.enterpriseButtonsProviderIcon.setId(e.provider)};return t?.logoPublicUrl?(0,i.Y)(y._V,{...o,src:t.logoPublicUrl}):(0,i.Y)(C.T,{id:n,value:l,"aria-label":`${l}'s icon`,elementDescriptor:[S.$z.providerIcon,S.$z.providerInitialIcon],elementId:S.$z.providerInitialIcon.setId(n)})};var eo=t(7651),ea=t(2454),es=t(1475),ec=t(3549),ed=t(8640),eu=t(6245),eh=t(1282);let em=(0,d.dm)(e=>{let{phoneId:r,onSuccess:t,onReset:l}=e,{user:o}=(0,v.Jd)(),a=n.useRef(o?.phoneNumbers.find(e=>e.id===r)),s=(0,eu.X)({defaultStep:+!!a.current});return(0,i.FD)(eu.s,{...s.props,children:[(0,i.Y)(ef,{resourceRef:a,title:(0,c.G)("userProfile.phoneNumberPage.title"),onSuccess:s.nextStep,onReset:l}),(0,i.Y)(ep,{resourceRef:a,title:(0,c.G)("userProfile.phoneNumberPage.verifyTitle"),onSuccess:t,onReset:l})]})}),ef=e=>{let{title:r,onSuccess:t,onReset:n,onUseExistingNumberClick:l,resourceRef:o}=e,a=(0,d.f0)(),{user:s}=(0,v.Jd)(),u=(0,v.Wp)((e,r)=>e.createPhoneNumber(r)),h=(0,ed.tJ)("phoneNumber","",{type:"tel",label:(0,c.G)("formFieldLabel__phoneNumber"),isRequired:!0}),m=h.value.length>1&&s?.username!==h.value,f=!!s?.phoneNumbers?.length&&l,p=async e=>{if(e.preventDefault(),s)return u(s,{phoneNumber:h.value}).then(e=>{o.current=e,t()}).catch(e=>(0,G.H4)(e,[h],a.setError))};return(0,i.Y)(ec.M,{headerTitle:r,gap:1,children:(0,i.FD)(ea.l.Root,{gap:4,onSubmit:p,children:[(0,i.Y)(y.EY,{localizationKey:(0,c.G)("userProfile.phoneNumberPage.infoText"),colorScheme:"secondary"}),(0,i.Y)(ea.l.ControlRow,{elementId:h.id,children:(0,i.Y)(ea.l.PhoneInput,{...h.props,autoFocus:!0})}),(0,i.FD)(y.so,{justify:f?"between":"end",children:[f&&(0,i.Y)(y.$n,{variant:"ghost",localizationKey:(0,c.G)("userProfile.mfaPhoneCodePage.backButton"),onClick:l}),(0,i.Y)(es.G,{submitLabel:(0,c.G)("userProfile.formButtonPrimary__add"),isDisabled:!m,onReset:n})]})]})})},ep=e=>{let{title:r,onSuccess:t,resourceRef:n,onReset:l}=e;return(0,i.Y)(ec.M,{headerTitle:r,headerSubtitle:(0,c.G)("userProfile.phoneNumberPage.verifySubtitle",{identifier:n.current?.phoneNumber||""}),children:(0,i.Y)(eh.j,{nextStep:t,identification:n.current,identifier:n.current?.phoneNumber,prepareVerification:n.current?.prepareVerification,onReset:l})})},eg=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(E,{onSuccess:r,onReset:r,...e})},eY=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(em,{onSuccess:r,onReset:r,...e})},ev=({shouldAllowCreation:e=!0})=>{let{user:r}=(0,v.Jd)(),t=!!r?.phoneNumbers?.length;return e||t?(0,i.Y)(D.rd.Root,{centered:!1,title:(0,c.G)("userProfile.start.phoneNumbersSection.title"),id:"phoneNumbers",children:(0,i.Y)(F.r.Root,{children:(0,i.FD)(D.rd.ItemList,{id:"phoneNumbers",children:[Z(r?.phoneNumbers,r?.primaryPhoneNumberId).map(e=>{let t=e.id;return(0,i.FD)(n.Fragment,{children:[(0,i.FD)(D.rd.Item,{id:"phoneNumbers",children:[(0,i.Y)(y.az,{sx:{whiteSpace:"nowrap",overflow:"hidden"},children:(0,i.FD)(y.so,{gap:2,center:!0,children:[(0,i.Y)(y.EY,{sx:e=>({color:e.colors.$colorForeground}),children:(0,eo.Om)(e.phoneNumber)}),r?.primaryPhoneNumberId===t&&(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__primary")}),"verified"!==e.verification.status&&(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__unverified")})]})}),(0,i.Y)(eP,{phone:e})]}),(0,i.Y)(F.r.Open,{value:`remove-${t}`,children:(0,i.Y)(F.r.Card,{variant:"destructive",children:(0,i.Y)(eg,{phoneId:t})})}),(0,i.Y)(F.r.Open,{value:`verify-${t}`,children:(0,i.Y)(F.r.Card,{children:(0,i.Y)(eY,{phoneId:t})})})]},t)}),e&&(0,i.FD)(i.FK,{children:[(0,i.Y)(F.r.Trigger,{value:"add",children:(0,i.Y)(D.rd.ArrowButton,{id:"phoneNumbers",localizationKey:(0,c.G)("userProfile.start.phoneNumbersSection.primaryButton")})}),(0,i.Y)(F.r.Open,{value:"add",children:(0,i.Y)(F.r.Card,{children:(0,i.Y)(eY,{})})})]})]})})}):null},eP=({phone:e})=>{let r=(0,d.f0)(),{open:t}=(0,$.D5)(),{user:n}=(0,v.Jd)(),l=e.id,o=(0,v.Wp)(r=>r.update({primaryPhoneNumberId:e.id}));if(!n)return null;let a=n.primaryPhoneNumberId===e.id,s="verified"===e.verification.status,u=[a&&!s?{label:(0,c.G)("userProfile.start.phoneNumbersSection.detailsAction__primary"),onClick:()=>t(`verify-${l}`)}:null,!a&&s?{label:(0,c.G)("userProfile.start.phoneNumbersSection.detailsAction__nonPrimary"),onClick:()=>o(n).catch(e=>(0,G.H4)(e,[],r.setError))}:null,!a&&!s?{label:(0,c.G)("userProfile.start.phoneNumbersSection.detailsAction__unverified"),onClick:()=>t(`verify-${l}`)}:null,{label:(0,c.G)("userProfile.start.phoneNumbersSection.destructiveAction"),isDestructive:!0,onClick:()=>t(`remove-${l}`)}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:u})};var eb=t(7591),ey=t(4557),eS=t(78);let e_=(0,d.dm)(e=>{let{onSuccess:r,onReset:t}=e,{user:n}=(0,v.Jd)(),l=(0,v.Wp)(e=>n?.update({username:e})),{userSettings:o}=(0,Y.O)(),a=(0,d.f0)(),{t:s,locale:u}=(0,eS._)(),{usernameSettings:h}=o,m=(0,ed.tJ)("username",n?.username||"",{type:"text",label:(0,c.G)("formFieldLabel__username"),placeholder:(0,c.G)("formFieldInputPlaceholder__username"),buildErrorMessage:e=>(0,ey.Z)(e,{t:s,locale:u,usernameSettings:h})});if(!n)return null;let f=o.attributes.username?.required,p=(!f||m.value.length>0)&&n.username!==m.value,g=async()=>{try{await l(m.value),r()}catch(e){(0,G.H4)(e,[m],a.setError)}};return(0,i.Y)(ec.M,{headerTitle:n.username?(0,c.G)("userProfile.usernamePage.title__update"):(0,c.G)("userProfile.usernamePage.title__set"),children:(0,i.FD)(ea.l.Root,{onSubmit:g,children:[(0,i.Y)(ea.l.ControlRow,{elementId:m.id,children:(0,i.Y)(ea.l.PlainInput,{...m.props,autoFocus:!0,isRequired:f})}),(0,i.Y)(es.G,{isDisabled:!p,onReset:t})]})})}),eD=()=>{let{close:e}=(0,$.D5)();return(0,i.Y)(e_,{onSuccess:e,onReset:e})},eR=()=>{let{user:e}=(0,v.Jd)();return e?(0,i.Y)(D.rd.Root,{title:(0,c.G)("userProfile.start.usernameSection.title"),id:"username",sx:{alignItems:"center",[eb.g.md]:{alignItems:"flex-start"}},children:(0,i.FD)(F.r.Root,{children:[(0,i.Y)(F.r.Closed,{value:"edit",children:(0,i.FD)(D.rd.Item,{id:"username",sx:{paddingLeft:e.username?void 0:"0"},children:[e.username&&(0,i.Y)(y.EY,{truncate:!0,sx:e=>({color:e.colors.$colorForeground}),children:e.username}),(0,i.Y)(F.r.Trigger,{value:"edit",children:(0,i.Y)(D.rd.Button,{id:"username",localizationKey:e.username?(0,c.G)("userProfile.start.usernameSection.primaryButton__updateUsername"):(0,c.G)("userProfile.start.usernameSection.primaryButton__setUsername")})})]})}),(0,i.Y)(F.r.Open,{value:"edit",children:(0,i.Y)(F.r.Card,{children:(0,i.Y)(eD,{})})})]})}):null};var eG=t(9345),eC=t(2421),eF=t(8225),e$=t(3817),ew=t(9538);let ex=e=>{let{user:r,...t}=e;return(0,i.Y)(e$.k,{...t,title:(0,c.G)("userProfile.profilePage.imageFormTitle"),avatarPreview:(0,i.Y)(ew.H,{size:e=>e.sizes.$12,...r})})},eI=(0,d.dm)(e=>{let{onSuccess:r,onReset:t}=e,n=(0,d.f0)(),{user:l}=(0,v.Jd)();if(!l)return null;let{first_name:o,last_name:a}=(0,Y.O)().userSettings.attributes,s=o?.enabled,u=a?.enabled,h=l.firstName||"",m=l.lastName||"",f=(0,ed.tJ)("firstName",l.firstName||"",{type:"text",label:(0,c.G)("formFieldLabel__firstName"),placeholder:(0,c.G)("formFieldInputPlaceholder__firstName"),isRequired:a?.required}),p=(0,ed.tJ)("lastName",l.lastName||"",{type:"text",label:(0,c.G)("formFieldLabel__lastName"),placeholder:(0,c.G)("formFieldInputPlaceholder__lastName"),isRequired:a?.required}),g=s&&f.value!==h||u&&p.value!==m,P=s&&o.required||u&&a.required,b=P&&!!p.value&&!!f.value&&g,y=l.enterpriseAccounts.some(e=>e.active),S=async e=>(e.preventDefault(),(g?l.update({firstName:f.value,lastName:p.value}):Promise.resolve()).then(r).catch(e=>{(0,G.H4)(e,[f,p],n.setError)}));return(0,i.FD)(ec.M,{headerTitle:(0,c.G)("userProfile.profilePage.title"),children:[y&&(0,i.Y)(eC.k,{message:(0,c.G)("userProfile.profilePage.readonly")}),(0,i.FD)(ea.l.Root,{onSubmit:S,sx:e=>({gap:e.space.$6}),children:[(0,i.Y)(ex,{user:l,onAvatarChange:e=>l.setProfileImage({file:e}).then(()=>{n.setIdle(),r?.()}).catch(e=>(0,G.H4)(e,[],n.setError)),onAvatarRemove:(0,eF.p)(l.imageUrl)?null:()=>{l.setProfileImage({file:null}).then(()=>{n.setIdle(),r?.()}).catch(e=>(0,G.H4)(e,[],n.setError))}}),(s||u)&&(0,i.FD)(ea.l.ControlRow,{elementId:"name",children:[s&&(0,i.Y)(ea.l.PlainInput,{...f.props,isDisabled:y,autoFocus:!0}),u&&(0,i.Y)(ea.l.PlainInput,{...p.props,isDisabled:y,autoFocus:!s})]}),(0,i.Y)(es.G,{isDisabled:P?!b:!g,onReset:t})]})]})}),ek=()=>{let{close:e}=(0,$.D5)();return(0,i.Y)(eI,{onSuccess:e,onReset:e})},eA=()=>{let{user:e}=(0,v.Jd)();if(!e)return null;let{username:r,primaryEmailAddress:t,primaryPhoneNumber:n,primaryWeb3Wallet:l,...o}=e;return(0,i.Y)(D.rd.Root,{title:(0,c.G)("userProfile.start.profileSection.title"),id:"profile",sx:{[eb.g.md]:{alignItems:"flex-start"}},children:(0,i.FD)(F.r.Root,{children:[(0,i.Y)(F.r.Closed,{value:"edit",children:(0,i.FD)(D.rd.Item,{id:"profile",children:[(0,i.Y)(eG.c,{user:o,size:"lg",mainIdentifierVariant:"subtitle",sx:e=>({color:e.colors.$colorForeground})}),(0,i.Y)(F.r.Trigger,{value:"edit",children:(0,i.Y)(D.rd.Button,{id:"profile",localizationKey:(0,c.G)("userProfile.start.profileSection.primaryButton")})})]})}),(0,i.Y)(F.r.Open,{value:"edit",children:(0,i.Y)(F.r.Card,{children:(0,i.Y)(ek,{})})})]})})};var ez=t(8099),eT=t(5243);let eE=(0,d.dm)(({onClick:e})=>{let r=(0,d.f0)(),{user:t}=(0,v.Jd)(),{strategies:n,strategyToDisplayData:l}=(0,w.k)(),o=(0,eT.R)(),a=n.filter(e=>e.startsWith("web3")),s=t?.verifiedWeb3Wallets.map(e=>e.verification.strategy),u=a.filter(e=>!s.includes(e)),h=(0,v.Wp)(e=>t?.createWeb3Wallet({web3Wallet:e})),m=async e=>{let i=(0,ez.U)(o),n=e.replace("web3_","").replace("_signature","");r.setError(void 0);try{r.setLoading(e);let l=await i.getWeb3Identifier({provider:n});if(!t)throw Error("user is not defined");let o=await h(l);o=await o?.prepareVerification({strategy:e});let a=o?.verification.message,s=await i.generateWeb3Signature({identifier:l,nonce:a,provider:n});await o?.attemptVerification({signature:s}),r.setIdle()}catch(t){r.setIdle();let e=(0,G.hG)(t);e?r.setError(e.longMessage):(0,G.H4)(t,[],r.setError)}};return 0===u.length?null:(0,i.FD)(i.FK,{children:[(0,i.Y)(D.rd.ActionMenu,{id:"web3Wallets",triggerLocalizationKey:(0,c.G)("userProfile.start.web3WalletsSection.primaryButton"),onClick:e,children:u.map(e=>(0,i.Y)(D.rd.ActionMenuItem,{id:l[e].id,onClick:()=>{m(e)},isLoading:r.loadingMetadata===e,isDisabled:r.isLoading,localizationKey:(0,c.G)("userProfile.web3WalletPage.web3WalletButtonsBlockButton",{provider:l[e].name}),sx:e=>({justifyContent:"start",gap:e.space.$2}),leftIcon:(0,i.Y)(y._V,{elementDescriptor:S.$z.providerIcon,elementId:S.$z.providerIcon.setId(l[e].id),isLoading:r.loadingMetadata===e,isDisabled:r.isLoading,src:l[e].iconUrl,alt:`Connect ${l[e].name}`,sx:e=>({width:e.sizes.$5})})},e))}),r.error&&(0,i.Y)(y.EY,{colorScheme:"danger",sx:e=>({padding:e.sizes.$1x5,paddingLeft:e.sizes.$8x5}),children:r.error})]})}),eL=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(O,{onSuccess:r,onReset:r,...e})},eO=(0,d.dm)(({shouldAllowCreation:e=!0})=>{let{user:r}=(0,v.Jd)(),t=(0,d.f0)(),{strategyToDisplayData:l}=(0,w.k)(),o=!!r?.web3Wallets?.length,[a,s]=(0,n.useState)(null);return e||o?(0,i.FD)(D.rd.Root,{title:(0,c.G)("userProfile.start.web3WalletsSection.title"),centered:!1,id:"web3Wallets",children:[(0,i.Y)(P.Z.Alert,{children:t.error}),(0,i.FD)(F.r.Root,{value:a,onChange:s,children:[(0,i.Y)(D.rd.ItemList,{id:"web3Wallets",children:Z(r?.web3Wallets,r?.primaryWeb3WalletId).map(e=>{var t;let o=e.verification.strategy,a=e.id;return l[o]&&(0,i.FD)(n.Fragment,{children:[(0,i.FD)(D.rd.Item,{id:"web3Wallets",align:"start",children:[(0,i.FD)(y.so,{sx:e=>({alignItems:"center",gap:e.space.$2,width:"100%"}),children:[l[o].iconUrl&&(0,i.Y)(y._V,{src:l[o].iconUrl,alt:l[o].name,sx:e=>({width:e.sizes.$4})}),(0,i.Y)(y.az,{sx:{whiteSpace:"nowrap",overflow:"hidden"},children:(0,i.FD)(y.so,{gap:2,justify:"start",children:[(0,i.FD)(y.EY,{children:[l[o].name," (",(t=e.web3Wallet).length<=10?t:t.slice(0,6)+"..."+t.slice(-4),")"]}),r?.primaryWeb3WalletId===a&&(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__primary")}),"verified"!==e.verification.status&&(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__unverified")})]})})]}),(0,i.Y)(eK,{walletId:a})]},a),(0,i.Y)(F.r.Open,{value:`remove-${a}`,children:(0,i.Y)(F.r.Card,{variant:"destructive",children:(0,i.Y)(eL,{walletId:e.id})})})]},e.id)})}),e&&(0,i.Y)(eE,{onClick:()=>s(null)})]})]}):null}),eK=({walletId:e})=>{let r=(0,d.f0)(),{open:t}=(0,$.D5)(),{user:n}=(0,v.Jd)(),l=n?.primaryWeb3WalletId===e,o=(0,v.Wp)(()=>n?.update({primaryWeb3WalletId:e})),a=[!l?{label:(0,c.G)("userProfile.start.web3WalletsSection.detailsAction__nonPrimary"),onClick:()=>{o().catch(e=>(0,G.H4)(e,[],r.setError))}}:null,{label:(0,c.G)("userProfile.start.web3WalletsSection.destructiveAction"),isDestructive:!0,onClick:()=>t(`remove-${e}`)}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:a})},eM=(0,d.dm)(()=>{let{attributes:e,social:r,enterpriseSSO:t}=(0,Y.O)().userSettings,n=(0,d.f0)(),{user:l}=(0,v.Jd)(),{shouldAllowIdentificationCreation:o}=(0,a.B)(),s=e.username?.enabled,u=e.email_address?.enabled,h=e.phone_number?.enabled,m=r&&Object.values(r).filter(e=>e.enabled).length>0,f=l&&t.enabled,p=e.web3_wallet?.enabled;return(0,i.Y)(y.fv,{elementDescriptor:S.$z.page,sx:e=>({gap:e.space.$8,color:e.colors.$colorForeground}),children:(0,i.FD)(y.fv,{elementDescriptor:S.$z.profilePage,elementId:S.$z.profilePage.setId("account"),children:[(0,i.Y)(b.Y.Root,{children:(0,i.Y)(b.Y.Title,{localizationKey:(0,c.G)("userProfile.start.headerTitle__account"),sx:e=>({marginBottom:e.space.$4}),textVariant:"h2"})}),(0,i.Y)(P.Z.Alert,{children:n.error}),(0,i.Y)(eA,{}),s&&(0,i.Y)(eR,{}),u&&(0,i.Y)(er,{shouldAllowCreation:o}),h&&(0,i.Y)(ev,{shouldAllowCreation:o}),m&&(0,i.Y)(J,{shouldAllowCreation:o}),f&&(0,i.Y)(ei,{}),p&&(0,i.Y)(eO,{shouldAllowCreation:o})]})})});var eN=t(2611),eB=t(7806),eW=t(7896),eJ=t(4901),eq=t(892),eU=t(8910);let ej=()=>{let e,{user:r}=(0,v.Jd)(),{session:t}=(0,v.wV)(),{data:n,isLoading:l}=(0,eW.s)(r?.getSessions,"user-sessions");return(0,i.Y)(D.rd.Root,{title:(0,c.G)("userProfile.start.activeDevicesSection.title"),centered:!1,id:"activeDevices",children:(0,i.Y)(D.rd.ItemList,{id:"activeDevices",disableAnimation:!0,children:l?(0,i.Y)(eN.K,{}):n?.sort((e=t.id,r=>r.id===e?-1:1)).map(e=>eV(e.status)?(0,i.Y)(eH,{session:e},e.id):null)})})},eV=e=>["active","pending"].includes(e),eH=({session:e})=>{let r=(0,v.wV)().session?.id===e.id,t=(0,eJ.m)(),n=(0,v.Wp)(e.revoke.bind(e)),l=async()=>{if(!r&&e)return t.setLoading(),n().catch(e=>(0,G.H4)(e,[],t.setError)).finally(()=>t.setIdle())};return(0,i.Y)(D.rd.Item,{id:"activeDevices",elementDescriptor:S.$z.activeDeviceListItem,elementId:r?S.$z.activeDeviceListItem.setId("current"):void 0,sx:{alignItems:"flex-start",opacity:t.isLoading?.5:1},isDisabled:t.isLoading,children:(0,i.FD)(i.FK,{children:[(0,i.Y)(eZ,{session:e}),!r&&(0,i.Y)(eX,{revoke:l})]})})},eZ=e=>{let{session:r}=(0,v.wV)(),t=r?.id===e.session.id,n=!!r?.actor,l=!!e.session.actor,{city:o,country:a,browserName:s,browserVersion:d,deviceType:u,ipAddress:h,isMobile:m}=e.session.latestActivity,f=`${s||""} ${d||""}`.trim()||"Web browser",p=[o||"",a||""].filter(Boolean).join(", ").trim()||null,{t:g}=(0,eS._)();return(0,i.FD)(y.so,{elementDescriptor:S.$z.activeDevice,elementId:t?S.$z.activeDevice.setId("current"):void 0,sx:e=>({width:"100%",overflow:"hidden",gap:e.space.$4,[eb.g.sm]:{gap:e.space.$2}}),children:[(0,i.Y)(y.so,{sx:e=>({[eb.g.sm]:{padding:"0"},borderRadius:e.radii.$md}),children:(0,i.Y)(y.In,{elementDescriptor:S.$z.activeDeviceIcon,elementId:S.$z.activeDeviceIcon.setId(m?"mobile":"desktop"),icon:m?eq.A:eU.A,sx:e=>({"--cl-chassis-bottom":"#444444","--cl-chassis-back":"#343434","--cl-chassis-screen":"#575757","--cl-screen":"#000000",width:e.space.$8,height:e.space.$8})})}),(0,i.FD)(y.fv,{align:"start",gap:1,children:[(0,i.FD)(y.so,{center:!0,gap:2,children:[(0,i.Y)(y.EY,{children:u||(m?"Mobile device":"Desktop device")}),t&&(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__thisDevice"),colorScheme:n?"danger":"primary"}),n&&!l&&(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__userDevice")}),!t&&l&&(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__otherImpersonatorDevice"),colorScheme:"danger"})]}),(0,i.Y)(y.EY,{colorScheme:"secondary",children:f}),(0,i.FD)(y.EY,{colorScheme:"secondary",children:[h," (",p,")"]}),(0,i.Y)(y.EY,{colorScheme:"secondary",children:g((0,eB.T)(e.session.lastActiveAt))})]})]})},eX=({revoke:e})=>{let r=[{label:(0,c.G)("userProfile.start.activeDevicesSection.destructiveAction"),isDestructive:!0,onClick:e}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:r})};var eQ=t(9599),e0=t(8691);let e1=(0,d.dm)(e=>{let{onReset:r}=e,t=(0,d.f0)(),{afterSignOutUrl:n,afterMultiSessionSingleSignOutUrl:l}=(0,eQ.g)(),{user:o}=(0,v.Jd)(),{t:a}=(0,eS._)(),{otherSessions:s}=(0,e0.z)({user:o}),{setActive:u}=(0,v.ho)(),h=(0,v.Wp)(()=>o?.delete()),m=(0,ed.tJ)("deleteConfirmation","",{type:"text",label:(0,c.G)("userProfile.deletePage.actionDescription"),isRequired:!0,placeholder:(0,c.G)("formFieldInputPlaceholder__confirmDeletionUserAccount")}),f=m.value===(a((0,c.G)("formFieldInputPlaceholder__confirmDeletionUserAccount"))||"Delete account"),p=async()=>{if(f)try{await h();let e=0===s.length?n:l;return await u({session:null,redirectUrl:e})}catch(e){(0,G.H4)(e,[],t.setError)}};return(0,i.Y)(ec.M,{headerTitle:(0,c.G)("userProfile.deletePage.title"),sx:e=>({gap:e.space.$0x5}),children:(0,i.FD)(ea.l.Root,{onSubmit:p,children:[(0,i.FD)(y.fv,{gap:1,children:[(0,i.Y)(y.EY,{colorScheme:"secondary",localizationKey:(0,c.G)("userProfile.deletePage.messageLine1")}),(0,i.Y)(y.EY,{colorScheme:"danger",localizationKey:(0,c.G)("userProfile.deletePage.messageLine2")})]}),(0,i.Y)(ea.l.ControlRow,{elementId:m.id,children:(0,i.Y)(ea.l.PlainInput,{...m.props,ignorePasswordManager:!0})}),(0,i.Y)(es.G,{submitLabel:(0,c.G)("userProfile.deletePage.confirm"),colorScheme:"danger",isDisabled:!f,onReset:r})]})})}),e2=()=>{let{close:e}=(0,$.D5)();return(0,i.Y)(e1,{onSuccess:e,onReset:e})},e5=()=>(0,i.Y)(D.rd.Root,{title:(0,c.G)("userProfile.start.dangerSection.title"),id:"danger",sx:{alignItems:"center",[eb.g.md]:{alignItems:"flex-start"}},children:(0,i.FD)(F.r.Root,{children:[(0,i.Y)(F.r.Closed,{value:"delete",children:(0,i.Y)(D.rd.Item,{id:"danger",sx:e=>({paddingLeft:e.space.$1}),children:(0,i.Y)(F.r.Trigger,{value:"delete",children:(0,i.Y)(D.rd.Button,{id:"danger",variant:"ghost",colorScheme:"danger",localizationKey:(0,c.G)("userProfile.start.dangerSection.deleteAccountButton")})})})}),(0,i.Y)(F.r.Open,{value:"delete",children:(0,i.Y)(F.r.Card,{variant:"destructive",children:(0,i.Y)(e2,{})})})]})});var e4=t(1323),e3=t(5079),e6=t(6103),e8=t(2534),e7=t(3610),e9=t(8095),re=t(9126),rr=t(7782),rt=t(1072),ri=t(5976),rn=t(2405),rl=t(2852);let ro=e=>{let{code:r}=e;return(0,i.Y)(y.so,{center:!0,sx:e=>({padding:`${e.space.$1} ${e.space.$4}`}),children:(0,i.Y)(y.EY,{children:r})})},ra=e=>{let{subtitle:r,backupCodes:t}=e,{applicationName:n}=(0,Y.O)().displayConfig,{user:l}=(0,v.Jd)(),{print:o,printableProps:a}=(0,re.h)(),{onCopy:s,hasCopied:d}=(0,rr.i)(t?.join(",")||"");if(!l)return null;let u=(0,e9.Cm)(l);return t?(0,i.FD)(i.FK,{children:[(0,i.FD)(y.fv,{gap:1,children:[(0,i.Y)(y.EY,{localizationKey:(0,c.G)("userProfile.backupCodePage.title__codelist"),variant:"subtitle"}),(0,i.Y)(y.EY,{localizationKey:r,variant:"caption",colorScheme:"secondary"})]}),(0,i.FD)(y.az,{sx:e=>({borderWidth:e.borderWidths.$normal,borderStyle:e.borderStyles.$solid,borderColor:e.colors.$borderAlpha100,borderRadius:e.radii.$lg}),children:[(0,i.Y)(y.xA,{gap:2,sx:e=>({gridTemplateColumns:`repeat(2, minmax(${e.sizes.$12}, 1fr))`,padding:`${e.space.$4} ${e.space.$6}`}),children:t.map((e,r)=>(0,i.Y)(ro,{code:e},r))}),(0,i.FD)(y.xA,{sx:e=>({borderTopWidth:e.borderWidths.$normal,borderTopStyle:e.borderStyles.$solid,borderTopColor:e.colors.$borderAlpha100,gridTemplateColumns:"repeat(3, minmax(0, 1fr))",">:not([hidden])~:not([hidden])":{borderRightWidth:"0px",borderLeftWidth:"1px",borderStyle:"solid",borderColor:e.colors.$borderAlpha100},">:first-child":{borderBottomLeftRadius:e.radii.$lg},">:last-child":{borderBottomRightRadius:e.radii.$lg}}),children:[(0,i.Y)(y.$n,{variant:"ghost",sx:e=>({width:"100%",padding:`${e.space.$2} 0`,borderRadius:0}),onClick:()=>{var e,r,i;let l,o=document.createElement("a"),a=new Blob([(e=t,r=n,i=u,l=e?.join("\n"),`These are your backup codes for ${r} account ${i}.
1
+ "use strict";(globalThis.webpackChunk_clerk_ui=globalThis.webpackChunk_clerk_ui||[]).push([["718"],{4484:function(e,r,t){t.r(r),t.d(r,{UserProfile:()=>r6,UserProfileModal:()=>r7});var i=t(4518),n=t(5074),l=t(1227),o=t(3264),a=t(5240),s=t(4607),c=t(2861),d=t(3269),u=t(9764),h=t(5396),m=t(7831),f=t(2265);let p=e=>{let{pages:r,apiKeysProps:t}=(0,a.B)(),n=r.routes.filter(e=>e.id!==l.j2.API_KEYS||!t?.hide);return(0,i.FD)(u.XM,{contentRef:e.contentRef,children:[(0,i.Y)(u.jq,{title:(0,c.G)("userProfile.navbar.title"),description:(0,c.G)("userProfile.navbar.description"),routes:n,contentRef:e.contentRef}),e.children]})};var g=t(540),Y=t(7697),v=t(1210),P=t(6088),b=t(6153),y=t(8272),S=t(8920),_=t(1421),D=t(4003),R=t(8080),G=t(4468),w=t(2660),C=t(3453),$=t(2513),F=t(2216),I=t(4964),x=t(6735);let k=e=>{let{strategy:r}=e,t=(0,d.f0)(),{user:n}=(0,v.Jd)(),{navigate:l}=(0,I.r)(),{strategyToDisplayData:o}=(0,F.k)(),{additionalOAuthScopes:s,componentName:u,mode:h}=(0,a.B)(),m="modal"===h,f=(0,v.Wp)(()=>{let e=r.replace("oauth_",""),t=m?(0,_.j)({url:window.location.href,componentName:u,socialProvider:e}):window.location.href,i=s?s[e]:[];return n?.createExternalAccount({strategy:r,redirectUrl:t,additionalScopes:i})}),p=o[r].iconUrl?(0,i.Y)(y._V,{isLoading:t.loadingMetadata===r,isDisabled:t.isLoading,elementDescriptor:S.$z.providerIcon,elementId:S.$z.providerIcon.setId(o[r].id),src:o[r].iconUrl,alt:`Connect ${o[r].name} account`,sx:e=>({width:e.sizes.$4})}):(0,i.Y)(w.T,{id:o[r].id,value:o[r].name,isLoading:t.loadingMetadata===r,isDisabled:t.isLoading});return(0,i.Y)(D.rd.ActionMenuItem,{id:o[r].id,onClick:()=>{if(n)return t.setLoading(r),f().then(e=>{e&&e.verification?.externalVerificationRedirectURL&&((0,x.y)(2e3).then(()=>t.setIdle(r)),l(e.verification.externalVerificationRedirectURL.href))}).catch(e=>{(0,G.H4)(e,[],t.setError),t.setIdle(r)})},isDisabled:t.isLoading,variant:"ghost",isLoading:t.loadingMetadata===r,focusRing:!1,closeAfterClick:!1,localizationKey:(0,c.G)("userProfile.connectedAccountPage.socialButtonsBlockButton",{provider:o[r].name}),sx:e=>({justifyContent:"start",gap:e.space.$2}),leftIcon:p},r)},A=({onClick:e})=>{let{user:r}=(0,v.Jd)(),{strategies:t}=(0,F.k)(),n=t.filter(e=>e.startsWith("oauth")),l=r?.verifiedExternalAccounts.map(e=>`oauth_${e.provider}`),o=n.filter(e=>!l.includes(e));return 0===o.length?null:(0,i.Y)(D.rd.ActionMenu,{triggerLocalizationKey:(0,c.G)("userProfile.start.connectedAccountsSection.primaryButton"),id:"connectedAccounts",onClick:e,children:o.map(e=>(0,i.Y)(k,{strategy:e},e))})};var z=t(8046);let T=e=>{let{onSuccess:r,onReset:t}=e,{user:l}=(0,v.Jd)(),{emailId:o}=e,a=l?.emailAddresses.find(e=>e.id===o),s=n.useRef(a?.emailAddress),d=a?.verification?.status==="verified"?(0,c.G)("userProfile.emailAddressPage.removeResource.messageLine2"):void 0;return s.current?(0,i.Y)(z.P,{title:(0,c.G)("userProfile.emailAddressPage.removeResource.title"),messageLine1:(0,c.G)("userProfile.emailAddressPage.removeResource.messageLine1",{identifier:s.current}),messageLine2:d,successMessage:(0,c.G)("userProfile.emailAddressPage.removeResource.successMessage",{emailAddress:s.current}),deleteResource:()=>Promise.resolve(a?.destroy()),onSuccess:r,onReset:t}):null},E=e=>{let{phoneId:r,onSuccess:t,onReset:l}=e,{user:o}=(0,v.Jd)(),a=o?.phoneNumbers.find(e=>e.id===r),s=n.useRef(a?.phoneNumber),d=a?.verification?.status==="verified"?(0,c.G)("userProfile.phoneNumberPage.removeResource.messageLine2"):void 0;return s.current?(0,i.Y)(z.P,{title:(0,c.G)("userProfile.phoneNumberPage.removeResource.title"),messageLine1:(0,c.G)("userProfile.phoneNumberPage.removeResource.messageLine1",{identifier:s.current}),messageLine2:d,successMessage:(0,c.G)("userProfile.phoneNumberPage.removeResource.successMessage",{phoneNumber:s.current}),deleteResource:()=>Promise.resolve(a?.destroy()),onSuccess:t,onReset:l}):null},L=e=>{let{accountId:r,onSuccess:t,onReset:l}=e,{user:o}=(0,v.Jd)(),a=o?.externalAccounts.find(e=>e.id===r),s=n.useRef(a?.provider),{providerToDisplayData:d}=(0,F.k)();return s.current?(0,i.Y)(z.P,{title:(0,c.G)("userProfile.connectedAccountPage.removeResource.title"),messageLine1:(0,c.G)("userProfile.connectedAccountPage.removeResource.messageLine1",{identifier:d[s.current]?.name||""}),messageLine2:(0,c.G)("userProfile.connectedAccountPage.removeResource.messageLine2"),successMessage:(0,c.G)("userProfile.connectedAccountPage.removeResource.successMessage",{connectedAccount:d[s.current]?.name||""}),deleteResource:()=>Promise.resolve(a?.destroy()),onSuccess:t,onReset:l}):null},O=e=>{let{user:r}=(0,v.Jd)(),{walletId:t,onSuccess:l,onReset:o}=e,a=r?.web3Wallets.find(e=>e.id===t),s=n.useRef(a?.web3Wallet),d=a?.verification?.status==="verified"?(0,c.G)("userProfile.web3WalletPage.removeResource.messageLine2"):void 0;return s.current?(0,i.Y)(z.P,{title:(0,c.G)("userProfile.web3WalletPage.removeResource.title"),messageLine1:(0,c.G)("userProfile.web3WalletPage.removeResource.messageLine1",{identifier:s.current}),messageLine2:d,successMessage:(0,c.G)("userProfile.web3WalletPage.removeResource.successMessage",{web3Wallet:s.current}),deleteResource:()=>Promise.resolve(a?.destroy()),onSuccess:l,onReset:o}):null},K=e=>{let{user:r}=(0,v.Jd)(),{phoneId:t,onSuccess:l,onReset:o}=e,a=r?.phoneNumbers.find(e=>e.id===t),s=n.useRef(a?.phoneNumber);return s.current?(0,i.Y)(z.P,{title:(0,c.G)("userProfile.mfaPhoneCodePage.removeResource.title"),messageLine1:(0,c.G)("userProfile.mfaPhoneCodePage.removeResource.messageLine1",{identifier:s.current}),messageLine2:(0,c.G)("userProfile.mfaPhoneCodePage.removeResource.messageLine2"),successMessage:(0,c.G)("userProfile.mfaPhoneCodePage.removeResource.successMessage",{mfaPhoneCode:s.current}),deleteResource:()=>Promise.resolve(a?.setReservedForSecondFactor({reserved:!1})),onSuccess:l,onReset:o}):null},B=e=>{let{onSuccess:r,onReset:t}=e,{user:n}=(0,v.Jd)();return n?(0,i.Y)(z.P,{title:(0,c.G)("userProfile.mfaTOTPPage.removeResource.title"),messageLine1:(0,c.G)("userProfile.mfaTOTPPage.removeResource.messageLine1"),messageLine2:(0,c.G)("userProfile.mfaTOTPPage.removeResource.messageLine2"),successMessage:(0,c.G)("userProfile.mfaTOTPPage.removeResource.successMessage"),deleteResource:n.disableTOTP,onSuccess:r,onReset:t}):null},M=e=>{let{onSuccess:r,onReset:t,passkey:n}=e;return(0,i.Y)(z.P,{title:(0,c.G)("userProfile.passkeyScreen.removeResource.title"),messageLine1:(0,c.G)("userProfile.passkeyScreen.removeResource.messageLine1",{name:n.name||""}),deleteResource:n.delete,onSuccess:r,onReset:t})},W=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(L,{onSuccess:r,onReset:r,...e})},N=["external_account_missing_refresh_token","oauth_fetch_user_error","oauth_token_exchange_error","external_account_email_address_verification_required"],J=(0,d.dm)(({shouldAllowCreation:e=!0})=>{let{user:r}=(0,v.Jd)(),t=(0,d.f0)(),l=!!r?.externalAccounts?.length,[o,a]=(0,n.useState)(null);if(!r||!e&&!l)return null;let s=[...r.verifiedExternalAccounts,...r.unverifiedExternalAccounts.filter(e=>e.verification?.error)];return(0,i.FD)(D.rd.Root,{title:(0,c.G)("userProfile.start.connectedAccountsSection.title"),centered:!1,id:"connectedAccounts",children:[(0,i.Y)(P.Z.Alert,{children:t.error}),(0,i.FD)(C.r.Root,{value:o,onChange:a,children:[(0,i.Y)(D.rd.ItemList,{id:"connectedAccounts",children:s.map(e=>(0,i.Y)(q,{account:e},e.id))}),e&&(0,i.Y)(A,{onClick:()=>a(null)})]})]})}),q=({account:e})=>{let{additionalOAuthScopes:r,componentName:t,mode:l}=(0,a.B)(),{navigate:o}=(0,I.r)(),{user:s}=(0,v.Jd)(),u=(0,d.f0)(),h=e.id,m="modal"===l,f=m?(0,_.j)({url:window.location.href,componentName:t}):window.location.href,p=(0,v.Wp)(()=>s?.createExternalAccount({strategy:e.verification.strategy,redirectUrl:f,additionalScopes:b}));if(!s)return null;let{providerToDisplayData:g}=(0,F.k)(),Y=e.username||e.emailAddress,P=e.verification?.error?.longMessage,b=function(e,r){if(!r)return[];let t=r[e.provider]||[],i=e.approvedScopes.split(" ");return 0===t.filter(e=>!i.includes(e)).length?[]:t}(e,r),R=b.length>0&&""!=e.approvedScopes,$=N.includes(e.verification?.error?.code||"")||R,x=$?(0,c.G)("userProfile.start.connectedAccountsSection.subtitle__disconnected"):P,k=async()=>{let r=m?(0,_.j)({url:window.location.href,componentName:t}):window.location.href;try{let t;(t=R?await e.reauthorize({additionalScopes:b,redirectUrl:r}):await p())&&await o(t.verification.externalVerificationRedirectURL?.href||"")}catch(e){(0,G.H4)(e,[],u.setError)}};return(0,i.FD)(n.Fragment,{children:[(0,i.FD)(D.rd.Item,{id:"connectedAccounts",children:[(0,i.FD)(y.so,{sx:e=>({overflow:"hidden",gap:e.space.$2}),children:[(0,i.Y)(()=>g[e.provider].iconUrl?(0,i.Y)(y._V,{elementDescriptor:[S.$z.providerIcon],elementId:S.$z.socialButtonsProviderIcon.setId(e.provider),alt:g[e.provider].name,src:g[e.provider].iconUrl,sx:e=>({width:e.sizes.$4,flexShrink:0})}):(0,i.Y)(w.T,{id:e.provider,value:g[e.provider].name}),{}),(0,i.Y)(y.az,{sx:{whiteSpace:"nowrap",overflow:"hidden"},children:(0,i.FD)(y.so,{gap:1,center:!0,children:[(0,i.Y)(y.EY,{sx:e=>({color:e.colors.$colorForeground}),children:`${g[e.provider].name}`}),(0,i.Y)(y.EY,{truncate:!0,as:"span",colorScheme:"secondary",children:Y?`• ${Y}`:""})]})})]}),(0,i.Y)(U,{account:e})]}),$&&(0,i.FD)(y.az,{sx:e=>({padding:`${e.sizes.$none} ${e.sizes.$none} ${e.sizes.$1x5} ${e.sizes.$8x5}`}),children:[(0,i.Y)(y.EY,{colorScheme:"secondary",sx:e=>({paddingRight:e.sizes.$1x5,display:"inline-block"}),localizationKey:x}),(0,i.Y)(y.$n,{sx:{display:"inline-block"},onClick:k,variant:"link",localizationKey:(0,c.G)("userProfile.start.connectedAccountsSection.actionLabel__connectionFailed")})]}),e.verification?.error?.code&&!$&&(0,i.Y)(y.EY,{colorScheme:"danger",sx:e=>({padding:`${e.sizes.$none} ${e.sizes.$1x5} ${e.sizes.$1x5} ${e.sizes.$8x5}`}),children:P}),(0,i.Y)(C.r.Open,{value:`remove-${h}`,children:(0,i.Y)(C.r.Card,{variant:"destructive",children:(0,i.Y)(W,{accountId:e.id})})})]},e.id)},U=({account:e})=>{let{open:r}=(0,$.D5)(),t=e.id,n=[{label:(0,c.G)("userProfile.start.connectedAccountsSection.destructiveActionTitle"),isDestructive:!0,onClick:()=>r(`remove-${t}`)}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:n})},j=e=>e.defaultSecondFactor?-1:1;function H(e){let r=[];return Object.entries(e).forEach(([,e])=>{e.used_for_second_factor&&r.push(...e.second_factors)}),r}function V(e,r){let t=H(e);return r.totpEnabled&&(t=t.filter(e=>"totp"!==e)),(r.backupCodeEnabled||!r.twoFactorEnabled)&&(t=t.filter(e=>"backup_code"!==e)),t}function Z(e,r){if(!e)return[];let t=e.filter(e=>e.id===r),i=e.filter(e=>e.id!==r),n=i.filter(e=>e.verification?.status==="verified"),l=i.filter(e=>!!e.verification?.status&&e.verification?.status!=="verified"),o=i.filter(e=>!e.verification.status);return n.sort((e,r)=>e.id.localeCompare(r.id)),l.sort((e,r)=>e.verification?.expireAt&&r.verification?.expireAt?e.verification.expireAt.getTime()-r.verification.expireAt.getTime():0),[...t,...n,...l,...o]}var X=t(2336);let Q=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(T,{onSuccess:r,onReset:r,...e})},ee=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(X.v,{onSuccess:r,onReset:r,...e})},er=({shouldAllowCreation:e=!0})=>{let{user:r}=(0,v.Jd)();return(0,i.Y)(D.rd.Root,{title:(0,c.G)("userProfile.start.emailAddressesSection.title"),centered:!1,id:"emailAddresses",children:(0,i.Y)(C.r.Root,{children:(0,i.FD)(D.rd.ItemList,{id:"emailAddresses",children:[Z(r?.emailAddresses,r?.primaryEmailAddressId).map(e=>{let t=e.id;return(0,i.FD)(n.Fragment,{children:[(0,i.FD)(D.rd.Item,{id:"emailAddresses",children:[(0,i.FD)(y.so,{sx:e=>({overflow:"hidden",gap:e.space.$1}),children:[(0,i.Y)(y.EY,{sx:e=>({color:e.colors.$colorForeground}),truncate:!0,children:e.emailAddress}),r?.primaryEmailAddressId===t&&(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__primary")}),"verified"!==e.verification.status&&(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__unverified")})]}),(0,i.Y)(et,{email:e})]}),(0,i.Y)(C.r.Open,{value:`remove-${t}`,children:(0,i.Y)(C.r.Card,{variant:"destructive",children:(0,i.Y)(Q,{emailId:t})})}),(0,i.Y)(C.r.Open,{value:`verify-${t}`,children:(0,i.Y)(C.r.Card,{children:(0,i.Y)(ee,{emailId:t})})})]},e.emailAddress)}),e&&(0,i.FD)(i.FK,{children:[(0,i.Y)(C.r.Trigger,{value:"add",children:(0,i.Y)(D.rd.ArrowButton,{id:"emailAddresses",localizationKey:(0,c.G)("userProfile.start.emailAddressesSection.primaryButton")})}),(0,i.Y)(C.r.Open,{value:"add",children:(0,i.Y)(C.r.Card,{children:(0,i.Y)(ee,{})})})]})]})})})},et=({email:e})=>{let r=(0,d.f0)(),{user:t}=(0,v.Jd)(),{open:n}=(0,$.D5)(),l=e.id,o=t?.primaryEmailAddressId===l,a="verified"===e.verification.status,s=(0,v.Wp)(()=>t?.update({primaryEmailAddressId:l})),u=[o&&!a?{label:(0,c.G)("userProfile.start.emailAddressesSection.detailsAction__primary"),onClick:()=>n(`verify-${l}`)}:null,!o&&a?{label:(0,c.G)("userProfile.start.emailAddressesSection.detailsAction__nonPrimary"),onClick:()=>{s().catch(e=>(0,G.H4)(e,[],r.setError))}}:null,!o&&!a?{label:(0,c.G)("userProfile.start.emailAddressesSection.detailsAction__unverified"),onClick:()=>n(`verify-${l}`)}:null,{label:(0,c.G)("userProfile.start.emailAddressesSection.destructiveAction"),isDestructive:!0,onClick:()=>n(`remove-${l}`)}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:u})},ei=()=>{let{user:e}=(0,v.Jd)(),r=e?.enterpriseAccounts.filter(({enterpriseConnection:e})=>e?.active);return r?.length?(0,i.Y)(D.rd.Root,{title:(0,c.G)("userProfile.start.enterpriseAccountsSection.title"),id:"enterpriseAccounts",centered:!1,children:(0,i.Y)(D.rd.ItemList,{id:"enterpriseAccounts",children:r.map(e=>(0,i.Y)(en,{account:e},e.id))})}):null},en=({account:e})=>{let r=e.emailAddress,t=e?.enterpriseConnection?.name,n=e.verification?.error?.longMessage;return(0,i.FD)(D.rd.Item,{id:"enterpriseAccounts",sx:e=>({gap:e.space.$2,justifyContent:"start"}),children:[(0,i.Y)(el,{account:e}),(0,i.Y)(y.az,{sx:{whiteSpace:"nowrap",overflow:"hidden"},children:(0,i.FD)(y.so,{gap:1,center:!0,children:[(0,i.Y)(y.EY,{truncate:!0,colorScheme:"body",children:t}),(0,i.Y)(y.EY,{truncate:!0,as:"span",colorScheme:"secondary",children:r?`• ${r}`:""}),n&&(0,i.Y)(y.Ex,{colorScheme:"danger",localizationKey:(0,c.G)("badge__requiresAction")})]})})]},e.id)},el=({account:e})=>{let{provider:r,enterpriseConnection:t}=e,n=r.replace(/(oauth_|saml_)/,"").trim(),l=t?.name??n,o={elementDescriptor:[S.$z.providerIcon],alt:l,sx:e=>({width:e.sizes.$4}),elementId:S.$z.enterpriseButtonsProviderIcon.setId(e.provider)};return t?.logoPublicUrl?(0,i.Y)(y._V,{...o,src:t.logoPublicUrl}):(0,i.Y)(w.T,{id:n,value:l,"aria-label":`${l}'s icon`,elementDescriptor:[S.$z.providerIcon,S.$z.providerInitialIcon],elementId:S.$z.providerInitialIcon.setId(n)})};var eo=t(7651),ea=t(2454),es=t(1475),ec=t(3549),ed=t(8640),eu=t(6245),eh=t(1282);let em=(0,d.dm)(e=>{let{phoneId:r,onSuccess:t,onReset:l}=e,{user:o}=(0,v.Jd)(),a=n.useRef(o?.phoneNumbers.find(e=>e.id===r)),s=(0,eu.X)({defaultStep:+!!a.current});return(0,i.FD)(eu.s,{...s.props,children:[(0,i.Y)(ef,{resourceRef:a,title:(0,c.G)("userProfile.phoneNumberPage.title"),onSuccess:s.nextStep,onReset:l}),(0,i.Y)(ep,{resourceRef:a,title:(0,c.G)("userProfile.phoneNumberPage.verifyTitle"),onSuccess:t,onReset:l})]})}),ef=e=>{let{title:r,onSuccess:t,onReset:n,onUseExistingNumberClick:l,resourceRef:o}=e,a=(0,d.f0)(),{user:s}=(0,v.Jd)(),u=(0,v.Wp)((e,r)=>e.createPhoneNumber(r)),h=(0,ed.tJ)("phoneNumber","",{type:"tel",label:(0,c.G)("formFieldLabel__phoneNumber"),isRequired:!0}),m=h.value.length>1&&s?.username!==h.value,f=!!s?.phoneNumbers?.length&&l,p=async e=>{if(e.preventDefault(),s)return u(s,{phoneNumber:h.value}).then(e=>{o.current=e,t()}).catch(e=>(0,G.H4)(e,[h],a.setError))};return(0,i.Y)(ec.M,{headerTitle:r,gap:1,children:(0,i.FD)(ea.l.Root,{gap:4,onSubmit:p,children:[(0,i.Y)(y.EY,{localizationKey:(0,c.G)("userProfile.phoneNumberPage.infoText"),colorScheme:"secondary"}),(0,i.Y)(ea.l.ControlRow,{elementId:h.id,children:(0,i.Y)(ea.l.PhoneInput,{...h.props,autoFocus:!0})}),(0,i.FD)(y.so,{justify:f?"between":"end",children:[f&&(0,i.Y)(y.$n,{variant:"ghost",localizationKey:(0,c.G)("userProfile.mfaPhoneCodePage.backButton"),onClick:l}),(0,i.Y)(es.G,{submitLabel:(0,c.G)("userProfile.formButtonPrimary__add"),isDisabled:!m,onReset:n})]})]})})},ep=e=>{let{title:r,onSuccess:t,resourceRef:n,onReset:l}=e;return(0,i.Y)(ec.M,{headerTitle:r,headerSubtitle:(0,c.G)("userProfile.phoneNumberPage.verifySubtitle",{identifier:n.current?.phoneNumber||""}),children:(0,i.Y)(eh.j,{nextStep:t,identification:n.current,identifier:n.current?.phoneNumber,prepareVerification:n.current?.prepareVerification,onReset:l})})},eg=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(E,{onSuccess:r,onReset:r,...e})},eY=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(em,{onSuccess:r,onReset:r,...e})},ev=({shouldAllowCreation:e=!0})=>{let{user:r}=(0,v.Jd)(),t=!!r?.phoneNumbers?.length;return e||t?(0,i.Y)(D.rd.Root,{centered:!1,title:(0,c.G)("userProfile.start.phoneNumbersSection.title"),id:"phoneNumbers",children:(0,i.Y)(C.r.Root,{children:(0,i.FD)(D.rd.ItemList,{id:"phoneNumbers",children:[Z(r?.phoneNumbers,r?.primaryPhoneNumberId).map(e=>{let t=e.id;return(0,i.FD)(n.Fragment,{children:[(0,i.FD)(D.rd.Item,{id:"phoneNumbers",children:[(0,i.Y)(y.az,{sx:{whiteSpace:"nowrap",overflow:"hidden"},children:(0,i.FD)(y.so,{gap:2,center:!0,children:[(0,i.Y)(y.EY,{sx:e=>({color:e.colors.$colorForeground}),children:(0,eo.Om)(e.phoneNumber)}),r?.primaryPhoneNumberId===t&&(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__primary")}),"verified"!==e.verification.status&&(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__unverified")})]})}),(0,i.Y)(eP,{phone:e})]}),(0,i.Y)(C.r.Open,{value:`remove-${t}`,children:(0,i.Y)(C.r.Card,{variant:"destructive",children:(0,i.Y)(eg,{phoneId:t})})}),(0,i.Y)(C.r.Open,{value:`verify-${t}`,children:(0,i.Y)(C.r.Card,{children:(0,i.Y)(eY,{phoneId:t})})})]},t)}),e&&(0,i.FD)(i.FK,{children:[(0,i.Y)(C.r.Trigger,{value:"add",children:(0,i.Y)(D.rd.ArrowButton,{id:"phoneNumbers",localizationKey:(0,c.G)("userProfile.start.phoneNumbersSection.primaryButton")})}),(0,i.Y)(C.r.Open,{value:"add",children:(0,i.Y)(C.r.Card,{children:(0,i.Y)(eY,{})})})]})]})})}):null},eP=({phone:e})=>{let r=(0,d.f0)(),{open:t}=(0,$.D5)(),{user:n}=(0,v.Jd)(),l=e.id,o=(0,v.Wp)(r=>r.update({primaryPhoneNumberId:e.id}));if(!n)return null;let a=n.primaryPhoneNumberId===e.id,s="verified"===e.verification.status,u=[a&&!s?{label:(0,c.G)("userProfile.start.phoneNumbersSection.detailsAction__primary"),onClick:()=>t(`verify-${l}`)}:null,!a&&s?{label:(0,c.G)("userProfile.start.phoneNumbersSection.detailsAction__nonPrimary"),onClick:()=>o(n).catch(e=>(0,G.H4)(e,[],r.setError))}:null,!a&&!s?{label:(0,c.G)("userProfile.start.phoneNumbersSection.detailsAction__unverified"),onClick:()=>t(`verify-${l}`)}:null,{label:(0,c.G)("userProfile.start.phoneNumbersSection.destructiveAction"),isDestructive:!0,onClick:()=>t(`remove-${l}`)}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:u})};var eb=t(7591),ey=t(4557),eS=t(78);let e_=(0,d.dm)(e=>{let{onSuccess:r,onReset:t}=e,{user:n}=(0,v.Jd)(),l=(0,v.Wp)(e=>n?.update({username:e})),{userSettings:o}=(0,Y.O)(),a=(0,d.f0)(),{t:s,locale:u}=(0,eS._)(),{usernameSettings:h}=o,m=(0,ed.tJ)("username",n?.username||"",{type:"text",label:(0,c.G)("formFieldLabel__username"),placeholder:(0,c.G)("formFieldInputPlaceholder__username"),buildErrorMessage:e=>(0,ey.Z)(e,{t:s,locale:u,usernameSettings:h})});if(!n)return null;let f=o.attributes.username?.required,p=(!f||m.value.length>0)&&n.username!==m.value,g=async()=>{try{await l(m.value),r()}catch(e){(0,G.H4)(e,[m],a.setError)}};return(0,i.Y)(ec.M,{headerTitle:n.username?(0,c.G)("userProfile.usernamePage.title__update"):(0,c.G)("userProfile.usernamePage.title__set"),children:(0,i.FD)(ea.l.Root,{onSubmit:g,children:[(0,i.Y)(ea.l.ControlRow,{elementId:m.id,children:(0,i.Y)(ea.l.PlainInput,{...m.props,autoFocus:!0,isRequired:f})}),(0,i.Y)(es.G,{isDisabled:!p,onReset:t})]})})}),eD=()=>{let{close:e}=(0,$.D5)();return(0,i.Y)(e_,{onSuccess:e,onReset:e})},eR=()=>{let{user:e}=(0,v.Jd)();return e?(0,i.Y)(D.rd.Root,{title:(0,c.G)("userProfile.start.usernameSection.title"),id:"username",sx:{alignItems:"center",[eb.g.md]:{alignItems:"flex-start"}},children:(0,i.FD)(C.r.Root,{children:[(0,i.Y)(C.r.Closed,{value:"edit",children:(0,i.FD)(D.rd.Item,{id:"username",sx:{paddingLeft:e.username?void 0:"0"},children:[e.username&&(0,i.Y)(y.EY,{truncate:!0,sx:e=>({color:e.colors.$colorForeground}),children:e.username}),(0,i.Y)(C.r.Trigger,{value:"edit",children:(0,i.Y)(D.rd.Button,{id:"username",localizationKey:e.username?(0,c.G)("userProfile.start.usernameSection.primaryButton__updateUsername"):(0,c.G)("userProfile.start.usernameSection.primaryButton__setUsername")})})]})}),(0,i.Y)(C.r.Open,{value:"edit",children:(0,i.Y)(C.r.Card,{children:(0,i.Y)(eD,{})})})]})}):null};var eG=t(9345),ew=t(2421),eC=t(8225),e$=t(3817),eF=t(9538);let eI=e=>{let{user:r,...t}=e;return(0,i.Y)(e$.k,{...t,title:(0,c.G)("userProfile.profilePage.imageFormTitle"),avatarPreview:(0,i.Y)(eF.H,{size:e=>e.sizes.$12,...r})})},ex=(0,d.dm)(e=>{let{onSuccess:r,onReset:t}=e,n=(0,d.f0)(),{user:l}=(0,v.Jd)();if(!l)return null;let{first_name:o,last_name:a}=(0,Y.O)().userSettings.attributes,s=o?.enabled,u=a?.enabled,h=l.firstName||"",m=l.lastName||"",f=(0,ed.tJ)("firstName",l.firstName||"",{type:"text",label:(0,c.G)("formFieldLabel__firstName"),placeholder:(0,c.G)("formFieldInputPlaceholder__firstName"),isRequired:a?.required}),p=(0,ed.tJ)("lastName",l.lastName||"",{type:"text",label:(0,c.G)("formFieldLabel__lastName"),placeholder:(0,c.G)("formFieldInputPlaceholder__lastName"),isRequired:a?.required}),g=s&&f.value!==h||u&&p.value!==m,P=s&&o.required||u&&a.required,b=P&&!!p.value&&!!f.value&&g,y=l.enterpriseAccounts.some(e=>e.active),S=async e=>(e.preventDefault(),(g?l.update({firstName:f.value,lastName:p.value}):Promise.resolve()).then(r).catch(e=>{(0,G.H4)(e,[f,p],n.setError)}));return(0,i.FD)(ec.M,{headerTitle:(0,c.G)("userProfile.profilePage.title"),children:[y&&(0,i.Y)(ew.k,{message:(0,c.G)("userProfile.profilePage.readonly")}),(0,i.FD)(ea.l.Root,{onSubmit:S,sx:e=>({gap:e.space.$6}),children:[(0,i.Y)(eI,{user:l,onAvatarChange:e=>l.setProfileImage({file:e}).then(()=>{n.setIdle(),r?.()}).catch(e=>(0,G.H4)(e,[],n.setError)),onAvatarRemove:(0,eC.p)(l.imageUrl)?null:()=>{l.setProfileImage({file:null}).then(()=>{n.setIdle(),r?.()}).catch(e=>(0,G.H4)(e,[],n.setError))}}),(s||u)&&(0,i.FD)(ea.l.ControlRow,{elementId:"name",children:[s&&(0,i.Y)(ea.l.PlainInput,{...f.props,isDisabled:y,autoFocus:!0}),u&&(0,i.Y)(ea.l.PlainInput,{...p.props,isDisabled:y,autoFocus:!s})]}),(0,i.Y)(es.G,{isDisabled:P?!b:!g,onReset:t})]})]})}),ek=()=>{let{close:e}=(0,$.D5)();return(0,i.Y)(ex,{onSuccess:e,onReset:e})},eA=()=>{let{user:e}=(0,v.Jd)();if(!e)return null;let{username:r,primaryEmailAddress:t,primaryPhoneNumber:n,primaryWeb3Wallet:l,...o}=e;return(0,i.Y)(D.rd.Root,{title:(0,c.G)("userProfile.start.profileSection.title"),id:"profile",sx:{[eb.g.md]:{alignItems:"flex-start"}},children:(0,i.FD)(C.r.Root,{children:[(0,i.Y)(C.r.Closed,{value:"edit",children:(0,i.FD)(D.rd.Item,{id:"profile",children:[(0,i.Y)(eG.c,{user:o,size:"lg",mainIdentifierVariant:"subtitle",sx:e=>({color:e.colors.$colorForeground})}),(0,i.Y)(C.r.Trigger,{value:"edit",children:(0,i.Y)(D.rd.Button,{id:"profile",localizationKey:(0,c.G)("userProfile.start.profileSection.primaryButton")})})]})}),(0,i.Y)(C.r.Open,{value:"edit",children:(0,i.Y)(C.r.Card,{children:(0,i.Y)(ek,{})})})]})})};var ez=t(6463),eT=t(3610);let eE=(0,n.lazy)(()=>Promise.all([t.e("545"),t.e("666"),t.e("188")]).then(t.bind(t,6464)).then(e=>({default:e.Web3SolanaWalletButtons}))),eL=({onConnect:e})=>{let r=(0,d.f0)(),{close:t}=(0,$.D5)(),l=async({walletName:i})=>{r.setLoading(i);try{await e({strategy:"web3_solana_signature",walletName:i}),r.setIdle(),t()}catch(e){if(r.setIdle(),e instanceof Error)(0,G.H4)(e,[],r.setError);else{let t=new eT.cR("An error occurred while generating the Solana signature.",{code:"web3_solana_signature_generation_failed",cause:e instanceof Error?e:void 0});(0,G.H4)(t,[],r.setError)}}};return(0,i.Y)(ec.M,{headerTitle:(0,c.G)("userProfile.start.web3WalletsSection.web3SelectSolanaWalletScreen.title"),headerSubtitle:(0,c.G)("userProfile.start.web3WalletsSection.web3SelectSolanaWalletScreen.subtitle"),children:(0,i.FD)(ea.l.Root,{children:[(0,i.Y)(n.Suspense,{fallback:(0,i.Y)(y.so,{direction:"row",align:"center",justify:"center",sx:e=>({height:"100%",minHeight:e.sizes.$32}),children:(0,i.Y)(y.y$,{size:"lg",colorScheme:"primary",elementDescriptor:S.$z.spinner})}),children:(0,i.Y)(eE,{web3AuthCallback:l})}),(0,i.Y)(es.c,{children:(0,i.Y)(y.$n,{type:"button",variant:"ghost",onClick:()=>{t()},localizationKey:(0,c.G)("userProfile.formButtonReset"),elementDescriptor:S.$z.formButtonReset})})]})})};var eO=t(5243);let eK=()=>{let e=(0,d.f0)(),{open:r}=(0,$.D5)(),{user:t}=(0,v.Jd)(),{strategies:n,strategyToDisplayData:l}=(0,F.k)(),o=(0,eO.R)(),a=n.filter(e=>e.startsWith("web3")),s=t?.verifiedWeb3Wallets?.map(e=>e.verification.strategy)??[],u=a.filter(e=>!s.includes(e)&&l[e]);if(0===u.length)return null;let h=(0,v.Wp)(e=>t?.createWeb3Wallet({web3Wallet:e})),m=async({strategy:i,walletName:n})=>{let l=(0,ez.U)(o);if("web3_solana_signature"===i&&!n)return void r("web3Wallets");let a=i.replace("web3_","").replace("_signature","");e.setError(void 0);try{e.setLoading(i);let r=await l.getWeb3Identifier({provider:a,walletName:n});if(!t)throw Error("user is not defined");let o=await h(r);o=await o?.prepareVerification({strategy:i});let s=o?.verification.message,c=await l.generateWeb3Signature({identifier:r,nonce:s,provider:a,walletName:n});await o?.attemptVerification({signature:c}),e.setIdle()}catch(t){e.setIdle();let r=(0,G.hG)(t);r?e.setError(r.longMessage):(0,G.H4)(t,[],e.setError)}};return(0,i.FD)(i.FK,{children:[(0,i.Y)(C.r.Closed,{value:"web3Wallets",children:(0,i.Y)(D.rd.ActionMenu,{id:"web3Wallets",triggerLocalizationKey:(0,c.G)("userProfile.start.web3WalletsSection.primaryButton"),children:u.map(r=>(0,i.Y)(D.rd.ActionMenuItem,{id:l[r].id,onClick:()=>{m({strategy:r})},isLoading:e.loadingMetadata===r,isDisabled:e.isLoading,localizationKey:(0,c.G)("userProfile.web3WalletPage.web3WalletButtonsBlockButton",{provider:l[r].name}),sx:e=>({justifyContent:"start",gap:e.space.$2}),leftIcon:(0,i.Y)(y._V,{elementDescriptor:S.$z.providerIcon,elementId:S.$z.providerIcon.setId(l[r].id),isLoading:e.loadingMetadata===r,isDisabled:e.isLoading,src:l[r].iconUrl,alt:`Connect ${l[r].name}`,sx:e=>({width:e.sizes.$5})})},r))})}),(0,i.Y)(C.r.Open,{value:"web3Wallets",children:(0,i.Y)(C.r.Card,{children:(0,i.Y)(eL,{onConnect:m})})}),e.error&&(0,i.Y)(y.EY,{colorScheme:"danger",sx:e=>({padding:e.sizes.$1x5,paddingLeft:e.sizes.$8x5}),children:e.error})]})},eB=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(O,{onSuccess:r,onReset:r,...e})},eM=(0,d.dm)(({shouldAllowCreation:e=!0})=>{let{user:r}=(0,v.Jd)(),t=(0,d.f0)(),{strategyToDisplayData:l}=(0,F.k)(),o=!!r?.web3Wallets?.length,[a,s]=(0,n.useState)(null);return e||o?(0,i.FD)(D.rd.Root,{title:(0,c.G)("userProfile.start.web3WalletsSection.title"),centered:!1,id:"web3Wallets",children:[(0,i.Y)(P.Z.Alert,{children:t.error}),(0,i.FD)(C.r.Root,{value:a,onChange:s,children:[(0,i.Y)(D.rd.ItemList,{id:"web3Wallets",children:Z(r?.web3Wallets,r?.primaryWeb3WalletId).map(e=>{var t;let o=e.verification.strategy,a=e.id;return l[o]&&(0,i.FD)(n.Fragment,{children:[(0,i.FD)(D.rd.Item,{id:"web3Wallets",align:"start",children:[(0,i.FD)(y.so,{sx:e=>({alignItems:"center",gap:e.space.$2,width:"100%"}),children:[l[o].iconUrl&&(0,i.Y)(y._V,{src:l[o].iconUrl,alt:l[o].name,sx:e=>({width:e.sizes.$4})}),(0,i.Y)(y.az,{sx:{whiteSpace:"nowrap",overflow:"hidden"},children:(0,i.FD)(y.so,{gap:2,justify:"start",children:[(0,i.FD)(y.EY,{children:[l[o].name," (",(t=e.web3Wallet).length<=10?t:t.slice(0,6)+"..."+t.slice(-4),")"]}),r?.primaryWeb3WalletId===a&&(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__primary")}),"verified"!==e.verification.status&&(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__unverified")})]})})]}),(0,i.Y)(eW,{walletId:a})]},a),(0,i.Y)(C.r.Open,{value:`remove-${a}`,children:(0,i.Y)(C.r.Card,{variant:"destructive",children:(0,i.Y)(eB,{walletId:e.id})})})]},e.id)})}),e&&(0,i.Y)(eK,{})]})]}):null}),eW=({walletId:e})=>{let r=(0,d.f0)(),{open:t}=(0,$.D5)(),{user:n}=(0,v.Jd)(),l=n?.primaryWeb3WalletId===e,o=(0,v.Wp)(()=>n?.update({primaryWeb3WalletId:e})),a=[!l?{label:(0,c.G)("userProfile.start.web3WalletsSection.detailsAction__nonPrimary"),onClick:()=>{o().catch(e=>(0,G.H4)(e,[],r.setError))}}:null,{label:(0,c.G)("userProfile.start.web3WalletsSection.destructiveAction"),isDestructive:!0,onClick:()=>t(`remove-${e}`)}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:a})},eN=(0,d.dm)(()=>{let{attributes:e,social:r,enterpriseSSO:t}=(0,Y.O)().userSettings,n=(0,d.f0)(),{user:l}=(0,v.Jd)(),{shouldAllowIdentificationCreation:o}=(0,a.B)(),s=e.username?.enabled,u=e.email_address?.enabled,h=e.phone_number?.enabled,m=r&&Object.values(r).filter(e=>e.enabled).length>0,f=l&&t.enabled,p=e.web3_wallet?.enabled;return(0,i.Y)(y.fv,{elementDescriptor:S.$z.page,sx:e=>({gap:e.space.$8,color:e.colors.$colorForeground}),children:(0,i.FD)(y.fv,{elementDescriptor:S.$z.profilePage,elementId:S.$z.profilePage.setId("account"),children:[(0,i.Y)(b.Y.Root,{children:(0,i.Y)(b.Y.Title,{localizationKey:(0,c.G)("userProfile.start.headerTitle__account"),sx:e=>({marginBottom:e.space.$4}),textVariant:"h2"})}),(0,i.Y)(P.Z.Alert,{children:n.error}),(0,i.Y)(eA,{}),s&&(0,i.Y)(eR,{}),u&&(0,i.Y)(er,{shouldAllowCreation:o}),h&&(0,i.Y)(ev,{shouldAllowCreation:o}),m&&(0,i.Y)(J,{shouldAllowCreation:o}),f&&(0,i.Y)(ei,{}),p&&(0,i.Y)(eM,{shouldAllowCreation:o})]})})});var eJ=t(2611),eq=t(7806),eU=t(7896),ej=t(4901),eH=t(892),eV=t(8910);let eZ=()=>{let e,{user:r}=(0,v.Jd)(),{session:t}=(0,v.wV)(),{data:n,isLoading:l}=(0,eU.s)(r?.getSessions,"user-sessions");return(0,i.Y)(D.rd.Root,{title:(0,c.G)("userProfile.start.activeDevicesSection.title"),centered:!1,id:"activeDevices",children:(0,i.Y)(D.rd.ItemList,{id:"activeDevices",disableAnimation:!0,children:l?(0,i.Y)(eJ.K,{}):n?.sort((e=t.id,r=>r.id===e?-1:1)).map(e=>eX(e.status)?(0,i.Y)(eQ,{session:e},e.id):null)})})},eX=e=>["active","pending"].includes(e),eQ=({session:e})=>{let r=(0,v.wV)().session?.id===e.id,t=(0,ej.m)(),n=(0,v.Wp)(e.revoke.bind(e)),l=async()=>{if(!r&&e)return t.setLoading(),n().catch(e=>(0,G.H4)(e,[],t.setError)).finally(()=>t.setIdle())};return(0,i.Y)(D.rd.Item,{id:"activeDevices",elementDescriptor:S.$z.activeDeviceListItem,elementId:r?S.$z.activeDeviceListItem.setId("current"):void 0,sx:{alignItems:"flex-start",opacity:t.isLoading?.5:1},isDisabled:t.isLoading,children:(0,i.FD)(i.FK,{children:[(0,i.Y)(e0,{session:e}),!r&&(0,i.Y)(e1,{revoke:l})]})})},e0=e=>{let{session:r}=(0,v.wV)(),t=r?.id===e.session.id,n=!!r?.actor,l=!!e.session.actor,{city:o,country:a,browserName:s,browserVersion:d,deviceType:u,ipAddress:h,isMobile:m}=e.session.latestActivity,f=`${s||""} ${d||""}`.trim()||"Web browser",p=[o||"",a||""].filter(Boolean).join(", ").trim()||null,{t:g}=(0,eS._)();return(0,i.FD)(y.so,{elementDescriptor:S.$z.activeDevice,elementId:t?S.$z.activeDevice.setId("current"):void 0,sx:e=>({width:"100%",overflow:"hidden",gap:e.space.$4,[eb.g.sm]:{gap:e.space.$2}}),children:[(0,i.Y)(y.so,{sx:e=>({[eb.g.sm]:{padding:"0"},borderRadius:e.radii.$md}),children:(0,i.Y)(y.In,{elementDescriptor:S.$z.activeDeviceIcon,elementId:S.$z.activeDeviceIcon.setId(m?"mobile":"desktop"),icon:m?eH.A:eV.A,sx:e=>({"--cl-chassis-bottom":"#444444","--cl-chassis-back":"#343434","--cl-chassis-screen":"#575757","--cl-screen":"#000000",width:e.space.$8,height:e.space.$8})})}),(0,i.FD)(y.fv,{align:"start",gap:1,children:[(0,i.FD)(y.so,{center:!0,gap:2,children:[(0,i.Y)(y.EY,{children:u||(m?"Mobile device":"Desktop device")}),t&&(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__thisDevice"),colorScheme:n?"danger":"primary"}),n&&!l&&(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__userDevice")}),!t&&l&&(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__otherImpersonatorDevice"),colorScheme:"danger"})]}),(0,i.Y)(y.EY,{colorScheme:"secondary",children:f}),(0,i.FD)(y.EY,{colorScheme:"secondary",children:[h," (",p,")"]}),(0,i.Y)(y.EY,{colorScheme:"secondary",children:g((0,eq.T)(e.session.lastActiveAt))})]})]})},e1=({revoke:e})=>{let r=[{label:(0,c.G)("userProfile.start.activeDevicesSection.destructiveAction"),isDestructive:!0,onClick:e}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:r})};var e2=t(9599),e5=t(8691);let e4=(0,d.dm)(e=>{let{onReset:r}=e,t=(0,d.f0)(),{afterSignOutUrl:n,afterMultiSessionSingleSignOutUrl:l}=(0,e2.g)(),{user:o}=(0,v.Jd)(),{t:a}=(0,eS._)(),{otherSessions:s}=(0,e5.z)({user:o}),{setActive:u}=(0,v.ho)(),h=(0,v.Wp)(()=>o?.delete()),m=(0,ed.tJ)("deleteConfirmation","",{type:"text",label:(0,c.G)("userProfile.deletePage.actionDescription"),isRequired:!0,placeholder:(0,c.G)("formFieldInputPlaceholder__confirmDeletionUserAccount")}),f=m.value===(a((0,c.G)("formFieldInputPlaceholder__confirmDeletionUserAccount"))||"Delete account"),p=async()=>{if(f)try{await h();let e=0===s.length?n:l;return await u({session:null,redirectUrl:e})}catch(e){(0,G.H4)(e,[],t.setError)}};return(0,i.Y)(ec.M,{headerTitle:(0,c.G)("userProfile.deletePage.title"),sx:e=>({gap:e.space.$0x5}),children:(0,i.FD)(ea.l.Root,{onSubmit:p,children:[(0,i.FD)(y.fv,{gap:1,children:[(0,i.Y)(y.EY,{colorScheme:"secondary",localizationKey:(0,c.G)("userProfile.deletePage.messageLine1")}),(0,i.Y)(y.EY,{colorScheme:"danger",localizationKey:(0,c.G)("userProfile.deletePage.messageLine2")})]}),(0,i.Y)(ea.l.ControlRow,{elementId:m.id,children:(0,i.Y)(ea.l.PlainInput,{...m.props,ignorePasswordManager:!0})}),(0,i.Y)(es.G,{submitLabel:(0,c.G)("userProfile.deletePage.confirm"),colorScheme:"danger",isDisabled:!f,onReset:r})]})})}),e3=()=>{let{close:e}=(0,$.D5)();return(0,i.Y)(e4,{onSuccess:e,onReset:e})},e6=()=>(0,i.Y)(D.rd.Root,{title:(0,c.G)("userProfile.start.dangerSection.title"),id:"danger",sx:{alignItems:"center",[eb.g.md]:{alignItems:"flex-start"}},children:(0,i.FD)(C.r.Root,{children:[(0,i.Y)(C.r.Closed,{value:"delete",children:(0,i.Y)(D.rd.Item,{id:"danger",sx:e=>({paddingLeft:e.space.$1}),children:(0,i.Y)(C.r.Trigger,{value:"delete",children:(0,i.Y)(D.rd.Button,{id:"danger",variant:"ghost",colorScheme:"danger",localizationKey:(0,c.G)("userProfile.start.dangerSection.deleteAccountButton")})})})}),(0,i.Y)(C.r.Open,{value:"delete",children:(0,i.Y)(C.r.Card,{variant:"destructive",children:(0,i.Y)(e3,{})})})]})});var e8=t(1323),e7=t(5079),e9=t(6103),re=t(2534),rr=t(8095),rt=t(9126),ri=t(7782),rn=t(1072),rl=t(5976),ro=t(2405),ra=t(2852);let rs=e=>{let{code:r}=e;return(0,i.Y)(y.so,{center:!0,sx:e=>({padding:`${e.space.$1} ${e.space.$4}`}),children:(0,i.Y)(y.EY,{children:r})})},rc=e=>{let{subtitle:r,backupCodes:t}=e,{applicationName:n}=(0,Y.O)().displayConfig,{user:l}=(0,v.Jd)(),{print:o,printableProps:a}=(0,rt.h)(),{onCopy:s,hasCopied:d}=(0,ri.i)(t?.join(",")||"");if(!l)return null;let u=(0,rr.Cm)(l);return t?(0,i.FD)(i.FK,{children:[(0,i.FD)(y.fv,{gap:1,children:[(0,i.Y)(y.EY,{localizationKey:(0,c.G)("userProfile.backupCodePage.title__codelist"),variant:"subtitle"}),(0,i.Y)(y.EY,{localizationKey:r,variant:"caption",colorScheme:"secondary"})]}),(0,i.FD)(y.az,{sx:e=>({borderWidth:e.borderWidths.$normal,borderStyle:e.borderStyles.$solid,borderColor:e.colors.$borderAlpha100,borderRadius:e.radii.$lg}),children:[(0,i.Y)(y.xA,{gap:2,sx:e=>({gridTemplateColumns:`repeat(2, minmax(${e.sizes.$12}, 1fr))`,padding:`${e.space.$4} ${e.space.$6}`}),children:t.map((e,r)=>(0,i.Y)(rs,{code:e},r))}),(0,i.FD)(y.xA,{sx:e=>({borderTopWidth:e.borderWidths.$normal,borderTopStyle:e.borderStyles.$solid,borderTopColor:e.colors.$borderAlpha100,gridTemplateColumns:"repeat(3, minmax(0, 1fr))",">:not([hidden])~:not([hidden])":{borderRightWidth:"0px",borderLeftWidth:"1px",borderStyle:"solid",borderColor:e.colors.$borderAlpha100},">:first-child":{borderBottomLeftRadius:e.radii.$lg},">:last-child":{borderBottomRightRadius:e.radii.$lg}}),children:[(0,i.Y)(y.$n,{variant:"ghost",sx:e=>({width:"100%",padding:`${e.space.$2} 0`,borderRadius:0}),onClick:()=>{var e,r,i;let l,o=document.createElement("a"),a=new Blob([(e=t,r=n,i=u,l=e?.join("\n"),`These are your backup codes for ${r} account ${i}.
2
2
  Store them securely and keep them secret. Each code can only be used once.
3
3
 
4
- ${l}`)],{type:"text/plain"});o.href=URL.createObjectURL(a),o.download=`${n}_backup_codes.txt`,document.body.appendChild(o),o.click()},children:(0,i.Y)(y.In,{icon:rt.A})}),(0,i.Y)(y.$n,{variant:"ghost",sx:e=>({width:"100%",padding:`${e.space.$2} 0`,borderRadius:0}),onClick:o,children:(0,i.Y)(y.In,{icon:ri.A})}),(0,i.Y)(y.$n,{variant:"ghost",onClick:s,sx:e=>({width:"100%",padding:`${e.space.$2} 0`,borderRadius:0}),children:(0,i.Y)(y.In,{icon:d?rn.A:rl.A})})]})]}),(0,i.FD)(re.L,{...a,children:[(0,i.FD)(y.DZ,{children:["Your backup codes for ",n," account ",u,":"]}),(0,i.Y)(y.fv,{gap:2,children:t.map((e,r)=>(0,i.Y)(ro,{code:e},r))})]})]}):null},rs=(0,d.dm)(e=>{let{onSuccess:r,onReset:t}=e,{user:l}=(0,v.Jd)(),o=(0,d.f0)(),a=(0,v.Wp)(()=>l?.createBackupCode()),[s,u]=n.useState(void 0);return(n.useEffect(()=>{!s&&l&&a().then(e=>u(e)).catch(e=>{if((0,e7.I3)(e))return t();(0,G.H4)(e,[],o.setError)})},[]),o.error)?(0,i.Y)(ec.M,{headerTitle:(0,c.G)("userProfile.backupCodePage.title")}):(0,i.Y)(ec.M,{headerTitle:(0,c.G)("userProfile.backupCodePage.title"),children:s?(0,i.FD)(i.FK,{children:[(0,i.Y)(y.EY,{localizationKey:(0,c.G)("userProfile.backupCodePage.successMessage")}),(0,i.Y)(ra,{subtitle:(0,c.G)("userProfile.backupCodePage.subtitle__codelist"),backupCodes:s.codes}),(0,i.Y)(es.c,{children:(0,i.Y)(y.$n,{autoFocus:!0,onClick:r,localizationKey:(0,c.G)("userProfile.formButtonPrimary__finish"),elementDescriptor:S.$z.formButtonPrimary})})]}):(0,i.Y)(eN.K,{})})}),rc=(0,d.dm)(e=>{let{onSuccess:r,onReset:t}=e,n=(0,eu.X)();return(0,i.FD)(eu.s,{...n.props,children:[(0,i.Y)(rd,{onContinue:n.nextStep}),(0,i.Y)(rs,{onSuccess:r,onReset:t})]})}),rd=e=>{let{onContinue:r}=e,{close:t}=(0,$.D5)();return(0,i.FD)(ec.M,{headerTitle:(0,c.G)("userProfile.backupCodePage.title"),children:[(0,i.Y)(y.EY,{localizationKey:(0,c.G)("userProfile.backupCodePage.infoText1")}),(0,i.Y)(y.EY,{localizationKey:(0,c.G)("userProfile.backupCodePage.infoText2")}),(0,i.FD)(es.c,{sx:{marginTop:0},children:[(0,i.Y)(y.$n,{textVariant:"buttonSmall",onClick:r,localizationKey:(0,c.G)("userProfile.formButtonPrimary__finish"),elementDescriptor:S.$z.formButtonPrimary}),(0,i.Y)(y.$n,{variant:"ghost",onClick:t,localizationKey:(0,c.G)("userProfile.formButtonReset"),elementDescriptor:S.$z.formButtonReset})]})]})};var ru=t(155),rh=t(6370),rm=t(9679);let rf=(0,d.dm)(e=>{let{onReset:r,onSuccess:t}=e,l=n.useRef(),o=(0,eu.X)({defaultStep:2}),a=(0,Y.O)().userSettings.attributes.backup_code?.enabled;return(0,i.FD)(eu.s,{...o.props,children:[(0,i.Y)(ef,{title:(0,c.G)("userProfile.phoneNumberPage.title"),resourceRef:l,onSuccess:o.nextStep,onUseExistingNumberClick:()=>o.goToStep(2),onReset:r}),(0,i.Y)(rg,{title:(0,c.G)("userProfile.mfaPhoneCodePage.title"),resourceRef:l,onSuccess:()=>a?o.goToStep(3):t(),onReset:()=>o.goToStep(2)}),(0,i.Y)(rY,{onSuccess:a?o.nextStep:t,onReset:r,onAddPhoneClick:()=>o.goToStep(0),onUnverifiedPhoneClick:e=>{l.current=e,o.goToStep(1)},title:(0,c.G)("userProfile.mfaPhoneCodePage.title"),resourceRef:l}),a&&(0,i.Y)(rh.B,{title:(0,c.G)("userProfile.mfaPhoneCodePage.successTitle"),text:l.current?.backupCodes&&l.current?.backupCodes.length>0?[(0,c.G)("userProfile.mfaPhoneCodePage.successMessage1"),(0,c.G)("userProfile.mfaPhoneCodePage.successMessage2")]:[(0,c.G)("userProfile.mfaPhoneCodePage.successMessage1")],onFinish:r,contents:(0,i.Y)(ra,{backupCodes:l.current?.backupCodes})})]})}),rp=e=>{let{phone:r,onSuccess:t,onUnverifiedPhoneClick:n,resourceRef:l}=e,o=(0,d.f0)(),a=(0,v.Wp)(()=>r.setReservedForSecondFactor({reserved:!0})),{country:s}=(0,eo.Mz)(r.phoneNumber),c=(0,eo.Om)(r.phoneNumber),u=async()=>{if("verified"!==r.verification.status)return n(r);o.setLoading(r.id);try{await a(),l.current=r,t()}catch(e){(0,G.H4)(e,[],o.setError)}finally{o.setIdle()}};return(0,i.FD)(y.$n,{variant:"outline",colorScheme:"neutral",sx:{justifyContent:"start"},onClick:u,isLoading:o.loadingMetadata===r.id,isDisabled:o.isLoading,children:[s.iso.toUpperCase()," ",c]},r.id)},rg=e=>{let{title:r,onSuccess:t,resourceRef:n,onReset:l}=e,o=(0,d.f0)(),a=n.current,s=(0,v.Wp)(()=>a?.setReservedForSecondFactor({reserved:!0})),u=async()=>{o.setLoading(a?.id);try{await s(),n.current=a,t()}catch(e){(0,G.H4)(e,[],o.setError)}finally{o.setIdle()}};return(0,i.Y)(ec.M,{headerTitle:r,headerSubtitle:(0,c.G)("userProfile.phoneNumberPage.verifySubtitle",{identifier:n.current?.phoneNumber||""}),children:(0,i.Y)(eh.j,{nextStep:()=>{u()},identification:n.current,identifier:n.current?.phoneNumber,prepareVerification:n.current?.prepareVerification,onReset:l})})},rY=e=>{let{onSuccess:r,onReset:t,title:n,onAddPhoneClick:l,onUnverifiedPhoneClick:o,resourceRef:a}=e,{user:s}=(0,v.Jd)();if(!s)return null;let d=s.phoneNumbers.filter(e=>!e.reservedForSecondFactor);return(0,i.FD)(ec.M,{headerTitle:n,gap:1,children:[(0,i.Y)(y.EY,{localizationKey:(0,c.G)(d.length?"userProfile.mfaPhoneCodePage.subtitle__availablePhoneNumbers":"userProfile.mfaPhoneCodePage.subtitle__unavailablePhoneNumbers"),colorScheme:"secondary"}),d.length>0&&(0,i.Y)(y.fv,{gap:2,children:d.map(e=>(0,i.Y)(rp,{onSuccess:r,phone:e,onUnverifiedPhoneClick:o,resourceRef:a},e.id))}),(0,i.FD)(es.c,{sx:{flexDirection:"row",justifyContent:"space-between"},children:[(0,i.Y)(ru.K,{variant:"ghost","aria-label":"Add phone number",icon:(0,i.Y)(y.In,{icon:rm.A,sx:e=>({marginRight:e.space.$2})}),localizationKey:(0,c.G)("userProfile.mfaPhoneCodePage.primaryButton__addPhoneNumber"),onClick:l}),(0,i.Y)(y.$n,{variant:"ghost",localizationKey:(0,c.G)("userProfile.formButtonReset"),onClick:t})]})]})};var rv=t(5559),rP=t(2094);let rb=(0,d.dm)(e=>{let{title:r,onSuccess:t,onReset:l}=e,{user:o}=(0,v.Jd)(),a=(0,d.f0)(),s=(0,v.Wp)(()=>o?.createTOTP()),{close:u}=(0,$.D5)(),[h,m]=n.useState(void 0),[f,p]=n.useState("qr");return(n.useEffect(()=>{o&&s().then(e=>m(e)).catch(e=>(0,e7.Cm)(e)&&"reverification_cancelled"===e.code?u():(0,G.H4)(e,[],a.setError))},[]),a.error)?(0,i.Y)(ec.M,{headerTitle:r}):(0,i.FD)(ec.M,{headerTitle:r,headerSubtitle:"qr"==f?(0,c.G)("userProfile.mfaTOTPPage.authenticatorApp.infoText__ableToScan"):(0,c.G)("userProfile.mfaTOTPPage.authenticatorApp.infoText__unableToScan"),children:[!h&&(0,i.Y)(eN.K,{}),h&&(0,i.FD)(i.FK,{children:[(0,i.FD)(y.fv,{gap:4,children:["qr"==f&&(0,i.Y)(rP.r,{justify:"center",url:h.uri||""}),"uri"==f&&(0,i.FD)(i.FK,{children:[(0,i.Y)(y.EY,{colorScheme:"secondary",localizationKey:(0,c.G)("userProfile.mfaTOTPPage.authenticatorApp.inputLabel__unableToScan1")}),(0,i.Y)(rv.r,{value:h.secret}),(0,i.Y)(y.EY,{colorScheme:"secondary",localizationKey:(0,c.G)("userProfile.mfaTOTPPage.authenticatorApp.inputLabel__unableToScan2")}),(0,i.Y)(rv.r,{value:h.uri})]})]}),(0,i.FD)(y.so,{justify:"between",align:"center",sx:{width:"100%"},children:["qr"==f&&(0,i.Y)(y.$n,{variant:"link",textVariant:"buttonLarge",onClick:()=>p("uri"),localizationKey:(0,c.G)("userProfile.mfaTOTPPage.authenticatorApp.buttonUnableToScan__nonPrimary")}),"uri"==f&&(0,i.Y)(y.$n,{variant:"link",textVariant:"buttonLarge",onClick:()=>p("qr"),localizationKey:(0,c.G)("userProfile.mfaTOTPPage.authenticatorApp.buttonAbleToScan__nonPrimary")}),(0,i.FD)(es.c,{children:[(0,i.Y)(y.$n,{onClick:t,localizationKey:(0,c.G)("userProfile.formButtonPrimary__continue"),elementDescriptor:S.$z.formButtonPrimary}),(0,i.Y)(y.$n,{variant:"ghost",onClick:l,localizationKey:(0,c.G)("userProfile.formButtonReset"),elementDescriptor:S.$z.formButtonReset})]})]})]})]})});var ry=t(3356);let rS=(0,d.dm)(e=>{let{onSuccess:r,onReset:t,resourceRef:n}=e,{user:l}=(0,v.Jd)(),o=(0,ry.xM)({onCodeEntryFinished:(e,r,t)=>{l?.verifyTOTP({code:e}).then(e=>r(e)).catch(t)},onResolve:e=>{n.current=e,r()}});return(0,i.FD)(ec.M,{headerTitle:(0,c.G)("userProfile.mfaTOTPPage.title"),children:[(0,i.Y)(y.fv,{children:(0,i.Y)(ea.l.OTPInput,{...o,label:(0,c.G)("userProfile.mfaTOTPPage.verifyTitle"),description:(0,c.G)("userProfile.mfaTOTPPage.verifySubtitle")})}),(0,i.Y)(es.c,{sx:{marginTop:0},children:(0,i.Y)(y.$n,{onClick:t,variant:"ghost",isDisabled:o.isLoading,localizationKey:(0,c.G)("userProfile.formButtonReset"),elementDescriptor:S.$z.formButtonReset})})]})}),r_=(0,d.dm)(e=>{let{onReset:r}=e,t=(0,eu.X)(),l=n.useRef();return(0,i.FD)(eu.s,{...t.props,children:[(0,i.Y)(rb,{title:(0,c.G)("userProfile.mfaTOTPPage.title"),onSuccess:t.nextStep,onReset:r}),(0,i.Y)(rS,{onSuccess:t.nextStep,onReset:r,resourceRef:l}),(0,i.Y)(rh.B,{title:(0,c.G)("userProfile.mfaTOTPPage.title"),text:(0,c.G)("userProfile.mfaTOTPPage.successMessage"),onFinish:r,contents:(0,i.Y)(ra,{subtitle:(0,c.G)("userProfile.backupCodePage.successSubtitle"),backupCodes:l.current?.backupCodes})})]})}),rD=(0,d.dm)(e=>{let{onSuccess:r,onReset:t,selectedStrategy:l}=e,o=(0,d.f0)(),{userSettings:{attributes:a}}=(0,Y.O)(),{user:s}=(0,v.Jd)();if(!s)return null;let u=(0,c.G)("userProfile.mfaPage.title"),h=n.useMemo(()=>H(a,s),[]);return(n.useEffect(()=>{0===h.length&&o.setError("There are no second factors available to add")},[]),o.error)?(0,i.Y)(ec.M,{headerTitle:u}):0!==h.length||l?(0,i.Y)(rR,{onSuccess:r,onReset:t,method:l||h[0]}):null}),rR=e=>{let{method:r,onSuccess:t,onReset:n}=e;switch(r){case"phone_code":return(0,i.Y)(rf,{onSuccess:t,onReset:n});case"totp":return(0,i.Y)(r_,{onSuccess:t,onReset:n});case"backup_code":return(0,i.Y)(rc,{onSuccess:t,onReset:n});default:return null}},rG=()=>{let{close:e}=(0,$.D5)();return(0,i.Y)(M,{onSuccess:e,onReset:e})},rC=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(K,{onSuccess:r,onReset:r,...e})},rF=()=>{let{close:e}=(0,$.D5)();return(0,i.Y)(rs,{onSuccess:e,onReset:e})},r$=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(rD,{onSuccess:r,onReset:r,selectedStrategy:e.selectedStrategy})},rw=()=>{let{userSettings:{attributes:e}}=(0,Y.O)(),{user:r}=(0,v.Jd)(),[t,l]=(0,n.useState)(null);if(!r)return null;let o=V(e),a=H(e,r),s=o.includes("totp")&&r.totpEnabled,d=o.includes("backup_code")&&r.backupCodeEnabled,u=r.phoneNumbers.filter(e=>"verified"===e.verification.status).filter(e=>e.reservedForSecondFactor).sort(j);return(0,i.Y)(D.rd.Root,{title:(0,c.G)("userProfile.start.mfaSection.title"),centered:!1,id:"mfa",children:(0,i.Y)(F.r.Root,{value:t,onChange:l,children:(0,i.FD)(D.rd.ItemList,{id:"mfa",children:[s&&(0,i.FD)(i.FK,{children:[(0,i.FD)(D.rd.Item,{id:"mfa",hoverable:!0,children:[(0,i.FD)(y.so,{sx:e=>({gap:e.space.$2,alignItems:"center"}),children:[(0,i.Y)(y.In,{icon:e3.A,sx:e=>({color:e.colors.$neutralAlpha700})}),(0,i.Y)(y.EY,{localizationKey:(0,c.G)("userProfile.start.mfaSection.totp.headerTitle")}),(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__default")})]}),(0,i.Y)(rk,{})]}),(0,i.Y)(F.r.Open,{value:"remove-totp",children:(0,i.Y)(F.r.Card,{variant:"destructive",children:(0,i.Y)(rG,{})})})]}),o.includes("phone_code")&&u.map(e=>{let r=!s&&e.defaultSecondFactor,t=e.id;return(0,i.FD)(n.Fragment,{children:[(0,i.FD)(D.rd.Item,{id:"mfa",hoverable:!0,children:[(0,i.FD)(y.so,{sx:e=>({gap:e.space.$2,alignItems:"center"}),children:[(0,i.Y)(y.In,{icon:e6.A,sx:e=>({color:e.colors.$neutralAlpha700})}),(0,i.FD)(y.EY,{children:["SMS Code ",(0,i.Y)(e4.R,{value:e.phoneNumber})]}),r&&(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__default")})]}),(0,i.Y)(rx,{phone:e,showTOTP:s})]}),(0,i.Y)(F.r.Open,{value:`remove-${t}`,children:(0,i.Y)(F.r.Card,{variant:"destructive",children:(0,i.Y)(rC,{phoneId:t})})})]},t)}),d&&(0,i.FD)(i.FK,{children:[(0,i.FD)(D.rd.Item,{id:"mfa",hoverable:!0,children:[(0,i.FD)(y.so,{sx:e=>({gap:e.space.$2,alignItems:"center"}),children:[(0,i.Y)(y.In,{icon:e8.A,sx:e=>({color:e.colors.$neutralAlpha700})}),(0,i.Y)(y.EY,{localizationKey:(0,c.G)("userProfile.start.mfaSection.backupCodes.headerTitle")})]}),(0,i.Y)(rI,{})]}),(0,i.Y)(F.r.Open,{value:"regenerate",children:(0,i.Y)(F.r.Card,{children:(0,i.Y)(rF,{})})})]}),(0,i.Y)(rA,{secondFactorsAvailableToAdd:a,onClick:()=>l(null)})]})})})},rx=({phone:e,showTOTP:r})=>{let{open:t}=(0,$.D5)(),n=(0,d.f0)(),l=e.id,o=[!r&&!e.defaultSecondFactor?{label:(0,c.G)("userProfile.start.mfaSection.phoneCode.actionLabel__setDefault"),onClick:()=>e.makeDefaultSecondFactor().catch(e=>(0,G.H4)(e,[],n.setError))}:null,{label:(0,c.G)("userProfile.start.mfaSection.phoneCode.destructiveActionLabel"),isDestructive:!0,onClick:()=>t(`remove-${l}`)}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:o})},rI=()=>{let{open:e}=(0,$.D5)(),r=[{label:(0,c.G)("userProfile.start.mfaSection.backupCodes.actionLabel__regenerate"),onClick:()=>e("regenerate")}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:r})},rk=()=>{let{open:e}=(0,$.D5)(),r=[{label:(0,c.G)("userProfile.start.mfaSection.totp.destructiveActionTitle"),isDestructive:!0,onClick:()=>e("remove-totp")}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:r})},rA=e=>{let{open:r}=(0,$.D5)(),{secondFactorsAvailableToAdd:t,onClick:l}=e,[o,a]=(0,n.useState)(),s=n.useMemo(()=>t.map(e=>"phone_code"===e?{icon:e6.A,text:"SMS code",key:"phone_code"}:"totp"===e?{icon:e3.A,text:"Authenticator application",key:"totp"}:"backup_code"===e?{icon:e8.A,text:"Backup code",key:"backup_code"}:null).filter(e=>null!==e),[t]);return(0,i.FD)(i.FK,{children:[t.length>0&&(0,i.Y)(F.r.Closed,{value:"multi-factor",children:(0,i.Y)(D.rd.ActionMenu,{id:"mfa",triggerLocalizationKey:(0,c.G)("userProfile.start.mfaSection.primaryButton"),onClick:l,children:s.map(e=>e&&(0,i.Y)(D.rd.ActionMenuItem,{id:e.key,localizationKey:e.text,leftIcon:e.icon,onClick:()=>{a(e.key),r("multi-factor")}},e.key))})}),(0,i.Y)(F.r.Open,{value:"multi-factor",children:(0,i.Y)(F.r.Card,{children:o&&(0,i.Y)(r$,{selectedStrategy:o})})})]})},rz=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(N,{onSuccess:r,onReset:r,...e})},rT=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(rE,{onSuccess:r,onReset:r,passkey:e.passkey})},rE=(0,d.dm)(e=>{let{onSuccess:r,onReset:t,passkey:n}=e,l=(0,d.f0)(),o=(0,ed.tJ)("passkeyName",n.name||"",{type:"text",label:(0,c.G)("formFieldLabel__passkeyName"),isRequired:!0}),a=o.value.length>1&&n.name!==o.value,s=async e=>(e.preventDefault(),n.update({name:o.value}).then(r).catch(e=>(0,G.H4)(e,[o],l.setError)));return(0,i.Y)(ec.M,{headerTitle:(0,c.G)("userProfile.passkeyScreen.title__rename"),headerSubtitle:(0,c.G)("userProfile.passkeyScreen.subtitle__rename"),children:(0,i.FD)(ea.l.Root,{onSubmit:s,children:[(0,i.Y)(ea.l.ControlRow,{elementId:o.id,children:(0,i.Y)(ea.l.PlainInput,{...o.props,autoComplete:"off"})}),(0,i.Y)(es.G,{submitLabel:(0,c.G)("userProfile.formButtonPrimary__save"),isDisabled:!a,onReset:t})]})})}),rL=()=>{let{user:e}=(0,v.Jd)(),[r,t]=(0,n.useState)(null);return e?(0,i.Y)(D.rd.Root,{title:(0,c.G)("userProfile.start.passkeysSection.title"),centered:!1,id:"passkeys",children:(0,i.Y)(F.r.Root,{value:r,onChange:t,children:(0,i.FD)(D.rd.ItemList,{id:"passkeys",children:[e.passkeys.map(e=>{let r=e.id;return(0,i.FD)(n.Fragment,{children:[(0,i.Y)(rO,{...e},r),(0,i.Y)(F.r.Open,{value:`remove-${r}`,children:(0,i.Y)(F.r.Card,{variant:"destructive",children:(0,i.Y)(rz,{passkey:e})})}),(0,i.Y)(F.r.Open,{value:`rename-${r}`,children:(0,i.Y)(F.r.Card,{children:(0,i.Y)(rT,{passkey:e})})})]},r)}),(0,i.Y)(rN,{onClick:()=>t(null)})]})})}):null},rO=e=>(0,i.FD)(D.rd.Item,{id:"passkeys",hoverable:!0,sx:{alignItems:"flex-start"},children:[(0,i.Y)(rK,{...e}),(0,i.Y)(rM,{passkey:e})]}),rK=e=>{let{name:r,createdAt:t,lastUsedAt:n}=e,{t:l}=(0,eS._)();return(0,i.Y)(y.so,{sx:e=>({width:"100%",overflow:"hidden",gap:e.space.$4,[eb.g.sm]:{gap:e.space.$2}}),children:(0,i.FD)(y.fv,{align:"start",gap:1,children:[(0,i.Y)(y.EY,{children:r}),(0,i.FD)(y.EY,{colorScheme:"secondary",children:["Created: ",l((0,eB.T)(t))]}),n&&(0,i.FD)(y.EY,{colorScheme:"secondary",children:["Last used: ",l((0,eB.T)(n))]})]})})},rM=({passkey:e})=>{let{open:r}=(0,$.D5)(),t=e.id,n=[{label:(0,c.G)("userProfile.start.passkeysSection.menuAction__rename"),onClick:()=>r(`rename-${t}`)},{label:(0,c.G)("userProfile.start.passkeysSection.menuAction__destructive"),isDestructive:!0,onClick:()=>r(`remove-${t}`)}];return(0,i.Y)(R.o,{actions:n})},rN=({onClick:e})=>{let r=(0,d.f0)(),{isSatellite:t}=(0,v.ho)(),{user:n}=(0,v.Jd)(),l=(0,v.Wp)(()=>n?.createPasskey()),o=async()=>{if(e?.(),n)try{await l()}catch(e){(0,G.H4)(e,[],r.setError)}};return t?null:(0,i.Y)(D.rd.ArrowButton,{id:"passkeys",localizationKey:(0,c.G)("userProfile.start.passkeysSection.primaryButton"),onClick:o})};var rB=t(3990),rW=t(8282);let rJ=(0,d.dm)(e=>{let{t:r,locale:t}=(0,eS._)(),{onSuccess:l,onReset:o}=e,{user:a}=(0,v.Jd)(),s=(0,v.Wp)((e,r)=>e.updatePassword(...r));if(!a)return null;let{userSettings:{passwordSettings:u},authConfig:{reverification:h}}=(0,Y.O)(),{session:m}=(0,v.wV)(),f=a.passwordEnabled?(0,c.G)("userProfile.passwordPage.title__update"):(0,c.G)("userProfile.passwordPage.title__set"),p=(0,d.f0)(),g=a.enterpriseAccounts.some(e=>e.active),P=a.passwordEnabled&&!h,b=(0,n.useRef)({title:(0,c.G)("userProfile.passwordPage.title__set")}),y=(0,ed.tJ)("currentPassword","",{type:"password",label:(0,c.G)("formFieldLabel__currentPassword"),isRequired:!0}),S=(0,ed.tJ)("newPassword","",{type:"password",label:(0,c.G)("formFieldLabel__newPassword"),isRequired:!0,validatePassword:!0,buildErrorMessage:e=>(0,rB.C5)(e,{t:r,locale:t,passwordSettings:u})}),_=(0,ed.tJ)("confirmPassword","",{type:"password",label:(0,c.G)("formFieldLabel__confirmPassword"),isRequired:!0}),D=(0,ed.tJ)("signOutOfOtherSessions","",{type:"checkbox",label:(0,c.G)("formFieldLabel__signOutOfOtherSessions"),defaultChecked:!0}),{setConfirmPasswordFeedback:R,isPasswordMatch:C}=(0,rW.Z)({passwordField:S,confirmPasswordField:_}),F=(P?y.value&&C:C)&&S.value&&_.value,$=async()=>{if(F)try{var e,r;let t;b.current={title:a.passwordEnabled?(0,c.G)("userProfile.passwordPage.title__update"):(0,c.G)("userProfile.passwordPage.title__set"),text:(e=a.passwordEnabled,r=!!D.checked,t=[],e?t.push((0,c.G)("userProfile.passwordPage.successMessage__update")):t.push((0,c.G)("userProfile.passwordPage.successMessage__set")),r&&t.push((0,c.G)("userProfile.passwordPage.successMessage__signOutOfOtherSessions")),t)};let i={newPassword:S.value,signOutOfOtherSessions:D.checked,currentPassword:P?y.value:void 0};await s(a,[i]),l()}catch(e){(0,G.H4)(e,[y,S,_],p.setError)}};return(0,i.FD)(ec.M,{headerTitle:f,children:[g&&(0,i.Y)(eC.k,{message:(0,c.G)("userProfile.passwordPage.readonly")}),(0,i.FD)(ea.l.Root,{onSubmit:$,onBlur:()=>{S.value&&R(_.value)},children:[(0,i.Y)("input",{readOnly:!0,"data-testid":"hidden-identifier",id:"identifier-field",name:"identifier",value:m?.publicUserData.identifier||"",style:{display:"none"}}),P&&(0,i.Y)(ea.l.ControlRow,{elementId:y.id,children:(0,i.Y)(ea.l.PasswordInput,{...y.props,minLength:6,isRequired:!0,autoFocus:!0,isDisabled:g})}),(0,i.Y)(ea.l.ControlRow,{elementId:S.id,children:(0,i.Y)(ea.l.PasswordInput,{...S.props,minLength:6,isRequired:!0,autoFocus:!a.passwordEnabled,isDisabled:g})}),(0,i.Y)(ea.l.ControlRow,{elementId:_.id,children:(0,i.Y)(ea.l.PasswordInput,{..._.props,onChange:e=>(e.target.value&&R(e.target.value),_.props.onChange(e)),isRequired:!0,isDisabled:g})}),(0,i.Y)(ea.l.ControlRow,{elementId:D.id,children:(0,i.Y)(ea.l.Checkbox,{...D.props,description:(0,c.G)("userProfile.passwordPage.checkboxInfoText__signOutOfOtherSessions"),isDisabled:g})}),g?(0,i.Y)(es.c,{children:(0,i.Y)(ea.l.ResetButton,{localizationKey:(0,c.G)("userProfile.formButtonReset"),block:!1,onClick:o})}):(0,i.Y)(es.G,{isDisabled:!F,onReset:o})]})]})}),rq=()=>{let{close:e}=(0,$.D5)();return(0,i.Y)(rJ,{onSuccess:e,onReset:e})},rU=()=>{let{user:e}=(0,v.Jd)();if(!e)return null;let{passwordEnabled:r}=e;return(0,i.Y)(D.rd.Root,{centered:!1,title:(0,c.G)("userProfile.start.passwordSection.title"),id:"password",children:(0,i.FD)(F.r.Root,{children:[(0,i.Y)(F.r.Closed,{value:"edit",children:(0,i.FD)(D.rd.Item,{id:"password",sx:e=>({paddingLeft:r?void 0:"0",paddingTop:e.space.$0x25,paddingBottom:e.space.$0x25}),children:[r&&(0,i.Y)(y.EY,{variant:"h2",children:"••••••••••"}),(0,i.Y)(F.r.Trigger,{value:"edit",children:(0,i.Y)(D.rd.Button,{id:"password",localizationKey:r?(0,c.G)("userProfile.start.passwordSection.primaryButton__updatePassword"):(0,c.G)("userProfile.start.passwordSection.primaryButton__setPassword")})})]})}),(0,i.Y)(F.r.Open,{value:"edit",children:(0,i.Y)(F.r.Card,{children:(0,i.Y)(rq,{})})})]})})},rj=(0,d.dm)(()=>{let{attributes:e,instanceIsPasswordBased:r}=(0,Y.O)().userSettings,t=(0,d.f0)(),{user:n}=(0,v.Jd)(),{shouldAllowIdentificationCreation:l}=(0,a.B)(),o=e.passkey?.enabled&&l,s=V(e).length>0,u=n?.deleteSelfEnabled;return(0,i.Y)(y.fv,{elementDescriptor:S.$z.page,sx:e=>({gap:e.space.$8}),children:(0,i.FD)(y.fv,{elementDescriptor:S.$z.profilePage,elementId:S.$z.profilePage.setId("security"),children:[(0,i.Y)(b.Y.Root,{children:(0,i.Y)(b.Y.Title,{localizationKey:(0,c.G)("userProfile.start.headerTitle__security"),sx:e=>({marginBottom:e.space.$4}),textVariant:"h2"})}),(0,i.Y)(P.Z.Alert,{children:t.error}),r&&(0,i.Y)(rU,{}),o&&(0,i.Y)(rL,{}),s&&(0,i.Y)(rw,{}),(0,i.Y)(ej,{}),u&&(0,i.Y)(e5,{})]})})}),rV=(0,n.lazy)(()=>Promise.all([t.e("666"),t.e("207"),t.e("259")]).then(t.bind(t,1608)).then(e=>({default:e.BillingPage}))),rH=(0,n.lazy)(()=>Promise.all([t.e("666"),t.e("326"),t.e("817")]).then(t.bind(t,8201)).then(e=>({default:e.APIKeysPage}))),rZ=(0,n.lazy)(()=>Promise.all([t.e("666"),t.e("970"),t.e("110")]).then(t.bind(t,7437)).then(e=>({default:e.PlansPage}))),rX=(0,n.lazy)(()=>Promise.all([t.e("545"),t.e("666"),t.e("627")]).then(t.bind(t,1666)).then(e=>({default:e.StatementPage}))),rQ=(0,n.lazy)(()=>Promise.all([t.e("545"),t.e("666"),t.e("122")]).then(t.bind(t,4856)).then(e=>({default:e.PaymentAttemptPage}))),r0=()=>{let{pages:e,shouldShowBilling:r,apiKeysProps:t}=(0,a.B)(),{apiKeysSettings:o,commerceSettings:s}=(0,Y.O)(),c=e.routes[0].id===l.j2.ACCOUNT,d=e.routes[0].id===l.j2.SECURITY,u=e.routes[0].id===l.j2.BILLING,h=e.routes[0].id===l.j2.API_KEYS,p=e.contents?.map((e,r)=>{let t=!c&&!d&&0===r;return(0,i.Y)(f.q,{index:t,path:t?void 0:e.url,children:(0,i.Y)(g.H,{mount:e.mount,unmount:e.unmount})},`custom-page-${e.url}`)});return(0,i.FD)(m.d,{children:[p,(0,i.FD)(f.q,{children:[(0,i.Y)(f.q,{path:c?void 0:"account",children:(0,i.Y)(m.d,{children:(0,i.Y)(f.q,{index:!0,children:(0,i.Y)(eM,{})})})}),(0,i.Y)(f.q,{path:d?void 0:"security",children:(0,i.Y)(m.d,{children:(0,i.Y)(f.q,{index:!0,children:(0,i.Y)(rj,{})})})}),s.billing.user.enabled&&r?(0,i.Y)(f.q,{path:u?void 0:"billing",children:(0,i.FD)(m.d,{children:[(0,i.Y)(f.q,{index:!0,children:(0,i.Y)(n.Suspense,{fallback:"",children:(0,i.Y)(rV,{})})}),s.billing.user.hasPaidPlans?(0,i.Y)(f.q,{path:"plans",children:(0,i.Y)(n.Suspense,{fallback:"",children:(0,i.Y)(rZ,{})})}):null,(0,i.Y)(f.q,{path:"statement/:statementId",children:(0,i.Y)(n.Suspense,{fallback:"",children:(0,i.Y)(rX,{})})}),(0,i.Y)(f.q,{path:"payment-attempt/:paymentAttemptId",children:(0,i.Y)(n.Suspense,{fallback:"",children:(0,i.Y)(rQ,{})})})]})}):null,o.user_api_keys_enabled&&!t?.hide&&(0,i.Y)(f.q,{path:h?void 0:"api-keys",children:(0,i.Y)(m.d,{children:(0,i.Y)(f.q,{index:!0,children:(0,i.Y)(n.Suspense,{fallback:"",children:(0,i.Y)(rH,{})})})})})]})]})};var r1=t(393);let r2=()=>(0,i.Y)(s.n.Root,{flow:"userProfile",children:(0,i.Y)(s.n.Part,{children:(0,i.FD)(m.d,{children:[(0,i.Y)(f.q,{path:"verify",children:(0,i.Y)(r1.G,{})}),(0,i.Y)(f.q,{children:(0,i.Y)(r5,{})})]})})}),r5=(0,o.G)(()=>{let e=n.useRef(null);return(0,i.Y)(h.a.Root,{children:(0,i.FD)(p,{contentRef:e,children:[(0,i.Y)(u.oT,{navbarTitleLocalizationKey:(0,c.G)("userProfile.navbar.title")}),(0,i.Y)(h.a.Content,{contentRef:e,scrollBoxId:l.AG,children:(0,i.Y)(r0,{})})]})})}),r4=(0,d.dm)(r2),r3=(0,d.dm)(r2),r6=e=>{let r={...e,routing:"virtual",componentName:"UserProfile",mode:"modal"};return(0,i.Y)(f.q,{path:"user",children:(0,i.Y)(a.M.Provider,{value:r,children:(0,i.Y)("div",{children:(0,i.Y)(r3,{...r})})})})}},9599:function(e,r,t){t.d(r,{g:()=>l});var i=t(1210),n=t(4964);let l=()=>{let{navigate:e}=(0,n.r)(),r=(0,i.ho)();return{navigateAfterSignOut:()=>e(r.buildAfterSignOutUrl()),navigateAfterMultiSessionSingleSignOutUrl:()=>e(r.buildAfterMultiSessionSingleSignOutUrl()),afterSignOutUrl:r.buildAfterSignOutUrl(),afterMultiSessionSingleSignOutUrl:r.buildAfterMultiSessionSingleSignOutUrl()}}}}]);
4
+ ${l}`)],{type:"text/plain"});o.href=URL.createObjectURL(a),o.download=`${n}_backup_codes.txt`,document.body.appendChild(o),o.click()},children:(0,i.Y)(y.In,{icon:rn.A})}),(0,i.Y)(y.$n,{variant:"ghost",sx:e=>({width:"100%",padding:`${e.space.$2} 0`,borderRadius:0}),onClick:o,children:(0,i.Y)(y.In,{icon:rl.A})}),(0,i.Y)(y.$n,{variant:"ghost",onClick:s,sx:e=>({width:"100%",padding:`${e.space.$2} 0`,borderRadius:0}),children:(0,i.Y)(y.In,{icon:d?ro.A:ra.A})})]})]}),(0,i.FD)(rt.L,{...a,children:[(0,i.FD)(y.DZ,{children:["Your backup codes for ",n," account ",u,":"]}),(0,i.Y)(y.fv,{gap:2,children:t.map((e,r)=>(0,i.Y)(rs,{code:e},r))})]})]}):null},rd=(0,d.dm)(e=>{let{onSuccess:r,onReset:t}=e,{user:l}=(0,v.Jd)(),o=(0,d.f0)(),a=(0,v.Wp)(()=>l?.createBackupCode()),[s,u]=n.useState(void 0);return(n.useEffect(()=>{!s&&l&&a().then(e=>u(e)).catch(e=>{if((0,eT.I3)(e))return t();(0,G.H4)(e,[],o.setError)})},[]),o.error)?(0,i.Y)(ec.M,{headerTitle:(0,c.G)("userProfile.backupCodePage.title")}):(0,i.Y)(ec.M,{headerTitle:(0,c.G)("userProfile.backupCodePage.title"),children:s?(0,i.FD)(i.FK,{children:[(0,i.Y)(y.EY,{localizationKey:(0,c.G)("userProfile.backupCodePage.successMessage")}),(0,i.Y)(rc,{subtitle:(0,c.G)("userProfile.backupCodePage.subtitle__codelist"),backupCodes:s.codes}),(0,i.Y)(es.c,{children:(0,i.Y)(y.$n,{autoFocus:!0,onClick:r,localizationKey:(0,c.G)("userProfile.formButtonPrimary__finish"),elementDescriptor:S.$z.formButtonPrimary})})]}):(0,i.Y)(eJ.K,{})})}),ru=(0,d.dm)(e=>{let{onSuccess:r,onReset:t}=e,n=(0,eu.X)();return(0,i.FD)(eu.s,{...n.props,children:[(0,i.Y)(rh,{onContinue:n.nextStep}),(0,i.Y)(rd,{onSuccess:r,onReset:t})]})}),rh=e=>{let{onContinue:r}=e,{close:t}=(0,$.D5)();return(0,i.FD)(ec.M,{headerTitle:(0,c.G)("userProfile.backupCodePage.title"),children:[(0,i.Y)(y.EY,{localizationKey:(0,c.G)("userProfile.backupCodePage.infoText1")}),(0,i.Y)(y.EY,{localizationKey:(0,c.G)("userProfile.backupCodePage.infoText2")}),(0,i.FD)(es.c,{sx:{marginTop:0},children:[(0,i.Y)(y.$n,{textVariant:"buttonSmall",onClick:r,localizationKey:(0,c.G)("userProfile.formButtonPrimary__finish"),elementDescriptor:S.$z.formButtonPrimary}),(0,i.Y)(y.$n,{variant:"ghost",onClick:t,localizationKey:(0,c.G)("userProfile.formButtonReset"),elementDescriptor:S.$z.formButtonReset})]})]})};var rm=t(155),rf=t(6370),rp=t(9679);let rg=(0,d.dm)(e=>{let{onReset:r,onSuccess:t}=e,l=n.useRef(),o=(0,eu.X)({defaultStep:2}),a=(0,Y.O)().userSettings.attributes.backup_code?.enabled;return(0,i.FD)(eu.s,{...o.props,children:[(0,i.Y)(ef,{title:(0,c.G)("userProfile.phoneNumberPage.title"),resourceRef:l,onSuccess:o.nextStep,onUseExistingNumberClick:()=>o.goToStep(2),onReset:r}),(0,i.Y)(rv,{title:(0,c.G)("userProfile.mfaPhoneCodePage.title"),resourceRef:l,onSuccess:()=>a?o.goToStep(3):t(),onReset:()=>o.goToStep(2)}),(0,i.Y)(rP,{onSuccess:a?o.nextStep:t,onReset:r,onAddPhoneClick:()=>o.goToStep(0),onUnverifiedPhoneClick:e=>{l.current=e,o.goToStep(1)},title:(0,c.G)("userProfile.mfaPhoneCodePage.title"),resourceRef:l}),a&&(0,i.Y)(rf.B,{title:(0,c.G)("userProfile.mfaPhoneCodePage.successTitle"),text:l.current?.backupCodes&&l.current?.backupCodes.length>0?[(0,c.G)("userProfile.mfaPhoneCodePage.successMessage1"),(0,c.G)("userProfile.mfaPhoneCodePage.successMessage2")]:[(0,c.G)("userProfile.mfaPhoneCodePage.successMessage1")],onFinish:r,contents:(0,i.Y)(rc,{backupCodes:l.current?.backupCodes})})]})}),rY=e=>{let{phone:r,onSuccess:t,onUnverifiedPhoneClick:n,resourceRef:l}=e,o=(0,d.f0)(),a=(0,v.Wp)(()=>r.setReservedForSecondFactor({reserved:!0})),{country:s}=(0,eo.Mz)(r.phoneNumber),c=(0,eo.Om)(r.phoneNumber),u=async()=>{if("verified"!==r.verification.status)return n(r);o.setLoading(r.id);try{await a(),l.current=r,t()}catch(e){(0,G.H4)(e,[],o.setError)}finally{o.setIdle()}};return(0,i.FD)(y.$n,{variant:"outline",colorScheme:"neutral",sx:{justifyContent:"start"},onClick:u,isLoading:o.loadingMetadata===r.id,isDisabled:o.isLoading,children:[s.iso.toUpperCase()," ",c]},r.id)},rv=e=>{let{title:r,onSuccess:t,resourceRef:n,onReset:l}=e,o=(0,d.f0)(),a=n.current,s=(0,v.Wp)(()=>a?.setReservedForSecondFactor({reserved:!0})),u=async()=>{o.setLoading(a?.id);try{await s(),n.current=a,t()}catch(e){(0,G.H4)(e,[],o.setError)}finally{o.setIdle()}};return(0,i.Y)(ec.M,{headerTitle:r,headerSubtitle:(0,c.G)("userProfile.phoneNumberPage.verifySubtitle",{identifier:n.current?.phoneNumber||""}),children:(0,i.Y)(eh.j,{nextStep:()=>{u()},identification:n.current,identifier:n.current?.phoneNumber,prepareVerification:n.current?.prepareVerification,onReset:l})})},rP=e=>{let{onSuccess:r,onReset:t,title:n,onAddPhoneClick:l,onUnverifiedPhoneClick:o,resourceRef:a}=e,{user:s}=(0,v.Jd)();if(!s)return null;let d=s.phoneNumbers.filter(e=>!e.reservedForSecondFactor);return(0,i.FD)(ec.M,{headerTitle:n,gap:1,children:[(0,i.Y)(y.EY,{localizationKey:(0,c.G)(d.length?"userProfile.mfaPhoneCodePage.subtitle__availablePhoneNumbers":"userProfile.mfaPhoneCodePage.subtitle__unavailablePhoneNumbers"),colorScheme:"secondary"}),d.length>0&&(0,i.Y)(y.fv,{gap:2,children:d.map(e=>(0,i.Y)(rY,{onSuccess:r,phone:e,onUnverifiedPhoneClick:o,resourceRef:a},e.id))}),(0,i.FD)(es.c,{sx:{flexDirection:"row",justifyContent:"space-between"},children:[(0,i.Y)(rm.K,{variant:"ghost","aria-label":"Add phone number",icon:(0,i.Y)(y.In,{icon:rp.A,sx:e=>({marginRight:e.space.$2})}),localizationKey:(0,c.G)("userProfile.mfaPhoneCodePage.primaryButton__addPhoneNumber"),onClick:l}),(0,i.Y)(y.$n,{variant:"ghost",localizationKey:(0,c.G)("userProfile.formButtonReset"),onClick:t})]})]})};var rb=t(5559),ry=t(2094);let rS=(0,d.dm)(e=>{let{title:r,onSuccess:t,onReset:l}=e,{user:o}=(0,v.Jd)(),a=(0,d.f0)(),s=(0,v.Wp)(()=>o?.createTOTP()),{close:u}=(0,$.D5)(),[h,m]=n.useState(void 0),[f,p]=n.useState("qr");return(n.useEffect(()=>{o&&s().then(e=>m(e)).catch(e=>(0,eT.Cm)(e)&&"reverification_cancelled"===e.code?u():(0,G.H4)(e,[],a.setError))},[]),a.error)?(0,i.Y)(ec.M,{headerTitle:r}):(0,i.FD)(ec.M,{headerTitle:r,headerSubtitle:"qr"==f?(0,c.G)("userProfile.mfaTOTPPage.authenticatorApp.infoText__ableToScan"):(0,c.G)("userProfile.mfaTOTPPage.authenticatorApp.infoText__unableToScan"),children:[!h&&(0,i.Y)(eJ.K,{}),h&&(0,i.FD)(i.FK,{children:[(0,i.FD)(y.fv,{gap:4,children:["qr"==f&&(0,i.Y)(ry.r,{justify:"center",url:h.uri||""}),"uri"==f&&(0,i.FD)(i.FK,{children:[(0,i.Y)(y.EY,{colorScheme:"secondary",localizationKey:(0,c.G)("userProfile.mfaTOTPPage.authenticatorApp.inputLabel__unableToScan1")}),(0,i.Y)(rb.r,{value:h.secret}),(0,i.Y)(y.EY,{colorScheme:"secondary",localizationKey:(0,c.G)("userProfile.mfaTOTPPage.authenticatorApp.inputLabel__unableToScan2")}),(0,i.Y)(rb.r,{value:h.uri})]})]}),(0,i.FD)(y.so,{justify:"between",align:"center",sx:{width:"100%"},children:["qr"==f&&(0,i.Y)(y.$n,{variant:"link",textVariant:"buttonLarge",onClick:()=>p("uri"),localizationKey:(0,c.G)("userProfile.mfaTOTPPage.authenticatorApp.buttonUnableToScan__nonPrimary")}),"uri"==f&&(0,i.Y)(y.$n,{variant:"link",textVariant:"buttonLarge",onClick:()=>p("qr"),localizationKey:(0,c.G)("userProfile.mfaTOTPPage.authenticatorApp.buttonAbleToScan__nonPrimary")}),(0,i.FD)(es.c,{children:[(0,i.Y)(y.$n,{onClick:t,localizationKey:(0,c.G)("userProfile.formButtonPrimary__continue"),elementDescriptor:S.$z.formButtonPrimary}),(0,i.Y)(y.$n,{variant:"ghost",onClick:l,localizationKey:(0,c.G)("userProfile.formButtonReset"),elementDescriptor:S.$z.formButtonReset})]})]})]})]})});var r_=t(3356);let rD=(0,d.dm)(e=>{let{onSuccess:r,onReset:t,resourceRef:n}=e,{user:l}=(0,v.Jd)(),o=(0,r_.xM)({onCodeEntryFinished:(e,r,t)=>{l?.verifyTOTP({code:e}).then(e=>r(e)).catch(t)},onResolve:e=>{n.current=e,r()}});return(0,i.FD)(ec.M,{headerTitle:(0,c.G)("userProfile.mfaTOTPPage.title"),children:[(0,i.Y)(y.fv,{children:(0,i.Y)(ea.l.OTPInput,{...o,label:(0,c.G)("userProfile.mfaTOTPPage.verifyTitle"),description:(0,c.G)("userProfile.mfaTOTPPage.verifySubtitle")})}),(0,i.Y)(es.c,{sx:{marginTop:0},children:(0,i.Y)(y.$n,{onClick:t,variant:"ghost",isDisabled:o.isLoading,localizationKey:(0,c.G)("userProfile.formButtonReset"),elementDescriptor:S.$z.formButtonReset})})]})}),rR=(0,d.dm)(e=>{let{onReset:r}=e,t=(0,eu.X)(),l=n.useRef();return(0,i.FD)(eu.s,{...t.props,children:[(0,i.Y)(rS,{title:(0,c.G)("userProfile.mfaTOTPPage.title"),onSuccess:t.nextStep,onReset:r}),(0,i.Y)(rD,{onSuccess:t.nextStep,onReset:r,resourceRef:l}),(0,i.Y)(rf.B,{title:(0,c.G)("userProfile.mfaTOTPPage.title"),text:(0,c.G)("userProfile.mfaTOTPPage.successMessage"),onFinish:r,contents:(0,i.Y)(rc,{subtitle:(0,c.G)("userProfile.backupCodePage.successSubtitle"),backupCodes:l.current?.backupCodes})})]})}),rG=(0,d.dm)(e=>{let{onSuccess:r,onReset:t,selectedStrategy:l}=e,o=(0,d.f0)(),{userSettings:{attributes:a}}=(0,Y.O)(),{user:s}=(0,v.Jd)();if(!s)return null;let u=(0,c.G)("userProfile.mfaPage.title"),h=n.useMemo(()=>V(a,s),[]);return(n.useEffect(()=>{0===h.length&&o.setError("There are no second factors available to add")},[]),o.error)?(0,i.Y)(ec.M,{headerTitle:u}):0!==h.length||l?(0,i.Y)(rw,{onSuccess:r,onReset:t,method:l||h[0]}):null}),rw=e=>{let{method:r,onSuccess:t,onReset:n}=e;switch(r){case"phone_code":return(0,i.Y)(rg,{onSuccess:t,onReset:n});case"totp":return(0,i.Y)(rR,{onSuccess:t,onReset:n});case"backup_code":return(0,i.Y)(ru,{onSuccess:t,onReset:n});default:return null}},rC=()=>{let{close:e}=(0,$.D5)();return(0,i.Y)(B,{onSuccess:e,onReset:e})},r$=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(K,{onSuccess:r,onReset:r,...e})},rF=()=>{let{close:e}=(0,$.D5)();return(0,i.Y)(rd,{onSuccess:e,onReset:e})},rI=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(rG,{onSuccess:r,onReset:r,selectedStrategy:e.selectedStrategy})},rx=()=>{let{userSettings:{attributes:e}}=(0,Y.O)(),{user:r}=(0,v.Jd)(),[t,l]=(0,n.useState)(null);if(!r)return null;let o=H(e),a=V(e,r),s=o.includes("totp")&&r.totpEnabled,d=o.includes("backup_code")&&r.backupCodeEnabled,u=r.phoneNumbers.filter(e=>"verified"===e.verification.status).filter(e=>e.reservedForSecondFactor).sort(j);return(0,i.Y)(D.rd.Root,{title:(0,c.G)("userProfile.start.mfaSection.title"),centered:!1,id:"mfa",children:(0,i.Y)(C.r.Root,{value:t,onChange:l,children:(0,i.FD)(D.rd.ItemList,{id:"mfa",children:[s&&(0,i.FD)(i.FK,{children:[(0,i.FD)(D.rd.Item,{id:"mfa",hoverable:!0,children:[(0,i.FD)(y.so,{sx:e=>({gap:e.space.$2,alignItems:"center"}),children:[(0,i.Y)(y.In,{icon:e7.A,sx:e=>({color:e.colors.$neutralAlpha700})}),(0,i.Y)(y.EY,{localizationKey:(0,c.G)("userProfile.start.mfaSection.totp.headerTitle")}),(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__default")})]}),(0,i.Y)(rz,{})]}),(0,i.Y)(C.r.Open,{value:"remove-totp",children:(0,i.Y)(C.r.Card,{variant:"destructive",children:(0,i.Y)(rC,{})})})]}),o.includes("phone_code")&&u.map(e=>{let r=!s&&e.defaultSecondFactor,t=e.id;return(0,i.FD)(n.Fragment,{children:[(0,i.FD)(D.rd.Item,{id:"mfa",hoverable:!0,children:[(0,i.FD)(y.so,{sx:e=>({gap:e.space.$2,alignItems:"center"}),children:[(0,i.Y)(y.In,{icon:e9.A,sx:e=>({color:e.colors.$neutralAlpha700})}),(0,i.FD)(y.EY,{children:["SMS Code ",(0,i.Y)(e8.R,{value:e.phoneNumber})]}),r&&(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__default")})]}),(0,i.Y)(rk,{phone:e,showTOTP:s})]}),(0,i.Y)(C.r.Open,{value:`remove-${t}`,children:(0,i.Y)(C.r.Card,{variant:"destructive",children:(0,i.Y)(r$,{phoneId:t})})})]},t)}),d&&(0,i.FD)(i.FK,{children:[(0,i.FD)(D.rd.Item,{id:"mfa",hoverable:!0,children:[(0,i.FD)(y.so,{sx:e=>({gap:e.space.$2,alignItems:"center"}),children:[(0,i.Y)(y.In,{icon:re.A,sx:e=>({color:e.colors.$neutralAlpha700})}),(0,i.Y)(y.EY,{localizationKey:(0,c.G)("userProfile.start.mfaSection.backupCodes.headerTitle")})]}),(0,i.Y)(rA,{})]}),(0,i.Y)(C.r.Open,{value:"regenerate",children:(0,i.Y)(C.r.Card,{children:(0,i.Y)(rF,{})})})]}),(0,i.Y)(rT,{secondFactorsAvailableToAdd:a,onClick:()=>l(null)})]})})})},rk=({phone:e,showTOTP:r})=>{let{open:t}=(0,$.D5)(),n=(0,d.f0)(),l=e.id,o=[!r&&!e.defaultSecondFactor?{label:(0,c.G)("userProfile.start.mfaSection.phoneCode.actionLabel__setDefault"),onClick:()=>e.makeDefaultSecondFactor().catch(e=>(0,G.H4)(e,[],n.setError))}:null,{label:(0,c.G)("userProfile.start.mfaSection.phoneCode.destructiveActionLabel"),isDestructive:!0,onClick:()=>t(`remove-${l}`)}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:o})},rA=()=>{let{open:e}=(0,$.D5)(),r=[{label:(0,c.G)("userProfile.start.mfaSection.backupCodes.actionLabel__regenerate"),onClick:()=>e("regenerate")}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:r})},rz=()=>{let{open:e}=(0,$.D5)(),r=[{label:(0,c.G)("userProfile.start.mfaSection.totp.destructiveActionTitle"),isDestructive:!0,onClick:()=>e("remove-totp")}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:r})},rT=e=>{let{open:r}=(0,$.D5)(),{secondFactorsAvailableToAdd:t,onClick:l}=e,[o,a]=(0,n.useState)(),s=n.useMemo(()=>t.map(e=>"phone_code"===e?{icon:e9.A,text:"SMS code",key:"phone_code"}:"totp"===e?{icon:e7.A,text:"Authenticator application",key:"totp"}:"backup_code"===e?{icon:re.A,text:"Backup code",key:"backup_code"}:null).filter(e=>null!==e),[t]);return(0,i.FD)(i.FK,{children:[t.length>0&&(0,i.Y)(C.r.Closed,{value:"multi-factor",children:(0,i.Y)(D.rd.ActionMenu,{id:"mfa",triggerLocalizationKey:(0,c.G)("userProfile.start.mfaSection.primaryButton"),onClick:l,children:s.map(e=>e&&(0,i.Y)(D.rd.ActionMenuItem,{id:e.key,localizationKey:e.text,leftIcon:e.icon,onClick:()=>{a(e.key),r("multi-factor")}},e.key))})}),(0,i.Y)(C.r.Open,{value:"multi-factor",children:(0,i.Y)(C.r.Card,{children:o&&(0,i.Y)(rI,{selectedStrategy:o})})})]})},rE=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(M,{onSuccess:r,onReset:r,...e})},rL=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(rO,{onSuccess:r,onReset:r,passkey:e.passkey})},rO=(0,d.dm)(e=>{let{onSuccess:r,onReset:t,passkey:n}=e,l=(0,d.f0)(),o=(0,ed.tJ)("passkeyName",n.name||"",{type:"text",label:(0,c.G)("formFieldLabel__passkeyName"),isRequired:!0}),a=o.value.length>1&&n.name!==o.value,s=async e=>(e.preventDefault(),n.update({name:o.value}).then(r).catch(e=>(0,G.H4)(e,[o],l.setError)));return(0,i.Y)(ec.M,{headerTitle:(0,c.G)("userProfile.passkeyScreen.title__rename"),headerSubtitle:(0,c.G)("userProfile.passkeyScreen.subtitle__rename"),children:(0,i.FD)(ea.l.Root,{onSubmit:s,children:[(0,i.Y)(ea.l.ControlRow,{elementId:o.id,children:(0,i.Y)(ea.l.PlainInput,{...o.props,autoComplete:"off"})}),(0,i.Y)(es.G,{submitLabel:(0,c.G)("userProfile.formButtonPrimary__save"),isDisabled:!a,onReset:t})]})})}),rK=()=>{let{user:e}=(0,v.Jd)(),[r,t]=(0,n.useState)(null);return e?(0,i.Y)(D.rd.Root,{title:(0,c.G)("userProfile.start.passkeysSection.title"),centered:!1,id:"passkeys",children:(0,i.Y)(C.r.Root,{value:r,onChange:t,children:(0,i.FD)(D.rd.ItemList,{id:"passkeys",children:[e.passkeys.map(e=>{let r=e.id;return(0,i.FD)(n.Fragment,{children:[(0,i.Y)(rB,{...e},r),(0,i.Y)(C.r.Open,{value:`remove-${r}`,children:(0,i.Y)(C.r.Card,{variant:"destructive",children:(0,i.Y)(rE,{passkey:e})})}),(0,i.Y)(C.r.Open,{value:`rename-${r}`,children:(0,i.Y)(C.r.Card,{children:(0,i.Y)(rL,{passkey:e})})})]},r)}),(0,i.Y)(rN,{onClick:()=>t(null)})]})})}):null},rB=e=>(0,i.FD)(D.rd.Item,{id:"passkeys",hoverable:!0,sx:{alignItems:"flex-start"},children:[(0,i.Y)(rM,{...e}),(0,i.Y)(rW,{passkey:e})]}),rM=e=>{let{name:r,createdAt:t,lastUsedAt:n}=e,{t:l}=(0,eS._)();return(0,i.Y)(y.so,{sx:e=>({width:"100%",overflow:"hidden",gap:e.space.$4,[eb.g.sm]:{gap:e.space.$2}}),children:(0,i.FD)(y.fv,{align:"start",gap:1,children:[(0,i.Y)(y.EY,{children:r}),(0,i.FD)(y.EY,{colorScheme:"secondary",children:["Created: ",l((0,eq.T)(t))]}),n&&(0,i.FD)(y.EY,{colorScheme:"secondary",children:["Last used: ",l((0,eq.T)(n))]})]})})},rW=({passkey:e})=>{let{open:r}=(0,$.D5)(),t=e.id,n=[{label:(0,c.G)("userProfile.start.passkeysSection.menuAction__rename"),onClick:()=>r(`rename-${t}`)},{label:(0,c.G)("userProfile.start.passkeysSection.menuAction__destructive"),isDestructive:!0,onClick:()=>r(`remove-${t}`)}];return(0,i.Y)(R.o,{actions:n})},rN=({onClick:e})=>{let r=(0,d.f0)(),{isSatellite:t}=(0,v.ho)(),{user:n}=(0,v.Jd)(),l=(0,v.Wp)(()=>n?.createPasskey()),o=async()=>{if(e?.(),n)try{await l()}catch(e){(0,G.H4)(e,[],r.setError)}};return t?null:(0,i.Y)(D.rd.ArrowButton,{id:"passkeys",localizationKey:(0,c.G)("userProfile.start.passkeysSection.primaryButton"),onClick:o})};var rJ=t(3990),rq=t(620);let rU=(0,d.dm)(e=>{let{t:r,locale:t}=(0,eS._)(),{onSuccess:l,onReset:o}=e,{user:a}=(0,v.Jd)(),s=(0,v.Wp)((e,r)=>e.updatePassword(...r));if(!a)return null;let{userSettings:{passwordSettings:u},authConfig:{reverification:h}}=(0,Y.O)(),{session:m}=(0,v.wV)(),f=a.passwordEnabled?(0,c.G)("userProfile.passwordPage.title__update"):(0,c.G)("userProfile.passwordPage.title__set"),p=(0,d.f0)(),g=a.enterpriseAccounts.some(e=>e.active),P=a.passwordEnabled&&!h,b=(0,n.useRef)({title:(0,c.G)("userProfile.passwordPage.title__set")}),y=(0,ed.tJ)("currentPassword","",{type:"password",label:(0,c.G)("formFieldLabel__currentPassword"),isRequired:!0}),S=(0,ed.tJ)("newPassword","",{type:"password",label:(0,c.G)("formFieldLabel__newPassword"),isRequired:!0,validatePassword:!0,buildErrorMessage:e=>(0,rJ.C5)(e,{t:r,locale:t,passwordSettings:u})}),_=(0,ed.tJ)("confirmPassword","",{type:"password",label:(0,c.G)("formFieldLabel__confirmPassword"),isRequired:!0}),D=(0,ed.tJ)("signOutOfOtherSessions","",{type:"checkbox",label:(0,c.G)("formFieldLabel__signOutOfOtherSessions"),defaultChecked:!0}),{setConfirmPasswordFeedback:R,isPasswordMatch:w}=(0,rq.Z)({passwordField:S,confirmPasswordField:_}),C=(P?y.value&&w:w)&&S.value&&_.value,$=async()=>{if(C)try{var e,r;let t;b.current={title:a.passwordEnabled?(0,c.G)("userProfile.passwordPage.title__update"):(0,c.G)("userProfile.passwordPage.title__set"),text:(e=a.passwordEnabled,r=!!D.checked,t=[],e?t.push((0,c.G)("userProfile.passwordPage.successMessage__update")):t.push((0,c.G)("userProfile.passwordPage.successMessage__set")),r&&t.push((0,c.G)("userProfile.passwordPage.successMessage__signOutOfOtherSessions")),t)};let i={newPassword:S.value,signOutOfOtherSessions:D.checked,currentPassword:P?y.value:void 0};await s(a,[i]),l()}catch(e){(0,G.H4)(e,[y,S,_],p.setError)}};return(0,i.FD)(ec.M,{headerTitle:f,children:[g&&(0,i.Y)(ew.k,{message:(0,c.G)("userProfile.passwordPage.readonly")}),(0,i.FD)(ea.l.Root,{onSubmit:$,onBlur:()=>{S.value&&R(_.value)},children:[(0,i.Y)("input",{readOnly:!0,"data-testid":"hidden-identifier",id:"identifier-field",name:"identifier",value:m?.publicUserData.identifier||"",style:{display:"none"}}),P&&(0,i.Y)(ea.l.ControlRow,{elementId:y.id,children:(0,i.Y)(ea.l.PasswordInput,{...y.props,minLength:6,isRequired:!0,autoFocus:!0,isDisabled:g})}),(0,i.Y)(ea.l.ControlRow,{elementId:S.id,children:(0,i.Y)(ea.l.PasswordInput,{...S.props,minLength:6,isRequired:!0,autoFocus:!a.passwordEnabled,isDisabled:g})}),(0,i.Y)(ea.l.ControlRow,{elementId:_.id,children:(0,i.Y)(ea.l.PasswordInput,{..._.props,onChange:e=>(e.target.value&&R(e.target.value),_.props.onChange(e)),isRequired:!0,isDisabled:g})}),(0,i.Y)(ea.l.ControlRow,{elementId:D.id,children:(0,i.Y)(ea.l.Checkbox,{...D.props,description:(0,c.G)("userProfile.passwordPage.checkboxInfoText__signOutOfOtherSessions"),isDisabled:g})}),g?(0,i.Y)(es.c,{children:(0,i.Y)(ea.l.ResetButton,{localizationKey:(0,c.G)("userProfile.formButtonReset"),block:!1,onClick:o})}):(0,i.Y)(es.G,{isDisabled:!C,onReset:o})]})]})}),rj=()=>{let{close:e}=(0,$.D5)();return(0,i.Y)(rU,{onSuccess:e,onReset:e})},rH=()=>{let{user:e}=(0,v.Jd)();if(!e)return null;let{passwordEnabled:r}=e;return(0,i.Y)(D.rd.Root,{centered:!1,title:(0,c.G)("userProfile.start.passwordSection.title"),id:"password",children:(0,i.FD)(C.r.Root,{children:[(0,i.Y)(C.r.Closed,{value:"edit",children:(0,i.FD)(D.rd.Item,{id:"password",sx:e=>({paddingLeft:r?void 0:"0",paddingTop:e.space.$0x25,paddingBottom:e.space.$0x25}),children:[r&&(0,i.Y)(y.EY,{variant:"h2",children:"••••••••••"}),(0,i.Y)(C.r.Trigger,{value:"edit",children:(0,i.Y)(D.rd.Button,{id:"password",localizationKey:r?(0,c.G)("userProfile.start.passwordSection.primaryButton__updatePassword"):(0,c.G)("userProfile.start.passwordSection.primaryButton__setPassword")})})]})}),(0,i.Y)(C.r.Open,{value:"edit",children:(0,i.Y)(C.r.Card,{children:(0,i.Y)(rj,{})})})]})})},rV=(0,d.dm)(()=>{let{attributes:e,instanceIsPasswordBased:r}=(0,Y.O)().userSettings,t=(0,d.f0)(),{user:n}=(0,v.Jd)(),{shouldAllowIdentificationCreation:l}=(0,a.B)(),o=e.passkey?.enabled&&l,s=H(e).length>0,u=n?.deleteSelfEnabled;return(0,i.Y)(y.fv,{elementDescriptor:S.$z.page,sx:e=>({gap:e.space.$8}),children:(0,i.FD)(y.fv,{elementDescriptor:S.$z.profilePage,elementId:S.$z.profilePage.setId("security"),children:[(0,i.Y)(b.Y.Root,{children:(0,i.Y)(b.Y.Title,{localizationKey:(0,c.G)("userProfile.start.headerTitle__security"),sx:e=>({marginBottom:e.space.$4}),textVariant:"h2"})}),(0,i.Y)(P.Z.Alert,{children:t.error}),r&&(0,i.Y)(rH,{}),o&&(0,i.Y)(rK,{}),s&&(0,i.Y)(rx,{}),(0,i.Y)(eZ,{}),u&&(0,i.Y)(e6,{})]})})}),rZ=(0,n.lazy)(()=>Promise.all([t.e("666"),t.e("207"),t.e("259")]).then(t.bind(t,1608)).then(e=>({default:e.BillingPage}))),rX=(0,n.lazy)(()=>Promise.all([t.e("666"),t.e("326"),t.e("817")]).then(t.bind(t,8201)).then(e=>({default:e.APIKeysPage}))),rQ=(0,n.lazy)(()=>Promise.all([t.e("666"),t.e("970"),t.e("110")]).then(t.bind(t,7437)).then(e=>({default:e.PlansPage}))),r0=(0,n.lazy)(()=>Promise.all([t.e("545"),t.e("666"),t.e("627")]).then(t.bind(t,1666)).then(e=>({default:e.StatementPage}))),r1=(0,n.lazy)(()=>Promise.all([t.e("545"),t.e("666"),t.e("122")]).then(t.bind(t,4856)).then(e=>({default:e.PaymentAttemptPage}))),r2=()=>{let{pages:e,shouldShowBilling:r,apiKeysProps:t}=(0,a.B)(),{apiKeysSettings:o,commerceSettings:s}=(0,Y.O)(),c=e.routes[0].id===l.j2.ACCOUNT,d=e.routes[0].id===l.j2.SECURITY,u=e.routes[0].id===l.j2.BILLING,h=e.routes[0].id===l.j2.API_KEYS,p=e.contents?.map((e,r)=>{let t=!c&&!d&&0===r;return(0,i.Y)(f.q,{index:t,path:t?void 0:e.url,children:(0,i.Y)(g.H,{mount:e.mount,unmount:e.unmount})},`custom-page-${e.url}`)});return(0,i.FD)(m.d,{children:[p,(0,i.FD)(f.q,{children:[(0,i.Y)(f.q,{path:c?void 0:"account",children:(0,i.Y)(m.d,{children:(0,i.Y)(f.q,{index:!0,children:(0,i.Y)(eN,{})})})}),(0,i.Y)(f.q,{path:d?void 0:"security",children:(0,i.Y)(m.d,{children:(0,i.Y)(f.q,{index:!0,children:(0,i.Y)(rV,{})})})}),s.billing.user.enabled&&r?(0,i.Y)(f.q,{path:u?void 0:"billing",children:(0,i.FD)(m.d,{children:[(0,i.Y)(f.q,{index:!0,children:(0,i.Y)(n.Suspense,{fallback:"",children:(0,i.Y)(rZ,{})})}),s.billing.user.hasPaidPlans?(0,i.Y)(f.q,{path:"plans",children:(0,i.Y)(n.Suspense,{fallback:"",children:(0,i.Y)(rQ,{})})}):null,(0,i.Y)(f.q,{path:"statement/:statementId",children:(0,i.Y)(n.Suspense,{fallback:"",children:(0,i.Y)(r0,{})})}),(0,i.Y)(f.q,{path:"payment-attempt/:paymentAttemptId",children:(0,i.Y)(n.Suspense,{fallback:"",children:(0,i.Y)(r1,{})})})]})}):null,o.user_api_keys_enabled&&!t?.hide&&(0,i.Y)(f.q,{path:h?void 0:"api-keys",children:(0,i.Y)(m.d,{children:(0,i.Y)(f.q,{index:!0,children:(0,i.Y)(n.Suspense,{fallback:"",children:(0,i.Y)(rX,{})})})})})]})]})};var r5=t(393);let r4=()=>(0,i.Y)(s.n.Root,{flow:"userProfile",children:(0,i.Y)(s.n.Part,{children:(0,i.FD)(m.d,{children:[(0,i.Y)(f.q,{path:"verify",children:(0,i.Y)(r5.G,{})}),(0,i.Y)(f.q,{children:(0,i.Y)(r3,{})})]})})}),r3=(0,o.G)(()=>{let e=n.useRef(null);return(0,i.Y)(h.a.Root,{children:(0,i.FD)(p,{contentRef:e,children:[(0,i.Y)(u.oT,{navbarTitleLocalizationKey:(0,c.G)("userProfile.navbar.title")}),(0,i.Y)(h.a.Content,{contentRef:e,scrollBoxId:l.AG,children:(0,i.Y)(r2,{})})]})})}),r6=(0,d.dm)(r4),r8=(0,d.dm)(r4),r7=e=>{let r={...e,routing:"virtual",componentName:"UserProfile",mode:"modal"};return(0,i.Y)(f.q,{path:"user",children:(0,i.Y)(a.M.Provider,{value:r,children:(0,i.Y)("div",{children:(0,i.Y)(r8,{...r})})})})}},9599:function(e,r,t){t.d(r,{g:()=>l});var i=t(1210),n=t(4964);let l=()=>{let{navigate:e}=(0,n.r)(),r=(0,i.ho)();return{navigateAfterSignOut:()=>e(r.buildAfterSignOutUrl()),navigateAfterMultiSessionSingleSignOutUrl:()=>e(r.buildAfterMultiSessionSingleSignOutUrl()),afterSignOutUrl:r.buildAfterSignOutUrl(),afterMultiSessionSingleSignOutUrl:r.buildAfterMultiSessionSingleSignOutUrl()}}}}]);
@@ -3,7 +3,7 @@ import { ClerkRuntimeError, isClerkAPIResponseError } from "@clerk/shared/error"
3
3
 
4
4
  //#region src/utils/web3CallbackErrorHandler.ts
5
5
  const web3CallbackErrorHandler = (err, setError) => {
6
- if (isClerkAPIResponseError(err) && err.errors[0].meta?.paramName === "identifier" && err.errors[0].code === "form_param_nil") return handleError(new ClerkRuntimeError("A Web3 Wallet extension cannot be found. Please install one to continue.", { code: "web3_missing_identifier" }), [], setError);
6
+ if (isClerkAPIResponseError(err) && err.errors?.[0]?.meta?.paramName === "identifier" && err.errors?.[0]?.code === "form_param_nil") return handleError(new ClerkRuntimeError("A Web3 Wallet extension cannot be found. Please install one to continue.", { code: "web3_missing_identifier" }), [], setError);
7
7
  return handleError(err, [], setError);
8
8
  };
9
9
 
@@ -1 +1 @@
1
- {"version":3,"file":"web3CallbackErrorHandler.js","names":["web3CallbackErrorHandler: Web3CallbackErrorHandler"],"sources":["../../src/utils/web3CallbackErrorHandler.ts"],"sourcesContent":["import { ClerkRuntimeError, isClerkAPIResponseError } from '@clerk/shared/error';\nimport type { ClerkAPIError, ClerkRuntimeError as ClerkRuntimeErrorType } from '@clerk/shared/types';\n\nimport { handleError } from './errorHandler';\n\ntype Web3CallbackErrorHandler = {\n (err: any, setError?: (err: ClerkRuntimeErrorType | ClerkAPIError | string | undefined) => void): void;\n};\n\nexport const web3CallbackErrorHandler: Web3CallbackErrorHandler = (err, setError) => {\n if (\n isClerkAPIResponseError(err) &&\n err.errors[0].meta?.paramName === 'identifier' &&\n err.errors[0].code === 'form_param_nil'\n ) {\n const error = new ClerkRuntimeError('A Web3 Wallet extension cannot be found. Please install one to continue.', {\n code: 'web3_missing_identifier',\n });\n\n return handleError(error, [], setError);\n }\n return handleError(err, [], setError);\n};\n"],"mappings":";;;;AASA,MAAaA,4BAAsD,KAAK,aAAa;AACnF,KACE,wBAAwB,IAAI,IAC5B,IAAI,OAAO,GAAG,MAAM,cAAc,gBAClC,IAAI,OAAO,GAAG,SAAS,iBAMvB,QAAO,YAJO,IAAI,kBAAkB,4EAA4E,EAC9G,MAAM,2BACP,CAAC,EAEwB,EAAE,EAAE,SAAS;AAEzC,QAAO,YAAY,KAAK,EAAE,EAAE,SAAS"}
1
+ {"version":3,"file":"web3CallbackErrorHandler.js","names":["web3CallbackErrorHandler: Web3CallbackErrorHandler"],"sources":["../../src/utils/web3CallbackErrorHandler.ts"],"sourcesContent":["import { ClerkRuntimeError, isClerkAPIResponseError } from '@clerk/shared/error';\nimport type { ClerkAPIError, ClerkRuntimeError as ClerkRuntimeErrorType } from '@clerk/shared/types';\n\nimport { handleError } from './errorHandler';\n\ntype Web3CallbackErrorHandler = {\n (err: any, setError?: (err: ClerkRuntimeErrorType | ClerkAPIError | string | undefined) => void): void;\n};\n\nexport const web3CallbackErrorHandler: Web3CallbackErrorHandler = (err, setError) => {\n if (\n isClerkAPIResponseError(err) &&\n err.errors?.[0]?.meta?.paramName === 'identifier' &&\n err.errors?.[0]?.code === 'form_param_nil'\n ) {\n const error = new ClerkRuntimeError('A Web3 Wallet extension cannot be found. Please install one to continue.', {\n code: 'web3_missing_identifier',\n });\n\n return handleError(error, [], setError);\n }\n return handleError(err, [], setError);\n};\n"],"mappings":";;;;AASA,MAAaA,4BAAsD,KAAK,aAAa;AACnF,KACE,wBAAwB,IAAI,IAC5B,IAAI,SAAS,IAAI,MAAM,cAAc,gBACrC,IAAI,SAAS,IAAI,SAAS,iBAM1B,QAAO,YAJO,IAAI,kBAAkB,4EAA4E,EAC9G,MAAM,2BACP,CAAC,EAEwB,EAAE,EAAE,SAAS;AAEzC,QAAO,YAAY,KAAK,EAAE,EAAE,SAAS"}