PageSourceSearch

https://www.brnrt.ai/_next/static/immutable/chunks/22_cshsbvo5ry.js

js brnrt.ai collected 2026-10-05 14:04:14 UTC 92,828 bytes, 1 lines download raw bytes

1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,649975,e=>{"use strict";var t=e.i(843476),n=e.i(508734),r=e.i(82217),s=e.i(982954),a=e.i(759659),o=e.i(328523),i=e.i(771139),l=e.i(831458),d=e.i(149882),c=e.i(21357),u=e.i(615227),m=e.i(468590),p=e.i(466691),g=e.i(839717),h=e.i(440087),x=e.i(577255),f=e.i(271645),v=e.i(963447),b=e.i(649254),j=e.i(769605),C=e.i(992874),w=e.i(486112),y=e.i(577596),N=e.i(783236),S=e.i(458612),k=e.i(496509);e.s(["default",0,function({showVote:e=!1,hasVoted:E=!1,isVoting:T=!1,votes:R=0,onVote:A,hideVoteCount:I=!1,showCopy:P=!1,onCopy:D,showRemix:O=!1,onRemix:M,isRemixing:F=!1,remixesRemaining:z=0,remixPending:L=0,allocationLoading:B=!1,remixImageUrl:H,remixImageAlt:U,canRemix:V=!0,showReport:_=!1,isAdmin:$=!1,showDelete:G=!1,showSuspend:W=!1,onDelete:q,onSuspend:K,onSuspendAndDelete:Y,isDeleting:J=!1,isSuspending:X=!1,notice:Z,size:Q="sm",className:ee,timestamp:et,contentId:en,creatorIds:er=[],relatedTikToks:es=[],showChat:ea=!1,onChat:eo,showComments:ei=!1,onCommentsClick:el,commentsToggleActive:ed=!1,onCommentsToggle:ec,commentCount:eu=0}){let em="xs"===Q,ep=em?"h-7 w-7 p-0":"",eg=em?"h-7 px-1.5":"",eh="xs"===Q?"h-2.5 w-2.5 sm:h-3 sm:w-3":"sm"===Q?"h-2.5 w-2.5 sm:h-3 lg:h-3.5 sm:w-3 lg:w-3.5":"h-3 w-3 sm:h-3.5 lg:h-4 sm:w-3.5 lg:w-4",[ex,ef]=(0,f.useState)(!1),{user:ev}=(0,v.useAuth)(),[eb,ej]=(0,f.useState)(!1),[eC,ew]=(0,f.useState)(!1),[ey,eN]=(0,f.useState)(null),[eS,ek]=(0,f.useState)(!1),eE=es??[],eT=eE.length>0,eR=en??Z?.id??null,eA=!!Z,eI=W&&!!K&&er.length>0,eP=W&&!!Y&&er.length>0,eD=G&&!!q,eO=eI||eP||eD,eM=e=>{eN(e),ew(!0)};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:(0,x.cn)("flex items-center",em?"gap-1.5 sm:gap-2":"gap-4 sm:gap-5 lg:gap-6",ee),children:[et&&(0,t.jsxs)("div",{className:(0,x.cn)("flex items-center gap-1.5","xs"===Q?"text-[10px]":"text-xs"),children:[(0,t.jsx)(d.Calendar,{className:(0,x.cn)("text-foreground","xs"===Q?"h-2.5 w-2.5":"h-3 w-3")}),(0,t.jsx)("span",{className:"text-foreground/60",children:et})]}),P&&D&&(0,t.jsxs)(g.Tooltip,{children:[(0,t.jsx)(g.TooltipTrigger,{render:(0,t.jsx)(p.Button,{type:"button",onClick:e=>{e.stopPropagation(),e.preventDefault(),D()},size:Q,variant:"ghost",className:(0,x.cn)(ep,"transition-colors hover:bg-interaction/10 hover:text-interaction"),"aria-label":"Copy link"}),children:(0,t.jsx)(n.Copy,{className:(0,x.cn)(eh,"text-foreground")})}),(0,t.jsx)(g.TooltipContent,{children:"Copy link"})]}),ei&&(el||ec)&&(0,t.jsxs)(p.Button,{onClick:e=>{e.stopPropagation(),e.preventDefault(),ec?ec():el&&el()},size:Q,variant:"ghost",className:(0,x.cn)(eg,"hover:bg-foreground
1/10 transition-colors flex items-center gap-1 sm:gap-1.5",ed&&"bg-foreground/15"),"aria-label":ed?"Hide comments":"View comments",children:[(0,t.jsx)(m.MessageSquare,{className:(0,x.cn)(eh,"text-foreground")}),eu>0&&(0,t.jsx)("span",{className:(0,x.cn)("font-medium select-none text-foreground","xs"===Q?"text-[10px] sm:text-xs":"text-xs sm:text-sm"),children:eu})]}),ea&&eo&&(0,t.jsxs)(g.Tooltip,{children:[(0,t.jsx)(g.TooltipTrigger,{render:(0,t.jsx)(p.Button,{type:"button",onClick:e=>{e.stopPropagation(),e.preventDefault(),eo()},size:Q,variant:"ghost",className:(0,x.cn)(ep,"hover:bg-foreground/10 transition-colors"),"aria-label":"Chat with researcher"}),children:(0,t.jsx)(b.AnimatedGradientIcon,{icon:u.MessageCircle,isActive:!0,iconSize:eh})}),(0,t.jsx)(g.TooltipContent,{children:"Chat with researcher"})]}),eT&&1===eE.length&&(0,t.jsx)(p.Button,{onClick:e=>{e.stopPropagation(),e.preventDefault(),1===eE.length&&window.open(eE[0].url,"_blank","noopener,noreferrer")},size:Q,variant:"ghost",className:(0,x.cn)(ep,"hover:bg-foreground
1/10 transition-colors"),"aria-label":"Watch video",title:eE[0].title||"Watch video",children:(0,t.jsx)(c.Play,{className:(0,x.cn)(eh,"text-foreground")})}),eT&&eE.length>1&&(0,t.jsxs)(h.DropdownMenu,{children:[(0,t.jsx)(h.DropdownMenuTrigger,{render:(0,t.jsxs)(p.Button,{onClick:e=>e.stopPropagation(),size:Q,variant:"ghost",className:(0,x.cn)(eg,"hover:bg-foreground/10 transition-colors"),"aria-label":`${eE.length} related videos`,children:[(0,t.jsx)(c.Play,{className:(0,x.cn)(eh,"text-foreground")}),(0,t.jsx)("span",{className:"ml-0.5 text-[10px] text-foreground/60",children:eE.length})]})}),(0,t.jsx)(h.DropdownMenuContent,{align:"end",side:"top",sideOffset:8,className:"bg-background/95 border-foreground/20 mb-2 max-w-[280px]",children:eE.map((e,n)=>(0,t.jsxs)(h.DropdownMenuItem,{onClick:()=>{window.open(e.url,"_blank","noopener,noreferrer")},className:"text-foreground hover:bg-foreground/10 cursor-pointer",children:[(0,t.jsx)(c.Play,{className:"h-4 w-4 mr-2"}),(0,t.jsx)("span",{className:"truncate",children:e.title||(e.creatorUsername?`@${e.creatorUsername}`:`Video ${n+1}`)})]},`tiktok-${n}`))})]}),O&&(0,t.jsxs)(g.Tooltip,{children:[(0,t.jsx)(g.TooltipTrigger,{render:(0,t.jsx)(p.Button,{type:"button",onClick:()=>{ev?$||V&&!(z<=0)?ef(!0):(0,j.showInfoToast)(L>0?"No remix slots are available right now. Your current remixes are still in progress.":"Daily remix allocation reached. Check back tomorrow."):(0,j.showAuthRequiredToast)("You must be logged in to remix content.")},size:Q,variant:"ghost",className:(0,x.cn)(ep,"hover:bg-interaction/10 hover:text-interaction transition-colors"),"aria-label":"Remix"}),children:(0,t.jsx)(r.Repeat2,{className:(0,x.cn)(eh,"text-foreground")})}),(0,t.jsx)(g.TooltipContent,{children:"Remix"})]}),_&&en&&(0,t.jsxs)(g.Tooltip,{children:[(0,t.jsx)(g.TooltipTrigger,{render:(0,t.jsx)(p.Button,{type:"button",onClick:()=>{ev?ek(!0):(0,j.showAuthRequiredToast)("You must be logged in to report content.")},size:Q,variant:"ghost",className:(0,x.cn)(ep,"hover:bg-orange-500/10 hover:text-orange-400 transition-colors"),"aria-label":"Report content"}),children:(0,t.jsx)(l.Flag,{className:(0,x.cn)(eh,"text-foreground")})}),(0,t.jsx)(g.TooltipContent,{children:"Report"})]}),e&&A&&eR&&(0,t.jsx)(y.default,{itemId:eR,isNotice:eA,votes:R,hasVoted:E,isVoting:T,onVote:A,adminVoteEnabled:$,size:Q,hideVoteCount:I,className:(0,x.cn)(eg,"hover:scale-105")}),$&&eO&&(0,t.jsxs)(h.DropdownMenu,{children:[(0,t.jsx)(h.DropdownMenuTrigger,{render:(0,t.jsx)(p.Button,{size:Q,variant:"ghost","aria-label":"Admin actions",className:(0,x.cn)(ep,"hover:bg-red-500/10 hover:text-red-400 transition-colors"),children:(0,t.jsx)(s.Shield,{className:(0,x.cn)(eh,"text-foreground")})})}),(0,t.jsxs)(h.DropdownMenuContent,{align:"end",side:"top",sideOffset:8,className:"bg-background/95 border-foreground
1/20 mb-2",children:[eP&&(0,t.jsxs)(h.DropdownMenuItem,{onClick:()=>{eM("suspendAndDelete")},className:"text-red-400 hover:bg-red-500/10 cursor-pointer",children:[(0,t.jsx)(i.UserX,{className:"h-4 w-4 mr-2"}),"Suspend & Delete"]}),eI&&(0,t.jsxs)(h.DropdownMenuItem,{onClick:()=>{eM("suspendOnly")},className:"text-orange-400 hover:bg-orange-500/10 cursor-pointer",children:[(0,t.jsx)(o.Pause,{className:"h-4 w-4 mr-2"}),"Suspend User"]}),(eI||eP)&&eD&&(0,t.jsx)(h.DropdownMenuSeparator,{className:"bg-foreground/10"}),eD&&(0,t.jsxs)(h.DropdownMenuItem,{onClick:()=>{ej(!0)},className:"text-foreground hover:bg-foreground/10 cursor-pointer",children:[(0,t.jsx)(a.Trash2,{className:"h-4 w-4 mr-2"}),"Delete Content"]})]})]})]}),O&&(0,t.jsx)(w.default,{open:ex,onOpenChange:ef,onConfirm:(e,t)=>M&&M(e,t),isRemixing:F,remixesRemaining:z,remixPending:L,allocationLoading:B,imageUrl:H,imageAlt:U}),(0,t.jsx)(C.default,{open:eb,onOpenChange:ej,onConfirm:()=>{q&&q(),ej(!1)},title:"Delete Content",description:"Are you sure you want to delete this content? This action cannot be undone.",isDeleting:J}),W&&K&&(0,t.jsx)(N.default,{open:eC,onOpenChange:e=>{e||eN(null),ew(e)},variant:"suspendAndDelete"===ey?"suspendAndDelete":"suspendOnly",onConfirm:e=>{"suspendAndDelete"===ey?Y&&Y(e):K&&K(e),ew(!1),eN(null)},isSuspending:X,userAlias:er.length>0?(0,k.getHumanAlias)(er[0]):void 0}),_&&en&&(0,t.jsx)(S.default,{open:eS,onOpenChange:ek,contentId:en,creatorId:er?.[0]??null})]})}])},300446,e=>{"use strict";var t=e.i(843476),n=e.i(271645),r=e.i(522016),s=e.i(769605),a=e.i(146012),o=e.i(466691),i=e.i(306662),l=e.i(323621),d=e.i(328623),c=e.i(741120),u=e.i(632781),m=e.i(689664),p=e.i(263676),g=e.i(730274),h=e.i(179490),x=e.i(759659),f=e.i(468590),v=e.i(325597),b=e.i(963447),j=e.i(958789),C=e.i(770444),w=e.i(326832),y=e.i(648119),N=e.i(668109),S=e.i(440087);e.i(306698);var k=e.i(829052),E=e.i(296318),T=e.i(149940),R=e.i(153909),A=e.i(657688),I=e.i(61701),P=e.i(200818);function D({author:e}){let r=(0,I.useAgentProfileImages)(),s=(0,P.useChippuPortrait)(e.name),[a,o]=(0,n.useState)(null);if(void 0===s)return null;let i=s!==a?s:null,l=i??r[e.portraitName];return l?(0,t.jsx)(A.default,{src:l,alt:e.name,fill:!0,sizes:"32px",className:"object-cover",unoptimized:l.startsWith("http"),onError:i?()=>o(i):void 0}):(0,t.jsx)("div",{className:"w-full h-full flex items-center justify-center text-xs font-medium",children:e.name.charAt(0)})}function O({feedItemId:e,hideAdminPanel:a=!1,compact:m=!1}){let{user:p,isAdmin:g}=(0,b.useAuth)(),v=(0,j.useAuthedFetch)(),A=p?.uid??null,{comments:I,loading:P,hasUpvoted:M,handleUpvote:F,upvotingCommentId:z}=(0,w.useCommentThread)({db:C.db,user:p??null,feedItemId:e}),{customPrompt:L,setCustomPrompt:B,selectedAgents:H,toggleAgent:U,generating:V,handleGenerate:_,suggestingAngles:$,suggestions:G,handleSuggestAngles:W,applySuggestion:q}=(0,T.useCommentGeneration)({feedItemId:e,userId:A,authedFetch:v}),{editingCommentId:K,editText:Y,savingEdit:J,deletingCommentId:X,deletingAll:Z,startEditing:Q,cancelEditing:ee,setEditText:et,handleSaveEdit:en,startDeleting:er,cancelDeleting:es,handleDeleteComment:ea,handleDeleteAllComments:eo}=(0,R.useCommentModeration)({feedItemId:e,userId:A,authedFetch:v}
1),[ei,el]=(0,n.useState)(!1),[ed,ec]=(0,n.useState)(!1),eu=(0,n.useCallback)(async()=>{try{await _()}catch(e){(0,s.showErrorToast)(e instanceof Error?e.message:"Failed to generate comments")}},[_]),em=(0,n.useCallback)(async()=>{try{await en()}catch(e){(0,s.showErrorToast)(e instanceof Error?e.message:"Failed to update comment")}},[en]),ep=(0,n.useCallback)(async e=>{try{await ea(e)}catch(e){(0,s.showErrorToast)(e instanceof Error?e.message:"Failed to delete comment")}},[ea]),eg=(0,n.useCallback)(async()=>{try{await eo(),ec(!1)}catch(e){(0,s.showErrorToast)(e instanceof Error?e.message:"Failed to delete all comments")}},[eo]);if(P)return(0,t.jsxs)("div",{className:`flex items-center justify-center text-muted-foreground ${m?"py-6":"py-8"}`,children:[(0,t.jsx)(u.Loader2,{className:"w-4 h-4 mr-2 animate-spin"}),"Loading comments..."]});let eh=(0,t.jsx)(t.Fragment,{children:0===I.length?(0,t.jsx)("p",{className:`text-sm text-muted-foreground italic ${m?"py-4":""}`,children:"No agent comments yet."}):(0,t.jsx)("div",{className:"space-y-3",children:I.map(e=>{let n=(0,E.commentAuthorView)(e.agentName,p?.uid),s=(0,t.jsx)(D,{author:n}),a="flex-shrink-0 w-8 h-8 rounded-full overflow-hidden bg-muted relative block";return(0,t.jsxs)("div",{className:"group flex gap-3",children:[n.profileHref?(0,t.jsx)(r.default,{href:n.profileHref,className:a,children:s}):(0,t.jsx)("div",{className:a,children:s}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-0.5",children:[n.profileHref?(0,t.jsx)(r.default,{href:n.profileHref,className:"font-medium text-sm hover:underline",children:n.name}):(0,t.jsx)("span",{className:"font-medium text-sm",children:n.name}),n.yours&&(0,t.jsxs)("span",{className:"text-xs text-interaction",children:["· ",E.OWN_CHIPPU_MARK]}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:e.createdAt.toLocaleDateString()}),g&&K!==e.id&&X!==e.id&&(0,t.jsxs)(S.DropdownMenu,{modal:!1,children:[(0,t.jsx)(S.DropdownMenuTrigger,{render:(0,t.jsx)("button",{type:"button","aria-label":"Comment actions",className:"ml-auto p-1 rounded opacity-0 group-hover:opacity-100 data-popup-open:opacity-100 hover:bg-muted transition-all",children:(0,t.jsx)(y.MoreHorizontal,{className:"w-3.5 h-3.5 text-muted-foreground"})})}),(0,t.jsxs)(S.DropdownMenuContent,{align:"end",className:"min-w-[120px]",children:[(0,t.jsxs)(S.DropdownMenuItem,{onClick:()=>Q(e.id,e.text),children:[(0,t.jsx)(h.Edit2,{className:"w-3.5 h-3.5 mr-2"}),"Edit"]}),(0,t.jsxs)(S.DropdownMenuItem,{onClick:()=>er(e.id),className:"text-destructive focus:text-destructive",children:[(0,t.jsx)(x.Trash2,{className:"w-3.5 h-3.5 mr-2"}),"Delete"]})]})]})]}),X===e.id?(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,t.jsx)("span",{className:"text-destructive",children:"Delete this comment?"}),(0,t.jsx)(o.Button,{size:"sm",variant:"outline",onClick:()=>ep(e.id),className:"h-6 px-2 text-xs text-destructive border-destructive/30 hover:bg-destructive/10",children:"Confirm"}),(0,t.jsx)(o.Button,{size:"sm",variant:"outline",onClick:es,className:"h-6 px-2 text-xs",children:"Cancel"})]}):K===e.id?(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(i.Textarea,{value:Y,onChange:e=>et(e.target.value),className:"text-sm resize-none min-h-[60px]",rows:2}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(o.Button,{size:"sm",onClick:em,disabled:J||!Y.trim(),className:"h-6 px-2 text-xs",children:J?(0,t.jsx)(u.Loader2,{className:"w-3 h-3 animate-spin"}):"Save"}),(0,t.jsx)(o.Button,{size:"sm",variant:"outline",onClick:ee,className:"h-6 px-2 text-xs",children:"Cancel"})]})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"text-sm",children:e.text}),(0,t.jsxs)("button",{onClick:()=>F(e.id),disabled:!p||z===e.id,className:`mt-1.5 flex items-center gap-1 text-xs transition-all ${M(e.id)?"text-interaction":"text-muted-foreground hover:text-interaction"} ${!p?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,title:p?M(e.id)?"Unlike":"Like":"Sign in to like",children:[(0,t.jsx)(N.Heart,{className:`w-3.5 h-3.5 transition-all ${M(e.id)?"fill-interaction text-interaction drop-shadow-[0_0_6px_hsl(var(--interaction)/0.5)]":""}`}),(e.upvotes??0)>0&&(0,t.jsx)("span",{children:e.upvotes})]})]})]})]},e.id)})})});return m?(0,t.jsx)("div",{className:"space-y-3",children:eh}):(0,t.jsxs)("div",{className:"border-t border-border mt-6 pt-6",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,t.jsx)(f.MessageSquare,{className:"w-5 h-5 text-muted-foreground"}),(0,t.jsx)("span",{className:"font-medium",children:"Agent Comments"}),I.length>0&&(0,t.jsxs)("span",{className:"text-sm text-muted-foreground",children:["(",I.length,")"]}),g&&I.length>0&&(0,t.jsx)("div",{className:"ml-auto flex items-center gap-2",children:ed?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("span",{className:"text-xs text-destructive",children:["Delete all ",I.length," comments?"]}),(0,t.jsx)(o.Button,{size:"sm",variant:"outline",onClick:eg,disabled:Z,className:"h-6 px-2 text-xs text-destructive border-destructive/30 hover:bg-destructive/10",children:Z?(0,t.jsx)(u.Loader2,{className:"w-3 h-3 animate-spin"}):"Confirm"}),(0,t.jsx)(o.Button,{size:"sm",variant:"outline",onClick:()=>ec(!1),disabled:Z,className:"h-6 px-2 text-xs",children:"Cancel"})]}):(0,t.jsxs)(o.Button,{size:"sm",variant:"ghost",onClick:()=>ec(!0),className:"h-6 px-2 text-xs text-muted-foreground hover:text-destructive",children:[(0,t.jsx)(x.Tras
1h2,{className:"w-3 h-3 mr-1"}),"Delete All"]})})]}),(0,t.jsxs)("div",{className:"space-y-4",children:[eh,g&&!a&&(0,t.jsxs)("div",{className:"mt-6 pt-4 border-t border-border",children:[(0,t.jsxs)("button",{onClick:()=>el(!ei),className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground",children:[(0,t.jsx)(d.Sparkles,{className:"w-4 h-4"}),ei?"Hide":"Generate comments..."]}),ei&&(0,t.jsxs)("div",{className:"mt-4 space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-sm font-medium mb-2 block",children:"Custom prompt (optional)"}),(0,t.jsx)(i.Textarea,{value:L,onChange:e=>B(e.target.value),placeholder:"e.g., 'Have Mikasa and Don Draper debate the aesthetic choices'",rows:2,className:"resize-none"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-sm font-medium mb-2 block",children:"Select agents (or leave empty for random)"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:k.COMMENTING_AGENTS.map(e=>(0,t.jsx)(l.Badge,{variant:H.includes(e)?"default":"outline",className:"cursor-pointer",onClick:()=>U(e),children:e},e))})]}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsxs)(o.Button,{variant:"outline",size:"sm",onClick:W,disabled:$,children:[$?(0,t.jsx)(u.Loader2,{className:"w-4 h-4 mr-2 animate-spin"}):(0,t.jsx)(d.Sparkles,{className:"w-4 h-4 mr-2"}),"Suggest Angles"]}),(0,t.jsxs)(o.Button,{size:"sm",onClick:eu,disabled:V,children:[V?(0,t.jsx)(u.Loader2,{className:"w-4 h-4 mr-2 animate-spin"}):(0,t.jsx)(c.RefreshCw,{className:"w-4 h-4 mr-2"}),"Generate Comments"]})]}),G.length>0&&(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium block",children:"Suggested angles:"}),G.map((e,n)=>(0,t.jsxs)("button",{onClick:()=>q(e),className:"w-full text-left p-3 rounded-md border border-border hover:bg-accent text-sm",children:[(0,t.jsx)("div",{className:"font-medium mb-1",children:e.agents.join(" + ")}),(0,t.jsx)("p",{className:"text-muted-foreground",children:e.description})]},n))]})]})]})]})]})}var M=e.i(985560),F=e.i(448307),z=e.i(767316);function L({feedItemId:e,title:w,open:y=!0,onOpenChange:N,presentation:S}){let E="sheet"===S,P=E?a.SheetTitle:"h2",{user:D,isAdmin:B}=(0,b.useAuth)(),H=(0,j.useAuthedFetch)(),U=(0,I.useAgentProfileImages)(),[V,_]=(0,n.use
1State)(!1),[$,G]=(0,n.useState)(""),[W,q]=(0,n.useState)(""),[K,Y]=(0,n.useState)(!1),{comments:J}=(0,M.useCommentFetching)({db:C.db,feedItemId:e,enabled:y}),{showAdminPanel:X,setShowAdminPanel:Z,confirmDeleteAll:Q,setConfirmDeleteAll:ee,customPrompt:et,setCustomPrompt:en,selectedAgents:er,toggleAgent:es,generating:ea,handleGenerate:eo,suggestingAngles:ei,suggestions:el,handleSuggestAngles:ed,applySuggestion:ec,pendingComments:eu,publishing:em,handlePublish:ep,toggleApproval:eg,toggleEdit:eh,updateEditedText:ex,discardPending:ef,approvedCount:ev,deletingAll:eb,handleDeleteAllComments:ej}=function({feedItemId:e,userId:t,authedFetch:r,onError:s}){let[a,o]=(0,n.useState)(!1),[i,l]=(0,n.useState)(!1),d=(0,T.useCommentGeneration)({feedItemId:e,userId:t,authedFetch:r}),c=(0,R.useCommentModeration)({feedItemId:e,userId:t,authedFetch:r}),u=(0,F.useLatestRef)(s),{handleGenerate:m,handlePublish:p}=d,{handleDeleteAllComments:g,handleDeleteComment:h}=c,x=(0,n.useCallback)(async()=>{try{await m({preview:!0})}catch(e){u.current?.(e,"Failed to generate comments")}},[m,u]),f=(0,n.useCallback)(async()=>{try{await p()}catch(e){u.current?.(e,"Failed to publish comments")}},[p,u]),v=(0,n.useCallback)(async()=>{try{await g(),l(!1)}catch(e){u.current?.(e,"Failed to delete all comments")}},[g,u]),b=(0,n.useCallback)(async e=>{try{await h(e)}catch(e){u.current?.(e,"Failed to delete comment")}},[h,u]);return{showAdminPanel:a,setShowAdminPanel:o,toggleAdminPanel:(0,n.useCallback)(()=>o(e=>!e),[]),confirmDeleteAll:i,setConfirmDeleteAll:l,customPrompt:d.customPrompt,setCustomPrompt:d.setCustomPrompt,selectedAgents:d.selectedAgents,toggleAgent:d.toggleAgent,generating:d.generating,handleGenerate:x,rawHandleGenerate:d.handleGenerate,suggestingAngles:d.suggestingAngles,suggestions:d.suggestions,handleSuggestAngles:d.handleSuggestAngles,applySuggestion:d.applySuggestion,pendingComments:d.pendingComments,publishing:d.publishing,handlePublish:f,rawHandlePublish:d.handlePublish,toggleApproval:d.toggleApproval,toggleEdit:d.toggleEdit,updateEditedText:d.updateEditedText,discardPending:d.discardPending,approvedCount:d.approvedCount,deletingAll:c.deletingAll,handleDeleteAllComments:v,rawHandleDeleteAllComments:c.handleDeleteAllComments,deletingCommentId:c.deletingCommentId,startDeleting:c.startDeleting,cancelDeleting:c.cancelDeleting,handleDeleteComment:b,editingCommentId:c.editingCommentId,editText:c.editText,savingEdit:c.savingEdit,setEditText:c.setEditText,startEditing:c.startEditing,cancelEditing:c.cancelEditing,handleSaveEdit:c.handleSaveEdit}}({feedItemId:e,userId:D?.uid??null,authedFetch:H,onError:(e,t)=>{(0,s.showErrorToast)(e instanceof Error?e.message:t)}}),eC=(0,n.useCallback)(async()=>{if(D&&$&&W.trim()){Y(!0);try{let t=await H("/api/admin/manual-comment",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({feedItemId:e,agentName:$,text:W.trim()})});if(!t.ok)throw Error(await (0,z.readApiError)(t,"Failed to create comment"));q("")}catch(e){(0,s.showErrorToast)(e instanceof Error?e.message:"Failed to create comment")}finally{Y(!1)}}},[D,e,$,W,H]),ew=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:E?"flex-shrink-0 border-b border-border px-4 pb-3 pt-4 sm:px-5 sm:pb-4 sm:pt-5":"pb-5",children:eu.length>0?(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,t.jsxs)(P,{className:"flex min-w-0 flex-1 items-center gap-2 text-foreground",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-foreground/90",children:"Review"}),(0,t.jsxs)("span",{className:"text-xs font-normal text-amber-400/80",children:[ev,"/",eu.length," approved"]})]}),E&&(0,t.jsx)(a.SheetClose,{className:"flex-shrink-0 rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50","aria-label":"Close comments",children:(0,t.jsx)(p.X,{className:"h-4 w-4"})})]}):(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)(f.MessageSquare,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground/60"}),(0,t.jsxs)(P,{className:"flex min-w-0 flex-1 items-baseline gap-2 text-foreground",children:[w?(0,t.jsx)("span",{className:"line-clamp-1 text-sm font-medium leading-snug text-foreground",children:w}):(0,t.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:"Comments"}),J.length>0&&(0,t.jsx)("span",{className:"flex-shrink-0 text-xs text-muted-foreground
1/60",children:J.length})]}),B&&J.length>0&&(0,t.jsx)("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:Q?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.Button,{size:"sm",variant:"outline",onClick:ej,disabled:eb,className:"h-6 px-2 text-xs text-red-400 border-red-400/30 hover:bg-red-500/20 bg-transparent",children:eb?(0,t.jsx)(u.Loader2,{className:"w-3 h-3 animate-spin"}):"Delete"}),(0,t.jsx)(o.Button,{size:"sm",variant:"outline",onClick:()=>ee(!1),disabled:eb,className:"h-6 border-border bg-transparent px-2 text-xs text-muted-foreground hover:bg-muted hover:text-foreground",children:"Cancel"})]}):(0,t.jsx)("button",{onClick:()=>ee(!0),className:"rounded-md p-1.5 text-muted-foreground/60 transition-colors hover:bg-muted/60 hover:text-red-400",title:"Delete all comments",children:(0,t.jsx)(x.Trash2,{className:"w-3.5 h-3.5"})})}),E&&(0,t.jsx)(a.SheetClose,{className:"flex-shrink-0 rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50","aria-label":"Close comments",children:(0,t.jsx)(p.X,{className:"h-4 w-4"})})]})}),(0,t.jsx)("div",{className:E?"flex-1 min-h-0 overflow-y-auto px-4 sm:px-5 py-3 sm:py-4 overscroll-contain [-webkit-overflow-scrolling:touch] scrollbar-hide":void 0,children:eu.length>0?(0,t.jsxs)("div",{className:"space-y-2",children:[eu.map(e=>(0,t.jsxs)("div",{className:`flex gap-3 p-2 rounded-lg border transition-all ${e.approved?"border-green-500/30 bg-green-500/5":"border-red-500/30 bg-red-500/5 opacity-60"}`,children:[(0,t.jsx)(r.default,{href:(0,k.agentProfileHref)(e.agentName),className:"relative block h-7 w-7 flex-shrink-0 overflow-hidden rounded-full bg-muted",children:U[e.agentName]?(0,t.jsx)(A.default,{src:U[e.agentName],alt:e.agentName,fill:!0,sizes:"28px",className:"object-cover",unoptimized:U[e.agentName]?.startsWith("http")}):(0,t.jsx)("div",{className:"flex h-full w-full items-center justify-center text-xs font-medium text-foreground",children:e.agentName.charAt(0)})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2 mb-1",children:[(0,t.jsx)(r.default,{href:(0,k.agentProfileHref)(e.agentName),className:"text-sm font-medium text-foreground hover:underline",children:e.agentName}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)("button",{onClick:()=>eh(e.id),className:"rounded p-1 transition-colors hover:bg-muted",title:"Edit",children:(0,t.jsx)(h.Edit2,{className:"h-3 w-3 text-muted-foreground"})}),(0,t.jsx)("button",{onClick:()=>eg(e.id),className:`p-1 rounded transition-colors ${e.approved?"bg-green-500/20 hover:bg-green-500/30":"bg-red-500/20 hover:bg-red-500/30"}`,title:e.approved?"Reject":"Approve",children:e.approved?(0,t.jsx)(m.Check,{className:"w-3 h-3 text-green-400"}):(0,t.jsx)(p.X,{className:"w-3 h-3 text-red-400"})})]})]}),e.editing?(0,t.jsx)(i.Textarea,{value:e.editedText,onChange:t=>
1ex(e.id,t.target.value),className:"min-h-[60px] resize-none border-border bg-muted/60 text-sm text-foreground focus-visible:border-interaction/50 focus-visible:ring-interaction/50",rows:2}):(0,t.jsx)("p",{className:"text-sm leading-relaxed text-foreground/90",children:e.text})]})]},e.id)),(0,t.jsxs)("div",{className:"mt-2 flex gap-2 border-t border-border pt-2",children:[(0,t.jsxs)(o.Button,{size:"sm",variant:"outline",onClick:ef,className:"border-border text-xs text-muted-foreground hover:bg-muted hover:text-foreground",children:[(0,t.jsx)(p.X,{className:"w-3 h-3 mr-1"}),"Discard"]}),(0,t.jsxs)(o.Button,{size:"sm",onClick:ep,disabled:em||0===ev,className:"flex-1 border-0 bg-interaction/20 text-xs text-interaction hover:bg-interaction/30",children:[em?(0,t.jsx)(u.Loader2,{className:"w-3 h-3 mr-1 animate-spin"}):(0,t.jsx)(g.Send,{className:"w-3 h-3 mr-1"}),"Publish ",ev," Comment",1!==ev?"s":""]})]})]}):(0,t.jsxs)("div",{className:"flex flex-col min-h-0",children:[(0,t.jsx)(O,{feedItemId:e,hideAdminPanel:!0,compact:!0}),B&&(0,t.jsxs)("div",{className:"mt-4 border-t border-border pt-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsxs)("button",{onClick:()=>{Z(!X),X||_(!1)},className:`flex items-center gap-2 text-xs transition-colors ${X?"text-interaction":"text-muted-foreground/70 hover:text-foreground"}`,children:[(0,t.jsx)(d.Sparkles,{className:"w-3.5 h-3.5"}),(0,t.jsx)("span",{children:X?"Hide":"Generate..."})]}),(0,t.jsxs)("button",{onClick:()=>{_(!V),V||Z(!1)},className:`flex items-center gap-2 text-xs transition-colors ${V?"text-interaction":"text-muted-foreground/70 hover:text-foreground"}`,children:[(0,t.jsx)(v.PenLine,{className:"w-3.5 h-3.5"}),(0,t.jsx)("span",{children:V?"Hide":"Write..."})]})]}),V&&(0,t.jsxs)("div",{className:"mt-3 space-y-3",children:[(0,t.jsxs)("select",{value:$,onChange:e=>G(e.target.value),className:"h-8 w-full cursor-pointer appearance-none rounded-md border border-border bg-muted/40 px-2 text-xs text-foreground focus:border-interaction/50 focus:outline-none",children:[(0,t.jsx)("option",{value:"",disabled:!0,className:"bg-background",children:"Select agent"}),k.COMMENTING_AGENTS.map(e=>(0,t.jsx)("option",{value:e,className:"bg-background",children:e},e))]}),(0,t.jsx)(i.Textarea,{value:W,onChange:e=>q(e.target.value),placeholder:"Write comment as this agent...",rows:3,className:"resize-none border-border bg-muted/40 text-sm text-foreground placeholder:text-muted-foreground/60 focus-visible:border-interaction/50 focus-visible:ring-interaction/50"}),(0,t.jsxs)(o.Button,{size:"sm",onClick:eC,disabled:K||!$||!W.trim(),className:"w-full border-0 bg-interaction/20 text-xs text-interaction hover:bg-interaction/30",children:[K?(0,t.jsx)(u.Loader2,{className:"w-3 h-3 mr-1 animate-spin"}):(0,t.jsx)(g.Send,{className:"w-3 h-3 mr-1"}),"Post as ",$||"..."]})]}),X&&(0,t.jsxs)("div",{className:"mt-3 space-y-3",children:[(0,t.jsx)(i.Textarea,{value:et,onChange:e=>en(e.target.value),placeholder:"Custom prompt (optional)",rows:2,className:"resize-none border-border bg-muted/40 text-sm text-foreground placeholder:text-muted-foreground/60 focus-visible:border-interaction/50 focus-visible:ring-interaction/50"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:k.COMMENTING_AGENTS.map(e=>(0,t.jsx)(l.Badge,{variant:"outline",className:`cursor-pointer text-xs ${er.includes(e)?"border-interaction/30 bg-interaction/15 text-interaction":"border-border text-muted-foreground hover:border-interaction/30 hover:text-foreground"}`,onClick:()=>es(e),children:e},e))}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsxs)(o.Button,{variant:"outline",size:"sm",onClick:ed,disabled:ei,className:"border-border bg-transparent text-xs text-muted-foreground hover:bg-muted/60 hover:text-foreground",children:[ei?(0,t.jsx)(u.Loader2,{className:"w-3 h-3 mr-1 animate-spin"}):(0,t.jsx)(d.Sparkles,{className:"w-3 h-3 mr-1"}),"Suggest"]}),(0,t.jsxs)(o.Button,{size:"sm",onClick:eo,disabled:ea,className:"border-0 bg-interaction/20 text-xs text-interaction hover:bg-interaction/30",children:[ea?(0,t.jsx)(u.Loader2,{className:"w-3 h-3 mr-1 animate-spin"}):(0,t.jsx)(c.RefreshCw,{className:"w-3 h-3 mr-1"}),"Generate"]})]}),el.length>0&&(0,t.jsx)("div",{className:"space-y-1.5",children:el.map((e,n)=>(0,t.jsxs)("button",{onClick:()=>ec(e),className:"w-full rounded-md border border-border bg-muted/20 p-2.5 text-left text-xs transition-colors hover:bg-muted/40",children:[(0,t.jsx)("div",{className:"font-medium text-foreground
1/90",children:e.agents.join(" + ")}),(0,t.jsx)("p",{className:"mt-0.5 line-clamp-1 text-muted-foreground/70",children:e.description})]},n))})]})]})]})})]});return E?(0,t.jsx)(a.Sheet,{open:y,onOpenChange:N,modal:!1,children:(0,t.jsx)(a.SheetContent,{side:"right",overlayClassName:"bg-transparent",showCloseButton:!1,className:"flex min-h-0 max-h-dvh w-full flex-col overflow-hidden border-l border-border bg-background/95 p-0 sm:w-[440px] sm:max-w-[440px]",onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:ew})}):ew}e.s(["CommentsSection",0,function({feedItemId:e}){return(0,t.jsx)(L,{feedItemId:e,presentation:"inline"})},"CommentsSheet",0,function(e){return(0,t.jsx)(L,{...e,presentation:"sheet"})}],300446)},458612,e=>{"use strict";var t=e.i(843476),n=e.i(271645),r=e.i(282879);e.s([],558762),e.i(558762);var s=e.i(366250),a=e.i(402820),o=e.i(156736),i=e.i(209793),l=e.i(784324),d=e.i(264951),c=e.i(77173);let u=e.i(313488).DialogTrigger;var m=e.i(974217),p=e.i(325326);class g extends p.DialogHandle{}e.s(["Backdrop",()=>a.DialogBackdrop,"Close",()=>o.DialogClose,"Description",()=>i.DialogDescription,"Handle",0,g,"Popup",()=>l.DialogPopup,"Portal",()=>d.DialogPortal,"Root",0,function(e){return(0,s.useRenderDialogRoot)("alert-dialog",e)},"Title",()=>c.DialogTitle,"Trigger",0,u,"Viewport",()=>m.DialogViewport,"createHandle",0,function(){return new g}],734604);var h=e.i(734604),h=h,x=e.i(577255),f=e.i(466691);function v({...e}){return(0,t.jsx)(h.Root,{"data-slot":"alert-dialog",...e})}function b({...e}){return(0,t.jsx)(h.Portal,{"data-slot":"alert-dialog-portal",...e})}function j({className:e,...n}){return(0,t.jsx)(h.Backdrop,{"data-slot":"alert-dialog-overlay",className:(0,x.cn)("fixed inset-0 isolate z-50 bg-background/80 backdrop-blur-sm",e),...n})}function C({className:e,...n}){return(0,t.jsxs)(b,{children:[(0,t.jsx)(j,{}),(0,t.jsx)(h.Popup,{"data-slot":"alert-dialog-content",className:(0,x.cn)("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-lg border bg-background p-6 shadow-lg outline-none sm:max-w-lg",e),...n})]})}function w({className:e,...n}){return(0,t.jsx)("div",{"data-slot":"alert-dialog-header",className:(0,x.cn)("flex flex-col gap-2 text-center sm:text-left",e),...n})}function y({className:e,...n}){return(0,t.jsx)("div",{"data-slot":"alert-dialog-footer",className:(0,x.cn)("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...n})}function N({className:e,...n}){return(0,t.jsx)(h.Title,{"data-slot":"alert-dialog-title",className:(0,x.cn)("text-lg font-semibold",e),...n})}function S({className:e,...n}){return(0,t.jsx)(h.Description,{"data-slot":"alert-dialog-description",className:(0,x.cn)("text-sm text-muted-foreground",e),...n})}function k({className:e,...n}){return(0,t.jsx)(f.Button,{"data-slot":"alert-dialog-action",className:(0,x.cn)(e),...n})}function E({className:e,variant:n="outline",size:r="default",...s}){return(0,t.jsx)(h.Close,{"data-slot":"alert-dialog-cancel",className:(0,x.cn)(e),render:(0,t.jsx)(f.Button,{variant:n,size:r}),...s})}var T=e.i(306662),R=e.i(925466);e.s([],506329),e.i(506329);var A=e.i(828918),I=e.i(146376),P=e.i(502077),D=e.i(956789),O=e.i(675606),M=e.i(56434),F=e.i(474354),z=e.i(875812);let L={checked:e=>e?{"data-checked":""}:{"data-unchecked":""},...F.transitionStatusMapping,...z.fieldValidityMapping};var B=e.i(64350),H=e.i(788015),U=e.i(552245),V=e.i(540886),_=e.i(370359),$=e.i(348990),G=e.i(469690),W=e.i(157153),q=e.i(247778),K=e.i(31421),Y=e.i(538489);let J=n.createContext(void 0);var X=e.i(186698),Z=e.i(733332);let Q=n.createContext(void 0),ee=n.forwardRef(function(e,r){let{render:s,className:a,disabled:o=!1,readOnly:i=!1,required:l=!1,"aria-labelledby":d,value:c,inputRef:u,nativeButton:m=!1,id:p,style:g,...h}=e,x=n.useContext(J),{disabled:f,readOnly:v,required:b,form:j,checkedValue:C,touched:w=!1,validation:y,name:N,setCheckedValue:S=D.NOOP,setTouched:k=D.NOOP,registerInputRef:E=D.NOOP}=x??{},{setTouched:T,setFilled:R,state:F,disabled:z}=(0,G.useFieldRootContext)(),Z=(0,W.useFieldItemContext)(),{labelId:ee,getDescriptionProps:et}=(0,q.useLabelableContext)(),en=z||Z.disabled||f||o,er=v||i,es=b||l,ea=x?C===c:""===c,eo=n.useRef(null),ei=n.useRef(null),el=y?.registerInput,ed=n.useCallback(e=>el?.(e,{controlRef:eo,value:void 0}),[el]),ec=(0,A.useMergedRefs)(u,ei,E,ed);(0,I.useIsoLayoutEffect)(()=>{ei.current?.checked&&R(!0)},[R]),(0,I.useIsoLayoutEffect)(()=>
1{if(ei.current){if(en&&ea)return void E(null);E(ei.current)}},[ea,en,E]);let eu=(0,H.useBaseUiId)(),em=(0,Y.useLabelableId)({id:p}),ep=m?void 0:em,eg={role:"radio","aria-checked":ea,"aria-labelledby":(0,K.useAriaLabelledBy)(d,ee,ei,!m,ep),[_.ACTIVE_COMPOSITE_ITEM]:ea?"":void 0,id:m?em:eu,onKeyDown(e){"Enter"===e.key&&e.preventDefault()},onClick(e){if(e.defaultPrevented||en||er)return;e.preventDefault();let t=ei.current;t&&(0,B.dispatchClickWithModifiers)(t,e)},onFocus(e){e.defaultPrevented||en||er||!w||(ei.current?.click(),k(!1))}},{getButtonProps:eh,buttonRef:ex}=(0,V.useButton)({disabled:en,native:m,composite:!1}),ef={type:"radio",ref:ec,form:j,id:ep,name:N,tabIndex:-1,style:N?P.visuallyHiddenInput:P.visuallyHidden,"aria-hidden":!0,...void 0!==c?{value:(0,X.serializeValue)(c)}:D.EMPTY_OBJECT,disabled:en,checked:ea,required:es,readOnly:er,onChange(e){if(e.nativeEvent.defaultPrevented||en||er||void 0===c)return;let t=(0,O.createChangeEventDetails)(M.REASONS.none,e.nativeEvent);S(c,t),t.isCanceled||T(!0)},onClick(e){e.stopPropagation()},onFocus(){eo.current?.focus()}},ev=n.useMemo(()=>({...F,required:es,disabled:en,readOnly:er,checked:ea}),[F,en,er,ea,es]),eb=void 0!==x,ej=[r,eo,ex],eC=[eg,h,eh,et,y?e=>y.getValidationProps(en,e):D.EMPTY_OBJECT],ew=(0,U.useRenderElement)("span",e,{enabled:!eb,state:ev,ref:ej,props:eC,stateAttributesMapping:L});return(0,t.jsxs)(Q.Provider,{value:ev,children:[eb?(0,t.jsx)($.CompositeItem,{tag:"span",render:s,className:a,style:g,state:ev,refs:ej,props:eC,stateAttributesMapping:L}):ew,(0,t.jsx)("input",{...ef,suppressHydrationWarning:!0})]})});var et=e.i(137584),en=e.i(223910);let er=n.forwardRef(function(e,t){let{render:r,className:s,style:a,keepMounted:o=!1,...i}=e,l=function(){let e=n.useContext(Q);if(void 0===e)throw Error((0,Z.default)(52));return e}(),d=l.checked,{mounted:c,transitionStatus:u,setMounted:m}=(0,en.useTransitionStatus)(d),p={...l,transitionStatus:u},g=n.useRef(null),h=(0,U.useRenderElement)("span",e,{ref:[t,g],state:p,props:i,stateAttributesMapping:L});return((0,et.useOpenChangeComplete)({batch:!0,enabled:!d,open:d,ref:g,onComplete(){d||m(!1)}}),o||c)?h:null});e.s(["Indicator",0,er,"Root",0,ee],66747);var es=e.i(66747),es=es,ea=e.i(951437),eo=e.i(667865),ei=e.i(584446),el=e.i(673327),ed=e.i(405934),ec=e.i(381104);Object.keys(z.DEFAULT_VALIDITY_STATE);let eu=n.createContext(void 0);var em=e.i(884708),ep=e.i(606039);let eg=[el.SHIFT],eh=n.forwardRef(function(e,r){let{render:s,className:a,disabled:o,readOnly:i,required:l,onValueChange:d,value:c,defaultValue:u,form:m,name:p,inputRef:g,id:h,style:x,...f}=e,{setTouched:v,setFocused:b,validationMode:j,name:C,disabled:w,state:y,validation:N,setDirty:S,setFilled:k,validityData:E}=(0,G.useFieldRootContext)(),{labelId:T}=(0,q.useLabelableContext)(),{clearErrors:R,elementRef:A}=(0,em.useFormContext)(),I=function(e=!1){let t=n.useContext(eu);if(!t&&!e)throw Error((0,Z.default)(86));return t}(!0),P=w||o,D=C??p,O=(0,H.useBaseUiId)(h),[M,F]=(0,ea.useControlled)({controlled:c,default:u,name:"RadioGroup",state:"value"}),[L,B]=n.useState(!1),U=(0,eo.useStableCallback)((e,t)=>{d?.(e,t),t.isCanceled||F(e)}),V=N.getInputControl,_=n.useMemo(()=>({get current(){return V()}}),[V]),$=n.useRef(null),W=n.useRef(null);function K(e){let t;return g&&("function"==typeof g?t=g(e):g.current=e),$.current=e,t}let Y=(0,eo.useStableCallback)(e=>{if(!e||e.disabled)return;W.current||(W.current=e);let t=$.current,n=e.checked||null==t||t.disabled?K(e):void 0;return()=>{W.current===e&&(W.current=null),$.current===e?n?(n(),$.current=null):K(null):n?.()}}),X=(0,eo.useStableCallback)(()=>{let e=A.current;if(!e)return M??null;for(let t of N.registeredInputs.keys())if(t.checked&&!t.matches(":disabled")&&(!e||t.form===e||null===t.form&&!t.hasAttribute("form")))return M??null;return null});(0,ec.useRegisterFieldControl)(_,O,M??null,X,!P,p),(0,ep.useValueChanged)(M,()=>{R(D),S(M!==E.initialValue),k(null!=M),N.change(M);let e=W.current;null==M&&e&&!e.disabled&&K(e)});let Q=T??I?.legendId,ee={...y,disabled:P??!1,required:l??!1,readOnly:i??!1},et=n.useMemo(()=>({checkedValue:M,disabled:P,form:m,validation:N,name:D,readOnly:i,registerInputRef:Y,required:l,setCheckedValue:U,setTouched:B,touched:L}),[M,P,m,N,D,i,Y,l,U,B,L]);return(0,t.jsx)(J.Provider,{value:et,children:(0,t.jsx)(ed.CompositeRoot,{render:s,className:a,style:x,state:ee,props:[{id:h,role:"radiogroup","aria-required":l||void 0,"aria-disabled":P||void 0,"aria-readonly":i||void 0,"aria-labelledby":Q,onFocus(){b(!0)},onBlur(e){(0,ei.contains)(e.currentTarget,e.relatedTarget)||(v(!0),b(!1),"onBlur"===j&&N.commit(M))},onKeyDownCapture(e){e.key.startsWith("Arrow")&&(B(!0),b(!0))}},f,e=>N.getValidationProps(P??!1,e)],refs:[r],stateAttributesMapping:z.fieldValidityMapping,enableHomeAndEndKeys:!1,modifierKeys:eg})})});var ex=e.i(456420);let ef={name:"circle",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]};ef.node;let ev=(0,ex.default)(ef);function eb({className:e,...n}){return(0,t.jsx)(eh,{"data-slot":"radio-group",className:(0,x.cn)("grid gap-2",e),...n})}function ej({className:e,...n}){return(0,t.jsx)(es.Root,{"data-slot":"radio-group-item",className:(0,x.cn)("aspect-square h-4 w-4 roun
1ded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...n,nativeButton:!0,render:(0,t.jsx)("button",{type:"button"}),children:(0,t.jsx)(es.Indicator,{"data-slot":"radio-group-indicator",className:"flex items-center justify-center data-unchecked:hidden",children:(0,t.jsx)(ev,{className:"h-2.5 w-2.5 fill-current text-current"})})})}var eC=e.i(831458),ew=e.i(632781),ey=e.i(340186);async function eN({contentId:e,reason:t,details:n,authedFetch:r}){let s=await r("/api/reports",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({contentId:e,reason:t,details:n})}),a=await s.json();return s.ok?{success:!0,id:a.data?.id}:409===s.status?{success:!1,error:"You have already reported this content"}:{success:!1,error:a.error||"Failed to submit report"}}var eS=e.i(769605),ek=e.i(963447),eE=e.i(958789);e.s(["default",0,function({open:e,onOpenChange:s,contentId:a,creatorId:o,onReportSubmitted:i}){let{user:l,blockUser:d}=(0,ek.useAuth)(),c=(0,eE.useAuthedFetch)(),u=(0,n.useId)(),[m,p]=(0,n.useState)(""),[g,h]=(0,n.useState)(""),[x,b]=(0,n.useState)(!1),[j,A]=(0,n.use
1State)(!1),[I,P]=(0,n.useState)(!1),D=async()=>{if(!m)return void(0,eS.showErrorToast)("Please select a reason");if(!l)return void(0,eS.showErrorToast)("You must be logged in to report content");b(!0);try{let e=await eN({contentId:a,reason:m,details:g.trim()||void 0,authedFetch:c});e.success?((0,eS.showSuccessToast)("Report submitted. Thank you for helping keep our community safe."),O(!1),i?.()):(0,eS.showErrorToast)(e.error||"Failed to submit report")}catch(e){console.error("Error submitting report:",e),(0,eS.showErrorToast)("Failed to submit report. Please try again.")}finally{b(!1)}},O=e=>{p(""),h(""),s(e)},M=async()=>{if(!l)return void(0,eS.showErrorToast)("You must be logged in to block a user");let e=(o??"").trim();e?e!==l.uid&&P(!0):(0,eS.showErrorToast)("Unable to identify the creator of this content")},F=async()=>{let e=(o??"").trim();if(l&&e){A(!0);try{await d(e),(0,eS.showSuccessToast)("User blocked. Their content will no longer appear for you."),P(!1),O(!1)}catch(e){console.error("Error blocking user:",e),(0,eS.showErrorToast)("Failed to block user. Please try again.")}finally{A(!1)}}};return(0,t.jsxs)(r.Dialog,{open:e,onOpenChange:(e,t)=>
1{!e&&(x||j)?t.cancel():O(e)},children:[(0,t.jsxs)(r.DialogContent,{className:"sm:max-w-[425px]",children:[(0,t.jsxs)(r.DialogHeader,{children:[(0,t.jsxs)(r.DialogTitle,{className:"flex items-center gap-2",children:[(0,t.jsx)(eC.Flag,{className:"h-5 w-5 text-orange-500"}),"Report Content"]}),(0,t.jsx)(r.DialogDescription,{children:"Help us understand what's wrong with this content. We review all reports and take action when community guidelines are violated."})]}),(0,t.jsxs)("div",{className:"space-y-4 py-4",children:[(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)(R.Label,{id:u,children:"Why are you reporting this? *"}),(0,t.jsx)(eb,{"aria-labelledby":u,value:m,onValueChange:e=>p(e),disabled:x,children:ey.REPORT_REASONS.map(e=>(0,t.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,t.jsx)(ej,{value:e,id:e}),(0,t.jsx)(R.Label,{htmlFor:e,className:"text-sm font-normal cursor-pointer",children:ey.REPORT_REASON_LABELS[e]})]},e))})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(R.Label,{htmlFor:"details",children:"Additional details (optional)"}),(0,t.jsx)(T.Textarea,{id:"details",placeholder:"Provide any additional context that might help us review this report...",value:g,onChange:e=>h(e.target.value),disabled:x,rows:3,className:"resize-none",maxLength:500}),(0,t.jsxs)("p",{className:"text-xs text-muted-foreground text-right",children:[g.length,"/500"]})]})]}),(0,t.jsxs)(r.DialogFooter,{children:[(0,t.jsx)(f.Button,{variant:"outline",onClick:()=>O(!1),disabled:x||j,children:"Cancel"}),o&&(0,t.jsx)(f.Button,{variant:"outline",onClick:M,disabled:x||j,className:"border-red-500/40 text-red-400 hover:bg-red-500/10 hover:text-red-300",children:j?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ew.Loader2,{className:"h-4 w-4 mr-2 animate-spin"}),"Blocking..."]}):"Block user"}),(0,t.jsx)(f.Button,{onClick:D,disabled:x||!m,className:"bg-orange-500 hover:bg-orange-600",children:x?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ew.Loader2,{className:"h-4 w-4 mr-2 animate-spin"}),"Submitting..."]}):"Submit Report"})]})]}),(0,t.jsx)(v,{open:I,onOpenChange:(e,t)=>
1{!e&&j?t.cancel():P(e)},children:(0,t.jsxs)(C,{children:[(0,t.jsxs)(w,{children:[(0,t.jsx)(N,{children:"Block this user?"}),(0,t.jsx)(S,{children:"Their content will immediately disappear from your feed and won't show up again unless you unblock them."})]}),(0,t.jsxs)(y,{children:[(0,t.jsx)(E,{disabled:j,children:"Cancel"}),(0,t.jsx)(k,{onClick:F,disabled:j,className:"bg-red-500 hover:bg-red-600",children:j?"Blocking...":"Block User"})]})]})})]})}],458612)},783236,e=>{"use strict";var t=e.i(843476),n=e.i(271645),r=e.i(282879),s=e.i(466691),a=e.i(306662),o=e.i(925466);e.s(["default",0,function({open:e,onOpenChange:i,onConfirm:l,isSuspending:d,userAlias:c="this user",variant:u="suspendOnly"}){let[m,p]=(0,n.useState)(""),g="suspendAndDelete"===u,h=e=>{d||(p(""),i(e))};return(0,t.jsx)(r.Dialog,{open:e,onOpenChange:(e,t)=>{!e&&d?t.cancel():h(e)},children:(0,t.jsxs)(r.DialogContent,{className:"sm:max-w-[425px]",children:[(0,t.jsxs)(r.DialogHeader,{children:[(0,t.jsx)(r.DialogTitle,{children:g?"Suspend & Delete":"Suspend User"}),(0,t.jsxs)(r.DialogDescription,{children:["Suspend"," ",(0,t.jsx)("span",{className:"font-semibold text-foreground",children:c}
1),"'s account",g?" and delete this content.":"."," They won't be able to sign in until unsuspended."]})]}),(0,t.jsxs)("div",{className:"space-y-4 py-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(o.Label,{htmlFor:"reason",children:"Reason for suspension *"}),(0,t.jsx)(a.Textarea,{id:"reason",placeholder:"Enter the reason for suspending this user...",value:m,onChange:e=>p(e.target.value),disabled:d,rows:4,className:"resize-none"})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:g?"This also removes the post immediately. You can unsuspend the user from the Admin Users page.":"This action is reversible. You can unsuspend the user from the Admin Users page."}),g&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Content deletion is permanent."})]}),(0,t.jsxs)(r.DialogFooter,{children:[(0,t.jsx)(s.Button,{variant:"outline",onClick:()=>h(!1),disabled:d,children:"Cancel"}),(0,t.jsx)(s.Button,{onClick:()=>{m.trim()&&l(m)},disabled:d||!m.trim(),className:g?"bg-red-500 hover:bg-red-600":"bg-orange-500 hover:bg-orange-600",children:d?g?"Applying...":"Suspending...":g?"Suspend & Delete":"Suspend User"})]})]})})}])},992874,e=>{"use strict";var t=e.i(843476),n=e.i(271645),r=e.i(466691),s=e.i(327427),a=e.i(925466),o=e.i(282879),i=e.i(58761);e.s(["default",0,function({open:e,onOpenChange:l,onConfirm:d,title:c="Confirm Action",description:u="Are you sure you want to delete this? This action cannot be undone.",confirmText:m="Delete",isDeleting:p=!1}){let[g,h]=(0,n.useState)(!1),x=e=>{e||h(!1),l(e)};return(0,t.jsx)(o.Dialog,{open:e,onOpenChange:(e,t)=>
1{!e&&p?t.cancel():x(e)},children:(0,t.jsxs)(o.DialogContent,{className:"sm:max-w-md",showCloseButton:!1,children:[(0,t.jsxs)(o.DialogHeader,{children:[(0,t.jsx)(o.DialogTitle,{children:c}),(0,t.jsx)(o.DialogDescription,{children:u})]}),(0,t.jsxs)("div",{className:"flex items-start space-x-2 py-4",children:[(0,t.jsx)(s.Checkbox,{id:"confirm-delete",checked:g,onCheckedChange:h,disabled:p}),(0,t.jsx)(a.Label,{htmlFor:"confirm-delete",className:"cursor-pointer",children:"I understand this action is not reversible."})]}),(0,t.jsxs)(o.DialogFooter,{className:"flex-col sm:flex-row gap-2",children:[(0,t.jsx)(r.Button,{variant:"outline",onClick:()=>x(!1),disabled:p,children:"Cancel"}),(0,t.jsx)(r.Button,{variant:"destructive",onClick:()=>{g&&(h(!1),d())},disabled:p||!g,children:p?(0,t.jsx)(i.Spinner,{size:"sm"}):m})]})]})})}])},486112,e=>{"use strict";var t=e.i(843476),n=e.i(271645),r=e.i(963447),s=e.i(613498),a=e.i(82217),o=e.i(328623),i=e.i(282879),l=e.i(597773),d=e.i(366570),c=e.i(829052),u=e.i(780420),m=e.i(230813);e.s(["default",0,function({open:e,onOpenChange:p,onConfirm:g,isRemixing:h=!1,remixesRemaining:x=0,remixPending:f=0,allocationLoading:v=!1,imageUrl:b,imageAlt:j}){let[C,w]=(0,n.useState)(""),y=c.ADMIN_PERSONAS[0],[N,S]=(0,n.useState)(y),{isAdmin:k}=(0,r.useAuth)(),E=(0,n.useRef)(!1);return(0,t.jsx)(i.Dialog,{open:e,onOpenChange:(e,t)=>
1{!e&&h?t.cancel():p(e)},children:(0,t.jsxs)(i.DialogContent,{overlayClassName:"bg-background/80 backdrop-blur-xl",closeButtonClassName:"bg-background/60 backdrop-blur-xl border border-foreground/10 text-foreground hover:bg-background/80 hover:text-foreground",className:"bg-background border border-border/60 backdrop-blur-xl shadow-2xl text-foreground sm:max-w-lg p-6 gap-0",children:[(0,t.jsx)(i.DialogTitle,{className:"sr-only",children:"Remix This"}),(0,t.jsxs)("div",{className:"space-y-5",children:[(0,t.jsxs)("div",{className:"text-center space-y-1.5",children:[(0,t.jsxs)("div",{className:"relative inline-block mx-auto",children:[(0,t.jsx)("span",{className:`text-2xl md:text-3xl font-black tracking-tight ${(0,s.getTextGradient)("orange")}`,children:"Remix This"}),(0,t.jsx)("div",{className:`absolute inset-0 blur-2xl ${(0,s.getTextGlow)()}`})]}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"Transform this image with your creative vision"})]}),b&&(0,t.jsxs)("div",{className:"relative overflow-hidden rounded-xl border border-border/60 bg-background/40",children:[(0,t.jsx)("img",{src:b,alt:j??"Image to remix",className:"w-full max-h-[28vh] object-contain",loading:"lazy"}),(0,t.jsx)("div",{className:"absolute inset-0 rounded-xl bg-gradient-to-t from-background/40 via-transparent to-transparent pointer-events-none"})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between text-sm px-1",children:[(0,t.jsx)("span",{className:"text-muted-foreground font-medium",children:"Daily Remixes"}),k?(0,t.jsx)("span",{className:"text-interaction font-medium",children:"Unlimited"}):(0,t.jsx)(l.AllocationBadge,{type:"remix",remaining:x,pending:f,variant:"default",size:"sm",loading:v})]}),!k&&0===x&&(0,t.jsx)(l.AllocationWarning,{type:"remix",remaining:0,pending:f,variant:"inline"}),k&&(0,t.jsx)(d.AdminPersonaSelector,{value:N,onChange:S,label:"Persona",placeholder:"Choose or create a persona",showHint:!0}),(0,t.jsx)(u.ComposerPrompt,{value:C,onChange:w,placeholder:"Describe how you want to transform this image...",disabled:h||!k&&0===x}),(0,t.jsx)(m.ComposerSubmitButton,{onClick:()=>{!E.current&&C.trim()&&(E.current=!0,g(C,k?N:void 0),w(""),S(y),p(!1),setTimeout(()=>{E.current=!1},1e3))},disabled:h||0===C.trim().length||!k&&0===x||k&&!N.trim(),isLoading:h,loadingLabel:"Remixing...",spinnerSize:"sm",className:"w-full py-4 h-auto text-base",children:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.Sparkles,{className:"h-4 w-4"}),(0,t.jsx)("span",{children:"Remix Image"}),(0,t.jsx)(a.Repeat2,{className:"h-4 w-4"})]})})]})]})})}])},577596,e=>{"use strict";var t=e.i(843476),n=e.i(271645),r=e.i(174080),s=e.i(466691),a=e.i(924911),o=e.i(769262),i=e.i(282879),l=e.i(668109),d=e.i(577255),c=e.i(191311),u=e.i(406958),m=e.i(958789),p=e.i(963447),g=e.i(829052),h=e.i(571860),x=e.i(412614);
1let f=g.ADMIN_PERSONAS[0];function v(e){return g.ADMIN_PERSONAS.includes(e)}function b(e){return e?.trim()||f}function j(e){return e.trim()||f}e.s(["default",0,function({itemId:e,isNotice:C,votes:w,hasVoted:y,isVoting:N,onVote:S,size:k="sm",className:E,hideVoteCount:T=!1,adminVoteEnabled:R=!1}){let[A,I]=(0,n.useState)(!1),[P,D]=(0,n.useState)(!1),O=`${e}:${C?"notice":"content"}:${w}`,[M,F]=(0,n.useState)({key:"",voters:null,error:null}),[z,L]=(0,n.useState)(null),[B,H]=(0,n.useState)(!1),[U,V]=(0,h.useLocalStorage)("brainrot_admin_vote_persona",{parse:b,serialize:j,serverDefault:f}),[_,$]=(0,n.useState)(f),[G,W]=(0,n.useState)(""),[q,K]=(0,n.useState)(!1),[Y,J]=(0,n.useState)(null),X=(0,n.useRef)(null),Z=(0,n.useRef)(null),Q=(0,n.useRef)(null),ee=(0,n.useRef)(null),et=(0,n.useRef)(!1),{user:en,loading:er}=(0,p.useAuth)(),es=(0,m.useAuthedFetch)(),ea=(0,x.useMediaQuery)("(max-width: 767px), (pointer: coarse)"),eo=M.key===O?M.voters:null,ei=M.key===O?M.error:null,el=(0,n.useCallback)(async()=>{if(e&&z!==O&&!er){if(!en)return void F({key:O,voters:null,error:"Sign in to view voters"});L(O),H(!0),F({key:O,voters:null,error:null});try{let t=await (0,u.fetchVoters)(es,{itemId:e,isNotice:C});F({key:O,voters:t,error:null})}catch(e){console.error("Failed to fetch voters",e),F({key:O,voters:null,error:e instanceof Error?e.message:"Failed to load voters"}),L(null)}finally{H(!1)}}},[er,es,z,C,e,en,O]),ed=(0,n.useCallback)(()=>{if(X.current){let e=X.current.getBoundingClientRect(),t=e.top,n=window.innerHeight-e.bottom,r=t<220&&n>t?"bottom":"top";J({top:"bottom"===r?e.bottom+12:e.top-12,left:e.left+e.width/2,side:r})}},[]),ec=(0,n.useCallback)(()=>{0===w||P||(ed(),el(),I(!0))},[w,P,ed,el]),eu=(0,n.useCallback)(()=>{I(!1)},[]),em=(0,n.useCallback)(()=>{$(U),W(v(U)?"":U),K(!v(U))},[U]),ep=(0,n.useCallback)(e=>{let t=e.trim();t&&(V(t),$(t),W(v(t)?"":t),K(!v(t)),D(!1),S(t))},[S,V]),eg=(0,n.useCallback)(()=>{0===w||P||(Q.current=setTimeout(()=>{ec()},400))},[w,P,ec]),eh=(0,n.useCallback)(()=>{Q.current&&(clearTimeout(Q.current),Q.current=null),eu()},[eu]),ex=(0,n.useCallback)(()=>{0===w||P||(et.current=!1,ee.current=setTimeout(()=>{et.current=!0,ec()},500))},[w,P,ec]),ef=(0,n.useCallback)(()=>{ee.current&&(clearTimeout(ee.current),ee.current=null)},[]),ev=(0,n.useCallback)(()=>{ee.current&&(clearTimeout(ee.current),ee.current=null)},[]),eb=(0,n.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),et.current){et.current=!1;return}if(R){eu(),ea&&(P||em(),D(e=>!e));return}S()},[R,eu,S,P,em,ea]);(0,n.useEffect)(()=>{if(!A)return;let e=e=>{X.current&&!X.current.contains(e.target)&&eu()};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[A,eu]),(0,n.useEffect)(()=>()=>{Q.current&&clearTimeout(Q.current),ee.current&&clearTimeout(ee.current)},[]);let ej=G.trim().length>0,eC=(0,n.useCallback)(e=>{let t=Z.current;t&&!(t.scrollHeight<=t.clientHeight)&&(t.scrollTop+=e.deltaY,e.preventDefault(),e.stopPropagation())},[]),ew=(0,t.jsxs)("div",{className:"flex min-h-0 flex-col gap-3",onWheelCapture:eC,children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-foreground/50",children:"Like As"}),(0,t.jsx)("p",{className:"text-xs text-foreground/70",children:"Pick a persona. This popover flips up or down automatically near the viewport edge."})]}),(0,t.jsx)("div",{ref:Z,className:"min-h-0 flex-1 space-y-1 overflow-y-auto overscroll-contain pr-1 touch-pan-y [-webkit-overflow-scrolling:touch]",children:g.ADMIN_PERSONAS.map(e=>{let n=_===e;return(0,t.jsx)(s.Button,{type:"button",variant:"ghost",size:"sm",className:(0,d.cn)("h-auto w-full justify-start rounded-md px-3 py-2 text-left text-sm",n?"bg-foreground
1/10 text-foreground":"text-foreground/80 hover:bg-foreground/8 hover:text-foreground"),onClick:t=>{t.preventDefault(),t.stopPropagation(),ep(e)},disabled:N,children:e},e)})}),(0,t.jsxs)("div",{className:"border-t border-foreground/10 pt-3",children:[(0,t.jsx)(s.Button,{type:"button",variant:"ghost",size:"sm",className:(0,d.cn)("h-auto w-full justify-start rounded-md px-3 py-2 text-left text-sm",q?"bg-foreground/10 text-foreground":"text-foreground/80 hover:bg-foreground/8 hover:text-foreground"),onClick:e=>{e.preventDefault(),e.stopPropagation(),K(e=>!e),q||W(v(_)?"":_)},disabled:N,children:"Custom persona…"}),q&&(0,t.jsxs)("div",{className:"space-y-2 pt-2",children:[(0,t.jsx)(a.Input,{value:G,onChange:e=>W(e.target.value),placeholder:"Enter a persona name",maxLength:60,disabled:N,onClick:e=>e.stopPropagation(),onKeyDown:e=>{"Enter"===e.key&&ej&&(e.preventDefault(),ep(G))}}),(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsx)(s.Button,{type:"button",size:"sm",onClick:e=>{e.preventDefault(),e.stopPropagation(),ep(G)},disabled:N||!ej,children:N?"Liking...":`Like as ${G.trim()||"..."}`})})]})]})]}),ey=A&&Y&&(0,t.jsxs)("div",{className:"fixed z-popover min-w-[160px] max-w-[220px] rounded-lg bg-background/95 border border-foreground
1/20 shadow-2xl px-3 py-2 pointer-events-auto",style:{top:`${Y.top}px`,left:`${Y.left}px`,transform:"bottom"===Y.side?"translate(-50%, 0)":"translate(-50%, -100%)"},onMouseEnter:()=>{Q.current&&(clearTimeout(Q.current),Q.current=null)},onMouseLeave:eh,children:[(0,t.jsx)("p",{className:"text-[10px] uppercase tracking-wide text-foreground/50 mb-1",children:C?"Supporters":"Liked by"}),B?(0,t.jsx)("p",{className:"text-xs text-foreground/70",children:"Loading…"}):ei?(0,t.jsx)("p",{className:"text-xs text-red-300",children:ei}):eo&&0!==eo.length?(0,t.jsx)("ul",{className:"space-y-1 max-h-40 overflow-y-auto pr-1",children:eo.map(e=>(0,t.jsxs)("li",{className:"text-xs text-foreground/90 flex items-center justify-between gap-3",children:[(0,t.jsx)("div",{className:"flex flex-col",children:(0,t.jsx)("span",{className:"font-medium truncate flex items-center gap-1",children:e.displayName})}),e.votedAt&&(0,t.jsx)("span",{className:"text-[10px] text-foreground/50 whitespace-nowrap",children:(0,c.formatRelative)(e.votedAt)})]},e.id))}):(0,t.jsx)("p",{className:"text-xs text-foreground/60",children:"No likes yet"}),(0,t.jsx)("div",{className:(0,d.cn)("absolute left-1/2 -translate-x-1/2 w-0 h-0 border-l-[6px] border-r-[6px] border-l-transparent border-r-transparent","bottom"===Y.side?"bottom-full -mb-[1px] border-b-[6px] border-b-background/95":"top-full -mt-[1px] border-t-[6px] border-t-background/95")})]}),eN=(0,t.jsxs)(s.Button,{ref:X,type:"button",onClick:eb,onMouseEnter:eg,onMouseLeave:eh,onTouchStart:ex,onTouchEnd:ef,onTouchMove:ev,disabled:N,"aria-label":R?"Like as":void 0,size:k,variant:"ghost",className:(0,d.cn)("flex items-center gap-1 sm:gap-1.5 transition-all duration-300 group relative overflow-hidden select-none",y?"bg-background/20 backdrop-blur-sm border border-foreground
1/20":"hover:bg-interaction/10 hover:text-interaction",E),children:[(0,t.jsx)(l.Heart,{className:(0,d.cn)("transition-all",y?"fill-interaction text-interaction drop-shadow-[0_0_8px_hsl(var(--interaction)/0.6)]":"text-foreground","xs"===k?"h-2.5 w-2.5 sm:h-3 sm:w-3":"sm"===k?"h-2.5 w-2.5 sm:h-3 lg:h-3.5 sm:w-3 lg:w-3.5":"h-3 w-3 sm:h-3.5 lg:h-4 sm:w-3.5 lg:w-4")}),!T&&(0,t.jsx)("span",{className:(0,d.cn)("font-medium select-none text-foreground","xs"===k?"text-[10px] sm:text-xs":"text-xs sm:text-sm"),children:w})]});return(0,t.jsxs)(t.Fragment,{children:[R?ea?(0,t.jsxs)(t.Fragment,{children:[eN,(0,t.jsx)(i.Dialog,{open:P,onOpenChange:D,children:(0,t.jsxs)(i.DialogContent,{overlayClassName:"bg-background/70 backdrop-blur-sm",closeButtonClassName:"bg-background/60 backdrop-blur-xl border border-foreground/10 text-foreground hover:bg-background/80 hover:text-foreground",className:"max-w-[calc(100vw-1.5rem)] overflow-hidden border-foreground/15 bg-background/95 p-0",children:[(0,t.jsx)(i.DialogTitle,{className:"sr-only",children:"Like as"}),(0,t.jsx)("div",{className:"flex max-h-[min(32rem,calc(100dvh-3rem))] min-h-0 flex-col p-4",children:ew})]})})]}):(0,t.jsxs)(o.Popover,{open:P,onOpenChange:e=>{e&&(eu(),em()),D(e)},children:[(0,t.jsx)(o.PopoverTrigger,{render:eN}),(0,t.jsxs)(o.PopoverContent,{side:"top",align:"end",sideOffset:10,collisionAvoidance:{side:"flip",align:"shift",fallbackAxisSide:"none"},collisionPadding:12,initialFocus:!1,className:"flex max-h-[min(28rem,calc(100dvh-6rem))] w-[min(22rem,calc(100vw-1.5rem))] flex-col overflow-hidden border-foreground
1/15 bg-background/95 p-3",onMouseEnter:()=>{Q.current&&(clearTimeout(Q.current),Q.current=null)},children:[(0,t.jsx)(o.PopoverTitle,{className:"sr-only",children:"Like as"}),ew]})]}):eN,"u">typeof document&&ey&&(0,r.createPortal)(ey,document.body)]})}])},769262,e=>{"use strict";var t=e.i(843476);e.s([],158421),e.i(158421);var n=e.i(271645),r=e.i(896499),s=e.i(17989),a=e.i(46420),o=e.i(733332);let i=n.createContext(void 0);function l(e){let t=n.useContext(i);if(void 0===t&&!e)throw Error((0,o.default)(47));return t}var d=e.i(174080),c=e.i(301252),u=e.i(439957),m=e.i(956789),p=e.i(56434),g=e.i(18478),h=e.i(264111),x=e.i(116786),f=e.i(990627),v=e.i(638396);let b={...x.popupStoreSelectors,disabled:e=>e.disabled,instantType:e=>e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,modal:e=>e.modal,focusManagerModal:e=>e.focusManagerModal,stickIfOpen:e=>e.stickIfOpen,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin};class j extends c.ReactStore{constructor(e,t,n){const r=new f.PopupTriggerMap;super(C(e,r,t,n),w(r),b)}setOpen=(e,t)=>{let n,r=t.reason===p.REASONS.triggerHover,s=t.reason===p.REASONS.triggerPress&&0===t.event.detail,a=!e&&(t.reason===p.REASONS.escapeKey||null==t.reason),o=(0,h.attachPreventUnmountOnClose)(t),i=this.select("activeTriggerId");if(e||t.reason!==p.REASONS.closePress||null!=t.trigger||null==i||(t.trigger=this.context.triggerElements.getById(i)??this.select("activeTriggerElement")??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let l=()=>{let n=(0,h.createPopupOpenState)(this.state,e,t.trigger,o());n.openChangeReason=t.reason,this.update(n)};r?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(v.PATIENT_CLICK_THRESHOLD,()=>{this.set("stickIfOpen",!1)}),d.flushSync(l)):l(),s?n="click":a?n="dismiss":t.reason===p.REASONS.focusOut&&(n="focus"),this.set("instantType",n)}}function C(e,t,n,r=!1){let s={...(0,x.createInitialPopupStoreState)(t,n,r),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return s.open&&e?.mounted===void 0&&(s.mounted=!0),s}function w(e){return{popupRef:n.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:n.createRef(),beforeContentFocusGuardRef:n.createRef(),stickIfOpenTimeout:new u.Timeout,triggerElements:e}}var y=e.i(675606);let N=(0,r.fastComponent)(function({props:e}){var r;let s,{children:a,open:o,defaultOpen:l=!1,onOpenChange:d,onOpenChangeComplete:c,modal:u=!1,handle:m,triggerId:g,defaultTriggerId:x=null}=e,f=(r={modal:u,open:l,openProp:o,activeTriggerId:x,triggerIdProp:g},s=(0,h.usePopupRootStore)((e,t)=>new j(r,e,t)),n.useEffect(()=>s.context.stickIfOpenTimeout.disposeEffect(),[s]),s);f.useControlledProp("openProp",o),f.useControlledProp("triggerIdProp",g);let v=f.useState("open"),b=f.useState("mounted"),C=f.useState("payload");f.useContextCallback("onOpenChange",d),f.useContextCallback("onOpenChangeComplete",c),(0,h.usePopupRootSync)(f,v),(0,h.useImplicitActiveTrigger)(f);let{forceUnmount:w}=(0,h.useOpenStateTransitions)(v,f,()=>{f.update({stickIfOpen:!0,openChangeReason:null})});f.useSyncedValues({modal:u}),n.useEffect(()=>{v||f.context.stickIfOpenTimeout.clear()},[f,v]),n.useImperativeHandle(e.actionsRef,()=>({unmount:w,close:()=>f.setOpen(!1,(0,y.createChangeEventDetails)(p.REASONS.imperativeAction))}),[w,f]);let N=v||b;return(0,t.jsxs)(i.Provider,{value:f,children:[m&&(0,t.jsx)(h.PopupHandleAttachment,{handle:m,store:f}),N&&(0,t.jsx)(S,{store:f,modal:u}),"function"==typeof a?a({payload:C}):a]})});function S({store:e,modal:t}){let n=e.useState("floatingRootContext"),r=(0,s.useDismiss)(n,{outsidePressEvent:{mouse:"trap-focus"===t?"sloppy":"intentional",touch:"sloppy"}}),a=r.reference,o=r.floating;return(0,h.usePopupInteractionProps)(e,{activeTriggerProps:a,inactiveTriggerProps:a,popupProps:o}),null}var k=e.i(540886),E=e.i(879938),T=e.i(552245),R=e.i(650316),A=e.i(385689),I=e.i(872135),P=e.i(788015),D=e.i(152535),O=e.i(459636),M=e.i(346570),F=e.i(32199);let z=(0,r.fastComponentRef)(function(e,r){let{render:s,className:a,style:i,disabled:d=!1,nativeButton:c=!0,handle:u,payload:m,openOnHover:g=!1,delay:x=300,closeDelay:f=0,id:b,...j}=e,C=l(!0),w=(0,O.usePopupHandleStore)(u)??C;if(!w)throw Error((0,o.default)(74));let y=(0,P.useBaseUiId)(b),N=w.useState("isTriggerActive",y),S=w.useState("floatingRootContext"),z=w.useState("isOpenedByTrigger",y),L=w.useState("triggerPopupId",y),B=n.useRef(null),{registerTrigger:H,isMountedByThisTrigger:U}=(0,h.useTriggerDataForwarding)(y,B,w,{payload:m,disabled:d,openOnHover:g,closeDelay:f}),V=w.useState("openChangeReason"),_=w.useState("stickIfOpen"),$=w.useState("openMethod"),G=w.useState("focusManagerModal"),W=(0,I.useHoverReferenceInteraction)(S,{enabled:!d&&g&&("touch"!==$||V!==
1p.REASONS.triggerPress),mouseOnly:!0,move:!1,handleClose:(0,R.safePolygon)(),restMs:x,delay:{close:f},triggerElementRef:B,isActiveTrigger:N,isClosing:()=>"ending"===w.select("transitionStatus")}),q=(0,A.useClick)(S,{stickIfOpen:_}),K=(0,F.useOpenMethodTriggerProps)(()=>w.select("open"),e=>{w.set("openMethod",e)}),Y=w.useState("triggerProps",U),{getButtonProps:J,buttonRef:X}=(0,k.useButton)({disabled:d,native:c}),{preFocusGuardRef:Z,handlePreFocusGuardFocus:Q,handleFocusTargetFocus:ee}=(0,M.useTriggerFocusGuards)(w,B),et=(0,T.useRenderElement)("button",e,{state:{disabled:d,open:z},ref:[X,r,H,B],props:[q.reference,W,Y,K,{[v.CLICK_TRIGGER_IDENTIFIER]:"",id:y,"aria-haspopup":"dialog","aria-expanded":z,"aria-controls":L},j,J],stateAttributesMapping:{open:e=>e&&V===p.REASONS.triggerPress?E.pressableTriggerOpenStateMapping.open(e):E.triggerOpenStateMapping.open(e)}}),en=(0,t.jsx)(n.Fragment,{children:et},y);return U&&!G?(0,t.jsxs)(n.Fragment,{children:[(0,t.jsx)(D.FocusGuard,{ref:Z,onFocus:Q}),en,(0,t.jsx)(D.FocusGuard,{ref:w.context.triggerFocusTargetRef,onFocus:ee})]}):en});var L=e.i(726674);let B=n.createContext(void 0),H=n.forwardRef(function(e,n){let{keepMounted:r=!1,...s}=e;return l().useState("mounted")||r?(0,t.jsx)(B.Provider,{value:r,children:(0,t.jsx)(L.FloatingPortal,{ref:n,...s})}):null});var U=e.i(144394),V=e.i(146376);let _=n.createContext(void 0);function $(){let e=n.useContext(_);if(!e)throw Error((0,o.default)(46));return e}var G=e.i(923706),W=e.i(426),q=e.i(222640),K=e.i(789579),Y=e.i(33383);let J=n.forwardRef(function(e,r){let{render:s,className:i,style:d,anchor:c,positionMethod:u,side:m,align:g,sideOffset:h,alignOffset:x,collisionBoundary:f="clipping-ancestors",collisionPadding:b,arrowPadding:j,sticky:C,disableAnchorTracking:w=!1,collisionAvoidance:y=v.POPUP_COLLISION_AVOIDANCE,...N}=e,S=l(),k=function(){let e=n.useContext(B);if(void 0===e)throw Error((0,o.default)(45));return e}(),E=(0,a.useFloatingNodeId)(),T=S.useState("floatingRootContext"),R=S.useState("mounted"),A=S.useState("open"),I=S.useState("openChangeReason"),P=S.useState("activeTriggerElement"),D=S.useState("modal"),O=S.useState("openMethod"),M=S.useState("positionerElement"),F=S.useState("instantType"),z=S.useState("transitionStatus"),L=S.useState("adaptiveOrigin"),H=n.useRef(null),$=(0,q.useAnimationsFinished)(M),J=(0,G.useAnchorPositioning)({anchor:c,floatingRootContext:T,positionMethod:u,mounted:R,side:m,sideOffset:h,align:g,alignOffset:x,arrowPadding:j,collisionBoundary:f,collisionPadding:b,sticky:C,disableAnchorTracking:w,keepMounted:k,nodeId:E,collisionAvoidance:y,adaptiveOrigin:L}),X=T.useState("domReferenceElement");(0,V.useIsoLayoutEffect)(()=>{let e=H.current;if(X&&(H.current=X),e&&X&&X!==e){S.set("instantType",void 0);let e=new AbortController;return $(()=>{S.set("instantType","trigger-change")},e.signal),()=>{e.abort()}}},[X,$,S]);let Z=!0===D&&I!==p.REASONS.triggerHover;(0,Y.useAnchoredPopupScrollLock)(A&&Z,"touch"===O,M,P);let Q=S.useStateSetter("positionerElement"),ee={open:A,side:J.side,align:J.align,anchorHidden:J.anchorHidden,instant:F},et=(0,K.usePositioner)(e,ee,{styles:J.positionerStyles,transitionStatus:z,props:N,refs:[r,Q],hidden:!R,inert:!A});return(0,t.jsxs)(_.Provider,{value:J,children:[R&&Z&&(0,t.jsx)(W.InternalBackdrop,{inert:(0,U.inertValue)(!A),cutout:P}),(0,t.jsx)(a.FloatingNode,{id:E,children:et})]})});var X=e.i(229315),Z=e.i(61487),Q=e.i(431157),ee=e.i(137584),et=e.i(673327),en=e.i(96533),er=e.i(253984),es=e.i(667865);let ea=n.createContext(void 0),eo=n.forwardRef(function(e,r){let{render:s,className:a,style:o,initialFocus:i,finalFocus:d,...c}=e,u=l(),m=$(),g=null!=(0,en.useToolbarRootContext)(!0),{context:x,hasClosePart:f}=function(){let[e,t]=n.useState(0),r=(0,es.useStableCallback)(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:n.useMemo(()=>({register:r}),[r]),hasClosePart:e>0}}(),v=u.useState("open"),b=u.useState("openMethod"),j=u.useState("instantType"),C=u.useState("transitionStatus"),w=u.useState("popupProps"),y=u.useState("titleElementId"),N=u.useState("descriptionElementId"),S=u.useState("modal"),k=u.useState("mounted"),R=u.useState("openChangeReason"),A=u.useState("activeTriggerElement"),I=u.useState("floatingRootContext"),P=I.useState("floatingId"),D=u.useState("disabled"),O=u.useState("openOnHover"),M=u.useState("closeDelay");(0,ee.useOpenChangeComplete)({open:v,ref:u.context.popupRef,onComplete(){v&&u.context.onOpenChangeComplete?.(!0)}}),(0,Q.useHoverFloatingInteraction)(I,{enabled:O&&!D,closeDelay:M});let F=void 0===i?(0,h.createDefaultInitialFocus)(u.context.popupRef):i,z=!1!==S&&f;u.useSyncedValue("focusManagerModal",z);let L=u.useStateSetter("popupElement"),B={open:v,side:m.side,align:m.align,instant:j,transitionStatus:C},H=(0,T.useRenderElement)("div",e,{state:B,ref:[r,u.context.popupRef,L],props:[w,{id:P,role:"dialog",...h.FOCUSABLE_POPUP_PROPS,"aria-labelledby":y,"aria-describedby":N,onKeyDown(e){g&&et.COMPOSITE_KEYS.has(e.key)&&e.stopPropagation()}},(0,er.getDisabledMountTransitionStyles)(C),c],stateAttributesMapping:E.popupTransitionStateMapping});return(0,t.jsx)(Z.FloatingFocusManager,{context:I,openInteractionType:b,modal:z,disabled:!k||R===p.REASONS.triggerHover,initialFocus:F,returnFocus:d,restoreFocus:"popup",previousFocusableElement:(0,X.isHTMLElement)(A)?A:void 0,nextFocusableElement:u.context.triggerFocusTargetRef,beforeContentFocusGuardRef:u.context.beforeContentFocusGuardRef,children:(0,t.jsx)(ea.Provider,{value:x,children:H})})}),ei=n.forwardRef(function(e,t){let{render:n,className:r,style:s,...a}=e,o=l().useState("open"),{arrowRef:i,side:d,align:c,arrowUncentered:u,arrowStyles:m}=$();return(0,T.useRenderElement)("div",e,{state:{open:o,side:d,align:c,uncentered:u},ref:[t,i],props:[{style:m,"aria-hidden":!0},a],stateAttributesMapping:E.popupStateMapping})}),el=n.forwardRef(function(e,t){let{render:n,className:r,style:s,...a}
1=e,o=l(),i=o.useState("open"),d=o.useState("mounted"),c=o.useState("transitionStatus"),u=o.useState("openChangeReason");return(0,T.useRenderElement)("div",e,{state:{open:i,transitionStatus:c},ref:t,props:[{role:"presentation",hidden:!d,style:{pointerEvents:u===p.REASONS.triggerHover?"none":void 0,userSelect:"none",WebkitUserSelect:"none"}},a],stateAttributesMapping:E.popupTransitionStateMapping})}),ed=n.forwardRef(function(e,t){let{render:n,className:r,style:s,...a}=e,o=l(),i=(0,P.useBaseUiId)(a.id);return o.useSyncedValueWithCleanup("titleElementId",i),(0,T.useRenderElement)("h2",e,{ref:t,props:[{id:i},a]})}),ec=n.forwardRef(function(e,t){let{render:n,className:r,style:s,...a}=e,o=l(),i=(0,P.useBaseUiId)(a.id);return o.useSyncedValueWithCleanup("descriptionElementId",i),(0,T.useRenderElement)("p",e,{ref:t,props:[{id:i},a]})}),eu=n.forwardRef(function(e,t){let r,{render:s,className:a,style:o,disabled:i=!1,nativeButton:d=!0,...c}=e,{buttonRef:u,getButtonProps:m}=(0,k.useButton)({disabled:i,focusableWhenDisabled:!1,native:d}),g=l();return r=n.useContext(ea),(0,V.useIsoLayoutEffect)(()=>r?.register(),[r]),(0,T.useRenderElement)("button",e,{ref:[t,u],props:[{onClick(e){g.setOpen(!1,(0,y.createChangeEventDetails)(p.REASONS.closePress,e.nativeEvent))}},c,m]})});var em=e.i(818390);let ep=n.forwardRef(function(e,t){let{render:n,className:r,style:s,children:a,...o}=e,i=l(),{side:d}=$(),c=i.useState("instantType"),{children:u,state:m}=(0,em.usePopupViewport)({store:i,side:d,children:a}),p={activationDirection:m.activationDirection,transitioning:m.transitioning,instant:c};return(0,T.useRenderElement)("div",e,{state:p,ref:t,props:[o,{children:u}],stateAttributesMapping:em.popupViewportStateMapping})});var eg=e.i(564170);class eh extends eg.BasePopupHandle{constructor(){super(function(){let e=new f.PopupTriggerMap;return Object.assign(new g.NullStore(Object.freeze(C(void 0,e)),Object.freeze(w(e)),b),{setOpen:m.NOOP})}(),"Popover")}open(e){this.openByTrigger(e)}close(){this.closePopup()}get isOpen(){return this.attachedStore?.select("open")??!1}}e.s(["Arrow",0,ei,"Backdrop",0,el,"Close",0,eu,"Description",0,ec,"Handle",0,eh,"Popup",0,eo,"Portal",0,H,"Positioner",0,J,"Root",0,function(e){return l(!0)?(0,t.jsx)(N,{props:e}):(0,t.jsx)(a.FloatingTree,{children:(0,t.jsx)(N,{props:e})})},"Title",0,ed,"Trigger",0,z,"Viewport",0,ep,"createHandle",0,function(){return new eh}],466914);var ex=e.i(466914),ex=ex,ef=e.i(577255);e.s(["Popover",0,function(e){return(0,t.jsx)(ex.Root,{"data-slot":"popover",...e})},"PopoverContent",0,function({align:e="center",alignOffset:n=0,anchor:r,collisionAvoidance:s,collisionBoundary:a,collisionPadding:o,positionMethod:i,side:l="bottom",sideOffset:d=4,sticky:c,className:u,...m}){return(0,t.jsx)(ex.Portal,{children:(0,t.jsx)(ex.Positioner,{align:e,alignOffset:n,anchor:r,collisionAvoidance:s,collisionBoundary:a,collisionPadding:o,positionMethod:i,side:l,sideOffset:d,sticky:c,className:"pointer-events-auto isolate z-50",children:(0,t.jsx)(ex.Popup,{"data-slot":"popover-content",className:(0,ef.cn)("z-50 w-72 origin-(--transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none transition-[transform,opacity] duration-150 ease-out data-ending-style:scale-95 data-ending-style:opacity-0 data-instant:transition-none data-starting-style:scale-95 data-starting-style:opacity-0 motion-reduce:transition-none",u),...m})})})},"PopoverTitle",0,function({className:e,...n}){return(0,t.jsx)(ex.Title,{"data-slot":"popover-title",className:(0,ef.cn)("font-medium",e),...n})},"PopoverTrigger",0,function(e){return(0,t.jsx)(ex.Trigger,{"data-slot":"popover-trigger",...e})}],769262)},571860,e=>{"use strict";var t=e.i(271645);function n(e){return`local-storage:${e}`}e.s(["useLocalStorage",0,function(e,{parse:r,serialize:s,serverDefault:a}){let o=(0,t.useCallback)(t=>{let r=()=>t(),s=n=>{(null===n.key||n.key===e)&&t()};return window.addEventListener("storage",s),window.addEventListener(n(e),r),()=>{window.removeEventListener("storage",s),window.removeEventListener(n(e),r)}},[e]),i=(0,t.useCallback)(()=>r(localStorage.getItem(e)),[e,r]),l=(0,t.useCallback)(()=>a,[a]);return[(0,t.useSyncExternalStore)(o,i,l),(0,t.useCallback)(t=>{let r=s(t);localStorage.getItem(e)!==r&&(localStorage.setItem(e,r),window.dispatchEvent(new Event(n(e))))},[e,s])]}])},668109,e=>{"use strict";var t=e.i(456420);let n={name:"heart",size:24,node:[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]]};n.node;let r=(0,t.default)(n);e.s(["Heart",0,r],668109)},179490,325597,985560,326832,648119,306698,e=>{"use strict";var t=e.i(456420);let n={name:"pen",size:24,node:[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],aliases:["edit-2"]};n.node;let r=(0,t.default)(n);e.s(["Edit2",0,r],179490);let s={name:"pen-line",size:24,node:[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],aliases:["edit-3"]};s.node;let a=(0,t.default)(s);e.s(["PenLine",0,a],325597);var o=e.i(271645),i=e.i(958789),l=e.i(406958);e.i(436180);var d=e.i(403657),c=e.i(615051),u=e.i(681307),m=e.i(150068);let p=u.z.string().min(1).refine(e=>e.trim().length>0,"must not be blank"),g=u.z.looseObject({feedItemId:p,agentName:m.stringOrUndefined,text:m.stringOrUndefined,createdAt:m.storedDate,upvotes:m.numberOrZero}).transform(e=>({feedItemId:e.feedItemId,agentName:e.agentName??"",text:e.text??"",createdAt:e.createdAt,upvotes:e.upvotes}));
1u.z.strictObject({id:p,feedItemId:p,agentName:p,text:p,createdAt:m.storageTimestampSchema,upvotes:u.z.literal(0)}),(0,m.readConverter)(g,{logScope:"comments"}),(0,m.nullableReadConverter)(g,{logScope:"comments"});let h=u.z.string().min(1).refine(e=>e===e.trim(),"must not have surrounding whitespace"),x=/^comment-upvote-[A-Za-z0-9_-]{43}$/,f=u.z.strictObject({id:h,userId:h,commentId:h,feedItemId:h,timestamp:m.storageTimestampSchema}).superRefine((e,t)=>{x.test(e.id)||t.addIssue({code:"custom",path:["id"],message:"expected canonical comment-upvote id"})}),v={toFirestore:e=>e,fromFirestore:e=>{var t,n;let r,s=(t=e.id,n=e.data(),(r=f.safeParse(n)).success?r.data.id!==t?{success:!1,detail:[{code:"custom",path:["id"],message:"stored comment-upvote id does not match its document id"}]}:{success:!0,data:r.data}:{success:!1,detail:r.error.issues});if(s.success)return s.data;throw console.warn(`[commentUpvotes] canonical schema parse failed for ${e.ref.path}`,s.detail),Error(`Invalid canonical comment-upvote document: ${e.ref.path}`)}};function b({db:e,feedItemId:t,enabled:n=!0}){let[r,s]=(0,o.useState)([]),[a,i]=(0,o.useState)(!0);return(0,o.useEffect)(()=>{if(!n||!t){s([]),i(!1);return}i(!0);let r=(0,d.collection)(e,"feed_items",t,"comments"),a=(0,c.query)(r,(0,c.orderBy)("createdAt","asc")),o=(0,c.onSnapshot)(a,e=>{s(e.docs.map(e=>(function(e,t,n){let r=g.safeParse(n);if(!r.success)return null;let s=r.data;return s.feedItemId!==t?null:{id:e,feedItemId:s.feedItemId,agentName:s.agentName,text:s.text,createdAt:s.createdAt??new Date(0),upvotes:s.upvotes}})(e.id,t,e.data())).filter(e=>null!==e)),i(!1)},e=>{console.error("Error fetching comments:",e),i(!1)});return()=>o()},[e,t,n]),{comments:r,loading:a}}e.s(["useCommentFetching",0,b],985560),e.s(["useCommentThread",0,function({db:e,user:t,feedItemId:n,enabled:r=!0,enableUpvotes:s=!0}){let a=(0,i.useAuthedFetch)(),[u,m]=(0,o.useState)(null),{comments:p,loading:g}=b({db:e,feedItemId:n,enabled:r}),{hasUpvoted:h,addUpvote:x,removeUpvote:f}=function({db:e,user:t,feedItemId:n,enabled:r=!0}){let[s,a]=(0,o.useState)([]),[i,l]=(0,o.useState)(!0);(0,o.useEffect)(()=>{if(!r||!t?.uid||!n){a([]),l(!1);return}l(!0);let s=(0,c.query)((0,d.collection)(e,"commentUpvotes").withConverter(v),(0,c.where)("userId","==",t.uid),(0,c.where)("feedItemId","==",n));return(0,c.onSnapshot)(s,e=>{a(e.docs.map(e=>e.data().commentId).filter(e=>!!e)),l(!1)},e=>{console.error("[useCommentUpvotes] subscription error:",e),l(!1)})},[t?.uid,n,e,r]);let u=(0,o.useMemo)(()=>new Set(s),[s]),m=(0,o.useMemo)(()=>e=>u.has(e),[u]);return{upvotedCommentIds:u,hasUpvoted:m,loading:i,addUpvote:(0,o.useMemo)(()=>e=>{a(t=>t.includes(e)?t:[...t,e])},[]),removeUpvote:(0,o.useMemo)(()=>e=>{a(t=>t.filter(t=>t!==e))},[])}}({db:e,user:t,feedItemId:n,enabled:r&&s}),j=(0,o.useCallback)(async e=>{if(!t||!s)return;m(e);let r=h(e);r?f(e):x(e);try{await (0,l.upvoteComment)(a,{feedItemId:n,commentId:e})}catch(t){r?x(e):f(e),console.error("Error upvoting comment:",t)}finally{m(null)}},[a,t,n,s,h,x,f]);return{comments:p,loading:g,hasUpvoted:h,handleUpvote:j,upvotingCommentId:u}}],326832);let j={name:"ellipsis",size:24,node:[["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"}]],aliases:["more-horizontal"]};j.node;let C=(0,t.default)(j);e.s(["MoreHorizontal",0,C],648119),e.i(829052),e.s([],306698)},82217,982954,e=>{"use strict";var t=e.i(456420);let n={name:"repeat-2",size:24,node:[["path",{d:"m2 9 3-3 3 3",key:"1ltn5i"}],["path",{d:"M13 18H7a2 2 0 0 1-2-2V6",key:"1r6tfw"}],["path",{d:"m22 15-3 3-3-3",key:"4rnwn2"}],["path",{d:"M11 6h6a2 2 0 0 1 2 2v10",key:"2f72bc"}]]};n.node;let r=(0,t.default)(n);e.s(["Repeat2",0,r],82217);let s={name:"shield",size:24,node:[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]};s.node;let a=(0,t.default)(s);e.s(["Shield",0,a],982954)},771139,e=>{"use strict";var t=e.i(456420);let n={name:"user-x",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]};n.node;let r=(0,t.default)(n);e.s(["UserX",0,r],771139)},296318,e=>{"use strict";var t=e.i(829052),n=e.i(858674),r=e.i(496509);let s="yours";function a(e,t){let n=t?.trim();return!!n&&(0,r.isResidentChippuAlias)(e)&&e===(0,r.getChippuAlias)(n)}e.s(["OWN_CHIPPU_MARK",0,s,"commentAuthorView",0,function(e,s){let o=(0,r.isResidentChippuAlias)(e);return{name:e,resident:o,yours:a(e,s),portraitName:o?n.RESIDENT_RESEARCHER_NAME:e,profileHref:o||!e.trim()?null:(0,t.agentProfileHref)(e)}},"viewerAuthorLabel",0,function(e,t){return a(e,t)?`${e} \xb7 ${s}`:e}])},12822,e=>{"use strict";var t=e.i(271645);e.i(436180);var n=e.i(403657),r=e.i(615051);e.s(["useCommentCount",0,function({db:e,feedItemId:s,isAdmin:a=!1,initialCount:o}){let i=void 0!==o,[l,d]=(0,t.useState)(o??0),[c,u]=(0,t.useState)(o);return o!==c&&(u(o),void 0!==o&&d(o)),(0,t.useEffect)(()=>{i||!s||(async()=>
1{try{let t=(0,n.collection)(e,"feed_items",s,"comments"),a=await (0,r.getCountFromServer)(t);d(a.data().count)}catch(e){console.error("Error fetching comment count:",e)}})()},[e,s,i]),{commentCount:l,showCommentsButton:a||l>0}}])},149940,153909,e=>{"use strict";var t=e.i(271645);e.i(306698);var n=e.i(829052),r=e.i(767316);function s(e,t){e[t]++,e.inFlight[t]?.abort()}function a(e,t){s(e,t);let n=e[t],r=new AbortController;return e.inFlight[t]=r,{signal:r.signal,isCurrent:()=>e.active&&e[t]===n}}e.s(["useCommentGeneration",0,function({feedItemId:e,userId:o,authedFetch:i}){let l=(0,t.useMemo)(()=>({feedItemId:e,owner:o,active:!1,generation:0,suggestion:0,publication:0,inFlight:{}}),[e,o]);(0,t.useLayoutEffect)(()=>(l.active=!0,()=>{l.active=!1,s(l,"generation"),s(l,"suggestion"),s(l,"publication")}),[l]);let[d,c]=(0,t.useState)([]),[u,m]=(0,t.useState)(""),[p,g]=(0,t.useState)(!1),[h,x]=(0,t.useState)(!1),[f,v]=(0,t.useState)([]),[b,j]=(0,t.useState)([]),[C,w]=(0,t.useState)(!1),[y,N]=(0,t.useState)(null),[S,k]=(0,t.useState)(l);S!==l&&(k(l),c([]),m(""),g(!1),x(!1),v([]),j([]),N(null),w(!1));let E=(0,t.useCallback)(e=>{l.active&&c(t=>t.includes(e)?t.filter(t=>t!==e):t.length<4?[...t,e]:t)},[l]),T=(0,t.useCallback)(async t=>{if(!o||!e||!l.active)return;let{signal:n,isCurrent:s}=a(l,"generation"),p=t?.preview??!1;g(!0);try{let t=await i("/api/admin/generate-comments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({feedItemId:e,customPrompt:u||void 0,agentNames:d.length>=1?d:void 0,...p?{preview:!0}:{}}),signal:n});if(!t.ok)throw Error(await (0,r.readApiError)(t,"Failed to generate comments"));if(p){let e=await t.json(),n=e.data?.comments||[];if(!s())return;N(l),j(n.map(e=>({id:e.id,agentName:e.agentName,text:e.text,approved:!0,editing:!1,editedText:e.text})))}if(!s())return;m(""),c([]),v([])}catch(e){if(!s())return;throw console.error("Error generating comments:",e),e}finally{s()&&g(!1)}},[o,e,u,d,i,l]),R=(0,t.useCallback)(async()=>{if(!o||!l.active)return;if(y!==l||!y.feedItemId)throw Error("Comment preview no longer belongs to this editing session");let e=b.filter(e=>e.approved).map(e=>({id:e.id,agentName:e.agentName,text:e.editing?e.editedText:e.text}));if(0===e.length)throw Error("No comments approved for publishing");let t=l.generation,{signal:n,isCurrent:s}=a(l,"publication");w(!0);try{let a=await i("/api/admin/publish-comments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({feedItemId:y.feedItemId,comments:e}),signal:n});if(!a.ok)throw Error(await (0,r.readApiError)(a,"Failed to publish comments"));s()&&l.generation===t&&(j([]),N(null))}catch(e){if(!s())return;throw console.error("Error publishing comments:",e),e}finally{s()&&w(!1)}},[o,b,y,i,l]),A=(0,t.useCallback)(async()=>{if(!o||!e||!l.active)return;let{signal:t,isCurrent:n}=a(l,"suggestion");x(!0);try{let r=await i("/api/admin/suggest-comment-angles",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({feedItemId:e}),signal:t});if(!r.ok)throw Error("Failed to get suggestions");let s=await r.json();n()&&v(s.data?.suggestions||[])}catch(e){if(!n())return;console.error("Error getting suggestions:",e)}finally{n()&&x(!1)}},[o,e,i,l]),I=(0,t.useCallback)(e=>{l.active&&(m(e.prompt),c(e.agents.filter(e=>n.COMMENTING_AGENTS.includes(e))))},[l]),P=(0,t.useCallback)(e=>{l.active&&j(t=>t.map(t=>t.id===e?{...t,approved:!t.approved}:t))},[l]),D=(0,t.useCallback)(e=>{l.active&&j(t=>t.map(t=>t.id===e?{...t,editing:!t.editing,editedText:t.text}:t))},[l]),O=(0,t.useCallback)((e,t)=>{l.active&&j(n=>n.map(n=>n.id===e?{...n,editedText:t,text:t}:n))},[l]),M=(0,t.useCallback)(()=>{l.active&&(s(l,"generation"),g(!1),j([]),N(null))},[l]),F=(0,t.useCallback)(e=>{l.active&&m(e)},[l]),z=b.filter(e=>e.approved).length;return{selectedAgents:d,toggleAgent:E,customPrompt:u,setCustomPrompt:F,generating:p,handleGenerate:T,suggestingAngles:h,suggestions:f,handleSuggestAngles:A,applySuggestion:I,pendingComments:b,publishing:C,handlePublish:R,toggleApproval:P,toggleEdit:D,updateEditedText:O,discardPending:M,approvedCount:z}}],149940),e.s(["useCommentModeration",0,function({feedItemId:e,userId:n,authedFetch:s}){let[a,o]=(0,t.useState)(null),[i,l]=(0,t.useState)(""),[d,c]=(0,t.useState)(!1),[u,m]=(0,t.useState)(null),[p,g]=(0,t.useState)(!1),h=(0,t.useCallback)((e,t)=>{o(e),l(t)},[]),x=(0,t.useCallback)(()=>{o(null),l("")},[]),f=(0,t.useCallback)(async()=>
1{if(n&&a){c(!0);try{let t=await s("/api/admin/comments",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({feedItemId:e,commentId:a,text:i})});if(!t.ok)throw Error(await (0,r.readApiError)(t,"Failed to update comment"));o(null),l("")}catch(e){throw console.error("Error updating comment:",e),e}finally{c(!1)}}},[n,e,a,i,s]),v=(0,t.useCallback)(e=>{m(e)},[]),b=(0,t.useCallback)(()=>{m(null)},[]);return{editingCommentId:a,editText:i,savingEdit:d,deletingCommentId:u,deletingAll:p,startEditing:h,cancelEditing:x,setEditText:l,handleSaveEdit:f,startDeleting:v,cancelDeleting:b,handleDeleteComment:(0,t.useCallback)(async t=>{if(n){m(t);try{let n=await s(`/api/admin/comments?feedItemId=${encodeURIComponent(e)}&commentId=${encodeURIComponent(t)}`,{method:"DELETE"});if(!n.ok)throw Error(await (0,r.readApiError)(n,"Failed to delete comment"))}catch(e){throw console.error("Error deleting comment:",e),e}finally{m(null)}}},[n,e,s]),handleDeleteAllComments:(0,t.useCallback)(async()=>{if(n){g(!0);try{let t=await s(`/api/admin/comments?feedItemId=${encodeURIComponent(e)}&all=true`,{method:"DELETE"});if(!t.ok)throw Error(await (0,r.readApiError)(t,"Failed to delete all comments"))}catch(e){throw console.error("Error deleting all comments:",e),e}finally{g(!1)}}},[n,e,s])}}],153909)},406958,e=>{"use strict";var t=e.i(693668),n=e.i(767316);let r="/api/engagement";class s extends Error{status;constructor(e,t){super(e),this.status=t,this.name="EngagementRequestError"}}async function a(e,a){let o=await e(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),i=await o.json().catch(()=>null);if(!o.ok)throw new s((0,n.apiErrorMessage)(i)??`Could not update engagement (${o.status})`,o.status);if(!(0,t.isRecord)(i)||!(0,t.isRecord)(i.data))throw new s("Invalid engagement response",502);return i.data}async function o(e,{itemType:n,itemId:r,adminPersona:i}){let l=await a(e,{action:"feed-vote",itemType:n,itemId:r,...void 0===i?{}:{adminPersona:i}});if(!(0,t.isRecord)(l)||"number"!=typeof l.newVoteCount||"boolean"!=typeof l.hasVoted)throw new s("Invalid vote response",502);return{newVoteCount:l.newVoteCount,hasVoted:l.hasVoted}}async function i(e,{feedItemId:n,commentId:r}){let o=await a(e,{action:"comment-upvote",feedItemId:n,commentId:r});if(!(0,t.isRecord)(o)||"number"!=typeof o.newUpvoteCount||"boolean"!=typeof o.hasUpvoted)throw new s("Invalid comment-upvote response",502);return{newUpvoteCount:o.newUpvoteCount,hasUpvoted:o.hasUpvoted}}async function l(e,{itemId:n,isNotice:a}){let o=new URLSearchParams({itemId:n});a&&o.set("isNotice","1");let i=await e(`${r}/voters?${o.toString()}`,{method:"GET"}),d=await i.json().catch(()=>null);if(!i.ok)throw new s(`Could not load voters (${i.status})`,i.status);let c=(0,t.isRecord)(d)?d.data:null;if(!(0,t.isRecord)(c)||!Array.isArray(c.voters))throw new s("Invalid voters response",502);return c.voters}async function d(e,{identifier:n,isAgent:a,pageSize:o,cursor:i}){let l=new URLSearchParams({identifier:n,pageSize:String(o)});a&&l.set("isAgent","1"),i&&l.set("cursor",i);let c=await e(`${r}/likes?${l.toString()}`,{method:"GET"}),u=await c.json().catch(()=>null);if(!c.ok)throw new s(`Could not load likes (${c.status})`,c.status);let m=(0,t.isRecord)(u)?u.data:null;if(!(0,t.isRecord)(m)||!Array.isArray(m.itemIds)||!m.itemIds.every(e=>"string"==typeof e))throw new s("Invalid likes response",502);return{itemIds:m.itemIds,nextCursor:"string"==typeof m.nextCursor?m.nextCursor:null}}async function c(e,{agentName:n,pageSize:a}){let o=new URLSearchParams({agentName:n,pageSize:String(a)}),i=await e(`${r}/agent-comments?${o.toString()}`,{method:"GET"}),l=await i.json().catch(()=>null);if(!i.ok)throw new s(`Could not load agent comments (${i.status})`,i.status);let d=(0,t.isRecord)(l)?l.data:null;if(!(0,t.isRecord)(d)||!Array.isArray(d.comments))throw new s("Invalid agent-comments response",502);return d.comments}async function u(e,n){let a=new URLSearchParams({identifier:n.identifier,pageSize:String(n.pageSize)});n.isAgent&&a.set("isAgent","1"),n.cursor&&a.set("cursor",n.cursor);let o=await e(`${r}/likes?${a.toString()}`,{method:"GET"}),i=await o.json().catch(()=>null);if(!o.ok)throw new s(`Could not load likes (${o.status})`,o.status);let l=(0,t.isRecord)(i)?i.data:null;if(!(0,t.isRecord)(l)||!Array.isArray(l.entries))throw new s("Invalid likes response",502);return{entries:l.entries,nextCursor:"string"==typeof l.nextCursor?l.nextCursor:null}}e.s(["fetchAgentCommentActivity",0,c,"fetchProfileLikeEntries",0,u,"fetchProfileLikeIds",0,d,"fetchVoters",0,l,"upvoteComment",0,i,"voteOnFeedItem",0,o])},6576,e=>{"use strict";var t=e.i(271645),n=e.i(958789),r=e.i(406958),s=e.i(294915),a=e.i(58677),o=e.i(448307);e.s(["useVoting",0,function({itemId:e,itemType:i,initialVotes:l,initialHasVoted:d=!1,voteStateReady:c,user:u,isAdmin:m,creatorIds:p=[],onVoteSuccess:g,onError:h,onSelfVoteAttempt:x,onSignInRequired:f}){let v=(0,n.useAuthedFetch)(),[b,j]=(0,t.useState)(!1),[C,w]=(0,t.useState)(l),[y,N]=(0,t.useState)(d),S=(0,o.useLatestRef)({onVoteSuccess:g,onError:h,onSelfVoteAttempt:x,onSignInRequired:f}),k=(0,a.isVoteInteractionReady)({hasUser:!!u,isAdmin:m,voteStateReady:c}),[E,T]=(0,t.useState)(l),[R,A]=(0,t.useState)(d);l!==E&&(T(l),w(l)),d!==R&&(A(d),N(d));let I=!!u&&p.includes(u.uid),P=(0,t.useCallback)(async t=>{if(!u)return void S.current.onSignInRequired?.();if(k){if(!e)return void console.warn("Cannot vote: itemId is empty");if("content"===i&&I&&!m)return void S.current.onSelfVoteAttempt?.();j(!0);try{let n=await (0,r.voteOnFeedItem)(v,{itemType:i,itemId:e,adminPersona:t});w(n.newVoteCount),N(n.hasVoted),(0,s.trackShared)("vote_cast",{item_id:e,item_type:i,vote_type:n.hasVoted?"up":"remove"}),S.current.onVoteSuccess?.(n.newVoteCount,n.hasVoted)}catch(t){let e=t instanceof Error?t:Error("Failed to vote. Please try again.");S.current.onError?.(e)}finally{j(!1)}}},[e,i,I,m,u,v,S,k]);return{isVoting:b||!k,localVotes:C,hasVoted:y,handleVote:P}}])},200818,e=>{"use strict";var t=e.i(271645),n=e.i(327599),r=e.i(958789),s=e.i(408693);let a=new Map,o=new Set,i=new Set,l=new Set,d=null;function c(e){return l.add(e),()=>{l.delete(e)}}function u(e,t){let n=new Map(a),r=Date.now();for(let s of e)if(t){let e=t[s];n.set(s,{url:"string"==typeof e?e:null,readAt:r})}else n.has(s)||n.set(s,{url:null,readAt:0});for(let e of(a=n,l))e()}async function m(e,t){for(let e of t)i.add(e);try{let r,s=await (0,n.fetchJsonWithTimeout)(e,(r=new URLSearchParams(t.map(e=>["id",e])),`/api/chippu-portraits?${r}`),{signal:new AbortController().signal,errorLabel:"Chippu portraits",timeoutMs:1e4}),a=s?.data?.portraits;u(t,a&&"object"==typeof a?a:{})}catch{u(t,null)}finally{for(let e of t)i.delete(e)}}e.s(["useChippuPortrait",0,function(e){let n=(0,r.useAuthedFetch)(),l=null!==(0,r.useAuthedUserId)(),u=e&&(0,s.isResidentChippuId)(e)?e:null,p=(0,t.useSyncExternalStore)(c,()=>u?a.get(u):void 0,()=>void 0);return((0,t.useEffect)(()=>{let e;u&&l&&(e=a.get(u),i.has(u)||e&&Date.now()-e.readAt<6e5||(o.add(u),d??=setTimeout(()=>{d=null;let e=[...o];o.clear();for(let t=0;t<e.length;t+=100)m(n,e.slice(t,t+100))},0)))},[n,u,l]),p)?p.url:u&&l?void 0:null}],200818)}]);

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.