'use client'
import { jsx, jsxs } from 'react/jsx-runtime';
import { useTranslation } from 'react-i18next';
import '@dynamic-labs/utils';
import '../../../../components/Accordion/components/AccordionItem/AccordionItem.js';
import 'react';
import { ReactComponent as SvgArrowLeft } from '../../../../shared/assets/arrow-left.js';
import '@dynamic-labs/iconic';
import '../../../../context/ViewContext/ViewContext.js';
import '../../../../../../_virtual/_tslib.js';
import '@dynamic-labs/wallet-connector-core';
import '../../../../shared/logger.js';
import '@dynamic-labs/wallet-book';
import '../../../../utils/constants/colors.js';
import '../../../../utils/constants/values.js';
import '@dynamic-labs/sdk-api-core';
import '../../../../shared/consts/index.js';
import '../../../../components/Alert/Alert.js';
import '../../../../events/dynamicEvents.js';
import '../../../../context/DynamicContext/DynamicContext.js';
import '../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
import '../../../../store/state/authMode/authMode.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 '../../../../context/VerificationContext/VerificationContext.js';
import 'react-dom';
import '../../../../utils/functions/compareChains/compareChains.js';
import '../../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.js';
import '../../../../context/ThemeContext/ThemeContext.js';
import '../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
import 'bs58';
import '@dynamic-labs/types';
import '../../../../context/SocialRedirectContext/SocialRedirectContext.js';
import '../../../../context/LoadingContext/LoadingContext.js';
import '../../../../context/WalletContext/WalletContext.js';
import '../../../../utils/hooks/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 { PoweredByDynamic } from '../../../../components/PoweredByDynamic/PoweredByDynamic.js';
import '../../../../context/FooterAnimationContext/index.js';
import '../../../../components/ShadowDOM/ShadowDOM.js';
import '../../../../components/Transition/ZoomTransition/ZoomTransition.js';
import '../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
import '../../../../components/Transition/OpacityTransition/OpacityTransition.js';
import '../../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
import '../../../../context/WalletGroupContext/WalletGroupContext.js';
import '../../components/DynamicWidgetHeader/DynamicWidgetHeader.js';
import { ModalCard } from '../../../../components/ModalCard/ModalCard.js';
import 'react-focus-lock';
import { Typography } from '../../../../components/Typography/Typography.js';
import { shortenWalletAddress } from '../../../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.js';
import { Divider } from '../../../../components/Divider/Divider.js';
import { useWidgetContext } from '../../context/DynamicWidgetContext.js';
import { IconButton } from '../../../../components/IconButton/IconButton.js';
import { ModalHeader } from '../../../../components/ModalHeader/ModalHeader.js';
import { TypographyButton } from '../../../../components/TypographyButton/TypographyButton.js';
import '../../../../components/MenuList/Dropdown/Dropdown.js';
import { Image } from '../../../../components/Image/Image.js';
import 'formik';
import '../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.js';
import '../../../../store/state/sendBalances.js';
import '../../../../components/Input/Input.js';
import '../../../../components/OverlayCard/OverlayCard.js';
import '../../../../views/TransactionConfirmationView/TransactionConfirmationView.js';
import '../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
import '../../../../context/PasskeyContext/PasskeyContext.js';
import '../../components/PasskeyCard/PasskeyCard.js';
import '../CryptoComOnramp/CryptoComOnramp.js';
import '../../../../context/OnrampContext/OnrampContext.js';
import '../../../../../index.js';
import '../../helpers/convertExchangeKeyAndProviderEnum.js';
import 'qrcode';
import '../ReceiveWalletFunds/ReceiveWalletFunds.js';
import '../../../../context/IpConfigurationContext/IpConfigurationContext.js';
import '../../../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
import '../../../DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
import '@hcaptcha/react-hcaptcha';
import '../../../../views/ExchangeWhitelistWarning/ExchangeWhitelistWarning.js';
import '../../../../context/ErrorContext/hooks/useErrorText/useErrorText.js';
import '../../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.js';
import '../../../../store/state/connectorsInitializing/connectorsInitializing.js';
import '../../../../store/state/tokenBalances.js';
import '../../../../store/state/multichainBalances.js';
import '../../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
import '../../../../components/InlineWidget/InlineWidget.js';
import '../../../../components/IsBrowser/IsBrowser.js';
import '../../../../components/Popper/Popper/Popper.js';
import '../../../../components/Popper/PopperContext/PopperContext.js';

