{"version":3,"file":"LiveStreamEmbed.CSH6nPSD.mjs","names":["useState"],"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,SAAO,EAAW,CAAC,EAAa,GAAiBA,EAAS,KAAK,CAAM,CAAC,EAAQ,GAAYA,EAAS,GAAM,CAEgO,GAF/N,MAAc,CAAC,IAAI,EAAU,GAAU,EAAW,eAAe,GAAW,CACxV,GAAG,EAAgB,GAAG,CAAC,IAAM,EAAI,MAAM,MAAM,2CAA2C,IAAiB,CAAC,GAAG,EAAI,GAAG,CAAC,IAAM,EAAK,MAAM,EAAI,MAAM,CAAC,GAAG,MAAM,QAAQ,EAAK,EAAE,EAAK,IAAI,SAAS,KAAK,CAAK,GAAU,MAAoB,EAAgB,SAAS,CAAC,CAAC,cAAe,EAC7Q,GAAG,EAAc,GAAG,CAAC,IAAM,EAAI,MAAM,MAAM,oCAAoC,IAAe,CAAC,GAAG,EAAI,KAAe,MAAM,EAAI,MAAM,GAAU,aAAa,KAAK,CAAK,GAAU,MAAoB,EAAgB,OAAO,CAAC,CAAC,aAAe,EAAO,GAAU,MAAoB,EAAgB,KAAK,CAAC,CAA+F,OAA7F,GAAW,CAAC,SAAS,EAAW,GAAK,CAAC,CAAC,EAAW,EAAO,gBAAgB,CAAC,GAAW,EAAG,IAAI,KAAW,CAAC,EAAU,GAAQ,GAAW,cAAc,EAAW,GAAK,CAAC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