'use client'
'use strict';

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

var jsxRuntime = require('react/jsx-runtime');
var reactI18next = require('react-i18next');
var iconic = require('@dynamic-labs/iconic');
var sdkApiCore = require('@dynamic-labs/sdk-api-core');
require('@dynamic-labs/utils');
require('../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
require('react');
var close = require('../../shared/assets/close.cjs');
var copy = require('../../shared/assets/copy.cjs');
var externalLink = require('../../shared/assets/externalLink.cjs');
require('../../context/ViewContext/ViewContext.cjs');
var Button = require('../../components/Button/Button.cjs');
require('../../components/Alert/Alert.cjs');
require('../../events/dynamicEvents.cjs');
require('../../../../_virtual/_tslib.cjs');
require('../../context/DynamicContext/DynamicContext.cjs');
require('../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
require('@dynamic-labs/wallet-connector-core');
require('../../shared/logger.cjs');
require('@dynamic-labs/wallet-book');
require('../../utils/constants/colors.cjs');
require('../../utils/constants/values.cjs');
require('../../shared/consts/index.cjs');
require('../../store/state/authMode/authMode.cjs');
var useInternalDynamicContext = require('../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.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');
var pixelToRem = require('../../utils/functions/pixelToRem/pixelToRem.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('../../context/VerificationContext/VerificationContext.cjs');
require('react-dom');
require('../../utils/functions/compareChains/compareChains.cjs');
require('../Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.cjs');
var useIconThemeVariant = require('../../utils/hooks/useIconThemeVariant/useIconThemeVariant.cjs');
require('../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
require('bs58');
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('../CollectUserDataView/useFields.cjs');
require('../../context/FieldsStateContext/FieldsStateContext.cjs');
require('../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
require('@dynamic-labs/rpc-providers');
require('../../store/state/walletOptions/walletOptions.cjs');
var Typography = require('../../components/Typography/Typography.cjs');
require('../../context/FooterAnimationContext/index.cjs');
require('../../components/ShadowDOM/ShadowDOM.cjs');
require('../../components/Transition/ZoomTransition/ZoomTransition.cjs');
require('../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
require('../../components/Transition/OpacityTransition/OpacityTransition.cjs');
require('../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
require('../../context/WalletGroupContext/WalletGroupContext.cjs');
require('../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
require('react-focus-lock');
var IconWithSpinner = require('../../components/IconWithSpinner/IconWithSpinner.cjs');
var shortenWalletAddress = require('../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.cjs');
require('../../context/ThemeContext/ThemeContext.cjs');
require('../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
var IconButton = require('../../components/IconButton/IconButton.cjs');
var ModalHeader = require('../../components/ModalHeader/ModalHeader.cjs');
var TypographyButton = require('../../components/TypographyButton/TypographyButton.cjs');
require('../../components/MenuList/Dropdown/Dropdown.cjs');
require('formik');
require('../../utils/hooks/useSubdomainCheck/useSubdomainCheck.cjs');
require('../../store/state/sendBalances.cjs');
var Input = require('../../components/Input/Input.cjs');
require('../../components/OverlayCard/OverlayCard.cjs');
require('../TransactionConfirmationView/TransactionConfirmationView.cjs');
require('../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
require('../../context/PasskeyContext/PasskeyContext.cjs');
require('../../widgets/DynamicWidget/components/PasskeyCard/PasskeyCard.cjs');
require('../../widgets/DynamicWidget/views/CryptoComOnramp/CryptoComOnramp.cjs');
require('../../context/OnrampContext/OnrampContext.cjs');
require('../../../index.cjs');
var convertExchangeKeyAndProviderEnum = require('../../widgets/DynamicWidget/helpers/convertExchangeKeyAndProviderEnum.cjs');
var CopyButton = require('../../components/CopyButton/CopyButton.cjs');
require('qrcode');
require('../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.cjs');
require('../../context/IpConfigurationContext/IpConfigurationContext.cjs');
require('../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
require('../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
require('@hcaptcha/react-hcaptcha');
require('../../context/ErrorContext/hooks/useErrorText/useErrorText.cjs');
require('../MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.cjs');
require('../../store/state/connectorsInitializing/connectorsInitializing.cjs');
require('../../store/state/tokenBalances.cjs');
require('../../store/state/multichainBalances.cjs');
require('../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
require('../../components/InlineWidget/InlineWidget.cjs');
require('../../components/IsBrowser/IsBrowser.cjs');
require('../../components/Popper/Popper/Popper.cjs');
require('../../components/Popper/PopperContext/PopperContext.cjs');

const docsLink = (exchange) => {
    if (exchange === sdkApiCore.ExchangeKeyEnum.Kraken) {
        return 'https://support.kraken.com/articles/360000672863-adding-and-confirming-a-new-cryptocurrency-withdrawal-address';
    }
    return undefined;
};
const exchangeAppUrlMap = {
    [sdkApiCore.ExchangeKeyEnum.Kraken]: 'https://www.kraken.com/',
    [sdkApiCore.ExchangeKeyEnum.Coinbase]: 'https://www.coinbase.com/',
};
const openExchangeApp = (exchange) => {
    const url = exchangeAppUrlMap[exchange];
    if (url)
        window.open(url, '_blank', 'noopener,noreferrer');
};
const iconSize = 96;
const ExchangeWhitelistWarning = ({ onContinue, exchange, onClose, }) => {
    var _a;
    const { t } = reactI18next.useTranslation();
    const iconThemeVariant = useIconThemeVariant.useIconThemeVariant();
    const { primaryWallet } = useInternalDynamicContext.useInternalDynamicContext();
    const closeButton = (jsxRuntime.jsx(IconButton.IconButton, { onClick: onClose, type: 'button', id: 'close-button', "data-testid": 'close-button', children: jsxRuntime.jsx(close.ReactComponent, {}) }));
    const link = docsLink(exchange);
    const exchangeDisplayName = exchange.charAt(0).toUpperCase() + exchange.slice(1);
    return (jsxRuntime.jsxs("div", { className: 'exchange-whitelist-warning', children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { trailing: closeButton, children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', copykey: 'dyn_exchange_whitelist_warning.title', children: t('dyn_exchange_whitelist_warning.title') }) }), jsxRuntime.jsxs("div", { className: 'exchange-whitelist-warning__content', children: [jsxRuntime.jsx("div", { className: 'exchange-whitelist-warning__content__icon-holder', children: jsxRuntime.jsx(iconic.SocialIcon, { name: convertExchangeKeyAndProviderEnum.convertExchangeKeytoProviderEnum(exchange), variant: iconThemeVariant, style: {
                                height: pixelToRem.pixelToRem(iconSize * IconWithSpinner.iconRatio),
                                width: pixelToRem.pixelToRem(iconSize * IconWithSpinner.iconRatio),
                            } }) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', className: 'exchange-whitelist-warning__content__description', copykey: 'dyn_exchange_whitelist_warning.description', children: t('dyn_exchange_whitelist_warning.description', {
                            exchange: exchangeDisplayName,
                        }) }), jsxRuntime.jsxs("div", { className: 'exchange-whitelist-warning__content__steps', children: [jsxRuntime.jsxs("div", { className: 'exchange-whitelist-warning__content__steps__step', children: [jsxRuntime.jsx("div", { className: 'exchange-whitelist-warning__content__steps__step__number-badge', children: "1" }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'primary', copykey: 'dyn_exchange_whitelist_warning.step1', children: t(`dyn_exchange_whitelist_warning.step1.${exchange}`) })] }), jsxRuntime.jsxs("div", { className: 'exchange-whitelist-warning__content__steps__step', children: [jsxRuntime.jsx("div", { className: 'exchange-whitelist-warning__content__steps__step__number-badge', children: "2" }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'primary', copykey: 'dyn_exchange_whitelist_warning.step2', children: t('dyn_exchange_whitelist_warning.step2') })] }), jsxRuntime.jsxs("div", { className: 'exchange-whitelist-warning__content__steps__step', children: [jsxRuntime.jsx("div", { className: 'exchange-whitelist-warning__content__steps__step__number-badge', children: "3" }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'primary', copykey: 'dyn_exchange_whitelist_warning.step3', children: t('dyn_exchange_whitelist_warning.step3', {
                                            exchange: exchangeDisplayName,
                                        }) })] })] }), jsxRuntime.jsxs("div", { className: 'exchange-whitelist-warning__content__address', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_exchange_whitelist_warning.address', children: t('dyn_exchange_whitelist_warning.address') }), jsxRuntime.jsxs("div", { className: 'exchange-whitelist-warning__content__address__copy', children: [jsxRuntime.jsx("div", { className: 'exchange-whitelist-warning__content__address__copy__copy-input', children: jsxRuntime.jsx(Input.Input, { id: 'wallet_address', "data-testid": 'wallet_address', label: shortenWalletAddress.shortenWalletAddress(primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.address), disabled: true }) }), jsxRuntime.jsx(CopyButton.CopyButton, { textToCopy: (_a = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.address) !== null && _a !== void 0 ? _a : '', children: jsxRuntime.jsx(copy.ReactComponent, {}) })] })] }), link && (jsxRuntime.jsxs("div", { className: 'exchange-whitelist-warning__content__instructions', children: [jsxRuntime.jsx(Typography.Typography, { as: 'a', weight: 'bold', href: link, target: '_blank', rel: 'noreferrer', className: 'exchange-whitelist-warning__content__instructions__link', variant: 'body_small', children: t('dyn_exchange_whitelist_warning.view_instructions') }), jsxRuntime.jsx(externalLink.ReactComponent, { style: {
                                    height: pixelToRem.pixelToRem(12),
                                    marginLeft: pixelToRem.pixelToRem(8),
                                    width: pixelToRem.pixelToRem(12),
                                }, className: 'exchange-whitelist-warning__content__steps__step__icon' })] })), jsxRuntime.jsx("div", { className: 'exchange-whitelist-warning__content__open', children: jsxRuntime.jsxs(Button.Button, { onClick: () => openExchangeApp(exchange), buttonVariant: 'primary', className: 'exchange-whitelist-warning__content__open__button', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', children: t('dyn_exchange_whitelist_warning.open', {
                                        exchange: exchangeDisplayName,
                                    }) }), jsxRuntime.jsx(externalLink.ReactComponent, { style: {
                                        height: pixelToRem.pixelToRem(14),
                                        marginLeft: pixelToRem.pixelToRem(8),
                                        width: pixelToRem.pixelToRem(14),
                                    } })] }) }), jsxRuntime.jsx("div", { className: 'exchange-whitelist-warning__content__done', children: jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'continue-button', buttonVariant: 'brand-primary', typographyProps: { color: 'white', weight: 'regular' }, className: 'exchange-whitelist-warning__content__done__button', onClick: () => {
                                onContinue();
                            }, copykey: 'dyn_exchange_whitelist_warning.done', children: t('dyn_exchange_whitelist_warning.done') }) })] })] }));
};

exports.ExchangeWhitelistWarning = ExchangeWhitelistWarning;
