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,s as n}from"./appearance-BS3s9rl-.js";import{n as r,t as i}from"./counterPresets-CKPXtDd-.js";import{i as a,n as o,r as s,t as c}from"./overlayStyle-BLOTt0xN.js";document.documentElement.style.cssText=`background:transparent;overflow:hidden`,document.body.style.cssText=`background:transparent;margin:0;overflow:hidden;height:100vh`;var l=new URLSearchParams(location.search),u=l.has(`demo`),d=l.get(`counter`),f=document.createElement(`style`);f.textContent=`
#counters-overlay-root{width:100vw;height:100vh;display:flex;align-items:center;justify-content:center;font-family:var(--oi-font,"Rajdhani",system-ui,sans-serif)}
.oi-counters{display:flex;flex-direction:var(--oi-dir,column);flex-wrap:wrap;align-items:center;justify-content:center;gap:10px}
.oi-cnt{display:inline-flex;align-items:center;gap:9px;background:var(--c-bg,var(--oi-bg,rgba(12,12,18,.82)));border:var(--oi-border,1px solid transparent);border-radius:var(--oi-radius,12px);padding:var(--oi-pad,7px 12px);box-shadow:var(--oi-shadow,none);backdrop-filter:var(--oi-blur,none);font-family:var(--c-font,var(--oi-font,"Rajdhani",system-ui,sans-serif))}
.oi-cnt.minimal{gap:7px;border-radius:30px;padding:6px 12px}
.oi-cnt-ico{flex-shrink:0;display:flex;align-items:center;justify-content:center;font-size:24px;line-height:1}
.oi-cnt.full .oi-cnt-ico{width:40px;height:40px;border-radius:9px;background:rgba(255,255,255,.08);font-size:22px}
.oi-cnt-ico img{width:100%;height:100%;object-fit:contain}
/* En minimal el ícono no tiene caja fija (el emoji se dimensiona por font-size); sin
   esto la IMAGEN tomaba su tamaño natural y rompía el layout. Le damos caja fija. */
.oi-cnt.minimal .oi-cnt-ico img{width:28px;height:28px}
.oi-cnt-meta{display:flex;flex-direction:column;gap:0}
.oi-cnt-title{font-size:12.5px;font-weight:var(--c-weight,var(--oi-weight,700));line-height:1.15;letter-spacing:.3px;color:var(--c-fg2,var(--oi-fg2,rgba(255,255,255,.92)));text-shadow:var(--c-shadow,0 0 0 transparent)}
.oi-cnt-val{font-size:28px;font-weight:var(--c-weight,var(--oi-weight,700));line-height:1;color:var(--c-fg,var(--oi-fg,#fff));text-shadow:var(--c-shadow,0 0 0 transparent),var(--c-glow,0 0 0 transparent)}
.oi-cnt.minimal .oi-cnt-val{font-size:22px}
.oi-cnt-frac{font-size:.55em;font-weight:500;opacity:.6;margin-left:.06em;letter-spacing:0}
.oi-cnt-val.pop{animation:oi-pop .3s ease}
@keyframes oi-pop{0%{transform:scale(1.35)}100%{transform:scale(1)}}
.oi-anim-shake{animation:oi-shake .6s ease infinite}
.oi-anim-bounce{animation:oi-bounce .7s ease infinite}
.oi-anim-spin{animation:oi-spin 2s linear infinite}
.oi-anim-pulse{animation:oi-pulse 1s ease infinite}
.oi-anim-float{animation:oi-float 2.5s ease infinite}
@keyframes oi-shake{0%,100%{transform:translateX(0) rotate(0)}25%{transform:translateX(-2px) rotate(-6deg)}75%{transform:translateX(2px) rotate(6deg)}}
@keyframes oi-bounce{0%,100%{transform:translateY(0)}50%{transform:translateY(-6px)}}
@keyframes oi-spin{to{transform:rotate(360deg)}}
@keyframes oi-pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.18)}}
@keyframes oi-float{0%,100%{transform:translateY(0) rotate(-3deg)}50%{transform:translateY(-4px) rotate(3deg)}}
${c}
`,document.head.appendChild(f);var p=document.getElementById(`counters-overlay-root`),m=document.createElement(`div`);m.className=`oi-counters`,p.appendChild(m);function h(e){return r.find(t=>t.id===e)??r.find(e=>e.id===`pro`)}function g(e,t){o(p,h(e),t)}function _(e){p.style.setProperty(`--oi-dir`,e===`row`||e===`horizontal`?`row`:`column`)}var v=new Map;function y(e,t){let n=t.isFraction&&t.maxValue!=null?`${t.value}/${t.maxValue}`:String(t.value),r=Math.max(v.get(t.id)??0,n.length);v.set(t.id,r),a(e,n,r)}function b(e){let r=document.createElement(`div`);r.className=`oi-cnt ${e.layout===`minimal`?`minimal`:`full`}`,r.dataset.id=e.id;let a=i[e.colorIdx]??i[i.length-1];e.bgColor&&r.style.setProperty(`--c-bg`,e.bgColor),r.style.setProperty(`--c-fg`,e.textColor||a.text),e.textColor&&r.style.setProperty(`--c-fg2`,e.textColor),e.font&&(t(e.font),r.style.setProperty(`--c-font`,n(e.font))),e.weight&&r.style.setProperty(`--c-weight`,String(e.weight)),e.textShadow&&r.style.setProperty(`--c-shadow`,`0 1px 3px rgba(0,0,0,.55), 0 0 1px rgba(0,0,0,.5)`),e.glow&&r.style.setProperty(`--c-glow`,`0 0 7px currentColor, 0 0 15px currentColor`);let o=document.createElement(`div`);if(o.className=`oi-cnt-ico`+(e.iconAnimation&&e.iconAnimation!==`none`?` oi-anim-${e.iconAnimation}`:``),e.iconImage){let t=document.createElement(`img`);t.src=e.iconImage,t.alt=``,o.appendChild(t)}else o.textContent=e.icon||`🎮`;let s=document.createElement(`div`);if(s.className=`oi-cnt-val`,y(s,e),e.layout===`minimal`)r.append(o,s);else{let t=document.createElement(`div`);t.className=`oi-cnt-meta`;let n=document.createElement(`div`);n.className=`oi-cnt-title`,n.textContent=e.name,t.append(n,s),r.append(o,t)}return r}var x=[];function S(e){x=e.filter(e=>!d||e.id===d).sort((e,t)=>e.order-t.order),m.innerHTML=``;for(let e of x)m.appendChild(b(e))}function C(e,t){let n=x.find(t=>t.id===e);if(!n)return;n.value=t;let r=m.querySelector(`[data-id="${CSS.escape(e)}"]`)?.querySelector(`.oi-cnt-val`);r&&(y(r,n),r.classList.remove(`pop`),r.offsetWidth,r.classList.add(`pop`))}var w=[{id:`d1`,name:`Muertes`,value:27,icon:`💀`,iconAnimation:`none`,colorIdx:5,layout:`full`,isFraction:!1,order:0},{id:`d2`,name:`Jefes`,value:3,icon:`⚔️`,iconAnimation:`none`,colorIdx:2,layout:`full`,isFraction:!0,maxValue:5,order:1}],T=!1;function E(e){return[e.id,e.name,e.icon,e.iconImage??``,e.iconAnimation,e.colorIdx,e.bgColor??``,e.textColor??``,e.layout,+!!e.isFraction,e.maxValue??``,e.order,e.font??``,e.weight??``,+!!e.textShadow,+!!e.glow].join(``)}var D=``;function O(e){if(!e||!e.length){D=``,u&&!T?S(w):(T=!1,S([]));return}T=!0;let t=e.filter(e=>!d||e.id===d).sort((e,t)=>e.order-t.order),n=t.map(E).join(`|`);if(n===D&&t.length===x.length){for(let e of t){let t=x.find(t=>t.id===e.id);(!t||t.value!==e.value)&&C(e.id,e.value)}x=t}else D=n,S(t)}var k=l.get(`uid`);k?(g(`pro`),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/${k}/settings`),e=>{let t=e.val(),n=t?.global?.counters??t?.tiktok?.counters;n&&(g(n.preset,n.vars),_(n.dir))}),i(r(t,`rooms/${k}/counters`),e=>{let t=e.val();O(t?Object.values(t):[])})}).catch(()=>{})):(u?(g(l.get(`preset`)??void 0,A(l.get(`vars`))),_(l.get(`dir`)??void 0)):g(`pro`),s(e=>{if(e.type===`counters_state`&&Array.isArray(e.data))O(e.data);else if(e.type===`counter_update`&&e.data){let t=e.data;C(t.id,t.value)}else if(e.type===`settings`&&!u){let t=e.counters;t&&typeof t==`object`&&(g(t.preset,t.vars),_(t.dir))}}),fetch(`/api/counters`).then(e=>e.json()).then(e=>O(Array.isArray(e)?e:[])).catch(()=>{u&&S(w)}),u?S(w):fetch(`/api/overlay/settings?platform=`+(l.get(`platform`)??`tiktok`)).then(e=>e.json()).then(e=>{e?.counters&&(g(e.counters.preset,e.counters.vars),_(e.counters.dir))}).catch(()=>{}));function A(e){if(e)try{return JSON.parse(decodeURIComponent(escape(atob(e))))}catch{return}}