import{a as t,j as n,R as S,r as g}from"./core.browser.esm-CQyIRvUX.js";import{F as H}from"./HorizontalLinks-D0YGfXo0.js";import{F as O}from"./SearchIcon-Dh4KWJzf.js";import{q as _,c as z}from"./QueryStringUtils-ncBEb2Bu.js";import{g as Q}from"./algoliaClient-2hqCYl8x.js";import{L as o,S as d,P as U}from"./Section-qoC8lYeX.js";import{B as V,F as Y,S as p}from"./FeaturedPost-Dei8b_fV.js";import"./_sentry-release-injection-file-q5yVqiXw.js";import{w as G}from"./withRailsContext-BrSkGU1X.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},s=new e.Error().stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="d59f3e66-4761-41f8-979b-e79d74f26cbb",e._sentryDebugIdIdentifier="sentry-dbid-d59f3e66-4761-41f8-979b-e79d74f26cbb")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},s=new e.Error().stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="f31809ad-f2ce-456c-a00e-64a0c0d9e257",e._sentryDebugIdIdentifier="sentry-dbid-f31809ad-f2ce-456c-a00e-64a0c0d9e257")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},s=new e.Error().stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="1f4845ef-d6c0-49ab-8357-42d3b70f93fd",e._sentryDebugIdIdentifier="sentry-dbid-1f4845ef-d6c0-49ab-8357-42d3b70f93fd")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},s=new e.Error().stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="4e394f15-6ba8-4b54-9aee-076df7cd0dd8",e._sentryDebugIdIdentifier="sentry-dbid-4e394f15-6ba8-4b54-9aee-076df7cd0dd8")}catch{}})();function J(){return t("div",{className:"flex rounded bg-beige-medium px-5 py-5 text-center",children:n("div",{id:"mc_embed_signup_scroll",children:[n("label",{className:"text-md mb-2 block font-medium text-gray-800",htmlFor:"mce-EMAIL",children:["Sign up for weekly updates from ",t("span",{className:"inline-block",children:"Y Combinator"})]}),t("div",{className:"text-center",children:t("a",{href:"/newsletter/subscribe?signup_source=ycdc_blog",id:"mc-embedded-subscribe",className:"ycdc-btn mt-2 w-full shrink-0 items-center justify-center",children:"Subscribe"})})]})})}const P="text-xl font-semibold tracking-wider text-gray-800 uppercase mb-2",y=[{slug:"admissions",name:"Admissions"},{slug:"advice",name:"Advice"},{slug:"biotech",name:"Biotech"},{slug:"blockchain",name:"Blockchain"},{slug:"essay",name:"Essay"},{slug:"female-founders",name:"Female Founders"},{slug:"founder-stories",name:"Founder Stories"},{slug:"interview",name:"Interviews"},{slug:"startup-school",name:"Startup School"},{slug:"work-at-a-startup",name:"Work at a Startup"},{slug:"yc-events",name:"YC Events"}],b=[{name:"All Posts",href:"/blog"},{name:"Startup Jobs",href:"/blog/jobs"},{name:"Startup School",href:"/blog/startup-school"}];function W(...e){return e.filter(Boolean).join(" ")}function I(e){return n("nav",{className:"flex items-center justify-between border-t border-gray-200 py-3","aria-label":"Pagination",children:[t("div",{className:"hidden sm:block",children:n("p",{className:"text-sm text-gray-700",children:["Showing"," ",t("span",{className:"font-medium",children:(e.pagination.page-1)*e.pagination.limit+1})," ","to"," ",t("span",{className:"font-medium",children:Math.min(e.pagination.page*e.pagination.limit,e.pagination.total)})," ","of ",t("span",{className:"font-medium",children:e.pagination.total})," total posts"]})}),n("div",{className:"flex flex-1 justify-between sm:justify-end",children:[e.pagination.prev&&t(o,{href:"",onClick:e.handlePrevious,className:"relative inline-flex items-center rounded-md border border-gray-300 px-4 py-2 text-sm font-medium text-gray-700 hover:cursor-pointer hover:bg-gray-50",children:"Previous"}),e.pagination.next&&t(o,{href:"",onClick:e.handleNext,className:"relative ml-3 inline-flex items-center rounded-md border border-gray-300 px-4 py-2 text-sm font-medium text-gray-700 hover:cursor-pointer hover:bg-gray-50",children:"Next"})]})]})}function B(e){const s=e.post.authors.map(r=>t(o,{href:`/blog/author/${r.slug}`,className:"text-blue-500 hover:underline",children:t("span",{className:"",children:r.name})},r.slug)).reduce((r,u)=>[r,", ",u]);return t("div",{className:"flex flex-col overflow-hidden rounded-lg",children:t("div",{className:"mb-6 mr-6 flex flex-1 flex-col justify-between",children:n("div",{className:"flex-1",children:[t(o,{href:`/blog/${e.post.slug}`,className:"mt-2 block",children:t("p",{className:"text-3xl font-semibold text-gray-900",children:e.post.title})}),n("p",{className:"text-md py-2 text-gray-500",children:["by ",s,t("span",{className:"ml-4 text-sm font-normal",children:new Date(e.post.published_at).toLocaleDateString()})]}),t("p",{className:"mt-3 text-base text-gray-800",children:e.post.custom_excerpt||e.post.excerpt}),t("div",{className:"mt-4",children:n(o,{className:"inline-flex text-sm font-medium text-blue-500 md:text-base",href:`/blog/${e.post.slug}`,children:["Read More"," ",t(H,{className:"mx-1 h-6 w-6",width:"1.25em",height:"1.25em"})]})})]})})})}function K(e){var N,v;const s=((N=e.pagination)==null?void 0:N.page)==1?3:0,r=S.useMemo(()=>e.posts.slice(0,s).map(a=>t(V,{post:a},a.id)),[e.posts]),u=S.useMemo(()=>e.posts.slice(s).map(a=>t(B,{post:a},a.id)),[e.posts]),[c,k]=g.useState(""),[l,x]=g.useState(""),[w,D]=g.useState([]),[m,j]=g.useState({page:1,next:2,prev:null,limit:10,total:0});g.useEffect(()=>{k(window.location.pathname);const a=_.parse(window.location.search);a.query&&(x(a.query),h(a.query,m.page))},[]);const C=a=>{window.location.href=b[a.target.selectedIndex].href},h=(a,A)=>{x(a);const M={indexName:`ycdc_blog_${window.RAILS_ENV}`,query:a,params:{page:A-1,attributesToRetrieve:["title","slug","excerpt","authors","tags","published_at"],attributesToHighlight:[],attributesToSnippet:[],hitsPerPage:10}};Q().search([M]).then(q=>{const i=q.results[0],T=i.hits;j({page:i.page+1,next:i.page!=i.nbPages-1?i.page+2:null,prev:i.page!=0?i.page:null,limit:i.hitsPerPage,total:i.nbHits}),D(T)});const L={query:a,page:e.pagination.page!=1?e.pagination.page:null};let f=`?${_.stringify(z(L))}`;f=="?"&&([f]=window.location.href.split("?")),window.location.search!==f&&history.replaceState({},"",f)},E=()=>{const a=`${c}?page=${e.pagination.next}`;window.location.href=a},R=()=>{const a=`${c}?page=${e.pagination.prev}`;window.location.href=a},$=()=>{h(l,m.next)},F=()=>{h(l,m.prev)};return n(U,{children:[t(d,{retroNoBottomBorder:!0,children:n("div",{children:[n("div",{className:"sm:hidden",children:[t("label",{htmlFor:"tabs",className:"sr-only",children:"Select a tab"}),t("select",{id:"tabs",name:"tabs",className:"block w-full rounded-md border-gray-300 pl-3 pr-10 text-base focus:border-indigo-500 focus:outline-none focus:ring-indigo-500 sm:text-sm",defaultValue:(v=b.find(a=>a.href==c))==null?void 0:v.name,onChange:a=>C(a),children:b.map(a=>t("option",{children:a.name},a.name))})]}),t("div",{className:"hidden sm:block",children:t("div",{className:"",children:n("nav",{className:"-mb-px flex space-x-8","aria-label":"Tabs",children:[b.map(a=>t(o,{href:a.href,className:W(a.href==c?"border-gray-200 text-black":"border-transparent text-gray-500 hover:border-gray-200 hover:text-gray-700","whitespace-nowrap border-b-2 px-1 py-2 text-sm font-medium"),"aria-current":a.href==c?"page":void 0,children:a.name},a.name)),t("div",{className:"flex flex-1 items-center justify-center lg:ml-8 lg:justify-end",children:n("div",{className:"w-full max-w-lg lg:max-w-xs",children:[t("label",{htmlFor:"search",className:"sr-only",children:"Search Blog Posts"}),n("div",{className:"relative",children:[t("div",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3",children:t(O,{className:"h-5 w-5 text-gray-400","aria-hidden":"true",width:"1.25em",height:"1.25em"})}),t("input",{id:"search",name:"search",className:"block w-full rounded-md border border-gray-300 bg-white py-2 pl-10 pr-3 leading-5 placeholder-gray-500 focus:border-indigo-500 focus:placeholder-gray-400 focus:outline-none focus:ring-1 focus:ring-indigo-500 sm:text-sm",placeholder:"Search Blog",type:"search",value:l,onChange:a=>{a.target.value!==l&&h(a.target.value,m.page)}})]})]})})]})})})]})}),e.featured&&l.length==0&&t(d,{retroNoBottomBorder:!0,children:t(Y,{post:e.featured})}),r.length>0&&l.length==0&&n(d,{retroNoBottomBorder:!0,children:[n(p,{noMargin:!0,children:["Recent Posts ",e.filter]}),t("div",{className:"mx-auto mt-12 grid max-w-lg gap-9 lg:max-w-none lg:grid-cols-3",children:r})]}),l.length>0&&t(d,{retroNoBottomBorder:!0,children:n("div",{className:"mt-2 grid max-w-lg gap-5 lg:max-w-none lg:grid-cols-3",children:[n("div",{className:"col-span-2",children:[n(p,{noMargin:!0,children:["Search: ",l]}),w.length==0&&t("p",{children:"No Results Found"}),w.map(a=>t(B,{post:a},a.objectID)),t(I,{pagination:m,handleNext:$,handlePrevious:F})]}),t("div",{className:"ml-20",children:n("div",{className:"mb-4",children:[t("p",{className:P,children:"Categories"}),y.map(a=>t(o,{className:"flex",href:`/blog/tag/${a.slug}`,children:t("div",{className:"text-md mb-3 rounded bg-beige-medium px-2 py-1 font-medium text-gray-800",children:a.name})},a.slug))]})})]})}),u.length>0&&l.length==0&&t(d,{retroNoBottomBorder:!0,children:n("div",{className:"mt-2 grid max-w-lg gap-5 lg:max-w-none lg:grid-cols-3",children:[n("div",{className:"col-span-2",children:[t(p,{noMargin:!0,children:"All Posts"}),u,t(I,{pagination:e.pagination,handleNext:E,handlePrevious:R})]}),t("div",{className:"ml-20",children:n("div",{className:"mb-4",children:[t("p",{className:P,children:"Categories"}),y.map(a=>t(o,{className:"flex",href:`/blog/tag/${a.slug}`,children:t("div",{className:"text-md mb-3 rounded bg-beige-medium px-2 py-1 font-medium text-gray-800",children:a.name})},a.slug))]})})]})}),t(d,{retroNoBottomBorder:!0,children:t("div",{className:"w-96",children:t(J,{})})})]})}const X=G(K),oe=Object.freeze(Object.defineProperty({__proto__:null,PUBLIC_CATEGORIES:y,default:X},Symbol.toStringTag,{value:"Module"}));export{X as B,J as M,y as P,oe as a};
