import { jsx as i, jsxs as o } from "react/jsx-runtime";
import { EAnalyticsEventType as A, EAnalyticsEvent as C } from "../../types/analytics/analytics.es.js";
import { cn as E } from "../../utils/cn/cn.es.js";
import e from "../../modules/IndividualProductCardV2/individualProductCardV2.module.css";
import { AdvancedGallery as L } from "../../components/AdvancedGallery/AdvancedGallery.es.js";
import { ImageGallery as F } from "../../components/ImageGallery/ImageGallery.es.js";
import { RatingPreview as b } from "../../components/RatingPreview/RatingPreview.es.js";
import { Typography as m } from "../../components/Typography/Typography.es.js";
import { FeaturesList as j } from "../../components/FeaturesList/FeaturesList.es.js";
import { PlainFeaturesGroup as q } from "../../components/PlainFeaturesGroup/PlainFeaturesGroup.es.js";
import { PriceDisplay as z } from "../../components/PriceDisplay/PriceDisplay.es.js";
import { PlanCard as B } from "../IndividualProductCard/components/PlanCard/PlanCard.es.js";
import { Button as M } from "../../components/Button/Button.es.js";
import { Quote as O } from "../../components/Quote/Quote.es.js";
const ti = (r) => {
  const {
    zenpatientId: h,
    signupUrl: c,
    name: G,
    description: V,
    label: v,
    images: k,
    advancedGallery: p,
    features: w,
    quote: u,
    featuresGroup: y,
    ratingPreview: f,
    view: l,
    button: a
  } = r, t = l === "plans_list" ? r.plans : void 0, x = t && t.length > 0, g = l === "plans_list" ? r.selectedPlanId : void 0, d = t == null ? void 0 : t.find((n) => n.id === g), P = d ? `${(a == null ? void 0 : a.link) || c}?defaultDurationSelection=${d == null ? void 0 : d.durationAmount}` : (a == null ? void 0 : a.link) || c, S = l === "pricing_display" ? r.priceDisplay : void 0, D = {
    event: C.ctaClicked,
    type: A.interaction,
    component: "Pricing",
    payload: {
      ctaLabel: (a == null ? void 0 : a.text) || "GET STARTED",
      ctaLink: P || c,
      productId: h
    }
  }, I = (n) => {
    var N;
    if (l !== "plans_list" || !r.onSelectPlan) return;
    r.onSelectPlan(n);
    const s = t == null ? void 0 : t.find((_) => _.id === n), T = {
      event: C.userSelectedPlan,
      location: "IPCv2",
      type: A.interaction,
      payload: {
        productId: h,
        planId: n,
        planPrice: s == null ? void 0 : s.price,
        planDuration: s == null ? void 0 : s.duration
      }
    };
    (N = window.eventBus) == null || N.emit("analytics", T);
  };
  return /* @__PURE__ */ i("section", { className: e.root, children: /* @__PURE__ */ o("div", { className: e.mainContainer, children: [
    /* @__PURE__ */ o("div", { className: e.leftColumn, children: [
      p && p.items.length > 0 ? /* @__PURE__ */ i(L, { items: p.items, label: v }) : /* @__PURE__ */ i(F, { images: k, label: v }),
      /* @__PURE__ */ i("div", { className: E(e.ratingContainer, e.mobileOnly), children: /* @__PURE__ */ i(b, { ...f }) }),
      u && /* @__PURE__ */ i("div", { className: e.quoteWrapper, children: /* @__PURE__ */ i(O, { ...u }) })
    ] }),
    /* @__PURE__ */ o("div", { className: e.rightColumn, children: [
      /* @__PURE__ */ o("div", { className: e.header, children: [
        /* @__PURE__ */ i(m, { as: "h1", defaultVariant: "displayXs", mobileVariant: "headingLg", children: G }),
        /* @__PURE__ */ i(
          m,
          {
            as: "p",
            defaultVariant: "bodyMd",
            mobileVariant: "bodySm",
            className: e.description,
            children: V
          }
        )
      ] }),
      /* @__PURE__ */ i(j, { features: w }),
      y && /* @__PURE__ */ i(q, { ...y }),
      l === "pricing_display" && S && /* @__PURE__ */ i(z, { items: S }),
      l === "plans_list" && x && /* @__PURE__ */ i("div", { className: e.plansSection, children: /* @__PURE__ */ o("div", { className: e.plans, children: [
        /* @__PURE__ */ i(m, { as: "h4", defaultVariant: "labelSm", emphasis: !0, weight: "regular", children: "Subscribe & Save" }),
        t.map((n) => /* @__PURE__ */ i(
          B,
          {
            plan: n,
            onSelect: I,
            isActive: g === n.id
          },
          n.id
        ))
      ] }) }),
      /* @__PURE__ */ i("div", { className: E(e.ratingContainer, e.desktopOnly), children: /* @__PURE__ */ i(b, { ...f }) }),
      /* @__PURE__ */ o("div", { className: e.actions, children: [
        /* @__PURE__ */ i(
          M,
          {
            as: "a",
            variant: "primary",
            size: "lg",
            href: P || c,
            analyticsProps: D,
            children: (a == null ? void 0 : a.text) || "Get started"
          }
        ),
        /* @__PURE__ */ i(m, { as: "p", defaultVariant: "labelMd", className: e.hsaFsaText, children: "HSA/FSA Eligible" })
      ] })
    ] })
  ] }) });
};
export {
  ti as IndividualProductCardV2
};
