import{j as e}from"./jsx-runtime.D_zvdyIk.js";import{r as a}from"./index.2yJIXLcc.js";import{F as h}from"./index.DRwKiUZ5.js";import"./iconBase.Blz05Vck.js";const b={fa:h},t=({icon:r,...o})=>{const s=j(r),n=s?s[r]:void 0;return n?e.jsx(n,{...o}):e.jsx("span",{className:"text-sm",children:"Icon not found"})},j=r=>{const o=r.substring(0,2).toLowerCase();return b[o]},u=({socialName:r,className:o,pathname:s})=>{const[n,l]=a.useState(""),[c,i]=a.useState(!1);a.useEffect(()=>{l(window.location.origin)},[]);const x=async()=>{const p=`${n}${window.location.pathname}`;try{await navigator.clipboard.writeText(p),i(!0),setTimeout(()=>{i(!1)},1e3)}catch(d){console.error("Failed to copy text: ",d)}};return e.jsxs("ul",{className:o,children:[e.jsx("li",{children:e.jsxs("a",{"aria-label":r,href:`https://www.facebook.com/sharer/sharer.php?u=${n}${s}`,target:"_blank",rel:"noopener noreferrer nofollow",children:[e.jsx("span",{className:"sr-only",children:r}),e.jsx(t,{className:"inline-block",icon:"FaFacebookF"})]})}),e.jsx("li",{children:e.jsxs("a",{"aria-label":r,href:`https://twitter.com/intent/tweet?text=${n}${s}`,target:"_blank",rel:"noopener noreferrer nofollow",children:[e.jsx("span",{className:"sr-only",children:r}),e.jsx(t,{className:"inline-block",icon:"FaXTwitter"})]})}),e.jsx("li",{children:e.jsxs("a",{"aria-label":r,href:`https://www.linkedin.com/shareArticle?mini=true&url=${n}${s}`,target:"_blank",rel:"noopener noreferrer nofollow",children:[e.jsx("span",{className:"sr-only",children:r}),e.jsx(t,{className:"inline-block",icon:"FaLinkedinIn"})]})}),e.jsx("li",{children:e.jsxs("a",{className:"cursor-pointer relative",onClick:x,"aria-label":"Copy Link",children:[e.jsx("span",{className:"sr-only",children:"Copy Link"}),c&&e.jsxs("span",{className:"text-xs absolute -right-16 text-text dark:text-darkmode-text whitespace-nowrap",children:[e.jsx(t,{className:"inline-block text-green-500",icon:"FaLink"})," ","copied!"]}),e.jsx(t,{className:"inline-block",icon:"FaRegCopy"})]})})]})};export{u as default};
