@tinyrack/issuary-server 0.21.1 → 0.22.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.
- package/dist/entities/oauth-client.entity.d.ts +18 -0
- package/dist/entities/oauth-client.entity.d.ts.map +1 -1
- package/dist/entities/oauth-code.entity.d.ts +18 -0
- package/dist/entities/oauth-code.entity.d.ts.map +1 -1
- package/dist/entities/oauth-device-code.entity.d.ts +18 -0
- package/dist/entities/oauth-device-code.entity.d.ts.map +1 -1
- package/dist/entities/revoked-token.entity.d.ts +18 -0
- package/dist/entities/revoked-token.entity.d.ts.map +1 -1
- package/dist/entities/terms-content.entity.d.ts +9 -0
- package/dist/entities/terms-content.entity.d.ts.map +1 -1
- package/dist/entities/terms.entity.d.ts +9 -0
- package/dist/entities/terms.entity.d.ts.map +1 -1
- package/dist/entities/user-consent.entity.d.ts +18 -0
- package/dist/entities/user-consent.entity.d.ts.map +1 -1
- package/dist/entities/user-terms-consent.entity.d.ts +9 -0
- package/dist/entities/user-terms-consent.entity.d.ts.map +1 -1
- package/dist/entities/user-totp-recovery-code.entity.d.ts +9 -0
- package/dist/entities/user-totp-recovery-code.entity.d.ts.map +1 -1
- package/dist/entities/user-totp.entity.d.ts +9 -0
- package/dist/entities/user-totp.entity.d.ts.map +1 -1
- package/dist/entities/user.entity.d.ts +9 -0
- package/dist/entities/user.entity.d.ts.map +1 -1
- package/dist/entities/user.entity.js +4 -0
- package/dist/entities/user.entity.js.map +1 -1
- package/dist/entrypoints/app.d.ts +53 -0
- package/dist/entrypoints/app.d.ts.map +1 -1
- package/dist/entrypoints/database/postgres/compiled-functions.d.ts +23 -20
- package/dist/entrypoints/database/postgres/compiled-functions.d.ts.map +1 -1
- package/dist/entrypoints/database/postgres/compiled-functions.js +134 -104
- package/dist/entrypoints/database/postgres/compiled-functions.js.map +1 -1
- package/dist/entrypoints/database/sqlite/compiled-functions.d.ts +23 -20
- package/dist/entrypoints/database/sqlite/compiled-functions.d.ts.map +1 -1
- package/dist/entrypoints/database/sqlite/compiled-functions.js +134 -104
- package/dist/entrypoints/database/sqlite/compiled-functions.js.map +1 -1
- package/dist/lib/config/resolved.d.ts +1 -0
- package/dist/lib/config/resolved.d.ts.map +1 -1
- package/dist/lib/config/security.d.ts +2 -0
- package/dist/lib/config/security.d.ts.map +1 -1
- package/dist/lib/config/security.js +5 -0
- package/dist/lib/config/security.js.map +1 -1
- package/dist/middleware/auth.d.ts +8 -0
- package/dist/middleware/auth.d.ts.map +1 -1
- package/dist/middleware/auth.js +64 -0
- package/dist/middleware/auth.js.map +1 -1
- package/dist/middleware/session.d.ts +9 -0
- package/dist/middleware/session.d.ts.map +1 -1
- package/dist/middleware/session.js +18 -0
- package/dist/middleware/session.js.map +1 -1
- package/dist/migrations/postgres/Migration20260825110000_add_password_reset_required.d.ts +6 -0
- package/dist/migrations/postgres/Migration20260825110000_add_password_reset_required.d.ts.map +1 -0
- package/dist/migrations/postgres/Migration20260825110000_add_password_reset_required.js +11 -0
- package/dist/migrations/postgres/Migration20260825110000_add_password_reset_required.js.map +1 -0
- package/dist/migrations/postgres/index.d.ts.map +1 -1
- package/dist/migrations/postgres/index.js +2 -0
- package/dist/migrations/postgres/index.js.map +1 -1
- package/dist/migrations/sqlite/Migration20260825110000_add_password_reset_required.d.ts +6 -0
- package/dist/migrations/sqlite/Migration20260825110000_add_password_reset_required.d.ts.map +1 -0
- package/dist/migrations/sqlite/Migration20260825110000_add_password_reset_required.js +10 -0
- package/dist/migrations/sqlite/Migration20260825110000_add_password_reset_required.js.map +1 -0
- package/dist/migrations/sqlite/index.d.ts.map +1 -1
- package/dist/migrations/sqlite/index.js +2 -0
- package/dist/migrations/sqlite/index.js.map +1 -1
- package/dist/repositories/user-totp-recovery-code.repository.d.ts +6 -0
- package/dist/repositories/user-totp-recovery-code.repository.d.ts.map +1 -1
- package/dist/repositories/user-totp.repository.d.ts +9 -0
- package/dist/repositories/user-totp.repository.d.ts.map +1 -1
- package/dist/routes/api/auth/index.d.ts +52 -0
- package/dist/routes/api/auth/index.d.ts.map +1 -1
- package/dist/routes/api/auth/index.js +2 -0
- package/dist/routes/api/auth/index.js.map +1 -1
- package/dist/routes/api/auth/passkey/verify/post.d.ts +37 -0
- package/dist/routes/api/auth/passkey/verify/post.d.ts.map +1 -1
- package/dist/routes/api/auth/passkey/verify/post.js +8 -2
- package/dist/routes/api/auth/passkey/verify/post.js.map +1 -1
- package/dist/routes/api/auth/password/reset-required/post.d.ts +18 -0
- package/dist/routes/api/auth/password/reset-required/post.d.ts.map +1 -0
- package/dist/routes/api/auth/password/reset-required/post.js +39 -0
- package/dist/routes/api/auth/password/reset-required/post.js.map +1 -0
- package/dist/routes/api/index.d.ts +52 -0
- package/dist/routes/api/index.d.ts.map +1 -1
- package/dist/routes/index.d.ts +52 -0
- package/dist/routes/index.d.ts.map +1 -1
- package/dist/schemas/error.d.ts +25 -0
- package/dist/schemas/error.d.ts.map +1 -1
- package/dist/schemas/error.js +1 -0
- package/dist/schemas/error.js.map +1 -1
- package/dist/schemas/response.d.ts +22 -0
- package/dist/schemas/response.d.ts.map +1 -1
- package/dist/schemas/response.js +8 -0
- package/dist/schemas/response.js.map +1 -1
- package/dist/seeders/config.seeder.js +2 -1
- package/dist/seeders/config.seeder.js.map +1 -1
- package/dist/services/container.d.ts +1 -0
- package/dist/services/container.d.ts.map +1 -1
- package/dist/services/container.js +9 -35
- package/dist/services/container.js.map +1 -1
- package/dist/services/legacy-credential-retirement.service.d.ts +20 -0
- package/dist/services/legacy-credential-retirement.service.d.ts.map +1 -0
- package/dist/services/legacy-credential-retirement.service.js +90 -0
- package/dist/services/legacy-credential-retirement.service.js.map +1 -0
- package/dist/services/oauth-connect.service.d.ts.map +1 -1
- package/dist/services/oauth-connect.service.js +4 -0
- package/dist/services/oauth-connect.service.js.map +1 -1
- package/dist/services/password-auth.service.d.ts.map +1 -1
- package/dist/services/password-auth.service.js +2 -1
- package/dist/services/password-auth.service.js.map +1 -1
- package/package.json +1 -1
- package/public/assets/2fa-BgveHSB_.js +2 -0
- package/public/assets/{2fa-B5vLgDXQ.js.map → 2fa-BgveHSB_.js.map} +1 -1
- package/public/assets/2fa-C37MUkye.js +2 -0
- package/public/assets/{2fa-CCOTIHDZ.js.map → 2fa-C37MUkye.js.map} +1 -1
- package/public/assets/2fa-UL_cNRnQ.js +2 -0
- package/public/assets/{2fa-C5vUVgr_.js.map → 2fa-UL_cNRnQ.js.map} +1 -1
- package/public/assets/2fa-kiqzGSz2.js +2 -0
- package/public/assets/{2fa-BqsM_D-X.js.map → 2fa-kiqzGSz2.js.map} +1 -1
- package/public/assets/{DialogHandle-BmtK2pRn.js → DialogHandle-Zvz8SgS0.js} +2 -2
- package/public/assets/{DialogHandle-BmtK2pRn.js.map → DialogHandle-Zvz8SgS0.js.map} +1 -1
- package/public/assets/admin-DbDuu6AI.js +2 -0
- package/public/assets/{admin-BPijkLw-.js.map → admin-DbDuu6AI.js.map} +1 -1
- package/public/assets/admin-users-CwTJdiih.js +2 -0
- package/public/assets/{admin-users-DvPbw1Vq.js.map → admin-users-CwTJdiih.js.map} +1 -1
- package/public/assets/{auth-choice-row-BCGjuedo.js → auth-choice-row-BlSsUI7d.js} +2 -2
- package/public/assets/{auth-choice-row-BCGjuedo.js.map → auth-choice-row-BlSsUI7d.js.map} +1 -1
- package/public/assets/{auth-field-DD8kvl--.js → auth-field-HwxENJnB.js} +2 -2
- package/public/assets/{auth-field-DD8kvl--.js.map → auth-field-HwxENJnB.js.map} +1 -1
- package/public/assets/{auth-layout-VtpryDof.js → auth-layout-CoeqNhTT.js} +2 -2
- package/public/assets/{auth-layout-VtpryDof.js.map → auth-layout-CoeqNhTT.js.map} +1 -1
- package/public/assets/{auth-page-header-CIn2E4zI.js → auth-page-header-CIs08f5Y.js} +2 -2
- package/public/assets/{auth-page-header-CIn2E4zI.js.map → auth-page-header-CIs08f5Y.js.map} +1 -1
- package/public/assets/{authorization-context-banner-SOuBHWIb.js → authorization-context-banner-BbtQmMYH.js} +2 -2
- package/public/assets/{authorization-context-banner-SOuBHWIb.js.map → authorization-context-banner-BbtQmMYH.js.map} +1 -1
- package/public/assets/{avatar-BEQjf2x6.js → avatar-CttWiIv3.js} +2 -2
- package/public/assets/{avatar-BEQjf2x6.js.map → avatar-CttWiIv3.js.map} +1 -1
- package/public/assets/{checkbox-gdHnSFQ-.js → checkbox-CJrRV8S1.js} +2 -2
- package/public/assets/{checkbox-gdHnSFQ-.js.map → checkbox-CJrRV8S1.js.map} +1 -1
- package/public/assets/config-v3-oy_ef.js +2 -0
- package/public/assets/config-v3-oy_ef.js.map +1 -0
- package/public/assets/{consent-BqqFDdsr.js → consent-BIhxtXHx.js} +2 -2
- package/public/assets/{consent-BqqFDdsr.js.map → consent-BIhxtXHx.js.map} +1 -1
- package/public/assets/{consent-CfRbz2R7.js → consent-DRmENn26.js} +2 -2
- package/public/assets/{consent-CfRbz2R7.js.map → consent-DRmENn26.js.map} +1 -1
- package/public/assets/{email-CKKakxPJ.js → email-CVRDeJ78.js} +2 -2
- package/public/assets/{email-CKKakxPJ.js.map → email-CVRDeJ78.js.map} +1 -1
- package/public/assets/email-UL_cNRnQ.js +2 -0
- package/public/assets/{email-C5vUVgr_.js.map → email-UL_cNRnQ.js.map} +1 -1
- package/public/assets/error-2VPY5w8V.js +2 -0
- package/public/assets/{error-BMXxpgfR.js.map → error-2VPY5w8V.js.map} +1 -1
- package/public/assets/{field-Cn4H1CUj.js → field-DDt6F9TZ.js} +2 -2
- package/public/assets/{field-Cn4H1CUj.js.map → field-DDt6F9TZ.js.map} +1 -1
- package/public/assets/forgot-DzDcduho.js +2 -0
- package/public/assets/{forgot-rO9sByfV.js.map → forgot-DzDcduho.js.map} +1 -1
- package/public/assets/forgot-UL_cNRnQ.js +2 -0
- package/public/assets/{forgot-C5vUVgr_.js.map → forgot-UL_cNRnQ.js.map} +1 -1
- package/public/assets/index-gliHKncz.js +11 -0
- package/public/assets/index-gliHKncz.js.map +1 -0
- package/public/assets/{initial-avatar-CtuDUz_W.js → initial-avatar-CZzHAPm3.js} +2 -2
- package/public/assets/{initial-avatar-CtuDUz_W.js.map → initial-avatar-CZzHAPm3.js.map} +1 -1
- package/public/assets/{input-CzQki7k6.js → input-CNRpSR08.js} +2 -2
- package/public/assets/{input-CzQki7k6.js.map → input-CNRpSR08.js.map} +1 -1
- package/public/assets/{labeled-separator-CV7nb0XW.js → labeled-separator-fnKySKv2.js} +2 -2
- package/public/assets/{labeled-separator-CV7nb0XW.js.map → labeled-separator-fnKySKv2.js.map} +1 -1
- package/public/assets/link-BN90emXr.js +2 -0
- package/public/assets/link-BN90emXr.js.map +1 -0
- package/public/assets/lock-keyhole-Cz72xkCn.js +2 -0
- package/public/assets/lock-keyhole-Cz72xkCn.js.map +1 -0
- package/public/assets/login-C6m2qSUt.js +2 -0
- package/public/assets/login-C6m2qSUt.js.map +1 -0
- package/public/assets/login-UL_cNRnQ.js +2 -0
- package/public/assets/login-UL_cNRnQ.js.map +1 -0
- package/public/assets/{logout-B5T52P8u.js → logout-CHdmF_16.js} +2 -2
- package/public/assets/{logout-B5T52P8u.js.map → logout-CHdmF_16.js.map} +1 -1
- package/public/assets/{modal-BDQFucjz.js → modal-sCM_zT82.js} +2 -2
- package/public/assets/{modal-BDQFucjz.js.map → modal-sCM_zT82.js.map} +1 -1
- package/public/assets/{mutationOptions-DyYFUbyn.js → mutationOptions-CrswitPs.js} +2 -2
- package/public/assets/{mutationOptions-DyYFUbyn.js.map → mutationOptions-CrswitPs.js.map} +1 -1
- package/public/assets/passkey-B2Blw47e.js +2 -0
- package/public/assets/{passkey-J1qnYp9A.js.map → passkey-B2Blw47e.js.map} +1 -1
- package/public/assets/passkey-CEx1VZ5R.js +2 -0
- package/public/assets/{passkey-CynCz1Dt.js.map → passkey-CEx1VZ5R.js.map} +1 -1
- package/public/assets/passkey-CU8x9J2w.js +2 -0
- package/public/assets/{passkey-BE9JvJOP.js.map → passkey-CU8x9J2w.js.map} +1 -1
- package/public/assets/passkey-UL_cNRnQ.js +2 -0
- package/public/assets/{passkey-C5vUVgr_.js.map → passkey-UL_cNRnQ.js.map} +1 -1
- package/public/assets/password-BhU_a0cR.js +2 -0
- package/public/assets/password-BhU_a0cR.js.map +1 -0
- package/public/assets/password-UL_cNRnQ.js +2 -0
- package/public/assets/password-UL_cNRnQ.js.map +1 -0
- package/public/assets/password-reset-CIacHnvA.js +2 -0
- package/public/assets/{password-reset-sU5KkBKi.js.map → password-reset-CIacHnvA.js.map} +1 -1
- package/public/assets/{password-strength-BeSOu_Ga.js → password-strength-C0Zkrrct.js} +2 -2
- package/public/assets/{password-strength-BeSOu_Ga.js.map → password-strength-C0Zkrrct.js.map} +1 -1
- package/public/assets/{pin-input-Cc-VkrQ3.js → pin-input-BlD4tPZJ.js} +2 -2
- package/public/assets/{pin-input-Cc-VkrQ3.js.map → pin-input-BlD4tPZJ.js.map} +1 -1
- package/public/assets/{profile-BcjsVYOx.js → profile-D1cEjfs8.js} +2 -2
- package/public/assets/{profile-BcjsVYOx.js.map → profile-D1cEjfs8.js.map} +1 -1
- package/public/assets/{profile-B5NaJfeS.js → profile-D43Yq-6S.js} +2 -2
- package/public/assets/{profile-B5NaJfeS.js.map → profile-D43Yq-6S.js.map} +1 -1
- package/public/assets/recovery-CLExnfYX.js +2 -0
- package/public/assets/{recovery-PnUATiUi.js.map → recovery-CLExnfYX.js.map} +1 -1
- package/public/assets/register-CZUyWXRO.js +2 -0
- package/public/assets/{register-DQXhru0_.js.map → register-CZUyWXRO.js.map} +1 -1
- package/public/assets/register-UL_cNRnQ.js +2 -0
- package/public/assets/{register-C5vUVgr_.js.map → register-UL_cNRnQ.js.map} +1 -1
- package/public/assets/reset-N3RQTYEB.js +2 -0
- package/public/assets/reset-N3RQTYEB.js.map +1 -0
- package/public/assets/reset-UL_cNRnQ.js +2 -0
- package/public/assets/{reset-C5vUVgr_.js.map → reset-UL_cNRnQ.js.map} +1 -1
- package/public/assets/reset-required-Cv5edDS6.js +2 -0
- package/public/assets/reset-required-Cv5edDS6.js.map +1 -0
- package/public/assets/reset-required-UL_cNRnQ.js +2 -0
- package/public/assets/reset-required-UL_cNRnQ.js.map +1 -0
- package/public/assets/{select-DqZynXSt.js → select-CWdSzsVo.js} +2 -2
- package/public/assets/{select-DqZynXSt.js.map → select-CWdSzsVo.js.map} +1 -1
- package/public/assets/select-UL_cNRnQ.js +2 -0
- package/public/assets/{select-C5vUVgr_.js.map → select-UL_cNRnQ.js.map} +1 -1
- package/public/assets/{separator-B0Bvh1he.js → separator-BWGym8uM.js} +2 -2
- package/public/assets/{separator-B0Bvh1he.js.map → separator-BWGym8uM.js.map} +1 -1
- package/public/assets/shell-header-bar-C9AB5lT-.js +2 -0
- package/public/assets/{shell-header-bar-CjG5qvPg.js.map → shell-header-bar-C9AB5lT-.js.map} +1 -1
- package/public/assets/{terms-BHDAgn-H.js → terms-COVFmzyl.js} +2 -2
- package/public/assets/{terms-BHDAgn-H.js.map → terms-COVFmzyl.js.map} +1 -1
- package/public/assets/{terms-B5NaJfeS.js → terms-D43Yq-6S.js} +2 -2
- package/public/assets/{terms-B5NaJfeS.js.map → terms-D43Yq-6S.js.map} +1 -1
- package/public/assets/{terms-checkbox-list-6jteUTIZ.js → terms-checkbox-list-Cw0zB-lO.js} +2 -2
- package/public/assets/{terms-checkbox-list-6jteUTIZ.js.map → terms-checkbox-list-Cw0zB-lO.js.map} +1 -1
- package/public/assets/totp-BFJEXxk0.js +2 -0
- package/public/assets/{totp-CJtfVNEq.js.map → totp-BFJEXxk0.js.map} +1 -1
- package/public/assets/{totp-BNZ904Zm.js → totp-BfCm6IWl.js} +2 -2
- package/public/assets/{totp-BNZ904Zm.js.map → totp-BfCm6IWl.js.map} +1 -1
- package/public/assets/totp-MINhsVxT.js +2 -0
- package/public/assets/{totp-ECvOUcFx.js.map → totp-MINhsVxT.js.map} +1 -1
- package/public/assets/use-totp-setup-C7Zk_2IY.js +3 -0
- package/public/assets/{use-totp-setup-BbS3XcZA.js.map → use-totp-setup-C7Zk_2IY.js.map} +1 -1
- package/public/assets/{useAriaLabelledBy-ByuMi3Ry.js → useAriaLabelledBy-CiOCg6X5.js} +2 -2
- package/public/assets/{useAriaLabelledBy-ByuMi3Ry.js.map → useAriaLabelledBy-CiOCg6X5.js.map} +1 -1
- package/public/assets/{useMutation-BWZ0G4Td.js → useMutation-ZLFeJg75.js} +2 -2
- package/public/assets/{useMutation-BWZ0G4Td.js.map → useMutation-ZLFeJg75.js.map} +1 -1
- package/public/assets/useQuery-BvMz34BW.js +2 -0
- package/public/assets/{useQuery-Ckxjmvtl.js.map → useQuery-BvMz34BW.js.map} +1 -1
- package/public/assets/{users-CmFxrCQT.js → users-COM7u3A-.js} +2 -2
- package/public/assets/{users-CmFxrCQT.js.map → users-COM7u3A-.js.map} +1 -1
- package/public/index.html +4 -3
- package/public/assets/2fa-B5vLgDXQ.js +0 -2
- package/public/assets/2fa-BqsM_D-X.js +0 -2
- package/public/assets/2fa-C5vUVgr_.js +0 -2
- package/public/assets/2fa-CCOTIHDZ.js +0 -2
- package/public/assets/admin-BPijkLw-.js +0 -2
- package/public/assets/admin-users-DvPbw1Vq.js +0 -2
- package/public/assets/config-DTQCUlfZ.js +0 -2
- package/public/assets/config-DTQCUlfZ.js.map +0 -1
- package/public/assets/email-C5vUVgr_.js +0 -2
- package/public/assets/error-BMXxpgfR.js +0 -2
- package/public/assets/forgot-C5vUVgr_.js +0 -2
- package/public/assets/forgot-rO9sByfV.js +0 -2
- package/public/assets/index-CS23Ozt6.js +0 -11
- package/public/assets/index-CS23Ozt6.js.map +0 -1
- package/public/assets/login-C5vUVgr_.js +0 -2
- package/public/assets/login-C5vUVgr_.js.map +0 -1
- package/public/assets/login-nukebli4.js +0 -2
- package/public/assets/login-nukebli4.js.map +0 -1
- package/public/assets/passkey-BE9JvJOP.js +0 -2
- package/public/assets/passkey-C5vUVgr_.js +0 -2
- package/public/assets/passkey-CynCz1Dt.js +0 -2
- package/public/assets/passkey-J1qnYp9A.js +0 -2
- package/public/assets/password-C5vUVgr_.js +0 -2
- package/public/assets/password-C5vUVgr_.js.map +0 -1
- package/public/assets/password-RkUttbhD.js +0 -2
- package/public/assets/password-RkUttbhD.js.map +0 -1
- package/public/assets/password-reset-sU5KkBKi.js +0 -2
- package/public/assets/recovery-PnUATiUi.js +0 -2
- package/public/assets/register-C5vUVgr_.js +0 -2
- package/public/assets/register-DQXhru0_.js +0 -2
- package/public/assets/reset-C5vUVgr_.js +0 -2
- package/public/assets/reset-CQgIa3yf.js +0 -2
- package/public/assets/reset-CQgIa3yf.js.map +0 -1
- package/public/assets/select-C5vUVgr_.js +0 -2
- package/public/assets/shell-header-bar-CjG5qvPg.js +0 -2
- package/public/assets/totp-CJtfVNEq.js +0 -2
- package/public/assets/totp-ECvOUcFx.js +0 -2
- package/public/assets/use-totp-setup-BbS3XcZA.js +0 -3
- package/public/assets/useQuery-Ckxjmvtl.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pin-input-Cc-VkrQ3.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,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,C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,OACN,CAAA,CAEO,GAElB,CACF"}
|
|
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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B,IAAa,CAAc,CAC7B,EACA,CAAC,CAAU,CACb,EAEA,OACE,EAAA,EAAA,KAAA,CAAC,EAAQ,KAAT,CAAyB,YAAW,IAAK,WAAzC,EAQE,EAAA,EAAA,IAAA,CAAC,EAAQ,MAAT,CAAe,UAAU,UAAU,QAAS,WACzC,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,2 +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-CjG5qvPg.js";import{t as x}from"./useQuery-Ckxjmvtl.js";import{a as S,i as C,n as w,r as T,t as E}from"./use-totp-setup-BbS3XcZA.js";import{t as D}from"./auth-field-DD8kvl--.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-CS23Ozt6.js";import{t as ae}from"./badge-CsOfUji0.js";import{t as oe}from"./auth-page-header-CIn2E4zI.js";import{t as B}from"./alert-leqyvHOp.js";import{t as se}from"./initial-avatar-CtuDUz_W.js";import{t as V}from"./promise-OpBtq8tG.js";import{n as H,t as U}from"./modal-BDQFucjz.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`}),(0,Z.jsx)(F.Title,{className:`text-tinyrack-danger`,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`:`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`}),(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-on-danger`,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`}):(0,Z.jsx)(me,{className:`size-tinyrack-lg text-tinyrack-primary`}),(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-
|
|
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{Dn as l,i as u,n as d,r as f,sr as p,t as m}from"./config-v3-oy_ef.js";import{t as h}from"./mutationOptions-CrswitPs.js";import{t as g}from"./useMutation-ZLFeJg75.js";import{A as _,D as v,t as y,tt as b}from"./shell-header-bar-C9AB5lT-.js";import{t as x}from"./useQuery-BvMz34BW.js";import{a as S,i as C,n as w,r as T,t as E}from"./use-totp-setup-C7Zk_2IY.js";import{t as D}from"./auth-field-HwxENJnB.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-CHdmF_16.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-gliHKncz.js";import{t as ae}from"./badge-CsOfUji0.js";import{t as oe}from"./auth-page-header-CIs08f5Y.js";import{t as B}from"./alert-leqyvHOp.js";import{t as se}from"./initial-avatar-CZzHAPm3.js";import{t as V}from"./promise-OpBtq8tG.js";import{n as H,t as U}from"./modal-sCM_zT82.js";import{a as W,i as G,n as K,r as q}from"./passkey-B2Blw47e.js";import{r as J,t as Y}from"./standard-schema-e8gtSzGE.js";import{n as ce,r as le}from"./totp-BfCm6IWl.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`}),(0,Z.jsx)(F.Title,{className:`text-tinyrack-danger`,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`:`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`}),(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=>u(await f.api.user.password.$post({json:e}))}),Ee=h({mutationFn:async e=>u(await f.api.user.password.$put({json:e}))}),De=h({mutationFn:async e=>u(await f.api.user.password.$delete({json:e}))});function Oe({isOpen:e,onClose:t}){let{t:n}=r(),i=p(),{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:``}}),u=g({...Ee,onSuccess:()=>{i.invalidateQueries({queryKey:L.queryKey}),d()}}),d=()=>{l.reset(),t()},f=l.handleSubmit(async e=>{try{await u.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:d,title:n(`profile.password.changeModal.title`),children:(0,Z.jsxs)(`form`,{className:`mt-tinyrack-lg flex flex-col gap-tinyrack-md`,onSubmit:f,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:u.isPending,intent:`neutral`,onClick:d,type:`button`,uiSize:`sm`,children:n(`profile.password.changeModal.cancel`)}),(0,Z.jsx)(s,{"data-testid":`change-password-submit`,disabled:u.isPending,intent:`primary`,loading:u.isPending,loadingLabel:n(`profile.password.changeModal.submitting`),type:`submit`,uiSize:`sm`,children:u.isPending?void 0:n(`profile.password.changeModal.submit`)})]})]})})}var ke=h({mutationFn:async()=>u(await f.api.user.$delete())});function Ae({isOpen:e,onClose:t,retentionDays:n}){let{t:i}=r(),a=l(),o=p(),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:``}}),u=g({...ke,onSuccess:async()=>{o.setQueryData(L.queryKey,{user:null}),await V(),a.navigate({to:`/login`})}}),d=()=>{u.isPending||(c.reset(),t())},f=c.handleSubmit(async()=>{try{await u.mutateAsync()}catch{c.setError(`root`,{message:i(`profile.deleteAccount.error`)})}});return(0,Z.jsx)(U,{icon:M,isOpen:e,onClose:d,preventClose:u.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:f,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:u.isPending,intent:`neutral`,onClick:d,type:`button`,uiSize:`sm`,children:i(`profile.deleteAccount.modal.cancel`)}),(0,Z.jsx)(s,{"data-testid":`delete-account-submit`,disabled:u.isPending,intent:`danger`,loading:u.isPending,loadingLabel:i(`profile.deleteAccount.modal.confirming`),type:`submit`,uiSize:`sm`,children:u.isPending?void 0:i(`profile.deleteAccount.modal.confirm`)})]})]})})}function je({isOpen:e,onClose:t}){let{t:n}=r(),i=p(),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()},u=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:u,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=p(),[l,u]=(0,X.useState)(null),[f,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:d.passkeys()}),c.invalidateQueries({queryKey:L.queryKey})},onSettled:()=>{m(null)}}),w=(0,X.useCallback)(()=>{u(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:f===e.id,isEditing:l?.id===e.id,onCancelDelete:E,onCancelEdit:()=>u(null),onConfirmDelete:()=>D(e),onEdit:()=>u(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:u,formatDate:f}){let{t:m}=r(),h=p(),_=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:d.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-on-danger`,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:u,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`}):(0,Z.jsx)(me,{className:`size-tinyrack-lg text-tinyrack-primary`}),(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:f(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=p(),{data:s}=b(m),[c,u]=(0,X.useState)(`verify`),[d,f]=(0,X.useState)(null),[h,_]=(0,X.useState)(null),v=g({...le,onSuccess:async e=>{f(e),u(`recovery`),await a.invalidateQueries({queryKey:L.queryKey})}}),y=(0,X.useCallback)(()=>{u(`verify`),f(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:d?.recovery_codes??[]})})}):null}function Fe({isOpen:e,onClose:t}){let{t:n}=r(),i=p(),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()},u=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:u,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=p(),{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}),u()}}),u=()=>{c.reset(),t()},d=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:u,title:n(`profile.password.setModal.title`),children:(0,Z.jsxs)(`form`,{className:`mt-tinyrack-lg flex flex-col gap-tinyrack-md`,onSubmit:d,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:u,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=p(),[u,f]=(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:d.passkeys()}),l.invalidateQueries({queryKey:L.queryKey}),y()},onError:e=>{f(`name`),e.name===`NotAllowedError`?h(c(`profile.passkey.setupModal.cancelled`)):h(c(`profile.passkey.setupModal.error`))}}),y=(0,X.useCallback)(()=>{_.reset(),f(`name`),h(null),n()},[_,n]),b=_.handleSubmit(async e=>{f(`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:[u===`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`)})})]}),u===`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=p(),a=ie.useSearch().oauth_error,o=a?e(ze[a]??`oauth.error.failed`):void 0,[c,u]=(0,X.useState)(null),[d,f]=(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:()=>{u(null)}}),A=async()=>{d&&(u(d.id),await k.mutateAsync(d.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=>f({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:d!==null,isPending:k.isPending,onClose:()=>f(null),onConfirm:A,providerName:d?.name??``}),(0,Z.jsx)(Ae,{isOpen:C,onClose:()=>w(!1),retentionDays:K})]})}export{Be as component};
|
|
2
|
+
//# sourceMappingURL=profile-D1cEjfs8.js.map
|