1import{r as m,j as t,R as $}from"./vendor-react-BGN68_Lp.js";import{a as v,u as h}from"./vendor-redux-D8sX5Eqv.js";import{s as J,N as q,a as Q,g as f,c as D,b as L,p as Z,L as K,d as ee,m as z,t as T,S as te,e as M,f as _,h as se,i as ne,j as ae}from"./index-uear5Vpj.js";import{I as F}from"./MatchIcons-CVn1p0ME.js";import{g,E as N}from"./vendor-styled-pkIKgjgv.js";import{u as k}from"./vendor-i18n-BWleq_Sd.js";import{a as ie}from"./vendor-router-CYD8mbvC.js";import{L as R}from"./lobbyEvents-BcVEWkzw.js";import"./vendor-socket-DSYo_sTV.js";const x=e=>{e.preventDefault(),e.stopPropagation()},Y=(e,n,s)=>{navigator.clipboard.writeText(`connect ${e}:${n}`),J(s("AddressServerCopy"))},re=(e,n)=>Object.values(e||{}).flatMap(s=>Object.values(s||{})).flatMap(s=>Object.values(s||{})).flatMap(s=>s||[]).find(s=>String(s.id)===String(n)),B=3e4,oe=300,U=250,E="cubic-bezier(0.23, 1, 0.32, 1)",ce=N` 2 from { 3 opacity: 0; 4 transform: translateY(8px); 5 } 6 7 to { 8 opacity: 1; 9 transform: translateY(0); 10 } 11`,le=N` 12 from { 13 opacity: 1; 14 transform: translateY(0); 15 } 16 17 to { 18 opacity: 0; 19 transform: translateY(8px); 20 } 21`,de=N` 22 from { 23 transform: scaleX(1); 24 } 25 26 to { 27 transform: scaleX(0); 28 } 29`,me=g.div` 30 position: fixed; 31 bottom: 36px; 32 left: ${e=>e.$collapsed?"120px":"280px"}; 33 z-index: 101; 34 display: flex; 35 flex-direction: column; 36 transition: left 0.2s ease; 37 gap: 6px; 38 pointer-events: none; 39 40 @media (max-width: 1000px) { 41 display: none; 42 } 43`,P=g(q)` 44 border-radius: 18px; 45 border: 2px solid rgba(117, 156, 255, 0.08); 46 background: 47 linear-gradient( 48 180deg, 49 rgba(44, 61, 104, 0.2) 0%, 50 rgba(65, 84, 152, 0.2) 100% 51 ), 52 #131821; 53 backdrop-filter: blur(15px); 54 padding: 12px 18px 12px 14px; 55 display: flex; 56 align-items: center; 57 min-width: 300px; 58 transition: 59 filter 150ms ${E}, 60 opacity 200ms ${E}; 61 cursor: pointer; 62 pointer-events: all; 63 64 .temporary-progress { 65 position: absolute; 66 left: 0; 67 top: 0; 68 height: 100%; 69 width: 100%; 70 border-radius: 17px; 71 overflow: hidden; 72 73 &::before { 74 content: ''; 75 position: absolute; 76 inset: 0 auto 0 0; 77 width: 100%; 78 transform-origin: left; 79 background: rgba(64, 76, 114, 0.24); 80 pointer-events: none; 81 animation: ${de} ${B}ms linear forwards; 82 z-index: 0; 83 } 84 } 85 86 &:hover { 87 filter: brightness(110%); 88 } 89 90 &.hidden { 91 display: none; 92 } 93 94 &.fade-in { 95 animation: ${ce} ${oe}ms ${E} backwards; 96 } 97 98 &.fade-out { 99 animation: ${le} ${U}ms ${E} forwards; 100 pointer-events: none; 101 } 102`,G=g.div` 103 border-radius: 10px; 104 border: 1.5px solid #576995; 105 width: 48px; 106 height: 48px; 107 padding: 3px; 108 109 img { 110 display: block; 111 border-radius: 7px; 112 width: 100%; 113 height: 100%; 114 object-fit: cover; 115 } 116`,V=g.div` 117 margin-left: 14px; 118`,W=g.div` 119 padding-left: 20px; 120 display: flex; 121 align-items: center; 122 gap: 6px; 123 margin-left: auto; 124 125 button { 126 border-radius: 10px; 127 display: flex; 128 align-items: center; 129 justify-content: center; 130 } 131`,H=g.h2` 132 font-size: 15px; 133 font-weight: 700; 134 margin-bottom: 5px; 135 text-align: left; 136`,j=g.div` 137 text-align: left; 138 display: flex; 139 align-items: center; 140 141 span { 142 color: #9ca4be; 143 font-size: 14px; 144 font-weight: 500; 145 } 146 147 img { 148 width: 16px; 149 height: 16px; 150 border-radius: 50%; 151 margin-right: 6px; 152 } 153`,b=g.button` 154 width: 36px; 155 height: 36px; 156 background: linear-gradient(270deg, #708cff -38.46%, #5971d2 146.15%); 157 158 img { 159 width: 16px; 160 height: 16px; 161 } 162 163 &.gray { 164 background: rgba(93, 108, 146, 0.5); 165 } 166`,X=g(Q)` 167 position: absolute; 168 top: -24px; 169 left: 50%; 170 transform: translateX(-50%); 171 172 &::after { 173 content: ''; 174 position: absolute; 175 top: 100%; 176 left: 50%; 177 margin-left: -5px; 178 border-width: 5px; 179 border-style: solid; 180 border-color: #5cd48b transparent transparent transparent; 181 } 182`,w=g.div` 183 color: #5b657e; 184 font-size: 14px; 185 font-weight: 600; 186 margin-left: 16px; 187 188 &::before { 189 content: ''; 190 position: absolute; 191 width: 4px; 192 height: 4px; 193 display: block; 194 border-radius: 50%; 195 background: #5b657e; 196 top: 50%; 197 left: -8px; 198 transform: translateY(-50%); 199 } 200`,C=g.button` 201 border-radius: 10px; 202 background: #549943; 203 min-width: 74px; 204 padding: 8px; 205 color: #1f3e1a; 206 font-size: 14px; 207 font-weight: 700; 208 height: 36px; 209 210 &.green { 211 color: #6ccc58; 212 border: 2px solid #6ccc58; 213 background: 214 linear-gradient( 215 180deg, 216 rgba(99, 255, 96, 0) -16.07%, 217 rgba(154, 255, 119, 0.12) 116.07% 218 ), 219 rgba(199, 211, 226, 0.01); 220 backdrop-filter: blur(13.5px); 221 } 222`,I={10:"serverSearch",11:"serverSearch",12:"warmup",13:"gameGoing",14:"gameFinished",15:"gameFinished"},pe=$.memo(({lobby:e})=>{const{t:n}=k(),[s,r]=m.useState(""),i=e.match_settings.id_mode_match_ready===0&&Object.keys(e.players).length>1,a=I[e.merge_status]?I[e.merge_status]:i?"waitingHost":"WAITING-FOR-PLAYERS",c=a==="serverSearch";return m.useEffect(()=>{if(!c){r("");return}const l=setInterval(()=>{r(d=>d.length>=3?".":d+".")},500);return()=>clearInterval(l)}
222,[c]),t.jsxs(H,{children:[n(a),c&&s]})}),ge=$.memo(({lobby:e})=>{const{t:n}=k(),{match_settings:s,merge_status:r,players:i,match_stats:a,available_settings:c}=e,l=Object.keys(i).length,d=s.max_players_3+s.max_players_2,o=m.useMemo(()=>Object.values(i).find(u=>u.is_host),[i]),y=m.useMemo(()=>c?.id_data_center.find(u=>u.id===s.id_data_center),[s.id_data_center,c]);return r>=13?t.jsxs(j,{children:[t.jsx("span",{className:"limited-length",children:s.map_name}),a?.base&&t.jsxs(w,{children:[a.base.team_2.score,":",a.base.team_3.score]})]}):r===10||r===11?t.jsxs(j,{children:[t.jsx("img",{loading:"lazy",src:f(`/img/flags/${y?.country}.svg`),alt:""}),t.jsx("span",{children:n(y?.city)}),t.jsxs(w,{children:[l,"/",d]})]}):r===12?t.jsxs(j,{children:[t.jsx("span",{className:"limited-length",children:s.map_name}),t.jsxs(w,{children:[Object.values(i).filter(u=>u.is_connect_server).length,"/",l]})]}):t.jsxs(j,{children:[o&&t.jsxs(t.Fragment,{children:[t.jsx("img",{loading:"lazy",src:o.avatar,alt:""}),t.jsx("span",{className:"limited-length",children:o.name})]}),t.jsxs(w,{children:[l,"/",d]})]})}),ue=({lobby:e,steamid64:n,onCopy:s,onJoin:r,onReady:i,onInvite:a})=>{const{t:c}=k(),l=e.match_settings,d=l.max_players_3+l.max_players_2,o=m.useMemo(()=>Object.values(e.players).filter(S=>S.id_slot===2||S.id_slot===3).length,[e]),y=l.id_mode_match_ready===1&&o===d,u=e.merge_status>=12;if(y){if(e.players[n]?.is_ready){const S=Object.values(e.players).filter(A=>A.id_slot!==1&&A.is_ready).length;return t.jsxs(C,{className:"green",children:[S,"/",o]})}return t.jsx(C,{onClick:i,children:c("readyForGame")})}if(u)return t.jsxs(t.Fragment,{children:[t.jsx(b,{className:"gray",onClick:s,children:t.jsx("img",{loading:"lazy",src:f("/pages/matches/icons/copy.svg"),alt:""})}),t.jsx(b,{onClick:r,children:t.jsx("img",{loading:"lazy",src:f("/pages/matches/icons/play.svg"),alt:""})})]});const p=(e.merge_status??0)<10&&!!e.players[n];return t.jsxs(t.Fragment,{children:[p&&t.jsxs(b,{className:"gray",onClick:a,children:[t.jsx(F,{size:16,color:"#fff"}),t.jsx(X,{children:"NEW"})]}),t.jsx(b,{children:t.jsx("img",{loading:"lazy",src:f("/pages/matches/icons/white-arrow.svg"),alt:"",style:{width:20,height:20}})})]})},fe=({lobby:e,leaving:n})=>{const{t:s}=k(),{pathname:r}=ie(),i=v(),a=h(p=>p.auth.steamid64),[c,l]=m.useState(!1),d=p=>{x(p),Y(e.server.ip,e.server.port,s)},o=p=>{x(p),window.location.href=`steam://rungameid/730//+connect ${e.server.ip}:${e.server.port}`},y=p=>{x(p),!c&&(Z(K.READY_ACCEPT),T("matches_lobby_ready_click"),l(!0),setTimeout(()=>{l(!1)},1e3),i(ee({steamid64:a,is_ready:!0})),z.goReady(e.id_lobby,!0))},u=p=>{x(p),T("matches_lobby_invite_click"),i(L("INVITE",{idLobby:e.id_lobby}))};return t.jsxs(P,{className:D(n?"fade-out":"fade-in",{hidden:r.includes("/match/"+e.id_lobby)}),to:"/match/"+e.id_lobby,children:[t.jsx(G,{children:t.jsx("img",{loading:"lazy",src:e.merge_status>=12?f(`/img/maps/2/${e.match_settings.map_name}.jpg`):f("/pages/matches/icons/overlay.svg"),alt:""})}),t.jsxs(V,{children:[t.jsx(pe,{lobby:e}),t.jsx(ge,{lobby:e})]}),t.jsx(W,{children:t.jsx(ue,{lobby:e,steamid64:a,onCopy:d,onJoin:o,onReady:y,onInvite:u})})]})},he=({server:e,leaving:n})=>{const{t:s}=k(),r=v(),i=h(o=>o.root.currentGame),a=e.id_games??i,c=o=>{x(o),Y(e.ip,e.port,s)},l=o=>{x(o),T("servers_invite_click",{source:"match_overlay",gamemode:e.mode,map:e.map,category:e.category,server_id:e.ip}),r(L("INVITE",{server:{...e,id_games:a}}))},d=o=>{x(o),r(L(te[Number(a)],{ip:e.ip,port:e.port,source:"rust_page"}))};return t.jsxs(P,{className:D(n?"fade-out":"fade-in"),click:d,to:"/",children:[e.is_temporary&&t.jsx("span",{className:"temporary-progress"}),t.jsx(G,{children:t.jsx("img",{loading:"lazy",src:f(`/img/maps/${a}/${e.map}.jpg`),alt:""})}),t.jsxs(V,{children:[t.jsxs(H,{children:[e.mode," #",e.num]}),t.jsxs(j,{children:[t.jsx("span",{children:e.map}),t.jsxs(w,{children:[e.players,"/",e.max_players]})]})]}),t.jsxs(W,{children:[t.jsxs(b,{className:"gray",onClick:l,children:[t.jsx(F,{size:16,color:"#fff"}),t.jsx(X,{children:"NEW"})]}),t.jsx(b,{className:"gray",onClick:c,children:t.jsx("img",{loading:"lazy",src:f("/pages/matches/icons/copy.svg"),alt:""})})]})]})},O=(e,n)=>{const[s,r]=m.useState(()=>e?{data:e,key:n}:null),[i,a]=m.useState(!1);return m.useEffect(()=>{if(e&&(!s||n===s.key)){r({data:e,key:n}),a(!1);return}if(!e&&!s)return;a(!0);const c=setTimeout(()=>{r(e?{data:e,key:n}:null),a(!1)},U);return()=>clearTimeout(c)}
222,[e,n]),{item:s,leaving:i}},xe=(e,n)=>m.useMemo(()=>{if(!e)return null;const s=re(n,e.id);return s?{...e,...s,ip:s.ip??e.ip,port:s.port??e.port,max_players:s.maxplayers??s.max_players??e.max_players,players:s.players??e.players}:e},[e,n]),ye=()=>{const e=v();m.useEffect(()=>{const n=s=>{const r=s?.message?.event,i=s?.message?.data;r==="AuthUserConnectToServer"&&e(M(i.connect?i.server:null))};return window.socket.on("receiveMessage",n),()=>{window.socket.off("receiveMessage",n)}},[e])},_e=60*1e3,be=(e,n)=>{const s=v();m.useEffect(()=>{if(!e)return;let r=Date.now();const i=()=>{r=Date.now(),z.getLobbyInfo({id:e}).then(c=>{const l=c?.result==="success"?c.data:null;s(_(ne(l)&&l?.players?.[n]?l:null))})},a=()=>{document.visibilityState==="visible"&&(Date.now()-r<_e||i())};return document.addEventListener("visibilitychange",a),window.addEventListener("online",a),window.socket.on("connect",i),()=>{document.removeEventListener("visibilitychange",a),window.removeEventListener("online",a),window.socket.off("connect",i)}},[s,e,n])},ve=(e,n)=>{const s=v();m.useEffect(()=>{if(!e)return;const r=i=>{if(!(!i||String(i.message.id_lobby)!==String(e))){if(i.message.event==="CustomMatchesRemoveLobby"){s(_(null));return}if(R.general.some(a=>a===i.message.event)){const a=i.message.data,c=a.players&&!a.players[n]||se(a.players_actions,n);s(c?_(null):_(a))}if(R.game.some(a=>a===i.message.event)){const a=i.message.data.merge_status;s(a===15?_(null):_({merge_status:a,server:i.message.data.server}))}}};return window.socket.emit("joinLobby",`custom-matches-lobby-${e}`),window.socket.on("receiveMessage",r),()=>{window.socket.off("receiveMessage",r)}},[e,n,s])},je=e=>{const n=v(),s=e?.is_temporary;m.useEffect(()=>{if(!e?.ip||!e?.port||!s)return;const r=setTimeout(()=>{n(M(null))},B);return()=>clearTimeout(r)},[e?.ip,e?.port,s,n])},Ce=()=>{const e=h(o=>o.auth.steamid64),n=h(o=>o.matches.currentLobby),{currentServer:s}=h(o=>o.auth),r=h(o=>o.root.servers),{currentGame:i,sidebarCollapsed:a}=h(o=>o.root),c=xe(s,r);ye(),ve(n?.id_lobby,e),be(n?.id_lobby,e),je(c);const l=O(n?.match_settings&&!ae(i)?n:null,n?.id_lobby),d=O(c,c?c.ip+":"+c.port:null);return t.jsxs(me,{$collapsed:a,children:[l.item&&t.jsx(fe,{lobby:l.item.data,leaving:l.leaving},l.item.key),d.item&&t.jsx(he,{server:d.item.data,leaving:d.leaving},d.item.key)]})};export{Ce 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.