import { __awaiter } from '../node_modules/.pnpm/@rollup_plugin-typescript@12.1.4_rollup@4.46.2_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.mjs';
import { jsxs, jsx } from 'react/jsx-runtime';
import { getTranslations } from 'next-intl/server';
import { cn } from '@windrun-huaiin/lib/utils';
import { richText } from './rich-text-expert.mjs';
import { FAQInteractive } from './faq-interactive.mjs';
import { responsiveSection } from './section-layout.mjs';

function FAQ(_a) {
    return __awaiter(this, arguments, void 0, function* ({ locale, sectionClassName }) {
        const t = yield getTranslations({ locale, namespace: 'faq' });
        // Process translation data
        const rawItems = t.raw('items');
        const data = {
            title: t('title'),
            description: richText(t, 'description'),
            items: rawItems.map((item, index) => ({
                id: `faq-item-${index}`,
                question: item.question,
                answer: richText(t, `items.${index}.answer`)
            }))
        };
        return (jsxs("section", { id: "faq", className: cn(responsiveSection, sectionClassName), children: [jsx("h2", { className: "text-3xl md:text-4xl font-bold text-center mb-4", children: data.title }), jsx("p", { className: "text-center text-gray-600 dark:text-gray-400 mb-12 text-base sm:text-lg mx-auto max-w-3xl", children: data.description }), jsx("div", { className: "space-y-6", children: data.items.map((item) => (jsxs("div", { "data-faq-id": item.id, className: "bg-white dark:bg-gray-800/60 p-6 rounded-xl border border-gray-200 dark:border-gray-700 hover:border-purple-300 dark:hover:border-purple-500/50 transition shadow-sm dark:shadow-none", children: [jsxs("button", { className: "w-full flex items-center justify-between text-left focus:outline-none", "data-faq-toggle": item.id, "aria-expanded": "false", children: [jsx("span", { className: "text-lg font-semibold text-gray-900 dark:text-gray-100", children: item.question }), jsx("svg", { className: "w-6 h-6 text-gray-400 ml-2 transition-transform duration-200", "data-faq-icon": item.id, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" }) })] }), jsx("div", { className: "mt-4 text-gray-700 dark:text-gray-300 text-base hidden", "data-faq-content": item.id, children: item.answer })] }, item.id))) }), jsx(FAQInteractive, { data: data })] }));
    });
}

export { FAQ };
