{"version":3,"file":"ImageProtection.BIebxfT4.mjs","names":["WrappedComponent"],"sources":["https:/framerusercontent.com/modules/XtNcRXOKB9sykpzU05nu/WUREFkpwxytiKE2DLEOs/ImageProtection.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useEffect}from\"react\";function getElementFromTarget(target){if(target instanceof Element)return target;if(target instanceof Node)return target.parentElement;return null;}function hasBackgroundImage(element){if(typeof window===\"undefined\")return false;const backgroundImage=window.getComputedStyle(element).backgroundImage;return Boolean(backgroundImage&&backgroundImage!==\"none\");}function isProtectedVisualTarget(target){const element=getElementFromTarget(target);if(!element)return false;if(element instanceof HTMLImageElement)return true;return hasBackgroundImage(element);}function isEditableField(element){if(!element)return false;if(element.isContentEditable)return true;const editableAncestor=element.closest('input, textarea, select, [contenteditable=\"\"], [contenteditable=\"true\"]');return Boolean(editableAncestor);}export function withImageProtection(Component){return /*#__PURE__*/forwardRef(function WithImageProtection(props,ref){useEffect(()=>{if(typeof window===\"undefined\"||typeof document===\"undefined\"){return;}const styleElement=document.createElement(\"style\");styleElement.setAttribute(\"data-image-protection-style\",\"true\");styleElement.textContent=`\n[data-image-protection-root=\"true\"] img,\n[data-image-protection-root=\"true\"] picture {\n  -webkit-user-drag: none;\n  user-drag: none;\n  -webkit-user-select: none;\n  user-select: none;\n  -webkit-touch-callout: none;\n}\n`;document.head.appendChild(styleElement);const onContextMenu=event=>{if(isProtectedVisualTarget(event.target)){event.preventDefault();}};const onDragStart=event=>{if(isProtectedVisualTarget(event.target)){event.preventDefault();}};const onSelectStart=event=>{if(isProtectedVisualTarget(event.target)){event.preventDefault();}};const onKeyDown=event=>{const key=event.key.toLowerCase();if(!(event.ctrlKey||event.metaKey)||key!==\"s\")return;const activeElement=document.activeElement;if(isEditableField(activeElement))return;event.preventDefault();};document.addEventListener(\"contextmenu\",onContextMenu);document.addEventListener(\"dragstart\",onDragStart);document.addEventListener(\"selectstart\",onSelectStart);window.addEventListener(\"keydown\",onKeyDown);return()=>{document.removeEventListener(\"contextmenu\",onContextMenu);document.removeEventListener(\"dragstart\",onDragStart);document.removeEventListener(\"selectstart\",onSelectStart);window.removeEventListener(\"keydown\",onKeyDown);styleElement.remove();};},[]);const WrappedComponent=Component;return /*#__PURE__*/_jsx(WrappedComponent,{ref:ref,...props,\"data-image-protection-root\":\"true\"});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withImageProtection\":{\"type\":\"reactHoc\",\"name\":\"withImageProtection\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ImageProtection.map"],"mappings":"uIAAmF,SAAS,EAAqB,EAAO,CAAkG,OAA9F,aAAkB,QAAe,EAAU,aAAkB,KAAY,EAAO,cAAqB,IAAK,CAAC,SAAS,EAAmB,EAAQ,CAAC,GAAU,IAAS,OAAY,MAAO,GAAM,IAAM,EAAgB,EAAO,iBAAiB,CAAO,CAAC,CAAC,gBAAgB,MAAO,GAAQ,GAAiB,IAAkB,OAAQ,CAAC,SAAS,EAAwB,EAAO,CAAC,IAAM,EAAQ,EAAqB,CAAM,EAA8E,OAAxE,EAAwB,aAAmB,kBAAoC,EAAmB,CAAO,EAA1F,EAA4F,CAAC,SAAS,EAAgB,EAAQ,CAAqL,OAAhL,EAAwB,EAAQ,kBAAyB,GAA8H,EAAlG,EAAQ,QAAQ,yEAA0F,EAAhL,EAAkM,CAAC,SAAgB,EAAoB,EAAU,CAAC,OAAoB,EAAW,SAA6B,EAAM,EAAI,CAS2C,OAT1C,MAAc,CAAC,GAAU,IAAS,QAAa,OAAO,SAAW,IAAa,OAAQ,IAAM,EAAa,SAAS,cAAc,OAAO,EAAE,EAAa,aAAa,8BAA8B,MAAM,EAAE,EAAa,YAAY;;;;;;;;;EAS5sC,SAAS,KAAK,YAAY,CAAY,EAAE,IAAM,EAAc,GAAO,CAAI,EAAwB,EAAM,MAAM,GAAG,EAAM,eAAe,CAAG,EAAQ,EAAY,GAAO,C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