'use client'
'use strict';

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

var _tslib = require('../../../../../_virtual/_tslib.cjs');
var email = require('../../../data/api/email/email.cjs');
require('@dynamic-labs/sdk-api-core');
require('@dynamic-labs/utils');
require('@dynamic-labs/iconic');
require('@dynamic-labs/wallet-connector-core');
require('react');
require('react/jsx-runtime');
require('../../ViewContext/ViewContext.cjs');
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('@dynamic-labs-sdk/client/core');
require('eventemitter3');
require('@dynamic-labs-sdk/client');
require('../../../config/ApiEndpoint.cjs');
require('@dynamic-labs/multi-wallet');
require('react-international-phone');
require('../../../store/state/nonce/nonce.cjs');
require('@dynamic-labs-wallet/browser-wallet-client');
require('../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
require('../../../store/state/primaryWalletId/primaryWalletId.cjs');
require('../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
require('../../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.cjs');
require('../../../events/dynamicEvents.cjs');
require('@dynamic-labs/locale');
var buildEmailOtpHandler = require('./buildEmailOtpHandler/buildEmailOtpHandler.cjs');
var otpVerificationStorage = require('./otpVerificationStorage/otpVerificationStorage.cjs');

const createEmailHandler = (environmentId, embeddedWalletSessionKeys) => (email$1, captchaToken) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
    const createEmailVerificationResponse = yield email.createEmailVerification({
        captchaToken,
        email: email$1,
        environmentId,
    });
    const { verificationUUID } = createEmailVerificationResponse;
    otpVerificationStorage.persistOtpVerificationState({
        captchaToken,
        destination: email$1,
        type: 'email',
        verificationUUID,
    });
    return buildEmailOtpHandler.buildEmailOtpHandler({
        captchaToken,
        email: email$1,
        embeddedWalletSessionKeys,
        environmentId,
        initialVerificationUUID: verificationUUID,
    });
});

exports.createEmailHandler = createEmailHandler;
