import{r as c,j as t,be as x,bf as b,B as v,ch as C,bg as j,m as l}from"./index-CfKY7XrC.js";function w({command:o,buttonLabel:r,copied:n,onCopy:d}){const[m,s]=c.useState(!1),[f,p]=c.useState(!1),e=c.useRef(null);c.useEffect(()=>()=>{e.current&&(clearTimeout(e.current),e.current=null)},[]);const a=()=>{e.current&&(clearTimeout(e.current),e.current=null)},i=()=>{a(),e.current=setTimeout(()=>s(!1),120)},h=m||f;return t.jsxs(x,{open:h,onOpenChange:u=>{u||(a(),s(!1),p(!1))},children:[t.jsx(b,{asChild:!0,children:t.jsxs(v,{size:"sm",variant:"outline",onMouseEnter:()=>{a(),s(!0)},onMouseLeave:i,onClick:()=>{d(),p(!0)},children:[t.jsx(C,{className:"h-3 w-3"}),n?"Copied":r]})}),t.jsx(j,{side:"top",className:"w-auto max-w-md border border-border bg-popover p-2 text-popover-foreground shadow-md",onOpenAutoFocus:u=>u.preventDefault(),onMouseEnter:()=>{a(),s(!0)},onMouseLeave:i,children:t.jsx("code",{className:"block select-text whitespace-pre-wrap break-all rounded bg-muted px-2 py-1 font-mono text-xs text-muted-foreground",children:o})})]})}function P(o){const r=o?`/mcp/${o}`:"/mcp";if(!l)return`http://localhost:8787${r}`;try{const n=new URL(l);return n.pathname=r,n.toString()}catch{return`${l}${r}`}}export{w as C,P as b};
