{"version":3,"file":"BunnyVideoGrid2.CWeSyeDn.mjs","names":["React.useRef","React.useState","__esmMin","window","init_ssg_sandbox_shims","init_npm_react_18_3_1","_e","de","init_jsx_runtime","p","ce","addPropertyControls","init_framer_DKtAEkcX","ControlType","useBunnyAudioCoordination","iframe","iframeRef","w","peers","forceMute","subscribe","onLoad","safeParse","s","onMessage","source","f","data","useContainerWidth","ref","width","setWidth","el","observer","entry","entries","VideoItem","titleStyle","stacked","textColor","videoId","params","autoplay","loop","muted","controls","src","libraryId","title","BunnyVideoGrid2","containerRef","containerWidth","mobile","STACK_BREAKPOINT","sharedProps","gap","videoId1","title1","videoId2","title2","init_BunnyVideoGrid2"],"sources":["https:/framerusercontent.com/modules/Dw6dIfU1fMCFg3xHfEqO/Ty5dBLy6PYtAIQeRFSTv/BunnyVideoGrid2.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";// Shared across all Bunny video components on the page.\n// - Forces every iframe to be muted on load (belt-and-suspenders vs URL param).\n// - When any iframe reports it has been unmuted, every other registered\n//   Bunny iframe is sent a setMuted=true command so only one plays audio.\nfunction useBunnyAudioCoordination(iframeRef){React.useEffect(()=>{const iframe=iframeRef.current;if(!iframe||typeof window===\"undefined\")return;const w=window;if(!w.__bunnyIframes)w.__bunnyIframes=new Set;const peers=w.__bunnyIframes;peers.add(iframe);const forceMute=()=>{try{iframe.contentWindow?.postMessage({method:\"setMuted\",value:true},\"*\");}catch{}};const subscribe=()=>{try{iframe.contentWindow?.postMessage({method:\"addEventListener\",value:\"volumechange\"},\"*\");}catch{}forceMute();};const onLoad=()=>{subscribe();setTimeout(forceMute,300);setTimeout(forceMute,1e3);setTimeout(forceMute,2500);};iframe.addEventListener(\"load\",onLoad);onLoad();const safeParse=s=>{try{return JSON.parse(s);}catch{return null;}};const onMessage=e=>{let source=null;peers.forEach(f=>{if(f.contentWindow===e.source)source=f;});if(!source)return;const data=typeof e.data===\"string\"?safeParse(e.data):e.data;if(!data||data.event!==\"volumechange\")return;const muted=data.value&&typeof data.value.muted===\"boolean\"?data.value.muted:data.data&&typeof data.data.muted===\"boolean\"?data.data.muted:undefined;if(muted===false){peers.forEach(f=>{if(f!==source){try{f.contentWindow?.postMessage({method:\"setMuted\",value:true},\"*\");}catch{}}});}};window.addEventListener(\"message\",onMessage);return()=>{window.removeEventListener(\"message\",onMessage);iframe.removeEventListener(\"load\",onLoad);peers.delete(iframe);};},[iframeRef]);}// Measures the component's own width so the grid can stack automatically\n// on narrow screens without needing a per-breakpoint prop override.\nfunction useContainerWidth(){const ref=React.useRef(null);const[width,setWidth]=React.useState(0);React.useEffect(()=>{const el=ref.current;if(!el||typeof ResizeObserver===\"undefined\")return;const observer=new ResizeObserver(entries=>{for(const entry of entries){setWidth(entry.contentRect.width);}});observer.observe(el);setWidth(el.getBoundingClientRect().width);return()=>observer.disconnect();},[]);return[ref,width];}const STACK_BREAKPOINT=560;function VideoItem({libraryId,videoId,autoplay,loop,muted,controls,borderRadius,title,stacked,textColor}){const iframeRef=React.useRef(null);useBunnyAudioCoordination(iframeRef);const titleStyle={margin:0,fontFamily:'\"Plus Jakarta Sans\", sans-serif',fontSize:stacked?22:26,fontWeight:700,lineHeight:\"1.2em\",letterSpacing:\"-0.03em\",color:textColor,textAlign:\"center\",width:\"100%\"};const renderVideo=()=>{if(!videoId){return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",aspectRatio:\"9/14\",backgroundColor:\"#1a1a1a\",borderRadius,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",color:\"#555\",fontSize:12,fontFamily:\"Inter, sans-serif\",textAlign:\"center\",padding:\"0 16px\",boxSizing:\"border-box\"},children:\"Paste a Bunny Video ID\"});}const params=new URLSearchParams;params.set(\"autoplay\",autoplay?\"true\":\"false\");if(loop)params.set(\"loop\",\"true\");params.set(\"muted\",muted?\"true\":\"false\");params.set(\"controls\",controls?\"true\":\"false\");params.set(\"preload\",\"true\");params.set(\"responsive\",\"true\");const src=`https://iframe.mediadelivery.net/embed/${libraryId}/${videoId}?${params.toString()}`;return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",aspectRatio:\"9/14\",borderRadius,overflow:\"hidden\",flexShrink:0,isolation:\"isolate\"},children:/*#__PURE__*/_jsx(\"iframe\",{ref:iframeRef,src:src,title:title||\"Video player\",style:{border:0,width:\"100%\",height:\"100%\",display:\"block\",borderRadius},allow:\"accelerometer;gyroscope;autoplay;encrypted-media;picture-in-picture;\",allowFullScreen:true})});};return /*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",flexDirection:\"column\",alignItems:\"center\",gap:16,flex:stacked?\"0 0 auto\":1,width:stacked?\"100%\":undefined,maxWidth:stacked?420:undefined,minWidth:0},children:[renderVideo(),/*#__PURE__*/_jsx(\"p\",{style:titleStyle,children:title||\"Video title\"})]});}export default function BunnyVideoGrid2({libraryId=\"639143\",videoId1=\"\",title1=\"\",videoId2=\"\",title2=\"\",autoplay=true,loop=true,muted=true,controls=true,gap=20,borderRadius=10,padding=0,mobile=false,textColor=\"rgb(10, 10, 10)\"}){const[containerRef,containerWidth]=useContainerWidth();const stacked=mobile||containerWidth>0&&containerWidth<STACK_BREAKPOINT;const sharedProps={libraryId,autoplay,loop,muted,controls,borderRadius,stacked,textColor};return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,style:{display:\"flex\",flexDirection:stacked?\"column\":\"row\",gap:stacked?Math.max(gap,32):gap,padding,width:\"100%\",height:\"100%\",boxSizing:\"border-box\",alignItems:stacked?\"center\":\"flex-start\"},children:[/*#__PURE__*/_jsx(VideoItem,{...sharedProps,videoId:videoId1,title:title1}),/*#__PURE__*/_jsx(VideoItem,{...sharedProps,videoId:videoId2,title:title2})]});}addPropertyControls(BunnyVideoGrid2,{mobile:{type:ControlType.Boolean,title:\"Force Stack\",defaultValue:false,enabledTitle:\"Vertical\",disabledTitle:\"Auto\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"rgb(10, 10, 10)\"},libraryId:{type:ControlType.String,title:\"Library ID\",defaultValue:\"639143\"},videoId1:{type:ControlType.String,title:\"Video 1 ID\",placeholder:\"3c886e67-...\",defaultValue:\"\"},title1:{type:ControlType.String,title:\"Title 1\",defaultValue:\"\",placeholder:\"Video title\"},videoId2:{type:ControlType.String,title:\"Video 2 ID\",placeholder:\"3c886e67-...\",defaultValue:\"\"},title2:{type:ControlType.String,title:\"Title 2\",defaultValue:\"\",placeholder:\"Video title\"},autoplay:{type:ControlType.Boolean,title:\"Autoplay\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},loop:{type:ControlType.Boolean,title:\"Loop\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},muted:{type:ControlType.Boolean,title:\"Muted\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},controls:{type:ControlType.Boolean,title:\"Controls\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},gap:{type:ControlType.Number,title:\"Gap\",defaultValue:20,min:0,max:80,unit:\"px\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:10,min:0,max:48,unit:\"px\"},padding:{type:ControlType.Number,title:\"Padding\",defaultValue:0,min:0,max:120,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"BunnyVideoGrid2\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./BunnyVideoGrid2.map"],"mappings":"A,wMAIA,SAASc,EAA0B,EAAU,CAACJ,MAAoB,CAAC,IAAMK,EAAOC,EAAU,QAAQ,GAAG,CAACD,GAAeZ,IAAS,OAAY,OAAO,IAAMc,EAAEd,EAAO,AAAqBc,EAAE,iCAAe,IAAI,IAAI,IAAMC,EAAMD,EAAE,eAAeC,EAAM,IAAIH,CAAM,EAAE,IAAMI,MAAc,CAAC,GAAG,CA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