"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),T=require("react"),g=require("../../types/analytics/analytics.cjs.js"),V=require("../../utils/useIsMobile.cjs.js"),f=require("../Comparison/assets/company-logo.svg.cjs.js"),q=require("../Comparison/utils.cjs.js"),e=require("../../src/modules/ComparisonV2/comparisonV2.module.css"),r=require("../../utils/cn/cn.cjs.js"),_=require("../../components/HighlightedTitle/HighlightedTitle.cjs.js"),c=require("../../components/Typography/Typography.cjs.js"),M=require("./components/ComparisonV2Tooltip/ComparisonV2Tooltip.cjs.js"),H=require("../../components/Icon/Icon.cjs.js"),B=require("../../components/Icon/constants.cjs.js"),D=require("../../components/Button/Button.cjs.js"),E=({title:j,description:u,ctaBlock:h,getStartedLink:p,comparisonV2Columns:x})=>{const[t,d]=T.useState(null),[m,n]=T.useState(null),b=V.useIsMobile(768),C=a=>{var l;(l=window.eventBus)==null||l.emit("analytics",{event:g.EAnalyticsEvent.ctaClicked,type:g.EAnalyticsEventType.interaction,component:"Comparison V2",payload:{link:p}})},N=a=>{b&&(t===a?(n(a),setTimeout(()=>{d(null),n(null)},250)):t?(n(t),setTimeout(()=>{n(null),d(a)},250)):d(a))},v=a=>{a==null||a.stopPropagation(),t&&(n(t),setTimeout(()=>{d(null),n(null)},250))};return s.jsx("div",{className:e.root,children:s.jsxs("div",{className:e.container,children:[s.jsxs("div",{className:e.header,children:[s.jsx(_.HighlightedTitle,{title:j,defaultVariant:"displayMd",mobileVariant:"headingXl",className:e.title}),u&&s.jsx(c.Typography,{as:"p",defaultVariant:"bodyLg",mobileVariant:"bodySm",className:e.description,children:u})]}),s.jsxs("div",{className:e.tableContainer,children:[s.jsx("div",{className:e.table,children:x.map((a,l)=>s.jsxs("div",{className:r.cn(e.alternativeCol,{[e.featuredCol]:a.featured}),children:[s.jsx("div",{className:r.cn(e.alternativeHeaderCell,{[e.featuredHeaderCell]:a.featured}),children:q.isHealthspan(a.comparisonV2Header.type)?s.jsx(f.default,{className:e.logo,"aria-label":"Healthspan logo"}):s.jsx(c.Typography,{as:"h3",defaultVariant:"headingLg",mobileVariant:"preambleMd",className:e.headerText,children:a.comparisonV2Header.title})}),a.comparisonV2Cells.map((o,y)=>{const i=`comparison-${l}-${y}`;return s.jsxs("div",{className:e.alternativeContent,onClick:()=>N(i),children:[(t===i||m===i)&&s.jsx(M.ComparisonV2Tooltip,{title:o.title,description:o.description||"",onClose:v,isOpening:t===i&&!m,isClosing:m===i}),s.jsx(c.Typography,{as:"p",defaultVariant:"preambleMd",mobileVariant:"bodyXl",className:r.cn(e.alternativeTitle,{[e.activeTitle]:t===i}),children:o.title}),o.description&&s.jsxs("div",{className:e.rowDescriptionContainer,children:[s.jsx(c.Typography,{as:"p",defaultVariant:"bodyMd",mobileVariant:"bodySm",className:r.cn(e.featuredDescription,e.hideMobile),children:o.description}),s.jsx(H.Icon,{name:B.EIconName.DOT,className:r.cn(e.dot,e.hideDesktop,{[e.activeDot]:t===i})})]})]},y)})]},l))}),h&&p&&s.jsx("div",{className:e.ctaContainer,children:s.jsxs("div",{className:e.ctaBlock,children:[s.jsx(c.Typography,{as:"p",defaultVariant:"preambleMd",className:e.ctaText,children:h}),s.jsx("div",{className:e.ctaButton,children:s.jsx(D.Button,{as:"a",href:p||"#",size:"lg",onClick:C,children:"Get started"})})]})})]})]})})};exports.ComparisonV2=E;
