@tinyrack/issuary-server 0.22.0 → 0.24.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 (333) hide show
  1. package/dist/entities/oauth-client.entity.d.ts +0 -18
  2. package/dist/entities/oauth-client.entity.d.ts.map +1 -1
  3. package/dist/entities/oauth-code.entity.d.ts +0 -18
  4. package/dist/entities/oauth-code.entity.d.ts.map +1 -1
  5. package/dist/entities/oauth-device-code.entity.d.ts +0 -18
  6. package/dist/entities/oauth-device-code.entity.d.ts.map +1 -1
  7. package/dist/entities/revoked-token.entity.d.ts +0 -18
  8. package/dist/entities/revoked-token.entity.d.ts.map +1 -1
  9. package/dist/entities/terms-content.entity.d.ts +0 -9
  10. package/dist/entities/terms-content.entity.d.ts.map +1 -1
  11. package/dist/entities/terms.entity.d.ts +0 -9
  12. package/dist/entities/terms.entity.d.ts.map +1 -1
  13. package/dist/entities/user-consent.entity.d.ts +0 -18
  14. package/dist/entities/user-consent.entity.d.ts.map +1 -1
  15. package/dist/entities/user-terms-consent.entity.d.ts +0 -9
  16. package/dist/entities/user-terms-consent.entity.d.ts.map +1 -1
  17. package/dist/entities/user-totp-recovery-code.entity.d.ts +0 -9
  18. package/dist/entities/user-totp-recovery-code.entity.d.ts.map +1 -1
  19. package/dist/entities/user-totp.entity.d.ts +0 -9
  20. package/dist/entities/user-totp.entity.d.ts.map +1 -1
  21. package/dist/entities/user.entity.d.ts +0 -9
  22. package/dist/entities/user.entity.d.ts.map +1 -1
  23. package/dist/entities/user.entity.js +0 -4
  24. package/dist/entities/user.entity.js.map +1 -1
  25. package/dist/entrypoints/app.d.ts +0 -59
  26. package/dist/entrypoints/app.d.ts.map +1 -1
  27. package/dist/entrypoints/database/postgres/compiled-functions.d.ts +20 -23
  28. package/dist/entrypoints/database/postgres/compiled-functions.d.ts.map +1 -1
  29. package/dist/entrypoints/database/postgres/compiled-functions.js +104 -134
  30. package/dist/entrypoints/database/postgres/compiled-functions.js.map +1 -1
  31. package/dist/entrypoints/database/sqlite/compiled-functions.d.ts +20 -23
  32. package/dist/entrypoints/database/sqlite/compiled-functions.d.ts.map +1 -1
  33. package/dist/entrypoints/database/sqlite/compiled-functions.js +104 -134
  34. package/dist/entrypoints/database/sqlite/compiled-functions.js.map +1 -1
  35. package/dist/lib/config/branding.d.ts +0 -4
  36. package/dist/lib/config/branding.d.ts.map +1 -1
  37. package/dist/lib/config/branding.js +0 -14
  38. package/dist/lib/config/branding.js.map +1 -1
  39. package/dist/lib/config/resolved.d.ts +0 -3
  40. package/dist/lib/config/resolved.d.ts.map +1 -1
  41. package/dist/lib/config/security.d.ts +0 -2
  42. package/dist/lib/config/security.d.ts.map +1 -1
  43. package/dist/lib/config/security.js +0 -5
  44. package/dist/lib/config/security.js.map +1 -1
  45. package/dist/middleware/auth.d.ts +0 -8
  46. package/dist/middleware/auth.d.ts.map +1 -1
  47. package/dist/middleware/auth.js +0 -64
  48. package/dist/middleware/auth.js.map +1 -1
  49. package/dist/middleware/session.d.ts +0 -9
  50. package/dist/middleware/session.d.ts.map +1 -1
  51. package/dist/middleware/session.js +0 -18
  52. package/dist/middleware/session.js.map +1 -1
  53. package/dist/migrations/postgres/Migration20260825140000_drop_password_reset_required.d.ts +6 -0
  54. package/dist/migrations/postgres/Migration20260825140000_drop_password_reset_required.d.ts.map +1 -0
  55. package/dist/migrations/postgres/Migration20260825140000_drop_password_reset_required.js +19 -0
  56. package/dist/migrations/postgres/Migration20260825140000_drop_password_reset_required.js.map +1 -0
  57. package/dist/migrations/postgres/index.d.ts.map +1 -1
  58. package/dist/migrations/postgres/index.js +2 -0
  59. package/dist/migrations/postgres/index.js.map +1 -1
  60. package/dist/migrations/sqlite/Migration20260825140000_drop_password_reset_required.d.ts +6 -0
  61. package/dist/migrations/sqlite/Migration20260825140000_drop_password_reset_required.d.ts.map +1 -0
  62. package/dist/migrations/sqlite/Migration20260825140000_drop_password_reset_required.js +19 -0
  63. package/dist/migrations/sqlite/Migration20260825140000_drop_password_reset_required.js.map +1 -0
  64. package/dist/migrations/sqlite/index.d.ts.map +1 -1
  65. package/dist/migrations/sqlite/index.js +2 -0
  66. package/dist/migrations/sqlite/index.js.map +1 -1
  67. package/dist/repositories/oauth-code.repository.d.ts +2 -2
  68. package/dist/repositories/oauth-code.repository.d.ts.map +1 -1
  69. package/dist/repositories/oauth-code.repository.js +3 -7
  70. package/dist/repositories/oauth-code.repository.js.map +1 -1
  71. package/dist/repositories/oauth-device-code.repository.d.ts +4 -4
  72. package/dist/repositories/oauth-device-code.repository.d.ts.map +1 -1
  73. package/dist/repositories/oauth-device-code.repository.js +6 -18
  74. package/dist/repositories/oauth-device-code.repository.js.map +1 -1
  75. package/dist/repositories/user-totp-recovery-code.repository.d.ts +1 -7
  76. package/dist/repositories/user-totp-recovery-code.repository.d.ts.map +1 -1
  77. package/dist/repositories/user-totp-recovery-code.repository.js +1 -2
  78. package/dist/repositories/user-totp-recovery-code.repository.js.map +1 -1
  79. package/dist/repositories/user-totp.repository.d.ts +0 -9
  80. package/dist/repositories/user-totp.repository.d.ts.map +1 -1
  81. package/dist/routes/api/auth/index.d.ts +0 -52
  82. package/dist/routes/api/auth/index.d.ts.map +1 -1
  83. package/dist/routes/api/auth/index.js +0 -2
  84. package/dist/routes/api/auth/index.js.map +1 -1
  85. package/dist/routes/api/auth/passkey/verify/post.d.ts +0 -37
  86. package/dist/routes/api/auth/passkey/verify/post.d.ts.map +1 -1
  87. package/dist/routes/api/auth/passkey/verify/post.js +2 -8
  88. package/dist/routes/api/auth/passkey/verify/post.js.map +1 -1
  89. package/dist/routes/api/config/get.d.ts +0 -4
  90. package/dist/routes/api/config/get.d.ts.map +1 -1
  91. package/dist/routes/api/config/get.js +0 -2
  92. package/dist/routes/api/config/get.js.map +1 -1
  93. package/dist/routes/api/config/index.d.ts +0 -4
  94. package/dist/routes/api/config/index.d.ts.map +1 -1
  95. package/dist/routes/api/index.d.ts +0 -56
  96. package/dist/routes/api/index.d.ts.map +1 -1
  97. package/dist/routes/index.d.ts +0 -56
  98. package/dist/routes/index.d.ts.map +1 -1
  99. package/dist/routes/oauth/device/get-post.js +5 -5
  100. package/dist/routes/oauth/device/get-post.js.map +1 -1
  101. package/dist/schemas/error.d.ts +0 -25
  102. package/dist/schemas/error.d.ts.map +1 -1
  103. package/dist/schemas/error.js +0 -1
  104. package/dist/schemas/error.js.map +1 -1
  105. package/dist/schemas/response.d.ts +0 -24
  106. package/dist/schemas/response.d.ts.map +1 -1
  107. package/dist/schemas/response.js +0 -13
  108. package/dist/schemas/response.js.map +1 -1
  109. package/dist/seeders/config.seeder.js +0 -1
  110. package/dist/seeders/config.seeder.js.map +1 -1
  111. package/dist/services/container.d.ts +0 -3
  112. package/dist/services/container.d.ts.map +1 -1
  113. package/dist/services/container.js +0 -15
  114. package/dist/services/container.js.map +1 -1
  115. package/dist/services/oauth-client.service.d.ts +0 -1
  116. package/dist/services/oauth-client.service.d.ts.map +1 -1
  117. package/dist/services/oauth-client.service.js +2 -17
  118. package/dist/services/oauth-client.service.js.map +1 -1
  119. package/dist/services/oauth-connect.service.d.ts.map +1 -1
  120. package/dist/services/oauth-connect.service.js +0 -4
  121. package/dist/services/oauth-connect.service.js.map +1 -1
  122. package/dist/services/oauth-token.service.d.ts.map +1 -1
  123. package/dist/services/oauth-token.service.js +4 -4
  124. package/dist/services/oauth-token.service.js.map +1 -1
  125. package/dist/services/password-auth.service.d.ts.map +1 -1
  126. package/dist/services/password-auth.service.js +3 -12
  127. package/dist/services/password-auth.service.js.map +1 -1
  128. package/dist/services/security.service.d.ts +0 -8
  129. package/dist/services/security.service.d.ts.map +1 -1
  130. package/dist/services/security.service.js +21 -82
  131. package/dist/services/security.service.js.map +1 -1
  132. package/dist/services/totp.service.js +2 -2
  133. package/dist/services/totp.service.js.map +1 -1
  134. package/package.json +2 -1
  135. package/public/assets/2fa-6btYq1AL.js +2 -0
  136. package/public/assets/{2fa-C37MUkye.js.map → 2fa-6btYq1AL.js.map} +1 -1
  137. package/public/assets/2fa-D3ieXkuh.js +2 -0
  138. package/public/assets/{2fa-kiqzGSz2.js.map → 2fa-D3ieXkuh.js.map} +1 -1
  139. package/public/assets/2fa-Dxh4Kxy-.js +2 -0
  140. package/public/assets/{2fa-BgveHSB_.js.map → 2fa-Dxh4Kxy-.js.map} +1 -1
  141. package/public/assets/2fa-UcpXAI9J.js +2 -0
  142. package/public/assets/{2fa-UL_cNRnQ.js.map → 2fa-UcpXAI9J.js.map} +1 -1
  143. package/public/assets/{DialogHandle-Zvz8SgS0.js → DialogHandle-tiMUnjZQ.js} +2 -2
  144. package/public/assets/{DialogHandle-Zvz8SgS0.js.map → DialogHandle-tiMUnjZQ.js.map} +1 -1
  145. package/public/assets/admin-B8RQbf4_.js +2 -0
  146. package/public/assets/admin-B8RQbf4_.js.map +1 -0
  147. package/public/assets/admin-users-Dz1QNdy3.js +2 -0
  148. package/public/assets/{admin-users-CwTJdiih.js.map → admin-users-Dz1QNdy3.js.map} +1 -1
  149. package/public/assets/alert-leqyvHOp.js.map +1 -1
  150. package/public/assets/{auth-choice-row-BlSsUI7d.js → auth-choice-row-DWzfcZQY.js} +2 -2
  151. package/public/assets/{auth-choice-row-BlSsUI7d.js.map → auth-choice-row-DWzfcZQY.js.map} +1 -1
  152. package/public/assets/{auth-field-HwxENJnB.js → auth-field-DsLGh1U-.js} +2 -2
  153. package/public/assets/{auth-field-HwxENJnB.js.map → auth-field-DsLGh1U-.js.map} +1 -1
  154. package/public/assets/auth-layout-DGTylGtX.js +2 -0
  155. package/public/assets/auth-layout-DGTylGtX.js.map +1 -0
  156. package/public/assets/{auth-page-header-CIs08f5Y.js → auth-page-header-COvqWINf.js} +2 -2
  157. package/public/assets/auth-page-header-COvqWINf.js.map +1 -0
  158. package/public/assets/authorization-context-banner-DVx1TsPY.js +2 -0
  159. package/public/assets/authorization-context-banner-DVx1TsPY.js.map +1 -0
  160. package/public/assets/{avatar-CttWiIv3.js → avatar-BCLugfaZ.js} +2 -2
  161. package/public/assets/{avatar-CttWiIv3.js.map → avatar-BCLugfaZ.js.map} +1 -1
  162. package/public/assets/badge-CsOfUji0.js.map +1 -1
  163. package/public/assets/{checkbox-CJrRV8S1.js → checkbox-CFVDS3zJ.js} +2 -2
  164. package/public/assets/{checkbox-CJrRV8S1.js.map → checkbox-CFVDS3zJ.js.map} +1 -1
  165. package/public/assets/config-DTQCUlfZ.js +2 -0
  166. package/public/assets/config-DTQCUlfZ.js.map +1 -0
  167. package/public/assets/{consent-BIhxtXHx.js → consent-CKOohdYI.js} +2 -2
  168. package/public/assets/{consent-BIhxtXHx.js.map → consent-CKOohdYI.js.map} +1 -1
  169. package/public/assets/{consent-DRmENn26.js → consent-ChiWc7Ql.js} +2 -2
  170. package/public/assets/{consent-DRmENn26.js.map → consent-ChiWc7Ql.js.map} +1 -1
  171. package/public/assets/createLucideIcon-BPpAIXR_.js.map +1 -1
  172. package/public/assets/{email-CVRDeJ78.js → email-Crjg1dcr.js} +2 -2
  173. package/public/assets/{email-CVRDeJ78.js.map → email-Crjg1dcr.js.map} +1 -1
  174. package/public/assets/email-UcpXAI9J.js +2 -0
  175. package/public/assets/{email-UL_cNRnQ.js.map → email-UcpXAI9J.js.map} +1 -1
  176. package/public/assets/error-VfMv226c.js +2 -0
  177. package/public/assets/{error-2VPY5w8V.js.map → error-VfMv226c.js.map} +1 -1
  178. package/public/assets/{field-DDt6F9TZ.js → field-89zKYDVL.js} +2 -2
  179. package/public/assets/{field-DDt6F9TZ.js.map → field-89zKYDVL.js.map} +1 -1
  180. package/public/assets/forgot-Dr88fVMq.js +2 -0
  181. package/public/assets/{forgot-DzDcduho.js.map → forgot-Dr88fVMq.js.map} +1 -1
  182. package/public/assets/forgot-UcpXAI9J.js +2 -0
  183. package/public/assets/{forgot-UL_cNRnQ.js.map → forgot-UcpXAI9J.js.map} +1 -1
  184. package/public/assets/{index-DZyHRhbQ.css → index-CDD8owGK.css} +1 -1
  185. package/public/assets/index-CZ0rWM7l.js +11 -0
  186. package/public/assets/index-CZ0rWM7l.js.map +1 -0
  187. package/public/assets/{initial-avatar-CZzHAPm3.js → initial-avatar-ocwNWL38.js} +2 -2
  188. package/public/assets/{initial-avatar-CZzHAPm3.js.map → initial-avatar-ocwNWL38.js.map} +1 -1
  189. package/public/assets/{input-CNRpSR08.js → input-GPigtjgi.js} +2 -2
  190. package/public/assets/{input-CNRpSR08.js.map → input-GPigtjgi.js.map} +1 -1
  191. package/public/assets/{labeled-separator-fnKySKv2.js → labeled-separator-CV7nb0XW.js} +2 -2
  192. package/public/assets/{labeled-separator-fnKySKv2.js.map → labeled-separator-CV7nb0XW.js.map} +1 -1
  193. package/public/assets/link-C-WdTj3F.js.map +1 -1
  194. package/public/assets/login-CQeTLmIu.js +2 -0
  195. package/public/assets/login-CQeTLmIu.js.map +1 -0
  196. package/public/assets/login-UcpXAI9J.js +2 -0
  197. package/public/assets/login-UcpXAI9J.js.map +1 -0
  198. package/public/assets/{logout-CHdmF_16.js → logout-B5T52P8u.js} +2 -2
  199. package/public/assets/{logout-CHdmF_16.js.map → logout-B5T52P8u.js.map} +1 -1
  200. package/public/assets/{modal-sCM_zT82.js → modal-BV3gpI-p.js} +2 -2
  201. package/public/assets/{modal-sCM_zT82.js.map → modal-BV3gpI-p.js.map} +1 -1
  202. package/public/assets/{mutationOptions-CrswitPs.js → mutationOptions-DyYFUbyn.js} +2 -2
  203. package/public/assets/{mutationOptions-CrswitPs.js.map → mutationOptions-DyYFUbyn.js.map} +1 -1
  204. package/public/assets/passkey-Bf7n49Z7.js +2 -0
  205. package/public/assets/{passkey-CEx1VZ5R.js.map → passkey-Bf7n49Z7.js.map} +1 -1
  206. package/public/assets/passkey-CT3G7pCL.js +2 -0
  207. package/public/assets/{passkey-CU8x9J2w.js.map → passkey-CT3G7pCL.js.map} +1 -1
  208. package/public/assets/passkey-J1qnYp9A.js +2 -0
  209. package/public/assets/{passkey-B2Blw47e.js.map → passkey-J1qnYp9A.js.map} +1 -1
  210. package/public/assets/passkey-UcpXAI9J.js +2 -0
  211. package/public/assets/{passkey-UL_cNRnQ.js.map → passkey-UcpXAI9J.js.map} +1 -1
  212. package/public/assets/password-BKI5GTRs.js +2 -0
  213. package/public/assets/password-BKI5GTRs.js.map +1 -0
  214. package/public/assets/password-UcpXAI9J.js +2 -0
  215. package/public/assets/password-UcpXAI9J.js.map +1 -0
  216. package/public/assets/password-reset-sU5KkBKi.js +2 -0
  217. package/public/assets/{password-reset-CIacHnvA.js.map → password-reset-sU5KkBKi.js.map} +1 -1
  218. package/public/assets/{password-strength-C0Zkrrct.js → password-strength-DTWF07Px.js} +2 -2
  219. package/public/assets/{password-strength-C0Zkrrct.js.map → password-strength-DTWF07Px.js.map} +1 -1
  220. package/public/assets/{pin-input-BlD4tPZJ.js → pin-input-BGOLfkwL.js} +2 -2
  221. package/public/assets/{pin-input-BlD4tPZJ.js.map → pin-input-BGOLfkwL.js.map} +1 -1
  222. package/public/assets/{profile-D43Yq-6S.js → profile-DSTMtoUf.js} +2 -2
  223. package/public/assets/{profile-D43Yq-6S.js.map → profile-DSTMtoUf.js.map} +1 -1
  224. package/public/assets/profile-RpDmbWNA.js +2 -0
  225. package/public/assets/profile-RpDmbWNA.js.map +1 -0
  226. package/public/assets/provider-logos-u1YURWQr.js.map +1 -1
  227. package/public/assets/recovery-DbgpqG6f.js +2 -0
  228. package/public/assets/{recovery-CLExnfYX.js.map → recovery-DbgpqG6f.js.map} +1 -1
  229. package/public/assets/register-B2Lixapy.js +2 -0
  230. package/public/assets/{register-CZUyWXRO.js.map → register-B2Lixapy.js.map} +1 -1
  231. package/public/assets/register-UcpXAI9J.js +2 -0
  232. package/public/assets/{register-UL_cNRnQ.js.map → register-UcpXAI9J.js.map} +1 -1
  233. package/public/assets/reset-C-Qjl2Qy.js +2 -0
  234. package/public/assets/reset-C-Qjl2Qy.js.map +1 -0
  235. package/public/assets/reset-UcpXAI9J.js +2 -0
  236. package/public/assets/{reset-UL_cNRnQ.js.map → reset-UcpXAI9J.js.map} +1 -1
  237. package/public/assets/{select-CWdSzsVo.js → select-BKx4bF4A.js} +2 -2
  238. package/public/assets/{select-CWdSzsVo.js.map → select-BKx4bF4A.js.map} +1 -1
  239. package/public/assets/select-UcpXAI9J.js +2 -0
  240. package/public/assets/{select-UL_cNRnQ.js.map → select-UcpXAI9J.js.map} +1 -1
  241. package/public/assets/{separator-BWGym8uM.js → separator-B0Bvh1he.js} +2 -2
  242. package/public/assets/{separator-BWGym8uM.js.map → separator-B0Bvh1he.js.map} +1 -1
  243. package/public/assets/shell-header-bar-CgyNXbPS.js +2 -0
  244. package/public/assets/shell-header-bar-CgyNXbPS.js.map +1 -0
  245. package/public/assets/{terms-D43Yq-6S.js → terms-DSTMtoUf.js} +2 -2
  246. package/public/assets/{terms-D43Yq-6S.js.map → terms-DSTMtoUf.js.map} +1 -1
  247. package/public/assets/{terms-COVFmzyl.js → terms-Vgpg5IZK.js} +2 -2
  248. package/public/assets/{terms-COVFmzyl.js.map → terms-Vgpg5IZK.js.map} +1 -1
  249. package/public/assets/{terms-checkbox-list-Cw0zB-lO.js → terms-checkbox-list-DqbXU4qw.js} +2 -2
  250. package/public/assets/{terms-checkbox-list-Cw0zB-lO.js.map → terms-checkbox-list-DqbXU4qw.js.map} +1 -1
  251. package/public/assets/{totp-BfCm6IWl.js → totp-BNZ904Zm.js} +2 -2
  252. package/public/assets/{totp-BfCm6IWl.js.map → totp-BNZ904Zm.js.map} +1 -1
  253. package/public/assets/totp-Cjns-PoB.js +2 -0
  254. package/public/assets/{totp-BFJEXxk0.js.map → totp-Cjns-PoB.js.map} +1 -1
  255. package/public/assets/totp-g0-s50HZ.js +2 -0
  256. package/public/assets/{totp-MINhsVxT.js.map → totp-g0-s50HZ.js.map} +1 -1
  257. package/public/assets/use-totp-setup-CtTaklH-.js +3 -0
  258. package/public/assets/{use-totp-setup-C7Zk_2IY.js.map → use-totp-setup-CtTaklH-.js.map} +1 -1
  259. package/public/assets/{useAriaLabelledBy-CiOCg6X5.js → useAriaLabelledBy-7uIPXK-0.js} +2 -2
  260. package/public/assets/{useAriaLabelledBy-CiOCg6X5.js.map → useAriaLabelledBy-7uIPXK-0.js.map} +1 -1
  261. package/public/assets/{useMutation-ZLFeJg75.js → useMutation-BWZ0G4Td.js} +2 -2
  262. package/public/assets/{useMutation-ZLFeJg75.js.map → useMutation-BWZ0G4Td.js.map} +1 -1
  263. package/public/assets/useQuery-pOdkMV4B.js +2 -0
  264. package/public/assets/{useQuery-BvMz34BW.js.map → useQuery-pOdkMV4B.js.map} +1 -1
  265. package/public/assets/users-B1hvVo3B.js +2 -0
  266. package/public/assets/users-B1hvVo3B.js.map +1 -0
  267. package/public/index.html +4 -5
  268. package/dist/routes/api/auth/password/reset-required/post.d.ts +0 -18
  269. package/dist/routes/api/auth/password/reset-required/post.d.ts.map +0 -1
  270. package/dist/routes/api/auth/password/reset-required/post.js +0 -39
  271. package/dist/routes/api/auth/password/reset-required/post.js.map +0 -1
  272. package/dist/services/legacy-credential-retirement.service.d.ts +0 -20
  273. package/dist/services/legacy-credential-retirement.service.d.ts.map +0 -1
  274. package/dist/services/legacy-credential-retirement.service.js +0 -90
  275. package/dist/services/legacy-credential-retirement.service.js.map +0 -1
  276. package/public/assets/2fa-BgveHSB_.js +0 -2
  277. package/public/assets/2fa-C37MUkye.js +0 -2
  278. package/public/assets/2fa-UL_cNRnQ.js +0 -2
  279. package/public/assets/2fa-kiqzGSz2.js +0 -2
  280. package/public/assets/admin-DbDuu6AI.js +0 -2
  281. package/public/assets/admin-DbDuu6AI.js.map +0 -1
  282. package/public/assets/admin-users-CwTJdiih.js +0 -2
  283. package/public/assets/auth-layout-CoeqNhTT.js +0 -2
  284. package/public/assets/auth-layout-CoeqNhTT.js.map +0 -1
  285. package/public/assets/auth-page-header-CIs08f5Y.js.map +0 -1
  286. package/public/assets/authorization-context-banner-BbtQmMYH.js +0 -2
  287. package/public/assets/authorization-context-banner-BbtQmMYH.js.map +0 -1
  288. package/public/assets/config-v3-oy_ef.js +0 -2
  289. package/public/assets/config-v3-oy_ef.js.map +0 -1
  290. package/public/assets/email-UL_cNRnQ.js +0 -2
  291. package/public/assets/error-2VPY5w8V.js +0 -2
  292. package/public/assets/forgot-DzDcduho.js +0 -2
  293. package/public/assets/forgot-UL_cNRnQ.js +0 -2
  294. package/public/assets/index-gliHKncz.js +0 -11
  295. package/public/assets/index-gliHKncz.js.map +0 -1
  296. package/public/assets/link-BN90emXr.js +0 -2
  297. package/public/assets/link-BN90emXr.js.map +0 -1
  298. package/public/assets/lock-keyhole-Cz72xkCn.js +0 -2
  299. package/public/assets/lock-keyhole-Cz72xkCn.js.map +0 -1
  300. package/public/assets/login-C6m2qSUt.js +0 -2
  301. package/public/assets/login-C6m2qSUt.js.map +0 -1
  302. package/public/assets/login-UL_cNRnQ.js +0 -2
  303. package/public/assets/login-UL_cNRnQ.js.map +0 -1
  304. package/public/assets/passkey-B2Blw47e.js +0 -2
  305. package/public/assets/passkey-CEx1VZ5R.js +0 -2
  306. package/public/assets/passkey-CU8x9J2w.js +0 -2
  307. package/public/assets/passkey-UL_cNRnQ.js +0 -2
  308. package/public/assets/password-BhU_a0cR.js +0 -2
  309. package/public/assets/password-BhU_a0cR.js.map +0 -1
  310. package/public/assets/password-UL_cNRnQ.js +0 -2
  311. package/public/assets/password-UL_cNRnQ.js.map +0 -1
  312. package/public/assets/password-reset-CIacHnvA.js +0 -2
  313. package/public/assets/profile-D1cEjfs8.js +0 -2
  314. package/public/assets/profile-D1cEjfs8.js.map +0 -1
  315. package/public/assets/recovery-CLExnfYX.js +0 -2
  316. package/public/assets/register-CZUyWXRO.js +0 -2
  317. package/public/assets/register-UL_cNRnQ.js +0 -2
  318. package/public/assets/reset-N3RQTYEB.js +0 -2
  319. package/public/assets/reset-N3RQTYEB.js.map +0 -1
  320. package/public/assets/reset-UL_cNRnQ.js +0 -2
  321. package/public/assets/reset-required-Cv5edDS6.js +0 -2
  322. package/public/assets/reset-required-Cv5edDS6.js.map +0 -1
  323. package/public/assets/reset-required-UL_cNRnQ.js +0 -2
  324. package/public/assets/reset-required-UL_cNRnQ.js.map +0 -1
  325. package/public/assets/select-UL_cNRnQ.js +0 -2
  326. package/public/assets/shell-header-bar-C9AB5lT-.js +0 -2
  327. package/public/assets/shell-header-bar-C9AB5lT-.js.map +0 -1
  328. package/public/assets/totp-BFJEXxk0.js +0 -2
  329. package/public/assets/totp-MINhsVxT.js +0 -2
  330. package/public/assets/use-totp-setup-C7Zk_2IY.js +0 -3
  331. package/public/assets/useQuery-BvMz34BW.js +0 -2
  332. package/public/assets/users-COM7u3A-.js +0 -2
  333. package/public/assets/users-COM7u3A-.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"password-strength-C0Zkrrct.js","names":["_formatErrorMessage","Meter.Indicator","Meter.Label","Meter.Root","Meter.Track","Meter.Value"],"sources":["../../../../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@base-ui/react/meter/root/MeterRootContext.mjs","../../../../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@base-ui/react/meter/root/MeterRoot.mjs","../../../../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@base-ui/react/meter/track/MeterTrack.mjs","../../../../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@base-ui/react/meter/indicator/MeterIndicator.mjs","../../../../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@base-ui/react/meter/value/MeterValue.mjs","../../../../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@base-ui/react/meter/label/MeterLabel.mjs","../../../../node_modules/.pnpm/@tinyrack+ui@0.25.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7_shiki@4.3.1_tailwindcss@4.3.2/node_modules/@tinyrack/ui/dist/components/meter/meter-indicator.js","../../../../node_modules/.pnpm/@tinyrack+ui@0.25.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7_shiki@4.3.1_tailwindcss@4.3.2/node_modules/@tinyrack/ui/dist/components/meter/meter-label.js","../../../../node_modules/.pnpm/@tinyrack+ui@0.25.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7_shiki@4.3.1_tailwindcss@4.3.2/node_modules/@tinyrack/ui/dist/components/meter/meter-root.js","../../../../node_modules/.pnpm/@tinyrack+ui@0.25.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7_shiki@4.3.1_tailwindcss@4.3.2/node_modules/@tinyrack/ui/dist/components/meter/meter-track.js","../../../../node_modules/.pnpm/@tinyrack+ui@0.25.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7_shiki@4.3.1_tailwindcss@4.3.2/node_modules/@tinyrack/ui/dist/components/meter/meter-value.js","../../../../node_modules/.pnpm/@tinyrack+ui@0.25.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7_shiki@4.3.1_tailwindcss@4.3.2/node_modules/@tinyrack/ui/dist/components/meter/index.js","../../../frontend/src/components/auth/password-strength.tsx"],"sourcesContent":["'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const MeterRootContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") MeterRootContext.displayName = \"MeterRootContext\";\nexport function useMeterRootContext() {\n const context = React.useContext(MeterRootContext);\n if (context === undefined) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: MeterRootContext is missing. Meter parts must be placed within <Meter.Root>.' : _formatErrorMessage(38));\n }\n return context;\n}","'use client';\n\nimport * as React from 'react';\nimport { visuallyHidden } from '@base-ui/utils/visuallyHidden';\nimport { MeterRootContext } from \"./MeterRootContext.mjs\";\nimport { formatNumber } from \"../../utils/formatNumber.mjs\";\nimport { valueToPercent } from \"../../utils/valueToPercent.mjs\";\nimport { clamp } from \"../../internals/clamp.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\n\n/**\n * Groups all parts of the meter and provides the value for screen readers.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Meter](https://base-ui.com/react/components/meter)\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport const MeterRoot = /*#__PURE__*/React.forwardRef(function MeterRoot(componentProps, forwardedRef) {\n const {\n format,\n getAriaValueText,\n locale,\n max = 100,\n min = 0,\n value: valueProp,\n render,\n className,\n children,\n style,\n ...elementProps\n } = componentProps;\n const [labelId, setLabelId] = React.useState();\n\n // `clamp` handles infinity, but NaN needs an explicit fallback before normalizing range outputs.\n const rawPercentage = valueToPercent(valueProp, min, max);\n const percentageValue = clamp(Number.isNaN(rawPercentage) ? 0 : rawPercentage, 0, 100);\n const clampedValue = clamp(Number.isNaN(valueProp) ? min : valueProp, min, max);\n\n // Format the clamped value so visible and accessible text stay in sync with `aria-valuenow` and\n // the indicator fill. The raw value remains available as the second `getAriaValueText` argument.\n const formattedValue = format ? formatNumber(clampedValue, locale, format) : formatNumber(percentageValue / 100, locale, {\n style: 'percent'\n });\n let ariaValuetext = formattedValue;\n if (getAriaValueText) {\n ariaValuetext = getAriaValueText(formattedValue, valueProp);\n }\n const defaultProps = {\n 'aria-labelledby': labelId,\n 'aria-valuemax': max,\n 'aria-valuemin': min,\n 'aria-valuenow': clampedValue,\n 'aria-valuetext': ariaValuetext,\n role: 'meter',\n children: /*#__PURE__*/_jsxs(React.Fragment, {\n children: [children, /*#__PURE__*/_jsx(\"span\", {\n role: \"presentation\",\n style: visuallyHidden,\n children: \"x\"\n })]\n })\n };\n const contextValue = React.useMemo(() => ({\n formattedValue,\n percentageValue,\n setLabelId,\n value: valueProp\n }), [formattedValue, percentageValue, setLabelId, valueProp]);\n const element = useRenderElement('div', componentProps, {\n ref: forwardedRef,\n props: [defaultProps, elementProps]\n });\n return /*#__PURE__*/_jsx(MeterRootContext.Provider, {\n value: contextValue,\n children: element\n });\n});\nif (process.env.NODE_ENV !== \"production\") MeterRoot.displayName = \"MeterRoot\";","'use client';\n\nimport * as React from 'react';\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\n\n/**\n * Contains the meter indicator and represents the entire range of the meter.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Meter](https://base-ui.com/react/components/meter)\n */\nexport const MeterTrack = /*#__PURE__*/React.forwardRef(function MeterTrack(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n ...elementProps\n } = componentProps;\n return useRenderElement('div', componentProps, {\n ref: forwardedRef,\n props: elementProps\n });\n});\nif (process.env.NODE_ENV !== \"production\") MeterTrack.displayName = \"MeterTrack\";","'use client';\n\nimport * as React from 'react';\nimport { useMeterRootContext } from \"../root/MeterRootContext.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\n\n/**\n * Visualizes the position of the value along the range.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Meter](https://base-ui.com/react/components/meter)\n */\nexport const MeterIndicator = /*#__PURE__*/React.forwardRef(function MeterIndicator(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n ...elementProps\n } = componentProps;\n const {\n percentageValue\n } = useMeterRootContext();\n return useRenderElement('div', componentProps, {\n ref: forwardedRef,\n props: [{\n style: {\n insetInlineStart: 0,\n height: 'inherit',\n width: `${percentageValue}%`\n }\n }, elementProps]\n });\n});\nif (process.env.NODE_ENV !== \"production\") MeterIndicator.displayName = \"MeterIndicator\";","'use client';\n\nimport * as React from 'react';\nimport { useMeterRootContext } from \"../root/MeterRootContext.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\n\n/**\n * A text element displaying the current value.\n * Renders a `<span>` element.\n *\n * Documentation: [Base UI Meter](https://base-ui.com/react/components/meter)\n */\nexport const MeterValue = /*#__PURE__*/React.forwardRef(function MeterValue(componentProps, forwardedRef) {\n const {\n className,\n render,\n children,\n style,\n ...elementProps\n } = componentProps;\n const {\n value,\n formattedValue\n } = useMeterRootContext();\n return useRenderElement('span', componentProps, {\n ref: forwardedRef,\n props: [{\n 'aria-hidden': true,\n children: typeof children === 'function' ? children(formattedValue, value) : formattedValue\n }, elementProps]\n });\n});\nif (process.env.NODE_ENV !== \"production\") MeterValue.displayName = \"MeterValue\";","'use client';\n\nimport * as React from 'react';\nimport { useMeterRootContext } from \"../root/MeterRootContext.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useRegisteredLabelId } from \"../../utils/useRegisteredLabelId.mjs\";\n\n/**\n * An accessible label for the meter.\n * Renders a `<span>` element.\n *\n * Documentation: [Base UI Meter](https://base-ui.com/react/components/meter)\n */\nexport const MeterLabel = /*#__PURE__*/React.forwardRef(function MeterLabel(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n id: idProp,\n ...elementProps\n } = componentProps;\n const {\n setLabelId\n } = useMeterRootContext();\n const id = useRegisteredLabelId(idProp, setLabelId);\n return useRenderElement('span', componentProps, {\n ref: forwardedRef,\n props: [{\n id,\n role: 'presentation'\n }, elementProps]\n });\n});\nif (process.env.NODE_ENV !== \"production\") MeterLabel.displayName = \"MeterLabel\";","\"use client\";\nimport { createComponentPart } from \"../../internal/component-part.js\";\nimport { Meter } from \"@base-ui/react/meter\";\n//#region src/components/meter/meter-indicator.tsx\nconst TRMeterIndicator = createComponentPart(Meter.Indicator, \"tr-meter-indicator\");\n//#endregion\nexport { TRMeterIndicator };\n\n//# sourceMappingURL=meter-indicator.js.map","\"use client\";\nimport { createComponentPart } from \"../../internal/component-part.js\";\nimport { Meter } from \"@base-ui/react/meter\";\n//#region src/components/meter/meter-label.tsx\nconst TRMeterLabel = createComponentPart(Meter.Label, \"tr-meter-label\");\n//#endregion\nexport { TRMeterLabel };\n\n//# sourceMappingURL=meter-label.js.map","\"use client\";\nimport { mergeComponentClassName } from \"../../internal/component-class-name.js\";\nimport { jsx } from \"react/jsx-runtime\";\nimport { Meter } from \"@base-ui/react/meter\";\n//#region src/components/meter/meter-root.tsx\nfunction TRMeterRoot({ className, max = 100, min = 0, value, variant = \"neutral\", ...props }) {\n\tconst clampedValue = Math.min(max, Math.max(min, Number.isNaN(value) ? min : value));\n\treturn /* @__PURE__ */ jsx(Meter.Root, {\n\t\t...props,\n\t\tclassName: mergeComponentClassName(\"tr-meter\", className),\n\t\t\"data-variant\": variant,\n\t\tmax,\n\t\tmin,\n\t\tvalue: clampedValue\n\t});\n}\n//#endregion\nexport { TRMeterRoot };\n\n//# sourceMappingURL=meter-root.js.map","\"use client\";\nimport { createComponentPart } from \"../../internal/component-part.js\";\nimport { Meter } from \"@base-ui/react/meter\";\n//#region src/components/meter/meter-track.tsx\nconst TRMeterTrack = createComponentPart(Meter.Track, \"tr-meter-track\");\n//#endregion\nexport { TRMeterTrack };\n\n//# sourceMappingURL=meter-track.js.map","\"use client\";\nimport { createComponentPart } from \"../../internal/component-part.js\";\nimport { Meter } from \"@base-ui/react/meter\";\n//#region src/components/meter/meter-value.tsx\nconst TRMeterValue = createComponentPart(Meter.Value, \"tr-meter-value\");\n//#endregion\nexport { TRMeterValue };\n\n//# sourceMappingURL=meter-value.js.map","import { TRMeterIndicator } from \"./meter-indicator.js\";\nimport { TRMeterLabel } from \"./meter-label.js\";\nimport { TRMeterRoot } from \"./meter-root.js\";\nimport { TRMeterTrack } from \"./meter-track.js\";\nimport { TRMeterValue } from \"./meter-value.js\";\n//#region src/components/meter/index.tsx\nconst TRMeter = {\n\tRoot: TRMeterRoot,\n\tTrack: TRMeterTrack,\n\tIndicator: TRMeterIndicator,\n\tValue: TRMeterValue,\n\tLabel: TRMeterLabel\n};\n//#endregion\nexport { TRMeter, TRMeterIndicator, TRMeterLabel, TRMeterRoot, TRMeterTrack, TRMeterValue };\n\n//# sourceMappingURL=index.js.map","import { TRMeter } from '@tinyrack/ui/components/meter';\nimport { TRText } from '@tinyrack/ui/components/text';\nimport { useTranslation } from 'react-i18next';\n\ntype PasswordPolicy = {\n min_length: number;\n max_length: number;\n};\n\ntype PasswordStrengthProps = {\n password: string;\n policy: PasswordPolicy;\n};\n\nconst LEVELS = ['weak', 'fair', 'good', 'strong'] as const;\n\nconst VARIANTS = {\n weak: 'danger',\n fair: 'warning',\n good: 'info',\n strong: 'success',\n} as const;\n\n/**\n * Scores a password 1-4 for feedback only.\n *\n * Deliberately simple: length against the deployment's own policy plus\n * character-class variety. The server is the authority on what is acceptable,\n * so this only needs to steer the user, and a full entropy estimator would be\n * a large dependency for a hint bar.\n *\n * Returns 0 for \"nothing to say yet\" so the caller can stay silent.\n */\nfunction scorePassword(password: string, policy: PasswordPolicy): number {\n if (password.length === 0) {\n return 0;\n }\n if (password.length < policy.min_length) {\n return 1;\n }\n\n const classes = [/[a-z]/, /[A-Z]/, /\\d/, /[^a-zA-Z0-9]/].filter((pattern) =>\n pattern.test(password),\n ).length;\n\n const isLong = password.length >= policy.min_length + 4;\n\n if (classes >= 3 && isLong) {\n return 4;\n }\n if (classes >= 2 && isLong) {\n return 3;\n }\n return 2;\n}\n\n/**\n * Strength hint under a new-password field.\n *\n * Renders nothing for an empty field so the form does not shift as soon as it\n * is focused. Announced politely rather than assertively — it updates on every\n * keystroke and should not interrupt typing.\n */\nexport function PasswordStrength({ password, policy }: PasswordStrengthProps) {\n const { t } = useTranslation();\n const score = scorePassword(password, policy);\n\n if (score === 0) {\n return null;\n }\n\n const level = LEVELS[score - 1];\n\n return (\n <TRMeter.Root\n aria-live=\"polite\"\n className=\"flex flex-col gap-tinyrack-xs\"\n max={4}\n min={0}\n value={score}\n variant={VARIANTS[level]}\n >\n <div className=\"flex items-baseline justify-between gap-tinyrack-sm\">\n <TRMeter.Label\n render={\n <TRText color=\"muted\" variant=\"caption\">\n {t('validation.password.strength.label')}\n </TRText>\n }\n />\n <TRMeter.Value\n render={\n <TRText color=\"muted\" variant=\"caption\">\n {t(`validation.password.strength.${level}`)}\n </TRText>\n }\n />\n </div>\n <TRMeter.Track>\n <TRMeter.Indicator />\n </TRMeter.Track>\n </TRMeter.Root>\n );\n}\n"],"x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11],"mappings":"mRAIa,EAAgC,EAAM,cAAc,IAAA,EAAS,EAE1E,SAAgB,GAAsB,CACpC,IAAM,EAAA,EAAgB,WAAW,CAAgB,EACjD,GAAI,IAAY,IAAA,GACd,MAAU,MAAwIA,EAAoB,EAAE,CAAC,EAE3K,OAAO,CACT,WCKa,EAAyB,EAAM,WAAW,SAAmB,EAAgB,EAAc,CACtG,GAAM,CACJ,SACA,mBACA,SACA,MAAM,IACN,MAAM,EACN,MAAO,EACP,SACA,YACA,WACA,QACA,GAAG,GACD,EACE,CAAC,EAAS,GAAA,EAAoB,SAAS,EAGvC,EAAgB,EAAe,EAAW,EAAK,CAAG,EAClD,EAAkB,EAAM,OAAO,MAAM,CAAa,EAAI,EAAI,EAAe,EAAG,GAAG,EAC/E,EAAe,EAAM,OAAO,MAAM,CAAS,EAAI,EAAM,EAAW,EAAK,CAAG,EAIxE,EAAiB,EAAS,EAAa,EAAc,EAAQ,CAAM,EAAI,EAAa,EAAkB,IAAK,EAAQ,CACvH,MAAO,SACT,CAAC,EACG,EAAgB,EAChB,IACF,EAAgB,EAAiB,EAAgB,CAAS,GAE5D,IAAM,EAAe,CACnB,kBAAmB,EACnB,gBAAiB,EACjB,gBAAiB,EACjB,gBAAiB,EACjB,iBAAkB,EAClB,KAAM,QACN,UAAuB,EAAA,EAAA,KAAA,CAAA,EAAY,SAAU,CAC3C,SAAU,CAAC,GAAuB,EAAA,EAAA,IAAA,CAAK,OAAQ,CAC7C,KAAM,eACN,MAAO,EACP,SAAU,GACZ,CAAC,CAAC,CACJ,CAAC,CACH,EACM,EAAA,EAAqB,aAAe,CAC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V,IAAK,EACL,IAAK,EACL,MAAO,EACP,QAAS,EAAS,YANpB,EAQE,EAAA,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,+DAAf,EACE,EAAA,EAAA,IAAA,CAAC,EAAQ,MAAT,CACE,QACE,EAAA,EAAA,IAAA,CAAC,EAAD,CAAQ,MAAM,QAAQ,QAAQ,mBAC3B,EAAE,oCAAoC,CACjC,CAAA,CAEX,CAAA,GACD,EAAA,EAAA,IAAA,CAAC,EAAQ,MAAT,CACE,QACE,EAAA,EAAA,IAAA,CAAC,EAAD,CAAQ,MAAM,QAAQ,QAAQ,mBAC3B,EAAE,gCAAgC,GAAO,CACpC,CAAA,CAEX,CAAA,CACE,KACL,EAAA,EAAA,IAAA,CAAC,EAAQ,MAAT,CAAA,UACE,EAAA,EAAA,IAAA,CAAC,EAAQ,UAAT,CAAoB,CAAA,CACP,CAAA,CACH,GAElB"}
