import{r as e}from"./chunk-DT4yxi9n.js";import"./modulepreload-polyfill-CkedBBHh.js";import{n as t,t as n}from"./jsx-runtime-CzGT4z3X.js";import{t as r}from"./client-c6txPfF0.js";import{ot as i}from"./apiService-DhhNwp2O.js";import{t as a}from"./triggerTypes-UDW9eUuw.js";import{t as o}from"./cdn-CkjwegRx.js";import{i as s,n as c,r as l}from"./giftsCache--pqQjzkU.js";import{a as u,r as d,s as f}from"./index.esm-DKdodk42.js";import{r as p,t as m}from"./firebase-BylMgSsD.js";import"./overlay-B8t1v0AB.js";var h=r(),g=e(t(),1),_=n();function v(e){let t=e.eventTrigger;if(!t)return null;if(t.type===`gift`&&(t.gifts&&t.gifts.length>0||t.giftNames&&t.giftNames.length>0)){let e=s(t,c())[0];return{image:e?.imgUrl,label:e?.name??t.giftNames?.[0]??`Regalo`,coins:t.giftCoins?.[0],isCoin:!0}}return t.type===`channel_point_redemption`?{image:t.rewardImage,label:t.rewardName??`Channel Points`,coins:t.rewardCost,isCoin:!1}:{label:a[t.type]?.label??t.type}}var y={width:160,display:`flex`,flexDirection:`column`,alignItems:`center`,gap:6,padding:10,borderRadius:14,background:`rgba(255,255,255,0.05)`,border:`1px solid rgba(255,255,255,0.08)`};function b({disrupt:e}){let t=v(e),n=o(e.iconUrl)??(e.type===`image`||e.type===`gif`?e.assetUrl:void 0),r=!e.iconUrl&&e.type===`video`?e.assetUrl:void 0;return(0,_.jsxs)(`div`,{style:y,children:[(0,_.jsx)(`div`,{style:{width:138,height:104,borderRadius:10,overflow:`hidden`,background:`rgba(0,0,0,0.35)`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:n?(0,_.jsx)(`img`,{src:n,alt:``,style:{width:`100%`,height:`100%`,objectFit:`contain`}}):r?(0,_.jsx)(`video`,{src:r,muted:!0,loop:!0,autoPlay:!0,playsInline:!0,style:{width:`100%`,height:`100%`,objectFit:`contain`}}):(0,_.jsx)(`span`,{style:{fontSize:34,opacity:.4},children:`🎭`})}),(0,_.jsx)(`div`,{style:{fontSize:14,fontWeight:700,color:`#fff`,textAlign:`center`,lineHeight:1.2,textShadow:`0 1px 4px rgba(0,0,0,0.8)`,maxWidth:`100%`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.name||`—`}),t&&(0,_.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:5,padding:`3px 9px`,borderRadius:999,background:`rgba(0,0,0,0.4)`,maxWidth:`100%`},children:[t.image&&(0,_.jsx)(`img`,{src:o(t.image),alt:``,style:{width:20,height:20,objectFit:`contain`}}),(0,_.jsx)(`span`,{style:{fontSize:12,color:`#e8e8f0`,fontWeight:600,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:t.label}),typeof t.coins==`number`&&(0,_.jsxs)(`span`,{style:{fontSize:12,fontWeight:700,color:`#ffb300`,whiteSpace:`nowrap`},children:[t.isCoin?`🪙`:`⭐`,` `,t.coins.toLocaleString()]})]})]})}function x(){let[e,t]=(0,g.useState)([]),n=new URLSearchParams(window.location.search),r=n.get(`platform`),a=n.get(`uid`);(0,g.useEffect)(()=>{if(l(),a){if(!p())return;let e=f(m,`rooms/${a}/disrupts`);return u(e,e=>{let n=e.val()??[];t(Array.isArray(n)?n:Object.values(n))}),()=>d(e)}let e=!0,n=()=>{i().then(n=>{e&&t(n)}).catch(()=>{})};n();let r=setInterval(n,8e3);return()=>{e=!1,clearInterval(r)}},[a]);let o=e.filter(e=>!(!e.enabled||r&&(e.eventTrigger?.platform??`tiktok`)!==r));return o.length===0?null:(0,_.jsx)(`div`,{style:{display:`inline-flex`,flexWrap:`wrap`,gap:10,padding:14,margin:16,borderRadius:20,maxWidth:`calc(100vw - 32px)`,background:`rgba(15,15,22,0.82)`,border:`1px solid rgba(255,255,255,0.1)`,backdropFilter:`blur(8px)`,fontFamily:`system-ui, -apple-system, Segoe UI, sans-serif`},children:o.map(e=>(0,_.jsx)(b,{disrupt:e},e.id))})}document.documentElement.style.background=`transparent`,document.documentElement.style.overflow=`hidden`,document.body.style.background=`transparent`,document.body.style.margin=`0`,document.body.style.overflow=`hidden`,(0,h.createRoot)(document.getElementById(`disrupts-menu-root`)).render((0,_.jsx)(x,{}));