1import{u as G,S as M,aw as U,j as a,ax as R,ay as w,az as V,aA as W,aB as q}from"./index-BSkckC04.js";import{u as F,h as H,r as n}from"./redux-vendor-D2oDNK8j.js";/* empty css */import{P as O}from"./Pagination-C3BL8rt1.js";import{L as f}from"./react-vendor-CojWF9B3.js";import"./ui-vendor-772QFaMB.js";const Z=12,J=s=>String(s||"").toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-"),_=s=>{if(!s)return"";const t={event_planning:"Event Planning",vendor_tips:"Vendor Tips",industry_news:"Industry News",how_to:"How To",case_studies:"Case Studies",company_news:"Company News"};return t[s]?t[s]:String(s).replace(/_/g," ").replace(/\b\w/g,m=>m.toUpperCase())},K=s=>{if(!s)return"";const t=new Date(s);return Number.isNaN(t.getTime())?"":t.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})},L=s=>{if(!s)return"";const t=typeof s=="string"?s:s==null?void 0:s.url;return t?t.startsWith("http")?t:`${q}${t}`:""},re=()=>{const{setSeo:s}=G(),t=F(),{blogPosts:m,blogLoading:N,pagination:c,blogFilters:g}=H(e=>e.cms),[i,T]=n.useState("All"),[b,$]=n.useState(""),[h,k]=n.useState(""),[u,j]=n.useState(1),[y,v]=n.useState([]);n.useEffect(()=>{s(M.blog)},[s]),n.useEffect(()=>{const e=setTimeout(()=>{k(b.trim())},300);return()=>clearTimeout(e)},[b]),n.useEffect(()=>{j(1),v([])},[h,i]),n.useEffect(()=>{const e={page:u,limit:Z};h&&(e.search=h),i!=="All"&&(e.category=i),t(U(e))},[t,u,h,i]),n.useEffect(()=>{v(e=>{const r=u===1?m:[...e,...m];if(!(r!=null&&r.length))return r;const l=new Map;return r.forEach(o=>{if(!o)return;const d=o._id||o.slug||o.id;l.has(d)||l.set(d,o)}),Array.from(l.values())})},[m,u]),n.useMemo(()=>{if(!c)return!1;const e=Number(c.currentPage||0),r=Number(c.totalPages||0);return e<r},[c]);const B=n.useMemo(()=>Array.isArray(g==null?void 0:g.categories)?g.categories.filter(Boolean):[],[g==null?void 0:g.categories]),p=e=>{T(e)},D=n.useCallback(e=>{j(e),window.scrollTo({top:0,behavior:"smooth"})},[]),I=e=>{const r=[];return e!=null&&e.category&&r.push(_(e.category)),Array.isArray(e==null?void 0:e.tags)&&e.tags.forEach(l=>{l&&r.push(l)}),r.slice(0,4)},z=e=>{if(!e)return"";if(typeof e=="string")return e;const r=e.firstName||"",l=e.lastName||"";return`${r} ${l}`.trim()};return a.jsxs("div",{className:"pp-max-container blog-page",children:[a.jsx("h1",{className:"blog-title",children:"Blog"}),a.jsxs("div",{className:"blog-filter-bar",children:[a.jsxs("div",{className:"blog-search",children:[a.jsx(R,{className:"blog-search-icon","aria-hidden":!0}),a.jsx("input",{value:b,onChange:e=>$(e.target.value),type:"text",className:"blog-search-input",placeholder:"Search...","aria-label":"Search blog"})]}),a.jsxs("div",{className:"blog-chips",children:[a.jsx("button",{type:"button","aria-pressed":i==="All",className:`blog-chip ${i==="All"?"is-active":""}`,onClick:()=>p("All"),children:"All"}),B.map(e=>a.jsx("button",{type:"button","aria-pressed":i===e,className:`blog-chip ${i===e?"is-active":""}`,onClick:()=>p(e),children:_(e)},e))]})]}),a.jsx("div",{className:"blog-grid",children:y.map(e=>{var A,C;const r=(e==null?void 0:e.slug)||J(e==null?void 0:e.title),l=L(e==null?void 0:e.featuredImage)||((C=(A=e==null?void 0:e.images)==null?void 0:A[0])==null?void 0:C.url),o=l?L(l):"",d=z(e==null?void 0:e.author),x=K((e==null?void 0:e.publishedAt)||(e==null?void 0:e.createdAt)),P=I(e),S=(e==null?void 0:e.excerpt)||"";return a.jsxs("article",{className:"blog-card",children:[a.jsxs("div",{className:"blog-card-media",children:[a.jsx(f,{to:`/blog/${r}`,children:o?a.jsx("img",{src:o,alt:e==null?void 0:e.title,loading:"lazy"}):null}),!!P.length&&a.jsx("div",{className:"blog-tags",children:P.map(E=>a.jsx("span",{className:"blog-tag",children:E},`${r}-${E}`))})]}),a.jsxs("div",{className:"blog-card-body",children:[a.jsx(f,{to:`/blog/${r}`,className:"blog-card-title",children:e==null?void 0:e.title}),a.jsxs("div",{className:"blog-card-meta",children:[d&&a.jsx("span",{className:"blog-meta-author",children:d}),d&&x&&a.jsx("span",{className:"blog-meta-dot"}),x&&a.jsx("span",{className:"blog-meta-date",children:x})]}),S&&a.jsx("p",{className:"blog-card-excerpt",children:S}),a.jsx(f,{to:`/blog/${r}`,className:"blog-read-link readarticles",children:"Read Article"})]})]},(e==null?void 0:e._id)||r)})}),!y.length&&!N&&a.jsx("div",{className:"blog-empty-container",children:a.jsxs("div",{className:"blog-empty-state",children:[a.jsx("div",{className:"blog-empty-icon",children:a.jsx(w,{})}),a.jsx("h2",{className:"blog-empty-title",children:"No blog posts yet"}),a.jsx("p",{className:"blog-empty-message",children:"We're working on creating amazing content for you. Check back soon for the latest updates, tips, and stories from the Party Pipeline team!"}),a.jsxs("div",{className:"blog-empty-features",children:[a.jsxs("div",{className:"blog-empty-feature",children:[a.jsx("span",{className:"blog-empty-feature-icon",children:a.jsx(w,{})}),a.jsx("span",{className:"blog-empty-feature-text",children:"Event Planning Tips"})]}),a.jsxs("div",{className:"blog-empty-feature",children:[a.jsx("span",{className:"blog-empty-feature-icon",children:a.jsx(V,{})}),a.jsx("span",{className:"blog-empty-feature-text",children:"Vendor Guides"})]}),a.jsxs("div",{className:"blog-empty-feature",children:[a.jsx("span",{className:"blog-empty-feature-icon",children:a.jsx(W,{})}),a.jsx("span",{className:"blog-empty-feature-text",children:"Industry Insights"})]})]})]})}),c&&c.totalPages>1&&a.jsx("div",{className:"blog-pagination",children:a.jsx(O,{currentPage:u,totalPages:c.totalPages,totalItems:c.totalItems,isLoading:N,onPageChange:D,className:"blog-pagination-container",infoClassName:"blog-pagination-info",buttonClassName:"blog-pagination-button",prevLabel:"Previous",nextLabel:"Next"})})]})};export{re 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.