1
+ {"version":3,"file":"password-strength-DTWF07Px.js","names":["_formatErrorMessage","Meter.Indicator","Meter.Label","Meter.Root","Meter.Track","Meter.Value"],"sources":["../../../../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@base-ui/react/meter/root/MeterRootContext.mjs","../../../../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@base-ui/react/meter/root/MeterRoot.mjs","../../../../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@base-ui/react/meter/track/MeterTrack.mjs","../../../../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@base-ui/react/meter/indicator/MeterIndicator.mjs","../../../../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@base-ui/react/meter/value/MeterValue.mjs","../../../../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@base-ui/react/meter/label/MeterLabel.mjs","../../../../node_modules/.pnpm/@tinyrack+ui@0.27.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7_shiki@4.4.2_tailwindcss@4.3.2/node_modules/@tinyrack/ui/dist/components/meter/meter-indicator.js","../../../../node_modules/.pnpm/@tinyrack+ui@0.27.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7_shiki@4.4.2_tailwindcss@4.3.2/node_modules/@tinyrack/ui/dist/components/meter/meter-label.js","../../../../node_modules/.pnpm/@tinyrack+ui@0.27.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7_shiki@4.4.2_tailwindcss@4.3.2/node_modules/@tinyrack/ui/dist/components/meter/meter-root.js","../../../../node_modules/.pnpm/@tinyrack+ui@0.27.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7_shiki@4.4.2_tailwindcss@4.3.2/node_modules/@tinyrack/ui/dist/components/meter/meter-track.js","../../../../node_modules/.pnpm/@tinyrack+ui@0.27.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7_shiki@4.4.2_tailwindcss@4.3.2/node_modules/@tinyrack/ui/dist/components/meter/meter-value.js","../../../../node_modules/.pnpm/@tinyrack+ui@0.27.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7_shiki@4.4.2_tailwindcss@4.3.2/node_modules/@tinyrack/ui/dist/components/meter/index.js","../../../frontend/src/components/auth/password-strength.tsx"],"sourcesContent":["'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const MeterRootContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") MeterRootContext.displayName = \"MeterRootContext\";\nexport function useMeterRootContext() {\n const context = React.useContext(MeterRootContext);\n if (context === undefined) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: MeterRootContext is missing. Meter parts must be placed within <Meter.Root>.' : _formatErrorMessage(38));\n }\n return context;\n}","'use client';\n\nimport * as React from 'react';\nimport { visuallyHidden } from '@base-ui/utils/visuallyHidden';\nimport { MeterRootContext } from \"./MeterRootContext.mjs\";\nimport { formatNumber } from \"../../utils/formatNumber.mjs\";\nimport { valueToPercent } from \"../../utils/valueToPercent.mjs\";\nimport { clamp } from \"../../internals/clamp.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\n\n/**\n * Groups all parts of the meter and provides the value for screen readers.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Meter](https://base-ui.com/react/components/meter)\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport const MeterRoot = /*#__PURE__*/React.forwardRef(function MeterRoot(componentProps, forwardedRef) {\n const {\n format,\n getAriaValueText,\n locale,\n max = 100,\n min = 0,\n value: valueProp,\n render,\n className,\n children,\n style,\n ...elementProps\n } = componentProps;\n const [labelId, setLabelId] = React.useState();\n\n // `clamp` handles infinity, but NaN needs an explicit fallback before normalizing range outputs.\n const rawPercentage = valueToPercent(valueProp, min, max);\n const percentageValue = clamp(Number.isNaN(rawPercentage) ? 0 : rawPercentage, 0, 100);\n const clampedValue = clamp(Number.isNaN(valueProp) ? min : valueProp, min, max);\n\n // Format the clamped value so visible and accessible text stay in sync with `aria-valuenow` and\n // the indicator fill. The raw value remains available as the second `getAriaValueText` argument.\n const formattedValue = format ? formatNumber(clampedValue, locale, format) : formatNumber(percentageValue / 100, locale, {\n style: 'percent'\n });\n let ariaValuetext = formattedValue;\n if (getAriaValueText) {\n ariaValuetext = getAriaValueText(formattedValue, valueProp);\n }\n const defaultProps = {\n 'aria-labelledby': labelId,\n 'aria-valuemax': max,\n 'aria-valuemin': min,\n 'aria-valuenow': clampedValue,\n 'aria-valuetext': ariaValuetext,\n role: 'meter',\n children: /*#__PURE__*/_jsxs(React.Fragment, {\n children: [children, /*#__PURE__*/_jsx(\"span\", {\n role: \"presentation\",\n style: visuallyHidden,\n children: \"x\"\n })]\n })\n };\n const contextValue = React.useMemo(() => ({\n formattedValue,\n percentageValue,\n setLabelId,\n value: valueProp\n }), [formattedValue, percentageValue, setLabelId, valueProp]);\n const element = useRenderElement('div', componentProps, {\n ref: forwardedRef,\n props: [defaultProps, elementProps]\n });\n return /*#__PURE__*/_jsx(MeterRootContext.Provider, {\n value: contextValue,\n children: element\n });\n});\nif (process.env.NODE_ENV !== \"production\") MeterRoot.displayName = \"MeterRoot\";","'use client';\n\nimport * as React from 'react';\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\n\n/**\n * Contains the meter indicator and represents the entire range of the meter.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Meter](https://base-ui.com/react/components/meter)\n */\nexport const MeterTrack = /*#__PURE__*/React.forwardRef(function MeterTrack(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n ...elementProps\n } = componentProps;\n return useRenderElement('div', componentProps, {\n ref: forwardedRef,\n props: elementProps\n });\n});\nif (process.env.NODE_ENV !== \"production\") MeterTrack.displayName = \"MeterTrack\";","'use client';\n\nimport * as React from 'react';\nimport { useMeterRootContext } from \"../root/MeterRootContext.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\n\n/**\n * Visualizes the position of the value along the range.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Meter](https://base-ui.com/react/components/meter)\n */\nexport const MeterIndicator = /*#__PURE__*/React.forwardRef(function MeterIndicator(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n ...elementProps\n } = componentProps;\n const {\n percentageValue\n } = useMeterRootContext();\n return useRenderElement('div', componentProps, {\n ref: forwardedRef,\n props: [{\n style: {\n insetInlineStart: 0,\n height: 'inherit',\n width: `${percentageValue}%`\n }\n }, elementProps]\n });\n});\nif (process.env.NODE_ENV !== \"production\") MeterIndicator.displayName = \"MeterIndicator\";","'use client';\n\nimport * as React from 'react';\nimport { useMeterRootContext } from \"../root/MeterRootContext.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\n\n/**\n * A text element displaying the current value.\n * Renders a `<span>` element.\n *\n * Documentation: [Base UI Meter](https://base-ui.com/react/components/meter)\n */\nexport const MeterValue = /*#__PURE__*/React.forwardRef(function MeterValue(componentProps, forwardedRef) {\n const {\n className,\n render,\n children,\n style,\n ...elementProps\n } = componentProps;\n const {\n value,\n formattedValue\n } = useMeterRootContext();\n return useRenderElement('span', componentProps, {\n ref: forwardedRef,\n props: [{\n 'aria-hidden': true,\n children: typeof children === 'function' ? children(formattedValue, value) : formattedValue\n }, elementProps]\n });\n});\nif (process.env.NODE_ENV !== \"production\") MeterValue.displayName = \"MeterValue\";","'use client';\n\nimport * as React from 'react';\nimport { useMeterRootContext } from \"../root/MeterRootContext.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useRegisteredLabelId } from \"../../utils/useRegisteredLabelId.mjs\";\n\n/**\n * An accessible label for the meter.\n * Renders a `<span>` element.\n *\n * Documentation: [Base UI Meter](https://base-ui.com/react/components/meter)\n */\nexport const MeterLabel = /*#__PURE__*/React.forwardRef(function MeterLabel(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n id: idProp,\n ...elementProps\n } = componentProps;\n const {\n setLabelId\n } = useMeterRootContext();\n const id = useRegisteredLabelId(idProp, setLabelId);\n return useRenderElement('span', componentProps, {\n ref: forwardedRef,\n props: [{\n id,\n role: 'presentation'\n }, elementProps]\n });\n});\nif (process.env.NODE_ENV !== \"production\") MeterLabel.displayName = \"MeterLabel\";","\"use client\";\nimport { createComponentPart } from \"../../internal/component-part.js\";\nimport { Meter } from \"@base-ui/react/meter\";\n//#region src/components/meter/meter-indicator.tsx\nconst TRMeterIndicator = createComponentPart(Meter.Indicator, \"tr-meter-indicator\");\n//#endregion\nexport { TRMeterIndicator };\n\n//# sourceMappingURL=meter-indicator.js.map","\"use client\";\nimport { createComponentPart } from \"../../internal/component-part.js\";\nimport { Meter } from \"@base-ui/react/meter\";\n//#region src/components/meter/meter-label.tsx\nconst TRMeterLabel = createComponentPart(Meter.Label, \"tr-meter-label\");\n//#endregion\nexport { TRMeterLabel };\n\n//# sourceMappingURL=meter-label.js.map","\"use client\";\nimport { mergeComponentClassName } from \"../../internal/component-class-name.js\";\nimport { jsx } from \"react/jsx-runtime\";\nimport { Meter } from \"@base-ui/react/meter\";\n//#region src/components/meter/meter-root.tsx\nfunction TRMeterRoot({ className, max = 100, min = 0, value, variant = \"neutral\", ...props }) {\n\tconst clampedValue = Math.min(max, Math.max(min, Number.isNaN(value) ? min : value));\n\treturn /* @__PURE__ */ jsx(Meter.Root, {\n\t\t...props,\n\t\tclassName: mergeComponentClassName(\"tr-meter\", className),\n\t\t\"data-variant\": variant,\n\t\tmax,\n\t\tmin,\n\t\tvalue: clampedValue\n\t});\n}\n//#endregion\nexport { TRMeterRoot };\n\n//# sourceMappingURL=meter-root.js.map","\"use client\";\nimport { createComponentPart } from \"../../internal/component-part.js\";\nimport { Meter } from \"@base-ui/react/meter\";\n//#region src/components/meter/meter-track.tsx\nconst TRMeterTrack = createComponentPart(Meter.Track, \"tr-meter-track\");\n//#endregion\nexport { TRMeterTrack };\n\n//# sourceMappingURL=meter-track.js.map","\"use client\";\nimport { createComponentPart } from \"../../internal/component-part.js\";\nimport { Meter } from \"@base-ui/react/meter\";\n//#region src/components/meter/meter-value.tsx\nconst TRMeterValue = createComponentPart(Meter.Value, \"tr-meter-value\");\n//#endregion\nexport { TRMeterValue };\n\n//# sourceMappingURL=meter-value.js.map","import { TRMeterIndicator } from \"./meter-indicator.js\";\nimport { TRMeterLabel } from \"./meter-label.js\";\nimport { TRMeterRoot } from \"./meter-root.js\";\nimport { TRMeterTrack } from \"./meter-track.js\";\nimport { TRMeterValue } from \"./meter-value.js\";\n//#region src/components/meter/index.tsx\nconst TRMeter = {\n\tRoot: TRMeterRoot,\n\tTrack: TRMeterTrack,\n\tIndicator: TRMeterIndicator,\n\tValue: TRMeterValue,\n\tLabel: TRMeterLabel\n};\n//#endregion\nexport { TRMeter, TRMeterIndicator, TRMeterLabel, TRMeterRoot, TRMeterTrack, TRMeterValue };\n\n//# sourceMappingURL=index.js.map","import { TRMeter } from '@tinyrack/ui/components/meter';\nimport { TRText } from '@tinyrack/ui/components/text';\nimport { useTranslation } from 'react-i18next';\n\ntype PasswordPolicy = {\n min_length: number;\n max_length: number;\n};\n\ntype PasswordStrengthProps = {\n password: string;\n policy: PasswordPolicy;\n};\n\nconst LEVELS = ['weak', 'fair', 'good', 'strong'] as const;\n\nconst VARIANTS = {\n weak: 'danger',\n fair: 'warning',\n good: 'info',\n strong: 'success',\n} as const;\n\n/**\n * Scores a password 1-4 for feedback only.\n *\n * Deliberately simple: length against the deployment's own policy plus\n * character-class variety. The server is the authority on what is acceptable,\n * so this only needs to steer the user, and a full entropy estimator would be\n * a large dependency for a hint bar.\n *\n * Returns 0 for \"nothing to say yet\" so the caller can stay silent.\n */\nfunction scorePassword(password: string, policy: PasswordPolicy): number {\n if (password.length === 0) {\n return 0;\n }\n if (password.length < policy.min_length) {\n return 1;\n }\n\n const classes = [/[a-z]/, /[A-Z]/, /\\d/, /[^a-zA-Z0-9]/].filter((pattern) =>\n pattern.test(password),\n ).length;\n\n const isLong = password.length >= policy.min_length + 4;\n\n if (classes >= 3 && isLong) {\n return 4;\n }\n if (classes >= 2 && isLong) {\n return 3;\n }\n return 2;\n}\n\n/**\n * Strength hint under a new-password field.\n *\n * Renders nothing for an empty field so the form does not shift as soon as it\n * is focused. Announced politely rather than assertively — it updates on every\n * keystroke and should not interrupt typing.\n */\nexport function PasswordStrength({ password, policy }: PasswordStrengthProps) {\n const { t } = useTranslation();\n const score = scorePassword(password, policy);\n\n if (score === 0) {\n return null;\n }\n\n const level = LEVELS[score - 1];\n\n return (\n <TRMeter.Root\n aria-live=\"polite\"\n className=\"flex flex-col gap-tinyrack-xs\"\n max={4}\n min={0}\n value={score}\n variant={VARIANTS[level]}\n >\n <div className=\"flex items-baseline justify-between gap-tinyrack-sm\">\n <TRMeter.Label\n render={\n <TRText color=\"muted\" variant=\"caption\">\n {t('validation.password.strength.label')}\n </TRText>\n }\n />\n <TRMeter.Value\n render={\n <TRText color=\"muted\" variant=\"caption\">\n {t(`validation.password.strength.${level}`)}\n </TRText>\n }\n />\n </div>\n <TRMeter.Track>\n <TRMeter.Indicator />\n </TRMeter.Track>\n </TRMeter.Root>\n );\n}\n"],"x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11],"mappings":"mRAIa,EAAgC,EAAM,cAAc,IAAA,EAAS,EAE1E,SAAgB,GAAsB,CACpC,IAAM,EAAA,EAAgB,WAAW,CAAgB,EACjD,GAAI,IAAY,IAAA,GACd,MAAU,MAAwIA,EAAoB,EAAE,CAAC,EAE3K,OAAO,CACT,WCKa,EAAyB,EAAM,WAAW,SAAmB,EAAgB,EAAc,CACtG,GAAM,CACJ,SACA,mBACA,SACA,MAAM,IACN,MAAM,EACN,MAAO,EACP,SACA,YACA,WACA,QACA,GAAG,GACD,EACE,CAAC,EAAS,GAAA,EAAoB,SAAS,EAGvC,EAAgB,EAAe,EAAW,EAAK,CAAG,EAClD,EAAkB,EAAM,OAAO,MAAM,CAAa,EAAI,EAAI,EAAe,EAAG,GAAG,EAC/E,EAAe,EAAM,OAAO,MAAM,CAAS,EAAI,EAAM,EAAW,EAAK,CAAG,EAIxE,EAAiB,EAAS,EAAa,EAAc,EAAQ,CAAM,EAAI,EAAa,EAAkB,IAAK,EAAQ,CACvH,MAAO,SACT,CAAC,EACG,EAAgB,EAChB,IACF,EAAgB,EAAiB,EAAgB,CAAS,GAE5D,IAAM,EAAe,CACnB,kBAAmB,EACnB,gBAAiB,EACjB,gBAAiB,EACjB,gBAAiB,EACjB,iBAAkB,EAClB,KAAM,QACN,UAAuB,EAAA,EAAA,KAAA,CAAA,EAAY,SAAU,CAC3C,S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,CAAM,EAE5C,GAAI,IAAU,EACZ,OAAO,KAGT,IAAM,EAAQ,EAAO,EAAQ,GAE7B,OACE,EAAA,EAAA,KAAA,CAAC,EAAQ,KAAT,CACE,YAAU,SACV,UAAU,gCACV,IAAK,EACL,IAAK,EACL,MAAO,EACP,QAAS,EAAS,YANpB,EAQE,EAAA,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,+DAAf,EACE,EAAA,EAAA,IAAA,CAAC,EAAQ,MAAT,CACE,QACE,EAAA,EAAA,IAAA,CAAC,EAAD,CAAQ,MAAM,QAAQ,QAAQ,mBAC3B,EAAE,oCAAoC,CACjC,CAAA,CAEX,CAAA,GACD,EAAA,EAAA,IAAA,CAAC,EAAQ,MAAT,CACE,QACE,EAAA,EAAA,IAAA,CAAC,EAAD,CAAQ,MAAM,QAAQ,QAAQ,mBAC3B,EAAE,gCAAgC,GAAO,CACpC,CAAA,CAEX,CAAA,CACE,KACL,EAAA,EAAA,IAAA,CAAC,EAAQ,MAAT,CAAA,UACE,EAAA,EAAA,IAAA,CAAC,EAAQ,UAAT,CAAoB,CAAA,CACP,CAAA,CACH,GAElB"}
@@ -1,2 +1,2 @@
1
- import{G as e,J as t,Z as n,_ as r,b as i,c as a,i as o,q as s,v as c,x as l}from"./createLucideIcon-BPpAIXR_.js";import{F as u,G as d,P as f,S as ee,U as p,Vt as m,W as h,Zt as te,bn as g,bt as ne,k as _,q as re,xt as v}from"./config-v3-oy_ef.js";import{S as ie,T as ae,_ as oe,b as se,g as ce,h as le,i as y,u as b,w as x,y as ue}from"./shell-header-bar-C9AB5lT-.js";import{t as S}from"./useAriaLabelledBy-CiOCg6X5.js";import{t as C}from"./field-DDt6F9TZ.js";import{t as w}from"./separator-BWGym8uM.js";var T=n(t(),1),E=T.createContext(void 0);function de(){let e=T.useContext(E);if(e===void 0)throw Error(c(98));return e}function D(e,t,n){return{...e,value:t,index:n,filled:t!==``}}var O={value:()=>null,length:()=>null,...x},k={value:()=>null,index:()=>null,...x},A={numeric:{slotPattern:`\\d{1}`,getRootPattern:e=>`\\d{${e}}`,regexp:/[^\d]/g,inputMode:`numeric`},alpha:{slotPattern:`[a-zA-Z]{1}`,getRootPattern:e=>`[a-zA-Z]{${e}}`,regexp:/[^a-zA-Z]/g,inputMode:`text`},alphanumeric:{slotPattern:`[a-zA-Z0-9]{1}`,getRootPattern:e=>`[a-zA-Z0-9]{${e}}`,regexp:/[^a-zA-Z0-9]/g,inputMode:`text`}};function j(e){return e===`none`?null:A[e]}function M(e){return(e??``).replace(/\s/g,``)}function fe(e,t){return t?e.replace(t.regexp,``):e}function N(e,t,n,r){let i=M(e),a=j(n),o=fe(i,a),s=i.length>o.length;if(r){let e=r(o);s||=o.length>e.length,o=fe(e,a),s||=e.length>o.length}let c=t<0?0:t,l=Array.from(o);return[l.slice(0,c).join(``),s||l.length>c]}function P(e,t,n,r){return N(e,t,n,r)[0]}function pe(e,t,n,r,i,a){let o=P(n,r,i,a);return P(`${e.slice(0,t)}${o}${e.slice(t+o.length)}`,r,i,a)}function F(e,t){return t<0||t>=e.length?e:`${e.slice(0,t)}${e.slice(t+1)}`}var I=s(),L=T.forwardRef(function(e,t){let{"aria-describedby":n,"aria-labelledby":o,id:s,autoComplete:c=`one-time-code`,defaultValue:d,value:ee,onValueChange:p,onValueComplete:m,form:h,length:g,autoSubmit:re=!1,mask:y=!1,inputMode:x,validationType:C=`numeric`,normalizeValue:w,disabled:de=!1,readOnly:D=!1,required:k=!1,name:A,onValueInvalid:M,render:fe,className:pe,style:F,...L}=e,{setDirty:z,validityData:B,disabled:V,setFilled:H,invalid:U,name:me,state:he,validation:W,validationMode:ge,setFocused:_e,setTouched:ve}=ie(),{clearErrors:ye}=ce(),{getDescriptionProps:be,labelId:xe}=ue(),G=V||de,K=me??A,[Se,Ce]=ae({controlled:ee,default:d,name:`OTPField`,state:`value`}),we=T.useRef(null),q=T.useRef([]),Te=T.useRef(null),J=T.useRef(null),Ee=T.useMemo(()=>({get current(){return q.current[0]??null}}),[]),Y=oe({id:s}),De=S(o,xe,Ee,!0,Y),Oe=o==null?De:void 0,ke=R(n,be({})[`aria-describedby`]),Ae=j(C),je=Ae?.slotPattern,Me=Ae?.getRootPattern(g),Ne=x??Ae?.inputMode,Pe=Number.isInteger(g)&&g>0,X=P(Se,g,C,w),Z=_(X),Q=X!==``,[Fe,Ie]=T.useState(0),[Le,Re]=T.useState(()=>Math.min(X.length,g-1)),[ze,Be]=T.useState(!1),Ve=ze?Math.min(Le,Math.max(g-1,0)):Math.min(X.length,g-1);i(()=>{H(Q)},[Q,H]),se(Ee,Y,X,void 0,!G,A);let $=l(e=>{let t=Math.min(Math.max(e,0),Math.max(q.current.length-1,0)),n=q.current[t];n?.focus(),n?.select()}),He=l((e,t)=>{Te.current={index:e,value:t}});function Ue(){let e=W.inputRef.current?.form??q.current[0]?.form??null;if(h){let t=r(we.current).getElementById(h);t?.tagName===`FORM`&&(e=t)}e&&typeof e.requestSubmit==`function`&&e.requestSubmit()}function We(e,t){m?.(e,t),re&&Ue()}le(X,()=>{ye(K),z(X!==B.initialValue),W.change(X);let e=Te.current;e!=null&&(Te.current=null,e.value===X&&$(e.index));let t=J.current;t!=null&&(J.current=null,t.value===X&&We(X,t.eventDetails))});let Ge=l((e,t)=>{let n=P(e,g,C,w),r=(t.reason===`input-change`||t.reason===`input-paste`)&&n.length===g&&(Z.current.length!==g||t.reason===`input-paste`)?u(t.reason,t.event):null;return n===Z.current?(r!=null&&We(n,r),null):(p?.(n,t),t.isCanceled?null:(Ce(n),r==null?n.length!==g&&(J.current=null):J.current={value:n,eventDetails:r},n))}),Ke=l((e,t)=>{M?.(e,t)}),qe=l((e,t)=>{if(e>Z.current.length){$(Math.min(Z.current.length,g-1));return}Re(e),Be(!0),_e(!0),t.currentTarget.select()}),Je=l(e=>{te(we.current,e.relatedTarget)||(ve(!0),Be(!1),_e(!1),ge===`onBlur`&&W.commit(Z.current))}),Ye=T.useCallback(e=>{if(Y!=null)return e===0?Y:`${Y}-${e+1}`},[Y]),Xe=T.useMemo(()=>({...he,complete:X.length===g,disabled:G,filled:Q,focused:ze,length:g,readOnly:D,required:k,value:X}),[G,he,Q,ze,g,D,k,X]),Ze=T.useMemo(()=>({autoComplete:c,activeIndex:Ve,disabled:G,form:h,focusInput:$,queueFocusInput:He,getInputId:Ye,handleInputBlur:Je,handleInputFocus:qe,inputMode:Ne,inputAriaLabelledBy:Oe,invalid:U,length:g,mask:y,pattern:je,reportValueInvalid:Ke,readOnly:D,required:k,normalizeValue:w,setValue:Ge,state:Xe,validationType:C,value:X}),[Ve,c,G,$,h,Ye,Je,qe,Ne,Oe,U,g,y,je,He,D,Ke,k,w,Ge,Xe,C,X]),Qe=a(`div`,e,{ref:[t,we],state:Xe,props:[{role:`group`,"aria-describedby":ke,"aria-labelledby":De},L],stateAttributesMapping:O});return(0,I.jsx)(b,{elementsRef:q,onMapChange:e=>{Ie(e.size)},children:(0,I.jsxs)(E.Provider,{value:Ze,children:[Qe,Pe&&(0,I.jsx)(`input`,{...W.getValidationProps(G,{onFocus(){$(0)},onChange(e){if(e.nativeEvent.defaultPrevented||G||D)return;let t=e.currentTarget.value,[n,r]=N(t,g,C,w);r&&Ke(t,u(`input-change`,e.nativeEvent));let i=Ge(n,f(`input-change`,e.nativeEvent));i!=null&&i!==``&&He(i.length-1,i)}}),ref:W.inputRef,type:`text`,id:Y&&K==null?`${Y}-hidden-input`:void 0,form:h,name:K,value:X,autoComplete:c,inputMode:Ne,minLength:g,maxLength:g,pattern:Me,disabled:G,readOnly:D,required:k,"aria-hidden":!0,tabIndex:-1,style:K?v:ne})]})})});function R(...e){let t=e.flatMap(e=>e?.split(/\s+/).filter(Boolean)??[]);return t.length>0?Array.from(new Set(t)).join(` `):void 0}var z=g(T.forwardRef(function(e,t){let{"aria-label":n,"aria-labelledby":r,render:i,className:o,style:s,...c}=e,{activeIndex:l,autoComplete:te,disabled:g,form:ne,focusInput:_,queueFocusInput:v,getInputId:ie,handleInputBlur:ae,handleInputFocus:oe,inputMode:se,inputAriaLabelledBy:ce,invalid:le,length:b,mask:x,pattern:ue,reportValueInvalid:S,readOnly:C,required:w,normalizeValue:E,setValue:O,state:A,validationType:j,value:M}=de(),{ref:fe,index:P}=y({guess:!0}),I=T.useRef(null),L=ee(),R=M[P]??``,z=D(A,R,P),B=n,V=r??ce,H=P===0?void 0:B,U={id:ie(P),value:R,type:x?`password`:`text`,inputMode:se,autoComplete:P===0?te:`off`,autoCorrect:`off`,spellCheck:`false`,enterKeyHint:P===b-1?`done`:`next`,maxLength:P===0?b:void 0,tabIndex:l===P?0:-1,disabled:g,form:ne,pattern:ue,readOnly:C,required:w,"aria-labelledby":H==null?V:void 0,"aria-invalid":!g&&le?!0:void 0,"aria-label":H,onMouseDown(e){e.defaultPrevented||g||(e.preventDefault(),_(P))},onFocus(e){e.defaultPrevented||g||oe(P,e)},onBlur(e){e.defaultPrevented||ae(e)},onChange(e){if(e.defaultPrevented||g||C)return;let t=e.currentTarget.value,[n,r]=N(t,b,j,E);if(r&&S(t,u(p,e.nativeEvent)),n===``){t===``?O(F(M,P),f(h,e.nativeEvent)):R!==``&&(e.currentTarget.value=R,e.currentTarget.select());return}let i=pe(M,P,n,b,j,E),a=O(i,f(p,e.nativeEvent));if(a!=null){let e=Math.min(P+n.length,b-1);v(e,a)}},onKeyDown(e){if(e.defaultPrevented||g)return;let t=Math.max(b-1,0),n=Math.min(M.length,t),r=(e.ctrlKey||e.metaKey)&&!e.altKey,i=L===`rtl`,a=i?`ArrowRight`:`ArrowLeft`,o=i?`ArrowLeft`:`ArrowRight`;if(e.key===a){m(e),_(r?0:Math.max(0,P-1));return}if(e.key===o){m(e),_(r?n:Math.min(t,P+1));return}if(e.key===`Home`||e.key===`ArrowUp`){m(e),_(0);return}if(e.key===`End`||e.key===`ArrowDown`){m(e),_(n);return}if(C)return;function s(t,n){let r=O(t,f(re,e.nativeEvent));r!=null&&v(n,r)}if(e.key===`Backspace`&&r){m(e),s(``,0);return}if(e.key===`Delete`){m(e),s(F(M,P),P);return}let c=e.currentTarget.value,l=e.currentTarget.selectionStart===0&&e.currentTarget.selectionEnd===c.length;if(e.key.length===1&&l&&R===e.key){m(e),P<b-1&&_(P+1);return}if(e.key===`Backspace`){m(e);let t=Math.max(0,P-1);s(F(M,R===``?t:P),t)}},onPaste(e){if(e.defaultPrevented||g||C)return;let t=``;try{t=e.clipboardData?.getData(`text/plain`)??``}catch{return}e.preventDefault();let[n,r]=N(t,b,j,E);if(r&&S(t,u(d,e.nativeEvent)),n===``)return;let i=O(pe(M,P,n,b,j,E),f(d,e.nativeEvent));if(i!=null){let e=Math.min(P+n.length,b-1);v(e,i)}}};return a(`input`,e,{ref:[t,fe,I],state:z,props:[U,c],stateAttributesMapping:k})}),`tr-otp-field-digit`,{tracksFocusModality:!0});function B({appearance:t=`solid`,className:n,uiSize:r=`md`,...i}){return(0,I.jsx)(L,{...i,className:e(`tr-otp-field`,n),"data-appearance":t,"data-ui-size":r})}function V({className:t,orientation:n=`vertical`,...r}){return(0,I.jsx)(w,{...r,className:e(`tr-otp-field-separator`,t),orientation:n})}var H={Root:B,Input:z,Separator:V},U=(0,T.forwardRef)(function({length:e=6,error:t,disabled:n=!1,onComplete:r,onChange:i,value:a,autoFocus:s=!1,className:c=``},l){let{t:u}=o(),d=(0,T.useId)(),f=(0,T.useRef)(null),[ee,p]=(0,T.useState)(a??``);(0,T.useEffect)(()=>{a!==void 0&&p(a)},[a]),(0,T.useImperativeHandle)(l,()=>({focus:()=>{(f.current?.querySelector(`input`))?.focus()},clear:()=>{p(``),(f.current?.querySelector(`input`))?.focus()}}),[]);let m=(0,T.useCallback)(e=>{p(e),i?.(e)},[i]),h=(0,T.useCallback)(e=>{r?.(e)},[r]);return(0,I.jsxs)(C.Root,{className:c,ref:f,children:[(0,I.jsx)(C.Label,{className:`sr-only`,htmlFor:d,children:u(`common.otp.label`)}),(0,I.jsx)(H.Root,{disabled:n,id:d,length:e,onValueChange:m,onValueComplete:h,uiSize:`md`,validationType:`numeric`,value:ee,children:Array.from({length:e},(t,n)=>(0,I.jsx)(H.Input,{"aria-label":n===0?void 0:u(`common.otp.digit`,{label:u(`common.otp.label`),position:n+1,total:e}),autoFocus:s&&n===0},n))}),t&&(0,I.jsx)(`p`,{className:`mt-tinyrack-sm text-center text-tinyrack-danger text-tinyrack-sm`,"data-testid":`pin-input-error`,children:t.message})]})});export{U as t};
2
- //# sourceMappingURL=pin-input-BlD4tPZJ.js.map
1
+ import{G as e,J as t,Z as n,_ as r,b as i,c as a,i as o,q as s,v as c,x as l}from"./createLucideIcon-BPpAIXR_.js";import{F as u,G as d,P as f,S as ee,U as p,Vt as m,W as h,Zt as te,bn as g,bt as ne,k as _,q as re,xt as v}from"./config-DTQCUlfZ.js";import{S as ie,T as ae,_ as oe,b as se,g as ce,h as le,i as y,u as b,w as x,y as ue}from"./shell-header-bar-CgyNXbPS.js";import{t as S}from"./useAriaLabelledBy-7uIPXK-0.js";import{t as C}from"./field-89zKYDVL.js";import{t as w}from"./separator-B0Bvh1he.js";var T=n(t(),1),E=T.createContext(void 0);function de(){let e=T.useContext(E);if(e===void 0)throw Error(c(98));return e}function D(e,t,n){return{...e,value:t,index:n,filled:t!==``}}var O={value:()=>null,length:()=>null,...x},k={value:()=>null,index:()=>null,...x},A={numeric:{slotPattern:`\\d{1}`,getRootPattern:e=>`\\d{${e}}`,regexp:/[^\d]/g,inputMode:`numeric`},alpha:{slotPattern:`[a-zA-Z]{1}`,getRootPattern:e=>`[a-zA-Z]{${e}}`,regexp:/[^a-zA-Z]/g,inputMode:`text`},alphanumeric:{slotPattern:`[a-zA-Z0-9]{1}`,getRootPattern:e=>`[a-zA-Z0-9]{${e}}`,regexp:/[^a-zA-Z0-9]/g,inputMode:`text`}};function j(e){return e===`none`?null:A[e]}function M(e){return(e??``).replace(/\s/g,``)}function fe(e,t){return t?e.replace(t.regexp,``):e}function N(e,t,n,r){let i=M(e),a=j(n),o=fe(i,a),s=i.length>o.length;if(r){let e=r(o);s||=o.length>e.length,o=fe(e,a),s||=e.length>o.length}let c=t<0?0:t,l=Array.from(o);return[l.slice(0,c).join(``),s||l.length>c]}function P(e,t,n,r){return N(e,t,n,r)[0]}function pe(e,t,n,r,i,a){let o=P(n,r,i,a);return P(`${e.slice(0,t)}${o}${e.slice(t+o.length)}`,r,i,a)}function F(e,t){return t<0||t>=e.length?e:`${e.slice(0,t)}${e.slice(t+1)}`}var I=s(),L=T.forwardRef(function(e,t){let{"aria-describedby":n,"aria-labelledby":o,id:s,autoComplete:c=`one-time-code`,defaultValue:d,value:ee,onValueChange:p,onValueComplete:m,form:h,length:g,autoSubmit:re=!1,mask:y=!1,inputMode:x,validationType:C=`numeric`,normalizeValue:w,disabled:de=!1,readOnly:D=!1,required:k=!1,name:A,onValueInvalid:M,render:fe,className:pe,style:F,...L}=e,{setDirty:z,validityData:B,disabled:V,setFilled:H,invalid:U,name:me,state:he,validation:W,validationMode:ge,setFocused:_e,setTouched:ve}=ie(),{clearErrors:ye}=ce(),{getDescriptionProps:be,labelId:xe}=ue(),G=V||de,K=me??A,[Se,Ce]=ae({controlled:ee,default:d,name:`OTPField`,state:`value`}),we=T.useRef(null),q=T.useRef([]),Te=T.useRef(null),J=T.useRef(null),Ee=T.useMemo(()=>({get current(){return q.current[0]??null}}),[]),Y=oe({id:s}),De=S(o,xe,Ee,!0,Y),Oe=o==null?De:void 0,ke=R(n,be({})[`aria-describedby`]),Ae=j(C),je=Ae?.slotPattern,Me=Ae?.getRootPattern(g),Ne=x??Ae?.inputMode,Pe=Number.isInteger(g)&&g>0,X=P(Se,g,C,w),Z=_(X),Q=X!==``,[Fe,Ie]=T.useState(0),[Le,Re]=T.useState(()=>Math.min(X.length,g-1)),[ze,Be]=T.useState(!1),Ve=ze?Math.min(Le,Math.max(g-1,0)):Math.min(X.length,g-1);i(()=>{H(Q)},[Q,H]),se(Ee,Y,X,void 0,!G,A);let $=l(e=>{let t=Math.min(Math.max(e,0),Math.max(q.current.length-1,0)),n=q.current[t];n?.focus(),n?.select()}),He=l((e,t)=>{Te.current={index:e,value:t}});function Ue(){let e=W.inputRef.current?.form??q.current[0]?.form??null;if(h){let t=r(we.current).getElementById(h);t?.tagName===`FORM`&&(e=t)}e&&typeof e.requestSubmit==`function`&&e.requestSubmit()}function We(e,t){m?.(e,t),re&&Ue()}le(X,()=>{ye(K),z(X!==B.initialValue),W.change(X);let e=Te.current;e!=null&&(Te.current=null,e.value===X&&$(e.index));let t=J.current;t!=null&&(J.current=null,t.value===X&&We(X,t.eventDetails))});let Ge=l((e,t)=>{let n=P(e,g,C,w),r=(t.reason===`input-change`||t.reason===`input-paste`)&&n.length===g&&(Z.current.length!==g||t.reason===`input-paste`)?u(t.reason,t.event):null;return n===Z.current?(r!=null&&We(n,r),null):(p?.(n,t),t.isCanceled?null:(Ce(n),r==null?n.length!==g&&(J.current=null):J.current={value:n,eventDetails:r},n))}),Ke=l((e,t)=>{M?.(e,t)}),qe=l((e,t)=>{if(e>Z.current.length){$(Math.min(Z.current.length,g-1));return}Re(e),Be(!0),_e(!0),t.currentTarget.select()}),Je=l(e=>{te(we.current,e.relatedTarget)||(ve(!0),Be(!1),_e(!1),ge===`onBlur`&&W.commit(Z.current))}),Ye=T.useCallback(e=>{if(Y!=null)return e===0?Y:`${Y}-${e+1}`},[Y]),Xe=T.useMemo(()=>({...he,complete:X.length===g,disabled:G,filled:Q,focused:ze,length:g,readOnly:D,required:k,value:X}),[G,he,Q,ze,g,D,k,X]),Ze=T.useMemo(()=>({autoComplete:c,activeIndex:Ve,disabled:G,form:h,focusInput:$,queueFocusInput:He,getInputId:Ye,handleInputBlur:Je,handleInputFocus:qe,inputMode:Ne,inputAriaLabelledBy:Oe,invalid:U,length:g,mask:y,pattern:je,reportValueInvalid:Ke,readOnly:D,required:k,normalizeValue:w,setValue:Ge,state:Xe,validationType:C,value:X}),[Ve,c,G,$,h,Ye,Je,qe,Ne,Oe,U,g,y,je,He,D,Ke,k,w,Ge,Xe,C,X]),Qe=a(`div`,e,{ref:[t,we],state:Xe,props:[{role:`group`,"aria-describedby":ke,"aria-labelledby":De},L],stateAttributesMapping:O});return(0,I.jsx)(b,{elementsRef:q,onMapChange:e=>{Ie(e.size)},children:(0,I.jsxs)(E.Provider,{value:Ze,children:[Qe,Pe&&(0,I.jsx)(`input`,{...W.getValidationProps(G,{onFocus(){$(0)},onChange(e){if(e.nativeEvent.defaultPrevented||G||D)return;let t=e.currentTarget.value,[n,r]=N(t,g,C,w);r&&Ke(t,u(`input-change`,e.nativeEvent));let i=Ge(n,f(`input-change`,e.nativeEvent));i!=null&&i!==``&&He(i.length-1,i)}}),ref:W.inputRef,type:`text`,id:Y&&K==null?`${Y}-hidden-input`:void 0,form:h,name:K,value:X,autoComplete:c,inputMode:Ne,minLength:g,maxLength:g,pattern:Me,disabled:G,readOnly:D,required:k,"aria-hidden":!0,tabIndex:-1,style:K?v:ne})]})})});function R(...e){let t=e.flatMap(e=>e?.split(/\s+/).filter(Boolean)??[]);return t.length>0?Array.from(new Set(t)).join(` `):void 0}var z=g(T.forwardRef(function(e,t){let{"aria-label":n,"aria-labelledby":r,render:i,className:o,style:s,...c}=e,{activeIndex:l,autoComplete:te,disabled:g,form:ne,focusInput:_,queueFocusInput:v,getInputId:ie,handleInputBlur:ae,handleInputFocus:oe,inputMode:se,inputAriaLabelledBy:ce,invalid:le,length:b,mask:x,pattern:ue,reportValueInvalid:S,readOnly:C,required:w,normalizeValue:E,setValue:O,state:A,validationType:j,value:M}=de(),{ref:fe,index:P}=y({guess:!0}),I=T.useRef(null),L=ee(),R=M[P]??``,z=D(A,R,P),B=n,V=r??ce,H=P===0?void 0:B,U={id:ie(P),value:R,type:x?`password`:`text`,inputMode:se,autoComplete:P===0?te:`off`,autoCorrect:`off`,spellCheck:`false`,enterKeyHint:P===b-1?`done`:`next`,maxLength:P===0?b:void 0,tabIndex:l===P?0:-1,disabled:g,form:ne,pattern:ue,readOnly:C,required:w,"aria-labelledby":H==null?V:void 0,"aria-invalid":!g&&le?!0:void 0,"aria-label":H,onMouseDown(e){e.defaultPrevented||g||(e.preventDefault(),_(P))},onFocus(e){e.defaultPrevented||g||oe(P,e)},onBlur(e){e.defaultPrevented||ae(e)},onChange(e){if(e.defaultPrevented||g||C)return;let t=e.currentTarget.value,[n,r]=N(t,b,j,E);if(r&&S(t,u(p,e.nativeEvent)),n===``){t===``?O(F(M,P),f(h,e.nativeEvent)):R!==``&&(e.currentTarget.value=R,e.currentTarget.select());return}let i=pe(M,P,n,b,j,E),a=O(i,f(p,e.nativeEvent));if(a!=null){let e=Math.min(P+n.length,b-1);v(e,a)}},onKeyDown(e){if(e.defaultPrevented||g)return;let t=Math.max(b-1,0),n=Math.min(M.length,t),r=(e.ctrlKey||e.metaKey)&&!e.altKey,i=L===`rtl`,a=i?`ArrowRight`:`ArrowLeft`,o=i?`ArrowLeft`:`ArrowRight`;if(e.key===a){m(e),_(r?0:Math.max(0,P-1));return}if(e.key===o){m(e),_(r?n:Math.min(t,P+1));return}if(e.key===`Home`||e.key===`ArrowUp`){m(e),_(0);return}if(e.key===`End`||e.key===`ArrowDown`){m(e),_(n);return}if(C)return;function s(t,n){let r=O(t,f(re,e.nativeEvent));r!=null&&v(n,r)}if(e.key===`Backspace`&&r){m(e),s(``,0);return}if(e.key===`Delete`){m(e),s(F(M,P),P);return}let c=e.currentTarget.value,l=e.currentTarget.selectionStart===0&&e.currentTarget.selectionEnd===c.length;if(e.key.length===1&&l&&R===e.key){m(e),P<b-1&&_(P+1);return}if(e.key===`Backspace`){m(e);let t=Math.max(0,P-1);s(F(M,R===``?t:P),t)}},onPaste(e){if(e.defaultPrevented||g||C)return;let t=``;try{t=e.clipboardData?.getData(`text/plain`)??``}catch{return}e.preventDefault();let[n,r]=N(t,b,j,E);if(r&&S(t,u(d,e.nativeEvent)),n===``)return;let i=O(pe(M,P,n,b,j,E),f(d,e.nativeEvent));if(i!=null){let e=Math.min(P+n.length,b-1);v(e,i)}}};return a(`input`,e,{ref:[t,fe,I],state:z,props:[U,c],stateAttributesMapping:k})}),`tr-otp-field-digit`,{tracksFocusModality:!0});function B({appearance:t=`solid`,className:n,uiSize:r=`md`,...i}){return(0,I.jsx)(L,{...i,className:e(`tr-otp-field`,n),"data-appearance":t,"data-ui-size":r})}function V({className:t,orientation:n=`vertical`,...r}){return(0,I.jsx)(w,{...r,className:e(`tr-otp-field-separator`,t),orientation:n})}var H={Root:B,Input:z,Separator:V},U=(0,T.forwardRef)(function({length:e=6,error:t,disabled:n=!1,onComplete:r,onChange:i,value:a,autoFocus:s=!1,className:c=``},l){let{t:u}=o(),d=(0,T.useId)(),f=(0,T.useRef)(null),[ee,p]=(0,T.useState)(a??``);(0,T.useEffect)(()=>{a!==void 0&&p(a)},[a]),(0,T.useImperativeHandle)(l,()=>({focus:()=>{(f.current?.querySelector(`input`))?.focus()},clear:()=>{p(``),(f.current?.querySelector(`input`))?.focus()}}),[]);let m=(0,T.useCallback)(e=>{p(e),i?.(e)},[i]),h=(0,T.useCallback)(e=>{r?.(e)},[r]);return(0,I.jsxs)(C.Root,{className:c,ref:f,children:[(0,I.jsx)(C.Label,{className:`sr-only`,htmlFor:d,children:u(`common.otp.label`)}),(0,I.jsx)(H.Root,{disabled:n,id:d,length:e,onValueChange:m,onValueComplete:h,uiSize:`md`,validationType:`numeric`,value:ee,children:Array.from({length:e},(t,n)=>(0,I.jsx)(H.Input,{"aria-label":n===0?void 0:u(`common.otp.digit`,{label:u(`common.otp.label`),position:n+1,total:e}),autoFocus:s&&n===0},n))}),t&&(0,I.jsx)(`p`,{className:`mt-tinyrack-sm text-center text-tinyrack-danger-foreground text-tinyrack-sm`,"data-testid":`pin-input-error`,children:t.message})]})});export{U as t};
2
+ //# sourceMappingURL=pin-input-BGOLfkwL.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pin-input-BlD4tPZJ.js","names":["_formatErrorMessage","REASONS.inputChange","REASONS.inputClear","REASONS.keyboard","REASONS.inputPaste","OTPField.Input","OTPField.Root"],"sources":["../../../../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@base-ui/react/otp-field/root/OTPFieldRootContext.mjs","../../../../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@base-ui/react/otp-field/utils/stateAttributesMapping.mjs","../../../../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@base-ui/react/otp-field/utils/otp.mjs","../../../../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@base-ui/react/otp-field/root/OTPFieldRoot.mjs","../../../../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@base-ui/react/otp-field/input/OTPFieldInput.mjs","../../../../node_modules/.pnpm/@tinyrack+ui@0.25.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7_shiki@4.3.1_tailwindcss@4.3.2/node_modules/@tinyrack/ui/dist/components/otp-field/otp-field-input.js","../../../../node_modules/.pnpm/@tinyrack+ui@0.25.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7_shiki@4.3.1_tailwindcss@4.3.2/node_modules/@tinyrack/ui/dist/components/otp-field/otp-field-root.js","../../../../node_modules/.pnpm/@tinyrack+ui@0.25.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7_shiki@4.3.1_tailwindcss@4.3.2/node_modules/@tinyrack/ui/dist/components/otp-field/otp-field-separator.js","../../../../node_modules/.pnpm/@tinyrack+ui@0.25.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7_shiki@4.3.1_tailwindcss@4.3.2/node_modules/@tinyrack/ui/dist/components/otp-field/index.js","../../../frontend/src/components/ui/pin-input.tsx"],"sourcesContent":["'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const OTPFieldRootContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") OTPFieldRootContext.displayName = \"OTPFieldRootContext\";\nexport function useOTPFieldRootContext() {\n const context = React.useContext(OTPFieldRootContext);\n if (context === undefined) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: OTPFieldRootContext is missing. OTPField parts must be placed within <OTPField.Root>.' : _formatErrorMessage(98));\n }\n return context;\n}\nexport function getOTPFieldInputState(state, value, index) {\n return {\n ...state,\n value,\n index,\n filled: value !== ''\n };\n}","import { fieldValidityMapping } from \"../../internals/field-constants/constants.mjs\";\nexport const rootStateAttributesMapping = {\n value: () => null,\n length: () => null,\n ...fieldValidityMapping\n};\nexport const inputStateAttributesMapping = {\n value: () => null,\n index: () => null,\n ...fieldValidityMapping\n};","const OTP_VALIDATION_CONFIG = {\n numeric: {\n slotPattern: '\\\\d{1}',\n getRootPattern: length => `\\\\d{${length}}`,\n regexp: /[^\\d]/g,\n inputMode: 'numeric'\n },\n alpha: {\n slotPattern: '[a-zA-Z]{1}',\n getRootPattern: length => `[a-zA-Z]{${length}}`,\n regexp: /[^a-zA-Z]/g,\n inputMode: 'text'\n },\n alphanumeric: {\n slotPattern: '[a-zA-Z0-9]{1}',\n getRootPattern: length => `[a-zA-Z0-9]{${length}}`,\n regexp: /[^a-zA-Z0-9]/g,\n inputMode: 'text'\n }\n};\nexport function getOTPValidationConfig(validationType) {\n if (validationType === 'none') {\n return null;\n }\n return OTP_VALIDATION_CONFIG[validationType];\n}\nexport function stripOTPWhitespace(value) {\n return (value ?? '').replace(/\\s/g, '');\n}\nfunction applyOTPValidation(value, validation) {\n return validation ? value.replace(validation.regexp, '') : value;\n}\n\n/**\n * Normalizes user-entered OTP text by stripping whitespace, applying validation and custom\n * normalization, and clamping the final value to the configured slot count.\n */\nexport function normalizeOTPValueWithDetails(value, length, validationType, normalizeValue) {\n const strippedValue = stripOTPWhitespace(value);\n const validation = getOTPValidationConfig(validationType);\n let normalizedValue = applyOTPValidation(strippedValue, validation);\n let didRejectCharacters = strippedValue.length > normalizedValue.length;\n if (normalizeValue) {\n const customNormalizedValue = normalizeValue(normalizedValue);\n didRejectCharacters ||= normalizedValue.length > customNormalizedValue.length;\n normalizedValue = applyOTPValidation(customNormalizedValue, validation);\n didRejectCharacters ||= customNormalizedValue.length > normalizedValue.length;\n }\n\n // Slice by Unicode code points so multi-byte characters do not split across OTP slots.\n const maxLength = length < 0 ? 0 : length;\n const normalizedCharacters = Array.from(normalizedValue);\n return [normalizedCharacters.slice(0, maxLength).join(''), didRejectCharacters || normalizedCharacters.length > maxLength];\n}\nexport function normalizeOTPValue(value, length, validationType, normalizeValue) {\n return normalizeOTPValueWithDetails(value, length, validationType, normalizeValue)[0];\n}\n\n/**\n * Replaces characters starting at the provided slot index, then re-normalizes the final OTP value\n * so paste and multi-character edits stay contiguous and length-bounded.\n */\nexport function replaceOTPValue(currentValue, index, nextValue, length, validationType, normalizeValue) {\n const normalizedValue = normalizeOTPValue(nextValue, length, validationType, normalizeValue);\n const prefix = currentValue.slice(0, index);\n const suffix = currentValue.slice(index + normalizedValue.length);\n return normalizeOTPValue(`${prefix}${normalizedValue}${suffix}`, length, validationType, normalizeValue);\n}\nexport function removeOTPCharacter(currentValue, index) {\n if (index < 0 || index >= currentValue.length) {\n return currentValue;\n }\n return `${currentValue.slice(0, index)}${currentValue.slice(index + 1)}`;\n}","'use client';\n\nimport * as React from 'react';\nimport { SafeReact } from '@base-ui/utils/safeReact';\nimport { useControlled } from '@base-ui/utils/useControlled';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useValueAsRef } from '@base-ui/utils/useValueAsRef';\nimport { visuallyHidden, visuallyHiddenInput } from '@base-ui/utils/visuallyHidden';\nimport { warn } from '@base-ui/utils/warn';\nimport { ownerDocument } from '@base-ui/utils/owner';\nimport { contains } from \"../../floating-ui-react/utils.mjs\";\nimport { CompositeList } from \"../../internals/composite/list/CompositeList.mjs\";\nimport { useFieldRootContext } from \"../../internals/field-root-context/FieldRootContext.mjs\";\nimport { useRegisterFieldControl } from \"../../internals/field-register-control/useRegisterFieldControl.mjs\";\nimport { useFormContext } from \"../../internals/form-context/FormContext.mjs\";\nimport { useLabelableContext } from \"../../internals/labelable-provider/LabelableContext.mjs\";\nimport { useAriaLabelledBy } from \"../../internals/labelable-provider/useAriaLabelledBy.mjs\";\nimport { useLabelableId } from \"../../internals/labelable-provider/useLabelableId.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useValueChanged } from \"../../internals/useValueChanged.mjs\";\nimport { createChangeEventDetails, createGenericEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { OTPFieldRootContext } from \"./OTPFieldRootContext.mjs\";\nimport { rootStateAttributesMapping } from \"../utils/stateAttributesMapping.mjs\";\nimport { getOTPValidationConfig, normalizeOTPValue, normalizeOTPValueWithDetails } from \"../utils/otp.mjs\";\n\n/**\n * Groups all OTP field parts and manages their state.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI OTP Field](https://base-ui.com/react/components/otp-field)\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport const OTPFieldRoot = /*#__PURE__*/React.forwardRef(function OTPFieldRoot(componentProps, forwardedRef) {\n const {\n 'aria-describedby': ariaDescribedByProp,\n 'aria-labelledby': ariaLabelledByProp,\n id: idProp,\n autoComplete = 'one-time-code',\n defaultValue,\n value: valueProp,\n onValueChange,\n onValueComplete: onValueCompleteProp,\n form,\n length,\n autoSubmit = false,\n mask = false,\n inputMode: inputModeProp,\n validationType = 'numeric',\n normalizeValue,\n disabled: disabledProp = false,\n readOnly = false,\n required = false,\n name: nameProp,\n onValueInvalid,\n render,\n className,\n style,\n ...elementProps\n } = componentProps;\n const {\n setDirty,\n validityData,\n disabled: fieldDisabled,\n setFilled,\n invalid,\n name: fieldName,\n state: fieldState,\n validation,\n validationMode,\n setFocused,\n setTouched\n } = useFieldRootContext();\n const {\n clearErrors\n } = useFormContext();\n const {\n getDescriptionProps,\n labelId\n } = useLabelableContext();\n const disabled = fieldDisabled || disabledProp;\n const name = fieldName ?? nameProp;\n const [valueUnwrapped, setValueUnwrapped] = useControlled({\n controlled: valueProp,\n default: defaultValue,\n name: 'OTPField',\n state: 'value'\n });\n const rootRef = React.useRef(null);\n const inputRefs = React.useRef([]);\n const pendingFocusRef = React.useRef(null);\n const pendingCompleteValueRef = React.useRef(null);\n const firstInputRef = React.useMemo(() => ({\n get current() {\n return inputRefs.current[0] ?? null;\n }\n }), []);\n const id = useLabelableId({\n id: idProp\n });\n const ariaLabelledBy = useAriaLabelledBy(ariaLabelledByProp, labelId, firstInputRef, true, id);\n const inputAriaLabelledBy = ariaLabelledByProp == null ? ariaLabelledBy : undefined;\n const fieldDescriptionProps = getDescriptionProps({});\n const ariaDescribedBy = mergeAriaIds(ariaDescribedByProp, fieldDescriptionProps['aria-describedby']);\n const validationConfig = getOTPValidationConfig(validationType);\n const pattern = validationConfig?.slotPattern;\n const hiddenInputPattern = validationConfig?.getRootPattern(length);\n const inputMode = inputModeProp ?? validationConfig?.inputMode;\n const hasValidLength = Number.isInteger(length) && length > 0;\n const value = normalizeOTPValue(valueUnwrapped, length, validationType, normalizeValue);\n const valueRef = useValueAsRef(value);\n const filled = value !== '';\n const [inputCount, setInputCount] = React.useState(0);\n const [focusedIndex, setFocusedIndex] = React.useState(() => Math.min(value.length, length - 1));\n const [focused, setFocusedState] = React.useState(false);\n const activeIndex = focused ? Math.min(focusedIndex, Math.max(length - 1, 0)) : Math.min(value.length, length - 1);\n useIsoLayoutEffect(() => {\n setFilled(filled);\n }, [filled, setFilled]);\n\n /* istanbul ignore else -- `process.env.NODE_ENV` is a build-time constant under test */\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useOTPFieldRootDevWarnings({\n inputCount,\n length\n });\n }\n useRegisterFieldControl(firstInputRef, id, value, undefined, !disabled, nameProp);\n const focusInput = useStableCallback(index => {\n const targetIndex = Math.min(Math.max(index, 0), Math.max(inputRefs.current.length - 1, 0));\n const target = inputRefs.current[targetIndex];\n target?.focus();\n target?.select();\n });\n const queueFocusInput = useStableCallback((index, nextValue) => {\n pendingFocusRef.current = {\n index,\n value: nextValue\n };\n });\n function requestSubmit() {\n // The hidden validation input only renders for a valid `length`, but the slots always do,\n // so fall back to the owning form of the first slot.\n let formElement = validation.inputRef.current?.form ?? inputRefs.current[0]?.form ?? null;\n if (form) {\n const associatedElement = ownerDocument(rootRef.current).getElementById(form);\n if (associatedElement?.tagName === 'FORM') {\n formElement = associatedElement;\n }\n }\n if (formElement && typeof formElement.requestSubmit === 'function') {\n formElement.requestSubmit();\n }\n }\n function completeValue(completedValue, eventDetails) {\n onValueCompleteProp?.(completedValue, eventDetails);\n if (autoSubmit) {\n requestSubmit();\n }\n }\n useValueChanged(value, () => {\n clearErrors(name);\n setDirty(value !== validityData.initialValue);\n validation.change(value);\n const pendingFocus = pendingFocusRef.current;\n if (pendingFocus != null) {\n pendingFocusRef.current = null;\n if (pendingFocus.value === value) {\n focusInput(pendingFocus.index);\n }\n }\n const pendingCompleteValue = pendingCompleteValueRef.current;\n if (pendingCompleteValue != null) {\n pendingCompleteValueRef.current = null;\n if (pendingCompleteValue.value === value) {\n completeValue(value, pendingCompleteValue.eventDetails);\n }\n }\n });\n const setValue = useStableCallback((nextValue, details) => {\n const normalizedValue = normalizeOTPValue(nextValue, length, validationType, normalizeValue);\n const canComplete = details.reason === REASONS.inputChange || details.reason === REASONS.inputPaste;\n const completeEventDetails = canComplete && normalizedValue.length === length && (valueRef.current.length !== length || details.reason === REASONS.inputPaste) ? createGenericEventDetails(details.reason, details.event) : null;\n if (normalizedValue === valueRef.current) {\n if (completeEventDetails != null) {\n completeValue(normalizedValue, completeEventDetails);\n }\n return null;\n }\n onValueChange?.(normalizedValue, details);\n if (details.isCanceled) {\n return null;\n }\n setValueUnwrapped(normalizedValue);\n if (completeEventDetails != null) {\n pendingCompleteValueRef.current = {\n value: normalizedValue,\n eventDetails: completeEventDetails\n };\n } else if (normalizedValue.length !== length) {\n pendingCompleteValueRef.current = null;\n }\n return normalizedValue;\n });\n const reportValueInvalid = useStableCallback((invalidValue, details) => {\n onValueInvalid?.(invalidValue, details);\n });\n const handleInputFocus = useStableCallback((index, event) => {\n if (index > valueRef.current.length) {\n focusInput(Math.min(valueRef.current.length, length - 1));\n return;\n }\n setFocusedIndex(index);\n setFocusedState(true);\n setFocused(true);\n event.currentTarget.select();\n });\n const handleInputBlur = useStableCallback(event => {\n if (contains(rootRef.current, event.relatedTarget)) {\n return;\n }\n setTouched(true);\n setFocusedState(false);\n setFocused(false);\n if (validationMode === 'onBlur') {\n validation.commit(valueRef.current);\n }\n });\n const getInputId = React.useCallback(index => {\n if (id == null) {\n return undefined;\n }\n return index === 0 ? id : `${id}-${index + 1}`;\n }, [id]);\n const state = React.useMemo(() => ({\n ...fieldState,\n complete: value.length === length,\n disabled,\n filled,\n focused,\n length,\n readOnly,\n required,\n value\n }), [disabled, fieldState, filled, focused, length, readOnly, required, value]);\n const contextValue = React.useMemo(() => ({\n autoComplete,\n activeIndex,\n disabled,\n form,\n focusInput,\n queueFocusInput,\n getInputId,\n handleInputBlur,\n handleInputFocus,\n inputMode,\n inputAriaLabelledBy,\n invalid,\n length,\n mask,\n pattern,\n reportValueInvalid,\n readOnly,\n required,\n normalizeValue,\n setValue,\n state,\n validationType,\n value\n }), [activeIndex, autoComplete, disabled, focusInput, form, getInputId, handleInputBlur, handleInputFocus, inputMode, inputAriaLabelledBy, invalid, length, mask, pattern, queueFocusInput, readOnly, reportValueInvalid, required, normalizeValue, setValue, state, validationType, value]);\n const element = useRenderElement('div', componentProps, {\n ref: [forwardedRef, rootRef],\n state,\n props: [{\n role: 'group',\n 'aria-describedby': ariaDescribedBy,\n 'aria-labelledby': ariaLabelledBy\n }, elementProps],\n stateAttributesMapping: rootStateAttributesMapping\n });\n return /*#__PURE__*/_jsx(CompositeList, {\n elementsRef: inputRefs,\n onMapChange: newMap => {\n setInputCount(newMap.size);\n },\n children: /*#__PURE__*/_jsxs(OTPFieldRootContext.Provider, {\n value: contextValue,\n children: [element, hasValidLength && /*#__PURE__*/_jsx(\"input\", {\n ...validation.getValidationProps(disabled, {\n onFocus() {\n focusInput(0);\n },\n onChange(event) {\n if (event.nativeEvent.defaultPrevented || disabled || readOnly) {\n return;\n }\n const rawValue = event.currentTarget.value;\n const [normalizedValue, didRejectCharacters] = normalizeOTPValueWithDetails(rawValue, length, validationType, normalizeValue);\n if (didRejectCharacters) {\n reportValueInvalid(rawValue, createGenericEventDetails(REASONS.inputChange, event.nativeEvent));\n }\n const committedValue = setValue(normalizedValue, createChangeEventDetails(REASONS.inputChange, event.nativeEvent));\n if (committedValue != null && committedValue !== '') {\n queueFocusInput(committedValue.length - 1, committedValue);\n }\n }\n }),\n ref: validation.inputRef,\n type: \"text\",\n id: id && name == null ? `${id}-hidden-input` : undefined,\n form: form,\n name: name,\n value: value,\n autoComplete: autoComplete,\n inputMode: inputMode,\n minLength: length,\n maxLength: length,\n pattern: hiddenInputPattern,\n disabled: disabled,\n readOnly: readOnly,\n required: required,\n \"aria-hidden\": true,\n tabIndex: -1,\n style: name ? visuallyHiddenInput : visuallyHidden\n })]\n })\n });\n});\nif (process.env.NODE_ENV !== \"production\") OTPFieldRoot.displayName = \"OTPFieldRoot\";\nfunction mergeAriaIds(...values) {\n const ids = values.flatMap(value => value?.split(/\\s+/).filter(Boolean) ?? []);\n return ids.length > 0 ? Array.from(new Set(ids)).join(' ') : undefined;\n}\nfunction useOTPFieldRootDevWarnings(parameters) {\n const {\n inputCount,\n length\n } = parameters;\n React.useEffect(() => {\n if (!Number.isInteger(length) || length <= 0 || inputCount === 0 || inputCount === length) {\n return;\n }\n const ownerStackMessage = SafeReact.captureOwnerStack?.() || '';\n const message = '<OTPField.Root> `length` must match the number of rendered ' + `<OTPField.Input /> parts. Received \\`length={${length}}\\` but rendered ` + `${inputCount} input${inputCount === 1 ? '' : 's'}.`;\n warn(message, ownerStackMessage);\n }, [inputCount, length]);\n React.useEffect(() => {\n if (Number.isInteger(length) && length > 0) {\n return;\n }\n const ownerStackMessage = SafeReact.captureOwnerStack?.() || '';\n warn(`<OTPField.Root> \\`length\\` must be a positive integer. Received \\`length={${String(length)}}\\`.`, ownerStackMessage);\n }, [length]);\n}","'use client';\n\nimport * as React from 'react';\nimport { SafeReact } from '@base-ui/utils/safeReact';\nimport { warn } from '@base-ui/utils/warn';\nimport { stopEvent } from \"../../floating-ui-react/utils.mjs\";\nimport { useCompositeListItem } from \"../../internals/composite/list/useCompositeListItem.mjs\";\nimport { useDirection } from \"../../internals/direction-context/DirectionContext.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { createChangeEventDetails, createGenericEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { useOTPFieldRootContext, getOTPFieldInputState } from \"../root/OTPFieldRootContext.mjs\";\nimport { inputStateAttributesMapping } from \"../utils/stateAttributesMapping.mjs\";\nimport { normalizeOTPValueWithDetails, removeOTPCharacter, replaceOTPValue } from \"../utils/otp.mjs\";\n\n/**\n * An individual OTP character input.\n * Renders an `<input>` element.\n *\n * Documentation: [Base UI OTP Field](https://base-ui.com/react/components/otp-field)\n */\nexport const OTPFieldInput = /*#__PURE__*/React.forwardRef(function OTPFieldInput(componentProps, forwardedRef) {\n const {\n 'aria-label': externalAriaLabel,\n 'aria-labelledby': externalAriaLabelledBy,\n render,\n className,\n style,\n ...elementProps\n } = componentProps;\n const {\n activeIndex,\n autoComplete,\n disabled,\n form,\n focusInput,\n queueFocusInput,\n getInputId,\n handleInputBlur,\n handleInputFocus,\n inputMode,\n inputAriaLabelledBy,\n invalid,\n length,\n mask,\n pattern,\n reportValueInvalid,\n readOnly,\n required,\n normalizeValue,\n setValue,\n state,\n validationType,\n value\n } = useOTPFieldRootContext();\n const {\n ref: listItemRef,\n index\n } = useCompositeListItem({\n guess: true\n });\n const inputRef = React.useRef(null);\n const direction = useDirection();\n const slotValue = value[index] ?? '';\n const inputState = getOTPFieldInputState(state, slotValue, index);\n const slotAriaLabel = externalAriaLabel;\n const inheritedLabel = externalAriaLabelledBy ?? inputAriaLabelledBy;\n const ariaLabel = index === 0 ? undefined : slotAriaLabel;\n\n /* istanbul ignore else -- `process.env.NODE_ENV` is a build-time constant under test */\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n if (index !== 0 || slotAriaLabel == null || inputRef.current?.labels?.length) {\n return;\n }\n const ownerStackMessage = SafeReact.captureOwnerStack?.() || '';\n warn('<OTPField.Input> ignores `aria-label` on the first input. Use a `<label>` or `<Field.Label>` to label the OTP field.', ownerStackMessage);\n }, [index, slotAriaLabel]);\n }\n const inputProps = {\n id: getInputId(index),\n value: slotValue,\n type: mask ? 'password' : 'text',\n inputMode,\n autoComplete: index === 0 ? autoComplete : 'off',\n autoCorrect: 'off',\n spellCheck: 'false',\n enterKeyHint: index === length - 1 ? 'done' : 'next',\n // Only the first slot has a max length to avoid password manager bubbles appearing after later inputs.\n maxLength: index === 0 ? length : undefined,\n tabIndex: activeIndex === index ? 0 : -1,\n disabled,\n form,\n pattern,\n readOnly,\n required,\n 'aria-labelledby': ariaLabel == null ? inheritedLabel : undefined,\n 'aria-invalid': !disabled && invalid ? true : undefined,\n 'aria-label': ariaLabel,\n onMouseDown(event) {\n if (event.defaultPrevented || disabled) {\n return;\n }\n event.preventDefault();\n focusInput(index);\n },\n onFocus(event) {\n if (event.defaultPrevented || disabled) {\n return;\n }\n handleInputFocus(index, event);\n },\n onBlur(event) {\n if (event.defaultPrevented) {\n return;\n }\n handleInputBlur(event);\n },\n onChange(event) {\n if (event.defaultPrevented || disabled || readOnly) {\n return;\n }\n const rawValue = event.currentTarget.value;\n const [nextDigits, didRejectCharacters] = normalizeOTPValueWithDetails(rawValue, length, validationType, normalizeValue);\n if (didRejectCharacters) {\n reportValueInvalid(rawValue, createGenericEventDetails(REASONS.inputChange, event.nativeEvent));\n }\n if (nextDigits === '') {\n if (rawValue === '') {\n setValue(removeOTPCharacter(value, index), createChangeEventDetails(REASONS.inputClear, event.nativeEvent));\n } else if (slotValue !== '') {\n event.currentTarget.value = slotValue;\n event.currentTarget.select();\n }\n return;\n }\n const nextValue = replaceOTPValue(value, index, nextDigits, length, validationType, normalizeValue);\n const committedValue = setValue(nextValue, createChangeEventDetails(REASONS.inputChange, event.nativeEvent));\n if (committedValue != null) {\n const nextInput = Math.min(index + nextDigits.length, length - 1);\n queueFocusInput(nextInput, committedValue);\n }\n },\n onKeyDown(event) {\n if (event.defaultPrevented || disabled) {\n return;\n }\n const firstIndex = 0;\n const lastIndex = Math.max(length - 1, firstIndex);\n const endTargetIndex = Math.min(value.length, lastIndex);\n const hasBoundaryModifier = (event.ctrlKey || event.metaKey) && !event.altKey;\n const isRtl = direction === 'rtl';\n const previousKey = isRtl ? 'ArrowRight' : 'ArrowLeft';\n const nextKey = isRtl ? 'ArrowLeft' : 'ArrowRight';\n if (event.key === previousKey) {\n stopEvent(event);\n focusInput(hasBoundaryModifier ? firstIndex : Math.max(firstIndex, index - 1));\n return;\n }\n if (event.key === nextKey) {\n stopEvent(event);\n focusInput(hasBoundaryModifier ? endTargetIndex : Math.min(lastIndex, index + 1));\n return;\n }\n if (event.key === 'Home' || event.key === 'ArrowUp') {\n stopEvent(event);\n focusInput(firstIndex);\n return;\n }\n if (event.key === 'End' || event.key === 'ArrowDown') {\n stopEvent(event);\n focusInput(endTargetIndex);\n return;\n }\n if (readOnly) {\n return;\n }\n function setKeyboardValue(nextValue, targetIndex) {\n const committedValue = setValue(nextValue, createChangeEventDetails(REASONS.keyboard, event.nativeEvent));\n if (committedValue != null) {\n queueFocusInput(targetIndex, committedValue);\n }\n }\n if (event.key === 'Backspace' && hasBoundaryModifier) {\n stopEvent(event);\n setKeyboardValue('', firstIndex);\n return;\n }\n if (event.key === 'Delete') {\n stopEvent(event);\n setKeyboardValue(removeOTPCharacter(value, index), index);\n return;\n }\n const inputValue = event.currentTarget.value;\n const fullSelection = event.currentTarget.selectionStart === 0 && event.currentTarget.selectionEnd === inputValue.length;\n if (event.key.length === 1 && fullSelection && slotValue === event.key) {\n stopEvent(event);\n if (index < length - 1) {\n focusInput(index + 1);\n }\n return;\n }\n if (event.key === 'Backspace') {\n stopEvent(event);\n const targetIndex = Math.max(firstIndex, index - 1);\n const deleteIndex = slotValue === '' ? targetIndex : index;\n setKeyboardValue(removeOTPCharacter(value, deleteIndex), targetIndex);\n }\n },\n onPaste(event) {\n if (event.defaultPrevented || disabled || readOnly) {\n return;\n }\n let rawValue = '';\n try {\n rawValue = event.clipboardData?.getData('text/plain') ?? '';\n } catch {\n /* istanbul ignore else -- `process.env.NODE_ENV` is a build-time constant under test */\n if (process.env.NODE_ENV !== 'production') {\n const ownerStackMessage = SafeReact.captureOwnerStack?.() || '';\n warn('<OTPField.Input> could not read clipboard text during paste handling.', ownerStackMessage);\n }\n return;\n }\n event.preventDefault();\n const [nextDigits, didRejectCharacters] = normalizeOTPValueWithDetails(rawValue, length, validationType, normalizeValue);\n if (didRejectCharacters) {\n reportValueInvalid(rawValue, createGenericEventDetails(REASONS.inputPaste, event.nativeEvent));\n }\n if (nextDigits === '') {\n return;\n }\n const committedValue = setValue(replaceOTPValue(value, index, nextDigits, length, validationType, normalizeValue), createChangeEventDetails(REASONS.inputPaste, event.nativeEvent));\n if (committedValue != null) {\n const nextInput = Math.min(index + nextDigits.length, length - 1);\n queueFocusInput(nextInput, committedValue);\n }\n }\n };\n const element = useRenderElement('input', componentProps, {\n ref: [forwardedRef, listItemRef, inputRef],\n state: inputState,\n props: [inputProps, elementProps],\n stateAttributesMapping: inputStateAttributesMapping\n });\n return element;\n});\nif (process.env.NODE_ENV !== \"production\") OTPFieldInput.displayName = \"OTPFieldInput\";","\"use client\";\nimport { createComponentPart } from \"../../internal/component-part.js\";\nimport { OTPField } from \"@base-ui/react/otp-field\";\n//#region src/components/otp-field/otp-field-input.tsx\nconst TROTPFieldInput = createComponentPart(OTPField.Input, \"tr-otp-field-digit\", { tracksFocusModality: true });\n//#endregion\nexport { TROTPFieldInput };\n\n//# sourceMappingURL=otp-field-input.js.map","\"use client\";\nimport { mergeComponentClassName } from \"../../internal/component-class-name.js\";\nimport { jsx } from \"react/jsx-runtime\";\nimport { OTPField } from \"@base-ui/react/otp-field\";\n//#region src/components/otp-field/otp-field-root.tsx\nfunction TROTPFieldRoot({ appearance = \"solid\", className, uiSize = \"md\", ...props }) {\n\treturn /* @__PURE__ */ jsx(OTPField.Root, {\n\t\t...props,\n\t\tclassName: mergeComponentClassName(\"tr-otp-field\", className),\n\t\t\"data-appearance\": appearance,\n\t\t\"data-ui-size\": uiSize\n\t});\n}\n//#endregion\nexport { TROTPFieldRoot };\n\n//# sourceMappingURL=otp-field-root.js.map","import { mergeComponentClassName } from \"../../internal/component-class-name.js\";\nimport { TRSeparator } from \"../separator/separator.js\";\nimport { jsx } from \"react/jsx-runtime\";\n//#region src/components/otp-field/otp-field-separator.tsx\nfunction TROTPFieldSeparator({ className, orientation = \"vertical\", ...props }) {\n\treturn /* @__PURE__ */ jsx(TRSeparator, {\n\t\t...props,\n\t\tclassName: mergeComponentClassName(\"tr-otp-field-separator\", className),\n\t\torientation\n\t});\n}\n//#endregion\nexport { TROTPFieldSeparator };\n\n//# sourceMappingURL=otp-field-separator.js.map","import { TROTPFieldInput } from \"./otp-field-input.js\";\nimport { TROTPFieldRoot } from \"./otp-field-root.js\";\nimport { TROTPFieldSeparator } from \"./otp-field-separator.js\";\n//#region src/components/otp-field/index.tsx\nconst TROTPField = {\n\tRoot: TROTPFieldRoot,\n\tInput: TROTPFieldInput,\n\tSeparator: TROTPFieldSeparator\n};\n//#endregion\nexport { TROTPField, TROTPFieldInput, TROTPFieldRoot, TROTPFieldSeparator };\n\n//# sourceMappingURL=index.js.map","import { TRField } from '@tinyrack/ui/components/field';\nimport { TROTPField } from '@tinyrack/ui/components/otp-field';\nimport {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useImperativeHandle,\n useRef,\n useState,\n} from 'react';\nimport type { FieldError } from 'react-hook-form';\nimport { useTranslation } from 'react-i18next';\n\nexport type PinInputRef = {\n focus: () => void;\n clear: () => void;\n};\n\ntype PinInputProps = {\n length?: number;\n error?: FieldError;\n disabled?: boolean;\n onComplete?: (value: string) => void;\n onChange?: (value: string) => void;\n value?: string;\n autoFocus?: boolean;\n className?: string;\n};\n\nexport const PinInput = forwardRef<PinInputRef, PinInputProps>(\n function PinInput(\n {\n length = 6,\n error,\n disabled = false,\n onComplete,\n onChange,\n value: controlledValue,\n autoFocus = false,\n className = '',\n },\n ref,\n ) {\n const { t } = useTranslation();\n const otpId = useId();\n const containerRef = useRef<HTMLDivElement>(null);\n const [internalValue, setInternalValue] = useState(controlledValue ?? '');\n\n useEffect(() => {\n if (controlledValue !== undefined) {\n setInternalValue(controlledValue);\n }\n }, [controlledValue]);\n\n useImperativeHandle(\n ref,\n () => ({\n focus: () => {\n const firstInput = containerRef.current?.querySelector('input');\n firstInput?.focus();\n },\n clear: () => {\n setInternalValue('');\n const firstInput = containerRef.current?.querySelector('input');\n firstInput?.focus();\n },\n }),\n [],\n );\n\n const handleValueChange = useCallback(\n (newValue: string) => {\n setInternalValue(newValue);\n onChange?.(newValue);\n },\n [onChange],\n );\n\n const handleValueComplete = useCallback(\n (completedValue: string) => {\n onComplete?.(completedValue);\n },\n [onComplete],\n );\n\n return (\n <TRField.Root className={className} ref={containerRef}>\n {/*\n A real label, not `aria-label`: Base UI deliberately ignores\n `aria-label` on the first OTP input and warns to use a label instead,\n because that input is also the one password managers autofill.\n Visually hidden — the screen's own heading already says what the code\n is, so showing it twice would be noise.\n */}\n <TRField.Label className=\"sr-only\" htmlFor={otpId}>\n {t('common.otp.label')}\n </TRField.Label>\n <TROTPField.Root\n disabled={disabled}\n /*\n * Base UI gives the first slot the root's own id and derives the\n * rest from it, so naming the root is what lets the label point at\n * a real input rather than at the wrapping group.\n */\n id={otpId}\n length={length}\n onValueChange={handleValueChange}\n onValueComplete={handleValueComplete}\n uiSize=\"md\"\n validationType=\"numeric\"\n value={internalValue}\n >\n {/*\n Each box is a separate input, so each needs to say which position\n it is. Two Base UI behaviours shape this: the first box ignores\n `aria-label` outright (it is the one password managers autofill, so\n it takes the field's own label), and on the rest an `aria-label`\n *replaces* the inherited field name rather than adding to it. So\n the field name is folded into the per-box string, and box one is\n left to the label above.\n */}\n {Array.from({ length }, (_, index) => (\n <TROTPField.Input\n aria-label={\n index === 0\n ? undefined\n : t('common.otp.digit', {\n label: t('common.otp.label'),\n position: index + 1,\n total: length,\n })\n }\n autoFocus={autoFocus && index === 0}\n key={index}\n />\n ))}\n </TROTPField.Root>\n {error && (\n <p\n className=\"mt-tinyrack-sm text-center text-tinyrack-danger text-tinyrack-sm\"\n data-testid=\"pin-input-error\"\n >\n {error.message}\n </p>\n )}\n </TRField.Root>\n );\n },\n);\n\nexport default PinInput;\n"],"x_google_ignoreList":[0,1,2,3,4,5,6,7,8],"mappings":"wgBAIa,EAAmC,EAAM,cAAc,IAAA,EAAS,EAE7E,SAAgB,IAAyB,CACvC,IAAM,EAAA,EAAgB,WAAW,CAAmB,EACpD,GAAI,IAAY,IAAA,GACd,MAAU,MAAiJA,EAAoB,EAAE,CAAC,EAEpL,OAAO,CACT,CACA,SAAgB,EAAsB,EAAO,EAAO,EAAO,CACzD,MAAO,CACL,GAAG,EACH,QACA,QACA,OAAQ,IAAU,EACpB,CACF,CCnBA,IAAa,EAA6B,CACxC,UAAa,KACb,WAAc,KACd,GAAG,CACL,EACa,EAA8B,CACzC,UAAa,KACb,UAAa,KACb,GAAG,CACL,ECVM,EAAwB,CAC5B,QAAS,CACP,Y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zC,EAAE,kBAAkB,CACR,CAAA,GACf,EAAA,EAAA,IAAA,CAAC,EAAW,KAAZ,CACY,WAMV,GAAI,EACI,SACR,cAAe,EACf,gBAAiB,EACjB,OAAO,KACP,eAAe,UACf,MAAO,YAWN,MAAM,KAAK,CAAE,QAAO,GAAI,EAAG,KAC1B,EAAA,EAAA,IAAA,CAAC,EAAW,MAAZ,CACE,aACE,IAAU,EACN,IAAA,GACA,EAAE,mBAAoB,CACpB,MAAO,EAAE,kBAAkB,EAC3B,SAAU,EAAQ,EAClB,MAAO,CACT,CAAC,EAEP,UAAW,GAAa,IAAU,CAEnC,EADM,CACN,CACF,CACc,CAAA,EAChB,IACC,EAAA,EAAA,IAAA,CAAC,IAAD,CACE,UAAU,mEACV,cAAY,2BAEX,EAAM,OACN,CAAA,CAEO,GAElB,CACF"}
1
+ {"version":3,"file":"pin-input-BGOLfkwL.js","names":["_formatErrorMessage","REASONS.inputChange","REASONS.inputClear","REASONS.keyboard","REASONS.inputPaste","OTPField.Input","OTPField.Root"],"sources":["../../../../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@base-ui/react/otp-field/root/OTPFieldRootContext.mjs","../../../../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@base-ui/react/otp-field/utils/stateAttributesMapping.mjs","../../../../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@base-ui/react/otp-field/utils/otp.mjs","../../../../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@base-ui/react/otp-field/root/OTPFieldRoot.mjs","../../../../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@base-ui/react/otp-field/input/OTPFieldInput.mjs","../../../../node_modules/.pnpm/@tinyrack+ui@0.27.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7_shiki@4.4.2_tailwindcss@4.3.2/node_modules/@tinyrack/ui/dist/components/otp-field/otp-field-input.js","../../../../node_modules/.pnpm/@tinyrack+ui@0.27.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7_shiki@4.4.2_tailwindcss@4.3.2/node_modules/@tinyrack/ui/dist/components/otp-field/otp-field-root.js","../../../../node_modules/.pnpm/@tinyrack+ui@0.27.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7_shiki@4.4.2_tailwindcss@4.3.2/node_modules/@tinyrack/ui/dist/components/otp-field/otp-field-separator.js","../../../../node_modules/.pnpm/@tinyrack+ui@0.27.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7_shiki@4.4.2_tailwindcss@4.3.2/node_modules/@tinyrack/ui/dist/components/otp-field/index.js","../../../frontend/src/components/ui/pin-input.tsx"],"sourcesContent":["'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const OTPFieldRootContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") OTPFieldRootContext.displayName = \"OTPFieldRootContext\";\nexport function useOTPFieldRootContext() {\n const context = React.useContext(OTPFieldRootContext);\n if (context === undefined) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: OTPFieldRootContext is missing. OTPField parts must be placed within <OTPField.Root>.' : _formatErrorMessage(98));\n }\n return context;\n}\nexport function getOTPFieldInputState(state, value, index) {\n return {\n ...state,\n value,\n index,\n filled: value !== ''\n };\n}","import { fieldValidityMapping } from \"../../internals/field-constants/constants.mjs\";\nexport const rootStateAttributesMapping = {\n value: () => null,\n length: () => null,\n ...fieldValidityMapping\n};\nexport const inputStateAttributesMapping = {\n value: () => null,\n index: () => null,\n ...fieldValidityMapping\n};","const OTP_VALIDATION_CONFIG = {\n numeric: {\n slotPattern: '\\\\d{1}',\n getRootPattern: length => `\\\\d{${length}}`,\n regexp: /[^\\d]/g,\n inputMode: 'numeric'\n },\n alpha: {\n slotPattern: '[a-zA-Z]{1}',\n getRootPattern: length => `[a-zA-Z]{${length}}`,\n regexp: /[^a-zA-Z]/g,\n inputMode: 'text'\n },\n alphanumeric: {\n slotPattern: '[a-zA-Z0-9]{1}',\n getRootPattern: length => `[a-zA-Z0-9]{${length}}`,\n regexp: /[^a-zA-Z0-9]/g,\n inputMode: 'text'\n }\n};\nexport function getOTPValidationConfig(validationType) {\n if (validationType === 'none') {\n return null;\n }\n return OTP_VALIDATION_CONFIG[validationType];\n}\nexport function stripOTPWhitespace(value) {\n return (value ?? '').replace(/\\s/g, '');\n}\nfunction applyOTPValidation(value, validation) {\n return validation ? value.replace(validation.regexp, '') : value;\n}\n\n/**\n * Normalizes user-entered OTP text by stripping whitespace, applying validation and custom\n * normalization, and clamping the final value to the configured slot count.\n */\nexport function normalizeOTPValueWithDetails(value, length, validationType, normalizeValue) {\n const strippedValue = stripOTPWhitespace(value);\n const validation = getOTPValidationConfig(validationType);\n let normalizedValue = applyOTPValidation(strippedValue, validation);\n let didRejectCharacters = strippedValue.length > normalizedValue.length;\n if (normalizeValue) {\n const customNormalizedValue = normalizeValue(normalizedValue);\n didRejectCharacters ||= normalizedValue.length > customNormalizedValue.length;\n normalizedValue = applyOTPValidation(customNormalizedValue, validation);\n didRejectCharacters ||= customNormalizedValue.length > normalizedValue.length;\n }\n\n // Slice by Unicode code points so multi-byte characters do not split across OTP slots.\n const maxLength = length < 0 ? 0 : length;\n const normalizedCharacters = Array.from(normalizedValue);\n return [normalizedCharacters.slice(0, maxLength).join(''), didRejectCharacters || normalizedCharacters.length > maxLength];\n}\nexport function normalizeOTPValue(value, length, validationType, normalizeValue) {\n return normalizeOTPValueWithDetails(value, length, validationType, normalizeValue)[0];\n}\n\n/**\n * Replaces characters starting at the provided slot index, then re-normalizes the final OTP value\n * so paste and multi-character edits stay contiguous and length-bounded.\n */\nexport function replaceOTPValue(currentValue, index, nextValue, length, validationType, normalizeValue) {\n const normalizedValue = normalizeOTPValue(nextValue, length, validationType, normalizeValue);\n const prefix = currentValue.slice(0, index);\n const suffix = currentValue.slice(index + normalizedValue.length);\n return normalizeOTPValue(`${prefix}${normalizedValue}${suffix}`, length, validationType, normalizeValue);\n}\nexport function removeOTPCharacter(currentValue, index) {\n if (index < 0 || index >= currentValue.length) {\n return currentValue;\n }\n return `${currentValue.slice(0, index)}${currentValue.slice(index + 1)}`;\n}","'use client';\n\nimport * as React from 'react';\nimport { SafeReact } from '@base-ui/utils/safeReact';\nimport { useControlled } from '@base-ui/utils/useControlled';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useValueAsRef } from '@base-ui/utils/useValueAsRef';\nimport { visuallyHidden, visuallyHiddenInput } from '@base-ui/utils/visuallyHidden';\nimport { warn } from '@base-ui/utils/warn';\nimport { ownerDocument } from '@base-ui/utils/owner';\nimport { contains } from \"../../floating-ui-react/utils.mjs\";\nimport { CompositeList } from \"../../internals/composite/list/CompositeList.mjs\";\nimport { useFieldRootContext } from \"../../internals/field-root-context/FieldRootContext.mjs\";\nimport { useRegisterFieldControl } from \"../../internals/field-register-control/useRegisterFieldControl.mjs\";\nimport { useFormContext } from \"../../internals/form-context/FormContext.mjs\";\nimport { useLabelableContext } from \"../../internals/labelable-provider/LabelableContext.mjs\";\nimport { useAriaLabelledBy } from \"../../internals/labelable-provider/useAriaLabelledBy.mjs\";\nimport { useLabelableId } from \"../../internals/labelable-provider/useLabelableId.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useValueChanged } from \"../../internals/useValueChanged.mjs\";\nimport { createChangeEventDetails, createGenericEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { OTPFieldRootContext } from \"./OTPFieldRootContext.mjs\";\nimport { rootStateAttributesMapping } from \"../utils/stateAttributesMapping.mjs\";\nimport { getOTPValidationConfig, normalizeOTPValue, normalizeOTPValueWithDetails } from \"../utils/otp.mjs\";\n\n/**\n * Groups all OTP field parts and manages their state.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI OTP Field](https://base-ui.com/react/components/otp-field)\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport const OTPFieldRoot = /*#__PURE__*/React.forwardRef(function OTPFieldRoot(componentProps, forwardedRef) {\n const {\n 'aria-describedby': ariaDescribedByProp,\n 'aria-labelledby': ariaLabelledByProp,\n id: idProp,\n autoComplete = 'one-time-code',\n defaultValue,\n value: valueProp,\n onValueChange,\n onValueComplete: onValueCompleteProp,\n form,\n length,\n autoSubmit = false,\n mask = false,\n inputMode: inputModeProp,\n validationType = 'numeric',\n normalizeValue,\n disabled: disabledProp = false,\n readOnly = false,\n required = false,\n name: nameProp,\n onValueInvalid,\n render,\n className,\n style,\n ...elementProps\n } = componentProps;\n const {\n setDirty,\n validityData,\n disabled: fieldDisabled,\n setFilled,\n invalid,\n name: fieldName,\n state: fieldState,\n validation,\n validationMode,\n setFocused,\n setTouched\n } = useFieldRootContext();\n const {\n clearErrors\n } = useFormContext();\n const {\n getDescriptionProps,\n labelId\n } = useLabelableContext();\n const disabled = fieldDisabled || disabledProp;\n const name = fieldName ?? nameProp;\n const [valueUnwrapped, setValueUnwrapped] = useControlled({\n controlled: valueProp,\n default: defaultValue,\n name: 'OTPField',\n state: 'value'\n });\n const rootRef = React.useRef(null);\n const inputRefs = React.useRef([]);\n const pendingFocusRef = React.useRef(null);\n const pendingCompleteValueRef = React.useRef(null);\n const firstInputRef = React.useMemo(() => ({\n get current() {\n return inputRefs.current[0] ?? null;\n }\n }), []);\n const id = useLabelableId({\n id: idProp\n });\n const ariaLabelledBy = useAriaLabelledBy(ariaLabelledByProp, labelId, firstInputRef, true, id);\n const inputAriaLabelledBy = ariaLabelledByProp == null ? ariaLabelledBy : undefined;\n const fieldDescriptionProps = getDescriptionProps({});\n const ariaDescribedBy = mergeAriaIds(ariaDescribedByProp, fieldDescriptionProps['aria-describedby']);\n const validationConfig = getOTPValidationConfig(validationType);\n const pattern = validationConfig?.slotPattern;\n const hiddenInputPattern = validationConfig?.getRootPattern(length);\n const inputMode = inputModeProp ?? validationConfig?.inputMode;\n const hasValidLength = Number.isInteger(length) && length > 0;\n const value = normalizeOTPValue(valueUnwrapped, length, validationType, normalizeValue);\n const valueRef = useValueAsRef(value);\n const filled = value !== '';\n const [inputCount, setInputCount] = React.useState(0);\n const [focusedIndex, setFocusedIndex] = React.useState(() => Math.min(value.length, length - 1));\n const [focused, setFocusedState] = React.useState(false);\n const activeIndex = focused ? Math.min(focusedIndex, Math.max(length - 1, 0)) : Math.min(value.length, length - 1);\n useIsoLayoutEffect(() => {\n setFilled(filled);\n }, [filled, setFilled]);\n\n /* istanbul ignore else -- `process.env.NODE_ENV` is a build-time constant under test */\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useOTPFieldRootDevWarnings({\n inputCount,\n length\n });\n }\n useRegisterFieldControl(firstInputRef, id, value, undefined, !disabled, nameProp);\n const focusInput = useStableCallback(index => {\n const targetIndex = Math.min(Math.max(index, 0), Math.max(inputRefs.current.length - 1, 0));\n const target = inputRefs.current[targetIndex];\n target?.focus();\n target?.select();\n });\n const queueFocusInput = useStableCallback((index, nextValue) => {\n pendingFocusRef.current = {\n index,\n value: nextValue\n };\n });\n function requestSubmit() {\n // The hidden validation input only renders for a valid `length`, but the slots always do,\n // so fall back to the owning form of the first slot.\n let formElement = validation.inputRef.current?.form ?? inputRefs.current[0]?.form ?? null;\n if (form) {\n const associatedElement = ownerDocument(rootRef.current).getElementById(form);\n if (associatedElement?.tagName === 'FORM') {\n formElement = associatedElement;\n }\n }\n if (formElement && typeof formElement.requestSubmit === 'function') {\n formElement.requestSubmit();\n }\n }\n function completeValue(completedValue, eventDetails) {\n onValueCompleteProp?.(completedValue, eventDetails);\n if (autoSubmit) {\n requestSubmit();\n }\n }\n useValueChanged(value, () => {\n clearErrors(name);\n setDirty(value !== validityData.initialValue);\n validation.change(value);\n const pendingFocus = pendingFocusRef.current;\n if (pendingFocus != null) {\n pendingFocusRef.current = null;\n if (pendingFocus.value === value) {\n focusInput(pendingFocus.index);\n }\n }\n const pendingCompleteValue = pendingCompleteValueRef.current;\n if (pendingCompleteValue != null) {\n pendingCompleteValueRef.current = null;\n if (pendingCompleteValue.value === value) {\n completeValue(value, pendingCompleteValue.eventDetails);\n }\n }\n });\n const setValue = useStableCallback((nextValue, details) => {\n const normalizedValue = normalizeOTPValue(nextValue, length, validationType, normalizeValue);\n const canComplete = details.reason === REASONS.inputChange || details.reason === REASONS.inputPaste;\n const completeEventDetails = canComplete && normalizedValue.length === length && (valueRef.current.length !== length || details.reason === REASONS.inputPaste) ? createGenericEventDetails(details.reason, details.event) : null;\n if (normalizedValue === valueRef.current) {\n if (completeEventDetails != null) {\n completeValue(normalizedValue, completeEventDetails);\n }\n return null;\n }\n onValueChange?.(normalizedValue, details);\n if (details.isCanceled) {\n return null;\n }\n setValueUnwrapped(normalizedValue);\n if (completeEventDetails != null) {\n pendingCompleteValueRef.current = {\n value: normalizedValue,\n eventDetails: completeEventDetails\n };\n } else if (normalizedValue.length !== length) {\n pendingCompleteValueRef.current = null;\n }\n return normalizedValue;\n });\n const reportValueInvalid = useStableCallback((invalidValue, details) => {\n onValueInvalid?.(invalidValue, details);\n });\n const handleInputFocus = useStableCallback((index, event) => {\n if (index > valueRef.current.length) {\n focusInput(Math.min(valueRef.current.length, length - 1));\n return;\n }\n setFocusedIndex(index);\n setFocusedState(true);\n setFocused(true);\n event.currentTarget.select();\n });\n const handleInputBlur = useStableCallback(event => {\n if (contains(rootRef.current, event.relatedTarget)) {\n return;\n }\n setTouched(true);\n setFocusedState(false);\n setFocused(false);\n if (validationMode === 'onBlur') {\n validation.commit(valueRef.current);\n }\n });\n const getInputId = React.useCallback(index => {\n if (id == null) {\n return undefined;\n }\n return index === 0 ? id : `${id}-${index + 1}`;\n }, [id]);\n const state = React.useMemo(() => ({\n ...fieldState,\n complete: value.length === length,\n disabled,\n filled,\n focused,\n length,\n readOnly,\n required,\n value\n }), [disabled, fieldState, filled, focused, length, readOnly, required, value]);\n const contextValue = React.useMemo(() => ({\n autoComplete,\n activeIndex,\n disabled,\n form,\n focusInput,\n queueFocusInput,\n getInputId,\n handleInputBlur,\n handleInputFocus,\n inputMode,\n inputAriaLabelledBy,\n invalid,\n length,\n mask,\n pattern,\n reportValueInvalid,\n readOnly,\n required,\n normalizeValue,\n setValue,\n state,\n validationType,\n value\n }), [activeIndex, autoComplete, disabled, focusInput, form, getInputId, handleInputBlur, handleInputFocus, inputMode, inputAriaLabelledBy, invalid, length, mask, pattern, queueFocusInput, readOnly, reportValueInvalid, required, normalizeValue, setValue, state, validationType, value]);\n const element = useRenderElement('div', componentProps, {\n ref: [forwardedRef, rootRef],\n state,\n props: [{\n role: 'group',\n 'aria-describedby': ariaDescribedBy,\n 'aria-labelledby': ariaLabelledBy\n }, elementProps],\n stateAttributesMapping: rootStateAttributesMapping\n });\n return /*#__PURE__*/_jsx(CompositeList, {\n elementsRef: inputRefs,\n onMapChange: newMap => {\n setInputCount(newMap.size);\n },\n children: /*#__PURE__*/_jsxs(OTPFieldRootContext.Provider, {\n value: contextValue,\n children: [element, hasValidLength && /*#__PURE__*/_jsx(\"input\", {\n ...validation.getValidationProps(disabled, {\n onFocus() {\n focusInput(0);\n },\n onChange(event) {\n if (event.nativeEvent.defaultPrevented || disabled || readOnly) {\n return;\n }\n const rawValue = event.currentTarget.value;\n const [normalizedValue, didRejectCharacters] = normalizeOTPValueWithDetails(rawValue, length, validationType, normalizeValue);\n if (didRejectCharacters) {\n reportValueInvalid(rawValue, createGenericEventDetails(REASONS.inputChange, event.nativeEvent));\n }\n const committedValue = setValue(normalizedValue, createChangeEventDetails(REASONS.inputChange, event.nativeEvent));\n if (committedValue != null && committedValue !== '') {\n queueFocusInput(committedValue.length - 1, committedValue);\n }\n }\n }),\n ref: validation.inputRef,\n type: \"text\",\n id: id && name == null ? `${id}-hidden-input` : undefined,\n form: form,\n name: name,\n value: value,\n autoComplete: autoComplete,\n inputMode: inputMode,\n minLength: length,\n maxLength: length,\n pattern: hiddenInputPattern,\n disabled: disabled,\n readOnly: readOnly,\n required: required,\n \"aria-hidden\": true,\n tabIndex: -1,\n style: name ? visuallyHiddenInput : visuallyHidden\n })]\n })\n });\n});\nif (process.env.NODE_ENV !== \"production\") OTPFieldRoot.displayName = \"OTPFieldRoot\";\nfunction mergeAriaIds(...values) {\n const ids = values.flatMap(value => value?.split(/\\s+/).filter(Boolean) ?? []);\n return ids.length > 0 ? Array.from(new Set(ids)).join(' ') : undefined;\n}\nfunction useOTPFieldRootDevWarnings(parameters) {\n const {\n inputCount,\n length\n } = parameters;\n React.useEffect(() => {\n if (!Number.isInteger(length) || length <= 0 || inputCount === 0 || inputCount === length) {\n return;\n }\n const ownerStackMessage = SafeReact.captureOwnerStack?.() || '';\n const message = '<OTPField.Root> `length` must match the number of rendered ' + `<OTPField.Input /> parts. Received \\`length={${length}}\\` but rendered ` + `${inputCount} input${inputCount === 1 ? '' : 's'}.`;\n warn(message, ownerStackMessage);\n }, [inputCount, length]);\n React.useEffect(() => {\n if (Number.isInteger(length) && length > 0) {\n return;\n }\n const ownerStackMessage = SafeReact.captureOwnerStack?.() || '';\n warn(`<OTPField.Root> \\`length\\` must be a positive integer. Received \\`length={${String(length)}}\\`.`, ownerStackMessage);\n }, [length]);\n}","'use client';\n\nimport * as React from 'react';\nimport { SafeReact } from '@base-ui/utils/safeReact';\nimport { warn } from '@base-ui/utils/warn';\nimport { stopEvent } from \"../../floating-ui-react/utils.mjs\";\nimport { useCompositeListItem } from \"../../internals/composite/list/useCompositeListItem.mjs\";\nimport { useDirection } from \"../../internals/direction-context/DirectionContext.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { createChangeEventDetails, createGenericEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { useOTPFieldRootContext, getOTPFieldInputState } from \"../root/OTPFieldRootContext.mjs\";\nimport { inputStateAttributesMapping } from \"../utils/stateAttributesMapping.mjs\";\nimport { normalizeOTPValueWithDetails, removeOTPCharacter, replaceOTPValue } from \"../utils/otp.mjs\";\n\n/**\n * An individual OTP character input.\n * Renders an `<input>` element.\n *\n * Documentation: [Base UI OTP Field](https://base-ui.com/react/components/otp-field)\n */\nexport const OTPFieldInput = /*#__PURE__*/React.forwardRef(function OTPFieldInput(componentProps, forwardedRef) {\n const {\n 'aria-label': externalAriaLabel,\n 'aria-labelledby': externalAriaLabelledBy,\n render,\n className,\n style,\n ...elementProps\n } = componentProps;\n const {\n activeIndex,\n autoComplete,\n disabled,\n form,\n focusInput,\n queueFocusInput,\n getInputId,\n handleInputBlur,\n handleInputFocus,\n inputMode,\n inputAriaLabelledBy,\n invalid,\n length,\n mask,\n pattern,\n reportValueInvalid,\n readOnly,\n required,\n normalizeValue,\n setValue,\n state,\n validationType,\n value\n } = useOTPFieldRootContext();\n const {\n ref: listItemRef,\n index\n } = useCompositeListItem({\n guess: true\n });\n const inputRef = React.useRef(null);\n const direction = useDirection();\n const slotValue = value[index] ?? '';\n const inputState = getOTPFieldInputState(state, slotValue, index);\n const slotAriaLabel = externalAriaLabel;\n const inheritedLabel = externalAriaLabelledBy ?? inputAriaLabelledBy;\n const ariaLabel = index === 0 ? undefined : slotAriaLabel;\n\n /* istanbul ignore else -- `process.env.NODE_ENV` is a build-time constant under test */\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n if (index !== 0 || slotAriaLabel == null || inputRef.current?.labels?.length) {\n return;\n }\n const ownerStackMessage = SafeReact.captureOwnerStack?.() || '';\n warn('<OTPField.Input> ignores `aria-label` on the first input. Use a `<label>` or `<Field.Label>` to label the OTP field.', ownerStackMessage);\n }, [index, slotAriaLabel]);\n }\n const inputProps = {\n id: getInputId(index),\n value: slotValue,\n type: mask ? 'password' : 'text',\n inputMode,\n autoComplete: index === 0 ? autoComplete : 'off',\n autoCorrect: 'off',\n spellCheck: 'false',\n enterKeyHint: index === length - 1 ? 'done' : 'next',\n // Only the first slot has a max length to avoid password manager bubbles appearing after later inputs.\n maxLength: index === 0 ? length : undefined,\n tabIndex: activeIndex === index ? 0 : -1,\n disabled,\n form,\n pattern,\n readOnly,\n required,\n 'aria-labelledby': ariaLabel == null ? inheritedLabel : undefined,\n 'aria-invalid': !disabled && invalid ? true : undefined,\n 'aria-label': ariaLabel,\n onMouseDown(event) {\n if (event.defaultPrevented || disabled) {\n return;\n }\n event.preventDefault();\n focusInput(index);\n },\n onFocus(event) {\n if (event.defaultPrevented || disabled) {\n return;\n }\n handleInputFocus(index, event);\n },\n onBlur(event) {\n if (event.defaultPrevented) {\n return;\n }\n handleInputBlur(event);\n },\n onChange(event) {\n if (event.defaultPrevented || disabled || readOnly) {\n return;\n }\n const rawValue = event.currentTarget.value;\n const [nextDigits, didRejectCharacters] = normalizeOTPValueWithDetails(rawValue, length, validationType, normalizeValue);\n if (didRejectCharacters) {\n reportValueInvalid(rawValue, createGenericEventDetails(REASONS.inputChange, event.nativeEvent));\n }\n if (nextDigits === '') {\n if (rawValue === '') {\n setValue(removeOTPCharacter(value, index), createChangeEventDetails(REASONS.inputClear, event.nativeEvent));\n } else if (slotValue !== '') {\n event.currentTarget.value = slotValue;\n event.currentTarget.select();\n }\n return;\n }\n const nextValue = replaceOTPValue(value, index, nextDigits, length, validationType, normalizeValue);\n const committedValue = setValue(nextValue, createChangeEventDetails(REASONS.inputChange, event.nativeEvent));\n if (committedValue != null) {\n const nextInput = Math.min(index + nextDigits.length, length - 1);\n queueFocusInput(nextInput, committedValue);\n }\n },\n onKeyDown(event) {\n if (event.defaultPrevented || disabled) {\n return;\n }\n const firstIndex = 0;\n const lastIndex = Math.max(length - 1, firstIndex);\n const endTargetIndex = Math.min(value.length, lastIndex);\n const hasBoundaryModifier = (event.ctrlKey || event.metaKey) && !event.altKey;\n const isRtl = direction === 'rtl';\n const previousKey = isRtl ? 'ArrowRight' : 'ArrowLeft';\n const nextKey = isRtl ? 'ArrowLeft' : 'ArrowRight';\n if (event.key === previousKey) {\n stopEvent(event);\n focusInput(hasBoundaryModifier ? firstIndex : Math.max(firstIndex, index - 1));\n return;\n }\n if (event.key === nextKey) {\n stopEvent(event);\n focusInput(hasBoundaryModifier ? endTargetIndex : Math.min(lastIndex, index + 1));\n return;\n }\n if (event.key === 'Home' || event.key === 'ArrowUp') {\n stopEvent(event);\n focusInput(firstIndex);\n return;\n }\n if (event.key === 'End' || event.key === 'ArrowDown') {\n stopEvent(event);\n focusInput(endTargetIndex);\n return;\n }\n if (readOnly) {\n return;\n }\n function setKeyboardValue(nextValue, targetIndex) {\n const committedValue = setValue(nextValue, createChangeEventDetails(REASONS.keyboard, event.nativeEvent));\n if (committedValue != null) {\n queueFocusInput(targetIndex, committedValue);\n }\n }\n if (event.key === 'Backspace' && hasBoundaryModifier) {\n stopEvent(event);\n setKeyboardValue('', firstIndex);\n return;\n }\n if (event.key === 'Delete') {\n stopEvent(event);\n setKeyboardValue(removeOTPCharacter(value, index), index);\n return;\n }\n const inputValue = event.currentTarget.value;\n const fullSelection = event.currentTarget.selectionStart === 0 && event.currentTarget.selectionEnd === inputValue.length;\n if (event.key.length === 1 && fullSelection && slotValue === event.key) {\n stopEvent(event);\n if (index < length - 1) {\n focusInput(index + 1);\n }\n return;\n }\n if (event.key === 'Backspace') {\n stopEvent(event);\n const targetIndex = Math.max(firstIndex, index - 1);\n const deleteIndex = slotValue === '' ? targetIndex : index;\n setKeyboardValue(removeOTPCharacter(value, deleteIndex), targetIndex);\n }\n },\n onPaste(event) {\n if (event.defaultPrevented || disabled || readOnly) {\n return;\n }\n let rawValue = '';\n try {\n rawValue = event.clipboardData?.getData('text/plain') ?? '';\n } catch {\n /* istanbul ignore else -- `process.env.NODE_ENV` is a build-time constant under test */\n if (process.env.NODE_ENV !== 'production') {\n const ownerStackMessage = SafeReact.captureOwnerStack?.() || '';\n warn('<OTPField.Input> could not read clipboard text during paste handling.', ownerStackMessage);\n }\n return;\n }\n event.preventDefault();\n const [nextDigits, didRejectCharacters] = normalizeOTPValueWithDetails(rawValue, length, validationType, normalizeValue);\n if (didRejectCharacters) {\n reportValueInvalid(rawValue, createGenericEventDetails(REASONS.inputPaste, event.nativeEvent));\n }\n if (nextDigits === '') {\n return;\n }\n const committedValue = setValue(replaceOTPValue(value, index, nextDigits, length, validationType, normalizeValue), createChangeEventDetails(REASONS.inputPaste, event.nativeEvent));\n if (committedValue != null) {\n const nextInput = Math.min(index + nextDigits.length, length - 1);\n queueFocusInput(nextInput, committedValue);\n }\n }\n };\n const element = useRenderElement('input', componentProps, {\n ref: [forwardedRef, listItemRef, inputRef],\n state: inputState,\n props: [inputProps, elementProps],\n stateAttributesMapping: inputStateAttributesMapping\n });\n return element;\n});\nif (process.env.NODE_ENV !== \"production\") OTPFieldInput.displayName = \"OTPFieldInput\";","\"use client\";\nimport { createComponentPart } from \"../../internal/component-part.js\";\nimport { OTPField } from \"@base-ui/react/otp-field\";\n//#region src/components/otp-field/otp-field-input.tsx\nconst TROTPFieldInput = createComponentPart(OTPField.Input, \"tr-otp-field-digit\", { tracksFocusModality: true });\n//#endregion\nexport { TROTPFieldInput };\n\n//# sourceMappingURL=otp-field-input.js.map","\"use client\";\nimport { mergeComponentClassName } from \"../../internal/component-class-name.js\";\nimport { jsx } from \"react/jsx-runtime\";\nimport { OTPField } from \"@base-ui/react/otp-field\";\n//#region src/components/otp-field/otp-field-root.tsx\nfunction TROTPFieldRoot({ appearance = \"solid\", className, uiSize = \"md\", ...props }) {\n\treturn /* @__PURE__ */ jsx(OTPField.Root, {\n\t\t...props,\n\t\tclassName: mergeComponentClassName(\"tr-otp-field\", className),\n\t\t\"data-appearance\": appearance,\n\t\t\"data-ui-size\": uiSize\n\t});\n}\n//#endregion\nexport { TROTPFieldRoot };\n\n//# sourceMappingURL=otp-field-root.js.map","import { mergeComponentClassName } from \"../../internal/component-class-name.js\";\nimport { TRSeparator } from \"../separator/separator.js\";\nimport { jsx } from \"react/jsx-runtime\";\n//#region src/components/otp-field/otp-field-separator.tsx\nfunction TROTPFieldSeparator({ className, orientation = \"vertical\", ...props }) {\n\treturn /* @__PURE__ */ jsx(TRSeparator, {\n\t\t...props,\n\t\tclassName: mergeComponentClassName(\"tr-otp-field-separator\", className),\n\t\torientation\n\t});\n}\n//#endregion\nexport { TROTPFieldSeparator };\n\n//# sourceMappingURL=otp-field-separator.js.map","import { TROTPFieldInput } from \"./otp-field-input.js\";\nimport { TROTPFieldRoot } from \"./otp-field-root.js\";\nimport { TROTPFieldSeparator } from \"./otp-field-separator.js\";\n//#region src/components/otp-field/index.tsx\nconst TROTPField = {\n\tRoot: TROTPFieldRoot,\n\tInput: TROTPFieldInput,\n\tSeparator: TROTPFieldSeparator\n};\n//#endregion\nexport { TROTPField, TROTPFieldInput, TROTPFieldRoot, TROTPFieldSeparator };\n\n//# sourceMappingURL=index.js.map","import { TRField } from '@tinyrack/ui/components/field';\nimport { TROTPField } from '@tinyrack/ui/components/otp-field';\nimport {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useImperativeHandle,\n useRef,\n useState,\n} from 'react';\nimport type { FieldError } from 'react-hook-form';\nimport { useTranslation } from 'react-i18next';\n\nexport type PinInputRef = {\n focus: () => void;\n clear: () => void;\n};\n\ntype PinInputProps = {\n length?: number;\n error?: FieldError;\n disabled?: boolean;\n onComplete?: (value: string) => void;\n onChange?: (value: string) => void;\n value?: string;\n autoFocus?: boolean;\n className?: string;\n};\n\nexport const PinInput = forwardRef<PinInputRef, PinInputProps>(\n function PinInput(\n {\n length = 6,\n error,\n disabled = false,\n onComplete,\n onChange,\n value: controlledValue,\n autoFocus = false,\n className = '',\n },\n ref,\n ) {\n const { t } = useTranslation();\n const otpId = useId();\n const containerRef = useRef<HTMLDivElement>(null);\n const [internalValue, setInternalValue] = useState(controlledValue ?? '');\n\n useEffect(() => {\n if (controlledValue !== undefined) {\n setInternalValue(controlledValue);\n }\n }, [controlledValue]);\n\n useImperativeHandle(\n ref,\n () => ({\n focus: () => {\n const firstInput = containerRef.current?.querySelector('input');\n firstInput?.focus();\n },\n clear: () => {\n setInternalValue('');\n const firstInput = containerRef.current?.querySelector('input');\n firstInput?.focus();\n },\n }),\n [],\n );\n\n const handleValueChange = useCallback(\n (newValue: string) => {\n setInternalValue(newValue);\n onChange?.(newValue);\n },\n [onChange],\n );\n\n const handleValueComplete = useCallback(\n (completedValue: string) => {\n onComplete?.(completedValue);\n },\n [onComplete],\n );\n\n return (\n <TRField.Root className={className} ref={containerRef}>\n {/*\n A real label, not `aria-label`: Base UI deliberately ignores\n `aria-label` on the first OTP input and warns to use a label instead,\n because that input is also the one password managers autofill.\n Visually hidden — the screen's own heading already says what the code\n is, so showing it twice would be noise.\n */}\n <TRField.Label className=\"sr-only\" htmlFor={otpId}>\n {t('common.otp.label')}\n </TRField.Label>\n <TROTPField.Root\n disabled={disabled}\n /*\n * Base UI gives the first slot the root's own id and derives the\n * rest from it, so naming the root is what lets the label point at\n * a real input rather than at the wrapping group.\n */\n id={otpId}\n length={length}\n onValueChange={handleValueChange}\n onValueComplete={handleValueComplete}\n uiSize=\"md\"\n validationType=\"numeric\"\n value={internalValue}\n >\n {/*\n Each box is a separate input, so each needs to say which position\n it is. Two Base UI behaviours shape this: the first box ignores\n `aria-label` outright (it is the one password managers autofill, so\n it takes the field's own label), and on the rest an `aria-label`\n *replaces* the inherited field name rather than adding to it. So\n the field name is folded into the per-box string, and box one is\n left to the label above.\n */}\n {Array.from({ length }, (_, index) => (\n <TROTPField.Input\n aria-label={\n index === 0\n ? undefined\n : t('common.otp.digit', {\n label: t('common.otp.label'),\n position: index + 1,\n total: length,\n })\n }\n autoFocus={autoFocus && index === 0}\n key={index}\n />\n ))}\n </TROTPField.Root>\n {error && (\n <p\n className=\"mt-tinyrack-sm text-center text-tinyrack-danger-foreground text-tinyrack-sm\"\n data-testid=\"pin-input-error\"\n >\n {error.message}\n </p>\n )}\n </TRField.Root>\n );\n },\n);\n\nexport default PinInput;\n"],"x_google_ignoreList":[0,1,2,3,4,5,6,7,8],"mappings":"wgBAIa,EAAmC,EAAM,cAAc,IAAA,EAAS,EAE7E,SAAgB,IAAyB,CACvC,IAAM,EAAA,EAAgB,WAAW,CAAmB,EACpD,GAAI,IAAY,IAAA,GACd,MAAU,MAAiJA,EAAoB,EAAE,CAAC,EAEpL,OAAO,CACT,CACA,SAAgB,EAAsB,EAAO,EAAO,EAAO,CACzD,MAAO,CACL,GAAG,EACH,QACA,QACA,OAAQ,IAAU,EACpB,CACF,CCnBA,IAAa,EAA6B,CACxC,UAAa,KACb,WAAc,KACd,GAAG,CACL,EACa,EAA8B,CACzC,UAAa,KACb,UAAa,KACb,GAAG,CACL,ECVM,EAAwB,CAC5B,QAAS,CACP,YAAa,SACb,eAAgB,GAAU,OAAO,EAAO,GACxC,OAAQ,SACR,UAAW,SACb,EACA,MAAO,CACL,YAAa,cACb,eAAgB,GAAU,YAAY,EAAO,GAC7C,OAAQ,aACR,UAAW,MACb,EACA,aAAc,CACZ,YAAa,iBACb,eAAgB,GAAU,eAAe,EAAO,GAChD,OAAQ,gBACR,UAAW,MACb,CACF,EACA,SAAgB,EAAuB,EAAgB,CAIrD,OAHI,IAAmB,OACd,KAEF,EAAsB,EAC/B,CACA,SAAgB,EAAmB,EAAO,CACxC,OAAQ,GAAS,GAAA,CAAI,QAAQ,MAAO,EAAE,CACxC,CACA,SAAS,GAAmB,EAAO,EAAY,CAC7C,OAAO,EAAa,EAAM,QAAQ,EAAW,OAAQ,EAAE,EAAI,CAC7D,CAMA,SAAgB,EAA6B,EAAO,EAAQ,EAAgB,EAAgB,CAC1F,IAAM,EAAgB,EAAmB,CAA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AIXR_.js";import{I as t}from"./index-gliHKncz.js";var n=e();function r(e){return(0,n.jsx)(t,{...e,onUnauthorized:()=>{window.location.href=`/login`}})}export{r as errorComponent};
2
- //# sourceMappingURL=profile-D43Yq-6S.js.map
1
+ import{q as e}from"./createLucideIcon-BPpAIXR_.js";import{I as t}from"./index-CZ0rWM7l.js";var n=e();function r(e){return(0,n.jsx)(t,{...e,onUnauthorized:()=>{window.location.href=`/login`}})}export{r as errorComponent};
2
+ //# sourceMappingURL=profile-DSTMtoUf.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"profile-D43Yq-6S.js","names":["RouteErrorFallback","PasswordModalType","TotpModalType","PasskeyModalType","ProfileError","props","ErrorComponentProps","window","location","href","errorComponent"],"sources":["../../../frontend/src/routes/profile/index.tsx?tsr-split=errorComponent"],"sourcesContent":["import {\n useMutation,\n useQueryClient,\n useSuspenseQuery,\n} from '@tanstack/react-query';\nimport {\n createFileRoute,\n type ErrorComponentProps,\n redirect,\n useRouter,\n} from '@tanstack/react-router';\nimport { TRButton } from '@tinyrack/ui/components/button';\nimport { TRCard } from '@tinyrack/ui/components/card';\nimport { TRText } from '@tinyrack/ui/components/text';\nimport { CircleAlertIcon, LogOutIcon } from 'lucide-react';\nimport { useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { z } from 'zod';\nimport { AuthPageHeader } from '#frontend/components/auth/auth-page-header.tsx';\nimport { DangerZoneSection } from '#frontend/components/profile/danger-zone-section.tsx';\nimport { LinkedAccountsSection } from '#frontend/components/profile/linked-accounts-section.tsx';\nimport { PasskeySection } from '#frontend/components/profile/passkey-section.tsx';\nimport { PasswordSection } from '#frontend/components/profile/password-section.tsx';\nimport { TotpSection } from '#frontend/components/profile/totp-section.tsx';\nimport { UnlinkOAuthModal } from '#frontend/components/profile/unlink-oauth-modal.tsx';\nimport { UserInfoSection } from '#frontend/components/profile/user-info-section.tsx';\nimport { Alert } from '#frontend/components/ui/alert.tsx';\nimport { InitialAvatar } from '#frontend/components/ui/initial-avatar.tsx';\nimport { RouteErrorFallback } from '#frontend/components/ui/route-error-fallback.tsx';\nimport { AppLayout } from '#frontend/features/layout/app-layout.tsx';\nimport { ChangePasswordModal } from '#frontend/features/profile/change-password-modal.tsx';\nimport { DeleteAccountModal } from '#frontend/features/profile/delete-account-modal.tsx';\nimport { DisableTotpModal } from '#frontend/features/profile/disable-totp-modal.tsx';\nimport { ManagePasskeysModal } from '#frontend/features/profile/manage-passkeys-modal.tsx';\nimport { RegenerateTotpRecoveryCodesModal } from '#frontend/features/profile/regenerate-totp-recovery-codes-modal.tsx';\nimport { RemovePasswordModal } from '#frontend/features/profile/remove-password-modal.tsx';\nimport { SetPasswordModal } from '#frontend/features/profile/set-password-modal.tsx';\nimport { SetupPasskeyModal } from '#frontend/features/profile/setup-passkey-modal.tsx';\nimport { SetupTotpModal } from '#frontend/features/profile/setup-totp-modal.tsx';\nimport { tick } from '#frontend/libs/promise.ts';\nimport { appConfigQueryOptions } from '#frontend/queries/config.ts';\nimport { logoutMutationOptions } from '#frontend/queries/logout.ts';\nimport {\n getOAuthAuthorizeUrl,\n oauthAccountsQueryOptions,\n unlinkOAuthMutationOptions,\n} from '#frontend/queries/oauth.ts';\nimport { getSessionQueryOptions } from '#frontend/queries/session.ts';\n\ntype PasswordModalType = 'set' | 'change' | 'remove' | null;\ntype TotpModalType = 'setup' | 'disable' | 'regenerate' | null;\ntype PasskeyModalType = 'setup' | 'manage' | null;\n\nconst SearchSchema = z.object({\n oauth_error: z.string().optional(),\n oauth_error_description: z.string().optional(),\n});\n\nconst OAUTH_ERROR_I18N_MAP: Record<string, string> = {\n access_denied: 'oauth.error.accessDenied',\n temporarily_unavailable: 'oauth.error.temporarilyUnavailable',\n server_error: 'oauth.error.serverError',\n};\n\nfunction ProfileError(props: ErrorComponentProps) {\n return (\n <RouteErrorFallback\n {...props}\n onUnauthorized={() => {\n window.location.href = '/login';\n }}\n />\n );\n}\n\nexport const Route = createFileRoute('/profile/')({\n component: Profile,\n errorComponent: ProfileError,\n validateSearch: SearchSchema,\n beforeLoad: async ({ context }) => {\n if (!context.user) {\n throw redirect({\n to: '/login',\n });\n }\n },\n loader: async ({ context }) => {\n await Promise.all([\n context.queryClient.ensureQueryData(getSessionQueryOptions),\n context.queryClient.ensureQueryData(oauthAccountsQueryOptions),\n context.queryClient.ensureQueryData(appConfigQueryOptions),\n ]);\n },\n});\n\nfunction Profile() {\n const { t } = useTranslation();\n const router = useRouter();\n const queryClient = useQueryClient();\n const search = Route.useSearch();\n\n const oauthError = search.oauth_error;\n const oauthErrorMessage = oauthError\n ? t(OAUTH_ERROR_I18N_MAP[oauthError] ?? 'oauth.error.failed')\n : undefined;\n const [unlinkingProvider, setUnlinkingProvider] = useState<string | null>(\n null,\n );\n const [unlinkModal, setUnlinkModal] = useState<{\n id: string;\n name: string;\n } | null>(null);\n const [passwordModal, setPasswordModal] = useState<PasswordModalType>(null);\n const [totpModal, setTotpModal] = useState<TotpModalType>(null);\n const [passkeyModal, setPasskeyModal] = useState<PasskeyModalType>(null);\n const [showDeleteModal, setShowDeleteModal] = useState(false);\n\n const { data: session } = useSuspenseQuery(getSessionQueryOptions);\n const { data: oauthAccountsData } = useSuspenseQuery(\n oauthAccountsQueryOptions,\n );\n const { data: appConfig } = useSuspenseQuery(appConfigQueryOptions);\n\n const logoutMutation = useMutation({\n ...logoutMutationOptions,\n onSuccess: async () => {\n queryClient.setQueryData(getSessionQueryOptions.queryKey, {\n user: null,\n });\n await tick();\n router.navigate({\n to: '/login',\n });\n },\n onSettled: () => {\n queryClient.invalidateQueries({\n queryKey: getSessionQueryOptions.queryKey,\n });\n },\n });\n\n const unlinkMutation = useMutation({\n ...unlinkOAuthMutationOptions,\n onSuccess: () => {\n queryClient.invalidateQueries({\n queryKey: oauthAccountsQueryOptions.queryKey,\n });\n },\n onSettled: () => {\n setUnlinkingProvider(null);\n },\n });\n\n const handleUnlinkConfirm = async () => {\n if (!unlinkModal) return;\n setUnlinkingProvider(unlinkModal.id);\n await unlinkMutation.mutateAsync(unlinkModal.id);\n };\n\n if (!session.user) {\n return null;\n }\n\n const user = session.user;\n const availableProviders = oauthAccountsData.available_providers;\n const hasLinkedOAuth = availableProviders.some((p) => p.linked);\n const isConfigManaged = user.managed_by === 'config';\n\n const passwordAuthMethod = appConfig.auth.password;\n const passkeyAuthMethod = appConfig.auth.passkey;\n const totpEnabled = passwordAuthMethod.totp.enabled;\n const passkeyEnabled = passkeyAuthMethod.enabled;\n\n const accountDeletionEnabled = appConfig.account_deletion.enabled;\n const retentionPeriod = appConfig.account_deletion.retention;\n\n const retentionDays = (() => {\n const match = retentionPeriod.match(/^(\\d+)([dmy])$/);\n if (!match) return 30;\n const value = parseInt(match[1], 10);\n const unit = match[2];\n switch (unit) {\n case 'd':\n return value;\n case 'm':\n return value * 30;\n case 'y':\n return value * 365;\n default:\n return 30;\n }\n })();\n\n const showPasswordSection = true;\n const showTotpSection = !isConfigManaged && totpEnabled;\n const showPasskeySection = !isConfigManaged && passkeyEnabled;\n const showLinkedAccounts = availableProviders.length > 0;\n const hasSecurityOptions =\n showPasswordSection || showTotpSection || showPasskeySection;\n\n return (\n <AppLayout\n headerActions={\n <TRButton\n appearance=\"ghost\"\n /*\n The visible label collapses below `sm:`, which would leave the\n control unnamed on a phone. `profile.logout` is the same string\n the label renders, so this does not shadow it.\n */\n aria-label={t('profile.logout')}\n data-testid=\"profile-logout\"\n disabled={logoutMutation.isPending}\n loading={logoutMutation.isPending}\n onClick={() => logoutMutation.mutate()}\n type=\"button\"\n uiSize=\"sm\"\n >\n {logoutMutation.isPending ? undefined : (\n <>\n <LogOutIcon aria-hidden className=\"size-tinyrack-lg\" />\n <span className=\"hidden sm:inline\">{t('profile.logout')}</span>\n </>\n )}\n </TRButton>\n }\n >\n <div className=\"flex items-center gap-tinyrack-lg\">\n <InitialAvatar email={user.email} size=\"lg\" />\n <div className=\"flex min-w-0 flex-col gap-tinyrack-3xs\">\n <AuthPageHeader title={t('profile.title')} />\n {/*\n Rendered here rather than as the header's `subtitle`: this node\n carries a testid and needs to truncate, neither of which the\n shared header does, and growing its API for one non-auth caller\n would be the wrong trade.\n */}\n <TRText\n as=\"p\"\n color=\"muted\"\n data-testid=\"profile-user-email\"\n truncate\n variant=\"bodySm\"\n >\n {user.email}\n </TRText>\n </div>\n </div>\n\n {oauthErrorMessage && (\n <Alert icon={CircleAlertIcon} type=\"error\">\n {oauthErrorMessage}\n </Alert>\n )}\n\n {user && <UserInfoSection user={user} />}\n\n {hasSecurityOptions && (\n <TRCard.Root variant=\"outlined\">\n <TRCard.Header className=\"border-tinyrack-border border-b-tinyrack-default px-tinyrack-lg py-tinyrack-md\">\n <TRCard.Title>{t('profile.security.title')}</TRCard.Title>\n <TRCard.Description>\n {t('profile.security.description')}\n </TRCard.Description>\n </TRCard.Header>\n {showTotpSection && user.totp_recovery_codes_missing && (\n <div\n className=\"border-tinyrack-border border-b-tinyrack-default px-tinyrack-lg py-tinyrack-md\"\n data-testid=\"profile-totp-recovery-warning\"\n >\n <Alert icon={CircleAlertIcon} type=\"warning\">\n {t('profile.totp.recoveryCodesMissing')}\n </Alert>\n </div>\n )}\n <TRCard.Content className=\"divide-y divide-tinyrack-border p-0\">\n {showPasswordSection && (\n <PasswordSection\n hasLinkedOAuth={hasLinkedOAuth}\n hasPassword={user.has_password}\n hasSecondFactorOnly={\n user.has_password &&\n !hasLinkedOAuth &&\n (user.totp_registered || user.passkey_count > 0)\n }\n isConfigManaged={isConfigManaged}\n onOpenModal={setPasswordModal}\n />\n )}\n {showTotpSection && (\n <TotpSection\n onOpenModal={setTotpModal}\n recoveryCodesMissing={user.totp_recovery_codes_missing}\n totpEnabled={user.totp_registered}\n />\n )}\n {showPasskeySection && (\n <PasskeySection\n onOpenModal={setPasskeyModal}\n passkeyCount={user.passkey_count}\n />\n )}\n </TRCard.Content>\n </TRCard.Root>\n )}\n\n {showLinkedAccounts && (\n <LinkedAccountsSection\n getAuthorizeUrl={getOAuthAuthorizeUrl}\n onUnlinkRequest={(provider) =>\n setUnlinkModal({\n id: provider.id,\n name: provider.display_name,\n })\n }\n providers={availableProviders}\n unlinkingProvider={unlinkingProvider}\n />\n )}\n\n <DangerZoneSection\n isConfigManaged={isConfigManaged}\n isDeletionEnabled={accountDeletionEnabled}\n onDeleteClick={() => setShowDeleteModal(true)}\n />\n\n <SetPasswordModal\n isOpen={passwordModal === 'set'}\n onClose={() => setPasswordModal(null)}\n />\n <ChangePasswordModal\n isOpen={passwordModal === 'change'}\n onClose={() => setPasswordModal(null)}\n />\n <RemovePasswordModal\n isOpen={passwordModal === 'remove'}\n onClose={() => setPasswordModal(null)}\n />\n\n <SetupTotpModal\n isOpen={totpModal === 'setup'}\n onClose={() => setTotpModal(null)}\n />\n <DisableTotpModal\n isOpen={totpModal === 'disable'}\n onClose={() => setTotpModal(null)}\n />\n <RegenerateTotpRecoveryCodesModal\n isOpen={totpModal === 'regenerate'}\n onClose={() => setTotpModal(null)}\n />\n\n <SetupPasskeyModal\n isOpen={passkeyModal === 'setup'}\n onClose={() => setPasskeyModal(null)}\n />\n <ManagePasskeysModal\n isOpen={passkeyModal === 'manage'}\n onAddNew={() => setPasskeyModal('setup')}\n onClose={() => setPasskeyModal(null)}\n />\n\n <UnlinkOAuthModal\n isOpen={unlinkModal !== null}\n isPending={unlinkMutation.isPending}\n onClose={() => setUnlinkModal(null)}\n onConfirm={handleUnlinkConfirm}\n providerName={unlinkModal?.name ?? ''}\n />\n\n <DeleteAccountModal\n isOpen={showDeleteModal}\n onClose={() => setShowDeleteModal(false)}\n retentionDays={retentionDays}\n />\n </AppLayout>\n );\n}\n"],"mappings":"qGAgEA,SAASI,EAAaC,EAA4B,CAChD,OACE,EAAA,EAAA,IAAA,CAAC,EAAD,CACE,GAAIA,EACJ,mBAAsB,CACpBE,OAAOC,SAASC,KAAO,QACzB,CAAE,CAAA,CAGR"}
1
+ {"version":3,"file":"profile-DSTMtoUf.js","names":["RouteErrorFallback","PasswordModalType","TotpModalType","PasskeyModalType","ProfileError","props","ErrorComponentProps","window","location","href","errorComponent"],"sources":["../../../frontend/src/routes/profile/index.tsx?tsr-split=errorComponent"],"sourcesContent":["import {\n useMutation,\n useQueryClient,\n useSuspenseQuery,\n} from '@tanstack/react-query';\nimport {\n createFileRoute,\n type ErrorComponentProps,\n redirect,\n useRouter,\n} from '@tanstack/react-router';\nimport { TRButton } from '@tinyrack/ui/components/button';\nimport { TRCard } from '@tinyrack/ui/components/card';\nimport { TRText } from '@tinyrack/ui/components/text';\nimport { CircleAlertIcon, LogOutIcon } from 'lucide-react';\nimport { useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { z } from 'zod';\nimport { AuthPageHeader } from '#frontend/components/auth/auth-page-header.tsx';\nimport { DangerZoneSection } from '#frontend/components/profile/danger-zone-section.tsx';\nimport { LinkedAccountsSection } from '#frontend/components/profile/linked-accounts-section.tsx';\nimport { PasskeySection } from '#frontend/components/profile/passkey-section.tsx';\nimport { PasswordSection } from '#frontend/components/profile/password-section.tsx';\nimport { TotpSection } from '#frontend/components/profile/totp-section.tsx';\nimport { UnlinkOAuthModal } from '#frontend/components/profile/unlink-oauth-modal.tsx';\nimport { UserInfoSection } from '#frontend/components/profile/user-info-section.tsx';\nimport { Alert } from '#frontend/components/ui/alert.tsx';\nimport { InitialAvatar } from '#frontend/components/ui/initial-avatar.tsx';\nimport { RouteErrorFallback } from '#frontend/components/ui/route-error-fallback.tsx';\nimport { AppLayout } from '#frontend/features/layout/app-layout.tsx';\nimport { ChangePasswordModal } from '#frontend/features/profile/change-password-modal.tsx';\nimport { DeleteAccountModal } from '#frontend/features/profile/delete-account-modal.tsx';\nimport { DisableTotpModal } from '#frontend/features/profile/disable-totp-modal.tsx';\nimport { ManagePasskeysModal } from '#frontend/features/profile/manage-passkeys-modal.tsx';\nimport { RegenerateTotpRecoveryCodesModal } from '#frontend/features/profile/regenerate-totp-recovery-codes-modal.tsx';\nimport { RemovePasswordModal } from '#frontend/features/profile/remove-password-modal.tsx';\nimport { SetPasswordModal } from '#frontend/features/profile/set-password-modal.tsx';\nimport { SetupPasskeyModal } from '#frontend/features/profile/setup-passkey-modal.tsx';\nimport { SetupTotpModal } from '#frontend/features/profile/setup-totp-modal.tsx';\nimport { tick } from '#frontend/libs/promise.ts';\nimport { appConfigQueryOptions } from '#frontend/queries/config.ts';\nimport { logoutMutationOptions } from '#frontend/queries/logout.ts';\nimport {\n getOAuthAuthorizeUrl,\n oauthAccountsQueryOptions,\n unlinkOAuthMutationOptions,\n} from '#frontend/queries/oauth.ts';\nimport { getSessionQueryOptions } from '#frontend/queries/session.ts';\n\ntype PasswordModalType = 'set' | 'change' | 'remove' | null;\ntype TotpModalType = 'setup' | 'disable' | 'regenerate' | null;\ntype PasskeyModalType = 'setup' | 'manage' | null;\n\nconst SearchSchema = z.object({\n oauth_error: z.string().optional(),\n oauth_error_description: z.string().optional(),\n});\n\nconst OAUTH_ERROR_I18N_MAP: Record<string, string> = {\n access_denied: 'oauth.error.accessDenied',\n temporarily_unavailable: 'oauth.error.temporarilyUnavailable',\n server_error: 'oauth.error.serverError',\n};\n\nfunction ProfileError(props: ErrorComponentProps) {\n return (\n <RouteErrorFallback\n {...props}\n onUnauthorized={() => {\n window.location.href = '/login';\n }}\n />\n );\n}\n\nexport const Route = createFileRoute('/profile/')({\n component: Profile,\n errorComponent: ProfileError,\n validateSearch: SearchSchema,\n beforeLoad: async ({ context }) => {\n if (!context.user) {\n throw redirect({\n to: '/login',\n });\n }\n },\n loader: async ({ context }) => {\n await Promise.all([\n context.queryClient.ensureQueryData(getSessionQueryOptions),\n context.queryClient.ensureQueryData(oauthAccountsQueryOptions),\n context.queryClient.ensureQueryData(appConfigQueryOptions),\n ]);\n },\n});\n\nfunction Profile() {\n const { t } = useTranslation();\n const router = useRouter();\n const queryClient = useQueryClient();\n const search = Route.useSearch();\n\n const oauthError = search.oauth_error;\n const oauthErrorMessage = oauthError\n ? t(OAUTH_ERROR_I18N_MAP[oauthError] ?? 'oauth.error.failed')\n : undefined;\n const [unlinkingProvider, setUnlinkingProvider] = useState<string | null>(\n null,\n );\n const [unlinkModal, setUnlinkModal] = useState<{\n id: string;\n name: string;\n } | null>(null);\n const [passwordModal, setPasswordModal] = useState<PasswordModalType>(null);\n const [totpModal, setTotpModal] = useState<TotpModalType>(null);\n const [passkeyModal, setPasskeyModal] = useState<PasskeyModalType>(null);\n const [showDeleteModal, setShowDeleteModal] = useState(false);\n\n const { data: session } = useSuspenseQuery(getSessionQueryOptions);\n const { data: oauthAccountsData } = useSuspenseQuery(\n oauthAccountsQueryOptions,\n );\n const { data: appConfig } = useSuspenseQuery(appConfigQueryOptions);\n\n const logoutMutation = useMutation({\n ...logoutMutationOptions,\n onSuccess: async () => {\n queryClient.setQueryData(getSessionQueryOptions.queryKey, {\n user: null,\n });\n await tick();\n router.navigate({\n to: '/login',\n });\n },\n onSettled: () => {\n queryClient.invalidateQueries({\n queryKey: getSessionQueryOptions.queryKey,\n });\n },\n });\n\n const unlinkMutation = useMutation({\n ...unlinkOAuthMutationOptions,\n onSuccess: () => {\n queryClient.invalidateQueries({\n queryKey: oauthAccountsQueryOptions.queryKey,\n });\n },\n onSettled: () => {\n setUnlinkingProvider(null);\n },\n });\n\n const handleUnlinkConfirm = async () => {\n if (!unlinkModal) return;\n setUnlinkingProvider(unlinkModal.id);\n await unlinkMutation.mutateAsync(unlinkModal.id);\n };\n\n if (!session.user) {\n return null;\n }\n\n const user = session.user;\n const availableProviders = oauthAccountsData.available_providers;\n const hasLinkedOAuth = availableProviders.some((p) => p.linked);\n const isConfigManaged = user.managed_by === 'config';\n\n const passwordAuthMethod = appConfig.auth.password;\n const passkeyAuthMethod = appConfig.auth.passkey;\n const totpEnabled = passwordAuthMethod.totp.enabled;\n const passkeyEnabled = passkeyAuthMethod.enabled;\n\n const accountDeletionEnabled = appConfig.account_deletion.enabled;\n const retentionPeriod = appConfig.account_deletion.retention;\n\n const retentionDays = (() => {\n const match = retentionPeriod.match(/^(\\d+)([dmy])$/);\n if (!match) return 30;\n const value = parseInt(match[1], 10);\n const unit = match[2];\n switch (unit) {\n case 'd':\n return value;\n case 'm':\n return value * 30;\n case 'y':\n return value * 365;\n default:\n return 30;\n }\n })();\n\n const showPasswordSection = true;\n const showTotpSection = !isConfigManaged && totpEnabled;\n const showPasskeySection = !isConfigManaged && passkeyEnabled;\n const showLinkedAccounts = availableProviders.length > 0;\n const hasSecurityOptions =\n showPasswordSection || showTotpSection || showPasskeySection;\n\n return (\n <AppLayout\n headerActions={\n <TRButton\n appearance=\"ghost\"\n /*\n The visible label collapses below `sm:`, which would leave the\n control unnamed on a phone. `profile.logout` is the same string\n the label renders, so this does not shadow it.\n */\n aria-label={t('profile.logout')}\n data-testid=\"profile-logout\"\n disabled={logoutMutation.isPending}\n loading={logoutMutation.isPending}\n onClick={() => logoutMutation.mutate()}\n type=\"button\"\n uiSize=\"sm\"\n >\n {logoutMutation.isPending ? undefined : (\n <>\n <LogOutIcon aria-hidden className=\"size-tinyrack-lg\" />\n <span className=\"hidden sm:inline\">{t('profile.logout')}</span>\n </>\n )}\n </TRButton>\n }\n >\n <div className=\"flex items-center gap-tinyrack-lg\">\n <InitialAvatar email={user.email} size=\"lg\" />\n <div className=\"flex min-w-0 flex-col gap-tinyrack-3xs\">\n <AuthPageHeader title={t('profile.title')} />\n {/*\n Rendered here rather than as the header's `subtitle`: this node\n carries a testid and needs to truncate, neither of which the\n shared header does, and growing its API for one non-auth caller\n would be the wrong trade.\n */}\n <TRText\n as=\"p\"\n color=\"muted\"\n data-testid=\"profile-user-email\"\n truncate\n variant=\"bodySm\"\n >\n {user.email}\n </TRText>\n </div>\n </div>\n\n {oauthErrorMessage && (\n <Alert icon={CircleAlertIcon} type=\"error\">\n {oauthErrorMessage}\n </Alert>\n )}\n\n {user && <UserInfoSection user={user} />}\n\n {hasSecurityOptions && (\n <TRCard.Root variant=\"outlined\">\n <TRCard.Header className=\"border-tinyrack-border border-b-tinyrack-default px-tinyrack-lg py-tinyrack-md\">\n <TRCard.Title>{t('profile.security.title')}</TRCard.Title>\n <TRCard.Description>\n {t('profile.security.description')}\n </TRCard.Description>\n </TRCard.Header>\n {showTotpSection && user.totp_recovery_codes_missing && (\n <div\n className=\"border-tinyrack-border border-b-tinyrack-default px-tinyrack-lg py-tinyrack-md\"\n data-testid=\"profile-totp-recovery-warning\"\n >\n <Alert icon={CircleAlertIcon} type=\"warning\">\n {t('profile.totp.recoveryCodesMissing')}\n </Alert>\n </div>\n )}\n <TRCard.Content className=\"divide-y divide-tinyrack-border p-0\">\n {showPasswordSection && (\n <PasswordSection\n hasLinkedOAuth={hasLinkedOAuth}\n hasPassword={user.has_password}\n hasSecondFactorOnly={\n user.has_password &&\n !hasLinkedOAuth &&\n (user.totp_registered || user.passkey_count > 0)\n }\n isConfigManaged={isConfigManaged}\n onOpenModal={setPasswordModal}\n />\n )}\n {showTotpSection && (\n <TotpSection\n onOpenModal={setTotpModal}\n recoveryCodesMissing={user.totp_recovery_codes_missing}\n totpEnabled={user.totp_registered}\n />\n )}\n {showPasskeySection && (\n <PasskeySection\n onOpenModal={setPasskeyModal}\n passkeyCount={user.passkey_count}\n />\n )}\n </TRCard.Content>\n </TRCard.Root>\n )}\n\n {showLinkedAccounts && (\n <LinkedAccountsSection\n getAuthorizeUrl={getOAuthAuthorizeUrl}\n onUnlinkRequest={(provider) =>\n setUnlinkModal({\n id: provider.id,\n name: provider.display_name,\n })\n }\n providers={availableProviders}\n unlinkingProvider={unlinkingProvider}\n />\n )}\n\n <DangerZoneSection\n isConfigManaged={isConfigManaged}\n isDeletionEnabled={accountDeletionEnabled}\n onDeleteClick={() => setShowDeleteModal(true)}\n />\n\n <SetPasswordModal\n isOpen={passwordModal === 'set'}\n onClose={() => setPasswordModal(null)}\n />\n <ChangePasswordModal\n isOpen={passwordModal === 'change'}\n onClose={() => setPasswordModal(null)}\n />\n <RemovePasswordModal\n isOpen={passwordModal === 'remove'}\n onClose={() => setPasswordModal(null)}\n />\n\n <SetupTotpModal\n isOpen={totpModal === 'setup'}\n onClose={() => setTotpModal(null)}\n />\n <DisableTotpModal\n isOpen={totpModal === 'disable'}\n onClose={() => setTotpModal(null)}\n />\n <RegenerateTotpRecoveryCodesModal\n isOpen={totpModal === 'regenerate'}\n onClose={() => setTotpModal(null)}\n />\n\n <SetupPasskeyModal\n isOpen={passkeyModal === 'setup'}\n onClose={() => setPasskeyModal(null)}\n />\n <ManagePasskeysModal\n isOpen={passkeyModal === 'manage'}\n onAddNew={() => setPasskeyModal('setup')}\n onClose={() => setPasskeyModal(null)}\n />\n\n <UnlinkOAuthModal\n isOpen={unlinkModal !== null}\n isPending={unlinkMutation.isPending}\n onClose={() => setUnlinkModal(null)}\n onConfirm={handleUnlinkConfirm}\n providerName={unlinkModal?.name ?? ''}\n />\n\n <DeleteAccountModal\n isOpen={showDeleteModal}\n onClose={() => setShowDeleteModal(false)}\n retentionDays={retentionDays}\n />\n </AppLayout>\n );\n}\n"],"mappings":"qGAgEA,SAASI,EAAaC,EAA4B,CAChD,OACE,EAAA,EAAA,IAAA,CAAC,EAAD,CACE,GAAIA,EACJ,mBAAsB,CACpBE,OAAOC,SAASC,KAAO,QACzB,CAAE,CAAA,CAGR"}
@@ -0,0 +1,2 @@
1
+ import{J as e,U as t,Z as n,i as r,n as i,q as a,r as o,s,t as c}from"./createLucideIcon-BPpAIXR_.js";import{On as l,Sr as u,i as d,n as f,r as p,t as m}from"./config-DTQCUlfZ.js";import{t as h}from"./mutationOptions-DyYFUbyn.js";import{t as g}from"./useMutation-BWZ0G4Td.js";import{A as _,D as v,t as y,tt as b}from"./shell-header-bar-CgyNXbPS.js";import{t as x}from"./useQuery-pOdkMV4B.js";import{a as S,i as C,n as w,r as T,t as E}from"./use-totp-setup-CtTaklH-.js";import{t as D}from"./auth-field-DsLGh1U-.js";import{t as O}from"./fingerprint-pattern-DP62Vk8x.js";import{t as k}from"./key-round-CdvHb8vT.js";import{i as A}from"./provider-logos-u1YURWQr.js";import{n as ee,t as te}from"./logout-B5T52P8u.js";import{t as j}from"./shield-check-D_p8H0ni.js";import{t as M}from"./trash-2-DZdKBLvC.js";import{t as N}from"./triangle-alert-CqNn0kPs.js";import{t as P}from"./zod-C87S6Tec.js";import{B as F,C as ne,R as I,S as L,T as re,w as R,x as ie,z}from"./index-CZ0rWM7l.js";import{t as ae}from"./badge-CsOfUji0.js";import{t as oe}from"./auth-page-header-COvqWINf.js";import{t as B}from"./alert-leqyvHOp.js";import{t as se}from"./initial-avatar-ocwNWL38.js";import{t as V}from"./promise-OpBtq8tG.js";import{n as H,t as U}from"./modal-BV3gpI-p.js";import{a as W,i as G,n as K,r as q}from"./passkey-J1qnYp9A.js";import{r as J,t as Y}from"./standard-schema-e8gtSzGE.js";import{n as ce,r as le}from"./totp-BNZ904Zm.js";var ue=c(`cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),de=c(`link-2-off`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7`,key:`10o201`}],[`path`,{d:`M15 7h2a5 5 0 0 1 4 8`,key:`1d3206`}],[`line`,{x1:`8`,x2:`12`,y1:`12`,y2:`12`,key:`rvw6j4`}],[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}]]),fe=c(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),pe=c(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),me=c(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),X=n(e(),1),Z=a();function he({isConfigManaged:e,isDeletionEnabled:t,onDeleteClick:n}){let{t:a}=r();return t?(0,Z.jsxs)(F.Root,{className:`border-tinyrack-danger-border bg-tinyrack-danger-surface`,variant:`outlined`,children:[(0,Z.jsxs)(F.Header,{className:`border-tinyrack-danger-border border-b-tinyrack-default px-tinyrack-lg py-tinyrack-md`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-tinyrack-sm`,children:[(0,Z.jsx)(N,{"aria-hidden":!0,className:`size-tinyrack-lg text-tinyrack-danger-foreground`}),(0,Z.jsx)(F.Title,{className:`text-tinyrack-danger-foreground`,children:a(`profile.dangerZone.title`)})]}),(0,Z.jsx)(F.Description,{children:a(`profile.dangerZone.description`)})]}),(0,Z.jsx)(F.Content,{className:`px-tinyrack-lg py-tinyrack-md`,children:(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-tinyrack-lg`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-tinyrack-3xs`,children:[(0,Z.jsx)(i,{as:`p`,variant:`bodySm`,weight:`medium`,children:a(`profile.deleteAccount.title`)}),(0,Z.jsx)(i,{as:`p`,color:`muted`,variant:`caption`,children:a(e?`profile.deleteAccount.configManaged`:`profile.deleteAccount.description`)})]}),(0,Z.jsxs)(s,{appearance:`outline`,"data-testid":`profile-delete-account`,disabled:e,intent:`danger`,onClick:n,type:`button`,uiSize:`sm`,children:[(0,Z.jsx)(M,{"aria-hidden":!0,className:`size-tinyrack-lg`}),a(`profile.deleteAccount.button`)]})]})})]}):null}function Q({icon:e,active:t,title:n,status:r,note:a,actions:o}){let s;return s=(0,X.isValidElement)(e)?e:(0,Z.jsx)(e,{"aria-hidden":!0,className:`size-tinyrack-lg ${t?`text-tinyrack-success-foreground`:`text-tinyrack-text-muted`}`}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-tinyrack-lg p-tinyrack-lg`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-tinyrack-md`,children:[(0,Z.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-tinyrack-md ${t?`bg-tinyrack-success-surface`:`bg-tinyrack-surface-muted`}`,children:s}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-tinyrack-3xs`,children:[(0,Z.jsx)(i,{as:`div`,variant:`bodySm`,weight:`medium`,children:n}),(0,Z.jsx)(i,{as:`div`,color:`muted`,variant:`caption`,children:r}),a]})]}),o&&(0,Z.jsx)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-tinyrack-xs`,children:o})]})}function ge({providers:e,unlinkingProvider:t,getAuthorizeUrl:n,onUnlinkRequest:i}){let{t:a}=r();return e.length===0?null:(0,Z.jsxs)(F.Root,{variant:`outlined`,children:[(0,Z.jsxs)(F.Header,{className:`border-tinyrack-border border-b-tinyrack-default px-tinyrack-lg py-tinyrack-md`,children:[(0,Z.jsx)(F.Title,{children:a(`profile.linkedAccounts.title`)}),(0,Z.jsx)(F.Description,{children:a(`profile.linkedAccounts.description`)})]}),(0,Z.jsx)(F.Content,{className:`divide-y divide-tinyrack-border p-0`,children:e.map(e=>(0,Z.jsx)(Q,{actions:e.linked?(0,Z.jsx)(s,{appearance:`ghost`,intent:`danger`,loading:t===e.id,loadingLabel:a(`profile.linkedAccounts.unlinking`),onClick:()=>i(e),type:`button`,uiSize:`sm`,children:t===e.id?void 0:a(`profile.linkedAccounts.unlink`)}):(0,Z.jsx)(z,{appearance:`outline`,intent:`neutral`,render:(0,Z.jsx)(`a`,{href:n(e.id,`link`,`/profile`)}),uiSize:`sm`,children:a(`profile.linkedAccounts.link`)}),active:e.linked,icon:(0,Z.jsx)(A,{className:`size-tinyrack-lg`,iconUrl:e.icon_url,providerId:e.id}),status:e.linked?a(`profile.linkedAccounts.connected`):a(`profile.linkedAccounts.notConnected`),title:e.display_name},e.id))})]})}function _e({passkeyCount:e,onOpenModal:t}){let{t:n}=r(),i=e>0;return(0,Z.jsx)(Q,{actions:(0,Z.jsx)(s,{appearance:`ghost`,intent:`primary`,onClick:()=>t(i?`manage`:`setup`),type:`button`,uiSize:`sm`,children:n(i?`profile.passkey.manage`:`profile.passkey.add`)}),active:i,icon:O,status:i?n(`profile.passkey.status.enabled`,{count:e}):n(`profile.passkey.status.disabled`),title:n(`profile.passkey.title`)})}function ve({hasPassword:e,hasLinkedOAuth:t,isConfigManaged:n,hasSecondFactorOnly:a,onOpenModal:o}){let{t:c}=r();return(0,Z.jsx)(Q,{actions:n?void 0:e?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(s,{appearance:`ghost`,"data-testid":`profile-password-change`,intent:`primary`,onClick:()=>o(`change`),type:`button`,uiSize:`sm`,children:c(`profile.password.change`)}),t?(0,Z.jsx)(s,{appearance:`ghost`,"data-testid":`profile-password-remove`,intent:`danger`,onClick:()=>o(`remove`),type:`button`,uiSize:`sm`,children:c(`profile.password.remove`)}):null,!t&&a&&(0,Z.jsxs)(v.Root,{children:[(0,Z.jsx)(v.Trigger,{render:(0,Z.jsx)(s,{appearance:`ghost`,disabled:!0,type:`button`,uiSize:`sm`,children:c(`profile.password.remove`)})}),(0,Z.jsx)(v.Portal,{children:(0,Z.jsx)(v.Positioner,{children:(0,Z.jsx)(v.Popup,{className:`max-w-tinyrack-measure-lg rounded-tinyrack-md border border-tinyrack-border bg-tinyrack-surface p-tinyrack-md text-tinyrack-text text-tinyrack-xs shadow-tinyrack-overlay`,children:(0,Z.jsxs)(`div`,{className:`flex items-start gap-tinyrack-sm`,children:[(0,Z.jsx)(S,{"aria-hidden":!0,className:`size-tinyrack-lg shrink-0 text-tinyrack-warning-foreground`}),(0,Z.jsx)(`div`,{children:c(`profile.password.removeDisabledReason`)})]})})})})]})]}):(0,Z.jsx)(s,{appearance:`ghost`,"data-testid":`profile-password-set`,intent:`primary`,onClick:()=>o(`set`),type:`button`,uiSize:`sm`,children:c(`profile.password.set`)}),active:e,icon:k,note:n?(0,Z.jsxs)(i,{as:`div`,className:`flex items-center gap-tinyrack-xs`,color:`muted`,variant:`caption`,children:[(0,Z.jsx)(pe,{"aria-hidden":!0,className:`size-tinyrack-md shrink-0`}),(0,Z.jsx)(`span`,{children:c(`profile.password.configManaged`)})]}):void 0,status:c(e?`profile.password.status.set`:`profile.password.status.notSet`),title:c(`profile.password.title`)})}function ye({totpEnabled:e,recoveryCodesMissing:t,onOpenModal:n}){let{t:i}=r();return(0,Z.jsx)(Q,{actions:e?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(s,{appearance:`ghost`,"data-testid":`profile-totp-regenerate`,intent:`primary`,onClick:()=>n(`regenerate`),type:`button`,uiSize:`sm`,children:i(`profile.totp.regenerate`)}),(0,Z.jsx)(s,{appearance:`ghost`,"data-testid":`profile-totp-disable`,intent:`danger`,onClick:()=>n(`disable`),type:`button`,uiSize:`sm`,children:i(`profile.totp.disable`)})]}):(0,Z.jsx)(s,{appearance:`ghost`,"data-testid":`profile-totp-enable`,intent:`primary`,onClick:()=>n(`setup`),type:`button`,uiSize:`sm`,children:i(`profile.totp.enable`)}),active:e,icon:j,status:i(e?t?`profile.totp.status.recoveryCodesMissing`:`profile.totp.status.enabled`:`profile.totp.status.disabled`),title:i(`profile.totp.title`)})}var be={error:I,warning:N,info:S};function $({variant:e,children:t}){return(0,Z.jsx)(B,{"data-testid":`alert-banner-${e}`,icon:be[e],type:e,children:t})}function xe({isOpen:e,onClose:t,providerName:n,isPending:i,onConfirm:a}){let{t:o}=r(),[c,l]=(0,X.useState)(null),u=()=>{i||(l(null),t())};return(0,Z.jsx)(U,{description:o(`profile.linkedAccounts.unlinkModal.description`,{provider:n}),icon:de,isOpen:e,onClose:u,preventClose:i,title:o(`profile.linkedAccounts.unlinkModal.title`),variant:`destructive`,children:(0,Z.jsxs)(`div`,{className:`mt-tinyrack-lg flex flex-col gap-tinyrack-md`,children:[(0,Z.jsx)($,{variant:`warning`,children:o(`profile.linkedAccounts.unlinkModal.warning`,{provider:n})}),c&&(0,Z.jsx)($,{variant:`error`,children:c}),(0,Z.jsxs)(H,{children:[(0,Z.jsx)(s,{appearance:`outline`,"data-testid":`unlink-oauth-cancel`,disabled:i,intent:`neutral`,onClick:u,type:`button`,uiSize:`sm`,children:o(`profile.linkedAccounts.unlinkModal.cancel`)}),(0,Z.jsx)(s,{"data-testid":`unlink-oauth-unlink`,disabled:i,intent:`danger`,loading:i,loadingLabel:o(`profile.linkedAccounts.unlinking`),onClick:async()=>{l(null);try{await a(),u()}catch{l(o(`profile.linkedAccounts.unlinkError`))}},type:`button`,uiSize:`sm`,children:o(`profile.linkedAccounts.unlink`)})]})]})})}function Se({label:e,value:t}){return(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-tinyrack-lg px-tinyrack-lg py-tinyrack-md`,children:[(0,Z.jsx)(i,{className:`shrink-0`,color:`muted`,variant:`caption`,children:e}),(0,Z.jsx)(i,{truncate:!0,variant:`bodySm`,weight:`medium`,children:t})]})}function Ce({user:e}){let{t}=r();return(0,Z.jsxs)(F.Root,{variant:`outlined`,children:[(0,Z.jsxs)(F.Header,{className:`border-tinyrack-border border-b-tinyrack-default px-tinyrack-lg py-tinyrack-md`,children:[(0,Z.jsx)(F.Title,{children:t(`profile.account.title`)}),(0,Z.jsx)(F.Description,{children:t(`profile.account.description`)})]}),(0,Z.jsxs)(F.Content,{className:`divide-y divide-tinyrack-border p-0`,children:[(0,Z.jsx)(Se,{label:t(`profile.id.label`),value:e.sub}),(0,Z.jsx)(Se,{label:t(`profile.email.label`),value:e.email})]})]})}function we({children:e,headerActions:t}){return(0,Z.jsxs)(`div`,{className:`flex min-h-dvh flex-col bg-tinyrack-surface`,children:[(0,Z.jsx)(_,{}),(0,Z.jsx)(y,{actions:t,brand:!0}),(0,Z.jsx)(`main`,{className:`flex flex-1 justify-center px-tinyrack-lg py-tinyrack-xl`,children:(0,Z.jsx)(`div`,{className:`auth-enter flex w-full max-w-tinyrack-overlay-md flex-col gap-tinyrack-xl`,children:e})})]})}var Te=h({mutationFn:async e=>d(await p.api.user.password.$post({json:e}))}),Ee=h({mutationFn:async e=>d(await p.api.user.password.$put({json:e}))}),De=h({mutationFn:async e=>d(await p.api.user.password.$delete({json:e}))});function Oe({isOpen:e,onClose:t}){let{t:n}=r(),i=u(),{data:a}=b(m),c=a.auth.password.policy,l=J({resolver:Y((0,X.useMemo)(()=>P.object({currentPassword:P.string().min(1,n(`validation.password.required`)),newPassword:P.string().min(c.min_length,n(`validation.password.min`,{count:c.min_length})).max(c.max_length,n(`validation.password.max`,{count:c.max_length})),confirmPassword:P.string()}).refine(e=>e.newPassword===e.confirmPassword,{message:n(`validation.confirmPassword.mismatch`),path:[`confirmPassword`]}),[c.max_length,c.min_length,n])),defaultValues:{currentPassword:``,newPassword:``,confirmPassword:``}}),d=g({...Ee,onSuccess:()=>{i.invalidateQueries({queryKey:L.queryKey}),f()}}),f=()=>{l.reset(),t()},p=l.handleSubmit(async e=>{try{await d.mutateAsync({current_password:e.currentPassword,new_password:e.newPassword})}catch(e){e instanceof o&&e.code===`INVALID_CURRENT_PASSWORD`?l.setError(`currentPassword`,{message:n(`profile.password.changeModal.invalidCurrent`)}):l.setError(`root`,{message:n(`profile.password.changeModal.error`)})}});return(0,Z.jsx)(U,{description:n(`profile.password.changeModal.description`),icon:k,isOpen:e,onClose:f,title:n(`profile.password.changeModal.title`),children:(0,Z.jsxs)(`form`,{className:`mt-tinyrack-lg flex flex-col gap-tinyrack-md`,onSubmit:p,children:[(0,Z.jsx)(D,{error:l.formState.errors.currentPassword,errorTestId:`change-password-error-currentPassword`,id:`current-password`,label:n(`profile.password.changeModal.currentPassword`),placeholder:n(`profile.password.changeModal.currentPasswordPlaceholder`),...l.register(`currentPassword`),type:`password`}),(0,Z.jsx)(D,{error:l.formState.errors.newPassword,errorTestId:`change-password-error-newPassword`,id:`new-password-change`,label:n(`profile.password.changeModal.newPassword`),placeholder:n(`profile.password.changeModal.newPasswordPlaceholder`),...l.register(`newPassword`),type:`password`}),(0,Z.jsx)(D,{error:l.formState.errors.confirmPassword,errorTestId:`change-password-error-confirmPassword`,id:`confirm-password-change`,label:n(`profile.password.changeModal.confirmPassword`),placeholder:n(`profile.password.changeModal.confirmPasswordPlaceholder`),...l.register(`confirmPassword`),type:`password`}),l.formState.errors.root&&(0,Z.jsx)($,{variant:`error`,children:l.formState.errors.root.message}),(0,Z.jsxs)(H,{children:[(0,Z.jsx)(s,{appearance:`outline`,"data-testid":`change-password-cancel`,disabled:d.isPending,intent:`neutral`,onClick:f,type:`button`,uiSize:`sm`,children:n(`profile.password.changeModal.cancel`)}),(0,Z.jsx)(s,{"data-testid":`change-password-submit`,disabled:d.isPending,intent:`primary`,loading:d.isPending,loadingLabel:n(`profile.password.changeModal.submitting`),type:`submit`,uiSize:`sm`,children:d.isPending?void 0:n(`profile.password.changeModal.submit`)})]})]})})}var ke=h({mutationFn:async()=>d(await p.api.user.$delete())});function Ae({isOpen:e,onClose:t,retentionDays:n}){let{t:i}=r(),a=l(),o=u(),c=J({resolver:Y((0,X.useMemo)(()=>P.object({confirmation:P.string().refine(e=>e.toLowerCase()===i(`profile.deleteAccount.modal.confirmPlaceholder`).toLowerCase(),{message:i(`validation.confirmText.mismatch`)})}),[i])),defaultValues:{confirmation:``}}),d=g({...ke,onSuccess:async()=>{o.setQueryData(L.queryKey,{user:null}),await V(),a.navigate({to:`/login`})}}),f=()=>{d.isPending||(c.reset(),t())},p=c.handleSubmit(async()=>{try{await d.mutateAsync()}catch{c.setError(`root`,{message:i(`profile.deleteAccount.error`)})}});return(0,Z.jsx)(U,{icon:M,isOpen:e,onClose:f,preventClose:d.isPending,title:i(`profile.deleteAccount.modal.title`),variant:`destructive`,children:(0,Z.jsxs)(`form`,{className:`mt-tinyrack-lg flex flex-col gap-tinyrack-md`,onSubmit:p,children:[(0,Z.jsx)($,{variant:`error`,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-tinyrack-xs`,children:[(0,Z.jsx)(`p`,{children:i(`profile.deleteAccount.modal.description`,{days:n})}),(0,Z.jsx)(`p`,{className:`text-tinyrack-xs opacity-tinyrack-hover`,children:i(`profile.deleteAccount.modal.warning`)})]})}),(0,Z.jsx)(D,{autoComplete:`off`,error:c.formState.errors.confirmation,errorTestId:`delete-account-error`,id:`delete-confirmation`,label:i(`profile.deleteAccount.modal.confirmLabel`),placeholder:i(`profile.deleteAccount.modal.confirmPlaceholder`),...c.register(`confirmation`),type:`text`}),c.formState.errors.root&&(0,Z.jsx)($,{variant:`error`,children:c.formState.errors.root.message}),(0,Z.jsxs)(H,{children:[(0,Z.jsx)(s,{appearance:`outline`,"data-testid":`delete-account-cancel`,disabled:d.isPending,intent:`neutral`,onClick:f,type:`button`,uiSize:`sm`,children:i(`profile.deleteAccount.modal.cancel`)}),(0,Z.jsx)(s,{"data-testid":`delete-account-submit`,disabled:d.isPending,intent:`danger`,loading:d.isPending,loadingLabel:i(`profile.deleteAccount.modal.confirming`),type:`submit`,uiSize:`sm`,children:d.isPending?void 0:i(`profile.deleteAccount.modal.confirm`)})]})]})})}function je({isOpen:e,onClose:t}){let{t:n}=r(),i=u(),a=J({resolver:Y((0,X.useMemo)(()=>P.object({code:P.string().length(6,n(`validation.totp.length`)).regex(/^\d{6}$/,n(`validation.totp.digits`))}),[n])),defaultValues:{code:``}}),c=g({...ce,onSuccess:()=>{i.invalidateQueries({queryKey:L.queryKey}),l()}}),l=()=>{a.reset(),t()},d=a.handleSubmit(async e=>{try{await c.mutateAsync({code:e.code})}catch(e){if(e instanceof o&&e.code===`CANNOT_REMOVE_LAST_SECOND_FACTOR`){a.setError(`code`,{message:n(`profile.totp.disableModal.cannotRemoveLastSecondFactor`)});return}a.setError(`code`,{message:n(`profile.totp.disableModal.error`)})}});return(0,Z.jsx)(U,{description:n(`profile.totp.disableModal.description`),icon:j,isOpen:e,onClose:l,title:n(`profile.totp.disableModal.title`),variant:`destructive`,children:(0,Z.jsxs)(`form`,{className:`mt-tinyrack-lg flex flex-col gap-tinyrack-md`,onSubmit:d,children:[(0,Z.jsx)($,{variant:`warning`,children:n(`profile.totp.disableModal.warning`)}),(0,Z.jsx)(D,{autoComplete:`one-time-code`,error:a.formState.errors.code,errorTestId:`disable-totp-error`,id:`disable-totp-code`,inputMode:`numeric`,label:n(`profile.totp.disableModal.codeLabel`),maxLength:6,pattern:`[0-9]*`,placeholder:`000000`,...a.register(`code`),type:`text`}),(0,Z.jsxs)(H,{children:[(0,Z.jsx)(s,{appearance:`outline`,"data-testid":`disable-totp-cancel`,disabled:c.isPending,intent:`neutral`,onClick:l,type:`button`,uiSize:`sm`,children:n(`profile.totp.disableModal.cancel`)}),(0,Z.jsx)(s,{"data-testid":`disable-totp-submit`,disabled:c.isPending,intent:`danger`,loading:c.isPending,loadingLabel:n(`profile.totp.disableModal.disabling`),type:`submit`,uiSize:`sm`,children:c.isPending?void 0:n(`profile.totp.disableModal.disable`)})]})]})})}function Me({isOpen:e,onClose:n,onAddNew:i}){let{t:a}=r(),c=u(),[l,d]=(0,X.useState)(null),[p,m]=(0,X.useState)(null),[h,_]=(0,X.useState)(null),[v,y]=(0,X.useState)(null),{data:b,isLoading:S}=x({...q,enabled:e}),C=g({...K,onSuccess:()=>{c.invalidateQueries({queryKey:f.passkeys()}),c.invalidateQueries({queryKey:L.queryKey})},onSettled:()=>{m(null)}}),w=(0,X.useCallback)(()=>{d(null),m(null),_(null),y(null),n()},[n]),T=e=>{_(e.id),y(null)},E=()=>{_(null),y(null)},D=async e=>{m(e.id),_(null);try{await C.mutateAsync({id:e.id})}catch(e){if(e instanceof o&&e.code===`CANNOT_REMOVE_LAST_SECOND_FACTOR`){y(a(`profile.passkey.manageModal.cannotRemoveLastSecondFactor`));return}y(a(`profile.passkey.manageModal.deleteError`))}},k=e=>new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`}),A=b?.passkeys||[];return(0,Z.jsxs)(U,{icon:O,isOpen:e,onClose:w,size:`lg`,title:a(`profile.passkey.manageModal.title`),children:[(0,Z.jsxs)(`div`,{className:`mt-tinyrack-lg flex flex-col gap-tinyrack-sm`,children:[v&&(0,Z.jsx)($,{variant:`error`,children:v}),S&&(0,Z.jsx)(`div`,{className:`flex justify-center py-tinyrack-xl`,children:(0,Z.jsx)(t,{uiSize:`md`})}),!S&&A.length===0&&(0,Z.jsx)(`div`,{className:`py-tinyrack-xl text-center text-tinyrack-sm text-tinyrack-text-muted`,"data-testid":`passkeys-empty`,children:(0,Z.jsx)(`p`,{children:a(`profile.passkey.manageModal.noPasskeys`)})}),!S&&A.length>0&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-tinyrack-sm`,children:A.map(e=>(0,Z.jsx)(Ne,{formatDate:k,isConfirmingDelete:h===e.id,isDeleting:p===e.id,isEditing:l?.id===e.id,onCancelDelete:E,onCancelEdit:()=>d(null),onConfirmDelete:()=>D(e),onEdit:()=>d(e),onRequestDelete:()=>T(e),passkey:e},e.id))})]}),(0,Z.jsxs)(H,{children:[(0,Z.jsx)(s,{appearance:`outline`,"data-testid":`manage-passkeys-close`,intent:`neutral`,onClick:w,type:`button`,uiSize:`sm`,children:a(`profile.passkey.manageModal.close`)}),(0,Z.jsx)(s,{"data-testid":`manage-passkeys-add-new`,intent:`primary`,onClick:()=>{w(),i()},type:`button`,uiSize:`sm`,children:a(`profile.passkey.manageModal.addNew`)})]})]})}function Ne({passkey:e,isDeleting:t,isEditing:n,isConfirmingDelete:i,onEdit:a,onCancelEdit:o,onRequestDelete:c,onConfirmDelete:l,onCancelDelete:d,formatDate:p}){let{t:m}=r(),h=u(),_=J({resolver:Y((0,X.useMemo)(()=>P.object({name:P.string().min(1,m(`validation.passkey.name.required`)).max(100,m(`validation.passkey.name.max`))}),[m])),defaultValues:{name:e.name||``}}),v=g({...W,onSuccess:()=>{h.invalidateQueries({queryKey:f.passkeys()}),o()}}),y=_.handleSubmit(async t=>{try{await v.mutateAsync({id:e.id,name:t.name})}catch{_.setError(`name`,{message:m(`profile.passkey.manageModal.renameError`)})}});return n?(0,Z.jsxs)(`form`,{className:`flex flex-col gap-tinyrack-xs rounded-tinyrack-md bg-tinyrack-surface-muted p-tinyrack-sm`,onSubmit:y,children:[(0,Z.jsx)(D,{"data-testid":`passkey-rename-input`,error:_.formState.errors.name,errorTestId:`passkey-rename-error`,hideLabel:!0,label:m(`profile.passkey.manageModal.nameLabel`),placeholder:m(`profile.passkey.manageModal.namePlaceholder`),..._.register(`name`),type:`text`}),(0,Z.jsxs)(`div`,{className:`flex justify-end gap-tinyrack-xs`,children:[(0,Z.jsx)(s,{appearance:`ghost`,disabled:v.isPending,onClick:()=>{_.reset(),o()},type:`button`,uiSize:`sm`,children:m(`profile.passkey.manageModal.cancelEdit`)}),(0,Z.jsx)(s,{disabled:v.isPending,intent:`primary`,type:`submit`,uiSize:`sm`,children:v.isPending?m(`profile.passkey.manageModal.saving`):m(`profile.passkey.manageModal.save`)})]})]}):i?(0,Z.jsxs)(`div`,{className:`flex items-center justify-between rounded-tinyrack-md border border-tinyrack-danger-border bg-tinyrack-danger-surface p-tinyrack-sm text-tinyrack-danger-foreground`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-tinyrack-sm`,children:[(0,Z.jsx)(M,{className:`size-tinyrack-lg`}),(0,Z.jsx)(`span`,{className:`text-tinyrack-xs`,children:m(`profile.passkey.manageModal.deleteConfirmInline`)})]}),(0,Z.jsxs)(`div`,{className:`flex gap-tinyrack-xs`,children:[(0,Z.jsx)(s,{appearance:`ghost`,onClick:d,type:`button`,uiSize:`sm`,children:m(`profile.passkey.manageModal.cancelEdit`)}),(0,Z.jsx)(s,{intent:`danger`,onClick:l,type:`button`,uiSize:`sm`,children:m(`profile.passkey.manageModal.delete`)})]})]}):(0,Z.jsxs)(`div`,{className:`flex items-center justify-between rounded-tinyrack-md bg-tinyrack-surface-muted p-tinyrack-sm`,"data-testid":`passkey-item`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-tinyrack-sm`,children:[e.device_type===`multiDevice`?(0,Z.jsx)(ue,{className:`size-tinyrack-lg text-tinyrack-primary-foreground`}):(0,Z.jsx)(me,{className:`size-tinyrack-lg text-tinyrack-primary-foreground`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`font-tinyrack-medium text-tinyrack-xs`,children:e.name||m(`profile.passkey.manageModal.unnamedPasskey`)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-tinyrack-xs text-tinyrack-text-muted text-tinyrack-xs`,children:[(0,Z.jsx)(`span`,{children:m(`profile.passkey.manageModal.createdAt`,{date:p(e.created_at)})}),e.backed_up&&(0,Z.jsx)(ae,{uiSize:`md`,variant:`success`,children:m(`profile.passkey.manageModal.backedUp`)})]})]})]}),(0,Z.jsxs)(`div`,{className:`flex gap-tinyrack-xs`,children:[(0,Z.jsx)(s,{appearance:`ghost`,"aria-label":m(`profile.passkey.manageModal.rename`),onClick:a,type:`button`,uiSize:`sm`,children:(0,Z.jsx)(fe,{className:`size-tinyrack-lg`})}),(0,Z.jsx)(s,{appearance:`ghost`,"aria-label":m(`profile.passkey.manageModal.delete`),disabled:t,intent:`danger`,loading:t,onClick:c,type:`button`,uiSize:`sm`,children:t?void 0:(0,Z.jsx)(M,{className:`size-tinyrack-lg`})})]})]})}function Pe({isOpen:e,onClose:t}){let{t:n}=r(),i=l(),a=u(),{data:s}=b(m),[c,d]=(0,X.useState)(`verify`),[f,p]=(0,X.useState)(null),[h,_]=(0,X.useState)(null),v=g({...le,onSuccess:async e=>{p(e),d(`recovery`),await a.invalidateQueries({queryKey:L.queryKey})}}),y=(0,X.useCallback)(()=>{d(`verify`),p(null),_(null),v.reset()},[v]),x=(0,X.useCallback)(()=>{y(),t()},[t,y]),S=(0,X.useCallback)(async e=>{_(null);try{await v.mutateAsync({code:e})}catch(e){if(e instanceof o){if(e.code===`INVALID_TOTP_CODE`)throw e;if(e.code===`UNAUTHORIZED`){a.setQueryData(L.queryKey,{user:null}),await V(),i.navigate({to:`/login`});return}if(e.code===`TOTP_NOT_ENABLED`||e.code===`VALIDATION_ERROR`){await a.invalidateQueries({queryKey:L.queryKey}),x();return}}_(n(`profile.totp.regenerateModal.unexpectedError`))}},[x,v,a,i,n]);return s.auth.password.totp.enabled?(0,Z.jsx)(U,{description:n(c===`verify`?`profile.totp.regenerateModal.description`:`profile.totp.regenerateModal.recoveryDescription`),icon:j,isOpen:e,onClose:x,preventClose:c===`recovery`,size:`sm`,title:n(c===`verify`?`profile.totp.regenerateModal.title`:`profile.totp.regenerateModal.recoveryTitle`),children:c===`verify`?(0,Z.jsxs)(`div`,{className:`mt-tinyrack-lg`,children:[h&&(0,Z.jsx)(`div`,{className:`mb-tinyrack-md`,children:(0,Z.jsx)($,{variant:`error`,children:h})}),(0,Z.jsx)(T,{invalidMessage:n(`profile.totp.regenerateModal.error`),isPending:v.isPending,onSubmit:S,pendingText:n(`profile.totp.regenerateModal.submitting`),submitLabel:n(`profile.totp.regenerateModal.submit`)})]}):(0,Z.jsx)(`div`,{className:`mt-tinyrack-lg`,children:(0,Z.jsx)(C,{onConfirm:x,recoveryCodes:f?.recovery_codes??[]})})}):null}function Fe({isOpen:e,onClose:t}){let{t:n}=r(),i=u(),a=J({resolver:Y((0,X.useMemo)(()=>P.object({currentPassword:P.string().min(1,n(`validation.password.required`))}),[n])),defaultValues:{currentPassword:``}}),c=g({...De,onSuccess:()=>{i.invalidateQueries({queryKey:L.queryKey}),l()}}),l=()=>{a.reset(),t()},d=a.handleSubmit(async e=>{try{await c.mutateAsync({current_password:e.currentPassword})}catch(e){if(e instanceof o){if(e.code===`INVALID_CURRENT_PASSWORD`){a.setError(`currentPassword`,{message:n(`profile.password.removeModal.invalidCurrent`)});return}if(e.code===`CANNOT_REMOVE_LAST_AUTH_METHOD`){a.setError(`root`,{message:n(`profile.password.removeModal.noOAuth`)});return}if(e.code===`CANNOT_REMOVE_PASSWORD_WITH_SECOND_FACTOR_ONLY`){a.setError(`root`,{message:n(`profile.password.removeModal.noOAuthWith2FA`)});return}}a.setError(`root`,{message:n(`profile.password.removeModal.error`)})}});return(0,Z.jsx)(U,{description:n(`profile.password.removeModal.description`),icon:k,isOpen:e,onClose:l,title:n(`profile.password.removeModal.title`),variant:`destructive`,children:(0,Z.jsxs)(`form`,{className:`mt-tinyrack-lg flex flex-col gap-tinyrack-md`,onSubmit:d,children:[(0,Z.jsx)(D,{error:a.formState.errors.currentPassword,errorTestId:`remove-password-error`,id:`current-password-remove`,label:n(`profile.password.removeModal.currentPassword`),placeholder:n(`profile.password.removeModal.currentPasswordPlaceholder`),...a.register(`currentPassword`),type:`password`}),a.formState.errors.root&&(0,Z.jsx)($,{variant:`error`,children:a.formState.errors.root.message}),(0,Z.jsxs)(H,{children:[(0,Z.jsx)(s,{appearance:`outline`,"data-testid":`remove-password-cancel`,disabled:c.isPending,intent:`neutral`,onClick:l,type:`button`,uiSize:`sm`,children:n(`profile.password.removeModal.cancel`)}),(0,Z.jsx)(s,{"data-testid":`remove-password-submit`,disabled:c.isPending,intent:`danger`,loading:c.isPending,loadingLabel:n(`profile.password.removeModal.submitting`),type:`submit`,uiSize:`sm`,children:c.isPending?void 0:n(`profile.password.removeModal.submit`)})]})]})})}function Ie({isOpen:e,onClose:t}){let{t:n}=r(),i=u(),{data:a}=b(m),o=a.auth.password.policy,c=J({resolver:Y((0,X.useMemo)(()=>P.object({password:P.string().min(o.min_length,n(`validation.password.min`,{count:o.min_length})).max(o.max_length,n(`validation.password.max`,{count:o.max_length})),confirmPassword:P.string()}).refine(e=>e.password===e.confirmPassword,{message:n(`validation.confirmPassword.mismatch`),path:[`confirmPassword`]}),[o.max_length,o.min_length,n])),defaultValues:{password:``,confirmPassword:``}}),l=g({...Te,onSuccess:()=>{i.invalidateQueries({queryKey:L.queryKey}),d()}}),d=()=>{c.reset(),t()},f=c.handleSubmit(async e=>{try{await l.mutateAsync({password:e.password})}catch{c.setError(`root`,{message:n(`profile.password.setModal.error`)})}});return(0,Z.jsx)(U,{description:n(`profile.password.setModal.description`),icon:k,isOpen:e,onClose:d,title:n(`profile.password.setModal.title`),children:(0,Z.jsxs)(`form`,{className:`mt-tinyrack-lg flex flex-col gap-tinyrack-md`,onSubmit:f,children:[(0,Z.jsx)(D,{error:c.formState.errors.password,errorTestId:`set-password-error-password`,id:`new-password`,label:n(`profile.password.setModal.newPassword`),placeholder:n(`profile.password.setModal.newPasswordPlaceholder`),...c.register(`password`),type:`password`}),(0,Z.jsx)(D,{error:c.formState.errors.confirmPassword,errorTestId:`set-password-error-confirmPassword`,id:`confirm-password`,label:n(`profile.password.setModal.confirmPassword`),placeholder:n(`profile.password.setModal.confirmPasswordPlaceholder`),...c.register(`confirmPassword`),type:`password`}),c.formState.errors.root&&(0,Z.jsx)($,{variant:`error`,children:c.formState.errors.root.message}),(0,Z.jsxs)(H,{children:[(0,Z.jsx)(s,{appearance:`outline`,"data-testid":`set-password-cancel`,disabled:l.isPending,intent:`neutral`,onClick:d,type:`button`,uiSize:`sm`,children:n(`profile.password.setModal.cancel`)}),(0,Z.jsx)(s,{"data-testid":`set-password-submit`,disabled:l.isPending,intent:`primary`,loading:l.isPending,loadingLabel:n(`profile.password.setModal.submitting`),type:`submit`,uiSize:`sm`,children:l.isPending?void 0:n(`profile.password.setModal.submit`)})]})]})})}function Le({isOpen:e,onClose:n,isRequired:i=!1,canSwitchToTotp:a=!1,onSwitchToTotp:o}){let{t:c}=r(),l=u(),[d,p]=(0,X.useState)(`name`),[m,h]=(0,X.useState)(null),_=J({resolver:Y((0,X.useMemo)(()=>P.object({name:P.string().max(100,c(`validation.passkey.name.max`)).optional().transform(e=>e?.trim()||void 0)}),[c])),defaultValues:{name:``}}),v=g({...G,onSuccess:()=>{l.invalidateQueries({queryKey:f.passkeys()}),l.invalidateQueries({queryKey:L.queryKey}),y()},onError:e=>{p(`name`),e.name===`NotAllowedError`?h(c(`profile.passkey.setupModal.cancelled`)):h(c(`profile.passkey.setupModal.error`))}}),y=(0,X.useCallback)(()=>{_.reset(),p(`name`),h(null),n()},[_,n]),b=_.handleSubmit(async e=>{p(`register`),h(null);try{await v.mutateAsync({name:e.name})}catch{}}),x=v.isPending;return(0,Z.jsxs)(U,{description:i?c(`profile.passkey.setupModal.requiredDescription`):void 0,icon:O,isOpen:e,onClose:y,preventClose:i,size:`sm`,title:c(`profile.passkey.setupModal.title`),children:[d===`name`&&(0,Z.jsxs)(`form`,{className:`mt-tinyrack-lg flex flex-col gap-tinyrack-md`,onSubmit:b,children:[(0,Z.jsx)(`p`,{className:`text-tinyrack-text-muted text-tinyrack-xs`,children:c(`profile.passkey.setupModal.description`)}),m&&(0,Z.jsx)($,{variant:`error`,children:m}),(0,Z.jsx)(D,{error:_.formState.errors.name,errorTestId:`setup-passkey-error`,hint:c(`profile.passkey.setupModal.nameHint`),id:`passkey-name`,label:c(`profile.passkey.setupModal.nameLabel`),placeholder:c(`profile.passkey.setupModal.namePlaceholder`),..._.register(`name`),type:`text`}),(0,Z.jsxs)(H,{children:[(0,Z.jsx)(s,{appearance:`outline`,"data-testid":`setup-passkey-cancel`,intent:`neutral`,onClick:y,type:`button`,uiSize:`sm`,children:c(`profile.passkey.setupModal.cancel`)}),(0,Z.jsx)(s,{"data-testid":`setup-passkey-continue`,intent:`primary`,type:`submit`,uiSize:`sm`,children:c(`profile.passkey.setupModal.continue`)})]}),a&&o&&(0,Z.jsx)(`p`,{className:`mt-tinyrack-sm text-center text-tinyrack-xs`,children:(0,Z.jsx)(s,{appearance:`ghost`,intent:`primary`,onClick:o,type:`button`,uiSize:`sm`,children:c(`profile.passkey.setupModal.switchToTotp`)})})]}),d===`register`&&(0,Z.jsxs)(`div`,{className:`mt-tinyrack-lg`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-tinyrack-md py-tinyrack-xl`,"data-testid":`setup-passkey-loading`,children:[(0,Z.jsx)(t,{uiSize:`md`}),(0,Z.jsx)(`p`,{className:`text-center text-tinyrack-text-muted text-tinyrack-xs`,children:c(`profile.passkey.setupModal.waitingForDevice`)})]}),(0,Z.jsx)(H,{children:(0,Z.jsx)(s,{appearance:`outline`,"data-testid":`setup-passkey-cancel`,disabled:x,intent:`neutral`,onClick:y,type:`button`,uiSize:`sm`,children:c(`profile.passkey.setupModal.cancel`)})})]})]})}function Re({isOpen:e,onClose:n,isRequired:i=!1,canSwitchToPasskey:a=!1,onSwitchToPasskey:o}){let{t:c}=r(),{step:l,setupData:u,recoveryCodes:d,isSetupPending:f,isVerifyPending:p,isConfirmPending:m,startSetup:h,verify:g,goToVerify:_,goToQr:v,confirmRecoveryCodes:y,reset:b}=E({autoStart:!1,onConfirmSuccess:()=>{b(),n()}}),x=(0,X.useCallback)(()=>{b(),n()},[n,b]),S=(0,X.useCallback)(()=>{!u&&!f&&h()},[u,f,h]);e&&!u&&!f&&l!==`error`&&S();let D=(0,X.useCallback)(async e=>{await g(e)},[g]),O=c(l===`recovery`?`setupTotp.recoveryCodes.title`:`profile.totp.setupModal.title`);return(0,Z.jsxs)(U,{description:i?c(`profile.totp.setupModal.requiredDescription`):void 0,icon:j,isOpen:e,onClose:x,preventClose:i||l===`recovery`,size:`sm`,title:O,children:[f&&(0,Z.jsx)(`div`,{className:`flex justify-center py-tinyrack-xl`,"data-testid":`setup-totp-loading`,children:(0,Z.jsx)(t,{uiSize:`md`})}),l===`error`&&(0,Z.jsxs)(`div`,{className:`mt-tinyrack-lg flex flex-col gap-tinyrack-md`,children:[(0,Z.jsx)($,{variant:`error`,children:c(`profile.totp.setupModal.setupError`)}),(0,Z.jsxs)(H,{children:[(0,Z.jsx)(s,{appearance:`outline`,intent:`neutral`,onClick:x,type:`button`,uiSize:`sm`,children:c(`profile.totp.setupModal.cancel`)}),(0,Z.jsx)(s,{intent:`primary`,onClick:h,type:`button`,uiSize:`sm`,children:c(`profile.totp.setupModal.retry`)})]})]}),u&&l===`qr`&&(0,Z.jsx)(`div`,{className:`mt-tinyrack-lg`,children:(0,Z.jsx)(w,{additionalActions:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(H,{children:(0,Z.jsx)(s,{appearance:`outline`,intent:`neutral`,onClick:x,type:`button`,uiSize:`sm`,children:c(`profile.totp.setupModal.cancel`)})}),a&&o&&(0,Z.jsx)(`p`,{className:`mt-tinyrack-sm text-center text-tinyrack-xs`,children:(0,Z.jsx)(s,{appearance:`ghost`,intent:`primary`,onClick:o,type:`button`,uiSize:`sm`,children:c(`profile.totp.setupModal.switchToPasskey`)})})]}),onNext:_,setupData:u})}),u&&l===`verify`&&(0,Z.jsx)(`div`,{className:`mt-tinyrack-lg`,children:(0,Z.jsx)(T,{isPending:p,onBack:v,onSubmit:D})}),l===`recovery`&&d.length>0&&(0,Z.jsx)(`div`,{className:`mt-tinyrack-lg`,children:(0,Z.jsx)(C,{isLoading:m,onConfirm:y,recoveryCodes:d})})]})}var ze={access_denied:`oauth.error.accessDenied`,temporarily_unavailable:`oauth.error.temporarilyUnavailable`,server_error:`oauth.error.serverError`};function Be(){let{t:e}=r(),t=l(),n=u(),a=ie.useSearch().oauth_error,o=a?e(ze[a]??`oauth.error.failed`):void 0,[c,d]=(0,X.useState)(null),[f,p]=(0,X.useState)(null),[h,_]=(0,X.useState)(null),[v,y]=(0,X.useState)(null),[x,S]=(0,X.useState)(null),[C,w]=(0,X.useState)(!1),{data:T}=b(L),{data:E}=b(R),{data:D}=b(m),O=g({...te,onSuccess:async()=>{n.setQueryData(L.queryKey,{user:null}),await V(),t.navigate({to:`/login`})},onSettled:()=>{n.invalidateQueries({queryKey:L.queryKey})}}),k=g({...re,onSuccess:()=>{n.invalidateQueries({queryKey:R.queryKey})},onSettled:()=>{d(null)}}),A=async()=>{f&&(d(f.id),await k.mutateAsync(f.id))};if(!T.user)return null;let j=T.user,M=E.available_providers,N=M.some(e=>e.linked),P=j.managed_by===`config`,z=D.auth.password,ae=D.auth.passkey,H=z.totp.enabled,U=ae.enabled,W=D.account_deletion.enabled,G=D.account_deletion.retention,K=(()=>{let e=G.match(/^(\d+)([dmy])$/);if(!e)return 30;let t=parseInt(e[1],10);switch(e[2]){case`d`:return t;case`m`:return t*30;case`y`:return t*365;default:return 30}})(),q=!P&&H,J=!P&&U,Y=M.length>0;return(0,Z.jsxs)(we,{headerActions:(0,Z.jsx)(s,{appearance:`ghost`,"aria-label":e(`profile.logout`),"data-testid":`profile-logout`,disabled:O.isPending,loading:O.isPending,onClick:()=>O.mutate(),type:`button`,uiSize:`sm`,children:O.isPending?void 0:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ee,{"aria-hidden":!0,className:`size-tinyrack-lg`}),(0,Z.jsx)(`span`,{className:`hidden sm:inline`,children:e(`profile.logout`)})]})}),children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-tinyrack-lg`,children:[(0,Z.jsx)(se,{email:j.email,size:`lg`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-tinyrack-3xs`,children:[(0,Z.jsx)(oe,{title:e(`profile.title`)}),(0,Z.jsx)(i,{as:`p`,color:`muted`,"data-testid":`profile-user-email`,truncate:!0,variant:`bodySm`,children:j.email})]})]}),o&&(0,Z.jsx)(B,{icon:I,type:`error`,children:o}),j&&(0,Z.jsx)(Ce,{user:j}),(0,Z.jsxs)(F.Root,{variant:`outlined`,children:[(0,Z.jsxs)(F.Header,{className:`border-tinyrack-border border-b-tinyrack-default px-tinyrack-lg py-tinyrack-md`,children:[(0,Z.jsx)(F.Title,{children:e(`profile.security.title`)}),(0,Z.jsx)(F.Description,{children:e(`profile.security.description`)})]}),q&&j.totp_recovery_codes_missing&&(0,Z.jsx)(`div`,{className:`border-tinyrack-border border-b-tinyrack-default px-tinyrack-lg py-tinyrack-md`,"data-testid":`profile-totp-recovery-warning`,children:(0,Z.jsx)(B,{icon:I,type:`warning`,children:e(`profile.totp.recoveryCodesMissing`)})}),(0,Z.jsxs)(F.Content,{className:`divide-y divide-tinyrack-border p-0`,children:[(0,Z.jsx)(ve,{hasLinkedOAuth:N,hasPassword:j.has_password,hasSecondFactorOnly:j.has_password&&!N&&(j.totp_registered||j.passkey_count>0),isConfigManaged:P,onOpenModal:_}),q&&(0,Z.jsx)(ye,{onOpenModal:y,recoveryCodesMissing:j.totp_recovery_codes_missing,totpEnabled:j.totp_registered}),J&&(0,Z.jsx)(_e,{onOpenModal:S,passkeyCount:j.passkey_count})]})]}),Y&&(0,Z.jsx)(ge,{getAuthorizeUrl:ne,onUnlinkRequest:e=>p({id:e.id,name:e.display_name}),providers:M,unlinkingProvider:c}),(0,Z.jsx)(he,{isConfigManaged:P,isDeletionEnabled:W,onDeleteClick:()=>w(!0)}),(0,Z.jsx)(Ie,{isOpen:h===`set`,onClose:()=>_(null)}),(0,Z.jsx)(Oe,{isOpen:h===`change`,onClose:()=>_(null)}),(0,Z.jsx)(Fe,{isOpen:h===`remove`,onClose:()=>_(null)}),(0,Z.jsx)(Re,{isOpen:v===`setup`,onClose:()=>y(null)}),(0,Z.jsx)(je,{isOpen:v===`disable`,onClose:()=>y(null)}),(0,Z.jsx)(Pe,{isOpen:v===`regenerate`,onClose:()=>y(null)}),(0,Z.jsx)(Le,{isOpen:x===`setup`,onClose:()=>S(null)}),(0,Z.jsx)(Me,{isOpen:x===`manage`,onAddNew:()=>S(`setup`),onClose:()=>S(null)}),(0,Z.jsx)(xe,{isOpen:f!==null,isPending:k.isPending,onClose:()=>p(null),onConfirm:A,providerName:f?.name??``}),(0,Z.jsx)(Ae,{isOpen:C,onClose:()=>w(!1),retentionDays:K})]})}export{Be as component};
2
+ //# sourceMappingURL=profile-RpDmbWNA.js.map