import{r as n,j as e,L as f}from"./vendor-react-f9GpqhU8.js";import{l as d,C as z,g as E,a as F}from"./index-YIaDEtYb.js";import{S as M}from"./SEOHead-_a__KoIo.js";import{x as $,y as q,d as R,h as H,z as Z}from"./vendor-icons-CFki6-W-.js";import{N as I}from"./NewsletterForm-BzwPmoPn.js";import{u as v}from"./useQuery-BCWjVG_Y.js";import"./vendor-utils-DjInyQU5.js";import"./vendor-ui-E0laiDhI.js";import"./vendor-supabase-DU84N46d.js";import"./button-B-hxtExd.js";import"./input-BEyrNZiQ.js";import"./card-DyZWyZVu.js";const b=9,re=()=>{const[g,j]=n.useState("newest"),[m,w]=n.useState(""),[o,N]=n.useState(""),[i,l]=n.useState(1),C=window.location.hostname==="emergences.novahypnose.fr",A="https://novahypnose.fr",{data:L,isLoading:_,isFetching:Q}=v({queryKey:["blog-articles"],queryFn:async()=>{d.debug("📥 [Blog] Chargement des articles depuis Supabase...");const t=performance.now(),s=await E(),a=performance.now();return d.debug(`✅ [Blog] Articles chargés en ${Math.round(a-t)}ms`),s.data||[]},staleTime:300*1e3}),{data:P,isLoading:S,isFetching:O}=v({queryKey:["blog-categories"],queryFn:async()=>{d.debug("📥 [Blog] Chargement des catégories depuis Supabase...");const t=performance.now(),s=await F(),a=performance.now();return d.debug(`✅ [Blog] Catégories chargées en ${Math.round(a-t)}ms`),s.data||[]},staleTime:300*1e3}),r=L||[],y=P||[],p=_||S;n.useEffect(()=>{!p&&r.length>0&&d.debug("⚡ [Blog] Données affichées depuis le cache React Query")},[p,r.length]);const k=n.useMemo(()=>{if(!r.length)return[];const t={};return r.forEach(s=>{s.categories&&Array.isArray(s.categories)&&s.categories.forEach(a=>{t[a]=(t[a]||0)+1})}),Object.entries(t).map(([s,a])=>{const x=y.find(D=>D.name===s);return{name:s,count:a,slug:x?.slug||s.toLowerCase().replace(/\s+/g,"-").replace(/[éèê]/g,"e").replace(/[àâ]/g,"a").replace(/[ùû]/g,"u").replace(/[îï]/g,"i").replace(/[ôö]/g,"o").replace(/ç/g,"c")}}).sort((s,a)=>s.name.localeCompare(a.name))},[r,y]),c=n.useMemo(()=>{let t=r;if(m.trim()){const s=m.toLowerCase();t=t.filter(a=>a.title.toLowerCase().includes(s)||a.meta_description?.toLowerCase().includes(s)||a.excerpt?.toLowerCase().includes(s))}return o&&(t=t.filter(s=>s.categories&&s.categories.includes(o))),t.sort((s,a)=>g==="newest"?new Date(a.published_at||a.created_at).getTime()-new Date(s.published_at||s.created_at).getTime():g==="oldest"?new Date(s.published_at||s.created_at).getTime()-new Date(a.published_at||a.created_at).getTime():0),t},[r,m,o,g]),u=Math.ceil(c.length/b),h=c.slice((i-1)*b,i*b),B={"@context":"https://schema.org","@type":"Blog",name:"Émergences - Le blog de l'hypnose et du bien-être",description:"Plongez dans l'univers fascinant de l'hypnose ericksonienne à travers des articles approfondis, des témoignages inspirants et des conseils pratiques par Alain Zenatti.",url:"https://novahypnose.fr/blog",author:{"@type":"Person",name:"Alain Zenatti",jobTitle:"Maître Hypnologue",url:"https://novahypnose.fr"},publisher:{"@type":"Organization",name:"NovaHypnose",url:"https://novahypnose.fr"},blogPost:h.map(t=>({"@type":"BlogPosting",headline:t.title,url:`https://novahypnose.fr/blog/article/${t.slug}`,datePublished:t.published_at||t.created_at,image:t.image_url,author:{"@type":"Person",name:"Alain Zenatti"}}))},T={"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:[{"@type":"ListItem",position:1,name:"Accueil",item:"https://novahypnose.fr"},{"@type":"ListItem",position:2,name:"Blog",item:"https://novahypnose.fr/blog"}]};return e.jsxs(z,{children:[e.jsx(M,{title:"Blog Hypnose et Bien-être | NovaHypnose Paris",description:"Articles sur l'hypnose ericksonienne, le bien-être et la transformation personnelle. Conseils pratiques par Alain Zenatti, hypnothérapeute à Paris.",type:"website",keywords:["blog hypnose","hypnose ericksonienne","bien-être","développement personnel","auto-hypnose","transformation personnelle"],structuredData:[B,T],url:`${A}/blog`,robots:C?"noindex, nofollow":"index, follow"}),e.jsxs("section",{className:"relative bg-nova-blue-dark text-white py-20",children:[e.jsx("div",{className:"absolute inset-0 bg-black/10"}),e.jsx("div",{className:"container mx-auto px-4 relative z-10",children:e.jsxs("div",{className:"max-w-4xl mx-auto text-center",children:[e.jsx("h1",{className:"text-4xl md:text-6xl font-bold mb-6",children:"Émergences, le blog de l'hypnose et du bien-être"}),e.jsx("p",{className:"text-xl md:text-2xl text-white/90 mb-8 leading-relaxed",children:"Plongez dans l'univers fascinant de l'hypnose ericksonienne à travers des articles approfondis, des témoignages inspirants et des conseils pratiques. Découvrez comment mobiliser vos ressources intérieures pour transformer votre vie, gérer vos émotions et atteindre vos objectifs. Un espace de réflexion et d'apprentissage guidé par Alain Zenatti, Maître Hypnologue à Paris."}),e.jsx("div",{className:"max-w-2xl mx-auto",children:e.jsxs("div",{className:"relative",children:[e.jsx($,{className:"absolute left-4 top-1/2 transform -translate-y-1/2 text-gray-400",size:20}),e.jsx("input",{type:"text",placeholder:"Rechercher un article...","aria-label":"Rechercher un article",value:m,onChange:t=>{w(t.target.value),l(1)},className:"w-full pl-12 pr-4 py-4 rounded-xl text-gray-900 text-lg focus:outline-none focus:ring-2 focus:ring-white shadow-xl"})]})})]})})]}),e.jsx("section",{className:"bg-white border-b border-gray-200",children:e.jsx("div",{className:"container mx-auto px-4 py-6",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("button",{onClick:()=>{N(""),l(1)},className:`px-6 py-2 rounded-full text-sm font-medium transition-all ${o===""?"bg-blue-500 text-white shadow-lg":"bg-gray-100 text-gray-700 hover:bg-gray-200"}`,children:["Tous les articles (",r.length,")"]}),k.map(({name:t,count:s,slug:a})=>e.jsxs(f,{to:`/blog/categorie/${a}`,className:`px-6 py-2 rounded-full text-sm font-medium transition-all ${o===t?"bg-blue-500 text-white shadow-lg":"bg-gray-100 text-gray-700 hover:bg-gray-200"}`,children:[t," (",s,")"]},t))]})})}),e.jsx("section",{className:"py-16 bg-gray-50",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsxs("div",{className:"flex justify-between items-center mb-8",children:[e.jsxs("p",{className:"text-gray-600",children:[c.length," article",c.length>1?"s":""," trouvé",c.length>1?"s":""]}),e.jsxs("select",{value:g,onChange:t=>j(t.target.value),className:"px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",children:[e.jsx("option",{value:"newest",children:"Plus récents"}),e.jsx("option",{value:"oldest",children:"Plus anciens"})]})]}),p?e.jsx("div",{className:"flex justify-center items-center py-20",children:e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500"})}):h.length===0?e.jsx("div",{className:"text-center py-20",children:e.jsx("p",{className:"text-xl text-gray-600",children:"Aucun article trouvé"})}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-8",children:h.map((t,s)=>e.jsxs(f,{to:`/blog/article/${t.slug}`,className:"group bg-white rounded-2xl overflow-hidden shadow-lg hover:shadow-2xl transition-all duration-300 hover:-translate-y-2",children:[e.jsxs("div",{className:"relative h-48 overflow-hidden bg-gray-100",children:[e.jsx("img",{src:t.image_url||"/placeholder.svg",alt:t.title,loading:s<3?"eager":"lazy",fetchpriority:s===0?"high":"auto",className:"w-full h-full object-cover group-hover:scale-110 transition-transform duration-300"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/50 to-transparent"})]}),e.jsxs("div",{className:"p-6",children:[t.categories&&t.categories.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 mb-3",children:t.categories.slice(0,2).map((a,x)=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-3 py-1 bg-blue-100 text-blue-600 rounded-full text-xs font-medium",children:[e.jsx(q,{size:12}),a]},x))}),e.jsx("h3",{className:"text-xl font-bold text-gray-900 mb-3 group-hover:text-blue-600 transition-colors line-clamp-2",children:t.title}),t.excerpt&&e.jsx("p",{className:"text-gray-600 mb-4 line-clamp-3",children:t.excerpt}),e.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-500",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(R,{size:14}),e.jsx("span",{children:new Date(t.published_at||t.created_at).toLocaleDateString("fr-FR",{year:"numeric",month:"long",day:"numeric"})})]}),t.reading_time&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(H,{size:14}),e.jsxs("span",{children:[t.reading_time," min"]})]})]}),e.jsxs("div",{className:"mt-4 flex items-center gap-2 text-blue-600 font-medium group-hover:gap-3 transition-all",children:["Lire l'article",e.jsx(Z,{size:16,className:"group-hover:translate-x-1 transition-transform"})]})]})]},t.id))}),u>1&&e.jsxs("div",{className:"mt-12 flex justify-center gap-2",children:[e.jsx("button",{onClick:()=>l(t=>Math.max(1,t-1)),disabled:i===1,className:"px-4 py-2 rounded-lg bg-white border border-gray-300 text-gray-700 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Précédent"}),Array.from({length:u},(t,s)=>s+1).map(t=>e.jsx("button",{onClick:()=>l(t),className:`px-4 py-2 rounded-lg ${i===t?"bg-blue-500 text-white":"bg-white border border-gray-300 text-gray-700 hover:bg-gray-50"}`,children:t},t)),e.jsx("button",{onClick:()=>l(t=>Math.min(u,t+1)),disabled:i===u,className:"px-4 py-2 rounded-lg bg-white border border-gray-300 text-gray-700 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Suivant"})]})]})]})}),e.jsx("section",{className:"py-16 bg-nova-blue-dark",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsx(I,{})})})]})};export{re as default};