1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[162],{9883:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/source/[uri]",function(){return s(8475)}])},8475:function(e,t,s){"use strict";s.r(t),s.d(t,{__N_SSP:function(){return f}});var l=s(5893),r=s(1163),o=s(7294),a=s(9008),c=s.n(a),i=s(6010),n=s(3299),d=s(7339),u=s(2176),x=s(9754),m=s(7517),f=!0;t.default=e=>{let{source:t}=e,s=(0,r.useRouter)(),{data:a,status:f}=(0,n.useSession)(),{setIsMenuShow:h,showToast:g}=(0,x.H)(),[v,j]=(0,o.useState)(!1),[p,w]=(0,o.useState)(!1),N=(0,m.sB)("show-source-stats",!1);(0,o.useEffect)(()=>{console.log("isFollowing state changed to:",v)},[v]),(0,o.useEffect)(()=>{h(!1)},[h]),(0,o.useEffect)(()=>{var e;let s=async()=>{var e,s,l;if(!(null==a?void 0:null===(e=a.user)||void 0===e?void 0:e.id)){console.log("No session available for follow status check");return}console.log("Checking follow status for source:",t.uri,"user:",a.user.id);try{let e=await fetch("/api/user/".concat(a.user.id,"/sources"));if(e.ok){let r=await e.json();console.log("User sources data:",r.sources),console.log("Looking for source URI:",t.uri),console.log("Available URIs:",null===(s=r.sources)||void 0===s?void 0:s.map(e=>e.uri));let o=null===(l=r.sources)||void 0===l?void 0:l.some(e=>{var s;let l=(null===(s=e.source)||void 0===s?void 0:s.uri)===t.uri||e.uri===t.uri;return console.log("Checking ".concat(e.uri," against ").concat(t.uri,": ").concat(l)),l});console.log("Is following source:",o),console.log("Setting isFollowing state to:",o),j(o)}else console.error("Failed to fetch user sources:",e.status)}catch(e){console.error("Error checking following status:",e)}};"authenticated"===f&&(null==a?void 0:null===(e=a.user)||void 0===e?void 0:e.id)?s():"loading"===f?console.log("Session is loading, waiting..."):console.log("No authenticated session available")},[t.uri,a,f]);let y=async()=>{var e,s;if(null==a?void 0:null===(e=a.user)||void 0===e?void 0:e.id){j(!v);try{if(v){let e=await fetch("/api/user/".concat(a.user.id,"/sources"));if(e.ok){let l=await e.json(),r=null===(s=l.sources)||void 0===s?void 0:s.find(e=>{var s;return(null===(s=e.source)||void 0===s?void 0:s.uri)===t.uri||e.uri===t.uri});if(r){let e=await fetch("/api/user/".concat(a.user.id,"/sources/").concat(r._id),{method:"DELETE"});if(!e.ok){j(v);let t=await e.json();g(t.error||"Failed to unfollow source. Please try again.")}}else j(v),g("Source not found. Please try again.")}else j(v),g("Failed to unfollow source. Please try again.")}else{let e=await fetch("/api/user/".concat(a.user.id,"/sources"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceUri:t.uri,priority:1,customKeywords:[]})});if(!e.ok){j(v);let t=await e.json();g(t.error||"Failed to follow source. Please try again.")}}}catch(e){j(v),console.error("Error following/unfollowing source:",e),g("An unexpected error occurred. Please try again.")}}};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(c(),{children:[(0,l.jsx)("title",{children:"".concat(t.name," - News Source | Concise")}),(0,l.jsx)("meta",{name:"description",content:"Learn about ".concat(t.name,", a ").concat(t.quality||"quality"," news source covering ").concat(t.category||"various topics",". Follow for the latest updates.")}),(0,l.jsx)("meta",{name:"keywords",content:"".concat(t.name,", news source, ").concat(t.category,", journalism, ").concat(t.uri)}),(0,l.jsx)("meta",{property:"og:title",content:"".concat(t.name," - News Source")}),(0,l.jsx)("meta",{property:"og:description",content:"Learn about ".concat(t.name,", a ").concat(t.quality||"quality"," news source.")}),(0,l.jsx)("meta",{property:"og:type",content:"website"}),(0,l.jsx)("meta",{name:"twitter:card",content:"summary"}),(0,l.jsx)("meta",{name:"twitter:title",content:"".concat(t.name," - News Source")}),(0,l.jsx)("meta",{name:"twitter:description",content:"Learn about ".concat(t.name,", a ").concat(t.quality||"quality"," news source.")})]}),(0,l.jsxs)("div",{className:"flex h-screen w-full flex-col bg-background",children:[(0,l.jsx)("div",{className:"flex w-full items-center justify-between p-xl",children:(0,l.jsxs)("div",{onClick:()=>{w(!0),setTimeout(()=>{s.back()},300)},className:"group flex w-fit cursor-pointer flex-row items-center gap-xl rounded-xl bg-surface-light/20 px-xl py-md",children:[(0,l.jsx)("div",{className:"flex",children:(0,l.jsx)("svg",{className:"h-[16px] w-[16px] rotate-180 fill-text-muted group-hover:fill-foreground",viewBox:"0 0 24 24",children:(0,l.jsx)("path",{d:"M8.59 16.59L13.17 12L8.59 7.41L10 6l6 6-6 6-1.41-1.41z"})})}),(0,l.jsx)("div",{className:"flex text-base group-hover:text-foreground",children:(0,l.jsx)(d.v,{children:"Back"})})]})}),(0,l.jsxs)("div",{className:(0,i.Z)("content-body flex h-full w-full flex-col gap-xl px-xl",p&&"animate__animated animate__fadeOut animate__faster"),children:[(0,l.jsxs)("div",{className:"flex w-full flex-col gap-xl",children:[(0,l.jsxs)("div",{className:"flex items-center gap-lg",children:[(0,l.jsx)("div",{className:"rounded-base flex h-[60px] w-[60px] items-center justify-center bg-surface-subtle",children:(0,l.jsx)("img",{src:"https://logo.dev/".concat(t.uri,"?size=48&format=png"),alt:"".concat(t.name," logo"),className:"h-[48px] w-[48px] rounded-md",onError:e=>{let s=e.target;s.src="https://www.google.com/s2/favicons?domain=".concat(t.uri,"&sz=48")}})}),(0,l.jsxs)("div",{className:"flex flex-col gap-xs",children:[(0,l.jsx)("h1",{className:"text-4xl text-foreground",style:{fontWeight:700},children:(0,l.jsx)(d.v,{children:t.name})}),(0,l.jsxs)("div",{className:"flex items-center gap-md",children:[(0,l.jsx)("div",{className:"text-md text-text-muted",children:t.uri}),t.isCore&&(0,l.jsx)("div",{className:"rounded-xs bg-surface-subtle px-sm py-xs text-xs text-text-muted",children:(0,l.jsx)(d.v,{children:"Core Source"})})]})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-md",children:[(0,l.jsx)("div",{className:(0,i.Z)("h-[8px] w-[8px] rounded-full",(e=>{switch(e){case"high":return"bg-green-500";case"medium":return"bg-yellow-500";case"low":return"bg-red-500";default:return"bg-gray-500"}})(t.quality))}),(0,l.jsx)("div",{className:"text-md text-foreground",children:(0,l.jsx)(d.v,{children:(e=>{switch(e){case"high":return"High Quality";case"medium":return"Medium Quality";case"low":return"Low Quality";default:return"Unknown Quality"}})(t.quality)})})]}
1),(0,l.jsx)("button",{onClick:y,className:(0,i.Z)("w-fit rounded-xl px-xl py-md text-md",v?"hover:bg-surface-subtle-foreground bg-foreground text-background":"bg-primary text-primary-foreground hover:bg-primary/90"),style:{fontWeight:600},children:v?"Unfollow":"Follow"},"follow-button-".concat(v))]}),(0,l.jsxs)("div",{className:"flex w-full gap-lg",children:[N&&(0,l.jsxs)("div",{className:"flex flex-1 flex-col gap-xs rounded-lg bg-surface-subtle p-lg",children:[(0,l.jsx)("div",{className:"text-sm text-text-muted",children:(0,l.jsx)(d.v,{children:"Followers"})}),(0,l.jsx)("div",{className:"text-3xl text-foreground",style:{fontWeight:600},children:t.userCount.toLocaleString()})]}),(0,l.jsxs)("div",{className:"flex flex-1 flex-col gap-xs rounded-lg bg-surface-subtle p-lg",children:[(0,l.jsx)("div",{className:"text-sm text-text-muted",children:(0,l.jsx)(d.v,{children:"Category"})}),(0,l.jsx)("div",{className:"text-3xl text-foreground",style:{fontWeight:600},children:(0,l.jsx)(d.v,{children:t.category||"General"})})]}),(0,l.jsxs)("div",{className:"flex flex-1 flex-col gap-xs rounded-lg bg-surface-subtle p-lg",children:[(0,l.jsx)("div",{className:"text-sm text-text-muted",children:(0,l.jsx)(d.v,{children:"Language"})}),(0,l.jsx)("div",{className:"text-3xl text-foreground",style:{fontWeight:600},children:(0,l.jsx)(d.v,{children:t.language||"English"})})]})]}),(0,l.jsxs)("div",{className:"flex w-full flex-col gap-md",children:[(0,l.jsx)("h2",{className:"text-2xl text-foreground",style:{fontWeight:600},children:(0,l.jsx)(d.v,{children:"About ".concat(t.name)})}),(0,l.jsx)("div",{className:"text-md leading-relaxed text-text-muted",children:(0,l.jsx)(d.v,{children:t.description||"".concat(t.name," is a ").concat(t.quality||"quality"," news source that provides ").concat(t.category||"comprehensive"," coverage of current events and breaking news. Follow this source to stay updated with their latest articles and insights.")})}),t.coverageFocus&&(0,l.jsx)("div",{className:"text-md leading-relaxed text-text-muted",children:(0,l.jsx)(d.v,{children:t.coverageFocus})})]}),(t.founded||t.headquarters||t.ownership)&&(0,l.jsxs)("div",{className:"flex w-full flex-col gap-md",children:[(0,l.jsx)("h3",{className:"text-xl text-foreground",style:{fontWeight:600},children:(0,l.jsx)(d.v,{children:"Source Information"})}),(0,l.jsxs)("div",{className:"flex flex-col gap-sm",children:[t.founded&&(0,l.jsxs)("div",{className:"flex items-center gap-md",children:[(0,l.jsx)("div",{className:"w-[80px] text-sm text-text-muted",children:(0,l.jsx)(d.v,{children:"Founded:"})}),(0,l.jsx)("div",{className:"text-md text-foreground",children:t.founded})]}),t.headquarters&&(0,l.jsxs)("div",{className:"flex items-center gap-md",children:[(0,l.jsx)("div",{className:"w-[80px] text-sm text-text-muted",children:(0,l.jsx)(d.v,{children:"Headquarters:"})}),(0,l.jsx)("div",{className:"text-md text-foreground",children:t.headquarters})]}),t.ownership&&(0,l.jsxs)("div",{className:"flex items-start gap-md",children:[(0,l.jsx)("div",{className:"w-[80px] shrink-0 text-sm text-text-muted",children:(0,l.jsx)(d.v,{children:"Ownership:"})}),(0,l.jsx)("div",{className:"text-md text-foreground",children:t.ownership})]})]})]}),(0,l.jsxs)("div",{className:"flex w-full flex-col gap-md",children:[(0,l.jsx)("h3",{className:"text-xl text-foreground",style:{fontWeight:600},children:(0,l.jsx)(d.v,{children:"Recent Articles"})}),(0,l.jsx)("div",{className:"flex h-[200px] w-full items-center justify-center rounded-lg bg-surface-subtle",children:(0,l.jsxs)("div",{className:"text-center",children:[(0,l.jsx)("div",{className:"mb-xs text-md text-text-muted",children:(0,l.jsx)(d.v,{children:"Articles coming soon"})}),(0,l.jsx)("div",{className:"text-sm text-text-muted",children:(0,l.jsx)(d.v,{children:"View articles from this source"})})]})})]})]}),(0,l.jsx)("div",{className:"flex",children:(0,l.jsx)(u.K,{buttonText:"Done",clickAction:()=>{w(!0),setTimeout(()=>{s.back()},300)},arrowDirection:"left"})})]})]})}}},function(e){e.O(0,[440,855,774,888,179],function(){return e(e.s=9883)}),_N_E=e.O()}]);
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.