1import{j as e}from"./editor-BhGk7_S1.js";import{u as b,b as A,a as j,L as Q}from"./index-BjIHAQhU.js";import{b as o}from"./leaflet-DcfcX7a_.js";import{A as T,a as F,b as N,c as v}from"./accordion-CaT-JHyX.js";import{A as q}from"./arrow-left-DCV3pRgt.js";import"./mapbox-BPFQ-Sfv.js";import"./trpc-DqtxhgQo.js";import"./index-CHxMfpQB.js";import"./chevron-down-BC8hO1vL.js";function D(){const{language:m}=b(),{data:d,isLoading:u}=A.faq.getSections.useQuery({language:m}),l=o.useMemo(()=>{if(!d)return console.log("No faqData yet"),[];console.log("Raw faqData:",d);const t=d.map(s=>{const a=s.sectionKey||`section-${s.id||"unknown"}`,c=(s.items||[]).map(r=>({id:r.itemKey||`item-${r.id||"unknown"}`,question:r.question||"No question",answer:r.answer||"No answer"}));return{id:a,icon:s.icon||"â",title:s.title||"Untitled Section",items:c}});return console.log("Transformed sections:",t),t},[d]),i=["screening","ambassador","about","dscovr"],n=o.useMemo(()=>{const t=l.filter(a=>a&&i.includes(a.id)).sort((a,c)=>i.indexOf(a.id)-i.indexOf(c.id)),s=l.filter(a=>a&&!i.includes(a.id));return[...t,...s]},[l]);o.useMemo(()=>{const t=[];return n.forEach(s=>{t.push({type:"section",id:`section-${s.id}`,sectionId:s.id,icon:s.icon,title:s.title}),s.items.forEach(a=>{t.push({type:"question",id:`question-${s.id}-${a.id}`,sectionId:s.id,question:a.question,answer:a.answer})})}),t},[n]);
1const[x,p]=o.useState(["screening","ambassador"]),[g,h]=o.useState([]),f=t=>{p(s=>s.includes(t)?s.filter(a=>a!==t):[...s,t])};return u?e.jsxs("div",{"data-loc":"client/src/pages/FAQTest.tsx:133",className:"min-h-screen flex items-center justify-center bg-background text-foreground",children:[e.jsx("div",{"data-loc":"client/src/pages/FAQTest.tsx:134",className:"starfield"}),e.jsxs("div",{"data-loc":"client/src/pages/FAQTest.tsx:135",className:"flex flex-col items-center gap-4",children:[e.jsx(j,{"data-loc":"client/src/pages/FAQTest.tsx:136",className:"w-12 h-12 animate-spin text-primary"}),e.jsx("p",{"data-loc":"client/src/pages/FAQTest.tsx:137",className:"text-muted-foreground",children:"Chargement des données FAQ..."})]})]}):e.jsxs("div",{"data-loc":"client/src/pages/FAQTest.tsx:144",className:"min-h-screen bg-background text-foreground",children:[e.jsx("div",{"data-loc":"client/src/pages/FAQTest.tsx:145",className:"starfield"}),e.jsxs("div",{"data-loc":"client/src/pages/FAQTest.tsx:147",className:"relative z-10",children:[e.jsx("header",{"data-loc":"client/src/pages/FAQTest.tsx:149",className:"border-b border-border bg-card/50 backdrop-blur-sm",children:e.jsx("div",{"data-loc":"client/src/pages/FAQTest.tsx:150",className:"container py-6",children:e.jsxs("div",{"data-loc":"client/src/pages/FAQTest.tsx:151",className:"flex items-center gap-4",children:[e.jsx(Q,{"data-loc":"client/src/pages/FAQTest.tsx:152",href:"/",children:e.jsxs("button",{"data-loc":"client/src/pages/FAQTest.tsx:153",className:"flex items-center gap-2 text-muted-foreground hover:text-foreground transition-colors",children:[e.jsx(q,{"data-loc":"client/src/pages/FAQTest.tsx:154",className:"w-5 h-5"}),e.jsx("span",{"data-loc":"client/src/pages/FAQTest.tsx:155",children:"Retour"})]})}),e.jsxs("div",{"data-loc":"client/src/pages/FAQTest.tsx:158",children:[e.jsx("h1",{"data-loc":"client/src/pages/FAQTest.tsx:159",className:"text-3xl font-bold text-foreground",children:"FAQ Test Page (Fixed)"}),e.jsx("p",{"data-loc":"client/src/pages/FAQTest.tsx:160",className:"text-sm text-muted-foreground mt-1",children:"Ãtape 3 : Solution sans accordions imbriqués"})]})]})})}),e.jsx("main",{"data-loc":"client/src/pages/FAQTest.tsx:169",className:"container py-8",children:e.jsx("div",{"data-loc":"client/src/pages/FAQTest.tsx:170",className:"max-w-4xl mx-auto",children:e.jsxs("div",{"data-loc":"client/src/pages/FAQTest.tsx:171",className:"bg-card/50 backdrop-blur-sm rounded-lg border border-border p-6 space-y-4",children:[e.jsxs("div",{"data-loc":"client/src/pages/FAQTest.tsx:172",className:"mb-4 p-4 bg-green-500/10 border border-green-500/30 rounded",children:[e.jsx("h2",{"data-loc":"client/src/pages/FAQTest.tsx:173",className:"text-lg font-semibold text-green-400 mb-2",children:"â
Solution : Un seul Accordion, pas d'imbrication"}),e.jsx("p",{"data-loc":"client/src/pages/FAQTest.tsx:176",className:"text-sm text-muted-foreground",children:"Chaque section et question a un ID unique dans un seul Accordion"})]}),e.jsx("div",{"data-loc":"client/src/pages/FAQTest.tsx:182",className:"space-y-3",children:n.map(t=>e.jsxs("div",{"data-loc":"client/src/pages/FAQTest.tsx:184",className:"border border-border rounded-lg bg-card/30 overflow-hidden",children:[e.jsxs("button",{"data-loc":"client/src/pages/FAQTest.tsx:186",onClick:()=>f(t.id),className:"w-full px-4 py-3 hover:bg-accent/50 transition-colors flex items-center justify-between",children:[e.jsxs("div",{"data-loc":"client/src/pages/FAQTest.tsx:190",className:"flex items-center gap-3",children:[e.jsx("span",{"data-loc":"client/src/pages/FAQTest.tsx:191",className:"text-2xl",children:t.icon}),e.jsx("span",{"data-loc":"client/src/pages/FAQTest.tsx:192",className:"font-semibold text-lg text-left",children:t.title})]}),e.jsx("svg",{"data-loc":"client/src/pages/FAQTest.tsx:194",className:`w-5 h-5 transition-transform ${x.includes(t.id)?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{"data-loc":"client/src/pages/FAQTest.tsx:200",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M19 9l-7 7-7-7"})})]}),x.includes(t.id)&&e.jsx("div",{"data-loc":"client/src/pages/FAQTest.tsx:206",className:"px-4 pb-4",children:e.jsx(T,{"data-loc":"client/src/pages/FAQTest.tsx:207",type:"single",collapsible:!0,value:g.find(s=>
1s.startsWith(`${t.id}-`)),onValueChange:s=>{h(a=>{const c=a.filter(r=>!r.startsWith(`${t.id}-`));return s?[...c,s]:c})},className:"space-y-2",children:t.items.map(s=>e.jsxs(F,{"data-loc":"client/src/pages/FAQTest.tsx:222",value:`${t.id}-${s.id}`,className:"border border-border/50 rounded bg-background/50",children:[e.jsx(N,{"data-loc":"client/src/pages/FAQTest.tsx:227",className:"px-3 py-2 text-sm hover:bg-accent/30",children:s.question}),e.jsx(v,{"data-loc":"client/src/pages/FAQTest.tsx:230",className:"px-3 pb-2 text-sm text-muted-foreground",children:e.jsx("div",{"data-loc":"client/src/pages/FAQTest.tsx:231",dangerouslySetInnerHTML:{__html:s.answer}})})]},`${t.id}-${s.id}`))})})]},t.id))}),e.jsxs("div",{"data-loc":"client/src/pages/FAQTest.tsx:243",className:"mt-6 p-4 bg-muted/30 rounded border border-border",children:[e.jsx("h3",{"data-loc":"client/src/pages/FAQTest.tsx:244",className:"font-semibold mb-2",children:"Ãtat actuel :"}),e.jsxs("p",{"data-loc":"client/src/pages/FAQTest.tsx:245",className:"text-sm text-muted-foreground",children:["Sections ouvertes : ",x.join(", ")||"aucune"]}),e.jsxs("p",{"data-loc":"client/src/pages/FAQTest.tsx:248",className:"text-sm text-muted-foreground mt-1",children:["Nombre de sections : ",n.length]}),e.jsxs("p",{"data-loc":"client/src/pages/FAQTest.tsx:251",className:"text-sm text-muted-foreground mt-1",children:["Total questions : ",n.reduce((t,s)=>t+s.items.length,0)]}),e.jsxs("p",{"data-loc":"client/src/pages/FAQTest.tsx:254",className:"text-sm text-muted-foreground mt-1",children:["Langue : ",m]})]})]})})})]})]})}export{D as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.