1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[42602],{42602:(e,l,t)=>{t.r(l),t.d(l,{DiscoverCommunitiesModal:()=>j});var i=t(20187),s=t(33548),n=t(19086),r=t(23087),o=t(86309),a=t(70725),d=t(59322),c=t(48478);let m=(0,t(57163).A)("lock-open",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]]);var x=t(78919),u=t(95851),h=t(39068),p=t(68648),b=t(78054),f=t(95617);let g=[{id:"bsc",name:"BNB",icon:"\uD83D\uDFE1"},{id:"robinhood",name:"Robinhood",icon:"\uD83D\uDFE2"},{id:"avalanche",name:"AVAX",icon:"\uD83D\uDD3A"},{id:"base",name:"Base",icon:"\uD83D\uDD35"},{id:"arbitrum",name:"Arbitrum",icon:"\uD83D\uDD37"},{id:"arc",name:"Arc",icon:"âª"}],j=e=>{let{isOpen:l,onClose:t,userId:j}=e,[v,y]=(0,u.useState)([]),[w,N]=(0,u.useState)(!1),[_,k]=(0,u.useState)(""),[z,A]=(0,u.useState)(null),[C,S]=(0,u.useState)(null),[E,q]=(0,u.useState)(!1),[T,M]=(0,u.useState)(new Set),F=(0,p.O)({open:l,onClose:t});(0,u.useEffect)(()=>{l&&J()},[l]);let J=async()=>{N(!0);try{let{data:e}=await n.N.from("community_memberships").select("community_id").eq("user_id",j),l=(null==e?void 0:e.map(e=>e.community_id))||[],t=n.N.from("communities").select("\n *,\n creator:boi_socialfi_users!communities_creator_id_fkey (\n username,\n avatar_url,\n wallet_address,\n selected_chain\n )\n ").eq("is_public",!0).order("member_count",{ascending:!1});_&&(t=t.ilike("name","%".concat(_,"%")));let{data:i,error:s}=await t;if(s)throw s;let r=(i||[]).filter(e=>!(0,b.wz)(e)&&!(0,b.xm)(e)).filter(e=>!l.includes(e.id)).map(e=>({...e,icon:(0,b.Db)(e)||e.icon}));y(r)}catch(e){console.error("Error fetching communities:",e)}finally{N(!1)}};(0,u.useEffect)(()=>{let e=setTimeout(()=>{l&&J()},500);return()=>clearTimeout(e)},[_]);let R=async e=>{A(e.id);try{let l=await (0,s.nr)("/api/hub/membership/join",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({communityId:e.id})}),t=await l.json().catch(()=>({}));if(!l.ok){if((null==t?void 0:t.code)==="already_pending")return void M(l=>new Set([...l,e.id]));throw Error((null==t?void 0:t.error)||"Failed to join community")}if(t.pending)return void M(l=>new Set([...l,e.id]));y(l=>l.filter(l=>l.id!==e.id)),setTimeout(()=>{window.location.reload()},1e3)}catch(e){console.error("Error joining community:",e),h.Ay.error(e instanceof Error?e.message:"Failed to join community")}finally{A(null)}};return l?(0,i.jsx)("div",{ref:F,role:"dialog","aria-modal":"true",className:"fixed inset-0 z-modal flex items-end sm:items-center justify-center bg-black/80 backdrop-blur-sm p-3 sm:p-4",style:{...f.H},onClick:t,children:(0,i.jsxs)("div",{className:"w-full max-w-4xl bg-[#111113] border border-line rounded-t-2xl sm:rounded-2xl shadow-2xl overflow-hidden h-[85vh] sm:h-[80vh] flex flex-col",style:{...f.Y},onClick:e=>e.stopPropagation(),children:[(0,i.jsxs)("div",{className:"p-6 border-b border-line flex items-center justify-between bg-[#111113]",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("h2",{className:"text-2xl font-bold text-white mb-1",children:"Discover Communities"}),(0,i.jsx)("p",{className:"text-zinc-400 text-sm",children:"Find and join amazing communities"})]}),(0,i.jsx)("button",{onClick:t,className:"w-11 h-11 flex items-center justify-center hover:bg-white/10 rounded-full transition-colors touch-manipulation","aria-label":"Close discover communities",children:(0,i.jsx)(r.A,{size:22,className:"text-zinc-400"})})]}),(0,i.jsxs)("div",{className:"px-6 py-3 space-y-3",children:[(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsxs)("div",{className:"relative flex-1",children:[(0,i.jsx)(o.A,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-zinc-500",size:18}),(0,i.jsx)("input",{type:"text",placeholder:"Search communities...",value:_,onChange:e=>k(e.target.value),className:"w-full pl-10 pr-4 py-2.5 bg-[#18181b] border border-line rounded-xl text-white placeholder-zinc-500 outline-none focus:border-gold transition-colors text-sm"})]}),(0,i.jsxs)("button",{onClick:()=>q(!E),className:"px-3 py-2.5 rounded-xl border transition-colors flex items-center gap-1.5 text-sm ".concat(E?"bg-gold/10 border-gold/50 text-gold-hover":"border-line text-zinc-400 hover:bg-white/5"),children:[(0,i.jsx)(a.A,{size:16}),"Filter"]})]}),E&&(0,i.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,i.jsxs)("button",{onClick:()=>S(null),className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg border text-xs font-medium transition-colors ".concat(C?"border-line text-zinc-500 hover:bg-white/5":"bg-gold/10 border-gold/50 text-gold-hover"),children:[(0,i.jsx)(d.A,{size:12}),"All"]}),g.map(e=>(0,i.jsxs)("button",{onClick:()=>S(C===e.id?null:e.id),className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg border text-xs font-medium transition-colors ".concat(C===e.id?"bg-gold/10 border-gold/50 text-gold-hover":"border-line text-zinc-500 hover:bg-white/5"),children:[(0,i.jsx)("span",{children:e.icon}),e.name]},e.id))]})]}),(0,i.jsx)("div",{className:"flex-1 overflow-y-auto px-6 pb-6 grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3",children:w?Array.from({length:8}).map((e,l)=>(0,i.jsx)("div",{className:"bg-[#18181b] rounded-xl aspect-square animate-pulse"},l)):(()=>{let e=C?v.filter(e=>!e.allowed_chains||0===e.allowed_chains.length||e.allowed_chains.includes(C)):v;return 0===e.length?(0,i.jsxs)("div",{className:"col-span-full text-center py-20 text-zinc-500",children:[(0,i.jsx)("p",{className:"text-lg",children:"No communities found"}),(0,i.jsx)("p",{className:"text-sm mt-2",children:"Try a different search or filter"})]}):e.map(e=>{let l=T.has(e.id);return(0,i.jsxs)("div",{className:"bg-[#18181b] border border-line rounded-xl overflow-hidden hover:border-zinc-600 transition-all group flex flex-col",children:[(0,i.jsxs)("div",{className:"h-16 bg-zinc-800 relative",children:[e.banner_url?(0,i.jsx)("img",{src:e.banner_url,alt:"",className:"w-full h-full object-cover"}):(0,i.jsx)("div",{className:"w-full h-full bg-gradient-to-br from-indigo-500/20 to-purple-500/20"}),(0,i.jsx)("div",{className:"absolute -bottom-4 left-3 p-0.5 bg-[#18181b] rounded-lg",children:(0,i.jsx)("div",{className:"w-8 h-8 bg-zinc-800 rounded-md overflow-hidden flex items-center justify-center border border-line text-sm",children:e.icon&&e.icon.startsWith("http")?(0,i.jsx)("img",{src:e.icon,alt:"",className:"w-full h-full object-cover"}):(0,i.jsx)("span",{className:"font-bold text-zinc-400",children:e.icon||e.name.charAt(0)})})}),e.allowed_chains&&e.allowed_chains.length>0&&(0,i.jsx)("div",{className:"absolute top-1 right-1 flex gap-0.5",children:e.allowed_chains.map(e=>{let l=g.find(l=>l.id===e);return l?(0,i.jsx)("span",{className:"text-[10px] bg-black/60 rounded px-1",title:l.name,children:l.icon},e):null})})]}),(0,i.jsxs)("div",{className:"pt-5 px-3 pb-3 flex flex-col flex-1",children:[(0,i.jsx)("h3",{className:"font-bold text-white text-sm truncate mb-1",children:e.name}),"approval"===e.join_mode?(0,i.jsxs)("span",{className:"self-start inl
1ine-flex items-center gap-1 text-[9px] font-bold uppercase tracking-wider px-1.5 py-0.5 rounded border bg-gold/10 text-gold-tint border-gold/25 mb-2",children:[(0,i.jsx)(c.A,{size:9}),"Request to Join"]}):(0,i.jsxs)("span",{className:"self-start inline-flex items-center gap-1 text-[9px] font-bold uppercase tracking-wider px-1.5 py-0.5 rounded border bg-emerald-500/10 text-emerald-300 border-emerald-500/25 mb-2",children:[(0,i.jsx)(m,{size:9}),"Join Instantly"]}),(0,i.jsx)("p",{className:"text-zinc-500 text-xs line-clamp-2 mb-3 flex-1",children:e.description||"No description"}),(0,i.jsxs)("div",{className:"flex items-center justify-between",children:[(0,i.jsxs)("div",{className:"flex items-center gap-1 text-[10px] text-zinc-500",children:[(0,i.jsx)(x.A,{size:10}),(0,i.jsx)("span",{children:e.member_count})]}),l?(0,i.jsx)("span",{className:"px-2.5 py-1 text-[10px] font-medium text-gold-hover bg-gold/10 rounded-lg border border-gold/20",children:"Requested"}):(0,i.jsx)("button",{onClick:()=>R(e),disabled:z===e.id,className:"px-3 py-1 bg-gold hover:bg-gold-deep text-black text-xs font-bold rounded-lg transition-colors disabled:opacity-50",children:z===e.id?"...":"approval"===e.join_mode?"Request":"Join"})]})]})]},e.id)})})()})]})}):null}},59322:(e,l,t)=>{t.d(l,{A:()=>i});let i=(0,t(57163).A)("globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]])},70725:(e,l,t)=>{t.d(l,{A:()=>i});let i=(0,t(57163).A)("funnel",[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]])}}]);
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.