1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5742,9578],{6707:(e,t,r)=>{r.d(t,{CG:()=>i,Fm:()=>m,Qs:()=>h,XW:()=>x,cj:()=>o,h:()=>u,qp:()=>f});var a=r(93261);r(66425);var s=r(77223),n=r(71982),l=r(46609);function o({...e}){return(0,a.jsx)(s.bL,{"data-slot":"sheet",...e})}function i({...e}){return(0,a.jsx)(s.l9,{"data-slot":"sheet-trigger",...e})}function d({...e}){return(0,a.jsx)(s.ZL,{"data-slot":"sheet-portal",...e})}function c({className:e,...t}){return(0,a.jsx)(s.hJ,{"data-slot":"sheet-overlay",className:(0,l.cn)("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/40 backdrop-blur-sm",e),...t})}function u({className:e,children:t,side:r="right",...o}){return(0,a.jsxs)(d,{children:[(0,a.jsx)(c,{}),(0,a.jsxs)(s.UC,{"data-slot":"sheet-content",className:(0,l.cn)("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500","right"===r&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm","left"===r&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm","top"===r&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b","bottom"===r&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",e),...o,children:[t,(0,a.jsxs)(s.bm,{className:"cursor-pointer ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 flex h-8 w-8 items-center justify-center rounded-full text-foreground/60 hover:text-foreground hover:bg-foreground
1/10 transition-colors focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[(0,a.jsx)(n.A,{className:"size-4"}),(0,a.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function m({className:e,...t}){return(0,a.jsx)("div",{"data-slot":"sheet-header",className:(0,l.cn)("flex flex-col gap-1.5 p-4",e),...t})}function x({className:e,...t}){return(0,a.jsx)("div",{"data-slot":"sheet-footer",className:(0,l.cn)("mt-auto flex flex-col gap-2 p-4",e),...t})}function f({className:e,...t}){return(0,a.jsx)(s.hE,{"data-slot":"sheet-title",className:(0,l.cn)("text-foreground font-semibold",e),...t})}function h({className:e,...t}){return(0,a.jsx)(s.VY,{"data-slot":"sheet-description",className:(0,l.cn)("text-muted-foreground text-sm",e),...t})}},15473:(e,t,r)=>{r.d(t,{AM:()=>o,Wv:()=>i,dT:()=>d,hl:()=>c});var a=r(93261),s=r(66425),n=r(88652),l=r(46609);let o=n.bL,i=n.l9,d=n.Mz,c=s.forwardRef(({className:e,align:t="center",sideOffset:r=4,...s},o)=>(0,a.jsx)(n.ZL,{children:(0,a.jsx)(n.UC,{ref:o,align:t,sideOffset:r,className:(0,l.cn)("z-50 w-72 rounded-2xl border border-border/60 bg-popover p-3 text-popover-foreground shadow-xl outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...s})}));c.displayName=n.UC.displayName},15742:(e,t,r)=>{r.d(t,{compressImage:()=>a});async function a(e,t=1920,r=.8){return e.type.startsWith("image/")?new Promise((a,s)=>{let n=new FileReader;n.readAsDataURL(e),n.onload=n=>{let l=new Image;l.src=n.target?.result,l.onload=()=>{let n=l.width,o=l.height;n>t&&(o=Math.round(t/n*o),n=t);let i=document.createElement("canvas");i.width=n,i.height=o;let d=i.getContext("2d");d?(d.drawImage(l,0,0,n,o),i.toBlob(t=>{if(!t)return void s(Error("Canvas to Blob failed"));let r=new File([t],e.name,{type:"image/jpeg",lastModified:Date.now()});r.size>e.size?a(e):a(r)},"image/jpeg",r)):s(Error("Failed to get canvas context"))},l.onerror=e=>s(e)},n.onerror=e=>s(e)}):e}},16663:(e,t,r)=>{r.d(t,{G:()=>s});var a=r(48105);let s=(0,a.createServerReference)("00573d78ff20fe4c578409176538d2200ff049e0d3",a.callServer,void 0,a.findSourceMapURL,"getGifFavoritesAction")},16677:(e,t,r)=>{r.d(t,{Z:()=>p});var a=r(93261),s=r(50566),n=r(94146),l=r(41864),o=r(93612),i=r(66425),d=r(42318),c=r(48105);let u=(0,c.createServerReference)("70ff7b43fd9df06de9adaf2f0f072c45c879e3221c",c.callServer,void 0,c.findSourceMapURL,"createReportAction");var m=r(85093),x=r(36388),f=r(17422);let h=["Spam or misleading","Harassment or bullying","Hate speech","Violence or illegal content","Nudity or sexual content","Other"];function p({open:e,onOpenChange:t,targetId:r,targetType:c}){let[g,v]=(0,i.useState)(""),[b,j]=(0,i.useState)(""),[w,N]=(0,i.useTransition)();return(0,a.jsx)(s.Dialog,{open:e,onOpenChange:t,children:(0,a.jsxs)(s.DialogContent,{className:"sm:max-w-[425px]",children:[(0,a.jsxs)(s.DialogHeader,{children:[(0,a.jsxs)(s.DialogTitle,{className:"flex items-center gap-2 text-destructive",children:[(0,a.jsx)(m.A,{className:"h-5 w-5"}),"Report Content"]}),(0,a.jsx)(s.DialogDescription,{children:"Help us understand what's wrong with this content. Reports are anonymous."})]}),(0,a.jsxs)("div",{className:"grid gap-4 py-4",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(l.J,{children:"Reason"}),(0,a.jsxs)(f.l6,{value:g,onValueChange:v,children:[(0,a.jsx)(f.bq,{children:(0,a.jsx)(f.yv,{placeholder:"Select a reason"})}),(0,a.jsx)(f.gC,{children:h.map(e=>(0,a.jsx)(f.eb,{value:e,children:e},e))})]})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(l.J,{children:"Additional Details (Optional)"}),(0,a.jsx)(o.T,{placeholder:"Please provide any extra context...",value:b,onChange:e=>j(e.target.value),className:"resize-none",rows:3})]})]}),(0,a.jsxs)(s.Es,{children:[(0,a.jsx)(n.$,{variant:"ghost",onClick:()=>t(!1),disabled:w,children:"Cancel"}),(0,a.jsxs)(n.$,{variant:"destructive",onClick:()=>
1{if(!g)return;let e=b?`${g}: ${b}`:g;N(async()=>{let a=await u(r,c,e);a.error?d.oR.error(a.error):(d.oR.success("Report submitted. Thank you for keeping Penfolk safe."),t(!1),v(""),j(""))})},disabled:!g||w,children:[w&&(0,a.jsx)(x.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Submit Report"]})]})]})})}},18673:(e,t,r)=>{r.d(t,{c:()=>w});var a=r(93261),s=r(66425),n=r(15473),l=r(6707),o=r(94146),i=r(63098),d=r(99370),c=r(36388),u=r(11915),m=r(13437),x=r(91778),f=r(95537),h=r(46609),p=r(64562),g=r(90337),v=r(16663),b=r(50140),j=r(42318);function w({onSelect:e,trigger:t}){let r,[N,y]=(0,s.useState)(!1),[k,S]=(0,s.useState)(""),C=(r="omJHysFaWgqIOWMi2c6wOcm1MYoi8Hgc",(0,s.useMemo)(()=>r?new f.uK(r):null,[r])),R=function(){let[e,t]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{let e=()=>t(window.innerWidth<768);return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e}(),[A,T]=(0,s.useState)([]),[z,I]=(0,s.useState)("trending"),[U,L]=(0,s.useState)([]),[D,M]=(0,s.useState)(0),[E,F]=(0,s.useState)(!1),[_,P]=(0,s.useState)(!1);(0,s.useEffect)(()=>{N&&"favorites"===z&&$()},[N,z]);let $=async()=>{T(await (0,v.G)())};(0,s.useEffect)(()=>{let e=setTimeout(()=>{M(0),L([]),W(0,k)},500);return()=>clearTimeout(e)},[k,C]);let W=async(e,t)=>{if(C&&!E){F(!0);try{let r;r=t.trim()?await C.search(t,{offset:e,limit:20}):await C.trending({offset:e,limit:20}),0===e?L(r.data):L(e=>[...e,...r.data])}catch(e){console.error(e)}finally{F(!1)}}},G=async e=>{let t=e.images.fixed_height,r={id:e.id,url:t.url,thumbnailUrl:e.images.fixed_width_downsampled.url,title:e.title,width:t.width,height:t.height},a=await (0,b.v)(r);a.success?(j.oR.success(a.isFavorite?"Added to Favorites":"Removed from Favorites"),a.isFavorite?T(e=>[{gifId:r.id,url:r.url,thumbnailUrl:r.thumbnailUrl,title:r.title,width:r.width,height:r.height},...e]):T(e=>e.filter(e=>e.gifId!==r.id))):j.oR.error("Failed to update favorites")},O=(0,a.jsxs)("div",{className:"relative mb-2",children:[(0,a.jsx)(i.A,{className:"absolute left-2 top-2.5 h-4 w-4 text-muted-foreground"}),(0,a.jsx)(x.p,{placeholder:"Search GIPHY...",className:"pl-8 h-9 text-xs bg-muted/50 border-none focus-visible:ring-1",value:k,onChange:e=>S(e.target.value),autoFocus:!R})]}),H=(0,a.jsxs)("div",{className:"pb-20",children:[(0,a.jsx)("div",{className:"columns-2 gap-2 space-y-2",children:U.map(t=>(0,a.jsxs)("div",{className:"relative group rounded-md overflow-hidden cursor-pointer bg-black/5 break-inside-avoid",onClick:()=>{let r;e({url:(r=t.images.fixed_height).url,width:r.width,height:r.height}),y(!1)},onContextMenu:e=>{e.preventDefault()},children:[(0,a.jsx)("img",{src:t.images.fixed_width.url,alt:t.title,className:"w-full h-auto object-cover",loading:"lazy"}),(0,a.jsx)("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/10 transition-colors pointer-events-none"}),(0,a.jsx)("button",{className:"absolute top-1 right-1 p-1.5 rounded-full bg-black/50 text-white opacity-0 group-hover:opacity-100 transition-opacity hover:bg-black/70 hover:scale-110 pointer-events-auto",onClick:e=>{e.stopPropagation(),G(t)},children:(0,a.jsx)(d.A,{className:(0,h.cn)("h-3 w-3",A.some(e=>e.gifId===t.id)&&"fill-current text-red-500")})})]},t.id))}),U.length>0&&(0,a.jsx)("div",{className:"py-4 flex justify-center",children:(0,a.jsxs)(o.$,{variant:"ghost",size:"sm",onClick:()=>{let e=D+20;M(e),W(e,k)},disabled:E,className:"text-xs text-muted-foreground",children:[E?(0,a.jsx)(c.A,{className:"h-4 w-4 animate-spin mr-2"}):null,"Load More"]})}),!E&&0===U.length&&(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center p-8 text-muted-foreground opacity-50",children:[(0,a.jsx)(i.A,{className:"h-8 w-8 mb-2"}),(0,a.jsx)("p",{className:"text-xs",children:"No GIFs found"})]})]}),q=(0,a.jsxs)(p.Tabs,{value:z,onValueChange:I,className:"flex flex-col h-full w-full",children:[(0,a.jsx)("div",{className:"flex-none px-2 pt-2",children:O}),(0,a.jsx)("div",{className:"flex-none px-2 pb-2",children:(0,a.jsxs)(p.TabsList,{className:"w-full grid grid-cols-2",children:[(0,a.jsxs)(p.TabsTrigger,{value:"trending",className:"text-xs data-[state=active]:bg-background",children:[(0,a.jsx)(u.A,{className:"h-3 w-3 mr-2"})," Trending"]}),(0,a.jsxs)(p.TabsTrigger,{value:"favorites",className:"text-xs data-[state=active]:bg-background",children:[(0,a.jsx)(d.A,{className:"h-3 w-3 mr-2"})," Favorites"]})]})}),(0,a.jsxs)("div",{className:"flex-1 overflow-y-auto min-h-0 bg-background/50 relative px-2",children:[(0,a.jsx)(p.TabsContent,{value:"trending",className:"m-0 h-full",children:C?H:(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center h-full text-muted-foreground gap-2 p-4 text-center",children:[(0,a.jsx)(m.A,{className:"h-8 w-8 op
1acity-50"}),(0,a.jsx)("p",{className:"text-sm",children:"GIPHY API Key Missing"})]})}),(0,a.jsx)(p.TabsContent,{value:"favorites",className:"m-0 h-full overflow-y-auto",children:0===A.length?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center h-40 text-muted-foreground gap-2 text-center opacity-70",children:[(0,a.jsx)(d.A,{className:"h-8 w-8"}),(0,a.jsx)("p",{className:"text-xs",children:"No favorites yet"}),(0,a.jsx)("p",{className:"text-[10px]",children:"Add specific GIFs to favorites to see them here!"})]}):(0,a.jsx)("div",{className:"columns-2 gap-2 space-y-2 pb-20",children:A.map(t=>(0,a.jsxs)(g.tz,{children:[(0,a.jsx)(g.Rc,{children:(0,a.jsxs)("div",{className:"relative rounded overflow-hidden cursor-pointer group break-inside-avoid",onClick:()=>e({url:t.url,width:t.width||200,height:t.height||200}),children:[(0,a.jsx)("img",{src:t.thumbnailUrl||t.url,alt:t.title,className:"w-full h-auto object-cover"}),(0,a.jsx)("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/10 transition-colors"})]})}),(0,a.jsx)(g.Ip,{children:(0,a.jsx)(g.kt,{onClick:()=>G({id:t.gifId,images:{fixed_height:{url:t.url}}}),children:"Remove from Favorites"})})]},t.gifId))})})]}),(0,a.jsx)("div",{className:"flex-none p-1 bg-black flex justify-end z-10 w-full",children:(0,a.jsx)("span",{className:"text-[9px] font-bold text-white/50 pr-1",children:"Powered by GIPHY"})})]});return R?(0,a.jsxs)(l.cj,{open:N,onOpenChange:y,children:[(0,a.jsx)(l.CG,{asChild:!0,children:t||(0,a.jsx)(o.$,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",children:(0,a.jsx)(m.A,{className:"h-5 w-5"})})}),(0,a.jsxs)(l.h,{side:"bottom",className:"h-[80vh] p-0 flex flex-col rounded-t-xl",children:[(0,a.jsx)(l.Fm,{className:"p-4 pb-2 border-b",children:(0,a.jsxs)(l.qp,{className:"text-left flex items-center gap-2",children:[(0,a.jsx)(m.A,{className:"h-4 w-4"})," GIFs"]})}),q]})]}):(0,a.jsxs)(n.AM,{open:N,onOpenChange:y,children:[(0,a.jsx)(n.Wv,{asChild:!0,children:t||(0,a.jsx)(o.$,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",children:(0,a.jsx)(m.A,{className:"h-5 w-5"})})}),(0,a.jsx)(n.hl,{className:"w-[360px] p-0 border-none shadow-none bg-transparent",align:"start",side:"top",children:(0,a.jsx)("div",{className:"rounded-xl overflow-hidden shadow-2xl border border-border bg-popover flex flex-col h-[500px]",children:q})})]})}},20518:(e,t,r)=>{r.d(t,{P:()=>d});var a=r(93261),s=r(66398),n=r(40594),l=r(94146),o=r(15473),i=r(44249);function d({onEmojiSelect:e,className:t}){let{theme:r}=(0,i.D)();return(0,a.jsxs)(o.AM,{children:[(0,a.jsx)(o.Wv,{asChild:!0,children:(0,a.jsx)(l.$,{variant:"ghost",size:"icon",className:t||"h-8 w-8 text-muted-foreground hover:text-foreground rounded-full",children:(0,a.jsx)(n.A,{className:"h-5 w-5"})})}),(0,a.jsx)(o.hl,{className:"w-full border-none p-0 bg-transparent shadow-none",side:"top",align:"start",children:(0,a.jsx)(s.Ay,{theme:"dark"===r?s.Sx.DARK:s.Sx.LIGHT,onEmojiClick:t=>e(t.emoji),lazyLoadEmojis:!0})})]})}},29578:(e,t,r)=>{r.d(t,{c:()=>$});var a=r(93261),s=r(66425),n=r(99370),l=r(17326),o=r(43640),i=r(93078),d=r
1(30719),c=r(89788),u=r(71982),m=r(35175),x=r(39825),f=r(8640),h=r(42752),p=r(91279),g=r(46609),v=r(48105);let b=(0,v.createServerReference)("609956953a83db975803cceefa86f85b712409149c",v.callServer,void 0,v.findSourceMapURL,"getTrendingComments"),j=(0,v.createServerReference)("70a5565695140228ee81d568f8f914cd4d620007cc",v.callServer,void 0,v.findSourceMapURL,"getPhotoCommentsWithCursor");var w=r(53958),N=r(63998);let y=(0,v.createServerReference)("400aed63c8c0901a729f6085a00734e5f0b6e819f1",v.callServer,void 0,v.findSourceMapURL,"deleteCommentAction"),k=(0,v.createServerReference)("6024c763d4eaa9c8323ff6ab1f514f1fabc1956fbb",v.callServer,void 0,v.findSourceMapURL,"toggleReactionAction"),S=(0,v.createServerReference)("4010bd740656ebba2d71aa76c110c4f66e6d0bfb12",v.callServer,void 0,v.findSourceMapURL,"searchUsersForMention");var C=r(42318),R=r(24486),A=r.n(R),T=r(16677),z=r(83835),I=r(13675),U=r(18673),L=r(15742),D=r(94146),M=r(15473),E=r(46684),F=r(20518),_=r(82316);function P({comment:e,currentUserId:t,onDelete:r,onReply:s,onReact:u,onReport:m,depth:x=0}){let f=e.reactions?.filter(e=>"like"===e.type).length||0,h=e.reactions?.filter(e=>"dislike"===e.type).length||0,v=e.reactions?.find(e=>e.userId===t)?.type;return(0,a.jsxs)("div",{className:"group flex gap-3 text-sm animate-in fade-in slide-in-from-bottom-2 duration-300 w-full min-w-0",children:[(0,a.jsx)(A(),{href:`/profile/${e.user?.username}`,className:"flex-shrink-0",children:(0,a.jsx)("div",{className:"h-8 w-8 rounded-full bg-muted overflow-hidden",children:e.user?.avatarUrl?(0,a.jsx)("img",{src:e.user.avatarUrl,alt:e.user.username,className:"h-full w-full object-cover"}):(0,a.jsx)("div",{className:"h-full w-full bg-primary/10 flex items-center justify-center text-[10px] font-bold",children:e.user?.username?.[0]?.toUpperCase()})})}),(0,a.jsxs)("div",{className:"flex-1 space-y-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,a.jsx)(A(),{href:`/profile/${e.user?.username}`,className:"font-semibold text-foreground/90 hover:underline",children:(0,a.jsx)(E.f,{name:e.user?.username||"Unknown",decoration:e.user?.nameDecoration})}),(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground tabular-nums",title:e.createdAt?new Date(e.createdAt).toLocaleString():void 0,children:e.createdAt&&(0,g.gk)(new Date(e.createdAt))})]}),(0,a.jsx)("div",{className:"text-muted-foreground leading-relaxed markdown-content break-words text-sm w-full min-w-0 overflow-hidden",children:(0,a.jsx)(z.oz,{remarkPlugins:[I.A],components:{p:({node:e,...t})=>(0,a.jsx)("p",{className:"mb-1 last:mb-0",...t}),a:({node:e,href:t,...r})=>t?t.startsWith("/profile/")||t.startsWith("profile/")||t.startsWith("/")?(0,a.jsx)(A(),{href:t,className:"text-primary font-medium hover:underline",...r}):(0,a.jsx)("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",...r}):(0,a.jsx)("span",{...r}),img:({node:e,src:t,alt:r,...s})=>t?"string"==typeof t&&t.match(/\.(mp4|webm|mov|ogg)$/i)||"Video"===r?(0,a.jsx)("span",{className:"block relative rounded-md overflow-hidden bg-muted my-1.5 ring-1 ring-border/20 max-w-full",onClick:e=>e.stopPropagation(),children:(0,a.jsx)("video",{src:t,controls:!0,preload:"metadata",className:"w-full h-auto object-contain max-h-[400px] rounded-md",...s})}):(0,a.jsx)("span",{className:"block relative rounded-md overflow-hidden bg-muted my-1.5 ring-1 ring-border/20 max-w-[300px]",children:(0,a.jsx)("img",{src:t,alt:r||"Comment image",className:"w-full h-auto object-contain",loading:"lazy",...s})}):null,code:({node:e,inline:t,className:r,children:s,...n})=>t?(0,a.jsx)("code",{className:"px-1 py-0.5 rounded text-xs font-mono bg-muted",...n,children:s}):(0,a.jsx)("code",{className:"block p-2 rounded-md text-xs font-mono overflow-x-auto my-1 bg-muted",...n,children:s}),h1:({node:e,...t})=>(0,a.jsx)("h1",{className:"text-lg font-bold mt-2 mb-1",...t}),h2:({node:e,...t})=>(0,a.jsx)("h2",{className:"text-base font-bold mt-2 mb-1",...t}),h3:({node:e,...t})=>(0,a.jsx)("h3",{className:"text-sm font-bold mt-1.5 mb-1",...t}),h4:({node:e,...t})=>(0,a.jsx)("h4",{className:"text-sm font-semibold mt-1.5 mb-1",...t}),blockquote:({node:e,...t})=>(0,a.jsx)("blockquote",{className:"border-l-2 border-primary/50 pl-2 italic my-1",...t}),ul:({node:e,...t})=>(0,a.jsx)("ul",{className:"list-disc pl-4 my-1",...t}),ol:({node:e,...t})=>(0,a.jsx)("ol",{className:"list-decimal pl-4 my-1",...t})},children:e.content.replace(/@(\w+)/g,"[@$1](/profile/$1)").replace(/\n/g," \n")})}),(0,a.jsxs)("div",{className:"flex items-center gap-1 text-[12px] text-muted-foreground pt-1 -ml-2",children:[(0,a.jsxs)("button",{onClick:()=>u(e.id,"like"),className:(0,g.cn)("flex items-center gap-1 px-2 h-7 rounded-full transition-[background-color,color,transform] duration-150 active:scale-[0.94] select-none","like"===v?"text-red-500 hover:bg-red-500/10":"hover:bg-muted hover:text-foreground"),"aria-label":"like"===v?"Remove like":"Like",children:[(0,a.jsx)(n.A,{className:(0,g.cn)("h-3.5 w-3.5","like"===v&&"fill-current")}),f>0&&(0,a.jsx)("span",{className:"tabular-nums",children:f})]}),(0,a.jsxs)("button",{onClick:()=>u(e.id,"dislike"),className:(0,g.cn)("flex items-center gap-1 px-2 h-7 rounded-full transition-[background-color,color,transform] duration-150 active:scale-[0.94] select-none","dislike"===v?"text-yellow-600 hover:bg-yellow-500/10":"hover:bg-muted hover:text-foreground"),"aria-label":"dislike"===v?"Remove dislike":"Dislike",children:[(0,a.jsx)(l.A,{className:(0,g.cn)("h-3.5 w-3.5","dislike"===v&&"fill-current")}),h>0&&(0,a.jsx)("span",{className:"tabular-nums",children:h})]}),(0,a.jsxs)("button",{onClick:()=>s(e),className:"flex items-center gap-1 px-2 h-7 rounded-full transition-[background-color,color,transform] duration-150 active:scale-[0.94] hover:bg-muted hover:text-foreground font-medium",children:[(0,a.jsx)(o.A,{className:"h-3.5 w-3.5"})," Reply"]}),(0,a.jsx)(_.P,{originalText:e.content,className:"opacity-0 group-hover:opacity-100 transition-opacity"}),(0,a.jsxs)(p.rI,{children:[(0,a.jsx)(p.ty,{className:"opacity-0 group-hover:opacity-100 transition-opacity",children:(0,a.jsx)(i.A,{className:"h-3 w-3"})}),(0,a.jsxs)(p.SQ,{align:"start",children:[t===e.userId&&(0,a.jsxs)(p._2,{onClick:()=>r(e.id),className:"text-red-500 focus:text-red-500",children:[(0,a.jsx)(d.A,{className:"h-4 w-4 mr-2"})," Delete"]}),t!==e.userId&&(0,a.jsxs)(p._2,{onClick:()=>m(e.id),children:[(0,a.jsx)(c.A,{className:"h-4 w-4 mr-2"})," Report"]})]})]})]}),e.replies&&e.replies.length>0&&(0,a.jsx)("div",{className:(0,g.cn)("mt-3 space-y-3",x<1?"pl-4 border-l border-muted-foreground
1/15":""),children:e.replies.map(e=>(0,a.jsx)(P,{comment:e,currentUserId:t,onDelete:r,onReply:s,onReact:u,onReport:m,depth:x+1},e.id))})]})]})}function $({entityId:e,currentUserId:t,className:r,disableComments:n=!1,initialComments:l=[],initialTotalCount:o=0}){let[i,d]=(0,s.useState)(l),[c,p]=(0,s.useState)(""),[v,R]=(0,s.useState)(null),[A,z]=(0,s.useState)(!1),[I,E]=(0,s.useTransition)(),[_,W]=(0,s.useState)(null),[G,O]=(0,s.useState)(!1),[H,q]=(0,s.useState)("top"),[Z,K]=(0,s.useState)(null),[V,Y]=(0,s.useState)(!1),[J,B]=(0,s.useState)(!1),[Q,X]=(0,s.useState)(null),[ee,et]=(0,s.useState)([]),[er,ea]=(0,s.useState)(!1),es=(0,s.useRef)(null),en=(0,s.useRef)(null),el=async(t=!1)=>{if(e&&!n){t?B(!0):z(!0);try{if("top"===H){if(t)return void B(!1);let r=await b(e,50);d(r),Y(!1)}else{let r=await j(e,10,t?Z:void 0);r.comments&&(t?d(e=>[...e,...r.comments]):d(r.comments),r.nextCursor?(K(new Date(r.nextCursor)),Y(!0)):Y(!1))}}catch(e){console.error(e),C.oR.error("Failed to load comments")}finally{t?B(!1):z(!1)}}};(0,s.useEffect)(()=>{d([]),K(null),Y(!1),el(!1)},[H,e]);let eo=(0,s.useRef)(null);(0,s.useEffect)(()=>{let e=new IntersectionObserver(e=>{e[0].isIntersecting&&V&&!J&&!A&&el(!0)},{threshold:1});return eo.current&&e.observe(eo.current),()=>{eo.current&&e.unobserve(eo.current)}},[V,J,A]),(0,s.useEffect)(()=>{if(null===Q)return void et([]);let e=setTimeout(async()=>{ea(!0);try{let e=await S(Q);et(e)}catch(e){console.error(e)}finally{ea(!1)}},300);return()=>clearTimeout(e)},[Q]);let ei=(e,t="")=>{if(!es.current)return;let r=es.current.selectionStart,a=es.current.selectionEnd,s=es.current.value,n=s.slice(r,a);p(s.slice(0,r)+e+n+t+s.slice(a)),setTimeout(()=>{es.current&&(es.current.focus(),es.current.setSelectionRange(r+e.length,a+e.length))},0)},ed=async e=>{for(let t of e.clipboardData.items)if(-1!==t.type.indexOf("image")||-1!==t.type.indexOf("video")){e.preventDefault();let r=t.getAsFile();r&&await ec(r);return}},ec=async e=>{O(!0);let t=C.oR.loading("Uploading image...");try{let t=e.type.startsWith("video/"),r=e;t||(r=await (0,L.compressImage)(e));let a=new FormData;a.append("file",r);let s=await (0,w.Q)(a);s.url?(ei(``),C.oR.success("Media uploaded!")):C.oR.error("Failed to upload image")}catch(e){console.error("Upload error:",e),C.oR.error("Error uploading image")}finally{C.oR.dismiss(t),O(!1)}},eu=async e=>{e.target.files&&e.target.files.length>0&&(await ec(e.target.files[0]),en.current&&(en.current.value=""))},em=()=>{c.trim()&&E(async()=>{let t=await (0,N.T)(e,c,v?.id);if(t.error)C.oR.error(t.error);else if(t.comment){if(v){let e=r=>r.map(r=>r.id===v.id?{...r,replies:[...r.replies||[],t.comment]}:r.replies&&r.replies.length>0?{...r,replies:e(r.replies)}:r);d(t=>e(t)),R(null)}else d([t.comment,...i]);p(""),X(null)}})},ex=async e=>{if(!confirm("Delete comment?"))return;let t=await y(e);if(t.error)C.oR.error(t.error);else{let t=r=>r.filter(r=>r.id!==e&&(r.replies&&(r.replies=t(r.replies)),!0));d(t(i))}},ef=async(e,r)=>{let a=s=>s.map(s=>{if(s.id===e){let e=s.reactions?.find(e=>e.userId===t),a=s.reactions||[];return a=e&&e.type===r?a.filter(e=>e.userId!==t):e?a.map(e=>e.userId===t?{...e,type:r}:e):[...a,{userId:t,type:r}],{...s,reactions:a}}return s.replies?{...s,replies:a(s.replies)}:s});d(a(i));let s=await k(e,r);s.error&&C.oR.error(s.error)},eh=e=>{W(e)};return n?(0,a.jsx)("div",{className:(0,g.cn)("flex items-center justify-center text-muted-foreground/50 text-sm italic p-8",r)}):(0,a.jsxs)("div",{className:(0,g.cn)("flex flex-col h-full",r),children:[(0,a.jsxs)("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[A?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-8 gap-2",children:[(0,a.jsx)("div",{className:"h-5 w-5 border-2 border-primary border-t-transparent rounded-full animate-spin"}),(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:"Loading discussion..."})]}):0===i.length?(0,a.jsx)("div",{className:"text-center text-muted-foreground/40 text-sm py-8 italic",children:"No comments yet. Be the first to start the conversation."}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"flex justify-end px-1 pb-2",children:(0,a.jsxs)("div",{className:"inline-flex items-center p-0.5 bg-muted/60 rounded-full",role:"tablist","aria-label":"Sort comments",children:[(0,a.jsx)("button",{role:"tab","aria-selected":"top"===H,onClick:()=>q("top"),className:(0,g.cn)("text-[12px] font-medium px-3 py-1 rounded-full transition-[background-color,color,box-shadow] duration-200","top"===H?"bg-background text-foreground shadow-[0_1px_2px_rgba(0,0,0,0.08)]":"text-muted-foreground hover:text-foreground"),children:"Top"}),(0,a.jsx)("button",{role:"tab","aria-selected":"newest"===H,onClick:()=>q("newest"),className:(0,g.cn)("text-[12px] font-medium px-3 py-1 rounded-full transition-[background-color,color,box-shadow] duration-200","
1newest"===H?"bg-background text-foreground shadow-[0_1px_2px_rgba(0,0,0,0.08)]":"text-muted-foreground hover:text-foreground"),children:"Newest"})]})}),i.map(e=>(0,a.jsx)(P,{comment:e,currentUserId:t,onDelete:ex,onReply:e=>R(e),onReact:ef,onReport:eh},e.id))]}),(0,a.jsx)("div",{ref:eo,className:"py-2 flex justify-center items-center min-h-[20px]",children:V&&(0,a.jsx)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:(0,a.jsx)("div",{className:"h-3 w-3 border-2 border-primary/50 border-t-transparent rounded-full animate-spin"})})})]}),(0,a.jsxs)("div",{className:"p-3 relative",children:[null!==Q&&(0,a.jsx)("div",{className:"absolute bottom-full left-4 mb-2 w-64 bg-popover border border-border rounded-md shadow-lg overflow-hidden max-h-48 overflow-y-auto animate-in fade-in zoom-in-95 duration-200 z-50",children:er?(0,a.jsx)("div",{className:"p-2 text-xs text-muted-foreground text-center",children:"Searching..."}):0===ee.length?(0,a.jsx)("div",{className:"p-2 text-xs text-muted-foreground text-center",children:"No users found"}):ee.map(e=>(0,a.jsxs)("button",{onClick:()=>(e=>{if(!es.current)return;let t=es.current.selectionStart||0,r=c.slice(0,t),a=c.slice(t),s=r.lastIndexOf(" ");p(c.slice(0,-1===s?0:s+1)+`@${e.username} `+a),X(null),es.current.focus()})(e),className:"w-full flex items-center gap-2 p-2 hover:bg-accent hover:text-accent-foreground text-left text-sm transition-colors",children:[(0,a.jsx)("div",{className:"h-6 w-6 rounded-full bg-muted overflow-hidden flex-shrink-0",children:e.avatarUrl?(0,a.jsx)("img",{src:e.avatarUrl,className:"h-full w-full object-cover"}):(0,a.jsx)("div",{className:"h-full w-full flex items-center justify-center text-[10px] font-bold",children:e.username[0]?.toUpperCase()})}),(0,a.jsxs)("div",{className:"flex flex-col overflow-hidden",children:[(0,a.jsx)("span",{className:"font-medium truncate text-xs",children:e.username}),e.fullName&&(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground truncate",children:e.fullName})]})]},e.id))}),v&&(0,a.jsxs)("div",{className:"flex justify-between items-center text-xs text-muted-foreground mb-2 px-1",children:[(0,a.jsxs)("span",{children:["Replying to ",(0,a.jsx)("strong",{children:v.user?.username})]}),(0,a.jsx)("button",{onClick:()=>R(null),className:"hover:text-foreground",children:(0,a.jsx)(u.A,{className:"h-3 w-3"})})]}),(0,a.jsxs)("div",{className:(0,g.cn)("flex items-end gap-2 p-2 rounded-2xl bg-muted/20 transition-all duration-200","focus-within:bg-muted/40 focu
1s-within:ring-1 focus-within:ring-primary/10"),children:[(0,a.jsx)("div",{className:"flex-1 min-w-0 flex flex-col pl-1",children:(0,a.jsx)(h.A,{ref:es,className:"w-full bg-transparent border-none p-0 py-2 text-sm focus:ring-0 resize-none min-h-[20px] max-h-[120px] outline-none placeholder:text-muted-foreground/60 leading-relaxed",placeholder:v?"Write a reply...":"Add a comment...",value:c,onChange:e=>{let t=e.target.value,r=e.target.selectionStart||0;p(t);let a=t.slice(0,r).split(/\s/),s=a[a.length-1];s.startsWith("@")?X(s.slice(1)):X(null)},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),em()),"Escape"===e.key&&X(null)},onPaste:ed,autoFocus:!!v,minRows:1})}),(0,a.jsxs)("div",{className:"flex items-center gap-1 pb-1",children:[(0,a.jsxs)("div",{className:(0,g.cn)("flex items-center gap-0.5 transition-all duration-200",c.trim().length>0?"opacity-100":"opacity-50 hover:opacity-100"),children:[(0,a.jsx)("input",{type:"file",ref:en,className:"hidden",accept:"image/*,video/*",onChange:eu}),(0,a.jsx)(D.$,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full text-muted-foreground hover:text-foreground",onClick:()=>en.current?.click(),disabled:G,title:"Image",children:G?(0,a.jsx)("div",{className:"h-3 w-3 border-2 border-current border-t-transparent rounded-full animate-spin"}):(0,a.jsx)(m.A,{className:"h-4 w-4"})}),(0,a.jsx)(F.P,{onEmojiSelect:e=>ei(e),className:"h-7 w-7 rounded-full text-muted-foreground hover:text-foreground"}),(0,a.jsxs)(M.AM,{children:[(0,a.jsx)(M.Wv,{asChild:!0,children:(0,a.jsx)(D.$,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full text-muted-foreground hover:text-foreground",title:"GIF",children:(0,a.jsx)(x.A,{className:"h-4 w-4"})})}),(0,a.jsx)(M.hl,{className:"w-80 p-0",align:"end",children:(0,a.jsx)(U.c,{onSelect:({url:e})=>ei(``)})})]})]}),(0,a.jsx)(D.$,{onClick:em,disabled:!c.trim()||I||G,size:"icon",className:(0,g.cn)("h-8 w-8 rounded-full transition-all duration-200",c.trim()?"bg-primary text-primary-foreground shadow-sm":"bg-transparent text-muted-foreground hover:bg-muted"),children:I?(0,a.jsx)("div",{className:"h-3 w-3 border-2 border-current border-t-transparent rounded-full animate-spin"}):(0,a.jsx)(f.A,{className:(0,g.cn)("h-4 w-4",c.trim()&&"ml-0.5")})})]})]})]}),_&&(0,a.jsx)(T.Z,{open:!!_,onOpenChange:e=>!e&&W(null),targetId:_,targetType:"comment"})]})}},44711:(e,t,r)=>{r.d(t,{W:()=>s});var a=r(48105);let s=(0,a.createServerReference)("60bff8c65bcb88e5e7db490cddc62c86811a25a671",a.callServer,void 0,a.findSourceMapURL,"translateTextAction")},46684:(e,t,r)=>{r.d(t,{f:()=>l});var a=r(93261),s=r(46609),n=r(83449);function l({name:e,decoration:t,className:r,style:o,as:i="span"}){let d=n.ie.find(e=>e.value===(t||"none")),c=d?.class||"";return(0,a.jsx)(i,{className:(0,s.cn)("inline-block",r,c),style:o,children:e})}},50140:(e,t,r)=>{r.d(t,{v:()=>s});var a=r(48105);let s=(0,a.createServerReference)("40eca3783772d03d6cacb62dbef5606b1c50b01b68",a.callServer,void 0,a.findSourceMapURL,"toggleGifFavoriteAction")},50566:(e,t,r)=>{r.d(t,{Dialog:()=>o,DialogContent:()=>m,DialogDescription:()=>p,DialogHeader:()=>x,DialogTitle:()=>h,DialogTrigger:()=>i,Es:()=>f,HM:()=>c});var a=r(93261);r(66425);var s=r(77223),n=r(71982),l=r(46609);function o({...e}){return(0,a.jsx)(s.bL,{"data-slot":"dialog",...e})}function i({...e}){return(0,a.jsx)(s.l9,{"data-slot":"dialog-trigger",...e})}function d({...e}){return(0,a.jsx)(s.ZL,{"data-slot":"dialog-portal",...e})}function c({...e}){return(0,a.jsx)(s.bm,{"data-slot":"dialog-close",...e})}function u({className:e,...t}){return(0,a.jsx)(s.hJ,{"data-slot":"dialog-overlay",className:(0,l.cn)("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/40 backdrop-blur-sm",e),...t})}function m({className:e,children:t,showCloseButton:r=!0,...o}){return(0,a.jsxs)(d,{"data-slot":"dialog-portal",children:[(0,a.jsx)(u,{}),(0,a.jsxs)(s.UC,{"data-slot":"dialog-content",className:(0,l.cn)("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 roun
1ded-3xl border border-border/60 p-6 shadow-2xl duration-200 outline-none sm:max-w-lg",e),...o,children:[t,r&&(0,a.jsxs)(s.bm,{"data-slot":"dialog-close",className:"cursor-pointer ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 flex h-8 w-8 items-center justify-center rounded-full text-foreground/60 hover:text-foreground hover:bg-foreground/10 transition-colors focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[(0,a.jsx)(n.A,{}),(0,a.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function x({className:e,...t}){return(0,a.jsx)("div",{"data-slot":"dialog-header",className:(0,l.cn)("flex flex-col gap-2 text-center sm:text-left",e),...t})}function f({className:e,...t}){return(0,a.jsx)("div",{"data-slot":"dialog-footer",className:(0,l.cn)("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function h({className:e,...t}){return(0,a.jsx)(s.hE,{"data-slot":"dialog-title",className:(0,l.cn)("text-lg leading-none font-semibold",e),...t})}function p({className:e,...t}){return(0,a.jsx)(s.VY,{"data-slot":"dialog-description",className:(0,l.cn)("text-muted-foreground text-sm",e),...t})}},53958:(e,t,r)=>{r.d(t,{Q:()=>s});var a=r(48105);let s=(0,a.createServerReference)("40fb99d23e9660316874052c24127138eda257d313",a.callServer,void 0,a.findSourceMapURL,"uploadCommentImageAction")},63998:(e,t,r)=>{r.d(t,{T:()=>s});var a=r(48105);let s=(0,a.createServerReference)("70df36079d185522fe452a43a063874fc73e9b4ac9",a.callServer,void 0,a.findSourceMapURL,"addCommentAction")},74779:(e,t,r)=>{r.d(t,{TooltipProvider:()=>o,ZI:()=>c,k$:()=>d,m_:()=>i});var a=r(93261),s=r(66425),n=r(5513),l=r(46609);let o=n.Kq,i=n.bL,d=n.l9,c=s.forwardRef(({className:e,sideOffset:t=4,...r},s)=>(0,a.jsx)(n.ZL,{children:(0,a.jsx)(n.UC,{ref:s,sideOffset:t,className:(0,l.cn)("z-50 overflow-hidden rounded-full border border-border/60 bg-popover px-3 py-1.5 text-xs font-medium text-popover-foreground shadow-lg animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));c.displayName=n.UC.displayName},82316:(e,t,r)=>{r.d(t,{P:()=>h});var a=r(93261),s=r(66425),n=r(39825),l=r(80345),o=r(46609),i=r(42318),d=r(48105);let c=(0,d.createServerReference)("60f7c60af6a61ec22b576f508f7c0dc561562bf3eb",d.callServer,void 0,d.findSourceMapURL,"smartTranslateAction");var u=r(44711),m=r(36602),x=r(74779);function f({data:e}){let[t,r]=(0,s.useState)(null);return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("div",{className:"text-sm text-muted-foreground leading-relaxed",children:e.segments.map((e,s)=>(0,a.jsxs)("span",{onMouseEnter:()=>r(s),onMouseLeave:()=>r(null),className:(0,o.cn)("cursor-default transition-colors duration-200 rounded px-0.5 mx-[1px]",t===s?"bg-primary/20 text-primary font-medium":""),children:[e.source_segment," "]},`src-${s}`))}),(0,a.jsx)("div",{className:"text-base text-foreground font-medium leading-relaxed",children:(0,a.jsx)(x.TooltipProvider,{children:e.segments.map((e,s)=>(0,a.jsxs)(x.m_,{open:t===s&&!!e.grammar_note,children:[(0,a.jsx)(x.k$,{asChild:!0,children:(0,a.jsxs)("span",{onMouseEnter:()=>r(s),onMouseLeave:()=>r(null),className:(0,o.cn)("cursor-pointer transition-all duration-200 rounded px-0.5 mx-[1px] inline-block",t===s?"bg-primary/20 text-primary scale-[1.02]":"",e.grammar_note?"underline decoration-dotted decoration-primary/50 underline-offset-4":""),children:[e.target_segment," ",e.grammar_note&&t===s&&(0,a.jsx)(m.A,{className:"inline h-3 w-3 -mt-0.5 ml-0.5 opacity-70"})]})}),e.grammar_note&&(0,a.jsxs)(x.ZI,{className:"max-w-[250px] bg-primary text-primary-foreground text-xs p-3",children:[(0,a.jsx)("p",{className:"font-bold mb-1",children:"Grammar Note:"}),(0,a.jsx)("p",{children:e.grammar_note})]})]},`tgt-${s}`))})}),(0,a.jsx)("div",{className:"flex justify-end",children:(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider font-bold bg-gradient-to-r from-amber-500 to-purple-600 bg-clip-text text-transparent",children:"Smart Translate â¨"})})]})}function h({originalText:e,className:t,onTranslate:r}
1){let[d,m]=(0,s.useState)(null),[x,p]=(0,s.useState)(null),[g,v]=(0,s.useState)(!1),[b,j]=(0,s.useState)(!1),[w,N]=(0,s.useState)(!1),y=async t=>{if(t.stopPropagation(),t.preventDefault(),d)return void j(!b);v(!0),N(!1);try{let t=(navigator.language||"en-US").split("-")[0],s=await c(e,t);if(s.success&&s.data){p(s.data),m(s.data.translation),r&&r(s.data.translation),i.oR.success("Smart Translation Active â¨"),v(!1);return}"Premium Required"===s.error?(0,i.oR)("Basic translation loaded",{description:"Upgrade to Pro for interactive grammar & alignment!",icon:(0,a.jsx)(n.A,{className:"w-4 h-4 text-purple-500"})}):s.error&&console.error("Smart Translate failed:",s.error);let l=await (0,u.W)(e,t);l.error?(i.oR.error(l.error),N(!0)):l.translatedText&&(m(l.translatedText),r&&r(l.translatedText))}catch(e){console.error(e),i.oR.error("Failed to translate"),N(!0)}finally{v(!1)}};return w?null:(0,a.jsxs)("div",{className:(0,o.cn)("relative inline-flex",t),children:[!b&&(0,a.jsx)(a.Fragment,{children:x?(0,a.jsx)("div",{className:"absolute bottom-full left-0 mb-2 w-64 border-l-2 border-primary/50 pl-3 py-2 animate-in fade-in bg-card rounded-r-md shadow-lg border border-border z-50",children:(0,a.jsx)(f,{data:x})}):d&&(0,a.jsx)("div",{className:"absolute bottom-full left-0 mb-2 w-64 text-sm border-l-2 border-primary/50 pl-2 py-1 animate-in fade-in bg-card rounded-r-md shadow-md border border-border z-50",children:d})}),(0,a.jsxs)("button",{onClick:y,disabled:g,className:"text-xs text-muted-foreground hover:text-primary flex items-center gap-1 transition-colors",title:"Translate",children:[x?(0,a.jsx)(n.A,{className:"w-3 h-3 text-purple-500"}):(0,a.jsx)(l.A,{className:"w-3 h-3"}),(0,a.jsx)("span",{children:g?"Translating...":d?b?"Show Translation":"Show Original":"Translate"})]})]})}},90337:(e,t,r)=>{r.d(t,{Fj:()=>x,Ip:()=>c,K5:()=>m,Pd:()=>f,Rc:()=>d,es:()=>h,kt:()=>u,tz:()=>i});var a=r(93261),s=r(66425),n=r(88606),l=r(46609);let o=s.createContext({open:!1,x:0,y:0,setOpen:()=>{},setPosition:()=>{}}),i=({children:e})=>{let[t,r]=s.useState(!1),[n,l]=s.useState({x:0,y:0});return s.useEffect(()=>{let e=()=>r(!1);return t&&window.addEventListener("click",e),()=>window.removeEventListener("click",e)},[t]),s.useEffect(()=>{let e=()=>r(!1);return t&&window.addEventListener("scroll",e,{capture:!0}),()=>window.removeEventListener("scroll",e,{capture:!0})},[t]),(0,a.jsx)(o.Provider,{value:{open:t,x:n.x,y:n.y,setOpen:r,setPosition:(e,t)=>l({x:e,y:t})},children:e})},d=({children:e,className:t})=>{let{setOpen:r,setPosition:n}=s.useContext(o);return(0,a.jsx)("div",{className:t,onContextMenu:e=>{e.preventDefault(),r(!0),n(e.clientX,e.clientY)},children:e})},c=({children:e,className:t})=>{let{open:r,x:n,y:i}=s.useContext(o);return r?(0,a.jsx)("div",{className:(0,l.cn)("fixed z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-80 zoom-in-95",t),style:{left:n,top:i},children:e}):null},u=({className:e,inset:t,onClick:r,children:s,...n})=>(0,a.jsx)("div",{className:(0,l.cn)("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),onClick:r,...n,children:s}),m=({className:e,...t})=>(0,a.jsx)("div",{className:(0,l.cn)("-mx-1 my-1 h-px bg-border",e),...t}),x=({children:e})=>(0,a.jsx)("div",{children:e}),f=({children:e,className:t})=>(0,a.jsxs)("div",{className:(0,l.cn)("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none text-muted-foreground",t),children:[e," ",(0,a.jsx)(n.A,{className:"ml-auto h-4 w-4"})]}),h=({children:e})=>null},93612:(e,t,r)=>{r.d(t,{T:()=>n});var a=r(93261);r(66425);var s=r(46609);function n({className:e,...t}){return(0,a.jsx)("textarea",{"data-slot":"textarea",className:(0,s.cn)("border-input/60 placeholder:text-muted-foreground focus-visible:border-ring/60 focus-visible:ring-ring/30 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-2xl border bg-background px-4 py-3 text-base transition-[color,box-shadow,border-color] outline-none focus-visible:ring-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),...t})}}}]);
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.