{"version":3,"file":"StreamVideo.DvJU7xja.mjs","names":["useState","useMemo","useCallback"],"sources":["https:/framerusercontent.com/modules/Y7tWksaQ44X3FCyUxOAZ/0rPbziZDIxbKIcU11Oik/StreamVideo.js"],"sourcesContent":["// Arthur's request: event videos on the /events page that people click, watch, then click the next one.\n// Click-to-play Cloudflare Stream video: shows the poster with a play button (never autoplays),\n// and swaps in the Stream player with sound when clicked. Leave Video ID empty to show a \"coming soon\" frame,\n// which sits on Arthur's own glow image (17 Oct 2026: no drawn gradients).\n// \"Shape\" keeps the frame at 16:9 or 9:16 at any width (set the layer height to Fit), or fills a fixed height.\n// 23 Oct 2026: the purple play circle is now the small corner pill from VideoBits (play triangle and\n// length), and hovering plays a muted preview. Also used for the contact page video.\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useMemo,useCallback,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{PlayPill,HoverPreview,VB_CSS}from\"https://framerusercontent.com/modules/us8fHL1CzcsbLHpTfdex/ITPfWjDfFUmQ7MHXMrVA/VideoBits.js\";const GLOW=\"https://framerusercontent.com/images/1JkuAgGJiPw8nU2mMUyhskcg.jpg\";function imageSrc(value){if(!value)return\"\";if(typeof value===\"string\")return value;return value.src||\"\";}/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function StreamVideo(props){const{videoId,title,shape,customerCode,posterTime,poster,radius,emptyLabel,style}=props;const[playing,setPlaying]=useState(false);const[hover,setHover]=useState(false);const customPoster=imageSrc(poster);const id=(videoId||\"\").trim();const urls=useMemo(()=>{if(!id)return null;const base=`https://customer-${customerCode}.cloudflarestream.com/${id}`;const streamPoster=`${base}/thumbnails/thumbnail.jpg?time=${posterTime}s&height=1080`;const posterUrl=customPoster||streamPoster;const player=`${base}/iframe?autoplay=true&preload=auto&primaryColor=%237949fc&poster=${encodeURIComponent(posterUrl)}`;return{poster:posterUrl,player};},[id,customerCode,posterTime,customPoster]);const play=useCallback(()=>{startTransition(()=>setPlaying(true));},[]);const sizing=shape===\"16:9\"?{width:\"100%\",height:\"auto\",aspectRatio:\"16 / 9\"}:shape===\"9:16\"?{width:\"100%\",height:\"auto\",aspectRatio:\"9 / 16\"}:{width:\"100%\",height:\"100%\"};const box={position:\"relative\",overflow:\"hidden\",borderRadius:radius,background:\"#0c0b10\",...style,...sizing};if(!urls){return /*#__PURE__*/_jsxs(\"div\",{style:{...box,display:\"flex\",flexDirection:\"column\",alignItems:\"center\",justifyContent:\"center\",gap:16,background:`url(${GLOW}) center bottom / cover no-repeat, #0c0b10`},children:[customPoster?/*#__PURE__*/_jsx(\"img\",{src:customPoster,alt:\"\",style:{position:\"absolute\",inset:0,width:\"100%\",height:\"100%\",objectFit:\"cover\"}}):null,/*#__PURE__*/_jsx(\"span\",{\"aria-hidden\":\"true\",style:{position:\"relative\",width:58,height:58,borderRadius:\"50%\",border:\"1.5px solid rgba(255,255,255,0.35)\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},children:/*#__PURE__*/_jsx(\"svg\",{width:\"18\",height:\"20\",viewBox:\"0 0 20 22\",style:{marginLeft:4},children:/*#__PURE__*/_jsx(\"path\",{d:\"M2 2l16 9-16 9z\",fill:\"rgba(255,255,255,0.6)\"})})}),/*#__PURE__*/_jsx(\"span\",{style:{position:\"relative\",color:\"rgba(255,255,255,0.72)\",fontFamily:\"Figtree, sans-serif\",fontSize:15,textAlign:\"center\",padding:\"0 16px\"},children:emptyLabel})]});}return /*#__PURE__*/_jsxs(\"div\",{style:box,children:[/*#__PURE__*/_jsx(\"style\",{children:VB_CSS}),playing?/*#__PURE__*/_jsx(\"iframe\",{src:urls.player,title:title||\"Video\",style:{position:\"absolute\",inset:0,width:\"100%\",height:\"100%\",border:0},allow:\"accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture; fullscreen\",allowFullScreen:true}):/*#__PURE__*/_jsxs(\"button\",{type:\"button\",className:\"vb-host\",\"aria-label\":title?`Play: ${title}`:\"Play video\",onClick:play,onMouseEnter:()=>setHover(true),onMouseLeave:()=>setHover(false),onFocus:()=>setHover(true),onBlur:()=>setHover(false),style:{position:\"absolute\",inset:0,width:\"100%\",height:\"100%\",padding:0,border:0,cursor:\"pointer\",background:\"transparent\"},children:[/*#__PURE__*/_jsx(\"img\",{src:urls.poster,alt:\"\",loading:\"lazy\",style:{position:\"absolute\",inset:0,width:\"100%\",height:\"100%\",objectFit:\"cover\",transform:hover?\"scale(1.03)\":\"scale(1)\",transition:\"transform 0.5s ease\"}}),/*#__PURE__*/_jsx(HoverPreview,{id:id,start:posterTime||0}),/*#__PURE__*/_jsx(\"span\",{\"aria-hidden\":\"true\",style:{position:\"absolute\",inset:0,zIndex:2,background:\"linear-gradient(180deg, rgba(0,0,0,0) 55%, rgba(0,0,0,0.28) 100%)\"}}),/*#__PURE__*/_jsx(PlayPill,{id:id})]})]});}StreamVideo.defaultProps={videoId:\"\",title:\"\",shape:\"fill\",customerCode:\"but5jhvwjvglsn3q\",posterTime:8,radius:14,emptyLabel:\"Film coming soon\"};addPropertyControls(StreamVideo,{videoId:{type:ControlType.String,title:\"Video ID\",defaultValue:\"\"},title:{type:ControlType.String,title:\"Title\",defaultValue:\"\"},shape:{type:ControlType.Enum,title:\"Shape\",options:[\"16:9\",\"9:16\",\"fill\"],optionTitles:[\"16:9\",\"9:16\",\"Fill frame\"],defaultValue:\"fill\"},posterTime:{type:ControlType.Number,title:\"Poster (s)\",defaultValue:8,min:0,step:1,displayStepper:true},poster:{type:ControlType.ResponsiveImage,title:\"Poster image\"},radius:{type:ControlType.Number,title:\"Radius\",defaultValue:14,min:0,max:40},emptyLabel:{type:ControlType.String,title:\"Empty text\",defaultValue:\"Film coming soon\"},customerCode:{type:ControlType.String,title:\"Stream code\",defaultValue:\"but5jhvwjvglsn3q\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"StreamVideo\",\"slots\":[],\"annotations\":{\"fram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