1var e=(e,t,r)=>new Promise((o,a)=>{var s=e=>{try{n(r.next(e))}catch(t){a(t)}},i=e=>{try{n(r.throw(e))}catch(t){a(t)}},n=e=>e.done?o(e.value):Promise.resolve(e.value).then(s,i);n((r=r.apply(e,t)).next())});import{r as t,j as r}from"./react-core.DUCwsPgO.js";import{z as o,A as a}from"./db.Qh9nOVd1.js";import{B as s}from"./BlogPostCard.Br2RyQ4y.js";import{B as i}from"./BlogPagination.CZgaOGxb.js";import{a as n,w as l,i as d,j as c,T as m}from"./app-lib.DA4YQ9WV.js";import{m as u}from"./motion.BxWTuJCG.js";import"./ui-local.B9Cw40PD.js";import"./ui.F2p4rI6T.js";function x(){const x=o(),[p,g]=t.useState([]),[h,f]=t.useState([]),[y,j]=t.useState([]),[b,v]=t.useState(!0),[w,N]=t.useState(null),[F,P]=t.useState(1),[S,k]=t.useState(1),[R,B]=t.useState(null);t.useEffect(()=>{let t=!0;return function(){e(this,null,function*(){try{const e=n(),{categories:r,error:o}=yield l(e,1e4,"Failed to load categories: Request timed out");if(!t)return;if(o)return;j(r||[])}catch(e){if(!t)return}})}(),()=>{t=!1}},[]),t.useEffect(()=>{let t=!0;return function(){e(this,null,function*(){v(!0),N(null);const e=1===F&&!R;try{const[r,o]=yield Promise.all([l(d({page:F,perPage:12}),15e3,"Failed to load posts: Request timed out. Please check your connection and try again."),e?l(c(1),1e4,"Failed to load featured posts: Request timed out."):Promise.resolve({posts:[],error:null,total:0})]);if(!t)return;if(r.error){let e=r.error.message||"Failed to load posts";throw"PGRST116"===r.error.code?e="No posts found. Please check back later!":"42501"===r.error.code?e="Database permission error. Please contact support.":"500"===r.error.code&&(e="Server error. Our team has been notified. Please try again later."),new Error(e)}g(r.posts||[]),k(Math.ceil((r.total||0)/12)),e?o.error?f([]):f(o.posts||[]):f([])}catch(r){if(!t)return;let e="Failed to load posts";(r instanceof m||(null==r?void 0:r.message))&&(e=r.message),N(e),g([]),f([])}finally{t&&v(!1)}})}(),()=>{t=!1}},[F,R]);const T=e=>{B(e),P(1),e&&x(`/blog/category/${e}`)};return r.jsxs(r.Fragment,{children:[r.jsxs(a,{children:[r.jsx("title",{children:"Blog | Latest News & Stories | The Wildland Fire Recovery Fund"}),r.jsx("meta",{name:"description",content:"Read the latest news, survivor stories, and updates from The Wildland Fire Recovery Fund. Stay informed about our work supporting wildfire survivors."}),r.jsx("link",{rel:"canonical",href:"https://thewildlandfirerecoveryfund.org/blog"}),r.jsx("meta",{name:"robots",content:"index, follow, max-image-preview:large"}),r.jsx("meta",{property:"og:title",content:"Blog | The Wildland Fire Recovery Fund"}),r.jsx("meta",{property:"og:description",content:"Latest news, stories, and updates from The Wildland Fire Recovery Fund"}),r.jsx("meta",{property:"og:type",content:"website"}),r.jsx("meta",{property:"og:url",content:"https://thewildlandfirerecoveryfund.org/blog"}),r.jsx("meta",{name:"twitter:card",content:"summary_large_image"}),r.jsx("meta",{name:"twitter:title",content:"Blog | The Wildland Fire Recovery Fund"}),r.jsx("meta",{name:"twitter:description",content:"Latest news, stories, and updates"})]}),r.jsx("div",{className:"min-h-screen bg-background pt-32 pb-24 overflow-x-clip",children:r.jsxs("div",{className:"container mx-auto px-4 sm:px-6 md:px-8 max-w-7xl min-w-0",children:[r.jsxs(u.div,{initial:{opacity:0,y:30},animate:{opacity:1,y:0},transition:{duration:.6},className:"max-w-3xl mx-auto text-center mb-16",children:[r.jsxs("h1",{className:"text-5xl md:text-6xl lg:text-7xl mb-8 font-bold tracking-tight text-heading",children:["Our ",r.jsx("span",{className:"text-primary",children:"Blog"})]}),r.jsx("p",{className:"text-lg md:text-xl text-body-text-muted leading-relaxed font-light",children:"Stories, news, and updates from the frontlines of wildfire recovery."})]}),y.length>0&&r.jsxs(u.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},className:"flex flex-wrap items-center justify-center gap-3 mb-12",children:[r.jsx("button",{onClick:()=>T(null),className:"px-4 py-2 rounded-full text-sm font-medium transition-all "+(R?"bg-card/50 text-muted-foreground hover:text-foreground hover:bg-card border border-border/40":"bg-primary text-primary-foreground"),children:"All Posts"}),y.map(e=>r.jsx("button",{onClick:()=>T(e.slug),className:"px-4 py-2 rounded-full text-sm font-medium transition-all "+(R===e.slug?"bg-primary text-primary-foreground":"bg-card/50 text-muted-foreground hover:text-foreground hover:bg-card border border-border/40"),children:e.name},e.id))]}),h.length>0&&r.jsx(u.div,{initial:{opacity:0,y:20}
1,animate:{opacity:1,y:0},transition:{delay:.3},className:"mb-16",children:r.jsx(s,{post:h[0],featured:!0,priority:!0})}),b&&r.jsxs("div",{className:"text-center py-20",children:[r.jsx("div",{className:"inline-block animate-spin rounded-full h-12 w-12 border-b-2 border-primary"}),r.jsx("p",{className:"text-muted-foreground mt-4",children:"Loading posts..."})]}),w&&r.jsx("div",{className:"max-w-2xl mx-auto bg-destructive/10 border border-destructive/20 rounded-xl p-6 text-center",children:r.jsx("p",{className:"text-destructive",children:w})}),!b&&!w&&0===p.length&&r.jsx("div",{className:"max-w-2xl mx-auto text-center py-20",children:r.jsx("p",{className:"text-muted-foreground text-lg",children:"No posts published yet. Check back soon!"})}),!b&&!w&&p.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-8",children:p.filter(e=>!h.some(t=>t.id===e.id)).map((e,t)=>r.jsx(s,{post:e,index:t,priority:0===t},e.id))}),r.jsx(i,{currentPage:F,totalPages:S,onPageChange:e=>{P(e),window.scrollTo({top:0,behavior:"smooth"})}})]})]})})]})}export{x as BlogIndexPage};
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.