import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{l as t}from"./vendor-map-UawGledW.js";import{d as n,r,t as i}from"./vendor-react-Botiei7A.js";import{t as a}from"./useTranslation-8J697w9K.js";import{f as o,n as s,r as c}from"./apiFetch-C4rLkcBG.js";import{n as l}from"./userService-D8W-jAMZ.js";import{n as u}from"./AuthContext-nLFdLz-B.js";import{n as d,x as f}from"./index-CYOX-9qz.js";import p from"./purify.es-B76NV0C6.js";import{i as m,n as h}from"./dateUtils-Kj8yC5yn.js";import{t as g}from"./blogService-DZ-Hf5l1.js";import{t as _}from"./SEOHead-_Tbv58pV.js";import{i as v}from"./seoUtils-DY9YQzSR.js";import{t as y}from"./confirm-dialog-Wp9FnBKZ.js";import{t as b}from"./ReportButton-BAN2fxqW.js";var x=e(t()),S=o(),C=new class{async getComments(e,t=1,n=10,r){return s(c(`${S}/blog/posts/${e}/comments`,{page:t,page_size:n,...r?{parent_id:r}:{}}))}async createComment(e,t,n){return s(`${S}/blog/posts/${e}/comments`,{method:`POST`,body:{blog_post_id:e,content:t,parent_id:n}})}async deleteComment(e){await s(`${S}/blog/comments/${e}`,{method:`DELETE`})}async toggleLike(e){return s(`${S}/blog/comments/${e}/like`,{method:`POST`,body:{}})}},w=i(),T=({blogPostId:e})=>{let{t}=a(),{user:n,isAuthenticated:r}=u(),i=d(),[o,s]=(0,x.useState)([]),[c,l]=(0,x.useState)(!0),[f,p]=(0,x.useState)(null),[m,h]=(0,x.useState)(``),[g,_]=(0,x.useState)(!1),[v,b]=(0,x.useState)(1),[S,T]=(0,x.useState)(1),[D,O]=(0,x.useState)(null);(0,x.useEffect)(()=>{k()},[e,v]);let k=async()=>{try{l(!0),p(null);let t=await C.getComments(e,v,10);s(t.comments),T(t.pagination.total_pages)}catch(e){console.error(`Error loading comments:`,e),p(e.response?.data?.error||t(`blog.comments.loadError`))}finally{l(!1)}},A=async n=>{if(n.preventDefault(),!(!m.trim()||!r))try{_(!0),s([await C.createComment(e,m.trim()),...o]),h(``),await k()}catch(e){console.error(`Error creating comment:`,e),i.error(e.response?.data?.error||t(`blog.comments.createError`))}finally{_(!1)}},j=async e=>{if(!r){i.error(t(`blog.comments.loginToLike`));return}try{let t=await C.toggleLike(e);s(o.map(n=>n.id===e?{...n,likes:t.likes}:n))}catch(e){console.error(`Error toggling like:`,e),i.error(e.response?.data?.error||t(`blog.comments.likeError`))}},M=e=>{O(e)};return(0,w.jsxs)(`div`,{className:`mt-12 border-t border-gray-200 pt-8`,children:[(0,w.jsx)(y,{open:D!==null,onConfirm:async()=>{if(!D)return;let e=D;O(null);try{await C.deleteComment(e),s(o.filter(t=>t.id!==e))}catch(e){console.error(`Erreur lors de la suppression:`,e),i.error(e.response?.data?.error||t(`blog.comments.deleteError`))}},onCancel:()=>{O(null)},title:t(`blog.comments.deleteTitle`),message:t(`blog.comments.deleteMessage`),confirmLabel:t(`blog.comments.deleteConfirm`),variant:`danger`}),(0,w.jsx)(`h2`,{className:`text-2xl font-bold text-gray-900 mb-6`,children:t(`blog.comments.title`,{count:o.length})}),r?(0,w.jsx)(`form`,{onSubmit:A,className:`mb-8`,children:(0,w.jsxs)(`div`,{className:`bg-white rounded-lg shadow-sm border border-gray-200 p-4`,children:[(0,w.jsx)(`textarea`,{value:m,onChange:e=>{let t=[...e.target.value];h(t.length>2e3?t.slice(0,2e3).join(``):e.target.value)},placeholder:t(`blog.comments.placeholder`),rows:4,className:`w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-transparent resize-none`,required:!0,minLength:3}),(0,w.jsxs)(`div`,{className:`mt-4 flex justify-between items-center`,children:[(0,w.jsx)(`span`,{className:`text-sm text-gray-500`,children:t(`blog.comments.charCount`,{count:[...m].length})}),(0,w.jsx)(`button`,{type:`submit`,disabled:g||!m.trim(),className:`px-6 py-2 bg-primary-600 text-white rounded-lg hover:bg-primary-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors`,children:t(g?`blog.comments.publishing`:`blog.comments.publish`)})]})]})}):(0,w.jsxs)(`div`,{className:`mb-8 bg-gray-50 border border-gray-200 rounded-lg p-6 text-center`,children:[(0,w.jsx)(`p`,{className:`text-gray-600 mb-4`,children:t(`blog.comments.loginRequired`)}),(0,w.jsx)(`a`,{href:`/login`,className:`inline-block px-6 py-2 bg-primary-600 text-white rounded-lg hover:bg-primary-700 transition-colors`,children:t(`blog.comments.loginButton`)})]}),c?(0,w.jsxs)(`div`,{className:`text-center py-8`,children:[(0,w.jsx)(`div`,{className:`inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-primary-600`}),(0,w.jsx)(`p`,{className:`mt-4 text-gray-600`,children:t(`blog.comments.loading`)})]}):f?(0,w.jsx)(`div`,{className:`bg-red-50 border border-red-200 rounded-lg p-4 text-red-700`,children:f}):o.length===0?(0,w.jsx)(`div`,{className:`text-center py-8 text-gray-500`,children:(0,w.jsx)(`p`,{children:t(`blog.comments.empty`)})}):(0,w.jsxs)(`div`,{className:`space-y-6`,children:[o.map(e=>(0,w.jsx)(E,{comment:e,currentUserId:n?.email,reporterUserId:n?.id,onToggleLike:j,onDelete:M},e.id)),S>1&&(0,w.jsxs)(`div`,{className:`flex justify-center items-center space-x-2 mt-8`,children:[(0,w.jsx)(`button`,{onClick:()=>b(e=>Math.max(1,e-1)),disabled:v===1,className:`px-4 py-2 border border-gray-300 rounded-lg disabled:opacity-50 disabled:cursor-not-allowed hover:bg-gray-50`,children:t(`blog.comments.prev`)}),(0,w.jsx)(`span`,{className:`text-gray-600`,children:t(`blog.comments.pageOf`,{page:v,total:S})}),(0,w.jsx)(`button`,{onClick:()=>b(e=>Math.min(S,e+1)),disabled:v===S,className:`px-4 py-2 border border-gray-300 rounded-lg disabled:opacity-50 disabled:cursor-not-allowed hover:bg-gray-50`,children:t(`blog.comments.next`)})]})]})]})},E=({comment:e,currentUserId:t,reporterUserId:n,onToggleLike:r,onDelete:i})=>{let{t:o}=a(),[s,c]=(0,x.useState)(!1),l=async()=>{c(!0),await r(e.id),c(!1)},u=t&&e.author_id===t;return(0,w.jsxs)(`div`,{className:`bg-white rounded-lg shadow-sm border border-gray-200 p-6`,children:[(0,w.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,w.jsxs)(`div`,{className:`flex-1`,children:[(0,w.jsxs)(`div`,{className:`flex items-center space-x-3 mb-3`,children:[(0,w.jsx)(`div`,{className:`w-10 h-10 bg-primary-100 rounded-full flex items-center justify-center`,children:(0,w.jsx)(`span`,{className:`text-primary-600 font-semibold`,children:e.author_name.charAt(0).toUpperCase()})}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`font-semibold text-gray-900`,children:e.author_name}),(0,w.jsx)(`p`,{className:`text-sm text-gray-500`,children:m(e.created_at)})]})]}),(0,w.jsx)(`p`,{className:`text-gray-700 whitespace-pre-wrap`,children:e.content})]}),(0,w.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[n&&!u&&(0,w.jsx)(b,{targetType:`comment`,targetId:e.id,targetName:o(`blog.comments.reportTarget`,{author:e.author_name}),reporterUserId:n}),u&&(0,w.jsxs)(`button`,{onClick:()=>i(e.id),className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-red-700 bg-red-50 hover:bg-red-100 border border-red-200 rounded-lg transition-colors`,title:o(`blog.comments.deleteCommentTitle`),children:[(0,w.jsx)(`svg`,{className:`w-3.5 h-3.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16`})}),o(`blog.comments.deleteButton`)]})]})]}),(0,w.jsx)(`div`,{className:`mt-4 flex items-center space-x-4`,children:(0,w.jsxs)(`button`,{onClick:l,disabled:s,className:`flex items-center space-x-2 text-gray-600 hover:text-primary-600 transition-colors disabled:opacity-50`,children:[(0,w.jsx)(`svg`,{className:`w-5 h-5 ${e.likes>0?`text-primary-600`:``}`,fill:e.likes>0?`currentColor`:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z`})}),(0,w.jsx)(`span`,{children:e.likes})]})})]})},D=e=>{if(e.includes(`<`)||e.includes(`>`)||e.includes(`&`)){let t=document.createElement(`div`);t.innerHTML=p.sanitize(e),e=t.textContent||e,e.includes(`<`)&&(e=new DOMParser().parseFromString(e,`text/html`).body.innerHTML||e)}return e},O=()=>(0,w.jsxs)(`div`,{className:`min-h-screen bg-white animate-pulse`,children:[(0,w.jsx)(`div`,{className:`h-14 bg-gray-100 border-b border-gray-200`}),(0,w.jsx)(`div`,{className:`max-w-7xl mx-auto px-6 py-10`,children:(0,w.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-[1fr_320px] gap-12`,children:[(0,w.jsxs)(`div`,{className:`space-y-4`,children:[(0,w.jsx)(`div`,{className:`h-4 bg-gray-200 rounded w-1/3`}),(0,w.jsx)(`div`,{className:`h-8 bg-gray-200 rounded w-3/4`}),(0,w.jsx)(`div`,{className:`h-4 bg-gray-200 rounded w-1/2`}),(0,w.jsx)(`div`,{className:`aspect-video bg-gray-200 rounded-2xl`}),[...[,,,,,,]].map((e,t)=>(0,w.jsx)(`div`,{className:`h-4 bg-gray-100 rounded`,style:{width:`${80+t%4*5}%`}},t))]}),(0,w.jsxs)(`div`,{className:`space-y-4`,children:[(0,w.jsx)(`div`,{className:`h-32 bg-gray-100 rounded-2xl`}),(0,w.jsx)(`div`,{className:`h-40 bg-gray-100 rounded-2xl`}),(0,w.jsx)(`div`,{className:`h-48 bg-gray-100 rounded-2xl`})]})]})})]}),k=({url:e,title:t})=>{let{t:n}=a(),[r,i]=(0,x.useState)(!1),o=async()=>{await navigator.clipboard.writeText(e).catch(()=>{}),i(!0),setTimeout(()=>i(!1),2500)},s=encodeURIComponent(e);return(0,w.jsxs)(`div`,{className:`flex gap-2.5 flex-wrap`,children:[(0,w.jsxs)(`a`,{href:`https://x.com/intent/tweet?url=${s}&text=${encodeURIComponent(t)}`,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-1.5 px-3 py-2 bg-gray-900 text-white text-xs font-semibold rounded-xl hover:bg-black transition-colors`,children:[(0,w.jsx)(`svg`,{className:`w-3.5 h-3.5`,viewBox:`0 0 24 24`,fill:`currentColor`,children:(0,w.jsx)(`path`,{d:`M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-4.714-6.231-5.401 6.231H2.747l7.73-8.835L1.254 2.25H8.08l4.265 5.642 5.899-5.642zm-1.161 17.52h1.833L7.084 4.126H5.117z`})}),`X / Twitter`]}),(0,w.jsxs)(`a`,{href:`https://www.facebook.com/sharer/sharer.php?u=${s}`,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-1.5 px-3 py-2 bg-blue-600 text-white text-xs font-semibold rounded-xl hover:bg-blue-700 transition-colors`,children:[(0,w.jsx)(`svg`,{className:`w-3.5 h-3.5`,viewBox:`0 0 24 24`,fill:`currentColor`,children:(0,w.jsx)(`path`,{d:`M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z`})}),`Facebook`]}),(0,w.jsx)(`button`,{onClick:o,className:`flex items-center gap-1.5 px-3 py-2 text-xs font-semibold rounded-xl transition-colors ${r?`bg-green-100 text-green-700`:`bg-gray-100 text-gray-700 hover:bg-gray-200`}`,children:r?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`svg`,{className:`w-3.5 h-3.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M5 13l4 4L19 7`})}),n(`blog.share.copied`)]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`svg`,{className:`w-3.5 h-3.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:1.75,d:`M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z`})}),n(`blog.share.copyLink`)]})})]})},A=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,j=()=>{let{t:e}=a(),{slugOrId:t}=n(),{user:i}=u(),[o,s]=(0,x.useState)(null),[c,d]=(0,x.useState)(!0),[m,y]=(0,x.useState)(null),[S,C]=(0,x.useState)([]),[E,j]=(0,x.useState)(null),[M,N]=(0,x.useState)(0),[P,F]=(0,x.useState)(0),[I,L]=(0,x.useState)(0),[R,z]=(0,x.useState)(!1),[B,V]=(0,x.useState)(!1),[H,U]=(0,x.useState)(0),[W,G]=(0,x.useState)(!1),K=(0,x.useRef)(null);(0,x.useEffect)(()=>{if(!t){y(e(`blog.detail.missingParam`)),d(!1);return}(async()=>{try{let e=A.test(t)?await g.getBlogPost(t):await g.getBlogPostBySlug(t);s(e),j(e.id),N(e.views||0),F(e.likes||0),L(e.shares||0),e.category&&g.listBlogPosts({page:1,page_size:4,status:`published`,category:e.category}).then(t=>C(t.posts.filter(t=>t.id!==e.id).slice(0,3))).catch(()=>{})}catch(t){y(t?.response?.data?.error||e(`blog.detail.notFound`))}finally{d(!1)}})()},[t,e]),(0,x.useEffect)(()=>{if(!E||c||!o)return;let e=setTimeout(()=>{g.incrementViews(E).then(N).catch(()=>{})},3e4);return()=>clearTimeout(e)},[E,c,o]),(0,x.useEffect)(()=>{let e=()=>{if(G(window.scrollY>100),K.current){let e=K.current,t=e.getBoundingClientRect().top+window.scrollY;U(Math.min(100,Math.max(0,(window.scrollY-t+window.innerHeight*.5)/e.offsetHeight*100)))}};return window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)},[]);let q=async()=>{if(!(!E||!i?.id||B)){V(!0);try{let e=await g.toggleLike(E,i.id);F(e.likes),z(e.liked)}finally{V(!1)}}},J=async()=>{if(!o)return;let e=`${window.location.origin}/blog/${o.slug||E}`;try{navigator.share&&navigator.canShare?.({url:e})&&await navigator.share({title:o.title,url:e}),E&&L(await g.incrementShares(E).catch(()=>I))}catch(t){t?.name!==`AbortError`&&await navigator.clipboard.writeText(e).catch(()=>{})}};if(c)return(0,w.jsx)(O,{});if(m||!o)return(0,w.jsxs)(`div`,{className:`min-h-screen flex flex-col items-center justify-center bg-white gap-4`,children:[(0,w.jsx)(`svg`,{className:`w-12 h-12 text-gray-300`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:1.5,d:`M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z`})}),(0,w.jsx)(`p`,{className:`text-gray-500`,children:m||e(`blog.detail.notFound`)}),(0,w.jsx)(r,{to:`/blog`,className:`text-sm text-primary-600 hover:underline`,children:e(`blog.detail.backToBlog`)})]});let Y=f(o.image_url),X=`${window.location.origin}/blog/${o.slug||E}`,Z=o.published_at||o.created_at,Q=o.author_avatar_url?l(o.author_avatar_url):null;return(0,w.jsxs)(`div`,{className:`min-h-screen bg-white`,children:[(0,w.jsx)(_,{...v(o)}),(0,w.jsx)(`div`,{className:`fixed top-0 left-0 h-0.5 bg-primary-500 z-50 transition-all duration-100`,style:{width:`${H}%`}}),(0,w.jsx)(`header`,{className:`fixed top-0 left-0 right-0 z-40 transition-all duration-200 ${W?`bg-white/95 backdrop-blur-sm border-b border-gray-100 shadow-sm`:`bg-transparent pointer-events-none`}`,children:W&&(0,w.jsxs)(`div`,{className:`max-w-7xl mx-auto px-6 h-14 flex items-center gap-4`,children:[(0,w.jsxs)(r,{to:`/blog`,className:`text-sm text-gray-500 hover:text-gray-800 flex items-center gap-1.5 transition-colors shrink-0`,children:[(0,w.jsx)(`svg`,{className:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M15 19l-7-7 7-7`})}),`Blog`]}),(0,w.jsx)(`p`,{className:`text-sm font-semibold text-gray-800 truncate flex-1`,children:o.title}),(0,w.jsxs)(`button`,{onClick:q,disabled:!i||B,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm font-medium transition-colors shrink-0 ${R?`bg-red-50 text-red-500`:`bg-gray-100 text-gray-600 hover:bg-gray-200`} disabled:opacity-40`,children:[(0,w.jsx)(`svg`,{className:`w-4 h-4`,fill:R?`currentColor`:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:1.75,d:`M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z`})}),P]})]})}),(0,w.jsx)(`div`,{className:`border-b border-gray-100 bg-gray-50`,children:(0,w.jsxs)(`div`,{className:`max-w-7xl mx-auto px-6 py-3 flex items-center gap-1.5 text-sm text-gray-500 font-Montserrat`,children:[(0,w.jsx)(r,{to:`/`,className:`hover:text-gray-800 transition-colors`,children:e(`blog.detail.breadcrumbHome`)}),(0,w.jsx)(`svg`,{className:`w-3.5 h-3.5 text-gray-300`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M9 5l7 7-7 7`})}),(0,w.jsx)(r,{to:`/blog`,className:`hover:text-gray-800 transition-colors`,children:`Blog`}),(0,w.jsx)(`svg`,{className:`w-3.5 h-3.5 text-gray-300`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M9 5l7 7-7 7`})}),(0,w.jsx)(`span`,{className:`text-gray-900 font-medium truncate`,children:o.category})]})}),(0,w.jsx)(`div`,{className:`max-w-7xl mx-auto px-6 py-10`,children:(0,w.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-[1fr_320px] gap-12`,children:[(0,w.jsxs)(`main`,{children:[(0,w.jsx)(`span`,{className:`inline-flex px-3 py-1 rounded-full text-xs font-semibold bg-primary-100 text-primary-700 mb-4`,children:o.category}),(0,w.jsx)(`h1`,{className:`text-3xl md:text-4xl font-bold text-gray-900 font-LeagueSpartan leading-tight mb-5`,children:o.title}),(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 mb-8 pb-6 border-b border-gray-100`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[Q?(0,w.jsx)(`img`,{src:Q,alt:o.author_name,className:`w-9 h-9 rounded-full object-cover flex-shrink-0`}):(0,w.jsx)(`div`,{className:`w-9 h-9 rounded-full bg-primary-600 flex items-center justify-center text-white font-bold text-sm flex-shrink-0`,children:o.author_name?.charAt(0).toUpperCase()}),(0,w.jsx)(`span`,{className:`font-semibold text-gray-900 text-sm`,children:o.author_name})]}),(0,w.jsx)(`span`,{className:`text-gray-300`,children:`·`}),(0,w.jsx)(`span`,{className:`text-gray-500 text-sm font-Montserrat`,children:h(Z)}),(0,w.jsx)(`span`,{className:`text-gray-300`,children:`·`}),(0,w.jsxs)(`span`,{className:`text-gray-500 text-sm font-Montserrat flex items-center gap-1`,children:[(0,w.jsx)(`svg`,{className:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z`})}),e(`blog.detail.readTime`,{minutes:o.read_time})]}),(0,w.jsx)(`span`,{className:`text-gray-300`,children:`·`}),(0,w.jsxs)(`span`,{className:`text-gray-500 text-sm font-Montserrat flex items-center gap-1`,children:[(0,w.jsxs)(`svg`,{className:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:[(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M15 12a3 3 0 11-6 0 3 3 0 016 0z`}),(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z`})]}),e(`blog.detail.views`,{count:M})]})]}),Y&&(0,w.jsx)(`div`,{className:`rounded-2xl overflow-hidden aspect-video bg-gray-100 mb-10`,children:(0,w.jsx)(`img`,{src:Y,alt:o.title,className:`w-full h-full object-cover`})}),o.excerpt&&(0,w.jsx)(`blockquote`,{className:`border-l-4 border-primary-400 pl-5 mb-10 italic text-lg text-gray-600 leading-relaxed font-Montserrat`,children:o.excerpt}),(0,w.jsx)(`div`,{ref:K,className:`blog-content`,dangerouslySetInnerHTML:{__html:p.sanitize(D(o.content),{ALLOWED_TAGS:[`p`,`br`,`strong`,`em`,`u`,`h2`,`h3`,`ul`,`ol`,`li`,`blockquote`,`img`],ALLOWED_ATTR:[`src`,`alt`]})}}),(0,w.jsxs)(`div`,{className:`mt-14 pt-8 border-t border-gray-100 flex flex-wrap items-center justify-between gap-4`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-4 text-sm text-gray-500`,children:[(0,w.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,w.jsxs)(`svg`,{className:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:[(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:1.75,d:`M15 12a3 3 0 11-6 0 3 3 0 016 0z`}),(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:1.75,d:`M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z`})]}),e(`blog.detail.views`,{count:M})]}),(0,w.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,w.jsx)(`svg`,{className:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:1.75,d:`M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z`})}),e(`blog.detail.likes`,{count:P})]}),(0,w.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,w.jsx)(`svg`,{className:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:1.75,d:`M8.684 13.342C8.886 12.938 9 12.482 9 12c0-.482-.114-.938-.316-1.342m0 2.684a3 3 0 110-2.684m0 2.684l6.632 3.316m-6.632-6l6.632-3.316m0 0a3 3 0 105.367-2.684 3 3 0 00-5.367 2.684zm0 9.316a3 3 0 105.368 2.684 3 3 0 00-5.368-2.684z`})}),e(`blog.detail.shares`,{count:I})]})]}),(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i?.id&&i.id!==o.author_id&&(0,w.jsx)(b,{targetType:`event`,targetId:o.id,targetName:o.title,reporterUserId:i.id}),(0,w.jsxs)(`button`,{onClick:q,disabled:!i||B,className:`flex items-center gap-1.5 px-4 py-2 rounded-full text-sm font-medium transition-colors disabled:opacity-40 ${R?`bg-red-500 text-white hover:bg-red-600`:`bg-primary-600 text-white hover:bg-primary-700`}`,children:[(0,w.jsx)(`svg`,{className:`w-4 h-4`,fill:R?`currentColor`:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:1.75,d:`M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z`})}),e(`blog.detail.likeButton`,{count:P})]})]})]}),(0,w.jsxs)(`div`,{className:`mt-10 bg-gray-50 rounded-2xl p-6 flex items-center gap-5`,children:[Q?(0,w.jsx)(`img`,{src:Q,alt:o.author_name,className:`w-14 h-14 rounded-full object-cover flex-shrink-0`}):(0,w.jsx)(`div`,{className:`w-14 h-14 rounded-full bg-primary-600 flex items-center justify-center text-white font-bold text-xl flex-shrink-0`,children:o.author_name?.charAt(0).toUpperCase()}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`text-xs text-gray-400 uppercase tracking-wider mb-0.5 font-Montserrat`,children:e(`blog.detail.authorLabel`)}),(0,w.jsx)(`p`,{className:`font-semibold text-gray-900`,children:o.author_name}),(0,w.jsx)(`p`,{className:`text-sm text-gray-500 mt-0.5 font-Montserrat`,children:e(`blog.detail.publishedOn`,{date:h(Z)})})]})]}),(0,w.jsx)(`div`,{className:`mt-12`,children:(0,w.jsx)(T,{blogPostId:o.id})})]}),(0,w.jsx)(`aside`,{children:(0,w.jsxs)(`div`,{className:`sticky top-24 space-y-5`,children:[(0,w.jsxs)(`div`,{className:`bg-gray-50 rounded-2xl p-5`,children:[(0,w.jsx)(`h3`,{className:`text-sm font-bold text-gray-900 mb-4 font-LeagueSpartan`,children:e(`blog.sidebar.shareTitle`)}),(0,w.jsx)(k,{url:X,title:o.title}),(0,w.jsxs)(`button`,{onClick:J,className:`mt-3 w-full flex items-center justify-center gap-2 px-4 py-2 bg-gray-200 text-gray-700 text-xs font-semibold rounded-xl hover:bg-gray-300 transition-colors font-Montserrat`,children:[(0,w.jsx)(`svg`,{className:`w-3.5 h-3.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M8.684 13.342C8.886 12.938 9 12.482 9 12c0-.482-.114-.938-.316-1.342m0 2.684a3 3 0 110-2.684m0 2.684l6.632 3.316m-6.632-6l6.632-3.316m0 0a3 3 0 105.367-2.684 3 3 0 00-5.367 2.684zm0 9.316a3 3 0 105.368 2.684 3 3 0 00-5.368-2.684z`})}),e(`blog.sidebar.shareViaNavigator`)]})]}),(0,w.jsxs)(`div`,{className:`bg-gray-50 rounded-2xl p-5`,children:[(0,w.jsx)(`h3`,{className:`text-sm font-bold text-gray-900 mb-4 font-LeagueSpartan`,children:e(`blog.sidebar.statsTitle`)}),(0,w.jsx)(`div`,{className:`grid grid-cols-3 gap-3 text-center`,children:[{value:M,label:e(`blog.sidebar.statsViews`)},{value:P,label:e(`blog.sidebar.statsLikes`)},{value:I,label:e(`blog.sidebar.statsShares`)}].map(({value:e,label:t})=>(0,w.jsxs)(`div`,{className:`bg-white rounded-xl py-3`,children:[(0,w.jsx)(`p`,{className:`text-xl font-bold text-gray-900 font-LeagueSpartan`,children:e}),(0,w.jsx)(`p`,{className:`text-xs text-gray-500 font-Montserrat`,children:t})]},t))})]}),o.tags?.length>0&&(0,w.jsxs)(`div`,{className:`bg-gray-50 rounded-2xl p-5`,children:[(0,w.jsx)(`h3`,{className:`text-sm font-bold text-gray-900 mb-3 font-LeagueSpartan`,children:e(`blog.sidebar.tagsTitle`)}),(0,w.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:o.tags.map((e,t)=>(0,w.jsxs)(`span`,{className:`px-3 py-1 bg-white border border-gray-200 text-gray-600 text-xs font-medium rounded-full hover:border-primary-300 hover:text-primary-700 transition-colors cursor-default font-Montserrat`,children:[`#`,e]},t))})]}),S.length>0&&(0,w.jsxs)(`div`,{className:`bg-gray-50 rounded-2xl p-5`,children:[(0,w.jsx)(`h3`,{className:`text-sm font-bold text-gray-900 mb-4 font-LeagueSpartan`,children:e(`blog.sidebar.relatedTitle`)}),(0,w.jsx)(`div`,{className:`space-y-4`,children:S.map(e=>(0,w.jsxs)(r,{to:`/blog/${e.slug||e.id}`,className:`flex gap-3 group`,children:[(0,w.jsx)(`div`,{className:`w-16 h-16 rounded-xl overflow-hidden flex-shrink-0 bg-gradient-to-br from-primary-500 to-primary-700`,children:e.image_url&&(0,w.jsx)(`img`,{src:f(e.image_url),alt:e.title,className:`w-full h-full object-cover group-hover:scale-105 transition-transform duration-200`})}),(0,w.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,w.jsx)(`p`,{className:`text-xs text-gray-400 mb-1 font-Montserrat`,children:h(e.published_at||e.created_at)}),(0,w.jsx)(`p`,{className:`text-sm font-semibold text-gray-900 line-clamp-2 leading-snug group-hover:text-primary-700 transition-colors font-Montserrat`,children:e.title})]})]},e.id))})]}),(0,w.jsxs)(r,{to:`/blog`,className:`flex items-center gap-2 text-sm text-primary-600 hover:text-primary-800 font-semibold font-Montserrat transition-colors`,children:[(0,w.jsx)(`svg`,{className:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M15 19l-7-7 7-7`})}),e(`blog.sidebar.backToBlog`)]})]})})]})}),(0,w.jsx)(`style`,{children:`
.blog-content { color: #374151; font-size: 1.0625rem; line-height: 1.875; }
.blog-content p { margin-bottom: 1.5rem; }
.blog-content p:last-child { margin-bottom: 0; }
.blog-content h2 {
font-family: 'League Spartan', sans-serif;
font-size: 1.625rem; font-weight: 700; color: #111827;
margin: 2.5rem 0 1rem; padding-bottom: 0.5rem;
border-bottom: 2px solid #f3f4f6;
}
.blog-content h3 {
font-family: 'League Spartan', sans-serif;
font-size: 1.25rem; font-weight: 700; color: #1f2937;
margin: 2rem 0 0.75rem;
}
.blog-content strong { font-weight: 600; color: #111827; }
.blog-content em { font-style: italic; color: #4b5563; }
.blog-content ul, .blog-content ol { padding-left: 1.5rem; margin: 1rem 0 1.5rem; }
.blog-content ul { list-style: disc; }
.blog-content ol { list-style: decimal; }
.blog-content li { margin-bottom: 0.4rem; }
.blog-content blockquote {
border-left: 4px solid #4a6735; background: #f2f5ee;
padding: 1rem 1.5rem; margin: 2rem 0; border-radius: 0 0.75rem 0.75rem 0;
color: #3a5229; font-style: italic;
}
.blog-content img {
width: 100%; height: auto; border-radius: 1rem;
margin: 2rem 0; box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}
`})]})};export{j as default};