{"version":3,"file":"ShareButtonOverride.D2aEGcJ6.mjs","names":["useState","useCallback","useMemo","_Fragment","useRef"],"sources":["https:/framerusercontent.com/modules/99ajeZZLHB5UkzkCBEHE/kj3KjOs94lMhN4rpQ6rB/ShareButtonOverride.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{forwardRef,startTransition,useEffect,useRef,useCallback,useMemo,useState}from\"react\";import{useIsStaticRenderer}from\"framer\";// User request: Create an override for a canvas Share button that preserves appearance/children,\n// uses navigator.share when available, otherwise copies URL with robust clipboard fallback,\n// supports keyboard activation, and announces copy/error status accessibly with no visible design changes.\nasync function copyToClipboardWithFallback(text){if(typeof navigator!==\"undefined\"&&navigator.clipboard?.writeText){try{await navigator.clipboard.writeText(text);return true;}catch{// Fall through to legacy fallback.\n}}if(typeof document!==\"undefined\"){const textarea=document.createElement(\"textarea\");textarea.value=text;textarea.setAttribute(\"readonly\",\"true\");textarea.style.position=\"fixed\";textarea.style.top=\"-9999px\";textarea.style.left=\"-9999px\";document.body.appendChild(textarea);textarea.focus();textarea.select();let copied=false;try{copied=document.execCommand(\"copy\");}catch{copied=false;}document.body.removeChild(textarea);return copied;}return false;}export function withShareAction(Component){return /*#__PURE__*/forwardRef(function WithShareAction(props,ref){const[statusMessage,setStatusMessage]=useState(\"\");const updateStatus=useCallback(message=>{startTransition(()=>setStatusMessage(message));if(typeof window!==\"undefined\"){window.setTimeout(()=>{startTransition(()=>setStatusMessage(\"\"));},2e3);}},[]);const shareCurrentPage=useCallback(async()=>{const url=typeof window!==\"undefined\"?window.location.href:\"\";if(!url){updateStatus(\"Unable to copy link.\");return;}if(typeof navigator!==\"undefined\"&&typeof navigator.share===\"function\"){try{await navigator.share({url});return;}catch(error){const aborted=error instanceof DOMException&&error.name===\"AbortError\";if(aborted)return;}}const copied=await copyToClipboardWithFallback(url);updateStatus(copied?\"Link copied.\":\"Unable to copy link.\");},[updateStatus]);const onClick=useCallback(async event=>{if(props.onClick){props.onClick(event);}await shareCurrentPage();},[props,shareCurrentPage]);const onKeyDown=useCallback(async event=>{if(props.onKeyDown){props.onKeyDown(event);}if(event.defaultPrevented)return;const element=event.currentTarget;const isNativeInteractive=element.tagName===\"BUTTON\"||element.tagName===\"A\";if(isNativeInteractive)return;if(event.key===\"Enter\"||event.key===\" \"){event.preventDefault();await shareCurrentPage();}},[props,shareCurrentPage]);const liveRegionStyle=useMemo(()=>({position:\"absolute\",width:1,height:1,padding:0,margin:-1,overflow:\"hidden\",clip:\"rect(0, 0, 0, 0)\",whiteSpace:\"nowrap\",border:0}),[]);return /*#__PURE__*/_jsx(Component,{ref:ref,...props,onClick:onClick,onKeyDown:onKeyDown,role:props.role??\"button\",tabIndex:props.tabIndex??0,style:{...props.style},\"aria-label\":props[\"aria-label\"]??\"Share this page\",children:/*#__PURE__*/_jsxs(_Fragment,{children:[props.children,/*#__PURE__*/_jsx(\"span\",{\"aria-live\":\"polite\",\"aria-atomic\":\"true\",style:liveRegionStyle,children:statusMessage})]})});});}export function withReplayOnNavigation(Component){return /*#__PURE__*/forwardRef(function WithReplayOnNavigation(props,ref){const[mountKey,setMountKey]=useState(0);const lastPathnameRef=useRef(\"\");const updateForPathChange=useCallback(()=>{if(typeof window===\"undefined\")return;const nextPathname=window.location.pathname;if(!nextPathname)return;if(nextPathname===lastPathnameRef.current)return;lastPathnameRef.current=nextPathname;startTransition(()=>{setMountKey(value=>value+1);});},[]);useEffect(()=>{if(typeof window===\"undefined\")return;lastPathnameRef.current=window.location.pathname;const onPotentialRouteChange=()=>{updateForPathChange();};window.addEventListener(\"popstate\",onPotentialRouteChange);const navigationApi=window.navigation;if(navigationApi){navigationApi.addEventListener(\"currententrychange\",onPotentialRouteChange);}// Fallback for routers that update history without emitting observable browser events.\nconst pollId=window.setInterval(onPotentialRouteChange,250);return()=>{window.removeEventListener(\"popstate\",onPotentialRouteChange);if(navigationApi){navigationApi.removeEventListener(\"currententrychange\",onPotentialRouteChange);}window.clearInterval(pollId);};},[updateForPathChange]);return /*#__PURE__*/_jsx(Component,{ref:ref,...props},mountKey);});}export function withViewportVideoPlayback(Component){return /*#__PURE__*/forwardRef(function WithViewportVideoPlayback(props,ref){const hostRef=useRef(null);const videoRef=useRef(null);const hasStartedRef=useRef(false);const hasCompletedRef=useRef(false);const isInViewRef=useRef(false);const isStatic=useIsStaticRenderer();const setRefs=useCallback(node=>{hostRef.current=node;if(typeof ref===\"function\"){ref(node);}else if(ref){ref.current=node;}},[ref]);useEffect(()=>{if(typeof window===\"undefined\")return;if(isStatic)return;const mediaQuery=window.matchMedia(\"(prefers-reduced-motion: reduce)\");if(mediaQuery.matches)return;const hostNode=hostRef.current;if(!hostNode)return;let cancelled=false;let intersectionObserver=null;let mutationObserver=null;let retryTimer=0;let detachEndedListener=null;const pauseVideo=()=>{const video=videoRef.current;if(!video)return;video.pause();};const tryPlayVideo=async()=>{const video=videoRef.current;if(!video)return;if(hasCompletedRef.current||video.ended)return;if(!video.paused)return;video.muted=true;try{const result=video.play();if(result&&typeof result.then===\"function\"){await result;}}catch{// Ignore autoplay rejections.\n}};const connectIntersection=()=>{const video=videoRef.current;if(!video||cancelled)return;if(intersectionObserver)return;video.loop=false;const onEnded=()=>{hasCompletedRef.current=true;pauseVideo();};video.addEventListener(\"ended\",onEnded);detachEndedListener=()=>{video.removeEventListener(\"ended\",onEnded);};intersectionObserver=new IntersectionObserver(entries=>{const[entry]=entries;if(!entry)return;const nextInView=entry.isIntersecting&&entry.intersectionRatio>=.6;if(nextInView===isInViewRef.current)return;isInViewRef.current=nextInView;if(!nextInView){pauseVideo();return;}if(hasCompletedRef.current||video.ended){hasCompletedRef.current=true;pauseVideo();return;}if(!hasStartedRef.current){try{video.currentTime=0;}catch{// Guard for browsers that block currentTime changes pre-metadata.\n}hasStartedRef.current=true;}void tryPlayVideo();},{threshold:[0,.6,1]});intersectionObserver.observe(video);};const attachVideoIfAvailable=()=>{if(cancelled)return false;const found=hostNode.querySelector(\"video\");if(!found)return false;videoRef.current=found;connectIntersection();return true;};if(!attachVideoIfAvailable()){mutationObserver=new MutationObserver(()=>{if(attachVideoIfAvailable()&&mutationObserver){mutationObserver.disconnect();mutationObserver=null;}});mutationObserver.observe(hostNode,{childList:true,subtree:true});retryTimer=window.setTimeout(()=>{attachVideoIfAvailable();},1200);}return()=>{cancelled=true;pauseVideo();if(detachEndedListener){detachEndedListener();detachEndedListener=null;}if(intersectionObserver){intersectionObserver.disconnect();}if(mutationObserver){mutationObserver.disconnect();}if(retryTimer){window.clearTimeout(retryTimer);}};},[isStatic]);return /*#__PURE__*/_jsx(Component,{ref:setRefs,...props});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withViewportVideoPlayback\":{\"type\":\"reactHoc\",\"name\":\"withViewportVideoPlayback\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withShareAction\":{\"type\":\"reactHoc\",\"name\":\"withShareAction\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withReplayOnNavigation\":{\"type\":\"reactHoc\",\"name\":\"withReplayOnNavigation\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ShareButtonOverride.map"],"mappings":"4OAGA,eAAe,EAA4B,EAAK,CAAC,GAAU,IAAY,QAAa,EAAU,WAAW,UAAW,GAAG,CAA2C,OAA1C,MAAM,EAAU,UAAU,UAAU,CAAI,EAAS,EAAK,MAAM,CACpL,CAAE,GAAG,OAAO,SAAW,IAAY,CAAC,IAAM,EAAS,SAAS,cAAc,UAAU,EAAE,EAAS,MAAM,EAAK,EAAS,aAAa,WAAW,MAAM,EAAE,EAAS,MAAM,SAAS,QAAQ,EAAS,MAAM,IAAI,UAAU,EAAS,MAAM,KAAK,UAAU,SAAS,KAAK,YAAY,CAAQ,EAAE,EAAS,MAAM,EAAE,EAAS,OAAO,EAAE,IAAI,EAAO,GAAM,GAAG,CAAC,EAAO,SAAS,YAAY,MAAM,CAAE,MAAM,CAAC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