1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8974],{20510:(e,t,a)=>{"use strict";a.d(t,{A:()=>l});var s=a(41865);let r=function(){for(var e=arguments.length,t=Array(e),a=0;a<e;a++)t[a]=arguments[a];return t.filter((e,t,a)=>!!e&&""!==e.trim()&&a.indexOf(e)===t).join(" ").trim()},n=e=>{let t=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,a)=>a?a.toUpperCase():t.toLowerCase());return t.charAt(0).toUpperCase()+t.slice(1)};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let o=(0,s.forwardRef)((e,t)=>{let{color:a="currentColor",size:n=24,strokeWidth:o=2,absoluteStrokeWidth:l,className:d="",children:c,iconNode:u,...m}=e;return(0,s.createElement)("svg",{ref:t,...i,width:n,height:n,stroke:a,strokeWidth:l?24*Number(o)/Number(n):o,className:r("lucide",d),...!c&&!(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0;return!1})(m)&&{"aria-hidden":"true"},...m},[...u.map(e=>{let[t,a]=e;return(0,s.createElement)(t,a)}),...Array.isArray(c)?c:[c]])}),l=(e,t)=>{let a=(0,s.forwardRef)((a,i)=>{let{className:l,...d}=a;return(0,s.createElement)(o,{ref:i,iconNode:t,className:r("lucide-".concat(n(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()),"lucide-".concat(e),l),...d})});return a.displayName=n(e),a}},24465:(e,t,a)=>{Promise.resolve().then(a.bind(a,67514)),Promise.resolve().then(a.bind(a,78048))},28176:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(20510).A)("shopping-bag",[["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}],["path",{d:"M3.103 6.034h17.794",key:"awc11p"}],["path",{d:"M3.4 5.467a2 2 0 0 0-.4 1.2V20a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6.667a2 2 0 0 0-.4-1.2l-2-2.667A2 2 0 0 0 17 2H7a2 2 0 0 0-1.6.8z",key:"o988cm"}]])},40121:(e,t,a)=>{"use strict";a.d(t,{C:()=>i});var s=a(41865),r=a(74515),n=a(57326),i=e=>{let{present:t,children:a}=e,i=function(e){var t,a;let[r,i]=s.useState(),l=s.useRef(null),d=s.useRef(e),c=s.useRef("none"),[u,m]=(t=e?"mounted":"unmounted",a={mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}},s.useReducer((e,t)=>{let s=a[e][t];return null!=s?s:e},t));return s.useEffect(()=>{let e=o(l.current);c.current="mounted"===u?e:"none"},[u]),(0,n.N)(()=>{let t=l.current,a=d.current;if(a!==e){let s=c.current,r=o(t);e?m("MOUNT"):"none"===r||(null==t?void 0:t.display)==="none"?m("UNMOUNT"):a&&s!==r?m("ANIMATION_OUT"):m("UNMOUNT"),d.current=e}},[e,m]),(0,n.N)(()=>{if(r){var e;let t,a=null!=(e=r.ownerDocument.defaultView)?e:window,s=e=>{let s=o(l.current).includes(CSS.escape(e.animationName));if(e.target===r&&s&&(m("ANIMATION_END"),!d.current)){let e=r.style.animationFillMode;r.style.animationFillMode="forwards",t=a.setTimeout(()=>{"forwards"===r.style.animationFillMode&&(r.style.animationFillMode=e)})}},n=e=>{e.target===r&&(c.current=o(l.current))};return r.addEventListener("animationstart",n),r.addEventListener("animationcancel",s),r.addEventListener("animationend",s),()=>{a.clearTimeout(t),r.removeEventListener("animationstart",n),r.removeEventListener("animationcancel",s),r.removeEventListener("animationend",s)}}m("ANIMATION_END")},[r,m]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:s.useCallback(e=>{l.current=e?getComputedStyle(e):null,i(e)},[])}}(t),l="function"==typeof a?a({present:i.isPresent}):s.Children.only(a),d=(0,r.s)(i.ref,function(e){var t,a;let s=null==(t=Object.getOwnPropertyDescriptor(e.props,"ref"))?void 0:t.get,r=s&&"isReactWarning"in s&&s.isReactWarning;return r?e.ref:(r=(s=null==(a=Object.getOwnPropertyDescriptor(e,"ref"))?void 0:a.get)&&"isReactWarning"in s&&s.isReactWarning)?e.props.ref:e.props.ref||e.ref}(l));return"function"==typeof a||i.isPresent?s.cloneElement(l,{ref:d}):null};function o(e){return(null==e?void 0:e.animationName)||"none"}i.displayName="Presence"},57329:(e,t,a)=>{"use strict";a.d(t,{wD:()=>o});var s=a(84157),r=a(86645),n=a(47104),i=a(56921);function o(e){let{title:t,text:a,url:o,utmSource:l,utmMedium:d,onShare:c,variant:u="default",size:m="md",className:h,"data-testid":p}=e;async function x(){if(!o.startsWith("/")||o.startsWith("//"))return void console.error('ShareButton: url must start with "/" and not be protocol-relative. Got: "'.concat(o,'"'));let e=function(e,t,a){if(!e.startsWith("/")||e.startsWith("//"))throw Error('ShareButton: url must start with "/" and not be protocol-relative. Got: "'.concat(e,'"'));let s=new URL(e,window.location.origin);return s.searchParams.set("utm_source",t),s.searchParams.set("utm_medium",a),s.toString()}(o,l,d),s=a.trim()||t.trim();if("function"==typeof navigator.share)try{await navigator.share({title:t,text:a,url:e}),null==c||c("native_share");return}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)return}let r=function(e,t){let a=e.trim(),s=a?"".concat(a," ").concat(t):t;return"https://wa.me/?text=".concat(encodeURIComponent(s))}(s,e);if(null!==window.open(r,"_blank")){null==c||c("whatsapp_deeplink");return}let n=s?"".concat(s," ").concat(e):e;try{await navigator.clipboard.writeText(n),(0,i.Te)("Link copied!"),null==c||c("clipboard")}catch(e){(0,i.Qg)("Could not copy link")}}return(0,s.jsxs)("button",{onClick:x,className:(0,n.cn)("inline-flex items-center justify-center gap-2 rounded-md font-medium transition-colors","md"===m?"h-12":"h-11","icon-only"===u?"px-2.5":"px-4","text-muted-foreground hover:text-foreground hover:bg-accent",h),type:"button","aria-label":"icon-only"===u?"Share":void 0,"data-testid":p,children:[(0,s.jsx)(r.A,{className:"md"===m?"size-6":"size-5"}),"default"===u&&(0,s.jsx)("span",{children:"Share"})]})}},59993:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(20510).A)("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]])},62259:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(20510).A)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]])},66975:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(20510).A)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},67514:(e,t,a)=>{"use strict";a.d(t,{FeedList:()=>z});var s=a(84157),r=a(41865),n=a(74062),i=a(72331),o=a(78079),l=a(35114),d=a(15557),c=a(85374),u=a(56591),m=a(34729),h=a(80665),p=a(34531),x=a(24857),g=a(87948),f=a(68737),v=a(82142),j=a(80149),y=a(70813),N=a(88817),w=a(13144),b=a(57329),k=a(11877),C=a(24412),D=a(31158),E=a(97670),M=a(15127),S=a(95175),R=a(86558),A=a(15958);let P=new Set;var _=a(44059),L=a(88150),T=a(6884),F=a(94385),I=a(78048);function O(e){let{onLoadMore:t,hasMore:a,isLoading:s,rootMargin:n="0px 0px 400px 0px"}=e,i=(0,r.useRef)(null);return(0,r.useEffect)(()=>{let e=i.current;if(!e||!a)return;let r=new IntersectionObserver(e=>{let r=e[0];(null==r?void 0:r.isIntersecting)&&!s&&a&&t()},{rootMargin:n});return r.observe(e),()=>{r.disconnect()}},[t,a,s,n]),{sentinelRef:i}}let U="em_pin_seed";function K(){let e=(0,c.zn)(U);if(e)return e;let t="".concat(Date.now().toString(36),"-").concat(Math.random().toString(36).slice(2,10));return(0,c.bl)(U,t)?t:"guest"}function W(e){var t,a,o,l,d,c,A,L,I,O,U,K,W,z,H,V,B,q;let{post:Z,isExpanded:G,onToggleExpand:Q,onLike:X,onRsvp:Y,currentUid:$,authLoading:J,isAdmin:ee,onPin:et,priority:ea=!1}
1=e,es=function(e){let t=(0,n.useRouter)(),a=(0,r.useRef)(null),s=(0,r.useRef)(null),i=(0,r.useRef)(!1),o=(0,r.useCallback)(e=>{a.current=e},[]),l=(0,r.useCallback)(()=>{if(!P.has(e)){P.add(e);try{t.prefetch(e)}catch(e){}}},[e,t]);function d(e){if(!e||!(e instanceof Element))return!1;let t=e.closest('a, button, [role="button"], [role="menu"], [role="menuitem"], [role="dialog"], [data-interactive], input, textarea, select, video, audio');return null!==t&&t!==a.current}let c=(0,r.useCallback)(e=>{let t=e.touches[0];t&&(s.current={x:t.clientX,y:t.clientY,time:Date.now()},l())},[l]),u=(0,r.useCallback)(()=>{l()},[l]),m=(0,r.useCallback)(()=>{l()},[l]),h=(0,r.useCallback)(a=>{let r=s.current;if(s.current=null,!r)return;let n=a.changedTouches[0];if(!n)return;let o=Math.abs(n.clientX-r.x),l=Math.abs(n.clientY-r.y),c=Date.now()-r.time;o+l>=10||c>=300||d(a.target)||(t.push(e),i.current=!0)},[e,t]);return{ref:o,handlers:{onTouchStart:c,onTouchEnd:h,onClick:(0,r.useCallback)(a=>{if(i.current){i.current=!1;return}d(a.target)||t.push(e)},[e,t]),onKeyDown:(0,r.useCallback)(a=>{("Enter"===a.key||" "===a.key)&&(a.preventDefault(),t.push(e))},[e,t]),onMouseEnter:u,onFocus:m},role:"link"}}("/post/".concat(Z._id)),er=null!=(I=Z.hashtags)?I:[],[en,ei]=(0,r.useState)(!1),eo=!J&&!!$&&Z.userId!==$,el=!!ee&&(!!Z.imageKey||!!(null==(t=Z.ogPreview)?void 0:t.imageKey))&&!Z.isPinned&&!!et,ed=Z.author,ec=null!=(O=null==ed?void 0:ed.name)?O:"Anonymous",eu=null!=(U=null==(a=ec[0])?void 0:a.toUpperCase())?U:"?",em="repost"===Z.postMode?Z.originalPost:null,eh=!!em,ep=(0,j.z)(Z),ex=!!ep,eg="event"===Z.postType&&!!Z.eventData,ef=eg?new Date:void 0,ev=!!eg&&!!ef&&(Z.eventData.endDate?new Date(Z.eventData.endDate)<ef:new Date(Z.eventData.startDate)<ef),ej=!!eg&&!!ef&&new Date(Z.eventData.startDate)>ef,ey=null==(o=Z.ogPreview)?void 0:o.mediaType,eN="link"===Z.postMode&&!ex&&("photo"===ey||"text"===ey),ew="link"!==Z.postMode||ex||eN?null:Z.ogPreview,eb=!!ew,ek="link"!==Z.postMode||ex||eN||eb?null:null!=(K=null==(l=Z.linkData)?void 0:l.url)?K:null,eC=null!=(W=Z.text)?W:"",eD=eC.length>250,eE=eD&&!G?eC.slice(0,250):eC;return(0,s.jsxs)(M.Zp,{as:"article",ref:es.ref,...es.handlers,role:es.role,tabIndex:0,className:"cursor-pointer","data-testid":"feed-post","data-post-mode":null!=(z=Z.postMode)?z:"text",children:[eh&&(0,s.jsxs)("div",{className:"flex items-center gap-1.5 px-4 pt-2 text-xs text-muted-foreground","data-testid":"repost-indicator",children:[(0,s.jsx)("span",{children:"\uD83D\uDD04"}),(0,s.jsxs)("span",{children:[ec," reposted"]})]}),(0,s.jsxs)("div",{className:"flex items-start gap-2.5 px-4 pt-3 pb-1",children:[(0,s.jsx)("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary-soft text-sm font-semibold text-primary overflow-hidden mt-0.5","data-testid":"author-avatar",children:(null==ed?void 0:ed.picture)?(0,s.jsx)("img",{src:(0,v.B)(ed.picture,64,64),alt:ec,className:"h-full w-full object-cover"}):eu}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)("span",{className:"text-sm font-medium text-foreground",children:ec}),(0,s.jsx)(N.w,{trustLevel:null==(d=Z.author)?void 0:d.trustLevel,isModerator:null==(c=Z.author)?void 0:c.isModerator})]}),(0,s.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,s.jsx)(T.R,{href:"/post/".concat(Z._id),className:"shrink-0 hover:text-primary hover:underline","data-testid":"post-time",children:(0,u.K)(Z.createdAt)}),Z.location&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{"aria-hidden":!0,className:"text-muted-foreground/50",children:"|"}),(0,s.jsxs)("span",{className:"flex min-w-0 items-center gap-1","data-testid":"post-location",children:[(0,s.jsx)(m.A,{className:"h-3.5 w-3.5 shrink-0"}),(0,s.jsx)("span",{className:"truncate",children:(0,i.formatPostLocation)(Z.location)})]})]})]})]}),(eo||el)&&(0,s.jsxs)(g.rI,{children:[(0,s.jsx)(g.ty,{asChild:!0,children:(0,s.jsx)("button",{className:"min-h-[44px] min-w-[44px] flex items-center justify-center text-muted-foreground hover:text-foreground","aria-label":"Post options","data-testid":"post-options-button",children:(0,s.jsx)(h.A,{size:20})})}),(0,s.jsxs)(g.SQ,{align:"end",children:[eo&&(0,s.jsx)(g._2,{onClick:()=>ei(!0),className:"text-destructive","data-testid":"report-button",children:"Report"}),el&&(0,s.jsx)(g._2,{onClick:()=>et(Z._id),"data-testid":"pin-button",children:"Pin to feed"})]})]})]}),(0,s.jsx)("div",{className:"px-4 py-2",children:eh?(0,s.jsxs)(s.Fragment,{children:[Z.text&&(0,s.jsx)("p",{className:"mb-3 whitespace-pre-wrap text-foreground",children:Z.text}),(0,s.jsxs)("div",{className:"rounded-2xl border border-border-soft bg-muted p-3",children:[(0,s.jsx)("div",{className:"mb-1 text-xs font-medium text-muted-foreground",children:null!=(H=null==(A=em.author)?void 0:A.name)?H:"Anonymous"}),(0,s.jsx)("p",{className:"whitespace-pre-wrap text-foreground",children:em.text})]})]}):ex?(0,s.jsxs)(s.Fragment,{children:[Z.text&&(0,s.jsx)("p",{className:"mb-3 whitespace-pre-wrap text-foreground",children:Z.text}),(0,s.jsx)(k.n,{videoData:ep,posterUrl:(0,f.R)(Z.ogPreview)}),(null==(L=Z.ogPreview)?void 0:L.title)&&(0,s.jsx)("div",{className:"mt-2 text-sm font-semibold text-foreground line-clamp-2",children:Z.ogPreview.title})]}):eN?(0,s.jsxs)(s.Fragment,{children:[Z.text&&(0,s.jsx)("p",{className:"mb-3 whitespace-pre-wrap text-foreground",children:Z.text}),(0,s.jsx)(C.j,{ogPreview:Z.ogPreview})]}):eb?(0,s.jsxs)(s.Fragment,{children:[Z.text&&(0,s.jsx)("p",{className:"mb-3 whitespace-pre-wrap text-foreground",children:Z.text}),(0,s.jsx)(D.X,{ogPreview:ew})]}):ek?(0,s.jsxs)(s.Fragment,{children:[Z.text&&(0,s.jsx)("p",{className:"mb-3 whitespace-pre-wrap text-foreground",children:Z.text}),(0,s.jsx)(E.x,{url:ek})]}):eg?(0,s.jsxs)(s.Fragment,{children:[Z.imageKey&&(0,s.jsx)(_.W,{imageKey:Z.imageKey,className:"mb-3","data-testid":"event-cover-header",priority:ea,width:Z.imageWidth,height:Z.imageHeight}),(0,s.jsxs)("div",{className:"space-y-2 ".concat(ev?"opacity-75":""),"data-testid":"event-card",children:[(0,s.jsxs)("div",{className:"flex gap-3",children:[(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center rounded-lg px-2.5 py-1.5 text-center shrink-0 ".concat(ev?"bg-muted text-muted-foreground":"bg-primary-soft text-primary"),"data-testid":"event-date-badge",children:[(0,s.jsx)("span",{className:"text-[10px] font-semibold uppercase leading-tight",children:new Date(Z.eventData.startDate).toLocaleDateString("en-IN",{month:"short"}).toUpperCase()}),(0,s.jsx)("span",{className:"text-lg font-bold leading-tight",children:new Date(Z.eventData.startDate).getDate()})]}),(0,s.jsxs)("div",{className:"min-w-0 flex-1 space-y-1",children:[(0,s.jsx)("h3",{className:"text-base font-semibold text-foreground",children:Z.eventData.title}),(0,s.jsxs)("div",{className:"flex items-center gap-1.5 text-sm text-muted-foreground",children:[(0,s.jsx)("span",{children:"\uD83D\uDCC5"}),(0,s.jsx)("span",{children:Z.eventData.endDate?function(e,t){let a=new Date(e),s=new Date(t),r=a.toDateString()===s.toDateString(),n={month:"short",day:"numeric"},i={hour:"numeric",minute:"2-digit"};if(r)return"".concat(a.toLocaleDateString("en-IN",n),", ").concat(a.toLocaleTimeString("en-IN",i)," â ").concat(s.toLocaleTimeString("en-IN",i));let o={...n,...i};return"".concat(a.toLocaleDateString("en-IN",o)," â ").concat(s.toLocaleDateString("en-IN",o))}(Z.eventData.startDate,Z.eventData.endDate):new Date(Z.eventData.startDate).toLocaleDateString("en-IN",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})})]}),Z.eventData.location&&(0,s.jsxs)("div",{className:"flex items-center gap-1.5 text-sm text-muted-foreground","data-testid":"event-location",children:[(0,s.jsx)(m.A,{className:"h-4 w-4 shrink-0"}),(0,s.jsx)("span",{children:Z.eventData.location})]}),Z.eventData.onlineUrl&&(0,s.jsxs)("div",{className:"flex items-center gap-1.5 text-sm text-muted-foreground","data-testid":"event-online",children:[(0,s.jsx)(p.A,{className:"h-4 w-4 shrink-0"}),(0,s.jsx)(R.E,{tone:"soft-info",children:"Online"})]}),Z.eventData.description&&(0,s.jsx)("p",{className:"text-sm text-foreground
1/80 line-clamp-2",children:Z.eventData.description})]})]}),ev&&(0,s.jsx)(R.E,{tone:"solid-muted","data-testid":"event-ended-badge",children:"Completed"}),ej&&(0,s.jsx)("span",{className:"inline-block text-sm font-medium text-primary","data-testid":"event-relative-time",children:(0,u.x)(Z.eventData.startDate)}),Y&&!ev&&(0,s.jsxs)("div",{className:"flex items-center gap-2 pt-1","data-testid":"rsvp-buttons",children:[Z.userRsvp&&(0,s.jsx)(R.E,{tone:"soft-vana","data-testid":"rsvp-status-badge",children:"going"===Z.userRsvp?"Going":"Interested"}),(0,s.jsxs)(S.v,{as:"button",selected:"going"===Z.userRsvp,onClick:()=>Y("going"===Z.userRsvp?"none":"going"),"data-testid":"rsvp-going","aria-pressed":"going"===Z.userRsvp,children:["Going ",(0,s.jsxs)("span",{"data-testid":"rsvp-count-going",children:["(",null!=(V=Z.goingCount)?V:0,")"]})]}),(0,s.jsxs)(S.v,{as:"button",selected:"interested"===Z.userRsvp,onClick:()=>Y("interested"===Z.userRsvp?"none":"interested"),"data-testid":"rsvp-interested","aria-pressed":"interested"===Z.userRsvp,children:["Interested"," ",(0,s.jsxs)("span",{"data-testid":"rsvp-count-interested",children:["(",null!=(B=Z.interestedCount)?B:0,")"]})]})]})]}),Z.text&&(0,s.jsx)("p",{className:"mt-2 text-sm text-muted-foreground",children:Z.text})]}):"article"===Z.postType&&Z.articleData?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("h3",{className:"text-base font-semibold text-foreground",children:Z.articleData.title||Z.text}),Z.articleData.body&&(0,s.jsxs)("p",{className:"mt-1 whitespace-pre-wrap text-foreground/85",children:[Z.articleData.body.slice(0,250),Z.articleData.body.length>250&&"... ",(0,s.jsx)(T.R,{href:"/post/".concat(Z._id),className:"text-primary font-medium hover:underline","data-testid":"read-more",children:"Read more"})]}),(Z.articleData.coverImageKey||Z.imageKey)&&(0,s.jsx)(_.W,{imageKey:Z.articleData.coverImageKey||Z.imageKey,className:"mt-3",priority:ea,width:Z.articleData.coverImageKey?void 0:Z.imageWidth,height:Z.articleData.coverImageKey?void 0:Z.imageHeight})]}):(0,s.jsxs)(s.Fragment,{children:[Z.text&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("p",{className:"whitespace-pre-wrap text-foreground",children:[eE,eD&&!G&&(0,s.jsxs)(s.Fragment,{children:["... ",(0,s.jsx)("button",{onClick:Q,className:"text-primary font-medium hover:underline","data-testid":"read-more",children:"Read more"})]})]}),eD&&G&&(0,s.jsx)("button",{onClick:Q,className:"text-primary font-medium hover:underline text-sm mt-1","data-testid":"read-less",children:"Read less"})]}),Z.imageKey&&(0,s.jsx)(_.W,{imageKey:Z.imageKey,className:"mt-3",priority:ea,width:Z.imageWidth,height:Z.imageHeight}),Z.documentKey&&(0,s.jsxs)("a",{href:"".concat("https://cdn.ecomitram.org","/").concat(Z.documentKey),target:"_blank",rel:"noopener noreferrer",className:"mt-3 flex items-center gap-3 rounded-2xl border border-border-soft bg-muted p-4 hover:bg-muted/70 transition-colors","data-testid":"post-document",children:[(0,s.jsxs)("svg",{className:"h-10 w-10 shrink-0 text-destructive",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,s.jsx)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6zM6 20V4h7v5h5v11H6z"}),(0,s.jsx)("path",{d:"M8 12h8v2H8zm0 4h5v2H8z"})]}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:"truncate text-sm font-medium text-foreground",children:null!=(q=Z.documentName)?q:"Document"}),(0,s.jsxs)("p",{className:"text-xs text-muted-foreground",children:[Z.documentSize?"".concat((Z.documentSize/1024/1024).toFixed(1)," MB"):"PDF"," \xb7 View/Download"]})]}),(0,s.jsx)("svg",{className:"h-5 w-5 shrink-0 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 6H5.25A2.25 2.25 0 003 8.25v10.5A2.25 2.25 0 005.25 21h10.5A2.25 2.25 0 0018 18.75V10.5m-10.5 6L21 3m0 0h-5.25M21 3v5.25"})})]}),Z.ogPreview&&(0,s.jsx)(D.X,{ogPreview:Z.ogPreview,className:"mt-3"})]})}),er.length>0&&(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5 px-4 pb-2","data-testid":"hashtag-chips",children:er.map(e=>(0,s.jsxs)(S.v,{href:"/?hashtag=".concat(e),"data-testid":"hashtag-chip",children:["#",e]},e))}),(0,s.jsxs)("div",{className:"flex items-center gap-1 border-t border-border-soft px-2 py-2.5 text-sm text-muted-foreground",children:[(0,s.jsx)(F.C,{active:"like"===Z.userReaction,count:Z.likesCount,onClick:X,disabled:!!$&&Z.userId===$,"data-testid":"like-button"}),(0,s.jsxs)(T.R,{href:"/post/".concat(Z._id),className:"min-h-[44px] flex items-center gap-1.5 px-2 hover:text-primary","aria-label":"Comments",children:[(0,s.jsx)(x.A,{className:"size-4","aria-hidden":"true"}),Z.commentsCount?Z.commentsCount:"Comment"]}
1),(0,s.jsx)(b.wD,{url:"/post/".concat(Z._id),title:"Check this out on EcoMitram",text:Z.text?(0,y.i)(Z.text,100):"",utmSource:"share",utmMedium:"post",variant:"icon-only",size:"sm",className:"ml-auto","data-testid":"share-button"})]}),(0,s.jsx)(w.Z,{isOpen:en,onClose:()=>ei(!1),targetType:"post",targetId:Z._id})]})}function z(){var e,t,a;let i=(0,n.useSearchParams)(),c=null!=(e=i.get("hashtag"))?e:void 0,u=null!=(t=i.get("userId"))?t:void 0,m=null!=(a=i.get("type"))?a:void 0,{uid:h,trustLevel:p,loading:x}=(0,A.i)(),g="admin"===p,f="event"===m,[v,j]=(0,r.useState)([]),[y,N]=(0,r.useState)([]),[w,b]=(0,r.useState)(null),[k,C]=(0,r.useState)(!0),[D,E]=(0,r.useState)(!1),[M,S]=(0,r.useState)(null),[R,P]=(0,r.useState)(null),[_,T]=(0,r.useState)(new Set),[F,U]=(0,r.useState)([]),[z,H]=(0,r.useState)([]),[V,B]=(0,r.useState)(null),[q,Z]=(0,r.useState)(null),[G,Q]=(0,r.useState)(!1),[X,Y]=(0,r.useState)(!1),$=(0,r.useMemo)(()=>y.filter(e=>void 0!==e.slot).sort((e,t)=>e.slot-t.slot),[y]),[J]=(0,r.useState)(K),ee=null!=h?h:J,et=(0,r.useMemo)(()=>y.filter(e=>void 0===e.slot),[y]),ea=(0,r.useMemo)(()=>(0,d.mB)(et,(0,d.Px)(ee)),[et,ee]),es=(0,r.useMemo)(()=>{let e=(0,d.SZ)(ea.length,(0,d.Px)(ee)),t=new Map;return e.forEach((e,a)=>{let s=ea[a];s&&t.set(e,s)}),t},[ea,ee]),er=(0,r.useCallback)(async(e,t,a,s,r)=>{let n=new URLSearchParams;e&&n.set("cursor",e),t&&n.set("hashtag",t),a&&n.set("userId",a),s&&n.set("postType",s),r&&n.set("eventStatus",r);let i=n.toString();return(0,o.uE)(i?"/posts?".concat(i):"/posts")},[]),en=(0,r.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];try{let t=await (0,o.uE)("/feed/pins",{...e&&{cache:"no-store"}});N(t.pins)}catch(e){}},[]);(0,r.useEffect)(()=>{C(!0),S(null),f?Promise.all([er(void 0,c,u,"event","upcoming"),er(void 0,c,u,"event","past")]).then(e=>{let[t,a]=e;U(t.posts),B(t.nextCursor),H(a.posts),Z(a.nextCursor)}).catch(e=>{S(e instanceof Error?e.message:"Failed to load events")}).finally(()=>C(!1)):Promise.all([er(void 0,c,u),en()]).then(e=>{let[t]=e;j(t.posts),b(t.nextCursor)}).catch(e=>{S(e instanceof Error?e.message:"Failed to load feed")}).finally(()=>C(!1))},[c,u,m,f,er,en]);let ei=(0,r.useCallback)(async()=>{if(w&&!D){E(!0),S(null);try{let e=await er(w,c,u);j(t=>[...t,...e.posts]),b(e.nextCursor)}catch(e){S(e instanceof Error?e.message:"Failed to load more posts")}finally{E(!1)}}},[w,D,er,c,u]),eo=(0,r.useCallback)(async()=>{if(V&&!G){Q(!0);try{let e=await er(V,c,u,"event","upcoming");U(t=>[...t,...e.posts]),B(e.nextCursor)}catch(e){}finally{Q(!1)}}},[V,G,er,c,u]),el=(0,r.useCallback)(async()=>{if(q&&!X){Y(!0);try{let e=await er(q,c,u,"event","past");H(t=>[...t,...e.posts]),Z(e.nextCursor)}catch(e){}finally{Y(!1)}}},[q,X,er,c,u]),{sentinelRef:ed}=O({onLoadMore:ei,hasMore:!!w,isLoading:D}),{sentinelRef:ec}=O({onLoadMore:eo,hasMore:!!V,isLoading:G}),{sentinelRef:eu}=O({onLoadMore:el,hasMore:!!q,isLoading:X}),em=(0,r.useCallback)(async(e,t)=>{try{let a=await (0,l.apiMutate)("/posts/".concat(e,"/like"),{method:"POST",body:{reactionType:t}});j(t=>t.map(t=>t._id===e?{...t,likesCount:a.likesCount,dislikesCount:a.dislikesCount,userReaction:a.reactionType}:t)),P(null)}catch(e){if(e instanceof o.hD&&"AUTH_REQUIRED"===e.errorCode)return;P(e instanceof Error?e.message:"Failed to react to post")}},[]),eh=(0,r.useCallback)(e=>{T(t=>{let a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})},[]),ep=(0,r.useCallback)(async(e,t)=>{try{let a=await (0,l.apiMutate)("/posts/".concat(e,"/rsvp"),{method:"POST",body:{status:t}});j(t=>t.map(t=>t._id===e?{...t,goingCount:a.goingCount,interestedCount:a.interestedCount,userRsvp:a.status}:t))}catch(e){if(e instanceof o.hD&&"AUTH_REQUIRED"===e.errorCode)return;P(e instanceof Error?e.message:"Failed to update RSVP")}},[]),ex=(0,r.useCallback)(async e=>{try{await (0,o.uE)("/feed/pins",{method:"POST",body:{entityType:"post",entityId:e}}),j(t=>t.filter(t=>t._id!==e)),await en(!0)}catch(e){P(e instanceof Error?e.message:"Failed to pin post")}},[en]),eg=(0,r.useCallback)(async e=>{try{await (0,o.uE)("/feed/pins/".concat(e),{method:"DELETE"}),await en(!0)}catch(e){P(e instanceof Error?e.message:"Failed to unpin post")}},[en]),ef=(0,r.useCallback)(()=>{C(!0),S(null),f?Promise.all([er(void 0,c,u,"event","upcoming"),er(void 0,c,u,"event","past")]).then(e=>
1{let[t,a]=e;U(t.posts),B(t.nextCursor),H(a.posts),Z(a.nextCursor)}).catch(e=>{S(e instanceof Error?e.message:"Failed to load events")}).finally(()=>C(!1)):Promise.all([er(void 0,c,u),en()]).then(e=>{let[t]=e;j(t.posts),b(t.nextCursor)}).catch(e=>{S(e instanceof Error?e.message:"Failed to load feed")}).finally(()=>C(!1))},[er,en,c,u,f]),ev=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return(0,s.jsx)(W,{post:e,priority:t,isExpanded:_.has(e._id),onToggleExpand:()=>eh(e._id),onLike:()=>em(e._id,"like"),onRsvp:"event"===e.postType?h?t=>ep(e._id,t):()=>{window.location.href="/login?redirect=".concat(encodeURIComponent("/post/".concat(e._id)))}:void 0,currentUid:h,authLoading:x,isAdmin:g,onPin:ex},e._id)};if(k)return(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(I.FeedSkeleton,{onRetry:ef})});let ej=f?0===F.length&&0===z.length:0===v.length;return M&&ej?(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{className:"rounded-2xl bg-destructive-soft p-4 text-center text-destructive","data-testid":"feed-error",role:"alert",children:[(0,s.jsx)("p",{children:M}),(0,s.jsx)("button",{onClick:ef,className:"mt-2 rounded-md bg-destructive/10 px-4 py-1 text-sm text-destructive hover:bg-destructive/15",children:"Try again"})]})}):f?0===F.length&&0===z.length?(0,s.jsx)(s.Fragment,{children:(0,s.jsx)("div",{className:"py-8 text-center text-muted-foreground","data-testid":"events-empty-state",children:"No upcoming events. Check back soon!"})}):(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{className:"space-y-3","data-testid":"feed-events-list",children:[F.map(e=>ev(e)),V&&(0,s.jsx)("div",{ref:ec,"aria-hidden":"true"}),G&&(0,s.jsx)("div",{className:"space-y-4","aria-live":"polite",role:"status",children:(0,s.jsx)(I.y,{})}),z.length>0&&(0,s.jsxs)("div",{className:"flex items-center gap-3 py-2","data-testid":"completed-events-header",children:[(0,s.jsx)("div",{className:"h-px flex-1 bg-border-soft"}),(0,s.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:"Completed"}),(0,s.jsx)("div",{className:"h-px flex-1 bg-border-soft"})]}),z.map(e=>ev(e)),q&&(0,s.jsx)("div",{ref:eu,"aria-hidden":"true"}),X&&(0,s.jsx)("div",{className:"space-y-4","aria-live":"polite",role:"status",children:(0,s.jsx)(I.y,{})})]})}):0===v.length?(0,s.jsx)(s.Fragment,{children:(0,s.jsx)("div",{className:"py-8 text-center text-muted-foreground",children:"No posts yet. Be the first to share something!"})}):(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)(L.n,{cards:$,isAdmin:g,onUnpin:eg}),R&&(0,s.jsx)("div",{className:"rounded-2xl bg-destructive-soft px-4 py-2 text-sm text-destructive","data-testid":"like-error",role:"alert",children:R}),c&&(0,s.jsxs)("div",{className:"flex items-center justify-between rounded-2xl bg-primary-soft px-4 py-2 text-sm text-foreground","data-testid":"hashtag-filter-banner",children:[(0,s.jsxs)("span",{children:["Filtering by: ",(0,s.jsxs)("strong",{children:["#",c]})]}),(0,s.jsx)("a",{href:"/",className:"text-primary underline","data-testid":"clear-filter",children:"Clear"})]}),v.map((e,t)=>{let a=es.get(t),n=t<2;return(0,s.jsxs)(r.Fragment,{children:[ev(e,n),a&&(0,s.jsx)(L.T,{card:a})]},e._id)}),M&&v.length>0&&(0,s.jsx)("div",{className:"rounded-2xl bg-destructive-soft px-4 py-2 text-sm text-destructive","data-testid":"load-more-error",role:"alert",children:M}),D&&(0,s.jsxs)("div",{className:"space-y-4","aria-live":"polite",role:"status",children:[(0,s.jsx)(I.y,{}),(0,s.jsx)(I.y,{})]}),w&&(0,s.jsx)("div",{ref:ed,"data-testid":"feed-sentinel","aria-hidden":"true"}),!w&&v.length>0&&!k&&(0,s.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground","data-testid":"end-of-feed",children:"You've seen all posts"})]})}},70813:(e,t,a)=>{"use strict";function s(e,t){let a=e.slice(0,t),s=a.charCodeAt(a.length-1);return s>=55296&&s<=56319?a.slice(0,-1):a}a.d(t,{i:()=>s})},78048:(e,t,a)=>{"use strict";a.d(t,{FeedSkeleton:()=>o,y:()=>i});var s=a(84157),r=a(81954),n=a(35426);function i(){return(0,s.jsxs)("div",{className:"space-y-3 rounded-lg border bg-card p-4",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(r.E,{className:"h-8 w-8 rounded-full"}),(0,s.jsx)(r.E,{className:"h-4 w-32"}),(0,s.jsx)(r.E,{className:"h-3 w-16"})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(r.E,{className:"h-4 w-full"}),(0,s.jsx)(r.E,{className:"h-4 w-3/4"})]}),(0,s.jsx)(r.E,{className:"aspect-video w-full rounded-lg"}),(0,s.jsxs)("div",{className:"flex items-center gap-4 border-t pt-3",children:[(0,s.jsx)(r.E,{className:"h-4 w-10"}),(0,s.jsx)(r.E,{className:"h-4 w-10"}),(0,s.jsx)(r.E,{className:"h-4 w-10"}),(0,s.jsx)(r.E,{className:"h-4 w-10"})]})]})}function o(e){let{onRetry:t}=e,{timedOut:a,reset:r}=(0,n.r)(1e4);return a?(0,s.jsxs)("div",{className:"py-8 text-center text-muted-foreground","aria-live":"polite",role:"status","data-testid":"feed-skeleton",children:[(0,s.jsx)("p",{children:"Could not load feed."}),(0,s.jsx)("button",{onClick:()=>{r(),t?t():window.location.reload()},className:"mt-2 rounded-md bg-primary px-4 py-2 text-sm text-primary-foreground hover:bg-primary/90",children:"Tap to retry"})]}):(0,s.jsxs)("div",{className:"space-y-4","aria-live":"polite",role:"status","data-testid":"feed-skeleton",children:[(0,s.jsx)(i,{}),(0,s.jsx)(i,{}),(0,s.jsx)(i,{})]})}},95175:(e,t,a)=>{"use strict";a.d(t,{v:()=>o});var s=a(84157);a(41865);var r=a(54572),n=a(47104);let i=(0,r.F)("inline-flex items-center gap-1 rounded-full border px-3 h-9 text-[13px] font-semibold whitespace-nowrap transition-colors",{variants:{selected:{true:"bg-primary text-primary-foreground border-primary",false:"bg-transparent text-primary border-primary/30 hover:bg-primary/10 hover:border-primary/50"}},defaultVariants:{selected:!1}});function o(e){let{className:t,selected:a,as:r="a",...o}=e;if("button"===r){let{children:e,...r}=o;return(0,s.jsx)("button",{"data-slot":"pwa-chip",type:"button",className:(0,n.cn)(i({selected:a,className:t})),...r,children:e})}let{children:l,...d}=o;return(0,s.jsx)("a",{"data-slot":"pwa-chip",className:(0,n.cn)(i({selected:a,className:t})),...d,children:l})}}},e=>{e.O(0,[520,2733,4262,8737,7708,9379,3743,3271,7271,6770,1253,8079,4996,2331,224,5456,6341,3902,7358],()=>e(e.s=24465)),_N_E=e.O()}]);
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.