{"version":3,"file":"LiveStreamEmbed.DdcnMi4q.mjs","names":[],"sources":["https:/framerusercontent.com/modules/d2h2e5NFWrOfQNewcYb9/WxK8mgYpJq2GLdCF5DOc/LiveStreamEmbed.js"],"sourcesContent":["// Live streaming embed for Kick and Twitch with fallback PNG\n// Checks both platforms every 30s, shows embed if live, else clickable PNG\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useState,startTransition}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * LiveStreamEmbed\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function LiveStreamEmbed(props){const{twitchUsername,kickUsername,fallbackImage,fallbackLink=\"https://kick.com/\",imageWidth=320,imageHeight=180,style}=props;const[livePlatform,setLivePlatform]=useState(null);const[checked,setChecked]=useState(false);useEffect(()=>{let cancelled=false;let intervalId;async function checkLive(){// Check Twitch first\nif(twitchUsername){try{const res=await fetch(`https://api.ivr.fi/v2/twitch/user?login=${twitchUsername}`);if(res.ok){const data=await res.json();if(Array.isArray(data)&&data[0]?.stream!==null){if(!cancelled)startTransition(()=>setLivePlatform(\"twitch\"));return;}}}catch{}}// Then check Kick\nif(kickUsername){try{const res=await fetch(`https://kick.com/api/v2/channels/${kickUsername}`);if(res.ok){const data=await res.json();if(data?.livestream!==null){if(!cancelled)startTransition(()=>setLivePlatform(\"kick\"));return;}}}catch{}}if(!cancelled)startTransition(()=>setLivePlatform(null));}checkLive().then(()=>setChecked(true));intervalId=window.setInterval(()=>{checkLive();},3e4);return()=>{cancelled=true;if(intervalId)clearInterval(intervalId);};},[twitchUsername,kickUsername]);if(RenderTarget.current()===RenderTarget.thumbnail)return null;// Show Twitch embed if live\nif(livePlatform===\"twitch\"&&twitchUsername){const parent=typeof window!==\"undefined\"?window.location.hostname:\"framer.com\";return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",position:\"relative\"},children:/*#__PURE__*/_jsx(\"iframe\",{title:\"Twitch Live Stream\",src:`https://player.twitch.tv/?channel=${twitchUsername}&parent=${parent}`,allowFullScreen:true,frameBorder:0,style:{border:0,width:\"100%\",height:\"100%\",minHeight:180,minWidth:180,aspectRatio:\"16/9\",maxWidth:\"100vw\",maxHeight:\"56vw\",...style}})});}// Show Kick embed if live\nif(livePlatform===\"kick\"&&kickUsername){return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",position:\"relative\"},children:/*#__PURE__*/_jsx(\"iframe\",{title:\"Kick Live Stream\",src:`https://player.kick.com/${kickUsername}`,allowFullScreen:true,frameBorder:0,style:{border:0,width:\"100%\",height:\"100%\",minHeight:180,minWidth:180,aspectRatio:\"16/9\",maxWidth:\"100vw\",maxHeight:\"56vw\",...style}})});}// Show fallback clickable PNG\nconst fallbackImgSrc=fallbackImage||\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\";return /*#__PURE__*/_jsx(\"a\",{href:fallbackLink,target:\"_blank\",rel:\"noopener noreferrer\",style:{display:\"block\",width:\"100%\",height:\"100%\"},children:/*#__PURE__*/_jsx(\"img\",{src:fallbackImgSrc,alt:\"Offline fallback\",style:{width:\"100%\",height:\"auto\",maxWidth:\"100vw\",maxHeight:\"56vw\",objectFit:\"contain\",display:\"block\",margin:\"0 auto\",borderRadius:8,boxShadow:\"0 2px 8px rgba(0,0,0,0.08)\",...style}})});}addPropertyControls(LiveStreamEmbed,{twitchUsername:{type:ControlType.String,title:\"Twitch Username\",defaultValue:\"\",placeholder:\"twitchuser\"},kickUsername:{type:ControlType.String,title:\"Kick Username\",defaultValue:\"\",placeholder:\"kickuser\"},fallbackImage:{type:ControlType.File,allowedFileTypes:[\"png\",\"jpg\",\"jpeg\",\"webp\",\"gif\",\"svg\"],title:\"Fallback PNG\"},fallbackLink:{type:ControlType.String,title:\"PNG Link\",defaultValue:\"https://kick.com/\",placeholder:\"https://...\"},imageWidth:{type:ControlType.Number,title:\"Image Width\",defaultValue:320,min:40,max:1920,step:1,unit:\"px\"},imageHeight:{type:ControlType.Number,title:\"Image Height\",defaultValue:180,min:40,max:1080,step:1,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"LiveStreamEmbed\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./LiveStreamEmbed.map"],"mappings":"2UAOG,SAAwB,EAAgB,EAAM,CAAC,GAAK,CAAC,iBAAe,eAAa,gBAAc,eAAa,oBAAoB,aAAW,IAAI,cAAY,IAAI,QAAM,CAAC,EAAW,CAAC,EAAa,EAAgB,CAAC,EAAS,KAAK,CAAM,CAAC,EAAQ,EAAW,CAAC,GAAS,EAAM,CAEgO,GAF/N,EAAU,IAAI,CAAC,IAAI,GAAU,EAAU,EAAW,eAAe,GAAW,CACxV,GAAG,EAAgB,GAAG,CAAC,IAAM,EAAI,KAAM,QAAO,0CAA0C,IAAiB,CAAC,GAAG,EAAI,GAAG,CAAC,IAAM,EAAK,KAAM,GAAI,MAAM,CAAC,GAAG,MAAM,QAAQ,EAAK,EAAE,EAAK,IAAI,SAAS,KAAK,CAAC,AAAI,GAAU,EAAgB,IAAI,EAAgB,SAAS,CAAC,CAAC,MAAQ,CAAC,CAAC,MAAK,CAAE,CAC/Q,GAAG,EAAc,GAAG,CAAC,IAAM,EAAI,KAAM,QAAO,mCAAmC,IAAe,CAAC,GAAG,EAAI,GAAG,CAAC,IAAM,EAAK,KAAM,GAAI,MAAM,CAAC,GAAG,GAAM,aAAa,KAAK,CAAC,AAAI,GAAU,EAAgB,IAAI,EAAgB,OAAO,CAAC,CAAC,MAAQ,CAAC,CAAC,MAAK,CAAE,CAAC,AAAI,GAAU,EAAgB,IAAI,EAAgB,KAAK,CAAC,AAAE,CAA6F,UAAlF,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