'use client'
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
import { useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { WalletConnectIcon } from '@dynamic-labs/iconic';
import '../../../context/DynamicContext/DynamicContext.js';
import '../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
import '@dynamic-labs/wallet-connector-core';
import '../../../context/ViewContext/ViewContext.js';
import '../../../shared/logger.js';
import '@dynamic-labs/wallet-book';
import '@dynamic-labs/utils';
import '../../constants/colors.js';
import '../../constants/values.js';
import '@dynamic-labs/sdk-api-core';
import '../../../shared/consts/index.js';
import '../../../events/dynamicEvents.js';
import '../../../../../_virtual/_tslib.js';
import '../../../context/CaptchaContext/CaptchaContext.js';
import '../../../context/ErrorContext/ErrorContext.js';
import '@dynamic-labs/multi-wallet';
import 'react-international-phone';
import '../../../store/state/nonce/nonce.js';
import '@dynamic-labs-sdk/client/core';
import '../../../client/client.js';
import '@dynamic-labs-sdk/client';
import '../../../config/ApiEndpoint.js';
import '@dynamic-labs/locale';
import '../../../store/state/dynamicContextProps/dynamicContextProps.js';
import '../../../store/state/primaryWalletId/primaryWalletId.js';
import '../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
import '../../../context/AccessDeniedContext/AccessDeniedContext.js';
import '../../../context/AccountExistsContext/AccountExistsContext.js';
import '../../../context/UserWalletsContext/UserWalletsContext.js';
import { useAuthMode } from '../../../store/state/authMode/authMode.js';
import '../../../context/VerificationContext/VerificationContext.js';
import 'react-dom';
import '../../functions/compareChains/compareChains.js';
import '../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.js';
import '../../../context/ThemeContext/ThemeContext.js';
import '../useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
import { useIsTurnkeyWallet } from '../useIsTurnkeyWallet/useIsTurnkeyWallet.js';
import 'bs58';
import '@dynamic-labs/types';
import '../../../context/SocialRedirectContext/SocialRedirectContext.js';
import '../../../context/LoadingContext/LoadingContext.js';
import '../../../context/WalletContext/WalletContext.js';
import '../useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.js';
import 'yup';
import '../../../context/MockContext/MockContext.js';
import '../../../views/CollectUserDataView/useFields.js';
import '../../../context/FieldsStateContext/FieldsStateContext.js';
import '../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
import '@dynamic-labs/rpc-providers';
import '../../../store/state/walletOptions/walletOptions.js';
import '../../../components/Accordion/components/AccordionItem/AccordionItem.js';
import '../../../components/Alert/Alert.js';
import '../../../components/ShadowDOM/ShadowDOM.js';
import '../../../components/IconButton/IconButton.js';
import '../../../components/InlineWidget/InlineWidget.js';
import '../../../components/Input/Input.js';
import '../../../components/IsBrowser/IsBrowser.js';
import '../../../components/MenuList/Dropdown/Dropdown.js';
import '../../../components/OverlayCard/OverlayCard.js';
import '../../../components/Transition/ZoomTransition/ZoomTransition.js';
import '../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
import '../../../components/Transition/OpacityTransition/OpacityTransition.js';
import '../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
import '../../../components/Popper/Popper/Popper.js';
import '../../../components/Popper/PopperContext/PopperContext.js';
import 'react-focus-lock';
import 'qrcode';
import 'formik';
import '../useSubdomainCheck/useSubdomainCheck.js';
import '../../../context/WalletGroupContext/WalletGroupContext.js';
import '../../../context/IpConfigurationContext/IpConfigurationContext.js';
import '../../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
import '../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
import '@hcaptcha/react-hcaptcha';
import '../../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
import '../../../widgets/DynamicWidget/helpers/convertExchangeKeyAndProviderEnum.js';
import '../../../views/ExchangeWhitelistWarning/ExchangeWhitelistWarning.js';
import '../../../context/ErrorContext/hooks/useErrorText/useErrorText.js';
import '../../../context/FooterAnimationContext/index.js';
import '../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.js';
import '../../../context/PasskeyContext/PasskeyContext.js';
import '../../../context/OnrampContext/OnrampContext.js';
import '../../../store/state/sendBalances.js';
import '../../../store/state/connectorsInitializing/connectorsInitializing.js';
import '../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
import '../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
import '../../../views/TransactionConfirmationView/TransactionConfirmationView.js';
import '../../../widgets/DynamicWidget/components/PasskeyCard/PasskeyCard.js';
import '../../../widgets/DynamicWidget/views/CryptoComOnramp/CryptoComOnramp.js';
import '../../../../index.js';
import '../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.js';
import '../../../store/state/tokenBalances.js';
import '../../../store/state/multichainBalances.js';
import '../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';

const useDynamicLayoutData = ({ view }) => {
    const { t } = useTranslation();
    const { isTurnkeyWalletWithoutAuthenticator } = useIsTurnkeyWallet();
    const { selectedWalletConnector } = useInternalDynamicContext();
    const authMode = useAuthMode();
    const helpHeaderMap = useMemo(() => ({
        'login-with-email-or-wallet-full-wallet-list': {
            copykey: 'dyn_login.helper.all_wallet_list',
            heading: t('dyn_login.helper.all_wallet_list'),
        },
        'login-with-wallet-only': {
            copykey: 'dyn_login.helper.wallet_only',
            heading: t('dyn_login.helper.wallet_only'),
        },
        'passkey-intro': {
            copykey: 'dyn_passkey_intro.helper.title',
            heading: t('dyn_passkey_intro.helper.title'),
        },
        'pending-connect': {
            copykey: 'dyn_login.helper.pending_connect.title',
            heading: t('dyn_login.helper.pending_connect.title'),
        },
        'pending-signature': {
            copykey: 'dyn_login.helper.pending_signature.title',
            heading: t('dyn_login.helper.pending_signature.title'),
        },
        'pending-signature-without-back-button': {
            copykey: 'dyn_login.helper.pending_signature_without_back_button.title',
            heading: t('dyn_login.helper.pending_signature_without_back_button.title'),
        },
        'qr-code': {
            copykey: 'dyn_login.helper.qr_code.title',
            heading: t('dyn_login.helper.qr_code.title'),
        },
        'wallet-connect-mobile-wallets-list': {
            copykey: 'dyn_wallet_conect.mobile.wallet_list.helper',
            heading: t('dyn_wallet_conect.mobile.wallet_list.helper'),
        },
        'wallet-list': {
            copykey: 'dyn_wallet_list.helper',
            heading: t('dyn_wallet_list.helper'),
        },
    }), [t]);
    const headerMap = useMemo(() => {
        var _a;
        return ({
            'account-exists': {
                copykey: 'dyn_account_exists.title',
                heading: t('dyn_account_exists.title'),
            },
            'backup-unsuccessful': {
                copykey: 'dyn_waas.backup_unsuccessful.title',
                heading: t('dyn_waas.backup_unsuccessful.title'),
            },
            'chainalysis-blocked-wallet': {
                copykey: 'dyn_chainalysis_blocked_wallet.title',
                heading: t('dyn_chainalysis_blocked_wallet.title'),
            },
            'confirm-exchange-transfer': {
                copykey: 'dyn_exchange_transfer_confirmation.title',
                heading: t('dyn_exchange_transfer_confirmation.title'),
            },
            'deposit-view': {
                copykey: 'dyn_deposit.title',
                heading: t('dyn_deposit.title'),
            },
            'duplicate-wallet': {
                copykey: 'dyn_duplicate_wallet.title',
                heading: t('dyn_duplicate_wallet.title'),
            },
            'embedded-delete-view': {
                copykey: 'dyn_embedded_delete.title',
                heading: t('dyn_embedded_delete.title'),
            },
            'embedded-wallet-exists': {
                copykey: 'dyn_wallet_link.already_exists.title',
                heading: t('dyn_wallet_link.already_exists.title'),
            },
            'external-funding-exchange-list': {
                copykey: 'dyn_wallet_funding.from_exchange.title',
                heading: t('dyn_wallet_funding.from_exchange.title'),
            },
            'external-funding-wallet-list': {
                copykey: 'dyn_wallet_funding.from_external_wallet.title',
                heading: t('dyn_wallet_funding.from_external_wallet.title'),
            },
            'farcaster-connect-view': {
                copykey: 'dyn_login.qr_code.title',
                heading: t('dyn_login.qr_code.title'),
            },
            'login-with-email-or-wallet': {
                copykey: 'dyn_login.title.all',
                heading: t('dyn_login.title.all'),
            },
            'login-with-email-or-wallet-full-wallet-list': {
                copykey: 'dyn_login.title.all_wallet_list',
                heading: t('dyn_login.title.all_wallet_list'),
            },
            'login-with-email-verification': {
                copykey: 'dyn_otp_verification.confirm_code',
                heading: t('dyn_otp_verification.confirm_code'),
            },
            'login-with-sms-verification': {
                copykey: 'dyn_otp_verification.confirm_code',
                heading: t('dyn_otp_verification.confirm_code'),
            },
            'login-with-wallet-only': {
                copykey: 'dyn_login.title.wallet_only',
                heading: t('dyn_login.title.wallet_only'),
            },
            'merge-user-accounts': {
                copykey: 'dyn_merge_user_accounts.wallet.title',
                heading: t('dyn_merge_user_accounts.wallet.title'),
            },
            'merge-user-accounts-conflicts': {
                copykey: 'dyn_merge_user_accounts_conflicts.title',
                heading: t('dyn_merge_user_accounts_conflicts.title'),
            },
            'mfa-choose-device': {
                copykey: 'dyn_mfa.choose_device_view.title',
                heading: t('dyn_mfa.choose_device_view.title'),
            },
            'mfa-display-backup-codes': {
                copykey: 'dyn_mfa.display_backup_codes_view.title',
                heading: t('dyn_mfa.display_backup_codes_view.title'),
            },
            'mfa-recovery': {
                copykey: 'dyn_mfa.recovery_view.title',
                heading: t('dyn_mfa.recovery_view.title'),
            },
            'mfa-secure-device': {
                copykey: 'dyn_mfa.secure_device_view.title',
                heading: t('dyn_mfa.secure_device_view.title'),
            },
            'mfa-secure-device-help': {
                copykey: 'dyn_mfa.secure_device_view.helper.title',
                heading: t('dyn_mfa.secure_device_view.helper.title'),
            },
            'mfa-verification': {
                copykey: 'dyn_mfa.otp_verification_view.title',
                heading: t('dyn_mfa.otp_verification_view.title'),
            },
            'mobile-wallet-redirect-view': {
                copykey: 'dyn_login.mobile_wallet_redirect.backup_title',
                heading: (_a = selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name) !== null && _a !== void 0 ? _a : t('dyn_login.mobile_wallet_redirect.backup_title'),
            },
            'multi-wallet-wallet-list': {
                copykey: authMode === 'connect-only'
                    ? 'dyn_wallet_list.title.connect'
                    : 'dyn_wallet_list.title.link',
                heading: authMode === 'connect-only'
                    ? t('dyn_wallet_list.title.connect')
                    : t('dyn_wallet_list.title.link'),
            },
            'network-not-supported': {
                copykey: 'dyn_network_not_supported.title',
                heading: t('dyn_network_not_supported.title'),
            },
            'passkey-recovery-complete': {
                copykey: isTurnkeyWalletWithoutAuthenticator
                    ? 'dyn_passkey_secure_modal.complete.title'
                    : 'dyn_passkey_recovery.complete.title',
                heading: isTurnkeyWalletWithoutAuthenticator
                    ? t('dyn_passkey_secure_modal.complete.title')
                    : t('dyn_passkey_recovery.complete.title'),
            },
            'passkey-recovery-start': {
                copykey: isTurnkeyWalletWithoutAuthenticator
                    ? 'dyn_passkey_secure_modal.start.title'
                    : 'dyn_passkey_recovery.start.title',
                heading: isTurnkeyWalletWithoutAuthenticator
                    ? t('dyn_passkey_secure_modal.start.title')
                    : t('dyn_passkey_recovery.start.title'),
            },
            'pending-connect': {
                copykey: 'dyn_login.connect_wallet.title',
                heading: t('dyn_login.connect_wallet.title'),
            },
            'pending-signature': {
                copykey: 'dyn_login.sign_wallet.title',
                heading: t('dyn_login.sign_wallet.title'),
            },
            'qr-code': {
                copykey: 'dyn_login.qr_code.title',
                heading: t('dyn_login.qr_code.title'),
            },
            'select-hardware-wallet': {
                copykey: 'dyn_select_hardware_wallet.title',
                heading: t('dyn_select_hardware_wallet.title'),
            },
            'select-wallet-in-wallet-group': {
                copykey: 'dyn_login.select_wallet_in_wallet_group.title',
                heading: t('dyn_login.select_wallet_in_wallet_group.title'),
            },
            'unified-wallet-exchange-list': {
                copykey: 'dyn_unified_list.title',
                heading: t('dyn_unified_list.title'),
            },
            'user-delete-account': {
                copykey: 'dyn_settings.delete_account.title',
                heading: t('dyn_settings.delete_account.title'),
            },
            'verify-email': {
                copykey: 'dyn_otp_verification.confirm_code',
                heading: t('dyn_otp_verification.confirm_code'),
            },
            'verify-sms': {
                copykey: 'dyn_otp_verification.confirm_code',
                heading: t('dyn_otp_verification.confirm_code'),
            },
            'wallet-connect-mobile-wallets-list': {
                copykey: 'dyn_wallet_conect.mobile.wallet_list.title',
                heading: (jsxs(Fragment, { children: [jsx(WalletConnectIcon, { style: { height: '1.5rem', width: '1.5rem' } }), ' ', t('dyn_wallet_conect.mobile.wallet_list.title')] })),
            },
            'wallet-group': {
                copykey: 'dyn_login.wallet_group.title',
                heading: t('dyn_login.wallet_group.title'),
            },
            'wallet-list': {
                copykey: 'dyn_wallet_list.title.select',
                heading: t('dyn_wallet_list.title.select'),
            },
            'wallet-sign': {
                copykey: 'dyn_wallet_transfer.sign.title',
                heading: t('dyn_wallet_transfer.sign.title'),
            },
            'wallet-used': {
                copykey: 'dyn_wallet_link.title',
                heading: t('dyn_wallet_link.title'),
            },
        });
    }, [isTurnkeyWalletWithoutAuthenticator, selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name, t]);
    const descriptionMap = useMemo(() => ({}), []);
    if (view === 'no-access') {
        const headerData = {
            copykey: 'dyn_no_access.title',
            heading: t('dyn_no_access.title'),
        };
        return { headerData };
    }
    if (view === 'access-blocked') {
        const headerData = {
            copykey: 'dyn_access_blocked.title',
            heading: t('dyn_access_blocked.title'),
        };
        return { headerData };
    }
    const helpHeaderData = helpHeaderMap[view];
    const headerData = headerMap[view];
    const descriptionData = descriptionMap[view];
    return {
        descriptionData,
        headerData,
        helpHeaderData,
    };
};

export { useDynamicLayoutData };
