{"version":3,"file":"ShareButtons.CVIsXwVE.mjs","names":["useMemo","useState","useCallback","startTransition"],"sources":["https:/framerusercontent.com/modules/XWr7rJp67WpcZmEVlF89/lxvsWvHTFkqIGk7nXuoD/ShareButtons.js"],"sourcesContent":["// User request: Fix the blog \"Share this post\" social media links so they generate real share URLs per post (and implement Copy Link).\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,useIsStaticRenderer,RenderTarget}from\"framer\";import{startTransition,useCallback,useMemo,useState}from\"react\";function getCanonicalUrl(fallbackUrl){if(typeof window===\"undefined\")return fallbackUrl;try{const canonical=document.querySelector('link[rel=\"canonical\"]')?.href;if(canonical)return canonical;const ogUrl=document.querySelector('meta[property=\"og:url\"]')?.getAttribute(\"content\");if(ogUrl)return ogUrl;const href=window.location.href||fallbackUrl;return href.split(\"#\")[0];}catch{return fallbackUrl;}}function getBestTitle(explicitTitle){const t=explicitTitle?.trim();if(t)return t;if(typeof document===\"undefined\")return\"\";try{// Prefer on-page title (blog posts) over site-level og:title.\nconst h1=document.querySelector(\"h1\")?.textContent?.trim();if(h1)return h1;const ogTitle=document.querySelector('meta[property=\"og:title\"]')?.getAttribute(\"content\")?.trim();if(ogTitle)return ogTitle;return document.title||\"\";}catch{return document.title||\"\";}}/**\n * Share Buttons\n *\n * Renders X / LinkedIn / Facebook / Copy Link buttons that share the current page URL.\n *\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function ShareButtons(props){const{iconSize,gap,iconColor,hoverColor,fallbackUrl,title,style}=props;const isStatic=useIsStaticRenderer();const pageUrl=useMemo(()=>getCanonicalUrl(fallbackUrl),// eslint-disable-next-line react-hooks/exhaustive-deps\n[fallbackUrl]);const shareTitle=useMemo(()=>getBestTitle(title),// eslint-disable-next-line react-hooks/exhaustive-deps\n[title]);const[hovered,setHovered]=useState(null);const[copied,setCopied]=useState(false);const encodedUrl=useMemo(()=>encodeURIComponent(pageUrl),[pageUrl]);const encodedTitle=useMemo(()=>encodeURIComponent(shareTitle),[shareTitle]);const links=useMemo(()=>{return{x:`https://x.com/intent/tweet?url=${encodedUrl}${shareTitle?`&text=${encodedTitle}`:\"\"}`,linkedin:`https://www.linkedin.com/sharing/share-offsite/?url=${encodedUrl}`,facebook:`https://www.facebook.com/sharer/sharer.php?u=${encodedUrl}`};},[encodedUrl,encodedTitle,shareTitle]);const openShare=useCallback(url=>{if(typeof window===\"undefined\")return;// In Canvas renderer, avoid opening tabs.\nif(isStatic||RenderTarget.current()===RenderTarget.canvas)return;window.open(url,\"_blank\",\"noopener,noreferrer\");},[isStatic]);const copyLink=useCallback(async()=>{if(typeof window===\"undefined\")return;if(isStatic||RenderTarget.current()===RenderTarget.canvas)return;try{await navigator.clipboard.writeText(pageUrl);startTransition(()=>setCopied(true));window.setTimeout(()=>{startTransition(()=>setCopied(false));},1200);}catch{// Fallback: try prompt\ntry{window.prompt(\"Copy link:\",pageUrl);}catch{// ignore\n}}},[isStatic,pageUrl]);const baseButtonStyle=useMemo(()=>({width:iconSize,height:iconSize,display:\"inline-flex\",alignItems:\"center\",justifyContent:\"center\",padding:0,border:\"none\",background:\"transparent\",color:iconColor,cursor:isStatic?\"default\":\"pointer\"}),[iconSize,iconColor,isStatic]);const containerStyle=useMemo(()=>({...style,position:\"relative\",display:\"inline-flex\",alignItems:\"center\",justifyContent:\"center\",gap}),[style,gap]);const colorFor=useCallback(key=>hovered===key?hoverColor:iconColor,[hovered,hoverColor,iconColor]);const iconProps=useMemo(()=>({width:iconSize,height:iconSize,viewBox:\"0 0 24 24\",fill:\"none\",stroke:\"currentColor\",strokeWidth:2,strokeLinecap:\"round\",strokeLinejoin:\"round\",\"aria-hidden\":true}),[iconSize]);return /*#__PURE__*/_jsxs(\"div\",{style:containerStyle,role:\"group\",\"aria-label\":\"Share this post\",children:[/*#__PURE__*/_jsx(\"button\",{type:\"button\",\"aria-label\":\"Share on X\",style:{...baseButtonStyle,color:colorFor(\"x\")},onMouseEnter:()=>startTransition(()=>setHovered(\"x\")),onMouseLeave:()=>startTransition(()=>setHovered(null)),onClick:()=>openShare(links.x),children:/*#__PURE__*/_jsxs(\"svg\",{...iconProps,children:[/*#__PURE__*/_jsx(\"path\",{d:\"M4 4l16 16\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M20 4L4 20\"})]})}),/*#__PURE__*/_jsx(\"button\",{type:\"button\",\"aria-label\":\"Share on LinkedIn\",style:{...baseButtonStyle,color:colorFor(\"linkedin\")},onMouseEnter:()=>startTransition(()=>setHovered(\"linkedin\")),onMouseLeave:()=>startTransition(()=>setHovered(null)),onClick:()=>openShare(links.linkedin),children:/*#__PURE__*/_jsxs(\"svg\",{...iconProps,children:[/*#__PURE__*/_jsx(\"path\",{d:\"M4 4h4v16H4z\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M6 9h2\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M10 10v10\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M10 13c0-2 1-3 3-3s3 1 3 3v7\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M10 10h3\"})]})}),/*#__PURE__*/_jsx(\"button\",{type:\"button\",\"aria-label\":\"Share on Facebook\",style:{...baseButtonStyle,color:colorFor(\"facebook\")},onMouseEnter:()=>startTransition(()=>setHovered(\"facebook\")),onMouseLeave:()=>startTransition(()=>setHovered(null)),onClick:()=>openShare(links.facebook),children:/*#__PURE__*/_jsx(\"svg\",{...iconProps,children:/*#__PURE__*/_jsx(\"path\",{d:\"M15 3h-2a4 4 0 0 0-4 4v3H7v4h2v7h4v-7h3l1-4h-4V7a1 1 0 0 1 1-1h3z\"})})}),/*#__PURE__*/_jsx(\"button\",{type:\"button\",\"aria-label\":copied?\"Link copied\":\"Copy link\",style:{...baseButtonStyle,color:colorFor(\"copy\")},onMouseEnter:()=>startTransition(()=>setHovered(\"copy\")),onMouseLeave:()=>startTransition(()=>setHovered(null)),onClick:copyLink,children:/*#__PURE__*/_jsxs(\"svg\",{...iconProps,children:[/*#__PURE__*/_jsx(\"path\",{d:\"M10 13a5 5 0 0 1 0-7l1-1a5 5 0 0 1 7 7l-1 1\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M14 11a5 5 0 0 1 0 7l-1 1a5 5 0 0 1-7-7l1-1\"})]})})]});}addPropertyControls(ShareButtons,{iconSize:{type:ControlType.Number,title:\"Icon Size\",defaultValue:18,min:12,max:32,step:1,unit:\"px\"},gap:{type:ControlType.Number,title:\"Gap\",defaultValue:8,min:0,max:32,step:1,unit:\"px\"},iconColor:{type:ControlType.Color,title:\"Icon\",defaultValue:\"#9B9CA1\"},hoverColor:{type:ControlType.Color,title:\"Hover\",defaultValue:\"#33C6AB\"},fallbackUrl:{type:ControlType.Link,title:\"Fallback URL\",defaultValue:\"https://www.edamame.tech\"},title:{type:ControlType.String,title:\"Title\",defaultValue:\"\",placeholder:\"Optional share text\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ShareButtons\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ShareButtons.map"],"mappings":"0OAC8M,SAAS,EAAgB,EAAY,CAAC,GAAU,IAAS,OAAY,OAAO,EAAY,GAAG,CAA+P,OAA9O,SAAS,cAAc,wBAAwB,EAAE,MAA+C,SAAS,cAAc,0BAA0B,EAAE,aAAa,UAAU,GAAkC,EAAO,SAAS,MAAM,GAAwB,MAAM,IAAI,CAAC,QAAS,CAAC,OAAO,GAAc,SAAS,EAAa,EAAc,CAAC,IAAM,EAAE,GAAe,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,OAAO,SAAW,IAAY,MAAM,GAAG,GAAG,CACphB,OAA/L,SAAS,cAAc,KAAK,EAAE,aAAa,MAAM,EAA+B,SAAS,cAAc,4BAA4B,EAAE,aAAa,UA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