{"version":3,"file":"ImageZoom.CEen7-Aa.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/a8VNbJeEiloS9R0x5SUm/uaBGH0RSxo4YBCxquaGO/Framestack.js","https:/framerusercontent.com/modules/8bqWyziLLg9dkB6ORWdx/0EezbBn2Oe4ZzxQDzZF3/ImageZoom.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{ControlType}from\"framer\";export function Message({title,subtitle}){return /*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",width:\"100%\",height:\"100%\",placeContent:\"center\",placeItems:\"center\",flexDirection:\"column\",backgroundColor:\"rgba(136, 85, 255, 0.1)\",borderRadius:6,border:\"1px dashed rgb(136, 85, 255)\",color:\"rgb(136, 85, 255)\",fontSize:12,padding:24},children:[/*#__PURE__*/_jsx(\"p\",{style:{margin:0,marginBottom:10,fontWeight:600,textAlign:\"center\"},children:title}),/*#__PURE__*/_jsx(\"p\",{style:{margin:0,opacity:.7,maxWidth:500,lineHeight:1.5,textAlign:\"center\"},children:subtitle})]});}export function borderProp({color=\"#222\"}){return{type:ControlType.Object,optional:true,controls:{color:{type:ControlType.Color,defaultValue:color},width:{type:ControlType.Padding,defaultValue:\"1px\"},style:{type:ControlType.Enum,defaultValue:\"solid\",options:[\"solid\",\"dashed\",\"dotted\",\"double\"],optionTitles:[\"Solid\",\"Dashed\",\"Dotted\",\"Double\"]}}};}export function Border({color,width,style,radius=\"inherit\"}){return /*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",inset:0,borderColor:color,borderWidth:width,borderStyle:style,borderRadius:radius,pointerEvents:\"none\"}});}\nexport const __FramerMetadata__ = {\"exports\":{\"borderProp\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"Message\":{\"type\":\"reactComponent\",\"name\":\"Message\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"Border\":{\"type\":\"reactComponent\",\"name\":\"Border\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Framestack.map","import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useState,useRef}from\"react\";import{borderProp,Border}from\"https://framerusercontent.com/modules/a8VNbJeEiloS9R0x5SUm/uaBGH0RSxo4YBCxquaGO/Framestack.js\";import{motion}from\"framer-motion\";/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n * @framerIntrinsicWidth 600\n * @framerIntrinsicHeight 400\n */export default function ImageZoom(props){var _props_image,_props_image1;const{action}=props;const[zoom,setZoom]=useState(false);const[origin,setOrigin]=useState([50,50]);const imgRef=useRef(null);const updateOrigin=e=>{const{left,top,width,height}=imgRef.current.getBoundingClientRect();let x=(e.clientX-left)/width*100;let y=(e.clientY-top)/height*100;x=Math.max(0,Math.min(100,x));y=Math.max(0,Math.min(100,y));setOrigin([x,y]);};const handleMouseEnter=()=>{if(action==\"hover\"){setZoom(true);}};const handleMouseLeave=()=>{if(action==\"hover\"){setZoom(false);}};const handleMouseUp=e=>{if(action==\"press\"){setZoom(false);updateOrigin(e);document.removeEventListener(\"mousemove\",updateOrigin);document.removeEventListener(\"mouseup\",handleMouseUp);}};const handleMouseDown=e=>{if(action==\"press\"){setZoom(true);updateOrigin(e);document.addEventListener(\"mousemove\",updateOrigin);document.addEventListener(\"mouseup\",handleMouseUp);}};const handleMouseMove=e=>{if(zoom&&action==\"hover\"){updateOrigin(e);}};const preventDragHandler=e=>{e.preventDefault();};return /*#__PURE__*/_jsxs(\"div\",{onMouseEnter:handleMouseEnter,onMouseLeave:handleMouseLeave,onMouseDown:handleMouseDown,onMouseUp:handleMouseUp,onMouseMove:handleMouseMove,onDragStart:preventDragHandler,style:{borderRadius:props.radius,boxShadow:props.shadows,overflow:\"hidden\",position:\"relative\",backgroundColor:props.background,...props.style},children:[/*#__PURE__*/_jsx(motion.img,{ref:imgRef,src:(_props_image=props.image)===null||_props_image===void 0?void 0:_props_image.src,alt:(_props_image1=props.image)===null||_props_image1===void 0?void 0:_props_image1.alt,initial:{scale:1},animate:{scale:zoom?props.zoomLevel:1},draggable:\"false\",style:{transformOrigin:`${origin[0]}% ${origin[1]}%`,width:\"100%\",height:\"100%\",objectFit:props.sizing,userSelect:\"none\"},transition:props.transition}),/*#__PURE__*/_jsx(Border,{...props.border,radius:props.radius})]});}ImageZoom.displayName=\"Image Zoom\";addPropertyControls(ImageZoom,{image:{type:ControlType.ResponsiveImage},sizing:{type:ControlType.Enum,defaultValue:\"cover\",options:[\"cover\",\"contain\",\"fill\"],optionTitles:[\"Fill\",\"Fit\",\"Stretch\"]},zoomLevel:{type:ControlType.Number,defaultValue:2,min:1,step:.01,unit:\"x\",title:\"Zoom\"},action:{type:ControlType.Enum,options:[\"hover\",\"press\"],optionTitles:[\"Hover\",\"Press\"],displaySegmentedControl:true,title:\"Zoom On\"},radius:{type:ControlType.BorderRadius},border:borderProp({}),shadows:{type:ControlType.BoxShadow},background:{type:ControlType.Color,optional:true},transition:{type:ControlType.Transition,defaultValue:{type:\"spring\",duration:.5,bounce:0}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ImageZoom\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"400\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerIntrinsicWidth\":\"600\",\"framerSupportedLayoutHeight\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ImageZoom.map"],"mappings":"iWAAspB,SAAgB,EAAW,CAAC,QAAM,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAY,OAAO,SAAS,GAAK,SAAS,CAAC,MAAM,CAAC,KAAK,EAAY,MAAM,aAAa,EAAM,CAAC,MAAM,CAAC,KAAK,EAAY,QAAQ,aAAa,MAAM,CAAC,MAAM,CAAC,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