'use client'
'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var jsxRuntime = require('react/jsx-runtime');
var reactI18next = require('react-i18next');
var CopyButton = require('../../../../components/CopyButton/CopyButton.cjs');
var IconButton = require('../../../../components/IconButton/IconButton.cjs');
var ModalHeader = require('../../../../components/ModalHeader/ModalHeader.cjs');
var QRCode = require('../../../../components/QRCode/QRCode.cjs');
var Typography = require('../../../../components/Typography/Typography.cjs');
require('react');
require('../../../../context/DynamicContext/DynamicContext.cjs');
require('../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
require('@dynamic-labs/iconic');
require('@dynamic-labs/wallet-connector-core');
var arrowLeft = require('../../../../shared/assets/arrow-left.cjs');
var copy = require('../../../../shared/assets/copy.cjs');
var embeddedWalletIcon = require('../../../../shared/assets/embedded-wallet-icon.cjs');
require('../../../../context/ViewContext/ViewContext.cjs');
require('../../../../shared/logger.cjs');
require('@dynamic-labs/wallet-book');
require('@dynamic-labs/utils');
require('../../../../utils/constants/colors.cjs');
require('../../../../utils/constants/values.cjs');
require('@dynamic-labs/sdk-api-core');
require('../../../../shared/consts/index.cjs');
require('../../../../events/dynamicEvents.cjs');
require('../../../../../../_virtual/_tslib.cjs');
require('../../../../context/CaptchaContext/CaptchaContext.cjs');
require('../../../../context/ErrorContext/ErrorContext.cjs');
require('@dynamic-labs/multi-wallet');
require('react-international-phone');
require('../../../../store/state/nonce/nonce.cjs');
require('@dynamic-labs-sdk/client/core');
require('../../../../client/client.cjs');
require('@dynamic-labs-sdk/client');
require('../../../../config/ApiEndpoint.cjs');
require('@dynamic-labs/locale');
require('../../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
require('../../../../store/state/primaryWalletId/primaryWalletId.cjs');
require('../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
require('../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
require('../../../../context/AccountExistsContext/AccountExistsContext.cjs');
require('../../../../context/UserWalletsContext/UserWalletsContext.cjs');
require('../../../../store/state/authMode/authMode.cjs');
require('../../../../context/VerificationContext/VerificationContext.cjs');
require('react-dom');
require('../../../../utils/functions/compareChains/compareChains.cjs');
require('../../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.cjs');
require('../../../../context/ThemeContext/ThemeContext.cjs');
require('../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
require('bs58');
var usePromise = require('../../../../utils/hooks/usePromise/usePromise.cjs');
require('@dynamic-labs/types');
require('../../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
require('../../../../context/LoadingContext/LoadingContext.cjs');
require('../../../../context/WalletContext/WalletContext.cjs');
require('../../../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.cjs');
require('yup');
require('../../../../context/MockContext/MockContext.cjs');
require('../../../../views/CollectUserDataView/useFields.cjs');
require('../../../../context/FieldsStateContext/FieldsStateContext.cjs');
require('../../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
require('@dynamic-labs/rpc-providers');
require('../../../../store/state/walletOptions/walletOptions.cjs');
require('../../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
require('../../../../components/Alert/Alert.cjs');
require('../../../../components/InlineWidget/InlineWidget.cjs');
require('../../../../components/Input/Input.cjs');
require('../../../../components/IsBrowser/IsBrowser.cjs');
require('../../../../components/MenuList/Dropdown/Dropdown.cjs');
require('../../../../components/OverlayCard/OverlayCard.cjs');
require('../../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
require('../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
require('../../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
require('../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
require('../../../../components/Popper/Popper/Popper.cjs');
require('../../../../components/Popper/PopperContext/PopperContext.cjs');
require('../../../../components/ShadowDOM/ShadowDOM.cjs');
require('react-focus-lock');
var useFetchChain = require('../../hooks/useFetchChain/useFetchChain.cjs');
var shortenWalletAddress = require('../../../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.cjs');
require('formik');
require('../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.cjs');
require('../../../../context/WalletGroupContext/WalletGroupContext.cjs');
require('../../../../context/IpConfigurationContext/IpConfigurationContext.cjs');
require('../../../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
require('../../../DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
require('@hcaptcha/react-hcaptcha');
var DynamicWidgetContext = require('../../context/DynamicWidgetContext.cjs');
require('../../helpers/convertExchangeKeyAndProviderEnum.cjs');
require('../../../../views/ExchangeWhitelistWarning/ExchangeWhitelistWarning.cjs');
require('../../../../context/ErrorContext/hooks/useErrorText/useErrorText.cjs');
require('../../../../context/FooterAnimationContext/index.cjs');
require('../../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.cjs');
require('../../../../context/PasskeyContext/PasskeyContext.cjs');
require('../../../../context/OnrampContext/OnrampContext.cjs');
require('../../../../store/state/sendBalances.cjs');
require('../../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
require('../../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
require('../../components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
require('../../../../views/TransactionConfirmationView/TransactionConfirmationView.cjs');
require('../../components/PasskeyCard/PasskeyCard.cjs');
require('../CryptoComOnramp/CryptoComOnramp.cjs');
require('../../../../../index.cjs');
require('../ReceiveWalletFunds/ReceiveWalletFunds.cjs');
require('../../../../store/state/tokenBalances.cjs');
require('../../../../store/state/multichainBalances.cjs');
require('../../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
var useInternalDynamicContext = require('../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');

const DepositView = () => {
    var _a;
    const { t } = reactI18next.useTranslation();
    const { primaryWallet, getNameService } = useInternalDynamicContext.useInternalDynamicContext();
    const walletConnector = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector;
    const { chain } = useFetchChain.useFetchChain(walletConnector);
    const { setDynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
    const { data: ens } = usePromise.usePromise(() => getNameService(primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.address), { deps: [primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.address], initialData: undefined });
    const ensName = (_a = ens === null || ens === void 0 ? void 0 : ens.name) !== null && _a !== void 0 ? _a : null;
    if (!primaryWallet) {
        return null;
    }
    const backButton = (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', id: 'back-button', "data-testid": 'back-button', onClick: () => setDynamicWidgetView('choose-wallet-funding-method'), children: jsxRuntime.jsx(arrowLeft.ReactComponent, {}) }));
    return (jsxRuntime.jsxs("div", { className: 'deposit-view', children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: backButton, children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', copykey: 'dyn_deposit.title', children: t('dyn_deposit.title') }) }), jsxRuntime.jsxs("div", { className: 'deposit-view__content', children: [jsxRuntime.jsx(QRCode.QRCode, { className: 'deposit-view__content__qr-code', value: primaryWallet.address, Icon: jsxRuntime.jsx(embeddedWalletIcon.ReactComponent, {}), logoSize: 40, logoMargin: 64, size: 215 }), jsxRuntime.jsxs("div", { className: 'deposit-view__content__address', children: [ensName && (jsxRuntime.jsx(Typography.Typography, { className: 'deposit-view__content__address__ens', variant: 'title', children: ensName })), jsxRuntime.jsxs("div", { className: 'deposit-view__content__address__wrapper', children: [jsxRuntime.jsx(Typography.Typography, { "data-testid": 'deposit-view-address', variant: 'title', weight: 'medium', className: 'deposit-view__content__address__wrapper__text', children: shortenWalletAddress.shortenWalletAddress(primaryWallet.address) }), jsxRuntime.jsx(CopyButton.CopyButton, { variant: 'text', textToCopy: primaryWallet.address, className: 'deposit-view__content__address__wrapper__copy', children: jsxRuntime.jsx(copy.ReactComponent, { "data-testid": 'copy-address' }) })] })] }), jsxRuntime.jsxs(Typography.Typography, { className: 'deposit-view__content__network', variant: 'body_small', color: 'secondary', copykey: 'dyn_deposit.receive_funds_on', children: [t('dyn_deposit.receive_funds_on'), chain === null || chain === void 0 ? void 0 : chain.name] })] })] }));
};

exports.DepositView = DepositView;
