@volter/twin-clerk 0.1.0

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 (321) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +102 -0
  3. package/client/clerk-js-dist/167_clerk.headless_b86dff_5.127.2.js +1 -0
  4. package/client/clerk-js-dist/2172_clerk.browser_0cc2cc_5.127.2.js +1 -0
  5. package/client/clerk-js-dist/2172_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  6. package/client/clerk-js-dist/368_clerk.headless_b86dff_5.127.2.js +3 -0
  7. package/client/clerk-js-dist/377_clerk.headless_b86dff_5.127.2.js +1 -0
  8. package/client/clerk-js-dist/4170_clerk.browser_0cc2cc_5.127.2.js +1 -0
  9. package/client/clerk-js-dist/4170_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  10. package/client/clerk-js-dist/437_clerk.headless_b86dff_5.127.2.js +1 -0
  11. package/client/clerk-js-dist/5192_clerk.browser_0cc2cc_5.127.2.js +1 -0
  12. package/client/clerk-js-dist/5192_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  13. package/client/clerk-js-dist/553_clerk.headless_b86dff_5.127.2.js +1 -0
  14. package/client/clerk-js-dist/5645_clerk.browser_0cc2cc_5.127.2.js +1 -0
  15. package/client/clerk-js-dist/5645_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  16. package/client/clerk-js-dist/623_clerk.headless_b86dff_5.127.2.js +42 -0
  17. package/client/clerk-js-dist/7067_clerk.browser_0cc2cc_5.127.2.js +1 -0
  18. package/client/clerk-js-dist/7067_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  19. package/client/clerk-js-dist/7502_clerk.browser_0cc2cc_5.127.2.js +1 -0
  20. package/client/clerk-js-dist/7502_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  21. package/client/clerk-js-dist/785_clerk.headless.browser_540199_5.127.2.js +1 -0
  22. package/client/clerk-js-dist/785_clerk.headless_b86dff_5.127.2.js +1 -0
  23. package/client/clerk-js-dist/8043_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  24. package/client/clerk-js-dist/825_clerk.headless.browser_540199_5.127.2.js +1 -0
  25. package/client/clerk-js-dist/825_clerk.headless_b86dff_5.127.2.js +1 -0
  26. package/client/clerk-js-dist/890_clerk.headless_b86dff_5.127.2.js +2 -0
  27. package/client/clerk-js-dist/901_clerk.headless.browser_540199_5.127.2.js +1 -0
  28. package/client/clerk-js-dist/apiKeys_clerk.browser_0cc2cc_5.127.2.js +1 -0
  29. package/client/clerk-js-dist/apiKeys_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  30. package/client/clerk-js-dist/base-account-sdk_clerk.browser_0cc2cc_5.127.2.js +42 -0
  31. package/client/clerk-js-dist/base-account-sdk_clerk.headless.browser_540199_5.127.2.js +42 -0
  32. package/client/clerk-js-dist/base-account-sdk_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  33. package/client/clerk-js-dist/blankcaptcha_clerk.browser_0cc2cc_5.127.2.js +1 -0
  34. package/client/clerk-js-dist/blankcaptcha_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  35. package/client/clerk-js-dist/checkout_clerk.browser_0cc2cc_5.127.2.js +9 -0
  36. package/client/clerk-js-dist/checkout_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  37. package/client/clerk-js-dist/clerk.browser.js +19 -0
  38. package/client/clerk-js-dist/clerk.headless.browser.js +19 -0
  39. package/client/clerk-js-dist/clerk.headless.js +19 -0
  40. package/client/clerk-js-dist/clerk.js +809 -0
  41. package/client/clerk-js-dist/clerk.legacy.browser.js +1 -0
  42. package/client/clerk-js-dist/clerk.no-rhc.js +766 -0
  43. package/client/clerk-js-dist/coinbase-wallet-sdk_clerk.browser_0cc2cc_5.127.2.js +3 -0
  44. package/client/clerk-js-dist/coinbase-wallet-sdk_clerk.headless.browser_540199_5.127.2.js +3 -0
  45. package/client/clerk-js-dist/coinbase-wallet-sdk_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  46. package/client/clerk-js-dist/cookieSuffix_clerk.browser_0cc2cc_5.127.2.js +1 -0
  47. package/client/clerk-js-dist/cookieSuffix_clerk.headless.browser_540199_5.127.2.js +1 -0
  48. package/client/clerk-js-dist/cookieSuffix_clerk.headless_b86dff_5.127.2.js +1 -0
  49. package/client/clerk-js-dist/cookieSuffix_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  50. package/client/clerk-js-dist/copy-api-key-modal_clerk.browser_0cc2cc_5.127.2.js +1 -0
  51. package/client/clerk-js-dist/copy-api-key-modal_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  52. package/client/clerk-js-dist/createorganization_clerk.browser_0cc2cc_5.127.2.js +1 -0
  53. package/client/clerk-js-dist/createorganization_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  54. package/client/clerk-js-dist/enableOrganizationsPrompt_clerk.browser_0cc2cc_5.127.2.js +247 -0
  55. package/client/clerk-js-dist/enableOrganizationsPrompt_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  56. package/client/clerk-js-dist/framework_clerk.browser_0cc2cc_5.127.2.js +1 -0
  57. package/client/clerk-js-dist/framework_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  58. package/client/clerk-js-dist/impersonationfab_clerk.browser_0cc2cc_5.127.2.js +1 -0
  59. package/client/clerk-js-dist/impersonationfab_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  60. package/client/clerk-js-dist/keylessPrompt_clerk.browser_0cc2cc_5.127.2.js +228 -0
  61. package/client/clerk-js-dist/keylessPrompt_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  62. package/client/clerk-js-dist/oauthConsent_clerk.browser_0cc2cc_5.127.2.js +1 -0
  63. package/client/clerk-js-dist/oauthConsent_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  64. package/client/clerk-js-dist/onetap_clerk.browser_0cc2cc_5.127.2.js +1 -0
  65. package/client/clerk-js-dist/onetap_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  66. package/client/clerk-js-dist/op-api-keys-page_clerk.browser_0cc2cc_5.127.2.js +1 -0
  67. package/client/clerk-js-dist/op-api-keys-page_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  68. package/client/clerk-js-dist/op-billing-page_clerk.browser_0cc2cc_5.127.2.js +1 -0
  69. package/client/clerk-js-dist/op-billing-page_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  70. package/client/clerk-js-dist/op-plans-page_clerk.browser_0cc2cc_5.127.2.js +1 -0
  71. package/client/clerk-js-dist/op-plans-page_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  72. package/client/clerk-js-dist/organizationlist_clerk.browser_0cc2cc_5.127.2.js +1 -0
  73. package/client/clerk-js-dist/organizationlist_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  74. package/client/clerk-js-dist/organizationprofile_clerk.browser_0cc2cc_5.127.2.js +1 -0
  75. package/client/clerk-js-dist/organizationprofile_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  76. package/client/clerk-js-dist/organizationswitcher_clerk.browser_0cc2cc_5.127.2.js +1 -0
  77. package/client/clerk-js-dist/organizationswitcher_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  78. package/client/clerk-js-dist/payment-attempt-page_clerk.browser_0cc2cc_5.127.2.js +1 -0
  79. package/client/clerk-js-dist/payment-attempt-page_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  80. package/client/clerk-js-dist/planDetails_clerk.browser_0cc2cc_5.127.2.js +1 -0
  81. package/client/clerk-js-dist/planDetails_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  82. package/client/clerk-js-dist/prefetchorganizationlist_clerk.browser_0cc2cc_5.127.2.js +1 -0
  83. package/client/clerk-js-dist/prefetchorganizationlist_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  84. package/client/clerk-js-dist/pricingTable_clerk.browser_0cc2cc_5.127.2.js +1 -0
  85. package/client/clerk-js-dist/pricingTable_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  86. package/client/clerk-js-dist/query-core-vendors_clerk.browser_0cc2cc_5.127.2.js +1 -0
  87. package/client/clerk-js-dist/query-core-vendors_clerk.headless.browser_540199_5.127.2.js +1 -0
  88. package/client/clerk-js-dist/query-core-vendors_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  89. package/client/clerk-js-dist/revoke-api-key-modal_clerk.browser_0cc2cc_5.127.2.js +1 -0
  90. package/client/clerk-js-dist/revoke-api-key-modal_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  91. package/client/clerk-js-dist/sessionTasks_clerk.browser_0cc2cc_5.127.2.js +1 -0
  92. package/client/clerk-js-dist/sessionTasks_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  93. package/client/clerk-js-dist/signin_clerk.browser_0cc2cc_5.127.2.js +1 -0
  94. package/client/clerk-js-dist/signin_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  95. package/client/clerk-js-dist/signup_clerk.browser_0cc2cc_5.127.2.js +1 -0
  96. package/client/clerk-js-dist/signup_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  97. package/client/clerk-js-dist/statement-page_clerk.browser_0cc2cc_5.127.2.js +1 -0
  98. package/client/clerk-js-dist/statement-page_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  99. package/client/clerk-js-dist/stripe-vendors_clerk.browser_0cc2cc_5.127.2.js +1 -0
  100. package/client/clerk-js-dist/stripe-vendors_clerk.headless.browser_540199_5.127.2.js +1 -0
  101. package/client/clerk-js-dist/stripe-vendors_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  102. package/client/clerk-js-dist/subscriptionDetails_clerk.browser_0cc2cc_5.127.2.js +1 -0
  103. package/client/clerk-js-dist/subscriptionDetails_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  104. package/client/clerk-js-dist/taskChooseOrganization_clerk.browser_0cc2cc_5.127.2.js +1 -0
  105. package/client/clerk-js-dist/taskChooseOrganization_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  106. package/client/clerk-js-dist/taskResetPassword_clerk.browser_0cc2cc_5.127.2.js +1 -0
  107. package/client/clerk-js-dist/taskResetPassword_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  108. package/client/clerk-js-dist/taskSetupMFA_clerk.browser_0cc2cc_5.127.2.js +4 -0
  109. package/client/clerk-js-dist/taskSetupMFA_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  110. package/client/clerk-js-dist/ui-common_clerk.browser_0cc2cc_5.127.2.js +124 -0
  111. package/client/clerk-js-dist/ui-common_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  112. package/client/clerk-js-dist/up-api-keys-page_clerk.browser_0cc2cc_5.127.2.js +1 -0
  113. package/client/clerk-js-dist/up-api-keys-page_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  114. package/client/clerk-js-dist/up-billing-page_clerk.browser_0cc2cc_5.127.2.js +1 -0
  115. package/client/clerk-js-dist/up-billing-page_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  116. package/client/clerk-js-dist/up-plans-page_clerk.browser_0cc2cc_5.127.2.js +1 -0
  117. package/client/clerk-js-dist/up-plans-page_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  118. package/client/clerk-js-dist/useravatar_clerk.browser_0cc2cc_5.127.2.js +1 -0
  119. package/client/clerk-js-dist/useravatar_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  120. package/client/clerk-js-dist/userbutton_clerk.browser_0cc2cc_5.127.2.js +1 -0
  121. package/client/clerk-js-dist/userbutton_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  122. package/client/clerk-js-dist/userprofile_clerk.browser_0cc2cc_5.127.2.js +4 -0
  123. package/client/clerk-js-dist/userprofile_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  124. package/client/clerk-js-dist/userverification_clerk.browser_0cc2cc_5.127.2.js +1 -0
  125. package/client/clerk-js-dist/userverification_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  126. package/client/clerk-js-dist/vendors_clerk.browser_0cc2cc_5.127.2.js +20 -0
  127. package/client/clerk-js-dist/vendors_clerk.headless.browser_540199_5.127.2.js +1 -0
  128. package/client/clerk-js-dist/vendors_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  129. package/client/clerk-js-dist/waitlist_clerk.browser_0cc2cc_5.127.2.js +1 -0
  130. package/client/clerk-js-dist/waitlist_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  131. package/client/clerk-js-dist/web3-solana-wallet-buttons_clerk.browser_0cc2cc_5.127.2.js +143 -0
  132. package/client/clerk-js-dist/web3-solana-wallet-buttons_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  133. package/client/clerk-js-dist/zxcvbn-common_clerk.browser_0cc2cc_5.127.2.js +1 -0
  134. package/client/clerk-js-dist/zxcvbn-common_clerk.headless.browser_540199_5.127.2.js +1 -0
  135. package/client/clerk-js-dist/zxcvbn-common_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  136. package/client/clerk-js-dist/zxcvbn-ts-core_clerk.browser_0cc2cc_5.127.2.js +2 -0
  137. package/client/clerk-js-dist/zxcvbn-ts-core_clerk.headless.browser_540199_5.127.2.js +2 -0
  138. package/client/clerk-js-dist/zxcvbn-ts-core_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  139. package/client/clerk-mirror.css +72 -0
  140. package/client/clerk-mirror.tsx +204 -0
  141. package/client/clerk.browser.js +19 -0
  142. package/dist/client/clerk-js-dist/167_clerk.headless_b86dff_5.127.2.js +1 -0
  143. package/dist/client/clerk-js-dist/2172_clerk.browser_0cc2cc_5.127.2.js +1 -0
  144. package/dist/client/clerk-js-dist/2172_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  145. package/dist/client/clerk-js-dist/368_clerk.headless_b86dff_5.127.2.js +3 -0
  146. package/dist/client/clerk-js-dist/377_clerk.headless_b86dff_5.127.2.js +1 -0
  147. package/dist/client/clerk-js-dist/4170_clerk.browser_0cc2cc_5.127.2.js +1 -0
  148. package/dist/client/clerk-js-dist/4170_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  149. package/dist/client/clerk-js-dist/437_clerk.headless_b86dff_5.127.2.js +1 -0
  150. package/dist/client/clerk-js-dist/5192_clerk.browser_0cc2cc_5.127.2.js +1 -0
  151. package/dist/client/clerk-js-dist/5192_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  152. package/dist/client/clerk-js-dist/553_clerk.headless_b86dff_5.127.2.js +1 -0
  153. package/dist/client/clerk-js-dist/5645_clerk.browser_0cc2cc_5.127.2.js +1 -0
  154. package/dist/client/clerk-js-dist/5645_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  155. package/dist/client/clerk-js-dist/623_clerk.headless_b86dff_5.127.2.js +42 -0
  156. package/dist/client/clerk-js-dist/7067_clerk.browser_0cc2cc_5.127.2.js +1 -0
  157. package/dist/client/clerk-js-dist/7067_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  158. package/dist/client/clerk-js-dist/7502_clerk.browser_0cc2cc_5.127.2.js +1 -0
  159. package/dist/client/clerk-js-dist/7502_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  160. package/dist/client/clerk-js-dist/785_clerk.headless.browser_540199_5.127.2.js +1 -0
  161. package/dist/client/clerk-js-dist/785_clerk.headless_b86dff_5.127.2.js +1 -0
  162. package/dist/client/clerk-js-dist/8043_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  163. package/dist/client/clerk-js-dist/825_clerk.headless.browser_540199_5.127.2.js +1 -0
  164. package/dist/client/clerk-js-dist/825_clerk.headless_b86dff_5.127.2.js +1 -0
  165. package/dist/client/clerk-js-dist/890_clerk.headless_b86dff_5.127.2.js +2 -0
  166. package/dist/client/clerk-js-dist/901_clerk.headless.browser_540199_5.127.2.js +1 -0
  167. package/dist/client/clerk-js-dist/apiKeys_clerk.browser_0cc2cc_5.127.2.js +1 -0
  168. package/dist/client/clerk-js-dist/apiKeys_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  169. package/dist/client/clerk-js-dist/base-account-sdk_clerk.browser_0cc2cc_5.127.2.js +42 -0
  170. package/dist/client/clerk-js-dist/base-account-sdk_clerk.headless.browser_540199_5.127.2.js +42 -0
  171. package/dist/client/clerk-js-dist/base-account-sdk_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  172. package/dist/client/clerk-js-dist/blankcaptcha_clerk.browser_0cc2cc_5.127.2.js +1 -0
  173. package/dist/client/clerk-js-dist/blankcaptcha_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  174. package/dist/client/clerk-js-dist/checkout_clerk.browser_0cc2cc_5.127.2.js +9 -0
  175. package/dist/client/clerk-js-dist/checkout_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  176. package/dist/client/clerk-js-dist/clerk.browser.js +19 -0
  177. package/dist/client/clerk-js-dist/clerk.headless.browser.js +19 -0
  178. package/dist/client/clerk-js-dist/clerk.headless.js +19 -0
  179. package/dist/client/clerk-js-dist/clerk.js +809 -0
  180. package/dist/client/clerk-js-dist/clerk.legacy.browser.js +1 -0
  181. package/dist/client/clerk-js-dist/clerk.no-rhc.js +766 -0
  182. package/dist/client/clerk-js-dist/coinbase-wallet-sdk_clerk.browser_0cc2cc_5.127.2.js +3 -0
  183. package/dist/client/clerk-js-dist/coinbase-wallet-sdk_clerk.headless.browser_540199_5.127.2.js +3 -0
  184. package/dist/client/clerk-js-dist/coinbase-wallet-sdk_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  185. package/dist/client/clerk-js-dist/cookieSuffix_clerk.browser_0cc2cc_5.127.2.js +1 -0
  186. package/dist/client/clerk-js-dist/cookieSuffix_clerk.headless.browser_540199_5.127.2.js +1 -0
  187. package/dist/client/clerk-js-dist/cookieSuffix_clerk.headless_b86dff_5.127.2.js +1 -0
  188. package/dist/client/clerk-js-dist/cookieSuffix_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  189. package/dist/client/clerk-js-dist/copy-api-key-modal_clerk.browser_0cc2cc_5.127.2.js +1 -0
  190. package/dist/client/clerk-js-dist/copy-api-key-modal_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  191. package/dist/client/clerk-js-dist/createorganization_clerk.browser_0cc2cc_5.127.2.js +1 -0
  192. package/dist/client/clerk-js-dist/createorganization_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  193. package/dist/client/clerk-js-dist/enableOrganizationsPrompt_clerk.browser_0cc2cc_5.127.2.js +247 -0
  194. package/dist/client/clerk-js-dist/enableOrganizationsPrompt_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  195. package/dist/client/clerk-js-dist/framework_clerk.browser_0cc2cc_5.127.2.js +1 -0
  196. package/dist/client/clerk-js-dist/framework_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  197. package/dist/client/clerk-js-dist/impersonationfab_clerk.browser_0cc2cc_5.127.2.js +1 -0
  198. package/dist/client/clerk-js-dist/impersonationfab_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  199. package/dist/client/clerk-js-dist/keylessPrompt_clerk.browser_0cc2cc_5.127.2.js +228 -0
  200. package/dist/client/clerk-js-dist/keylessPrompt_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  201. package/dist/client/clerk-js-dist/oauthConsent_clerk.browser_0cc2cc_5.127.2.js +1 -0
  202. package/dist/client/clerk-js-dist/oauthConsent_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  203. package/dist/client/clerk-js-dist/onetap_clerk.browser_0cc2cc_5.127.2.js +1 -0
  204. package/dist/client/clerk-js-dist/onetap_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  205. package/dist/client/clerk-js-dist/op-api-keys-page_clerk.browser_0cc2cc_5.127.2.js +1 -0
  206. package/dist/client/clerk-js-dist/op-api-keys-page_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  207. package/dist/client/clerk-js-dist/op-billing-page_clerk.browser_0cc2cc_5.127.2.js +1 -0
  208. package/dist/client/clerk-js-dist/op-billing-page_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  209. package/dist/client/clerk-js-dist/op-plans-page_clerk.browser_0cc2cc_5.127.2.js +1 -0
  210. package/dist/client/clerk-js-dist/op-plans-page_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  211. package/dist/client/clerk-js-dist/organizationlist_clerk.browser_0cc2cc_5.127.2.js +1 -0
  212. package/dist/client/clerk-js-dist/organizationlist_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  213. package/dist/client/clerk-js-dist/organizationprofile_clerk.browser_0cc2cc_5.127.2.js +1 -0
  214. package/dist/client/clerk-js-dist/organizationprofile_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  215. package/dist/client/clerk-js-dist/organizationswitcher_clerk.browser_0cc2cc_5.127.2.js +1 -0
  216. package/dist/client/clerk-js-dist/organizationswitcher_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  217. package/dist/client/clerk-js-dist/payment-attempt-page_clerk.browser_0cc2cc_5.127.2.js +1 -0
  218. package/dist/client/clerk-js-dist/payment-attempt-page_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  219. package/dist/client/clerk-js-dist/planDetails_clerk.browser_0cc2cc_5.127.2.js +1 -0
  220. package/dist/client/clerk-js-dist/planDetails_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  221. package/dist/client/clerk-js-dist/prefetchorganizationlist_clerk.browser_0cc2cc_5.127.2.js +1 -0
  222. package/dist/client/clerk-js-dist/prefetchorganizationlist_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  223. package/dist/client/clerk-js-dist/pricingTable_clerk.browser_0cc2cc_5.127.2.js +1 -0
  224. package/dist/client/clerk-js-dist/pricingTable_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  225. package/dist/client/clerk-js-dist/query-core-vendors_clerk.browser_0cc2cc_5.127.2.js +1 -0
  226. package/dist/client/clerk-js-dist/query-core-vendors_clerk.headless.browser_540199_5.127.2.js +1 -0
  227. package/dist/client/clerk-js-dist/query-core-vendors_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  228. package/dist/client/clerk-js-dist/revoke-api-key-modal_clerk.browser_0cc2cc_5.127.2.js +1 -0
  229. package/dist/client/clerk-js-dist/revoke-api-key-modal_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  230. package/dist/client/clerk-js-dist/sessionTasks_clerk.browser_0cc2cc_5.127.2.js +1 -0
  231. package/dist/client/clerk-js-dist/sessionTasks_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  232. package/dist/client/clerk-js-dist/signin_clerk.browser_0cc2cc_5.127.2.js +1 -0
  233. package/dist/client/clerk-js-dist/signin_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  234. package/dist/client/clerk-js-dist/signup_clerk.browser_0cc2cc_5.127.2.js +1 -0
  235. package/dist/client/clerk-js-dist/signup_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  236. package/dist/client/clerk-js-dist/statement-page_clerk.browser_0cc2cc_5.127.2.js +1 -0
  237. package/dist/client/clerk-js-dist/statement-page_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  238. package/dist/client/clerk-js-dist/stripe-vendors_clerk.browser_0cc2cc_5.127.2.js +1 -0
  239. package/dist/client/clerk-js-dist/stripe-vendors_clerk.headless.browser_540199_5.127.2.js +1 -0
  240. package/dist/client/clerk-js-dist/stripe-vendors_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  241. package/dist/client/clerk-js-dist/subscriptionDetails_clerk.browser_0cc2cc_5.127.2.js +1 -0
  242. package/dist/client/clerk-js-dist/subscriptionDetails_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  243. package/dist/client/clerk-js-dist/taskChooseOrganization_clerk.browser_0cc2cc_5.127.2.js +1 -0
  244. package/dist/client/clerk-js-dist/taskChooseOrganization_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  245. package/dist/client/clerk-js-dist/taskResetPassword_clerk.browser_0cc2cc_5.127.2.js +1 -0
  246. package/dist/client/clerk-js-dist/taskResetPassword_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  247. package/dist/client/clerk-js-dist/taskSetupMFA_clerk.browser_0cc2cc_5.127.2.js +4 -0
  248. package/dist/client/clerk-js-dist/taskSetupMFA_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  249. package/dist/client/clerk-js-dist/ui-common_clerk.browser_0cc2cc_5.127.2.js +124 -0
  250. package/dist/client/clerk-js-dist/ui-common_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  251. package/dist/client/clerk-js-dist/up-api-keys-page_clerk.browser_0cc2cc_5.127.2.js +1 -0
  252. package/dist/client/clerk-js-dist/up-api-keys-page_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  253. package/dist/client/clerk-js-dist/up-billing-page_clerk.browser_0cc2cc_5.127.2.js +1 -0
  254. package/dist/client/clerk-js-dist/up-billing-page_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  255. package/dist/client/clerk-js-dist/up-plans-page_clerk.browser_0cc2cc_5.127.2.js +1 -0
  256. package/dist/client/clerk-js-dist/up-plans-page_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  257. package/dist/client/clerk-js-dist/useravatar_clerk.browser_0cc2cc_5.127.2.js +1 -0
  258. package/dist/client/clerk-js-dist/useravatar_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  259. package/dist/client/clerk-js-dist/userbutton_clerk.browser_0cc2cc_5.127.2.js +1 -0
  260. package/dist/client/clerk-js-dist/userbutton_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  261. package/dist/client/clerk-js-dist/userprofile_clerk.browser_0cc2cc_5.127.2.js +4 -0
  262. package/dist/client/clerk-js-dist/userprofile_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  263. package/dist/client/clerk-js-dist/userverification_clerk.browser_0cc2cc_5.127.2.js +1 -0
  264. package/dist/client/clerk-js-dist/userverification_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  265. package/dist/client/clerk-js-dist/vendors_clerk.browser_0cc2cc_5.127.2.js +20 -0
  266. package/dist/client/clerk-js-dist/vendors_clerk.headless.browser_540199_5.127.2.js +1 -0
  267. package/dist/client/clerk-js-dist/vendors_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  268. package/dist/client/clerk-js-dist/waitlist_clerk.browser_0cc2cc_5.127.2.js +1 -0
  269. package/dist/client/clerk-js-dist/waitlist_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  270. package/dist/client/clerk-js-dist/web3-solana-wallet-buttons_clerk.browser_0cc2cc_5.127.2.js +143 -0
  271. package/dist/client/clerk-js-dist/web3-solana-wallet-buttons_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  272. package/dist/client/clerk-js-dist/zxcvbn-common_clerk.browser_0cc2cc_5.127.2.js +1 -0
  273. package/dist/client/clerk-js-dist/zxcvbn-common_clerk.headless.browser_540199_5.127.2.js +1 -0
  274. package/dist/client/clerk-js-dist/zxcvbn-common_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  275. package/dist/client/clerk-js-dist/zxcvbn-ts-core_clerk.browser_0cc2cc_5.127.2.js +2 -0
  276. package/dist/client/clerk-js-dist/zxcvbn-ts-core_clerk.headless.browser_540199_5.127.2.js +2 -0
  277. package/dist/client/clerk-js-dist/zxcvbn-ts-core_clerk.legacy.browser_6070dd_5.127.2.js +1 -0
  278. package/dist/client/clerk-mirror.bundle.js +321 -0
  279. package/dist/client/clerk-mirror.css +72 -0
  280. package/dist/client/clerk-mirror.d.ts +33 -0
  281. package/dist/client/clerk-mirror.js +143 -0
  282. package/dist/client/clerk-mirror.tsx +204 -0
  283. package/dist/client/clerk.browser.js +19 -0
  284. package/dist/src/clerk-capabilities.d.ts +4 -0
  285. package/dist/src/clerk-capabilities.js +1132 -0
  286. package/dist/src/clerk-conformance.d.ts +32 -0
  287. package/dist/src/clerk-conformance.js +158 -0
  288. package/dist/src/clerk-connector.d.ts +170 -0
  289. package/dist/src/clerk-connector.js +223 -0
  290. package/dist/src/clerk-events.d.ts +55 -0
  291. package/dist/src/clerk-events.js +146 -0
  292. package/dist/src/clerk-fapi.d.ts +19 -0
  293. package/dist/src/clerk-fapi.js +665 -0
  294. package/dist/src/clerk-jwt.d.ts +109 -0
  295. package/dist/src/clerk-jwt.js +230 -0
  296. package/dist/src/clerk-mirror-ui.d.ts +34 -0
  297. package/dist/src/clerk-mirror-ui.js +160 -0
  298. package/dist/src/clerk-server.d.ts +35 -0
  299. package/dist/src/clerk-server.js +172 -0
  300. package/dist/src/clerk-twin.d.ts +28 -0
  301. package/dist/src/clerk-twin.js +1658 -0
  302. package/dist/src/cli.d.ts +2 -0
  303. package/dist/src/cli.js +35 -0
  304. package/dist/src/index.d.ts +12 -0
  305. package/dist/src/index.js +56 -0
  306. package/dist/test-fixtures/clerk-openapi-operations.SOURCE.md +16 -0
  307. package/dist/test-fixtures/clerk-openapi-operations.json +1989 -0
  308. package/package.json +76 -0
  309. package/src/clerk-capabilities.ts +1246 -0
  310. package/src/clerk-conformance.ts +172 -0
  311. package/src/clerk-connector.ts +268 -0
  312. package/src/clerk-events.ts +166 -0
  313. package/src/clerk-fapi.ts +673 -0
  314. package/src/clerk-jwt.ts +256 -0
  315. package/src/clerk-mirror-ui.ts +165 -0
  316. package/src/clerk-server.ts +175 -0
  317. package/src/clerk-twin.ts +1580 -0
  318. package/src/cli.ts +33 -0
  319. package/src/index.ts +94 -0
  320. package/test-fixtures/clerk-openapi-operations.SOURCE.md +16 -0
  321. package/test-fixtures/clerk-openapi-operations.json +1989 -0
@@ -0,0 +1 @@
1
+ "use strict";(globalThis.webpackChunk_clerk_clerk_js=globalThis.webpackChunk_clerk_clerk_js||[]).push([["2809"],{38595:function(e,t,l){l.r(t),l.d(t,{APIKeysPage:()=>h});var r=l(73312),o=l(61869),a=l(11576),i=l(64204),s=l(92654),c=l(15579),n=l(84808);let h=()=>{let{user:e}=(0,o.aF)(),{contentRef:t}=(0,c.jh)(),{apiKeysProps:l}=(0,a.useUserProfileContext)();return e?(0,r.BX)(i.Col,{gap:4,elementDescriptor:i.descriptors.page,children:[(0,r.tZ)(s.h.Root,{children:(0,r.tZ)(s.h.Title,{localizationKey:(0,i.localizationKeys)("userProfile.apiKeysPage.title"),textVariant:"h2"})}),(0,r.tZ)(a.APIKeysContext.Provider,{value:{componentName:"APIKeys",...l},children:(0,r.tZ)(n.APIKeysPage,{subject:e.id,revokeModalRoot:t})})]}):null}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(globalThis.webpackChunk_clerk_clerk_js=globalThis.webpackChunk_clerk_clerk_js||[]).push([["2809"],{38595:function(e,t,l){l.r(t),l.d(t,{APIKeysPage:()=>h});var r=l(73312),o=l(61869),a=l(11576),i=l(64204),s=l(92654),c=l(15579),n=l(84808);let h=()=>{let{user:e}=(0,o.aF)(),{contentRef:t}=(0,c.jh)(),{apiKeysProps:l}=(0,a.useUserProfileContext)();return e?(0,r.BX)(i.Col,{gap:4,elementDescriptor:i.descriptors.page,children:[(0,r.tZ)(s.h.Root,{children:(0,r.tZ)(s.h.Title,{localizationKey:(0,i.localizationKeys)("userProfile.apiKeysPage.title"),textVariant:"h2"})}),(0,r.tZ)(a.APIKeysContext.Provider,{value:{componentName:"APIKeys",...l},children:(0,r.tZ)(n.APIKeysPage,{subject:e.id,revokeModalRoot:t})})]}):null}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(globalThis.webpackChunk_clerk_clerk_js=globalThis.webpackChunk_clerk_clerk_js||[]).push([["82"],{41470:function(e,i,t){t.r(i),t.d(i,{BillingPage:()=>_});var l=t(73312),r=t(92418),s=t(2672),a=t(92654),n=t(36148),o=t(11576),c=t(64204),b=t(93746),g=t(12264),u=t(11061),p=t(15515),d=t(91800);let h={0:"subscriptions",1:"statements",2:"payments"},P=(0,s.withCardStateProvider)(()=>{let e=(0,s.useCardState)(),{selectedTab:i,handleTabChange:t}=(0,b.x)(h);return(0,l.tZ)(c.Col,{elementDescriptor:c.descriptors.page,sx:e=>({gap:e.space.$8,color:e.colors.$colorForeground}),children:(0,l.BX)(c.Col,{elementDescriptor:c.descriptors.profilePage,elementId:c.descriptors.profilePage.setId("billing"),gap:4,children:[(0,l.tZ)(a.h.Root,{children:(0,l.tZ)(a.h.Title,{localizationKey:(0,c.localizationKeys)("userProfile.billingPage.title"),textVariant:"h2"})}),(0,l.tZ)(r.Z.Alert,{children:e.error}),(0,l.BX)(n.mQ,{value:i,onChange:t,children:[(0,l.BX)(n.dr,{sx:e=>({gap:e.space.$6}),children:[(0,l.tZ)(n.OK,{localizationKey:(0,c.localizationKeys)("userProfile.billingPage.start.headerTitle__subscriptions")}),(0,l.tZ)(n.OK,{localizationKey:(0,c.localizationKeys)("userProfile.billingPage.start.headerTitle__statements")}),(0,l.tZ)(n.OK,{localizationKey:(0,c.localizationKeys)("userProfile.billingPage.start.headerTitle__payments")})]}),(0,l.BX)(n.nP,{children:[(0,l.BX)(n.x4,{sx:e=>({width:"100%",flexDirection:"column"}),children:[(0,l.tZ)(d.b,{title:(0,c.localizationKeys)("userProfile.billingPage.subscriptionsListSection.title"),switchPlansLabel:(0,c.localizationKeys)("userProfile.billingPage.subscriptionsListSection.actionLabel__switchPlan"),newSubscriptionLabel:(0,c.localizationKeys)("userProfile.billingPage.subscriptionsListSection.actionLabel__newSubscription"),manageSubscriptionLabel:(0,c.localizationKeys)("userProfile.billingPage.subscriptionsListSection.actionLabel__manageSubscription")}),(0,l.tZ)(u.A6,{})]}),(0,l.tZ)(n.x4,{sx:{width:"100%"},children:(0,l.tZ)(p.StatementsList,{})}),(0,l.tZ)(n.x4,{sx:{width:"100%"},children:(0,l.tZ)(g.PaymentAttemptsList,{})})]})]})]})})}),_=()=>(0,l.tZ)(o.SubscriberTypeContext.Provider,{value:"user",children:(0,l.tZ)(P,{})})}}]);
@@ -0,0 +1 @@
1
+ "use strict";(globalThis.webpackChunk_clerk_clerk_js=globalThis.webpackChunk_clerk_clerk_js||[]).push([["82"],{41470:function(e,i,t){t.r(i),t.d(i,{BillingPage:()=>_});var l=t(73312),r=t(92418),s=t(2672),a=t(92654),n=t(36148),o=t(11576),c=t(64204),b=t(93746),g=t(12264),u=t(11061),p=t(15515),d=t(91800);let h={0:"subscriptions",1:"statements",2:"payments"},P=(0,s.withCardStateProvider)(()=>{let e=(0,s.useCardState)(),{selectedTab:i,handleTabChange:t}=(0,b.x)(h);return(0,l.tZ)(c.Col,{elementDescriptor:c.descriptors.page,sx:e=>({gap:e.space.$8,color:e.colors.$colorForeground}),children:(0,l.BX)(c.Col,{elementDescriptor:c.descriptors.profilePage,elementId:c.descriptors.profilePage.setId("billing"),gap:4,children:[(0,l.tZ)(a.h.Root,{children:(0,l.tZ)(a.h.Title,{localizationKey:(0,c.localizationKeys)("userProfile.billingPage.title"),textVariant:"h2"})}),(0,l.tZ)(r.Z.Alert,{children:e.error}),(0,l.BX)(n.mQ,{value:i,onChange:t,children:[(0,l.BX)(n.dr,{sx:e=>({gap:e.space.$6}),children:[(0,l.tZ)(n.OK,{localizationKey:(0,c.localizationKeys)("userProfile.billingPage.start.headerTitle__subscriptions")}),(0,l.tZ)(n.OK,{localizationKey:(0,c.localizationKeys)("userProfile.billingPage.start.headerTitle__statements")}),(0,l.tZ)(n.OK,{localizationKey:(0,c.localizationKeys)("userProfile.billingPage.start.headerTitle__payments")})]}),(0,l.BX)(n.nP,{children:[(0,l.BX)(n.x4,{sx:e=>({width:"100%",flexDirection:"column"}),children:[(0,l.tZ)(d.b,{title:(0,c.localizationKeys)("userProfile.billingPage.subscriptionsListSection.title"),switchPlansLabel:(0,c.localizationKeys)("userProfile.billingPage.subscriptionsListSection.actionLabel__switchPlan"),newSubscriptionLabel:(0,c.localizationKeys)("userProfile.billingPage.subscriptionsListSection.actionLabel__newSubscription"),manageSubscriptionLabel:(0,c.localizationKeys)("userProfile.billingPage.subscriptionsListSection.actionLabel__manageSubscription")}),(0,l.tZ)(u.A6,{})]}),(0,l.tZ)(n.x4,{sx:{width:"100%"},children:(0,l.tZ)(p.StatementsList,{})}),(0,l.tZ)(n.x4,{sx:{width:"100%"},children:(0,l.tZ)(g.PaymentAttemptsList,{})})]})]})]})})}),_=()=>(0,l.tZ)(o.SubscriberTypeContext.Provider,{value:"user",children:(0,l.tZ)(P,{})})}}]);
@@ -0,0 +1 @@
1
+ "use strict";(globalThis.webpackChunk_clerk_clerk_js=globalThis.webpackChunk_clerk_clerk_js||[]).push([["99"],{83487:function(e,r,o){o.r(r),o.d(r,{PlansPage:()=>d});var t=o(73312),l=o(92654),a=o(11576),i=o(17703),n=o(24676),c=o(24718);let s=()=>{let{navigate:e}=(0,n.useRouter)();return(0,t.BX)(t.HY,{children:[(0,t.tZ)(l.h.Root,{sx:e=>({borderBottomWidth:e.borderWidths.$normal,borderBottomStyle:e.borderStyles.$solid,borderBottomColor:e.colors.$borderAlpha100,marginBlockEnd:e.space.$4,paddingBlockEnd:e.space.$4}),children:(0,t.tZ)(l.h.BackLink,{onClick:()=>void e("../",{searchParams:new URLSearchParams("tab=subscriptions")}),children:(0,t.tZ)(l.h.Title,{localizationKey:(0,i.u1)("userProfile.plansPage.title"),textVariant:"h2"})})}),(0,t.tZ)(a.PricingTableContext.Provider,{value:{componentName:"PricingTable",mode:"modal"},children:(0,t.tZ)(c.b,{})})]})},d=()=>(0,t.tZ)(a.SubscriberTypeContext.Provider,{value:"user",children:(0,t.tZ)(s,{})})}}]);
@@ -0,0 +1 @@
1
+ "use strict";(globalThis.webpackChunk_clerk_clerk_js=globalThis.webpackChunk_clerk_clerk_js||[]).push([["99"],{83487:function(e,r,o){o.r(r),o.d(r,{PlansPage:()=>d}),o(45261),o(70957),o(24551),o(22349),o(65223);var t=o(73312),l=o(92654),a=o(11576),i=o(17703),n=o(24676),c=o(24718);let s=()=>{let{navigate:e}=(0,n.useRouter)();return(0,t.BX)(t.HY,{children:[(0,t.tZ)(l.h.Root,{sx:e=>({borderBottomWidth:e.borderWidths.$normal,borderBottomStyle:e.borderStyles.$solid,borderBottomColor:e.colors.$borderAlpha100,marginBlockEnd:e.space.$4,paddingBlockEnd:e.space.$4}),children:(0,t.tZ)(l.h.BackLink,{onClick:()=>void e("../",{searchParams:new URLSearchParams("tab=subscriptions")}),children:(0,t.tZ)(l.h.Title,{localizationKey:(0,i.u1)("userProfile.plansPage.title"),textVariant:"h2"})})}),(0,t.tZ)(a.PricingTableContext.Provider,{value:{componentName:"PricingTable",mode:"modal"},children:(0,t.tZ)(c.b,{})})]})},d=()=>(0,t.tZ)(a.SubscriberTypeContext.Provider,{value:"user",children:(0,t.tZ)(s,{})})}}]);
@@ -0,0 +1 @@
1
+ "use strict";(globalThis.webpackChunk_clerk_clerk_js=globalThis.webpackChunk_clerk_clerk_js||[]).push([["4283"],{28128:function(e,r,s){s.r(r),s.d(r,{UserAvatar:()=>u,_UserAvatar:()=>c});var t=s(73312),a=s(61869),o=s(11576),i=s(64204),l=s(5472),n=s(51217);let c=e=>{let r=(0,o.useUserAvatarContext)(),{user:s}=(0,a.aF)();return(0,t.tZ)(n.InternalThemeProvider,{children:(0,t.tZ)(l.Y,{boxElementDescriptor:i.descriptors.userAvatarBox,imageElementDescriptor:i.descriptors.userAvatarImage,...s,rounded:e.rounded??r.rounded??!0,size:e=>e.sizes.$7})})},u=(0,o.withCoreUserGuard)(c)}}]);
@@ -0,0 +1 @@
1
+ "use strict";(globalThis.webpackChunk_clerk_clerk_js=globalThis.webpackChunk_clerk_clerk_js||[]).push([["4283"],{28128:function(e,r,s){s.r(r),s.d(r,{UserAvatar:()=>c,_UserAvatar:()=>i});var t=s(73312),a=s(61869),l=s(11576),n=s(64204),o=s(5472),u=s(51217);let i=e=>{var r,s;let i=(0,l.useUserAvatarContext)(),{user:c}=(0,a.aF)();return(0,t.tZ)(u.InternalThemeProvider,{children:(0,t.tZ)(o.Y,{boxElementDescriptor:n.descriptors.userAvatarBox,imageElementDescriptor:n.descriptors.userAvatarImage,...c,rounded:null==(s=null!=(r=e.rounded)?r:i.rounded)||s,size:e=>e.sizes.$7})})},c=(0,l.withCoreUserGuard)(i)}}]);
@@ -0,0 +1 @@
1
+ "use strict";(globalThis.webpackChunk_clerk_clerk_js=globalThis.webpackChunk_clerk_clerk_js||[]).push([["2270"],{49327:function(e,t,o){o.d(t,{fB:()=>p,gW:()=>m,uj:()=>B});var n=o(73312),r=o(42305),s=o(48774),i=o(97295),c=o(24676),l=o(31673),u=o(11576),d=o(64204),a=o(34174);let p=e=>{let{navigate:t}=(0,c.useRouter)(),{handleManageAccountClicked:o,handleSignOutSessionClicked:s,handleUserProfileActionClicked:i,session:a}=e,{menutItems:p}=(0,u.useUserButtonContext)(),B=e=>({borderTopWidth:e.borderWidths.$normal,borderTopStyle:e.borderStyles.$solid,borderTopColor:e.colors.$borderAlpha100,padding:`${e.space.$4} ${e.space.$5}`}),m=async n=>n?.path?(await t(n.path),e?.completedCallback()):n.id===l.Zb.MANAGE_ACCOUNT?await o():n?.open?i(n.open):(n.onClick?.(),e?.completedCallback());return(0,n.tZ)(r.eX,{role:"menu",elementDescriptor:d.descriptors.userButtonPopoverActions,elementId:d.descriptors.userButtonPopoverActions.setId("singleSession"),sx:e=>({borderTopWidth:e.borderWidths.$normal,borderTopStyle:e.borderStyles.$solid,borderTopColor:e.colors.$borderAlpha100}),children:p?.map(e=>{let t;return t=Object.values(l.Zb).includes(e.id)?{elementDescriptor:d.descriptors.userButtonPopoverActionButton,elementId:d.descriptors.userButtonPopoverActionButton.setId(e.id),iconBoxElementDescriptor:d.descriptors.userButtonPopoverActionButtonIconBox,iconBoxElementId:d.descriptors.userButtonPopoverActionButtonIconBox.setId(e.id),iconElementDescriptor:d.descriptors.userButtonPopoverActionButtonIcon,iconElementId:d.descriptors.userButtonPopoverActionButtonIcon.setId(e.id)}:{elementDescriptor:d.descriptors.userButtonPopoverCustomItemButton,elementId:d.descriptors.userButtonPopoverCustomItemButton.setId(e.id),iconBoxElementDescriptor:d.descriptors.userButtonPopoverCustomItemButtonIconBox,iconBoxElementId:d.descriptors.userButtonPopoverCustomItemButtonIconBox.setId(e.id),iconElementDescriptor:d.descriptors.userButtonPopoverActionItemButtonIcon,iconElementId:d.descriptors.userButtonPopoverActionItemButtonIcon.setId(e.id)},(0,n.tZ)(r.aU,{...t,icon:e.icon,label:e.name,onClick:e.id===l.Zb.SIGN_OUT?s(a):()=>m(e),sx:B,iconSx:e=>({width:e.sizes.$4,height:e.sizes.$4})},e.id)})})},B=e=>{let{navigate:t}=(0,c.useRouter)(),{handleManageAccountClicked:o,handleSignOutSessionClicked:p,handleSessionClicked:B,handleAddAccountClicked:m,handleUserProfileActionClicked:I,session:v,otherSessions:A}=e,{menutItems:h}=(0,u.useUserButtonContext)(),g=async n=>n?.path?(await t(n.path),e?.completedCallback()):n.id===l.Zb.MANAGE_ACCOUNT?await o():n?.open?I(n.open):(n.onClick?.(),e?.completedCallback()),C=h.every(e=>Object.values(l.Zb).includes(e.id));return(0,n.BX)(n.HY,{children:[C?(0,n.tZ)(r.r5,{role:"menu",elementDescriptor:d.descriptors.userButtonPopoverActions,elementId:d.descriptors.userButtonPopoverActions.setId("multiSession"),children:(0,n.BX)(d.Flex,{justify:"between",sx:e=>({marginLeft:e.space.$12,padding:`0 ${e.space.$5} ${e.space.$4}`,gap:e.space.$2}),children:[(0,n.tZ)(r.U8,{elementDescriptor:d.descriptors.userButtonPopoverActionButton,elementId:d.descriptors.userButtonPopoverActionButton.setId("manageAccount"),iconBoxElementDescriptor:d.descriptors.userButtonPopoverActionButtonIconBox,iconBoxElementId:d.descriptors.userButtonPopoverActionButtonIconBox.setId("manageAccount"),iconElementDescriptor:d.descriptors.userButtonPopoverActionButtonIcon,iconElementId:d.descriptors.userButtonPopoverActionButtonIcon.setId("manageAccount"),icon:a.tc,label:(0,d.localizationKeys)("userButton.action__manageAccount"),onClick:o,focusRing:!0}),(0,n.tZ)(r.U8,{elementDescriptor:d.descriptors.userButtonPopoverActionButton,elementId:d.descriptors.userButtonPopoverActionButton.setId("signOut"),iconBoxElementDescriptor:d.descriptors.userButtonPopoverActionButtonIconBox,iconBoxElementId:d.descriptors.userButtonPopoverActionButtonIconBox.setId("signOut"),iconElementDescriptor:d.descriptors.userButtonPopoverActionButtonIcon,iconElementId:d.descriptors.userButtonPopoverActionButtonIcon.setId("signOut"),icon:a.lv,label:(0,d.localizationKeys)("userButton.action__signOut"),onClick:p(v),focusRing:!0})]})}):(0,n.tZ)(r.r5,{role:"menu",elementDescriptor:d.descriptors.userButtonPopoverActions,elementId:d.descriptors.userButtonPopoverActions.setId("multiSession"),sx:e=>({gap:e.space.$1,paddingBottom:e.space.$2}),children:h?.map(e=>{let t;return t=Object.values(l.Zb).includes(e.id)?{elementDescriptor:d.descriptors.userButtonPopoverActionButton,elementId:d.descriptors.userButtonPopoverActionButton.setId(e.id),iconBoxElementDescriptor:d.descriptors.userButtonPopoverActionButtonIconBox,iconBoxElementId:d.descriptors.userButtonPopoverActionButtonIconBox.setId(e.id),iconElementDescriptor:d.descriptors.userButtonPopoverActionButtonIcon,iconElementId:d.descriptors.userButtonPopoverActionButtonIcon.setId(e.id)}:{elementDescriptor:d.descriptors.userButtonPopoverCustomItemButton,elementId:d.descriptors.userButtonPopoverCustomItemButton.setId(e.id),iconBoxElementDescriptor:d.descriptors.userButtonPopoverCustomItemButtonIconBox,iconBoxElementId:d.descriptors.userButtonPopoverCustomItemButtonIconBox.setId(e.id),iconElementDescriptor:d.descriptors.userButtonPopoverActionItemButtonIcon,iconElementId:d.descriptors.userButtonPopoverActionItemButtonIcon.setId(e.id)},(0,n.tZ)(r.aU,{...t,icon:e.icon,label:e.name,onClick:e.id===l.Zb.SIGN_OUT?p(v):()=>g(e),sx:e=>({border:0,padding:`${e.space.$2} ${e.space.$5}`,gap:e.space.$3x5}),iconSx:e=>({width:e.sizes.$4,height:e.sizes.$4}),iconBoxSx:e=>({minHeight:e.sizes.$4,minWidth:e.sizes.$4,alignItems:"center"})},e.id)})}),(0,n.BX)(r.eX,{role:"menu",sx:e=>({borderTopStyle:e.borderStyles.$solid,borderTopWidth:e.borderWidths.$normal,borderTopColor:e.colors.$borderAlpha100}),children:[A.map(e=>(0,n.tZ)(s.K,{icon:a.nR,onClick:B(e),role:"menuitem",children:(0,n.tZ)(i.E,{user:e.user})},e.id)),(0,n.tZ)(r.aU,{elementDescriptor:d.descriptors.userButtonPopoverActionButton,elementId:d.descriptors.userButtonPopoverActionButton.setId("addAccount"),iconBoxElementDescriptor:d.descriptors.userButtonPopoverActionButtonIconBox,iconBoxElementId:d.descriptors.userButtonPopoverActionButtonIconBox.setId("addAccount"),iconElementDescriptor:d.descriptors.userButtonPopoverActionButtonIcon,iconElementId:d.descriptors.userButtonPopoverActionButtonIcon.setId("addAccount"),icon:a.mm,label:(0,d.localizationKeys)("userButton.action__addAccount"),onClick:m,iconSx:e=>({width:e.sizes.$9,height:e.sizes.$6}),iconBoxSx:e=>({minHeight:e.sizes.$9,minWidth:e.sizes.$6,alignItems:"center"}),spinnerSize:"md"})]})]})},m=e=>{let{handleSignOutAllClicked:t,elementDescriptor:o,elementId:s,iconBoxElementDescriptor:i,iconBoxElementId:c,iconElementDescriptor:l,iconElementId:u,label:p,sx:B,actionSx:m}=e;return(0,n.tZ)(r.eX,{role:"menu",sx:[e=>({padding:e.space.$2}),B],children:(0,n.tZ)(r.aU,{elementDescriptor:o||d.descriptors.userButtonPopoverActionButton,elementId:s||d.descriptors.userButtonPopoverActionButton.setId("signOutAll"),iconBoxElementDescriptor:i||d.descriptors.userButtonPopoverActionButtonIconBox,iconBoxElementId:c||d.descriptors.userButtonPopoverActionButtonIconBox.setId("signOutAll"),iconElementDescriptor:l||d.descriptors.userButtonPopoverActionButtonIcon,iconElementId:u||d.descriptors.userButtonPopoverActionButtonIcon.setId("signOutAll"),icon:a.lv,label:p||(0,d.localizationKeys)("userButton.action__signOutAll"),onClick:t,variant:"ghost",colorScheme:"neutral",sx:[e=>({backgroundColor:e.colors.$transparent,padding:`${e.space.$2} ${e.space.$3}`,borderBottomWidth:0,borderRadius:e.radii.$lg}),m],spinnerSize:"md"})})}},37322:function(e,t,o){o.r(t),o.d(t,{UserButton:()=>b});var n=o(73312),r=o(69144),s=o(2672),i=o(84045),c=o(11576),l=o(64204),u=o(65695),d=o(61869),a=o(1151),p=o(53929),B=o(97295),m=o(49327),I=o(35241);let v=r.forwardRef((e,t)=>{let{close:o,...r}=e,s=()=>o?.(!1),{session:i}=(0,d.kP)(),u=(0,c.useUserButtonContext)(),{__experimental_asStandalone:v}=u,{authConfig:A}=(0,c.useEnvironment)(),{user:h}=(0,d.aF)(),{handleAddAccountClicked:g,handleManageAccountClicked:C,handleSessionClicked:P,handleSignOutAllClicked:x,handleSignOutSessionClicked:b,handleUserProfileActionClicked:$,otherSessions:k}=(0,I.Z)({...u,actionCompleteCallback:s,user:h});return(0,n.tZ)(p.r,{elementDescriptor:l.descriptors.userButtonPopoverRootBox,children:(0,n.BX)(a.f.Root,{elementDescriptor:l.descriptors.userButtonPopoverCard,ref:t,role:"dialog","aria-label":"User button popover",shouldEntryAnimate:!v,...r,children:[(0,n.BX)(a.f.Content,{elementDescriptor:l.descriptors.userButtonPopoverMain,children:[(0,n.tZ)(B.E,{elementId:"userButton",user:h,sx:e=>({width:"100%",padding:`${e.space.$4} ${e.space.$5}`})}),A.singleSessionMode?(0,n.tZ)(m.fB,{handleManageAccountClicked:C,handleSignOutSessionClicked:b,handleUserProfileActionClicked:$,session:i,completedCallback:s}):(0,n.tZ)(m.uj,{session:i,otherSessions:k,handleManageAccountClicked:C,handleSignOutSessionClicked:b,handleSessionClicked:P,handleAddAccountClicked:g,handleUserProfileActionClicked:$,completedCallback:s})]}),(0,n.tZ)(a.f.Footer,{elementDescriptor:l.descriptors.userButtonPopoverFooter,children:!A.singleSessionMode&&k.length>0&&(0,n.tZ)(m.gW,{handleSignOutAllClicked:x})})]})})});var A=o(5472),h=o(77711),g=o(95878);let C=({showName:e})=>{let{user:t}=(0,d.aF)();return t&&e?(0,n.tZ)(l.Text,{variant:"subtitle",as:"span",elementDescriptor:l.descriptors.userButtonOuterIdentifier,sx:[e=>({paddingLeft:e.space.$2})],children:(0,g.Pp)(t)||(0,g.xC)(t)}):null},P=(0,h.C)((0,r.forwardRef)((e,t)=>{let{sx:o,...r}=e,{user:s}=(0,d.aF)(),{showName:i}=(0,c.useUserButtonContext)(),{t:u}=(0,l.useLocalizations)();return(0,n.tZ)(l.Button,{elementDescriptor:l.descriptors.userButtonTrigger,variant:"roundWrapper",sx:[e=>({borderRadius:i?e.radii.$md:e.radii.$circle,color:e.colors.$colorForeground}),o],ref:t,"aria-label":`${u(e.isOpen?(0,l.localizationKeys)("userButton.action__closeUserMenu"):(0,l.localizationKeys)("userButton.action__openUserMenu"))}`,"aria-expanded":e.isOpen,"aria-haspopup":"dialog",...r,children:(0,n.BX)(l.Flex,{elementDescriptor:l.descriptors.userButtonBox,isOpen:e.isOpen,align:"center",as:"span",gap:2,children:[(0,n.tZ)(C,{showName:i}),(0,n.tZ)(A.Y,{boxElementDescriptor:l.descriptors.userButtonAvatarBox,imageElementDescriptor:l.descriptors.userButtonAvatarImage,...s,size:e=>e.sizes.$7})]})})})),x=(0,s.withFloatingTree)(({children:e})=>{let{defaultOpen:t}=(0,c.useUserButtonContext)(),{floating:o,reference:s,styles:l,toggle:d,isOpen:a,nodeId:p,context:B}=(0,u.Sv)({defaultOpen:t,placement:"bottom-end",offset:8}),m=(0,r.useId)();return(0,n.BX)(n.HY,{children:[(0,n.tZ)(P,{ref:s,onClick:d,isOpen:a,"aria-controls":a?m:void 0,"aria-expanded":a}),(0,n.tZ)(i.J,{nodeId:p,context:B,isOpen:a,children:(0,r.cloneElement)(e,{id:m,close:d,ref:o,style:l})})]})}),b=(0,c.withCoreUserGuard)((0,s.withCardStateProvider)(()=>{let{__experimental_asStandalone:e}=(0,c.useUserButtonContext)();return(0,n.tZ)(l.Flow.Root,{flow:"userButton",sx:{display:"inline-flex"},children:e?(0,n.tZ)(v,{close:"function"==typeof e?e:void 0}):(0,n.tZ)(x,{children:(0,n.tZ)(v,{})})})}))},35241:function(e,t,o){o.d(t,{Z:()=>a});var n=o(61869),r=o(76663),s=o(11576),i=o(2672),c=o(57046),l=o(55809),u=o(54264),d=o(24676);let a=e=>{let{setActive:t,signOut:o,openUserProfile:a}=(0,n.cL)(),p=(0,i.useCardState)(),{signedInSessions:B,otherSessions:m}=(0,u.j)({user:e.user}),{navigate:I}=(0,d.useRouter)(),{displayConfig:v}=(0,s.useEnvironment)();return{handleSignOutSessionClicked:t=>()=>0===m.length?o(e.navigateAfterSignOut):o(e.navigateAfterMultiSessionSingleSignOut,{sessionId:t.id}).finally(()=>p.setIdle()),handleManageAccountClicked:()=>"navigation"===e.userProfileMode?I(e.userProfileUrl||"").finally(()=>{(async()=>{await (0,c._)(300),e.actionCompleteCallback?.()})()}):(a(e.userProfileProps),e.actionCompleteCallback?.()),handleUserProfileActionClicked:t=>"navigation"===e.userProfileMode?I(e.userProfileUrl||"").finally(()=>{(async()=>{await (0,c._)(300),e.actionCompleteCallback?.()})()}):(a({...e.userProfileProps,...t&&{__experimental_startPath:t}}),e.actionCompleteCallback?.()),handleSignOutAllClicked:()=>o(e.navigateAfterSignOut),handleSessionClicked:o=>async()=>(p.setLoading(),t({session:o,navigate:async({session:t})=>!t.currentTask&&e.afterSwitchSessionUrl?void await I(e.afterSwitchSessionUrl):e.taskUrl?void await I(e.taskUrl):void await (0,r.W8)(t,{baseUrl:e.signInUrl??v.signInUrl,navigate:I})}).finally(()=>{p.setIdle(),e.actionCompleteCallback?.()})),handleAddAccountClicked:()=>((0,l.T7)(e.signInUrl||window.location.href),(0,c._)(2e3)),otherSessions:m,signedInSessions:B}}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(globalThis.webpackChunk_clerk_clerk_js=globalThis.webpackChunk_clerk_clerk_js||[]).push([["2270"],{37322:function(e,t,r){r.r(t),r.d(t,{UserButton:()=>b});var o=r(73312),n=r(69144),s=r(2672),i=r(84045),l=r(11576),a=r(64204),c=r(65695),d=r(61869),u=r(1151),p=r(53929),h=r(97295),B=r(49327),C=r(35241);let f=n.forwardRef((e,t)=>{let{close:r,...n}=e,s=()=>null==r?void 0:r(!1),{session:i}=(0,d.kP)(),c=(0,l.useUserButtonContext)(),{__experimental_asStandalone:f}=c,{authConfig:g}=(0,l.useEnvironment)(),{user:k}=(0,d.aF)(),{handleAddAccountClicked:m,handleManageAccountClicked:x,handleSessionClicked:v,handleSignOutAllClicked:Z,handleSignOutSessionClicked:b,handleUserProfileActionClicked:w,otherSessions:S}=(0,C.Z)({...c,actionCompleteCallback:s,user:k});return(0,o.tZ)(p.r,{elementDescriptor:a.descriptors.userButtonPopoverRootBox,children:(0,o.BX)(u.f.Root,{elementDescriptor:a.descriptors.userButtonPopoverCard,ref:t,role:"dialog","aria-label":"User button popover",shouldEntryAnimate:!f,...n,children:[(0,o.BX)(u.f.Content,{elementDescriptor:a.descriptors.userButtonPopoverMain,children:[(0,o.tZ)(h.E,{elementId:"userButton",user:k,sx:e=>({width:"100%",padding:"".concat(e.space.$4," ").concat(e.space.$5)})}),g.singleSessionMode?(0,o.tZ)(B.fB,{handleManageAccountClicked:x,handleSignOutSessionClicked:b,handleUserProfileActionClicked:w,session:i,completedCallback:s}):(0,o.tZ)(B.uj,{session:i,otherSessions:S,handleManageAccountClicked:x,handleSignOutSessionClicked:b,handleSessionClicked:v,handleAddAccountClicked:m,handleUserProfileActionClicked:w,completedCallback:s})]}),(0,o.tZ)(u.f.Footer,{elementDescriptor:a.descriptors.userButtonPopoverFooter,children:!g.singleSessionMode&&S.length>0&&(0,o.tZ)(B.gW,{handleSignOutAllClicked:Z})})]})})});var g=r(5472),k=r(77711),m=r(95878);let x=e=>{let{showName:t}=e,{user:r}=(0,d.aF)();return r&&t?(0,o.tZ)(a.Text,{variant:"subtitle",as:"span",elementDescriptor:a.descriptors.userButtonOuterIdentifier,sx:[e=>({paddingLeft:e.space.$2})],children:(0,m.Pp)(r)||(0,m.xC)(r)}):null},v=(0,k.C)((0,n.forwardRef)((e,t)=>{let{sx:r,...n}=e,{user:s}=(0,d.aF)(),{showName:i}=(0,l.useUserButtonContext)(),{t:c}=(0,a.useLocalizations)();return(0,o.tZ)(a.Button,{elementDescriptor:a.descriptors.userButtonTrigger,variant:"roundWrapper",sx:[e=>({borderRadius:i?e.radii.$md:e.radii.$circle,color:e.colors.$colorForeground}),r],ref:t,"aria-label":"".concat(c(e.isOpen?(0,a.localizationKeys)("userButton.action__closeUserMenu"):(0,a.localizationKeys)("userButton.action__openUserMenu"))),"aria-expanded":e.isOpen,"aria-haspopup":"dialog",...n,children:(0,o.BX)(a.Flex,{elementDescriptor:a.descriptors.userButtonBox,isOpen:e.isOpen,align:"center",as:"span",gap:2,children:[(0,o.tZ)(x,{showName:i}),(0,o.tZ)(g.Y,{boxElementDescriptor:a.descriptors.userButtonAvatarBox,imageElementDescriptor:a.descriptors.userButtonAvatarImage,...s,size:e=>e.sizes.$7})]})})})),Z=(0,s.withFloatingTree)(e=>{let{children:t}=e,{defaultOpen:r}=(0,l.useUserButtonContext)(),{floating:s,reference:a,styles:d,toggle:u,isOpen:p,nodeId:h,context:B}=(0,c.Sv)({defaultOpen:r,placement:"bottom-end",offset:8}),C=(0,n.useId)();return(0,o.BX)(o.HY,{children:[(0,o.tZ)(v,{ref:a,onClick:u,isOpen:p,"aria-controls":p?C:void 0,"aria-expanded":p}),(0,o.tZ)(i.J,{nodeId:h,context:B,isOpen:p,children:(0,n.cloneElement)(t,{id:C,close:u,ref:s,style:d})})]})}),b=(0,l.withCoreUserGuard)((0,s.withCardStateProvider)(()=>{let{__experimental_asStandalone:e}=(0,l.useUserButtonContext)();return(0,o.tZ)(a.Flow.Root,{flow:"userButton",sx:{display:"inline-flex"},children:e?(0,o.tZ)(f,{close:"function"==typeof e?e:void 0}):(0,o.tZ)(Z,{children:(0,o.tZ)(f,{})})})}))}}]);
@@ -0,0 +1,4 @@
1
+ "use strict";(globalThis.webpackChunk_clerk_clerk_js=globalThis.webpackChunk_clerk_clerk_js||[]).push([["3470"],{99140:function(e,t,r){r.d(t,{_:()=>z});var i=r(73312),o=r(61869),a=r(69144),l=r(2672),n=r(70431),s=r(19460),c=r(68487),d=r(88870),u=r(36788),h=r(96231),m=r(11576),p=r(17703),f=r(10207),g=r(24676),y=r(63872),v=r(64204),P=r(65695);let Z=e=>{let{navigate:t}=(0,g.useRouter)(),{email:r,nextStep:o,onReset:n}=e,c=(0,l.useCardState)(),u=(0,m.useUserProfileContext)(),{startEnterpriseSSOLinkFlow:h}=(0,P.eq)(r);async function p(){await t(r.verification.externalVerificationRedirectURL?.href||"")}return a.useEffect(()=>{let{mode:e,componentName:t}=u;h({redirectUrl:"modal"===e?(0,y.bX)({url:window.location.href,componentName:t}):window.location.href}).then(()=>o()).catch(e=>(0,d.S3)(e,[],c.setError))},[]),(0,i.BX)(i.HY,{children:[(0,i.tZ)(v.Flex,{justify:"center",children:(0,i.tZ)(v.Button,{variant:"link",onClick:p,localizationKey:(0,v.localizationKeys)("userProfile.emailAddressPage.enterpriseSSOLink.formButton")})}),(0,i.tZ)(s.K,{children:(0,i.tZ)(v.Button,{variant:"ghost",localizationKey:(0,v.localizationKeys)("userProfile.formButtonReset"),elementDescriptor:v.descriptors.formButtonReset,onClick:n})})]})};var b=r(12786);let z=(0,l.withCardStateProvider)(e=>{let{emailId:t,onSuccess:r,onReset:g,disableAutoFocus:y=!1}=e,v=(0,l.useCardState)(),{user:P}=(0,o.aF)(),z=(0,m.useEnvironment)(),K=(0,o.WZ)(e=>P?.createEmailAddress({email:e})),_=a.useRef(P?.emailAddresses.find(e=>e.id===t)),R=C(_.current,z),x=(0,h.a2)({defaultStep:+!!_.current,onNextStep:()=>v.setError(void 0)}),B=(0,u.Yp)("emailAddress","",{type:"email",label:(0,p.u1)("formFieldLabel__emailAddress"),placeholder:(0,p.u1)("formFieldInputPlaceholder__emailAddress"),isRequired:!0}),w=B.value.length>1&&P?.username!==B.value,k=async e=>{if(e.preventDefault(),P)return K(B.value).then(e=>{_.current=e,x.nextStep()}).catch(e=>(0,d.S3)(e,[B],v.setError))},I=S(R);return(0,i.BX)(h.en,{...x.props,children:[(0,i.tZ)(c.Y,{headerTitle:e.title||(0,p.u1)("userProfile.emailAddressPage.title"),headerSubtitle:e.subtitle||(0,p.u1)("userProfile.emailAddressPage.formHint"),children:(0,i.BX)(n.l.Root,{onSubmit:k,children:[(0,i.tZ)(n.l.ControlRow,{elementId:B.id,children:(0,i.tZ)(n.l.PlainInput,{...B.props,autoFocus:!y})}),(0,i.tZ)(s.A,{submitLabel:(0,p.u1)("userProfile.formButtonPrimary__add"),isDisabled:!w,onReset:g})]})}),(0,i.BX)(c.Y,{headerTitle:(0,p.u1)("userProfile.emailAddressPage.verifyTitle"),headerSubtitle:(0,p.u1)(`${I}.formSubtitle`,{identifier:_.current?.emailAddress||""}),children:["email_link"===R&&(0,i.tZ)(b.K,{nextStep:r,email:_.current,onReset:g}),"email_code"===R&&(0,i.tZ)(f.H,{nextStep:r,identification:_.current,identifier:_.current?.emailAddress,prepareVerification:()=>_.current?.prepareVerification({strategy:"email_code"}),onReset:g}),"enterprise_sso"===R&&(0,i.tZ)(Z,{nextStep:r,email:_.current,onReset:g})]})]})}),S=e=>{switch(e){case"email_code":return"userProfile.emailAddressPage.emailCode";case"enterprise_sso":return"userProfile.emailAddressPage.enterpriseSSOLink";case"email_link":return"userProfile.emailAddressPage.emailLink";default:throw Error(`Unsupported strategy for email verification: ${e}`)}},C=(e,t)=>e?.matchesSsoConnection?"enterprise_sso":!function(e){let{userSettings:t}=e,{email_address:r}=t.attributes;return!!(r?.enabled&&r?.verifications.includes("email_link"))}(t)?"email_code":"email_link"},85838:function(e,t,r){r.d(t,{j:()=>h});var i=r(73312),o=r(61869),a=r(95878),l=r(96231),n=r(11576),s=r(64204),c=r(65695),d=r(34174);let u=e=>{let{code:t}=e;return(0,i.tZ)(s.Flex,{center:!0,sx:e=>({padding:`${e.space.$1} ${e.space.$4}`}),children:(0,i.tZ)(s.Text,{children:t})})},h=e=>{let{subtitle:t,backupCodes:r}=e,{applicationName:h}=(0,n.useEnvironment)().displayConfig,{user:m}=(0,o.aF)(),{print:p,printableProps:f}=(0,l.Qz)(),{onCopy:g,hasCopied:y}=(0,c.VP)(r?.join(",")||"");if(!m)return null;let v=(0,a.xC)(m);return r?(0,i.BX)(i.HY,{children:[(0,i.BX)(s.Col,{gap:1,children:[(0,i.tZ)(s.Text,{localizationKey:(0,s.localizationKeys)("userProfile.backupCodePage.title__codelist"),variant:"subtitle"}),(0,i.tZ)(s.Text,{localizationKey:t,variant:"caption",colorScheme:"secondary"})]}),(0,i.BX)(s.Box,{sx:e=>({borderWidth:e.borderWidths.$normal,borderStyle:e.borderStyles.$solid,borderColor:e.colors.$borderAlpha100,borderRadius:e.radii.$lg}),children:[(0,i.tZ)(s.Grid,{gap:2,sx:e=>({gridTemplateColumns:`repeat(2, minmax(${e.sizes.$12}, 1fr))`,padding:`${e.space.$4} ${e.space.$6}`}),children:r.map((e,t)=>(0,i.tZ)(u,{code:e},t))}),(0,i.BX)(s.Grid,{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.tZ)(s.Button,{variant:"ghost",sx:e=>({width:"100%",padding:`${e.space.$2} 0`,borderRadius:0}),onClick:()=>{let e=document.createElement("a"),t=new Blob([function(e,t,r){let i=e?.join("\n");return`These are your backup codes for ${t} account ${r}.
2
+ Store them securely and keep them secret. Each code can only be used once.
3
+
4
+ ${i}`}(r,h,v)],{type:"text/plain"});e.href=URL.createObjectURL(t),e.download=`${h}_backup_codes.txt`,document.body.appendChild(e),e.click()},children:(0,i.tZ)(s.Icon,{icon:d.UW})}),(0,i.tZ)(s.Button,{variant:"ghost",sx:e=>({width:"100%",padding:`${e.space.$2} 0`,borderRadius:0}),onClick:p,children:(0,i.tZ)(s.Icon,{icon:d.Kh})}),(0,i.tZ)(s.Button,{variant:"ghost",onClick:g,sx:e=>({width:"100%",padding:`${e.space.$2} 0`,borderRadius:0}),children:(0,i.tZ)(s.Icon,{icon:y?d.Jr:d.CK})})]})]}),(0,i.BX)(l.o4,{...f,children:[(0,i.BX)(s.Heading,{children:["Your backup codes for ",h," account ",v,":"]}),(0,i.tZ)(s.Col,{gap:2,children:r.map((e,t)=>(0,i.tZ)(u,{code:e},t))})]})]}):null}},10207:function(e,t,r){r.d(t,{H:()=>u});var i=r(73312),o=r(69144),a=r(12667),l=r(2672),n=r(70431),s=r(19460),c=r(88870),d=r(64204);let u=e=>{let t=(0,l.useCardState)(),{nextStep:r,identification:u,identifier:h,onReset:m,prepareVerification:p}=e,f=()=>p?.()?.catch(e=>(0,c.S3)(e,[],t.setError)),g=(0,a.e3)({onCodeEntryFinished:(e,t,r)=>{u?.attemptVerification({code:e}).then(()=>t()).catch(r)},onResendCodeClicked:f,onResolve:r});return o.useEffect(()=>{f()},[]),(0,i.BX)(i.HY,{children:[(0,i.tZ)(n.l.OTPInput,{...g,label:(0,d.localizationKeys)("userProfile.emailAddressPage.emailCode.formTitle"),description:(0,d.localizationKeys)("userProfile.emailAddressPage.emailCode.formSubtitle",{identifier:h||""}),resendButton:(0,d.localizationKeys)("userProfile.emailAddressPage.emailCode.resendButton"),centerAlign:!1}),(0,i.BX)(s.K,{children:[(0,i.tZ)(d.Button,{isLoading:g.isLoading,localizationKey:(0,d.localizationKeys)("formButtonPrimary__verify"),elementDescriptor:d.descriptors.formButtonPrimary,onClick:g.onFakeContinue}),(0,i.tZ)(d.Button,{variant:"ghost",isDisabled:g.isLoading,localizationKey:(0,d.localizationKeys)("userProfile.formButtonReset"),elementDescriptor:d.descriptors.formButtonReset,onClick:m})]})]})}},12786:function(e,t,r){r.d(t,{K:()=>p,M:()=>f});var i=r(73312),o=r(69144),a=r(2672),l=r(19460),n=r(65495),s=r(88870),c=r(96231),d=r(56749),u=r(11576),h=r(64204),m=r(65695);let p=e=>{let{email:t,nextStep:r,onReset:c}=e,p=(0,a.useCardState)(),f=(0,u.useUserProfileContext)(),{startEmailLinkFlow:g}=(0,m.E2)(t),{displayConfig:y}=(0,u.useEnvironment)();function v(){let{routing:e}=f,t="virtual"===e?y.userProfileUrl:"";g({redirectUrl:(0,d.Uu)({ctx:f,baseUrl:t,intent:"profile"})}).then(()=>r()).catch(e=>(0,s.S3)(e,[],p.setError))}return o.useEffect(()=>{v()},[]),(0,i.BX)(i.HY,{children:[(0,i.tZ)(n.V,{resendButton:(0,h.localizationKeys)("userProfile.emailAddressPage.emailLink.resendButton"),onResendCodeClicked:v}),(0,i.tZ)(l.K,{children:(0,i.tZ)(h.Button,{variant:"ghost",localizationKey:(0,h.localizationKeys)("userProfile.formButtonReset"),elementDescriptor:h.descriptors.formButtonReset,onClick:c})})]})},f=()=>(0,i.tZ)(c.Ej,{title:(0,h.localizationKeys)("signUp.emailLink.verifiedSwitchTab.title"),subtitle:(0,h.localizationKeys)("signUp.emailLink.verifiedSwitchTab.subtitle"),status:"verified"})},23742:function(e,t,r){r.r(t),r.d(t,{UserProfileModal:()=>tk,UserProfile:()=>tw});var i=r(73312),o=r(69144),a=r(2672),l=r(15579),n=r(23394),s=r(31673),c=r(11576),d=r(64204),u=r(24676),h=r(17703);let m=e=>{let{pages:t,apiKeysProps:r}=(0,c.useUserProfileContext)(),o=t.routes.filter(e=>e.id!==s.xM.API_KEYS||!r?.hide);return(0,i.BX)(l.Uh,{contentRef:e.contentRef,children:[(0,i.tZ)(l.l2,{title:(0,h.u1)("userProfile.navbar.title"),description:(0,h.u1)("userProfile.navbar.description"),routes:o,contentRef:e.contentRef}),e.children]})};var p=r(94995),f=r(61869),g=r(92418),y=r(92654),v=r(19655),P=r(33009),Z=r(88870),b=r(63872),z=r(96231),S=r(99805),C=r(44709),K=r(65695),_=r(57046);let R=e=>{let{strategy:t}=e,r=(0,a.useCardState)(),{user:o}=(0,f.aF)(),{navigate:l}=(0,u.useRouter)(),{strategyToDisplayData:n}=(0,K.vO)(),{additionalOAuthScopes:s,componentName:h,mode:m}=(0,c.useUserProfileContext)(),p="modal"===m,g=(0,f.WZ)(()=>{let e=t.replace("oauth_",""),r=p?(0,b.bX)({url:window.location.href,componentName:h,socialProvider:e}):window.location.href,i=s?s[e]:[];return o?.createExternalAccount({strategy:t,redirectUrl:r,additionalScopes:i})}),y=n[t].iconUrl?(0,i.tZ)(d.Image,{isLoading:r.loadingMetadata===t,isDisabled:r.isLoading,elementDescriptor:d.descriptors.providerIcon,elementId:d.descriptors.providerIcon.setId(n[t].id),src:n[t].iconUrl,alt:`Connect ${n[t].name} account`,sx:e=>({width:e.sizes.$4})}):(0,i.tZ)(z.e_,{id:n[t].id,value:n[t].name,isLoading:r.loadingMetadata===t,isDisabled:r.isLoading});return(0,i.tZ)(v.zd.ActionMenuItem,{id:n[t].id,onClick:()=>{if(o)return r.setLoading(t),g().then(e=>{e&&e.verification?.externalVerificationRedirectURL&&((0,_._)(2e3).then(()=>r.setIdle(t)),l(e.verification.externalVerificationRedirectURL.href))}).catch(e=>{(0,Z.S3)(e,[],r.setError),r.setIdle(t)})},isDisabled:r.isLoading,variant:"ghost",isLoading:r.loadingMetadata===t,focusRing:!1,closeAfterClick:!1,localizationKey:(0,d.localizationKeys)("userProfile.connectedAccountPage.socialButtonsBlockButton",{provider:n[t].name}),sx:e=>({justifyContent:"start",gap:e.space.$2}),leftIcon:y},t)},x=({onClick:e})=>{let{user:t}=(0,f.aF)(),{strategies:r}=(0,K.vO)(),o=r.filter(e=>e.startsWith("oauth")),a=t?.verifiedExternalAccounts.map(e=>`oauth_${e.provider}`),l=o.filter(e=>!a.includes(e));return 0===l.length?null:(0,i.tZ)(v.zd.ActionMenu,{triggerLocalizationKey:(0,d.localizationKeys)("userProfile.start.connectedAccountsSection.primaryButton"),id:"connectedAccounts",onClick:e,children:l.map(e=>(0,i.tZ)(R,{strategy:e},e))})},B=e=>{let{onSuccess:t,onReset:r}=e,{user:a}=(0,f.aF)(),{emailId:l}=e,n=a?.emailAddresses.find(e=>e.id===l),s=o.useRef(n?.emailAddress),c=n?.verification?.status==="verified"?(0,d.localizationKeys)("userProfile.emailAddressPage.removeResource.messageLine2"):void 0;return s.current?(0,i.tZ)(z.LE,{title:(0,d.localizationKeys)("userProfile.emailAddressPage.removeResource.title"),messageLine1:(0,d.localizationKeys)("userProfile.emailAddressPage.removeResource.messageLine1",{identifier:s.current}),messageLine2:c,successMessage:(0,d.localizationKeys)("userProfile.emailAddressPage.removeResource.successMessage",{emailAddress:s.current}),deleteResource:()=>Promise.resolve(n?.destroy()),onSuccess:t,onReset:r}):null},w=e=>{let{phoneId:t,onSuccess:r,onReset:a}=e,{user:l}=(0,f.aF)(),n=l?.phoneNumbers.find(e=>e.id===t),s=o.useRef(n?.phoneNumber),c=n?.verification?.status==="verified"?(0,d.localizationKeys)("userProfile.phoneNumberPage.removeResource.messageLine2"):void 0;return s.current?(0,i.tZ)(z.LE,{title:(0,d.localizationKeys)("userProfile.phoneNumberPage.removeResource.title"),messageLine1:(0,d.localizationKeys)("userProfile.phoneNumberPage.removeResource.messageLine1",{identifier:s.current}),messageLine2:c,successMessage:(0,d.localizationKeys)("userProfile.phoneNumberPage.removeResource.successMessage",{phoneNumber:s.current}),deleteResource:()=>Promise.resolve(n?.destroy()),onSuccess:r,onReset:a}):null},k=e=>{let{accountId:t,onSuccess:r,onReset:a}=e,{user:l}=(0,f.aF)(),n=l?.externalAccounts.find(e=>e.id===t),s=o.useRef(n?.provider),{providerToDisplayData:c}=(0,K.vO)();return s.current?(0,i.tZ)(z.LE,{title:(0,d.localizationKeys)("userProfile.connectedAccountPage.removeResource.title"),messageLine1:(0,d.localizationKeys)("userProfile.connectedAccountPage.removeResource.messageLine1",{identifier:c[s.current]?.name||""}),messageLine2:(0,d.localizationKeys)("userProfile.connectedAccountPage.removeResource.messageLine2"),successMessage:(0,d.localizationKeys)("userProfile.connectedAccountPage.removeResource.successMessage",{connectedAccount:c[s.current]?.name||""}),deleteResource:()=>Promise.resolve(n?.destroy()),onSuccess:r,onReset:a}):null},I=e=>{let{user:t}=(0,f.aF)(),{walletId:r,onSuccess:a,onReset:l}=e,n=t?.web3Wallets.find(e=>e.id===r),s=o.useRef(n?.web3Wallet),c=n?.verification?.status==="verified"?(0,d.localizationKeys)("userProfile.web3WalletPage.removeResource.messageLine2"):void 0;return s.current?(0,i.tZ)(z.LE,{title:(0,d.localizationKeys)("userProfile.web3WalletPage.removeResource.title"),messageLine1:(0,d.localizationKeys)("userProfile.web3WalletPage.removeResource.messageLine1",{identifier:s.current}),messageLine2:c,successMessage:(0,d.localizationKeys)("userProfile.web3WalletPage.removeResource.successMessage",{web3Wallet:s.current}),deleteResource:()=>Promise.resolve(n?.destroy()),onSuccess:a,onReset:l}):null},A=e=>{let{user:t}=(0,f.aF)(),{phoneId:r,onSuccess:a,onReset:l}=e,n=t?.phoneNumbers.find(e=>e.id===r),s=o.useRef(n?.phoneNumber);return s.current?(0,i.tZ)(z.LE,{title:(0,d.localizationKeys)("userProfile.mfaPhoneCodePage.removeResource.title"),messageLine1:(0,d.localizationKeys)("userProfile.mfaPhoneCodePage.removeResource.messageLine1",{identifier:s.current}),messageLine2:(0,d.localizationKeys)("userProfile.mfaPhoneCodePage.removeResource.messageLine2"),successMessage:(0,d.localizationKeys)("userProfile.mfaPhoneCodePage.removeResource.successMessage",{mfaPhoneCode:s.current}),deleteResource:()=>Promise.resolve(n?.setReservedForSecondFactor({reserved:!1})),onSuccess:a,onReset:l}):null},T=e=>{let{onSuccess:t,onReset:r}=e,{user:o}=(0,f.aF)();return o?(0,i.tZ)(z.LE,{title:(0,d.localizationKeys)("userProfile.mfaTOTPPage.removeResource.title"),messageLine1:(0,d.localizationKeys)("userProfile.mfaTOTPPage.removeResource.messageLine1"),messageLine2:(0,d.localizationKeys)("userProfile.mfaTOTPPage.removeResource.messageLine2"),successMessage:(0,d.localizationKeys)("userProfile.mfaTOTPPage.removeResource.successMessage"),deleteResource:o.disableTOTP,onSuccess:t,onReset:r}):null},X=e=>{let{onSuccess:t,onReset:r,passkey:o}=e;return(0,i.tZ)(z.LE,{title:(0,d.localizationKeys)("userProfile.passkeyScreen.removeResource.title"),messageLine1:(0,d.localizationKeys)("userProfile.passkeyScreen.removeResource.messageLine1",{name:o.name||""}),deleteResource:o.delete,onSuccess:t,onReset:r})},L=e=>{let{close:t}=(0,C.XC)();return(0,i.tZ)(k,{onSuccess:t,onReset:t,...e})},$=["external_account_missing_refresh_token","oauth_fetch_user_error","oauth_token_exchange_error","external_account_email_address_verification_required"],F=(0,a.withCardStateProvider)(({shouldAllowCreation:e=!0})=>{let{user:t}=(0,f.aF)(),r=(0,a.useCardState)(),l=!!t?.externalAccounts?.length,[n,s]=(0,o.useState)(null);if(!t||!e&&!l)return null;let c=[...t.verifiedExternalAccounts,...t.unverifiedExternalAccounts.filter(e=>e.verification?.error)];return(0,i.BX)(v.zd.Root,{title:(0,d.localizationKeys)("userProfile.start.connectedAccountsSection.title"),centered:!1,id:"connectedAccounts",children:[(0,i.tZ)(g.Z.Alert,{children:r.error}),(0,i.BX)(S.a.Root,{value:n,onChange:s,children:[(0,i.tZ)(v.zd.ItemList,{id:"connectedAccounts",children:c.map(e=>(0,i.tZ)(E,{account:e},e.id))}),e&&(0,i.tZ)(x,{onClick:()=>s(null)})]})]})}),E=({account:e})=>{let{additionalOAuthScopes:t,componentName:r,mode:l}=(0,c.useUserProfileContext)(),{navigate:n}=(0,u.useRouter)(),{user:s}=(0,f.aF)(),h=(0,a.useCardState)(),m=e.id,p="modal"===l,g=p?(0,b.bX)({url:window.location.href,componentName:r}):window.location.href,y=(0,f.WZ)(()=>s?.createExternalAccount({strategy:e.verification.strategy,redirectUrl:g,additionalScopes:R}));if(!s)return null;let{providerToDisplayData:P}=(0,K.vO)(),C=e.username||e.emailAddress,_=e.verification?.error?.longMessage,R=function(e,t){if(!t)return[];let r=t[e.provider]||[],i=e.approvedScopes.split(" ");return 0===r.filter(e=>!i.includes(e)).length?[]:r}(e,t),x=R.length>0&&""!=e.approvedScopes,B=$.includes(e.verification?.error?.code||"")||x,w=B?(0,d.localizationKeys)("userProfile.start.connectedAccountsSection.subtitle__disconnected"):_,k=async()=>{let t=p?(0,b.bX)({url:window.location.href,componentName:r}):window.location.href;try{let r;(r=x?await e.reauthorize({additionalScopes:R,redirectUrl:t}):await y())&&await n(r.verification.externalVerificationRedirectURL?.href||"")}catch(e){(0,Z.S3)(e,[],h.setError)}};return(0,i.BX)(o.Fragment,{children:[(0,i.BX)(v.zd.Item,{id:"connectedAccounts",children:[(0,i.BX)(d.Flex,{sx:e=>({overflow:"hidden",gap:e.space.$2}),children:[(0,i.tZ)(()=>P[e.provider].iconUrl?(0,i.tZ)(d.Image,{elementDescriptor:[d.descriptors.providerIcon],elementId:d.descriptors.socialButtonsProviderIcon.setId(e.provider),alt:P[e.provider].name,src:P[e.provider].iconUrl,sx:e=>({width:e.sizes.$4,flexShrink:0})}):(0,i.tZ)(z.e_,{id:e.provider,value:P[e.provider].name}),{}),(0,i.tZ)(d.Box,{sx:{whiteSpace:"nowrap",overflow:"hidden"},children:(0,i.BX)(d.Flex,{gap:1,center:!0,children:[(0,i.tZ)(d.Text,{sx:e=>({color:e.colors.$colorForeground}),children:`${P[e.provider].name}`}),(0,i.tZ)(d.Text,{truncate:!0,as:"span",colorScheme:"secondary",children:C?`\u{2022} ${C}`:""})]})})]}),(0,i.tZ)(D,{account:e})]}),B&&(0,i.BX)(d.Box,{sx:e=>({padding:`${e.sizes.$none} ${e.sizes.$none} ${e.sizes.$1x5} ${e.sizes.$8x5}`}),children:[(0,i.tZ)(d.Text,{colorScheme:"secondary",sx:e=>({paddingRight:e.sizes.$1x5,display:"inline-block"}),localizationKey:w}),(0,i.tZ)(d.Button,{sx:{display:"inline-block"},onClick:k,variant:"link",localizationKey:(0,d.localizationKeys)("userProfile.start.connectedAccountsSection.actionLabel__connectionFailed")})]}),e.verification?.error?.code&&!B&&(0,i.tZ)(d.Text,{colorScheme:"danger",sx:e=>({padding:`${e.sizes.$none} ${e.sizes.$1x5} ${e.sizes.$1x5} ${e.sizes.$8x5}`}),children:_}),(0,i.tZ)(S.a.Open,{value:`remove-${m}`,children:(0,i.tZ)(S.a.Card,{variant:"destructive",children:(0,i.tZ)(L,{accountId:e.id})})})]},e.id)},D=({account:e})=>{let{open:t}=(0,C.XC)(),r=e.id,o=[{label:(0,d.localizationKeys)("userProfile.start.connectedAccountsSection.destructiveActionTitle"),isDestructive:!0,onClick:()=>t(`remove-${r}`)}].filter(e=>null!==e);return(0,i.tZ)(P.a,{actions:o})};function O(e,t){if(!e)return[];let r=e.filter(e=>e.id===t),i=e.filter(e=>e.id!==t),o=i.filter(e=>e.verification?.status==="verified"),a=i.filter(e=>!!e.verification?.status&&e.verification?.status!=="verified"),l=i.filter(e=>!e.verification.status);return o.sort((e,t)=>e.id.localeCompare(t.id)),a.sort((e,t)=>e.verification?.expireAt&&t.verification?.expireAt?e.verification.expireAt.getTime()-t.verification.expireAt.getTime():0),[...r,...o,...a,...l]}var N=r(99140);let W=e=>{let{close:t}=(0,C.XC)();return(0,i.tZ)(B,{onSuccess:t,onReset:t,...e})},M=e=>{let{close:t}=(0,C.XC)();return(0,i.tZ)(N._,{onSuccess:t,onReset:t,...e})},U=({shouldAllowCreation:e=!0})=>{let{user:t}=(0,f.aF)();return(0,i.tZ)(v.zd.Root,{title:(0,d.localizationKeys)("userProfile.start.emailAddressesSection.title"),centered:!1,id:"emailAddresses",children:(0,i.tZ)(S.a.Root,{children:(0,i.BX)(v.zd.ItemList,{id:"emailAddresses",children:[O(t?.emailAddresses,t?.primaryEmailAddressId).map(e=>{let r=e.id;return(0,i.BX)(o.Fragment,{children:[(0,i.BX)(v.zd.Item,{id:"emailAddresses",children:[(0,i.BX)(d.Flex,{sx:e=>({overflow:"hidden",gap:e.space.$1}),children:[(0,i.tZ)(d.Text,{sx:e=>({color:e.colors.$colorForeground}),truncate:!0,children:e.emailAddress}),t?.primaryEmailAddressId===r&&(0,i.tZ)(d.Badge,{localizationKey:(0,d.localizationKeys)("badge__primary")}),"verified"!==e.verification.status&&(0,i.tZ)(d.Badge,{localizationKey:(0,d.localizationKeys)("badge__unverified")})]}),(0,i.tZ)(Y,{email:e})]}),(0,i.tZ)(S.a.Open,{value:`remove-${r}`,children:(0,i.tZ)(S.a.Card,{variant:"destructive",children:(0,i.tZ)(W,{emailId:r})})}),(0,i.tZ)(S.a.Open,{value:`verify-${r}`,children:(0,i.tZ)(S.a.Card,{children:(0,i.tZ)(M,{emailId:r})})})]},e.emailAddress)}),e&&(0,i.BX)(i.HY,{children:[(0,i.tZ)(S.a.Trigger,{value:"add",children:(0,i.tZ)(v.zd.ArrowButton,{id:"emailAddresses",localizationKey:(0,d.localizationKeys)("userProfile.start.emailAddressesSection.primaryButton")})}),(0,i.tZ)(S.a.Open,{value:"add",children:(0,i.tZ)(S.a.Card,{children:(0,i.tZ)(M,{})})})]})]})})})},Y=({email:e})=>{let t=(0,a.useCardState)(),{user:r}=(0,f.aF)(),{open:o}=(0,C.XC)(),l=e.id,n=r?.primaryEmailAddressId===l,s="verified"===e.verification.status,c=(0,f.WZ)(()=>r?.update({primaryEmailAddressId:l})),u=[n&&!s?{label:(0,d.localizationKeys)("userProfile.start.emailAddressesSection.detailsAction__primary"),onClick:()=>o(`verify-${l}`)}:null,!n&&s?{label:(0,d.localizationKeys)("userProfile.start.emailAddressesSection.detailsAction__nonPrimary"),onClick:()=>{c().catch(e=>(0,Z.S3)(e,[],t.setError))}}:null,!n&&!s?{label:(0,d.localizationKeys)("userProfile.start.emailAddressesSection.detailsAction__unverified"),onClick:()=>o(`verify-${l}`)}:null,{label:(0,d.localizationKeys)("userProfile.start.emailAddressesSection.destructiveAction"),isDestructive:!0,onClick:()=>o(`remove-${l}`)}].filter(e=>null!==e);return(0,i.tZ)(P.a,{actions:u})},q=()=>{let{user:e}=(0,f.aF)(),t=e?.enterpriseAccounts.filter(({enterpriseConnection:e})=>e?.active);return t?.length?(0,i.tZ)(v.zd.Root,{title:(0,d.localizationKeys)("userProfile.start.enterpriseAccountsSection.title"),id:"enterpriseAccounts",centered:!1,children:(0,i.tZ)(v.zd.ItemList,{id:"enterpriseAccounts",children:t.map(e=>(0,i.tZ)(j,{account:e},e.id))})}):null},j=({account:e})=>{let t=e.emailAddress,r=e?.enterpriseConnection?.name,o=e.verification?.error?.longMessage;return(0,i.BX)(v.zd.Item,{id:"enterpriseAccounts",sx:e=>({gap:e.space.$2,justifyContent:"start"}),children:[(0,i.tZ)(H,{account:e}),(0,i.tZ)(d.Box,{sx:{whiteSpace:"nowrap",overflow:"hidden"},children:(0,i.BX)(d.Flex,{gap:1,center:!0,children:[(0,i.tZ)(d.Text,{truncate:!0,colorScheme:"body",children:r}),(0,i.tZ)(d.Text,{truncate:!0,as:"span",colorScheme:"secondary",children:t?`\u{2022} ${t}`:""}),o&&(0,i.tZ)(d.Badge,{colorScheme:"danger",localizationKey:(0,d.localizationKeys)("badge__requiresAction")})]})})]},e.id)},H=({account:e})=>{let{provider:t,enterpriseConnection:r}=e,o=t.replace(/(oauth_|saml_)/,"").trim(),a=r?.name??o,l={elementDescriptor:[d.descriptors.providerIcon],alt:a,sx:e=>({width:e.sizes.$4}),elementId:d.descriptors.enterpriseButtonsProviderIcon.setId(e.provider)};return r?.logoPublicUrl?(0,i.tZ)(d.Image,{...l,src:r.logoPublicUrl}):(0,i.tZ)(z.e_,{id:o,value:a,"aria-label":`${a}'s icon`,elementDescriptor:[d.descriptors.providerIcon,d.descriptors.providerInitialIcon],elementId:d.descriptors.providerInitialIcon.setId(o)})};var V=r(98690),Q=r(70431),G=r(19460),J=r(68487),ee=r(36788),et=r(10207);let er=(0,a.withCardStateProvider)(e=>{let{phoneId:t,onSuccess:r,onReset:a}=e,{user:l}=(0,f.aF)(),n=o.useRef(l?.phoneNumbers.find(e=>e.id===t)),s=(0,z.a2)({defaultStep:+!!n.current});return(0,i.BX)(z.en,{...s.props,children:[(0,i.tZ)(ei,{resourceRef:n,title:(0,d.localizationKeys)("userProfile.phoneNumberPage.title"),onSuccess:s.nextStep,onReset:a}),(0,i.tZ)(eo,{resourceRef:n,title:(0,d.localizationKeys)("userProfile.phoneNumberPage.verifyTitle"),onSuccess:r,onReset:a})]})}),ei=e=>{let{title:t,onSuccess:r,onReset:o,onUseExistingNumberClick:l,resourceRef:n}=e,s=(0,a.useCardState)(),{user:c}=(0,f.aF)(),u=(0,f.WZ)((e,t)=>e.createPhoneNumber(t)),h=(0,ee.Yp)("phoneNumber","",{type:"tel",label:(0,d.localizationKeys)("formFieldLabel__phoneNumber"),isRequired:!0}),m=h.value.length>1&&c?.username!==h.value,p=!!c?.phoneNumbers?.length&&l,g=async e=>{if(e.preventDefault(),c)return u(c,{phoneNumber:h.value}).then(e=>{n.current=e,r()}).catch(e=>(0,Z.S3)(e,[h],s.setError))};return(0,i.tZ)(J.Y,{headerTitle:t,gap:1,children:(0,i.BX)(Q.l.Root,{gap:4,onSubmit:g,children:[(0,i.tZ)(d.Text,{localizationKey:(0,d.localizationKeys)("userProfile.phoneNumberPage.infoText"),colorScheme:"secondary"}),(0,i.tZ)(Q.l.ControlRow,{elementId:h.id,children:(0,i.tZ)(Q.l.PhoneInput,{...h.props,autoFocus:!0})}),(0,i.BX)(d.Flex,{justify:p?"between":"end",children:[p&&(0,i.tZ)(d.Button,{variant:"ghost",localizationKey:(0,d.localizationKeys)("userProfile.mfaPhoneCodePage.backButton"),onClick:l}),(0,i.tZ)(G.A,{submitLabel:(0,d.localizationKeys)("userProfile.formButtonPrimary__add"),isDisabled:!m,onReset:o})]})]})})},eo=e=>{let{title:t,onSuccess:r,resourceRef:o,onReset:a}=e;return(0,i.tZ)(J.Y,{headerTitle:t,headerSubtitle:(0,d.localizationKeys)("userProfile.phoneNumberPage.verifySubtitle",{identifier:o.current?.phoneNumber||""}),children:(0,i.tZ)(et.H,{nextStep:r,identification:o.current,identifier:o.current?.phoneNumber,prepareVerification:o.current?.prepareVerification,onReset:a})})},ea=e=>{let{close:t}=(0,C.XC)();return(0,i.tZ)(w,{onSuccess:t,onReset:t,...e})},el=e=>{let{close:t}=(0,C.XC)();return(0,i.tZ)(er,{onSuccess:t,onReset:t,...e})},en=({shouldAllowCreation:e=!0})=>{let{user:t}=(0,f.aF)(),r=!!t?.phoneNumbers?.length;return e||r?(0,i.tZ)(v.zd.Root,{centered:!1,title:(0,d.localizationKeys)("userProfile.start.phoneNumbersSection.title"),id:"phoneNumbers",children:(0,i.tZ)(S.a.Root,{children:(0,i.BX)(v.zd.ItemList,{id:"phoneNumbers",children:[O(t?.phoneNumbers,t?.primaryPhoneNumberId).map(e=>{let r=e.id;return(0,i.BX)(o.Fragment,{children:[(0,i.BX)(v.zd.Item,{id:"phoneNumbers",children:[(0,i.tZ)(d.Box,{sx:{whiteSpace:"nowrap",overflow:"hidden"},children:(0,i.BX)(d.Flex,{gap:2,center:!0,children:[(0,i.tZ)(d.Text,{sx:e=>({color:e.colors.$colorForeground}),children:(0,V.L_)(e.phoneNumber)}),t?.primaryPhoneNumberId===r&&(0,i.tZ)(d.Badge,{localizationKey:(0,d.localizationKeys)("badge__primary")}),"verified"!==e.verification.status&&(0,i.tZ)(d.Badge,{localizationKey:(0,d.localizationKeys)("badge__unverified")})]})}),(0,i.tZ)(es,{phone:e})]}),(0,i.tZ)(S.a.Open,{value:`remove-${r}`,children:(0,i.tZ)(S.a.Card,{variant:"destructive",children:(0,i.tZ)(ea,{phoneId:r})})}),(0,i.tZ)(S.a.Open,{value:`verify-${r}`,children:(0,i.tZ)(S.a.Card,{children:(0,i.tZ)(el,{phoneId:r})})})]},r)}),e&&(0,i.BX)(i.HY,{children:[(0,i.tZ)(S.a.Trigger,{value:"add",children:(0,i.tZ)(v.zd.ArrowButton,{id:"phoneNumbers",localizationKey:(0,d.localizationKeys)("userProfile.start.phoneNumbersSection.primaryButton")})}),(0,i.tZ)(S.a.Open,{value:"add",children:(0,i.tZ)(S.a.Card,{children:(0,i.tZ)(el,{})})})]})]})})}):null},es=({phone:e})=>{let t=(0,a.useCardState)(),{open:r}=(0,C.XC)(),{user:o}=(0,f.aF)(),l=e.id,n=(0,f.WZ)(t=>t.update({primaryPhoneNumberId:e.id}));if(!o)return null;let s=o.primaryPhoneNumberId===e.id,c="verified"===e.verification.status,u=[s&&!c?{label:(0,d.localizationKeys)("userProfile.start.phoneNumbersSection.detailsAction__primary"),onClick:()=>r(`verify-${l}`)}:null,!s&&c?{label:(0,d.localizationKeys)("userProfile.start.phoneNumbersSection.detailsAction__nonPrimary"),onClick:()=>n(o).catch(e=>(0,Z.S3)(e,[],t.setError))}:null,!s&&!c?{label:(0,d.localizationKeys)("userProfile.start.phoneNumbersSection.detailsAction__unverified"),onClick:()=>r(`verify-${l}`)}:null,{label:(0,d.localizationKeys)("userProfile.start.phoneNumbersSection.destructiveAction"),isDestructive:!0,onClick:()=>r(`remove-${l}`)}].filter(e=>null!==e);return(0,i.tZ)(P.a,{actions:u})};var ec=r(51217),ed=r(36127);let eu=(0,a.withCardStateProvider)(e=>{let{onSuccess:t,onReset:r}=e,{user:o}=(0,f.aF)(),l=(0,f.WZ)(e=>o?.update({username:e})),{userSettings:n}=(0,c.useEnvironment)(),s=(0,a.useCardState)(),{t:u,locale:h}=(0,d.useLocalizations)(),{usernameSettings:m}=n,p=(0,ee.Yp)("username",o?.username||"",{type:"text",label:(0,d.localizationKeys)("formFieldLabel__username"),placeholder:(0,d.localizationKeys)("formFieldInputPlaceholder__username"),buildErrorMessage:e=>(0,ed.f)(e,{t:u,locale:h,usernameSettings:m})});if(!o)return null;let g=n.attributes.username?.required,y=(!g||p.value.length>0)&&o.username!==p.value,v=async()=>{try{await l(p.value),t()}catch(e){(0,Z.S3)(e,[p],s.setError)}};return(0,i.tZ)(J.Y,{headerTitle:o.username?(0,d.localizationKeys)("userProfile.usernamePage.title__update"):(0,d.localizationKeys)("userProfile.usernamePage.title__set"),children:(0,i.BX)(Q.l.Root,{onSubmit:v,children:[(0,i.tZ)(Q.l.ControlRow,{elementId:p.id,children:(0,i.tZ)(Q.l.PlainInput,{...p.props,autoFocus:!0,isRequired:g})}),(0,i.tZ)(G.A,{isDisabled:!y,onReset:r})]})})}),eh=()=>{let{close:e}=(0,C.XC)();return(0,i.tZ)(eu,{onSuccess:e,onReset:e})},em=()=>{let{user:e}=(0,f.aF)();return e?(0,i.tZ)(v.zd.Root,{title:(0,d.localizationKeys)("userProfile.start.usernameSection.title"),id:"username",sx:{alignItems:"center",[ec.mqu.md]:{alignItems:"flex-start"}},children:(0,i.BX)(S.a.Root,{children:[(0,i.tZ)(S.a.Closed,{value:"edit",children:(0,i.BX)(v.zd.Item,{id:"username",sx:{paddingLeft:e.username?void 0:"0"},children:[e.username&&(0,i.tZ)(d.Text,{truncate:!0,sx:e=>({color:e.colors.$colorForeground}),children:e.username}),(0,i.tZ)(S.a.Trigger,{value:"edit",children:(0,i.tZ)(v.zd.Button,{id:"username",localizationKey:e.username?(0,d.localizationKeys)("userProfile.start.usernameSection.primaryButton__updateUsername"):(0,d.localizationKeys)("userProfile.start.usernameSection.primaryButton__setUsername")})})]})}),(0,i.tZ)(S.a.Open,{value:"edit",children:(0,i.tZ)(S.a.Card,{children:(0,i.tZ)(eh,{})})})]})}):null};var ep=r(97295),ef=r(43300),eg=r(6654),ey=r(5472);let ev=e=>{let{user:t,...r}=e;return(0,i.tZ)(eg.C,{...r,title:(0,h.u1)("userProfile.profilePage.imageFormTitle"),avatarPreview:(0,i.tZ)(ey.Y,{size:e=>e.sizes.$12,...t})})},eP=(0,a.withCardStateProvider)(e=>{let{onSuccess:t,onReset:r}=e,o=(0,a.useCardState)(),{user:l}=(0,f.aF)();if(!l)return null;let{first_name:n,last_name:s}=(0,c.useEnvironment)().userSettings.attributes,u=n?.enabled,h=s?.enabled,m=l.firstName||"",p=l.lastName||"",g=(0,ee.Yp)("firstName",l.firstName||"",{type:"text",label:(0,d.localizationKeys)("formFieldLabel__firstName"),placeholder:(0,d.localizationKeys)("formFieldInputPlaceholder__firstName"),isRequired:s?.required}),y=(0,ee.Yp)("lastName",l.lastName||"",{type:"text",label:(0,d.localizationKeys)("formFieldLabel__lastName"),placeholder:(0,d.localizationKeys)("formFieldInputPlaceholder__lastName"),isRequired:s?.required}),v=u&&g.value!==m||h&&y.value!==p,P=u&&n.required||h&&s.required,z=P&&!!y.value&&!!g.value&&v,S=l.enterpriseAccounts.some(e=>e.active),C=async e=>(e.preventDefault(),(v?l.update({firstName:g.value,lastName:y.value}):Promise.resolve()).then(t).catch(e=>{(0,Z.S3)(e,[g,y],o.setError)}));return(0,i.BX)(J.Y,{headerTitle:(0,d.localizationKeys)("userProfile.profilePage.title"),children:[S&&(0,i.tZ)(ef.e,{message:(0,d.localizationKeys)("userProfile.profilePage.readonly")}),(0,i.BX)(Q.l.Root,{onSubmit:C,sx:e=>({gap:e.space.$6}),children:[(0,i.tZ)(ev,{user:l,onAvatarChange:e=>l.setProfileImage({file:e}).then(()=>{o.setIdle(),t?.()}).catch(e=>(0,Z.S3)(e,[],o.setError)),onAvatarRemove:(0,b.QO)(l.imageUrl)?null:()=>{l.setProfileImage({file:null}).then(()=>{o.setIdle(),t?.()}).catch(e=>(0,Z.S3)(e,[],o.setError))}}),(u||h)&&(0,i.BX)(Q.l.ControlRow,{elementId:"name",children:[u&&(0,i.tZ)(Q.l.PlainInput,{...g.props,isDisabled:S,autoFocus:!0}),h&&(0,i.tZ)(Q.l.PlainInput,{...y.props,isDisabled:S,autoFocus:!u})]}),(0,i.tZ)(G.A,{isDisabled:P?!z:!v,onReset:r})]})]})}),eZ=()=>{let{close:e}=(0,C.XC)();return(0,i.tZ)(eP,{onSuccess:e,onReset:e})},eb=()=>{let{user:e}=(0,f.aF)();if(!e)return null;let{username:t,primaryEmailAddress:r,primaryPhoneNumber:o,primaryWeb3Wallet:a,...l}=e;return(0,i.tZ)(v.zd.Root,{title:(0,d.localizationKeys)("userProfile.start.profileSection.title"),id:"profile",sx:{[ec.mqu.md]:{alignItems:"flex-start"}},children:(0,i.BX)(S.a.Root,{children:[(0,i.tZ)(S.a.Closed,{value:"edit",children:(0,i.BX)(v.zd.Item,{id:"profile",children:[(0,i.tZ)(ep.E,{user:l,size:"lg",mainIdentifierVariant:"subtitle",sx:e=>({color:e.colors.$colorForeground})}),(0,i.tZ)(S.a.Trigger,{value:"edit",children:(0,i.tZ)(v.zd.Button,{id:"profile",localizationKey:(0,d.localizationKeys)("userProfile.start.profileSection.primaryButton")})})]})}),(0,i.tZ)(S.a.Open,{value:"edit",children:(0,i.tZ)(S.a.Card,{children:(0,i.tZ)(eZ,{})})})]})})};var ez=r(41024);let eS=(0,o.lazy)(()=>Promise.all([r.e("514"),r.e("3956"),r.e("1192"),r.e("9573"),r.e("569")]).then(r.bind(r,22382)).then(e=>({default:e.Web3SolanaWalletButtons}))),eC=({onConnect:e})=>{let t=(0,a.useCardState)(),{close:r}=(0,C.XC)(),l=async({walletName:r})=>{t.setLoading(r);try{await e({strategy:"web3_solana_signature",walletName:r}),t.setIdle()}catch(e){if(t.setIdle(),e instanceof Error)(0,Z.S3)(e,[],t.setError);else{let r=new ez.w$("An error occurred while generating the Solana signature.",{code:"web3_solana_signature_generation_failed",cause:e instanceof Error?e:void 0});(0,Z.S3)(r,[],t.setError)}}};return(0,i.tZ)(J.Y,{headerTitle:(0,d.localizationKeys)("userProfile.start.web3WalletsSection.web3SelectSolanaWalletScreen.title"),headerSubtitle:(0,d.localizationKeys)("userProfile.start.web3WalletsSection.web3SelectSolanaWalletScreen.subtitle"),children:(0,i.BX)(Q.l.Root,{children:[(0,i.tZ)(o.Suspense,{fallback:(0,i.tZ)(d.Flex,{direction:"row",align:"center",justify:"center",sx:e=>({height:"100%",minHeight:e.sizes.$32}),children:(0,i.tZ)(d.Spinner,{size:"lg",colorScheme:"primary",elementDescriptor:d.descriptors.spinner})}),children:(0,i.tZ)(eS,{web3AuthCallback:l})}),(0,i.tZ)(G.K,{children:(0,i.tZ)(d.Button,{type:"button",variant:"ghost",onClick:()=>{r()},localizationKey:(0,d.localizationKeys)("userProfile.formButtonReset"),elementDescriptor:d.descriptors.formButtonReset})})]})})};var eK=r(19955),e_=r(63744);let eR=()=>{let e=(0,a.useCardState)(),{open:t}=(0,C.XC)(),{user:r}=(0,f.aF)(),{strategies:o,strategyToDisplayData:l}=(0,K.vO)(),n=o.filter(e=>e.startsWith("web3")),s=r?.verifiedWeb3Wallets?.map(e=>e.verification.strategy)??[],c=n.filter(e=>!s.includes(e)&&l[e]);if(0===c.length)return null;let u=(0,f.WZ)(e=>r?.createWeb3Wallet({web3Wallet:e})),h=async({strategy:i,walletName:o})=>{if("web3_solana_signature"===i&&!o)return void t("web3Wallets");let a=i.replace("web3_","").replace("_signature","");e.setError(void 0);try{e.setLoading(i);let t=await (0,e_.Ly)({provider:a,walletName:o});if(!r)throw Error("user is not defined");let l=await u(t);l=await l?.prepareVerification({strategy:i});let n=l?.verification.message,s=await (0,e_.bQ)({identifier:t,nonce:n,provider:a,walletName:o});await l?.attemptVerification({signature:s}),e.setIdle()}catch(t){e.setIdle(),(0,eK.H)(t,e.setError)}};return(0,i.BX)(i.HY,{children:[(0,i.tZ)(S.a.Closed,{value:"web3Wallets",children:(0,i.tZ)(v.zd.ActionMenu,{id:"web3Wallets",triggerLocalizationKey:(0,d.localizationKeys)("userProfile.start.web3WalletsSection.primaryButton"),children:c.map(t=>(0,i.tZ)(v.zd.ActionMenuItem,{id:l[t].id,onClick:()=>h({strategy:t}),isLoading:e.loadingMetadata===t,isDisabled:e.isLoading,localizationKey:(0,d.localizationKeys)("userProfile.web3WalletPage.web3WalletButtonsBlockButton",{provider:l[t].name}),sx:e=>({justifyContent:"start",gap:e.space.$2}),leftIcon:(0,i.tZ)(d.Image,{elementDescriptor:d.descriptors.providerIcon,elementId:d.descriptors.providerIcon.setId(l[t].id),isLoading:e.loadingMetadata===t,isDisabled:e.isLoading,src:l[t].iconUrl,alt:`Connect ${l[t].name}`,sx:e=>({width:e.sizes.$5})})},t))})}),(0,i.tZ)(S.a.Open,{value:"web3Wallets",children:(0,i.tZ)(S.a.Card,{children:(0,i.tZ)(eC,{onConnect:h})})})]})},ex=e=>{let{close:t}=(0,C.XC)();return(0,i.tZ)(I,{onSuccess:t,onReset:t,...e})},eB=(0,a.withCardStateProvider)(({shouldAllowCreation:e=!0})=>{let{user:t}=(0,f.aF)(),r=(0,a.useCardState)(),{strategyToDisplayData:l}=(0,K.vO)(),n=!!t?.web3Wallets?.length,[s,c]=(0,o.useState)(null);return e||n?(0,i.BX)(v.zd.Root,{title:(0,d.localizationKeys)("userProfile.start.web3WalletsSection.title"),centered:!1,id:"web3Wallets",children:[(0,i.tZ)(g.Z.Alert,{children:r.error}),(0,i.BX)(S.a.Root,{value:s,onChange:c,children:[(0,i.tZ)(v.zd.ItemList,{id:"web3Wallets",children:O(t?.web3Wallets,t?.primaryWeb3WalletId).map(e=>{var r;let a=e.verification.strategy,n=e.id;return l[a]&&(0,i.BX)(o.Fragment,{children:[(0,i.BX)(v.zd.Item,{id:"web3Wallets",align:"start",children:[(0,i.BX)(d.Flex,{sx:e=>({alignItems:"center",gap:e.space.$2,width:"100%"}),children:[l[a].iconUrl&&(0,i.tZ)(d.Image,{src:l[a].iconUrl,alt:l[a].name,sx:e=>({width:e.sizes.$4})}),(0,i.tZ)(d.Box,{sx:{whiteSpace:"nowrap",overflow:"hidden"},children:(0,i.BX)(d.Flex,{gap:2,justify:"start",children:[(0,i.BX)(d.Text,{children:[l[a].name," (",(r=e.web3Wallet).length<=10?r:r.slice(0,6)+"..."+r.slice(-4),")"]}),t?.primaryWeb3WalletId===n&&(0,i.tZ)(d.Badge,{localizationKey:(0,d.localizationKeys)("badge__primary")}),"verified"!==e.verification.status&&(0,i.tZ)(d.Badge,{localizationKey:(0,d.localizationKeys)("badge__unverified")})]})})]}),(0,i.tZ)(ew,{walletId:n,isVerified:"verified"===e.verification.status})]},n),(0,i.tZ)(S.a.Open,{value:`remove-${n}`,children:(0,i.tZ)(S.a.Card,{variant:"destructive",children:(0,i.tZ)(ex,{walletId:e.id})})})]},e.id)})}),e&&(0,i.tZ)(eR,{})]})]}):null}),ew=({walletId:e,isVerified:t})=>{let r=(0,a.useCardState)(),{open:o}=(0,C.XC)(),{user:l}=(0,f.aF)(),n=l?.primaryWeb3WalletId===e,s=(0,f.WZ)(()=>l?.update({primaryWeb3WalletId:e})),c=[!n&&t?{label:(0,d.localizationKeys)("userProfile.start.web3WalletsSection.detailsAction__nonPrimary"),onClick:()=>{s().catch(e=>(0,Z.S3)(e,[],r.setError))}}:null,{label:(0,d.localizationKeys)("userProfile.start.web3WalletsSection.destructiveAction"),isDestructive:!0,onClick:()=>o(`remove-${e}`)}].filter(e=>null!==e);return(0,i.tZ)(P.a,{actions:c})},ek=(0,a.withCardStateProvider)(()=>{let{attributes:e,social:t,enterpriseSSO:r}=(0,c.useEnvironment)().userSettings,o=(0,a.useCardState)(),{user:l}=(0,f.aF)(),{shouldAllowIdentificationCreation:n}=(0,c.useUserProfileContext)(),s=e.username?.enabled,u=e.email_address?.enabled,h=e.phone_number?.enabled,m=t&&Object.values(t).filter(e=>e.enabled).length>0,p=l&&r.enabled,v=e.web3_wallet?.enabled;return(0,i.tZ)(d.Col,{elementDescriptor:d.descriptors.page,sx:e=>({gap:e.space.$8,color:e.colors.$colorForeground}),children:(0,i.BX)(d.Col,{elementDescriptor:d.descriptors.profilePage,elementId:d.descriptors.profilePage.setId("account"),children:[(0,i.tZ)(y.h.Root,{children:(0,i.tZ)(y.h.Title,{localizationKey:(0,d.localizationKeys)("userProfile.start.headerTitle__account"),sx:e=>({marginBottom:e.space.$4}),textVariant:"h2"})}),(0,i.tZ)(g.Z.Alert,{children:o.error}),(0,i.tZ)(eb,{}),s&&(0,i.tZ)(em,{}),u&&(0,i.tZ)(U,{shouldAllowCreation:n}),h&&(0,i.tZ)(en,{shouldAllowCreation:n}),m&&(0,i.tZ)(F,{shouldAllowCreation:n}),p&&(0,i.tZ)(q,{}),v&&(0,i.tZ)(eB,{shouldAllowCreation:n})]})})});var eI=r(58104),eA=r(53997),eT=r(34174);let eX=()=>{let e,{user:t}=(0,f.aF)(),{session:r}=(0,f.kP)(),{data:o,isLoading:a}=(0,K.ib)(t?.getSessions,"user-sessions");return(0,i.tZ)(v.zd.Root,{title:(0,d.localizationKeys)("userProfile.start.activeDevicesSection.title"),centered:!1,id:"activeDevices",children:(0,i.tZ)(v.zd.ItemList,{id:"activeDevices",disableAnimation:!0,children:a?(0,i.tZ)(eI.m,{}):o?.sort((e=r.id,t=>t.id===e?-1:1)).map(e=>eL(e.status)?(0,i.tZ)(e$,{session:e},e.id):null)})})},eL=e=>["active","pending"].includes(e),e$=({session:e})=>{let t=(0,f.kP)().session?.id===e.id,r=(0,K._m)(),o=(0,f.WZ)(e.revoke.bind(e)),a=async()=>{if(!t&&e)return r.setLoading(),o().catch(e=>(0,Z.S3)(e,[],r.setError)).finally(()=>r.setIdle())};return(0,i.tZ)(v.zd.Item,{id:"activeDevices",elementDescriptor:d.descriptors.activeDeviceListItem,elementId:t?d.descriptors.activeDeviceListItem.setId("current"):void 0,sx:{alignItems:"flex-start",opacity:r.isLoading?.5:1},isDisabled:r.isLoading,children:(0,i.BX)(i.HY,{children:[(0,i.tZ)(eF,{session:e}),!t&&(0,i.tZ)(eE,{revoke:a})]})})},eF=e=>{let{session:t}=(0,f.kP)(),r=t?.id===e.session.id,o=!!t?.actor,a=!!e.session.actor,{city:l,country:n,browserName:s,browserVersion:c,deviceType:u,ipAddress:h,isMobile:m}=e.session.latestActivity,p=`${s||""} ${c||""}`.trim()||"Web browser",g=[l||"",n||""].filter(Boolean).join(", ").trim()||null,{t:y}=(0,d.useLocalizations)();return(0,i.BX)(d.Flex,{elementDescriptor:d.descriptors.activeDevice,elementId:r?d.descriptors.activeDevice.setId("current"):void 0,sx:e=>({width:"100%",overflow:"hidden",gap:e.space.$4,[ec.mqu.sm]:{gap:e.space.$2}}),children:[(0,i.tZ)(d.Flex,{sx:e=>({[ec.mqu.sm]:{padding:"0"},borderRadius:e.radii.$md}),children:(0,i.tZ)(d.Icon,{elementDescriptor:d.descriptors.activeDeviceIcon,elementId:d.descriptors.activeDeviceIcon.setId(m?"mobile":"desktop"),icon:m?eT.Fh:eT.eu,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.BX)(d.Col,{align:"start",gap:1,children:[(0,i.BX)(d.Flex,{center:!0,gap:2,children:[(0,i.tZ)(d.Text,{children:u||(m?"Mobile device":"Desktop device")}),r&&(0,i.tZ)(d.Badge,{localizationKey:(0,d.localizationKeys)("badge__thisDevice"),colorScheme:o?"danger":"primary"}),o&&!a&&(0,i.tZ)(d.Badge,{localizationKey:(0,d.localizationKeys)("badge__userDevice")}),!r&&a&&(0,i.tZ)(d.Badge,{localizationKey:(0,d.localizationKeys)("badge__otherImpersonatorDevice"),colorScheme:"danger"})]}),(0,i.tZ)(d.Text,{colorScheme:"secondary",children:p}),(0,i.BX)(d.Text,{colorScheme:"secondary",children:[h," (",g,")"]}),(0,i.tZ)(d.Text,{colorScheme:"secondary",children:y((0,eA.Q)(e.session.lastActiveAt))})]})]})},eE=({revoke:e})=>{let t=[{label:(0,d.localizationKeys)("userProfile.start.activeDevicesSection.destructiveAction"),isDestructive:!0,onClick:e}].filter(e=>null!==e);return(0,i.tZ)(P.a,{actions:t})};var eD=r(54264);let eO=(0,a.withCardStateProvider)(e=>{let{onReset:t}=e,r=(0,a.useCardState)(),{afterSignOutUrl:o,afterMultiSessionSingleSignOutUrl:l}=(0,c.useSignOutContext)(),{user:n}=(0,f.aF)(),{t:s}=(0,d.useLocalizations)(),{otherSessions:u}=(0,eD.j)({user:n}),{setActive:h}=(0,f.cL)(),m=(0,f.WZ)(()=>n?.delete()),p=(0,ee.Yp)("deleteConfirmation","",{type:"text",label:(0,d.localizationKeys)("userProfile.deletePage.actionDescription"),isRequired:!0,placeholder:(0,d.localizationKeys)("formFieldInputPlaceholder__confirmDeletionUserAccount")}),g=p.value===(s((0,d.localizationKeys)("formFieldInputPlaceholder__confirmDeletionUserAccount"))||"Delete account"),y=async()=>{if(g)try{await m();let e=0===u.length?o:l;return await h({session:null,redirectUrl:e})}catch(e){(0,Z.S3)(e,[],r.setError)}};return(0,i.tZ)(J.Y,{headerTitle:(0,d.localizationKeys)("userProfile.deletePage.title"),sx:e=>({gap:e.space.$0x5}),children:(0,i.BX)(Q.l.Root,{onSubmit:y,children:[(0,i.BX)(d.Col,{gap:1,children:[(0,i.tZ)(d.Text,{colorScheme:"secondary",localizationKey:(0,d.localizationKeys)("userProfile.deletePage.messageLine1")}),(0,i.tZ)(d.Text,{colorScheme:"danger",localizationKey:(0,d.localizationKeys)("userProfile.deletePage.messageLine2")})]}),(0,i.tZ)(Q.l.ControlRow,{elementId:p.id,children:(0,i.tZ)(Q.l.PlainInput,{...p.props,ignorePasswordManager:!0})}),(0,i.tZ)(G.A,{submitLabel:(0,d.localizationKeys)("userProfile.deletePage.confirm"),colorScheme:"danger",isDisabled:!g,onReset:t})]})})}),eN=()=>{let{close:e}=(0,C.XC)();return(0,i.tZ)(eO,{onSuccess:e,onReset:e})},eW=()=>(0,i.tZ)(v.zd.Root,{title:(0,d.localizationKeys)("userProfile.start.dangerSection.title"),id:"danger",sx:{alignItems:"center",[ec.mqu.md]:{alignItems:"flex-start"}},children:(0,i.BX)(S.a.Root,{children:[(0,i.tZ)(S.a.Closed,{value:"delete",children:(0,i.tZ)(v.zd.Item,{id:"danger",sx:e=>({paddingLeft:e.space.$1}),children:(0,i.tZ)(S.a.Trigger,{value:"delete",children:(0,i.tZ)(v.zd.Button,{id:"danger",variant:"ghost",colorScheme:"danger",localizationKey:(0,d.localizationKeys)("userProfile.start.dangerSection.deleteAccountButton")})})})}),(0,i.tZ)(S.a.Open,{value:"delete",children:(0,i.tZ)(S.a.Card,{variant:"destructive",children:(0,i.tZ)(eN,{})})})]})});var eM=r(5994),eU=r(85838);let eY=(0,a.withCardStateProvider)(e=>{let{onSuccess:t,onReset:r}=e,{user:l}=(0,f.aF)(),n=(0,a.useCardState)(),s=(0,f.WZ)(()=>l?.createBackupCode()),[c,u]=o.useState(void 0);return(o.useEffect(()=>{!c&&l&&s().then(e=>u(e)).catch(e=>{if((0,ez.mh)(e))return r();(0,Z.S3)(e,[],n.setError)})},[]),n.error)?(0,i.tZ)(J.Y,{headerTitle:(0,d.localizationKeys)("userProfile.backupCodePage.title")}):(0,i.tZ)(J.Y,{headerTitle:(0,d.localizationKeys)("userProfile.backupCodePage.title"),children:c?(0,i.BX)(i.HY,{children:[(0,i.tZ)(d.Text,{localizationKey:(0,d.localizationKeys)("userProfile.backupCodePage.successMessage")}),(0,i.tZ)(eU.j,{subtitle:(0,d.localizationKeys)("userProfile.backupCodePage.subtitle__codelist"),backupCodes:c.codes}),(0,i.tZ)(G.K,{children:(0,i.tZ)(d.Button,{autoFocus:!0,onClick:t,localizationKey:(0,d.localizationKeys)("userProfile.formButtonPrimary__finish"),elementDescriptor:d.descriptors.formButtonPrimary})})]}):(0,i.tZ)(eI.m,{})})}),eq=(0,a.withCardStateProvider)(e=>{let{onSuccess:t,onReset:r}=e,o=(0,z.a2)();return(0,i.BX)(z.en,{...o.props,children:[(0,i.tZ)(ej,{onContinue:o.nextStep}),(0,i.tZ)(eY,{onSuccess:t,onReset:r})]})}),ej=e=>{let{onContinue:t}=e,{close:r}=(0,C.XC)();return(0,i.BX)(J.Y,{headerTitle:(0,d.localizationKeys)("userProfile.backupCodePage.title"),children:[(0,i.tZ)(d.Text,{localizationKey:(0,d.localizationKeys)("userProfile.backupCodePage.infoText1")}),(0,i.tZ)(d.Text,{localizationKey:(0,d.localizationKeys)("userProfile.backupCodePage.infoText2")}),(0,i.BX)(G.K,{sx:{marginTop:0},children:[(0,i.tZ)(d.Button,{textVariant:"buttonSmall",onClick:t,localizationKey:(0,d.localizationKeys)("userProfile.formButtonPrimary__finish"),elementDescriptor:d.descriptors.formButtonPrimary}),(0,i.tZ)(d.Button,{variant:"ghost",onClick:r,localizationKey:(0,d.localizationKeys)("userProfile.formButtonReset"),elementDescriptor:d.descriptors.formButtonReset})]})]})};var eH=r(53412),eV=r(67263);let eQ=(0,a.withCardStateProvider)(e=>{let{onReset:t,onSuccess:r}=e,a=o.useRef(),l=(0,z.a2)({defaultStep:2}),n=(0,c.useEnvironment)().userSettings.attributes.backup_code?.enabled;return(0,i.BX)(z.en,{...l.props,children:[(0,i.tZ)(ei,{title:(0,d.localizationKeys)("userProfile.phoneNumberPage.title"),resourceRef:a,onSuccess:l.nextStep,onUseExistingNumberClick:()=>l.goToStep(2),onReset:t}),(0,i.tZ)(eJ,{title:(0,d.localizationKeys)("userProfile.mfaPhoneCodePage.title"),resourceRef:a,onSuccess:()=>n?l.goToStep(3):r(),onReset:()=>l.goToStep(2)}),(0,i.tZ)(e0,{onSuccess:n?l.nextStep:r,onReset:t,onAddPhoneClick:()=>l.goToStep(0),onUnverifiedPhoneClick:e=>{a.current=e,l.goToStep(1)},title:(0,d.localizationKeys)("userProfile.mfaPhoneCodePage.title"),resourceRef:a}),n&&(0,i.tZ)(eV.I,{title:(0,d.localizationKeys)("userProfile.mfaPhoneCodePage.successTitle"),text:a.current?.backupCodes&&a.current?.backupCodes.length>0?[(0,d.localizationKeys)("userProfile.mfaPhoneCodePage.successMessage1"),(0,d.localizationKeys)("userProfile.mfaPhoneCodePage.successMessage2")]:[(0,d.localizationKeys)("userProfile.mfaPhoneCodePage.successMessage1")],onFinish:t,contents:(0,i.tZ)(eU.j,{backupCodes:a.current?.backupCodes})})]})}),eG=e=>{let{phone:t,onSuccess:r,onUnverifiedPhoneClick:o,resourceRef:l}=e,n=(0,a.useCardState)(),s=(0,f.WZ)(()=>t.setReservedForSecondFactor({reserved:!0})),{country:c}=(0,V.Z_)(t.phoneNumber),u=(0,V.L_)(t.phoneNumber),h=async()=>{if("verified"!==t.verification.status)return o(t);n.setLoading(t.id);try{await s(),l.current=t,r()}catch(e){(0,Z.S3)(e,[],n.setError)}finally{n.setIdle()}};return(0,i.BX)(d.Button,{variant:"outline",colorScheme:"neutral",sx:{justifyContent:"start"},onClick:h,isLoading:n.loadingMetadata===t.id,isDisabled:n.isLoading,children:[c.iso.toUpperCase()," ",u]},t.id)},eJ=e=>{let{title:t,onSuccess:r,resourceRef:o,onReset:l}=e,n=(0,a.useCardState)(),s=o.current,c=(0,f.WZ)(()=>s?.setReservedForSecondFactor({reserved:!0})),u=async()=>{n.setLoading(s?.id);try{await c(),o.current=s,r()}catch(e){(0,Z.S3)(e,[],n.setError)}finally{n.setIdle()}};return(0,i.tZ)(J.Y,{headerTitle:t,headerSubtitle:(0,d.localizationKeys)("userProfile.phoneNumberPage.verifySubtitle",{identifier:o.current?.phoneNumber||""}),children:(0,i.tZ)(et.H,{nextStep:()=>{u()},identification:o.current,identifier:o.current?.phoneNumber,prepareVerification:o.current?.prepareVerification,onReset:l})})},e0=e=>{let{onSuccess:t,onReset:r,title:o,onAddPhoneClick:a,onUnverifiedPhoneClick:l,resourceRef:n}=e,{user:s}=(0,f.aF)();if(!s)return null;let c=s.phoneNumbers.filter(e=>!e.reservedForSecondFactor);return(0,i.BX)(J.Y,{headerTitle:o,gap:1,children:[(0,i.tZ)(d.Text,{localizationKey:(0,d.localizationKeys)(c.length?"userProfile.mfaPhoneCodePage.subtitle__availablePhoneNumbers":"userProfile.mfaPhoneCodePage.subtitle__unavailablePhoneNumbers"),colorScheme:"secondary"}),c.length>0&&(0,i.tZ)(d.Col,{gap:2,children:c.map(e=>(0,i.tZ)(eG,{onSuccess:t,phone:e,onUnverifiedPhoneClick:l,resourceRef:n},e.id))}),(0,i.BX)(G.K,{sx:{flexDirection:"row",justifyContent:"space-between"},children:[(0,i.tZ)(eH.h,{variant:"ghost","aria-label":"Add phone number",icon:(0,i.tZ)(d.Icon,{icon:eT.v3,sx:e=>({marginRight:e.space.$2})}),localizationKey:(0,d.localizationKeys)("userProfile.mfaPhoneCodePage.primaryButton__addPhoneNumber"),onClick:a}),(0,i.tZ)(d.Button,{variant:"ghost",localizationKey:(0,d.localizationKeys)("userProfile.formButtonReset"),onClick:r})]})]})};var e1=r(68864);let e3=(0,a.withCardStateProvider)(e=>{let{title:t,onSuccess:r,onReset:l}=e,{user:n}=(0,f.aF)(),s=(0,a.useCardState)(),c=(0,f.WZ)(()=>n?.createTOTP()),{close:u}=(0,C.XC)(),[h,m]=o.useState(void 0),[p,g]=o.useState("qr");return(o.useEffect(()=>{n&&c().then(e=>m(e)).catch(e=>(0,ez.uX)(e)&&"reverification_cancelled"===e.code?u():(0,Z.S3)(e,[],s.setError))},[]),s.error)?(0,i.tZ)(J.Y,{headerTitle:t}):(0,i.BX)(J.Y,{headerTitle:t,headerSubtitle:"qr"==p?(0,d.localizationKeys)("userProfile.mfaTOTPPage.authenticatorApp.infoText__ableToScan"):(0,d.localizationKeys)("userProfile.mfaTOTPPage.authenticatorApp.infoText__unableToScan"),children:[!h&&(0,i.tZ)(eI.m,{}),h&&(0,i.BX)(i.HY,{children:[(0,i.BX)(d.Col,{gap:4,children:["qr"==p&&(0,i.tZ)(z.s_,{justify:"center",url:h.uri||""}),"uri"==p&&(0,i.BX)(i.HY,{children:[(0,i.tZ)(d.Text,{colorScheme:"secondary",localizationKey:(0,d.localizationKeys)("userProfile.mfaTOTPPage.authenticatorApp.inputLabel__unableToScan1")}),(0,i.tZ)(e1.D,{value:h.secret}),(0,i.tZ)(d.Text,{colorScheme:"secondary",localizationKey:(0,d.localizationKeys)("userProfile.mfaTOTPPage.authenticatorApp.inputLabel__unableToScan2")}),(0,i.tZ)(e1.D,{value:h.uri})]})]}),(0,i.BX)(d.Flex,{justify:"between",align:"center",sx:{width:"100%"},children:["qr"==p&&(0,i.tZ)(d.Button,{variant:"link",textVariant:"buttonLarge",onClick:()=>g("uri"),localizationKey:(0,d.localizationKeys)("userProfile.mfaTOTPPage.authenticatorApp.buttonUnableToScan__nonPrimary")}),"uri"==p&&(0,i.tZ)(d.Button,{variant:"link",textVariant:"buttonLarge",onClick:()=>g("qr"),localizationKey:(0,d.localizationKeys)("userProfile.mfaTOTPPage.authenticatorApp.buttonAbleToScan__nonPrimary")}),(0,i.BX)(G.K,{children:[(0,i.tZ)(d.Button,{onClick:r,localizationKey:(0,d.localizationKeys)("userProfile.formButtonPrimary__continue"),elementDescriptor:d.descriptors.formButtonPrimary}),(0,i.tZ)(d.Button,{variant:"ghost",onClick:l,localizationKey:(0,d.localizationKeys)("userProfile.formButtonReset"),elementDescriptor:d.descriptors.formButtonReset})]})]})]})]})});var e2=r(12667);let e4=(0,a.withCardStateProvider)(e=>{let{onSuccess:t,onReset:r,resourceRef:o}=e,{user:a}=(0,f.aF)(),l=(0,e2.e3)({onCodeEntryFinished:(e,t,r)=>{a?.verifyTOTP({code:e}).then(e=>t(e)).catch(r)},onResolve:e=>{o.current=e,t()}});return(0,i.BX)(J.Y,{headerTitle:(0,d.localizationKeys)("userProfile.mfaTOTPPage.title"),children:[(0,i.tZ)(d.Col,{children:(0,i.tZ)(Q.l.OTPInput,{...l,label:(0,d.localizationKeys)("userProfile.mfaTOTPPage.verifyTitle"),description:(0,d.localizationKeys)("userProfile.mfaTOTPPage.verifySubtitle")})}),(0,i.tZ)(G.K,{sx:{marginTop:0},children:(0,i.tZ)(d.Button,{onClick:r,variant:"ghost",isDisabled:l.isLoading,localizationKey:(0,d.localizationKeys)("userProfile.formButtonReset"),elementDescriptor:d.descriptors.formButtonReset})})]})}),e6=(0,a.withCardStateProvider)(e=>{let{onReset:t}=e,r=(0,z.a2)(),a=o.useRef();return(0,i.BX)(z.en,{...r.props,children:[(0,i.tZ)(e3,{title:(0,d.localizationKeys)("userProfile.mfaTOTPPage.title"),onSuccess:r.nextStep,onReset:t}),(0,i.tZ)(e4,{onSuccess:r.nextStep,onReset:t,resourceRef:a}),(0,i.tZ)(eV.I,{title:(0,d.localizationKeys)("userProfile.mfaTOTPPage.title"),text:(0,d.localizationKeys)("userProfile.mfaTOTPPage.successMessage"),onFinish:t,contents:(0,i.tZ)(eU.j,{subtitle:(0,d.localizationKeys)("userProfile.backupCodePage.successSubtitle"),backupCodes:a.current?.backupCodes})})]})});var e7=r(85390);let e5=(0,a.withCardStateProvider)(e=>{let{onSuccess:t,onReset:r,selectedStrategy:l}=e,n=(0,a.useCardState)(),{userSettings:{attributes:s}}=(0,c.useEnvironment)(),{user:u}=(0,f.aF)();if(!u)return null;let h=(0,d.localizationKeys)("userProfile.mfaPage.title"),m=o.useMemo(()=>(0,e7.kZ)(s,u),[]);return(o.useEffect(()=>{0===m.length&&n.setError("There are no second factors available to add")},[]),n.error)?(0,i.tZ)(J.Y,{headerTitle:h}):0!==m.length||l?(0,i.tZ)(e9,{onSuccess:t,onReset:r,method:l||m[0]}):null}),e9=e=>{let{method:t,onSuccess:r,onReset:o}=e;switch(t){case"phone_code":return(0,i.tZ)(eQ,{onSuccess:r,onReset:o});case"totp":return(0,i.tZ)(e6,{onSuccess:r,onReset:o});case"backup_code":return(0,i.tZ)(eq,{onSuccess:r,onReset:o});default:return null}},e8=()=>{let{close:e}=(0,C.XC)();return(0,i.tZ)(T,{onSuccess:e,onReset:e})},te=e=>{let{close:t}=(0,C.XC)();return(0,i.tZ)(A,{onSuccess:t,onReset:t,...e})},tt=()=>{let{close:e}=(0,C.XC)();return(0,i.tZ)(eY,{onSuccess:e,onReset:e})},tr=e=>{let{close:t}=(0,C.XC)();return(0,i.tZ)(e5,{onSuccess:t,onReset:t,selectedStrategy:e.selectedStrategy})},ti=()=>{let{userSettings:{attributes:e,signUp:t}}=(0,c.useEnvironment)(),{user:r}=(0,f.aF)(),[a,l]=(0,o.useState)(null);if(!r)return null;let n=(0,e7.mG)(e),s=(0,e7.kZ)(e,r),u=n.includes("totp")&&r.totpEnabled,h=n.includes("backup_code")&&r.backupCodeEnabled,m=n.includes("phone_code"),p=r.phoneNumbers.filter(e=>"verified"===e.verification.status).filter(e=>e.reservedForSecondFactor).sort(e7.Oy),g=!!(t.mfa?.required&&0===p.length),y=!!(t.mfa?.required&&!u&&1===p.length);return(0,i.tZ)(v.zd.Root,{title:(0,d.localizationKeys)("userProfile.start.mfaSection.title"),centered:!1,id:"mfa",children:(0,i.tZ)(S.a.Root,{value:a,onChange:l,children:(0,i.BX)(v.zd.ItemList,{id:"mfa",children:[u&&(0,i.BX)(i.HY,{children:[(0,i.BX)(v.zd.Item,{id:"mfa",hoverable:!0,children:[(0,i.BX)(d.Flex,{sx:e=>({gap:e.space.$2,alignItems:"center"}),children:[(0,i.tZ)(d.Icon,{icon:eT.hc,sx:e=>({color:e.colors.$neutralAlpha700})}),(0,i.tZ)(d.Text,{localizationKey:(0,d.localizationKeys)("userProfile.start.mfaSection.totp.headerTitle")}),(0,i.tZ)(d.Badge,{localizationKey:(0,d.localizationKeys)("badge__default")})]}),!g&&(0,i.tZ)(tl,{})]}),(0,i.tZ)(S.a.Open,{value:"remove-totp",children:(0,i.tZ)(S.a.Card,{variant:"destructive",children:(0,i.tZ)(e8,{})})})]}),m&&p.map(e=>{let t=!u&&e.defaultSecondFactor,r=e.id;return(0,i.BX)(o.Fragment,{children:[(0,i.BX)(v.zd.Item,{id:"mfa",hoverable:!0,children:[(0,i.BX)(d.Flex,{sx:e=>({gap:e.space.$2,alignItems:"center"}),children:[(0,i.tZ)(d.Icon,{icon:eT.ij,sx:e=>({color:e.colors.$neutralAlpha700})}),(0,i.BX)(d.Text,{children:["SMS Code ",(0,i.tZ)(eM.q,{value:e.phoneNumber})]}),t&&(0,i.tZ)(d.Badge,{localizationKey:(0,d.localizationKeys)("badge__default")})]}),(0,i.tZ)(to,{phone:e,isDefault:t,hidePhoneCodeDeleteAction:y})]}),(0,i.tZ)(S.a.Open,{value:`remove-${r}`,children:(0,i.tZ)(S.a.Card,{variant:"destructive",children:(0,i.tZ)(te,{phoneId:r})})})]},r)}),h&&(0,i.BX)(i.HY,{children:[(0,i.BX)(v.zd.Item,{id:"mfa",hoverable:!0,children:[(0,i.BX)(d.Flex,{sx:e=>({gap:e.space.$2,alignItems:"center"}),children:[(0,i.tZ)(d.Icon,{icon:eT.Qi,sx:e=>({color:e.colors.$neutralAlpha700})}),(0,i.tZ)(d.Text,{localizationKey:(0,d.localizationKeys)("userProfile.start.mfaSection.backupCodes.headerTitle")})]}),(0,i.tZ)(ta,{})]}),(0,i.tZ)(S.a.Open,{value:"regenerate",children:(0,i.tZ)(S.a.Card,{children:(0,i.tZ)(tt,{})})})]}),(0,i.tZ)(ts,{secondFactorsAvailableToAdd:s,onClick:()=>l(null)})]})})})},to=({phone:e,isDefault:t,hidePhoneCodeDeleteAction:r})=>{let{open:o}=(0,C.XC)(),l=(0,a.useCardState)(),n=e.id,s=[!t?{label:(0,d.localizationKeys)("userProfile.start.mfaSection.phoneCode.actionLabel__setDefault"),onClick:()=>e.makeDefaultSecondFactor().catch(e=>(0,Z.S3)(e,[],l.setError))}:null,!r?{label:(0,d.localizationKeys)("userProfile.start.mfaSection.phoneCode.destructiveActionLabel"),isDestructive:!0,onClick:()=>o(`remove-${n}`)}:null].filter(e=>null!==e);return 0===s.length?null:(0,i.tZ)(P.a,{actions:s})},ta=()=>{let{open:e}=(0,C.XC)(),t=[{label:(0,d.localizationKeys)("userProfile.start.mfaSection.backupCodes.actionLabel__regenerate"),onClick:()=>e("regenerate")}].filter(e=>null!==e);return(0,i.tZ)(P.a,{actions:t})},tl=()=>{let{open:e}=(0,C.XC)(),t=[{label:(0,d.localizationKeys)("userProfile.start.mfaSection.totp.destructiveActionTitle"),isDestructive:!0,onClick:()=>e("remove-totp")}].filter(e=>null!==e);return(0,i.tZ)(P.a,{actions:t})},tn={phone_code:{icon:eT.ij,text:"SMS code",key:"phone_code"},totp:{icon:eT.hc,text:"Authenticator application",key:"totp"},backup_code:{icon:eT.Qi,text:"Backup code",key:"backup_code"}},ts=e=>{let{open:t}=(0,C.XC)(),{secondFactorsAvailableToAdd:r,onClick:a}=e,[l,n]=(0,o.useState)(),s=o.useMemo(()=>r.map(e=>tn[e]||null).filter(e=>null!==e),[r]);return(0,i.BX)(i.HY,{children:[r.length>0&&(0,i.tZ)(S.a.Closed,{value:"multi-factor",children:(0,i.tZ)(v.zd.ActionMenu,{id:"mfa",triggerLocalizationKey:(0,d.localizationKeys)("userProfile.start.mfaSection.primaryButton"),onClick:a,children:s.map(e=>(0,i.tZ)(v.zd.ActionMenuItem,{id:e.key,localizationKey:e.text,leftIcon:e.icon,onClick:()=>{n(e.key),t("multi-factor")}},e.key))})}),(0,i.tZ)(S.a.Open,{value:"multi-factor",children:(0,i.tZ)(S.a.Card,{children:l&&(0,i.tZ)(tr,{selectedStrategy:l})})})]})},tc=e=>{let{close:t}=(0,C.XC)();return(0,i.tZ)(X,{onSuccess:t,onReset:t,...e})},td=e=>{let{close:t}=(0,C.XC)();return(0,i.tZ)(tu,{onSuccess:t,onReset:t,passkey:e.passkey})},tu=(0,a.withCardStateProvider)(e=>{let{onSuccess:t,onReset:r,passkey:o}=e,l=(0,a.useCardState)(),n=(0,ee.Yp)("passkeyName",o.name||"",{type:"text",label:(0,d.localizationKeys)("formFieldLabel__passkeyName"),isRequired:!0}),s=n.value.length>1&&o.name!==n.value,c=async e=>(e.preventDefault(),o.update({name:n.value}).then(t).catch(e=>(0,Z.S3)(e,[n],l.setError)));return(0,i.tZ)(J.Y,{headerTitle:(0,d.localizationKeys)("userProfile.passkeyScreen.title__rename"),headerSubtitle:(0,d.localizationKeys)("userProfile.passkeyScreen.subtitle__rename"),children:(0,i.BX)(Q.l.Root,{onSubmit:c,children:[(0,i.tZ)(Q.l.ControlRow,{elementId:n.id,children:(0,i.tZ)(Q.l.PlainInput,{...n.props,autoComplete:"off"})}),(0,i.tZ)(G.A,{submitLabel:(0,d.localizationKeys)("userProfile.formButtonPrimary__save"),isDisabled:!s,onReset:r})]})})}),th=()=>{let{user:e}=(0,f.aF)(),[t,r]=(0,o.useState)(null);return e?(0,i.tZ)(v.zd.Root,{title:(0,d.localizationKeys)("userProfile.start.passkeysSection.title"),centered:!1,id:"passkeys",children:(0,i.tZ)(S.a.Root,{value:t,onChange:r,children:(0,i.BX)(v.zd.ItemList,{id:"passkeys",children:[e.passkeys.map(e=>{let t=e.id;return(0,i.BX)(o.Fragment,{children:[(0,i.tZ)(tm,{...e},t),(0,i.tZ)(S.a.Open,{value:`remove-${t}`,children:(0,i.tZ)(S.a.Card,{variant:"destructive",children:(0,i.tZ)(tc,{passkey:e})})}),(0,i.tZ)(S.a.Open,{value:`rename-${t}`,children:(0,i.tZ)(S.a.Card,{children:(0,i.tZ)(td,{passkey:e})})})]},t)}),(0,i.tZ)(tg,{onClick:()=>r(null)})]})})}):null},tm=e=>(0,i.BX)(v.zd.Item,{id:"passkeys",hoverable:!0,sx:{alignItems:"flex-start"},children:[(0,i.tZ)(tp,{...e}),(0,i.tZ)(tf,{passkey:e})]}),tp=e=>{let{name:t,createdAt:r,lastUsedAt:o}=e,{t:a}=(0,d.useLocalizations)();return(0,i.tZ)(d.Flex,{sx:e=>({width:"100%",overflow:"hidden",gap:e.space.$4,[ec.mqu.sm]:{gap:e.space.$2}}),children:(0,i.BX)(d.Col,{align:"start",gap:1,children:[(0,i.tZ)(d.Text,{children:t}),(0,i.BX)(d.Text,{colorScheme:"secondary",children:["Created: ",a((0,eA.Q)(r))]}),o&&(0,i.BX)(d.Text,{colorScheme:"secondary",children:["Last used: ",a((0,eA.Q)(o))]})]})})},tf=({passkey:e})=>{let{open:t}=(0,C.XC)(),r=e.id,o=[{label:(0,d.localizationKeys)("userProfile.start.passkeysSection.menuAction__rename"),onClick:()=>t(`rename-${r}`)},{label:(0,d.localizationKeys)("userProfile.start.passkeysSection.menuAction__destructive"),isDestructive:!0,onClick:()=>t(`remove-${r}`)}];return(0,i.tZ)(P.a,{actions:o})},tg=({onClick:e})=>{let t=(0,a.useCardState)(),{isSatellite:r}=(0,f.cL)(),{user:o}=(0,f.aF)(),l=(0,f.WZ)(()=>o?.createPasskey()),n=async()=>{if(e?.(),o)try{await l()}catch(e){(0,Z.S3)(e,[],t.setError)}};return r?null:(0,i.tZ)(v.zd.ArrowButton,{id:"passkeys",localizationKey:(0,d.localizationKeys)("userProfile.start.passkeysSection.primaryButton"),onClick:n})};var ty=r(86842);let tv=(0,a.withCardStateProvider)(e=>{let{onSuccess:t,onReset:r}=e,{user:l}=(0,f.aF)(),n=(0,f.WZ)((e,t)=>e.updatePassword(...t));if(!l)return null;let{userSettings:{passwordSettings:s},authConfig:{reverification:u}}=(0,c.useEnvironment)(),{session:h}=(0,f.kP)(),m=l.passwordEnabled?(0,d.localizationKeys)("userProfile.passwordPage.title__update"):(0,d.localizationKeys)("userProfile.passwordPage.title__set"),p=(0,a.useCardState)(),g=l.enterpriseAccounts.some(e=>e.active),y=l.passwordEnabled&&!u,v=(0,o.useRef)({title:(0,d.localizationKeys)("userProfile.passwordPage.title__set")}),P=(0,ee.Yp)("currentPassword","",{type:"password",label:(0,d.localizationKeys)("formFieldLabel__currentPassword"),isRequired:!0}),b=(0,ee.Yp)("newPassword","",{type:"password",label:(0,d.localizationKeys)("formFieldLabel__newPassword"),isRequired:!0,validatePassword:!0,buildErrorMessage:e=>(0,ty.GM)(e,{t:R,locale:x,passwordSettings:s})}),z=(0,ee.Yp)("confirmPassword","",{type:"password",label:(0,d.localizationKeys)("formFieldLabel__confirmPassword"),isRequired:!0}),S=(0,ee.Yp)("signOutOfOtherSessions","",{type:"checkbox",label:(0,d.localizationKeys)("formFieldLabel__signOutOfOtherSessions"),defaultChecked:!0}),{setConfirmPasswordFeedback:C,isPasswordMatch:_}=(0,K.p5)({passwordField:b,confirmPasswordField:z}),{t:R,locale:x}=(0,d.useLocalizations)(),B=(y?P.value&&_:_)&&b.value&&z.value,w=async()=>{try{v.current={title:l.passwordEnabled?(0,d.localizationKeys)("userProfile.passwordPage.title__update"):(0,d.localizationKeys)("userProfile.passwordPage.title__set"),text:((e,t)=>{let r=[];return e?r.push((0,d.localizationKeys)("userProfile.passwordPage.successMessage__update")):r.push((0,d.localizationKeys)("userProfile.passwordPage.successMessage__set")),t&&r.push((0,d.localizationKeys)("userProfile.passwordPage.successMessage__signOutOfOtherSessions")),r})(l.passwordEnabled,!!S.checked)};let e={newPassword:b.value,signOutOfOtherSessions:S.checked,currentPassword:y?P.value:void 0};await n(l,[e]),t()}catch(e){(0,Z.S3)(e,[P,b,z],p.setError)}};return(0,i.BX)(J.Y,{headerTitle:m,children:[g&&(0,i.tZ)(ef.e,{message:(0,d.localizationKeys)("userProfile.passwordPage.readonly")}),(0,i.BX)(Q.l.Root,{onSubmit:w,onBlur:()=>{b.value&&C(z.value)},children:[(0,i.tZ)("input",{readOnly:!0,"data-testid":"hidden-identifier",id:"identifier-field",name:"identifier",value:h?.publicUserData.identifier||"",style:{display:"none"}}),y&&(0,i.tZ)(Q.l.ControlRow,{elementId:P.id,children:(0,i.tZ)(Q.l.PasswordInput,{...P.props,minLength:6,isRequired:!0,autoFocus:!0,isDisabled:g})}),(0,i.tZ)(Q.l.ControlRow,{elementId:b.id,children:(0,i.tZ)(Q.l.PasswordInput,{...b.props,minLength:6,isRequired:!0,autoFocus:!l.passwordEnabled,isDisabled:g})}),(0,i.tZ)(Q.l.ControlRow,{elementId:z.id,children:(0,i.tZ)(Q.l.PasswordInput,{...z.props,onChange:e=>(e.target.value&&C(e.target.value),z.props.onChange(e)),isRequired:!0,isDisabled:g})}),(0,i.tZ)(Q.l.ControlRow,{elementId:S.id,children:(0,i.tZ)(Q.l.Checkbox,{...S.props,description:(0,d.localizationKeys)("userProfile.passwordPage.checkboxInfoText__signOutOfOtherSessions"),isDisabled:g})}),g?(0,i.tZ)(G.K,{children:(0,i.tZ)(Q.l.ResetButton,{localizationKey:(0,d.localizationKeys)("userProfile.formButtonReset"),block:!1,onClick:r})}):(0,i.tZ)(G.A,{isDisabled:!B,onReset:r})]})]})}),tP=()=>{let{close:e}=(0,C.XC)();return(0,i.tZ)(tv,{onSuccess:e,onReset:e})},tZ=()=>{let{user:e}=(0,f.aF)();if(!e)return null;let{passwordEnabled:t}=e;return(0,i.tZ)(v.zd.Root,{centered:!1,title:(0,d.localizationKeys)("userProfile.start.passwordSection.title"),id:"password",children:(0,i.BX)(S.a.Root,{children:[(0,i.tZ)(S.a.Closed,{value:"edit",children:(0,i.BX)(v.zd.Item,{id:"password",sx:e=>({paddingLeft:t?void 0:"0",paddingTop:e.space.$0x25,paddingBottom:e.space.$0x25}),children:[t&&(0,i.tZ)(d.Text,{variant:"h2",children:"••••••••••"}),(0,i.tZ)(S.a.Trigger,{value:"edit",children:(0,i.tZ)(v.zd.Button,{id:"password",localizationKey:t?(0,d.localizationKeys)("userProfile.start.passwordSection.primaryButton__updatePassword"):(0,d.localizationKeys)("userProfile.start.passwordSection.primaryButton__setPassword")})})]})}),(0,i.tZ)(S.a.Open,{value:"edit",children:(0,i.tZ)(S.a.Card,{children:(0,i.tZ)(tP,{})})})]})})},tb=(0,a.withCardStateProvider)(()=>{let{attributes:e,instanceIsPasswordBased:t}=(0,c.useEnvironment)().userSettings,r=(0,a.useCardState)(),{user:o}=(0,f.aF)(),{shouldAllowIdentificationCreation:l}=(0,c.useUserProfileContext)(),n=e.passkey?.enabled&&l,s=(0,e7.mG)(e).length>0,u=o?.deleteSelfEnabled;return(0,i.tZ)(d.Col,{elementDescriptor:d.descriptors.page,sx:e=>({gap:e.space.$8}),children:(0,i.BX)(d.Col,{elementDescriptor:d.descriptors.profilePage,elementId:d.descriptors.profilePage.setId("security"),children:[(0,i.tZ)(y.h.Root,{children:(0,i.tZ)(y.h.Title,{localizationKey:(0,d.localizationKeys)("userProfile.start.headerTitle__security"),sx:e=>({marginBottom:e.space.$4}),textVariant:"h2"})}),(0,i.tZ)(g.Z.Alert,{children:r.error}),t&&(0,i.tZ)(tZ,{}),n&&(0,i.tZ)(th,{}),s&&(0,i.tZ)(ti,{}),(0,i.tZ)(eX,{}),u&&(0,i.tZ)(eW,{})]})})}),tz=(0,o.lazy)(()=>Promise.all([r.e("9573"),r.e("5645"),r.e("7502"),r.e("82")]).then(r.bind(r,41470)).then(e=>({default:e.BillingPage}))),tS=(0,o.lazy)(()=>Promise.all([r.e("9573"),r.e("4616"),r.e("2809")]).then(r.bind(r,38595)).then(e=>({default:e.APIKeysPage}))),tC=(0,o.lazy)(()=>Promise.all([r.e("9573"),r.e("4170"),r.e("99")]).then(r.bind(r,83487)).then(e=>({default:e.PlansPage}))),tK=(0,o.lazy)(()=>Promise.all([r.e("9573"),r.e("5645"),r.e("9177")]).then(r.bind(r,15515)).then(e=>({default:e.StatementPage}))),t_=(0,o.lazy)(()=>Promise.all([r.e("9573"),r.e("8711")]).then(r.bind(r,12264)).then(e=>({default:e.PaymentAttemptPage}))),tR=()=>{let{pages:e,shouldShowBilling:t,apiKeysProps:r}=(0,c.useUserProfileContext)(),{apiKeysSettings:a,commerceSettings:l}=(0,c.useEnvironment)(),n=e.routes[0].id===s.xM.ACCOUNT,d=e.routes[0].id===s.xM.SECURITY,h=e.routes[0].id===s.xM.BILLING,m=e.routes[0].id===s.xM.API_KEYS,f=e.contents?.map((e,t)=>{let r=!n&&!d&&0===t;return(0,i.tZ)(u.Route,{index:r,path:r?void 0:e.url,children:(0,i.tZ)(p.O,{mount:e.mount,unmount:e.unmount})},`custom-page-${e.url}`)});return(0,i.BX)(u.Switch,{children:[f,(0,i.BX)(u.Route,{children:[(0,i.tZ)(u.Route,{path:n?void 0:"account",children:(0,i.tZ)(u.Switch,{children:(0,i.tZ)(u.Route,{index:!0,children:(0,i.tZ)(ek,{})})})}),(0,i.tZ)(u.Route,{path:d?void 0:"security",children:(0,i.tZ)(u.Switch,{children:(0,i.tZ)(u.Route,{index:!0,children:(0,i.tZ)(tb,{})})})}),l.billing.user.enabled&&t?(0,i.tZ)(u.Route,{path:h?void 0:"billing",children:(0,i.BX)(u.Switch,{children:[(0,i.tZ)(u.Route,{index:!0,children:(0,i.tZ)(o.Suspense,{fallback:"",children:(0,i.tZ)(tz,{})})}),l.billing.user.hasPaidPlans?(0,i.tZ)(u.Route,{path:"plans",children:(0,i.tZ)(o.Suspense,{fallback:"",children:(0,i.tZ)(tC,{})})}):null,(0,i.tZ)(u.Route,{path:"statement/:statementId",children:(0,i.tZ)(o.Suspense,{fallback:"",children:(0,i.tZ)(tK,{})})}),(0,i.tZ)(u.Route,{path:"payment-attempt/:paymentAttemptId",children:(0,i.tZ)(o.Suspense,{fallback:"",children:(0,i.tZ)(t_,{})})})]})}):null,a.user_api_keys_enabled&&!r?.hide&&(0,i.tZ)(u.Route,{path:m?void 0:"api-keys",children:(0,i.tZ)(u.Switch,{children:(0,i.tZ)(u.Route,{index:!0,children:(0,i.tZ)(o.Suspense,{fallback:"",children:(0,i.tZ)(tS,{})})})})})]})]})};var tx=r(12786);let tB=(0,c.withCoreUserGuard)(()=>{let e=o.useRef(null);return(0,i.tZ)(n.P.Root,{children:(0,i.BX)(m,{contentRef:e,children:[(0,i.tZ)(l.ap,{navbarTitleLocalizationKey:(0,d.localizationKeys)("userProfile.navbar.title")}),(0,i.tZ)(n.P.Content,{contentRef:e,scrollBoxId:s.g8,children:(0,i.tZ)(tR,{})})]})})}),tw=(0,a.withCardStateProvider)(e=>(0,i.tZ)(d.Flow.Root,{flow:"userProfile",children:(0,i.tZ)(d.Flow.Part,{children:(0,i.BX)(u.Switch,{children:[(0,i.tZ)(u.Route,{path:"verify",children:(0,i.tZ)(tx.M,{})}),(0,i.tZ)(u.Route,{children:(0,i.tZ)(tB,{})})]})})})),tk=e=>{let t={...e,routing:"virtual",componentName:"UserProfile",mode:"modal"};return(0,i.tZ)(u.Route,{path:"user",children:(0,i.tZ)(c.UserProfileContext.Provider,{value:t,children:(0,i.tZ)("div",{children:(0,i.tZ)(tw,{...t})})})})}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(globalThis.webpackChunk_clerk_clerk_js=globalThis.webpackChunk_clerk_clerk_js||[]).push([["3470"],{99140:function(e,t,i){i.d(t,{_:()=>z}),i(92037),i(28419);var r=i(73312),l=i(61869),o=i(69144),a=i(2672),n=i(70431),s=i(19460),c=i(68487),d=i(88870),u=i(36788),h=i(96231),m=i(11576),p=i(17703),f=i(10207);i(50725);var v=i(24676),g=i(96620),y=i(64204),P=i(65695);let Z=e=>{let{navigate:t}=(0,v.useRouter)(),{email:i,nextStep:l,onReset:n}=e,c=(0,a.useCardState)(),u=(0,m.useUserProfileContext)(),{startEnterpriseSSOLinkFlow:h}=(0,P.eq)(i);async function p(){var e;await t((null==(e=i.verification.externalVerificationRedirectURL)?void 0:e.href)||"")}return o.useEffect(()=>{let{mode:e,componentName:t}=u;h({redirectUrl:"modal"===e?(0,g.bX)({url:window.location.href,componentName:t}):window.location.href}).then(()=>l()).catch(e=>(0,d.S3)(e,[],c.setError))},[]),(0,r.BX)(r.HY,{children:[(0,r.tZ)(y.Flex,{justify:"center",children:(0,r.tZ)(y.Button,{variant:"link",onClick:p,localizationKey:(0,y.localizationKeys)("userProfile.emailAddressPage.enterpriseSSOLink.formButton")})}),(0,r.tZ)(s.K,{children:(0,r.tZ)(y.Button,{variant:"ghost",localizationKey:(0,y.localizationKeys)("userProfile.formButtonReset"),elementDescriptor:y.descriptors.formButtonReset,onClick:n})})]})};var b=i(12786);let z=(0,a.withCardStateProvider)(e=>{var t,i;let{emailId:v,onSuccess:g,onReset:y,disableAutoFocus:P=!1}=e,z=(0,a.useCardState)(),{user:K}=(0,l.aF)(),_=(0,m.useEnvironment)(),R=(0,l.WZ)(e=>null==K?void 0:K.createEmailAddress({email:e})),x=o.useRef(null==K?void 0:K.emailAddresses.find(e=>e.id===v)),B=C(x.current,_),w=(0,h.a2)({defaultStep:+!!x.current,onNextStep:()=>z.setError(void 0)}),k=(0,u.Yp)("emailAddress","",{type:"email",label:(0,p.u1)("formFieldLabel__emailAddress"),placeholder:(0,p.u1)("formFieldInputPlaceholder__emailAddress"),isRequired:!0}),I=k.value.length>1&&(null==K?void 0:K.username)!==k.value,A=async e=>{if(e.preventDefault(),K)return R(k.value).then(e=>{x.current=e,w.nextStep()}).catch(e=>(0,d.S3)(e,[k],z.setError))},T=S(B);return(0,r.BX)(h.en,{...w.props,children:[(0,r.tZ)(c.Y,{headerTitle:e.title||(0,p.u1)("userProfile.emailAddressPage.title"),headerSubtitle:e.subtitle||(0,p.u1)("userProfile.emailAddressPage.formHint"),children:(0,r.BX)(n.l.Root,{onSubmit:A,children:[(0,r.tZ)(n.l.ControlRow,{elementId:k.id,children:(0,r.tZ)(n.l.PlainInput,{...k.props,autoFocus:!P})}),(0,r.tZ)(s.A,{submitLabel:(0,p.u1)("userProfile.formButtonPrimary__add"),isDisabled:!I,onReset:y})]})}),(0,r.BX)(c.Y,{headerTitle:(0,p.u1)("userProfile.emailAddressPage.verifyTitle"),headerSubtitle:(0,p.u1)("".concat(T,".formSubtitle"),{identifier:(null==(t=x.current)?void 0:t.emailAddress)||""}),children:["email_link"===B&&(0,r.tZ)(b.K,{nextStep:g,email:x.current,onReset:y}),"email_code"===B&&(0,r.tZ)(f.H,{nextStep:g,identification:x.current,identifier:null==(i=x.current)?void 0:i.emailAddress,prepareVerification:()=>{var e;return null==(e=x.current)?void 0:e.prepareVerification({strategy:"email_code"})},onReset:y}),"enterprise_sso"===B&&(0,r.tZ)(Z,{nextStep:g,email:x.current,onReset:y})]})]})}),S=e=>{switch(e){case"email_code":return"userProfile.emailAddressPage.emailCode";case"enterprise_sso":return"userProfile.emailAddressPage.enterpriseSSOLink";case"email_link":return"userProfile.emailAddressPage.emailLink";default:throw Error("Unsupported strategy for email verification: ".concat(e))}},C=(e,t)=>(null==e?void 0:e.matchesSsoConnection)?"enterprise_sso":!function(e){let{userSettings:t}=e,{email_address:i}=t.attributes;return!!((null==i?void 0:i.enabled)&&(null==i?void 0:i.verifications.includes("email_link")))}(t)?"email_code":"email_link"},85838:function(e,t,i){i.d(t,{j:()=>h}),i(91634),i(98383),i(45261),i(70957),i(24551),i(22349),i(65223);var r=i(73312),l=i(61869),o=i(95878),a=i(96231),n=i(11576),s=i(64204),c=i(65695),d=i(96519);let u=e=>{let{code:t}=e;return(0,r.tZ)(s.Flex,{center:!0,sx:e=>({padding:"".concat(e.space.$1," ").concat(e.space.$4)}),children:(0,r.tZ)(s.Text,{children:t})})},h=e=>{let{subtitle:t,backupCodes:i}=e,{applicationName:h}=(0,n.useEnvironment)().displayConfig,{user:m}=(0,l.aF)(),{print:p,printableProps:f}=(0,a.Qz)(),{onCopy:v,hasCopied:g}=(0,c.VP)((null==i?void 0:i.join(","))||"");if(!m)return null;let y=(0,o.xC)(m);return i?(0,r.BX)(r.HY,{children:[(0,r.BX)(s.Col,{gap:1,children:[(0,r.tZ)(s.Text,{localizationKey:(0,s.localizationKeys)("userProfile.backupCodePage.title__codelist"),variant:"subtitle"}),(0,r.tZ)(s.Text,{localizationKey:t,variant:"caption",colorScheme:"secondary"})]}),(0,r.BX)(s.Box,{sx:e=>({borderWidth:e.borderWidths.$normal,borderStyle:e.borderStyles.$solid,borderColor:e.colors.$borderAlpha100,borderRadius:e.radii.$lg}),children:[(0,r.tZ)(s.Grid,{gap:2,sx:e=>({gridTemplateColumns:"repeat(2, minmax(".concat(e.sizes.$12,", 1fr))"),padding:"".concat(e.space.$4," ").concat(e.space.$6)}),children:i.map((e,t)=>(0,r.tZ)(u,{code:e},t))}),(0,r.BX)(s.Grid,{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,r.tZ)(s.Button,{variant:"ghost",sx:e=>({width:"100%",padding:"".concat(e.space.$2," 0"),borderRadius:0}),onClick:()=>{let e=document.createElement("a"),t=new Blob([function(e,t,i){let r=null==e?void 0:e.join("\n");return"These are your backup codes for ".concat(t," account ").concat(i,".\nStore them securely and keep them secret. Each code can only be used once.\n\n").concat(r)}(i,h,y)],{type:"text/plain"});e.href=URL.createObjectURL(t),e.download="".concat(h,"_backup_codes.txt"),document.body.appendChild(e),e.click()},children:(0,r.tZ)(s.Icon,{icon:d.UW})}),(0,r.tZ)(s.Button,{variant:"ghost",sx:e=>({width:"100%",padding:"".concat(e.space.$2," 0"),borderRadius:0}),onClick:p,children:(0,r.tZ)(s.Icon,{icon:d.Kh})}),(0,r.tZ)(s.Button,{variant:"ghost",onClick:v,sx:e=>({width:"100%",padding:"".concat(e.space.$2," 0"),borderRadius:0}),children:(0,r.tZ)(s.Icon,{icon:g?d.Jr:d.CK})})]})]}),(0,r.BX)(a.o4,{...f,children:[(0,r.BX)(s.Heading,{children:["Your backup codes for ",h," account ",y,":"]}),(0,r.tZ)(s.Col,{gap:2,children:i.map((e,t)=>(0,r.tZ)(u,{code:e},t))})]})]}):null}},10207:function(e,t,i){i.d(t,{H:()=>u});var r=i(73312),l=i(69144),o=i(12667),a=i(2672),n=i(70431),s=i(19460),c=i(88870),d=i(64204);let u=e=>{let t=(0,a.useCardState)(),{nextStep:i,identification:u,identifier:h,onReset:m,prepareVerification:p}=e,f=()=>{var e;return null==p||null==(e=p())?void 0:e.catch(e=>(0,c.S3)(e,[],t.setError))},v=(0,o.e3)({onCodeEntryFinished:(e,t,i)=>{null==u||u.attemptVerification({code:e}).then(()=>t()).catch(i)},onResendCodeClicked:f,onResolve:i});return l.useEffect(()=>{f()},[]),(0,r.BX)(r.HY,{children:[(0,r.tZ)(n.l.OTPInput,{...v,label:(0,d.localizationKeys)("userProfile.emailAddressPage.emailCode.formTitle"),description:(0,d.localizationKeys)("userProfile.emailAddressPage.emailCode.formSubtitle",{identifier:h||""}),resendButton:(0,d.localizationKeys)("userProfile.emailAddressPage.emailCode.resendButton"),centerAlign:!1}),(0,r.BX)(s.K,{children:[(0,r.tZ)(d.Button,{isLoading:v.isLoading,localizationKey:(0,d.localizationKeys)("formButtonPrimary__verify"),elementDescriptor:d.descriptors.formButtonPrimary,onClick:v.onFakeContinue}),(0,r.tZ)(d.Button,{variant:"ghost",isDisabled:v.isLoading,localizationKey:(0,d.localizationKeys)("userProfile.formButtonReset"),elementDescriptor:d.descriptors.formButtonReset,onClick:m})]})]})}},12786:function(e,t,i){i.d(t,{K:()=>p,M:()=>f});var r=i(73312),l=i(69144),o=i(2672),a=i(19460),n=i(65495),s=i(88870),c=i(96231),d=i(56749),u=i(11576),h=i(64204),m=i(65695);let p=e=>{let{email:t,nextStep:i,onReset:c}=e,p=(0,o.useCardState)(),f=(0,u.useUserProfileContext)(),{startEmailLinkFlow:v}=(0,m.E2)(t),{displayConfig:g}=(0,u.useEnvironment)();function y(){let{routing:e}=f,t="virtual"===e?g.userProfileUrl:"";v({redirectUrl:(0,d.Uu)({ctx:f,baseUrl:t,intent:"profile"})}).then(()=>i()).catch(e=>(0,s.S3)(e,[],p.setError))}return l.useEffect(()=>{y()},[]),(0,r.BX)(r.HY,{children:[(0,r.tZ)(n.V,{resendButton:(0,h.localizationKeys)("userProfile.emailAddressPage.emailLink.resendButton"),onResendCodeClicked:y}),(0,r.tZ)(a.K,{children:(0,r.tZ)(h.Button,{variant:"ghost",localizationKey:(0,h.localizationKeys)("userProfile.formButtonReset"),elementDescriptor:h.descriptors.formButtonReset,onClick:c})})]})},f=()=>(0,r.tZ)(c.Ej,{title:(0,h.localizationKeys)("signUp.emailLink.verifiedSwitchTab.title"),subtitle:(0,h.localizationKeys)("signUp.emailLink.verifiedSwitchTab.subtitle"),status:"verified"})},23742:function(e,t,i){i.r(t),i.d(t,{UserProfileModal:()=>tk,UserProfile:()=>tw});var r=i(73312),l=i(69144),o=i(2672),a=i(15579),n=i(23394),s=i(31673),c=i(11576),d=i(64204),u=i(24676),h=i(17703);let m=e=>{let{pages:t,apiKeysProps:i}=(0,c.useUserProfileContext)(),l=t.routes.filter(e=>e.id!==s.xM.API_KEYS||!(null==i?void 0:i.hide));return(0,r.BX)(a.Uh,{contentRef:e.contentRef,children:[(0,r.tZ)(a.l2,{title:(0,h.u1)("userProfile.navbar.title"),description:(0,h.u1)("userProfile.navbar.description"),routes:l,contentRef:e.contentRef}),e.children]})};i(50725);var p=i(94995),f=i(61869),v=i(92418),g=i(92654);i(65223),i(28419),i(56113);var y=i(19655),P=i(33009),Z=i(88870),b=i(96620),z=i(96231),S=i(99805),C=i(44709),K=i(65695);i(87945);var _=i(57046);let R=e=>{let{strategy:t}=e,i=(0,o.useCardState)(),{user:l}=(0,f.aF)(),{navigate:a}=(0,u.useRouter)(),{strategyToDisplayData:n}=(0,K.vO)(),{additionalOAuthScopes:s,componentName:h,mode:m}=(0,c.useUserProfileContext)(),p="modal"===m,v=(0,f.WZ)(()=>{let e=t.replace("oauth_",""),i=p?(0,b.bX)({url:window.location.href,componentName:h,socialProvider:e}):window.location.href,r=s?s[e]:[];return null==l?void 0:l.createExternalAccount({strategy:t,redirectUrl:i,additionalScopes:r})}),g=n[t].iconUrl?(0,r.tZ)(d.Image,{isLoading:i.loadingMetadata===t,isDisabled:i.isLoading,elementDescriptor:d.descriptors.providerIcon,elementId:d.descriptors.providerIcon.setId(n[t].id),src:n[t].iconUrl,alt:"Connect ".concat(n[t].name," account"),sx:e=>({width:e.sizes.$4})}):(0,r.tZ)(z.e_,{id:n[t].id,value:n[t].name,isLoading:i.loadingMetadata===t,isDisabled:i.isLoading});return(0,r.tZ)(y.zd.ActionMenuItem,{id:n[t].id,onClick:()=>{if(l)return i.setLoading(t),v().then(e=>{var r;e&&(null==(r=e.verification)?void 0:r.externalVerificationRedirectURL)&&((0,_._)(2e3).then(()=>i.setIdle(t)),a(e.verification.externalVerificationRedirectURL.href))}).catch(e=>{(0,Z.S3)(e,[],i.setError),i.setIdle(t)})},isDisabled:i.isLoading,variant:"ghost",isLoading:i.loadingMetadata===t,focusRing:!1,closeAfterClick:!1,localizationKey:(0,d.localizationKeys)("userProfile.connectedAccountPage.socialButtonsBlockButton",{provider:n[t].name}),sx:e=>({justifyContent:"start",gap:e.space.$2}),leftIcon:g},t)},x=e=>{let{onClick:t}=e,{user:i}=(0,f.aF)(),{strategies:l}=(0,K.vO)(),o=l.filter(e=>e.startsWith("oauth")),a=null==i?void 0:i.verifiedExternalAccounts.map(e=>"oauth_".concat(e.provider)),n=o.filter(e=>!a.includes(e));return 0===n.length?null:(0,r.tZ)(y.zd.ActionMenu,{triggerLocalizationKey:(0,d.localizationKeys)("userProfile.start.connectedAccountsSection.primaryButton"),id:"connectedAccounts",onClick:t,children:n.map(e=>(0,r.tZ)(R,{strategy:e},e))})},B=e=>{var t;let{onSuccess:i,onReset:o}=e,{user:a}=(0,f.aF)(),{emailId:n}=e,s=null==a?void 0:a.emailAddresses.find(e=>e.id===n),c=l.useRef(null==s?void 0:s.emailAddress),u=(null==s||null==(t=s.verification)?void 0:t.status)==="verified"?(0,d.localizationKeys)("userProfile.emailAddressPage.removeResource.messageLine2"):void 0;return c.current?(0,r.tZ)(z.LE,{title:(0,d.localizationKeys)("userProfile.emailAddressPage.removeResource.title"),messageLine1:(0,d.localizationKeys)("userProfile.emailAddressPage.removeResource.messageLine1",{identifier:c.current}),messageLine2:u,successMessage:(0,d.localizationKeys)("userProfile.emailAddressPage.removeResource.successMessage",{emailAddress:c.current}),deleteResource:()=>Promise.resolve(null==s?void 0:s.destroy()),onSuccess:i,onReset:o}):null},w=e=>{var t;let{phoneId:i,onSuccess:o,onReset:a}=e,{user:n}=(0,f.aF)(),s=null==n?void 0:n.phoneNumbers.find(e=>e.id===i),c=l.useRef(null==s?void 0:s.phoneNumber),u=(null==s||null==(t=s.verification)?void 0:t.status)==="verified"?(0,d.localizationKeys)("userProfile.phoneNumberPage.removeResource.messageLine2"):void 0;return c.current?(0,r.tZ)(z.LE,{title:(0,d.localizationKeys)("userProfile.phoneNumberPage.removeResource.title"),messageLine1:(0,d.localizationKeys)("userProfile.phoneNumberPage.removeResource.messageLine1",{identifier:c.current}),messageLine2:u,successMessage:(0,d.localizationKeys)("userProfile.phoneNumberPage.removeResource.successMessage",{phoneNumber:c.current}),deleteResource:()=>Promise.resolve(null==s?void 0:s.destroy()),onSuccess:o,onReset:a}):null},k=e=>{var t,i;let{accountId:o,onSuccess:a,onReset:n}=e,{user:s}=(0,f.aF)(),c=null==s?void 0:s.externalAccounts.find(e=>e.id===o),u=l.useRef(null==c?void 0:c.provider),{providerToDisplayData:h}=(0,K.vO)();return u.current?(0,r.tZ)(z.LE,{title:(0,d.localizationKeys)("userProfile.connectedAccountPage.removeResource.title"),messageLine1:(0,d.localizationKeys)("userProfile.connectedAccountPage.removeResource.messageLine1",{identifier:(null==(t=h[u.current])?void 0:t.name)||""}),messageLine2:(0,d.localizationKeys)("userProfile.connectedAccountPage.removeResource.messageLine2"),successMessage:(0,d.localizationKeys)("userProfile.connectedAccountPage.removeResource.successMessage",{connectedAccount:(null==(i=h[u.current])?void 0:i.name)||""}),deleteResource:()=>Promise.resolve(null==c?void 0:c.destroy()),onSuccess:a,onReset:n}):null},I=e=>{var t;let{user:i}=(0,f.aF)(),{walletId:o,onSuccess:a,onReset:n}=e,s=null==i?void 0:i.web3Wallets.find(e=>e.id===o),c=l.useRef(null==s?void 0:s.web3Wallet),u=(null==s||null==(t=s.verification)?void 0:t.status)==="verified"?(0,d.localizationKeys)("userProfile.web3WalletPage.removeResource.messageLine2"):void 0;return c.current?(0,r.tZ)(z.LE,{title:(0,d.localizationKeys)("userProfile.web3WalletPage.removeResource.title"),messageLine1:(0,d.localizationKeys)("userProfile.web3WalletPage.removeResource.messageLine1",{identifier:c.current}),messageLine2:u,successMessage:(0,d.localizationKeys)("userProfile.web3WalletPage.removeResource.successMessage",{web3Wallet:c.current}),deleteResource:()=>Promise.resolve(null==s?void 0:s.destroy()),onSuccess:a,onReset:n}):null},A=e=>{let{user:t}=(0,f.aF)(),{phoneId:i,onSuccess:o,onReset:a}=e,n=null==t?void 0:t.phoneNumbers.find(e=>e.id===i),s=l.useRef(null==n?void 0:n.phoneNumber);return s.current?(0,r.tZ)(z.LE,{title:(0,d.localizationKeys)("userProfile.mfaPhoneCodePage.removeResource.title"),messageLine1:(0,d.localizationKeys)("userProfile.mfaPhoneCodePage.removeResource.messageLine1",{identifier:s.current}),messageLine2:(0,d.localizationKeys)("userProfile.mfaPhoneCodePage.removeResource.messageLine2"),successMessage:(0,d.localizationKeys)("userProfile.mfaPhoneCodePage.removeResource.successMessage",{mfaPhoneCode:s.current}),deleteResource:()=>Promise.resolve(null==n?void 0:n.setReservedForSecondFactor({reserved:!1})),onSuccess:o,onReset:a}):null},T=e=>{let{onSuccess:t,onReset:i}=e,{user:l}=(0,f.aF)();return l?(0,r.tZ)(z.LE,{title:(0,d.localizationKeys)("userProfile.mfaTOTPPage.removeResource.title"),messageLine1:(0,d.localizationKeys)("userProfile.mfaTOTPPage.removeResource.messageLine1"),messageLine2:(0,d.localizationKeys)("userProfile.mfaTOTPPage.removeResource.messageLine2"),successMessage:(0,d.localizationKeys)("userProfile.mfaTOTPPage.removeResource.successMessage"),deleteResource:l.disableTOTP,onSuccess:t,onReset:i}):null},X=e=>{let{onSuccess:t,onReset:i,passkey:l}=e;return(0,r.tZ)(z.LE,{title:(0,d.localizationKeys)("userProfile.passkeyScreen.removeResource.title"),messageLine1:(0,d.localizationKeys)("userProfile.passkeyScreen.removeResource.messageLine1",{name:l.name||""}),deleteResource:l.delete,onSuccess:t,onReset:i})},L=e=>{let{close:t}=(0,C.XC)();return(0,r.tZ)(k,{onSuccess:t,onReset:t,...e})},F=["external_account_missing_refresh_token","oauth_fetch_user_error","oauth_token_exchange_error","external_account_email_address_verification_required"],E=(0,o.withCardStateProvider)(e=>{var t;let{shouldAllowCreation:i=!0}=e,{user:a}=(0,f.aF)(),n=(0,o.useCardState)(),s=!!(null==a||null==(t=a.externalAccounts)?void 0:t.length),[c,u]=(0,l.useState)(null);if(!a||!i&&!s)return null;let h=[...a.verifiedExternalAccounts,...a.unverifiedExternalAccounts.filter(e=>{var t;return null==(t=e.verification)?void 0:t.error})];return(0,r.BX)(y.zd.Root,{title:(0,d.localizationKeys)("userProfile.start.connectedAccountsSection.title"),centered:!1,id:"connectedAccounts",children:[(0,r.tZ)(v.Z.Alert,{children:n.error}),(0,r.BX)(S.a.Root,{value:c,onChange:u,children:[(0,r.tZ)(y.zd.ItemList,{id:"connectedAccounts",children:h.map(e=>(0,r.tZ)(D,{account:e},e.id))}),i&&(0,r.tZ)(x,{onClick:()=>u(null)})]})]})}),D=e=>{var t,i,a,n,s,h;let{account:m}=e,{additionalOAuthScopes:p,componentName:v,mode:g}=(0,c.useUserProfileContext)(),{navigate:P}=(0,u.useRouter)(),{user:C}=(0,f.aF)(),_=(0,o.useCardState)(),R=m.id,x="modal"===g,B=x?(0,b.bX)({url:window.location.href,componentName:v}):window.location.href,w=(0,f.WZ)(()=>null==C?void 0:C.createExternalAccount({strategy:m.verification.strategy,redirectUrl:B,additionalScopes:T}));if(!C)return null;let{providerToDisplayData:k}=(0,K.vO)(),I=m.username||m.emailAddress,A=null==(i=m.verification)||null==(t=i.error)?void 0:t.longMessage,T=function(e,t){if(!t)return[];let i=t[e.provider]||[],r=e.approvedScopes.split(" ");return 0===i.filter(e=>!r.includes(e)).length?[]:i}(m,p),X=T.length>0&&""!=m.approvedScopes,E=F.includes((null==(n=m.verification)||null==(a=n.error)?void 0:a.code)||"")||X,D=E?(0,d.localizationKeys)("userProfile.start.connectedAccountsSection.subtitle__disconnected"):A,$=async()=>{let e=x?(0,b.bX)({url:window.location.href,componentName:v}):window.location.href;try{let i;if(i=X?await m.reauthorize({additionalScopes:T,redirectUrl:e}):await w()){var t;await P((null==(t=i.verification.externalVerificationRedirectURL)?void 0:t.href)||"")}}catch(e){(0,Z.S3)(e,[],_.setError)}};return(0,r.BX)(l.Fragment,{children:[(0,r.BX)(y.zd.Item,{id:"connectedAccounts",children:[(0,r.BX)(d.Flex,{sx:e=>({overflow:"hidden",gap:e.space.$2}),children:[(0,r.tZ)(()=>k[m.provider].iconUrl?(0,r.tZ)(d.Image,{elementDescriptor:[d.descriptors.providerIcon],elementId:d.descriptors.socialButtonsProviderIcon.setId(m.provider),alt:k[m.provider].name,src:k[m.provider].iconUrl,sx:e=>({width:e.sizes.$4,flexShrink:0})}):(0,r.tZ)(z.e_,{id:m.provider,value:k[m.provider].name}),{}),(0,r.tZ)(d.Box,{sx:{whiteSpace:"nowrap",overflow:"hidden"},children:(0,r.BX)(d.Flex,{gap:1,center:!0,children:[(0,r.tZ)(d.Text,{sx:e=>({color:e.colors.$colorForeground}),children:"".concat(k[m.provider].name)}),(0,r.tZ)(d.Text,{truncate:!0,as:"span",colorScheme:"secondary",children:I?"• ".concat(I):""})]})})]}),(0,r.tZ)(O,{account:m})]}),E&&(0,r.BX)(d.Box,{sx:e=>({padding:"".concat(e.sizes.$none," ").concat(e.sizes.$none," ").concat(e.sizes.$1x5," ").concat(e.sizes.$8x5)}),children:[(0,r.tZ)(d.Text,{colorScheme:"secondary",sx:e=>({paddingRight:e.sizes.$1x5,display:"inline-block"}),localizationKey:D}),(0,r.tZ)(d.Button,{sx:{display:"inline-block"},onClick:$,variant:"link",localizationKey:(0,d.localizationKeys)("userProfile.start.connectedAccountsSection.actionLabel__connectionFailed")})]}),(null==(h=m.verification)||null==(s=h.error)?void 0:s.code)&&!E&&(0,r.tZ)(d.Text,{colorScheme:"danger",sx:e=>({padding:"".concat(e.sizes.$none," ").concat(e.sizes.$1x5," ").concat(e.sizes.$1x5," ").concat(e.sizes.$8x5)}),children:A}),(0,r.tZ)(S.a.Open,{value:"remove-".concat(R),children:(0,r.tZ)(S.a.Card,{variant:"destructive",children:(0,r.tZ)(L,{accountId:m.id})})})]},m.id)},O=e=>{let{account:t}=e,{open:i}=(0,C.XC)(),l=t.id,o=[{label:(0,d.localizationKeys)("userProfile.start.connectedAccountsSection.destructiveActionTitle"),isDestructive:!0,onClick:()=>i("remove-".concat(l))}].filter(e=>null!==e);return(0,r.tZ)(P.a,{actions:o})};var $=i(85390);function N(e,t){if(!e)return[];let i=e.filter(e=>e.id===t),r=e.filter(e=>e.id!==t),l=r.filter(e=>{var t;return(null==(t=e.verification)?void 0:t.status)==="verified"}),o=r.filter(e=>{var t,i;return!!(null==(t=e.verification)?void 0:t.status)&&(null==(i=e.verification)?void 0:i.status)!=="verified"}),a=r.filter(e=>!e.verification.status);return l.sort((e,t)=>e.id.localeCompare(t.id)),o.sort((e,t)=>{var i,r;return(null==(i=e.verification)?void 0:i.expireAt)&&(null==(r=t.verification)?void 0:r.expireAt)?e.verification.expireAt.getTime()-t.verification.expireAt.getTime():0}),[...i,...l,...o,...a]}var W=i(99140);let M=e=>{let{close:t}=(0,C.XC)();return(0,r.tZ)(B,{onSuccess:t,onReset:t,...e})},U=e=>{let{close:t}=(0,C.XC)();return(0,r.tZ)(W._,{onSuccess:t,onReset:t,...e})},Y=e=>{let{shouldAllowCreation:t=!0}=e,{user:i}=(0,f.aF)();return(0,r.tZ)(y.zd.Root,{title:(0,d.localizationKeys)("userProfile.start.emailAddressesSection.title"),centered:!1,id:"emailAddresses",children:(0,r.tZ)(S.a.Root,{children:(0,r.BX)(y.zd.ItemList,{id:"emailAddresses",children:[N(null==i?void 0:i.emailAddresses,null==i?void 0:i.primaryEmailAddressId).map(e=>{let t=e.id;return(0,r.BX)(l.Fragment,{children:[(0,r.BX)(y.zd.Item,{id:"emailAddresses",children:[(0,r.BX)(d.Flex,{sx:e=>({overflow:"hidden",gap:e.space.$1}),children:[(0,r.tZ)(d.Text,{sx:e=>({color:e.colors.$colorForeground}),truncate:!0,children:e.emailAddress}),(null==i?void 0:i.primaryEmailAddressId)===t&&(0,r.tZ)(d.Badge,{localizationKey:(0,d.localizationKeys)("badge__primary")}),"verified"!==e.verification.status&&(0,r.tZ)(d.Badge,{localizationKey:(0,d.localizationKeys)("badge__unverified")})]}),(0,r.tZ)(q,{email:e})]}),(0,r.tZ)(S.a.Open,{value:"remove-".concat(t),children:(0,r.tZ)(S.a.Card,{variant:"destructive",children:(0,r.tZ)(M,{emailId:t})})}),(0,r.tZ)(S.a.Open,{value:"verify-".concat(t),children:(0,r.tZ)(S.a.Card,{children:(0,r.tZ)(U,{emailId:t})})})]},e.emailAddress)}),t&&(0,r.BX)(r.HY,{children:[(0,r.tZ)(S.a.Trigger,{value:"add",children:(0,r.tZ)(y.zd.ArrowButton,{id:"emailAddresses",localizationKey:(0,d.localizationKeys)("userProfile.start.emailAddressesSection.primaryButton")})}),(0,r.tZ)(S.a.Open,{value:"add",children:(0,r.tZ)(S.a.Card,{children:(0,r.tZ)(U,{})})})]})]})})})},q=e=>{let{email:t}=e,i=(0,o.useCardState)(),{user:l}=(0,f.aF)(),{open:a}=(0,C.XC)(),n=t.id,s=(null==l?void 0:l.primaryEmailAddressId)===n,c="verified"===t.verification.status,u=(0,f.WZ)(()=>null==l?void 0:l.update({primaryEmailAddressId:n})),h=[s&&!c?{label:(0,d.localizationKeys)("userProfile.start.emailAddressesSection.detailsAction__primary"),onClick:()=>a("verify-".concat(n))}:null,!s&&c?{label:(0,d.localizationKeys)("userProfile.start.emailAddressesSection.detailsAction__nonPrimary"),onClick:()=>{u().catch(e=>(0,Z.S3)(e,[],i.setError))}}:null,!s&&!c?{label:(0,d.localizationKeys)("userProfile.start.emailAddressesSection.detailsAction__unverified"),onClick:()=>a("verify-".concat(n))}:null,{label:(0,d.localizationKeys)("userProfile.start.emailAddressesSection.destructiveAction"),isDestructive:!0,onClick:()=>a("remove-".concat(n))}].filter(e=>null!==e);return(0,r.tZ)(P.a,{actions:h})},j=()=>{let{user:e}=(0,f.aF)(),t=null==e?void 0:e.enterpriseAccounts.filter(e=>{let{enterpriseConnection:t}=e;return null==t?void 0:t.active});return(null==t?void 0:t.length)?(0,r.tZ)(y.zd.Root,{title:(0,d.localizationKeys)("userProfile.start.enterpriseAccountsSection.title"),id:"enterpriseAccounts",centered:!1,children:(0,r.tZ)(y.zd.ItemList,{id:"enterpriseAccounts",children:t.map(e=>(0,r.tZ)(H,{account:e},e.id))})}):null},H=e=>{var t,i,l;let{account:o}=e,a=o.emailAddress,n=null==o||null==(t=o.enterpriseConnection)?void 0:t.name,s=null==(l=o.verification)||null==(i=l.error)?void 0:i.longMessage;return(0,r.BX)(y.zd.Item,{id:"enterpriseAccounts",sx:e=>({gap:e.space.$2,justifyContent:"start"}),children:[(0,r.tZ)(V,{account:o}),(0,r.tZ)(d.Box,{sx:{whiteSpace:"nowrap",overflow:"hidden"},children:(0,r.BX)(d.Flex,{gap:1,center:!0,children:[(0,r.tZ)(d.Text,{truncate:!0,colorScheme:"body",children:n}),(0,r.tZ)(d.Text,{truncate:!0,as:"span",colorScheme:"secondary",children:a?"• ".concat(a):""}),s&&(0,r.tZ)(d.Badge,{colorScheme:"danger",localizationKey:(0,d.localizationKeys)("badge__requiresAction")})]})})]},o.id)},V=e=>{var t;let{account:i}=e,{provider:l,enterpriseConnection:o}=i,a=l.replace(/(oauth_|saml_)/,"").trim(),n=null!=(t=null==o?void 0:o.name)?t:a,s={elementDescriptor:[d.descriptors.providerIcon],alt:n,sx:e=>({width:e.sizes.$4}),elementId:d.descriptors.enterpriseButtonsProviderIcon.setId(i.provider)};return(null==o?void 0:o.logoPublicUrl)?(0,r.tZ)(d.Image,{...s,src:o.logoPublicUrl}):(0,r.tZ)(z.e_,{id:a,value:n,"aria-label":"".concat(n,"'s icon"),elementDescriptor:[d.descriptors.providerIcon,d.descriptors.providerInitialIcon],elementId:d.descriptors.providerInitialIcon.setId(a)})};var Q=i(98690),G=i(70431),J=i(19460),ee=i(68487),et=i(36788),ei=i(10207);let er=(0,o.withCardStateProvider)(e=>{let{phoneId:t,onSuccess:i,onReset:o}=e,{user:a}=(0,f.aF)(),n=l.useRef(null==a?void 0:a.phoneNumbers.find(e=>e.id===t)),s=(0,z.a2)({defaultStep:+!!n.current});return(0,r.BX)(z.en,{...s.props,children:[(0,r.tZ)(el,{resourceRef:n,title:(0,d.localizationKeys)("userProfile.phoneNumberPage.title"),onSuccess:s.nextStep,onReset:o}),(0,r.tZ)(eo,{resourceRef:n,title:(0,d.localizationKeys)("userProfile.phoneNumberPage.verifyTitle"),onSuccess:i,onReset:o})]})}),el=e=>{var t;let{title:i,onSuccess:l,onReset:a,onUseExistingNumberClick:n,resourceRef:s}=e,c=(0,o.useCardState)(),{user:u}=(0,f.aF)(),h=(0,f.WZ)((e,t)=>e.createPhoneNumber(t)),m=(0,et.Yp)("phoneNumber","",{type:"tel",label:(0,d.localizationKeys)("formFieldLabel__phoneNumber"),isRequired:!0}),p=m.value.length>1&&(null==u?void 0:u.username)!==m.value,v=!!(null==u||null==(t=u.phoneNumbers)?void 0:t.length)&&n,g=async e=>{if(e.preventDefault(),u)return h(u,{phoneNumber:m.value}).then(e=>{s.current=e,l()}).catch(e=>(0,Z.S3)(e,[m],c.setError))};return(0,r.tZ)(ee.Y,{headerTitle:i,gap:1,children:(0,r.BX)(G.l.Root,{gap:4,onSubmit:g,children:[(0,r.tZ)(d.Text,{localizationKey:(0,d.localizationKeys)("userProfile.phoneNumberPage.infoText"),colorScheme:"secondary"}),(0,r.tZ)(G.l.ControlRow,{elementId:m.id,children:(0,r.tZ)(G.l.PhoneInput,{...m.props,autoFocus:!0})}),(0,r.BX)(d.Flex,{justify:v?"between":"end",children:[v&&(0,r.tZ)(d.Button,{variant:"ghost",localizationKey:(0,d.localizationKeys)("userProfile.mfaPhoneCodePage.backButton"),onClick:n}),(0,r.tZ)(J.A,{submitLabel:(0,d.localizationKeys)("userProfile.formButtonPrimary__add"),isDisabled:!p,onReset:a})]})]})})},eo=e=>{var t,i,l;let{title:o,onSuccess:a,resourceRef:n,onReset:s}=e;return(0,r.tZ)(ee.Y,{headerTitle:o,headerSubtitle:(0,d.localizationKeys)("userProfile.phoneNumberPage.verifySubtitle",{identifier:(null==(t=n.current)?void 0:t.phoneNumber)||""}),children:(0,r.tZ)(ei.H,{nextStep:a,identification:n.current,identifier:null==(i=n.current)?void 0:i.phoneNumber,prepareVerification:null==(l=n.current)?void 0:l.prepareVerification,onReset:s})})},ea=e=>{let{close:t}=(0,C.XC)();return(0,r.tZ)(w,{onSuccess:t,onReset:t,...e})},en=e=>{let{close:t}=(0,C.XC)();return(0,r.tZ)(er,{onSuccess:t,onReset:t,...e})},es=e=>{var t;let{shouldAllowCreation:i=!0}=e,{user:o}=(0,f.aF)(),a=!!(null==o||null==(t=o.phoneNumbers)?void 0:t.length);return i||a?(0,r.tZ)(y.zd.Root,{centered:!1,title:(0,d.localizationKeys)("userProfile.start.phoneNumbersSection.title"),id:"phoneNumbers",children:(0,r.tZ)(S.a.Root,{children:(0,r.BX)(y.zd.ItemList,{id:"phoneNumbers",children:[N(null==o?void 0:o.phoneNumbers,null==o?void 0:o.primaryPhoneNumberId).map(e=>{let t=e.id;return(0,r.BX)(l.Fragment,{children:[(0,r.BX)(y.zd.Item,{id:"phoneNumbers",children:[(0,r.tZ)(d.Box,{sx:{whiteSpace:"nowrap",overflow:"hidden"},children:(0,r.BX)(d.Flex,{gap:2,center:!0,children:[(0,r.tZ)(d.Text,{sx:e=>({color:e.colors.$colorForeground}),children:(0,Q.L_)(e.phoneNumber)}),(null==o?void 0:o.primaryPhoneNumberId)===t&&(0,r.tZ)(d.Badge,{localizationKey:(0,d.localizationKeys)("badge__primary")}),"verified"!==e.verification.status&&(0,r.tZ)(d.Badge,{localizationKey:(0,d.localizationKeys)("badge__unverified")})]})}),(0,r.tZ)(ec,{phone:e})]}),(0,r.tZ)(S.a.Open,{value:"remove-".concat(t),children:(0,r.tZ)(S.a.Card,{variant:"destructive",children:(0,r.tZ)(ea,{phoneId:t})})}),(0,r.tZ)(S.a.Open,{value:"verify-".concat(t),children:(0,r.tZ)(S.a.Card,{children:(0,r.tZ)(en,{phoneId:t})})})]},t)}),i&&(0,r.BX)(r.HY,{children:[(0,r.tZ)(S.a.Trigger,{value:"add",children:(0,r.tZ)(y.zd.ArrowButton,{id:"phoneNumbers",localizationKey:(0,d.localizationKeys)("userProfile.start.phoneNumbersSection.primaryButton")})}),(0,r.tZ)(S.a.Open,{value:"add",children:(0,r.tZ)(S.a.Card,{children:(0,r.tZ)(en,{})})})]})]})})}):null},ec=e=>{let{phone:t}=e,i=(0,o.useCardState)(),{open:l}=(0,C.XC)(),{user:a}=(0,f.aF)(),n=t.id,s=(0,f.WZ)(e=>e.update({primaryPhoneNumberId:t.id}));if(!a)return null;let c=a.primaryPhoneNumberId===t.id,u="verified"===t.verification.status,h=[c&&!u?{label:(0,d.localizationKeys)("userProfile.start.phoneNumbersSection.detailsAction__primary"),onClick:()=>l("verify-".concat(n))}:null,!c&&u?{label:(0,d.localizationKeys)("userProfile.start.phoneNumbersSection.detailsAction__nonPrimary"),onClick:()=>s(a).catch(e=>(0,Z.S3)(e,[],i.setError))}:null,!c&&!u?{label:(0,d.localizationKeys)("userProfile.start.phoneNumbersSection.detailsAction__unverified"),onClick:()=>l("verify-".concat(n))}:null,{label:(0,d.localizationKeys)("userProfile.start.phoneNumbersSection.destructiveAction"),isDestructive:!0,onClick:()=>l("remove-".concat(n))}].filter(e=>null!==e);return(0,r.tZ)(P.a,{actions:h})};var ed=i(51217),eu=i(36127);let eh=(0,o.withCardStateProvider)(e=>{var t;let{onSuccess:i,onReset:l}=e,{user:a}=(0,f.aF)(),n=(0,f.WZ)(e=>null==a?void 0:a.update({username:e})),{userSettings:s}=(0,c.useEnvironment)(),u=(0,o.useCardState)(),{t:h,locale:m}=(0,d.useLocalizations)(),{usernameSettings:p}=s,v=(0,et.Yp)("username",(null==a?void 0:a.username)||"",{type:"text",label:(0,d.localizationKeys)("formFieldLabel__username"),placeholder:(0,d.localizationKeys)("formFieldInputPlaceholder__username"),buildErrorMessage:e=>(0,eu.f)(e,{t:h,locale:m,usernameSettings:p})});if(!a)return null;let g=null==(t=s.attributes.username)?void 0:t.required,y=(!g||v.value.length>0)&&a.username!==v.value,P=async()=>{try{await n(v.value),i()}catch(e){(0,Z.S3)(e,[v],u.setError)}};return(0,r.tZ)(ee.Y,{headerTitle:a.username?(0,d.localizationKeys)("userProfile.usernamePage.title__update"):(0,d.localizationKeys)("userProfile.usernamePage.title__set"),children:(0,r.BX)(G.l.Root,{onSubmit:P,children:[(0,r.tZ)(G.l.ControlRow,{elementId:v.id,children:(0,r.tZ)(G.l.PlainInput,{...v.props,autoFocus:!0,isRequired:g})}),(0,r.tZ)(J.A,{isDisabled:!y,onReset:l})]})})}),em=()=>{let{close:e}=(0,C.XC)();return(0,r.tZ)(eh,{onSuccess:e,onReset:e})},ep=()=>{let{user:e}=(0,f.aF)();return e?(0,r.tZ)(y.zd.Root,{title:(0,d.localizationKeys)("userProfile.start.usernameSection.title"),id:"username",sx:{alignItems:"center",[ed.mqu.md]:{alignItems:"flex-start"}},children:(0,r.BX)(S.a.Root,{children:[(0,r.tZ)(S.a.Closed,{value:"edit",children:(0,r.BX)(y.zd.Item,{id:"username",sx:{paddingLeft:e.username?void 0:"0"},children:[e.username&&(0,r.tZ)(d.Text,{truncate:!0,sx:e=>({color:e.colors.$colorForeground}),children:e.username}),(0,r.tZ)(S.a.Trigger,{value:"edit",children:(0,r.tZ)(y.zd.Button,{id:"username",localizationKey:e.username?(0,d.localizationKeys)("userProfile.start.usernameSection.primaryButton__updateUsername"):(0,d.localizationKeys)("userProfile.start.usernameSection.primaryButton__setUsername")})})]})}),(0,r.tZ)(S.a.Open,{value:"edit",children:(0,r.tZ)(S.a.Card,{children:(0,r.tZ)(em,{})})})]})}):null};var ef=i(97295),ev=i(43300),eg=i(6654),ey=i(5472);let eP=e=>{let{user:t,...i}=e;return(0,r.tZ)(eg.C,{...i,title:(0,h.u1)("userProfile.profilePage.imageFormTitle"),avatarPreview:(0,r.tZ)(ey.Y,{size:e=>e.sizes.$12,...t})})},eZ=(0,o.withCardStateProvider)(e=>{let{onSuccess:t,onReset:i}=e,l=(0,o.useCardState)(),{user:a}=(0,f.aF)();if(!a)return null;let{first_name:n,last_name:s}=(0,c.useEnvironment)().userSettings.attributes,u=null==n?void 0:n.enabled,h=null==s?void 0:s.enabled,m=a.firstName||"",p=a.lastName||"",v=(0,et.Yp)("firstName",a.firstName||"",{type:"text",label:(0,d.localizationKeys)("formFieldLabel__firstName"),placeholder:(0,d.localizationKeys)("formFieldInputPlaceholder__firstName"),isRequired:null==s?void 0:s.required}),g=(0,et.Yp)("lastName",a.lastName||"",{type:"text",label:(0,d.localizationKeys)("formFieldLabel__lastName"),placeholder:(0,d.localizationKeys)("formFieldInputPlaceholder__lastName"),isRequired:null==s?void 0:s.required}),y=u&&v.value!==m||h&&g.value!==p,P=u&&n.required||h&&s.required,z=P&&!!g.value&&!!v.value&&y,S=a.enterpriseAccounts.some(e=>e.active),C=async e=>(e.preventDefault(),(y?a.update({firstName:v.value,lastName:g.value}):Promise.resolve()).then(t).catch(e=>{(0,Z.S3)(e,[v,g],l.setError)}));return(0,r.BX)(ee.Y,{headerTitle:(0,d.localizationKeys)("userProfile.profilePage.title"),children:[S&&(0,r.tZ)(ev.e,{message:(0,d.localizationKeys)("userProfile.profilePage.readonly")}),(0,r.BX)(G.l.Root,{onSubmit:C,sx:e=>({gap:e.space.$6}),children:[(0,r.tZ)(eP,{user:a,onAvatarChange:e=>a.setProfileImage({file:e}).then(()=>{l.setIdle(),null==t||t()}).catch(e=>(0,Z.S3)(e,[],l.setError)),onAvatarRemove:(0,b.QO)(a.imageUrl)?null:()=>{a.setProfileImage({file:null}).then(()=>{l.setIdle(),null==t||t()}).catch(e=>(0,Z.S3)(e,[],l.setError))}}),(u||h)&&(0,r.BX)(G.l.ControlRow,{elementId:"name",children:[u&&(0,r.tZ)(G.l.PlainInput,{...v.props,isDisabled:S,autoFocus:!0}),h&&(0,r.tZ)(G.l.PlainInput,{...g.props,isDisabled:S,autoFocus:!u})]}),(0,r.tZ)(J.A,{isDisabled:P?!z:!y,onReset:i})]})]})}),eb=()=>{let{close:e}=(0,C.XC)();return(0,r.tZ)(eZ,{onSuccess:e,onReset:e})},ez=()=>{let{user:e}=(0,f.aF)();if(!e)return null;let{username:t,primaryEmailAddress:i,primaryPhoneNumber:l,primaryWeb3Wallet:o,...a}=e;return(0,r.tZ)(y.zd.Root,{title:(0,d.localizationKeys)("userProfile.start.profileSection.title"),id:"profile",sx:{[ed.mqu.md]:{alignItems:"flex-start"}},children:(0,r.BX)(S.a.Root,{children:[(0,r.tZ)(S.a.Closed,{value:"edit",children:(0,r.BX)(y.zd.Item,{id:"profile",children:[(0,r.tZ)(ef.E,{user:a,size:"lg",mainIdentifierVariant:"subtitle",sx:e=>({color:e.colors.$colorForeground})}),(0,r.tZ)(S.a.Trigger,{value:"edit",children:(0,r.tZ)(y.zd.Button,{id:"profile",localizationKey:(0,d.localizationKeys)("userProfile.start.profileSection.primaryButton")})})]})}),(0,r.tZ)(S.a.Open,{value:"edit",children:(0,r.tZ)(S.a.Card,{children:(0,r.tZ)(eb,{})})})]})})};i(92037);var eS=i(41024);let eC=(0,l.lazy)(()=>Promise.all([i.e("514"),i.e("3956"),i.e("1192"),i.e("9573"),i.e("569")]).then(i.bind(i,22382)).then(e=>({default:e.Web3SolanaWalletButtons}))),eK=e=>{let{onConnect:t}=e,i=(0,o.useCardState)(),{close:a}=(0,C.XC)(),n=async e=>{let{walletName:r}=e;i.setLoading(r);try{await t({strategy:"web3_solana_signature",walletName:r}),i.setIdle()}catch(e){if(i.setIdle(),e instanceof Error)(0,Z.S3)(e,[],i.setError);else{let t=new eS.w$("An error occurred while generating the Solana signature.",{code:"web3_solana_signature_generation_failed",cause:e instanceof Error?e:void 0});(0,Z.S3)(t,[],i.setError)}}};return(0,r.tZ)(ee.Y,{headerTitle:(0,d.localizationKeys)("userProfile.start.web3WalletsSection.web3SelectSolanaWalletScreen.title"),headerSubtitle:(0,d.localizationKeys)("userProfile.start.web3WalletsSection.web3SelectSolanaWalletScreen.subtitle"),children:(0,r.BX)(G.l.Root,{children:[(0,r.tZ)(l.Suspense,{fallback:(0,r.tZ)(d.Flex,{direction:"row",align:"center",justify:"center",sx:e=>({height:"100%",minHeight:e.sizes.$32}),children:(0,r.tZ)(d.Spinner,{size:"lg",colorScheme:"primary",elementDescriptor:d.descriptors.spinner})}),children:(0,r.tZ)(eC,{web3AuthCallback:n})}),(0,r.tZ)(J.K,{children:(0,r.tZ)(d.Button,{type:"button",variant:"ghost",onClick:()=>{a()},localizationKey:(0,d.localizationKeys)("userProfile.formButtonReset"),elementDescriptor:d.descriptors.formButtonReset})})]})})};var e_=i(19955),eR=i(62218);let ex=()=>{var e,t;let i=(0,o.useCardState)(),{open:l}=(0,C.XC)(),{user:a}=(0,f.aF)(),{strategies:n,strategyToDisplayData:s}=(0,K.vO)(),c=n.filter(e=>e.startsWith("web3")),u=null!=(t=null==a||null==(e=a.verifiedWeb3Wallets)?void 0:e.map(e=>e.verification.strategy))?t:[],h=c.filter(e=>!u.includes(e)&&s[e]);if(0===h.length)return null;let m=(0,f.WZ)(e=>null==a?void 0:a.createWeb3Wallet({web3Wallet:e})),p=async e=>{let{strategy:t,walletName:r}=e;if("web3_solana_signature"===t&&!r)return void l("web3Wallets");let o=t.replace("web3_","").replace("_signature","");i.setError(void 0);try{i.setLoading(t);let e=await (0,eR.Ly)({provider:o,walletName:r});if(!a)throw Error("user is not defined");let l=await m(e),n=null==(l=await (null==l?void 0:l.prepareVerification({strategy:t})))?void 0:l.verification.message,s=await (0,eR.bQ)({identifier:e,nonce:n,provider:o,walletName:r});await (null==l?void 0:l.attemptVerification({signature:s})),i.setIdle()}catch(e){i.setIdle(),(0,e_.H)(e,i.setError)}};return(0,r.BX)(r.HY,{children:[(0,r.tZ)(S.a.Closed,{value:"web3Wallets",children:(0,r.tZ)(y.zd.ActionMenu,{id:"web3Wallets",triggerLocalizationKey:(0,d.localizationKeys)("userProfile.start.web3WalletsSection.primaryButton"),children:h.map(e=>(0,r.tZ)(y.zd.ActionMenuItem,{id:s[e].id,onClick:()=>p({strategy:e}),isLoading:i.loadingMetadata===e,isDisabled:i.isLoading,localizationKey:(0,d.localizationKeys)("userProfile.web3WalletPage.web3WalletButtonsBlockButton",{provider:s[e].name}),sx:e=>({justifyContent:"start",gap:e.space.$2}),leftIcon:(0,r.tZ)(d.Image,{elementDescriptor:d.descriptors.providerIcon,elementId:d.descriptors.providerIcon.setId(s[e].id),isLoading:i.loadingMetadata===e,isDisabled:i.isLoading,src:s[e].iconUrl,alt:"Connect ".concat(s[e].name),sx:e=>({width:e.sizes.$5})})},e))})}),(0,r.tZ)(S.a.Open,{value:"web3Wallets",children:(0,r.tZ)(S.a.Card,{children:(0,r.tZ)(eK,{onConnect:p})})})]})},eB=e=>{let{close:t}=(0,C.XC)();return(0,r.tZ)(I,{onSuccess:t,onReset:t,...e})},ew=(0,o.withCardStateProvider)(e=>{var t;let{shouldAllowCreation:i=!0}=e,{user:a}=(0,f.aF)(),n=(0,o.useCardState)(),{strategyToDisplayData:s}=(0,K.vO)(),c=!!(null==a||null==(t=a.web3Wallets)?void 0:t.length),[u,h]=(0,l.useState)(null);return i||c?(0,r.BX)(y.zd.Root,{title:(0,d.localizationKeys)("userProfile.start.web3WalletsSection.title"),centered:!1,id:"web3Wallets",children:[(0,r.tZ)(v.Z.Alert,{children:n.error}),(0,r.BX)(S.a.Root,{value:u,onChange:h,children:[(0,r.tZ)(y.zd.ItemList,{id:"web3Wallets",children:N(null==a?void 0:a.web3Wallets,null==a?void 0:a.primaryWeb3WalletId).map(e=>{var t;let i=e.verification.strategy,o=e.id;return s[i]&&(0,r.BX)(l.Fragment,{children:[(0,r.BX)(y.zd.Item,{id:"web3Wallets",align:"start",children:[(0,r.BX)(d.Flex,{sx:e=>({alignItems:"center",gap:e.space.$2,width:"100%"}),children:[s[i].iconUrl&&(0,r.tZ)(d.Image,{src:s[i].iconUrl,alt:s[i].name,sx:e=>({width:e.sizes.$4})}),(0,r.tZ)(d.Box,{sx:{whiteSpace:"nowrap",overflow:"hidden"},children:(0,r.BX)(d.Flex,{gap:2,justify:"start",children:[(0,r.BX)(d.Text,{children:[s[i].name," (",(t=e.web3Wallet).length<=10?t:t.slice(0,6)+"..."+t.slice(-4),")"]}),(null==a?void 0:a.primaryWeb3WalletId)===o&&(0,r.tZ)(d.Badge,{localizationKey:(0,d.localizationKeys)("badge__primary")}),"verified"!==e.verification.status&&(0,r.tZ)(d.Badge,{localizationKey:(0,d.localizationKeys)("badge__unverified")})]})})]}),(0,r.tZ)(ek,{walletId:o,isVerified:"verified"===e.verification.status})]},o),(0,r.tZ)(S.a.Open,{value:"remove-".concat(o),children:(0,r.tZ)(S.a.Card,{variant:"destructive",children:(0,r.tZ)(eB,{walletId:e.id})})})]},e.id)})}),i&&(0,r.tZ)(ex,{})]})]}):null}),ek=e=>{let{walletId:t,isVerified:i}=e,l=(0,o.useCardState)(),{open:a}=(0,C.XC)(),{user:n}=(0,f.aF)(),s=(null==n?void 0:n.primaryWeb3WalletId)===t,c=(0,f.WZ)(()=>null==n?void 0:n.update({primaryWeb3WalletId:t})),u=[!s&&i?{label:(0,d.localizationKeys)("userProfile.start.web3WalletsSection.detailsAction__nonPrimary"),onClick:()=>{c().catch(e=>(0,Z.S3)(e,[],l.setError))}}:null,{label:(0,d.localizationKeys)("userProfile.start.web3WalletsSection.destructiveAction"),isDestructive:!0,onClick:()=>a("remove-".concat(t))}].filter(e=>null!==e);return(0,r.tZ)(P.a,{actions:u})},eI=(0,o.withCardStateProvider)(()=>{var e,t,i,l;let{attributes:a,social:n,enterpriseSSO:s}=(0,c.useEnvironment)().userSettings,u=(0,o.useCardState)(),{user:h}=(0,f.aF)(),{shouldAllowIdentificationCreation:m}=(0,c.useUserProfileContext)(),p=null==(e=a.username)?void 0:e.enabled,y=null==(t=a.email_address)?void 0:t.enabled,P=null==(i=a.phone_number)?void 0:i.enabled,Z=n&&Object.values(n).filter(e=>e.enabled).length>0,b=h&&s.enabled,z=null==(l=a.web3_wallet)?void 0:l.enabled;return(0,r.tZ)(d.Col,{elementDescriptor:d.descriptors.page,sx:e=>({gap:e.space.$8,color:e.colors.$colorForeground}),children:(0,r.BX)(d.Col,{elementDescriptor:d.descriptors.profilePage,elementId:d.descriptors.profilePage.setId("account"),children:[(0,r.tZ)(g.h.Root,{children:(0,r.tZ)(g.h.Title,{localizationKey:(0,d.localizationKeys)("userProfile.start.headerTitle__account"),sx:e=>({marginBottom:e.space.$4}),textVariant:"h2"})}),(0,r.tZ)(v.Z.Alert,{children:u.error}),(0,r.tZ)(ez,{}),p&&(0,r.tZ)(ep,{}),y&&(0,r.tZ)(Y,{shouldAllowCreation:m}),P&&(0,r.tZ)(es,{shouldAllowCreation:m}),Z&&(0,r.tZ)(E,{shouldAllowCreation:m}),b&&(0,r.tZ)(j,{}),z&&(0,r.tZ)(ew,{shouldAllowCreation:m})]})})});i(38062);var eA=i(58104),eT=i(53997),eX=i(96519);let eL=()=>{let e,{user:t}=(0,f.aF)(),{session:i}=(0,f.kP)(),{data:l,isLoading:o}=(0,K.ib)(null==t?void 0:t.getSessions,"user-sessions");return(0,r.tZ)(y.zd.Root,{title:(0,d.localizationKeys)("userProfile.start.activeDevicesSection.title"),centered:!1,id:"activeDevices",children:(0,r.tZ)(y.zd.ItemList,{id:"activeDevices",disableAnimation:!0,children:o?(0,r.tZ)(eA.m,{}):null==l?void 0:l.sort((e=i.id,t=>t.id===e?-1:1)).map(e=>eF(e.status)?(0,r.tZ)(eE,{session:e},e.id):null)})})},eF=e=>["active","pending"].includes(e),eE=e=>{var t;let{session:i}=e,l=(null==(t=(0,f.kP)().session)?void 0:t.id)===i.id,o=(0,K._m)(),a=(0,f.WZ)(i.revoke.bind(i)),n=async()=>{if(!l&&i)return o.setLoading(),a().catch(e=>(0,Z.S3)(e,[],o.setError)).finally(()=>o.setIdle())};return(0,r.tZ)(y.zd.Item,{id:"activeDevices",elementDescriptor:d.descriptors.activeDeviceListItem,elementId:l?d.descriptors.activeDeviceListItem.setId("current"):void 0,sx:{alignItems:"flex-start",opacity:o.isLoading?.5:1},isDisabled:o.isLoading,children:(0,r.BX)(r.HY,{children:[(0,r.tZ)(eD,{session:i}),!l&&(0,r.tZ)(eO,{revoke:n})]})})},eD=e=>{let{session:t}=(0,f.kP)(),i=(null==t?void 0:t.id)===e.session.id,l=!!(null==t?void 0:t.actor),o=!!e.session.actor,{city:a,country:n,browserName:s,browserVersion:c,deviceType:u,ipAddress:h,isMobile:m}=e.session.latestActivity,p="".concat(s||""," ").concat(c||"").trim()||"Web browser",v=[a||"",n||""].filter(Boolean).join(", ").trim()||null,{t:g}=(0,d.useLocalizations)();return(0,r.BX)(d.Flex,{elementDescriptor:d.descriptors.activeDevice,elementId:i?d.descriptors.activeDevice.setId("current"):void 0,sx:e=>({width:"100%",overflow:"hidden",gap:e.space.$4,[ed.mqu.sm]:{gap:e.space.$2}}),children:[(0,r.tZ)(d.Flex,{sx:e=>({[ed.mqu.sm]:{padding:"0"},borderRadius:e.radii.$md}),children:(0,r.tZ)(d.Icon,{elementDescriptor:d.descriptors.activeDeviceIcon,elementId:d.descriptors.activeDeviceIcon.setId(m?"mobile":"desktop"),icon:m?eX.Fh:eX.eu,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,r.BX)(d.Col,{align:"start",gap:1,children:[(0,r.BX)(d.Flex,{center:!0,gap:2,children:[(0,r.tZ)(d.Text,{children:u||(m?"Mobile device":"Desktop device")}),i&&(0,r.tZ)(d.Badge,{localizationKey:(0,d.localizationKeys)("badge__thisDevice"),colorScheme:l?"danger":"primary"}),l&&!o&&(0,r.tZ)(d.Badge,{localizationKey:(0,d.localizationKeys)("badge__userDevice")}),!i&&o&&(0,r.tZ)(d.Badge,{localizationKey:(0,d.localizationKeys)("badge__otherImpersonatorDevice"),colorScheme:"danger"})]}),(0,r.tZ)(d.Text,{colorScheme:"secondary",children:p}),(0,r.BX)(d.Text,{colorScheme:"secondary",children:[h," (",v,")"]}),(0,r.tZ)(d.Text,{colorScheme:"secondary",children:g((0,eT.Q)(e.session.lastActiveAt))})]})]})},eO=e=>{let{revoke:t}=e,i=[{label:(0,d.localizationKeys)("userProfile.start.activeDevicesSection.destructiveAction"),isDestructive:!0,onClick:t}].filter(e=>null!==e);return(0,r.tZ)(P.a,{actions:i})};var e$=i(54264);let eN=(0,o.withCardStateProvider)(e=>{let{onReset:t}=e,i=(0,o.useCardState)(),{afterSignOutUrl:l,afterMultiSessionSingleSignOutUrl:a}=(0,c.useSignOutContext)(),{user:n}=(0,f.aF)(),{t:s}=(0,d.useLocalizations)(),{otherSessions:u}=(0,e$.j)({user:n}),{setActive:h}=(0,f.cL)(),m=(0,f.WZ)(()=>null==n?void 0:n.delete()),p=(0,et.Yp)("deleteConfirmation","",{type:"text",label:(0,d.localizationKeys)("userProfile.deletePage.actionDescription"),isRequired:!0,placeholder:(0,d.localizationKeys)("formFieldInputPlaceholder__confirmDeletionUserAccount")}),v=p.value===(s((0,d.localizationKeys)("formFieldInputPlaceholder__confirmDeletionUserAccount"))||"Delete account"),g=async()=>{if(v)try{await m();let e=0===u.length?l:a;return await h({session:null,redirectUrl:e})}catch(e){(0,Z.S3)(e,[],i.setError)}};return(0,r.tZ)(ee.Y,{headerTitle:(0,d.localizationKeys)("userProfile.deletePage.title"),sx:e=>({gap:e.space.$0x5}),children:(0,r.BX)(G.l.Root,{onSubmit:g,children:[(0,r.BX)(d.Col,{gap:1,children:[(0,r.tZ)(d.Text,{colorScheme:"secondary",localizationKey:(0,d.localizationKeys)("userProfile.deletePage.messageLine1")}),(0,r.tZ)(d.Text,{colorScheme:"danger",localizationKey:(0,d.localizationKeys)("userProfile.deletePage.messageLine2")})]}),(0,r.tZ)(G.l.ControlRow,{elementId:p.id,children:(0,r.tZ)(G.l.PlainInput,{...p.props,ignorePasswordManager:!0})}),(0,r.tZ)(J.A,{submitLabel:(0,d.localizationKeys)("userProfile.deletePage.confirm"),colorScheme:"danger",isDisabled:!v,onReset:t})]})})}),eW=()=>{let{close:e}=(0,C.XC)();return(0,r.tZ)(eN,{onSuccess:e,onReset:e})},eM=()=>(0,r.tZ)(y.zd.Root,{title:(0,d.localizationKeys)("userProfile.start.dangerSection.title"),id:"danger",sx:{alignItems:"center",[ed.mqu.md]:{alignItems:"flex-start"}},children:(0,r.BX)(S.a.Root,{children:[(0,r.tZ)(S.a.Closed,{value:"delete",children:(0,r.tZ)(y.zd.Item,{id:"danger",sx:e=>({paddingLeft:e.space.$1}),children:(0,r.tZ)(S.a.Trigger,{value:"delete",children:(0,r.tZ)(y.zd.Button,{id:"danger",variant:"ghost",colorScheme:"danger",localizationKey:(0,d.localizationKeys)("userProfile.start.dangerSection.deleteAccountButton")})})})}),(0,r.tZ)(S.a.Open,{value:"delete",children:(0,r.tZ)(S.a.Card,{variant:"destructive",children:(0,r.tZ)(eW,{})})})]})});var eU=i(5994),eY=i(85838);let eq=(0,o.withCardStateProvider)(e=>{let{onSuccess:t,onReset:i}=e,{user:a}=(0,f.aF)(),n=(0,o.useCardState)(),s=(0,f.WZ)(()=>null==a?void 0:a.createBackupCode()),[c,u]=l.useState(void 0);return(l.useEffect(()=>{!c&&a&&s().then(e=>u(e)).catch(e=>{if((0,eS.mh)(e))return i();(0,Z.S3)(e,[],n.setError)})},[]),n.error)?(0,r.tZ)(ee.Y,{headerTitle:(0,d.localizationKeys)("userProfile.backupCodePage.title")}):(0,r.tZ)(ee.Y,{headerTitle:(0,d.localizationKeys)("userProfile.backupCodePage.title"),children:c?(0,r.BX)(r.HY,{children:[(0,r.tZ)(d.Text,{localizationKey:(0,d.localizationKeys)("userProfile.backupCodePage.successMessage")}),(0,r.tZ)(eY.j,{subtitle:(0,d.localizationKeys)("userProfile.backupCodePage.subtitle__codelist"),backupCodes:c.codes}),(0,r.tZ)(J.K,{children:(0,r.tZ)(d.Button,{autoFocus:!0,onClick:t,localizationKey:(0,d.localizationKeys)("userProfile.formButtonPrimary__finish"),elementDescriptor:d.descriptors.formButtonPrimary})})]}):(0,r.tZ)(eA.m,{})})}),ej=(0,o.withCardStateProvider)(e=>{let{onSuccess:t,onReset:i}=e,l=(0,z.a2)();return(0,r.BX)(z.en,{...l.props,children:[(0,r.tZ)(eH,{onContinue:l.nextStep}),(0,r.tZ)(eq,{onSuccess:t,onReset:i})]})}),eH=e=>{let{onContinue:t}=e,{close:i}=(0,C.XC)();return(0,r.BX)(ee.Y,{headerTitle:(0,d.localizationKeys)("userProfile.backupCodePage.title"),children:[(0,r.tZ)(d.Text,{localizationKey:(0,d.localizationKeys)("userProfile.backupCodePage.infoText1")}),(0,r.tZ)(d.Text,{localizationKey:(0,d.localizationKeys)("userProfile.backupCodePage.infoText2")}),(0,r.BX)(J.K,{sx:{marginTop:0},children:[(0,r.tZ)(d.Button,{textVariant:"buttonSmall",onClick:t,localizationKey:(0,d.localizationKeys)("userProfile.formButtonPrimary__finish"),elementDescriptor:d.descriptors.formButtonPrimary}),(0,r.tZ)(d.Button,{variant:"ghost",onClick:i,localizationKey:(0,d.localizationKeys)("userProfile.formButtonReset"),elementDescriptor:d.descriptors.formButtonReset})]})]})};var eV=i(53412),eQ=i(67263);let eG=(0,o.withCardStateProvider)(e=>{var t,i,o,a;let{onReset:n,onSuccess:s}=e,u=l.useRef(),h=(0,z.a2)({defaultStep:2}),m=null==(t=(0,c.useEnvironment)().userSettings.attributes.backup_code)?void 0:t.enabled;return(0,r.BX)(z.en,{...h.props,children:[(0,r.tZ)(el,{title:(0,d.localizationKeys)("userProfile.phoneNumberPage.title"),resourceRef:u,onSuccess:h.nextStep,onUseExistingNumberClick:()=>h.goToStep(2),onReset:n}),(0,r.tZ)(e0,{title:(0,d.localizationKeys)("userProfile.mfaPhoneCodePage.title"),resourceRef:u,onSuccess:()=>m?h.goToStep(3):s(),onReset:()=>h.goToStep(2)}),(0,r.tZ)(e1,{onSuccess:m?h.nextStep:s,onReset:n,onAddPhoneClick:()=>h.goToStep(0),onUnverifiedPhoneClick:e=>{u.current=e,h.goToStep(1)},title:(0,d.localizationKeys)("userProfile.mfaPhoneCodePage.title"),resourceRef:u}),m&&(0,r.tZ)(eQ.I,{title:(0,d.localizationKeys)("userProfile.mfaPhoneCodePage.successTitle"),text:(null==(i=u.current)?void 0:i.backupCodes)&&(null==(o=u.current)?void 0:o.backupCodes.length)>0?[(0,d.localizationKeys)("userProfile.mfaPhoneCodePage.successMessage1"),(0,d.localizationKeys)("userProfile.mfaPhoneCodePage.successMessage2")]:[(0,d.localizationKeys)("userProfile.mfaPhoneCodePage.successMessage1")],onFinish:n,contents:(0,r.tZ)(eY.j,{backupCodes:null==(a=u.current)?void 0:a.backupCodes})})]})}),eJ=e=>{let{phone:t,onSuccess:i,onUnverifiedPhoneClick:l,resourceRef:a}=e,n=(0,o.useCardState)(),s=(0,f.WZ)(()=>t.setReservedForSecondFactor({reserved:!0})),{country:c}=(0,Q.Z_)(t.phoneNumber),u=(0,Q.L_)(t.phoneNumber),h=async()=>{if("verified"!==t.verification.status)return l(t);n.setLoading(t.id);try{await s(),a.current=t,i()}catch(e){(0,Z.S3)(e,[],n.setError)}finally{n.setIdle()}};return(0,r.BX)(d.Button,{variant:"outline",colorScheme:"neutral",sx:{justifyContent:"start"},onClick:h,isLoading:n.loadingMetadata===t.id,isDisabled:n.isLoading,children:[c.iso.toUpperCase()," ",u]},t.id)},e0=e=>{var t,i,l;let{title:a,onSuccess:n,resourceRef:s,onReset:c}=e,u=(0,o.useCardState)(),h=s.current,m=(0,f.WZ)(()=>null==h?void 0:h.setReservedForSecondFactor({reserved:!0})),p=async()=>{u.setLoading(null==h?void 0:h.id);try{await m(),s.current=h,n()}catch(e){(0,Z.S3)(e,[],u.setError)}finally{u.setIdle()}};return(0,r.tZ)(ee.Y,{headerTitle:a,headerSubtitle:(0,d.localizationKeys)("userProfile.phoneNumberPage.verifySubtitle",{identifier:(null==(t=s.current)?void 0:t.phoneNumber)||""}),children:(0,r.tZ)(ei.H,{nextStep:()=>{p()},identification:s.current,identifier:null==(i=s.current)?void 0:i.phoneNumber,prepareVerification:null==(l=s.current)?void 0:l.prepareVerification,onReset:c})})},e1=e=>{let{onSuccess:t,onReset:i,title:l,onAddPhoneClick:o,onUnverifiedPhoneClick:a,resourceRef:n}=e,{user:s}=(0,f.aF)();if(!s)return null;let c=s.phoneNumbers.filter(e=>!e.reservedForSecondFactor);return(0,r.BX)(ee.Y,{headerTitle:l,gap:1,children:[(0,r.tZ)(d.Text,{localizationKey:(0,d.localizationKeys)(c.length?"userProfile.mfaPhoneCodePage.subtitle__availablePhoneNumbers":"userProfile.mfaPhoneCodePage.subtitle__unavailablePhoneNumbers"),colorScheme:"secondary"}),c.length>0&&(0,r.tZ)(d.Col,{gap:2,children:c.map(e=>(0,r.tZ)(eJ,{onSuccess:t,phone:e,onUnverifiedPhoneClick:a,resourceRef:n},e.id))}),(0,r.BX)(J.K,{sx:{flexDirection:"row",justifyContent:"space-between"},children:[(0,r.tZ)(eV.h,{variant:"ghost","aria-label":"Add phone number",icon:(0,r.tZ)(d.Icon,{icon:eX.v3,sx:e=>({marginRight:e.space.$2})}),localizationKey:(0,d.localizationKeys)("userProfile.mfaPhoneCodePage.primaryButton__addPhoneNumber"),onClick:o}),(0,r.tZ)(d.Button,{variant:"ghost",localizationKey:(0,d.localizationKeys)("userProfile.formButtonReset"),onClick:i})]})]})};var e3=i(68864);let e2=(0,o.withCardStateProvider)(e=>{let{title:t,onSuccess:i,onReset:a}=e,{user:n}=(0,f.aF)(),s=(0,o.useCardState)(),c=(0,f.WZ)(()=>null==n?void 0:n.createTOTP()),{close:u}=(0,C.XC)(),[h,m]=l.useState(void 0),[p,v]=l.useState("qr");return(l.useEffect(()=>{n&&c().then(e=>m(e)).catch(e=>(0,eS.uX)(e)&&"reverification_cancelled"===e.code?u():(0,Z.S3)(e,[],s.setError))},[]),s.error)?(0,r.tZ)(ee.Y,{headerTitle:t}):(0,r.BX)(ee.Y,{headerTitle:t,headerSubtitle:"qr"==p?(0,d.localizationKeys)("userProfile.mfaTOTPPage.authenticatorApp.infoText__ableToScan"):(0,d.localizationKeys)("userProfile.mfaTOTPPage.authenticatorApp.infoText__unableToScan"),children:[!h&&(0,r.tZ)(eA.m,{}),h&&(0,r.BX)(r.HY,{children:[(0,r.BX)(d.Col,{gap:4,children:["qr"==p&&(0,r.tZ)(z.s_,{justify:"center",url:h.uri||""}),"uri"==p&&(0,r.BX)(r.HY,{children:[(0,r.tZ)(d.Text,{colorScheme:"secondary",localizationKey:(0,d.localizationKeys)("userProfile.mfaTOTPPage.authenticatorApp.inputLabel__unableToScan1")}),(0,r.tZ)(e3.D,{value:h.secret}),(0,r.tZ)(d.Text,{colorScheme:"secondary",localizationKey:(0,d.localizationKeys)("userProfile.mfaTOTPPage.authenticatorApp.inputLabel__unableToScan2")}),(0,r.tZ)(e3.D,{value:h.uri})]})]}),(0,r.BX)(d.Flex,{justify:"between",align:"center",sx:{width:"100%"},children:["qr"==p&&(0,r.tZ)(d.Button,{variant:"link",textVariant:"buttonLarge",onClick:()=>v("uri"),localizationKey:(0,d.localizationKeys)("userProfile.mfaTOTPPage.authenticatorApp.buttonUnableToScan__nonPrimary")}),"uri"==p&&(0,r.tZ)(d.Button,{variant:"link",textVariant:"buttonLarge",onClick:()=>v("qr"),localizationKey:(0,d.localizationKeys)("userProfile.mfaTOTPPage.authenticatorApp.buttonAbleToScan__nonPrimary")}),(0,r.BX)(J.K,{children:[(0,r.tZ)(d.Button,{onClick:i,localizationKey:(0,d.localizationKeys)("userProfile.formButtonPrimary__continue"),elementDescriptor:d.descriptors.formButtonPrimary}),(0,r.tZ)(d.Button,{variant:"ghost",onClick:a,localizationKey:(0,d.localizationKeys)("userProfile.formButtonReset"),elementDescriptor:d.descriptors.formButtonReset})]})]})]})]})});var e6=i(12667);let e4=(0,o.withCardStateProvider)(e=>{let{onSuccess:t,onReset:i,resourceRef:l}=e,{user:o}=(0,f.aF)(),a=(0,e6.e3)({onCodeEntryFinished:(e,t,i)=>{null==o||o.verifyTOTP({code:e}).then(e=>t(e)).catch(i)},onResolve:e=>{l.current=e,t()}});return(0,r.BX)(ee.Y,{headerTitle:(0,d.localizationKeys)("userProfile.mfaTOTPPage.title"),children:[(0,r.tZ)(d.Col,{children:(0,r.tZ)(G.l.OTPInput,{...a,label:(0,d.localizationKeys)("userProfile.mfaTOTPPage.verifyTitle"),description:(0,d.localizationKeys)("userProfile.mfaTOTPPage.verifySubtitle")})}),(0,r.tZ)(J.K,{sx:{marginTop:0},children:(0,r.tZ)(d.Button,{onClick:i,variant:"ghost",isDisabled:a.isLoading,localizationKey:(0,d.localizationKeys)("userProfile.formButtonReset"),elementDescriptor:d.descriptors.formButtonReset})})]})}),e5=(0,o.withCardStateProvider)(e=>{var t;let{onReset:i}=e,o=(0,z.a2)(),a=l.useRef();return(0,r.BX)(z.en,{...o.props,children:[(0,r.tZ)(e2,{title:(0,d.localizationKeys)("userProfile.mfaTOTPPage.title"),onSuccess:o.nextStep,onReset:i}),(0,r.tZ)(e4,{onSuccess:o.nextStep,onReset:i,resourceRef:a}),(0,r.tZ)(eQ.I,{title:(0,d.localizationKeys)("userProfile.mfaTOTPPage.title"),text:(0,d.localizationKeys)("userProfile.mfaTOTPPage.successMessage"),onFinish:i,contents:(0,r.tZ)(eY.j,{subtitle:(0,d.localizationKeys)("userProfile.backupCodePage.successSubtitle"),backupCodes:null==(t=a.current)?void 0:t.backupCodes})})]})}),e7=(0,o.withCardStateProvider)(e=>{let{onSuccess:t,onReset:i,selectedStrategy:a}=e,n=(0,o.useCardState)(),{userSettings:{attributes:s}}=(0,c.useEnvironment)(),{user:u}=(0,f.aF)();if(!u)return null;let h=(0,d.localizationKeys)("userProfile.mfaPage.title"),m=l.useMemo(()=>(0,$.kZ)(s,u),[]);return(l.useEffect(()=>{0===m.length&&n.setError("There are no second factors available to add")},[]),n.error)?(0,r.tZ)(ee.Y,{headerTitle:h}):0!==m.length||a?(0,r.tZ)(e9,{onSuccess:t,onReset:i,method:a||m[0]}):null}),e9=e=>{let{method:t,onSuccess:i,onReset:l}=e;switch(t){case"phone_code":return(0,r.tZ)(eG,{onSuccess:i,onReset:l});case"totp":return(0,r.tZ)(e5,{onSuccess:i,onReset:l});case"backup_code":return(0,r.tZ)(ej,{onSuccess:i,onReset:l});default:return null}},e8=()=>{let{close:e}=(0,C.XC)();return(0,r.tZ)(T,{onSuccess:e,onReset:e})},te=e=>{let{close:t}=(0,C.XC)();return(0,r.tZ)(A,{onSuccess:t,onReset:t,...e})},tt=()=>{let{close:e}=(0,C.XC)();return(0,r.tZ)(eq,{onSuccess:e,onReset:e})},ti=e=>{let{close:t}=(0,C.XC)();return(0,r.tZ)(e7,{onSuccess:t,onReset:t,selectedStrategy:e.selectedStrategy})},tr=()=>{var e,t;let{userSettings:{attributes:i,signUp:o}}=(0,c.useEnvironment)(),{user:a}=(0,f.aF)(),[n,s]=(0,l.useState)(null);if(!a)return null;let u=(0,$.mG)(i),h=(0,$.kZ)(i,a),m=u.includes("totp")&&a.totpEnabled,p=u.includes("backup_code")&&a.backupCodeEnabled,v=u.includes("phone_code"),g=a.phoneNumbers.filter(e=>"verified"===e.verification.status).filter(e=>e.reservedForSecondFactor).sort($.Oy),P=!!((null==(e=o.mfa)?void 0:e.required)&&0===g.length),Z=!!((null==(t=o.mfa)?void 0:t.required)&&!m&&1===g.length);return(0,r.tZ)(y.zd.Root,{title:(0,d.localizationKeys)("userProfile.start.mfaSection.title"),centered:!1,id:"mfa",children:(0,r.tZ)(S.a.Root,{value:n,onChange:s,children:(0,r.BX)(y.zd.ItemList,{id:"mfa",children:[m&&(0,r.BX)(r.HY,{children:[(0,r.BX)(y.zd.Item,{id:"mfa",hoverable:!0,children:[(0,r.BX)(d.Flex,{sx:e=>({gap:e.space.$2,alignItems:"center"}),children:[(0,r.tZ)(d.Icon,{icon:eX.hc,sx:e=>({color:e.colors.$neutralAlpha700})}),(0,r.tZ)(d.Text,{localizationKey:(0,d.localizationKeys)("userProfile.start.mfaSection.totp.headerTitle")}),(0,r.tZ)(d.Badge,{localizationKey:(0,d.localizationKeys)("badge__default")})]}),!P&&(0,r.tZ)(ta,{})]}),(0,r.tZ)(S.a.Open,{value:"remove-totp",children:(0,r.tZ)(S.a.Card,{variant:"destructive",children:(0,r.tZ)(e8,{})})})]}),v&&g.map(e=>{let t=!m&&e.defaultSecondFactor,i=e.id;return(0,r.BX)(l.Fragment,{children:[(0,r.BX)(y.zd.Item,{id:"mfa",hoverable:!0,children:[(0,r.BX)(d.Flex,{sx:e=>({gap:e.space.$2,alignItems:"center"}),children:[(0,r.tZ)(d.Icon,{icon:eX.ij,sx:e=>({color:e.colors.$neutralAlpha700})}),(0,r.BX)(d.Text,{children:["SMS Code ",(0,r.tZ)(eU.q,{value:e.phoneNumber})]}),t&&(0,r.tZ)(d.Badge,{localizationKey:(0,d.localizationKeys)("badge__default")})]}),(0,r.tZ)(tl,{phone:e,isDefault:t,hidePhoneCodeDeleteAction:Z})]}),(0,r.tZ)(S.a.Open,{value:"remove-".concat(i),children:(0,r.tZ)(S.a.Card,{variant:"destructive",children:(0,r.tZ)(te,{phoneId:i})})})]},i)}),p&&(0,r.BX)(r.HY,{children:[(0,r.BX)(y.zd.Item,{id:"mfa",hoverable:!0,children:[(0,r.BX)(d.Flex,{sx:e=>({gap:e.space.$2,alignItems:"center"}),children:[(0,r.tZ)(d.Icon,{icon:eX.Qi,sx:e=>({color:e.colors.$neutralAlpha700})}),(0,r.tZ)(d.Text,{localizationKey:(0,d.localizationKeys)("userProfile.start.mfaSection.backupCodes.headerTitle")})]}),(0,r.tZ)(to,{})]}),(0,r.tZ)(S.a.Open,{value:"regenerate",children:(0,r.tZ)(S.a.Card,{children:(0,r.tZ)(tt,{})})})]}),(0,r.tZ)(ts,{secondFactorsAvailableToAdd:h,onClick:()=>s(null)})]})})})},tl=e=>{let{phone:t,isDefault:i,hidePhoneCodeDeleteAction:l}=e,{open:a}=(0,C.XC)(),n=(0,o.useCardState)(),s=t.id,c=[!i?{label:(0,d.localizationKeys)("userProfile.start.mfaSection.phoneCode.actionLabel__setDefault"),onClick:()=>t.makeDefaultSecondFactor().catch(e=>(0,Z.S3)(e,[],n.setError))}:null,!l?{label:(0,d.localizationKeys)("userProfile.start.mfaSection.phoneCode.destructiveActionLabel"),isDestructive:!0,onClick:()=>a("remove-".concat(s))}:null].filter(e=>null!==e);return 0===c.length?null:(0,r.tZ)(P.a,{actions:c})},to=()=>{let{open:e}=(0,C.XC)(),t=[{label:(0,d.localizationKeys)("userProfile.start.mfaSection.backupCodes.actionLabel__regenerate"),onClick:()=>e("regenerate")}].filter(e=>null!==e);return(0,r.tZ)(P.a,{actions:t})},ta=()=>{let{open:e}=(0,C.XC)(),t=[{label:(0,d.localizationKeys)("userProfile.start.mfaSection.totp.destructiveActionTitle"),isDestructive:!0,onClick:()=>e("remove-totp")}].filter(e=>null!==e);return(0,r.tZ)(P.a,{actions:t})},tn={phone_code:{icon:eX.ij,text:"SMS code",key:"phone_code"},totp:{icon:eX.hc,text:"Authenticator application",key:"totp"},backup_code:{icon:eX.Qi,text:"Backup code",key:"backup_code"}},ts=e=>{let{open:t}=(0,C.XC)(),{secondFactorsAvailableToAdd:i,onClick:o}=e,[a,n]=(0,l.useState)(),s=l.useMemo(()=>i.map(e=>tn[e]||null).filter(e=>null!==e),[i]);return(0,r.BX)(r.HY,{children:[i.length>0&&(0,r.tZ)(S.a.Closed,{value:"multi-factor",children:(0,r.tZ)(y.zd.ActionMenu,{id:"mfa",triggerLocalizationKey:(0,d.localizationKeys)("userProfile.start.mfaSection.primaryButton"),onClick:o,children:s.map(e=>(0,r.tZ)(y.zd.ActionMenuItem,{id:e.key,localizationKey:e.text,leftIcon:e.icon,onClick:()=>{n(e.key),t("multi-factor")}},e.key))})}),(0,r.tZ)(S.a.Open,{value:"multi-factor",children:(0,r.tZ)(S.a.Card,{children:a&&(0,r.tZ)(ti,{selectedStrategy:a})})})]})},tc=e=>{let{close:t}=(0,C.XC)();return(0,r.tZ)(X,{onSuccess:t,onReset:t,...e})},td=e=>{let{close:t}=(0,C.XC)();return(0,r.tZ)(tu,{onSuccess:t,onReset:t,passkey:e.passkey})},tu=(0,o.withCardStateProvider)(e=>{let{onSuccess:t,onReset:i,passkey:l}=e,a=(0,o.useCardState)(),n=(0,et.Yp)("passkeyName",l.name||"",{type:"text",label:(0,d.localizationKeys)("formFieldLabel__passkeyName"),isRequired:!0}),s=n.value.length>1&&l.name!==n.value,c=async e=>(e.preventDefault(),l.update({name:n.value}).then(t).catch(e=>(0,Z.S3)(e,[n],a.setError)));return(0,r.tZ)(ee.Y,{headerTitle:(0,d.localizationKeys)("userProfile.passkeyScreen.title__rename"),headerSubtitle:(0,d.localizationKeys)("userProfile.passkeyScreen.subtitle__rename"),children:(0,r.BX)(G.l.Root,{onSubmit:c,children:[(0,r.tZ)(G.l.ControlRow,{elementId:n.id,children:(0,r.tZ)(G.l.PlainInput,{...n.props,autoComplete:"off"})}),(0,r.tZ)(J.A,{submitLabel:(0,d.localizationKeys)("userProfile.formButtonPrimary__save"),isDisabled:!s,onReset:i})]})})}),th=()=>{let{user:e}=(0,f.aF)(),[t,i]=(0,l.useState)(null);return e?(0,r.tZ)(y.zd.Root,{title:(0,d.localizationKeys)("userProfile.start.passkeysSection.title"),centered:!1,id:"passkeys",children:(0,r.tZ)(S.a.Root,{value:t,onChange:i,children:(0,r.BX)(y.zd.ItemList,{id:"passkeys",children:[e.passkeys.map(e=>{let t=e.id;return(0,r.BX)(l.Fragment,{children:[(0,r.tZ)(tm,{...e},t),(0,r.tZ)(S.a.Open,{value:"remove-".concat(t),children:(0,r.tZ)(S.a.Card,{variant:"destructive",children:(0,r.tZ)(tc,{passkey:e})})}),(0,r.tZ)(S.a.Open,{value:"rename-".concat(t),children:(0,r.tZ)(S.a.Card,{children:(0,r.tZ)(td,{passkey:e})})})]},t)}),(0,r.tZ)(tv,{onClick:()=>i(null)})]})})}):null},tm=e=>(0,r.BX)(y.zd.Item,{id:"passkeys",hoverable:!0,sx:{alignItems:"flex-start"},children:[(0,r.tZ)(tp,{...e}),(0,r.tZ)(tf,{passkey:e})]}),tp=e=>{let{name:t,createdAt:i,lastUsedAt:l}=e,{t:o}=(0,d.useLocalizations)();return(0,r.tZ)(d.Flex,{sx:e=>({width:"100%",overflow:"hidden",gap:e.space.$4,[ed.mqu.sm]:{gap:e.space.$2}}),children:(0,r.BX)(d.Col,{align:"start",gap:1,children:[(0,r.tZ)(d.Text,{children:t}),(0,r.BX)(d.Text,{colorScheme:"secondary",children:["Created: ",o((0,eT.Q)(i))]}),l&&(0,r.BX)(d.Text,{colorScheme:"secondary",children:["Last used: ",o((0,eT.Q)(l))]})]})})},tf=e=>{let{passkey:t}=e,{open:i}=(0,C.XC)(),l=t.id,o=[{label:(0,d.localizationKeys)("userProfile.start.passkeysSection.menuAction__rename"),onClick:()=>i("rename-".concat(l))},{label:(0,d.localizationKeys)("userProfile.start.passkeysSection.menuAction__destructive"),isDestructive:!0,onClick:()=>i("remove-".concat(l))}];return(0,r.tZ)(P.a,{actions:o})},tv=e=>{let{onClick:t}=e,i=(0,o.useCardState)(),{isSatellite:l}=(0,f.cL)(),{user:a}=(0,f.aF)(),n=(0,f.WZ)(()=>null==a?void 0:a.createPasskey()),s=async()=>{if(null==t||t(),a)try{await n()}catch(e){(0,Z.S3)(e,[],i.setError)}};return l?null:(0,r.tZ)(y.zd.ArrowButton,{id:"passkeys",localizationKey:(0,d.localizationKeys)("userProfile.start.passkeysSection.primaryButton"),onClick:s})};i(79876);var tg=i(86842);let ty=(0,o.withCardStateProvider)(e=>{let{onSuccess:t,onReset:i}=e,{user:a}=(0,f.aF)(),n=(0,f.WZ)((e,t)=>e.updatePassword(...t));if(!a)return null;let{userSettings:{passwordSettings:s},authConfig:{reverification:u}}=(0,c.useEnvironment)(),{session:h}=(0,f.kP)(),m=a.passwordEnabled?(0,d.localizationKeys)("userProfile.passwordPage.title__update"):(0,d.localizationKeys)("userProfile.passwordPage.title__set"),p=(0,o.useCardState)(),v=a.enterpriseAccounts.some(e=>e.active),g=a.passwordEnabled&&!u,y=(0,l.useRef)({title:(0,d.localizationKeys)("userProfile.passwordPage.title__set")}),P=(0,et.Yp)("currentPassword","",{type:"password",label:(0,d.localizationKeys)("formFieldLabel__currentPassword"),isRequired:!0}),b=(0,et.Yp)("newPassword","",{type:"password",label:(0,d.localizationKeys)("formFieldLabel__newPassword"),isRequired:!0,validatePassword:!0,buildErrorMessage:e=>(0,tg.GM)(e,{t:R,locale:x,passwordSettings:s})}),z=(0,et.Yp)("confirmPassword","",{type:"password",label:(0,d.localizationKeys)("formFieldLabel__confirmPassword"),isRequired:!0}),S=(0,et.Yp)("signOutOfOtherSessions","",{type:"checkbox",label:(0,d.localizationKeys)("formFieldLabel__signOutOfOtherSessions"),defaultChecked:!0}),{setConfirmPasswordFeedback:C,isPasswordMatch:_}=(0,K.p5)({passwordField:b,confirmPasswordField:z}),{t:R,locale:x}=(0,d.useLocalizations)(),B=(g?P.value&&_:_)&&b.value&&z.value,w=async()=>{try{y.current={title:a.passwordEnabled?(0,d.localizationKeys)("userProfile.passwordPage.title__update"):(0,d.localizationKeys)("userProfile.passwordPage.title__set"),text:((e,t)=>{let i=[];return e?i.push((0,d.localizationKeys)("userProfile.passwordPage.successMessage__update")):i.push((0,d.localizationKeys)("userProfile.passwordPage.successMessage__set")),t&&i.push((0,d.localizationKeys)("userProfile.passwordPage.successMessage__signOutOfOtherSessions")),i})(a.passwordEnabled,!!S.checked)};let e={newPassword:b.value,signOutOfOtherSessions:S.checked,currentPassword:g?P.value:void 0};await n(a,[e]),t()}catch(e){(0,Z.S3)(e,[P,b,z],p.setError)}};return(0,r.BX)(ee.Y,{headerTitle:m,children:[v&&(0,r.tZ)(ev.e,{message:(0,d.localizationKeys)("userProfile.passwordPage.readonly")}),(0,r.BX)(G.l.Root,{onSubmit:w,onBlur:()=>{b.value&&C(z.value)},children:[(0,r.tZ)("input",{readOnly:!0,"data-testid":"hidden-identifier",id:"identifier-field",name:"identifier",value:(null==h?void 0:h.publicUserData.identifier)||"",style:{display:"none"}}),g&&(0,r.tZ)(G.l.ControlRow,{elementId:P.id,children:(0,r.tZ)(G.l.PasswordInput,{...P.props,minLength:6,isRequired:!0,autoFocus:!0,isDisabled:v})}),(0,r.tZ)(G.l.ControlRow,{elementId:b.id,children:(0,r.tZ)(G.l.PasswordInput,{...b.props,minLength:6,isRequired:!0,autoFocus:!a.passwordEnabled,isDisabled:v})}),(0,r.tZ)(G.l.ControlRow,{elementId:z.id,children:(0,r.tZ)(G.l.PasswordInput,{...z.props,onChange:e=>(e.target.value&&C(e.target.value),z.props.onChange(e)),isRequired:!0,isDisabled:v})}),(0,r.tZ)(G.l.ControlRow,{elementId:S.id,children:(0,r.tZ)(G.l.Checkbox,{...S.props,description:(0,d.localizationKeys)("userProfile.passwordPage.checkboxInfoText__signOutOfOtherSessions"),isDisabled:v})}),v?(0,r.tZ)(J.K,{children:(0,r.tZ)(G.l.ResetButton,{localizationKey:(0,d.localizationKeys)("userProfile.formButtonReset"),block:!1,onClick:i})}):(0,r.tZ)(J.A,{isDisabled:!B,onReset:i})]})]})}),tP=()=>{let{close:e}=(0,C.XC)();return(0,r.tZ)(ty,{onSuccess:e,onReset:e})},tZ=()=>{let{user:e}=(0,f.aF)();if(!e)return null;let{passwordEnabled:t}=e;return(0,r.tZ)(y.zd.Root,{centered:!1,title:(0,d.localizationKeys)("userProfile.start.passwordSection.title"),id:"password",children:(0,r.BX)(S.a.Root,{children:[(0,r.tZ)(S.a.Closed,{value:"edit",children:(0,r.BX)(y.zd.Item,{id:"password",sx:e=>({paddingLeft:t?void 0:"0",paddingTop:e.space.$0x25,paddingBottom:e.space.$0x25}),children:[t&&(0,r.tZ)(d.Text,{variant:"h2",children:"••••••••••"}),(0,r.tZ)(S.a.Trigger,{value:"edit",children:(0,r.tZ)(y.zd.Button,{id:"password",localizationKey:t?(0,d.localizationKeys)("userProfile.start.passwordSection.primaryButton__updatePassword"):(0,d.localizationKeys)("userProfile.start.passwordSection.primaryButton__setPassword")})})]})}),(0,r.tZ)(S.a.Open,{value:"edit",children:(0,r.tZ)(S.a.Card,{children:(0,r.tZ)(tP,{})})})]})})},tb=(0,o.withCardStateProvider)(()=>{var e;let{attributes:t,instanceIsPasswordBased:i}=(0,c.useEnvironment)().userSettings,l=(0,o.useCardState)(),{user:a}=(0,f.aF)(),{shouldAllowIdentificationCreation:n}=(0,c.useUserProfileContext)(),s=(null==(e=t.passkey)?void 0:e.enabled)&&n,u=(0,$.mG)(t).length>0,h=null==a?void 0:a.deleteSelfEnabled;return(0,r.tZ)(d.Col,{elementDescriptor:d.descriptors.page,sx:e=>({gap:e.space.$8}),children:(0,r.BX)(d.Col,{elementDescriptor:d.descriptors.profilePage,elementId:d.descriptors.profilePage.setId("security"),children:[(0,r.tZ)(g.h.Root,{children:(0,r.tZ)(g.h.Title,{localizationKey:(0,d.localizationKeys)("userProfile.start.headerTitle__security"),sx:e=>({marginBottom:e.space.$4}),textVariant:"h2"})}),(0,r.tZ)(v.Z.Alert,{children:l.error}),i&&(0,r.tZ)(tZ,{}),s&&(0,r.tZ)(th,{}),u&&(0,r.tZ)(tr,{}),(0,r.tZ)(eL,{}),h&&(0,r.tZ)(eM,{})]})})}),tz=(0,l.lazy)(()=>Promise.all([i.e("9573"),i.e("5645"),i.e("7502"),i.e("82")]).then(i.bind(i,41470)).then(e=>({default:e.BillingPage}))),tS=(0,l.lazy)(()=>Promise.all([i.e("9573"),i.e("4616"),i.e("2809")]).then(i.bind(i,38595)).then(e=>({default:e.APIKeysPage}))),tC=(0,l.lazy)(()=>Promise.all([i.e("9573"),i.e("4170"),i.e("99")]).then(i.bind(i,83487)).then(e=>({default:e.PlansPage}))),tK=(0,l.lazy)(()=>Promise.all([i.e("9573"),i.e("5645"),i.e("9177")]).then(i.bind(i,15515)).then(e=>({default:e.StatementPage}))),t_=(0,l.lazy)(()=>Promise.all([i.e("9573"),i.e("8711")]).then(i.bind(i,12264)).then(e=>({default:e.PaymentAttemptPage}))),tR=()=>{var e;let{pages:t,shouldShowBilling:i,apiKeysProps:o}=(0,c.useUserProfileContext)(),{apiKeysSettings:a,commerceSettings:n}=(0,c.useEnvironment)(),d=t.routes[0].id===s.xM.ACCOUNT,h=t.routes[0].id===s.xM.SECURITY,m=t.routes[0].id===s.xM.BILLING,f=t.routes[0].id===s.xM.API_KEYS,v=null==(e=t.contents)?void 0:e.map((e,t)=>{let i=!d&&!h&&0===t;return(0,r.tZ)(u.Route,{index:i,path:i?void 0:e.url,children:(0,r.tZ)(p.O,{mount:e.mount,unmount:e.unmount})},"custom-page-".concat(e.url))});return(0,r.BX)(u.Switch,{children:[v,(0,r.BX)(u.Route,{children:[(0,r.tZ)(u.Route,{path:d?void 0:"account",children:(0,r.tZ)(u.Switch,{children:(0,r.tZ)(u.Route,{index:!0,children:(0,r.tZ)(eI,{})})})}),(0,r.tZ)(u.Route,{path:h?void 0:"security",children:(0,r.tZ)(u.Switch,{children:(0,r.tZ)(u.Route,{index:!0,children:(0,r.tZ)(tb,{})})})}),n.billing.user.enabled&&i?(0,r.tZ)(u.Route,{path:m?void 0:"billing",children:(0,r.BX)(u.Switch,{children:[(0,r.tZ)(u.Route,{index:!0,children:(0,r.tZ)(l.Suspense,{fallback:"",children:(0,r.tZ)(tz,{})})}),n.billing.user.hasPaidPlans?(0,r.tZ)(u.Route,{path:"plans",children:(0,r.tZ)(l.Suspense,{fallback:"",children:(0,r.tZ)(tC,{})})}):null,(0,r.tZ)(u.Route,{path:"statement/:statementId",children:(0,r.tZ)(l.Suspense,{fallback:"",children:(0,r.tZ)(tK,{})})}),(0,r.tZ)(u.Route,{path:"payment-attempt/:paymentAttemptId",children:(0,r.tZ)(l.Suspense,{fallback:"",children:(0,r.tZ)(t_,{})})})]})}):null,a.user_api_keys_enabled&&!(null==o?void 0:o.hide)&&(0,r.tZ)(u.Route,{path:f?void 0:"api-keys",children:(0,r.tZ)(u.Switch,{children:(0,r.tZ)(u.Route,{index:!0,children:(0,r.tZ)(l.Suspense,{fallback:"",children:(0,r.tZ)(tS,{})})})})})]})]})};var tx=i(12786);let tB=(0,c.withCoreUserGuard)(()=>{let e=l.useRef(null);return(0,r.tZ)(n.P.Root,{children:(0,r.BX)(m,{contentRef:e,children:[(0,r.tZ)(a.ap,{navbarTitleLocalizationKey:(0,d.localizationKeys)("userProfile.navbar.title")}),(0,r.tZ)(n.P.Content,{contentRef:e,scrollBoxId:s.g8,children:(0,r.tZ)(tR,{})})]})})}),tw=(0,o.withCardStateProvider)(e=>(0,r.tZ)(d.Flow.Root,{flow:"userProfile",children:(0,r.tZ)(d.Flow.Part,{children:(0,r.BX)(u.Switch,{children:[(0,r.tZ)(u.Route,{path:"verify",children:(0,r.tZ)(tx.M,{})}),(0,r.tZ)(u.Route,{children:(0,r.tZ)(tB,{})})]})})})),tk=e=>{let t={...e,routing:"virtual",componentName:"UserProfile",mode:"modal"};return(0,r.tZ)(u.Route,{path:"user",children:(0,r.tZ)(c.UserProfileContext.Provider,{value:t,children:(0,r.tZ)("div",{children:(0,r.tZ)(tw,{...t})})})})}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(globalThis.webpackChunk_clerk_clerk_js=globalThis.webpackChunk_clerk_clerk_js||[]).push([["8662"],{7389:function(e,t,r){r.d(t,{v:()=>n});var i=r(73312),o=r(24562),a=r(64204);let n=e=>{let{onBackLinkClick:t}=e;return(0,i.tZ)(o._,{cardTitle:(0,a.localizationKeys)("signIn.alternativeMethods.getHelp.title"),cardSubtitle:(0,a.localizationKeys)("signIn.alternativeMethods.getHelp.content"),onBackLinkClick:t})}},95518:function(e,t,r){r.d(t,{Vh:()=>f,Vs:()=>v,bx:()=>h,mQ:()=>k,s2:()=>y,t3:()=>s,xT:()=>u}),r(72642);var i=r(20645),o=r(98690),a=r(7772),n=r(90577);let l=e=>t=>"safeIdentifier"in t&&t.safeIdentifier===e;function c(e){if((0,i.iW)()){let t=e.find(({strategy:e})=>"passkey"===e);if(t)return t}return null}function s(e,t,r){return e&&0!==e.length?r===a.kJ.Password?function(e,t){let r=c(e);if(r)return r;let i=e.sort(n.sZ)[0];return"password"===i.strategy?i:e.find(l(t))||i||null}(e,t):function(e,t){let r=c(e);if(r)return r;let i=e.sort(n.b8),o=i.find(l(t));if(o)return o;let a=i[0];return"email_link"===a.strategy?a:e.find(l(t))||a||null}(e,t):null}let d=["passkey","email_code","password","phone_code","email_link"];function u(e){return!!e&&d.includes(e.strategy)}function h(e){if(!e||0===e.length)return null;let t=e.find(e=>"totp"===e.strategy);if(t)return t;let r=e.find(e=>"phone_code"===e.strategy);return r||e[0]}let p=["reset_password_phone_code","reset_password_email_code"],f=e=>!!e&&p.includes(e);function y(e){let t;return"tel"===e.type?"phoneNumber":(t=e.value,/^\S+@\S+\.\S+$/.test(t))?"emailAddress":"username"}let v=(e,t,r)=>{if(!t)return null;let i=e.find(e=>"strategy"===e.id)?.value;if(i&&"phone_code"!==i)return null;let a=e.find(e=>e.id===r)?.value;if(!a||!a?.startsWith("+"))return null;let n=(0,o.jR)(a,t);return"sms"===n?null:n},k=(e,t,r)=>{if(!e||!t||"phoneNumber"!==t||!r||!r?.startsWith("+"))return null;let i=(0,o.jR)(r,e);return"sms"===i?null:i}},61419:function(e,t,r){r.r(t),r.d(t,{UserVerification:()=>er,UserVerificationModal:()=>ei});var i=r(73312),o=r(69144),a=r(11576),n=r(64204),l=r(24676),c=r(2672),s=r(24562),d=r(21455),u=r(17703),h=r(95518),p=r(38246),f=r(5482),y=r(92418),v=r(92654),k=r(44271),Z=r(34174),m=r(20645),C=r(90577);function b({filterOutFactor:e,supportedFirstFactors:t}){let r=t?t.filter(e=>!(0,h.Vh)(e.strategy)):[],i=r&&r.length>0,a=(0,o.useMemo)(()=>t?t.filter(e=>!e.strategy.startsWith("oauth_")).filter(e=>(0,h.xT)(e)).filter(t=>!t||!e||("email_code"===t.strategy&&"email_code"===e.strategy?t.emailAddressId!==e.emailAddressId:"phone_code"===t.strategy&&"phone_code"===e.strategy?t.phoneNumberId!==e.phoneNumberId:t.strategy!==e.strategy)).filter(e=>"passkey"!==e.strategy||(0,m.iW)()).sort(C.U6):[],[t,e]);return{hasAnyStrategy:i,hasFirstParty:a&&a.length>0,firstPartyFactors:a}}var g=r(61869),w=r(65695);let M=()=>{let{session:e}=(0,g.kP)(),t=(()=>{let{level:e}=(0,a.useUserVerification)();return(0,o.useMemo)(()=>({level:e||"second_factor"}),[e])})();return{...(0,w.ib)(e?e.startVerification:void 0,t,{throttleTime:300})}};function _(e){let t=t=>{let{isLoading:r,data:o}=M();return r||!o?(0,i.tZ)(d.W,{}):(0,i.tZ)(e,{...t})},r=e.displayName||e.name||"Component";return e.displayName=r,t.displayName=r,t}let B=e=>{let{onBackLinkClick:t}=e;return(0,i.tZ)(s._,{cardTitle:(0,n.localizationKeys)("reverification.alternativeMethods.getHelp.title"),cardSubtitle:(0,n.localizationKeys)("reverification.alternativeMethods.getHelp.content"),onBackLinkClick:t})},S=e=>((e,t)=>{let[r,a]=o.useState(!1),n=o.useCallback(()=>a(e=>!e),[a]);return r?(0,i.tZ)(B,{onBackLinkClick:n}):(0,i.tZ)(e,{...t,onHavingTroubleClick:n})})(A,{...e}),A=e=>{let{onBackLinkClick:t,onHavingTroubleClick:r,onFactorSelected:o}=e,a=(0,c.useCardState)(),{data:l}=M(),{firstPartyFactors:s,hasAnyStrategy:d}=b({filterOutFactor:e?.currentFactor,supportedFirstFactors:l?.supportedFirstFactors});return(0,i.tZ)(n.Flow.Part,{part:"alternativeMethods",children:(0,i.BX)(y.Z.Root,{children:[(0,i.BX)(y.Z.Content,{children:[(0,i.BX)(v.h.Root,{children:[(0,i.tZ)(v.h.Title,{localizationKey:(0,n.localizationKeys)("reverification.alternativeMethods.title")}),(0,i.tZ)(v.h.Subtitle,{localizationKey:(0,n.localizationKeys)("reverification.alternativeMethods.subtitle")})]}),(0,i.tZ)(y.Z.Alert,{children:a.error}),(0,i.tZ)(n.Flex,{direction:"col",elementDescriptor:n.descriptors.main,gap:6,children:(0,i.BX)(n.Col,{gap:4,children:[d&&(0,i.tZ)(n.Flex,{elementDescriptor:n.descriptors.alternativeMethods,direction:"col",gap:2,children:s.map((e,t)=>{var r;return(0,i.tZ)(p.$,{leftIcon:(r=e,({email_code:Z.GT,phone_code:Z.iU,password:Z.kh,passkey:Z.IG,enterprise_sso:Z.cp})[r.strategy]),textLocalizationKey:function(e){switch(e.strategy){case"email_code":return(0,n.localizationKeys)("reverification.alternativeMethods.blockButton__emailCode",{identifier:(0,k.H)(e.safeIdentifier)||""});case"phone_code":return(0,n.localizationKeys)("reverification.alternativeMethods.blockButton__phoneCode",{identifier:(0,k.H)(e.safeIdentifier)||""});case"password":return(0,n.localizationKeys)("reverification.alternativeMethods.blockButton__password");case"passkey":return(0,n.localizationKeys)("reverification.alternativeMethods.blockButton__passkey");default:throw Error(`Invalid sign in strategy: "${e.strategy}"`)}}(e),elementDescriptor:n.descriptors.alternativeMethodsBlockButton,textElementDescriptor:n.descriptors.alternativeMethodsBlockButtonText,arrowElementDescriptor:n.descriptors.alternativeMethodsBlockButtonArrow,textVariant:"buttonLarge",isDisabled:a.isLoading,onClick:()=>{a.setError(void 0),o(e)}},t)})}),t&&(0,i.tZ)(f.h,{boxElementDescriptor:n.descriptors.backRow,linkElementDescriptor:n.descriptors.backLink,onClick:t})]})})]}),(0,i.tZ)(y.Z.Footer,{children:(0,i.BX)(y.Z.Action,{elementId:"havingTrouble",children:[(0,i.tZ)(y.Z.ActionText,{localizationKey:(0,n.localizationKeys)("reverification.alternativeMethods.actionText")}),(0,i.tZ)(y.Z.ActionLink,{localizationKey:(0,n.localizationKeys)("reverification.alternativeMethods.actionLink"),onClick:r})]})})]})})};var z=r(70431),K=r(88870),F=r(36788),L=r(7389),I=r(24152),T=r(93234);let P=()=>{let{afterVerification:e}=(0,a.useUserVerification)(),t=(0,T.H)(),{setActive:r}=(0,g.cL)(),{setCache:i}=M(),{navigate:n}=(0,l.useRouter)();return{handleVerificationResponse:(0,o.useCallback)(async o=>{switch(i({data:o,isLoading:!1,isValidating:!1,error:null,cachedAt:Date.now()}),o.status){case"complete":return await r({session:o.session.id}),e?.();case"needs_second_factor":return n("./factor-two");default:return console.error((0,I.Ws)(o.status,t))}},[n,r,t])}};function R(e){let{onShowAlternativeMethodsClick:t}=e,{session:r}=(0,g.kP)(),{handleVerificationResponse:a}=P(),l=(0,c.useCardState)(),[s,d]=o.useState(!1),u=o.useCallback(()=>d(e=>!e),[d]),h=(0,F.Yp)("password","",{type:"password",label:(0,n.localizationKeys)("formFieldLabel__password"),placeholder:(0,n.localizationKeys)("formFieldInputPlaceholder__password")}),p=async e=>(e.preventDefault(),r?.attemptFirstFactorVerification({strategy:"password",password:h.value}).then(a).catch(e=>(0,K.S3)(e,[h],l.setError)));return s?(0,i.tZ)(L.v,{onBackLinkClick:u}):(0,i.tZ)(n.Flow.Part,{part:"password",children:(0,i.BX)(y.Z.Root,{children:[(0,i.BX)(y.Z.Content,{children:[(0,i.BX)(v.h.Root,{showLogo:!0,children:[(0,i.tZ)(v.h.Title,{localizationKey:(0,n.localizationKeys)("reverification.password.title")}),(0,i.tZ)(v.h.Subtitle,{localizationKey:(0,n.localizationKeys)("reverification.password.subtitle")})]}),(0,i.tZ)(y.Z.Alert,{children:l.error}),(0,i.BX)(n.Col,{elementDescriptor:n.descriptors.main,gap:4,children:[(0,i.BX)(z.l.Root,{onSubmit:p,gap:8,children:[(0,i.tZ)(z.l.ControlRow,{elementId:h.id,children:(0,i.tZ)(z.l.PasswordInput,{...h.props,autoFocus:!0})}),(0,i.tZ)(z.l.SubmitButton,{hasArrow:!0})]}),(0,i.tZ)(y.Z.Action,{elementId:t?"alternativeMethods":"havingTrouble",children:(0,i.tZ)(y.Z.ActionLink,{localizationKey:(0,n.localizationKeys)(t?"reverification.password.actionLink":"reverification.alternativeMethods.actionLink"),onClick:t||u})})]})]}),(0,i.tZ)(y.Z.Footer,{})]})})}function X(e,t){return"primary"in e&&e.primary&&!("primary"in t&&t.primary)?-1:"primary"in t&&t.primary&&!("primary"in e&&e.primary)?1:0}var E=r(23465);let x=e=>{let{session:t}=(0,g.kP)(),r=(0,c.useCardState)(),{handleVerificationResponse:a}=P();o.useEffect(()=>{e.factorAlreadyPrepared||n()},[]);let n=()=>{t.prepareFirstFactorVerification(e.factor).then(()=>e.onFactorPrepare()).catch(e=>(0,K.S3)(e,[],r.setError))};return(0,i.tZ)(E.U,{cardTitle:e.cardTitle,cardSubtitle:e.cardSubtitle,inputLabel:e.inputLabel,resendButton:e.resendButton,onCodeEntryFinishedAction:(r,i,o)=>{t.attemptFirstFactorVerification({strategy:e.factor.strategy,code:r}).then(async e=>(await i(),a(e))).catch(o)},onResendCodeClicked:n,safeIdentifier:e.factor.safeIdentifier,profileImageUrl:t?.user?.imageUrl,onShowAlternativeMethodsClicked:e.onShowAlternativeMethodsClicked,showAlternativeMethods:e.showAlternativeMethods,onBackLinkClicked:e.onBackLinkClicked})},V=e=>(0,i.tZ)(n.Flow.Part,{part:"emailCode",children:(0,i.tZ)(x,{...e,cardTitle:(0,n.localizationKeys)("reverification.emailCode.title"),cardSubtitle:(0,n.localizationKeys)("reverification.emailCode.subtitle"),inputLabel:(0,n.localizationKeys)("reverification.emailCode.formTitle"),resendButton:(0,n.localizationKeys)("reverification.emailCode.resendButton")})}),D=e=>{let{onShowAlternativeMethodsClicked:t}=e,{session:r}=(0,g.kP)(),{__internal_isWebAuthnSupported:o}=(0,g.cL)(),{handleVerificationResponse:a}=P(),l=(0,c.useCardState)();return(0,i.BX)(y.Z.Root,{children:[(0,i.BX)(y.Z.Content,{children:[(0,i.BX)(v.h.Root,{showLogo:!0,children:[(0,i.tZ)(v.h.Title,{localizationKey:(0,n.localizationKeys)("reverification.passkey.title")}),(0,i.tZ)(v.h.Subtitle,{localizationKey:(0,n.localizationKeys)("reverification.passkey.subtitle")})]}),(0,i.tZ)(y.Z.Alert,{children:l.error}),(0,i.tZ)(n.Col,{elementDescriptor:n.descriptors.main,gap:8,children:(0,i.tZ)(z.l.Root,{children:(0,i.BX)(n.Col,{gap:3,children:[(0,i.tZ)(n.Button,{type:"button",onClick:e=>{e.preventDefault(),r?.verifyWithPasskey().then(e=>a(e)).catch(e=>(0,K.S3)(e,[],l.setError))},localizationKey:(0,n.localizationKeys)("reverification.passkey.blockButton__passkey"),hasArrow:!0}),(0,i.tZ)(y.Z.Action,{elementId:"alternativeMethods",children:t&&(0,i.tZ)(y.Z.ActionLink,{localizationKey:(0,n.localizationKeys)("footerActionLink__useAnotherMethod"),onClick:t})})]})})})]}),(0,i.tZ)(y.Z.Footer,{})]})},N=e=>(0,i.tZ)(n.Flow.Part,{part:"phoneCode",children:(0,i.tZ)(x,{...e,cardTitle:(0,n.localizationKeys)("reverification.phoneCode.title"),cardSubtitle:(0,n.localizationKeys)("reverification.phoneCode.subtitle"),inputLabel:(0,n.localizationKeys)("reverification.phoneCode.formTitle"),resendButton:(0,n.localizationKeys)("reverification.phoneCode.resendButton"),showAlternativeMethods:e.showAlternativeMethods})}),U=e=>{if(!e)return"";let t=e.strategy;return"emailAddressId"in e&&(t+=e.emailAddressId),"phoneNumberId"in e&&(t+=e.phoneNumberId),t},W=["password","email_code","phone_code","passkey"],H=_((0,c.withCardStateProvider)(function(){let{data:e}=M(),t=(0,c.useCardState)(),{navigate:r}=(0,l.useRouter)(),n=o.useRef(""),p=(0,o.useMemo)(()=>e.supportedFirstFactors?.filter(e=>W.includes(e.strategy))?.sort(X)||null,[e.supportedFirstFactors]),{preferredSignInStrategy:f}=(0,a.useEnvironment)().displayConfig,[{currentFactor:y},v]=o.useState(()=>({currentFactor:(0,h.t3)(p,null,f),prevCurrentFactor:void 0})),{hasAnyStrategy:k,hasFirstParty:Z}=b({filterOutFactor:y,supportedFirstFactors:p}),[m,C]=o.useState(()=>!y||!(0,h.xT)(y)),g=k?()=>{t.setError(void 0),C(e=>!e)}:void 0,w=()=>{n.current=U(y)};if((0,o.useEffect)(()=>{"needs_second_factor"===e.status&&r("factor-two")},[]),!y)return(0,i.tZ)(s._,{cardTitle:(0,u.u1)("reverification.noAvailableMethods.title"),cardSubtitle:(0,u.u1)("reverification.noAvailableMethods.subtitle"),message:(0,u.u1)("reverification.noAvailableMethods.message"),shouldNavigateBack:!1});if(m){let e=(0,h.xT)(y);return(0,i.tZ)(S,{onBackLinkClick:e?()=>{t.setError(void 0),g?.()}:void 0,onFactorSelected:e=>{v(t=>({currentFactor:e,prevCurrentFactor:t.currentFactor})),g?.()},currentFactor:y})}switch(y?.strategy){case"password":return(0,i.tZ)(R,{onShowAlternativeMethodsClick:g});case"email_code":return(0,i.tZ)(V,{factorAlreadyPrepared:n.current===U(y),onFactorPrepare:w,onShowAlternativeMethodsClicked:g,factor:y,showAlternativeMethods:Z});case"phone_code":return(0,i.tZ)(N,{factorAlreadyPrepared:n.current===U(y),onFactorPrepare:w,onShowAlternativeMethodsClicked:g,factor:y,showAlternativeMethods:Z});case"passkey":return(0,i.tZ)(D,{onShowAlternativeMethodsClicked:g});default:return(0,i.tZ)(d.W,{})}})),$=e=>{let t=(0,c.useCardState)(),{session:r}=(0,g.kP)(),{handleVerificationResponse:a}=P();o.useEffect(()=>{e.factorAlreadyPrepared||n?.()},[]);let n=e.prepare?()=>e.prepare?.().then(()=>e.onFactorPrepare()).catch(e=>(0,K.S3)(e,[],t.setError)):void 0;return(0,i.tZ)(E.U,{cardTitle:e.cardTitle,cardSubtitle:e.cardSubtitle,resendButton:e.resendButton,inputLabel:e.inputLabel,onCodeEntryFinishedAction:(t,i,o)=>{r.attemptSecondFactorVerification({strategy:e.factor.strategy,code:t}).then(async e=>(await i(),a(e))).catch(o)},onResendCodeClicked:n,safeIdentifier:"safeIdentifier"in e.factor?e.factor.safeIdentifier:void 0,profileImageUrl:r?.user?.imageUrl,onShowAlternativeMethodsClicked:e.onShowAlternativeMethodsClicked,showAlternativeMethods:e.showAlternativeMethods})};function j(e){return(0,i.tZ)(n.Flow.Part,{part:"totp2Fa",children:(0,i.tZ)($,{...e,cardTitle:(0,n.localizationKeys)("reverification.totpMfa.title"),cardSubtitle:(0,n.localizationKeys)("reverification.totpMfa.subtitle"),inputLabel:(0,n.localizationKeys)("reverification.totpMfa.formTitle"),showAlternativeMethods:e.showAlternativeMethods})})}let G=e=>{let[t,r]=o.useState(!1),a=o.useCallback(()=>r(e=>!e),[r]);return t?(0,i.tZ)(B,{onBackLinkClick:a}):(0,i.tZ)(O,{supportedSecondFactors:e.supportedSecondFactors,onBackLinkClick:e.onBackLinkClick,onFactorSelected:e.onFactorSelected,onHavingTroubleClick:a})},O=e=>{let{supportedSecondFactors:t,onHavingTroubleClick:r,onFactorSelected:o,onBackLinkClick:a}=e,l=(0,c.useCardState)();return(0,i.tZ)(n.Flow.Part,{part:"alternativeMethods",children:(0,i.BX)(y.Z.Root,{children:[(0,i.BX)(y.Z.Content,{children:[(0,i.BX)(v.h.Root,{showLogo:!0,children:[(0,i.tZ)(v.h.Title,{localizationKey:(0,n.localizationKeys)("reverification.alternativeMethods.title")}),(0,i.tZ)(v.h.Subtitle,{localizationKey:(0,n.localizationKeys)("reverification.alternativeMethods.subtitle")})]}),(0,i.tZ)(y.Z.Alert,{children:l.error}),(0,i.BX)(n.Col,{elementDescriptor:n.descriptors.main,gap:3,children:[(0,i.tZ)(n.Col,{gap:2,children:t?.sort(C.Q0).map((e,t)=>(0,i.tZ)(p.$,{textLocalizationKey:function(e){switch(e.strategy){case"phone_code":return(0,n.localizationKeys)("reverification.alternativeMethods.blockButton__phoneCode",{identifier:(0,k.H)(e.safeIdentifier)||""});case"totp":return(0,n.localizationKeys)("reverification.alternativeMethods.blockButton__totp");case"backup_code":return(0,n.localizationKeys)("reverification.alternativeMethods.blockButton__backupCode");default:throw Error(`Invalid verification strategy: "${e.strategy}"`)}}(e),elementDescriptor:n.descriptors.alternativeMethodsBlockButton,textElementDescriptor:n.descriptors.alternativeMethodsBlockButtonText,arrowElementDescriptor:n.descriptors.alternativeMethodsBlockButtonArrow,isDisabled:l.isLoading,onClick:()=>o(e)},t))}),(0,i.tZ)(y.Z.Action,{elementId:"alternativeMethods",children:a&&(0,i.tZ)(y.Z.ActionLink,{localizationKey:(0,n.localizationKeys)("backButton"),onClick:e.onBackLinkClick})})]})]}),(0,i.tZ)(y.Z.Footer,{children:(0,i.BX)(y.Z.Action,{elementId:"havingTrouble",children:[(0,i.tZ)(y.Z.ActionText,{localizationKey:(0,n.localizationKeys)("reverification.alternativeMethods.actionText")}),(0,i.tZ)(y.Z.ActionLink,{localizationKey:(0,n.localizationKeys)("reverification.alternativeMethods.actionLink"),onClick:r})]})})]})})},Q=e=>{let{onShowAlternativeMethodsClicked:t}=e,{session:r}=(0,g.kP)(),{handleVerificationResponse:o}=P(),a=(0,c.useCardState)(),l=(0,F.Yp)("code","",{type:"text",label:(0,n.localizationKeys)("formFieldLabel__backupCode"),isRequired:!0});return(0,i.BX)(y.Z.Root,{children:[(0,i.BX)(y.Z.Content,{children:[(0,i.BX)(v.h.Root,{showLogo:!0,children:[(0,i.tZ)(v.h.Title,{localizationKey:(0,n.localizationKeys)("reverification.backupCodeMfa.title")}),(0,i.tZ)(v.h.Subtitle,{localizationKey:(0,n.localizationKeys)("reverification.backupCodeMfa.subtitle")})]}),(0,i.tZ)(y.Z.Alert,{children:a.error}),(0,i.tZ)(n.Col,{elementDescriptor:n.descriptors.main,gap:8,children:(0,i.BX)(z.l.Root,{onSubmit:e=>(e.preventDefault(),r.attemptSecondFactorVerification({strategy:"backup_code",code:l.value}).then(o).catch(e=>(0,K.S3)(e,[l],a.setError))),children:[(0,i.tZ)(z.l.ControlRow,{elementId:l.id,children:(0,i.tZ)(z.l.PlainInput,{...l.props,autoFocus:!0,onActionClicked:t})}),(0,i.BX)(n.Col,{gap:3,children:[(0,i.tZ)(z.l.SubmitButton,{hasArrow:!0}),(0,i.tZ)(y.Z.Action,{elementId:"alternativeMethods",children:t&&(0,i.tZ)(y.Z.ActionLink,{localizationKey:(0,n.localizationKeys)("footerActionLink__useAnotherMethod"),onClick:t})})]})]})})]}),(0,i.tZ)(y.Z.Footer,{})]})},Y=e=>{let{session:t}=(0,g.kP)();return(0,i.tZ)(n.Flow.Part,{part:"phoneCode2Fa",children:(0,i.tZ)($,{...e,cardTitle:(0,n.localizationKeys)("reverification.phoneCodeMfa.title"),cardSubtitle:(0,n.localizationKeys)("reverification.phoneCodeMfa.subtitle"),inputLabel:(0,n.localizationKeys)("reverification.phoneCodeMfa.formTitle"),resendButton:(0,n.localizationKeys)("reverification.phoneCodeMfa.resendButton"),prepare:()=>{let{phoneNumberId:r,strategy:i}=e.factor;return t.prepareSecondFactorVerification({phoneNumberId:r,strategy:i})}})})},q=e=>{if(!e)return"";let t=e.strategy;return"phoneNumberId"in e&&(t+=e.phoneNumberId),t},J=["phone_code","totp","backup_code"],ee=_((0,c.withCardStateProvider)(function(){let{navigate:e}=(0,l.useRouter)(),{data:t}=M(),r=(0,o.useMemo)(()=>t.supportedSecondFactors?.filter(e=>J.includes(e.strategy))?.sort(X)||null,[t.supportedSecondFactors]),a=o.useRef(""),[n,c]=o.useState(()=>(0,h.bx)(r)),[s,u]=o.useState(!n),p=()=>u(e=>!e),f=(0,o.useMemo)(()=>r?.filter(e=>!e||!n||("phone_code"===e.strategy&&"phone_code"===n.strategy?e.phoneNumberId!==n.phoneNumberId:e.strategy!==n.strategy)),[r,n]),y=()=>{a.current=q(n)},v=(0,o.useMemo)(()=>f&&f.length>0||!1,[f]);if((0,o.useEffect)(()=>{"needs_first_factor"===t.status&&e("../")},[]),!n)return(0,i.tZ)(d.W,{});if(s&&v)return(0,i.tZ)(G,{supportedSecondFactors:f||null,onBackLinkClick:p,onFactorSelected:e=>{c(e),p()}});switch(n?.strategy){case"phone_code":return(0,i.tZ)(Y,{factorAlreadyPrepared:a.current===q(n),onFactorPrepare:y,factor:n,onShowAlternativeMethodsClicked:p,showAlternativeMethods:v});case"totp":return(0,i.tZ)(j,{factorAlreadyPrepared:a.current===q(n),onFactorPrepare:y,factor:n,onShowAlternativeMethodsClicked:p,showAlternativeMethods:v});case"backup_code":return(0,i.tZ)(Q,{onShowAlternativeMethodsClicked:p});default:return(0,i.tZ)(d.W,{})}}));function et(){let{invalidate:e}=M();return(0,o.useEffect)(()=>()=>{e()},[]),(0,i.tZ)(n.Flow.Root,{flow:"userVerification",children:(0,i.BX)(l.Switch,{children:[(0,i.tZ)(l.Route,{path:"factor-two",children:(0,i.tZ)(ee,{})}),(0,i.tZ)(l.Route,{index:!0,children:(0,i.tZ)(H,{})})]})})}et.displayName="UserVerification";let er=(0,a.withCoreSessionSwitchGuard)(et),ei=e=>(0,i.tZ)(l.Route,{path:"user-verification",children:(0,i.tZ)(a.UserVerificationContext.Provider,{value:{componentName:"UserVerification",...e,routing:"virtual"},children:(0,i.tZ)("div",{children:(0,i.tZ)(er,{...e,routing:"virtual"})})})})}}]);
@@ -0,0 +1 @@
1
+ "use strict";(globalThis.webpackChunk_clerk_clerk_js=globalThis.webpackChunk_clerk_clerk_js||[]).push([["8662"],{7389:function(e,t,r){r.d(t,{v:()=>n});var i=r(73312),o=r(24562),a=r(64204);let n=e=>{let{onBackLinkClick:t}=e;return(0,i.tZ)(o._,{cardTitle:(0,a.localizationKeys)("signIn.alternativeMethods.getHelp.title"),cardSubtitle:(0,a.localizationKeys)("signIn.alternativeMethods.getHelp.content"),onBackLinkClick:t})}},95518:function(e,t,r){r.d(t,{Vh:()=>f,Vs:()=>y,bx:()=>h,mQ:()=>k,s2:()=>v,t3:()=>s,xT:()=>u}),r(28419),r(56113),r(72642);var i=r(20645),o=r(98690),a=r(7772),n=r(90577);let l=e=>t=>"safeIdentifier"in t&&t.safeIdentifier===e;function c(e){if((0,i.iW)()){let t=e.find(e=>{let{strategy:t}=e;return"passkey"===t});if(t)return t}return null}function s(e,t,r){return e&&0!==e.length?r===a.kJ.Password?function(e,t){let r=c(e);if(r)return r;let i=e.sort(n.sZ)[0];return"password"===i.strategy?i:e.find(l(t))||i||null}(e,t):function(e,t){let r=c(e);if(r)return r;let i=e.sort(n.b8),o=i.find(l(t));if(o)return o;let a=i[0];return"email_link"===a.strategy?a:e.find(l(t))||a||null}(e,t):null}let d=["passkey","email_code","password","phone_code","email_link"];function u(e){return!!e&&d.includes(e.strategy)}function h(e){if(!e||0===e.length)return null;let t=e.find(e=>"totp"===e.strategy);if(t)return t;let r=e.find(e=>"phone_code"===e.strategy);return r||e[0]}let p=["reset_password_phone_code","reset_password_email_code"],f=e=>!!e&&p.includes(e);function v(e){let t;return"tel"===e.type?"phoneNumber":(t=e.value,/^\S+@\S+\.\S+$/.test(t))?"emailAddress":"username"}let y=(e,t,r)=>{var i,a;if(!t)return null;let n=null==(i=e.find(e=>"strategy"===e.id))?void 0:i.value;if(n&&"phone_code"!==n)return null;let l=null==(a=e.find(e=>e.id===r))?void 0:a.value;if(!l||!(null==l?void 0:l.startsWith("+")))return null;let c=(0,o.jR)(l,t);return"sms"===c?null:c},k=(e,t,r)=>{if(!e||!t||"phoneNumber"!==t||!r||!(null==r?void 0:r.startsWith("+")))return null;let i=(0,o.jR)(r,e);return"sms"===i?null:i}},61419:function(e,t,r){r.r(t),r.d(t,{UserVerification:()=>er,UserVerificationModal:()=>ei});var i=r(73312),o=r(69144),a=r(11576),n=r(64204),l=r(24676);r(28419),r(65223);var c=r(2672),s=r(24562),d=r(21455),u=r(17703),h=r(95518);r(92037);var p=r(38246),f=r(5482),v=r(92418),y=r(92654),k=r(44271),Z=r(96519),m=r(20645),C=r(90577);function b(e){let{filterOutFactor:t,supportedFirstFactors:r}=e,i=r?r.filter(e=>!(0,h.Vh)(e.strategy)):[],a=i&&i.length>0,n=(0,o.useMemo)(()=>r?r.filter(e=>!e.strategy.startsWith("oauth_")).filter(e=>(0,h.xT)(e)).filter(e=>!e||!t||("email_code"===e.strategy&&"email_code"===t.strategy?e.emailAddressId!==t.emailAddressId:"phone_code"===e.strategy&&"phone_code"===t.strategy?e.phoneNumberId!==t.phoneNumberId:e.strategy!==t.strategy)).filter(e=>"passkey"!==e.strategy||(0,m.iW)()).sort(C.U6):[],[r,t]);return{hasAnyStrategy:a,hasFirstParty:n&&n.length>0,firstPartyFactors:n}}var g=r(61869),w=r(65695);let M=()=>{let{session:e}=(0,g.kP)(),t=(()=>{let{level:e}=(0,a.useUserVerification)();return(0,o.useMemo)(()=>({level:e||"second_factor"}),[e])})();return{...(0,w.ib)(e?e.startVerification:void 0,t,{throttleTime:300})}};function _(e){let t=t=>{let{isLoading:r,data:o}=M();return r||!o?(0,i.tZ)(d.W,{}):(0,i.tZ)(e,{...t})},r=e.displayName||e.name||"Component";return e.displayName=r,t.displayName=r,t}let B=e=>{let{onBackLinkClick:t}=e;return(0,i.tZ)(s._,{cardTitle:(0,n.localizationKeys)("reverification.alternativeMethods.getHelp.title"),cardSubtitle:(0,n.localizationKeys)("reverification.alternativeMethods.getHelp.content"),onBackLinkClick:t})},S=e=>((e,t)=>{let[r,a]=o.useState(!1),n=o.useCallback(()=>a(e=>!e),[a]);return r?(0,i.tZ)(B,{onBackLinkClick:n}):(0,i.tZ)(e,{...t,onHavingTroubleClick:n})})(A,{...e}),A=e=>{let{onBackLinkClick:t,onHavingTroubleClick:r,onFactorSelected:o}=e,a=(0,c.useCardState)(),{data:l}=M(),{firstPartyFactors:s,hasAnyStrategy:d}=b({filterOutFactor:null==e?void 0:e.currentFactor,supportedFirstFactors:null==l?void 0:l.supportedFirstFactors});return(0,i.tZ)(n.Flow.Part,{part:"alternativeMethods",children:(0,i.BX)(v.Z.Root,{children:[(0,i.BX)(v.Z.Content,{children:[(0,i.BX)(y.h.Root,{children:[(0,i.tZ)(y.h.Title,{localizationKey:(0,n.localizationKeys)("reverification.alternativeMethods.title")}),(0,i.tZ)(y.h.Subtitle,{localizationKey:(0,n.localizationKeys)("reverification.alternativeMethods.subtitle")})]}),(0,i.tZ)(v.Z.Alert,{children:a.error}),(0,i.tZ)(n.Flex,{direction:"col",elementDescriptor:n.descriptors.main,gap:6,children:(0,i.BX)(n.Col,{gap:4,children:[d&&(0,i.tZ)(n.Flex,{elementDescriptor:n.descriptors.alternativeMethods,direction:"col",gap:2,children:s.map((e,t)=>{var r;return(0,i.tZ)(p.$,{leftIcon:(r=e,({email_code:Z.GT,phone_code:Z.iU,password:Z.kh,passkey:Z.IG,enterprise_sso:Z.cp})[r.strategy]),textLocalizationKey:function(e){switch(e.strategy){case"email_code":return(0,n.localizationKeys)("reverification.alternativeMethods.blockButton__emailCode",{identifier:(0,k.H)(e.safeIdentifier)||""});case"phone_code":return(0,n.localizationKeys)("reverification.alternativeMethods.blockButton__phoneCode",{identifier:(0,k.H)(e.safeIdentifier)||""});case"password":return(0,n.localizationKeys)("reverification.alternativeMethods.blockButton__password");case"passkey":return(0,n.localizationKeys)("reverification.alternativeMethods.blockButton__passkey");default:throw Error('Invalid sign in strategy: "'.concat(e.strategy,'"'))}}(e),elementDescriptor:n.descriptors.alternativeMethodsBlockButton,textElementDescriptor:n.descriptors.alternativeMethodsBlockButtonText,arrowElementDescriptor:n.descriptors.alternativeMethodsBlockButtonArrow,textVariant:"buttonLarge",isDisabled:a.isLoading,onClick:()=>{a.setError(void 0),o(e)}},t)})}),t&&(0,i.tZ)(f.h,{boxElementDescriptor:n.descriptors.backRow,linkElementDescriptor:n.descriptors.backLink,onClick:t})]})})]}),(0,i.tZ)(v.Z.Footer,{children:(0,i.BX)(v.Z.Action,{elementId:"havingTrouble",children:[(0,i.tZ)(v.Z.ActionText,{localizationKey:(0,n.localizationKeys)("reverification.alternativeMethods.actionText")}),(0,i.tZ)(v.Z.ActionLink,{localizationKey:(0,n.localizationKeys)("reverification.alternativeMethods.actionLink"),onClick:r})]})})]})})};var z=r(70431),K=r(88870),F=r(36788),L=r(7389),I=r(24152),T=r(93234);let P=()=>{let{afterVerification:e}=(0,a.useUserVerification)(),t=(0,T.H)(),{setActive:r}=(0,g.cL)(),{setCache:i}=M(),{navigate:n}=(0,l.useRouter)();return{handleVerificationResponse:(0,o.useCallback)(async o=>{switch(i({data:o,isLoading:!1,isValidating:!1,error:null,cachedAt:Date.now()}),o.status){case"complete":return await r({session:o.session.id}),null==e?void 0:e();case"needs_second_factor":return n("./factor-two");default:return console.error((0,I.Ws)(o.status,t))}},[n,r,t])}};function R(e){let{onShowAlternativeMethodsClick:t}=e,{session:r}=(0,g.kP)(),{handleVerificationResponse:a}=P(),l=(0,c.useCardState)(),[s,d]=o.useState(!1),u=o.useCallback(()=>d(e=>!e),[d]),h=(0,F.Yp)("password","",{type:"password",label:(0,n.localizationKeys)("formFieldLabel__password"),placeholder:(0,n.localizationKeys)("formFieldInputPlaceholder__password")}),p=async e=>(e.preventDefault(),null==r?void 0:r.attemptFirstFactorVerification({strategy:"password",password:h.value}).then(a).catch(e=>(0,K.S3)(e,[h],l.setError)));return s?(0,i.tZ)(L.v,{onBackLinkClick:u}):(0,i.tZ)(n.Flow.Part,{part:"password",children:(0,i.BX)(v.Z.Root,{children:[(0,i.BX)(v.Z.Content,{children:[(0,i.BX)(y.h.Root,{showLogo:!0,children:[(0,i.tZ)(y.h.Title,{localizationKey:(0,n.localizationKeys)("reverification.password.title")}),(0,i.tZ)(y.h.Subtitle,{localizationKey:(0,n.localizationKeys)("reverification.password.subtitle")})]}),(0,i.tZ)(v.Z.Alert,{children:l.error}),(0,i.BX)(n.Col,{elementDescriptor:n.descriptors.main,gap:4,children:[(0,i.BX)(z.l.Root,{onSubmit:p,gap:8,children:[(0,i.tZ)(z.l.ControlRow,{elementId:h.id,children:(0,i.tZ)(z.l.PasswordInput,{...h.props,autoFocus:!0})}),(0,i.tZ)(z.l.SubmitButton,{hasArrow:!0})]}),(0,i.tZ)(v.Z.Action,{elementId:t?"alternativeMethods":"havingTrouble",children:(0,i.tZ)(v.Z.ActionLink,{localizationKey:(0,n.localizationKeys)(t?"reverification.password.actionLink":"reverification.alternativeMethods.actionLink"),onClick:t||u})})]})]}),(0,i.tZ)(v.Z.Footer,{})]})})}function X(e,t){return"primary"in e&&e.primary&&!("primary"in t&&t.primary)?-1:"primary"in t&&t.primary&&!("primary"in e&&e.primary)?1:0}var E=r(23465);let x=e=>{var t;let{session:r}=(0,g.kP)(),a=(0,c.useCardState)(),{handleVerificationResponse:n}=P();o.useEffect(()=>{e.factorAlreadyPrepared||l()},[]);let l=()=>{r.prepareFirstFactorVerification(e.factor).then(()=>e.onFactorPrepare()).catch(e=>(0,K.S3)(e,[],a.setError))};return(0,i.tZ)(E.U,{cardTitle:e.cardTitle,cardSubtitle:e.cardSubtitle,inputLabel:e.inputLabel,resendButton:e.resendButton,onCodeEntryFinishedAction:(t,i,o)=>{r.attemptFirstFactorVerification({strategy:e.factor.strategy,code:t}).then(async e=>(await i(),n(e))).catch(o)},onResendCodeClicked:l,safeIdentifier:e.factor.safeIdentifier,profileImageUrl:null==r||null==(t=r.user)?void 0:t.imageUrl,onShowAlternativeMethodsClicked:e.onShowAlternativeMethodsClicked,showAlternativeMethods:e.showAlternativeMethods,onBackLinkClicked:e.onBackLinkClicked})},V=e=>(0,i.tZ)(n.Flow.Part,{part:"emailCode",children:(0,i.tZ)(x,{...e,cardTitle:(0,n.localizationKeys)("reverification.emailCode.title"),cardSubtitle:(0,n.localizationKeys)("reverification.emailCode.subtitle"),inputLabel:(0,n.localizationKeys)("reverification.emailCode.formTitle"),resendButton:(0,n.localizationKeys)("reverification.emailCode.resendButton")})}),D=e=>{let{onShowAlternativeMethodsClicked:t}=e,{session:r}=(0,g.kP)(),{__internal_isWebAuthnSupported:o}=(0,g.cL)(),{handleVerificationResponse:a}=P(),l=(0,c.useCardState)();return(0,i.BX)(v.Z.Root,{children:[(0,i.BX)(v.Z.Content,{children:[(0,i.BX)(y.h.Root,{showLogo:!0,children:[(0,i.tZ)(y.h.Title,{localizationKey:(0,n.localizationKeys)("reverification.passkey.title")}),(0,i.tZ)(y.h.Subtitle,{localizationKey:(0,n.localizationKeys)("reverification.passkey.subtitle")})]}),(0,i.tZ)(v.Z.Alert,{children:l.error}),(0,i.tZ)(n.Col,{elementDescriptor:n.descriptors.main,gap:8,children:(0,i.tZ)(z.l.Root,{children:(0,i.BX)(n.Col,{gap:3,children:[(0,i.tZ)(n.Button,{type:"button",onClick:e=>{e.preventDefault(),null==r||r.verifyWithPasskey().then(e=>a(e)).catch(e=>(0,K.S3)(e,[],l.setError))},localizationKey:(0,n.localizationKeys)("reverification.passkey.blockButton__passkey"),hasArrow:!0}),(0,i.tZ)(v.Z.Action,{elementId:"alternativeMethods",children:t&&(0,i.tZ)(v.Z.ActionLink,{localizationKey:(0,n.localizationKeys)("footerActionLink__useAnotherMethod"),onClick:t})})]})})})]}),(0,i.tZ)(v.Z.Footer,{})]})},N=e=>(0,i.tZ)(n.Flow.Part,{part:"phoneCode",children:(0,i.tZ)(x,{...e,cardTitle:(0,n.localizationKeys)("reverification.phoneCode.title"),cardSubtitle:(0,n.localizationKeys)("reverification.phoneCode.subtitle"),inputLabel:(0,n.localizationKeys)("reverification.phoneCode.formTitle"),resendButton:(0,n.localizationKeys)("reverification.phoneCode.resendButton"),showAlternativeMethods:e.showAlternativeMethods})}),U=e=>{if(!e)return"";let t=e.strategy;return"emailAddressId"in e&&(t+=e.emailAddressId),"phoneNumberId"in e&&(t+=e.phoneNumberId),t},W=["password","email_code","phone_code","passkey"],H=_((0,c.withCardStateProvider)(function(){let{data:e}=M(),t=(0,c.useCardState)(),{navigate:r}=(0,l.useRouter)(),n=o.useRef(""),p=(0,o.useMemo)(()=>{var t,r;return(null==(r=e.supportedFirstFactors)||null==(t=r.filter(e=>W.includes(e.strategy)))?void 0:t.sort(X))||null},[e.supportedFirstFactors]),{preferredSignInStrategy:f}=(0,a.useEnvironment)().displayConfig,[{currentFactor:v},y]=o.useState(()=>({currentFactor:(0,h.t3)(p,null,f),prevCurrentFactor:void 0})),{hasAnyStrategy:k,hasFirstParty:Z}=b({filterOutFactor:v,supportedFirstFactors:p}),[m,C]=o.useState(()=>!v||!(0,h.xT)(v)),g=k?()=>{t.setError(void 0),C(e=>!e)}:void 0,w=()=>{n.current=U(v)};if((0,o.useEffect)(()=>{"needs_second_factor"===e.status&&r("factor-two")},[]),!v)return(0,i.tZ)(s._,{cardTitle:(0,u.u1)("reverification.noAvailableMethods.title"),cardSubtitle:(0,u.u1)("reverification.noAvailableMethods.subtitle"),message:(0,u.u1)("reverification.noAvailableMethods.message"),shouldNavigateBack:!1});if(m){let e=(0,h.xT)(v);return(0,i.tZ)(S,{onBackLinkClick:e?()=>{t.setError(void 0),null==g||g()}:void 0,onFactorSelected:e=>{y(t=>({currentFactor:e,prevCurrentFactor:t.currentFactor})),null==g||g()},currentFactor:v})}switch(null==v?void 0:v.strategy){case"password":return(0,i.tZ)(R,{onShowAlternativeMethodsClick:g});case"email_code":return(0,i.tZ)(V,{factorAlreadyPrepared:n.current===U(v),onFactorPrepare:w,onShowAlternativeMethodsClicked:g,factor:v,showAlternativeMethods:Z});case"phone_code":return(0,i.tZ)(N,{factorAlreadyPrepared:n.current===U(v),onFactorPrepare:w,onShowAlternativeMethodsClicked:g,factor:v,showAlternativeMethods:Z});case"passkey":return(0,i.tZ)(D,{onShowAlternativeMethodsClicked:g});default:return(0,i.tZ)(d.W,{})}})),j=e=>{var t;let r=(0,c.useCardState)(),{session:a}=(0,g.kP)(),{handleVerificationResponse:n}=P();o.useEffect(()=>{e.factorAlreadyPrepared||null==l||l()},[]);let l=e.prepare?()=>{var t;return null==(t=e.prepare)?void 0:t.call(e).then(()=>e.onFactorPrepare()).catch(e=>(0,K.S3)(e,[],r.setError))}:void 0;return(0,i.tZ)(E.U,{cardTitle:e.cardTitle,cardSubtitle:e.cardSubtitle,resendButton:e.resendButton,inputLabel:e.inputLabel,onCodeEntryFinishedAction:(t,r,i)=>{a.attemptSecondFactorVerification({strategy:e.factor.strategy,code:t}).then(async e=>(await r(),n(e))).catch(i)},onResendCodeClicked:l,safeIdentifier:"safeIdentifier"in e.factor?e.factor.safeIdentifier:void 0,profileImageUrl:null==a||null==(t=a.user)?void 0:t.imageUrl,onShowAlternativeMethodsClicked:e.onShowAlternativeMethodsClicked,showAlternativeMethods:e.showAlternativeMethods})};function G(e){return(0,i.tZ)(n.Flow.Part,{part:"totp2Fa",children:(0,i.tZ)(j,{...e,cardTitle:(0,n.localizationKeys)("reverification.totpMfa.title"),cardSubtitle:(0,n.localizationKeys)("reverification.totpMfa.subtitle"),inputLabel:(0,n.localizationKeys)("reverification.totpMfa.formTitle"),showAlternativeMethods:e.showAlternativeMethods})})}let $=e=>{let[t,r]=o.useState(!1),a=o.useCallback(()=>r(e=>!e),[r]);return t?(0,i.tZ)(B,{onBackLinkClick:a}):(0,i.tZ)(O,{supportedSecondFactors:e.supportedSecondFactors,onBackLinkClick:e.onBackLinkClick,onFactorSelected:e.onFactorSelected,onHavingTroubleClick:a})},O=e=>{let{supportedSecondFactors:t,onHavingTroubleClick:r,onFactorSelected:o,onBackLinkClick:a}=e,l=(0,c.useCardState)();return(0,i.tZ)(n.Flow.Part,{part:"alternativeMethods",children:(0,i.BX)(v.Z.Root,{children:[(0,i.BX)(v.Z.Content,{children:[(0,i.BX)(y.h.Root,{showLogo:!0,children:[(0,i.tZ)(y.h.Title,{localizationKey:(0,n.localizationKeys)("reverification.alternativeMethods.title")}),(0,i.tZ)(y.h.Subtitle,{localizationKey:(0,n.localizationKeys)("reverification.alternativeMethods.subtitle")})]}),(0,i.tZ)(v.Z.Alert,{children:l.error}),(0,i.BX)(n.Col,{elementDescriptor:n.descriptors.main,gap:3,children:[(0,i.tZ)(n.Col,{gap:2,children:null==t?void 0:t.sort(C.Q0).map((e,t)=>(0,i.tZ)(p.$,{textLocalizationKey:function(e){switch(e.strategy){case"phone_code":return(0,n.localizationKeys)("reverification.alternativeMethods.blockButton__phoneCode",{identifier:(0,k.H)(e.safeIdentifier)||""});case"totp":return(0,n.localizationKeys)("reverification.alternativeMethods.blockButton__totp");case"backup_code":return(0,n.localizationKeys)("reverification.alternativeMethods.blockButton__backupCode");default:throw Error('Invalid verification strategy: "'.concat(e.strategy,'"'))}}(e),elementDescriptor:n.descriptors.alternativeMethodsBlockButton,textElementDescriptor:n.descriptors.alternativeMethodsBlockButtonText,arrowElementDescriptor:n.descriptors.alternativeMethodsBlockButtonArrow,isDisabled:l.isLoading,onClick:()=>o(e)},t))}),(0,i.tZ)(v.Z.Action,{elementId:"alternativeMethods",children:a&&(0,i.tZ)(v.Z.ActionLink,{localizationKey:(0,n.localizationKeys)("backButton"),onClick:e.onBackLinkClick})})]})]}),(0,i.tZ)(v.Z.Footer,{children:(0,i.BX)(v.Z.Action,{elementId:"havingTrouble",children:[(0,i.tZ)(v.Z.ActionText,{localizationKey:(0,n.localizationKeys)("reverification.alternativeMethods.actionText")}),(0,i.tZ)(v.Z.ActionLink,{localizationKey:(0,n.localizationKeys)("reverification.alternativeMethods.actionLink"),onClick:r})]})})]})})},Q=e=>{let{onShowAlternativeMethodsClicked:t}=e,{session:r}=(0,g.kP)(),{handleVerificationResponse:o}=P(),a=(0,c.useCardState)(),l=(0,F.Yp)("code","",{type:"text",label:(0,n.localizationKeys)("formFieldLabel__backupCode"),isRequired:!0});return(0,i.BX)(v.Z.Root,{children:[(0,i.BX)(v.Z.Content,{children:[(0,i.BX)(y.h.Root,{showLogo:!0,children:[(0,i.tZ)(y.h.Title,{localizationKey:(0,n.localizationKeys)("reverification.backupCodeMfa.title")}),(0,i.tZ)(y.h.Subtitle,{localizationKey:(0,n.localizationKeys)("reverification.backupCodeMfa.subtitle")})]}),(0,i.tZ)(v.Z.Alert,{children:a.error}),(0,i.tZ)(n.Col,{elementDescriptor:n.descriptors.main,gap:8,children:(0,i.BX)(z.l.Root,{onSubmit:e=>(e.preventDefault(),r.attemptSecondFactorVerification({strategy:"backup_code",code:l.value}).then(o).catch(e=>(0,K.S3)(e,[l],a.setError))),children:[(0,i.tZ)(z.l.ControlRow,{elementId:l.id,children:(0,i.tZ)(z.l.PlainInput,{...l.props,autoFocus:!0,onActionClicked:t})}),(0,i.BX)(n.Col,{gap:3,children:[(0,i.tZ)(z.l.SubmitButton,{hasArrow:!0}),(0,i.tZ)(v.Z.Action,{elementId:"alternativeMethods",children:t&&(0,i.tZ)(v.Z.ActionLink,{localizationKey:(0,n.localizationKeys)("footerActionLink__useAnotherMethod"),onClick:t})})]})]})})]}),(0,i.tZ)(v.Z.Footer,{})]})},Y=e=>{let{session:t}=(0,g.kP)();return(0,i.tZ)(n.Flow.Part,{part:"phoneCode2Fa",children:(0,i.tZ)(j,{...e,cardTitle:(0,n.localizationKeys)("reverification.phoneCodeMfa.title"),cardSubtitle:(0,n.localizationKeys)("reverification.phoneCodeMfa.subtitle"),inputLabel:(0,n.localizationKeys)("reverification.phoneCodeMfa.formTitle"),resendButton:(0,n.localizationKeys)("reverification.phoneCodeMfa.resendButton"),prepare:()=>{let{phoneNumberId:r,strategy:i}=e.factor;return t.prepareSecondFactorVerification({phoneNumberId:r,strategy:i})}})})},q=e=>{if(!e)return"";let t=e.strategy;return"phoneNumberId"in e&&(t+=e.phoneNumberId),t},J=["phone_code","totp","backup_code"],ee=_((0,c.withCardStateProvider)(function(){let{navigate:e}=(0,l.useRouter)(),{data:t}=M(),r=(0,o.useMemo)(()=>{var e,r;return(null==(r=t.supportedSecondFactors)||null==(e=r.filter(e=>J.includes(e.strategy)))?void 0:e.sort(X))||null},[t.supportedSecondFactors]),a=o.useRef(""),[n,c]=o.useState(()=>(0,h.bx)(r)),[s,u]=o.useState(!n),p=()=>u(e=>!e),f=(0,o.useMemo)(()=>null==r?void 0:r.filter(e=>!e||!n||("phone_code"===e.strategy&&"phone_code"===n.strategy?e.phoneNumberId!==n.phoneNumberId:e.strategy!==n.strategy)),[r,n]),v=()=>{a.current=q(n)},y=(0,o.useMemo)(()=>f&&f.length>0||!1,[f]);if((0,o.useEffect)(()=>{"needs_first_factor"===t.status&&e("../")},[]),!n)return(0,i.tZ)(d.W,{});if(s&&y)return(0,i.tZ)($,{supportedSecondFactors:f||null,onBackLinkClick:p,onFactorSelected:e=>{c(e),p()}});switch(null==n?void 0:n.strategy){case"phone_code":return(0,i.tZ)(Y,{factorAlreadyPrepared:a.current===q(n),onFactorPrepare:v,factor:n,onShowAlternativeMethodsClicked:p,showAlternativeMethods:y});case"totp":return(0,i.tZ)(G,{factorAlreadyPrepared:a.current===q(n),onFactorPrepare:v,factor:n,onShowAlternativeMethodsClicked:p,showAlternativeMethods:y});case"backup_code":return(0,i.tZ)(Q,{onShowAlternativeMethodsClicked:p});default:return(0,i.tZ)(d.W,{})}}));function et(){let{invalidate:e}=M();return(0,o.useEffect)(()=>()=>{e()},[]),(0,i.tZ)(n.Flow.Root,{flow:"userVerification",children:(0,i.BX)(l.Switch,{children:[(0,i.tZ)(l.Route,{path:"factor-two",children:(0,i.tZ)(ee,{})}),(0,i.tZ)(l.Route,{index:!0,children:(0,i.tZ)(H,{})})]})})}et.displayName="UserVerification";let er=(0,a.withCoreSessionSwitchGuard)(et),ei=e=>(0,i.tZ)(l.Route,{path:"user-verification",children:(0,i.tZ)(a.UserVerificationContext.Provider,{value:{componentName:"UserVerification",...e,routing:"virtual"},children:(0,i.tZ)("div",{children:(0,i.tZ)(er,{...e,routing:"virtual"})})})})}}]);