{"version":3,"file":"VideoModule.CTTDoFp2.mjs","names":["useState","useRef","_Fragment"],"sources":["https:/framerusercontent.com/modules/Ik0V8VJkIyybgVTJC0IP/2IY8fKC1P6GEURLAXXpC/VideoModule.js"],"sourcesContent":["// Video module with custom play button, \"See how it works\" burst element, and custom cover image\nimport{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useState,useRef,useEffect,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Video Module\n *\n * @framerIntrinsicWidth 800\n * @framerIntrinsicHeight 450\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function VideoModule(props){const{videoSource=\"upload\",uploadedVideo=\"https://framerusercontent.com/assets/MLWPbW1dUQawJLhhun3dBwpgJak.mp4\",youtubeUrl=\"\",vimeoUrl=\"\",bunnyUrl=\"\",coverImage={src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Video cover\"},showBurst=true,burstText=\"See how\\nit works\",burstColor=\"#5B5FED\",burstTextColor=\"#FFFFFF\",playButtonColor=\"#FFFFFF\",playButtonIconColor=\"#5B5FED\",playButtonSize=100,burstSize=160,burstFont}=props;const[isPlaying,setIsPlaying]=useState(false);const[showCover,setShowCover]=useState(true);const videoRef=useRef(null);const iframeRef=useRef(null);const[isMobile,setIsMobile]=useState(false);useEffect(()=>{if(typeof window!==\"undefined\"){const checkMobile=()=>{startTransition(()=>setIsMobile(window.innerWidth<768));};checkMobile();window.addEventListener(\"resize\",checkMobile);return()=>window.removeEventListener(\"resize\",checkMobile);}},[]);const getEmbedUrl=()=>{if(videoSource===\"youtube\"&&youtubeUrl){const videoId=extractYouTubeId(youtubeUrl);return videoId?`https://www.youtube.com/embed/${videoId}?autoplay=1&rel=0&modestbranding=1&showinfo=0`:\"\";}if(videoSource===\"vimeo\"&&vimeoUrl){const videoId=extractVimeoId(vimeoUrl);return videoId?`https://player.vimeo.com/video/${videoId}?autoplay=1&byline=0&portrait=0`:\"\";}if(videoSource===\"bunny\"&&bunnyUrl){const ids=extractBunnyIds(bunnyUrl);if(!ids)return\"\";// Suppress the native Bunny player chrome (controls=false) so the\n// component's own cover + play button stays the only UI.\nconst params=[\"autoplay=true\",\"preload=true\",\"responsive=true\",\"loop=false\",\"muted=false\",\"controls=false\"].join(\"&\");return`https://iframe.mediadelivery.net/embed/${ids.libraryId}/${ids.videoId}?${params}`;}return\"\";};const extractYouTubeId=url=>{const regExp=/^.*(youtu.be\\/|v\\/|u\\/\\w\\/|embed\\/|watch\\?v=|&v=)([^#&?]*).*/;const match=url.match(regExp);return match&&match[2].length===11?match[2]:null;};const extractVimeoId=url=>{const regExp=/vimeo\\.com\\/(\\d+)/;const match=url.match(regExp);return match?match[1]:null;};// Accepts bunny.net play, embed, or direct iframe URLs, e.g.\n//   https://player.mediadelivery.net/play/678884/87856a59-bc7d-4681-9541-d3b7d7893b2b\n//   https://iframe.mediadelivery.net/embed/678884/87856a59-bc7d-4681-9541-d3b7d7893b2b\n// and returns the numeric library id + video GUID.\nconst extractBunnyIds=url=>{const regExp=/mediadelivery\\.net\\/(?:play|embed)\\/(\\d+)\\/([a-f0-9-]{36})/i;const match=url.match(regExp);return match?{libraryId:match[1],videoId:match[2]}:null;};const handlePlay=()=>{startTransition(()=>{setIsPlaying(true);setShowCover(false);});if(videoSource===\"upload\"&&videoRef.current){videoRef.current.play();}};useEffect(()=>{if(videoSource===\"upload\"&&videoRef.current){const video=videoRef.current;const handleEnded=()=>{startTransition(()=>{setIsPlaying(false);setShowCover(true);});};video.addEventListener(\"ended\",handleEnded);return()=>video.removeEventListener(\"ended\",handleEnded);}},[videoSource]);const embedUrl=getEmbedUrl();return /*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",width:\"100%\",height:\"100%\",overflow:\"hidden\",borderRadius:16,backgroundColor:\"#000\"},children:[videoSource===\"upload\"?/*#__PURE__*/_jsx(\"video\",{ref:videoRef,src:uploadedVideo,style:{width:\"100%\",height:\"100%\",objectFit:\"contain\"},controls:isPlaying}):embedUrl&&/*#__PURE__*/_jsx(\"iframe\",{ref:iframeRef,src:isPlaying?embedUrl:\"\",style:{width:\"100%\",height:\"100%\",border:\"none\",display:isPlaying?\"block\":\"none\"},allow:\"autoplay; fullscreen; picture-in-picture\",allowFullScreen:true,title:\"Video player\"}),showCover&&/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:0,left:0,width:\"100%\",height:\"100%\",backgroundImage:`url(${coverImage.src})`,backgroundSize:\"cover\",backgroundPosition:\"center\"},role:\"img\",\"aria-label\":coverImage.alt}),/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:0,left:0,width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},children:/*#__PURE__*/_jsx(\"button\",{onClick:handlePlay,style:{width:playButtonSize,height:playButtonSize,borderRadius:\"50%\",backgroundColor:playButtonColor,border:\"none\",cursor:\"pointer\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",boxShadow:\"0 8px 24px rgba(0, 0, 0, 0.3)\",transition:\"transform 0.2s ease\",zIndex:2},onMouseEnter:e=>{e.currentTarget.style.transform=\"scale(1.1)\";},onMouseLeave:e=>{e.currentTarget.style.transform=\"scale(1)\";},\"aria-label\":\"Play video\",children:/*#__PURE__*/_jsx(\"svg\",{width:playButtonSize*.4,height:playButtonSize*.4,viewBox:\"0 0 24 24\",fill:playButtonIconColor,children:/*#__PURE__*/_jsx(\"path\",{d:\"M8 5v14l11-7z\"})})})}),showBurst&&/*#__PURE__*/_jsxs(\"div\",{style:{position:\"absolute\",bottom:isMobile?20:40,left:isMobile?20:40,width:isMobile?burstSize*.5:burstSize,height:isMobile?burstSize*.5:burstSize,borderRadius:\"50%\",backgroundColor:burstColor,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",boxShadow:\"0 4px 16px rgba(0, 0, 0, 0.2)\",zIndex:3,animation:\"pulse 2s ease-in-out infinite\"},children:[/*#__PURE__*/_jsx(\"style\",{children:`\n                                    @keyframes pulse {\n                                        0%, 100% {\n                                            transform: scale(1);\n                                        }\n                                        50% {\n                                            transform: scale(1.05);\n                                        }\n                                    }\n                                    @media (max-width: 768px) {\n                                        .burst-text {\n                                            font-size: 9px !important;\n                                        }\n                                    }\n                                `}),/*#__PURE__*/_jsx(\"span\",{className:\"burst-text\",style:{color:burstTextColor,textAlign:\"center\",whiteSpace:\"pre-line\",...burstFont},children:burstText})]})]})]});}addPropertyControls(VideoModule,{videoSource:{type:ControlType.Enum,title:\"Video Source\",options:[\"upload\",\"youtube\",\"vimeo\",\"bunny\"],optionTitles:[\"Upload\",\"YouTube\",\"Vimeo\",\"Bunny\"],defaultValue:\"upload\",displaySegmentedControl:true},uploadedVideo:{type:ControlType.File,title:\"Video File\",allowedFileTypes:[\"mp4\",\"webm\",\"mov\"],hidden:({videoSource})=>videoSource!==\"upload\"},youtubeUrl:{type:ControlType.String,title:\"YouTube URL\",placeholder:\"https://www.youtube.com/watch?v=...\",hidden:({videoSource})=>videoSource!==\"youtube\"},vimeoUrl:{type:ControlType.String,title:\"Vimeo URL\",placeholder:\"https://vimeo.com/...\",hidden:({videoSource})=>videoSource!==\"vimeo\"},bunnyUrl:{type:ControlType.String,title:\"Bunny URL\",placeholder:\"https://player.mediadelivery.net/play/...\",hidden:({videoSource})=>videoSource!==\"bunny\"},coverImage:{type:ControlType.ResponsiveImage,title:\"Cover Image\"},showBurst:{type:ControlType.Boolean,title:\"Show Burst\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},burstText:{type:ControlType.String,title:\"Burst Text\",defaultValue:\"See how\\nit works\",displayTextArea:true,hidden:({showBurst})=>!showBurst},burstColor:{type:ControlType.Color,title:\"Burst Color\",defaultValue:\"#5B5FED\",hidden:({showBurst})=>!showBurst},burstTextColor:{type:ControlType.Color,title:\"Burst Text Color\",defaultValue:\"#FFFFFF\",hidden:({showBurst})=>!showBurst},burstSize:{type:ControlType.Number,title:\"Burst Size\",defaultValue:160,min:80,max:200,step:10,unit:\"px\",hidden:({showBurst})=>!showBurst},burstFont:{type:ControlType.Font,title:\"Burst Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"14px\",variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1.2em\"},hidden:({showBurst})=>!showBurst},playButtonColor:{type:ControlType.Color,title:\"Play Button Color\",defaultValue:\"#FFFFFF\"},playButtonIconColor:{type:ControlType.Color,title:\"Play Icon Color\",defaultValue:\"#5B5FED\"},playButtonSize:{type:ControlType.Number,title:\"Play Button Size\",defaultValue:120,min:40,max:160,step:10,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"VideoModule\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any\",\"framerSupportedLayoutHeight\":\"any\",\"framerContractVersion\":\"1\",\"framerIntrinsicWidth\":\"800\",\"framerIntrinsicHeight\":\"450\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./VideoModule.map"],"mappings":"2NASG,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,cAAY,SAAS,gBAAc,uEAAuE,aAAW,GAAG,WAAS,GAAG,WAAS,GAAG,aAAW,CAAC,IAAI,sEAAsE,IAAI,aAAa,EAAE,YAAU,GAAK,YAAU;UAAoB,aAAW,UAAU,iBAAe,UAAU,kBAAgB,UAAU,sBAAoB,UAAU,iBAAe,IAAI,YAAU,IAAI,aAAW,EAAW,CAAC,EAAU,GAAcA,EAAS,EAAK,EAAO,CAAC,EAAU,GAAcA,EAAS,EAAI,EAAQ,EAASC,EAAO,IAAI,EAAQ,EAAUA,EAAO,IAAI,EAAO,CAAC,EAAS,GAAaD,EAAS,EAAK,EAAE,MAAc,CAAC,GAAU,IAAS,OAAY,CAAC,IAAM,MAAgB,CAAC,MAAoB,EAAY,EAAO,WAA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