{"version":3,"file":"GraipeVideo.C6HTcGan.mjs","names":["useRef","useState","__esmMin","init_ssg_sandbox_shims","window","_e","c","init_jsx_runtime","ce","init_npm_react_18_3_1","de","init_framer_Bf4_tcb2","ControlType","useIsStaticRenderer","addPropertyControls","GraipeVideo","props","isStatic","ref","still","setStill","v","mq","once","toEnd","io","e","need","file","alt","style","ratio","radius","poster","init_GraipeVideo"],"sources":["https:/framerusercontent.com/modules/Neg44EMvo1q6Aa97N5zF/4yovDxcvzGoTw87xjnjz/GraipeVideo.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef,useState}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";/**\r\n * @framerSupportedLayoutWidth any-prefer-fixed\r\n * @framerSupportedLayoutHeight auto\r\n * @framerIntrinsicWidth 393\r\n * @framerIntrinsicHeight 284\r\n */export default function GraipeVideo(props){const{file,poster,alt,ratio,radius,once,style}=props;const isStatic=useIsStaticRenderer();const ref=useRef(null);const[still,setStill]=useState(false);useEffect(()=>{const v=ref.current;if(!v||isStatic)return;const mq=window.matchMedia(\"(prefers-reduced-motion: reduce)\");if(once){const toEnd=()=>v.currentTime=Math.max(0,v.duration-.05);if(mq.matches){v.preload=\"auto\";if(v.readyState>=1)toEnd();else v.addEventListener(\"loadedmetadata\",toEnd,{once:true});return;}if(typeof IntersectionObserver===\"undefined\")return;// judged on height only: the S06 stage video is wider than the screen and clipped at the side\nconst io=new IntersectionObserver(([e])=>{const need=.6*Math.min(e.boundingClientRect.height,window.innerHeight);if(!e.isIntersecting||e.intersectionRect.height<need)return;v.play().catch(()=>{});io.disconnect();},{threshold:[0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1]});io.observe(v);return()=>io.disconnect();}if(mq.matches)return setStill(true);if(typeof IntersectionObserver===\"undefined\")return;const io=new IntersectionObserver(([e])=>e.isIntersecting?v.play().catch(()=>{}):v.pause(),{threshold:.25});io.observe(v);return()=>io.disconnect();},[isStatic,file,once]);return /*#__PURE__*/_jsx(\"div\",{role:\"img\",\"aria-label\":alt,style:{...style,width:\"100%\",aspectRatio:String(ratio),borderRadius:radius,overflow:\"hidden\",position:\"relative\"},children:still&&poster?/*#__PURE__*/_jsx(\"img\",{src:poster,alt:\"\",style:{width:\"100%\",height:\"100%\",objectFit:\"cover\",display:\"block\"}}):/*#__PURE__*/_jsx(\"video\",{ref:ref,src:file,poster:poster||undefined,muted:true,loop:!once,playsInline:true,preload:once?\"auto\":still?\"auto\":\"metadata\",\"aria-hidden\":true,style:{width:\"100%\",height:\"100%\",objectFit:\"cover\",display:\"block\"}})});}GraipeVideo.defaultProps={file:\"\",poster:\"\",alt:\"\",ratio:393/284,radius:12,once:false};addPropertyControls(GraipeVideo,{file:{type:ControlType.File,title:\"Video\",allowedFileTypes:[\"mp4\"]},poster:{type:ControlType.Image,title:\"Poster\"},alt:{type:ControlType.String,title:\"Alt\",displayTextArea:true},ratio:{type:ControlType.Number,title:\"Ratio W/H\",min:.2,max:4,step:1e-4},radius:{type:ControlType.Number,title:\"Radius\",min:0,max:60},once:{type:ControlType.Boolean,title:\"Play once\",defaultValue:false}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"GraipeVideo\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"284\",\"framerIntrinsicWidth\":\"393\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./GraipeVideo.map"],"mappings":"A,8MAKG,SAAwBe,EAAY,EAAM,CAAC,GAAK,CAAC,OAAK,SAAO,MAAI,QAAM,SAAO,OAAK,SAAOC,EAAYC,EAASJ,EAAoB,EAAQK,EAAIlB,EAAO,IAAI,EAAO,CAACmB,EAAMC,GAAUnB,EAAS,EAAK,EAC8W,OAD5WO,MAAc,CAAC,IAAMa,EAAEH,EAAI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