import{n as e}from"./chunk-B3K2TuZy.js";import{a as t,d as n,p as r,r as i,t as a}from"./jsx-runtime-C2-Nj7wv.js";import{i as o}from"./eventService-DU6EozU3.js";import{d as s}from"./index-BfpLoHKV.js";import{t as c}from"./associationService-DOsFfaSc.js";import{t as l}from"./SEOHead-yW9dtwJ-.js";import{n as u,r as d,t as f}from"./frenchRegions-DIRW9Jtj.js";import{r as p}from"./urlUtils-Du22Qaem.js";var m=e(r()),h=a();function g(e,t){let n=e.location?.postalCode?.trim().slice(0,2).toUpperCase();if(n&&t.departments.includes(n))return!0;let r=e.location?.city?.toLowerCase();return!!r&&t.cities.some(e=>e.toLowerCase()===r)}var _=()=>{let{region:e}=n(),r=e?u[e]:void 0,[a,_]=(0,m.useState)([]),[v,y]=(0,m.useState)([]);(0,m.useEffect)(()=>{if(!r)return;let e=!0;return o.getEvents().then(t=>{e&&_(t.filter(e=>g(e,r)).slice(0,6))}).catch(()=>{}),c.getAssociations({region:r.name,page_size:6}).then(t=>{e&&y(t.associations||[])}).catch(()=>{}),()=>{e=!1}},[r]);let b=(0,m.useMemo)(()=>f.filter(e=>e.slug!==r?.slug).slice(0,6),[r]);return r?(0,h.jsxs)(`div`,{className:`min-h-screen bg-gray-50`,children:[(0,h.jsx)(l,{...s(r)}),(0,h.jsxs)(`div`,{className:`max-w-5xl mx-auto px-6 pt-6 text-xs text-gray-400`,children:[(0,h.jsx)(i,{to:`/airsoft`,className:`hover:text-gray-700`,children:`Airsoft par région`}),(0,h.jsx)(`span`,{className:`mx-1.5`,children:`/`}),(0,h.jsx)(`span`,{className:`text-gray-600`,children:r.name})]}),(0,h.jsxs)(`section`,{className:`max-w-5xl mx-auto px-6 pt-4 pb-8`,children:[(0,h.jsxs)(`h1`,{className:`text-3xl md:text-4xl font-bold text-gray-900 leading-tight mb-4`,children:[`Airsoft en `,r.name]}),(0,h.jsx)(`p`,{className:`text-gray-600 text-sm md:text-base leading-relaxed max-w-3xl`,children:r.intro}),(0,h.jsx)(`div`,{className:`flex flex-wrap gap-2 mt-5`,children:r.cities.map(e=>(0,h.jsx)(i,{to:d(e),title:`Organiser une partie à ${e}`,className:`px-3 py-1 bg-white border border-gray-200 rounded-full text-xs font-medium text-gray-600 hover:border-primary-400 hover:text-primary-700 hover:bg-primary-50 transition-colors`,children:e},e))})]}),(0,h.jsxs)(`div`,{className:`max-w-5xl mx-auto px-6 space-y-10 pb-16`,children:[(0,h.jsxs)(`section`,{children:[(0,h.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,h.jsxs)(`h2`,{className:`text-lg font-bold text-gray-900`,children:[`Parties d'airsoft en `,r.name]}),(0,h.jsx)(i,{to:`/events`,className:`text-xs font-semibold text-primary-600 hover:underline`,children:`Voir tout`})]}),a.length>0?(0,h.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:a.map(e=>(0,h.jsxs)(i,{to:p(e.id,e.title,`recommended`),className:`bg-white rounded-xl border border-gray-100 p-4 hover:shadow-md transition-shadow`,children:[(0,h.jsx)(`h3`,{className:`text-sm font-semibold text-gray-900 truncate`,children:e.title}),(0,h.jsx)(`p`,{className:`text-xs text-gray-500 mt-1`,children:[e.location?.city,e.startDate].filter(Boolean).join(` · `)})]},e.id))}):(0,h.jsxs)(`div`,{className:`bg-white rounded-xl border border-dashed border-gray-200 p-6 text-center`,children:[(0,h.jsxs)(`p`,{className:`text-sm text-gray-500 mb-3`,children:[`Aucune partie programmée en `,r.name,` pour le moment.`]}),(0,h.jsx)(i,{to:d(r.cities[0]),className:`inline-block px-4 py-2 bg-gray-900 text-white text-xs font-semibold rounded-lg hover:bg-gray-800 transition-colors`,children:`Organiser la première partie`})]})]}),(0,h.jsxs)(`section`,{children:[(0,h.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,h.jsxs)(`h2`,{className:`text-lg font-bold text-gray-900`,children:[`Associations d'airsoft en `,r.name]}),(0,h.jsx)(i,{to:`/associations`,className:`text-xs font-semibold text-primary-600 hover:underline`,children:`Voir tout`})]}),v.length>0?(0,h.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:v.map(e=>(0,h.jsxs)(i,{to:`/associations/${e.id}`,className:`bg-white rounded-xl border border-gray-100 p-4 hover:shadow-md transition-shadow`,children:[(0,h.jsx)(`h3`,{className:`text-sm font-semibold text-gray-900 truncate`,children:e.name}),(0,h.jsx)(`p`,{className:`text-xs text-gray-500 mt-1`,children:[e.city,e.region].filter(Boolean).join(`, `)||`Association airsoft`})]},e.id))}):(0,h.jsxs)(`div`,{className:`bg-white rounded-xl border border-dashed border-gray-200 p-6 text-center`,children:[(0,h.jsxs)(`p`,{className:`text-sm text-gray-500 mb-3`,children:[`Aucune association référencée en `,r.name,` pour le moment.`]}),(0,h.jsx)(i,{to:`/associations/create`,className:`inline-block px-4 py-2 bg-gray-900 text-white text-xs font-semibold rounded-lg hover:bg-gray-800 transition-colors`,children:`Référencer votre association`})]})]}),(0,h.jsxs)(`section`,{className:`bg-white rounded-2xl border border-gray-100 p-6`,children:[(0,h.jsxs)(`h2`,{className:`text-lg font-bold text-gray-900 mb-3`,children:[`Débuter l'airsoft en `,r.name]}),(0,h.jsxs)(`p`,{className:`text-sm text-gray-600 leading-relaxed mb-3`,children:[`L'airsoft est un loisir de simulation qui se pratique avec des répliques propulsant des billes biodégradables de 6 mm. En `,r.name,`, rejoindre une association locale reste la meilleure façon de débuter : le matériel de sécurité (protection oculaire homologuée avant tout) y est vérifié, les règles expliquées, et les parties encadrées.`]}),(0,h.jsxs)(`p`,{className:`text-sm text-gray-600 leading-relaxed`,children:[`Que vous cherchiez du CQB nerveux, du milsim immersif ou des parties conviviales le week-end, la communauté airsoft de `,r.name,` propose des formats pour tous les niveaux. Consultez notre `,(0,h.jsx)(i,{to:`/blog`,className:`text-primary-600 hover:underline`,children:`blog`}),` pour les guides d'équipement et les conseils aux débutants.`]})]}),(0,h.jsxs)(`section`,{children:[(0,h.jsx)(`h2`,{className:`text-sm font-semibold text-gray-500 mb-3`,children:`Airsoft dans d'autres régions`}),(0,h.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[b.map(e=>(0,h.jsx)(i,{to:`/airsoft/${e.slug}`,className:`px-3 py-1.5 bg-white border border-gray-200 rounded-full text-xs font-medium text-gray-600 hover:border-gray-400 hover:bg-gray-50 transition-colors`,children:e.name},e.slug)),(0,h.jsx)(i,{to:`/airsoft`,className:`px-3 py-1.5 bg-gray-900 text-white rounded-full text-xs font-semibold hover:bg-gray-800 transition-colors`,children:`Toutes les régions`})]})]})]})]}):(0,h.jsx)(t,{to:`/airsoft`,replace:!0})};export{_ as default};