{"version":3,"file":"ImageGuard.B995rmYf.mjs","names":[],"sources":["https:/framerusercontent.com/modules/xJMfjjbwheFeRmlSkIBY/0ZkWxum0g7KdwTS9ucqi/ImageGuard.js"],"sourcesContent":["// ImageGuard.tsx\n// ------------------------------------------------------------\n// 🔒 ImageGuard — Lightweight global image-protection plugin\n//\n// ▶ Features\n// • Image Protection — disables right-click, drag, selection, and long-press\n//   on all images only.\n// • Global Right-Click — when set to *Disable*, blocks right-click anywhere\n//   on the page.\n//\n// ⚠️ Note: cannot prevent screenshots or DevTools access.\n//\n// ------------------------------------------------------------\n// Author: Abdullah Noman, Product Designer\n// Visit My Website: https://noman.design\n// ------------------------------------------------------------\nimport{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";const IMG_SELECTOR='img, picture, figure, [role=\"img\"], [data-framer-component-type=\"Image\"]';export default function ImageGuard({imageProtection=true,globalRightClick=true}){React.useEffect(()=>{const isImage=t=>{const el=t;return!!el?.closest(IMG_SELECTOR);};const stop=e=>{e.preventDefault();e.stopPropagation();};// Context-menu behavior\nconst onContextMenu=e=>{// if globalRightClick is false => block everywhere\nif(!globalRightClick)return stop(e);// otherwise only block on images (if enabled)\nif(imageProtection&&isImage(e.target))stop(e);};// Image-only interactions\nconst onSelect=e=>{if(imageProtection&&isImage(e.target))stop(e);};const onDrag=e=>{if(imageProtection&&isImage(e.target))stop(e);};const onTouch=e=>{if(imageProtection&&isImage(e.target))stop(e);};// Mark images and inject minimal CSS\nlet css=null;let mo=null;const mark=(root=document)=>{root.querySelectorAll(IMG_SELECTOR).forEach(el=>{el.setAttribute(\"draggable\",\"false\");});};if(imageProtection){mark();mo=new MutationObserver(muts=>{muts.forEach(m=>m.addedNodes.forEach(n=>{if(n.nodeType===1)mark(n);}));});mo.observe(document.documentElement,{childList:true,subtree:true});css=document.createElement(\"style\");css.textContent=`\n        ${IMG_SELECTOR} {\n          -webkit-user-drag: none !important;\n          user-select: none !important;\n          -webkit-touch-callout: none !important;\n        }\n      `;document.head.appendChild(css);}// Attach listeners\ndocument.addEventListener(\"contextmenu\",onContextMenu,{capture:true});if(imageProtection){document.addEventListener(\"selectstart\",onSelect,{capture:true});document.addEventListener(\"dragstart\",onDrag,{capture:true});document.addEventListener(\"touchstart\",onTouch,{passive:false,capture:true});}// Cleanup\nreturn()=>{document.removeEventListener(\"contextmenu\",onContextMenu,true);if(imageProtection){document.removeEventListener(\"selectstart\",onSelect,true);document.removeEventListener(\"dragstart\",onDrag,true);document.removeEventListener(\"touchstart\",onTouch,true);}mo?.disconnect();css?.remove();};},[imageProtection,globalRightClick]);return /*#__PURE__*/_jsx(\"div\",{style:{display:\"none\"}});}addPropertyControls(ImageGuard,{imageProtection:{type:ControlType.Boolean,title:\"Image Protection\",enabledTitle:\"Enable\",disabledTitle:\"Disable\",defaultValue:true},globalRightClick:{type:ControlType.Boolean,title:\"Global Right-Click\",enabledTitle:\"Enable\",disabledTitle:\"Disable\",defaultValue:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ImageGuard\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ImageGuard.map"],"mappings":"0KAgByN,SAAwB,EAAW,CAAC,kBAAgB,GAAK,mBAAiB,IAAM,CAaqC,OAbpC,MAAoB,CAAC,IAAM,EAAQ,GAAqB,CAAC,CAAT,GAAc,QAAQ,EAAa,CAAS,EAAK,GAAG,CAAC,EAAE,gBAAgB,CAAC,EAAE,iBAAiB,EAC/a,EAAc,GAAG,CACvB,GAAG,CAAC,EAAiB,OAAO,EAAK,EAAE,CAChC,GAAiB,EAAQ,EAAE,OAAO,EAAC,EAAK,EAAE,EACvC,EAAS,GAAG,CAAI,GAAiB,EAAQ,EAAE,OAAO,EAAC,EAAK,EAAE,EAAS,EAAO,GAAG,CAAI,GAAiB,EAAQ,EAAE,OAAO,EAAC,EA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