{"version":3,"file":"DisableImageContextMenu.DTOJh0Wi.mjs","names":["useRef","useCallback"],"sources":["https:/framerusercontent.com/modules/gjkQVAyiCLJ9rbPfThID/559kBGMZMPdZma1UIcOs/DisableImageContextMenu.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useCallback,useEffect,useRef}from\"react\";// User instruction: Update DisableImageContextMenu to preserve wrapped behavior/styling, suppress context menu for image/video media targets, and harden all scoped videos (including dynamically added ones) without visual layout changes.\nexport function DisableImageContextMenu(Component){return /*#__PURE__*/forwardRef(function DisableImageContextMenuOverride(props,ref){const hostRef=useRef(null);const setRefs=useCallback(node=>{hostRef.current=node;if(typeof ref===\"function\"){ref(node);}else if(ref&&typeof ref===\"object\"){ref.current=node;}},[ref]);useEffect(()=>{const host=hostRef.current;if(!host)return;const isInteractiveTarget=target=>{return Boolean(target.closest(\"a, button, input, textarea, select, option, label, form, audio, [role='button'], [role='link'], [contenteditable='true']\"));};const isImageLikeTarget=target=>{if(target instanceof HTMLImageElement)return true;if(target.closest(\"img, picture, figure, [role='img'], svg image\"))return true;const imageLikeAncestor=target.closest(\".framer-image, [data-framer-name='Image'], [data-framer-component-type='Image'], picture, figure, [role='img']\");return Boolean(imageLikeAncestor?.querySelector(\"img, svg image\"));};const isVideoLikeTarget=target=>{if(target instanceof HTMLVideoElement)return true;if(target.closest(\"video\"))return true;const videoLikeAncestor=target.closest(\"[data-framer-name='Video'], [data-framer-component-type='Video'], .framer-video\");return Boolean(videoLikeAncestor?.querySelector(\"video\"));};const isEventWithinVideo=event=>{const path=typeof event.composedPath===\"function\"?event.composedPath():[];for(const node of path){if(node instanceof HTMLVideoElement){return true;}}return false;};const applyVideoRestrictions=video=>{if(\"controlsList\"in video){const existing=video.getAttribute(\"controlsList\")??\"\";const tokens=new Set(existing.split(/\\s+/).filter(Boolean));tokens.add(\"nodownload\");tokens.add(\"noplaybackrate\");video.setAttribute(\"controlsList\",Array.from(tokens).join(\" \"));}if(\"disablePictureInPicture\"in video){video.disablePictureInPicture=true;}if(\"disableRemotePlayback\"in video){video.disableRemotePlayback=true;}video.setAttribute(\"disableremoteplayback\",\"\");};const applyRestrictionsToAllVideos=()=>{const videos=host.querySelectorAll(\"video\");for(const video of videos){applyVideoRestrictions(video);}};const onContextMenu=event=>{const target=event.target;if(!(target instanceof Element))return;if(!host.contains(target))return;if(isVideoLikeTarget(target)||isEventWithinVideo(event)){event.preventDefault();return;}if(isInteractiveTarget(target))return;const isBlockedMediaTarget=isImageLikeTarget(target);if(!isBlockedMediaTarget)return;event.preventDefault();};applyRestrictionsToAllVideos();const observer=new MutationObserver(mutations=>{for(const mutation of mutations){for(const node of mutation.addedNodes){if(!(node instanceof Element))continue;if(node instanceof HTMLVideoElement){applyVideoRestrictions(node);continue;}const nestedVideos=node.querySelectorAll(\"video\");for(const video of nestedVideos){applyVideoRestrictions(video);}}}});observer.observe(host,{childList:true,subtree:true});host.addEventListener(\"contextmenu\",onContextMenu);return()=>{host.removeEventListener(\"contextmenu\",onContextMenu);observer.disconnect();};},[]);return /*#__PURE__*/_jsx(Component,{ref:setRefs,...props});});}\nexport const __FramerMetadata__ = {\"exports\":{\"DisableImageContextMenu\":{\"type\":\"reactHoc\",\"name\":\"DisableImageContextMenu\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./DisableImageContextMenu.map"],"mappings":"uIACA,SAAgB,EAAwB,EAAU,CAAC,OAAoB,EAAW,SAAyC,EAAM,EAAI,CAAC,IAAM,EAAQA,EAAO,IAAI,EAAQ,EAAQC,EAAY,GAAM,CAAC,EAAQ,QAAQ,EAAQ,OAAO,GAAM,WAAY,EAAI,CAAI,EAAW,GAAK,OAAO,GAAM,WAAU,EAAI,QAAQ,EAAM,EAAE,CAAC,CAAG,CAAC,EAA6pF,OAA3pF,MAAc,CAAC,IAAM,EAAK,EAAQ,QAAQ,GAAG,CAAC,EAAK,OAAO,IAAM,EAAo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