{"version":3,"file":"Magnifier.BTdTJW1P.mjs","names":["useState","useCallback","__esmMin","init_npm_react_18_3_1","ne","_e","p","c","init_jsx_runtime","urlFromBackground","bg","el","match","artworkIn","img","host","own","nodes","i","src","sourceFrom","found","scaleArtwork","EASE","value","withMagnifier","setSrc","lens","setLens","onEnter","event","onMove","rect","x","y","ZOOM","LENS","onLeave","Component","props","init_Magnifier"],"sources":["https:/framerusercontent.com/modules/fX7VTyuWeRxdZqRyAs1E/aT3IPrb61kdCazDPZAuI/Magnifier.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useCallback,useState}from\"react\";const LENS=190;const ZOOM=2.6;const EASE=\"cubic-bezier(0.32, 0.72, 0, 1)\";function urlFromBackground(el){const bg=getComputedStyle(el).backgroundImage;if(!bg||bg===\"none\")return null;const match=bg.match(/url\\([\"']?(.*?)[\"']?\\)/);return match?match[1]:null;}// Framer renders an image fill as an <img>, as a background on the frame,\n// or as a background on a child div. Find whichever one actually carries it.\nfunction artworkIn(host){const img=host.querySelector(\"img\");if(img&&(img.currentSrc||img.src)){return{el:img,src:img.currentSrc||img.src};}const own=urlFromBackground(host);if(own)return{el:host,src:own};const nodes=host.querySelectorAll(\"*\");for(let i=0;i<nodes.length;i++){const el=nodes[i];const src=urlFromBackground(el);if(src)return{el,src};}return null;}function sourceFrom(host){const found=artworkIn(host);return found?found.src:null;}function scaleArtwork(host,value){const found=artworkIn(host);// never transform the host itself, that would move the lens with it\nif(!found||found.el===host)return;found.el.style.transition=`transform 700ms ${EASE}`;found.el.style.transform=value;}export function withMagnifier(Component){return props=>{const[src,setSrc]=useState(null);const[lens,setLens]=useState(null);const onEnter=useCallback(event=>{const host=event.currentTarget;setSrc(sourceFrom(host));scaleArtwork(host,\"scale(1.06)\");},[]);const onMove=useCallback(event=>{const host=event.currentTarget;const rect=host.getBoundingClientRect();const x=event.clientX-rect.left;const y=event.clientY-rect.top;if(x<0||y<0||x>rect.width||y>rect.height){setLens(null);return;}setLens({x,y,bgW:rect.width*ZOOM,bgH:rect.height*ZOOM,bgX:-(x*ZOOM-LENS/2),bgY:-(y*ZOOM-LENS/2)});},[]);const onLeave=useCallback(event=>{const host=event.currentTarget;scaleArtwork(host,\"scale(1)\");setLens(null);},[]);return /*#__PURE__*/_jsxs(Component,{...props,onMouseEnter:onEnter,onMouseMove:onMove,onMouseLeave:onLeave,style:{...props.style,cursor:lens?\"none\":\"zoom-in\",overflow:\"hidden\"},children:[props.children,lens&&src?/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",left:lens.x-LENS/2,top:lens.y-LENS/2,width:LENS,height:LENS,borderRadius:\"50%\",pointerEvents:\"none\",backgroundImage:`url(\"${src}\")`,backgroundRepeat:\"no-repeat\",backgroundSize:`${lens.bgW}px ${lens.bgH}px`,backgroundPosition:`${lens.bgX}px ${lens.bgY}px`,border:\"1px solid rgba(237, 234, 228, 0.55)\",boxShadow:\"0 14px 34px rgba(0,0,0,0.5), inset 0 0 0 6px rgba(28,27,26,0.35)\",zIndex:10}}):null]});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withMagnifier\":{\"type\":\"reactHoc\",\"name\":\"withMagnifier\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Magnifier.map"],"mappings":"A,gIAA2K,SAASS,EAAkB,EAAG,CAAC,IAAMC,EAAG,iBAAiBC,CAAE,CAAC,CAAC,gBAAgB,GAAG,CAACD,GAAIA,IAAK,OAAO,OAAO,KAAK,IAAME,EAAMF,EAAG,MAAM,wBAAwB,EAAE,OAAOE,EAAMA,EAAM,GAAG,IAAK,CAElW,SAASC,EAAU,EAAK,CAAC,IAAMC,EAAIC,EAAK,cAAc,KAAK,EAAE,GAAGD,IAAMA,EAAI,YAAYA,EAAI,KAAM,MAAM,CAAC,GAAGA,EAAI,IAAIA,EAAI,YAAYA,EAAI,GAAG,EAAG,IAAME,EAAIP,EAAkBM,CA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