const ConfirmExchangeTransferView = ({ amount, toAddress, exchange, token, accountIdentifier, fiatAmount, fee, feeInFiat, fiatCurrencySymbol, onSubmit, onBack, }) => {
    const { t } = useTranslation();
    const { goToInitialDynamicWidgetView } = useWidgetContext();
    const backButton = (jsx(IconButton, { type: 'button', id: 'back-button', "data-testid": 'back-button', onClick: () => {
            onBack();
        }, children: jsx(SvgArrowLeft, {}) }));
    return (jsxs("div", { className: 'confirm-exchange-transfer', children: [jsx(ModalHeader, { leading: backButton, children: jsx(Typography, { variant: 'title', copykey: 'dyn_exchange_transfer_confirmation.title', children: t('dyn_exchange_transfer_confirmation.title') }) }), jsxs("div", { className: 'confirm-exchange-transfer__content', children: [jsx("div", { className: 'confirm-exchange-transfer__content__modal', children: jsxs(ModalCard, { border: false, sharpBorder: true, dropShadow: false, children: [jsxs("div", { className: 'confirm-exchange-transfer__content__modal__top', children: [jsxs("div", { className: 'confirm-exchange-transfer__content__modal__top__token', children: [(token === null || token === void 0 ? void 0 : token.logoURI) ? (jsx(Image, { src: token.logoURI, alt: token.symbol, className: 'confirm-exchange-transfer__content__modal__top__token__icon', dataTestId: 'confirm-exchange-transfer__content__modal__top__token__icon' })) : (jsx("div", { className: 'confirm-exchange-transfer__content__modal__top__token__icon--skeleton', "data-testid": 'confirm-exchange-transfer__content__modal__top__token__icon--skeleton' })), jsx(Typography, { variant: 'body_normal', className: 'confirm-exchange-transfer__content__modal__top__token__name', children: token === null || token === void 0 ? void 0 : token.symbol }), jsxs("div", { className: 'confirm-exchange-transfer__content__modal__top__token__balance-container', children: [jsx(Typography, { variant: 'body_normal', weight: 'medium', "data-testid": 'confirm-exchange-transfer_token-option__primary', copykey: 'dyn_exchange_transfer_confirmation.send', children: t('dyn_exchange_transfer_confirmation.send', {
                                                                fiatCurrency: fiatAmount,
                                                                fiatCurrencySymbol,
                                                            }) }), jsx(Typography, { weight: 'medium', variant: 'body_small', color: 'secondary', "data-testid": 'confirm-exchange-transfer_token-option__secondary', children: `${amount} ${token === null || token === void 0 ? void 0 : token.symbol}` })] })] }), jsx(Divider, {})] }), jsxs("div", { className: 'confirm-exchange-transfer__content__modal__transaction', children: [jsxs("div", { className: 'confirm-exchange-transfer__content__modal__transaction__from', children: [jsx(Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'confirm-exchange-transfer__content__modal__transaction__from__title', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__from__title', copykey: 'dyn_exchange_transfer_confirmation.from', children: t('dyn_exchange_transfer_confirmation.from') }), jsx(Typography, { variant: 'body_normal', weight: 'regular', className: 'confirm-exchange-transfer__content__modal__transaction__from__exchange', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__from__exchange', children: accountIdentifier
                                                        ? `${(exchange === null || exchange === void 0 ? void 0 : exchange.charAt(0).toUpperCase()) + (exchange === null || exchange === void 0 ? void 0 : exchange.slice(1))} ${accountIdentifier}`
                                                        : `${(exchange === null || exchange === void 0 ? void 0 : exchange.charAt(0).toUpperCase()) + (exchange === null || exchange === void 0 ? void 0 : exchange.slice(1))}` })] }), jsx(Divider, {}), jsxs("div", { className: 'confirm-exchange-transfer__content__modal__transaction__from', children: [jsx(Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'confirm-exchange-transfer__content__modal__transaction__from__title', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__from__title', copykey: 'dyn_exchange_transfer_confirmation.to', children: t('dyn_exchange_transfer_confirmation.to') }), jsx(Typography, { variant: 'body_normal', weight: 'regular', className: 'confirm-exchange-transfer__content__modal__transaction__from__exchange', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__from__exchange', children: shortenWalletAddress(toAddress) })] }), jsx(Divider, {}), jsxs("div", { className: 'confirm-exchange-transfer__content__modal__transaction__from', children: [jsx(Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'confirm-exchange-transfer__content__modal__transaction__from__title', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__from__title', copykey: 'dyn_exchange_transfer_confirmation.fee', children: t('dyn_exchange_transfer_confirmation.fee') }), jsx(Typography, { variant: 'body_normal', weight: 'medium', className: 'confirm-exchange-transfer__content__modal__transaction__from__exchange', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__from__exchange', copykey: 'dyn_exchange_transfer_confirmation.fee_not_found', children: fee
                                                        ? `${feeInFiat} ${fiatCurrencySymbol} (${fee} ${token === null || token === void 0 ? void 0 : token.symbol})`
                                                        : t('dyn_exchange_transfer_confirmation.fee_not_found') })] }), jsx(Divider, {}), jsxs("div", { className: 'confirm-exchange-transfer__content__modal__transaction__receive', children: [jsxs("div", { className: 'confirm-exchange-transfer__content__modal__transaction__receive__container', children: [jsx(Typography, { variant: 'body_normal', weight: 'bold', color: 'secondary', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__receive__container', copykey: 'dyn_exchange_transfer_confirmation.receive', children: t('dyn_exchange_transfer_confirmation.receive') }), jsx(Typography, { weight: 'medium', variant: 'body_small', color: 'secondary', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__receive__container__fees', copykey: 'dyn_exchange_transfer_confirmation.cost', children: fee
                                                                ? t('dyn_exchange_transfer_confirmation.cost')
                                                                : t('dyn_exchange_transfer_confirmation.cost_no_fee') })] }), jsxs("div", { className: 'confirm-exchange-transfer__content__modal__transaction__receive__amount-container', children: [jsx(Typography, { variant: 'body_normal', weight: 'bold', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__receive__container', children: fee && fiatAmount && feeInFiat
                                                                ? `${fiatAmount - feeInFiat} ${fiatCurrencySymbol}`
                                                                : `${fiatAmount} ${fiatCurrencySymbol}` }), jsx(Typography, { weight: 'medium', variant: 'body_small', color: 'secondary', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__receive__container__fees', children: fee && amount
                                                                ? `${amount - fee} ${token === null || token === void 0 ? void 0 : token.symbol}`
                                                                : `${amount} ${token === null || token === void 0 ? void 0 : token.symbol}` })] })] })] })] }) }), jsx("div", { className: 'confirm-exchange-transfer__content__terms', children: jsx(ModalCard, { border: false, sharpBorder: true, dropShadow: false, children: jsx(Typography, { variant: 'body_small', weight: 'regular', className: 'confirm-exchange-transfer__content__modal__transaction__from__exchange', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__from__exchange', copykey: 'dyn_exchange_transfer_confirmation.terms', children: t('dyn_exchange_transfer_confirmation.terms') }) }) }), jsxs("div", { className: 'confirm-exchange-transfer__content__buttons', children: [jsx("div", { className: 'confirm-exchange-transfer__content__buttons__button', children: jsx(TypographyButton, { dataTestId: 'cancel-button', buttonVariant: 'card', typographyProps: { weight: 'bold' }, className: 'confirm-exchange-transfer__content__buttons__button', onClick: () => {
                                        goToInitialDynamicWidgetView();
                                    }, copykey: 'dyn_exchange_transfer_confirmation.cancel', children: t('dyn_exchange_transfer_confirmation.cancel') }) }), jsx("div", { className: 'confirm-exchange-transfer__content__buttons__button', children: jsx(TypographyButton, { dataTestId: 'confirm-button', buttonVariant: 'brand-primary', typographyProps: { color: 'white', weight: 'bold' }, className: 'confirm-exchange-transfer__content__buttons__button', onClick: () => {
                                        onSubmit();
                                    }, copykey: 'dyn_exchange_transfer_confirmation.confirm', children: t('dyn_exchange_transfer_confirmation.confirm') }) })] })] }), jsx("div", { className: 'confirm-exchange-transfer__content__footer', children: jsx(PoweredByDynamic, { asFooter: true }) })] }));
};

export { ConfirmExchangeTransferView };
