{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/fVjqamKJicCusSjKz3Oj/OS7WtEdM62bNgVHpHJVl/Card_Flip.js"],
  "sourcesContent": ["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{motion,useSpring}from\"framer-motion\";import{useState,useRef,useEffect}from\"react\";// Learn more: https://www.framer.com/docs/guides/overrides/\n//Spring animation parameters\nconst spring={type:\"spring\",stiffness:300,damping:40};/**\n * 3D Flip\n * Created By Joshua Guo\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */ export function withClick(Component){return props=>{const[isFlipped,setIsFlipped]=useState(false);const handleClick=()=>{setIsFlipped(prevState=>!prevState);};const[rotateXaxis,setRotateXaxis]=useState(0);const[rotateYaxis,setRotateYaxis]=useState(0);const ref=useRef(null);const handleMouseMove=event=>{const element=ref.current;const elementRect=element.getBoundingClientRect();const elementWidth=elementRect.width;const elementHeight=elementRect.height;const elementCenterX=elementWidth/2;const elementCenterY=elementHeight/2;const mouseX=event.clientY-elementRect.y-elementCenterY;const mouseY=event.clientX-elementRect.x-elementCenterX;const degreeX=mouseX/elementWidth*20 //The number is the rotation factor\n;const degreeY=mouseY/elementHeight*20 //The number is the rotation factor\n;setRotateXaxis(degreeX);setRotateYaxis(degreeY);};const handleMouseEnd=()=>{setRotateXaxis(0);setRotateYaxis(0);};const dx=useSpring(0,spring);const dy=useSpring(0,spring);useEffect(()=>{dx.set(-rotateXaxis);dy.set(rotateYaxis);},[rotateXaxis,rotateYaxis]);return /*#__PURE__*/ _jsx(motion.div,{onClick:handleClick,transition:spring,style:{perspective:\"1200px\",transformStyle:\"preserve-3d\",width:`${props.width}`,height:`${props.height}`},children:/*#__PURE__*/ _jsx(motion.div,{ref:ref,whileHover:{scale:1.1},onMouseMove:handleMouseMove,onMouseLeave:handleMouseEnd,transition:spring,style:{width:\"100%\",height:\"100%\",rotateX:dx,rotateY:dy},children:/*#__PURE__*/ _jsxs(\"div\",{style:{perspective:\"1200px\",transformStyle:\"preserve-3d\",width:\"100%\",height:\"100%\"},children:[/*#__PURE__*/ _jsx(motion.div,{animate:{rotateY:isFlipped?-180:0},transition:spring,style:{width:\"100%\",height:\"100%\",zIndex:isFlipped?0:1,backfaceVisibility:\"hidden\",position:\"absolute\"},children:/*#__PURE__*/ _jsx(Component,{...props,variant:\"Front\",style:{width:\"100%\",height:\"100%\"}})}),/*#__PURE__*/ _jsx(motion.div,{initial:{rotateY:180},animate:{rotateY:isFlipped?0:180},transition:spring,style:{width:\"100%\",height:\"100%\",zIndex:isFlipped?1:0,backfaceVisibility:\"hidden\",position:\"absolute\"},children:/*#__PURE__*/ _jsx(Component,{...props,variant:\"Back\",style:{width:\"100%\",height:\"100%\"}})})]})})});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withClick\":{\"type\":\"reactHoc\",\"name\":\"withClick\",\"annotations\":{\"framerSupportedLayoutWidth\":\"fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Card_Flip.map"],
  "mappings": "gHAEA,IAAMA,EAAO,CAAC,KAAK,SAAS,UAAU,IAAI,QAAQ,EAAE,EAMzC,SAASC,EAAUC,EAAU,CAAC,OAAOC,GAAO,CAAC,GAAK,CAACC,EAAUC,CAAY,EAAEC,EAAS,EAAK,EAAQC,EAAY,IAAI,CAACF,EAAaG,GAAW,CAACA,CAAS,CAAE,EAAO,CAACC,EAAYC,CAAc,EAAEJ,EAAS,CAAC,EAAO,CAACK,EAAYC,CAAc,EAAEN,EAAS,CAAC,EAAQO,EAAIC,EAAO,IAAI,EAAQC,EAAgBC,GAAO,CAA2B,IAAMC,EAAlBJ,EAAI,QAAkC,sBAAsB,EAAQK,EAAaD,EAAY,MAAYE,EAAcF,EAAY,OAAaG,EAAeF,EAAa,EAAQG,EAAeF,EAAc,EAAQG,EAAON,EAAM,QAAQC,EAAY,EAAEI,EAA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CAAC,QAAQ5B,EAAU,EAAE,GAAG,EAAE,WAAWJ,EAAO,MAAM,CAAC,MAAM,OAAO,OAAO,OAAO,OAAOI,EAAU,EAAE,EAAE,mBAAmB,SAAS,SAAS,UAAU,EAAE,SAAuB2B,EAAK7B,EAAU,CAAC,GAAGC,EAAM,QAAQ,OAAO,MAAM,CAAC,MAAM,OAAO,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAE,CAAE",
  "names": ["spring", "withClick", "Component", "props", "isFlipped", "setIsFlipped", "ye", "handleClick", "prevState", "rotateXaxis", "setRotateXaxis", "rotateYaxis", "setRotateYaxis", "ref", "pe", "handleMouseMove", "event", "elementRect", "elementWidth", "elementHeight", "elementCenterX", "elementCenterY", "mouseX", "mouseY", "degreeX", "degreeY", "handleMouseEnd", "dx", "useSpring", "dy", "ue", "p", "motion", "u"]
}
