1import"./chunk-RJYBTLPW.js";import"./chunk-IWDOFJ6Q.js";import{A as O,B as J,D as P,Da as re,G as Q,Ga as ae,H as R,Ha as ne,I as V,K as S,M as L,Q as D,R as X,Ra as h,V as Y,Y as W,f as c,fa as ee,g as E,h as n,ia as m,k,ka as te,l as o,p as i,qa as se,r as C,t,w as I}from"./chunk-KEQDT2XX.js";import"./chunk-JJ75YLVJ.js";var me=L("<span> </span>"),he=L('<div class="absolute transition-all duration-75 ease-out will-change-transform"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="drop-shadow-lg"><path d="M5.65376 12.3673L5.46026 5.66847L18.6768 11.4867L11.4076 14.5962L8.29805 21.8654L5.65376 12.3673Z" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path></svg> <div class="absolute top-6 left-4 whitespace-nowrap px-2"><div><span class="font-extrabold text-sm"> </span> <!></div></div></div>'),xe=L('<div class="absolute will-change-transform"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="drop-shadow-lg hidden"><path d="M5.65376 12.3673L5.46026 5.66847L18.6768 11.4867L11.4076 14.5962L8.29805 21.8654L5.65376 12.3673Z" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path></svg> <div class="absolute top-6 left-4 whitespace-nowrap px-2"><div class="px-2 rounded-full rounded-tl-none text-xs font-medium text-white shadow-lg flex items-center space-x-1 pointer-events-none"><input type="text" placeholder="Say something..." autocomplete="off" class="px-2 bg-transparent text-white placeholder-white/60 focus:outline-none text-xs flex-1 min-w-[120px] border-0 focus:ring-0 focus:ring-offset-0 cursor-text pointer-events-auto"></div></div></div>'),we=L('<div class="fixed inset-0 pointer-events-none z-50"><!> <!></div>');function be(le,p){Q(p,!1);let Z=c(),oe=c(),v=h(p,"live",8),x=h(p,"currentUserId",8),ie=h(p,"currentUserName",8),ye=h(p,"currentUserAvatar",8),M=h(p,"currentPage",8),K=h(p,"adminPresence",24,()=>[]),r=c({}),y=c(!1),w=c(""),A=c(0),B=c(0),d=c({}),q=!1,F=null,U=null;ae(()=>{console.log("\u{1F50C} AdminMultiplayer mounted"),console.log("\u{1F4CA} Initial adminPresence:",K()),console.log("\u{1F464} Current user:",x(),ie()),console.log("\u{1F4CD} Current page:",M()),K().forEach(e=>{E(r,t(r)[e.user_id]={user_id:e.user_id,name:e.name,avatar_url:e.avatar_url,cursor:{x:-100,y:-100,page:""}})}),console.log("\u{1F3AF} Initialized cursors:",t(r)),F=e=>{if(n(A,e.clientX),n(B,e.clientY),!q){q=!0;let s=t(y)?50:10;setTimeout(()=>{v().pushEvent("update_cursor",{x:t(A),y:t(B),page:M()}),q=!1},s)}},U=e=>{e.key==="/"?(e.preventDefault(),n(y,!0)):e.key==="Escape"&&t(y)&&(e.preventDefault(),z())},document.addEventListener("mousemove",F),document.addEventListener("keydown",U),v().handleEvent("live_message",de),v().handleEvent("clear_chat_input",()=>{n(w,"")}),v().handleEvent("cursor_update",e=>{let{user_id:s,name:a,avatar_url:u,cursor:l}=e;E(r,t(r)[s]={user_id:s,name:a,avatar_url:u,cursor:l}),n(r,t(r))}),v().handleEvent("admin_joined",e=>{console.log("\u{1F44B} Admin joined:",e);let{user_id:s,name:a,avatar_url:u}=e;E(r,t(r)[s]={user_id:s,name:a,avatar_url:u,cursor:{x:-100,y:-100,page:""}}),n(r,t(r)),console.log("\u2705 Updated cursors after join:",t(r))}),v().handleEvent("admin_left",e=>{console.log("\u{1F44B} Admin left:",e);let{user_id:s}=e;delete t(r)[s],delete t(d)[s],n(r,t(r)),n(d,t(d)),console.log("\u2705 Updated cursors after leave:",t(r))})}),ne(()=>{F&&document.removeEventListener("mousemove",F),U&&document.removeEventListener("keydown",U)});function de(e){let{user_id:s,message:a}=e;a&&a.trim()!==""?E(d,t(d)[s]=e):delete t(d)[s],n(d,t(d))}function ue(e){let s=e.target;n(w,s.value),v().pushEvent("update_live_message",{text:t(w),cursor_position:{x:t(A),y:t(B)}})}function $e(e){(e.key==="Enter"||e.key==="Escape")&&(e.preventDefault(),z())}function z(){n(y,!1),n(w,""),v().pushEvent("close_live_message",{})}function T(e){let s=["#FF6B6B","#4ECDC4","#45B7D1","#FFA07A","#98D8C8","#F7DC6F","#BB8FCE","#85C1E2","#F8B739","#52D273"],a=e.split("").reduce((u,l)=>u+l.charCodeAt(0),0);return s[a%s.length]}O(()=>
1(t(r),I(x()),I(M())),()=>{n(Z,Object.values(t(r)).filter(e=>e.user_id!==x()&&e.cursor&&e.cursor.page===M()))}),O(()=>(t(d),I(x())),()=>{n(oe,Object.values(t(d)).filter(e=>e.user_id!==x()))}),J(),re();var H=we(),G=i(H);W(G,1,()=>t(Z),e=>e.user_id,(e,s)=>{var a=he();let u=k(()=>t(s).cursor||{x:-100,y:-100}),l=k(()=>t(d)[t(s).user_id]);var _=i(a),f=i(_);o(_);var $=C(_,2),j=i($),N=i(j),ge=i(N,!0);o(N);var pe=C(N,2);{var _e=g=>{var b=me(),fe=i(b,!0);o(b),P(()=>X(fe,t(l).message)),D(g,b)};Y(pe,g=>{t(l)&&t(l).message&&g(_e)})}o(j),o($),o(a),P(g=>{var b;m(a,"style",`transform: translate3d(${t(u).x-2}px, ${t(u).y-2}px, 0);`),m(f,"fill",g),te(j,`px-2 rounded-tl-none ${(b=t(l)&&t(l).message?"rounded-full":"rounded-xl")!=null?b:""} text-xs font-medium text-white shadow-lg flex items-center space-x-2 w-full align-bottom`),m(j,"style",`background-color: ${g!=null?g:""};`),X(ge,t(s).name)},[()=>T(t(s).user_id)],k),D(e,a)});var ce=C(G,2);{var ve=e=>{var s=xe(),a=i(s),u=i(a);o(a);var l=C(a,2),_=i(l),f=i(_);ee(f),V(f,!0),o(_),o(l),o(s),P($=>{m(s,"style",`transform: translate3d(${t(A)-2}px, ${t(B)-2}px, 0);`),m(u,"fill",$),m(_,"style",`background-color: ${$!=null?$:""};`)},[()=>T(x())],k),se(f,()=>t(w),$=>n(w,$)),S("input",f,ue),S("keydown",f,$e),D(e,s)};Y(ce,e=>{t(y)&&e(ve)})}o(H),D(le,H),R()}export{be as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.