(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[797],{4813:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});var l=s(5155);function a(){return(0,l.jsxs)("div",{className:"animate-pulse bg-white rounded-lg shadow-md p-4",children:[(0,l.jsx)("div",{className:"h-48 bg-gray-200 rounded-md mb-4"})," ",(0,l.jsx)("div",{className:"h-5 bg-gray-200 rounded w-3/4 mb-2"})," ",(0,l.jsx)("div",{className:"h-4 bg-gray-200 rounded w-1/2"})," "]})}},4887:(e,t,s)=>{"use strict";s.d(t,{N:()=>a});var l=s(3464);let a=async()=>(await l.A.get("".concat("https://www.samimramizfellowship.org/api","/classes"))).data},5431:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>S});var l=s(5155),a=s(2115),r=s(5695),n=s(3464),o=s(4887);let i=async e=>(await n.A.get("".concat("https://www.samimramizfellowship.org/api","/classes/").concat(e))).data;function c(e){var t,s;let{sections:r}=e,n=r.map(e=>e.key).join(","),[o,i]=(0,a.useState)(null!=(s=null==(t=r[0])?void 0:t.key)?s:null);(0,a.useEffect)(()=>{let e=n.split(","),t=()=>{let t=e[0];for(let s of e){let e=document.getElementById(s);e&&e.getBoundingClientRect().top<=120&&(t=s)}window.innerHeight+window.scrollY>=document.body.scrollHeight-4&&(t=e[e.length-1]),i(t)};return t(),window.addEventListener("scroll",t,{passive:!0}),window.addEventListener("resize",t),()=>{window.removeEventListener("scroll",t),window.removeEventListener("resize",t)}},[n]);let c=e=>{var t;null==(t=document.getElementById(e))||t.scrollIntoView({behavior:"smooth"}),window.history.replaceState(null,"","".concat(window.location.pathname).concat(window.location.search,"#").concat(e))};return(0,l.jsx)("nav",{"aria-label":"Class sections",className:"sticky top-0 z-30 bg-gray-50/95 backdrop-blur border-b border-gray-200",children:(0,l.jsx)("div",{className:"max-w-6xl mx-auto flex justify-start sm:justify-center gap-1 overflow-x-auto px-2",children:r.map(e=>(0,l.jsx)("button",{type:"button",onClick:()=>c(e.key),"aria-current":o===e.key?"true":void 0,className:"shrink-0 px-4 py-3 -mb-px text-sm md:text-base font-medium border-b-2 transition-colors ".concat(o===e.key?"border-[#BE4C19] text-[#BE4C19]":"border-transparent text-gray-600 hover:text-black"),children:e.label},e.key))})})}var d=s(6766),m=s(6874),h=s.n(m);let u=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/placeholder.svg";return e?/^(https?:)?\/\//.test(e)||e.startsWith("/")?e:"".concat("https://www.samimramizfellowship.org/storage","/").concat(e):t};function x(e){let{html:t,text:s,className:r=""}=e,n=(0,a.useRef)(null),[o,i]=(0,a.useState)(!1),[c,d]=(0,a.useState)(!1);return((0,a.useEffect)(()=>{let e=n.current;e&&d(e.scrollHeight>e.clientHeight+1)},[t,s]),t||s)?(0,l.jsxs)("div",{children:[t?(0,l.jsx)("div",{ref:n,className:"".concat(o?"":"line-clamp-3"," ").concat(r),dangerouslySetInnerHTML:{__html:t}}):(0,l.jsx)("div",{ref:n,className:"".concat(o?"":"line-clamp-3"," ").concat(r),children:s}),(c||o)&&(0,l.jsx)("button",{type:"button",onClick:()=>i(e=>!e),className:"mt-2 text-sm font-medium text-[#BE4C19] hover:underline",children:o?"Show less":"Read more"})]}):null}function g(e){let{fellows:t}=e;return 0===t.length?(0,l.jsx)("p",{className:"text-center text-gray-500",children:"No fellows have been added for this class yet."}):(0,l.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-8",children:t.map(e=>{var t;let s="/blogs/?fellow=".concat(e.id);return(0,l.jsxs)("article",{className:"bg-white rounded-lg shadow-md overflow-hidden flex flex-col hover:shadow-lg transition-shadow",children:[(0,l.jsx)(h(),{href:s,"aria-label":"Blogs by ".concat(e.name),children:(0,l.jsx)(d.default,{src:u(null!=(t=e.image_url)?t:e.image),alt:e.name,className:"w-full aspect-[4/5] object-cover",width:600,height:750})}),(0,l.jsxs)("div",{className:"p-5 flex flex-col flex-1",children:[(0,l.jsx)(h(),{href:s,className:"text-xl font-semibold hover:text-[#BE4C19] transition-colors",children:e.name}),e.location&&(0,l.jsx)("p",{className:"text-gray-500 text-sm mt-1",children:e.location}),(0,l.jsx)(x,{html:e.description,className:"mt-3 text-gray-700 text-sm leading-6"}),(0,l.jsxs)(h(),{href:s,className:"mt-auto pt-4 text-sm font-semibold text-[#BE4C19] hover:underline",children:["Read ",e.name.split(" ")[0],"'s blogs →"]})]})]},e.id)})})}function p(e){let{members:t}=e;return(0,l.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-6",children:t.map(e=>(0,l.jsxs)("div",{className:"text-center",children:[(0,l.jsx)(d.default,{src:u(e.image_url),alt:e.name,className:"w-full aspect-square rounded-lg object-cover shadow-md",width:400,height:400}),(0,l.jsx)("h3",{className:"mt-3 font-semibold",children:e.name}),(0,l.jsx)("p",{className:"text-gray-500 text-sm",children:e.role||"Selection Committee"})]},e.id))})}function f(e){let{partners:t}=e;return(0,l.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-8",children:t.map(e=>(0,l.jsxs)("article",{className:"bg-white shadow-md rounded-lg overflow-hidden flex flex-col hover:shadow-lg transition-shadow",children:[(0,l.jsx)("div",{className:"h-44 flex items-center justify-center bg-gray-50 p-6",children:(0,l.jsx)(d.default,{src:u(e.image_url),alt:e.name,className:"max-h-full w-auto object-contain",width:300,height:160})}),(0,l.jsxs)("div",{className:"p-5",children:[(0,l.jsx)("h3",{className:"text-lg font-semibold",children:e.name}),e.location&&(0,l.jsx)("p",{className:"text-gray-500 text-sm",children:e.location}),(0,l.jsx)(x,{text:e.description,className:"mt-3 text-gray-700 text-sm leading-6"})]})]},e.id))})}function w(e){let{contributors:t}=e;return(0,l.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-6",children:t.map(e=>(0,l.jsxs)("div",{className:"text-center",children:[(0,l.jsx)(d.default,{src:u(e.image_url),alt:e.name,className:"w-full aspect-square rounded-lg object-cover shadow-md",width:300,height:300}),(0,l.jsx)("h3",{className:"mt-3 font-semibold text-sm",children:e.name})]},e.id))})}var b=s(5442),v=s(4813),j=s(9356);let y=e=>{var t;let s=null==e||null==(t=e.split(".").pop())?void 0:t.toLowerCase();return s&&["mp4","avi","mkv"].includes(s)?"video":"image"};function N(e){let{classId:t,year:s}=e,n=(0,r.useRouter)(),[o,i]=(0,a.useState)([]),[c,d]=(0,a.useState)(1),[m,x]=(0,a.useState)(!0),[g,p]=(0,a.useState)(!0),[f,w]=(0,a.useState)("");return((0,a.useEffect)(()=>{let e=!1;return(async()=>{p(!0);try{let s=(await (0,j.n)(c,{per_page:6,class:t})).data||[];if(e)return;i(e=>1===c?s:[...e,...s]),x(6===s.length)}catch(t){console.error(t),e||w("Failed to load posts.")}finally{e||p(!1)}})(),()=>{e=!0}},[t,c]),f)?(0,l.jsx)("p",{className:"text-center text-red-500",children:f}):g&&0===o.length?(0,l.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:Array.from({length:3}).map((e,t)=>(0,l.jsx)(v.A,{},t))}):0===o.length?(0,l.jsxs)("p",{className:"text-center text-gray-500",children:["No posts from Class ",s," yet."]}):(0,l.jsxs)("section",{children:[(0,l.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:o.map(e=>{var t,s;let a=y(e.file),r=e.file?u(e.file):void 0;return(0,l.jsx)("div",{onClick:()=>n.push("/blogs/?post=".concat(e.slug)),className:"cursor-pointer h-full flex flex-col",children:(0,l.jsx)(b.A,{post:{id:String(e.id),title:e.title,excerpt:e.excerpt,image:r,type:a,videoSrc:"video"===a?r:void 0,date:new Date(e.published_at).toLocaleDateString(),author:(null==(t=e.fellow)?void 0:t.name)||(null==(s=e.user)?void 0:s.name)||"Unknown"}})},e.id)})}),(0,l.jsxs)("div",{className:"flex flex-col sm:flex-row items-center justify-center gap-4 mt-10",children:[m&&(0,l.jsx)("button",{onClick:()=>d(e=>e+1),disabled:g,className:"px-6 py-2 rounded-md bg-[#BE4C19] text-white font-medium hover:bg-black transition disabled:opacity-60",children:g?"Loading...":"Load more"}),(0,l.jsxs)(h(),{href:"/blogs/?class=".concat(t),className:"text-[#BE4C19] hover:underline font-medium",children:["See all Class ",s," posts"]})]})]})}function k(){let e=(0,r.useSearchParams)().get("year"),[t,s]=(0,a.useState)(null),[d,m]=(0,a.useState)(!0),[h,u]=(0,a.useState)("");(0,a.useEffect)(()=>{let t=!1;return(async()=>{m(!0),u("");try{let l=e;if(!l){let e=await (0,o.N)();if(0===e.length)throw Error("No classes have been published yet.");l=String(e[0].year)}let a=await i(l);t||s(a)}catch(e){var l;if(t)return;console.error(e),n.A.isAxiosError(e)&&(null==(l=e.response)?void 0:l.status)===404?u("That class does not exist."):e instanceof Error?u(e.message):u("Failed to load this class.")}finally{t||m(!1)}})(),()=>{t=!0}},[e]);let x=t?[{key:"fellows",label:"Fellows",title:"Fellows",intro:"Click a fellow's name or photo to read their blogs."},...t.committee_members.length?[{key:"committee",label:"Selection Committee",title:"Selection Committee",intro:"The experts who selected and guide this class."}]:[],...t.partners.length?[{key:"partners",label:"Partners",title:"Partners",intro:"The media outlets that host this class's fellows."}]:[],...t.contributors.length?[{key:"contributors",label:"Contributors",title:"Contributors",intro:"The people whose support made this class possible."}]:[],{key:"blogs",label:"Blogs",title:"Blogs",intro:"Latest reporting by Class ".concat(t.year," fellows.")}]:[];return((0,a.useEffect)(()=>{if(!t)return;let e=window.location.hash.replace("#","");e?requestAnimationFrame(()=>{var t;return null==(t=document.getElementById(e))?void 0:t.scrollIntoView({behavior:"smooth"})}):window.scrollTo({top:0})},[t]),d)?(0,l.jsx)("main",{className:"min-h-screen bg-gray-50 py-10 px-4",children:(0,l.jsx)("p",{className:"text-center text-gray-500 text-lg",children:"Loading class..."})}):h||!t?(0,l.jsx)("main",{className:"min-h-screen bg-gray-50 py-10 px-4",children:(0,l.jsx)("p",{className:"text-center text-red-500",children:h})}):(0,l.jsxs)("main",{className:"min-h-screen bg-gray-50",children:[(0,l.jsxs)("header",{className:"py-12 px-4 text-center",children:[(0,l.jsx)("h1",{className:"text-3xl md:text-5xl font-bold mb-4 leading-tight",children:t.name.trim()}),(0,l.jsx)("div",{className:"text-gray-600 max-w-3xl mx-auto",dangerouslySetInnerHTML:{__html:t.description}})]}),(0,l.jsx)(c,{sections:x}),(0,l.jsx)("div",{className:"max-w-6xl mx-auto px-4",children:x.map(e=>(0,l.jsxs)("section",{id:e.key,className:"scroll-mt-16 py-14 border-b border-gray-200 last:border-b-0",children:[(0,l.jsx)("h2",{className:"text-3xl font-bold text-center",children:e.title}),(0,l.jsx)("p",{className:"text-gray-600 text-center mt-2 mb-10",children:e.intro}),"fellows"===e.key&&(0,l.jsx)(g,{fellows:t.fellows}),"committee"===e.key&&(0,l.jsx)(p,{members:t.committee_members}),"partners"===e.key&&(0,l.jsx)(f,{partners:t.partners}),"contributors"===e.key&&(0,l.jsx)(w,{contributors:t.contributors}),"blogs"===e.key&&(0,l.jsx)(N,{classId:t.id,year:t.year})]},e.key))})]})}function S(){return(0,l.jsx)(a.Suspense,{fallback:(0,l.jsx)("main",{className:"min-h-screen bg-gray-50 py-10 px-4",children:(0,l.jsx)("p",{className:"text-center text-gray-500 text-lg",children:"Loading class..."})}),children:(0,l.jsx)(k,{})})}},5442:(e,t,s)=>{"use strict";s.d(t,{A:()=>o});var l=s(5155),a=s(6766),r=s(2115),n=s(9509);let o=e=>{let{post:t}=e,[s,o]=(0,r.useState)(!1),[i,c]=(0,r.useState)(!1),d=t.title.length>50?"".concat(t.title.substring(0,50),"..."):t.title;return(0,l.jsxs)("article",{className:"bg-white rounded-lg overflow-hidden shadow-md hover:shadow-lg transition-all duration-300 transform hover:-translate-y-1",onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[(0,l.jsxs)("div",{className:"relative w-full h-48 overflow-hidden",children:["video"===t.type&&t.videoSrc&&!s?(0,l.jsxs)("video",{className:"w-full h-full object-cover",controls:!0,autoPlay:!0,muted:!0,loop:!0,playsInline:!0,poster:t.image,onError:()=>o(!0),children:[(0,l.jsx)("source",{src:t.videoSrc,type:"video/mp4"}),"Your browser does not support the video tag."]}):(0,l.jsx)(a.default,{src:t.image||"".concat(n.env.NEXT_PUBLIC_URL,"/placeholder.svg"),alt:t.title,className:"w-full h-full object-cover transition-transform duration-500 ".concat(i?"scale-105":"scale-100"),width:1200,height:800}),"video"===t.type&&(0,l.jsx)("div",{className:"absolute top-3 right-3 bg-black bg-opacity-70 text-white text-xs px-2 py-1 rounded",children:"Video"})]}),(0,l.jsxs)("div",{className:"p-5",children:[(0,l.jsxs)("div",{className:"flex items-center text-gray-500 text-xs mb-2",children:[(0,l.jsx)("span",{children:t.date}),(0,l.jsx)("span",{className:"mx-2",children:"•"}),(0,l.jsx)("span",{children:t.author})]}),(0,l.jsx)("h3",{className:"font-semibold text-lg mb-2 line-clamp-2",title:t.title,children:d}),(0,l.jsx)("p",{className:"text-gray-600 text-sm line-clamp-3 mb-4",children:t.excerpt}),(0,l.jsxs)("button",{className:"text-blue-600 hover:text-blue-800 text-sm font-medium flex items-center transition-transform duration-200 ".concat(i?"translate-x-1":""),children:["Read more",(0,l.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 ml-1",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]})]})]})}},5695:(e,t,s)=>{"use strict";var l=s(8999);s.o(l,"usePathname")&&s.d(t,{usePathname:function(){return l.usePathname}}),s.o(l,"useRouter")&&s.d(t,{useRouter:function(){return l.useRouter}}),s.o(l,"useSearchParams")&&s.d(t,{useSearchParams:function(){return l.useSearchParams}})},6533:(e,t,s)=>{Promise.resolve().then(s.bind(s,5431))},9356:(e,t,s)=>{"use strict";s.d(t,{n:()=>a});var l=s(3464);let a=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1?arguments[1]:void 0;return(await l.A.get("".concat("https://www.samimramizfellowship.org/api","/blogs"),{params:{page:e,...t}})).data}}},e=>{var t=t=>e(e.s=t);e.O(0,[464,766,874,441,684,358],()=>t(6533)),_N_E=e.O()}]);