{"version":3,"file":"VideoCompare.CLa3G4CW.mjs","names":["React.useState","React.useRef"],"sources":["https:/framerusercontent.com/modules/hN6ExihD9QERk0oeZQgq/t5WNmUuw0vytFhGxfFCo/VideoCompare.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";export default function VideoCompare(props){const[sliderPosition,setSliderPosition]=React.useState(50);const containerRef=React.useRef(null);// Handle dragging/moving the slider\nconst handleMove=e=>{if(!containerRef.current)return;const{left,width}=containerRef.current.getBoundingClientRect();// Check for touch or mouse event\nconst clientX=\"touches\"in e?e.touches[0].clientX:e.clientX;let newPos=(clientX-left)/width*100;newPos=Math.max(0,Math.min(100,newPos))// Clamp between 0 and 100\n;setSliderPosition(newPos);};return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,onMouseMove:e=>e.buttons===1&&handleMove(e),onTouchMove:handleMove,onClick:handleMove,style:{width:\"100%\",height:\"100%\",position:\"relative\",overflow:\"hidden\",cursor:\"col-resize\",backgroundColor:\"#000\",borderRadius:props.radius},children:[/*#__PURE__*/_jsx(\"video\",{src:props.videoAfter,style:{...videoStyle,objectFit:props.objectFit},autoPlay:true,muted:true,loop:true,playsInline:true}),/*#__PURE__*/_jsxs(\"div\",{style:{position:\"absolute\",top:0,left:0,right:0,bottom:0,clipPath:`inset(0 ${100-sliderPosition}% 0 0)`},children:[/*#__PURE__*/_jsx(\"video\",{src:props.videoBefore,style:{...videoStyle,objectFit:props.objectFit},autoPlay:true,muted:true,loop:true,playsInline:true}),props.showLabels&&/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",bottom:20,left:20,padding:\"4px 8px\",background:\"rgba(0,0,0,0.6)\",color:\"white\",borderRadius:4,fontSize:12,fontWeight:600},children:props.labelBefore})]}),props.showLabels&&/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",bottom:20,right:20,padding:\"4px 8px\",background:\"rgba(0,0,0,0.6)\",color:\"white\",borderRadius:4,fontSize:12,fontWeight:600,pointerEvents:\"none\"},children:props.labelAfter}),/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:0,bottom:0,left:`${sliderPosition}%`,width:2,backgroundColor:\"white\",boxShadow:\"0 0 10px rgba(0,0,0,0.5)\",pointerEvents:\"none\"},children:/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:\"50%\",left:\"50%\",transform:\"translate(-50%, -50%)\",width:32,height:32,backgroundColor:\"white\",borderRadius:\"50%\",boxShadow:\"0 2px 8px rgba(0,0,0,0.3)\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},children:/*#__PURE__*/_jsx(\"svg\",{width:\"16\",height:\"16\",viewBox:\"0 0 24 24\",fill:\"none\",stroke:\"black\",strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\",children:/*#__PURE__*/_jsx(\"path\",{d:\"M19 12H5M12 19l-7-7 7-7M12 5l7 7-7 7\"})})})})]});}const videoStyle={width:\"100%\",height:\"100%\",display:\"block\"};addPropertyControls(VideoCompare,{videoBefore:{type:ControlType.File,title:\"Before (File)\",allowedFileTypes:[\"mp4\",\"webm\"]},videoAfter:{type:ControlType.File,title:\"After (File)\",allowedFileTypes:[\"mp4\",\"webm\"]},objectFit:{type:ControlType.Enum,title:\"Fit\",options:[\"cover\",\"contain\"],defaultValue:\"cover\"},radius:{type:ControlType.Number,title:\"Radius\",defaultValue:20},showLabels:{type:ControlType.Boolean,title:\"Show Labels\",defaultValue:true},labelBefore:{type:ControlType.String,title:\"Label Left\",defaultValue:\"Wireframe\"},labelAfter:{type:ControlType.String,title:\"Label Right\",defaultValue:\"Render\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"VideoCompare\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./VideoCompare.map"],"mappings":"wLAAyI,SAA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