import{a as y}from"/build/_shared/chunk-GCSGTKFG.js";import{Aa as U,Ba as _,Ca as j,Da as $,Ea as N,Fa as T,Ga as P,Ua as z,W as p,d as R,o as S,p as v,q as w,r as B,ua as l,yb as E}from"/build/_shared/chunk-WTSCANCV.js";import{O as I,b as C,ca as D,m as Y,pa as k,s as n}from"/build/_shared/chunk-FBTTROEM.js";import{I as b,a as Q}from"/build/_shared/chunk-NQJZCUPB.js";import{e as s}from"/build/_shared/chunk-ADMCF34Z.js";var ao="_12ly3j70",ro="_12ly3j71",O="_12ly3j72",no="_12ly3j73";var g=s(Y(),1);var a=s(Q(),1);var F="_1tfbhfj0",M="_1tfbhfj1",W="_1tfbhfj2",V="_1tfbhfj3";var X="_1tfbhfj6",A="_1tfbhfj7";var o=s(b(),1),i=({icon:c,shareUrl:e,label:d})=>(0,o.jsx)("a",{href:e,target:"_blank",rel:"noreferrer noopener","aria-label":d,role:"button",className:A,children:(0,o.jsx)(c,{size:20})}),eo=({linkOnly:c,shareLink:e,width:d="12rem",shareText:m,primary:h,shareLocation:u,size:H="round"})=>{let[q,f]=(0,a.useState)(!1),[t,G]=(0,a.useState)(""),x=(0,a.useId)();(0,a.useEffect)(()=>{G(e||window.location.href)},[e]);let J=()=>{f(!1)},K=async()=>{try{await navigator.clipboard.writeText(t),console.log("Copied to clipboard successfully!"),f(!0)}catch(L){console.error("Failed to copy text (this will fail running locally): ",L),C.includes("localhost")&&f(!0)}},r={twitter:`https://x.com/intent/tweet?text=${encodeURIComponent(m??"")}&url=${encodeURIComponent(e??t)}`,linkedin:`https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(e??t)}`,facebook:`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(e??t)}`,reddit:`https://reddit.com/submit?url=${encodeURIComponent(e??t)}&title=${encodeURIComponent(m??"")}`,email:`mailto:?subject=${encodeURIComponent(m??"")}&body=${encodeURIComponent(e??t)}`};return(0,o.jsxs)(U,{children:[(0,o.jsx)(_,{asChild:!0,id:`share-trigger-${x}`,children:c?(0,o.jsxs)("button",{type:"button",className:O,children:[(0,o.jsx)(D,{})," ",(0,o.jsx)("span",{children:"Copy Link"})]}):e?(0,o.jsxs)(p,{hasIcon:!0,type:"button",color:h?"primary":"secondary",size:H,style:{width:d},onClick:()=>y.capture("Share",{location:u,type:"Web"}),children:[!h&&(0,o.jsx)(k,{})," Share"]}):(0,o.jsx)(z,{icon:"Share2Icon",size:"lg",color:h?"primary":"secondary","aria-label":"Share",onClick:()=>y.capture("Share",{location:u,type:"Web"})})}),(0,o.jsxs)(j,{children:[(0,o.jsx)($,{className:F}),(0,o.jsxs)(N,{className:M,id:`share-content-${x}`,children:[(0,o.jsx)(T,{asChild:!0,children:(0,o.jsx)("h3",{className:(0,g.default)(n({heading:"h3"})),style:{position:"absolute",left:24,top:24},children:"Share"})}),(0,o.jsx)(P,{asChild:!0,children:(0,o.jsx)(p,{color:"unstyled","aria-label":"Close",className:X,onClick:J,children:(0,o.jsx)(I,{style:{width:"1.5rem",height:"1.5rem"}})})}),(0,o.jsxs)("div",{style:{padding:"48px 24px 0"},children:[(0,o.jsxs)(l,{display:"flex",gap:"$3",justifyContent:"space-between",paddingTop:"12px",children:[(0,o.jsx)(i,{icon:R,shareUrl:r.twitter,label:"Share on X"}),(0,o.jsx)(i,{icon:S,shareUrl:r.linkedin,label:"Share on LinkedIn"}),(0,o.jsx)(i,{icon:w,shareUrl:r.facebook,label:"Share on Facebook"}),(0,o.jsx)(i,{icon:v,shareUrl:r.reddit,label:"Share on Reddit"}),(0,o.jsx)(i,{icon:B,shareUrl:r.email,label:"Share via Email"})]}),(0,o.jsx)(l,{padding:"32px 0",children:(0,o.jsx)(E,{})}),(0,o.jsxs)(l,{display:"flex",flexDirection:{mobile:"column",desktop:"row"},gap:"$2",children:[(0,o.jsx)(l,{borderRadius:"0.5rem",padding:"0.75rem 0.75rem 0.75rem 1rem",backgroundColor:"$primaryWhite",display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",flex:"1",minWidth:"0",children:(0,o.jsx)("span",{className:(0,g.default)(n(),V),style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t})}),(0,o.jsx)(p,{onClick:K,className:W,children:q?(0,o.jsx)(o.Fragment,{children:(0,o.jsx)("span",{className:n({color:"inverse",body:"body-sm"}),children:"Copied"})}):(0,o.jsx)("span",{className:n({color:"inverse",body:"body-sm"}),children:"Copy link"})})]})]})]})]})]})},to=eo;export{ao as a,ro as b,O as c,no as d,to as e};
