@tinyrack/issuary-server 0.23.0 → 0.25.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/entrypoints/app.d.ts +0 -6
- package/dist/entrypoints/app.d.ts.map +1 -1
- package/dist/lib/config/branding.d.ts +0 -4
- package/dist/lib/config/branding.d.ts.map +1 -1
- package/dist/lib/config/branding.js +0 -14
- package/dist/lib/config/branding.js.map +1 -1
- package/dist/lib/config/resolved.d.ts +0 -2
- package/dist/lib/config/resolved.d.ts.map +1 -1
- package/dist/routes/api/config/get.d.ts +0 -4
- package/dist/routes/api/config/get.d.ts.map +1 -1
- package/dist/routes/api/config/get.js +0 -2
- package/dist/routes/api/config/get.js.map +1 -1
- package/dist/routes/api/config/index.d.ts +0 -4
- package/dist/routes/api/config/index.d.ts.map +1 -1
- package/dist/routes/api/index.d.ts +0 -4
- package/dist/routes/api/index.d.ts.map +1 -1
- package/dist/routes/index.d.ts +0 -4
- package/dist/routes/index.d.ts.map +1 -1
- package/dist/schemas/response.d.ts +0 -2
- package/dist/schemas/response.d.ts.map +1 -1
- package/dist/schemas/response.js +0 -5
- package/dist/schemas/response.js.map +1 -1
- package/dist/services/container.d.ts +0 -2
- package/dist/services/container.d.ts.map +1 -1
- package/package.json +2 -1
- package/public/assets/2fa-BlpDkf-r.js +2 -0
- package/public/assets/{2fa-CCOTIHDZ.js.map → 2fa-BlpDkf-r.js.map} +1 -1
- package/public/assets/{2fa-B5vLgDXQ.js → 2fa-DIpGlpoI.js} +2 -2
- package/public/assets/{2fa-B5vLgDXQ.js.map → 2fa-DIpGlpoI.js.map} +1 -1
- package/public/assets/2fa-tzTSqiOS.js +2 -0
- package/public/assets/{2fa-C5vUVgr_.js.map → 2fa-tzTSqiOS.js.map} +1 -1
- package/public/assets/{2fa-BqsM_D-X.js → 2fa-waFAdIa0.js} +2 -2
- package/public/assets/{2fa-BqsM_D-X.js.map → 2fa-waFAdIa0.js.map} +1 -1
- package/public/assets/DialogHandle-ChG5Sj7T.js +2 -0
- package/public/assets/{DialogHandle-BmtK2pRn.js.map → DialogHandle-ChG5Sj7T.js.map} +1 -1
- package/public/assets/admin-Ii29X08B.js +2 -0
- package/public/assets/admin-Ii29X08B.js.map +1 -0
- package/public/assets/{admin-users-DvPbw1Vq.js → admin-users-d7tT-cjc.js} +2 -2
- package/public/assets/{admin-users-DvPbw1Vq.js.map → admin-users-d7tT-cjc.js.map} +1 -1
- package/public/assets/alert-leqyvHOp.js.map +1 -1
- package/public/assets/{auth-choice-row-BCGjuedo.js → auth-choice-row-DUvFyo7b.js} +2 -2
- package/public/assets/{auth-choice-row-BCGjuedo.js.map → auth-choice-row-DUvFyo7b.js.map} +1 -1
- package/public/assets/{auth-field-DD8kvl--.js → auth-field-BSlAWkbx.js} +2 -2
- package/public/assets/{auth-field-DD8kvl--.js.map → auth-field-BSlAWkbx.js.map} +1 -1
- package/public/assets/auth-layout-CcJy6dVY.js +2 -0
- package/public/assets/auth-layout-CcJy6dVY.js.map +1 -0
- package/public/assets/{auth-page-header-CIn2E4zI.js → auth-page-header-ZLhtQ7Et.js} +2 -2
- package/public/assets/auth-page-header-ZLhtQ7Et.js.map +1 -0
- package/public/assets/authorization-context-banner-DfkjwE93.js +2 -0
- package/public/assets/authorization-context-banner-DfkjwE93.js.map +1 -0
- package/public/assets/{avatar-BEQjf2x6.js → avatar-D-70MKp8.js} +2 -2
- package/public/assets/{avatar-BEQjf2x6.js.map → avatar-D-70MKp8.js.map} +1 -1
- package/public/assets/badge-CsOfUji0.js.map +1 -1
- package/public/assets/checkbox-C3UmXoKz.js +2 -0
- package/public/assets/{checkbox-gdHnSFQ-.js.map → checkbox-C3UmXoKz.js.map} +1 -1
- package/public/assets/config-DTQCUlfZ.js.map +1 -1
- package/public/assets/{consent-CfRbz2R7.js → consent-BJgO9pEV.js} +2 -2
- package/public/assets/{consent-CfRbz2R7.js.map → consent-BJgO9pEV.js.map} +1 -1
- package/public/assets/{consent-BqqFDdsr.js → consent-D_yGE8TR.js} +2 -2
- package/public/assets/{consent-BqqFDdsr.js.map → consent-D_yGE8TR.js.map} +1 -1
- package/public/assets/createLucideIcon-BPpAIXR_.js.map +1 -1
- package/public/assets/{email-CKKakxPJ.js → email-DAa8JGoC.js} +2 -2
- package/public/assets/{email-CKKakxPJ.js.map → email-DAa8JGoC.js.map} +1 -1
- package/public/assets/email-tzTSqiOS.js +2 -0
- package/public/assets/{email-C5vUVgr_.js.map → email-tzTSqiOS.js.map} +1 -1
- package/public/assets/{error-BMXxpgfR.js → error-Dj4QQ8vW.js} +2 -2
- package/public/assets/{error-BMXxpgfR.js.map → error-Dj4QQ8vW.js.map} +1 -1
- package/public/assets/field-CEs4ugVJ.js +3 -0
- package/public/assets/{field-Cn4H1CUj.js.map → field-CEs4ugVJ.js.map} +1 -1
- package/public/assets/{forgot-rO9sByfV.js → forgot-CYMAWPVu.js} +2 -2
- package/public/assets/{forgot-rO9sByfV.js.map → forgot-CYMAWPVu.js.map} +1 -1
- package/public/assets/forgot-tzTSqiOS.js +2 -0
- package/public/assets/{forgot-C5vUVgr_.js.map → forgot-tzTSqiOS.js.map} +1 -1
- package/public/assets/{index-CS23Ozt6.js → index-H6CJKjiN.js} +3 -3
- package/public/assets/{index-CS23Ozt6.js.map → index-H6CJKjiN.js.map} +1 -1
- package/public/assets/{index-DZyHRhbQ.css → index-kD9gQA-w.css} +1 -1
- package/public/assets/{initial-avatar-CtuDUz_W.js → initial-avatar-DjSqgENY.js} +2 -2
- package/public/assets/{initial-avatar-CtuDUz_W.js.map → initial-avatar-DjSqgENY.js.map} +1 -1
- package/public/assets/{input-CzQki7k6.js → input-BHPUSlfp.js} +2 -2
- package/public/assets/{input-CzQki7k6.js.map → input-BHPUSlfp.js.map} +1 -1
- package/public/assets/link-C-WdTj3F.js.map +1 -1
- package/public/assets/{login-nukebli4.js → login-CBinfk4L.js} +2 -2
- package/public/assets/{login-nukebli4.js.map → login-CBinfk4L.js.map} +1 -1
- package/public/assets/login-tzTSqiOS.js +2 -0
- package/public/assets/{login-C5vUVgr_.js.map → login-tzTSqiOS.js.map} +1 -1
- package/public/assets/{modal-BDQFucjz.js → modal-CwoBUXp3.js} +2 -2
- package/public/assets/{modal-BDQFucjz.js.map → modal-CwoBUXp3.js.map} +1 -1
- package/public/assets/{passkey-CynCz1Dt.js → passkey-Jw2CRzJp.js} +2 -2
- package/public/assets/{passkey-CynCz1Dt.js.map → passkey-Jw2CRzJp.js.map} +1 -1
- package/public/assets/{passkey-BE9JvJOP.js → passkey-V_tav53p.js} +2 -2
- package/public/assets/{passkey-BE9JvJOP.js.map → passkey-V_tav53p.js.map} +1 -1
- package/public/assets/passkey-tzTSqiOS.js +2 -0
- package/public/assets/{passkey-C5vUVgr_.js.map → passkey-tzTSqiOS.js.map} +1 -1
- package/public/assets/{password-RkUttbhD.js → password-6QOqTV_s.js} +2 -2
- package/public/assets/{password-RkUttbhD.js.map → password-6QOqTV_s.js.map} +1 -1
- package/public/assets/{password-strength-BeSOu_Ga.js → password-strength-DtGMHOD-.js} +2 -2
- package/public/assets/{password-strength-BeSOu_Ga.js.map → password-strength-DtGMHOD-.js.map} +1 -1
- package/public/assets/password-tzTSqiOS.js +2 -0
- package/public/assets/{password-C5vUVgr_.js.map → password-tzTSqiOS.js.map} +1 -1
- package/public/assets/pin-input-DdhzDNy9.js +2 -0
- package/public/assets/{pin-input-Cc-VkrQ3.js.map → pin-input-DdhzDNy9.js.map} +1 -1
- package/public/assets/{profile-B5NaJfeS.js → profile-DVjIWt8X.js} +2 -2
- package/public/assets/{profile-B5NaJfeS.js.map → profile-DVjIWt8X.js.map} +1 -1
- package/public/assets/profile-SHr6F-7b.js +2 -0
- package/public/assets/profile-SHr6F-7b.js.map +1 -0
- package/public/assets/provider-logos-u1YURWQr.js.map +1 -1
- package/public/assets/{recovery-PnUATiUi.js → recovery-CvNl-yt9.js} +2 -2
- package/public/assets/{recovery-PnUATiUi.js.map → recovery-CvNl-yt9.js.map} +1 -1
- package/public/assets/{register-DQXhru0_.js → register-SFXa5EeL.js} +2 -2
- package/public/assets/{register-DQXhru0_.js.map → register-SFXa5EeL.js.map} +1 -1
- package/public/assets/register-tzTSqiOS.js +2 -0
- package/public/assets/{register-C5vUVgr_.js.map → register-tzTSqiOS.js.map} +1 -1
- package/public/assets/{reset-CQgIa3yf.js → reset-l-pLzjwe.js} +2 -2
- package/public/assets/{reset-CQgIa3yf.js.map → reset-l-pLzjwe.js.map} +1 -1
- package/public/assets/reset-tzTSqiOS.js +2 -0
- package/public/assets/{reset-C5vUVgr_.js.map → reset-tzTSqiOS.js.map} +1 -1
- package/public/assets/{select-DqZynXSt.js → select-D2H87qXJ.js} +2 -2
- package/public/assets/{select-DqZynXSt.js.map → select-D2H87qXJ.js.map} +1 -1
- package/public/assets/select-tzTSqiOS.js +2 -0
- package/public/assets/{select-C5vUVgr_.js.map → select-tzTSqiOS.js.map} +1 -1
- package/public/assets/separator-B0Bvh1he.js.map +1 -1
- package/public/assets/shell-header-bar-BPgCjFPv.js +2 -0
- package/public/assets/shell-header-bar-BPgCjFPv.js.map +1 -0
- package/public/assets/{terms-BHDAgn-H.js → terms-D5rfQhog.js} +2 -2
- package/public/assets/{terms-BHDAgn-H.js.map → terms-D5rfQhog.js.map} +1 -1
- package/public/assets/{terms-B5NaJfeS.js → terms-DVjIWt8X.js} +2 -2
- package/public/assets/{terms-B5NaJfeS.js.map → terms-DVjIWt8X.js.map} +1 -1
- package/public/assets/{terms-checkbox-list-6jteUTIZ.js → terms-checkbox-list-BKJcS2pJ.js} +2 -2
- package/public/assets/{terms-checkbox-list-6jteUTIZ.js.map → terms-checkbox-list-BKJcS2pJ.js.map} +1 -1
- package/public/assets/{totp-ECvOUcFx.js → totp-BbQi-gsF.js} +2 -2
- package/public/assets/{totp-ECvOUcFx.js.map → totp-BbQi-gsF.js.map} +1 -1
- package/public/assets/{totp-CJtfVNEq.js → totp-wY0Zji8E.js} +2 -2
- package/public/assets/{totp-CJtfVNEq.js.map → totp-wY0Zji8E.js.map} +1 -1
- package/public/assets/{use-totp-setup-BbS3XcZA.js → use-totp-setup-OH_GTMxA.js} +3 -3
- package/public/assets/{use-totp-setup-BbS3XcZA.js.map → use-totp-setup-OH_GTMxA.js.map} +1 -1
- package/public/assets/{useAriaLabelledBy-ByuMi3Ry.js → useAriaLabelledBy-9o83pv9X.js} +2 -2
- package/public/assets/{useAriaLabelledBy-ByuMi3Ry.js.map → useAriaLabelledBy-9o83pv9X.js.map} +1 -1
- package/public/assets/useQuery-CI5Ukuae.js +2 -0
- package/public/assets/{useQuery-Ckxjmvtl.js.map → useQuery-CI5Ukuae.js.map} +1 -1
- package/public/assets/users-DqCnblEo.js +2 -0
- package/public/assets/users-DqCnblEo.js.map +1 -0
- package/public/index.html +2 -2
- package/public/assets/2fa-C5vUVgr_.js +0 -2
- package/public/assets/2fa-CCOTIHDZ.js +0 -2
- package/public/assets/DialogHandle-BmtK2pRn.js +0 -2
- package/public/assets/admin-BPijkLw-.js +0 -2
- package/public/assets/admin-BPijkLw-.js.map +0 -1
- package/public/assets/auth-layout-VtpryDof.js +0 -2
- package/public/assets/auth-layout-VtpryDof.js.map +0 -1
- package/public/assets/auth-page-header-CIn2E4zI.js.map +0 -1
- package/public/assets/authorization-context-banner-SOuBHWIb.js +0 -2
- package/public/assets/authorization-context-banner-SOuBHWIb.js.map +0 -1
- package/public/assets/checkbox-gdHnSFQ-.js +0 -2
- package/public/assets/email-C5vUVgr_.js +0 -2
- package/public/assets/field-Cn4H1CUj.js +0 -3
- package/public/assets/forgot-C5vUVgr_.js +0 -2
- package/public/assets/login-C5vUVgr_.js +0 -2
- package/public/assets/passkey-C5vUVgr_.js +0 -2
- package/public/assets/password-C5vUVgr_.js +0 -2
- package/public/assets/pin-input-Cc-VkrQ3.js +0 -2
- package/public/assets/profile-BcjsVYOx.js +0 -2
- package/public/assets/profile-BcjsVYOx.js.map +0 -1
- package/public/assets/register-C5vUVgr_.js +0 -2
- package/public/assets/reset-C5vUVgr_.js +0 -2
- package/public/assets/select-C5vUVgr_.js +0 -2
- package/public/assets/shell-header-bar-CjG5qvPg.js +0 -2
- package/public/assets/shell-header-bar-CjG5qvPg.js.map +0 -1
- package/public/assets/useQuery-Ckxjmvtl.js +0 -2
- package/public/assets/users-CmFxrCQT.js +0 -2
- package/public/assets/users-CmFxrCQT.js.map +0 -1
|
@@ -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,EAA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OAAO,EAAA,EAClD,MAAM,CACpB,CACF,GACA,CAAC,CACH,EAEA,IAAM,GAAA,EAAA,EAAA,YAAA,CACH,GAAqB,CACpB,EAAiB,CAAQ,EACzB,IAAW,CAAQ,CACrB,EACA,CAAC,CAAQ,CACX,EAEM,GAAA,EAAA,EAAA,YAAA,CACH,GAA2B,CAC1B,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
|
+
{"version":3,"file":"pin-input-DdhzDNy9.js","names":["_formatErrorMessage","REASONS.inputChange","REASONS.inputClear","REASONS.keyboard","REASONS.inputPaste","OTPField.Input","OTPField.Root"],"sources":["../../../../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@base-ui/react/otp-field/root/OTPFieldRootContext.mjs","../../../../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@base-ui/react/otp-field/utils/stateAttributesMapping.mjs","../../../../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@base-ui/react/otp-field/utils/otp.mjs","../../../../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@base-ui/react/otp-field/root/OTPFieldRoot.mjs","../../../../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@base-ui/react/otp-field/input/OTPFieldInput.mjs","../../../../node_modules/.pnpm/@tinyrack+ui@0.27.1_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7_shiki@4.4.2_tailwindcss@4.3.2/node_modules/@tinyrack/ui/dist/components/otp-field/otp-field-input.js","../../../../node_modules/.pnpm/@tinyrack+ui@0.27.1_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7_shiki@4.4.2_tailwindcss@4.3.2/node_modules/@tinyrack/ui/dist/components/otp-field/otp-field-root.js","../../../../node_modules/.pnpm/@tinyrack+ui@0.27.1_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7_shiki@4.4.2_tailwindcss@4.3.2/node_modules/@tinyrack/ui/dist/components/otp-field/otp-field-separator.js","../../../../node_modules/.pnpm/@tinyrack+ui@0.27.1_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7_shiki@4.4.2_tailwindcss@4.3.2/node_modules/@tinyrack/ui/dist/components/otp-field/index.js","../../../frontend/src/components/ui/pin-input.tsx"],"sourcesContent":["'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const OTPFieldRootContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") OTPFieldRootContext.displayName = \"OTPFieldRootContext\";\nexport function useOTPFieldRootContext() {\n const context = React.useContext(OTPFieldRootContext);\n if (context === undefined) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: OTPFieldRootContext is missing. OTPField parts must be placed within <OTPField.Root>.' : _formatErrorMessage(98));\n }\n return context;\n}\nexport function getOTPFieldInputState(state, value, index) {\n return {\n ...state,\n value,\n index,\n filled: value !== ''\n };\n}","import { fieldValidityMapping } from \"../../internals/field-constants/constants.mjs\";\nexport const rootStateAttributesMapping = {\n value: () => null,\n length: () => null,\n ...fieldValidityMapping\n};\nexport const inputStateAttributesMapping = {\n value: () => null,\n index: () => null,\n ...fieldValidityMapping\n};","const OTP_VALIDATION_CONFIG = {\n numeric: {\n slotPattern: '\\\\d{1}',\n getRootPattern: length => `\\\\d{${length}}`,\n regexp: /[^\\d]/g,\n inputMode: 'numeric'\n },\n alpha: {\n slotPattern: '[a-zA-Z]{1}',\n getRootPattern: length => `[a-zA-Z]{${length}}`,\n regexp: /[^a-zA-Z]/g,\n inputMode: 'text'\n },\n alphanumeric: {\n slotPattern: '[a-zA-Z0-9]{1}',\n getRootPattern: length => `[a-zA-Z0-9]{${length}}`,\n regexp: /[^a-zA-Z0-9]/g,\n inputMode: 'text'\n }\n};\nexport function getOTPValidationConfig(validationType) {\n if (validationType === 'none') {\n return null;\n }\n return OTP_VALIDATION_CONFIG[validationType];\n}\nexport function stripOTPWhitespace(value) {\n return (value ?? '').replace(/\\s/g, '');\n}\nfunction applyOTPValidation(value, validation) {\n return validation ? value.replace(validation.regexp, '') : value;\n}\n\n/**\n * Normalizes user-entered OTP text by stripping whitespace, applying validation and custom\n * normalization, and clamping the final value to the configured slot count.\n */\nexport function normalizeOTPValueWithDetails(value, length, validationType, normalizeValue) {\n const strippedValue = stripOTPWhitespace(value);\n const validation = getOTPValidationConfig(validationType);\n let normalizedValue = applyOTPValidation(strippedValue, validation);\n let didRejectCharacters = strippedValue.length > normalizedValue.length;\n if (normalizeValue) {\n const customNormalizedValue = normalizeValue(normalizedValue);\n didRejectCharacters ||= normalizedValue.length > customNormalizedValue.length;\n normalizedValue = applyOTPValidation(customNormalizedValue, validation);\n didRejectCharacters ||= customNormalizedValue.length > normalizedValue.length;\n }\n\n // Slice by Unicode code points so multi-byte characters do not split across OTP slots.\n const maxLength = length < 0 ? 0 : length;\n const normalizedCharacters = Array.from(normalizedValue);\n return [normalizedCharacters.slice(0, maxLength).join(''), didRejectCharacters || normalizedCharacters.length > maxLength];\n}\nexport function normalizeOTPValue(value, length, validationType, normalizeValue) {\n return normalizeOTPValueWithDetails(value, length, validationType, normalizeValue)[0];\n}\n\n/**\n * Replaces characters starting at the provided slot index, then re-normalizes the final OTP value\n * so paste and multi-character edits stay contiguous and length-bounded.\n */\nexport function replaceOTPValue(currentValue, index, nextValue, length, validationType, normalizeValue) {\n const normalizedValue = normalizeOTPValue(nextValue, length, validationType, normalizeValue);\n const prefix = currentValue.slice(0, index);\n const suffix = currentValue.slice(index + normalizedValue.length);\n return normalizeOTPValue(`${prefix}${normalizedValue}${suffix}`, length, validationType, normalizeValue);\n}\nexport function removeOTPCharacter(currentValue, index) {\n if (index < 0 || index >= currentValue.length) {\n return currentValue;\n }\n return `${currentValue.slice(0, index)}${currentValue.slice(index + 1)}`;\n}","'use client';\n\nimport * as React from 'react';\nimport { SafeReact } from '@base-ui/utils/safeReact';\nimport { useControlled } from '@base-ui/utils/useControlled';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useValueAsRef } from '@base-ui/utils/useValueAsRef';\nimport { visuallyHidden, visuallyHiddenInput } from '@base-ui/utils/visuallyHidden';\nimport { warn } from '@base-ui/utils/warn';\nimport { ownerDocument } from '@base-ui/utils/owner';\nimport { contains } from \"../../floating-ui-react/utils.mjs\";\nimport { CompositeList } from \"../../internals/composite/list/CompositeList.mjs\";\nimport { useFieldRootContext } from \"../../internals/field-root-context/FieldRootContext.mjs\";\nimport { useRegisterFieldControl } from \"../../internals/field-register-control/useRegisterFieldControl.mjs\";\nimport { useFormContext } from \"../../internals/form-context/FormContext.mjs\";\nimport { useLabelableContext } from \"../../internals/labelable-provider/LabelableContext.mjs\";\nimport { useAriaLabelledBy } from \"../../internals/labelable-provider/useAriaLabelledBy.mjs\";\nimport { useLabelableId } from \"../../internals/labelable-provider/useLabelableId.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useValueChanged } from \"../../internals/useValueChanged.mjs\";\nimport { createChangeEventDetails, createGenericEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { OTPFieldRootContext } from \"./OTPFieldRootContext.mjs\";\nimport { rootStateAttributesMapping } from \"../utils/stateAttributesMapping.mjs\";\nimport { getOTPValidationConfig, normalizeOTPValue, normalizeOTPValueWithDetails } from \"../utils/otp.mjs\";\n\n/**\n * Groups all OTP field parts and manages their state.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI OTP Field](https://base-ui.com/react/components/otp-field)\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport const OTPFieldRoot = /*#__PURE__*/React.forwardRef(function OTPFieldRoot(componentProps, forwardedRef) {\n const {\n 'aria-describedby': ariaDescribedByProp,\n 'aria-labelledby': ariaLabelledByProp,\n id: idProp,\n autoComplete = 'one-time-code',\n defaultValue,\n value: valueProp,\n onValueChange,\n onValueComplete: onValueCompleteProp,\n form,\n length,\n autoSubmit = false,\n mask = false,\n inputMode: inputModeProp,\n validationType = 'numeric',\n normalizeValue,\n disabled: disabledProp = false,\n readOnly = false,\n required = false,\n name: nameProp,\n onValueInvalid,\n render,\n className,\n style,\n ...elementProps\n } = componentProps;\n const {\n setDirty,\n validityData,\n disabled: fieldDisabled,\n setFilled,\n invalid,\n name: fieldName,\n state: fieldState,\n validation,\n validationMode,\n setFocused,\n setTouched\n } = useFieldRootContext();\n const {\n clearErrors\n } = useFormContext();\n const {\n getDescriptionProps,\n labelId\n } = useLabelableContext();\n const disabled = fieldDisabled || disabledProp;\n const name = fieldName ?? nameProp;\n const [valueUnwrapped, setValueUnwrapped] = useControlled({\n controlled: valueProp,\n default: defaultValue,\n name: 'OTPField',\n state: 'value'\n });\n const rootRef = React.useRef(null);\n const inputRefs = React.useRef([]);\n const pendingFocusRef = React.useRef(null);\n const pendingCompleteValueRef = React.useRef(null);\n const firstInputRef = React.useMemo(() => ({\n get current() {\n return inputRefs.current[0] ?? null;\n }\n }), []);\n const id = useLabelableId({\n id: idProp\n });\n const ariaLabelledBy = useAriaLabelledBy(ariaLabelledByProp, labelId, firstInputRef, true, id);\n const inputAriaLabelledBy = ariaLabelledByProp == null ? ariaLabelledBy : undefined;\n const fieldDescriptionProps = getDescriptionProps({});\n const ariaDescribedBy = mergeAriaIds(ariaDescribedByProp, fieldDescriptionProps['aria-describedby']);\n const validationConfig = getOTPValidationConfig(validationType);\n const pattern = validationConfig?.slotPattern;\n const hiddenInputPattern = validationConfig?.getRootPattern(length);\n const inputMode = inputModeProp ?? validationConfig?.inputMode;\n const hasValidLength = Number.isInteger(length) && length > 0;\n const value = normalizeOTPValue(valueUnwrapped, length, validationType, normalizeValue);\n const valueRef = useValueAsRef(value);\n const filled = value !== '';\n const [inputCount, setInputCount] = React.useState(0);\n const [focusedIndex, setFocusedIndex] = React.useState(() => Math.min(value.length, length - 1));\n const [focused, setFocusedState] = React.useState(false);\n const activeIndex = focused ? Math.min(focusedIndex, Math.max(length - 1, 0)) : Math.min(value.length, length - 1);\n useIsoLayoutEffect(() => {\n setFilled(filled);\n }, [filled, setFilled]);\n\n /* istanbul ignore else -- `process.env.NODE_ENV` is a build-time constant under test */\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useOTPFieldRootDevWarnings({\n inputCount,\n length\n });\n }\n useRegisterFieldControl(firstInputRef, id, value, undefined, !disabled, nameProp);\n const focusInput = useStableCallback(index => {\n const targetIndex = Math.min(Math.max(index, 0), Math.max(inputRefs.current.length - 1, 0));\n const target = inputRefs.current[targetIndex];\n target?.focus();\n target?.select();\n });\n const queueFocusInput = useStableCallback((index, nextValue) => {\n pendingFocusRef.current = {\n index,\n value: nextValue\n };\n });\n function requestSubmit() {\n // The hidden validation input only renders for a valid `length`, but the slots always do,\n // so fall back to the owning form of the first slot.\n let formElement = validation.inputRef.current?.form ?? inputRefs.current[0]?.form ?? null;\n if (form) {\n const associatedElement = ownerDocument(rootRef.current).getElementById(form);\n if (associatedElement?.tagName === 'FORM') {\n formElement = associatedElement;\n }\n }\n if (formElement && typeof formElement.requestSubmit === 'function') {\n formElement.requestSubmit();\n }\n }\n function completeValue(completedValue, eventDetails) {\n onValueCompleteProp?.(completedValue, eventDetails);\n if (autoSubmit) {\n requestSubmit();\n }\n }\n useValueChanged(value, () => {\n clearErrors(name);\n setDirty(value !== validityData.initialValue);\n validation.change(value);\n const pendingFocus = pendingFocusRef.current;\n if (pendingFocus != null) {\n pendingFocusRef.current = null;\n if (pendingFocus.value === value) {\n focusInput(pendingFocus.index);\n }\n }\n const pendingCompleteValue = pendingCompleteValueRef.current;\n if (pendingCompleteValue != null) {\n pendingCompleteValueRef.current = null;\n if (pendingCompleteValue.value === value) {\n completeValue(value, pendingCompleteValue.eventDetails);\n }\n }\n });\n const setValue = useStableCallback((nextValue, details) => {\n const normalizedValue = normalizeOTPValue(nextValue, length, validationType, normalizeValue);\n const canComplete = details.reason === REASONS.inputChange || details.reason === REASONS.inputPaste;\n const completeEventDetails = canComplete && normalizedValue.length === length && (valueRef.current.length !== length || details.reason === REASONS.inputPaste) ? createGenericEventDetails(details.reason, details.event) : null;\n if (normalizedValue === valueRef.current) {\n if (completeEventDetails != null) {\n completeValue(normalizedValue, completeEventDetails);\n }\n return null;\n }\n onValueChange?.(normalizedValue, details);\n if (details.isCanceled) {\n return null;\n }\n setValueUnwrapped(normalizedValue);\n if (completeEventDetails != null) {\n pendingCompleteValueRef.current = {\n value: normalizedValue,\n eventDetails: completeEventDetails\n };\n } else if (normalizedValue.length !== length) {\n pendingCompleteValueRef.current = null;\n }\n return normalizedValue;\n });\n const reportValueInvalid = useStableCallback((invalidValue, details) => {\n onValueInvalid?.(invalidValue, details);\n });\n const handleInputFocus = useStableCallback((index, event) => {\n if (index > valueRef.current.length) {\n focusInput(Math.min(valueRef.current.length, length - 1));\n return;\n }\n setFocusedIndex(index);\n setFocusedState(true);\n setFocused(true);\n event.currentTarget.select();\n });\n const handleInputBlur = useStableCallback(event => {\n if (contains(rootRef.current, event.relatedTarget)) {\n return;\n }\n setTouched(true);\n setFocusedState(false);\n setFocused(false);\n if (validationMode === 'onBlur') {\n validation.commit(valueRef.current);\n }\n });\n const getInputId = React.useCallback(index => {\n if (id == null) {\n return undefined;\n }\n return index === 0 ? id : `${id}-${index + 1}`;\n }, [id]);\n const state = React.useMemo(() => ({\n ...fieldState,\n complete: value.length === length,\n disabled,\n filled,\n focused,\n length,\n readOnly,\n required,\n value\n }), [disabled, fieldState, filled, focused, length, readOnly, required, value]);\n const contextValue = React.useMemo(() => ({\n autoComplete,\n activeIndex,\n disabled,\n form,\n focusInput,\n queueFocusInput,\n getInputId,\n handleInputBlur,\n handleInputFocus,\n inputMode,\n inputAriaLabelledBy,\n invalid,\n length,\n mask,\n pattern,\n reportValueInvalid,\n readOnly,\n required,\n normalizeValue,\n setValue,\n state,\n validationType,\n value\n }), [activeIndex, autoComplete, disabled, focusInput, form, getInputId, handleInputBlur, handleInputFocus, inputMode, inputAriaLabelledBy, invalid, length, mask, pattern, queueFocusInput, readOnly, reportValueInvalid, required, normalizeValue, setValue, state, validationType, value]);\n const element = useRenderElement('div', componentProps, {\n ref: [forwardedRef, rootRef],\n state,\n props: [{\n role: 'group',\n 'aria-describedby': ariaDescribedBy,\n 'aria-labelledby': ariaLabelledBy\n }, elementProps],\n stateAttributesMapping: rootStateAttributesMapping\n });\n return /*#__PURE__*/_jsx(CompositeList, {\n elementsRef: inputRefs,\n onMapChange: newMap => {\n setInputCount(newMap.size);\n },\n children: /*#__PURE__*/_jsxs(OTPFieldRootContext.Provider, {\n value: contextValue,\n children: [element, hasValidLength && /*#__PURE__*/_jsx(\"input\", {\n ...validation.getValidationProps(disabled, {\n onFocus() {\n focusInput(0);\n },\n onChange(event) {\n if (event.nativeEvent.defaultPrevented || disabled || readOnly) {\n return;\n }\n const rawValue = event.currentTarget.value;\n const [normalizedValue, didRejectCharacters] = normalizeOTPValueWithDetails(rawValue, length, validationType, normalizeValue);\n if (didRejectCharacters) {\n reportValueInvalid(rawValue, createGenericEventDetails(REASONS.inputChange, event.nativeEvent));\n }\n const committedValue = setValue(normalizedValue, createChangeEventDetails(REASONS.inputChange, event.nativeEvent));\n if (committedValue != null && committedValue !== '') {\n queueFocusInput(committedValue.length - 1, committedValue);\n }\n }\n }),\n ref: validation.inputRef,\n type: \"text\",\n id: id && name == null ? `${id}-hidden-input` : undefined,\n form: form,\n name: name,\n value: value,\n autoComplete: autoComplete,\n inputMode: inputMode,\n minLength: length,\n maxLength: length,\n pattern: hiddenInputPattern,\n disabled: disabled,\n readOnly: readOnly,\n required: required,\n \"aria-hidden\": true,\n tabIndex: -1,\n style: name ? visuallyHiddenInput : visuallyHidden\n })]\n })\n });\n});\nif (process.env.NODE_ENV !== \"production\") OTPFieldRoot.displayName = \"OTPFieldRoot\";\nfunction mergeAriaIds(...values) {\n const ids = values.flatMap(value => value?.split(/\\s+/).filter(Boolean) ?? []);\n return ids.length > 0 ? Array.from(new Set(ids)).join(' ') : undefined;\n}\nfunction useOTPFieldRootDevWarnings(parameters) {\n const {\n inputCount,\n length\n } = parameters;\n React.useEffect(() => {\n if (!Number.isInteger(length) || length <= 0 || inputCount === 0 || inputCount === length) {\n return;\n }\n const ownerStackMessage = SafeReact.captureOwnerStack?.() || '';\n const message = '<OTPField.Root> `length` must match the number of rendered ' + `<OTPField.Input /> parts. Received \\`length={${length}}\\` but rendered ` + `${inputCount} input${inputCount === 1 ? '' : 's'}.`;\n warn(message, ownerStackMessage);\n }, [inputCount, length]);\n React.useEffect(() => {\n if (Number.isInteger(length) && length > 0) {\n return;\n }\n const ownerStackMessage = SafeReact.captureOwnerStack?.() || '';\n warn(`<OTPField.Root> \\`length\\` must be a positive integer. Received \\`length={${String(length)}}\\`.`, ownerStackMessage);\n }, [length]);\n}","'use client';\n\nimport * as React from 'react';\nimport { SafeReact } from '@base-ui/utils/safeReact';\nimport { warn } from '@base-ui/utils/warn';\nimport { stopEvent } from \"../../floating-ui-react/utils.mjs\";\nimport { useCompositeListItem } from \"../../internals/composite/list/useCompositeListItem.mjs\";\nimport { useDirection } from \"../../internals/direction-context/DirectionContext.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { createChangeEventDetails, createGenericEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { useOTPFieldRootContext, getOTPFieldInputState } from \"../root/OTPFieldRootContext.mjs\";\nimport { inputStateAttributesMapping } from \"../utils/stateAttributesMapping.mjs\";\nimport { normalizeOTPValueWithDetails, removeOTPCharacter, replaceOTPValue } from \"../utils/otp.mjs\";\n\n/**\n * An individual OTP character input.\n * Renders an `<input>` element.\n *\n * Documentation: [Base UI OTP Field](https://base-ui.com/react/components/otp-field)\n */\nexport const OTPFieldInput = /*#__PURE__*/React.forwardRef(function OTPFieldInput(componentProps, forwardedRef) {\n const {\n 'aria-label': externalAriaLabel,\n 'aria-labelledby': externalAriaLabelledBy,\n render,\n className,\n style,\n ...elementProps\n } = componentProps;\n const {\n activeIndex,\n autoComplete,\n disabled,\n form,\n focusInput,\n queueFocusInput,\n getInputId,\n handleInputBlur,\n handleInputFocus,\n inputMode,\n inputAriaLabelledBy,\n invalid,\n length,\n mask,\n pattern,\n reportValueInvalid,\n readOnly,\n required,\n normalizeValue,\n setValue,\n state,\n validationType,\n value\n } = useOTPFieldRootContext();\n const {\n ref: listItemRef,\n index\n } = useCompositeListItem({\n guess: true\n });\n const inputRef = React.useRef(null);\n const direction = useDirection();\n const slotValue = value[index] ?? '';\n const inputState = getOTPFieldInputState(state, slotValue, index);\n const slotAriaLabel = externalAriaLabel;\n const inheritedLabel = externalAriaLabelledBy ?? inputAriaLabelledBy;\n const ariaLabel = index === 0 ? undefined : slotAriaLabel;\n\n /* istanbul ignore else -- `process.env.NODE_ENV` is a build-time constant under test */\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n if (index !== 0 || slotAriaLabel == null || inputRef.current?.labels?.length) {\n return;\n }\n const ownerStackMessage = SafeReact.captureOwnerStack?.() || '';\n warn('<OTPField.Input> ignores `aria-label` on the first input. Use a `<label>` or `<Field.Label>` to label the OTP field.', ownerStackMessage);\n }, [index, slotAriaLabel]);\n }\n const inputProps = {\n id: getInputId(index),\n value: slotValue,\n type: mask ? 'password' : 'text',\n inputMode,\n autoComplete: index === 0 ? autoComplete : 'off',\n autoCorrect: 'off',\n spellCheck: 'false',\n enterKeyHint: index === length - 1 ? 'done' : 'next',\n // Only the first slot has a max length to avoid password manager bubbles appearing after later inputs.\n maxLength: index === 0 ? length : undefined,\n tabIndex: activeIndex === index ? 0 : -1,\n disabled,\n form,\n pattern,\n readOnly,\n required,\n 'aria-labelledby': ariaLabel == null ? inheritedLabel : undefined,\n 'aria-invalid': !disabled && invalid ? true : undefined,\n 'aria-label': ariaLabel,\n onMouseDown(event) {\n if (event.defaultPrevented || disabled) {\n return;\n }\n event.preventDefault();\n focusInput(index);\n },\n onFocus(event) {\n if (event.defaultPrevented || disabled) {\n return;\n }\n handleInputFocus(index, event);\n },\n onBlur(event) {\n if (event.defaultPrevented) {\n return;\n }\n handleInputBlur(event);\n },\n onChange(event) {\n if (event.defaultPrevented || disabled || readOnly) {\n return;\n }\n const rawValue = event.currentTarget.value;\n const [nextDigits, didRejectCharacters] = normalizeOTPValueWithDetails(rawValue, length, validationType, normalizeValue);\n if (didRejectCharacters) {\n reportValueInvalid(rawValue, createGenericEventDetails(REASONS.inputChange, event.nativeEvent));\n }\n if (nextDigits === '') {\n if (rawValue === '') {\n setValue(removeOTPCharacter(value, index), createChangeEventDetails(REASONS.inputClear, event.nativeEvent));\n } else if (slotValue !== '') {\n event.currentTarget.value = slotValue;\n event.currentTarget.select();\n }\n return;\n }\n const nextValue = replaceOTPValue(value, index, nextDigits, length, validationType, normalizeValue);\n const committedValue = setValue(nextValue, createChangeEventDetails(REASONS.inputChange, event.nativeEvent));\n if (committedValue != null) {\n const nextInput = Math.min(index + nextDigits.length, length - 1);\n queueFocusInput(nextInput, committedValue);\n }\n },\n onKeyDown(event) {\n if (event.defaultPrevented || disabled) {\n return;\n }\n const firstIndex = 0;\n const lastIndex = Math.max(length - 1, firstIndex);\n const endTargetIndex = Math.min(value.length, lastIndex);\n const hasBoundaryModifier = (event.ctrlKey || event.metaKey) && !event.altKey;\n const isRtl = direction === 'rtl';\n const previousKey = isRtl ? 'ArrowRight' : 'ArrowLeft';\n const nextKey = isRtl ? 'ArrowLeft' : 'ArrowRight';\n if (event.key === previousKey) {\n stopEvent(event);\n focusInput(hasBoundaryModifier ? firstIndex : Math.max(firstIndex, index - 1));\n return;\n }\n if (event.key === nextKey) {\n stopEvent(event);\n focusInput(hasBoundaryModifier ? endTargetIndex : Math.min(lastIndex, index + 1));\n return;\n }\n if (event.key === 'Home' || event.key === 'ArrowUp') {\n stopEvent(event);\n focusInput(firstIndex);\n return;\n }\n if (event.key === 'End' || event.key === 'ArrowDown') {\n stopEvent(event);\n focusInput(endTargetIndex);\n return;\n }\n if (readOnly) {\n return;\n }\n function setKeyboardValue(nextValue, targetIndex) {\n const committedValue = setValue(nextValue, createChangeEventDetails(REASONS.keyboard, event.nativeEvent));\n if (committedValue != null) {\n queueFocusInput(targetIndex, committedValue);\n }\n }\n if (event.key === 'Backspace' && hasBoundaryModifier) {\n stopEvent(event);\n setKeyboardValue('', firstIndex);\n return;\n }\n if (event.key === 'Delete') {\n stopEvent(event);\n setKeyboardValue(removeOTPCharacter(value, index), index);\n return;\n }\n const inputValue = event.currentTarget.value;\n const fullSelection = event.currentTarget.selectionStart === 0 && event.currentTarget.selectionEnd === inputValue.length;\n if (event.key.length === 1 && fullSelection && slotValue === event.key) {\n stopEvent(event);\n if (index < length - 1) {\n focusInput(index + 1);\n }\n return;\n }\n if (event.key === 'Backspace') {\n stopEvent(event);\n const targetIndex = Math.max(firstIndex, index - 1);\n const deleteIndex = slotValue === '' ? targetIndex : index;\n setKeyboardValue(removeOTPCharacter(value, deleteIndex), targetIndex);\n }\n },\n onPaste(event) {\n if (event.defaultPrevented || disabled || readOnly) {\n return;\n }\n let rawValue = '';\n try {\n rawValue = event.clipboardData?.getData('text/plain') ?? '';\n } catch {\n /* istanbul ignore else -- `process.env.NODE_ENV` is a build-time constant under test */\n if (process.env.NODE_ENV !== 'production') {\n const ownerStackMessage = SafeReact.captureOwnerStack?.() || '';\n warn('<OTPField.Input> could not read clipboard text during paste handling.', ownerStackMessage);\n }\n return;\n }\n event.preventDefault();\n const [nextDigits, didRejectCharacters] = normalizeOTPValueWithDetails(rawValue, length, validationType, normalizeValue);\n if (didRejectCharacters) {\n reportValueInvalid(rawValue, createGenericEventDetails(REASONS.inputPaste, event.nativeEvent));\n }\n if (nextDigits === '') {\n return;\n }\n const committedValue = setValue(replaceOTPValue(value, index, nextDigits, length, validationType, normalizeValue), createChangeEventDetails(REASONS.inputPaste, event.nativeEvent));\n if (committedValue != null) {\n const nextInput = Math.min(index + nextDigits.length, length - 1);\n queueFocusInput(nextInput, committedValue);\n }\n }\n };\n const element = useRenderElement('input', componentProps, {\n ref: [forwardedRef, listItemRef, inputRef],\n state: inputState,\n props: [inputProps, elementProps],\n stateAttributesMapping: inputStateAttributesMapping\n });\n return element;\n});\nif (process.env.NODE_ENV !== \"production\") OTPFieldInput.displayName = \"OTPFieldInput\";","\"use client\";\nimport { createComponentPart } from \"../../internal/component-part.js\";\nimport { OTPField } from \"@base-ui/react/otp-field\";\n//#region src/components/otp-field/otp-field-input.tsx\nconst TROTPFieldInput = createComponentPart(OTPField.Input, \"tr-otp-field-digit\", { tracksFocusModality: true });\n//#endregion\nexport { TROTPFieldInput };\n\n//# sourceMappingURL=otp-field-input.js.map","\"use client\";\nimport { mergeComponentClassName } from \"../../internal/component-class-name.js\";\nimport { jsx } from \"react/jsx-runtime\";\nimport { OTPField } from \"@base-ui/react/otp-field\";\n//#region src/components/otp-field/otp-field-root.tsx\nfunction TROTPFieldRoot({ appearance = \"solid\", className, uiSize = \"md\", ...props }) {\n\treturn /* @__PURE__ */ jsx(OTPField.Root, {\n\t\t...props,\n\t\tclassName: mergeComponentClassName(\"tr-otp-field\", className),\n\t\t\"data-appearance\": appearance,\n\t\t\"data-ui-size\": uiSize\n\t});\n}\n//#endregion\nexport { TROTPFieldRoot };\n\n//# sourceMappingURL=otp-field-root.js.map","import { mergeComponentClassName } from \"../../internal/component-class-name.js\";\nimport { TRSeparator } from \"../separator/separator.js\";\nimport { jsx } from \"react/jsx-runtime\";\n//#region src/components/otp-field/otp-field-separator.tsx\nfunction TROTPFieldSeparator({ className, orientation = \"vertical\", ...props }) {\n\treturn /* @__PURE__ */ jsx(TRSeparator, {\n\t\t...props,\n\t\tclassName: mergeComponentClassName(\"tr-otp-field-separator\", className),\n\t\torientation\n\t});\n}\n//#endregion\nexport { TROTPFieldSeparator };\n\n//# sourceMappingURL=otp-field-separator.js.map","import { TROTPFieldInput } from \"./otp-field-input.js\";\nimport { TROTPFieldRoot } from \"./otp-field-root.js\";\nimport { TROTPFieldSeparator } from \"./otp-field-separator.js\";\n//#region src/components/otp-field/index.tsx\nconst TROTPField = {\n\tRoot: TROTPFieldRoot,\n\tInput: TROTPFieldInput,\n\tSeparator: TROTPFieldSeparator\n};\n//#endregion\nexport { TROTPField, TROTPFieldInput, TROTPFieldRoot, TROTPFieldSeparator };\n\n//# sourceMappingURL=index.js.map","import { TRField } from '@tinyrack/ui/components/field';\nimport { TROTPField } from '@tinyrack/ui/components/otp-field';\nimport {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useImperativeHandle,\n useRef,\n useState,\n} from 'react';\nimport type { FieldError } from 'react-hook-form';\nimport { useTranslation } from 'react-i18next';\n\nexport type PinInputRef = {\n focus: () => void;\n clear: () => void;\n};\n\ntype PinInputProps = {\n length?: number;\n error?: FieldError;\n disabled?: boolean;\n onComplete?: (value: string) => void;\n onChange?: (value: string) => void;\n value?: string;\n autoFocus?: boolean;\n className?: string;\n};\n\nexport const PinInput = forwardRef<PinInputRef, PinInputProps>(\n function PinInput(\n {\n length = 6,\n error,\n disabled = false,\n onComplete,\n onChange,\n value: controlledValue,\n autoFocus = false,\n className = '',\n },\n ref,\n ) {\n const { t } = useTranslation();\n const otpId = useId();\n const containerRef = useRef<HTMLDivElement>(null);\n const [internalValue, setInternalValue] = useState(controlledValue ?? '');\n\n useEffect(() => {\n if (controlledValue !== undefined) {\n setInternalValue(controlledValue);\n }\n }, [controlledValue]);\n\n useImperativeHandle(\n ref,\n () => ({\n focus: () => {\n const firstInput = containerRef.current?.querySelector('input');\n firstInput?.focus();\n },\n clear: () => {\n setInternalValue('');\n const firstInput = containerRef.current?.querySelector('input');\n firstInput?.focus();\n },\n }),\n [],\n );\n\n const handleValueChange = useCallback(\n (newValue: string) => {\n setInternalValue(newValue);\n onChange?.(newValue);\n },\n [onChange],\n );\n\n const handleValueComplete = useCallback(\n (completedValue: string) => {\n onComplete?.(completedValue);\n },\n [onComplete],\n );\n\n return (\n <TRField.Root className={className} ref={containerRef}>\n {/*\n A real label, not `aria-label`: Base UI deliberately ignores\n `aria-label` on the first OTP input and warns to use a label instead,\n because that input is also the one password managers autofill.\n Visually hidden — the screen's own heading already says what the code\n is, so showing it twice would be noise.\n */}\n <TRField.Label className=\"sr-only\" htmlFor={otpId}>\n {t('common.otp.label')}\n </TRField.Label>\n <TROTPField.Root\n disabled={disabled}\n /*\n * Base UI gives the first slot the root's own id and derives the\n * rest from it, so naming the root is what lets the label point at\n * a real input rather than at the wrapping group.\n */\n id={otpId}\n length={length}\n onValueChange={handleValueChange}\n onValueComplete={handleValueComplete}\n uiSize=\"md\"\n validationType=\"numeric\"\n value={internalValue}\n >\n {/*\n Each box is a separate input, so each needs to say which position\n it is. Two Base UI behaviours shape this: the first box ignores\n `aria-label` outright (it is the one password managers autofill, so\n it takes the field's own label), and on the rest an `aria-label`\n *replaces* the inherited field name rather than adding to it. So\n the field name is folded into the per-box string, and box one is\n left to the label above.\n */}\n {Array.from({ length }, (_, index) => (\n <TROTPField.Input\n aria-label={\n index === 0\n ? undefined\n : t('common.otp.digit', {\n label: t('common.otp.label'),\n position: index + 1,\n total: length,\n })\n }\n autoFocus={autoFocus && index === 0}\n key={index}\n />\n ))}\n </TROTPField.Root>\n {error && (\n <p\n className=\"mt-tinyrack-sm text-center text-tinyrack-danger-foreground text-tinyrack-sm\"\n data-testid=\"pin-input-error\"\n >\n {error.message}\n </p>\n )}\n </TRField.Root>\n );\n },\n);\n\nexport default PinInput;\n"],"x_google_ignoreList":[0,1,2,3,4,5,6,7,8],"mappings":"ygBAIa,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,aAA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N,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,8EACV,cAAY,2BAEX,EAAM,OACN,CAAA,CAEO,GAElB,CACF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{q as e}from"./createLucideIcon-BPpAIXR_.js";import{I as t}from"./index-
|
|
2
|
-
//# sourceMappingURL=profile-
|
|
1
|
+
import{q as e}from"./createLucideIcon-BPpAIXR_.js";import{I as t}from"./index-H6CJKjiN.js";var n=e();function r(e){return(0,n.jsx)(t,{...e,onUnauthorized:()=>{window.location.href=`/login`}})}export{r as errorComponent};
|
|
2
|
+
//# sourceMappingURL=profile-DVjIWt8X.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile-B5NaJfeS.js","names":["RouteErrorFallback","PasswordModalType","TotpModalType","PasskeyModalType","ProfileError","props","ErrorComponentProps","window","location","href","errorComponent"],"sources":["../../../frontend/src/routes/profile/index.tsx?tsr-split=errorComponent"],"sourcesContent":["import {\n useMutation,\n useQueryClient,\n useSuspenseQuery,\n} from '@tanstack/react-query';\nimport {\n createFileRoute,\n type ErrorComponentProps,\n redirect,\n useRouter,\n} from '@tanstack/react-router';\nimport { TRButton } from '@tinyrack/ui/components/button';\nimport { TRCard } from '@tinyrack/ui/components/card';\nimport { TRText } from '@tinyrack/ui/components/text';\nimport { CircleAlertIcon, LogOutIcon } from 'lucide-react';\nimport { useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { z } from 'zod';\nimport { AuthPageHeader } from '#frontend/components/auth/auth-page-header.tsx';\nimport { DangerZoneSection } from '#frontend/components/profile/danger-zone-section.tsx';\nimport { LinkedAccountsSection } from '#frontend/components/profile/linked-accounts-section.tsx';\nimport { PasskeySection } from '#frontend/components/profile/passkey-section.tsx';\nimport { PasswordSection } from '#frontend/components/profile/password-section.tsx';\nimport { TotpSection } from '#frontend/components/profile/totp-section.tsx';\nimport { UnlinkOAuthModal } from '#frontend/components/profile/unlink-oauth-modal.tsx';\nimport { UserInfoSection } from '#frontend/components/profile/user-info-section.tsx';\nimport { Alert } from '#frontend/components/ui/alert.tsx';\nimport { InitialAvatar } from '#frontend/components/ui/initial-avatar.tsx';\nimport { RouteErrorFallback } from '#frontend/components/ui/route-error-fallback.tsx';\nimport { AppLayout } from '#frontend/features/layout/app-layout.tsx';\nimport { ChangePasswordModal } from '#frontend/features/profile/change-password-modal.tsx';\nimport { DeleteAccountModal } from '#frontend/features/profile/delete-account-modal.tsx';\nimport { DisableTotpModal } from '#frontend/features/profile/disable-totp-modal.tsx';\nimport { ManagePasskeysModal } from '#frontend/features/profile/manage-passkeys-modal.tsx';\nimport { RegenerateTotpRecoveryCodesModal } from '#frontend/features/profile/regenerate-totp-recovery-codes-modal.tsx';\nimport { RemovePasswordModal } from '#frontend/features/profile/remove-password-modal.tsx';\nimport { SetPasswordModal } from '#frontend/features/profile/set-password-modal.tsx';\nimport { SetupPasskeyModal } from '#frontend/features/profile/setup-passkey-modal.tsx';\nimport { SetupTotpModal } from '#frontend/features/profile/setup-totp-modal.tsx';\nimport { tick } from '#frontend/libs/promise.ts';\nimport { appConfigQueryOptions } from '#frontend/queries/config.ts';\nimport { logoutMutationOptions } from '#frontend/queries/logout.ts';\nimport {\n getOAuthAuthorizeUrl,\n oauthAccountsQueryOptions,\n unlinkOAuthMutationOptions,\n} from '#frontend/queries/oauth.ts';\nimport { getSessionQueryOptions } from '#frontend/queries/session.ts';\n\ntype PasswordModalType = 'set' | 'change' | 'remove' | null;\ntype TotpModalType = 'setup' | 'disable' | 'regenerate' | null;\ntype PasskeyModalType = 'setup' | 'manage' | null;\n\nconst SearchSchema = z.object({\n oauth_error: z.string().optional(),\n oauth_error_description: z.string().optional(),\n});\n\nconst OAUTH_ERROR_I18N_MAP: Record<string, string> = {\n access_denied: 'oauth.error.accessDenied',\n temporarily_unavailable: 'oauth.error.temporarilyUnavailable',\n server_error: 'oauth.error.serverError',\n};\n\nfunction ProfileError(props: ErrorComponentProps) {\n return (\n <RouteErrorFallback\n {...props}\n onUnauthorized={() => {\n window.location.href = '/login';\n }}\n />\n );\n}\n\nexport const Route = createFileRoute('/profile/')({\n component: Profile,\n errorComponent: ProfileError,\n validateSearch: SearchSchema,\n beforeLoad: async ({ context }) => {\n if (!context.user) {\n throw redirect({\n to: '/login',\n });\n }\n },\n loader: async ({ context }) => {\n await Promise.all([\n context.queryClient.ensureQueryData(getSessionQueryOptions),\n context.queryClient.ensureQueryData(oauthAccountsQueryOptions),\n context.queryClient.ensureQueryData(appConfigQueryOptions),\n ]);\n },\n});\n\nfunction Profile() {\n const { t } = useTranslation();\n const router = useRouter();\n const queryClient = useQueryClient();\n const search = Route.useSearch();\n\n const oauthError = search.oauth_error;\n const oauthErrorMessage = oauthError\n ? t(OAUTH_ERROR_I18N_MAP[oauthError] ?? 'oauth.error.failed')\n : undefined;\n const [unlinkingProvider, setUnlinkingProvider] = useState<string | null>(\n null,\n );\n const [unlinkModal, setUnlinkModal] = useState<{\n id: string;\n name: string;\n } | null>(null);\n const [passwordModal, setPasswordModal] = useState<PasswordModalType>(null);\n const [totpModal, setTotpModal] = useState<TotpModalType>(null);\n const [passkeyModal, setPasskeyModal] = useState<PasskeyModalType>(null);\n const [showDeleteModal, setShowDeleteModal] = useState(false);\n\n const { data: session } = useSuspenseQuery(getSessionQueryOptions);\n const { data: oauthAccountsData } = useSuspenseQuery(\n oauthAccountsQueryOptions,\n );\n const { data: appConfig } = useSuspenseQuery(appConfigQueryOptions);\n\n const logoutMutation = useMutation({\n ...logoutMutationOptions,\n onSuccess: async () => {\n queryClient.setQueryData(getSessionQueryOptions.queryKey, {\n user: null,\n });\n await tick();\n router.navigate({\n to: '/login',\n });\n },\n onSettled: () => {\n queryClient.invalidateQueries({\n queryKey: getSessionQueryOptions.queryKey,\n });\n },\n });\n\n const unlinkMutation = useMutation({\n ...unlinkOAuthMutationOptions,\n onSuccess: () => {\n queryClient.invalidateQueries({\n queryKey: oauthAccountsQueryOptions.queryKey,\n });\n },\n onSettled: () => {\n setUnlinkingProvider(null);\n },\n });\n\n const handleUnlinkConfirm = async () => {\n if (!unlinkModal) return;\n setUnlinkingProvider(unlinkModal.id);\n await unlinkMutation.mutateAsync(unlinkModal.id);\n };\n\n if (!session.user) {\n return null;\n }\n\n const user = session.user;\n const availableProviders = oauthAccountsData.available_providers;\n const hasLinkedOAuth = availableProviders.some((p) => p.linked);\n const isConfigManaged = user.managed_by === 'config';\n\n const passwordAuthMethod = appConfig.auth.password;\n const passkeyAuthMethod = appConfig.auth.passkey;\n const totpEnabled = passwordAuthMethod.totp.enabled;\n const passkeyEnabled = passkeyAuthMethod.enabled;\n\n const accountDeletionEnabled = appConfig.account_deletion.enabled;\n const retentionPeriod = appConfig.account_deletion.retention;\n\n const retentionDays = (() => {\n const match = retentionPeriod.match(/^(\\d+)([dmy])$/);\n if (!match) return 30;\n const value = parseInt(match[1], 10);\n const unit = match[2];\n switch (unit) {\n case 'd':\n return value;\n case 'm':\n return value * 30;\n case 'y':\n return value * 365;\n default:\n return 30;\n }\n })();\n\n const showPasswordSection = true;\n const showTotpSection = !isConfigManaged && totpEnabled;\n const showPasskeySection = !isConfigManaged && passkeyEnabled;\n const showLinkedAccounts = availableProviders.length > 0;\n const hasSecurityOptions =\n showPasswordSection || showTotpSection || showPasskeySection;\n\n return (\n <AppLayout\n headerActions={\n <TRButton\n appearance=\"ghost\"\n /*\n The visible label collapses below `sm:`, which would leave the\n control unnamed on a phone. `profile.logout` is the same string\n the label renders, so this does not shadow it.\n */\n aria-label={t('profile.logout')}\n data-testid=\"profile-logout\"\n disabled={logoutMutation.isPending}\n loading={logoutMutation.isPending}\n onClick={() => logoutMutation.mutate()}\n type=\"button\"\n uiSize=\"sm\"\n >\n {logoutMutation.isPending ? undefined : (\n <>\n <LogOutIcon aria-hidden className=\"size-tinyrack-lg\" />\n <span className=\"hidden sm:inline\">{t('profile.logout')}</span>\n </>\n )}\n </TRButton>\n }\n >\n <div className=\"flex items-center gap-tinyrack-lg\">\n <InitialAvatar email={user.email} size=\"lg\" />\n <div className=\"flex min-w-0 flex-col gap-tinyrack-3xs\">\n <AuthPageHeader title={t('profile.title')} />\n {/*\n Rendered here rather than as the header's `subtitle`: this node\n carries a testid and needs to truncate, neither of which the\n shared header does, and growing its API for one non-auth caller\n would be the wrong trade.\n */}\n <TRText\n as=\"p\"\n color=\"muted\"\n data-testid=\"profile-user-email\"\n truncate\n variant=\"bodySm\"\n >\n {user.email}\n </TRText>\n </div>\n </div>\n\n {oauthErrorMessage && (\n <Alert icon={CircleAlertIcon} type=\"error\">\n {oauthErrorMessage}\n </Alert>\n )}\n\n {user && <UserInfoSection user={user} />}\n\n {hasSecurityOptions && (\n <TRCard.Root variant=\"outlined\">\n <TRCard.Header className=\"border-tinyrack-border border-b-tinyrack-default px-tinyrack-lg py-tinyrack-md\">\n <TRCard.Title>{t('profile.security.title')}</TRCard.Title>\n <TRCard.Description>\n {t('profile.security.description')}\n </TRCard.Description>\n </TRCard.Header>\n {showTotpSection && user.totp_recovery_codes_missing && (\n <div\n className=\"border-tinyrack-border border-b-tinyrack-default px-tinyrack-lg py-tinyrack-md\"\n data-testid=\"profile-totp-recovery-warning\"\n >\n <Alert icon={CircleAlertIcon} type=\"warning\">\n {t('profile.totp.recoveryCodesMissing')}\n </Alert>\n </div>\n )}\n <TRCard.Content className=\"divide-y divide-tinyrack-border p-0\">\n {showPasswordSection && (\n <PasswordSection\n hasLinkedOAuth={hasLinkedOAuth}\n hasPassword={user.has_password}\n hasSecondFactorOnly={\n user.has_password &&\n !hasLinkedOAuth &&\n (user.totp_registered || user.passkey_count > 0)\n }\n isConfigManaged={isConfigManaged}\n onOpenModal={setPasswordModal}\n />\n )}\n {showTotpSection && (\n <TotpSection\n onOpenModal={setTotpModal}\n recoveryCodesMissing={user.totp_recovery_codes_missing}\n totpEnabled={user.totp_registered}\n />\n )}\n {showPasskeySection && (\n <PasskeySection\n onOpenModal={setPasskeyModal}\n passkeyCount={user.passkey_count}\n />\n )}\n </TRCard.Content>\n </TRCard.Root>\n )}\n\n {showLinkedAccounts && (\n <LinkedAccountsSection\n getAuthorizeUrl={getOAuthAuthorizeUrl}\n onUnlinkRequest={(provider) =>\n setUnlinkModal({\n id: provider.id,\n name: provider.display_name,\n })\n }\n providers={availableProviders}\n unlinkingProvider={unlinkingProvider}\n />\n )}\n\n <DangerZoneSection\n isConfigManaged={isConfigManaged}\n isDeletionEnabled={accountDeletionEnabled}\n onDeleteClick={() => setShowDeleteModal(true)}\n />\n\n <SetPasswordModal\n isOpen={passwordModal === 'set'}\n onClose={() => setPasswordModal(null)}\n />\n <ChangePasswordModal\n isOpen={passwordModal === 'change'}\n onClose={() => setPasswordModal(null)}\n />\n <RemovePasswordModal\n isOpen={passwordModal === 'remove'}\n onClose={() => setPasswordModal(null)}\n />\n\n <SetupTotpModal\n isOpen={totpModal === 'setup'}\n onClose={() => setTotpModal(null)}\n />\n <DisableTotpModal\n isOpen={totpModal === 'disable'}\n onClose={() => setTotpModal(null)}\n />\n <RegenerateTotpRecoveryCodesModal\n isOpen={totpModal === 'regenerate'}\n onClose={() => setTotpModal(null)}\n />\n\n <SetupPasskeyModal\n isOpen={passkeyModal === 'setup'}\n onClose={() => setPasskeyModal(null)}\n />\n <ManagePasskeysModal\n isOpen={passkeyModal === 'manage'}\n onAddNew={() => setPasskeyModal('setup')}\n onClose={() => setPasskeyModal(null)}\n />\n\n <UnlinkOAuthModal\n isOpen={unlinkModal !== null}\n isPending={unlinkMutation.isPending}\n onClose={() => setUnlinkModal(null)}\n onConfirm={handleUnlinkConfirm}\n providerName={unlinkModal?.name ?? ''}\n />\n\n <DeleteAccountModal\n isOpen={showDeleteModal}\n onClose={() => setShowDeleteModal(false)}\n retentionDays={retentionDays}\n />\n </AppLayout>\n );\n}\n"],"mappings":"qGAgEA,SAASI,EAAaC,EAA4B,CAChD,OACE,EAAA,EAAA,IAAA,CAAC,EAAD,CACE,GAAIA,EACJ,mBAAsB,CACpBE,OAAOC,SAASC,KAAO,QACzB,CAAE,CAAA,CAGR"}
|
|
1
|
+
{"version":3,"file":"profile-DVjIWt8X.js","names":["RouteErrorFallback","PasswordModalType","TotpModalType","PasskeyModalType","ProfileError","props","ErrorComponentProps","window","location","href","errorComponent"],"sources":["../../../frontend/src/routes/profile/index.tsx?tsr-split=errorComponent"],"sourcesContent":["import {\n useMutation,\n useQueryClient,\n useSuspenseQuery,\n} from '@tanstack/react-query';\nimport {\n createFileRoute,\n type ErrorComponentProps,\n redirect,\n useRouter,\n} from '@tanstack/react-router';\nimport { TRButton } from '@tinyrack/ui/components/button';\nimport { TRCard } from '@tinyrack/ui/components/card';\nimport { TRText } from '@tinyrack/ui/components/text';\nimport { CircleAlertIcon, LogOutIcon } from 'lucide-react';\nimport { useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { z } from 'zod';\nimport { AuthPageHeader } from '#frontend/components/auth/auth-page-header.tsx';\nimport { DangerZoneSection } from '#frontend/components/profile/danger-zone-section.tsx';\nimport { LinkedAccountsSection } from '#frontend/components/profile/linked-accounts-section.tsx';\nimport { PasskeySection } from '#frontend/components/profile/passkey-section.tsx';\nimport { PasswordSection } from '#frontend/components/profile/password-section.tsx';\nimport { TotpSection } from '#frontend/components/profile/totp-section.tsx';\nimport { UnlinkOAuthModal } from '#frontend/components/profile/unlink-oauth-modal.tsx';\nimport { UserInfoSection } from '#frontend/components/profile/user-info-section.tsx';\nimport { Alert } from '#frontend/components/ui/alert.tsx';\nimport { InitialAvatar } from '#frontend/components/ui/initial-avatar.tsx';\nimport { RouteErrorFallback } from '#frontend/components/ui/route-error-fallback.tsx';\nimport { AppLayout } from '#frontend/features/layout/app-layout.tsx';\nimport { ChangePasswordModal } from '#frontend/features/profile/change-password-modal.tsx';\nimport { DeleteAccountModal } from '#frontend/features/profile/delete-account-modal.tsx';\nimport { DisableTotpModal } from '#frontend/features/profile/disable-totp-modal.tsx';\nimport { ManagePasskeysModal } from '#frontend/features/profile/manage-passkeys-modal.tsx';\nimport { RegenerateTotpRecoveryCodesModal } from '#frontend/features/profile/regenerate-totp-recovery-codes-modal.tsx';\nimport { RemovePasswordModal } from '#frontend/features/profile/remove-password-modal.tsx';\nimport { SetPasswordModal } from '#frontend/features/profile/set-password-modal.tsx';\nimport { SetupPasskeyModal } from '#frontend/features/profile/setup-passkey-modal.tsx';\nimport { SetupTotpModal } from '#frontend/features/profile/setup-totp-modal.tsx';\nimport { tick } from '#frontend/libs/promise.ts';\nimport { appConfigQueryOptions } from '#frontend/queries/config.ts';\nimport { logoutMutationOptions } from '#frontend/queries/logout.ts';\nimport {\n getOAuthAuthorizeUrl,\n oauthAccountsQueryOptions,\n unlinkOAuthMutationOptions,\n} from '#frontend/queries/oauth.ts';\nimport { getSessionQueryOptions } from '#frontend/queries/session.ts';\n\ntype PasswordModalType = 'set' | 'change' | 'remove' | null;\ntype TotpModalType = 'setup' | 'disable' | 'regenerate' | null;\ntype PasskeyModalType = 'setup' | 'manage' | null;\n\nconst SearchSchema = z.object({\n oauth_error: z.string().optional(),\n oauth_error_description: z.string().optional(),\n});\n\nconst OAUTH_ERROR_I18N_MAP: Record<string, string> = {\n access_denied: 'oauth.error.accessDenied',\n temporarily_unavailable: 'oauth.error.temporarilyUnavailable',\n server_error: 'oauth.error.serverError',\n};\n\nfunction ProfileError(props: ErrorComponentProps) {\n return (\n <RouteErrorFallback\n {...props}\n onUnauthorized={() => {\n window.location.href = '/login';\n }}\n />\n );\n}\n\nexport const Route = createFileRoute('/profile/')({\n component: Profile,\n errorComponent: ProfileError,\n validateSearch: SearchSchema,\n beforeLoad: async ({ context }) => {\n if (!context.user) {\n throw redirect({\n to: '/login',\n });\n }\n },\n loader: async ({ context }) => {\n await Promise.all([\n context.queryClient.ensureQueryData(getSessionQueryOptions),\n context.queryClient.ensureQueryData(oauthAccountsQueryOptions),\n context.queryClient.ensureQueryData(appConfigQueryOptions),\n ]);\n },\n});\n\nfunction Profile() {\n const { t } = useTranslation();\n const router = useRouter();\n const queryClient = useQueryClient();\n const search = Route.useSearch();\n\n const oauthError = search.oauth_error;\n const oauthErrorMessage = oauthError\n ? t(OAUTH_ERROR_I18N_MAP[oauthError] ?? 'oauth.error.failed')\n : undefined;\n const [unlinkingProvider, setUnlinkingProvider] = useState<string | null>(\n null,\n );\n const [unlinkModal, setUnlinkModal] = useState<{\n id: string;\n name: string;\n } | null>(null);\n const [passwordModal, setPasswordModal] = useState<PasswordModalType>(null);\n const [totpModal, setTotpModal] = useState<TotpModalType>(null);\n const [passkeyModal, setPasskeyModal] = useState<PasskeyModalType>(null);\n const [showDeleteModal, setShowDeleteModal] = useState(false);\n\n const { data: session } = useSuspenseQuery(getSessionQueryOptions);\n const { data: oauthAccountsData } = useSuspenseQuery(\n oauthAccountsQueryOptions,\n );\n const { data: appConfig } = useSuspenseQuery(appConfigQueryOptions);\n\n const logoutMutation = useMutation({\n ...logoutMutationOptions,\n onSuccess: async () => {\n queryClient.setQueryData(getSessionQueryOptions.queryKey, {\n user: null,\n });\n await tick();\n router.navigate({\n to: '/login',\n });\n },\n onSettled: () => {\n queryClient.invalidateQueries({\n queryKey: getSessionQueryOptions.queryKey,\n });\n },\n });\n\n const unlinkMutation = useMutation({\n ...unlinkOAuthMutationOptions,\n onSuccess: () => {\n queryClient.invalidateQueries({\n queryKey: oauthAccountsQueryOptions.queryKey,\n });\n },\n onSettled: () => {\n setUnlinkingProvider(null);\n },\n });\n\n const handleUnlinkConfirm = async () => {\n if (!unlinkModal) return;\n setUnlinkingProvider(unlinkModal.id);\n await unlinkMutation.mutateAsync(unlinkModal.id);\n };\n\n if (!session.user) {\n return null;\n }\n\n const user = session.user;\n const availableProviders = oauthAccountsData.available_providers;\n const hasLinkedOAuth = availableProviders.some((p) => p.linked);\n const isConfigManaged = user.managed_by === 'config';\n\n const passwordAuthMethod = appConfig.auth.password;\n const passkeyAuthMethod = appConfig.auth.passkey;\n const totpEnabled = passwordAuthMethod.totp.enabled;\n const passkeyEnabled = passkeyAuthMethod.enabled;\n\n const accountDeletionEnabled = appConfig.account_deletion.enabled;\n const retentionPeriod = appConfig.account_deletion.retention;\n\n const retentionDays = (() => {\n const match = retentionPeriod.match(/^(\\d+)([dmy])$/);\n if (!match) return 30;\n const value = parseInt(match[1], 10);\n const unit = match[2];\n switch (unit) {\n case 'd':\n return value;\n case 'm':\n return value * 30;\n case 'y':\n return value * 365;\n default:\n return 30;\n }\n })();\n\n const showPasswordSection = true;\n const showTotpSection = !isConfigManaged && totpEnabled;\n const showPasskeySection = !isConfigManaged && passkeyEnabled;\n const showLinkedAccounts = availableProviders.length > 0;\n const hasSecurityOptions =\n showPasswordSection || showTotpSection || showPasskeySection;\n\n return (\n <AppLayout\n headerActions={\n <TRButton\n appearance=\"ghost\"\n /*\n The visible label collapses below `sm:`, which would leave the\n control unnamed on a phone. `profile.logout` is the same string\n the label renders, so this does not shadow it.\n */\n aria-label={t('profile.logout')}\n data-testid=\"profile-logout\"\n disabled={logoutMutation.isPending}\n loading={logoutMutation.isPending}\n onClick={() => logoutMutation.mutate()}\n type=\"button\"\n uiSize=\"sm\"\n >\n {logoutMutation.isPending ? undefined : (\n <>\n <LogOutIcon aria-hidden className=\"size-tinyrack-lg\" />\n <span className=\"hidden sm:inline\">{t('profile.logout')}</span>\n </>\n )}\n </TRButton>\n }\n >\n <div className=\"flex items-center gap-tinyrack-lg\">\n <InitialAvatar email={user.email} size=\"lg\" />\n <div className=\"flex min-w-0 flex-col gap-tinyrack-3xs\">\n <AuthPageHeader title={t('profile.title')} />\n {/*\n Rendered here rather than as the header's `subtitle`: this node\n carries a testid and needs to truncate, neither of which the\n shared header does, and growing its API for one non-auth caller\n would be the wrong trade.\n */}\n <TRText\n as=\"p\"\n color=\"muted\"\n data-testid=\"profile-user-email\"\n truncate\n variant=\"bodySm\"\n >\n {user.email}\n </TRText>\n </div>\n </div>\n\n {oauthErrorMessage && (\n <Alert icon={CircleAlertIcon} type=\"error\">\n {oauthErrorMessage}\n </Alert>\n )}\n\n {user && <UserInfoSection user={user} />}\n\n {hasSecurityOptions && (\n <TRCard.Root variant=\"outlined\">\n <TRCard.Header className=\"border-tinyrack-border border-b-tinyrack-default px-tinyrack-lg py-tinyrack-md\">\n <TRCard.Title>{t('profile.security.title')}</TRCard.Title>\n <TRCard.Description>\n {t('profile.security.description')}\n </TRCard.Description>\n </TRCard.Header>\n {showTotpSection && user.totp_recovery_codes_missing && (\n <div\n className=\"border-tinyrack-border border-b-tinyrack-default px-tinyrack-lg py-tinyrack-md\"\n data-testid=\"profile-totp-recovery-warning\"\n >\n <Alert icon={CircleAlertIcon} type=\"warning\">\n {t('profile.totp.recoveryCodesMissing')}\n </Alert>\n </div>\n )}\n <TRCard.Content className=\"divide-y divide-tinyrack-border p-0\">\n {showPasswordSection && (\n <PasswordSection\n hasLinkedOAuth={hasLinkedOAuth}\n hasPassword={user.has_password}\n hasSecondFactorOnly={\n user.has_password &&\n !hasLinkedOAuth &&\n (user.totp_registered || user.passkey_count > 0)\n }\n isConfigManaged={isConfigManaged}\n onOpenModal={setPasswordModal}\n />\n )}\n {showTotpSection && (\n <TotpSection\n onOpenModal={setTotpModal}\n recoveryCodesMissing={user.totp_recovery_codes_missing}\n totpEnabled={user.totp_registered}\n />\n )}\n {showPasskeySection && (\n <PasskeySection\n onOpenModal={setPasskeyModal}\n passkeyCount={user.passkey_count}\n />\n )}\n </TRCard.Content>\n </TRCard.Root>\n )}\n\n {showLinkedAccounts && (\n <LinkedAccountsSection\n getAuthorizeUrl={getOAuthAuthorizeUrl}\n onUnlinkRequest={(provider) =>\n setUnlinkModal({\n id: provider.id,\n name: provider.display_name,\n })\n }\n providers={availableProviders}\n unlinkingProvider={unlinkingProvider}\n />\n )}\n\n <DangerZoneSection\n isConfigManaged={isConfigManaged}\n isDeletionEnabled={accountDeletionEnabled}\n onDeleteClick={() => setShowDeleteModal(true)}\n />\n\n <SetPasswordModal\n isOpen={passwordModal === 'set'}\n onClose={() => setPasswordModal(null)}\n />\n <ChangePasswordModal\n isOpen={passwordModal === 'change'}\n onClose={() => setPasswordModal(null)}\n />\n <RemovePasswordModal\n isOpen={passwordModal === 'remove'}\n onClose={() => setPasswordModal(null)}\n />\n\n <SetupTotpModal\n isOpen={totpModal === 'setup'}\n onClose={() => setTotpModal(null)}\n />\n <DisableTotpModal\n isOpen={totpModal === 'disable'}\n onClose={() => setTotpModal(null)}\n />\n <RegenerateTotpRecoveryCodesModal\n isOpen={totpModal === 'regenerate'}\n onClose={() => setTotpModal(null)}\n />\n\n <SetupPasskeyModal\n isOpen={passkeyModal === 'setup'}\n onClose={() => setPasskeyModal(null)}\n />\n <ManagePasskeysModal\n isOpen={passkeyModal === 'manage'}\n onAddNew={() => setPasskeyModal('setup')}\n onClose={() => setPasskeyModal(null)}\n />\n\n <UnlinkOAuthModal\n isOpen={unlinkModal !== null}\n isPending={unlinkMutation.isPending}\n onClose={() => setUnlinkModal(null)}\n onConfirm={handleUnlinkConfirm}\n providerName={unlinkModal?.name ?? ''}\n />\n\n <DeleteAccountModal\n isOpen={showDeleteModal}\n onClose={() => setShowDeleteModal(false)}\n retentionDays={retentionDays}\n />\n </AppLayout>\n );\n}\n"],"mappings":"qGAgEA,SAASI,EAAaC,EAA4B,CAChD,OACE,EAAA,EAAA,IAAA,CAAC,EAAD,CACE,GAAIA,EACJ,mBAAsB,CACpBE,OAAOC,SAASC,KAAO,QACzB,CAAE,CAAA,CAGR"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{J as e,U as t,Z as n,i as r,n as i,q as a,r as o,s,t as c}from"./createLucideIcon-BPpAIXR_.js";import{On as l,Sr as u,i as d,n as f,r as p,t as m}from"./config-DTQCUlfZ.js";import{t as h}from"./mutationOptions-DyYFUbyn.js";import{t as g}from"./useMutation-BWZ0G4Td.js";import{a as _,j as v,nt as y,r as b,t as x}from"./shell-header-bar-BPgCjFPv.js";import{t as S}from"./useQuery-CI5Ukuae.js";import{a as C,i as w,n as T,r as E,t as D}from"./use-totp-setup-OH_GTMxA.js";import{t as O}from"./auth-field-BSlAWkbx.js";import{t as k}from"./fingerprint-pattern-DP62Vk8x.js";import{t as A}from"./key-round-CdvHb8vT.js";import{i as j}from"./provider-logos-u1YURWQr.js";import{n as ee,t as te}from"./logout-B5T52P8u.js";import{t as M}from"./shield-check-D_p8H0ni.js";import{t as N}from"./trash-2-DZdKBLvC.js";import{t as P}from"./triangle-alert-CqNn0kPs.js";import{t as F}from"./zod-C87S6Tec.js";import{B as I,C as ne,R as L,S as R,T as re,w as z,x as ie,z as ae}from"./index-H6CJKjiN.js";import{t as oe}from"./badge-CsOfUji0.js";import{t as se}from"./auth-page-header-ZLhtQ7Et.js";import{t as B}from"./alert-leqyvHOp.js";import{t as ce}from"./initial-avatar-DjSqgENY.js";import{t as V}from"./promise-OpBtq8tG.js";import{n as H,t as U}from"./modal-CwoBUXp3.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 le,r as ue}from"./totp-BNZ904Zm.js";var de=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`}]]),fe=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`}]]),pe=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`}]]),me=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`}]]),he=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 ge({isConfigManaged:e,isDeletionEnabled:t,onDeleteClick:n}){let{t:a}=r();return t?(0,Z.jsxs)(I.Root,{className:`border-tinyrack-danger-border bg-tinyrack-danger-surface`,variant:`outlined`,children:[(0,Z.jsxs)(I.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)(P,{"aria-hidden":!0,className:`size-tinyrack-lg text-tinyrack-danger-foreground`}),(0,Z.jsx)(I.Title,{className:`text-tinyrack-danger-foreground`,children:a(`profile.dangerZone.title`)})]}),(0,Z.jsx)(I.Description,{children:a(`profile.dangerZone.description`)})]}),(0,Z.jsx)(I.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)(N,{"aria-hidden":!0,className:`size-tinyrack-lg`}),a(`profile.deleteAccount.button`)]})]})})]}):null}function Q({icon:e,active:t,title:n,status:r,note:a,actions:o}){let s;return s=(0,X.isValidElement)(e)?e:(0,Z.jsx)(e,{"aria-hidden":!0,className:`size-tinyrack-lg ${t?`text-tinyrack-success-foreground`:`text-tinyrack-text-muted`}`}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-tinyrack-lg p-tinyrack-lg`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-tinyrack-md`,children:[(0,Z.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-tinyrack-md ${t?`bg-tinyrack-success-surface`:`bg-tinyrack-surface-muted`}`,children:s}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-tinyrack-3xs`,children:[(0,Z.jsx)(i,{as:`div`,variant:`bodySm`,weight:`medium`,children:n}),(0,Z.jsx)(i,{as:`div`,color:`muted`,variant:`caption`,children:r}),a]})]}),o&&(0,Z.jsx)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-tinyrack-xs`,children:o})]})}function _e({providers:e,unlinkingProvider:t,getAuthorizeUrl:n,onUnlinkRequest:i}){let{t:a}=r();return e.length===0?null:(0,Z.jsxs)(I.Root,{variant:`outlined`,children:[(0,Z.jsxs)(I.Header,{className:`border-tinyrack-border border-b-tinyrack-default px-tinyrack-lg py-tinyrack-md`,children:[(0,Z.jsx)(I.Title,{children:a(`profile.linkedAccounts.title`)}),(0,Z.jsx)(I.Description,{children:a(`profile.linkedAccounts.description`)})]}),(0,Z.jsx)(I.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)(ae,{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)(j,{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 ve({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:k,status:i?n(`profile.passkey.status.enabled`,{count:e}):n(`profile.passkey.status.disabled`),title:n(`profile.passkey.title`)})}function ye({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)(b.Root,{children:[(0,Z.jsx)(b.Trigger,{render:(0,Z.jsx)(s,{appearance:`ghost`,disabled:!0,type:`button`,uiSize:`sm`,children:c(`profile.password.remove`)})}),(0,Z.jsx)(b.Portal,{children:(0,Z.jsx)(b.Positioner,{children:(0,Z.jsx)(b.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)(C,{"aria-hidden":!0,className:`size-tinyrack-lg shrink-0 text-tinyrack-warning-foreground`}),(0,Z.jsx)(`div`,{children:c(`profile.password.removeDisabledReason`)})]})})})})]})]}):(0,Z.jsx)(s,{appearance:`ghost`,"data-testid":`profile-password-set`,intent:`primary`,onClick:()=>o(`set`),type:`button`,uiSize:`sm`,children:c(`profile.password.set`)}),active:e,icon:A,note:n?(0,Z.jsxs)(i,{as:`div`,className:`flex items-center gap-tinyrack-xs`,color:`muted`,variant:`caption`,children:[(0,Z.jsx)(me,{"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 be({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:M,status:i(e?t?`profile.totp.status.recoveryCodesMissing`:`profile.totp.status.enabled`:`profile.totp.status.disabled`),title:i(`profile.totp.title`)})}var xe={error:L,warning:P,info:C};function $({variant:e,children:t}){return(0,Z.jsx)(B,{"data-testid":`alert-banner-${e}`,icon:xe[e],type:e,children:t})}function Se({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:fe,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 Ce({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 we({user:e}){let{t}=r();return(0,Z.jsxs)(I.Root,{variant:`outlined`,children:[(0,Z.jsxs)(I.Header,{className:`border-tinyrack-border border-b-tinyrack-default px-tinyrack-lg py-tinyrack-md`,children:[(0,Z.jsx)(I.Title,{children:t(`profile.account.title`)}),(0,Z.jsx)(I.Description,{children:t(`profile.account.description`)})]}),(0,Z.jsxs)(I.Content,{className:`divide-y divide-tinyrack-border p-0`,children:[(0,Z.jsx)(Ce,{label:t(`profile.id.label`),value:e.sub}),(0,Z.jsx)(Ce,{label:t(`profile.email.label`),value:e.email})]})]})}function Te({children:e,headerActions:t}){return(0,Z.jsxs)(`div`,{className:`flex min-h-dvh flex-col bg-tinyrack-surface`,children:[(0,Z.jsx)(v,{}),(0,Z.jsx)(x,{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})}),(0,Z.jsx)(_,{})]})}var Ee=h({mutationFn:async e=>d(await p.api.user.password.$post({json:e}))}),De=h({mutationFn:async e=>d(await p.api.user.password.$put({json:e}))}),Oe=h({mutationFn:async e=>d(await p.api.user.password.$delete({json:e}))});function ke({isOpen:e,onClose:t}){let{t:n}=r(),i=u(),{data:a}=y(m),c=a.auth.password.policy,l=J({resolver:Y((0,X.useMemo)(()=>F.object({currentPassword:F.string().min(1,n(`validation.password.required`)),newPassword:F.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:F.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({...De,onSuccess:()=>{i.invalidateQueries({queryKey:R.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:A,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)(O,{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)(O,{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)(O,{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 Ae=h({mutationFn:async()=>d(await p.api.user.$delete())});function je({isOpen:e,onClose:t,retentionDays:n}){let{t:i}=r(),a=l(),o=u(),c=J({resolver:Y((0,X.useMemo)(()=>F.object({confirmation:F.string().refine(e=>e.toLowerCase()===i(`profile.deleteAccount.modal.confirmPlaceholder`).toLowerCase(),{message:i(`validation.confirmText.mismatch`)})}),[i])),defaultValues:{confirmation:``}}),d=g({...Ae,onSuccess:async()=>{o.setQueryData(R.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:N,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)(O,{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 Me({isOpen:e,onClose:t}){let{t:n}=r(),i=u(),a=J({resolver:Y((0,X.useMemo)(()=>F.object({code:F.string().length(6,n(`validation.totp.length`)).regex(/^\d{6}$/,n(`validation.totp.digits`))}),[n])),defaultValues:{code:``}}),c=g({...le,onSuccess:()=>{i.invalidateQueries({queryKey:R.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:M,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)(O,{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 Ne({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:x}=S({...q,enabled:e}),C=g({...K,onSuccess:()=>{c.invalidateQueries({queryKey:f.passkeys()}),c.invalidateQueries({queryKey:R.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`))}},O=e=>new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`}),A=b?.passkeys||[];return(0,Z.jsxs)(U,{icon:k,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}),x&&(0,Z.jsx)(`div`,{className:`flex justify-center py-tinyrack-xl`,children:(0,Z.jsx)(t,{uiSize:`md`})}),!x&&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`)})}),!x&&A.length>0&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-tinyrack-sm`,children:A.map(e=>(0,Z.jsx)(Pe,{formatDate:O,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 Pe({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)(()=>F.object({name:F.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)(O,{"data-testid":`passkey-rename-input`,error:_.formState.errors.name,errorTestId:`passkey-rename-error`,hideLabel:!0,label:m(`profile.passkey.manageModal.nameLabel`),placeholder:m(`profile.passkey.manageModal.namePlaceholder`),..._.register(`name`),type:`text`}),(0,Z.jsxs)(`div`,{className:`flex justify-end gap-tinyrack-xs`,children:[(0,Z.jsx)(s,{appearance:`ghost`,disabled:v.isPending,onClick:()=>{_.reset(),o()},type:`button`,uiSize:`sm`,children:m(`profile.passkey.manageModal.cancelEdit`)}),(0,Z.jsx)(s,{disabled:v.isPending,intent:`primary`,type:`submit`,uiSize:`sm`,children:v.isPending?m(`profile.passkey.manageModal.saving`):m(`profile.passkey.manageModal.save`)})]})]}):i?(0,Z.jsxs)(`div`,{className:`flex items-center justify-between rounded-tinyrack-md border border-tinyrack-danger-border bg-tinyrack-danger-surface p-tinyrack-sm text-tinyrack-danger-foreground`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-tinyrack-sm`,children:[(0,Z.jsx)(N,{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)(de,{className:`size-tinyrack-lg text-tinyrack-primary-foreground`}):(0,Z.jsx)(he,{className:`size-tinyrack-lg text-tinyrack-primary-foreground`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`font-tinyrack-medium text-tinyrack-xs`,children:e.name||m(`profile.passkey.manageModal.unnamedPasskey`)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-tinyrack-xs text-tinyrack-text-muted text-tinyrack-xs`,children:[(0,Z.jsx)(`span`,{children:m(`profile.passkey.manageModal.createdAt`,{date:p(e.created_at)})}),e.backed_up&&(0,Z.jsx)(oe,{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)(pe,{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)(N,{className:`size-tinyrack-lg`})})]})]})}function Fe({isOpen:e,onClose:t}){let{t:n}=r(),i=l(),a=u(),{data:s}=y(m),[c,d]=(0,X.useState)(`verify`),[f,p]=(0,X.useState)(null),[h,_]=(0,X.useState)(null),v=g({...ue,onSuccess:async e=>{p(e),d(`recovery`),await a.invalidateQueries({queryKey:R.queryKey})}}),b=(0,X.useCallback)(()=>{d(`verify`),p(null),_(null),v.reset()},[v]),x=(0,X.useCallback)(()=>{b(),t()},[t,b]),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(R.queryKey,{user:null}),await V(),i.navigate({to:`/login`});return}if(e.code===`TOTP_NOT_ENABLED`||e.code===`VALIDATION_ERROR`){await a.invalidateQueries({queryKey:R.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:M,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)(E,{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)(w,{onConfirm:x,recoveryCodes:f?.recovery_codes??[]})})}):null}function Ie({isOpen:e,onClose:t}){let{t:n}=r(),i=u(),a=J({resolver:Y((0,X.useMemo)(()=>F.object({currentPassword:F.string().min(1,n(`validation.password.required`))}),[n])),defaultValues:{currentPassword:``}}),c=g({...Oe,onSuccess:()=>{i.invalidateQueries({queryKey:R.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:A,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)(O,{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 Le({isOpen:e,onClose:t}){let{t:n}=r(),i=u(),{data:a}=y(m),o=a.auth.password.policy,c=J({resolver:Y((0,X.useMemo)(()=>F.object({password:F.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:F.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({...Ee,onSuccess:()=>{i.invalidateQueries({queryKey:R.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:A,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)(O,{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)(O,{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 Re({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)(()=>F.object({name:F.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:R.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:k,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)(O,{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 ze({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}=D({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 C=(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:M,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)(T,{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)(E,{isPending:p,onBack:v,onSubmit:C})}),l===`recovery`&&d.length>0&&(0,Z.jsx)(`div`,{className:`mt-tinyrack-lg`,children:(0,Z.jsx)(w,{isLoading:m,onConfirm:y,recoveryCodes:d})})]})}var Be={access_denied:`oauth.error.accessDenied`,temporarily_unavailable:`oauth.error.temporarilyUnavailable`,server_error:`oauth.error.serverError`};function Ve(){let{t:e}=r(),t=l(),n=u(),a=ie.useSearch().oauth_error,o=a?e(Be[a]??`oauth.error.failed`):void 0,[c,d]=(0,X.useState)(null),[f,p]=(0,X.useState)(null),[h,_]=(0,X.useState)(null),[v,b]=(0,X.useState)(null),[x,S]=(0,X.useState)(null),[C,w]=(0,X.useState)(!1),{data:T}=y(R),{data:E}=y(z),{data:D}=y(m),O=g({...te,onSuccess:async()=>{n.setQueryData(R.queryKey,{user:null}),await V(),t.navigate({to:`/login`})},onSettled:()=>{n.invalidateQueries({queryKey:R.queryKey})}}),k=g({...re,onSuccess:()=>{n.invalidateQueries({queryKey:z.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`,F=D.auth.password,ae=D.auth.passkey,oe=F.totp.enabled,H=ae.enabled,U=D.account_deletion.enabled,W=D.account_deletion.retention,G=(()=>{let e=W.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}})(),K=!P&&oe,q=!P&&H,J=M.length>0;return(0,Z.jsxs)(Te,{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)(ce,{email:j.email,size:`lg`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-tinyrack-3xs`,children:[(0,Z.jsx)(se,{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:L,type:`error`,children:o}),j&&(0,Z.jsx)(we,{user:j}),(0,Z.jsxs)(I.Root,{variant:`outlined`,children:[(0,Z.jsxs)(I.Header,{className:`border-tinyrack-border border-b-tinyrack-default px-tinyrack-lg py-tinyrack-md`,children:[(0,Z.jsx)(I.Title,{children:e(`profile.security.title`)}),(0,Z.jsx)(I.Description,{children:e(`profile.security.description`)})]}),K&&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:L,type:`warning`,children:e(`profile.totp.recoveryCodesMissing`)})}),(0,Z.jsxs)(I.Content,{className:`divide-y divide-tinyrack-border p-0`,children:[(0,Z.jsx)(ye,{hasLinkedOAuth:N,hasPassword:j.has_password,hasSecondFactorOnly:j.has_password&&!N&&(j.totp_registered||j.passkey_count>0),isConfigManaged:P,onOpenModal:_}),K&&(0,Z.jsx)(be,{onOpenModal:b,recoveryCodesMissing:j.totp_recovery_codes_missing,totpEnabled:j.totp_registered}),q&&(0,Z.jsx)(ve,{onOpenModal:S,passkeyCount:j.passkey_count})]})]}),J&&(0,Z.jsx)(_e,{getAuthorizeUrl:ne,onUnlinkRequest:e=>p({id:e.id,name:e.display_name}),providers:M,unlinkingProvider:c}),(0,Z.jsx)(ge,{isConfigManaged:P,isDeletionEnabled:U,onDeleteClick:()=>w(!0)}),(0,Z.jsx)(Le,{isOpen:h===`set`,onClose:()=>_(null)}),(0,Z.jsx)(ke,{isOpen:h===`change`,onClose:()=>_(null)}),(0,Z.jsx)(Ie,{isOpen:h===`remove`,onClose:()=>_(null)}),(0,Z.jsx)(ze,{isOpen:v===`setup`,onClose:()=>b(null)}),(0,Z.jsx)(Me,{isOpen:v===`disable`,onClose:()=>b(null)}),(0,Z.jsx)(Fe,{isOpen:v===`regenerate`,onClose:()=>b(null)}),(0,Z.jsx)(Re,{isOpen:x===`setup`,onClose:()=>S(null)}),(0,Z.jsx)(Ne,{isOpen:x===`manage`,onAddNew:()=>S(`setup`),onClose:()=>S(null)}),(0,Z.jsx)(Se,{isOpen:f!==null,isPending:k.isPending,onClose:()=>p(null),onConfirm:A,providerName:f?.name??``}),(0,Z.jsx)(je,{isOpen:C,onClose:()=>w(!1),retentionDays:G})]})}export{Ve as component};
|
|
2
|
+
//# sourceMappingURL=profile-SHr6F-7b.js.map
|