{"version":3,"file":"APHeroVideo.CmfTAl1g.mjs","names":["React.useRef","React.useState","__esmMin","init_ssg_sandbox_shims","init_npm_react_18_3_1","_e","de","init_jsx_runtime","c","p","ce","window","addPropertyControls","RenderTarget","init_framer_CaDWdxiz","ControlType","posterSrcSet","m","url","base","w","APHeroVideo","props","label","alt","ref","isCanvas","deferred","poster","load","setLoad","shown","setShown","reduce","idle","timer","start","onLoad","onPref","video","visible","sync","observer","entries","src","box","style","fill","fit","focus","tint","init_APHeroVideo"],"sources":["https:/framerusercontent.com/modules/hG219C4b5klnlf9ZIax0/9FIK0s8lv0ziOGQpRfLv/APHeroVideo.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";// Framer-hosted images can be served smaller with ?scale-down-to=<px>. Published pages get the\n// poster as an /assets/ URL, which can't be resized, but the same file under /images/ can.\nfunction posterSrcSet(url){const m=/^https:\\/\\/framerusercontent\\.com\\/(?:images|assets)\\/([\\w-]+\\.(?:jpe?g|png|webp))$/i.exec(url);if(!m)return undefined;const base=`https://framerusercontent.com/images/${m[1]}`;return[512,1024,2048].map(w=>`${base}?scale-down-to=${w} ${w}w`).join(\", \");}/**\n * Autoplay video for a hero panel: muted, looping, no controls.\n * With a poster, the poster is shown first as a high-priority image (so it is\n * the page's first big paint), and the video only starts downloading after the\n * page has loaded, then fades in over the poster. Without a poster the video\n * loads straight away, as before.\n * Pauses while off screen. People who prefer reduced motion see only the poster\n * (or the paused first frame when there is no poster).\n * With alt text, screen readers announce it as an image; without, it's decorative and hidden from them.\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function APHeroVideo(props){const{src=\"\",poster=\"\",fit=\"cover\",focus=\"50% 50%\",tint=\"rgba(18, 7, 64, 0)\",alt=\"\",style}=props;const label=alt.trim();const ref=React.useRef(null);const isCanvas=RenderTarget.current()===RenderTarget.canvas;const deferred=!!poster&&!isCanvas;// load: the video element gets its src. shown: the video is drawn over the poster.\nconst[load,setLoad]=React.useState(!deferred);const[shown,setShown]=React.useState(!deferred);// With a poster, wait for the page to finish loading (then an idle moment) before fetching the video.\nReact.useEffect(()=>{if(load||typeof window===\"undefined\")return;const reduce=window.matchMedia(\"(prefers-reduced-motion: reduce)\");let idle;let timer;const start=()=>{if(reduce.matches)return;const w=window;if(typeof w.requestIdleCallback===\"function\")idle=w.requestIdleCallback(()=>setLoad(true),{timeout:2e3});else timer=setTimeout(()=>setLoad(true),200);};const onLoad=()=>start();const onPref=()=>{if(!reduce.matches&&document.readyState===\"complete\")start();};if(document.readyState===\"complete\")start();else window.addEventListener(\"load\",onLoad,{once:true});reduce.addEventListener?.(\"change\",onPref);return()=>{window.removeEventListener(\"load\",onLoad);reduce.removeEventListener?.(\"change\",onPref);const w=window;if(idle!==undefined&&typeof w.cancelIdleCallback===\"function\")w.cancelIdleCallback(idle);if(timer)clearTimeout(timer);};},[load]);React.useEffect(()=>{const video=ref.current;if(!video||typeof window===\"undefined\"||!load)return;// React doesn't render the muted attribute on the server, and browsers only autoplay muted video\nvideo.muted=true;const reduce=window.matchMedia(\"(prefers-reduced-motion: reduce)\");let visible=true;const sync=()=>{if(reduce.matches||!visible)video.pause();else video.play().catch(()=>{});};const observer=\"IntersectionObserver\"in window?new IntersectionObserver(entries=>{visible=entries[0]?.isIntersecting??true;sync();},{threshold:.1}):null;observer?.observe(video);reduce.addEventListener?.(\"change\",sync);sync();return()=>{observer?.disconnect();reduce.removeEventListener?.(\"change\",sync);};},[src,load]);const box={position:\"relative\",width:\"100%\",height:\"100%\",overflow:\"hidden\",background:\"rgb(18, 7, 64)\",...style};const fill={position:\"absolute\",inset:0,width:\"100%\",height:\"100%\",objectFit:fit,objectPosition:focus,display:\"block\"};if(!src){return /*#__PURE__*/_jsx(\"div\",{style:{...box,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",color:\"rgba(255, 255, 255, 0.7)\",font:\"500 14px Inter, sans-serif\"},children:isCanvas?\"Add a video file\":null});}return /*#__PURE__*/_jsxs(\"div\",{style:box,children:[deferred?/*#__PURE__*/_jsx(\"img\",{src:poster,srcSet:posterSrcSet(poster),sizes:\"(min-width: 1200px) 34vw, 100vw\",alt:label,\"aria-hidden\":label?undefined:true,loading:\"eager\",...{fetchpriority:\"high\"},style:fill}):null,/*#__PURE__*/_jsx(\"video\",{ref:ref,src:load?src:undefined,poster:deferred?undefined:poster||undefined,muted:true,autoPlay:load,loop:true,playsInline:true,preload:load?\"auto\":\"none\",role:!deferred&&label?\"img\":undefined,\"aria-label\":!deferred&&label?label:undefined,\"aria-hidden\":!deferred&&label?undefined:true,tabIndex:-1,onLoadedData:()=>setShown(true),style:{...fill,opacity:shown?1:0,transition:deferred?\"opacity 0.4s ease\":undefined}}),/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",inset:0,background:tint,pointerEvents:\"none\"}})]});}addPropertyControls(APHeroVideo,{src:{type:ControlType.File,title:\"Video\",allowedFileTypes:[\"mp4\",\"webm\",\"mov\"]},poster:{type:ControlType.File,title:\"Poster\",allowedFileTypes:[\"jpg\",\"jpeg\",\"png\",\"webp\"]},fit:{type:ControlType.Enum,title:\"Fit\",options:[\"cover\",\"contain\"],optionTitles:[\"Fill\",\"Fit\"],defaultValue:\"cover\",displaySegmentedControl:true},focus:{type:ControlType.String,title:\"Focus\",defaultValue:\"50% 50%\",description:\"Which part stays in view when cropped (x y), e.g. 30% 50%.\"},tint:{type:ControlType.Color,title:\"Tint\",defaultValue:\"rgba(18, 7, 64, 0)\"},alt:{type:ControlType.String,title:\"Alt text\",defaultValue:\"\",description:\"What the video shows. Leave empty if it's purely decorative. With a poster, it becomes the poster image's alt text.\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"APHeroVideo\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\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