// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-3.0-or-later
// @source: https://gitlab.com/soapbox-pub/ditto/-/tree/f0a3877c
import{Qn as e,Qr as t,Xr as n,Yn as r,ei as i,ti as a}from"./lucide-icons-BdRF0moN.js";import{t as o}from"./jsx-runtime-By8HlURe.js";import{l as s}from"./EmbeddedNote-BKfkvcrg.js";import{l as c}from"./useCurrentUser-C6OJJlWo.js";import{a as l}from"./appRelays-Clm5NPIe.js";import{n as u}from"./chunk-62JRHF6Z-yJW_vgm4.js";import{t as d}from"./skeleton-CVls4GW9.js";import{n as f}from"./safeNip19-CtQLwPmS.js";import{d as p,f as m,m as h,p as g,u as _}from"./useEventInteractions-Buyvdv_T.js";import{t as v}from"./getDisplayName-B6lnEGRj.js";import{r as y}from"./useLinkPreview-CqNF97jn.js";import{t as b}from"./GitSiteLinks-CnSU1vGl.js";import{r as x,t as S}from"./lib-D6JeXc-v.js";import{t as C}from"./markdownComponents-BiuuXc15.js";var w=o();function T(e,o){switch(e){case 1630:return{icon:t,className:`border-green-500/30 text-green-700 dark:text-green-400 bg-green-500/5`};case 1631:return{icon:o===1617||o===1618?r:a,className:`border-purple-500/30 text-purple-700 dark:text-purple-400 bg-purple-500/5`};case 1632:return{icon:n,className:`border-red-500/30 text-red-700 dark:text-red-400 bg-red-500/5`};default:return{icon:i,className:`border-border text-muted-foreground bg-muted/40`}}}function E({pubkey:e}){return(0,w.jsxs)(`span`,{className:`text-muted-foreground`,children:[` by `,v(c(e).data?.metadata,e)]})}function D({event:t,preview:n=!0}){let i=p(t),a=_(t),o=a?.identifier??``,c=[...i?.relay?[i.relay]:[],...a?.relay?[a.relay]:[],l],{data:v,isLoading:D}=y(i?.id,c,a?.pubkey),O=g(t.kind,v?.kind),k=h(v?.kind),A=v?m(v):void 0,{icon:j,className:M}=T(t.kind,v?.kind),N=i?f({id:i.id,relays:i.relay?[i.relay]:[l],author:v?.pubkey}):void 0,P=f({id:t.id,author:t.pubkey,relays:[l]}),F=t.content.trim(),I=t.tags.find(([e])=>e===`merge-commit`||e===`merge-commit-id`)?.[1],L=t.tags.find(([e])=>e===`applied-as-commits`)?.slice(1)??[],R=A??(i?`#${i.id.slice(0,8)}`:void 0);return(0,w.jsxs)(`div`,{className:`mt-2 space-y-3`,children:[(0,w.jsx)(`div`,{className:`rounded-2xl border border-border overflow-hidden`,children:(0,w.jsxs)(`div`,{className:`px-3.5 py-3 space-y-2.5`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[11px] font-medium capitalize shrink-0 ${M}`,children:[(0,w.jsx)(j,{className:`size-3`}),O]}),k&&(0,w.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[k,v&&(0,w.jsx)(E,{pubkey:v.pubkey})]})]}),D&&!R?(0,w.jsx)(d,{className:`h-4 w-3/4`}):R?(0,w.jsxs)(`div`,{className:`min-w-0`,children:[N?(0,w.jsx)(u,{to:`/${N}`,className:`font-semibold text-sm leading-snug hover:underline break-words line-clamp-2`,onClick:e=>e.stopPropagation(),children:R}):(0,w.jsx)(`span`,{className:`font-semibold text-sm leading-snug break-words line-clamp-2`,children:R}),o&&(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5 font-mono`,children:o})]}):o&&(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground font-mono`,children:o}),I&&(0,w.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-muted/50 px-2.5 py-1.5`,children:[(0,w.jsx)(r,{className:`size-3.5 text-muted-foreground shrink-0`}),(0,w.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`Merge commit`}),(0,w.jsx)(`code`,{className:`ml-auto text-[11px] font-mono text-muted-foreground`,children:I.slice(0,12)})]}),!n&&L.length>0&&(0,w.jsx)(`div`,{className:`rounded-lg bg-muted/50 divide-y divide-border/50 overflow-hidden`,children:L.map(t=>(0,w.jsxs)(`div`,{className:`flex items-center gap-2 px-2.5 py-1.5`,children:[(0,w.jsx)(e,{className:`size-3.5 text-muted-foreground shrink-0`}),(0,w.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`Applied as`}),(0,w.jsx)(`code`,{className:`ml-auto text-[11px] font-mono text-muted-foreground`,children:t.slice(0,12)})]},t))}),n&&F&&(0,w.jsx)(`div`,{className:`text-[13px] text-muted-foreground line-clamp-3 leading-relaxed whitespace-pre-wrap break-words`,children:(0,w.jsx)(s,{event:t,as:`span`,disableNoteEmbeds:!0,disableMediaEmbeds:!0})}),(0,w.jsx)(b,{nip19:P,className:`pt-0.5`})]})}),!n&&F&&(0,w.jsx)(`div`,{className:`rounded-2xl border border-border overflow-hidden px-4 py-4 sidebar:px-5 sidebar:py-5`,children:(0,w.jsx)(`div`,{className:`prose prose-sm max-w-none break-words text-foreground prose-headings:text-foreground prose-headings:font-bold prose-strong:text-foreground prose-a:text-primary prose-img:rounded-lg prose-pre:overflow-x-auto prose-pre:rounded-lg prose-pre:bg-muted prose-pre:text-foreground prose-code:text-[13px] prose-code:text-foreground prose-code:before:content-none prose-code:after:content-none prose-code:bg-muted prose-code:rounded prose-code:px-1.5 prose-code:py-0.5 prose-code:font-normal prose-li:marker:text-muted-foreground prose-blockquote:text-muted-foreground prose-blockquote:border-border prose-hr:border-border prose-th:text-foreground`,children:(0,w.jsx)(x,{rehypePlugins:[S],components:C(t),children:F})})})]})}export{D as GitStatusCard};
// @license-end
