{"version":3,"file":"ShareButton.Dobj3Ylq.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/3AQHwpIEemG34JVuccCB/2ME3VMP7XrYtfdmmAaqo/ShareButton.js"],"sourcesContent":["// Share Button that shares the current webpage link\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useState,startTransition}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * Share Button\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function ShareButton(props){const{children,copiedDuration,style}=props;const[copied,setCopied]=useState(false);function setCopiedState(){startTransition(()=>setCopied(true));window.setTimeout(()=>{startTransition(()=>setCopied(false));},copiedDuration);}function handleShare(){if(typeof window===\"undefined\"||typeof navigator===\"undefined\")return;const url=window.location.href;if(typeof navigator.share===\"function\"){navigator.share({url}).catch(()=>{// User cancelled native share sheet or browser blocked it.\n});return;}if(navigator.clipboard?.writeText){navigator.clipboard.writeText(url).then(setCopiedState).catch(()=>{});return;}if(typeof document===\"undefined\")return;const input=document.createElement(\"input\");input.value=url;input.style.position=\"fixed\";input.style.left=\"-9999px\";input.style.top=\"-9999px\";document.body.appendChild(input);input.focus();input.select();try{document.execCommand(\"copy\");setCopiedState();}catch{// Ignore fallback failure.\n}document.body.removeChild(input);}if(RenderTarget.current()===RenderTarget.thumbnail)return null;if(!children)return null;return /*#__PURE__*/_jsx(\"div\",{role:\"button\",tabIndex:0,\"aria-label\":copied?\"Link copied\":\"Share this page\",onClick:handleShare,onKeyDown:event=>{if(event.key===\"Enter\"||event.key===\" \"){event.preventDefault();handleShare();}},style:{...style,width:\"100%\",height:\"100%\",display:\"contents\",cursor:\"pointer\"},children:children});}addPropertyControls(ShareButton,{children:{type:ControlType.Slot,title:\"Element\",maxCount:1},copiedDuration:{type:ControlType.Number,title:\"Copied Time\",defaultValue:1200,min:300,max:5e3,step:100,unit:\"ms\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ShareButton\",\"slots\":[\"children\"],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ShareButton.map"],"mappings":"yMAMG,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,WAAS,iBAAe,SAAO,EAAW,CAAC,EAAO,GAAWA,EAAS,EAAK,EAAE,SAAS,GAAgB,CAAC,MAAoB,EAAU,EAAI,CAAC,EAAE,EAAO,eAAe,CAAC,MAAoB,EAAU,EAAK,CAAC,CAAE,EAAE,CAAc,CAAE,CAAC,SAAS,GAAa,CAAC,GAAU,IAAS,QAAoB,IAAY,OAAY,OAAO,IAAM,EAAI,EAAO,SAAS,KAAK,GAAG,OAAO,EAAU,OAAQ,WAAW,CAAC,EAAU,MAAM,CAAC,KAAG,CAAC,CAAC,CAAC,UAAU,CACrd,CAAC,EAAE,MAAO,CAAC,GAAG,EAAU,WAAW,UAAU,CAAC,EAAU,UAAU,UAAU,CAAG,CAAC,CAAC,KAAK,CAAc,CAAC,CAAC,UAAU,CAAC,CAAC,EAAE,MAAO,CAAC,GAAG,OAAO,SAAW,IAAY,OAAO,IAAM,EAAM,SAAS,cAAc,OAAO,EAAE,EAAM,MAAM,EAAI,EAAM,MAAM,SAAS,QAAQ,EAAM,MAAM,KAAK,UAAU,EAAM,MAAM,IAAI,UAAU,SAAS,KAAK,YAAY,CAAK,EAAE,EAAM,MAAM,EAAE,EAAM,OAAO,EAAE,GAAG,CAAC,SAAS,YAAY,MAAM,EAAE,EAAe,CAAE,MAAM,CACxa,CAAC,SAAS,KAAK,YAAY,CAAK,CAAE,CAAyF,OAArF,EAAa,QAAQ,IAAI,EAAa,WAAyB,CAAC,EAAgB,KAAyB,EAAK,MAAM,CAAC,KAAK,SAAS,SAAS,EAAE,aAAa,EAAO,cAAc,kBAAkB,QAAQ,EAAY,UAAU,GAAO,EAAI,EAAM,MAAM,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