"use client";
import { jsx as c } from "react/jsx-runtime";
import { useState as l } from "react";
import f from "../../components/Accordion/accordion.module.css";
import { AccordionItem as I } from "./components/AccordionItem/AccordionItem.es.js";
const w = ({ items: o, mode: s = "multiple" }) => {
  const [r, i] = l(null), [m, p] = l(/* @__PURE__ */ new Set()), a = (t) => {
    s === "single" ? i((e) => e === t ? null : t) : p((e) => {
      const n = new Set(e);
      return n.has(t) ? n.delete(t) : n.add(t), n;
    });
  }, u = (t) => s === "single" ? r === t : m.has(t);
  return /* @__PURE__ */ c("div", { className: f.container, children: o.map((t, e) => /* @__PURE__ */ c(
    I,
    {
      title: t.title,
      content: t.content,
      isOpen: u(e),
      index: e,
      onClick: a,
      icon: t.icon,
      isLast: e === o.length - 1
    },
    e
  )) });
};
export {
  w as Accordion
};
