import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
import { useIntl, FormattedMessage } from 'react-intl';
import { t as transformComparisonV4Response, C as ComparisonTableHeroV2TableTrackingContextProvider } from '../ComparisonTableHeroV2TrackingContext-3f2aabac.js';
import { c as createUrl } from '../createUrl-71d09e7b.js';
import { g as generateUrl, A as AvailablePages } from '../generateUrl-3fc80d02.js';
import { T as Table } from '../tracking-6183d916.js';
import { s as styleInject } from '../style-inject.es-1f59c1d0.js';
import { C as ComparisonTableHeroV2Table } from '../ComparisonTableHeroV2Table-e3ed92dd.js';
import 'react';
import 'duration-fns';
import '../savingsCalculator.js';
import '../quoteFilters-9ddc9e2f.js';
import '../provider-constants-b35398f2.js';
import '../sortQuotesByDeliverySpeedEstimate-f8c8a1b8.js';
import 'date-fns';
import 'react-intersection-observer';
import '@transferwise/components';
import '../index-823145c4.js';
import '@transferwise/formatting';
import '@transferwise/icons';
import '../ProviderLogo-ce8211ca.js';
import '@wise/components-theming';
import '../aliasFilter-a7b9c811.js';
import '../isConsideredMidmarketRate-4f12041d.js';

var css_248z$1 = ".cc_comparison-hero-v2__container_2292392129 {\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  justify-content: center;\n  gap: var(--size-40);\n  width: 100%;\n  padding: var(--size-10);\n}\n@media (min-width: 480px) {\n  .cc_comparison-hero-v2__container_2292392129 {\n    max-width: 567px;\n  }\n  .cc_comparison-hero-v2__container_2292392129.cc_with-speed_2292392129 {\n    max-width: 844px;\n  }\n}\n@media (min-width: 992px) {\n  .cc_comparison-hero-v2__container_2292392129 {\n    padding: 0;\n  }\n}\n\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9jb21wYXJpc29uLXRhYmxlLWhlcm8tdjIvQ29tcGFyaXNvblRhYmxlSGVyb1YyQ29udGFpbmVyLm1vZHVsZS5sZXNzIiwiQ29tcGFyaXNvblRhYmxlSGVyb1YyQ29udGFpbmVyLm1vZHVsZS5sZXNzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUdBO0VBQ0UsYUFBQTtFQUNBLHNCQUFBO0VBQ0EsbUJBQUE7RUFDQSx1QkFBQTtFQUNBLG1CQUFBO0VBQ0EsV0FBQTtFQUNBLHVCQUFBO0FDRkY7QURJRTtFQUFBO0lBQ0UsZ0JBQUE7RUNERjtFREdFO0lBQ0UsZ0JBQUE7RUNESjtBQUNGO0FESUU7RUFBQTtJQUNFLFVBQUE7RUNERjtBQUNGIiwiZmlsZSI6IkNvbXBhcmlzb25UYWJsZUhlcm9WMkNvbnRhaW5lci5tb2R1bGUubGVzcyJ9 */";
var styles = {"comparison-hero-v2__container":"cc_comparison-hero-v2__container_2292392129","comparisonHeroV2__container":"cc_comparison-hero-v2__container_2292392129","with-speed":"cc_with-speed_2292392129","withSpeed":"cc_with-speed_2292392129"};
styleInject(css_248z$1);

var css_248z = ".cc_disclaimerContainer_2292392129 {\n  display: flex;\n  flex-direction: row;\n  flex-wrap: wrap;\n  justify-content: center;\n}\n\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9jb21wYXJpc29uLXRhYmxlLWhlcm8tdjIvQ29tcGFyaXNvblRhYmxlSGVyb1YyRGlzY2xhaW1lci9Db21wYXJpc29uVGFibGVIZXJvVjJEaXNjbGFpbWVyLm1vZHVsZS5sZXNzIiwiQ29tcGFyaXNvblRhYmxlSGVyb1YyRGlzY2xhaW1lci5tb2R1bGUubGVzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFQTtFQUNFLGFBQUE7RUFDQSxtQkFBQTtFQUNBLGVBQUE7RUFDQSx1QkFBQTtBQ0RGIiwiZmlsZSI6IkNvbXBhcmlzb25UYWJsZUhlcm9WMkRpc2NsYWltZXIubW9kdWxlLmxlc3MifQ== */";
var componentStyle = {"disclaimerContainer":"cc_disclaimerContainer_2292392129"};
styleInject(css_248z);

