t2-mapper/docs/assets/ServerBrowser-CZoFV5bl.js

1 line
6.9 KiB
JavaScript
Raw Normal View History

2026-03-13 23:59:01 -07:00
import{r as e}from"./chunk-DECur_0Z.js";import{n as t,r as n,t as r}from"./jsx-runtime-BpGWiA-R.js";import{a as i}from"./SettingsProvider-DlQTXm3x.js";import"./logger-DePRU8Hm.js";import"./traditional-DPdbI9gv.js";import"./mission-CWASMBNZ.js";import{Z as a}from"./index-C2tCa94d.js";var ee=t(),o=e(n(),1),s={Dialog:`_Dialog_tsmc0_1 _Dialog_6c89x_1`,Overlay:`_Overlay_tsmc0_10 _Overlay_6c89x_20`,Header:`_Header_tsmc0_14`,Title:`_Title_tsmc0_22`,HiddenRadio:`_HiddenRadio_tsmc0_31`,RefreshButton:`_RefreshButton_tsmc0_41 _DialogButton_6c89x_31`,ServerCount:`_ServerCount_tsmc0_47`,TableWrapper:`_TableWrapper_tsmc0_52`,Table:`_Table_tsmc0_52`,EmptyServer:`_EmptyServer_tsmc0_104`,Empty:`_Empty_tsmc0_104`,PasswordIcon:`_PasswordIcon_tsmc0_121`,Footer:`_Footer_tsmc0_134`,JoinButton:`_JoinButton_tsmc0_145 _DialogButton_6c89x_31`,CloseButton:`_CloseButton_tsmc0_150 _Secondary_6c89x_70 _DialogButton_6c89x_31`,WarriorField:`_WarriorField_tsmc0_154`,WarriorLabel:`_WarriorLabel_tsmc0_160`,WarriorInput:`_WarriorInput_tsmc0_166`,Hint:`_Hint_tsmc0_186`,Actions:`_Actions_tsmc0_192 _Actions_6c89x_84`},c=r();function l(e){let t=(0,ee.c)(90),{onClose:n}=e,r=a(se),l=a(oe),u=a(ae),d=a(ie),f=a(re),{warriorName:p,setWarriorName:ce}=i(),[m,h]=(0,o.useState)(null),g;t[0]!==f||t[1]!==n||t[2]!==m||t[3]!==p?(g=()=>{m&&(f(m,p),n())},t[0]=f,t[1]=n,t[2]=m,t[3]=p,t[4]=g):g=t[4];let _=g,v;t[5]!==f||t[6]!==n||t[7]!==p?(v=e=>{f(e,p),n()},t[5]=f,t[6]=n,t[7]=p,t[8]=v):v=t[8];let y=v,[b,le]=(0,o.useState)(`ping`),[x,ue]=(0,o.useState)(`asc`),de=(0,o.useRef)(null),S,C;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>{de.current?.focus();try{document.exitPointerLock()}catch{}},C=[],t[9]=S,t[10]=C):(S=t[9],C=t[10]),(0,o.useEffect)(S,C);let w,T;t[11]===d?(w=t[12],T=t[13]):(w=()=>{d()},T=[d],t[11]=d,t[12]=w,t[13]=T),(0,o.useEffect)(w,T);let E,D;t[14]===n?(E=t[15],D=t[16]):(E=()=>{let e=e=>{e.stopPropagation(),e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},D=[n],t[14]=n,t[15]=E,t[16]=D),(0,o.useEffect)(E,D);let O;t[17]===b?O=t[18]:(O=e=>{b===e?ue(ne):(le(e),ue(`desc`))},t[17]=b,t[18]=O);let k=O,A;if(t[19]!==r||t[20]!==x||t[21]!==b){let e;t[23]!==x||t[24]!==b?(e=(e,t)=>{let n=e[b],r=t[b],i=typeof n==`number`&&typeof r==`number`?n-r:String(n).localeCompare(String(r));return x===`asc`?i:-i},t[23]=x,t[24]=b,t[25]=e):e=t[25],A=[...r].sort(e),t[19]=r,t[20]=x,t[21]=b,t[22]=A}else A=t[22];let j=A,M;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,c.jsx)(`h2`,{className:s.Title,children:`Server Browser`}),t[26]=M):M=t[26];let N=r.length===1?``:`s`,P;t[27]!==r.length||t[28]!==N?(P=(0,c.jsxs)(`span`,{className:s.ServerCount,children:[r.length,` server`,N]}),t[27]=r.length,t[28]=N,t[29]=P):P=t[29];let F;t[30]!==d||t[31]!==l?(F=(0,c.jsx)(`button`,{className:s.RefreshButton,onClick:d,disabled:l,children:`Refresh`}),t[30]=d,t[31]=l,t[32]=F):F=t[32];let I;t[33]!==P||t[34]!==F?(I=(0,c.jsxs)(`div`,{className:s.Header,children:[M,P,F]}),t[33]=P,t[34]=F,t[35]=I):I=t[35];let L;t[36]===k?L=t[37]:(L=(0,c.jsx)(`thead`,{children:(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`th`,{onClick:()=>k(`name`),children:`Server Name`}),(0,c.jsx)(`th`,{onClick:()=>k(`playerCount`),children:`Players`}),(0,c.jsx)(`th`,{onClick:()=>k(`ping`),children:`Ping`}),(0,c.jsx)(`th`,{onClick:()=>k(`mapName`),children:`Map`}),(0,c.jsx)(`th`,{onClick:()=>k(`gameType`),children:`Type`}),(0,c.jsx)(`th`,{onClick:()=>k(`mod`),children:`Mod`})]})}),t[36]=k,t[37]=L);let R;if(t[38]!==u||t[39]!==y||t[40]!==n||t[41]!==m||t[42]!==j){let e;t[44]!==u||t[45]!==y||t[46]!==n||t[47]!==m?(e=e=>(0,c.jsxs)(`tr`,{onClick:()=>{h(e.address);let t=document.forms.serverList.elements.serverAddress;Array.from(t).find(t=>t.value===e.address).focus()},onDoubleClick:()=>{h(e.address),y(e.address),n()},children:[(0,c.jsxs)(`td`,{children:[(0,c.jsx)(`input`,{type:`radio`,className:s.HiddenRadio,name:`serverAddress`,value:e.address,checked:m===e.address,onChange:e=>{h(e.target.value)}}),e.passwordRequired&&(0,c.jsx)(`span`,{className:s.PasswordIcon,children:`🔒`}),e.name]}),(