1import{j as e,b5 as E,aU as O,aV as L,r as x,aW as p,b4 as _,b7 as P,b8 as H}from"./vendor-react-P0HpX7vU.js";import{b as T}from"./blogService-B-BCwCtM.js";import{b as s,c as w,d as C,e as h}from"./index-BV5eOZpo.js";import{B as r,T as n,o as N,b as f,aM as q,aN as J,aO as V,C as G,q as W,A as K,aP as z,D as Q,af as X}from"./vendor-mui-BYUvh2j7.js";import{r as Y}from"./vendor-markdown-DAae6eF-.js";import"./vendor-maps-DeoPjTXT.js";import"./vendor-animations-DIK8Mnda.js";import"./vendor-redux-Bbrn1qda.js";import"./vendor-icons-Bb0P5DhU.js";/* empty css */const Z=({title:l,url:d})=>{const t=encodeURIComponent(d),c=encodeURIComponent(l),m={whatsapp:`https://wa.me/?text=${c}%20${t}`,facebook:`https://www.facebook.com/sharer/sharer.php?u=${t}`,twitter:`https://twitter.com/intent/tweet?text=${c}&url=${t}`};return e.jsxs(r,{sx:{display:"flex",flexDirection:"column",gap:2,p:2},children:[e.jsx(n,{variant:"body1",fontWeight:600,gutterBottom:!0,children:"SHARE THIS POST"}),e.jsxs(N,{spacing:1.5,children:[e.jsx(f,{variant:"contained",href:m.whatsapp,target:"_blank",startIcon:e.jsx(q,{}),sx:{bgcolor:"#25D366","&:hover":{bgcolor:"#1ebe5d"},textTransform:"none",justifyContent:"flex-start",fontWeight:600},children:"WhatsApp"}),e.jsx(f,{variant:"contained",href:m.facebook,target:"_blank",startIcon:e.jsx(J,{}),sx:{bgcolor:"#3b5998","&:hover":{bgcolor:"#324b84"},textTransform:"none",justifyContent:"flex-start",fontWeight:600},children:"Facebook"}),e.jsx(f,{variant:"contained",href:m.twitter,target:"_blank",startIcon:e.jsx(V,{}),sx:{bgcolor:"#1DA1F2","&:hover":{bgcolor:"#198fda"},textTransform:"none",justifyContent:"flex-start",fontWeight:600},children:"Twitter"})]})]})},de=()=>{const{slug:l}=E(),d=O();L();const[t,c]=x.useState(null),[m,u]=x.useState(!0),[D,A]=x.useState(null),[a,B]=x.useState([]);x.useEffect(()=>{if(!l)return;if(new URLSearchParams(d.search).get("preview")==="1"){const y=sessionStorage.getItem("blogPreviewData");if(y)try{const S=JSON.parse(y);c(S),u(!1),sessionStorage.removeItem("blogPreviewData");return}catch(S){console.error("Error parsing preview data:",S)}const j=d.state?.previewData;if(j){c(j),u(!1);return}}F()},[l,d.search]);const F=async()=>{try{u(!0);const o=await T.getBlogBySlug(l);c(o.data),U()}catch(o){A(o.message||"Failed to fetch blog post")}finally{u(!1)}},U=async()=>{try{const o={limit:8,sort:"-publishedAt"};let y=(await T.getBlogs(o)).data.filter(j=>j.slug!==l);B(y.slice(0,7))}catch(o){console.error("Failed to fetch related blogs:",o)}};if(m)return e.jsx(r,{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"400px",children:e.jsx(G,{})});if(D||!t)return e.jsxs(W,{maxWidth:"lg",sx:{py:4},children:[e.jsx(K,{severity:"error",sx:{mb:3},children:D||"Blog post not found"}),e.jsx(f,{component:p,to:"/blog",startIcon:e.jsx(z,{}),variant:"outlined",children:"Back to Blog"})]});const v=t.metaTitle||t.title,k=t.metaDescription||t.excerpt,g=`${window.location.origin}/blog/${t.slug}`,I=s(t.featuredImage,"large")||w(h()),b=I||`${window.location.origin}${h()}`,M=typeof window<"u"?window.location.href:g,$=a.length<=1?0:Math.min(3,a.length-1);a.slice(0,$);const R=a.slice(0,7);return console.log("ð Blog Detail Page Image Debug:",{blogTitle:t.title,blogId:t._id,featuredImage:t.featuredImage,featuredImageUrl:I,imageUrl:b,srcSet:C(t.featuredImage),thumbnailUrl:s(t.featuredImage,"thumbnail"),mediumUrl:s(t.featuredImage,"medium"),largeUrl:s(t.featuredImage,"large"),originalUrl:s(t.featuredImage,"original"),relatedBlogs:a.map(o=>({title:o.title,featuredImage:o.featuredImage,thumbnailUrl:s(o.featuredImage,"thumbnail")}))}),e.jsxs(e.Fragment,{children:[e.jsxs(_,{children:[e.jsx("title",{children:v}),e.jsx("meta",{name:"description",content:k}),e.jsx("meta",{name:"keywords",content:t.tags?.join(", ")||""}),e.jsx("link",{rel:"canonical",href:g}),e.jsx("meta",{property:"og:title",content:v}),e.jsx("meta",{property:"og:description",content:k}),e.jsx("meta",{property:"og:type",content:"article"}),e.jsx("meta",{property:"og:url",content:g}),e.jsx("meta",{property:"og:image",content:b}),e.jsx("meta",{property:"og:site_name",content:"Cocaine Energy SupplementÂ®ï¸ Supplement®ï¸"}),e.jsx("meta",{property:"article:published_time",content:t.publishedAt}),e.jsx("meta",{property:"article:section",content:t.category}),t.tags?.map(o=>e.jsx("meta",{property:"article:tag",content:o},o)),e.jsx("meta",{name:"twitter:card",content:"summary_large_image"}),e.jsx("meta",{name:"twitter:title",content:v}),e.jsx("meta",{name:"twitter:description",content:k}),e.jsx("meta",{name:"twitter:image",content:b}),e.jsx("script",{type:"application/ld+json",children:JSON.stringify({"@context":"https://schema.org","@type":"BlogPosting",headline:t.title,de
1scription:t.excerpt,image:b,url:g,datePublished:t.publishedAt,dateModified:t.updatedAt,publisher:{"@type":"Organization",name:"Cocaine Energy SupplementÂ®ï¸ Supplement®ï¸",url:window.location.origin},mainEntityOfPage:{"@type":"WebPage","@id":g},wordCount:t.content?t.content.split(/\s+/).length:0,articleSection:t.category,keywords:t.tags?.join(", ")||""})})]}),e.jsx(r,{sx:{width:"100%",backgroundColor:"#d32f2f",backgroundImage:` 2 url('/assets/blogbg.jpeg'), 3 radial-gradient(circle, rgba(0,0,0,0.1) 1px, transparent 1px) 4 `,backgroundSize:"cover, 20px 20px",backgroundPosition:"center, top left",backgroundRepeat:"no-repeat, repeat",py:{xs:4,md:6},px:{xs:2,md:4},position:"relative",zIndex:1},children:e.jsxs(W,{maxWidth:"lg",children:[e.jsx(n,{variant:"body1",sx:{fontWeight:"bold",color:"white",mb:2,lineHeight:1.2,fontSize:{xs:"1.5rem",sm:"2rem"},textAlign:"center",fontFamily:"Rubik"},children:t.title}),e.jsxs(r,{display:"flex",justifyContent:"flex-end",alignItems:"center",gap:2,children:[e.jsx(n,{variant:"body1",sx:{color:"white",textTransform:"uppercase",fontWeight:"medium"},children:"Blog"}),e.jsx(n,{variant:"body1",sx:{color:"white",textTransform:"uppercase",fontWeight:"medium"},children:P(new Date(t.publishedAt),"MMMM dd, yyyy").toUpperCase()})]})]})}),e.jsx(r,{sx:{width:"100%",display:"flex",justifyContent:"center",position:"relative",zIndex:2,mt:"-30px"},children:e.jsx(r,{sx:{width:"100%",maxWidth:"700px",position:"relative",overflow:"hidden",backgroundImage:"radial-gradient(circle, rgba(0,0,0,0.1) 1px, transparent 1px)",backgroundSize:"20px 20px",minHeight:{xs:"300px",sm:"400px"},borderRadius:"16px",boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:e.jsx(r,{component:"img",src:I,srcSet:C(t.featuredImage)||void 0,crossOrigin:"anonymous",alt:t.featuredImage?.alt||t.title,loading:"lazy",decoding:"async",onError:o=>{console.error("â Blog Detail Image failed to load:",{src:o.target.src,blogTitle:t.title,featuredImage:t.featuredImage}),o.target.src.includes("hype")||(o.target.src=w(h()))},sx:{width:"100%",height:{xs:"300px",sm:"400px"},objectFit:"fill",display:"block"}})})}),e.jsx(W,{maxWidth:"lg",sx:{py:{xs:2,md:4}},children:e.jsxs(r,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},gap:{xs:0,md:4}},children:[e.jsxs(r,{sx:{width:{xs:"100%",md:"66.666%"}},children:[e.jsx(r,{sx:{mb:6,"& h1, & h2, & h3, & h4, & h5, & h6":{fontFamily:"'Rubik', sans-serif !important"},"& p":{mb:2,lineHeight:1.8,fontSize:{xs:"1rem",md:"1.1rem"}},"& strong":{fontWeight:"bold"},"& em":{fontStyle:"italic"},"& h1":{fontSize:{xs:"1.75rem",md:"2rem"},fontWeight:"bold",mt:4,mb:2,color:"primary.main"},"& h2":{fontSize:{xs:"1.5rem",md:"1.8rem"},fontWeight:"bold",mt:4,mb:2,color:"primary.main"},"& h3":{fontSize:{xs:"1.25rem",md:"1.5rem"},fontWeight:"bold",mt:3,mb:2,color:"primary.main"},"& h4":{fontSize:{xs:"1.1rem",md:"1.3rem"},fontWeight:"bold",mt:3,mb:2,color:"primary.main"},"& h5":{fontSize:"1.1rem",fontWeight:"bold",mt:2,mb:1,color:"primary.main"},"& h6":{fontSize:"1rem",fontWeight:"bold",mt:2,mb:1,color:"primary.main"},"& ul, & ol":{pl:3,mb:2,"& li":{mb:1}},"& blockquote":{borderLeft:"4px solid",borderColor:"primary.main",pl:2,py:1,mb:2,fontStyle:"italic",backgroundColor:"grey.50"},"& code":{backgroundColor:"grey.100",padding:"2px 4px",borderRadius:"4px",fontSize:"0.9em"},"& pre":{backgroundColor:"grey.100",padding:2,borderRadius:1,overflow:"auto",mb:2},"& pre code":{backgroundColor:"transparent",padding:0},"& a":{color:"primary.main",textDecoration:"underline","&:hover":{textDecoration:"none"}},"& img":{maxWidth:"100%",height:"auto",borderRadius:1,my:2}},children:e.jsx(H,{remarkPlugins:[Y],components:{h1:({node:o,...i})=>e.jsx("h1",{style:{fontFamily:"Rubik"},...i}),h2:({node:o,...i})=>e.jsx("h2",{style:{fontFamily:"Rubik"},...i}),h3:({node:o,...i})=>e.jsx("h3",{style:{fontFamily:"Rubik"},...i}),h4:({node:o,...i})=>e.jsx("h4",{style:{fontFamily:"Rubik"},...i}),h5:({node:o,...i})=>e.jsx("h5",{style:{fontFamily:"Rubik"},...i}),h6:({node:o,...i})=>e.jsx("h6",{style:{fontFamily:"Rubik"},...i}),img:({node:o,...i})=>e.jsx("img",{...i,loading:"lazy",decoding:"async",alt:i.alt||"Blog image",style:{maxWidth:"100%",height:"auto",borderRadius:"8px",marginTop:"16px",marginBottom:"16
4px"}})},children:t.content||""})}),e.jsx(Q,{sx:{my:4}}),e.jsx(r,{sx:{mb:6},children:e.jsxs(n,{variant:"body2",sx:{fontStyle:"italic",color:"text.secondary","& strong":{fontWeight:"bold"}},children:[e.jsx("strong",{children:"* Consume responsibly."})," Not suitable for children or individuals sensitive to caffeine. Not recommended for children, pregnant, or nursing women. Consult a doctor if you have health concerns about caffeine."]})}),a.length>0&&a[0]&&e.jsx(r,{sx:{mt:4},children:e.jsx(p,{to:`/blog/${a[0].slug}`,style:{textDecoration:"none",color:"inherit"},children:e.jsxs(r,{display:"flex",alignItems:"center",gap:2,sx:{p:2,borderRadius:1,border:"1px solid",borderColor:"divider","&:hover":{backgroundColor:"action.hover",borderColor:"primary.main"}},children:[e.jsx(z,{color:"primary"}),e.jsxs(r,{children:[e.jsx(n,{variant:"caption",color:"text.secondary",sx:{display:"block"},children:"Previous"}),e.jsx(n,{variant:"body1",fontWeight:"medium",children:a[0].title})]})]})})})]}),e.jsxs(r,{sx:{width:{xs:"100%",md:"33.333%"},p:2,borderLeft:"2px solid #ddd",ml:{md:4}},children:[e.jsx(Z,{title:t.title,url:M}),R?.length>0&&e.jsxs(r,{sx:{mt:4,p:2},children:[e.jsx(n,{variant:"body1",fontWeight:"bold",sx:{mb:3,textTransform:"uppercase"},children:"more articles"}),e.jsx(r,{display:"flex",flexDirection:"column",gap:3,children:R.map(o=>e.jsx(r,{children:e.jsx(p,{to:`/blog/${o.slug}`,style:{textDecoration:"none",color:"inherit"},children:e.jsxs(r,{display:"flex",gap:2,children:[e.jsx(X,{component:"img",src:s(o.featuredImage,"thumbnail")||w(h()),srcSet:C(o.featuredImage)||void 0,crossOrigin:"anonymous",loading:"lazy",decoding:"async",onError:i=>{console.error("â More Articles Image failed to load:",{src:i.target.src,blogTitle:o.title,featuredImage:o.featuredImage}),i.target.src.includes("hype")||(i.target.src=w(h()))},sx:{width:100,height:80,borderRadius:1,objectFit:"cover",flexShrink:0,backgroundColor:"#fafafa"},alt:o.featuredImage?.alt||o.title}),e.jsxs(r,{flex:1,children:[e.jsx(n,{variant:"body2",fontWeight:"bold",sx:{mb:1,lineHeight:1.3,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis",fontFamily:"Rubik","&:hover":{color:"primary.main"}},children:o.title}),e.jsx(n,{variant:"caption",color:"text.secondary",sx:{display:"block"},children:P(new Date(o.publishedAt),"MMMM dd, yyyy")}),e.jsx(r,{mt:1,children:e.jsx(n,{component:p,to:`/blog/${o.slug}`,variant:"body2",sx:{color:"primary.main",textDecoration:"none",fontWeight:"medium",fontSize:"0.75rem","&:hover":{textDecoration:"underline"}},children:"Read More »"})})]})]})})},o._id))}),e.jsx(r,{sx:{mt:3,textAlign:"center"},children:e.jsx(f,{component:p,to:"/blog",variant:"outlined",sx:{textTransform:"uppercase",fontWeight:"bold",borderColor:"primary.main",color:"primary.main","&:hover":{borderColor:"primary.dark",backgroundColor:"primary.main",color:"white"}},children:"View All"})})]})]})]})})]})};export{de 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.