"use client";
import { jsx as l } from "react/jsx-runtime";
import { useState as m } from "react";
import S from "../../components/FAQComponent/faqComponent.module.css";
import { FAQComponentItem as h } from "../FAQComponentItem/FAQComponentItem.es.js";
const I = ({ items: r, mode: n = "multiple", initialActiveIndex: s }) => {
  const [p, c] = m(s != null ? s : null), [u, f] = m(/* @__PURE__ */ new Set()), a = (t) => {
    n === "single" ? c((e) => e === t ? null : t) : f((e) => {
      const o = new Set(e);
      return o.has(t) ? o.delete(t) : o.add(t), o;
    });
  }, g = (t) => n === "single" ? p === t : u.has(t);
  return /* @__PURE__ */ l("div", { className: S.root, children: r.map((t, e) => /* @__PURE__ */ l(
    h,
    {
      title: t.title,
      content: t.content,
      isOpen: g(e),
      index: e,
      onClick: a
    },
    e
  )) });
};
export {
  I as FAQComponent
};
