const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/firebase-BylMgSsD.js","assets/chunk-DT4yxi9n.js","assets/index.esm-DKdodk42.js"])))=>i.map(i=>d[i]);
import"./modulepreload-polyfill-CkedBBHh.js";import{t as e}from"./preload-helper-CT1Z6Pdu.js";import{a as t,n}from"./giftsCache--pqQjzkU.js";import{n as r,t as i}from"./giftPresets-oLS_8r6a.js";import{n as a,r as o}from"./overlayStyle-BLOTt0xN.js";var s=new URLSearchParams(location.search),c=(()=>{let e=s.get(`platform`);return e===`tiktok`||e===`twitch`||e===`kick`?e:null})(),l=s.has(`demo`),u=s.get(`uid`);document.documentElement.style.cssText=`background:transparent;overflow:hidden`,document.body.style.cssText=`background:transparent;margin:0;overflow:hidden;height:100vh;user-select:none`;var d=Math.max(0,parseInt(s.get(`min`)??`0`,10)||0),ee=Math.max(800,parseInt(s.get(`hold`)??`3000`,10)||3e3),te=e=>e===`only`||e===`except`?e:`all`,f=`all`,p=new Set,m={center:{x:50,y:.38},bottom:{x:50,y:.66},"bottom-left":{x:25,y:.66},"bottom-right":{x:75,y:.66}},h=e=>e&&e in m?e:null,g=h(s.get(`pos`))??`center`,_=document.createElement(`style`);_.textContent=`
#gift-overlay-root{position:fixed;inset:0;pointer-events:none;font-family:var(--oi-font,'Trebuchet MS','Segoe UI',system-ui,sans-serif)}
#gift-fx{position:fixed;inset:0;width:100%;height:100%}
.gr-rocket{position:fixed;left:50%;bottom:-140px;transform:translateX(-50%);display:flex;flex-direction:column;align-items:center;gap:14px;opacity:0;will-change:transform,opacity}
.gr-ring{position:relative;width:104px;height:104px;border-radius:50%;padding:4px;background:conic-gradient(from 0deg,var(--oi-c1,#fff3c4),var(--oi-c3,#f5b821),var(--oi-c2,#ffd86b),var(--oi-c3,#d4881f),var(--oi-c1,#fff3c4));box-shadow:0 0 24px rgba(var(--oi-glow,255,200,90),.9),0 0 60px rgba(var(--oi-glow,255,200,90),.55),0 0 120px rgba(var(--oi-glow,255,200,90),.35);animation:gr-spin 2.6s linear infinite;animation-play-state:paused}
.gr-ring::after{content:"";position:absolute;inset:-10px;border-radius:50%;border:2px solid rgba(var(--oi-glow,255,200,90),.35);animation:gr-pulse 1.4s ease-out infinite;animation-play-state:paused}
@keyframes gr-spin{to{transform:rotate(360deg)}}
@keyframes gr-pulse{0%{transform:scale(.85);opacity:.8}100%{transform:scale(1.5);opacity:0}}
.gr-avatar{width:100%;height:100%;border-radius:50%;object-fit:cover;background:#1a1407;display:flex;align-items:center;justify-content:center;font-size:38px;font-weight:800;color:var(--oi-c1,#fff3c4);text-shadow:0 2px 8px rgba(0,0,0,.6);overflow:hidden}
.gr-avatar img{width:100%;height:100%;object-fit:cover;border-radius:50%}
.gr-reveal{position:fixed;left:50%;top:38%;transform:translate(-50%,-50%) scale(.4);display:flex;flex-direction:column;align-items:center;gap:8px;opacity:0;will-change:transform,opacity;text-align:center}
.gr-orb{position:relative;width:180px;height:180px;display:flex;align-items:center;justify-content:center}
.gr-halo{position:absolute;inset:-40px;border-radius:50%;background:radial-gradient(circle,rgba(var(--oi-glow,255,200,90),.55) 0%,rgba(var(--oi-glow,255,200,90),.12) 45%,transparent 70%);filter:blur(2px);animation:gr-halo 1.6s ease-in-out infinite;animation-play-state:paused}
@keyframes gr-halo{0%,100%{transform:scale(1);opacity:.85}50%{transform:scale(1.12);opacity:1}}
.gr-shine{position:absolute;inset:-6px;border-radius:50%;background:conic-gradient(from 0deg,transparent,rgba(255,255,255,.5),transparent 30%);animation:gr-spin 3.2s linear infinite;animation-play-state:paused;-webkit-mask:radial-gradient(circle,transparent 58%,#000 60%);mask:radial-gradient(circle,transparent 58%,#000 60%)}
.gr-icon{width:130px;height:130px;display:flex;align-items:center;justify-content:center;filter:drop-shadow(0 6px 16px rgba(0,0,0,.5)) drop-shadow(0 0 22px rgba(var(--oi-glow,255,200,90),.8));animation:gr-float 2.4s ease-in-out infinite;animation-play-state:paused}
.gr-icon img,.gr-icon svg{width:100%;height:100%;object-fit:contain}
@keyframes gr-float{0%,100%{transform:translateY(0) rotate(-3deg)}50%{transform:translateY(-8px) rotate(3deg)}}
/* Contorno oscuro NÍTIDO (drop-shadow apilado, opera sobre el degradado renderizado) +
   brillo de color → legible sobre CUALQUIER fondo del Live, no solo negro. */
.gr-gift-name{font-size:28px;font-weight:800;letter-spacing:.5px;background:linear-gradient(180deg,var(--oi-c1,#fff7da) 0%,var(--oi-c2,#ffd86b) 45%,var(--oi-c3,#d4881f) 100%);-webkit-background-clip:text;background-clip:text;color:transparent;filter:drop-shadow(1.2px 1.2px 0 rgba(0,0,0,.92)) drop-shadow(-1.2px -1.2px 0 rgba(0,0,0,.92)) drop-shadow(1.2px -1.2px 0 rgba(0,0,0,.92)) drop-shadow(-1.2px 1.2px 0 rgba(0,0,0,.92)) drop-shadow(0 2px 4px rgba(0,0,0,.6)) drop-shadow(0 0 14px rgba(var(--oi-glow,255,200,90),.5));max-width:80vw}
/* Nombre del usuario: protagonista del revelado — grande, en degradado, con contorno y brillo. */
.gr-user{font-size:46px;font-weight:900;letter-spacing:.3px;line-height:1.05;background:linear-gradient(180deg,#fff,var(--oi-name,var(--oi-c1,#fff3c4)));-webkit-background-clip:text;background-clip:text;color:transparent;filter:drop-shadow(1.5px 1.5px 0 rgba(0,0,0,.92)) drop-shadow(-1.5px -1.5px 0 rgba(0,0,0,.92)) drop-shadow(1.5px -1.5px 0 rgba(0,0,0,.92)) drop-shadow(-1.5px 1.5px 0 rgba(0,0,0,.92)) drop-shadow(0 2px 5px rgba(0,0,0,.7)) drop-shadow(0 0 16px rgba(var(--oi-glow,255,200,90),.6));max-width:84vw;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.gr-verb{font-size:17px;font-weight:700;letter-spacing:.5px;text-transform:uppercase;color:var(--oi-line,#fff);text-shadow:-1px -1px 0 rgba(0,0,0,.85),1px -1px 0 rgba(0,0,0,.85),-1px 1px 0 rgba(0,0,0,.85),1px 1px 0 rgba(0,0,0,.85),0 2px 8px rgba(0,0,0,.8);margin-top:-2px}
.gr-badge{margin-top:4px;padding:6px 20px;border-radius:999px;font-size:22px;font-weight:900;color:#2a1a05;background:linear-gradient(180deg,var(--oi-c1,#fff3c4),var(--oi-c2,#f5b821));box-shadow:0 8px 24px rgba(var(--oi-glow,255,200,90),.5),inset 0 0 8px rgba(255,255,255,.5)}
.gr-flash{position:fixed;inset:0;background:radial-gradient(circle at var(--gr-fx,50%) var(--gr-fy,38%),rgba(255,250,235,.9),rgba(var(--oi-glow,255,200,90),.25) 30%,transparent 60%);opacity:0;pointer-events:none}
.gr-shock{position:fixed;left:50%;top:38%;width:60px;height:60px;border-radius:50%;border:4px solid rgba(var(--oi-glow,255,200,90),.9);transform:translate(-50%,-50%) scale(0);opacity:0;box-shadow:0 0 30px rgba(var(--oi-glow,255,200,90),.8)}
/* Las animaciones de bucle (anillo/pulso/halo/brillo/flotar) están PAUSADAS por defecto:
   los elementos viven siempre en el DOM (ocultos con opacity:0) y una animación infinita
   con opacity:0 sigue costando compositing 24/7 en OBS aunque no haya ningún regalo. Solo
   corren mientras hay un revelado en pantalla (root.gr-playing, toggled en play()/drain()). */
.gr-playing .gr-ring,.gr-playing .gr-ring::after,.gr-playing .gr-halo,.gr-playing .gr-shine,.gr-playing .gr-icon{animation-play-state:running}
`,document.head.appendChild(_);var v=document.getElementById(`gift-overlay-root`);v.innerHTML=`
  <div class="gr-flash" id="gr-flash"></div>
  <div class="gr-shock" id="gr-shock"></div>
  <canvas id="gift-fx"></canvas>
  <div class="gr-rocket" id="gr-rocket">
    <div class="gr-ring"><div class="gr-avatar" id="gr-avatar">U</div></div>
  </div>
  <div class="gr-reveal" id="gr-reveal">
    <div class="gr-orb"><div class="gr-halo"></div><div class="gr-shine"></div><div class="gr-icon" id="gr-icon"></div></div>
    <div class="gr-user" id="gr-user">Usuario</div>
    <div class="gr-verb" id="gr-verb">envió</div>
    <div class="gr-gift-name" id="gr-gift-name">Regalo</div>
    <div class="gr-badge" id="gr-badge">×1</div>
  </div>
`;function y(e){return i.find(t=>t.id===e)??i.find(e=>e.id===`gold`)}function ne(e){let t=(e||``).trim().replace(/^#/,``);return t.length===3&&(t=t.split(``).map(e=>e+e).join(``)),/^[0-9a-fA-F]{6}$/.test(t)?`${parseInt(t.slice(0,2),16)},${parseInt(t.slice(2,4),16)},${parseInt(t.slice(4,6),16)}`:`255,200,90`}function b(e,t){a(v,y(e),t);let n=t?.c2??y(e)?.vars.c2??`#ffd86b`;v.style.setProperty(`--oi-glow`,ne(n))}var x=document.getElementById(`gift-fx`),S=x.getContext(`2d`),C=0,w=0,T=1;function E(){T=Math.min(window.devicePixelRatio||1,1.5),C=window.innerWidth,w=window.innerHeight,x.width=C*T,x.height=w*T,x.style.width=C+`px`,x.style.height=w+`px`,S.setTransform(T,0,0,T,0,0)}window.addEventListener(`resize`,E),E();var D=[],O=(e,t)=>e+Math.random()*(t-e),k=e=>e[Math.random()*e.length|0];function A(){let e=getComputedStyle(v),t=e.getPropertyValue(`--oi-c1`).trim()||`#fff7da`,n=e.getPropertyValue(`--oi-c2`).trim()||`#ffd86b`;return[`#ffffff`,t,n,n,e.getPropertyValue(`--oi-c3`).trim()||`#d4881f`]}var j=A();function re(e,t){for(let n=0;n<3;n++)D.push({x:e+O(-8,8),y:t+O(-4,10),vx:O(-.6,.6),vy:O(.4,1.8),life:1,decay:O(.02,.04),size:O(1.5,4),color:k(j),g:.02,glow:!0});P()}function ie(e,t){for(let n=0;n<130;n++){let r=Math.PI*2*n/130+O(-.08,.08),i=O(4,13);D.push({x:e,y:t,vx:Math.cos(r)*i,vy:Math.sin(r)*i,life:1,decay:O(.008,.02),size:O(2,5),color:k(j),g:.08,glow:!0,drag:.96})}for(let n=0;n<40;n++){let n=O(0,Math.PI*2),r=O(8,18);D.push({x:e,y:t,vx:Math.cos(n)*r,vy:Math.sin(n)*r,life:1,decay:O(.03,.06),size:O(1,2.5),color:`#fff7ea`,g:.05,glow:!0,drag:.92})}for(let n=0;n<50;n++){let n=O(0,Math.PI*2),r=O(1,6);D.push({x:e,y:t,vx:Math.cos(n)*r,vy:Math.sin(n)*r-1,life:1,decay:O(.004,.01),size:O(1,3),color:k(j),g:.12,glow:!1,drag:.99,twinkle:!0})}P()}var M=!1;function N(e){S.clearRect(0,0,C,w),S.globalCompositeOperation=`lighter`;for(let t=D.length-1;t>=0;t--){let n=D[t];if(n.drag&&(n.vx*=n.drag,n.vy*=n.drag),n.vy+=n.g,n.x+=n.vx,n.y+=n.vy,n.life-=n.decay,n.life<=0){D.splice(t,1);continue}let r=n.life;n.twinkle&&(r*=.5+.5*Math.sin(e/60+n.x)),r=Math.max(0,r),S.fillStyle=n.color,n.glow&&(S.globalAlpha=r*.3,S.beginPath(),S.arc(n.x,n.y,n.size*2.6,0,Math.PI*2),S.fill()),S.globalAlpha=r,S.beginPath(),S.arc(n.x,n.y,n.size,0,Math.PI*2),S.fill()}S.globalAlpha=1,S.globalCompositeOperation=`source-over`,D.length>0?requestAnimationFrame(N):M=!1}function P(){M||(M=!0,requestAnimationFrame(N))}function ae(e){let t=getComputedStyle(v),n=t.getPropertyValue(`--oi-c1`).trim()||`#fff7da`,r=t.getPropertyValue(`--oi-c2`).trim()||`#ffd86b`,i=t.getPropertyValue(`--oi-c3`).trim()||`#d4881f`;return`<svg viewBox="0 0 120 120" xmlns="http://www.w3.org/2000/svg">${`<defs><linearGradient id="gr-g" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="${n}"/><stop offset=".5" stop-color="${r}"/><stop offset="1" stop-color="${i}"/></linearGradient></defs>`}${{gift:`<rect x="20" y="48" width="80" height="56" rx="8" fill="url(#gr-g)"/><rect x="14" y="36" width="92" height="20" rx="6" fill="url(#gr-g)"/><rect x="54" y="36" width="12" height="68" fill="${i}" opacity=".5"/><path d="M60 36c-6-22-34-18-26 0M60 36c6-22 34-18 26 0" fill="none" stroke="url(#gr-g)" stroke-width="9" stroke-linecap="round"/>`,bits:`<path d="M30 44h60l-30 56z" fill="url(#gr-g)"/><path d="M30 44l14-20h32l14 20z" fill="url(#gr-g)"/><path d="M44 24l-14 20h28z" fill="${n}" opacity=".7"/><path d="M76 24l14 20H62z" fill="${i}" opacity=".5"/>`,sub:`<path d="M22 44l16 18 22-30 22 30 16-18 6 52H16z" fill="url(#gr-g)"/><rect x="20" y="92" width="80" height="14" rx="4" fill="url(#gr-g)"/><circle cx="22" cy="42" r="7" fill="url(#gr-g)"/><circle cx="98" cy="42" r="7" fill="url(#gr-g)"/><circle cx="60" cy="30" r="7" fill="url(#gr-g)"/>`,subgift:`<rect x="20" y="48" width="80" height="56" rx="8" fill="url(#gr-g)"/><rect x="14" y="36" width="92" height="20" rx="6" fill="url(#gr-g)"/><circle cx="60" cy="80" r="7" fill="${i}"/><path d="M60 36c-6-22-34-18-26 0M60 36c6-22 34-18 26 0" fill="none" stroke="url(#gr-g)" stroke-width="9" stroke-linecap="round"/>`}[e]}</svg>`}var F=document.getElementById(`gr-rocket`),I=document.getElementById(`gr-avatar`),L=document.getElementById(`gr-reveal`),oe=document.getElementById(`gr-user`),se=document.getElementById(`gr-verb`),ce=document.getElementById(`gr-gift-name`),R=document.getElementById(`gr-icon`),z=document.getElementById(`gr-badge`),le=document.getElementById(`gr-flash`),B=document.getElementById(`gr-shock`),V=e=>new Promise(t=>setTimeout(t,e)),H=[],U=!1;function ue(e,t){let n=(t||`U`).trim()[0]?.toUpperCase()||`U`;if(e){let t=new Image;t.referrerPolicy=`no-referrer`,t.onerror=()=>{I.textContent=n},t.onload=()=>{I.innerHTML=``,I.appendChild(t)},t.src=e,I.textContent=n}else I.textContent=n}function de(e){return e===`sub`?`se suscribió`:e===`subgift`?`regaló`:`envió`}async function fe(e){U=!0,v.classList.add(`gr-playing`),j=A(),ue(e.avatar,e.username),oe.textContent=e.username,se.textContent=de(e.kind),ce.textContent=e.giftName,e.imgUrl?R.innerHTML=`<img src="${e.imgUrl}" alt="" referrerpolicy="no-referrer"/>`:R.innerHTML=ae(e.kind),z.textContent=`×`+(e.amount>0?e.amount:1),z.style.display=e.amount>1||e.kind===`subgift`?``:`none`;let t=m[g]??m.center,n=w*t.y,r=C*t.x/100;F.style.left=t.x+`%`,L.style.left=t.x+`%`,B.style.left=t.x+`%`,v.style.setProperty(`--gr-fx`,t.x+`%`),v.style.setProperty(`--gr-fy`,t.y*100+`%`),F.style.opacity=`0`,F.style.transform=`translateX(-50%)`,F.getBoundingClientRect();let i=F.animate([{transform:`translateX(-50%) translateY(0)`,opacity:0},{transform:`translateX(-50%) translateY(-60px)`,opacity:1,offset:.12},{transform:`translateX(-50%) translateY(-${w-n-60}px)`,opacity:1}],{duration:950,easing:`cubic-bezier(.22,.9,.3,1)`,fill:`forwards`}),a=!0,o=v.querySelector(`.gr-ring`);(function e(){if(!a)return;let t=o.getBoundingClientRect();re(t.left+t.width/2,t.top+t.height+6),requestAnimationFrame(e)})(),await i.finished,await V(120),a=!1,F.style.opacity=`0`,i.cancel(),ie(r,n),le.animate([{opacity:0},{opacity:1,offset:.1},{opacity:0}],{duration:520,easing:`ease-out`}),B.style.top=n+`px`,B.animate([{transform:`translate(-50%,-50%) scale(0)`,opacity:.95},{transform:`translate(-50%,-50%) scale(14)`,opacity:0}],{duration:700,easing:`cubic-bezier(.1,.7,.3,1)`}),await V(120),L.style.top=n+`px`;let s=L.animate([{transform:`translate(-50%,-50%) scale(.3) rotate(-8deg)`,opacity:0},{transform:`translate(-50%,-50%) scale(1.18) rotate(3deg)`,opacity:1,offset:.55},{transform:`translate(-50%,-50%) scale(1) rotate(0deg)`,opacity:1}],{duration:620,easing:`cubic-bezier(.2,1.4,.4,1)`,fill:`forwards`}),c=!0;(function e(){c&&(Math.random()<.6&&(D.push({x:r+O(-C*.2,C*.2),y:n-90,vx:O(-.5,.5),vy:O(.3,1.2),life:1,decay:.01,size:O(1,2.5),color:k(j),g:.03,glow:!0,twinkle:!0}),P()),requestAnimationFrame(e))})(),await V(ee),c=!1;let l=L.animate([{transform:`translate(-50%,-50%) scale(1)`,opacity:1},{transform:`translate(-50%,-60%) scale(.92)`,opacity:0}],{duration:500,easing:`ease-in`,fill:`forwards`});await l.finished,L.style.opacity=`0`,s.cancel(),l.cancel(),F.style.transform=`translateX(-50%)`,U=!1,G()}function W(e){H.length>24||(H.push(e),G())}function G(){if(!U){if(H.length===0){v.classList.remove(`gr-playing`);return}fe(H.shift())}}var K=[];try{K=n()}catch{}function pe(e){if(e.kind===`sub`||e.kind===`subgift`)return!0;if(e.kind===`bits`)return e.value>=d;if(f!==`all`&&p.size>0){let t=e.giftName.trim().toLowerCase();if(f===`only`)return p.has(t);if(p.has(t))return!1}return e.value>=d}var q=(e,t)=>typeof e[t]==`string`?e[t]:``,J=(e,t)=>typeof e[t]==`number`?e[t]:0,Y=(e,t)=>e[t]===!0;function me(e){if(J(e,`giftType`)===1&&!Y(e,`repeatEnd`))return null;let n=Math.max(1,J(e,`repeatCount`)||1),r=Math.max(0,J(e,`coins`)||J(e,`diamondCount`)),i=q(e,`giftImageUrl`)||q(e,`imgUrl`)||t({gifts:q(e,`giftId`)?[q(e,`giftId`)]:[],giftNames:q(e,`giftName`)?[q(e,`giftName`)]:[]},K);return{username:q(e,`nickname`)||q(e,`uniqueId`)||`Anónimo`,avatar:q(e,`profilePicUrl`)||null,giftName:q(e,`giftName`)||`Regalo`,amount:n,value:r*n,imgUrl:i||null,kind:`gift`}}function X(e){return Y(e,`isAnonymous`)?`Anónimo`:q(e,`userName`)||q(e,`userLogin`)||`Anónimo`}function he(e,t){switch(e){case`gift_event`:return me(t);case`twitch_cheer_event`:{let e=Math.max(0,J(t,`bits`));return e<=0?null:{username:X(t),giftName:`Bits`,amount:e,value:e,kind:`bits`}}case`twitch_sub_gift_event`:{let e=Math.max(1,J(t,`total`));return{username:X(t),giftName:e>1?`Subs regalados`:`Sub regalada`,amount:e,value:e,kind:`subgift`}}case`twitch_sub_event`:return Y(t,`isGift`)?null:{username:X(t),giftName:`Suscripción`,amount:1,value:1,kind:`sub`};case`kick_gifted_sub_event`:{let e=Math.max(1,J(t,`quantity`));return{username:Y(t,`isAnonymous`)?`Anónimo`:q(t,`userLogin`)||`Anónimo`,giftName:e>1?`Subs regalados`:`Sub regalada`,amount:e,value:e,kind:`subgift`}}case`kick_sub_event`:return{username:q(t,`userLogin`)||`Anónimo`,giftName:`Suscripción`,amount:1,value:1,kind:`sub`};default:return null}}function ge(e){return e.startsWith(`twitch_`)?`twitch`:e.startsWith(`kick_`)?`kick`:`tiktok`}function Z(e,t){if(c&&ge(e)!==c)return;let n=he(e,t);!n||!pe(n)||W(n)}function Q(e){if(!e||typeof e!=`object`)return;(e.preset||e.vars)&&b(e.preset,e.vars),typeof e.minValue==`number`&&isFinite(e.minValue)&&(d=Math.max(0,e.minValue)),typeof e.holdMs==`number`&&isFinite(e.holdMs)&&(ee=Math.max(800,e.holdMs));let t=h(e.pos??null);t&&(g=t),e.giftFilterMode!==void 0&&(f=te(e.giftFilterMode)),Array.isArray(e.giftFilterNames)&&(p=new Set(e.giftFilterNames.map(e=>String(e).trim().toLowerCase()).filter(Boolean)))}u?(b(r),e(async()=>{let{firebaseDb:e,isFirebaseConfigured:t}=await import(`./firebase-BylMgSsD.js`).then(e=>e.n);return{firebaseDb:e,isFirebaseConfigured:t}},__vite__mapDeps([0,1,2])).then(async({firebaseDb:t,isFirebaseConfigured:n})=>{if(!n())return;let{ref:r,onValue:i}=await e(async()=>{let{ref:e,onValue:t}=await import(`./index.esm-DKdodk42.js`).then(e=>e.t);return{ref:e,onValue:t}},__vite__mapDeps([2,1]));i(r(t,`rooms/${u}/settings`),e=>{let t=e.val();Q(t?.global?.giftReveal??t?.tiktok?.giftReveal)});let a=r(t,`rooms/${u}/giftEvent`),o=null;i(a,e=>{let t=e.val();if(!t)return;let n=t.seq??0;if(o===null){o=n;return}n!==o&&(o=n,Z(`gift_event`,{...t,giftType:t.giftType??0}))});let s=r(t,`rooms/${u}/giftTest`),c=null;i(s,e=>{let t=e.val();if(!t)return;let n=t.seq??0;if(c===null){c=n;return}n!==c&&(c=n,$(t))})}).catch(()=>{})):(l?b(s.get(`preset`)??void 0,_e(s.get(`vars`))):b(r),o(e=>{let t=e.type;if(t===`settings`&&!l){let t=e;(!t.platform||!c||t.platform===c)&&t.giftReveal&&Q(t.giftReveal)}else t===`gift_reveal_test`?$(e.data??{}):Z(t,e.data??{})}),l||fetch(`/api/overlay/settings?platform=`+(s.get(`platform`)??`tiktok`)).then(e=>e.json()).then(e=>Q(e?.giftReveal)).catch(()=>{}));function $(e){if(e.platform&&c&&e.platform!==c)return;let t=[`gift`,`bits`,`sub`,`subgift`].includes(q(e,`kind`))?q(e,`kind`):`gift`;W({username:q(e,`username`)||`Tester`,avatar:q(e,`avatar`)||null,giftName:q(e,`giftName`)||`Regalo de prueba`,amount:Math.max(1,J(e,`amount`)||1),value:Math.max(0,J(e,`value`)),imgUrl:q(e,`imgUrl`)||null,kind:t})}try{let e=new BroadcastChannel(`oi-gift-reveal-test`);e.onmessage=e=>{try{$(e.data??{})}catch{}}}catch{}if(l){let e=[{username:`CarlaStream`,giftName:`Rosa`,amount:5,value:5,kind:`gift`},{username:`ElDiegoGG`,giftName:`Diamante`,amount:1,value:100,kind:`gift`},{username:`LunaVT`,giftName:`Bits`,amount:500,value:500,kind:`bits`},{username:`MaxPower`,giftName:`Suscripción`,amount:1,value:1,kind:`sub`},{username:`SoyPepe`,giftName:`Subs regalados`,amount:5,value:5,kind:`subgift`}],t=0,n=()=>W(e[t++%e.length]);setTimeout(n,500),setInterval(()=>{!U&&H.length===0&&n()},6500)}function _e(e){if(e)try{return JSON.parse(decodeURIComponent(escape(atob(e))))}catch{return}}