{"version":3,"file":"VideoButton.CANO2XsF.mjs","names":["useState","useCallback","_Fragment"],"sources":["https:/framerusercontent.com/modules/uXMngEYA9s1tzJSWsoRP/N8ijXD9J3Ic4KCZgXm9A/VideoButton.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useState,useEffect,useCallback}from\"react\";import{createPortal}from\"react-dom\";/**\n * @framerDisableUnlink\n */// Helper function to extract YouTube video ID from various URL formats\nfunction getYouTubeVideoId(url){if(!url)return null;const patterns=[/youtube\\.com\\/watch\\?v=([a-zA-Z0-9_-]+)/,/youtu\\.be\\/([a-zA-Z0-9_-]+)/,/youtube\\.com\\/embed\\/([a-zA-Z0-9_-]+)/,/youtube\\.com\\/v\\/([a-zA-Z0-9_-]+)/];for(const pattern of patterns){const match=url.match(pattern);if(match)return match[1];}return null;}// Video overlay component\nfunction VideoOverlay({videoId,onClose}){useEffect(()=>{const handleEscape=e=>{if(e.key===\"Escape\")onClose();};document.addEventListener(\"keydown\",handleEscape);document.body.style.overflow=\"hidden\";return()=>{document.removeEventListener(\"keydown\",handleEscape);document.body.style.overflow=\"\";};},[onClose]);return /*#__PURE__*/createPortal(/*#__PURE__*/_jsx(\"div\",{style:{position:\"fixed\",top:0,left:0,right:0,bottom:0,backgroundColor:\"rgba(64, 64, 64, 0.8)\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",zIndex:999999,cursor:\"pointer\"},onClick:onClose,children:/*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",width:\"calc(100% - 32px)\",maxWidth:\"1200px\",aspectRatio:\"16/9\",cursor:\"default\"},onClick:e=>e.stopPropagation(),children:[/*#__PURE__*/_jsx(\"style\",{children:`\n                        .video-close-button {\n                            position: absolute;\n                            top: -40px;\n                            right: 0;\n                            width: 32px;\n                            height: 32px;\n                            background: transparent;\n                            border: none;\n                            cursor: pointer;\n                            padding: 0;\n                            display: flex;\n                            align-items: center;\n                            justify-content: center;\n                            transition: transform 0.3s ease;\n                        }\n                        \n                        @media (min-width: 1200px) {\n                            .video-close-button:hover {\n                                transform: rotate(90deg);\n                            }\n                        }\n                    `}),/*#__PURE__*/_jsx(\"button\",{onClick:onClose,className:\"video-close-button\",\"aria-label\":\"Close video\",children:/*#__PURE__*/_jsx(\"svg\",{width:\"24\",height:\"24\",viewBox:\"0 0 24 24\",fill:\"none\",xmlns:\"http://www.w3.org/2000/svg\",children:/*#__PURE__*/_jsx(\"path\",{d:\"M18 6L6 18M6 6L18 18\",stroke:\"white\",strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\"})})}),/*#__PURE__*/_jsx(\"iframe\",{src:`https://www.youtube.com/embed/${videoId}?autoplay=1&modestbranding=1&rel=0`,style:{width:\"100%\",height:\"100%\",border:\"none\",borderRadius:\"10px\"},allow:\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\",allowFullScreen:true})]})}),document.body);}export function withVideoSupport(Component){return props=>{const[showVideo,setShowVideo]=useState(false);const[videoId,setVideoId]=useState(null);const handleClick=useCallback(e=>{// Check if the component has a link prop with YouTube URL\nconst link=props.link||props.href||props.url;const extractedVideoId=getYouTubeVideoId(link);if(extractedVideoId){e.preventDefault();e.stopPropagation();setVideoId(extractedVideoId);setShowVideo(true);}else if(props.onClick){// If no YouTube link, call original onClick\nprops.onClick(e);}},[props]);const handleClose=useCallback(()=>{setShowVideo(false);setVideoId(null);},[]);return /*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(Component,{...props,onClick:handleClick}),showVideo&&videoId&&/*#__PURE__*/_jsx(VideoOverlay,{videoId:videoId,onClose:handleClose})]});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withVideoSupport\":{\"type\":\"reactHoc\",\"name\":\"withVideoSupport\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./VideoButton.map"],"mappings":"4JAGA,SAAS,EAAkB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