PageSourceSearch

https://founder-spark-63.lovable.app/assets/ReadArticle-eNOW1M87.js

js founder-spark-63.lovable.app collected 2026-10-03 03:32:16 UTC 7,186 bytes, 1 lines download raw bytes

1import{u as g,j as t}from"./query-_koPiPsI.js";import{k as q,f as U,r as a,L as w}from"./react-vendor-h1rQ_Bae.js";import{aA as S,s as c,U as m,B as j,aC as A,ai as k,z as E,aD as I}from"./index-Dq2zLArw.js";import{u as T,f as P}from"./usePublicPostViews-9lUkjDPs.js";import{A as $,s as D,a as L}from"./stripInlineFaqs-BqA7Ik5l.js";import{N as F}from"./NewsletterSignup-BD7Q0vYT.js";import{p as R}from"./purify.es-BlZidd4c.js";import{E as z}from"./eye-DeaWVGHm.js";import"./ui-radix-CKwvnS8F.js";import"./supabase-DL6nu9mS.js";import"./charts-Xu79y1bN.js";import"./motion-nVmI7L5T.js";import"./thumbs-up-DIXQLZcT.js";function ee(){const{slug:s}=q(),i=U();a.useState(()=>crypto.randomUUID()),a.useState(()=>Date.now());const[p,l]=a.useState(0),_=a.useRef(0),{domainInfo:o}=S(),{data:e,isLoading:u}=g({queryKey:["post",s,o?.userId],queryFn:async()=>{let r=c.from("posts").select("*").eq("slug",s).eq("status","published").eq("published_to_platform",!0);o?.userId?r=r.eq("author_id",o.userId).in("visibility",["both","whitelabel"]):r=r.in("visibility",["both","platform"]);const{data:n,error:d}=await r.maybeSingle();if(d)throw d;if(!n)return null;const{data:x}=await c.from("public_profiles").select("full_name, username, avatar_url, bio, newsletter_enabled, role_title, linkedin_url, twitter_url, github_url, youtube_url, medium_url, substack_url, personal_url").eq("id",n.author_id).maybeSingle();return{...n,profiles:x??null}},enabled:!!s&&!!o}),{data:h=[]}=g({queryKey:["article-faqs",e?.id],queryFn:async()=>{if(!e?.id)return[];const{data:r}=await c.from("article_faqs").select("question, answer").eq("post_id",e.id).order("position",{ascending:!0});return r||[]},enabled:!!e?.id}),{data:f}=g({queryKey:["profile-by-slug",s],queryFn:async()=>{const{data:r}=await c.from("public_profiles").select("username").eq("username",s).maybeSingle();return r},enabled:!!s&&!u&&!e});if(a.useEffect(()=>{!u&&!e&&f?.username&&i(`/user/${f.username}`,{replace:!0})},[u,e,f,i]),a.useEffect(()=>{o?.type==="platform"&&e?.profiles?.username&&i(`/user/${e.profiles.username}/${s}`,{replace:!0})},[o,e,s,i]),a.useEffect(()=>{const r=()=>{const n=window.innerHeight,d=document.documentElement.scrollHeight,x=window.pageYOffset||document.documentElement.scrollTop,N=Math.round((x+n)/d*100),b=Math.max(_.current,Math.min(N,100));_.current=b,l(b)};return window.addEventListener("scroll",r),()=>window.removeEventListener("scroll",r)},[]),u)return t.jsx("div",{className:"min-h-screen bg-background",children:t.jsxs("div",{className:"max-w-3xl mx-auto px-4 py-16",children:[t.jsx(m,{className:"h-8 w-24 mb-8"}),t.jsx(m,{className:"h-12 w-full mb-4"}),t.jsx(m,{className:"h-4 w-48 mb-8"}),t.jsx(m,{className:"h-96 w-full"})]})});if(!e)return t.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:t.jsxs("div",{className:"text-center",children:[t.jsx("h1",{className:"text-2xl font-bold mb-4",children:"Article not found"}),t.jsx(j,{asChild:!0,children:t.jsx(w,{to:"/read",children:"View all articles"})})]})});const v=(e.content||"").split(/\s+/).filter(Boolean).length,y=typeof window<"u"?window.location.href:"";return t.jsxs("div",{className:"min-h-screen bg-background",children:[t.jsx(A,{title:`${e.title} | ${e.profiles?.full_name||"ThoughtForge"}`,description:e.excerpt||e.content?.substring(0,160)||"",image:e.featured_image_url,authorUsername:e.profiles?.username,canonicalUrl:e.canonical_url||(e.profiles?.username?`https://thoughtforge.app/user/${e.profiles.username}/${s}`:void 0)}),t.jsx($,{title:e.title,description:e.excerpt||e.content?.substring(0,160)||"",content:e.content||"",publishedAt:e.platform_published_at||e.created_at,modifiedAt:e.updated_at,authorName:e.profiles?.full_name||"ThoughtForge Author",authorUsername:e.profiles?.username,authorBio:e.profiles?.bio,authorAvatarUrl:e.profiles?.avatar_url,authorRoleTitle:e.profiles?.role_title||void 0,authorLinkedInUrl:e.profiles?.linkedin_url||void 0,authorTwitterUrl:e.profiles?.twitter_url||void 0,authorGithubUrl:e.profiles?.github_url||void 0,authorYoutubeUrl:e.profiles?.youtube_url||void 0,authorMediumUrl:e.profiles?.medium_url||void 0,authorSubstackUrl:e.profiles?.substack_url||void 0,authorPersonalUrl:e.profiles?.personal_url||void 0,featuredImageUrl:e.featured_image_url,articleUrl:e.canonical_url||y,wordCount:v,faqs:h,humanityVerificationUrl:e.humanity_verification_url,humanitySignedAt:e.humanity_signed_at}),t.jsx("div",{className:"fixed top-0 left-0 w-full h-1 bg-muted z-50",children:t.jsx("div",{className:"h-full bg-primary transition-all duration-300",style:{width:`${p}%`}})}),t.jsxs("div",{className:"max-w-3xl mx-auto px-4 py-8",children:[t.jsx(j,{variant:"ghost",size:"sm",asChild:!0,className:"mb-8",children:t.jsxs(w,{to:"/read",children:[t.jsx(k,{className:"w-4 h-4 mr-2"}),"Back to articles"]})}),t.jsxs("article",{itemScope:!0,itemType:"https://schema.org/Article",children:[t.jsx("meta",{itemProp:"datePublished",content:e.platform_published_at||e.created_at}),t.jsx("meta",{itemProp:"author",content:e.profiles?.full_name||"ThoughtForge Author"}),t.jsx("h1",{itemProp:"headline",className:"text-4xl md:text-5xl font-bold mb-4",children:e.title}),t.jsxs("div",{className:"flex items-center gap-3 mb-8 text-muted-foreground flex-wrap",children:[t.jsx("time",{dateTime:e.platform_published_at||e.created_at,children:E(new Date(e.platform_published_at||e.created_at),{addSuffix:!0})}),t.jsx("span",{children:"·"}),t.jsxs("span",{children:[I(e.content||"")," min read"]}),t.jsx(B,{postId:e.id,authorId:e.author_id,username:e.profiles?.username})]}),e.featured_image_url&&t.jsx("img",{itemProp:"image",src:e.featured_image_url,alt:e.title,className:"w-full rounded-lg mb-8",width:1200,height:630,loading:"eager"}),t.jsx("div",{itemProp:"articleBody",className:"article-content",dangerouslySetInnerHTML:{__html:R.sanitize(D(e.content,h.length))}}),t.jsx(L,{faqs:h}),t.jsx("img",{src:`https://hzzvddioivvtwkjjqavq.supabase.co/functions/v1/log-crawler-hit?p=${encodeURIComponent(typeof window<"u"?window.location.pathname:"")}`,alt:"",width:1,height:1,"aria-hidden":"true",style:{position:"absolute",width:1,height:1,opacity:0,pointerEvents:"none"},loading:"lazy"}),e.profiles&&t.jsx("div",{className:"mt-12 pt-8 border-t border-border",children:t.jsxs("div",{className:"flex items-start gap-4",children:[e.profiles.avatar_url&&t.jsx("img",{src:e.profiles.avatar_url,alt:e.profiles.full_name||"Author",className:"w-16 h-16 rounded-full"}),t.jsxs("div",{children:[t.jsx("h3",{className:"font-semibold text-lg",children:e.profiles.full_name||"Anonymous"}),e.profiles.bio&&t.jsx("p",{className:"text-muted-foreground mt-1",children:e.profiles.bio})]})]})}),e.profiles&&t.jsx("div",{className:"mt-12",children:t.jsx(F,{authorId:e.author_id,authorName:e.profiles.full_name||"this creator",newsletterEnabled:!!e.profiles.newsletter_enabled})})]})]})]})}function B({postId:s,authorId:i,username:p}){const l=T(s,i,p??"");return!l||l<1?null:t.jsxs(t.Fragment,{children:[t.jsx("span",{children:"·"}),t.jsxs("span",{className:"inline-flex items-center gap-1.5",title:`${l.toLocaleStr
1ing()} views`,children:[t.jsx(z,{className:"h-4 w-4"}),P(l)," views"]})]})}export{ee 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.