"use client";
import { jsx as t, jsxs as e } from "react/jsx-runtime";
import { useState as u, useCallback as g } from "react";
import { cn as h } from "../../utils/cn/cn.es.js";
import r from "../../components/FeaturesList/featuresList.module.css";
import { TypeBadge as S } from "../TypeBadge/TypeBadge.es.js";
import { Typography as p } from "../Typography/Typography.es.js";
import { Superscript as a } from "../Superscript/Superscript.es.js";
import { IconBracket as N } from "../IconBracket/IconBracket.es.js";
const w = ({ features: n }) => {
  const [o, m] = u([]), d = g((i) => {
    m((s) => s.includes(i) ? s.filter((l) => l !== i) : [...s, i]);
  }, []);
  return /* @__PURE__ */ t("div", { className: r.root, children: n.map((i, s) => {
    const l = i.description && i.collapsible, b = !!i.description, c = /* @__PURE__ */ e("div", { className: r.labelWrapper, children: [
      /* @__PURE__ */ t(S, { type: i.type }, s),
      /* @__PURE__ */ e(
        p,
        {
          className: r.label,
          as: "span",
          defaultVariant: "bodyMd",
          mobileVariant: "labelLg",
          weight: "regular",
          children: [
            i.label,
            i.labelSuperscript && !isNaN(i.labelSuperscript) && /* @__PURE__ */ t(a, { value: i.labelSuperscript.toString() })
          ]
        }
      )
    ] });
    return /* @__PURE__ */ e("div", { className: r.feature, children: [
      l ? /* @__PURE__ */ e("button", { className: r.header, onClick: () => d(s), children: [
        c,
        /* @__PURE__ */ t(N, { variant: o.includes(s) ? "close" : "plus", size: "md" })
      ] }) : c,
      b && /* @__PURE__ */ e(
        p,
        {
          as: "p",
          defaultVariant: "bodySm",
          className: h(r.description, {
            [r.descriptionActive]: o.includes(s) || !l
          }),
          weight: "regular",
          children: [
            i.description,
            i.descriptionSuperscript && !isNaN(i.descriptionSuperscript) && /* @__PURE__ */ t(a, { value: i.descriptionSuperscript.toString() })
          ]
        }
      )
    ] }, `${i.label}-${s}`);
  }) });
};
export {
  w as FeaturesList
};