const ComparisonTableHeroV2Disclaimer = ({ paymentMethod = 'bank', content, showSpeedColumn = false, }) => {
    const contentToRender = content || (jsx(DefaultContent, { paymentMethod: paymentMethod, showSpeedColumn: showSpeedColumn }));
    return (jsx("div", Object.assign({ className: `text-xs-center ${showSpeedColumn ? 'np-text-body-default' : 'np-text-body-default-bold'}` }, { children: contentToRender })));
};
const DefaultContent = ({ paymentMethod, showSpeedColumn = false, }) => {
    const { locale } = useIntl();
    const DISCLAIMER_URL = createUrl(generateUrl(locale, 'compare/disclaimer', AvailablePages.COMPARISON_DISCLAIMER));
    return (jsxs("div", Object.assign({ className: `${componentStyle['disclaimerContainer']}` }, { children: [jsx(FormattedMessage, { id: showSpeedColumn ? 'cthv2-disclaimer-body-with-speed' : 'cthv2-disclaimer-body' }), !showSpeedColumn && (jsxs(Fragment, { children: ["\u00A0", jsx(FormattedMessage, { id: 'cthv2-disclaimer-payment-method-' + paymentMethod })] })), "\u00A0", jsx("a", Object.assign({ href: DISCLAIMER_URL, target: "_blank", rel: "noreferrer" }, { children: jsx(FormattedMessage, { id: "cthv2-disclaimer-how-we-collect-data" }) }))] })));
};

const ComparisonTableHeroV2Container = ({ comparisonResponse, midMarketRate, showDisclaimer = true, excludePartners = true, footerCTAType = 'link', footerRedirectUrl, maxVisibleProviders = 4, paymentMethod = 'bank-or-ach', hideFooter = false, alwaysShowFooter = false, showSpeedColumn = false, showFastestFlag = false, showCheapestFlag = false, showAllProviders = false, trackEvent = () => {
    /* do nothing. */
}, }) => {
    const { locale } = useIntl();
    const quotes = transformComparisonV4Response(comparisonResponse, excludePartners);
    if (quotes.length === 0) {
        return null;
    }
    let footertUrl = footerRedirectUrl;
    if (footerCTAType === 'link' && !footerRedirectUrl) {
        footertUrl = createUrl(generateUrl(locale, `compare?sendAmount=${comparisonResponse.amount}&sourceCurrency=${comparisonResponse.sourceCurrency}&targetCurrency=${comparisonResponse.targetCurrency}`, AvailablePages.COMPARISON_HOMEPAGE));
    }
    return quotes.length === 0 ? null : (jsx(ComparisonTableHeroV2TableTrackingContextProvider, Object.assign({ trackEvent: trackEvent, trackingData: {
            comparisonResponse: comparisonResponse,
            componentType: Table.HeroV2,
            excludePartners: excludePartners,
            midMarketRate: midMarketRate,
        } }, { children: jsxs("div", Object.assign({ className: `${styles['comparison-hero-v2__container']} ${showSpeedColumn ? styles['with-speed'] : ''}` }, { children: [jsx(ComparisonTableHeroV2Table, { sendMoney: {
                        currency: comparisonResponse.sourceCurrency,
                        value: comparisonResponse.amount,
                    }, quotes: quotes, showSpeedColumn: showSpeedColumn, footerCTAType: footerCTAType, footerRedirectUrl: footertUrl, hideFooter: !alwaysShowFooter &&
                        (showAllProviders || hideFooter || quotes.length <= maxVisibleProviders), maxVisibleProviders: showAllProviders ? quotes.length : Math.min(maxVisibleProviders, quotes.length), midMarketRate: midMarketRate, showFastestFlag: showFastestFlag, showCheapestFlag: showCheapestFlag }), showDisclaimer && (jsx(ComparisonTableHeroV2Disclaimer, { paymentMethod: paymentMethod, showSpeedColumn: showSpeedColumn }))] })) })));
};

export { ComparisonTableHeroV2Container, ComparisonTableHeroV2Disclaimer };
//# sourceMappingURL=index.js.map
