'use client'
'use strict';

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

var sdkApiCore = require('@dynamic-labs/sdk-api-core');
var utils = require('@dynamic-labs/utils');
require('@dynamic-labs-sdk/client/core');
require('../../client/client.cjs');
require('react');
require('@dynamic-labs-sdk/client');
var ApiEndpoint = require('../../config/ApiEndpoint.cjs');
require('@dynamic-labs/iconic');
require('@dynamic-labs/wallet-connector-core');
require('react/jsx-runtime');
require('../../context/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');
var getApiHeaders = require('../../client/extension/hooks/useInitializeSdkClient/getApiHeaders/getApiHeaders.cjs');
require('../../events/dynamicEvents.cjs');
var getProjectSettings = require('../../client/extension/projectSettings/getProjectSettings/getProjectSettings.cjs');
require('../../../../_virtual/_tslib.cjs');
var isCookieEnabled = require('../../client/extension/functions/isCookieEnabled/isCookieEnabled.cjs');
var getMinAuthToken = require('../../client/extension/functions/getMinAuthToken/getMinAuthToken.cjs');
require('@dynamic-labs/multi-wallet');
require('react-international-phone');
require('../../store/state/nonce/nonce.cjs');
var randomString = require('../../utils/functions/randomString/randomString.cjs');
require('@dynamic-labs/locale');
require('../../store/state/dynamicContextProps/dynamicContextProps.cjs');
require('../../store/state/primaryWalletId/primaryWalletId.cjs');
require('../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');

const sdkApi = ({ customHeaders } = {}) => {
    const settings = {
        basePath: ApiEndpoint.getBaseUrl(),
        headers: Object.assign(Object.assign({ 'Content-Type': 'application/json', 'x-dyn-request-id': randomString.randomString(50) }, getApiHeaders.getApiHeaders()), customHeaders),
    };
    const minJwt = getMinAuthToken.getMinAuthToken();
    if (minJwt) {
        settings.headers.Authorization = `Bearer ${minJwt}`;
    }
    const projectSettings = getProjectSettings.getProjectSettings();
    const credentials = projectSettings && isCookieEnabled.isCookieEnabled() ? 'include' : undefined;
    return new sdkApiCore.SDKApi(new sdkApiCore.Configuration(Object.assign(Object.assign({}, settings), { credentials, fetchApi: utils.FetchService.fetch })));
};

exports.sdkApi = sdkApi;
