// @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{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Fr as t,Qn as n,Zn as r,p as i,qi as a,qn as o}from"./lucide-icons-BdRF0moN.js";import{t as s}from"./jsx-runtime-By8HlURe.js";import{a as c}from"./downloadFile-kpATXaJi.js";import{t as l}from"./button-Cs26nq0r.js";import{a as u}from"./appRelays-Clm5NPIe.js";import{n as d}from"./safeNip19-CtQLwPmS.js";import{t as f}from"./badge-eEdLlpTp.js";import{t as p}from"./GitSiteLinks-CnSU1vGl.js";import{r as m,t as h}from"./lib-D6JeXc-v.js";import{t as g}from"./markdownComponents-BiuuXc15.js";var _=e(a(),1),v=s();function y({event:e,preview:a=!0}){let s=e.tags.find(([e])=>e===`subject`)?.[1],y=e.tags.find(([e])=>e===`branch-name`)?.[1],b=(e.tags.find(([e])=>e===`a`)?.[1])?.split(`:`)[2]??``,x=e.tags.filter(([e])=>e===`clone`).map(([,e])=>e),S=e.tags.some(([e,t])=>e===`t`&&t===`shakespeare`),C=e.tags.find(([e])=>e===`c`)?.[1],w=e.tags.find(([e])=>e===`merge-base`)?.[1],T=e.tags.filter(([e])=>e===`t`).map(([,e])=>e).filter(e=>e!==`shakespeare`),E=s||e.content.split(` `)[0]?.trim()||`Pull Request`,D=e.content.trim().length>0,[O,k]=(0,_.useState)(!1),A=e=>{navigator.clipboard.writeText(e),k(!0),setTimeout(()=>k(!1),2e3)},j=x[0]?`https://shakespeare.diy/clone?url=${encodeURIComponent(x[0])}`:`https://shakespeare.diy`,M=d({id:e.id,author:e.pubkey,relays:[u]});return(0,v.jsxs)(`div`,{className:`mt-2 space-y-3`,children:[(0,v.jsx)(`div`,{className:`rounded-2xl border border-border overflow-hidden`,children:(0,v.jsxs)(`div`,{className:`px-3.5 py-3 space-y-2`,children:[(0,v.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,v.jsx)(o,{className:`size-4 text-emerald-600 dark:text-emerald-400 shrink-0 mt-0.5`}),(0,v.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,v.jsx)(`span`,{className:`font-semibold text-sm leading-snug line-clamp-2`,children:E}),(0,v.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-0.5 text-xs text-muted-foreground`,children:[b&&(0,v.jsx)(`span`,{className:`font-mono`,children:b}),b&&y&&(0,v.jsx)(`span`,{className:`text-muted-foreground/40`,children:`/`}),y&&(0,v.jsx)(f,{variant:`secondary`,className:`text-[10px] font-mono px-1.5 py-0 border-0`,children:y})]})]})]}),T.length>0&&(0,v.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[T.slice(0,a?6:T.length).map(e=>(0,v.jsxs)(`span`,{className:`text-[11px] text-muted-foreground`,children:[`#`,e]},e)),a&&T.length>6&&(0,v.jsxs)(`span`,{className:`text-[11px] text-muted-foreground/50`,children:[`+`,T.length-6,` more`]})]}),x[0]&&(0,v.jsxs)(`div`,{className:`group/clone flex items-center gap-2 rounded-lg bg-muted/50 px-2.5 py-1.5`,children:[(0,v.jsx)(`code`,{className:`flex-1 text-[11px] font-mono text-muted-foreground truncate select-all`,children:x[0]}),(0,v.jsxs)(l,{variant:`ghost`,size:`sm`,className:`h-5 w-5 p-0 shrink-0 opacity-50 group-hover/clone:opacity-100 transition-opacity`,onClick:e=>{e.stopPropagation(),A(x[0])},children:[(0,v.jsx)(t,{className:`size-3`}),(0,v.jsx)(`span`,{className:`sr-only`,children:O?`Copied`:`Copy`})]})]}),(0,v.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[S&&(0,v.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 rounded-full bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground transition-colors hover:bg-primary/90`,onClick:e=>{e.stopPropagation(),c(j)},children:[(0,v.jsx)(i,{className:`size-3`}),`Edit with Shakespeare`]}),(0,v.jsx)(p,{nip19:M})]})]})}),!a&&(C||w||y)&&(0,v.jsxs)(`div`,{className:`rounded-2xl border border-border overflow-hidden divide-y divide-border`,children:[y&&(0,v.jsxs)(`div`,{className:`flex items-center gap-2.5 px-3.5 py-2 text-sm`,children:[(0,v.jsx)(r,{className:`size-3.5 text-muted-foreground shrink-0`}),(0,v.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:`Branch`}),(0,v.jsx)(`code`,{className:`ml-auto text-xs font-mono text-muted-foreground`,children:y})]}),C&&(0,v.jsxs)(`div`,{className:`flex items-center gap-2.5 px-3.5 py-2 text-sm`,children:[(0,v.jsx)(n,{className:`size-3.5 text-muted-foreground shrink-0`}),(0,v.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:`Tip`}),(0,v.jsx)(`code`,{className:`ml-auto text-xs font-mono text-muted-foreground`,children:C.slice(0,12)})]}),w&&(0,v.jsxs)(`div`,{className:`flex items-center gap-2.5 px-3.5 py-2 text-sm`,children:[(0,v.jsx)(n,{className:`size-3.5 text-muted-foreground shrink-0`}),(0,v.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:`Base`}),(0,v.jsx)(`code`,{className:`ml-auto text-xs font-mono text-muted-foreground`,children:w.slice(0,12)})]})]}),!a&&D&&(0,v.jsx)(`div`,{className:`rounded-2xl border border-border overflow-hidden px-4 py-4 sidebar:px-5 sidebar:py-5`,children:(0,v.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,v.jsx)(m,{rehypePlugins:[h],components:g(e),children:e.content})})})]})}export{y as PullRequestCard}; // @license-end