1import{j as e}from"./vendor-query-CniT1WJL.js";import{r as u,L as x,u as j,e as v}from"./vendor-react-69GsFwrV.js";import{bN as N,bO as y,I as w,f,q as d,bP as k}from"./index-KjAD5lCC.js";import{B as p}from"./badge-DyGI04xR.js";import{ao as C,ai as h,aM as S,bh as R,F as A,y as c,bi as L,D as b,X as $}from"./vendor-ui-Ad3ANzF6.js";import z from"./CoaVerify-DxTqguh8.js";import"./vendor-forms-q6h4WU-p.js";const I=["Body Composition","Recovery & Repair","Metabolic Research","Cognitive & Neuroprotection","Longevity & Anti-Aging"];function F(){const[s,t]=u.useState(""),[a,i]=u.useState(""),{data:o,isLoading:m}=N(s||void 0,a||void 0),n=o??[];return e.jsxs("div",{className:"max-w-4xl mx-auto px-4 py-6",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h1",{className:"font-serif text-3xl font-bold mb-1",children:"Research Library"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"A curated reference library of research compounds, compiled from public scientific sources."})]}),e.jsxs(x,{to:y,"data-testid":"link-research-vida-files",className:"group mb-6 flex items-center gap-3 rounded-lg border border-card-border bg-card px-4 py-3 transition-colors hover-elevate focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",children:[e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-[10px] bg-vida-mint-soft text-vida-green-800 dark:bg-vida-green-700 dark:text-vida-mint",children:e.jsx(C,{"aria-hidden":"true",className:"size-4"})}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block text-sm font-semibold text-foreground group-hover:text-primary transition-colors",children:"Vida Files"}),e.jsx("span",{className:"block text-xs text-muted-foreground",children:"The weekly featured-peptide write-up, plus the archive of past features."})]}),e.jsx(h,{"aria-hidden":"true",className:"size-4 shrink-0 text-muted-foreground transition-transform group-hover:translate-x-0.5"})]}),e.jsxs("div",{className:"relative mb-4",children:[e.jsx(S,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground pointer-events-none"}),e.jsx(w,{type:"search",placeholder:"Search compounds, CAS numbers, formulas...","aria-label":"Search compounds, CAS numbers, or formulas",value:s,onChange:r=>t(r.target.value),className:"pl-9","data-testid":"input-research-search"})]}),e.jsx("div",{className:"flex flex-wrap gap-2 mb-5",children:I.map(r=>{const l=a===r;return e.jsx("button",{type:"button",onClick:()=>i(l?"":r),"aria-pressed":l,className:f("rounded-lg border px-3 py-1.5 text-xs font-medium transition-colors hover-elevate",l?"bg-primary text-primary-foreground border-primary":"bg-card text-muted-foreground border-card-border"),"data-testid":`chip-category-${r}`,children:r},r)})}),e.jsxs("div",{className:"flex items-center justify-between gap-3 mb-4 text-xs text-muted-foreground",children:[e.jsx("span",{"data-testid":"text-result-count",children:m?"Searching...":`${n.length} result${n.length!==1?"s":""}`}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(R,{className:"w-3.5 h-3.5"}),"Sources: PubChem · pep-pedia.org"]})]}),m?e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:Array.from({length:6}).map((r,l)=>e.jsx(d,{className:"h-40 rounded-lg"},l))}):n.length===0?e.jsxs("div",{className:"text-center py-20",children:[e.jsx(A,{className:"w-10 h-10 text-muted-foreground mx-auto mb-3"}),e.jsx("p",{className:"text-muted-foreground font-medium",children:"No compounds found."}),e.jsx("p",{className:"text-muted-foreground text-sm mt-1",children:"Try a different search term or category."})]}):e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:n.map(r=>{const l=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-start justify-between gap-2 mb-1",children:[e.jsx("h2",{className:"text-foreground font-semibold leading-tight group-hover:text-primary transition-colors",children:r.name}),r.inCatalog&&r.productSlug?e.jsx(p,{className:"bg-accent text-accent-foreground shrink-0",children:"In catalog"}):null]}),r.classTag?e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:r.classTag}):e.jsx("div",{className:"mb-3"}),r.summary?e.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed line-clamp-2 mb-3",children:r.summary}):null,e.jsxs("dl",{className:"grid grid-cols-1 gap-1 text-xs mb-3",children:[r.molecularWeight!=null?e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Mol. weight"}),e.jsxs("dd",{className:"text-foreground font-medium",children:[r.molecularWeight," g/mol"]})]}):null,r.molecularFormula?e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Formula"}),e.jsx("dd",{className:"text-foreground font-medium font-mono",children:r.molecularFormula})]}):r.casNumber?e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsx("dt",{className:"text-muted-foreground",children:"CAS"}),e.jsx("dd",{className:"text-foreground font-medium font-mono",children:r.casNumber})]}):null]}),e.jsxs("div",{className:"mt-auto flex items-center justify-between gap-2 pt-2",children:[e.jsx("div",{className:"flex items-center gap-1.5",children:r.pubchemCid?e.jsx(p,{variant:"secondary",className:"text-[10px]",children:"PubChem"}):null}),e.jsxs("span",{className:"text-primary text-sm font-medium inline-flex items-center gap-1",children:[r.inCatalog?"View research":"Source pending",e.jsx(h,{className:"w-3.5 h-3.5"})]})]})]}),g="group bg-card border border-card-border rounded-lg p-4 flex flex-col hover:border-primary/40 hover:shadow-sm transition-all";return r.inCatalog&&r.productSlug?e.jsx(x,{href:`/products/${r.productSlug}#research`,className:g,"data-testid":`card-compound-${r.slug}`,children:l},r.slug):e.jsx("article",{className:`${g} opacity-80`,"data-testid":`card-compound-${r.slug}`,children:l},r.slug)})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-8 text-center",children:"Curated from public scie
1ntific sources for research reference; research/in-vitro use only. Sources: PubChem, pep-pedia.org."})]})}function P(s){if(!s)return"";try{return new Date(s).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}catch{return""}}function E({infographic:s,onClose:t}){return u.useEffect(()=>{const a=i=>{i.key==="Escape"&&t()};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[t]),e.jsx("div",{role:"presentation",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 p-4",onClick:t,children:e.jsxs("div",{className:"relative max-h-[90vh] max-w-[90vw] overflow-auto rounded-card bg-card shadow-2xl",onClick:a=>a.stopPropagation(),children:[e.jsxs("div",{className:"sticky top-0 z-10 flex items-center justify-between gap-3 border-b border-card-border bg-card px-4 py-3",children:[e.jsx("p",{className:"font-semibold text-sm text-foreground truncate",children:s.title}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsxs("a",{href:s.url,download:!0,className:"inline-flex items-center gap-1.5 rounded-pill border border-card-border px-3 py-1.5 text-xs font-medium text-foreground hover:bg-muted transition-colors","aria-label":`Download ${s.title}`,children:[e.jsx(b,{className:"size-3.5","aria-hidden":"true"}),"Download"]}),e.jsx("button",{type:"button",onClick:t,"aria-label":"Close preview",className:"flex size-8 items-center justify-center rounded-pill hover:bg-muted transition-colors text-muted-foreground",children:e.jsx($,{className:"size-4"})})]})]}),e.jsx("div",{className:"p-4",children:e.jsx("img",{src:s.url,alt:s.alt??s.title,className:"max-h-[75vh] w-auto rounded object-contain mx-auto"})})]})})}function T({item:s}){const[t,a]=u.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"group relative flex flex-col rounded-card border border-card-border bg-card overflow-hidden hover:border-primary/40 hover:shadow-sm transition-all",children:[e.jsxs("button",{type:"button",onClick:()=>a(!0),className:"relative block aspect-[3/4] overflow-hidden bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-inset","aria-label":`Preview ${s.title}`,children:[e.jsx("img",{src:s.url,alt:s.alt??s.title,loading:"lazy",className:"h-full w-full object-cover transition-transform group-hover:scale-105"}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/0 group-hover:bg-black/20 transition-colors",children:e.jsx(L,{className:"size-8 text-white opacity-0 group-hover:opacity-100 drop-shadow transition-opacity","aria-hidden":"true"})})]}),e.jsxs("div",{className:"flex items-center justify-between gap-2 p-3",children:[e.jsx("p",{className:"text-xs font-medium text-foreground line-clamp-2 flex-1",children:s.title}),e.jsx("a",{href:s.url,download:!0,onClick:i=>i.stopPropagation(),"aria-label":`Download ${s.title}`,className:"shrink-0 flex size-7 items-center justify-center rounded-full border border-card-border text-muted-foreground hover:text-primary hover:border-primary/40 transition-colors",children:e.jsx(b,{className:"size-3.5","aria-hidden":"true"})})]})]}),t&&e.jsx(E,{infographic:s,onClose:()=>a(!1)})]})}function D({post:s}){return e.jsxs(x,{to:`/blog/${s.slug}`,className:"group block rounded-card border border-card-border bg-card overflow-hidden hover-elevate transition-shadow focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",children:[s.featureImage?e.jsx("div",{className:"aspect-[16/9] bg-muted overflow-hidden",children:e.jsx("img",{src:s.featureImage,alt:"",loading:"lazy",className:"h-full w-full object-cover transition-transform group-hover:scale-105"})}):e.jsx("div",{className:"aspect-[16/9] bg-muted flex items-center justify-center",children:e.jsx(c,{className:"w-8 h-8 text-muted-foreground"})}),e.jsxs("div",{className:"p-4",children:[e.jsx("h4",{className:"font-display text-lg text-foreground leading-tight mb-2 line-clamp-2 group-hover:text-primary transition-colors",children:s.title}),s.excerpt&&e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-3 mb-3",children:s.excerpt}),e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:P(s.publishedAt)}),e.jsxs("span",{className:"inline-flex items-center gap-1 text-primary group-hover:gap-1.5 transition-all font-medium",children:["Read",e.jsx(h,{className:"w-3.5 h-3.5"})]})]})]})]})}function V({section:s}){const t=s.infographics.length>0,a=s.posts.length>0,i=!t&&!a;return e.jsxs("section",{"aria-labelledby":`corner-section-${s.key}`,className:"mb-12 last:mb-0",children:[e.jsxs("div",{className:"mb-5",children:[e.jsx("h2",{id:`corner-section-${s.key}`,className:"font-serif text-2xl font-bold text-foreground mb-1",children:s.title}),e.jsx("p",{className:"text-sm text-muted-foreground max-w-prose",children:s.blurb})]}),i?e.jsxs("div",{className:"rounded-card border border-card-border bg-card p-8 text-center",children:[e.jsx(c,{className:"w-8 h-8 text-muted-foreground mx-auto mb-3"}),e.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"New guides are on the way."}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Check back soon for curated content in this section."})]}):e.jsxs("div",{className:"space-y-6",children:[t&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-3",children:"Reference Sheets"}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-4",children:s.infographics.map(o=>e.jsx(T,{item:o},o.id))})]}),a&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-3",children:"Articles"}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-5",children:s.posts.map(o=>e.jsx(D,{post:o},o.slug))})]})]})]})}function _(){return e.jsx("div",{className:"space-y-12","aria-busy":"true",children:[1,2].map(s=>e.jsxs("div",{children:[e.jsx(d,{className:"h-7 w-48 mb-2 rounded"}),e.jsx(d,{className:"h-4 w-80 mb-5 rounded"}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-4 mb-6",children:Array.from({length:4}).map((t,a)=>e.jsx(d,{className:"aspect-[3/4] rounded-card"},a))}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-5",children:Array.from({length:2}).map((t,a)=>e.jsx(d,{className:"h-52 rounded-card"},a))})]},s))})}function B(){const{data:s,isLoading:t,error:a}=k();return e.jsxs("div",{className:"max-w-4xl mx-auto px-4 py-6",children:[e.jsxs("div",{className:"mb-6 rounded-card border border-primary/20 bg-primary/5 px-4 py-3 flex items-start gap-2.5",children:[e.jsx(c,{className:"size-4 text-primary mt-0.5 shrink-0","aria-hidden":"true"}),e.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:[e.jsx("span",{className:"font-semibold text-primary",children:"Vida Fam researchers:"})," curated guides, reference sheets, and articles for in-vitro and pre-clinical research use only. Content is intended for qualified researchers and is not medical advice or dosing guidance."]})]}),a?e.jsxs("div",{className:"rounded-card border border-card-border bg-card p-10 text-center",children:[e.jsx(c,{className:"w-10 h-10 text-muted-foreground mx-auto mb-3"}),e.jsx("p",{className:"text-muted-foreground font-medium",children:"Could not load the Research Corner."}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Please check back shortly."})]}):t?e.jsx(_,{}):!s||s.sections.length===0?e.jsxs("div",{className:"rounded-card border border-card-border bg-card p-10 text-center",children:[e.jsx(c,{className:"w-10 h-10 text-muted-foreground mx-auto mb-3"}),e.jsx("p",{className:"text-muted-foreground font-medium",children:"Research Corner is being curated."}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Infographics and guides are on the way. Check back soon."})]}):e.jsx("div",{children:s.sections.map(i=>e.jsx(V,{section:i},i.key))})]})}const M=[{value:"library",label:"Library"},{value:"guides",label:"Guides"},{value:"lab",label:"Lab Results"}];function q({active:s,onSelect:t}){return e.jsx("div",{role:"tablist","aria-label":"Research sections",className:"mb-6 grid grid-cols-3 gap-1 rounded-pill bg-muted p-1 max-w-md",children:M.map(a=>{const i=s===a.value;return e.jsx("button",{type:"button",role:"tab","aria-selected":i,onClick:()=>t(a.value),"data-testid":`tab-research-${a.value}`,className:f("rounded-pill px-4 py-2 text-sm font-semibold motion-safe:transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",i?"bg-card text-ink shadow-sm":"text-ink-3 hover:text-ink"),children:a.label},a.value)})})}function X(){const[s,t]=j(),a=v(),i=new URLSearchParams(a).get("tab"),o=i==="lab"?"lab":i==="guides"?"guides":"library",m=n=>{const r=s.split("?")[0];t(n==="library"?r:`${r}?tab=${n}`)};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"max-w-4xl mx-auto px-4 pt-6",children:e.jsx(q,{active:o,onSelect:m})}),o==="library"&&e.jsx(F,{}),o==="guides"&&e.jsx(B,{}),o==="lab"&&e.jsx(z,{})]})}
1export{X 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.