1import{R as e,r as l,j as a}from"./vendor-react-BfgFmtGS.js";import{B as r}from"./button-CYJdLL_L.js";import{A as s,a as o,b as t}from"./avatar-DkgobaOn.js";import{a as i}from"./runtime-utils-GN4cODRt.js";import{f as n}from"./displayText-C8gylbfe.js";import{f as d}from"./useUserSettings-COWmNJt_.js";import{g as c,b as m,a as u}from"./image-utils-BFdDQ3hX.js";import{b as f}from"./shareUrls-CnKIAmlW.js";import{VideoPreview as p}from"./VideoPreview-D9BEa8DQ.js";import{u as h}from"./usePerfBudget-BZdR-G4y.js";import{L as w}from"./vendor-router-QOYqHwMx.js";import{F as x}from"./flame-DueLJnbo.js";import{B as v}from"./ban-DClk00Tq.js";import{C as g}from"./check-0D421DYe.js";import{P as b}from"./plus-O3w64FuI.js";import{E as j}from"./eye-off-YQaMGNXO.js";const y=({src:e,alt:r,className:s,lowEnd:o})=>{const[t,n]=l.useState(!1),[d,c]=l.useState(!1);return d?a.jsx("div",{className:i("bg-muted/30 w-full h-full",s)}):a.jsx("div",{className:i("relative w-full h-full overflow-hidden bg-muted/10",s),children:a.jsx("img",{src:e,alt:r,className:i("w-full h-full object-cover",!o&&"transition-opacity duration-300",o||t?"opacity-100":"opacity-0"),onLoad:o?void 0:()=>n(!0),onError:()=>c(!0),loading:"lazy",decoding:"async",fetchpriority:o?"low":void 0})})},N=e=>"video"===e.type?a.jsx(p,{src:e.src,fallbackSrc:e.fallbackSrc,posterSrc:e.posterSrc,posterFallbackSrc:e.posterFallbackSrc,alt:e.alt,className:e.className,playMode:"never"}):a.jsx(y,{src:e.src,alt:e.alt,className:e.className,lowEnd:e.lowEnd}),_=e.memo(function({board:e,onFollow:p,onUnfollow:y,onNotInterested:_,showTrending:k,hideOwner:S=!1,animationDelay:E=0}){var F,U,z,C,M,$;const{lowEnd:B}=h(),{user:P,profile:D}=d(),[A,L]=l.useState(e.is_following),[I,R]=l.useState(e.follower_count||0),[T,V]=l.useState(!1);l.useEffect(()=>{L(e.is_following),R(e.follower_count||0)},[e.is_following,e.follower_count]);const H=f({id:e.id,ownerUsername:e.owner_username,slug:e.slug}),O=(null==(F=e.description)?void 0:F.trim())||`A public Echo board with ${e.memory_count} echoes.`,W=`${e.name} board preview`,Y=e.owner_id||e.user_id||null,q=e=>String(e||"").trim().replace(/^@+/,"").toLowerCase(),G=q(e.owner_username),J=q((null==D?void 0:D.username)||(null==(U=null==P?void 0:P.user_metadata)?void 0:U.username)),K=Boolean(P&&(Y&&Y===P.id||G&&J&&G===J)),Q=Boolean(P&&p&&y&&!K),X=l.useMemo(()=>(e.preview_media||[]).flatMap(e=>{const l="string"==typeof(null==e?void 0:e.url)?e.url.trim():"";if(!l)return[];const a="video"===e.type?"video":"image",r="video"===a?c(l):m(l,"thumbnail")||l;return r?[{url:r,fallbackSrc:"video"===a?l:void 0,posterSrc:"video"===a&&("string"==typeof(null==e?void 0:e.poster_url)&&e.poster_url?u({thumbnailUrl:e.poster_url,videoUrl:l,size:"thumbnail"}):u({videoUrl:l,size:"thumbnail"}))||void 0,posterFallbackSrc:"video"===a&&"string"==typeof(null==e?void 0:e.poster_url)?e.poster_url:void 0,type:a}]:[]}),[e.preview_media]),Z=(e,l)=>a.jsx(N,{src:e.url,fallbackSrc:e.fallbackSrc,posterSrc:e.posterSrc,posterFallbackSrc:e.posterFallbackSrc,type:e.type,alt:W,className:l,lowEnd:B});return a.jsxs(w,{to:H,"aria-label":`${e.name}. ${O}`,className:i("group block",!B&&"animate-in fade-in slide-in-from-bottom-2"),style:B?void 0:{animationDelay:`${E}ms`},children:[a.jsxs("div",{className:"sr-only",children:[a.jsx("h3",{children:e.name}),a.jsx("p",{children:O}),a.jsxs("p",{children:[e.memory_count," echoes."]}),e.owner_username?a.jsxs("p",{children:["Curated by @",n(e.owner_username),"."]}):null]}),a.jsxs("div",{className:"relative",children:[a.jsxs("div",{className:"h-44 rounded-[1.5rem] overflow-hidden relative bg-muted transition-all duration-300 group-hover:shadow-float",style:B?void 0:{WebkitMaskImage:"-webkit-radial-gradient(white, black)",isolation:"isolate"},children:[a.jsx("div",{className:i("w-full h-full transition-all duration-300",e.is_mature&&"blur-xl scale-110 saturate-50"),children:(()=>{const l=X.filter(e=>e.url&&""!==e.url.trim());return 0===l.length?a.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center bg-gradient-to-br from-primary/10 via-background to-primary/5 p-4 text-center",children:[a.jsx("div",{className:"text-4xl opacity-50 mb-2",children:e.icon||"ð¦"}),e.memory_count>0&&a.jsxs("span",{className:"text-[10px] text-muted-foreground uppercase opacity-70 font-semibold tracking-wider",children:["View ",e.memory_count," Echoes"]})]}):1===l.length?Z(l[0],i("w-full h-full object-cover",!B&&"animate-in fade-in duration-500")):2===l.length?a.jsx("div",{className:"grid grid-cols-2 h-full gap-[2px]",children:l.map((e,l)=>a.jsx("div",{className:"w-full h-full relative overflow-hidden",children:Z(e,i("w-full h-full object-cover",!B&&"animate-in fade-in duration-500"))},l))}):3===l.length?a.jsxs("div",{className:"grid grid-cols-2 grid-rows-2 h-full gap-[2px]",children:[a.jsx("div",{className:"col-span-1 row-span-2 w-full h-full relative overflow-hidden",children:Z(l[0],i("w-full h-full object-cover",!B&&"animate-in fade-in duration-500"))}),a.jsx("div",{className:"w-full h-full relative overflow-hidden",children:Z(l[1],i("w-full h-full object-cover",!B&&"animate-in fade-in duration-500"))}),a.jsx("div",{className:"w-full h-full relative overflow-hidden",children:Z(l[2],i("w-full h-full object-cover",!B&&"animate-in fade-in duration-500"))})]}):a.jsx("div",{className:"grid grid-cols-2 grid-rows-2 h-full gap-[2px]",children:l.slice(0,4).map((e,l)=>a.jsx("div",{className:"w-full h-full relative overflow-hidden",children:Z(e,i("w-full h-full object-cover",!B&&"animate-in fade-in duration-500"))},l))})})()}),e.is_mature&&a.jsx("div",{className:"absolute inset-0 bg-black/20","aria-hidden":"true"}),k&&e.new_followers_week&&e.new_followers_week>0&&a.jsxs("div",{className:"absolute top-3 left-3 flex items-center gap-1 px-2 py-1 rounded-full bg-gradient-to-r from-orange-500 to-rose-500 text-white text-[10px] font-bold uppercase tracking-wider shadow-lg",children:[a.jsx(x,{className:"w-3 h-3"}),"+",e.new_followers_week]}),e.is_mature&&a.jsx("div",{className:"absolute bottom-3 left-3 rounded-full bg-background/90 px-3 py-1.5 text-[10px] font-bold uppercase tracking-[0.18em] text-foreground shadow-sm backdrop-blur-sm",children:"Sensitive"}),Q&&a.jsxs("div",{className:"absolute top-3 right-3 flex items-center gap-2 transition-opacity duration-300 opacity-100",children:[_?a.jsx(r,{type:"button",size:"icon",variant:"secondary",onClick:l=>{l.preventDefault(),l.stopPropagation(),_(e.id)},className:"h-8 w-8 rounded-full bg-white/90 text-gray-900 shadow-float backdrop-blur-sm hover:bg-white",title:`Show less from ${e.name}`,children:a.jsx(v,{className:"h-3.5 w-3.5"})}):null,a.jsx(r,{size:"sm",onClick:async l=>{if(l.preventDefault(),l.stopPropagation(),T)return;const a=A,r=I;L(!a),R(e=>a?e-1:e+1),V(!0);try{a?await(null==y?void 0:y(e.id)):await(null==p?void 0:p(e.id))}catch(s){L(a),R(r)}finally{V(!1)}},disabled:T,className:i("h-8 rounded-full px-3 gap-1.5 shadow-float backdrop-blur-sm transition-all active:scale-95",A?"bg-white/90 hover:bg-white text-gray-900":"bg-primary text-primary-foreground"),children:A?a.jsxs(a.Fragment,{children:[a.jsx(g,{className:"w-3.5 h-3.5"}),a.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider",children:"Following"})]}):a.jsxs(a.Fragment,{children:[a.jsx(b,{className:"w-3.5 h-3.5"}),a.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider",children:"Follow"})]})})]})]}),a.jsxs("div",{className:"mt-3 px-1",children:[!S&&a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsxs(s,{className:"w-5 h-5",children:[a.jsx(o,{src:e.owner_avatar||void 0}),a.jsx(t,{className:"text-[10px]",children:(null==(C=null==(z=e.owner_username)?void 0:z[0])?void 0:C.toUpperCase())||"?"})]}),a.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:["@",n(e.owner_username)]})]}),a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx("h3",{className:"min-w-0 truncate text-base font-bold text-foreground transition-colors group-hover:text-primary",children:e.name}),(e.is_hidden||e.hidden_from_feed)&&a.jsx(j,{className:"h-3 w-3 shrink-0 text-purple-500"})]}),a.jsxs("p",{className:"text-[10px] font-bold text-muted-foreground uppercase tracking-widest mt-0.5",children:[Math.max(e.memory_count,(null==(M=e.preview_media)?void 0:M.length)||0)," ",1===Math.max(e.memory_count,(null==($=e.preview_media)?void 0:$.length)||0)?"Echo":"Echoes"]})]})]})]})});export{_ as ExploreBoardCard};
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.