1import{E as je,b7 as St,u as Rt,G as st,t as c,ah as Pt,c as r,J as n,j as e,h as Re,B as f,aj as qe,aC as Ut,b6 as Pe,ak as Ae,al as Te,Z as Et,am as $e,be as At,an as $,ad as Ye,bF as Je,M as Tt,S as We,I as $t,ae as re,q as Xe,aD as be,b5 as Lt,aX as Ke,$ as at,a1 as zt,a8 as Gt,a9 as Bt,aa as Vt,ab as Ot,F as Qt,ay as Ht,f as qt,af as Ze}from"./index-JdcCQ3sc.js";import{A as it,a as lt,b as nt}from"./avatar-UXYy-wdi.js";import{G as ct,M as Yt}from"./MentionAutocomplete-BEC3rwFd.js";import{M as Jt}from"./MessageActions-D-Bs2_nu.js";import{M as Wt}from"./MessageText-DVaWCnZK.js";import{i as ot,V as rt}from"./VerifiedBadge-8P1NOngl.js";import{u as Xt}from"./useViewTracker-CCF70u6c.js";import{A as Ue}from"./arrow-left-BGv2wG4i.js";import{F as Ee}from"./flame-Di45EZih.js";import{S as Kt}from"./share-2-fT25-UNo.js";import{H as _e}from"./hash-CTCuXxeO.js";import{L as et}from"./layout-grid-DqBag45C.js";import{C as Zt}from"./crown-DNjfB18-.js";import{F as mt}from"./flag-DIh_BFRv.js";import{G as _t}from"./grip-vertical-CWnyDXD1.js";import{C as es}from"./copy-zR6WVXky.js";import{I as ts}from"./info-B9wI5ymR.js";import{I as dt}from"./image-RFBHahEY.js";import{S as ut}from"./send-OLgQw5Ds.js";import{P as ss}from"./pencil-CICo-TxQ.js";import{F as as}from"./film-DysMgd-e.js";/** 2 * @license lucide-react v0.453.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const is=je("BellOff",[["path",{d:"M8.7 3A6 6 0 0 1 18 8a21.3 21.3 0 0 0 .6 5",key:"o7mx20"}],["path",{d:"M17 17H3s3-2 3-9a4.67 4.67 0 0 1 .3-1.7",key:"16f1lm"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** 7 * @license lucide-react v0.453.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */const xt=je("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/** 12 * @license lucide-react v0.453.0 - ISC 13 * 14 * This source code is licensed under the ISC license. 15 * See the LICENSE file in the root directory of this source tree. 16 */const ls=je("PinOff",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]]);/** 17 * @license lucide-react v0.453.0 - ISC 18 * 19 * This source code is licensed under the ISC license. 20 * See the LICENSE file in the root directory of this source tree. 21 */const pt=je("Pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);function ns(a){const v=new Date(a),x=(Date.now()-v.getTime())/1e3;return x<60?"just now":x<3600?`${Math.floor(x/60)}m ago`:x<86400?`${Math.floor(x/3600)}h ago`:`${Math.floor(x/86400)}d ago`}function oe({msg:a,myRole:v,onDelete:x,onReport:w,onPin:i,onUnpin:E,isPinned:L,communityId:p,reactions:F,onReact:S,onQuoteRepost:j,onHashtagClick:A,depth:B=0}){const{user:k}=st(),{isEUR:R,formatPrice:J,exchangeRate:V}=qt(),y=k?.id===a.userId,se=y||v==="owner"||v==="mod"||k?.role==="admin",d=v==="owner"||v==="mod"||k?.role==="admin",O=F?.[a.id]??{},[T,u]=r.useState(!1),[g,D]=r.useState(a.message),Z=Date.now()-new Date(a.createdAt).getTime(),me=y&&Z<3600*1e3,I=c.useUtils(),_=c.communities.editMessage.useMutation({onMutate:({messageId:o,message:C})=>{const h=P=>P&&{...P,items:P.items.map(te=>te.id===o?{...te,message:C,isEdited:1}:te)};I.communities.getFeed.setData({communityId:p},h),I.communities.getTopFeed.setData({communityId:p},h),I.communities.getMediaFeed.setData({communityId:p},h)},onSuccess:()=>{u(!1),n.success("Post updated")},onError:o=>{n.error(o.message),I.communities.getFeed.invalidate(),I.communities.getTopFeed.invalidate(),I.communities.getMediaFeed.invalidate()}}),[ee,ae]=r.useState(!1),[z,Q]=r.useState(""),[ie,W]=r.useState(!1),[M,H]=r.useState(null),[b,s]=r.useState(null),[De,q]=r.useState(!1),de=r.useRef(null),{data:N,refetch:ve}=c.communities.getReplies.useQuery({parentId:a.id,communityId:p},{enabled:ee}),X=c.communities.postReply.useMutation({onSuccess:()=>{Q(""),ve()},onError:o=>n.error(o.message)}),we=Xt(a.id);return e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:110",ref:we,className:"flex gap-3 group",children:[e.jsxs(it,{"data-loc":"client/src/pages/CommunityDetail.tsx:111",className:"w-8 h-8 flex-shrink-0 mt-0.5",children:[e.jsx(lt,{"data-loc":"client/src/pages/CommunityDetail.tsx:112",src:a.userAvatarUrl}),e.jsx(nt,{"data-loc":"client/src/pages/CommunityDetail.tsx:113",className:"text-xs bg-gray-700 text-white",children:(a.userUsername||a.userName||"?").charAt(0).toUpperCase()})]}),e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:117",className:"flex-1 min-w-0",children:[e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:118",className:"flex items-center gap-2 mb-0.5",children:[e.jsx("span",{"data-loc":"client/src/pages/CommunityDetail.tsx:119",className:"text-sm font-medium text-white",children:a.userUsername||a.userName}),ot({role:a.userRole,isVerified:a.userIsVerified})&&e.jsx(rt,{"data-loc":"client/src/pages/CommunityDetail.tsx:120",className:"mt-0.5"}),e.jsx("span",{"data-loc":"client/src/pages/CommunityDetail.tsx:121",className:"text-xs text-muted-foreground",children:ns(a.createdAt)}),a.isEdited===1&&e.jsx("span",{"data-loc":"client/src/pages/CommunityDetail.tsx:122",className:"text-xs text-muted-foreground italic",children:"(edited)"})]}),T?e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:127",className:"space-y-2",children:[e.jsx(Ze,{"data-loc":"client/src/pages/CommunityDetail.tsx:128",value:g,onChange:o=>D(o.target.value),rows:3,className:"bg-gray-800 border-white/10 text-white text-sm resize-none"}),e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:134",className:"flex gap-2",children:[e.jsx(f,{"data-loc":"client/src/pages/CommunityDetail.tsx:135",size:"sm",onClick:()=>_.mutate({messageId:a.id,communityId:p,message:g}),disabled:_.isPending,children:_.isPending?"Saving...":"Save"}),e.jsx(f,{"data-loc":"client/src/pages/CommunityDetail.tsx:138",size:"sm",variant:"ghost",onClick:()=>{u(!1),D(a.message)},children:e.jsx(re,{"data-loc":"client/src/pages/CommunityDetail.tsx:139",className:"w-3.5 h-3.5"})})]})]}):e.jsx(Wt,{"data-loc":"client/src/pages/CommunityDetail.tsx:144",text:a.message||"",suppressPreview:!!a.sourceCardId,onHashtagClick:A}),a.imageUrl&&!T&&e.jsx("img",{"data-loc":"client/src/pages/CommunityDetail.tsx:148",src:a.imageUrl,alt:"attachment",className:"mt-2 rounded-lg max-h-64 object-cover"}),a.gifUrl&&!T&&e.jsx("img",{"data-loc":"client/src/pages/CommunityDetail.tsx:151",src:a.gifUrl,alt:"GIF",className:"mt-2 rounded-lg max-h-64"}),a.videoUrl&&!T&&e.jsx("video",{"data-loc":"client/src/pages/CommunityDetail.tsx:154",src:a.videoUrl,controls:!0,muted:!0,playsInl
21ine:!0,className:"mt-2 rounded-lg max-h-64 bg-black w-full max-w-[480px]",preload:"metadata"}),a.sourceCardId&&!T&&e.jsxs("a",{"data-loc":"client/src/pages/CommunityDetail.tsx:158",href:`/card/${a.sourceCardId}`,className:"mt-2 flex items-center gap-3 bg-gray-800/60 border border-white/10 rounded-xl p-3 hover:border-primary/40 hover:bg-gray-800 transition-colors w-full max-w-sm",children:[a.sourceCardImageUrl?e.jsx("img",{"data-loc":"client/src/pages/CommunityDetail.tsx:163",src:a.sourceCardImageUrl,alt:a.sourceCardName||a.sourceCardId,className:"w-16 h-22 object-cover rounded-lg flex-shrink-0 shadow-lg"}):e.jsx("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:169",className:"w-16 h-22 bg-gray-700 rounded-lg flex-shrink-0 flex items-center justify-center text-2xl",children:"ð"}),e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:171",className:"flex flex-col min-w-0 gap-0.5",children:[e.jsx("span",{"data-loc":"client/src/pages/CommunityDetail.tsx:172",className:"text-[10px] text-muted-foreground uppercase tracking-widest font-medium",children:"Shared Card"}),e.jsx("span",{"data-loc":"client/src/pages/CommunityDetail.tsx:173",className:"text-base font-bold text-white truncate leading-tight",children:a.sourceCardName||a.sourceCardId}),a.sourceCardSetName&&e.jsx("span",{"data-loc":"client/src/pages/CommunityDetail.tsx:175",className:"text-[11px] text-muted-foreground truncate",children:a.sourceCardSetName}),(()=>{const o=a.sourceCardPriceEurCents,C=a.sourceCardPriceUsdCents;let h=null;return R&&o!=null?h=o/100:R&&C!=null?h=C/100*V:!R&&C!=null&&(h=C/100),h!=null?e.jsx("span",{"data-loc":"client/src/pages/CommunityDetail.tsx:185",className:"text-sm font-bold text-yellow-400 mt-0.5",children:J(h)}):null})(),e.jsx("span",{"data-loc":"client/src/pages/CommunityDetail.tsx:188",className:"text-xs text-primary mt-1 font-medium",children:"View card â"})]})]}),e.jsx("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:197",className:"mt-1.5",children:e.jsx(Jt,{"data-loc":"client/src/pages/CommunityDetail.tsx:198",messageId:a.id,replyCount:N?.length??a.replyCount??0,likeCount:Object.values(O).reduce((o,C)=>o+(C.count||0),0),repostCount:a.repostCount||0,viewCount:a.viewCount||0,bookmarkCount:a.bookmarkCount||0,isBolted:Object.values(O).some(o=>o.reacted===!0),onBolt:k?()=>S(a.id,"â¡"):void 0,onReply:k?()=>{W(o=>!o),ae(!0)}:void 0,onQuoteRepost:j?async o=>{const C=a.message?.slice(0,180)||"",h=a.userUsername||a.userName||"User",P=C?`${o} 22 23> @${h}: ${C}`:o;await j(P)}:void 0,quotePreview:{authorName:a.userUsername||a.userName||"User",text:a.message||"",imageUrl:a.imageUrl,gifUrl:a.gifUrl,videoUrl:a.videoUrl},shareUrl:`${window.location.origin}/communities/${a.communitySlug||p}/post/${a.id}`,compact:!0})}),((N?.length??0)>0||(a.replyCount??0)>0)&&e.jsx("button",{"data-loc":"client/src/pages/CommunityDetail.tsx:229",onClick:()=>ae(o=>!o),className:"text-xs text-muted-foreground hover:text-white transition-colors mt-0.5",children:ee?"Hide replies":`${N?.length??a.replyCount??"..."} repl${(N?.length??a.replyCount??0)===1?"y":"ies"}`}),ie&&k&&e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:239",className:"mt-2 space-y-1.5",children:[(M||b)&&e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:242",className:"flex gap-2 flex-wrap",children:[M&&e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:244",className:"relative",children:[e.jsx("img",{"data-loc":"client/src/pages/CommunityDetail.tsx:245",src:M,alt:"preview",className:"h-20 rounded-lg object-cover"}),e.jsx("button",{"data-loc":"client/src/pages/CommunityDetail.tsx:246",onClick:()=>H(null),className:"absolute -top-1 -right-1 bg-black/70 rounded-full p-0.5",children:e.jsx(re,{"data-loc":"client/src/pages/CommunityDetail.tsx:246",className:"w-3 h-3"})})]}),b&&e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:250",className:"relative",children:[e.jsx("img",{"data-loc":"client/src/pages/CommunityDetail.tsx:251",src:b.previewUrl,alt:"GIF",className:"h-20 rounded-lg"}),e.jsx("button",{"data-loc":"client/src/pages/CommunityDetail.tsx:252",onClick:()=>s(null),className:"absolute -top-1 -right-1 bg-black/70 rounded-full p-0.5",children:e.jsx(re,{"data-loc":"client/src/pages/CommunityDetail.tsx:252",className:"w-3 h-3"})})]})]}),e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:257",className:"flex gap-2",children:[e.jsx(Ze,{"data-loc":"client/src/pages/CommunityDetail.tsx:258",value:z,onChange:o=>Q(o.target.value),placeholder:"Write a reply...",rows:2,className:"bg-gray-800 border-white/10 text-white text-sm resize-none flex-1"}),e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:265",className:"flex flex-col gap-1 self-end",children:[e.jsx("button",{"data-loc":"client/src/pages/CommunityDetail.tsx:266",onClick:()=>de.current?.click(),className:"text-muted-foreground hover:text-white transition-colors p-1",title:"Attach image",children:e.jsx(dt,{"data-loc":"client/src/pages/CommunityDetail.tsx:270",className:"w-4 h-4"})}),e.jsx("input",{"data-loc":"client/src/pages/CommunityDetail.tsx:272",ref:de,type:"file",accept:"image/*",className:"hidden",onChange:o=>{const C=o.target.files?.[0];if(!C)return;const h=new FileReader;h.onload=P=>H(P.target?.result),h.readAsDataURL(C),o.target.value=""}}),e.jsx("button",{"data-loc":"client/src/pages/CommunityDetail.tsx:286",onClick:()=>q(!0),className:"text-muted-foreground hover:text-white transition-colors p-1",title:"Add GIF",children:e.jsx("span",{"data-loc":"client/src/pages/CommunityDetail.tsx:290",className:"text-[10px] font-bold border border-current roun
23ded px-0.5 leading-tight",children:"GIF"})}),e.jsx(f,{"data-loc":"client/src/pages/CommunityDetail.tsx:292",size:"sm",onClick:()=>{!z.trim()&&!M&&!b||X.mutate({communityId:p,parentId:a.id,message:z.trim()||".",imageUrl:M??void 0,gifUrl:b?.url})},disabled:X.isPending||!z.trim()&&!M&&!b,className:"self-end",children:e.jsx(ut,{"data-loc":"client/src/pages/CommunityDetail.tsx:307",className:"w-3.5 h-3.5"})})]})]}),e.jsx(ct,{"data-loc":"client/src/pages/CommunityDetail.tsx:311",open:De,onSelect:o=>{s(o),q(!1)},onClose:()=>q(!1)})]}),ee&&N&&N.length>0&&e.jsx("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:321",className:`mt-3 space-y-3 ${B<3?"pl-3 border-l border-white/10":""}`,children:N.map(o=>e.jsx(oe,{"data-loc":"client/src/pages/CommunityDetail.tsx:323",msg:o,myRole:v,onDelete:x,onReport:w,communityId:p,reactions:F,onReact:S,onQuoteRepost:j,depth:B+1},o.id))})]}),e.jsx("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:341",className:"opacity-0 group-hover:opacity-100 transition-opacity flex items-start gap-1 flex-shrink-0",children:k&&e.jsxs(Ae,{"data-loc":"client/src/pages/CommunityDetail.tsx:343",children:[e.jsx(Te,{"data-loc":"client/src/pages/CommunityDetail.tsx:344",asChild:!0,children:e.jsx("button",{"data-loc":"client/src/pages/CommunityDetail.tsx:345",className:"p-1 rounded hover:bg-white/10 text-muted-foreground hover:text-white transition-colors",children:e.jsx(xt,{"data-loc":"client/src/pages/CommunityDetail.tsx:346",className:"w-3.5 h-3.5"})})}),e.jsxs($e,{"data-loc":"client/src/pages/CommunityDetail.tsx:349",align:"end",className:"bg-gray-900 border-white/10 text-white",children:[me&&e.jsxs($,{"data-loc":"client/src/pages/CommunityDetail.tsx:351",onClick:()=>u(!0),className:"focus:bg-white/5",children:[e.jsx(ss,{"data-loc":"client/src/pages/CommunityDetail.tsx:352",className:"w-3.5 h-3.5 mr-2"})," Edit Post"]}),d&&L&&e.jsxs($,{"data-loc":"client/src/pages/CommunityDetail.tsx:356",onClick:()=>E?.(p),className:"focus:bg-white/5",children:[e.jsx(ls,{"data-loc":"client/src/pages/CommunityDetail.tsx:357",className:"w-3.5 h-3.5 mr-2"})," Unpin Post"]}),d&&!L&&e.jsxs($,{"data-loc":"client/src/pages/CommunityDetail.tsx:361",onClick:()=>i?.(a.id,p),className:"focus:bg-white/5",children:[e.jsx(pt,{"data-loc":"client/src/pages/CommunityDetail.tsx:362",className:"w-3.5 h-3.5 mr-2"})," Pin Post"]}),se&&e.jsxs($,{"data-loc":"client/src/pages/CommunityDetail.tsx:366",onClick:()=>x(a.id),className:"text-destructive focus:text-destructive focus:bg-destructive/10",children:[e.jsx(at,{"data-loc":"client/src/pages/CommunityDetail.tsx:367",className:"w-3.5 h-3.5 mr-2"})," Delete"]}),!y&&e.jsxs($,{"data-loc":"client/src/pages/CommunityDetail.tsx:371",onClick:()=>w(a.id),className:"focus:bg-white/5",children:[e.jsx(mt,{"data-loc":"client/src/pages/CommunityDetail.tsx:372",className:"w-3.5 h-3.5 mr-2"})," Report"]})]})]})})]})}function tt({communityId:a,onPosted:v}){const[x,w]=r.useState(""),[i,E]=r.useState(null),[L,p]=r.useState(null),[F,S]=r.useState(null),[j,A]=r.useState(null),[B,k]=r.useState(!1),[R,J]=r.useState(!1),V=r.useRef(null),y=r.useRef(null),se=c.communities.postMessage.useMutation({onSuccess:()=>{w(""),E(null),p(null),S(null),A(null),v()},onError:u=>n.error(u.message)}),d=u=>{const g=u.target.files?.[0];if(!g)return;if(g.size>5*1024*1024){n.error("Image must be under 5MB");return}E(g);const D=new FileReader;D.onload=Z=>p(Z.target?.result),D.readAsDataURL(g),S(null),A(null)},O=u=>{const g=u.target.files?.[0];if(g){if(g.size>50*1024*1024){n.error("Video must be under 50 MB");return}A({file:g,previewUrl:URL.createObjectURL(g)}),E(null),p(null),S(null),u.target.value=""}},T=async()=>{if(!(!x.trim()&&!i&&!F&&!j)){k(!0);try{let u;if(j){const g=new FormData;g.append("file",j.file);const D=await fetch("/api/upload/video",{method:"POST",body:g});if(!D.ok)throw new Error("Video upload failed");u=(await D.json()).url}await se.mutateAsync({communityId:a,message:x.trim(),imageUrl:L??void 0,gifUrl:F?.url,videoUrl:u})}catch(u){n.error(u.message)}finally{k(!1)}}};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:451",className:"bg-gray-900/60 border border-white/5 rounded-2xl p-4",children:[e.jsx(Yt,{"data-loc":"client/src/pages/CommunityDetail.tsx:452",value:x,onChange:w,placeholder:"Share something with the community...",rows:3,className:"bg-gray-800/60 border-white/10 text-white placeholder:text-muted-foreground resize-none mb-3 w-full rounded-md border px-3 py-2 text-sm"}),L&&e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:460",className:"relative inline-block mb-3",children:[e.jsx("img",{"data-loc":"client/src/pages/CommunityDetail.tsx:461",src:L,alt:"preview",className:"h-24 rounded-lg object-cover"}),e.jsx("button",{"data-loc":"client/src/pages/CommunityDetail.tsx:462",onClick:()=>{E(null),p(null)},className:"absolute -top-1 -right-1 w-5 h-5 bg-black/80 rounded-full flex items-center justify-center text-white text-xs",children:"Ã"})]}),F&&e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:467",className:"relative inline-block mb-3",children:[e.jsx("img",{"data-loc":"client/src/pages/CommunityDetail.tsx:468",src:F.previewUrl,alt:"GIF",className:"h-24 rounded-lg"}),e.jsx("button",{"data-loc":"client/src/pages/CommunityDetail.tsx:469",onClick:()=>S(null),className:"absolute -top-1 -right-1 w-5 h-5 bg-black/80 rounded-full flex items-center justify-center text-white text-xs",children:"Ã"})]}),j&&e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:474",className:"relative inline-block mb-3 max-w-[240px]",children:[e.jsx("video",{"data-loc":"client/src/pages/CommunityDetail.tsx:475",src:j.previewUrl,className:"h-24 rounded-lg bg-black",controls:!0,muted:!0,playsInl
23ine:!0}),e.jsx("button",{"data-loc":"client/src/pages/CommunityDetail.tsx:476",onClick:()=>{A(null),URL.revokeObjectURL(j.previewUrl)},className:"absolute -top-1 -right-1 w-5 h-5 bg-black/80 rounded-full flex items-center justify-center text-white text-xs",children:"Ã"})]}),e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:480",className:"flex items-center justify-between",children:[e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:481",className:"flex items-center gap-2",children:[e.jsx("button",{"data-loc":"client/src/pages/CommunityDetail.tsx:482",onClick:()=>V.current?.click(),className:"text-muted-foreground hover:text-white transition-colors p-1",title:"Attach image",children:e.jsx(dt,{"data-loc":"client/src/pages/CommunityDetail.tsx:483",className:"w-4 h-4"})}),e.jsx("input",{"data-loc":"client/src/pages/CommunityDetail.tsx:485",ref:V,type:"file",accept:"image/*",className:"hidden",onChange:d}),e.jsx("button",{"data-loc":"client/src/pages/CommunityDetail.tsx:486",onClick:()=>J(!0),className:"text-muted-foreground hover:text-white transition-colors p-1",title:"Add GIF",children:e.jsx("span",{"data-loc":"client/src/pages/CommunityDetail.tsx:487",className:"text-[10px] font-bold border border-current rounded px-0.5 leading-tight",children:"GIF"})}),e.jsx("button",{"data-loc":"client/src/pages/CommunityDetail.tsx:489",onClick:()=>y.current?.click(),className:"text-muted-foreground hover:text-white transition-colors p-1",title:"Attach video",children:e.jsx(as,{"data-loc":"client/src/pages/CommunityDetail.tsx:490",className:"w-4 h-4"})}),e.jsx("input",{"data-loc":"client/src/pages/CommunityDetail.tsx:492",ref:y,type:"file",accept:"video/mp4,video/webm,video/quicktime",className:"hidden",onChange:O})]}),e.jsxs(f,{"data-loc":"client/src/pages/CommunityDetail.tsx:494",size:"sm",onClick:T,disabled:B||!x.trim()&&!i&&!F&&!j,className:"gap-2",children:[e.jsx(ut,{"data-loc":"client/src/pages/CommunityDetail.tsx:495",className:"w-3.5 h-3.5"}),B?"Posting...":"Post"]})]})]}),e.jsx(ct,{"data-loc":"client/src/pages/CommunityDetail.tsx:500",open:R,onClose:()=>J(!1),onSelect:u=>{S({url:u.url,previewUrl:u.previewUrl}),E(null),p(null),A(null),J(!1)}})]})}function Fs(){const v=St().slug,[,x]=Rt(),{user:w}=st(),i=c.useUtils(),{onChatRepost:E,onChatBookmark:L,onCommunityReaction:p,onChatReactionUpdate:F,onChatNewMessage:S,onChatMessageDeleted:j,onChatMessageEdited:A,onCommunityNewPost:B}=Pt();r.useEffect(()=>{const t=S(()=>{i.communities.getFeed.invalidate(),i.communities.getForYouFeed.invalidate(),i.communities.getTopFeed.invalidate(),i.communities.getMediaFeed.invalidate()}),l=E(()=>{i.communities.getFeed.invalidate(),i.communities.getForYouFeed.invalidate(),i.communities.getTopFeed.invalidate(),i.communities.getMediaFeed.invalidate()}),m=L(()=>{i.chat.getBookmarkIds.invalidate(),i.chat.getBookmarkedMessages.invalidate(),i.communities.getFeed.invalidate()}),U=p(()=>{i.communities.getReactions.invalidate(),i.communities.getFeed.invalidate(),i.communities.getForYouFeed.invalidate(),i.communities.getTopFeed.invalidate(),i.communities.getMediaFeed.invalidate()}),G=F(()=>{i.communities.getFeed.invalidate(),i.communities.getForYouFeed.invalidate(),i.communities.getTopFeed.invalidate(),i.communities.getMediaFeed.invalidate()}),ce=j(()=>{i.communities.getFeed.invalidate(),i.communities.getForYouFeed.invalidate(),i.communities.getTopFeed.invalidate(),i.communities.getMediaFeed.invalidate(),i.chat.getBookmarkedMessages.invalidate()}),Mt=A(()=>{i.communities.getFeed.invalidate(),i.communities.getForYouFeed.invalidate(),i.communities.getTopFeed.invalidate(),i.communities.getMediaFeed.invalidate()}),Ft=B(()=>{i.communities.getFeed.invalidate(),i.communities.getForYouFeed.invalidate(),i.communities.getTopFeed.invalidate(),i.communities.getMediaFeed.invalidate()});return()=>{t(),l(),m(),U(),G(),ce(),Mt(),Ft()}},[S,E,L,p,F,j,A,B]);const k=(()=>{const t=typeof window<"u"?window.location.search:"",m=new URLSearchParams(t).get("message");return m?Number(m):null})(),[R,J]=r.useState(k),V=r.useRef({}),[y,se]=r.useState("latest"),[d,O]=r.useState(null),[T,u]=r.useState(!1),[g,D]=r.useState([]),[Z,me]=r.useState(!1),[I,_]=r.useState(null),[ee,ae]=r.useState(!1),[z,Q]=r.useState(""),[ie,W]=r.useState(""),[M,H]=r.useState(null),b=!!(ie||M),{data:s,isLoading:De}=c.communities.get.useQuery({slug:v},{enabled:!!v}),{data:q,isLoading:de}=c.communities.getFeed.useQuery({communityId:s?.id??0},{enabled:!!s?.id&&y==="latest"&&!d}),{data:N,isLoading:ve}=c.communities.getTopFeed.useQuery({communityId:s?.id??0},{enabled:!!s?.id&&y==="top"&&!d}),{data:X,isLoading:we}=c.communities.getMediaFeed.useQuery({communityId:s?.id??0},{enabled:!!s?.id&&y==="media"&&!d}),{data:o,isLoading:C}=c.communities.searchPosts.useQuery(M?{query:M,type:"hashtag",communityId:s?.id,limit:30}:{query:ie,type:"text",communityId:s?.id,limit:30},{enabled:b&&!!s?.id}),{data:h}=c.communities.getTrendingHashtags.useQuery({communityId:s?.id},{enabled:!!s?.id}),{data:P}=c.communities.getMembers.useQuery({communityId:s?.id??0},{enabled:!!s?.id&&d==="members"}),te=P?.members??P,{data:Le}=c.communities.getReports.useQuery({communityId:s?.id??0},{enabled:!!s?.id&&d==="reports"}),{data:K,refetch:gt}=c.communities.getRules.useQuery({communityId:s?.id??0},{enabled:!!s?.id&&(y==="about"||d==="rules")}),{data:ht}=c.communities.getNotificationLevel.useQuery({communityId:s?.id??0},{enabled:!!s?.id&&!!w}),yt=c.communities.join.useMutation({onSuccess:()=>{i.communities.get.invalidate(),n.success("Joined!")},onError:t=>n.error(t.message)}
23),Ct=c.communities.leave.useMutation({onSuccess:()=>{i.communities.get.invalidate(),n.success("Left community.")},onError:t=>n.error(t.message)}),Ne=c.communities.postMessage.useMutation({onSuccess:()=>{i.communities.getFeed.invalidate(),i.communities.getTopFeed.invalidate()},onError:t=>n.error(t.message)}),ze=c.communities.postMessage.useMutation({onSuccess:()=>{i.communities.getFeed.invalidate(),i.communities.getTopFeed.invalidate(),n.success("Shared to community!")},onError:t=>n.error(t.message)}),{data:cs=[]}=c.communities.myCommunities.useQuery(void 0,{enabled:!!w}),ue=c.communities.deleteMessage.useMutation({onSuccess:()=>{i.communities.getFeed.invalidate(),i.communities.getTopFeed.invalidate(),i.communities.getMediaFeed.invalidate()},onError:t=>n.error(t.message)}),xe=c.communities.reportMessage.useMutation({onSuccess:()=>n.success("Message reported."),onError:t=>n.error(t.message)}),ft=c.communities.kickMember.useMutation({onSuccess:()=>{i.communities.getMembers.invalidate(),n.success("Member kicked.")},onError:t=>n.error(t.message)}),bt=c.communities.banMember.useMutation({onSuccess:()=>{i.communities.getMembers.invalidate(),n.success("Member banned.")},onError:t=>n.error(t.message)}),Ge=c.communities.setModRole.useMutation({onSuccess:()=>{i.communities.getMembers.invalidate(),n.success("Role updated.")},onError:t=>n.error(t.message)}),Be=c.chat.follow.useMutation({onSuccess:()=>{i.communities.getMembers.invalidate()},onError:t=>n.error(t.message)}),Ve=c.chat.unfollow.useMutation({onSuccess:()=>{i.communities.getMembers.invalidate()},onError:t=>n.error(t.message)}),Oe=c.communities.resolveReport.useMutation({onSuccess:()=>i.communities.getReports.invalidate(),onError:t=>n.error(t.message)}),pe=c.communities.pinPost.useMutation({onSuccess:()=>{i.communities.get.invalidate(),n.success("Post pinned!")},onError:t=>n.error(t.message)}),ge=c.communities.unpinPost.useMutation({onSuccess:()=>{i.communities.get.invalidate(),n.success("Post unpinned.")},onError:t=>n.error(t.message)}),ke=c.communities.setRules.useMutation({onSuccess:()=>{gt(),u(!1),n.success("Rules saved!")},onError:t=>n.error(t.message)}),jt=c.communities.setNotificationLevel.useMutation({onSuccess:t=>{i.communities.getNotificationLevel.invalidate(),n.success(`Notifications set to ${t.level}`)},onError:t=>n.error(t.message)}),Ie=c.communities.createInvite.useMutation({onSuccess:t=>{_(t.token)},onError:t=>n.error(t.message)}),Qe=r.useMemo(()=>{const t=[...q?.items??[],...N?.items??[],...X?.items??[]].map(l=>l.id);return Array.from(new Set(t))},[q,N,X]),{data:Dt,refetch:vt}=c.communities.getReactions.useQuery({messageIds:Qe},{enabled:Qe.length>0}),he=Dt??{},wt=c.communities.toggleReaction.useMutation({onSuccess:()=>vt(),onError:t=>n.error(t.message)}),ye=(t,l)=>{w&&wt.mutate({messageId:t,emoji:l})};r.useEffect(()=>{if(!R)return;const t=V.current[R];if(t){t.scrollIntoView({behavior:"smooth",block:"center"});const l=setTimeout(()=>J(null),3e3);return()=>clearTimeout(l)}},[R,q,N]);const Nt=()=>{if(!I)return;const t=`${window.location.origin}/invite/${I}`;navigator.clipboard.writeText(t).then(()=>{ae(!0),setTimeout(()=>ae(!1),2e3)})},kt=()=>{navigator.clipboard.writeText(window.location.href).then(()=>{n.success("Link copied!")})};if(De)return e.jsxs(e.Fragment,{children:[e.jsx(Re,{"data-loc":"client/src/pages/CommunityDetail.tsx:783"}),e.jsx("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:784",className:"min-h-screen bg-gray-950 flex items-center justify-center",children:e.jsx("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:785",className:"w-8 h-8 border-2 border-primary border-t-transparent rounded-full animate-spin"})})]});if(!s)return e.jsxs(e.Fragment,{children:[e.jsx(Re,{"data-loc":"client/src/pages/CommunityDetail.tsx:794"}),e.jsx("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:795",className:"min-h-screen bg-gray-950 text-white flex items-center justify-center",children:e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:796",className:"text-center",children:[e.jsx("p",{"data-loc":"client/src/pages/CommunityDetail.tsx:797",className:"text-muted-foreground mb-4",children:"Community not found."}),e.jsx(f,{"data-loc":"client/src/pages/CommunityDetail.tsx:798",onClick:()=>x("/communities"),children:"Back to Communities"})]})})]});const Y=s.myRole,Ce=!!Y,fe=Y==="owner",Me=Y==="owner"||Y==="mod",Fe=w?.role==="admin",le=ht?.level??"all",ne=s.pinnedPostId,Se=q?.items??[],He=Se.find(t=>
23t.id===ne),It=[{id:"top",label:"Top",icon:e.jsx(Xe,{"data-loc":"client/src/pages/CommunityDetail.tsx:817",className:"w-3.5 h-3.5"})},{id:"latest",label:"Latest",icon:e.jsx(Ht,{"data-loc":"client/src/pages/CommunityDetail.tsx:818",className:"w-3.5 h-3.5"})},{id:"media",label:"Media",icon:e.jsx(et,{"data-loc":"client/src/pages/CommunityDetail.tsx:819",className:"w-3.5 h-3.5"})},{id:"about",label:"About",icon:e.jsx(ts,{"data-loc":"client/src/pages/CommunityDetail.tsx:820",className:"w-3.5 h-3.5"})}];return e.jsxs(e.Fragment,{children:[e.jsx(Re,{"data-loc":"client/src/pages/CommunityDetail.tsx:825"}),e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:826",className:"min-h-screen bg-gradient-to-b from-gray-950 via-gray-900 to-black text-white",children:[e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:828",className:"relative h-40 sm:h-52 bg-gradient-to-br from-primary/20 to-blue-900/40 overflow-hidden",children:[s.bannerImageUrl?e.jsx("img",{"data-loc":"client/src/pages/CommunityDetail.tsx:830",src:s.bannerImageUrl,alt:s.name,className:"w-full h-full object-cover"}):e.jsx("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:832",className:"w-full h-full flex items-center justify-center",children:e.jsx(qe,{"data-loc":"client/src/pages/CommunityDetail.tsx:833",className:"w-16 h-16 text-primary/20"})}),e.jsx("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:836",className:"absolute inset-0 bg-gradient-to-t from-gray-950/90 to-transparent"}),e.jsxs("button",{"data-loc":"client/src/pages/CommunityDetail.tsx:837",onClick:()=>x("/communities"),className:"absolute top-4 left-4 flex items-center gap-2 text-white/80 hover:text-white bg-black/40 hover:bg-black/60 px-3 py-1.5 rounded-full text-sm transition-all",children:[e.jsx(Ue,{"data-loc":"client/src/pages/CommunityDetail.tsx:841",className:"w-4 h-4"})," Communities"]})]}),e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:845",className:"max-w-4xl mx-auto px-4 -mt-6 relative z-10",children:[e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:847",className:"bg-gray-900/80 backdrop-blur border border-white/5 rounded-2xl p-5 mb-1",children:[e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:848",className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:849",className:"flex-1 min-w-0",children:[e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:850",className:"flex items-center gap-2 mb-1",children:[e.jsx("h1",{"data-loc":"client/src/pages/CommunityDetail.tsx:851",className:"text-xl sm:text-2xl font-bold text-white truncate",children:s.name}),!!s.isPrivate&&e.jsx(Ut,{"data-loc":"client/src/pages/CommunityDetail.tsx:852",className:"w-4 h-4 text-muted-foreground flex-shrink-0"})]}),s.summary&&e.jsx("p",{"data-loc":"client/src/pages/CommunityDetail.tsx:854",className:"text-sm text-muted-foreground mb-2 line-clamp-2",children:s.summary}),e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:855",className:"flex items-center gap-4",children:[e.jsxs("span",{"data-loc":"client/src/pages/CommunityDetail.tsx:856",className:"flex items-center gap-1 text-sm text-muted-foreground",children:[e.jsx(qe,{"data-loc":"client/src/pages/CommunityDetail.tsx:857",className:"w-3.5 h-3.5"}),e.jsx("strong",{"data-loc":"client/src/pages/CommunityDetail.tsx:858",className:"text-white",children:s.memberCount})," Members"]}),e.jsxs("span",{"data-loc":"client/src/pages/CommunityDetail.tsx:860",className:"flex items-center gap-1 text-sm text-muted-foreground",children:[e.jsx(Ee,{"data-loc":"client/src/pages/CommunityDetail.tsx:861",className:"w-3.5 h-3.5 text-orange-400"}),e.jsx("strong",{"data-loc":"client/src/pages/CommunityDetail.tsx:862",className:"text-white",children:s.postCount??0})," Posts"]})]})]}),e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:868",className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx("button",{"data-loc":"client/src/pages/CommunityDetail.tsx:870",onClick:kt,title:"Share community",className:"w-9 h-9 flex items-center justify-center rounded-full border border-white/10 text-muted-foreground hover:text-white hover:border-white/30 transition-all",children:e.jsx(Kt,{"data-loc":"client/src/pages/CommunityDetail.tsx:875",className:"w-4 h-4"})}),(Me||Fe)&&e.jsx("button",{"data-loc":"client/src/pages/CommunityDetail.tsx:880",onClick:()=>{me(!0),I||Ie.mutate({communityId:s.id})},title:"Invite people",className:"w-9 h-9 flex items-center justify-center rounded-full border border-white/10 text-muted-foreground hover:text-white hover:border-white/30 transition-all",children:e.jsx(Pe,{"data-loc":"client/src/pages/CommunityDetail.tsx:888",className:"w-4 h-4"})}),Ce&&e.jsxs(Ae,{"data-loc":"client/src/pages/CommunityDetail.tsx:894",children:[e.jsx(Te,{"data-loc":"client/src/pages/CommunityDetail.tsx:895",asChild:!0,children:e.jsx("button",{"data-loc":"client/src/pages/CommunityDetail.tsx:896",title:"Set notifications",className:`w-9 h-9 flex items-center justify-center rounded-full border transition-all ${le==="off"?"border-white/10 text-muted-foreground":"border-primary/40 text-primary"} hover:border-white/30 hover:text-white`,children:le==="off"?e.jsx(is,{"data-loc":"client/src/pages/CommunityDetail.tsx:904",className:"w-4 h-4"}):e.jsx(Et,{"data-loc":"client/src/pages/CommunityDetail.tsx:904",className:"w-4 h-4"})})}),e.jsxs($e,{"data-loc":"client/src/pages/CommunityDetail.tsx:907",align:"end",className:"bg-gray-900 border-white/10 text-white w-44",children:[e.jsx("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:908",className:"px-2 py-1.5 text-xs text-muted-foreground font-medium",children:"Notifications"}),e.jsx(At,{"data-loc":"client/src/pages/CommunityDetail.tsx:909",className:"bg-white/5"}),["all","highlights","off"].map(t=>e.jsxs($,{"data-loc":"client/src/pages/CommunityDetail.tsx:911",onClick:()=>jt.mutate({communityId:s.id,level:t}),className:`focus:bg-white/5 capitalize ${le===t?"text-primary":""}`,children:[le===t&&e.jsx(Ye,{"data-loc":"client/src/pages/CommunityDetail.tsx:916",className:"w-3.5 h-3.5 mr-2"}),le!==t&&e.jsx("span",{"data-loc":"client/src/pages/CommunityDetail.tsx:917",className:"w-3.5 mr-2"}),t==="all"?"All posts":t==="highlights"?"Highlights only":"Off"]},t))]})]}),(fe||Fe)&&e.jsx("button",{"data-loc":"client/src/pages/CommunityDetail.tsx:927",onClick:()=>x(`/communities/${v}/settings`),title:"Community settings",className:"w-9 h-9 flex items-center justify-center rounded-full border border-white/10 text-muted-foreground hover:text-white hover:border-white/30 transition-all",children:e.jsx(Je,{"data-loc":"client/src/pages/CommunityDetail.tsx:932",className:"w-4 h-4"})}),w?Ce?fe?e.jsx(f,{"data-loc":"client/src/pages/CommunityDetail.tsx:940",size:"sm",variant:"outline",className:"border-white/10 text-white font-semibold px-4",disabled:!0,children:"Owner"}):e.jsx(f,{"data-loc":"client/src/pages/CommunityDetail.tsx:944",size:"sm",variant:"outline",className:"border-white/10 text-muted-foreground px-4",onClick:()=>Ct.mutate({communityId:s.id}),children:"Joined"}):e.jsx(f,{"data-loc":"client/src/pages/CommunityDetail.tsx:950",size:"sm",className:"px-5 font-semibold",onClick:()=>yt.mutate({communityId:s.id}),children:"Join"}):e.jsx(f,{"data-loc":"client/src/pages/CommunityDetail.tsx:956",
23size:"sm",className:"px-5 font-semibold",onClick:()=>window.location.href=Tt(),children:"Join"})]})]}),e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:965",className:"flex gap-2 mt-3 pt-3 border-t border-white/5",children:[["members","rules"].map(t=>e.jsx("button",{"data-loc":"client/src/pages/CommunityDetail.tsx:967",onClick:()=>O(d===t?null:t),className:`px-3 py-1 rounded-full text-xs font-medium transition-all ${d===t?"bg-primary text-primary-foreground":"bg-white/5 text-muted-foreground hover:text-white hover:bg-white/10"}`,children:t.charAt(0).toUpperCase()+t.slice(1)},t)),(Me||Fe)&&e.jsx("button",{"data-loc":"client/src/pages/CommunityDetail.tsx:978",onClick:()=>O(d==="reports"?null:"reports"),className:`px-3 py-1 rounded-full text-xs font-medium transition-all ${d==="reports"?"bg-primary text-primary-foreground":"bg-white/5 text-muted-foreground hover:text-white hover:bg-white/10"}`,children:"Reports"})]})]}),!d&&e.jsxs("form",{"data-loc":"client/src/pages/CommunityDetail.tsx:992",onSubmit:t=>{t.preventDefault(),z.trim()&&(W(z.trim()),H(null))},className:"relative mb-4",children:[e.jsx(We,{"data-loc":"client/src/pages/CommunityDetail.tsx:1002",className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx($t,{"data-loc":"client/src/pages/CommunityDetail.tsx:1003",value:z,onChange:t=>Q(t.target.value),placeholder:"Search posts or #hashtags in this communityâ¦",className:"pl-9 pr-10 bg-gray-900 border-white/10 text-white placeholder:text-muted-foreground"}),z&&e.jsx("button",{"data-loc":"client/src/pages/CommunityDetail.tsx:1010",type:"button",onClick:()=>{Q(""),W(""),H(null)},className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-white",children:e.jsx(re,{"data-loc":"client/src/pages/CommunityDetail.tsx:1015",className:"w-4 h-4"})})]}),!d&&b&&e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1023",className:"flex items-center gap-2 mb-4 px-3 py-2 bg-primary/10 border border-primary/20 rounded-xl text-sm",children:[e.jsx(_e,{"data-loc":"client/src/pages/CommunityDetail.tsx:1024",className:"w-4 h-4 text-primary flex-shrink-0"}),e.jsx("span",{"data-loc":"client/src/pages/CommunityDetail.tsx:1025",className:"text-white flex-1",children:M?e.jsxs(e.Fragment,{children:["Results for ",e.jsxs("span",{"data-loc":"client/src/pages/CommunityDetail.tsx:1027",className:"text-primary font-semibold",children:["#",M]})]}):e.jsxs(e.Fragment,{children:["Results for ",e.jsxs("span",{"data-loc":"client/src/pages/CommunityDetail.tsx:1029",className:"text-primary font-semibold",children:["â",ie,"â"]})]})}),e.jsx("button",{"data-loc":"client/src/pages/CommunityDetail.tsx:1032",onClick:()=>{W(""),Q(""),H(null)},className:"text-muted-foreground hover:text-white transition-colors",children:e.jsx(re,{"data-loc":"client/src/pages/CommunityDetail.tsx:1036",className:"w-4 h-4"})})]}),!d&&!b&&h&&h.length>0&&e.jsx("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1043",className:"flex flex-wrap gap-1.5 mb-4",children:h.slice(0,8).map(t=>e.jsxs("button",{"data-loc":"client/src/pages/CommunityDetail.tsx:1045",onClick:()=>{H(t.hashtag),W(""),Q("")},className:"flex items-center gap-1 px-2.5 py-1 rounded-full bg-gray-800 border border-white/10 text-xs text-muted-foreground hover:text-white hover:border-primary/40 hover:bg-primary/10 transition-all",children:[e.jsx(_e,{"data-loc":"client/src/pages/CommunityDetail.tsx:1050",className:"w-3 h-3"}),t.hashtag,e.jsx("span",{"data-loc":"client/src/pages/CommunityDetail.tsx:1051",className:"text-[10px] opacity-60",children:t.count})]},t.hashtag))}),!d&&e.jsx("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1059",className:"flex border-b border-white/5 mb-6",children:It.map(t=>e.jsxs("button",{"data-loc":"client/src/pages/CommunityDetail.tsx:1061",onClick:()=>se(t.id),className:`flex items-center gap-1.5 px-5 py-3 text-sm font-medium transition-all relative ${y===t.id?"text-white":"text-muted-foreground hover:text-white hover:bg-white/5"}`,children:[t.icon,t.label,y===t.id&&e.jsx("span",{"data-loc":"client/src/pages/CommunityDetail.tsx:1073",className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary rounded-full"})]},t.id))}),d&&e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1082",className:"flex items-center gap-3 mb-6",children:[e.jsx("button",{"data-loc":"client/src/pages/CommunityDetail.tsx:1083",onClick:()=>O(null),className:"text-muted-foreground hover:text-white transition-colors",children:e.jsx(Ue,{"data-loc":"client/src/pages/CommunityDetail.tsx:1084",className:"w-4 h-4"})}),e.jsx("h2",{"data-loc":"client/src/pages/CommunityDetail.tsx:1086",className:"text-lg font-semibold capitalize",children:d})]}),!d&&b&&e.jsx("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1092",className:"space-y-4 pb-12",children:C?e.jsx("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1094",className:"space-y-4",children:[1,2,3].map(t=>e.jsx("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1094",className:"h-16 bg-gray-900/60 rounded-xl animate-pulse"},t))}):o?.items?.length?e.jsx("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1101",className:"space-y-4",children:o.items.map(t=>e.jsx("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1103",className:"bg-gray-900/60 border border-white/5 rounded-2xl p-4",children:e.jsx(oe,{"data-loc":"client/src/pages/CommunityDetail.tsx:1104",msg:t,myRole:Y,communityId:s.id,isPinned:!1,onDelete:l=>ue.mutate({messageId:l,communityId:s.id}),onReport:l=>xe.mutate({communityId:s.id,messageId:l}),onPin:(l,m)=>pe.mutate({postId:l,communityId:m}),onUnpin:l=>ge.mutate({communityId:l}),reactions:he,onReact:ye,onHashtagClick:l=>{H(l),W(""),Q("")}})},t.id))}):e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1096",className:"text-center py-16 text-muted-foreground",children:[e.jsx(We,{"data-loc":"client/src/pages/CommunityDetail.tsx:1097",className:"w-12 h-12 mx-auto mb-3 opacity-20"}),e.jsx("p",{"data-loc":"client/src/pages/CommunityDetail.tsx:1098",children:"No posts found."})]})}),!d&&!b&&y==="latest"&&e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1122",className:"space-y-4 pb-12",children:[Ce&&e.jsx(tt,{"data-loc":"client/src/pages/CommunityDetail.tsx:1123",communityId:s.id,onPosted:()=>{i.communities.getFeed.invalidate(),i.communities.getTopFeed.invalidate(),i.communities.getMediaFeed.invalidate()}}),ne&&He&&e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1127",className:"bg-amber-950/30 border border-amber-500/20 rounded-2xl p-4",children:[e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1128",className:"flex items-center gap-2 mb-2",children:[e.jsx(pt,{"data-loc":"client/src/pages/CommunityDetail.tsx:1129",className:"w-3.5 h-3.5 text-amber-400"}),e.jsx("span",{"data-loc":"client/src/pages/CommunityDetail.tsx:1130",className:"text-xs font-medium text-amber-400 uppercase tracking-wide",children:"Pinned Post"})]}),e.jsx(oe,{"data-loc":"client/src/pages/CommunityDetail.tsx:1132",msg:He,myRole:Y,communityId:s.id,isPinned:!0,onDelete:t=>ue.mutate({messageId:t,communityId:s.id}),onReport:t=>xe.mutate({communityId:s.id,messageId:t}),onPin:(t,l)=>pe.mutate({postId:t,communityId:l}),onUnpin:t=>ge.mutate({communityId:t}),reactions:he,onReact:ye,onQuoteRepost:s?.id?async t=>{await Ne.mutateAsync({communityId:s.id,message:t})}:void 0})]}),de?e.jsx("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1147",className:"space-y-4",children:[1,2,3].map(t=>e.jsx("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1147",className:"h-16 bg-gray-900/60 rounded-xl animate-pulse"},t))}):Se.length===0?e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1149",className:"text-center py-16 text-muted-foreground",children:[e.jsx(Ee,{"data-loc":"client/src/pages/CommunityDetail.tsx:1150",className:"w-12 h-12 mx-auto mb-3 opacity-20"}),e.jsx("p",{"data-loc":"client/src/pages/CommunityDetail.tsx:1151",children:"No posts yet. Be the first to share something!"})]}):e.jsx("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1154",className:"space-y-4",children:Se.map(t=>e.jsx("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1156",ref:l=>{V.current[t.id]=l},className:`bg-gray-900/60 border rounded-2xl p-4 transition-all duration-500 ${t.id===ne?"border-amber-500/20":"border-white/5"} ${R===t.id?"ring-2 ring-primary/60 border-primary/40 bg-primary/5":""}`,children:e.jsx(oe,{"data-loc":"client/src/pages/CommunityDetail.tsx:1162",msg:t,myRole:Y,communityId:s.id,isPinned:t.id===ne,onDelete:l=>ue.mutate({messageId:l,communityId:s.id}),onReport:l=>xe.mutate({communityId:s.id,messageId:l}),onPin:(l,m)=>pe.mutate({postId:l,communityId:m}),onUnpin:l=>ge.mutate({communityId:l}),reactions:he,onReact:ye,onQuoteRepost:async(l,m)=>{await Ne.mutateAsync({communityId:s.id,message:l}),m&&ze.mutate({communityId:m,message:l})}})},t.id))})]}),!d&&!b&&y==="top"&&e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1185",className:"space-y-4 pb-12",children:[Ce&&e.jsx(tt,{"data-loc":"client/src/pages/CommunityDetail.tsx:1186",communityId:s.id,onPosted:()=>{i.communities.getTopFeed.invalidate(),i.communities.getFeed.invalidate()}}),ve?e.jsx("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1188",className:"space-y-4",children:[1,2,3].map(t=>e.jsx("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1188",className:"h-16 bg-gray-900/60 rounded-xl animate-pulse"},t))}):N?.items.length?e.jsx("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1195",className:"space-y-4",children:N.items.map((t,l)=>e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1197",ref:m=>{V.current[t.id]=m}
23,className:`bg-gray-900/60 border border-white/5 rounded-2xl p-4 transition-all duration-500 ${R===t.id?"ring-2 ring-primary/60 border-primary/40 bg-primary/5":""}`,children:[e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1203",className:"flex items-center gap-2 mb-2",children:[e.jsxs("span",{"data-loc":"client/src/pages/CommunityDetail.tsx:1204",className:"text-xs font-bold text-muted-foreground w-5",children:["#",l+1]}),t.reactionCount>0&&e.jsxs("span",{"data-loc":"client/src/pages/CommunityDetail.tsx:1206",className:"text-xs text-orange-400 flex items-center gap-0.5",children:[e.jsx(Ee,{"data-loc":"client/src/pages/CommunityDetail.tsx:1207",className:"w-3 h-3"}),t.reactionCount," reactions"]})]}),e.jsx(oe,{"data-loc":"client/src/pages/CommunityDetail.tsx:1211",msg:t,myRole:Y,communityId:s.id,isPinned:t.id===ne,onDelete:m=>ue.mutate({messageId:m,communityId:s.id}),onReport:m=>xe.mutate({communityId:s.id,messageId:m}),onPin:(m,U)=>pe.mutate({postId:m,communityId:U}),onUnpin:m=>ge.mutate({communityId:m}),reactions:he,onReact:ye,onQuoteRepost:async(m,U)=>{await Ne.mutateAsync({communityId:s.id,message:m}),U&&ze.mutate({communityId:U,message:m})}})]},t.id))}):e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1190",className:"text-center py-16 text-muted-foreground",children:[e.jsx(Xe,{"data-loc":"client/src/pages/CommunityDetail.tsx:1191",className:"w-12 h-12 mx-auto mb-3 opacity-20"}),e.jsx("p",{"data-loc":"client/src/pages/CommunityDetail.tsx:1192",children:"No posts yet."})]})]}),!d&&!b&&y==="media"&&e.jsx("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1234",className:"pb-12",children:we?e.jsx("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1236",className:"grid grid-cols-3 gap-2",children:[1,2,3,4,5,6].map(t=>e.jsx("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1236",className:"aspect-square bg-gray-900/60 rounded-xl animate-pulse"},t))}):X?.items.length?e.jsx("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1243",className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:X.items.map(t=>e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1245",className:"group relative aspect-square rounded-xl overflow-hidden bg-gray-900/60 border border-white/5 cursor-pointer",onClick:()=>x(`/communities/${s.slug}/post/${t.id}`),children:[t.videoUrl?e.jsxs(e.Fragment,{children:[e.jsx("video",{"data-loc":"client/src/pages/CommunityDetail.tsx:1250",src:t.videoUrl,className:"w-full h-full object-cover",muted:!0,playsInline:!0}),e.jsx("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1251",className:"absolute top-2 left-2 bg-black/70 rounded px-1.5 py-0.5 text-[10px] text-white font-medium",children:"VIDEO"})]}):t.gifUrl?e.jsxs(e.Fragment,{children:[e.jsx("img",{"data-loc":"client/src/pages/CommunityDetail.tsx:1255",src:t.gifUrl,alt:"GIF",className:"w-full h-full object-cover"}),e.jsx("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1256",className:"absolute top-2 left-2 bg-black/70 rounded px-1.5 py-0.5 text-[10px] text-white font-medium",children:"GIF"})]}):e.jsx("img",{"data-loc":"client/src/pages/CommunityDetail.tsx:1259",src:t.imageUrl,alt:"",className:"w-full h-full object-cover"}),e.jsx("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1261",className:"absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-all flex items-end p-2 opacity-0 group-hover:opacity-100",children:e.jsx("p",{"data-loc":"client/src/pages/CommunityDetail.tsx:1262",className:"text-xs text-white line-clamp-2",children:t.message})})]},t.id))}):e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1238",className:"text-center py-16 text-muted-foreground",children:[e.jsx(et,{"data-loc":"client/src/pages/CommunityDetail.tsx:1239",className:"w-12 h-12 mx-auto mb-3 opacity-20"}),e.jsx("p",{"data-loc":"client/src/pages/CommunityDetail.tsx:1240",children:"No media posts yet."})]})}),!d&&!b&&y==="about"&&e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1273",className:"pb-12 max-w-2xl space-y-6",children:[e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1274",className:"bg-gray-900/60 border border-white/5 rounded-2xl p-5",children:[e.jsx("h3",{"data-loc":"client/src/pages/CommunityDetail.tsx:1275",className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:"About"}),e.jsx("p",{"data-loc":"client/src/pages/CommunityDetail.tsx:1276",className:"text-sm text-gray-200",children:s.description||s.summary||"No description provided."})]}),e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1278",className:"bg-gray-900/60 border border-white/5 rounded-2xl p-5",children:[e.jsx("h3",{"data-loc":"client/src/pages/CommunityDetail.tsx:1279",className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:"Stats"}),e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1280",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1281",children:[e.jsx("p",{"data-loc":"client/src/pages/CommunityDetail.tsx:1282",className:"text-2xl font-bold text-white",children:s.memberCount}),e.jsx("p",{"data-loc":"client/src/pages/CommunityDetail.tsx:1283",className:"text-xs text-muted-foreground",children:"Members"})]}),e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1285",children:[e.jsx("p",{"data-loc":"client/src/pages/CommunityDetail.tsx:1286",className:"text-2xl font-bold text-white",children:s.postCount??0}),e.jsx("p",{"data-loc":"client/src/pages/CommunityDetail.tsx:1287",className:"text-xs text-muted-foreground",children:"Posts"})]}),e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1289",children:[e.jsx("p",{"data-loc":"client/src/pages/CommunityDetail.tsx:1290",className:"text-sm font-medium text-white",children:s.isPrivate?"Private":"Public"}),e.jsx("p",{"data-loc":"client/src/pages/CommunityDetail.tsx:1291",className:"text-xs text-muted-foreground",children:"Visibility"})]}),e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1293",children:[e.jsx("p",{"data-loc":"client/src/pages/CommunityDetail.tsx:1294",className:"text-sm font-medium text-white",children:new Date(s.createdAt).toLocaleDateString("en-US")}),e.jsx("p",{"data-loc":"client/src/pages/CommunityDetail.tsx:1295",className:"text-xs text-muted-foreground",children:"Created"})]})]})]}),K&&K.length>0&&e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1300",className:"bg-gray-900/60 border border-white/5 rounded-2xl p-5",children:[e.jsx("h3",{"data-loc":"client/src/pages/CommunityDetail.tsx:1301",className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:"Rules"}),e.jsx("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1302",className:"space-y-3",children:K.map((t,l)=>e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1304",children:[e.jsxs("p",{"data-loc":"client/src/pages/CommunityDetail.tsx:1305",className:"text-sm font-semibold text-white",children:[l+1,". ",t.title]}),t.description&&e.jsx("p",{"data-loc":"client/src/pages/CommunityDetail.tsx:1306",className:"text-xs text-muted-foreground mt-0.5",children:t.description})]},l))})]})]}),d==="members"&&e.jsx("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1317",className:"space-y-2 pb-12",children:(Array.isArray(te)?te:[])?.map(t=>e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1319",className:"flex items-center justify-between bg-gray-900/60 border border-white/5 rounded-xl px-4 py-3",children:[e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1320",className:"flex items-center gap-3",children:[e.jsx("button",{"data-loc":"client/src/pages/CommunityDetail.tsx:1321",onClick:()=>x(`/profile/${t.username}`),className:"rounded-full ring-0 hover:ring-2 hover:ring-primary/40 transition-all",children:e.jsxs(it,{"data-loc":"client/src/pages/CommunityDetail.tsx:1325",className:"w-8 h-8",children:[e.jsx(lt,{"data-loc":"client/src/pages/CommunityDetail.tsx:1326",src:t.avatarUrl}),e.jsx(nt,{"data-loc":"client/src/pages/CommunityDetail.tsx:1327",className:"text-xs bg-gray-700 text-white",children:(t.username||t.name||"?").charAt(0).toUpperCase()})]})}),e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1332",children:[e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1333",className:"flex items-center gap-1",children:[e.jsx("button",{"data-loc":"client/src/pages/CommunityDetail.tsx:1334",onClick:()=>x(`/profile/${t.username}`),className:"text-sm font-medium text-white hover:text-primary transition-colors",children:t.username||t.name}),ot({role:t.userRole,isVerified:t.userIsVerified})&&e.jsx(rt,{"data-loc":"client/src/pages/CommunityDetail.tsx:1340",className:"mt-0.5"})]}),e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1342",className:"flex items-center gap-1",children:[t.role==="owner"&&e.jsxs("span",{"data-loc":"client/src/pages/CommunityDetail.tsx:1343",className:"flex items-center gap-0.5 text-xs text-yellow-400",children:[e.jsx(Zt,{"data-loc":"client/src/pages/CommunityDetail.tsx:1343",className:"w-2.5 h-2.5"})," Owner"]}),t.role==="mod"&&e.jsxs("span",{"data-loc":"client/src/pages/CommunityDetail.tsx:1344",className:"flex items-center gap-0.5 text-xs text-blue-400",children:[e.jsx(be,{"data-loc":"client/src/pages/CommunityDetail.tsx:1344",className:"w-2.5 h-2.5"})," Mod"]}),t.role==="member"&&e.jsx("span",{"data-loc":"client/src/pages/CommunityDetail.tsx:1345",className:"text-xs text-muted-foreground",children:"Member"})]})]})]}),e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1349",className:"flex items-center gap-2",children:[w&&!t.isSelf&&e.jsx("button",{"data-loc":"client/src/pages/CommunityDetail.tsx:1351",onClick:()=>t.isFollowing?Ve.mutate({userId:t.userId}):Be.mutate({userId:t.userId}),disabled:Be.isPending||Ve.isPending,className:`flex items-center gap-1 px-2.5 py-1 rounded-full text-xs font-medium transition-all border ${t.isFollowing?"border-white/20 text-muted-foreground hover:border-destructive/40 hover:text-destructive":"border-primary/40 text-primary hover:bg-primary/10"}`,children:t.isFollowing?e.jsxs(e.Fragment,{children:[e.jsx(Lt,{"data-loc":"client/src/pages/CommunityDetail.tsx:1364",className:"w-3 h-3"})," Following"]}):e.jsxs(e.Fragment,{children:[e.jsx(Pe,{"data-loc":"client/src/pages/CommunityDetail.tsx:1365",className:"w-3 h-3"})," Follow"]})}),Me&&t.role!=="owner"&&t.userId!==w?.id&&e.jsxs(Ae,{"data-loc":"client/src/pages/CommunityDetail.tsx:1370",children:[e.jsx(Te,{"data-loc":"client/src/pages/CommunityDetail.tsx:1371",asChild:!0,children:e.jsx("button",{"data-loc":"client/src/pages/CommunityDetail.tsx:1372",className:"p-1.5 rounded hover:bg-white/10 text-muted-foreground hover:text-white transition-colors",children:e.jsx(xt,{"data-loc":"client/src/pages/CommunityDetail.tsx:1373",className:"w-4 h-4"})})}),e.jsxs($e,{"data-loc":"client/src/pages/CommunityDetail.tsx:1376",align:"end",className:"bg-gray-900 border-white/10 text-white",children:[fe&&t.role==="member"&&e.jsxs($,{"data-loc":"client/src/pages/CommunityDetail.tsx:1378",onClick:()=>Ge.mutate({communityId:s.id,userId:t.userId,role:"mod"}),className:"focus:bg-white/5",children:[e.jsx(be,{"data-loc":"client/src/pages/CommunityDetail.tsx:1379",className:"w-3.5 h-3.5 mr-2 text-blue-400"})," Make Mod"]}),fe&&t.role==="mod"&&e.jsxs($,{"data-loc":"client/src/pages/CommunityDetail.tsx:1383",onClick:()=>Ge.mutate({communityId:s.id,userId:t.userId,role:"member"}),className:"focus:bg-white/5",children:[e.jsx(be,{"data-loc":"client/src/pages/CommunityDetail.tsx:1384",className:"w-3.5 h-3.5 mr-2"})," Remove Mod"]}),e.jsxs($,{"data-loc":"client/src/pages/CommunityDetail.tsx:1387",onClick:()=>ft.mutate({communityId:s.id,userId:t.userId}),className:"focus:bg-white/5",children:[e.jsx(Ue,{"data-loc":"client/src/pages/CommunityDetail.tsx:1388",className:"w-3.5 h-3.5 mr-2"})," Kick"]}),e.jsxs($,{"data-loc":"client/src/pages/CommunityDetail.tsx:1390",onClick:()=>bt.mutate({communityId:s.id,userId:t.userId}),className:"text-destructive focus:text-destructive focus:bg-destructive/10",children:[e.jsx(mt,{"data-loc":"client/src/pages/CommunityDetail.tsx:1391",className:"w-3.5 h-3.5 mr-2"})," Ban"]})]})]})]})]},t.id))}),d==="rules"&&e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1404",className:"pb-12 max-w-2xl",children:[e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1405",className:"flex items-center justify-between mb-4",children:[e.jsxs("h2",{"data-loc":"client/src/pages/CommunityDetail.tsx:1406",className:"text-lg font-semibold flex items-center gap-2",children:[e.jsx(Ke,{"data-loc":"client/src/pages/CommunityDetail.tsx:1406",className:"w-5 h-5 text-primary"})," Community Rules"]}),!T&&e.jsxs(f,{"data-loc":"client/src/pages/CommunityDetail.tsx:1408",size:"sm",variant:"outline",className:"border-white/10 text-xs gap-1",onClick:()=>{D(K??[]),u(!0)},children:[e.jsx(Je,{"data-loc":"client/src/pages/CommunityDetail.tsx:1410",className:"w-3.5 h-3.5"})," Edit Rules"]})]}),T?e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1415",className:"space-y-3",children:[g.map((t,l)=>e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1417",className:"flex gap-2 items-start bg-gray-800/40 rounded-xl p-3 border border-white/5",children:[e.jsx(_t,{"data-loc":"client/src/pages/CommunityDetail.tsx:1418",className:"w-4 h-4 text-muted-foreground mt-2 flex-shrink-0"}),e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1419",className:"flex-1 space-y-2",children:[e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1420",className:"flex items-center gap-2",children:[e.jsxs("span",{"data-loc":"client/src/pages/CommunityDetail.tsx:1421",className:"text-xs text-muted-foreground w-5 text-right flex-shrink-0",children:[l+1,"."]}),e.jsx("input",{"data-loc":"client/src/pages/CommunityDetail.tsx:1422",value:t.title,onChange:m=>D(U=>U.map((G,ce)=>ce===l?{...G,title:m.target.value}:G)),placeholder:"Rule title",maxLength:80,className:"flex-1 bg-transparent border-b border-white/10 text-sm text-white placeholder:text-muted-foreground focus:outline-none focus:border-primary pb-0.5"})]}),e.jsx("input",{"data-loc":"client/src/pages/CommunityDetail.tsx:1427",value:t.description,onChange:m=>D(U=>U.map((G,ce)=>ce===l?{...G,description:m.target.value}:G)),placeholder:"Optional description...",maxLength:400,className:"w-full bg-transparent text-xs text-muted-foreground placeholder:text-muted-foreground
23/50 focus:outline-none focus:text-white"})]}),e.jsx("button",{"data-loc":"client/src/pages/CommunityDetail.tsx:1432",type:"button",onClick:()=>D(m=>m.filter((U,G)=>G!==l)),className:"p-1 rounded hover:bg-white/10 text-muted-foreground hover:text-destructive transition-colors flex-shrink-0",children:e.jsx(at,{"data-loc":"client/src/pages/CommunityDetail.tsx:1434",className:"w-3.5 h-3.5"})})]},l)),g.length<20&&e.jsxs(f,{"data-loc":"client/src/pages/CommunityDetail.tsx:1439",type:"button",size:"sm",variant:"outline",className:"border-white/10 text-xs gap-1 w-full",onClick:()=>D(t=>[...t,{title:"",description:""}]),children:[e.jsx(zt,{"data-loc":"client/src/pages/CommunityDetail.tsx:1441",className:"w-3 h-3"})," Add Rule"]}),e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1444",className:"flex gap-2 pt-2",children:[e.jsx(f,{"data-loc":"client/src/pages/CommunityDetail.tsx:1445",size:"sm",variant:"outline",className:"border-white/10 text-xs",onClick:()=>u(!1),children:"Cancel"}),e.jsx(f,{"data-loc":"client/src/pages/CommunityDetail.tsx:1446",size:"sm",className:"text-xs",disabled:ke.isPending,onClick:()=>ke.mutate({communityId:s.id,rules:g.filter(t=>t.title.trim())}),children:ke.isPending?"Saving...":"Save Rules"})]})]}):e.jsx("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1453",className:"space-y-3",children:!K||K.length===0?e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1455",className:"text-center py-12 text-muted-foreground",children:[e.jsx(Ke,{"data-loc":"client/src/pages/CommunityDetail.tsx:1456",className:"w-10 h-10 mx-auto mb-3 opacity-20"}),e.jsx("p",{"data-loc":"client/src/pages/CommunityDetail.tsx:1457",children:"No rules set yet."})]}):K.map((t,l)=>e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:14
2360",className:"bg-gray-900/60 border border-white/5 rounded-xl p-4",children:[e.jsxs("p",{"data-loc":"client/src/pages/CommunityDetail.tsx:1461",className:"text-sm font-semibold text-white",children:[l+1,". ",t.title]}),t.description&&e.jsx("p",{"data-loc":"client/src/pages/CommunityDetail.tsx:1462",className:"text-xs text-muted-foreground mt-1",children:t.description})]},l))})]}),d==="reports"&&e.jsx("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1472",className:"space-y-3 pb-12",children:Le?.length===0?e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1474",className:"text-center py-12 text-muted-foreground",children:[e.jsx(be,{"data-loc":"client/src/pages/CommunityDetail.tsx:1475",className:"w-10 h-10 mx-auto mb-3 opacity-20"}),e.jsx("p",{"data-loc":"client/src/pages/CommunityDetail.tsx:1476",children:"No pending reports."})]}):Le?.map(t=>e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1479",className:"bg-gray-900/60 border border-white/5 rounded-xl p-4",children:[e.jsxs("p",{"data-loc":"client/src/pages/CommunityDetail.tsx:1480",className:"text-sm text-muted-foreground mb-1",children:["Message #",t.messageId," reported"]}),t.reason&&e.jsxs("p",{"data-loc":"client/src/pages/CommunityDetail.tsx:1481",className:"text-sm text-white mb-3",children:['"',t.reason,'"']}),e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1482",className:"flex gap-2",children:[e.jsx(f,{"data-loc":"client/src/pages/CommunityDetail.tsx:1483",size:"sm",variant:"outline",className:"border-white/10 text-xs",onClick:()=>Oe.mutate({reportId:t.id,communityId:s.id,action:"dismiss"}),children:"Dismiss"}),e.jsx(f,{"data-loc":"client/src/pages/CommunityDetail.tsx:1487",size:"sm",className:"text-xs",onClick:()=>Oe.mutate({reportId:t.id,communityId:s.id,action:"resolve"}),children:"Resolve"})]})]},t.id))})]})]}),e.jsx(Gt,{"data-loc":"client/src/pages/CommunityDetail.tsx:1500",open:Z,onOpenChange:me,children:e.jsxs(Bt,{"data-loc":"client/src/pages/CommunityDetail.tsx:1501",className:"bg-gray-900 border-white/10 text-white max-w-sm",children:[e.jsx(Vt,{"data-loc":"client/src/pages/CommunityDetail.tsx:1502",children:e.jsxs(Ot,{"data-loc":"client/src/pages/CommunityDetail.tsx:1503",className:"flex items-center gap-2",children:[e.jsx(Pe,{"data-loc":"client/src/pages/CommunityDetail.tsx:1504",className:"w-5 h-5 text-primary"})," Invite to ",s.name]})}),e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1507",className:"space-y-4",children:[e.jsx("p",{"data-loc":"client/src/pages/CommunityDetail.tsx:1508",className:"text-sm text-muted-foreground",children:"Share this link to invite people to join the community."}),Ie.isPending?e.jsx("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1510",className:"h-10 bg-gray-800 rounded-lg animate-pulse"}):I?e.jsxs("div",{"data-loc":"client/src/pages/CommunityDetail.tsx:1512",className:"flex gap-2",children:[e.jsx("input",{"data-loc":"client/src/pages/CommunityDetail.tsx:1513",readOnly:!0,value:`${window.location.origin}/invite/${I}`,className:"flex-1 bg-gray-800 border border-white/10 rounded-lg px-3 py-2 text-sm text-white"}),e.jsxs("button",{"data-loc":"client/src/pages/CommunityDetail.tsx:1518",onClick:Nt,className:"px-3 py-2 bg-primary rounded-lg text-sm font-medium text-white hover:bg-primary/80 transition-colors flex items-center gap-1.5",children:[ee?e.jsx(Ye,{"data-loc":"client/src/pages/CommunityDetail.tsx:1522",className:"w-4 h-4"}):e.jsx(es,{"data-loc":"client/src/pages/CommunityDetail.tsx:1522",className:"w-4 h-4"}),ee?"Copied!":"Copy"]})]}):null,e.jsx(f,{"data-loc":"client/src/pages/CommunityDetail.tsx:1527",size:"sm",variant:"outline",className:"border-white/10 text-xs w-full",onClick:()=>{_(null),Ie.mutate({communityId:s.id})},children:"Generate new link"})]})]})}),e.jsx(Qt,{"data-loc":"client/src/pages/CommunityDetail.tsx:1537",onFeedbackClick:()=>window.location.href="https://help.manus.im"})]})}export{Fs 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.