1import{u as I,x as k,j as e,r as i,R as L,ae as A,m as o,k as d,p as c,s as x,I as F,q as S,t as _,e as w,f as b,T as N}from"./entry.client-kLF6ofHV.js";import{S as E,a as M}from"./Swiper-CBMWZIhX.js";function R(l){const s=I();return k()?e.jsx(e.Fragment,{}):s?e.jsx(e.Fragment,{children:s&&e.jsx("div",{className:"w-full overflow-hidden",children:l.type?e.jsx(B,{collection:l==null?void 0:l.collection,theme:s,color:l.color}):e.jsx(Q,{item:l==null?void 0:l.item,theme:s,color:l.color})})}):e.jsx(e.Fragment,{})}R.displayName="Block(content/collection-preview)";const B=({collection:l,theme:s,color:r})=>{var f,g,h,p,y,j,v;const n=i.useRef(null);if(!l)return e.jsx(e.Fragment,{});const[m,u]=i.useState(null);i.useEffect(()=>{const t=[];s!=="nmf"&&t.push({taxonomy:N.Site,terms:[s],field:b.Slug,operator:w.In}),l&&t.push({taxonomy:N.Collection,terms:[l],field:b.Slug,operator:w.In}),u({relation:L.And,taxArray:t})},[s]);const a=A({first:5,terms:[l],taxQuery:m});return(g=(f=a.data)==null?void 0:f.contentNodes)!=null&&g.nodes&&((h=a.data.terms)!=null&&h.nodes)?e.jsx(o.div,{ref:n,...d(!0),className:"w-full flex flex-col",children:e.jsxs("div",{className:"w-grid m-auto flex gap-4 flex-col md:flex-row bg-fg my-4",children:[e.jsxs("div",{className:c("w-full order-2 md:w-1/4 md:order-1 p-4 flex flex-col justify-between gap-6",s==="nmf"?r==="red"?"bg-nmfAlt":"bg-grey-light":"bg-hero"),children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"type-theme-ui-m",children:"From the Living Library"}),e.jsx("h2",{className:"type-theme-title-xl",children:(p=a.data.terms.nodes[0])==null?void 0:p.name})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[((y=a.data.terms.nodes[0])==null?void 0:y.description)&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"type-theme-ui-m",children:"Information"}),e.jsx("p",{className:"type-global-body-s md:type-global-body-m",dangerouslySetInnerHTML:{__html:a.data.terms.nodes[0].description}})]}),e.jsxs(x,{href:(j=a.data.terms.nodes[0])==null?void 0:j.uri,target:s==="nmf"?void 0:"_blank",className:"styled-button secondary w-full mt-6 gap-3",children:[e.jsx("span",{children:"View in library"}),e.jsx("i",{className:"block w-[24px] h-[24px] [&>svg]:w-full [&>svg]:h-full",children:e.jsx(F,{name:s==="nmf"?"arrow-right":"arrow-right-up"})})]})]})]}),e.jsxs("div",{className:"w-full order-1 md:w-3/4 md:order-2 py-4 relative [&_.swiper-wrapper]:!ease-linear [&_.swiper]:!pointer-events-none",children:[e.jsx(x,{href:(v=a.data.terms.nodes[0])==null?void 0:v.uri,target:s==="nmf"?void 0:"_blank",className:"absolute top-0 left-0 w-full h-full z-40"}),e.jsx(E,{a11y:{prevSlideMessage:"Previous slide",nextSlideMessage:"Next slide"},loop:!0,speed:6e3,autoplay:{delay:0,disableOnInteraction:!1,pauseOnMouseEnter:!1},draggable:!1,slidesPerView:2.25,spaceBetween:16,children:a.data.contentNodes.nodes.map((t,T)=>e.jsx(M,{className:"h-auto flex items-end",children:e.jsx(C,{item:t})},T))})]})]})}):e.jsx(e.Fragment,{})},C=({item:l})=>{const{image:s,loading:r}=S(l),n=I();return e.jsx("div",{className:"w-full flex flex-col",children:s?e.jsx(o.div,{...d(!0),className:"w-full bg-grey-xlight",children:e.jsx(_,{...s,objectFit:"cover",className:c("w-full transition-all ease-in-out duration-300",n==="mpv"?"relative mpv-image-hover group-hover:before:w-full":"group-hover:grayscale")})}):r?e.jsx("div",{className:"w-full aspect-[6/4] animate-pulse bg-grey-xlight"}):null})},Q=({item:l,theme:s,color:r})=>{const{image:n,loading:m}=S(l),u=i.useRef(null);return l?e.jsxs(o.div,{ref:u,...d(!0),className:"grid-auto bg-fg my-9",children:[e.jsxs("div",{className:c("col-span-12 md:col-span-3 p-4 flex flex-col md:h-full justify-between gap-6 order-2 md:order-1",s==="nmf"?r==="red"?"bg-nmfAlt":"bg-grey-light":"bg-hero"),children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"type-theme-ui-m",children:"From the Living Library"}),e.jsx("h2",{className:"type-theme-title-xl",children:l==null?void 0:l.title})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"type-theme-ui-m",children:"Information"}),e.jsx("div",{className:"type-global-body-s md:type-global-body-m line-clamp-5",dangerouslySetInnerHTML:{__html:l.excerpt??""}}),e.jsxs(x,{href:l==null?void 0:l.uri,target:s==="nmf"?void 0:"_blank",className:"styled-button secondary w-full mt-6 gap-3",children:[e.jsx("span",{children:"View in library"}),e.jsx("i",{className:"block w-[24px] h-[24px] [&>svg]:w-full [&>svg]:h-full",children:e.jsx(F,{name:s==="nmf"?"arrow-right":"arrow-right-up"})})]})]})]}),e.jsx("div",{className:"col-span-12 md:col-span-9 py-6 px-6 md:pl-0 order-1 md:order-2 flex justify-center items-center",children:n?e.jsx(o.div,{...d(!0),className:"w-full h-full bg-grey-xlight",children:e.jsx(_,{...n,objectFit:"cover",className:c("w-full transition-all ease-in-out duration-300",s==="mpv"?"relative mpv-image-hover group-hover:before:w-full":"group-hover:grayscale")}
1)}):m?e.jsx("div",{className:"w-full aspect-[6/4] animate-pulse bg-grey-xlight"}):null})]}):e.jsx(e.Fragment,{})};export{B as Collection,R as default}; 2//# sourceMappingURL=collection-preview-CKOWJB_T.js.map
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.